### Install and Use create-interchain-app Source: https://github.com/hyperweb-io/interchainjs/blob/main/README.md Use this command-line tool to quickly set up a new InterchainJS project with example configurations, such as the authz example. ```bash npm install -g create-interchain-app cia --example authz ``` -------------------------------- ### Setup Starship and Dependencies Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/starship/index.mdx Installs necessary dependencies like kubectl, kind, and helm, and fetches Starship's helm charts. Run this command to prepare your system for Starship. ```sh yarn starship setup ``` -------------------------------- ### Start Starship Source: https://github.com/hyperweb-io/interchainjs/blob/main/networks/cosmos/starship/README.md Starts the Starship environment using a configuration file for the genesis setup. Spin-up time may vary based on local machine resources. ```bash pnpm starship:all # or pnpm starship start ``` -------------------------------- ### Start Starship Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/ethereum/starship/index.mdx Starts the Starship environment using the configuration file `configs/config.yaml` as the genesis file. Spinup may take time; monitor progress with `kubectl get pods`. ```bash yarn starship:all # or yarn starship start ``` -------------------------------- ### Install Dependencies and Build Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Run these commands when first cloning the repository to install dependencies and build the project for development. ```shell yarn yarn build:dev ``` -------------------------------- ### Install @interchainjs/solana Source: https://github.com/hyperweb-io/interchainjs/blob/main/networks/solana/README.md Install the SDK using npm. ```bash npm install @interchainjs/solana ``` -------------------------------- ### Install Dependencies Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md Run these commands when first cloning the repository to install dependencies and build the project in development mode. ```shell pnpm install pnpm run build:dev ``` -------------------------------- ### Install InterchainJS with npm Source: https://github.com/hyperweb-io/interchainjs/blob/main/README.md Install the core interchainjs library and the Cosmos adapter using npm. Ensure you have npm installed. ```bash npm i interchainjs npm i @interchainjs/cosmos ``` -------------------------------- ### Start Local Solana Testnet Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/starship/index.mdx Run this command from the networks/solana directory to start the local testnet. ```bash pnpm run starship:start ``` -------------------------------- ### Install @interchainjs/ethereum Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/ethereum/index.mdx Install the package using npm. This is the first step to using the Ethereum client. ```sh npm install @interchainjs/ethereum ``` -------------------------------- ### Start Starship (Alternative) Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/cosmos/starship/index.mdx An alternative command to start Starship and create the mini-cosmos ecosystem. It uses the `configs/config.yaml` file as the genesis configuration. ```bash yarn starship start ``` -------------------------------- ### Install InterchainJS with pnpm Source: https://github.com/hyperweb-io/interchainjs/blob/main/README.md Install the core interchainjs library and the Cosmos adapter using pnpm. Ensure you have pnpm installed. ```bash pnpm add interchainjs pnpm add @interchainjs/cosmos ``` -------------------------------- ### Install Dependencies Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-vue/README.md Installs project dependencies using pnpm. This is typically the first step when cloning the repository. ```shell pnpm install ``` -------------------------------- ### Import Query Helper Example Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Shows how to import a specific query helper function for the staking module. ```javascript import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; ``` -------------------------------- ### Quick Start with Cosmos Signer Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/tutorial.md Demonstrates creating a wallet from a mnemonic, initializing a DirectSigner for Cosmos, and signing/broadcasting a transaction. ```typescript import { DirectSigner } from '@interchainjs/cosmos'; import { Secp256k1HDWallet } from '@interchainjs/cosmos'; import { HDPath } from '@interchainjs/types'; // Create wallet from mnemonic const wallet = await Secp256k1HDWallet.fromMnemonic( "your twelve word mnemonic phrase here", { derivations: [{ prefix: "cosmos", hdPath: HDPath.cosmos(0, 0, 0).toString(), }] } ); // Create signer const signer = new DirectSigner(wallet, { chainId: 'cosmoshub-4', queryClient: queryClient, addressPrefix: 'cosmos' }); // Sign and broadcast transaction const result = await signer.signAndBroadcast({ messages: [/* your messages */], fee: { amount: [{ denom: 'uatom', amount: '1000' }], gas: '200000' } }); ``` -------------------------------- ### Usage Example for Custom Network Signer Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/tutorial.md Demonstrates how to instantiate and use the `CustomNetworkSigner` with a wallet and custom query client. This example shows creating a wallet from a mnemonic and signing/broadcasting a transaction. ```typescript import { Secp256k1HDWallet } from '@interchainjs/auth'; // Create wallet for your custom network const wallet = await Secp256k1HDWallet.fromMnemonic( "your mnemonic phrase", { derivations: [{ prefix: "custom", hdPath: "m/44'/999'/0'/0/0", // Use your network's coin type }] } ); // Create custom signer const signer = new CustomNetworkSigner(wallet, { chainId: 'custom-network-1', queryClient: customQueryClient, // Add other network-specific configuration }); // Use the signer const result = await signer.signAndBroadcast({ messages: [ { type: 'custom/MsgTransfer', value: { from: 'custom1...', to: 'custom1...', amount: '1000000' } } ], fee: { amount: '1000', gas: '200000' } }); console.log('Transaction hash:', result.transactionHash); ``` -------------------------------- ### Install InjectiveJS Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injectivejs/README.md Install the InjectiveJS library using npm. ```sh npm install injectivejs ``` -------------------------------- ### Install InterchainJS and Cosmos Adapter Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/index.mdx Install the core interchainjs library along with the Cosmos network adapter using Yarn or npm. ```bash yarn add interchainjs yarn add @interchainjs/cosmos ``` ```bash npm i interchainjs npm i @interchainjs/cosmos ``` -------------------------------- ### Keplr + DirectSigner (Cosmos) Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/config-and-custom-cosmos-signers.md Integrate Keplr with DirectSigner for standard Cosmos chains. This example shows how to enable Keplr, get an offline signer, create a DirectSigner, register message encoders, and send a transaction. ```typescript import { DirectSigner, createCosmosQueryClient, toEncoders } from '@interchainjs/cosmos'; import { MsgSend } from 'interchainjs'; import { send } from 'interchainjs'; await window.keplr.enable(chainId); const offlineSigner = window.keplr.getOfflineSigner(chainId); const queryClient = await createCosmosQueryClient(rpc); const signer = new DirectSigner(offlineSigner, { queryClient, chainId, addressPrefix: 'cosmos' }); signer.addEncoders(toEncoders(MsgSend)); const [{ address }] = await signer.getAccounts(); const fee = { amount: [{ denom: 'uatom', amount: '5000' }], gas: '200000' }; const msg = { fromAddress: address, toAddress: dest, amount: [{ denom: 'uatom', amount: '1000' }] }; const res = await send(signer, address, msg, fee, 'demo'); await res.wait(); console.log(res.transactionHash); ``` -------------------------------- ### Install injective-react Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md Install the injective-react library using npm. ```sh npm install injective-react ``` -------------------------------- ### Install @interchainjs/cosmos Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/cosmos/index.mdx Install the package using npm. ```sh npm install @interchainjs/cosmos ``` -------------------------------- ### Example Workflow Plugins Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/network-implementation-guide.md Provides concrete examples of plugins for different transaction building steps, including input validation, message encoding, and signature generation. ```typescript // Example plugins for different transaction building steps class InputValidationPlugin extends BaseWorkflowPlugin { async execute(context: TContext): Promise { // Validate transaction inputs (messages, fees, etc.) const inputs = context.getInputs(); this.validateInputs(inputs); context.setValidatedInputs(inputs); } } class MessageEncodingPlugin extends BaseWorkflowPlugin { constructor() { super(['input-validation'], 'message-encoding'); } async execute(context: TContext): Promise { // Encode messages according to network protocol const messages = context.getValidatedInputs().messages; const encodedMessages = await this.encodeMessages(messages); context.setEncodedMessages(encodedMessages); } } class SignaturePlugin extends BaseWorkflowPlugin { constructor() { super(['message-encoding', 'fee-calculation'], 'signature'); } async execute(context: TContext): Promise { // Generate signature using appropriate signing method const signDoc = context.getSignDocument(); const signer = context.getSigner(); const signature = await signer.sign(signDoc); context.setSignature(signature); } } ``` -------------------------------- ### Start Starship (Alternative) Source: https://github.com/hyperweb-io/interchainjs/blob/main/networks/ethereum/starship/README.md An alternative command to start the Starship environment. It uses the `configs/config.yaml` file as the genesis file to define the e2e test infrastructure topology. ```bash pnpm starship start ``` -------------------------------- ### Setup and Deploy Starship Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/interchainjs/starship/README.md Commands to set up Helm/Starship, perform a sanity check, deploy Starship, and monitor its status. ```sh pnpm starship setup pnpm starship get-pods pnpm starship deploy pnpm starship wait-for-pods or watch pnpm starship get-pods pnpm starship start-ports pnpm starship port-pids ``` -------------------------------- ### Import Transaction Helper Example Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Shows how to import a specific transaction helper function for the staking module. ```javascript import { createDelegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; ``` -------------------------------- ### Install InterchainJS Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Install the InterchainJS package using npm. ```sh npm install interchainjs ``` -------------------------------- ### DirectSigner with IWallet Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/signer.md Example of creating a DirectSigner instance using a wallet derived from a mnemonic. ```APIDOC ## DirectSigner with IWallet ### Description This example demonstrates how to initialize a `DirectSigner` using a wallet created from a mnemonic phrase. It shows the process of loading the wallet and then instantiating the signer with necessary chain and query client configurations. ### Usage ```typescript import { DirectSigner } from '@interchainjs/cosmos'; import { Secp256k1HDWallet } from '@interchainjs/cosmos/wallets/secp256k1hd'; import { HDPath } from '@interchainjs/types'; // Create wallet from mnemonic const wallet = await Secp256k1HDWallet.fromMnemonic( "", [{ prefix: "cosmos", hdPath: HDPath.cosmos(0, 0, 0).toString(), // m/44'/118'/0'/0/0 }] ); // Create signer with wallet const signer = new DirectSigner(wallet, { chainId: 'cosmoshub-4', queryClient: queryClient, // Assume queryClient is defined elsewhere addressPrefix: 'cosmos' }); ``` ``` -------------------------------- ### Install Starship Dependencies Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/interchainjs/starship/README.md A command to automatically check and install necessary dependencies for running e2e tests with Starship, and fetch its Helm charts. ```bash pnpm starship setup ``` -------------------------------- ### Create Cosmos RPC Client Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Example of creating an RPC client to query data from a Cosmos-based blockchain using a tree-shakable helper. ```javascript import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; { getRpcEndpoint } = useChain("cosmoshub"); const endpoint = await getRpcEndpoint(); // now you can query the cosmos modules const balance = await getAllBalances(endpoint,{ address: "cosmos1addresshere", }); ``` -------------------------------- ### Basic Ethereum Signer Setup Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/ethereum/src/signers/index.mdx Demonstrates how to initialize LegacyEthereumSigner and EIP1559EthereumSigner with a wallet and query client. Optionally configure a gas multiplier for transaction fees. ```typescript import { LegacyEthereumSigner, EIP1559EthereumSigner, EthereumQueryClient } from '@interchainjs/ethereum'; import { Secp256k1HDWallet } from '@interchainjs/ethereum/wallets'; // Create wallet from private key const wallet = Secp256k1HDWallet.fromPrivateKey('0x...'); // Or create from mnemonic const wallet = Secp256k1HDWallet.fromMnemonic('your mnemonic phrase here'); // Create query client const queryClient = new EthereumQueryClient(rpcClient, protocolAdapter); // Create signers const legacySigner = new LegacyEthereumSigner(wallet, { queryClient, gasMultiplier: 1.2 // optional: 20% gas buffer }); const eip1559Signer = new EIP1559EthereumSigner(wallet, { queryClient, gasMultiplier: 1.2 }); ``` -------------------------------- ### Browser Solana Transaction with Phantom Wallet Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/index.mdx Example of sending tokens in a browser environment using the Phantom wallet. It checks for Phantom installation, connects to the wallet, and uses a signing client to send tokens. ```typescript import { Connection, PublicKey, Transaction, PhantomSigner, PhantomSigningClient, isPhantomInstalled, MAINNET_ENDPOINT } from '@interchainjs/solana'; // Check if Phantom wallet is installed if (!isPhantomInstalled()) { console.error('Phantom wallet not installed'); return; } // Connect to Phantom wallet const phantomSigner = new PhantomSigner(); await phantomSigner.connect(); // Create signing client const connection = new Connection(MAINNET_ENDPOINT); const client = new PhantomSigningClient(connection, phantomSigner); // Get wallet address const walletAddress = phantomSigner.getPublicKey(); console.log('Wallet address:', walletAddress.toString()); // Send transaction through Phantom const recipient = new PublicKey('11111111111111111111111111111112'); const result = await client.sendTokens(walletAddress, recipient, 0.1); console.log('Transaction result:', result); ``` -------------------------------- ### Basic Cosmos Direct Signer Example Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Demonstrates creating a DirectSigner for Cosmos networks using a mnemonic. It shows minimal configuration with queryClient, chainId, and addressPrefix. ```typescript import { getSigner } from '@interchainjs/interchain/core'; import { DirectSigner } from '@interchainjs/cosmos'; import { Secp256k1HDWallet } from '@interchainjs/cosmos/wallets/secp256k1hd'; // Create wallet const wallet = await Secp256k1HDWallet.fromMnemonic(mnemonic, { derivations: [{ prefix: "cosmos", hdPath: HDPath.cosmos(0, 0, 0).toString() }] }); // Create signer with minimal configuration const signer = getSigner(wallet, { preferredSignType: 'cosmos_direct', signerOptions: { queryClient: cosmosQueryClient, chainId: 'cosmoshub-4', addressPrefix: 'cosmos' } }); ``` -------------------------------- ### Install @interchainjs/types Source: https://github.com/hyperweb-io/interchainjs/blob/main/packages/types/README.md Install the @interchainjs/types package using npm. ```sh npm install @interchainjs/types ``` -------------------------------- ### Install injective-vue Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-vue/README.md Install the injective-vue package using npm. ```sh npm install injective-vue ``` -------------------------------- ### Install @interchainjs/injective Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/injective/index.mdx Install the Injective package using npm. ```sh npm install @interchainjs/injective ``` -------------------------------- ### Setup Kind Kubernetes Cluster Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/starship/index.mdx Creates a local Kubernetes cluster using kind and configures access to it. This simplifies the process of setting up the necessary infrastructure for Starship. ```bash yarn starship setup-kind ``` -------------------------------- ### Using the Transaction Builder Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/workflow-builder-and-plugins.md Demonstrates how to instantiate a transaction builder, set staging data, and build a transaction. ```typescript const builder = new MyTransactionBuilder(signer); builder.context.setStagingData('transaction_args', args); const transaction = await builder.build(); ``` -------------------------------- ### Install InterchainJS SDK Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/migration-from-cosmjs.mdx Remove existing CosmJS dependencies and install the new SDK and its related packages. ```shell npm install @interchainjs/cosmos @interchainjs/auth @interchainjs/cosmos-types ``` -------------------------------- ### Import and Use Query Helper Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Demonstrates importing and using a tree-shakable query helper for retrieving blockchain data. ```javascript // Import only what you need import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; // Now you can query the blockchain const balance = await getAllBalances(endpoint, { address: "cosmos1addresshere", }); ``` -------------------------------- ### Manually Start Port Forwarding Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/starship/index.mdx If no process is listening on port 8899, execute this script to manually start port forwarding. ```bash bash starship/port-forward.sh ``` -------------------------------- ### Create Network Directory Structure Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/network-implementation-guide.md Sets up the standard directory structure for a new network implementation. ```bash mkdir -p networks/my-network/src/{adapters,auth,communication,signing,wallets,types,config} mkdir -p networks/my-network/{tests,docs} ``` -------------------------------- ### Creating Wallets Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/cosmos/src/signers/index.mdx Demonstrates creating SimpleWallet instances from a private key, mnemonic phrase, or generating a random wallet for a specified address prefix. ```typescript import { SimpleWallet } from '@interchainjs/cosmos'; // From private key const wallet1 = SimpleWallet.fromPrivateKey('abcd1234...', 'cosmos'); // From mnemonic const wallet2 = SimpleWallet.fromMnemonic( 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', 'cosmos' ); // Random wallet const wallet3 = SimpleWallet.random('osmo'); // Get account info const account = await wallet1.getAccount(); console.log('Address:', account.address); ``` -------------------------------- ### Starship Integration Test Setup Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/network-implementation-guide.md Configures the Starship testing environment by setting the configuration file and registry. This setup is crucial before running integration tests. ```typescript // starship/__tests__/setup.test.ts import path from 'path'; import { ConfigContext, useRegistry } from 'starshipjs'; beforeAll(async () => { const configFile = path.join(__dirname, '..', 'configs', 'config.yaml'); ConfigContext.setConfigFile(configFile); ConfigContext.setRegistry(await useRegistry(configFile)); }); ``` -------------------------------- ### Build Solana Projects Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/index.mdx Commands for building Solana projects in development, production, and watch modes. ```bash # Development build npm run build:dev # Production build npm run build # Watch mode npm run dev ``` -------------------------------- ### Build and Publish Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md After generating code, build the types and then publish the package using these commands. ```shell pnpm run build pnpm run publish ``` -------------------------------- ### Node.js Solana Transaction Example Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/index.mdx A basic example for sending a SOL transfer transaction in a Node.js environment. It involves creating a connection, generating a keypair, constructing a transaction, and sending it. ```typescript import { Connection, Keypair, PublicKey, Transaction, SystemProgram, DEVNET_ENDPOINT, solToLamports } from '@interchainjs/solana'; // Create connection to Solana cluster const connection = new Connection(DEVNET_ENDPOINT); // Generate a new keypair const keypair = Keypair.generate(); console.log('Public Key:', keypair.publicKey.toString()); // Create a simple transfer transaction const recipient = new PublicKey('11111111111111111111111111111112'); const lamports = solToLamports(0.1); // 0.1 SOL const transaction = new Transaction(); transaction.add( SystemProgram.transfer({ fromPubkey: keypair.publicKey, toPubkey: recipient, lamports }) ); // Sign and send transaction const signature = await connection.sendTransaction(transaction, [keypair]); console.log('Transaction signature:', signature); ``` -------------------------------- ### Build Project Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-vue/README.md Builds the project, including types. This is a prerequisite for publishing. ```shell pnpm run build ``` -------------------------------- ### Create and Use SimpleWallet for Testing Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/cosmos/src/signers/index.mdx Demonstrates how to create a random SimpleWallet for testing purposes and use it with DirectSigner. Ensure you have the necessary imports. ```typescript import { DirectSigner, SimpleWallet } from '@interchainjs/cosmos'; // Create test wallet const testWallet = SimpleWallet.random('cosmos'); // Use in tests const signer = new DirectSigner(testWallet, config); ``` -------------------------------- ### Error Handling Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/index.mdx Examples of how to handle errors during account information retrieval and transaction processing. ```APIDOC ## Error Handling ```typescript import { Connection, PublicKey } from '@interchainjs/solana'; try { const connection = new Connection(DEVNET_ENDPOINT); // Assuming DEVNET_ENDPOINT is defined const publicKey = new PublicKey('somePublicKey'); // Assuming publicKey is defined const accountInfo = await connection.getAccountInfo(publicKey); if (!accountInfo) { throw new Error('Account not found'); } // Process account info } catch (error) { if (error.message.includes('Invalid public key')) { console.error('Invalid address format'); } else if (error.message.includes('Account not found')) { console.error('Account does not exist'); } else { console.error('Network error:', error.message); } } // Transaction error handling try { const connection = new Connection(DEVNET_ENDPOINT); // Assuming DEVNET_ENDPOINT is defined const transaction = {}; // Assuming transaction is defined const signers = []; // Assuming signers is defined const signature = await connection.sendTransaction(transaction, signers); // Wait for confirmation with timeout const confirmation = await connection.confirmTransaction(signature, 'confirmed'); if (confirmation.value.err) { throw new Error(`Transaction failed: ${confirmation.value.err}`); } console.log('Transaction confirmed:', signature); } catch (error) { console.error('Transaction failed:', error.message); } ``` ``` -------------------------------- ### Querying Balances with Tree Shakable Helpers Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchain-react/index.mdx Demonstrates how to import and use the `getAllBalances` helper function to query blockchain data. Ensure the `endpoint` is correctly configured. ```javascript import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; // Now you can query the blockchain const balance = await getAllBalances(endpoint, { address: "cosmos1addresshere", }); ``` -------------------------------- ### Set up Local Kubernetes Cluster with Kind Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/interchainjs/starship/README.md Command to create a local Kind cluster and configure access to a Kubernetes cluster locally. Note: Local machine resource constraints can impact Starship spin-up time. ```bash pnpm starship setup-kind ``` -------------------------------- ### Local Development with Starship Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/index.mdx Commands to start and stop a local Solana cluster using Starship. ```APIDOC ### Local Development with Starship ```bash # Start local Solana cluster npm run starship:start # Stop local cluster npm run starship:stop ``` ``` -------------------------------- ### Composing Messages - OCR Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md Example of how to import and use message composer for OCR module functions. ```APIDOC ## Composing Messages - OCR This section shows how to use the `MessageComposer` to create messages for the OCR module. ### Usage ```js import { MessageComposer } from "injectivejs/injective/ocr/v1beta1/tx.registry"; const { acceptPayeeship, createFeed, fundFeedRewardPool, setPayees, transferPayeeship, transmit, updateFeed, withdrawFeedRewardPool } = MessageComposer.withTypeUrl; ``` ``` -------------------------------- ### Composing Messages - Insurance Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md Example of how to import and use message composer for Insurance module functions. ```APIDOC ## Composing Messages - Insurance This section shows how to use the `MessageComposer` to create messages for the Insurance module. ### Usage ```js import { MessageComposer } from "injectivejs/injective/insurance/v1beta1/tx.registry"; const { createInsuranceFund, requestRedemption, underwrite } = MessageComposer.withTypeUrl; ``` ``` -------------------------------- ### Composing Messages - Auction Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md Example of how to import and use message composer for Auction module functions. ```APIDOC ## Composing Messages - Auction This section shows how to use the `MessageComposer` to create messages for the Auction module. ### Usage ```js import { MessageComposer } from "injectivejs/injective/auction/v1beta1/tx.registry"; const { bid } = MessageComposer.withTypeUrl; ``` ``` -------------------------------- ### Combine Query and Transaction Helpers for Staking Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Demonstrates how to use both query and transaction helpers together for a staking operation. Imports are tree-shakable to optimize bundle size. ```javascript // Import helpers import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; import { delegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; // Query validator info const { validator } = await getValidator(endpoint, { validatorAddr: "cosmosvaloper1...", }); // Execute delegation const result = await delegate( signingClient, signerAddress, { delegatorAddress: signerAddress, validatorAddress: validator.operatorAddress, amount: { denom: "uatom", amount: "1000000" }, }, fee, "Delegation via InterchainJS" ); ``` -------------------------------- ### Composing Messages - Exchange Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injective-react/README.md Example of how to import and use message composer for Exchange module functions. ```APIDOC ## Composing Messages - Exchange This section shows how to use the `MessageComposer` to create messages for the Exchange module. ### Usage ```js import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; const { createSpotLimitOrder, createSpotMarketOrder, deposit } = MessageComposer.withTypeUrl; ``` ``` -------------------------------- ### Using IWallet with Custom Signer Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/advanced/tutorial.md Demonstrates initializing a custom Cosmos signer using an IWallet implementation, such as Secp256k1HDWallet. ```typescript import { Secp256k1HDWallet } from '@interchainjs/cosmos'; // Create wallet const wallet = await Secp256k1HDWallet.fromMnemonic(mnemonic, config); // Use with custom signer const signer = new CustomCosmosSigner(wallet, signerConfig); ``` -------------------------------- ### Tx Helpers - General Source: https://github.com/hyperweb-io/interchainjs/blob/main/libs/injectivejs/README.md General examples of using transaction helper functions for signing and broadcasting messages. ```APIDOC ## Tx Helpers ### Description Helper functions are available to sign and broadcast messages for various Injective modules. ### Usage ```js import { createDeposit, createLiquidatePosition, createActivateStakeGrant, } from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; ``` For more detailed usage, refer to the [starship tests](https://github.com/hyperweb-io/interchainjs/tree/main/networks/injective/starship/__tests__) in the `networks/injective` repo. React and Vue hooks are also available in [injective-react](https://github.com/hyperweb-io/interchainjs/tree/main/libs/injective-react) and [injective-vue](https://github.com/hyperweb-io/interchainjs/tree/main/libs/injective-vue) respectively. ``` -------------------------------- ### Start Solana Sandbox Validator Source: https://github.com/hyperweb-io/interchainjs/blob/main/dev-docs/agent/solana/solana-sandbox-testing.md Initiates the local Solana validator sandbox. Ensure you are in the repository root. This command aligns ports with Starship defaults and writes runtime artifacts to `tmp/`. ```bash # From the repository root .augment/solana-sandbox.sh start ``` -------------------------------- ### Vue Composable for Bank Query Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/libs/interchainjs/index.mdx Example of importing a Vue composable for querying all balances from the bank module. ```javascript import { useGetAllBalances } from "@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue"; ``` -------------------------------- ### Building Source: https://github.com/hyperweb-io/interchainjs/blob/main/docs/networks/solana/index.mdx Commands for building the Solana SDK for development and production, including watch mode. ```APIDOC ### Building ```bash # Development build npm run build:dev # Production build npm run build # Watch mode npm run dev ``` ```