Prerequisites
- The TypeScript project plus
npm install @solana/web3.js bs58. - A Solana wallet holding SOL, and
SOLANA_PRIVATE_KEY(base58) andSOLANA_RPC_URLin.env.
Script
src/swap-across-chains.ts
Notes
fromToken: nullortoToken: nullmeans the chain’s native asset. Symbols and addresses are both accepted.- A wallet may add its own compute-budget instructions; every instruction Bridg built must stay byte-identical.
- The Solana step carries
refreshBlockhash; when it istrue, fetch a fresh blockhash and set it on the message before signing.