### Install InitiaJS Library (Bash) Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/quickstart Installs the InitiaJS library into the project using npm. ```bash npm add @initia/initia.js ``` -------------------------------- ### Initialize OPinit Bot Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/rollup/opinit-bots Starts the interactive setup process for OPinit Bots. This command guides users through selecting the bot type (executor or challenger), configuring necessary keys, and setting up the bot's configuration. ```bash weave opinit init ``` -------------------------------- ### Initialize Initia Node Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/initia-node Command to start the node setup process, guiding from an empty directory to a fully synced node. ```bash weave initia init ``` -------------------------------- ### Initialize Weave CLI Project Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Starts the initial setup process for a new Weave project. This command guides the user through configuring essential components like the Gas Station and infrastructure. ```bash weave init ``` -------------------------------- ### Project Setup Commands Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/evm/creating-erc20s/creating-standard-erc20s Initializes a new project directory and installs the Viem package for interacting with EVM networks. This sets up the foundational environment for the tutorial. ```sh mkdir erc20-factory cd erc20-factory npm init npm install viem mkdir src mkdir abis ``` -------------------------------- ### Run Installation Test Script (Bash) Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/quickstart Executes the TypeScript script using ts-node to verify the InitiaJS installation. ```bash npx ts-node src/quickstart.ts ``` -------------------------------- ### Initialize Node.js Project with TypeScript (Bash) Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/quickstart Initializes a new Node.js project, installs TypeScript and related types, configures TypeScript, creates a source directory, and adds a basic TypeScript file. ```bash npm init && npm add -D typescript @types/node ts-node && npx tsc --init && mkdir src && echo 'async function example() { console.log("Running example!")}; example()' > src/quickstart.ts ``` -------------------------------- ### Build and Install Weave CLI from Source Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Builds the Weave CLI from its source code repository. This method involves cloning the repository, checking out the latest version tag, and using `make install`. ```bash git clone https://github.com/initia-labs/weave.git cd weave VERSION=$(curl -s https://api.github.com/repos/initia-labs/weave/releases/latest | grep "tag_name:" | cut -d'"' -f4 | cut -c 2-) git checkout tags/v$VERSION make install ``` -------------------------------- ### Install and Verify Initia CLI Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/initiad-cli/introduction Instructions for cloning the Initia repository, checking out a specific version, installing the CLI tool using 'make install', and verifying the installation by running the 'initiad version' command. ```bash export VERSION=v0.5.7 git clone https://github.com/initia-labs/initia.git cd initia git checkout $VERSION make install ``` ```bash initiad version # v0.5.7 ``` -------------------------------- ### Show All Weave CLI Commands Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Displays a help message listing all available commands and their brief descriptions for the Weave CLI. This is useful for exploring the tool's capabilities. ```bash weave --help ``` -------------------------------- ### Test InitiaJS Installation with TypeScript Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/quickstart Replaces the content of `src/quickstart.ts` with code that initializes a RESTClient and fetches the chain ID. ```typescript import { RESTClient, Coin } from '@initia/initia.js'; const restClient = new RESTClient('https://rest.testnet.initia.xyz'); (async () => { const chainId = await restClient.tendermint.chainId(); console.log(chainId); })(); ``` -------------------------------- ### OPInit Challenger Bot Log Output Example Source: https://docs.initia.xyz/nodes-and-rollups/deploying-rollups/deploy An example of the terminal output when the OPInit Challenger bot is running. It shows log messages related to its initialization, bridge information, and node setup. ```log Streaming logs from launchd com.opinitd.challenger.daemon 2025-02-11T17:31:59.060+0700 INFO challenger challenger/challenger.go:94 bridge info {"id": 659, "submission_interval": 60} 2025-02-11T17:31:59.200+0700 INFO challenger node/node.go:118 initialize height 2025-02-11T17:31:59.346+0700 INFO challenger node/node.go:118 initialize height 2025-02-11T17:31:59.347+0700 INFO challenger host/host.go:88 host start {"height": 5315486} ``` -------------------------------- ### Install Build Essentials and Go Source: https://docs.initia.xyz/nodes-and-rollups/running-nodes/running-l1-nodes/l1-nodes-initiad Installs essential build tools and the Go programming language, which are prerequisites for compiling the Initia node from source. Requires root privileges. ```bash sudo apt install -y build-essential ``` ```bash sudo apt install -y golang ``` -------------------------------- ### Start OPInit Executor Bot Source: https://docs.initia.xyz/nodes-and-rollups/deploying-rollups/deploy This section details the command to start the OPInit Executor bot after its configuration is complete. It shows the command to run and provides an example of the expected log output indicating the bot is operational. ```shell weave opinit start executor ``` -------------------------------- ### Download and Install Weave CLI for Linux (ARM64) Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Downloads the latest Weave CLI binary for Linux ARM64 architecture using wget. It fetches the latest version tag from GitHub, downloads the tarball, and extracts it. ```bash VERSION=$(curl -s https://api.github.com/repos/initia-labs/weave/releases/latest | grep "tag_name:" | cut -d'"' -f4 | cut -c 2-) wget https://github.com/initia-labs/weave/releases/download/v$VERSION/weave-$VERSION-linux-arm64.tar.gz tar -xvf weave-$VERSION-linux-arm64.tar.gz ``` -------------------------------- ### Install Minitiad CLI for EVM Source: https://docs.initia.xyz/developers/developer-guides/integrating-initia-apps/vip/integrate-vip Installs the Minitiad CLI for EVM compatibility. This involves cloning the minievm repository, checking out the specific version matching the rollup, and building the installation. Ensure the MINIEVM_VERSION is set correctly. ```bash export MINIEVM_VERSION=1.1.7 # Replace with your rollup's version git clone https://github.com/initia-labs/minievm.git cd minievm git checkout $MINIEVM_VERSION make install ``` -------------------------------- ### VM-Agnostic Query Examples Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/querying-data Provides examples for common VM-agnostic queries using the RESTClient. These include fetching account balances, block information, transaction details, and oracle prices. ```APIDOC RESTClient Methods: // Query account balance // Parameters: // address: The account address to query. // pagination: Optional pagination parameters (e.g., {'pagination.key': nextKey}). // Returns: A tuple containing an array of Coin objects and pagination info. // Example: // const balances = await restClient.bank.balance('init14l3c2vxrdvu6y0sqykppey930s4kufsvt97aeu'); // Query block information // Parameters: // height: Optional block height. If not provided, the latest block is returned. // Returns: Block information object. // Example: // const blockInfo = await restClient.tendermint.blockInfo(10000); // Query transaction information // Parameters: // txHash: The hash of the transaction to query. // Returns: Transaction information object. // Example: // const txInfo = await restClient.tx.txInfo('6DFEE8E4BFC38341E8AADBD74A23588D8DE94FA38052CB5721DDA780A24F8B1D'); // Query oracle price // Parameters: // currencyPair: An object defining the currency pair (e.g., new CurrencyPair('BTC', 'USD')). // Returns: The price of the specified currency pair. // Example: // const currenyPair = new CurrencyPair('BTC', 'USD'); // const price = await restClient.oracle.price(currenyPair); ``` -------------------------------- ### Initialize Coin with InitiaJS Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/movevm/creating-move-coin Provides a TypeScript example using the InitiaJS library to initialize a managed coin. It outlines the setup for RESTClient, Wallet, and constructing the MsgExecute transaction for coin initialization. ```ts import { bcs, RESTClient, MnemonicKey, MsgExecute, Wallet, } from '@initia/initia.js'; async function createCoin() { const restClient = new RESTClient('https://rest.testnet.initia.xyz', { gasPrices: '0.015uinit', gasAdjustment: '1.5', }); const key = new MnemonicKey({ mnemonic: 'beauty sniff protect ...', }); const wallet = new Wallet(restClient, key); const msgs = [ new MsgExecute( key.accAddress, '0x1', 'managed_coin', 'initialize', [], [ // max supply, if you want to set max supply, insert number instaed of null bcs.option(bcs.u128()).serialize(null).toBase64(), bcs.string().serialize('my_coin').toBase64(), // name bcs.string().serialize('MYCOIN').toBase64(), // symbol // decimal point (raw value 1 consider to 10 ** (- decimalPoint)) bcs.u8().serialize(6).toBase64(), bcs.string().serialize('').toBase64(), // icon uri bcs.string().serialize('').toBase64(), // project uri ] ), ]; // sign tx const signedTx = await wallet.createAndSignTx({ msgs }); // send(broadcast) tx restClient.tx.broadcastSync(signedTx).then(res => console.log(res)); // { // height: 0, // txhash: '40E0D5633D37E207B2463D275F5B479FC67D545B666C37DC7B121ED551FA18FC', // raw_log: '[]' // } } createCoin(); ``` -------------------------------- ### Install InitiaJS SDK using npm Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/introduction This command installs the InitiaJS library, a TypeScript SDK for interacting with the Initia L1 and rollups, using npm. It is a prerequisite for using the library in your project. ```bash npm install @initia/initia.js ``` -------------------------------- ### Install Initia EVM Contracts (Shell) Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/evm/connect-oracles Installs the required Initia EVM contracts dependency using Foundry's package manager. This command fetches and integrates the necessary smart contracts for the tutorial. ```sh forge install initia-labs/initia-evm-contracts ``` -------------------------------- ### Project Setup: Initialize Project and Files Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/evm/cosmos-coin-to-erc20 Commands to create a new project directory, initialize npm, and create the main JavaScript file. These steps set up the basic environment for the tutorial. ```sh mkdir cosmos-coin-to-erc20 cd cosmos-coin-to-erc20 npm init touch src/index.js ``` -------------------------------- ### Create Project Directory (Bash) Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/quickstart Creates a new directory for the project and navigates into it using bash commands. ```bash mkdir initia-js-quickstart && cd initia-js-quickstart ``` -------------------------------- ### Install Weave CLI via Homebrew (macOS) Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Installs the Weave CLI using the Homebrew package manager on macOS. This is the recommended method for macOS users for straightforward installation and updates. ```bash brew install initia-labs/tap/weave ``` -------------------------------- ### Verify Weave CLI Installation Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Checks if the Weave CLI has been installed correctly by displaying its version. This command confirms that the binary is accessible and executable. ```bash weave version ``` -------------------------------- ### InitiaJS Project Dependencies Source: https://docs.initia.xyz/developers/developer-guides/integrating-initia-apps/initiadex Lists the npm packages required to run the InitiaJS example script for liquidity provision and delegation. ```bash npm install @initia/initia.js @initia/initia.proto @noble/hashes @cosmjs/encoding bluebird ``` -------------------------------- ### Setup Project Directory (Shell) Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/evm/connect-oracles Creates a new directory named 'connect-oracle' and then changes the current working directory into it. This is the initial step for setting up a new project. ```sh mkdir connect-oracle cd connect-oracle ``` -------------------------------- ### Clone Initia Tutorials Repository Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/initiad-cli/transactions Clones the official initia-tutorials repository from GitHub, which contains example Move modules like 'read_write' for development. ```bash git clone git@github.com:initia-labs/initia-tutorials.git ``` -------------------------------- ### Download and Install Weave CLI for Linux (AMD64) Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Downloads the latest Weave CLI binary for Linux AMD64 architecture using wget. It fetches the latest version tag from GitHub, downloads the tarball, and extracts it. ```bash VERSION=$(curl -s https://api.github.com/repos/initia-labs/weave/releases/latest | grep "tag_name:" | cut -d'"' -f4 | cut -c 2-) wget https://github.com/initia-labs/weave/releases/download/v$VERSION/weave-$VERSION-linux-amd64.tar.gz tar -xvf weave-$VERSION-linux-amd64.tar.gz ``` -------------------------------- ### Project Setup Commands Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/evm/address-conversion Commands to set up a new Node.js project and install the necessary bech32-converting package. ```sh mkdir address-conversion cd address-conversion npm init npm install bech32-converting ``` -------------------------------- ### Initialize Challenger Bot with Config and New Key Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/rollup/opinit-bots Sets up the Challenger bot using a configuration file and generates new cryptographic keys. This method automates the setup and key generation process. ```bash weave opinit init challenger --with-config --generate-key-file ``` -------------------------------- ### Disable Weave CLI Usage Analytics Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/installation Opt-out of the default behavior where Weave collects non-identifiable usage data. This command disables data collection to enhance user privacy. ```bash weave analytics disable ``` -------------------------------- ### InitiaJS Liquidity Provision and Delegation Example Source: https://docs.initia.xyz/developers/developer-guides/integrating-initia-apps/initiadex Demonstrates creating a pair, providing liquidity, whitelisting LP tokens, delegating LP tokens to a validator, and withdrawing rewards using InitiaJS. Requires specific npm packages and a local Initia node running on http://localhost:1317. ```typescript // NOTE: In this example, we use the same mnemonic for both user and validator. // The reason is that we want to simplify the example. // This will make it easier to whitelist during the proposal. // It takes a bit of time to whitelist, so you can skip this step 3 and do it manually. // Some possible errors: // location=0000000000000000000000000000000000000000000000000000000000000001::object, code=524289 -> The object (pair) is already created, skip step 1 // location=0000000000000000000000000000000000000000000000000000000000000001::object, code=393218 -> The object (pair) is not created yet, retry step 1 import { AccAddress, bcs, RESTClient, MnemonicKey, MsgDelegate, MsgExecute, MsgSubmitProposal, MsgVote, MsgWhitelist, MsgWithdrawDelegatorReward, Wallet } from "@initia/initia.js" import { ProposalStatus, VoteOption } from "@initia/initia.proto/cosmos/gov/v1/gov" import { delay } from "bluebird" import { sha3_256 } from "@noble/hashes/sha3"; import { concatBytes, toBytes } from "@noble/hashes/utils"; import { toHex } from "@cosmjs/encoding" import { MsgUndelegate } from "vm/move/msgs/staking"; const user = new Wallet( new RESTClient('http://localhost:1317', { gasPrices: '0.015uinit', gasAdjustment: '1.75' }), new MnemonicKey({ // TODO: put your mnemonic here mnemonic: 'mimic exist actress ...' }) ) const validator = new Wallet( new RESTClient('http://localhost:1317', { gasPrices: '0.015uinit', gasAdjustment: '1.75' }), new MnemonicKey({ // TODO: put your mnemonic here mnemonic: 'mimic exist actress ...' }) ) function coinMetadata(creator: string, symbol: string) { const OBJECT_FROM_SEED_ADDRESS_SCHEME = 0xfe const addrBytes = bcs.address().serialize(creator).toBytes() const seed = toBytes(symbol) const bytes = new Uint8Array([...concatBytes(addrBytes, seed), OBJECT_FROM_SEED_ADDRESS_SCHEME]) const sum = sha3_256.create().update(bytes).digest() return toHex(sum) } async function getLastProposalId(restClient: RESTClient): Promise { const [proposals, pagination] = await restClient.gov.proposals() if (proposals.length === 0) return 0 return proposals[proposals.length - 1].id } async function getProposalStatus(restClient: RESTClient, proposalId: number): Promise { const proposal = await restClient.gov.proposal(proposalId) return proposal ? proposal.status : null } async function checkProposalPassed(restClient: RESTClient, proposalId: number): Promise { for (;;) { console.log(`checking proposal ${proposalId} status... in ${restClient.URL}/cosmos/gov/v1/proposals/${proposalId}`) const status = await getProposalStatus(restClient, proposalId) if (status === ProposalStatus.PROPOSAL_STATUS_PASSED) return if (status === ProposalStatus.PROPOSAL_STATUS_REJECTED) throw new Error(`proposal ${proposalId} rejected`) if (status === ProposalStatus.PROPOSAL_STATUS_FAILED) throw new Error(`proposal ${proposalId} failed`) await delay(5_000) } } async function provideLiquidity( lp_metadata: string, coin_a_amount: number, coin_b_amount: number, min_liquidity: number | null ) { const msg = new MsgExecute( user.key.accAddress, '0x1', 'dex', 'provide_liquidity_script', [], [ bcs.string().serialize(lp_metadata).toBase64(), bcs.u64().serialize(coin_a_amount).toBase64(), bcs.u64().serialize(coin_b_amount).toBase64(), bcs.option(bcs.u64()).serialize(min_liquidity).toBase64() ] ) const signedTx = await user.createAndSignTx({ msgs: [msg] }) await user.rest.tx.broadcast(signedTx).catch(console.log) } async function createPairScript( sender: Wallet, name: string, symbol: string, swap_fee_rate: number, coin_a_weight: number, coin_b_weight: number, coin_a_metadata: string, coin_b_metadata: string, coin_a_amount: number, coin_b_amount: number ) { const msg = new MsgExecute( sender.key.accAddress, '0x1', 'dex', 'create_pair_script', [], [ bcs.string().serialize(name).toBase64(), ``` -------------------------------- ### Initialize IBC Relayer with Weave Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/rollup/relayer Guides the user through the initial setup of the IBC relayer. It covers configuring networks and channels between Initia L1 and rollups, and setting up the necessary accounts for relaying messages. Users can choose between configuring for whitelisted rollups, using artifacts from `weave rollup launch`, or manual configuration. ```bash weave relayer init ``` -------------------------------- ### Execute Swap via InitiaJS Source: https://docs.initia.xyz/developers/developer-guides/integrating-initia-apps/initiadex Demonstrates executing the `swap_script` Move entry function using the InitiaJS SDK. It covers wallet setup, creating a `MsgExecute` transaction with BCS serialized arguments, signing, and broadcasting. ```typescript import { bcs, RESTClient, MnemonicKey, MsgExecute, Wallet, } from '@initia/initia.js'; async function main() { const restClient = new RESTClient('https://rest.testnet.initia.xyz', { gasPrices: '0.015uinit', gasAdjustment: '1.5', }); const key = new MnemonicKey({ mnemonic: 'beauty sniff protect ...', }); const wallet = new Wallet(restClient, key); const msgs = [ new MsgExecute( key.accAddress, '0x1', 'dex', 'swap_script', [], [ bcs.object().serialize('0x...'), // pair object bcs.object().serialize('0x...'), // offer asset metadata bcs.u64().serialize(100000000), // offer amount bcs.option(bcs.u64()).serialize(100000000), // min return amount ].map(v => v.toBase64()) ), ]; // sign tx const signedTx = await wallet.createAndSignTx({ msgs }); // send(broadcast) tx restClient.tx.broadcastSync(signedTx).then(res => console.log(res)); } ``` -------------------------------- ### Setup Viem Clients and Imports for ERC20Factory Source: https://docs.initia.xyz/developers/developer-guides/vm-specific-tutorials/evm/creating-erc20s/creating-standard-erc20s Imports necessary modules from Viem and local files, defines private key and factory address, and initializes public and wallet clients for contract interaction. ```js const { createPublicClient, createWalletClient, decodeEventLog, getContract, http } = require('viem'); const { privateKeyToAccount } = require('viem/accounts'); const erc20Abi = require('./abis/erc20Abi.json'); const erc20FactoryAbi = require('./abis/erc20factoryabi.json'); const miniEVM = require('./chain'); const privateKey = process.env.PRIVATE_KEY; // Load from environment variable const erc20FactoryAddress = process.env.ERC20_FACTORY_ADDRESS; // Load from environment variable // Create an account from the private key const account = privateKeyToAccount(privateKey); // Create a wallet client const client = createWalletClient({ account, chain: miniEVM, transport: http(), }); // create a public client const publicClient = createPublicClient({ chain: miniEVM, transport: http(), }); ``` -------------------------------- ### Sign and Broadcast Initia Transaction Offline Source: https://docs.initia.xyz/developers/developer-guides/tools/sdks/initia-js/transactions/signing-transactions This snippet demonstrates signing a transaction offline using a mnemonic and broadcasting it to the Initia network. It utilizes the initia.js library for client setup, wallet management, message creation, fee calculation, and transaction signing. The example also includes a helper function to generate a transaction hash. ```typescript import { Coins, Fee, RESTClient, MnemonicKey, MsgSend, Wallet, } from '@initia/initia.js'; import crypto from 'crypto'; const mnemonic = process.env.MNEMONIC; const chainId = process.env.CHAIN_ID || "initiation-2"; const restUrl = process.env.REST_URL || "https://rest.testnet.initia.xyz"; const gasPrices = process.env.GAS_PRICES || "0.015uinit"; // Will be INIT for mainnet export function getTxHash(tx: Uint8Array): string { const s256Buffer = crypto .createHash(`sha256`) .update(Buffer.from(tx)) .digest(); const txbytes = new Uint8Array(s256Buffer); return Buffer.from(txbytes.slice(0, 32)).toString(`hex`).toUpperCase(); } async function offlineSingingTest() { // rest client that is not connected const offlineRestClient = new RESTClient(``, { chainId: chainId, gasPrices: gasPrices, }); // rest client that is connected const onlineRestClient = new RESTClient(restUrl, { chainId: chainId, gasPrices: gasPrices, }); // set up key const key = new MnemonicKey({ mnemonic: mnemonic, }); const account = await onlineRestClient.auth.accountInfo(key.accAddress); // you have to know account number and current sequence const wallet = new Wallet(offlineRestClient, key); // msg to send const msg = new MsgSend(key.accAddress, key.accAddress, '100uinit'); // use fixed fee to not estimate gas const gasLimit = 500000; const feeAmount = new Coins(offlineRestClient.config.gasPrices) .toArray()[0] .mul(gasLimit); const fee = new Fee(gasLimit, new Coins([feeAmount])); const signedTx = await wallet.createAndSignTx({ msgs: [msg], accountNumber: account.getAccountNumber(), sequence: account.getSequenceNumber(), fee, }); const signedTxBytes = signedTx.toBytes(); const txHash = getTxHash(signedTxBytes); const broadcastRes = await onlineRestClient.tx.broadcastSync(signedTx); // true console.log(txHash === broadcastRes.txhash); } offlineSingingTest(); ``` -------------------------------- ### Verify Go and Make Versions Source: https://docs.initia.xyz/nodes-and-rollups/running-nodes/running-l1-nodes/l1-nodes-initiad Checks if the installed versions of `make` and `go` meet the minimum requirements (make >= 3.8, go >= 1.22) for building the Initia node from source. ```bash make --version ``` ```bash go version ``` -------------------------------- ### Execute Swap via CLI Source: https://docs.initia.xyz/developers/developer-guides/integrating-initia-apps/initiadex Illustrates how to execute the `swap_script` Move entry function using the `initiad tx move execute` command. It includes arguments for pair, offer coin, amounts, and transaction fee parameters. ```bash initiad tx move execute 0x1 dex swap_script \ --args '["object:0x...", "object:0x...", "u64:100", "option:100"]' \ --from [key-name] \ --gas auto --gas-adjustment 1.5 --gas-prices 0.015uinit \ --node [rpc-url]:[rpc-port] --chain-id [chain-id] ``` -------------------------------- ### Start L1 Node Source: https://docs.initia.xyz/nodes-and-rollups/running-nodes/running-l1-nodes/l1-nodes-weave Starts the initialized L1 node using the `weave initia start` command. Successful execution will show logs from Cosmovisor and the node's services. ```sh weave initia start ``` -------------------------------- ### Enable and Start Initiad Systemd Service Source: https://docs.initia.xyz/nodes-and-rollups/running-nodes/running-l1-nodes/l1-nodes-initiad Commands to enable the Initiad service to start automatically on system boot and to start the service immediately. These are standard systemd commands for managing services. ```bash systemctl enable initiad systemctl start initiad ``` -------------------------------- ### Start the IBC Relayer Source: https://docs.initia.xyz/nodes-and-rollups/deploying-rollups/deploy Starts the initialized IBC Relayer Bot. Once started, the relayer will begin processing IBC messages, updating clients, and streaming logs, ensuring communication between your rollup and the Initia L1 network. ```sh weave relayer start ``` ```sh Updating IBC client: 07-tendermint-1 of network: demo-314 Successfully updated IBC client: 07-tendermint-1 of network: demo-314 Updating IBC client: 07-tendermint-0 of network: demo-314 wSuccessfully updated IBC client: 07-tendermint-0 of network: demo-314 Streaming logs from launchd com.hermes.daemon 2025-02-11T10:36:06.546411Z INFO ThreadId(01) using default configuration from '/Users/tansawit/.hermes/config.toml' 2025-02-11T10:36:06.547351Z INFO ThreadId(01) running Hermes v1.10.4+542e14f 2025-02-11T10:36:06.749253Z INFO ThreadId(16) REST service running, exposing REST API at http://127.0.0.1:7010 ``` -------------------------------- ### Simulate Swap via InitiaJS Source: https://docs.initia.xyz/developers/developer-guides/integrating-initia-apps/initiadex Provides an example of using the InitiaJS SDK to call the `get_swap_simulation` view function. It demonstrates initializing the REST client and serializing arguments using BCS for the API call. ```typescript import { RESTClient, bcs } from '@initia/initia.js'; const restClient = new RESTClient('https://rest.testnet.initia.xyz', { gasPrices: '0.015uinit', gasAdjustment: '1.5', }); restClient.move .view( '0x1', 'dex', 'get_swap_simulation', [], [ bcs.object().serialize('0x...').toBase64(), bcs.object().serialize('0x...').toBase64(), bcs.u64().serialize(100).toBase64(), ] ) .then(console.log); ``` -------------------------------- ### Start IBC Relayer with Weave Source: https://docs.initia.xyz/developers/developer-guides/tools/clis/weave-cli/rollup/relayer Starts the configured IBC relayer. This command can run the relayer in the background using the `--detach` flag and control whether IBC clients are updated before starting with the `--update-client` flag. Relayer requires funds if the connected rollup is not in the fee whitelist. ```bash weave relayer start weave relayer start -d weave relayer start --update-client false ```