Constructors

Methods

  • Retrieves the BTC Peg-In address and its corresponding ScriptPubKey for a given Bitcoin source chain (mainnet or testnet) and a specified destination chain. This address is used to initiate a transfer (peg-in) from the Bitcoin network into the Brotocol.

    Parameters

    • fromChain: `${string} (BroSDK ChainId)`

      The source Bitcoin chain (Mainnet or Testnet).

    • toChain: `${string} (BroSDK ChainId)`

      The destination chain (must be a known chain, although it is not used in address generation).

    Returns Promise<undefined | { address: string; scriptPubKey: Uint8Array }>

    A promise that resolves with an object containing:

    • address: the BTC Peg-In address to which the user should send BTC.
    • scriptPubKey: the ScriptPubKey representation of the address. Returns undefined if the provided chain is invalid or unsupported.
  • Retrieves the BRC20 tick (e.g., "ordi", "pepe") associated with a known BRC20 token ID on a specific BRC20-compatible blockchain in the SDK. Internally, this function looks up the list of supported BRC20 tokens on the given chain and returns the brc20Tick value corresponding to the provided KnownTokenId.BRC20Token.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The blockchain network (must be a valid BRC20 chain, like brc20-mainnet or brc20-testnet).

    • token: "a brc20 token (BroSDK TokenId)"

      The known BRC20 token identifier (must follow the brc20-<tick> format).

    Returns Promise<undefined | string>

    A promise that resolves with the corresponding BRC20 tick string, or undefined if the token is not found or the chain is not supported.

  • Retrieves the KnownTokenId.BRC20Token corresponding to a given BRC20 tick on a specific BRC20-compatible blockchain. This function performs a case-insensitive match of the provided tick against the list of supported BRC20 tokens on the given chain.

    Always use this function to obtain a BRC20 token ID at runtime. Do not construct TokenId values manually, as supported tokens may change dynamically.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The blockchain network to search in (must be a BRC20-compatible chain such as brc20-mainnet or brc20-testnet).

    • tick: string

      The BRC20 tick (e.g., "ordi", "pepe") to look up.

    Returns Promise<undefined | "a brc20 token (BroSDK TokenId)">

    A promise that resolves with the associated KnownTokenId.BRC20Token, or undefined if no match is found or the chain is not supported.

    Developers should always use this function to obtain a BRC20 token ID at runtime. Never construct TokenId values manually, as the supported token list may change dynamically.

  • This function facilitates the transfer of tokens from the Bitcoin network to other supported blockchain networks. It checks the validity of the route and then calls the appropriate bridging function based on the destination chain.

    Parameters

    • input: BridgeFromBitcoinInput

      An object containing the input parameters required for the bridging operation:

      • fromChain: ChainId - The ID of the source blockchain.
      • toChain: ChainId - The ID of the destination blockchain (Stacks, EVM, etc.).
      • fromToken: TokenId - The token being transferred from the Bitcoin network.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The source address on the Bitcoin network.
      • fromAddressScriptPubKey: Uint8Array - The script public key corresponding to the fromAddress.
      • toAddress: string - The recipient's address on the destination blockchain.
      • amount: SDKNumber - The amount of tokens to transfer.
      • networkFeeRate: bigint - The network fee rate to be used for the transaction.
      • reselectSpendableUTXOs: ReselectSpendableUTXOsFn.
      • signPsbt: BridgeFromBitcoinInput_signPsbtFn.

    Returns Promise<BridgeFromBitcoinOutput>

    A promise that resolves with the transaction ID (tx) of the bridging operation.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is unsupported.

  • This function facilitates the transfer of BRC-20 tokens from a BRC20-compatible network to other supported blockchain networks such as Stacks, EVM-compatible, Bitcoin, or Runes chains. It validates the provided route and delegates to the appropriate bridging logic depending on the destination.

    Parameters

    • input: BridgeFromBRC20Input

      An object containing the input parameters required for the bridging operation:

      • fromChain: ChainId - The ID of the source blockchain (must be a BRC20-compatible chain).
      • toChain: ChainId - The ID of the destination blockchain (Stacks, EVM, Bitcoin, Runes, or another BRC20 chain).
      • fromToken: TokenId - The BRC-20 token being transferred.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The sender's Bitcoin address.
      • fromAddressScriptPubKey: Uint8Array - The script public key corresponding to the fromAddress.
      • toAddress: string - The recipient's address on the destination blockchain.
      • toAddressScriptPubKey?: Uint8Array - Required when the destination chain is Bitcoin, BRC20 or Runes.
      • inputInscriptionUTXO: UTXOSpendable - The inscription UTXO holding the BRC-20 token to bridge.
      • networkFeeRate: bigint - The fee rate for Bitcoin transaction construction.
      • swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public - Optional swap configuration for token conversion. Functions to be provided by the developer:
      • reselectSpendableNetworkFeeUTXOs: BridgeFromBRC20Input_reselectSpendableNetworkFeeUTXOs - Function to fetch additional UTXOs for network fee.
      • signPsbt: BridgeFromBRC20Input_signPsbtFn - Function to sign the PSBT (Partially Signed Bitcoin Transaction).
      • sendTransaction - Function used to broadcast the final signed transaction.

    Returns Promise<BridgeFromBRC20Output>

    A promise that resolves with the Bitcoin transaction ID (txid) of the bridging operation.

    TooManyRequestsError - is received from the backend API.

    UnsupportedBridgeRouteError - If the combination of fromChain, toChain, fromToken, and toToken is unsupported.

    InvalidMethodParametersError - If required parameters are missing.

    BridgeValidateFailedError - If the bridge order validation fails.

  • This function facilitates the transfer of tokens from an EVM-compatible blockchain to other supported blockchain networks, including Stacks, Bitcoin, and other EVM-compatible chains. It validates the route and calls the appropriate bridging function based on the destination chain and tokens involved.

    Parameters

    • input: BridgeFromEVMInput

      An object containing the input parameters required for the bridging operation:

      • fromChain: ChainId - The ID of the source blockchain (an EVM-compatible chain in this case).
      • toChain: ChainId - The ID of the destination blockchain (Stacks, Bitcoin, or another EVM-compatible chain).
      • fromToken: TokenId - The token being transferred from the EVM-compatible blockchain.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The sender's address on the source chain.
      • toAddress: string - The recipient's address on the destination blockchain.
      • toAddressScriptPubKey?: Uint8Array - The script public key for the toAddress, required when the destination is a Bitcoin chain.
      • amount: SDKNumber - The amount of tokens to transfer.
      • sendTransaction - // Implementation for sending transaction from EVM chain.

    Returns Promise<BridgeFromEVMOutput>

    A promise that resolves with the transaction hash (txHash) of the bridging operation.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is unsupported.

  • This function facilitates the transfer of tokens from the Runes protocol to other supported blockchain networks. It validates the route using internal logic and delegates the transaction construction and broadcasting based on the destination chain.

    Parameters

    • input: BridgeFromRunesInput

      An object containing the input parameters required for the bridging operation:

      • fromChain: ChainId - The ID of the source blockchain (must be a Runes chain).
      • toChain: ChainId - The ID of the destination blockchain (Stacks, EVM, Bitcoin or BRC20).
      • fromToken: TokenId - The token being transferred from the Runes chain.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The sender’s address on the Runes chain.
      • fromAddressScriptPubKey: Uint8Array - The script public key for fromAddress.
      • toAddress: string - The recipient’s address on the destination blockchain.
      • toAddressScriptPubKey?: Uint8Array - Required when the destination chain is Bitcoin or BRC20.
      • amount: SDKNumber - The amount of tokens to transfer.
      • inputRuneUTXOs: RunesUTXOSpendable[] - UTXOs containing the Runes to be spent.
      • networkFeeRate: bigint - The Bitcoin network fee rate to be used for the transaction.
      • swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public - Optional swap route for token conversion before bridging. Functions to be provided by the developer:
      • reselectSpendableNetworkFeeUTXOs: BridgeFromRunesInput_reselectSpendableNetworkFeeUTXOs - Callback to reselect UTXOs for network fee.
      • signPsbt - Callback function to sign the PSBT (Partially Signed Bitcoin Transaction).
      • sendTransaction - Callback function to broadcast the signed transaction.

    Returns Promise<BridgeFromRunesOutput>

    A promise that resolves with the transaction ID (txid) of the bridging operation.

    UnsupportedBridgeRouteError - If the route is not supported.

    InvalidMethodParametersError - If required parameters are missing or invalid.

    TooFrequentlyError - If the operation is rate-limited due to excessive requests.

  • This function facilitates the transfer of tokens from the Stacks network to other supported blockchain networks, including Bitcoin and EVM-compatible chains. It validates the route and calls the appropriate bridging function based on the destination chain and tokens involved.

    Parameters

    • input: BridgeFromStacksInput

      An object containing the input parameters required for the bridging operation:

      • fromChain: ChainId - The ID of the source blockchain.
      • toChain: ChainId - The ID of the destination blockchain (Bitcoin, EVM, etc.).
      • fromToken: TokenId - The token being transferred from the source chain.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The sender's address on the source chain.
      • toAddress: string - The recipient's address on the destination blockchain.
      • amount: SDKNumber - The amount of tokens to transfer.
      • sendTransaction - // Implementation for sending transaction from Stacks mainnet.

    Returns Promise<BridgeFromStacksOutput>

    A promise that resolves with the transaction ID (txid) of the bridging operation.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is unsupported.

  • This function provides detailed information about token transfers from the Bitcoin network to other supported blockchain networks, including Stacks and EVM-compatible chains. It verifies the validity of the transfer route and retrieves bridge information based on the destination chain.

    Parameters

    • input: BridgeInfoFromBitcoinInput

      An object containing the input parameters required for retrieving bridge information:

      • fromChain: ChainId - The ID of the source blockchain.
      • toChain: ChainId - The ID of the destination blockchain (Stacks, EVM, etc.).
      • amount: SDKNumber - The amount of tokens involved in the transfer.

    Returns Promise<BridgeInfoFromBitcoinOutput>

    A promise that resolves with an object containing detailed information about the token transfer, including:

    • fromChain: KnownChainId.KnownChain - The source blockchain.
    • fromToken: KnownTokenId.KnownToken - The token being transferred from the Bitcoin network.
    • toChain: KnownChainId.KnownChain - The destination blockchain.
    • toToken: KnownTokenId.KnownToken - The token expected on the destination chain.
    • fromAmount: SDKNumber - The amount of tokens being transferred.
    • toAmount: SDKNumber - The amount of tokens expected on the destination chain after the transfer.
    • feeAmount: SDKNumber - The fee amount deducted during the transfer.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains is unsupported.

  • This function provides detailed information about token transfers from BRC-20 compatible chains to other supported blockchain networks, including Stacks, EVM-compatible chains, Bitcoin and Runes. It verifies the validity of the transfer route and retrieves bridge information, including intermediary steps and fees.

    Parameters

    • input: BridgeInfoFromBRC20Input

      An object containing the input parameters required to retrieve bridge information:

      • fromChain: ChainId – The source blockchain (must be a BRC-20-compatible chain).
      • toChain: ChainId – The destination blockchain.
      • fromToken: TokenId – The token being bridged from the source chain.
      • toToken: TokenId – The token expected on the destination chain.
      • amount: SDKNumber – The amount of tokens to bridge.
      • swapRoute?: SwapRoute_WithExchangeRate_Public – Optional: a route to perform token swaps during the bridge.

    Returns Promise<BridgeInfoFromBRC20Output>

    A promise that resolves with detailed bridge information:

    • fromChain, toChain, fromToken, toToken – Source and destination details.
    • fromAmount, toAmount – Input and estimated output amounts.
    • fees – A list of estimated fees applied to the bridge (fixed or rate-based).
    • isPaused, minBridgeAmount, maxBridgeAmount – Status and constraints of the bridge route.
    • transferProphets – A list of step-by-step bridge operations, including intermediary chains or swaps when applicable.

    UnsupportedBridgeRouteError – If the route between the source and destination is not supported.

  • This function provides detailed information about token transfers from an EVM-compatible blockchain to other supported blockchain networks, including Stacks, Bitcoin, and other EVM-compatible chains. It verifies the validity of the transfer route and retrieves bridge information based on the destination chain and tokens.

    Parameters

    • input: BridgeInfoFromEVMInput

      An object containing the input parameters required for retrieving bridge information:

      • fromChain: ChainId - The ID of the source blockchain (Stacks in this case).
      • toChain: ChainId - The ID of the destination blockchain (Bitcoin, EVM-compatible chains, etc.).
      • fromToken: TokenId - The token being transferred from the Stacks network.
      • toToken: TokenId - The token expected on the destination chain.
      • amount: SDKNumber - The amount of tokens involved in the transfer.

    Returns Promise<BridgeInfoFromEVMOutput>

    A promise that resolves with an object containing detailed information about the token transfer, including:

    • fromChain: KnownChainId.KnownChain - The source blockchain.
    • fromToken: KnownTokenId.KnownToken - The token being transferred from the Stacks network.
    • toChain: KnownChainId.KnownChain - The destination blockchain.
    • toToken: KnownTokenId.KnownToken - The token expected on the destination chain.
    • fromAmount: SDKNumber - The amount of tokens being transferred.
    • toAmount: SDKNumber - The amount of tokens expected on the destination chain after the transfer.
    • feeAmount: SDKNumber - The fee amount deducted during the transfer.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is unsupported.

  • This function provides detailed information about bridging a token from the Runes protocol to other supported blockchain networks including Stacks, EVM, Bitcoin or BRC-20. It validates the compatibility of the route and determines fees, transfer amount, and route steps required to complete the bridge.

    Parameters

    • input: BridgeInfoFromBRC20Input

      An object containing the input parameters required to retrieve bridge information:

      • fromChain: ChainId – The source blockchain (must be a Runes-compatible chain).
      • toChain: ChainId – The destination blockchain.
      • fromToken: TokenId – The token being bridged from the source chain.
      • toToken: TokenId – The token expected on the destination chain.
      • amount: SDKNumber – The amount of tokens to bridge.
      • swapRoute?: SwapRoute_WithExchangeRate_Public – Optional: a route to perform token swaps during the bridge.

    Returns Promise<BridgeInfoFromBRC20Output>

    A promise that resolves with detailed bridge information:

    • fromChain, toChain, fromToken, toToken – Source and destination details.
    • fromAmount, toAmount – Input and estimated output amounts.
    • fees – A list of estimated fees applied to the bridge (fixed or rate-based).
    • isPaused, minBridgeAmount, maxBridgeAmount – Status and constraints of the bridge route.
    • transferProphets – A list of step-by-step bridge operations, including intermediary chains or swaps when applicable.

    UnsupportedBridgeRouteError – If the route between the source and destination is not supported.

  • This function provides detailed information about token transfers from the Stacks network to other supported blockchain networks, including Bitcoin and EVM-compatible chains. It verifies the validity of the transfer route and retrieves bridge information based on the destination chain and tokens.

    Parameters

    • input: BridgeInfoFromStacksInput

      An object containing the input parameters required for retrieving bridge information:

      • fromChain: ChainId - The ID of the source blockchain (Stacks in this case).
      • toChain: ChainId - The ID of the destination blockchain (Bitcoin, EVM-compatible chains, etc.).
      • fromToken: TokenId - The token being transferred from the Stacks network.
      • toToken: TokenId - The token expected on the destination chain.
      • amount: SDKNumber - The amount of tokens involved in the transfer.

    Returns Promise<BridgeInfoFromStacksOutput>

    A promise that resolves with an object containing detailed information about the token transfer, including:

    • fromChain: KnownChainId.KnownChain - The source blockchain.
    • fromToken: KnownTokenId.KnownToken - The token being transferred from the Stacks network.
    • toChain: KnownChainId.KnownChain - The destination blockchain.
    • toToken: KnownTokenId.KnownToken - The token expected on the destination chain.
    • fromAmount: SDKNumber - The amount of tokens being transferred.
    • toAmount: SDKNumber - The amount of tokens expected on the destination chain after the transfer.
    • feeAmount: SDKNumber - The fee amount deducted during the transfer.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is unsupported.

  • This function facilitates the claiming of time-locked assets on EVM-compatible chains. It uses smart contract functions to execute the release of locked assets based on predefined conditions.

    Parameters

    • input: ClaimTimeLockedAssetsInput

      An object containing the input parameters required for claiming time-locked assets:

      • chain: KnownChainId.EVMChain - The ID of the EVM-compatible blockchain where the assets are locked.
      • lockedAssetIds: string[] - An array of IDs representing the locked assets to be claimed.
      • sendTransaction - // Implementation for sending transaction from EVM chain.

    Returns Promise<undefined | ClaimTimeLockedAssetsOutput>

    A promise that resolves with the transaction hash (txHash) of the claiming operation, or undefined if the operation fails.

    UnsupportedChainError - If the provided EVM chain is unsupported or invalid.

  • This function estimates the transaction fee and vSize for move or swap tokens from the Bitcoin network to other supported blockchain networks, including Stacks and EVM-compatible chains.

    Parameters

    • input: EstimateBridgeTransactionFromBitcoinInput

      An object containing the input parameters required for estimating the transaction:

      • fromChain: ChainId - The ID of the source blockchain (Bitcoin in this case).
      • toChain: ChainId - The ID of the destination blockchain (Stacks, EVM-compatible chains, etc.).
      • fromToken: TokenId - The token being transferred from the Bitcoin network.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The source address on the Bitcoin network.
      • fromAddressScriptPubKey: Uint8Array - The script public key of the source address.
      • toAddress: string - The destination address on the target blockchain.
      • amount: SDKNumber - The amount of tokens to be transferred.
      • networkFeeRate: bigint - The fee rate for the Bitcoin network.
      • reselectSpendableUTXOs - // Implementation for reselect UTXOs.

    Returns Promise<EstimateBridgeTransactionFromBitcoinOutput>

    A promise that resolves with an object containing the estimated transaction details:

    • fee: SDKNumber - The estimated transaction fee.
    • estimatedVSize: SDKNumber - The estimated vSize of the transaction.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is unsupported.

  • This function estimates the transaction fee and vSize for transferring or swapping BRC-20 tokens from a Bitcoin-based network to other supported blockchains, including Stacks, EVM-compatible chains, Runes, or the Bitcoin network itself.

    Parameters

    • input: EstimateBridgeTransactionFromBRC20Input

      An object containing the input parameters required for the transaction estimation:

      • fromChain: ChainId - The ID of the source chain (must be a BRC-20 compatible chain).
      • fromToken: TokenId - The token being bridged from the BRC-20 chain.
      • toChain: ChainId - The ID of the target chain.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The sender's Bitcoin address.
      • fromAddressScriptPubKey: Uint8Array - The script public key corresponding to the fromAddress.
      • toAddress: string - The recipient's address on the destination chain.
      • toAddressScriptPubKey?: Uint8Array - Required when bridging to a Bitcoin-based chain.
      • inputInscriptionUTXO: UTXOSpendable - The UTXO containing the BRC-20 inscription to be bridged.
      • swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public - Optional swap route if a token swap is involved before bridging.
      • networkFeeRate: bigint - The desired network fee rate.
      • reselectSpendableNetworkFeeUTXOs: BridgeFromBRC20Input_reselectSpendableNetworkFeeUTXOs - Function to reselect additional UTXOs for covering network fees.

    Returns Promise<EstimateBridgeTransactionFromBRC20Output>

    A promise that resolves with estimated transaction parameters:

    • fee: SDKNumber - The estimated total fee in satoshis.
    • estimatedVSize: SDKNumber - The estimated virtual size of the transaction in vBytes.
    • revealTransactionSatoshiAmount?: SDKNumber - Optional, the amount of satoshis used in the reveal transaction output.

    UnsupportedBridgeRouteError - If the provided route between the source and destination chains or tokens is not supported.

    InvalidMethodParametersError - If any required parameters are missing or invalid for the selected route.

  • This function estimates the transaction fee and vSize for bridging Rune tokens from the Runes protocol to other supported blockchain networks such as Stacks, EVM-compatible chains, or BRC-20 destination.

    Parameters

    • input: EstimateBridgeTransactionFromRunesInput

      An object containing the input parameters required for estimating the transaction:

      • fromChain: ChainId - The ID of the source blockchain (a Runes-compatible Bitcoin chain).
      • toChain: ChainId - The ID of the destination blockchain.
      • fromToken: TokenId - The Rune token being transferred from the source.
      • toToken: TokenId - The token expected on the destination chain.
      • fromAddress: string - The source Bitcoin address that holds the Rune token.
      • fromAddressScriptPubKey: Uint8Array - The script public key corresponding to the source address.
      • toAddress: string - The destination address on the target blockchain.
      • toAddressScriptPubKey?: Uint8Array - The script public key for the destination address, required when the destination is a Bitcoin-based chain.
      • amount: SDKNumber - The amount of Rune tokens to transfer.
      • inputRuneUTXOs: RunesUTXOSpendable[] - The list of Rune UTXOs used as inputs.
      • networkFeeRate: bigint - The fee rate to use for Bitcoin transaction construction.
      • swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public - Optional swap route to use in case token conversion is needed.
      • reselectSpendableNetworkFeeUTXOs: BridgeFromRunesInput_reselectSpendableNetworkFeeUTXOs - A function to reselect network fee UTXOs when needed.

    Returns Promise<EstimateBridgeTransactionFromRunesOutput>

    A promise that resolves with an object containing estimated transaction data:

    • fee: SDKNumber - The estimated total fee in satoshis for the bridging operation.
    • estimatedVSize: SDKNumber - The estimated vSize of the transaction in bytes.
    • revealTransactionSatoshiAmount?: SDKNumber - (Optional) The satoshi amount associated with the reveal transaction used to complete the bridge.

    UnsupportedBridgeRouteError - If the route between the source and destination tokens or chains is not supported.

    InvalidMethodParametersError - If required parameters are missing.

  • This function retrieves the contract address of a specific token on a given EVM-compatible blockchain.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The ID of the EVM-compatible blockchain where the token contract is deployed.

    • token:
          | "evm-susdt (BroSDK TokenId)"
          | "evm-usdt (BroSDK TokenId)"
          | "evm-usdc (BroSDK TokenId)"
          | "evm-abtc (BroSDK TokenId)"
          | "evm-wbtc (BroSDK TokenId)"
          | "evm-btcb (BroSDK TokenId)"
          | "evm-cbbtc (BroSDK TokenId)"
          | "evm-lunr (BroSDK TokenId)"
          | "evm-alex (BroSDK TokenId)"
          | "evm-sko (BroSDK TokenId)"
          | "evm-vlistx (BroSDK TokenId)"
          | "evm-vlialex (BroSDK TokenId)"
          | "evm-ubtc (BroSDK TokenId)"
          | "evm-wubtc (BroSDK TokenId)"
          | "evm-db20 (BroSDK TokenId)"
          | "evm-dog (BroSDK TokenId)"
          | "evm-stx (BroSDK TokenId)"
          | "evm-trump (BroSDK TokenId)"
          | "evm-ghiblicz (BroSDK TokenId)"
          | "evm-eth (BroSDK TokenId)"
          | "evm-sol (BroSDK TokenId)"
          | "evm-link (BroSDK TokenId)"

      The specific token ID for which the contract address is to be retrieved.

    Returns Promise<undefined | `0x${string}` | typeof evmNativeCurrencyAddress>

    A promise that resolves with the contract address of the token, or undefined if the chain is not EVM-compatible or if the contract address cannot be retrieved.

  • This function maps a given contract address on an EVM-compatible blockchain to its corresponding known token ID.

    Always use this function to retrieve an EVMToken ID at runtime. Do not hardcode or cache token IDs, as supported tokens may change dynamically.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The ID of the EVM-compatible blockchain where the contract is deployed.

    • address: `0x${string}` | typeof evmNativeCurrencyAddress

      The contract address on the EVM-compatible blockchain.

    Returns Promise<
        | undefined
        | "evm-susdt (BroSDK TokenId)"
        | "evm-usdt (BroSDK TokenId)"
        | "evm-usdc (BroSDK TokenId)"
        | "evm-abtc (BroSDK TokenId)"
        | "evm-wbtc (BroSDK TokenId)"
        | "evm-btcb (BroSDK TokenId)"
        | "evm-cbbtc (BroSDK TokenId)"
        | "evm-lunr (BroSDK TokenId)"
        | "evm-alex (BroSDK TokenId)"
        | "evm-sko (BroSDK TokenId)"
        | "evm-vlistx (BroSDK TokenId)"
        | "evm-vlialex (BroSDK TokenId)"
        | "evm-ubtc (BroSDK TokenId)"
        | "evm-wubtc (BroSDK TokenId)"
        | "evm-db20 (BroSDK TokenId)"
        | "evm-dog (BroSDK TokenId)"
        | "evm-stx (BroSDK TokenId)"
        | "evm-trump (BroSDK TokenId)"
        | "evm-ghiblicz (BroSDK TokenId)"
        | "evm-eth (BroSDK TokenId)"
        | "evm-sol (BroSDK TokenId)"
        | "evm-link (BroSDK TokenId)",
    >

    A promise that resolves with the known token ID corresponding to the provided contract address, or undefined if the token ID cannot be found or if the chain is not EVM-compatible.

  • This function retrieves the numeric EVM chain ID (chainId) associated with a known EVM-compatible chain in the SDK. This chain ID serves as the identifier for chains within smart contracts.

    Parameters

    • chain:
          | "evm-ethereum (BroSDK ChainId)"
          | "evm-sepolia (BroSDK ChainId)"
          | "evm-bsc (BroSDK ChainId)"
          | "evm-bsctestnet (BroSDK ChainId)"
          | "evm-coredao (BroSDK ChainId)"
          | "evm-coredao-testnet (BroSDK ChainId)"
          | "evm-bsquared (BroSDK ChainId)"
          | "evm-bob (BroSDK ChainId)"
          | "evm-bitlayer (BroSDK ChainId)"
          | "evm-lorenzo (BroSDK ChainId)"
          | "evm-merlin (BroSDK ChainId)"
          | "evm-ailayer (BroSDK ChainId)"
          | "evm-mode (BroSDK ChainId)"
          | "evm-xlayer (BroSDK ChainId)"
          | "evm-arbitrum (BroSDK ChainId)"
          | "evm-aurora (BroSDK ChainId)"
          | "evm-blife-testnet (BroSDK ChainId)"
          | "evm-bitboy-testnet (BroSDK ChainId)"
          | "evm-manta (BroSDK ChainId)"
          | "evm-linea (BroSDK ChainId)"
          | "evm-base (BroSDK ChainId)"
          | "evm-bera-testnet (BroSDK ChainId)"

      A known EVM-compatible chain identifier (KnownChainId.EVMChain).

    Returns Promise<undefined | bigint>

    A promise that resolves with the numeric chainId (as a bigint) corresponding to the specified EVM-compatible chain. Returns undefined if the chain ID is not available or not supported.

  • This function maps a numeric chain ID (chainId) to its corresponding known chain identifier (KnownChainId.EVMChain) used in the SDK.

    Parameters

    • chainId: bigint

      The numeric chain ID (as a bigint) of an EVM-compatible blockchain.

    Returns Promise<
        | undefined
        | "evm-ethereum (BroSDK ChainId)"
        | "evm-sepolia (BroSDK ChainId)"
        | "evm-bsc (BroSDK ChainId)"
        | "evm-bsctestnet (BroSDK ChainId)"
        | "evm-coredao (BroSDK ChainId)"
        | "evm-coredao-testnet (BroSDK ChainId)"
        | "evm-bsquared (BroSDK ChainId)"
        | "evm-bob (BroSDK ChainId)"
        | "evm-bitlayer (BroSDK ChainId)"
        | "evm-lorenzo (BroSDK ChainId)"
        | "evm-merlin (BroSDK ChainId)"
        | "evm-ailayer (BroSDK ChainId)"
        | "evm-mode (BroSDK ChainId)"
        | "evm-xlayer (BroSDK ChainId)"
        | "evm-arbitrum (BroSDK ChainId)"
        | "evm-aurora (BroSDK ChainId)"
        | "evm-blife-testnet (BroSDK ChainId)"
        | "evm-bitboy-testnet (BroSDK ChainId)"
        | "evm-manta (BroSDK ChainId)"
        | "evm-linea (BroSDK ChainId)"
        | "evm-base (BroSDK ChainId)"
        | "evm-bera-testnet (BroSDK ChainId)",
    >

    A promise that resolves with the corresponding known EVM chain ID (KnownChainId.EVMChain), or undefined if the chain ID is not recognized or not supported.

  • This function retrieves the contract address of a specific type of contract (e.g., a bridge endpoint) on a given EVM-compatible blockchain.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The ID of the EVM-compatible blockchain where the contract is deployed.

    • contractType: "BridgeEndpoint"

      The type of contract (e.g., PublicEVMContractType.BridgeEndpoint) for which the address is to be retrieved.

    Returns Promise<undefined | `0x${string}`>

    A promise that resolves with the contract address of the specified type, or undefined if the chain is not EVM-compatible or if the address cannot be retrieved.

  • This function roughly returns a list of possible routes supported by the SDK. It aggregates the results from different blockchain networks (Stacks, EVM, Bitcoin).

    Parameters

    • Optionalconditions: GetSupportedRoutesFn_Conditions

      An optional object containing the conditions for filtering the possible routes:

      • fromChain?: ChainId - The ID of the source blockchain (optional).
      • toChain?: ChainId - The ID of the destination blockchain (optional).
      • fromToken?: TokenId - The ID of the token being transferred from the source blockchain (optional).
      • toToken?: TokenId - The ID of the token expected on the destination blockchain (optional).
      • includeUnpredictableSwapPossibilities?: boolean - Whether to include routes that require token swaps to complete. Note that the ability to perform these swaps cannot be determined at this point, so enabling this option may return routes that cannot actually be completed (optional).

    Returns Promise<KnownRoute[]>

    A promise that resolves with an array of KnownRoute objects, each representing a supported token transfer route between blockchains.

  • This function retrieves a list of time-locked assets for a given wallet address across multiple EVM-compatible blockchain networks. It queries smart contracts to find and return information about the assets that are currently locked in time-based agreements.

    Parameters

    • input: GetTimeLockedAssetsInput

      An object containing the input parameters required for retrieving time-locked assets:

      • walletAddress: EVMAddress - The address of the wallet for which to retrieve the time-locked assets.
      • chains: KnownChainId.EVMChain[] - An array of EVM-compatible blockchains to query for locked assets.

    Returns Promise<GetTimeLockedAssetsOutput>

    A promise that resolves with an object containing a list of time-locked assets:

    • assets: TimeLockedAsset[] - An array of objects, each representing a time-locked asset, including:
      • id: string - The unique identifier of the time-locked agreement.
      • chain: KnownChainId.EVMChain - The blockchain where the asset is locked.
      • token: KnownTokenId.EVMToken - The token that is locked.
      • amount: SDKNumber - The amount of the token that is locked.
      • releaseTime: Date - The time when the asset is scheduled to be released.

    UnsupportedChainError - If any of the provided EVM chains is unsupported or invalid.

  • Determines whether a given route (from one blockchain/token to another) is supported by the SDK. This function evaluates cross-chain compatibility for all supported networks (EVM, Stacks, Bitcoin, BRC20, Runes) by delegating to specialized validators per source chain type. It checks that the route is logically valid, not deprecated, and exists in the bridge configuration which is dynamically fetched.

    Parameters

    • route: DefinedRoute & { swapRoute?: SwapRoute }

      The route to validate, containing:

      • fromChain: the origin blockchain (ChainId)
      • fromToken: the token to bridge from (TokenId)
      • toChain: the destination blockchain (ChainId)
      • toToken: the token to receive on the destination (TokenId)
      • swapRoute? – (optional) An optional swap configuration that may be present in the route object.

    Returns Promise<boolean>

    A promise that resolves to true if the route is supported for bridging, or false if the route is invalid, unsupported, or incomplete.

  • Retrieves the RuneIdCombined associated with a known Runes token on a specific Runes-compatible blockchain. Internally, this function queries the list of supported Runes tokens for the specified chain, and looks up the runesId that corresponds to the provided KnownTokenId.RunesToken.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The Runes-compatible blockchain (runes-mainnet or runes-testnet) to search in.

    • token: "a runes token (BroSDK TokenId)"

      The known Runes token ID (must follow the runes-<id> format).

    Returns Promise<undefined | `${number}:${number}`>

    A promise that resolves with the corresponding RuneIdCombined if found, or undefined if the token is not supported or the chain is invalid.

  • Retrieves the KnownTokenId.RunesToken associated with a given RuneIdCombined on a specific Runes-compatible blockchain. This function queries the list of supported Runes tokens for the specified chain, and returns the known Runes token ID mapped to the provided runesId.

    Always use this function to retrieve a RunesToken ID at runtime. Do not hardcode or cache token IDs, as supported tokens may change dynamically.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The Runes-compatible blockchain (runes-mainnet or runes-testnet) to search in.

    • id: `${number}:${number}`

      The RuneIdCombined representing the unique Runes asset identifier.

    Returns Promise<undefined | "a runes token (BroSDK TokenId)">

    A promise that resolves with the corresponding KnownTokenId.RunesToken, or undefined if the ID is not recognized or the chain is not supported.

  • This function retrieves the Stacks contract address (principal) associated with a known Stacks token ID used by the SDK.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The ID of the Stacks blockchain.

    • token: StacksToken

      The specific token ID for which the contract address is to be retrieved.

    Returns Promise<undefined | StacksContractAddress>

    A promise that resolves with the contract address associated with the specified token, or undefined if the chain is not a Stacks chain or if the contract address cannot be retrieved.

  • This function maps a given Stacks contract address to its corresponding known token ID. Always use this function to retrieve the current KnownTokenId.StacksToken for a contract at runtime.

    Token IDs are dynamically resolved and may change as supported tokens are updated — do not hardcode or cache these values.

    Parameters

    • chain: `${string} (BroSDK ChainId)`

      The ID of the Stacks blockchain.

    • address: StacksContractAddress

      The contract address on the Stacks blockchain.

    Returns Promise<undefined | StacksToken>

    A promise that resolves with the known token ID corresponding to the provided contract address, or undefined if the chain is not a Stacks chain or if the token is not supported by Brotocol.