Skip to main content

Prerequisites

  • The TypeScript project plus npm install @solana/web3.js bs58.
  • A Solana wallet holding SOL, and SOLANA_PRIVATE_KEY (base58) and SOLANA_RPC_URL in .env.

Script

src/swap-across-chains.ts

Notes

  • fromToken: null or toToken: null means 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 is true, fetch a fresh blockhash and set it on the message before signing.

Endpoints used