NetworkSwappableTokensMap
} from "@synapseprotocol/sdk";
import {JsonRpcProvider} from "@ethersproject/providers";
import {ContractTransaction, PopulatedTransaction} from "@ethersproject/contracts";
import {parseUnits, formatUnits} from "@ethersproject/units";
import {BigNumber} from "@ethersproject/bignumber";
// Initialize dummy Ethers Provider
const AVAX_PROVIDER = new JsonRpcProvider("https://api.avax.network/ext/bc/C/rpc");
// Use SDK Data about different chains
const AVAX_NETWORK = Networks.AVALANCHE;
const SYNAPSE_BRIDGE = new Bridge.SynapseBridge({
// Set up some variables to prepare a Avalanche USDC -> BSC USDT quote
INPUT_AMOUNT: BigNumber = parseUnits("1000", tokenIn.decimals(NETWORK.chainId));
SYNAPSE_BRIDGE.estimateBridgeTokenOutput({
tokenFrom: TOKEN_IN, // token to send from the source chain, in this case USDT on Avalanche
chainIdTo: CHAIN_OUT, // Chain ID of the destination chain, in this case BSC
tokenTo: TOKEN_OUT, // Token to be received on the destination chain, in this case USDC
amountFrom: INPUT_AMOUNT,
}).then(({ amountToReceive, bridgeFee }) => {
let amountOutFormatted = formatUnits(
TOKEN_OUT.decimals(chainOut)
console.log(`${amountOutFormatted} USDT will be received on the output chain`)
.catch((err) => throw new Error(err.toString()))