Interface for communication with the Bridge on-chain contract.
- activeWalletPublicKey
- buildUtxoHash
- deposits
- getChainIdentifier
- pendingRedemptions
- requestRedemption
- revealDeposit
- submitDepositSweepProof
- submitRedemptionProof
- timedOutRedemptions
- txProofDifficultyFactor
- walletRegistry
- wallets
• getDepositRevealedEvents: Function
<DepositRevealedEvent
>
Get emitted DepositRevealed events.
See
GetEventsFunction
src/lib/contracts/bridge.ts:26
• getNewWalletRegisteredEvents: Function
<NewWalletRegisteredEvent
>
Get emitted NewWalletRegisteredEvent events.
See
GetEventsFunction
src/lib/contracts/bridge.ts:155
• getRedemptionRequestedEvents: Function
<RedemptionRequestedEvent
>
Get emitted RedemptionRequested events.
See
GetEventsFunction
src/lib/contracts/bridge.ts:181
▸ activeWalletPublicKey(): Promise
<undefined
| Hex
>
Gets the public key of the current active wallet.
Promise
<undefined
| Hex
>
Compressed (33 bytes long with 02 or 03 prefix) active wallet's public key. If there is no active wallet at the moment, undefined is returned.
src/lib/contracts/bridge.ts:149
▸ buildUtxoHash(utxo
): Hex
Builds the UTXO hash based on the UTXO components.
Name | Type | Description |
---|---|---|
utxo |
BitcoinUtxo |
UTXO components. |
The hash of the UTXO.
src/lib/contracts/bridge.ts:175
▸ deposits(depositTxHash
, depositOutputIndex
): Promise
<DepositRequest
>
Gets a revealed deposit from the on-chain contract.
Name | Type | Description |
---|---|---|
depositTxHash |
BitcoinTxHash |
The revealed deposit transaction's hash. |
depositOutputIndex |
number |
Index of the deposit transaction output that funds the revealed deposit. |
Promise
<DepositRequest
>
Revealed deposit data.
src/lib/contracts/bridge.ts:68
▸ getChainIdentifier(): ChainIdentifier
Gets the chain-specific identifier of this contract.
src/lib/contracts/bridge.ts:20
▸ pendingRedemptions(walletPublicKey
, redeemerOutputScript
): Promise
<RedemptionRequest
>
Gets a pending redemption from the on-chain contract.
Name | Type | Description |
---|---|---|
walletPublicKey |
Hex |
Bitcoin public key of the wallet the request is targeted to. Must be in the compressed form (33 bytes long with 02 or 03 prefix). |
redeemerOutputScript |
Hex |
The redeemer output script the redeemed funds are supposed to be locked on. Must not be prepended with length. |
Promise
<RedemptionRequest
>
Promise with the pending redemption.
src/lib/contracts/bridge.ts:124
▸ requestRedemption(walletPublicKey
, mainUtxo
, redeemerOutputScript
, amount
): Promise
<Hex
>
Requests a redemption from the on-chain contract.
Name | Type | Description |
---|---|---|
walletPublicKey |
Hex |
The Bitcoin public key of the wallet. Must be in the compressed form (33 bytes long with 02 or 03 prefix). |
mainUtxo |
BitcoinUtxo |
The main UTXO of the wallet. Must match the main UTXO held by the on-chain contract. |
redeemerOutputScript |
Hex |
The output script that the redeemed funds will be locked to. Must not be prepended with length. |
amount |
BigNumber |
The amount to be redeemed in satoshis. |
Promise
<Hex
>
Transaction hash of the request redemption transaction.
src/lib/contracts/bridge.ts:84
▸ revealDeposit(depositTx
, depositOutputIndex
, deposit
, vault?
): Promise
<Hex
>
Reveals a given deposit to the on-chain 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 |
Promise
<Hex
>
Transaction hash of the reveal deposit transaction.
src/lib/contracts/bridge.ts:54
▸ submitDepositSweepProof(sweepTx
, sweepProof
, mainUtxo
, vault?
): Promise
<Hex
>
Submits a deposit sweep transaction proof to the on-chain contract.
Name | Type | Description |
---|---|---|
sweepTx |
BitcoinRawTxVectors |
Sweep transaction data. |
sweepProof |
BitcoinSpvProof |
Sweep proof data. |
mainUtxo |
BitcoinUtxo |
Data of the wallet's main UTXO. |
vault? |
ChainIdentifier |
Optional identifier of the vault the swept deposits should be routed in. |
Promise
<Hex
>
Transaction hash of the submit deposit sweep proof transaction.
src/lib/contracts/bridge.ts:37
▸ submitRedemptionProof(redemptionTx
, redemptionProof
, mainUtxo
, walletPublicKey
): Promise
<Hex
>
Submits a redemption transaction proof to the on-chain contract.
Name | Type | Description |
---|---|---|
redemptionTx |
BitcoinRawTxVectors |
Redemption transaction data |
redemptionProof |
BitcoinSpvProof |
Redemption proof data |
mainUtxo |
BitcoinUtxo |
Data of the wallet's main UTXO |
walletPublicKey |
Hex |
Bitcoin public key of the wallet. Must be in the compressed form (33 bytes long with 02 or 03 prefix). |
Promise
<Hex
>
Transaction hash of the submit redemption proof transaction.
src/lib/contracts/bridge.ts:100
▸ timedOutRedemptions(walletPublicKey
, redeemerOutputScript
): Promise
<RedemptionRequest
>
Gets a timed-out redemption from the on-chain contract.
Name | Type | Description |
---|---|---|
walletPublicKey |
Hex |
Bitcoin public key of the wallet the request is targeted to. Must be in the compressed form (33 bytes long with 02 or 03 prefix). |
redeemerOutputScript |
Hex |
The redeemer output script the redeemed funds are supposed to be locked on. Must not be prepended with length. |
Promise
<RedemptionRequest
>
Promise with the pending redemption.
src/lib/contracts/bridge.ts:138
▸ txProofDifficultyFactor(): Promise
<number
>
Gets transaction proof difficulty factor from the on-chain contract.
Promise
<number
>
Proof difficulty factor.
Dev
This number signifies how many confirmations a transaction has to accumulate before it can be proven on-chain.
src/lib/contracts/bridge.ts:113
▸ walletRegistry(): Promise
<WalletRegistry
>
Returns the attached WalletRegistry instance.
Promise
<WalletRegistry
>
src/lib/contracts/bridge.ts:160
▸ wallets(walletPublicKeyHash
): Promise
<Wallet
>
Gets details about a registered wallet.
Name | Type | Description |
---|---|---|
walletPublicKeyHash |
Hex |
The 20-byte wallet public key hash (computed using Bitcoin HASH160 over the compressed ECDSA public key). |
Promise
<Wallet
>
Promise with the wallet details.