TokenBridge protocol definition, providing a consistent client interface for the TokenBridge protocol

Find details on the TokenBridge protocol here: https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0003_token_bridge.md

Type Parameters

  • N extends Network = Network

  • C extends Chain = Chain

Hierarchy

  • TokenBridge

Methods

  • returns the original asset with its foreign chain

    Parameters

    • nativeAddress: TokenAddress<C>

      The wrapped address to check

    Returns Promise<TokenId<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia">>

    The TokenId corresponding to the original asset and chain

  • Returns the address of the native version of this asset

    Parameters

    • foreignToken: TokenId<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia">

      The token to check

    Returns Promise<GetNativeAddress<ChainToPlatform<C>>>

    The address of the native version of this asset

  • returns the wrapped version of the native asset

    Returns Promise<GetNativeAddress<ChainToPlatform<C>>>

    The address of the native gas token that has been wrapped for use where the gas token is not possible to use (e.g. bridging)

  • Check to see if a foreign token has a wrapped version

    Parameters

    • foreignToken: TokenId<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia">

      The token to check

    Returns Promise<boolean>

    true if the token has a wrapped version

  • Checks if a transfer VAA has been redeemed

    Parameters

    • vaa: VAA<"TokenBridge:Transfer"> | VAA<"TokenBridge:TransferWithPayload">

      The transfer VAA to check

    Returns Promise<boolean>

    true if the transfer has been redeemed

  • Redeem a transfer VAA to receive the tokens on this chain

    Parameters

    • sender: AccountAddress<C>

      The sender of the transfer

    • vaa: VAA<"TokenBridge:Transfer"> | VAA<"TokenBridge:TransferWithPayload">

      The transfer VAA to redeem

    • Optional unwrapNative: boolean

      Whether to unwrap the native token if it is a wrapped token

    Returns AsyncGenerator<UnsignedTransaction<N, C>, any, unknown>

    An AsyncGenerator that produces transactions to sign and send

  • Initiate a transfer of some token to another chain

    Parameters

    • sender: AccountAddress<C>

      The sender of the transfer

    • recipient: ChainAddress

      The recipient of the transfer as a ChainAddress so we know what the destination chain should be

    • token: TokenAddress<C>

      The token to transfer

    • amount: bigint

      The amount of the token to transfer

    • Optional payload: Uint8Array

      Optional payload to include in the transfer

    Returns AsyncGenerator<UnsignedTransaction<N, C>, any, unknown>

    An AsyncGenerator that produces transactions to sign and send

Generated using TypeDoc