The source Bitcoin chain (Mainnet
or Testnet
).
The destination chain (must be a known chain, although it is not used in address generation).
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
.
The blockchain network (must be a valid BRC20 chain, like brc20-mainnet
or brc20-testnet
).
The known BRC20 token identifier (must follow the brc20-<tick>
format).
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.
The blockchain network to search in (must be a BRC20-compatible chain such as brc20-mainnet
or brc20-testnet
).
The BRC20 tick (e.g., "ordi", "pepe") to look up.
A promise that resolves with the associated KnownTokenId.BRC20Token
,
or undefined
if no match is found or the chain is not supported.
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.
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
.A promise that resolves with the transaction ID (tx
) of the bridging operation.
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.
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.A promise that resolves with the Bitcoin transaction ID (txid
) of the bridging operation.
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.
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.A promise that resolves with the transaction hash (txHash
) of the bridging operation.
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.
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.A promise that resolves with the transaction ID (txid
) of the bridging operation.
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.
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.A promise that resolves with the transaction ID (txid
) of the bridging operation.
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.
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.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.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.
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.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.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.
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.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.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.
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.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.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.
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.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.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.
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.A promise that resolves with the transaction hash (txHash
) of the claiming operation, or undefined
if the operation fails.
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.
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.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.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.
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.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.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.
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.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.This function retrieves the contract address of a specific token on a given EVM-compatible blockchain.
The ID of the EVM-compatible blockchain where the token contract is deployed.
The specific token ID for which the contract address is to be retrieved.
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.
The ID of the EVM-compatible blockchain where the contract is deployed.
The contract address on the EVM-compatible blockchain.
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.
A known EVM-compatible chain identifier (KnownChainId.EVMChain
).
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.
The numeric chain ID (as a bigint
) of an EVM-compatible blockchain.
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.
The ID of the EVM-compatible blockchain where the contract is deployed.
The type of contract (e.g., PublicEVMContractType.BridgeEndpoint
)
for which the address is to be retrieved.
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).
Optional
conditions: GetSupportedRoutesFn_ConditionsAn 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).A promise that resolves with an array of KnownRoute
objects, each representing a supported
token transfer route between blockchains.
Optional
conditions: GetSupportedRoutesFn_ConditionsThis 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.
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.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.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.
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.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
.
The Runes-compatible blockchain (runes-mainnet
or runes-testnet
) to search in.
The known Runes token ID (must follow the runes-<id>
format).
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.
The Runes-compatible blockchain (runes-mainnet
or runes-testnet
) to search in.
The RuneIdCombined
representing the unique Runes asset identifier.
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.
The ID of the Stacks blockchain.
The specific token ID for which the contract address is to be retrieved.
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.
The ID of the Stacks blockchain.
The contract address on the Stacks blockchain.
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.
Static
default
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.