### Environment Setup and Installation Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/wallet/README.md Ensures necessary tools like Node.js and ts-node are installed and navigates to the wallet examples directory. ```bash node --version ts-node --version ``` ```bash cd examples/wallet ``` -------------------------------- ### Environment Setup Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/liquidity/README.md Ensures necessary tools like Node.js and ts-node are installed and available for running the liquidity examples. ```bash node --version v16.15.0 ts-node --version v10.7.0 ``` -------------------------------- ### Install Liquidity Examples Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/liquidity/README.md Navigates to the liquidity examples directory within the xchainjs-lib project, preparing for script execution. ```bash cd examples/liquidity ``` -------------------------------- ### Install Estimate Swap Example Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/estimate-swap/README.md Navigate to the estimate-swap example directory within the xchainjs-lib project. This command is used to prepare for running swap estimation scripts. ```bash cd examples/estimate-swap ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/frameworks/vite-example/README.md Installs all necessary project dependencies using different package managers. This is the first step after cloning the repository to ensure all required libraries are available for development or building. ```shell # yarn yarn ``` ```shell # npm npm install ``` ```shell # pnpm pnpm install ``` ```shell # bun bun install ``` -------------------------------- ### Install Check Transaction Script Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/check-tx/README.md Navigates to the specific example directory and installs project dependencies using yarn, preparing the script for execution. ```bash cd examples/check-tx yarn install ``` -------------------------------- ### Run Development Server Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/frameworks/vite-example/README.md Starts a local development server that typically includes features like hot-reloading. This command is used for active development to see changes reflected instantly. ```shell # yarn yarn dev ``` ```shell # npm npm run dev ``` ```shell # pnpm pnpm dev ``` ```shell # bun pnpm run dev ``` -------------------------------- ### Execute Wallet Example Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/wallet/README.md Demonstrates how to execute the wallet example script, either with a placeholder or a specific secret phrase. ```bash yarn wallet phrase ``` ```bash yarn wallet "your secret phrase" ``` -------------------------------- ### Install @xchainjs/xchain-bsc Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-bsc/README.md Installs the primary @xchainjs/xchain-bsc package using yarn. ```sh yarn add @xchainjs/xchain-bsc ``` -------------------------------- ### Environment Setup Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/check-tx/README.md Ensures the necessary Node.js and ts-node versions are installed, which are prerequisites for running the xchainjs-lib scripts. ```bash node --version v16.15.0 ts-node --version v10.7.0 ``` -------------------------------- ### Install Solana Client Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-solana/README.md Installs the Solana client package using either yarn or npm. ```sh yarn add @xchainjs/xchain-solana or npm install @xchainjs/xchain-solana ``` -------------------------------- ### Installation Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-doge/README.md Installs the @xchainjs/xchain-doge package and its required peer dependencies using yarn. ```shell yarn add @xchainjs/xchain-doge yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios bitcoinjs-lib wif ``` -------------------------------- ### Install Mayamidgard-query Package Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-mayamidgard-query/README.md Installs the `@xchainjs/xchain-mayamidgard-query` package using yarn. ```sh yarn add @xchainjs/xchain-mayamidgard-query ``` -------------------------------- ### Install xchain-cosmos-sdk Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-cosmos-sdk/README.md Installs the `@xchainjs/xchain-cosmos-sdk` package using Yarn. This is the primary command to add the library to your project. ```bash yarn add @xchainjs/xchain-cosmos-sdk ``` -------------------------------- ### Install Peer Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-bsc/README.md Lists the essential peer dependencies that must be installed alongside @xchainjs/xchain-bsc for full functionality. ```sh yarn add @xchainjs/xchain-evm @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios ethers ``` -------------------------------- ### Install xchain-thorchain and Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-thorchain/README.md Installs the main xchain-thorchain package and its required peer dependencies. Ensure compatible versions of peer dependencies, especially `@cosmos-client/core`, are installed to avoid potential issues. ```shell yarn add @xchainjs/xchain-thorchain ``` ```shell yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util @xchainjs/xchain-cosmos axios @cosmos-client/core bech32-buffer ``` -------------------------------- ### Install Peer Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-midgard-query/README.md Installs the necessary peer dependencies required by `@xchainjs/xchain-midgard-query`. These include `@xchainjs/xchain-client`, `@xchainjs/xchain-util`, `@xchainjs/xchain-midgard`, and `axios`. These must be installed separately as they are not bundled with the main package. ```bash yarn add @xchainjs/xchain-client @xchainjs/xchain-util @xchainjs/xchain-midgard axios ``` -------------------------------- ### Install Midgard Module Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-midgard/README.md Installs the `@xchainjs/xchain-midgard` package using Yarn. This is the primary method to add the library to your project. ```bash yarn add @xchainjs/xchain-midgard ``` -------------------------------- ### Install Cosmos Package Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-cosmos/README.md Installs the @xchainjs/xchain-cosmos package using yarn. ```bash yarn add @xchainjs/xchain-cosmos ``` -------------------------------- ### Install @xchainjs/xchain-wallet Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-wallet/README.md Installs the @xchainjs/xchain-wallet package using yarn. This is the primary method to integrate the library into your project. ```bash yarn add @xchainjs/xchain-wallet ``` -------------------------------- ### Install Base Client Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-base/README.md Installs the @xchainjs/xchain-base package using either yarn or npm package managers. ```sh yarn add @xchainjs/xchain-base ``` ```sh npm install @xchainjs/xchain-base ``` -------------------------------- ### Get Taproot Address by Index Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/bitcoin/README.md Demonstrates how to retrieve a Taproot account address at a specific index using the xchainjs-lib Bitcoin client. This command-line example requires a mnemonic phrase and an index as input. ```shell yarn taprootAddress phrase index ``` -------------------------------- ### Build for Production Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/frameworks/vite-example/README.md Compiles and minifies the project assets for production deployment. This command prepares the application for a production environment, optimizing code size and performance. Note: The original text mentioned this failed with yarn. ```shell # yarn yarn build ``` ```shell # npm npm run build ``` ```shell # pnpm pnpm build ``` ```shell # bun pnpm run build ``` -------------------------------- ### Solana Get All Balances Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/solana/README.md Retrieves all balances owned by a specific Solana address. This command is executed using yarn. ```sh yarn allBalances address ``` -------------------------------- ### Run Development Server Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/frameworks/next.js-example/README.md Commands to start the local development server for the Next.js project. These commands are executed in the project's root directory using different package managers. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Solana Get Address by Index Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/solana/README.md Generates a Solana account address based on a seed phrase and a specific index. This command is executed using yarn. ```sh yarn address phrase index ``` -------------------------------- ### Do Swap Command Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/aggregator/README.md Executes a cryptocurrency swap. Requires `yarn` to run. Takes a `phrase` (seed phrase) and `amount` as arguments. ```sh yarn doSwap phrase amount ``` -------------------------------- ### Solana Get Specific Asset Balance Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/solana/README.md Retrieves the balance for a specific token asset owned by a Solana address. This command is executed using yarn. ```sh yarn tokenBalance address token ``` -------------------------------- ### Get MAYANames by Owner using Yarn CLI Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/mayachain-amm/README.md Fetches a list of all MAYANames owned by a given address. This command is useful for discovering or managing MAYANames associated with a specific wallet or account. ```sh yarn mayanameOwned address ``` -------------------------------- ### Get Swap History Command Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/aggregator/README.md Retrieves the swap history for specified addresses. Requires `yarn` to run. Takes chain addresses as arguments (e.g., `chain1:address1 chain2:address2`). ```sh yarn swapHistory chain1:address1 chain2:address2 ``` -------------------------------- ### Create Radix Client Instance Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-radix/README.md Illustrates how to instantiate the Radix client with specific network and phrase parameters. It also shows how to access asset information. ```javascript import { Network, XChainClientParams } from '@xchainjs/xchain-client' import { Client } from '@xchainjs/xchain-radix' const phrase = 'rural bright ball negative already grass good grant nation screen model pizza' const params: XChainClientParams = { network: Network.Testnet, phrase: phrase, feeBounds: { lower: 1, upper: 5 }, } const client = new Client(params, 'Ed25519') console.log(client.getAssetInfo()) ``` -------------------------------- ### Estimate Swap Example Outputs Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/estimate-swap/README.md Demonstrates the JSON output from the `estimateSwap` command for different swap scenarios, including BTC to ETH and BTC to THOR.RUNE. These examples showcase the structure of fees, estimated output, and other transaction parameters. ```json { "memo": "=:ETH.ETH:undefined:1215999", "expiry": "2022-10-04T06:05:35.691Z", "toAddress": "bc1q45l09yhmjayd0swcnfku839uk0x0vsxau4a8j6", "txEstimate": { "input": "⚡ 200,000", "totalFees": { "inboundFee": "ᚱ 0.85042717", "swapFee": "ᚱ 0.00016927", "outboundFee": "ᚱ 13.15033307", "affiliateFee": "ᚱ 0" }, "slipPercentage": "0.00000715632168076026", "netOutput": "Ξ 0.01252814", "waitTimeSeconds": "606", "canSwap": true, "errors": [] } } ``` ```json { "memo": "=:ETH.ETH:undefined:2824318999", "expiry": "2022-10-04T06:08:07.854Z", "toAddress": "bc1q45l09yhmjayd0swcnfku839uk0x0vsxau4a8j6", "txEstimate": { "input": "₿ 2", "totalFees": { "inboundFee": "ᚱ 0.85028568", "swapFee": "ᚱ 177.52446807", "outboundFee": "ᚱ 13.14662292", "affiliateFee": "ᚱ 0" }, "slipPercentage": "0.00736167351651217019", "netOutput": "Ξ 29.11668923", "waitTimeSeconds": "1992", "canSwap": true, "errors": [] } } ``` ```json { "memo": "=:THOR.RUNE:undefined:2343615739999", "expiry": "2022-10-04T06:09:14.962Z", "toAddress": "bc1q45l09yhmjayd0swcnfku839uk0x0vsxau4a8j6", "txEstimate": { "input": "₿ 2", "totalFees": { "inboundFee": "ᚱ 0.02", "swapFee": "ᚱ 66.65512242", "outboundFee": "ᚱ 0", "affiliateFee": "ᚱ 0" }, "slipPercentage": "0.00275120137876842664", "netOutput": "ᚱ 24,160.98700222", "waitTimeSeconds": "1412", "canSwap": true, "errors": [] } } ``` -------------------------------- ### Get MAYAName Details using Yarn CLI Source: https://github.com/xchainjs/xchainjs-lib/blob/master/examples/mayachain-amm/README.md Retrieves detailed information about a specific MAYAName. This command takes the MAYAName as input and returns associated data, such as owner, registration details, and associated addresses. ```sh yarn mayanameDetails MAYAName ``` -------------------------------- ### Install Peer Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-mayachain/README.md Installs essential peer dependencies required by @xchainjs/xchain-mayachain. Ensure these are installed in your project to avoid compatibility issues. ```bash yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util @xchainjs/xchain-cosmos axios @cosmos-client/core bech32-buffer ``` -------------------------------- ### Install xchain-client Peer Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-litecoin/README.md Installs the necessary peer dependencies for @xchainjs/xchain-litecoin, including @xchainjs/xchain-client, @xchainjs/xchain-crypto, @xchainjs/xchain-util, axios, bitcoinjs-lib, and wif. These must be added to your project separately. ```bash yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios bitcoinjs-lib wif ``` -------------------------------- ### Install Peer Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-arbitrum/README.md Installs essential peer dependencies required by xchain-arbitrum, such as @xchainjs/xchain-evm, @xchainjs/xchain-client, and ethers. These must be installed separately. ```sh yarn add @xchainjs/xchain-evm @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios ethers ``` -------------------------------- ### Install xchain-ethereum Package Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-ethereum/README.md Installs the main @xchainjs/xchain-ethereum package using yarn. This command adds the core library to your project's dependencies. ```shell yarn add @xchainjs/xchain-ethereum ``` -------------------------------- ### Install @xchainjs/xchain-zcash and Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-zcash/README.md Installs the `@xchainjs/xchain-zcash` package and its required peer dependencies using Yarn. Ensure these peer dependencies are also installed in your project for the client to function correctly. ```bash yarn add @xchainjs/xchain-zcash ``` ```bash yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util ``` -------------------------------- ### Swap Estimation Example Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-thorchain-query/README.md Demonstrates the structure of an estimated swap transaction from THORChain, including memo, fees, slip, and output. ```ts { memo: '=:THOR.RUNE::2071168559999', expiry: '2022-09-07T02:16:45.732Z', toAddress: '', txEstimate: { input: '₿ 2', totalFees: { inboundFee: 'ᚱ 0.02', swapFee: 'ᚱ 52.85380999', outboundFee: 'ᚱ 0.06', affiliateFee: 'ᚱ 0' }, slipPercentage: '0.00246920801878638026', netOutput: 'ᚱ 21,352.25318742', waitTimeSeconds: '1248', canSwap: true, errors: [] } } ``` -------------------------------- ### Install Cardano Client Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-cardano/README.md Instructions for installing the Cardano client package using either yarn or npm package managers. ```sh yarn add @xchainjs/xchain-cardano ``` ```sh npm install @xchainjs/xchain-cardano ``` -------------------------------- ### Install Dependencies Source: https://github.com/xchainjs/xchainjs-lib/blob/master/tools/txJammer/README.md Installs project dependencies using Yarn. ```bash yarn install ``` -------------------------------- ### Install xchain-radix Client Source: https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-radix/README.md Shows how to add the xchain-radix library to your project using yarn. This is the first step to using the Radix client. ```shell yarn add @xchainjs/xchain-radix ```