- ArbitrumBitcoinDepositor
- ArbitrumExtraDataEncoder
- ArbitrumTBTCToken
- BaseBitcoinDepositor
- BaseTBTCToken
- BitcoinClientWithNetworkOverride
- BitcoinTxHash
- CrossChainDepositor
- Deposit
- DepositFunding
- DepositRefund
- DepositScript
- DepositsService
- ElectrumClient
- EthereumAddress
- EthereumBridge
- EthereumDepositorProxy
- EthereumExtraDataEncoder
- EthereumL1BitcoinDepositor
- EthereumL1BitcoinRedeemer
- EthereumTBTCToken
- EthereumTBTCVault
- EthereumWalletRegistry
- Hex
- MaintenanceService
- OptimisticMinting
- RedemptionsService
- SolanaAddress
- SolanaExtraDataEncoder
- Spv
- StarkNetAddress
- StarkNetBitcoinDepositor
- StarkNetExtraDataEncoder
- StarkNetTBTCToken
- TBTC
- TBTCCore
- WalletTx
- BitcoinClient
- BitcoinDepositor
- BitcoinHeader
- BitcoinRawTx
- BitcoinRawTxVectors
- BitcoinSpvProof
- BitcoinTx
- BitcoinTxMerkleBranch
- BitcoinTxOutpoint
- BitcoinTxOutput
- Bridge
- ChainEvent
- ChainIdentifier
- CrossChainContractsLoader
- DepositReceipt
- DepositRequest
- DepositorProxy
- DestinationChainTBTCToken
- ElectrumCredentials
- EthereumContractConfig
- ExtraDataEncoder
- L1BitcoinRedeemer
- L2BitcoinRedeemer
- RedeemerProxy
- RedemptionRequest
- RedemptionWallet
- SerializableWallet
- StarkNetBitcoinDepositorConfig
- StarkNetTBTCTokenConfig
- TBTCToken
- TBTCVault
- ValidRedemptionWallet
- Wallet
- WalletRegistry
- BitcoinTxInput
- BitcoinUtxo
- ChainMapping
- CrossChainContracts
- CrossChainDepositorMode
- CrossChainExtraDataEncoder
- CrossChainInterfaces
- DepositRevealedEvent
- DestinationChainInterfaces
- DestinationChainName
- DkgResultApprovedEvent
- DkgResultChallengedEvent
- DkgResultSubmittedEvent
- ElectrumClientOptions
- ErrorMatcherFn
- EthereumSigner
- ExecutionLoggerFn
- L1BitcoinDepositor
- L1CrossChainContracts
- L2BitcoinDepositor
- L2Chain
- L2CrossChainContracts
- L2TBTCToken
- NewWalletRegisteredEvent
- OptimisticMintingCancelledEvent
- OptimisticMintingFinalizedEvent
- OptimisticMintingRequest
- OptimisticMintingRequestedEvent
- RedemptionRequestedEvent
- RetrierFn
- StarkNetDepositorConfig
- StarkNetProvider
- TBTCContracts
- ArbitrumCrossChainExtraDataEncoder
- ArbitrumL2BitcoinDepositor
- ArbitrumL2TBTCToken
- BaseL2BitcoinDepositor
- BaseL2TBTCToken
- BitcoinAddressConverter
- BitcoinCompactSizeUint
- BitcoinHashUtils
- BitcoinHeaderSerializer
- BitcoinLocktimeUtils
- BitcoinPrivateKeyUtils
- BitcoinPublicKeyUtils
- BitcoinScriptUtils
- BitcoinTargetConverter
- ChainMappings
- EthereumCrossChainExtraDataEncoder
- SolanaCrossChainExtraDataEncoder
- StarkNetCrossChainExtraDataEncoder
- StarkNetDepositor
- WORMHOLE_CHAIN_IDS
- tbtcABI
- amountToSatoshi
- assembleBitcoinSpvProof
- backoffRetrier
- chainIdFromSigner
- computeElectrumScriptHash
- decodeDestinationReceiver
- encodeDestinationReceiver
- ethereumAddressFromSigner
- ethereumCrossChainContractsLoader
- extractBitcoinRawTxVectors
- getChainIdFromEncodedReceiver
- getRecipientFromEncodedReceiver
- isValidEncodedReceiver
- loadArbitrumCrossChainContracts
- loadArbitrumCrossChainInterfaces
- loadBaseCrossChainContracts
- loadBaseCrossChainInterfaces
- loadEthereumCoreContracts
- loadSolanaCrossChainInterfaces
- loadStarkNetCrossChainContracts
- loadStarkNetCrossChainInterfaces
- packRevealDepositParameters
- retryAll
- skipRetryWhenMatched
- toBitcoinJsLibNetwork
- validateBitcoinHeadersChain
- validateBitcoinSpvProof
- validateDepositReceipt
Ƭ BitcoinTxInput: BitcoinTxOutpoint & { scriptSig: Hex }
Data about a Bitcoin transaction input.
Ƭ BitcoinUtxo: BitcoinTxOutpoint & { value: BigNumber }
Data about a Bitcoin unspent transaction output.
Ƭ ChainMapping: Object
Type representing a mapping between specific L1 and L2 chains.
| Name | Type | Description |
|---|---|---|
arbitrum? |
Arbitrum |
Identifier of the Arbitrum L2 chain. |
base? |
Base |
Identifier of the Base L2 chain. |
ethereum? |
Ethereum |
Identifier of the Ethereum L1 chain. |
solana? |
Solana |
Identifier of the Solana chain. |
starknet? |
StarkNet |
Identifier of the StarkNet L2 chain. |
sui? |
Sui |
Identifier of the SUI L2 chain. |
Ƭ CrossChainContracts: CrossChainInterfaces
Deprecated
Use CrossChainInterfaces instead
lib/contracts/cross-chain.ts:252
Ƭ CrossChainDepositorMode: "L2Transaction" | "L1Transaction"
Mode of operation for the cross-chain depositor proxy:
- [L2Transaction]: The proxy will reveal the deposit using a transaction on the L2 chain. The tBTC system is responsible for relaying the deposit to the tBTC L1 chain.
- [L1Transaction]: The proxy will directly reveal the deposit using a transaction on the tBTC L1 chain.
services/deposits/cross-chain.ts:21
Ƭ CrossChainExtraDataEncoder: ExtraDataEncoder
Deprecated
Use ExtraDataEncoder instead
lib/contracts/cross-chain.ts:272
Ƭ CrossChainInterfaces: DestinationChainInterfaces & L1CrossChainContracts
Convenience type aggregating TBTC cross-chain contracts forming a connector between TBTC L1 ledger chain and a specific supported destination chain.
lib/contracts/cross-chain.ts:13
Ƭ DepositRevealedEvent: DepositReceipt & Pick<DepositRequest, "amount" | "vault"> & { fundingOutputIndex: number ; fundingTxHash: BitcoinTxHash } & ChainEvent
Represents an event emitted on deposit reveal to the on-chain bridge.
Ƭ DestinationChainInterfaces: Object
Aggregates destination chain-specific TBTC cross-chain contracts.
| Name | Type |
|---|---|
destinationChainBitcoinDepositor |
BitcoinDepositor |
destinationChainTbtcToken |
DestinationChainTBTCToken |
l2BitcoinRedeemer? |
L2BitcoinRedeemer |
lib/contracts/cross-chain.ts:19
Ƭ DestinationChainName: Exclude<keyof typeof Chains, "Ethereum">
Destination chains supported by tBTC v2 contracts. These are chains other than the main Ethereum L1 chain.
Ƭ DkgResultApprovedEvent: { approver: ChainIdentifier ; resultHash: Hex } & ChainEvent
Represents an event emitted when a DKG result is approved on the on-chain wallet registry.
lib/contracts/wallet-registry.ts:64
Ƭ DkgResultChallengedEvent: { challenger: ChainIdentifier ; reason: string ; resultHash: Hex } & ChainEvent
Represents an event emitted when a DKG result is challenged on the on-chain wallet registry.
lib/contracts/wallet-registry.ts:79
Ƭ DkgResultSubmittedEvent: { result: DkgResult ; resultHash: Hex ; seed: Hex } & ChainEvent
Represents an event emitted when a DKG result is submitted to the on-chain wallet registry.
lib/contracts/wallet-registry.ts:45
Ƭ ElectrumClientOptions: object
Additional options used by the Electrum server.
Ƭ ErrorMatcherFn: (err: unknown) => boolean
▸ (err): boolean
| Name | Type |
|---|---|
err |
unknown |
boolean
Ƭ EthereumSigner: Signer | providers.Provider
Represents an Ethereum signer. This type is a wrapper for Ethers-specific types and can be either a Signer that can make write transactions or a Provider that works only in the read-only mode.
Ƭ ExecutionLoggerFn: (msg: string) => void
A function that is called with execution status messages.
▸ (msg): void
| Name | Type |
|---|---|
msg |
string |
void
Ƭ L1BitcoinDepositor: BitcoinDepositor & { extraDataEncoder: () => ExtraDataEncoder ; getChainIdentifier: () => ChainIdentifier ; getDepositState: (depositId: string) => Promise<DepositState> ; initializeDeposit: (depositTx: BitcoinRawTxVectors, depositOutputIndex: number, deposit: DepositReceipt, vault?: ChainIdentifier) => Promise<any> }
Interface for communication with the L1BitcoinDepositor on-chain contract specific to the given L2 chain, deployed on the L1 chain.
lib/contracts/cross-chain.ts:163
Ƭ L1CrossChainContracts: Object
Aggregates L1-specific TBTC cross-chain contracts.
| Name | Type |
|---|---|
l1BitcoinDepositor |
L1BitcoinDepositor |
l1BitcoinRedeemer |
L1BitcoinRedeemer | null |
lib/contracts/cross-chain.ts:28
Ƭ L2BitcoinDepositor: BitcoinDepositor
Deprecated
Use BitcoinDepositor instead
lib/contracts/cross-chain.ts:267
Ƭ L2Chain: DestinationChainName
Deprecated
Use DestinationChainName instead
Ƭ L2CrossChainContracts: DestinationChainInterfaces
Deprecated
Use DestinationChainInterfaces instead
lib/contracts/cross-chain.ts:257
Ƭ L2TBTCToken: DestinationChainTBTCToken
Deprecated
Use DestinationChainTBTCToken instead
lib/contracts/cross-chain.ts:262
Ƭ NewWalletRegisteredEvent: { ecdsaWalletID: Hex ; walletPublicKeyHash: Hex } & ChainEvent
Represents an event emitted when new wallet is registered on the on-chain bridge.
Ƭ OptimisticMintingCancelledEvent: { depositKey: Hex ; guardian: ChainIdentifier } & ChainEvent
Represents an event that is emitted when an optimistic minting request is cancelled on chain.
lib/contracts/tbtc-vault.ts:170
Ƭ OptimisticMintingFinalizedEvent: { depositKey: Hex ; depositor: ChainIdentifier ; minter: ChainIdentifier ; optimisticMintingDebt: BigNumber } & ChainEvent
Represents an event that is emitted when an optimistic minting request is finalized on chain.
lib/contracts/tbtc-vault.ts:186
Ƭ OptimisticMintingRequest: Object
Represents optimistic minting request for the given deposit revealed to the Bridge.
| Name | Type | Description |
|---|---|---|
finalizedAt |
number |
UNIX timestamp at which the optimistic minting was finalized. 0 if not yet finalized. |
requestedAt |
number |
UNIX timestamp at which the optimistic minting was requested. |
lib/contracts/tbtc-vault.ts:120
Ƭ OptimisticMintingRequestedEvent: { amount: BigNumber ; depositKey: Hex ; depositor: ChainIdentifier ; fundingOutputIndex: number ; fundingTxHash: BitcoinTxHash ; minter: ChainIdentifier } & ChainEvent
Represents an event that is emitted when a new optimistic minting is requested on chain.
lib/contracts/tbtc-vault.ts:136
Ƭ RedemptionRequestedEvent: Omit<RedemptionRequest, "requestedAt"> & { walletPublicKeyHash: Hex } & ChainEvent
Represents an event emitted on redemption request.
Ƭ RetrierFn<T>: (fn: () => Promise<T>) => Promise<T>
| Name |
|---|
T |
▸ (fn): Promise<T>
| Name | Type | Description |
|---|---|---|
fn |
() => Promise<T> |
The function to be retried. |
Promise<T>
Ƭ StarkNetDepositorConfig: StarkNetBitcoinDepositorConfig
Deprecated
Use StarkNetBitcoinDepositorConfig instead
lib/starknet/starknet-depositor.ts:67
Ƭ StarkNetProvider: Provider | Account
Represents a StarkNet provider that can be either a Provider or Account instance. This follows the pattern similar to Solana's Connection type.
- Provider: For read-only operations (e.g., balance queries)
- Account: For write operations (e.g., transactions)
Ƭ TBTCContracts: Object
Convenience type aggregating all TBTC core contracts.
| Name | Type |
|---|---|
bridge |
Bridge |
tbtcToken |
TBTCToken |
tbtcVault |
TBTCVault |
walletRegistry |
WalletRegistry |
• Const ArbitrumCrossChainExtraDataEncoder: typeof ArbitrumExtraDataEncoder = ArbitrumExtraDataEncoder
Deprecated
Use ArbitrumExtraDataEncoder instead
lib/arbitrum/l2-bitcoin-depositor.ts:159
• Const ArbitrumL2BitcoinDepositor: typeof ArbitrumBitcoinDepositor = ArbitrumBitcoinDepositor
Deprecated
Use ArbitrumBitcoinDepositor instead
lib/arbitrum/l2-bitcoin-depositor.ts:154
• Const ArbitrumL2TBTCToken: typeof ArbitrumTBTCToken = ArbitrumTBTCToken
Deprecated
Use ArbitrumTBTCToken instead
lib/arbitrum/l2-tbtc-token.ts:63
• Const BaseL2BitcoinDepositor: typeof BaseBitcoinDepositor = BaseBitcoinDepositor
Deprecated
Use BaseBitcoinDepositor instead
lib/base/l2-bitcoin-depositor.ts:124
• Const BaseL2TBTCToken: typeof BaseTBTCToken = BaseTBTCToken
Deprecated
Use BaseTBTCToken instead
• Const BitcoinAddressConverter: Object
Utility functions allowing to perform Bitcoin address conversions.
| Name | Type |
|---|---|
addressToOutputScript |
(address: string, bitcoinNetwork: BitcoinNetwork) => Hex |
addressToPublicKeyHash |
(address: string, bitcoinNetwork: BitcoinNetwork) => Hex |
outputScriptToAddress |
(script: Hex, bitcoinNetwork: BitcoinNetwork) => string |
publicKeyHashToAddress |
(publicKeyHash: Hex, witness: boolean, bitcoinNetwork: BitcoinNetwork) => string |
publicKeyToAddress |
(publicKey: Hex, bitcoinNetwork: BitcoinNetwork, witness: boolean) => string |
• Const BitcoinCompactSizeUint: Object
Utility functions allowing to deal with Bitcoin compact size uints.
| Name | Type |
|---|---|
read |
(varLenData: Hex) => { byteLength: number ; value: number } |
• Const BitcoinHashUtils: Object
Utility functions allowing to deal with Bitcoin hashes.
| Name | Type |
|---|---|
computeHash160 |
(text: Hex) => Hex |
computeHash256 |
(text: Hex) => Hex |
computeSha256 |
(text: Hex) => Hex |
hashLEToBigNumber |
(hash: Hex) => BigNumber |
• Const BitcoinHeaderSerializer: Object
Utility functions allowing to serialize and deserialize Bitcoin block headers.
| Name | Type |
|---|---|
deserializeHeader |
(rawHeader: Hex) => BitcoinHeader |
deserializeHeadersChain |
(rawHeadersChain: Hex) => BitcoinHeader[] |
serializeHeader |
(header: BitcoinHeader) => Hex |
• Const BitcoinLocktimeUtils: Object
Utility functions allowing to deal with Bitcoin locktime.
| Name | Type |
|---|---|
calculateLocktime |
(locktimeStartedAt: number, locktimeDuration: number) => Hex |
locktimeToNumber |
(locktimeLE: string | Buffer<ArrayBufferLike>) => number |
• Const BitcoinPrivateKeyUtils: Object
Utility functions allowing to perform operations on Bitcoin ECDSA private keys.
| Name | Type |
|---|---|
createKeyPair |
(privateKey: string, bitcoinNetwork: BitcoinNetwork) => ECPairInterface |
• Const BitcoinPublicKeyUtils: Object
Utility functions allowing to perform operations on Bitcoin ECDSA public keys.
| Name | Type |
|---|---|
compressPublicKey |
(publicKey: Hex) => string |
isCompressedPublicKey |
(publicKey: Hex) => boolean |
• Const BitcoinScriptUtils: Object
Utility functions allowing to deal with Bitcoin scripts.
| Name | Type |
|---|---|
isP2PKHScript |
(script: Hex) => boolean |
isP2SHScript |
(script: Hex) => boolean |
isP2WPKHScript |
(script: Hex) => boolean |
isP2WSHScript |
(script: Hex) => boolean |
• Const BitcoinTargetConverter: Object
Utility functions allowing to perform Bitcoin target conversions.
| Name | Type |
|---|---|
bitsToTarget |
(bits: number) => BigNumber |
targetToDifficulty |
(target: BigNumber) => BigNumber |
• Const ChainMappings: ChainMapping[]
List of chain mappings supported by tBTC v2 contracts.
• Const EthereumCrossChainExtraDataEncoder: typeof EthereumExtraDataEncoder = EthereumExtraDataEncoder
Deprecated
Use EthereumExtraDataEncoder instead
lib/ethereum/l1-bitcoin-depositor.ts:215
• Const SolanaCrossChainExtraDataEncoder: typeof SolanaExtraDataEncoder = SolanaExtraDataEncoder
Deprecated
Use SolanaExtraDataEncoder instead
lib/solana/extra-data-encoder.ts:60
• Const StarkNetCrossChainExtraDataEncoder: typeof StarkNetExtraDataEncoder = StarkNetExtraDataEncoder
Deprecated
Use StarkNetExtraDataEncoder instead
lib/starknet/extra-data-encoder.ts:67
• Const StarkNetDepositor: typeof StarkNetBitcoinDepositor = StarkNetBitcoinDepositor
Deprecated
Use StarkNetBitcoinDepositor instead
lib/starknet/starknet-depositor.ts:527
• Const WORMHOLE_CHAIN_IDS: Object
Mapping of chain identifiers to their corresponding Wormhole chain IDs. Use these constants instead of hardcoded chain IDs when encoding destination receivers for NTT (Native Token Transfer) bridges.
Example
import { WORMHOLE_CHAIN_IDS, Chains, encodeDestinationReceiver } from "@keep-network/tbtc-v2"
const encoded = encodeDestinationReceiver(
WORMHOLE_CHAIN_IDS[Chains.Ethereum.Sepolia],
"0x1234567890123456789012345678901234567890"
)| Name | Type |
|---|---|
1 |
number |
11155111 |
number |
• Const tbtcABI: StarkNetABIEntry[]
tBTC token ABI for StarkNet Includes standard ERC20 functions needed for tBTC operations
▸ amountToSatoshi(value): BigNumber
Converts the amount to Satoshi precision.
| Name | Type | Description |
|---|---|---|
value |
BigNumber |
The amount to be converted. |
BigNumber
The amount in Satoshi precision.
▸ assembleBitcoinSpvProof(transactionHash, requiredConfirmations, bitcoinClient): Promise<BitcoinTx & BitcoinSpvProof>
Assembles a proof that a given transaction was included in the blockchain and has accumulated the required number of confirmations.
| Name | Type | Description |
|---|---|---|
transactionHash |
BitcoinTxHash |
Hash of the transaction being proven. |
requiredConfirmations |
number |
Required number of confirmations. |
bitcoinClient |
BitcoinClient |
Bitcoin client used to interact with the network. |
Promise<BitcoinTx & BitcoinSpvProof>
Bitcoin transaction along with the inclusion proof.
▸ backoffRetrier<T>(retries, backoffStepMs?, logger?, errorMatcher?): RetrierFn<T>
Returns a retrier that can be passed a function to be retried retries
number of times, with exponential backoff. The result will return the
function's return value if no exceptions are thrown. It will only retry if
the function throws an exception matched by matcher; {@see retryAll} can
be used to retry no matter the exception, though this is not necessarily
recommended in production.
Example usage:
await url.get("https://example.com/") // may transiently fail
// Retries 3 times with exponential backoff, no matter what error is
// reported by `url.get`.
backoffRetrier(3)(async () => url.get("https://example.com"))
// Retries 3 times with exponential backoff, but only if the error
// message includes "server unavailable".
backoffRetrier(3, (_) => _.message.includes('server unavailable'))(
async () => url.get("https://example.com"))
)
| Name |
|---|
T |
| Name | Type | Default value | Description |
|---|---|---|---|
retries |
number |
undefined |
The number of retries to perform before bubbling the failure out. |
backoffStepMs |
number |
1000 |
Initial backoff step in milliseconds that will be increased exponentially for subsequent retry attempts. (default = 1000 ms) |
logger |
ExecutionLoggerFn |
console.debug |
A logger function to pass execution messages. |
errorMatcher? |
ErrorMatcherFn |
retryAll |
A matcher function that receives the error when an exception is thrown, and returns true if the error should lead to a retry. A false return will rethrow the error and terminate the retry loop. |
RetrierFn<T>
A function that can retry any function.
▸ chainIdFromSigner(signer): Promise<string>
Resolves the chain ID from the given signer.
| Name | Type | Description |
|---|---|---|
signer |
EthereumSigner |
The signer whose chain ID should be resolved. |
Promise<string>
Chain ID as a string.
▸ computeElectrumScriptHash(script): string
Converts a Bitcoin script to an Electrum script hash. See [Electrum protocol]https://electrumx.readthedocs.io/en/stable/protocol-basics.html#script-hashes
| Name | Type | Description |
|---|---|---|
script |
Hex |
Bitcoin script as hex string |
string
Electrum script hash as a hex string.
▸ decodeDestinationReceiver(encodedReceiver): Object
Decodes destination chain ID and recipient address from encoded receiver data.
| Name | Type | Description |
|---|---|---|
encodedReceiver |
string | Hex |
The encoded receiver data (32 bytes) |
Object
Object containing the decoded chain ID and recipient address
| Name | Type |
|---|---|
chainId |
number |
recipient |
string |
Example
const { chainId, recipient } = decodeDestinationReceiver("0x2712000000000000000000001234567890123456789012345678901234567890")
// Returns: { chainId: 10002, recipient: "0x1234567890123456789012345678901234567890" }▸ encodeDestinationReceiver(chainId, recipient): Hex
Encodes destination chain ID and recipient address into a 32-byte value.
| Name | Type | Description |
|---|---|---|
chainId |
number |
Wormhole chain ID of the destination chain (uint16) |
recipient |
string |
Recipient address on the destination chain (20 bytes) |
The encoded receiver data as a 32-byte hex string
Example
const encoded = encodeDestinationReceiver(10002, "0x1234567890123456789012345678901234567890")
// Returns: "0x2712000000000000000000001234567890123456789012345678901234567890"▸ ethereumAddressFromSigner(signer): Promise<EthereumAddress | undefined>
Resolves the Ethereum address tied to the given signer. The address cannot be resolved for signers that works in the read-only mode
| Name | Type | Description |
|---|---|---|
signer |
EthereumSigner |
The signer whose address should be resolved. |
Promise<EthereumAddress | undefined>
Ethereum address or undefined for read-only signers.
Throws
Throws an error if the address of the signer is not a proper Ethereum address.
▸ ethereumCrossChainContractsLoader(signer, chainId): Promise<CrossChainContractsLoader>
Creates the Ethereum implementation of tBTC cross-chain contracts loader. The provided signer is attached to loaded L1 contracts. The given Ethereum chain ID is used to load the L1 contracts and resolve the chain mapping that provides corresponding L2 chains IDs.
| Name | Type | Description |
|---|---|---|
signer |
EthereumSigner |
Ethereum L1 signer. |
chainId |
Ethereum |
Ethereum L1 chain ID. |
Promise<CrossChainContractsLoader>
Loader for tBTC cross-chain contracts.
Throws
Throws an error if the signer's Ethereum chain ID is other than the one used to construct the loader.
lib/ethereum/cross-chain.ts:29
▸ extractBitcoinRawTxVectors(rawTransaction): BitcoinRawTxVectors
Decomposes a transaction in the raw representation into version, vector of inputs, vector of outputs and locktime.
| Name | Type | Description |
|---|---|---|
rawTransaction |
BitcoinRawTx |
Transaction in the raw format. |
Transaction data with fields represented as un-prefixed hex strings.
▸ getChainIdFromEncodedReceiver(encodedReceiver): number
Gets the chain ID from encoded receiver data without full decoding.
| Name | Type | Description |
|---|---|---|
encodedReceiver |
string | Hex |
The encoded receiver data |
number
The chain ID
▸ getRecipientFromEncodedReceiver(encodedReceiver): string
Gets the recipient address from encoded receiver data without full decoding.
| Name | Type | Description |
|---|---|---|
encodedReceiver |
string | Hex |
The encoded receiver data |
string
The recipient address
▸ isValidEncodedReceiver(encodedReceiver): boolean
Validates that an encoded receiver has the correct format.
| Name | Type | Description |
|---|---|---|
encodedReceiver |
string | Hex |
The encoded receiver data to validate |
boolean
True if the format is valid, false otherwise
▸ loadArbitrumCrossChainContracts(signer, chainId): Promise<DestinationChainInterfaces>
| Name | Type |
|---|---|
signer |
EthereumSigner |
chainId |
Arbitrum |
Promise<DestinationChainInterfaces>
Deprecated
Use loadArbitrumCrossChainInterfaces instead
▸ loadArbitrumCrossChainInterfaces(signer, chainId): Promise<DestinationChainInterfaces>
Loads Arbitrum implementation of tBTC cross-chain interfaces for the given Arbitrum chain ID and attaches the given signer there.
| Name | Type | Description |
|---|---|---|
signer |
EthereumSigner |
Signer that should be attached to the contracts. |
chainId |
Arbitrum |
Arbitrum chain ID. |
Promise<DestinationChainInterfaces>
Handle to the contracts.
Throws
Throws an error if the signer's Arbitrum chain ID is other than the one used to load contracts.
▸ loadBaseCrossChainContracts(signer, chainId): Promise<DestinationChainInterfaces>
| Name | Type |
|---|---|
signer |
EthereumSigner |
chainId |
Base |
Promise<DestinationChainInterfaces>
Deprecated
Use loadBaseCrossChainInterfaces instead
▸ loadBaseCrossChainInterfaces(signer, chainId): Promise<DestinationChainInterfaces>
Loads Base implementation of tBTC cross-chain contracts for the given Base chain ID and attaches the given signer there.
| Name | Type | Description |
|---|---|---|
signer |
EthereumSigner |
Signer that should be attached to the contracts. |
chainId |
Base |
Base chain ID. |
Promise<DestinationChainInterfaces>
Handle to the contracts.
Throws
Throws an error if the signer's Base chain ID is other than the one used to load contracts.
▸ loadEthereumCoreContracts(signer, chainId): Promise<TBTCContracts>
Loads Ethereum implementation of tBTC core contracts for the given Ethereum chain ID and attaches the given signer there.
| Name | Type | Description |
|---|---|---|
signer |
EthereumSigner |
Signer that should be attached to tBTC contracts. |
chainId |
Ethereum |
Ethereum chain ID. |
Promise<TBTCContracts>
Handle to tBTC core contracts.
Throws
Throws an error if the signer's Ethereum chain ID is other than the one used to load tBTC contracts.
▸ loadSolanaCrossChainInterfaces(solanaProvider): Promise<DestinationChainInterfaces>
Loads Solana implementation of tBTC cross-chain interfaces using an AnchorProvider (which includes the connection and the wallet).
| Name | Type | Description |
|---|---|---|
solanaProvider |
AnchorProvider |
Anchor provider for Solana. Must include both connection and wallet. |
Promise<DestinationChainInterfaces>
Handle to the cross-chain interfaces for the TBTC interface on Solana.
Throws
If the connection's genesis hash does not match the expected genesisHash.
▸ loadStarkNetCrossChainContracts(walletAddress, provider?, chainId?): Promise<DestinationChainInterfaces>
| Name | Type | Default value |
|---|---|---|
walletAddress |
string |
undefined |
provider? |
StarkNetProvider |
undefined |
chainId |
string |
Chains.StarkNet.Sepolia |
Promise<DestinationChainInterfaces>
Deprecated
Use loadStarkNetCrossChainInterfaces instead
▸ loadStarkNetCrossChainInterfaces(walletAddress, provider?, chainId?): Promise<DestinationChainInterfaces>
Loads StarkNet implementation of tBTC cross-chain contracts. Now supports balance queries with deployed tBTC contracts and enhanced configuration.
| Name | Type | Default value | Description |
|---|---|---|---|
walletAddress |
string |
undefined |
The StarkNet wallet address to use as deposit owner |
provider? |
StarkNetProvider |
undefined |
Optional StarkNet provider for blockchain interactions |
chainId |
string |
Chains.StarkNet.Sepolia |
Optional chain ID (defaults to Sepolia) |
Promise<DestinationChainInterfaces>
Handle to the contracts
▸ packRevealDepositParameters(depositTx, depositOutputIndex, deposit, vault?): Object
Packs deposit parameters to match the ABI of the revealDeposit and revealDepositWithExtraData functions of the Ethereum Bridge contract.
| Name | Type | Description |
|---|---|---|
depositTx |
BitcoinRawTxVectors |
Deposit transaction data |
depositOutputIndex |
number |
Index of the deposit transaction output that funds the revealed deposit |
deposit |
DepositReceipt |
Data of the revealed deposit |
vault? |
ChainIdentifier |
Optional parameter denoting the vault the given deposit should be routed to |
Object
Packed parameters.
| Name | Type |
|---|---|
extraData |
undefined | string |
fundingTx |
{ inputVector: string ; locktime: string ; outputVector: string ; version: string } |
fundingTx.inputVector |
string |
fundingTx.locktime |
string |
fundingTx.outputVector |
string |
fundingTx.version |
string |
reveal |
{ blindingFactor: string ; fundingOutputIndex: number = depositOutputIndex; refundLocktime: string ; refundPubKeyHash: string ; vault: string ; walletPubKeyHash: string } |
reveal.blindingFactor |
string |
reveal.fundingOutputIndex |
number |
reveal.refundLocktime |
string |
reveal.refundPubKeyHash |
string |
reveal.vault |
string |
reveal.walletPubKeyHash |
string |
▸ retryAll(error): true
A convenience matcher for withBackoffRetries that retries irrespective of the error.
| Name | Type | Description |
|---|---|---|
error |
any |
The error to match against. Not necessarily an Error instance, since the retriable function may throw a non-Error. |
true
Always returns true.
▸ skipRetryWhenMatched(matchers): ErrorMatcherFn
A matcher to specify list of error messages that should abort the retry loop and throw immediately.
| Name | Type | Description |
|---|---|---|
matchers |
(string | RegExp)[] |
List of patterns for error matching. |
Matcher function that returns false if error matches one of the patterns. True is returned if no matches are found and retry loop should continue
▸ toBitcoinJsLibNetwork(bitcoinNetwork): networks.Network
Converts the provided BitcoinNetwork enumeration to a format expected
by the bitcoinjs-lib library.
| Name | Type | Description |
|---|---|---|
bitcoinNetwork |
BitcoinNetwork |
Specified Bitcoin network. |
networks.Network
Network representation compatible with the bitcoinjs-lib library.
Throws
An error if the network is not supported by bitcoinjs-lib.
▸ validateBitcoinHeadersChain(headers, previousEpochDifficulty, currentEpochDifficulty): void
Validates a chain of consecutive block headers by checking each header's difficulty, hash, and continuity with the previous header. This function can be used to validate a series of Bitcoin block headers for their validity.
| Name | Type | Description |
|---|---|---|
headers |
BitcoinHeader[] |
An array of block headers that form the chain to be validated. |
previousEpochDifficulty |
BigNumber |
The difficulty of the previous Bitcoin epoch. |
currentEpochDifficulty |
BigNumber |
The difficulty of the current Bitcoin epoch. |
void
An empty return value.
Dev
The block headers must come from Bitcoin epochs with difficulties marked by the previous and current difficulties. If a Bitcoin difficulty relay is used to provide these values and the relay is up-to-date, only the recent block headers will pass validation. Block headers older than the current and previous Bitcoin epochs will fail.
Throws
If any of the block headers are invalid, or if the block header chain is not continuous.
▸ validateBitcoinSpvProof(transactionHash, requiredConfirmations, previousDifficulty, currentDifficulty, bitcoinClient): Promise<void>
Proves that a transaction with the given hash is included in the Bitcoin blockchain by validating the transaction's inclusion in the Merkle tree and verifying that the block containing the transaction has enough confirmations.
| Name | Type | Description |
|---|---|---|
transactionHash |
BitcoinTxHash |
The hash of the transaction to be validated. |
requiredConfirmations |
number |
The number of confirmations required for the transaction to be considered valid. The transaction has 1 confirmation when it is in the block at the current blockchain tip. Every subsequent block added to the blockchain is one additional confirmation. |
previousDifficulty |
BigNumber |
The difficulty of the previous Bitcoin epoch. |
currentDifficulty |
BigNumber |
The difficulty of the current Bitcoin epoch. |
bitcoinClient |
BitcoinClient |
The client for interacting with the Bitcoin blockchain. |
Promise<void>
An empty return value.
Throws
If the transaction is not included in the Bitcoin blockchain or if the block containing the transaction does not have enough confirmations.
Dev
The function should be used within a try-catch block.
▸ validateDepositReceipt(receipt): void
Validates the given deposit receipt. Throws in case of a validation error.
| Name | Type | Description |
|---|---|---|
receipt |
DepositReceipt |
The validated deposit receipt. |
void
Dev
This function does not validate the depositor's identifier as its validity is chain-specific. This parameter must be validated outside.