Skip to content

@liquality.bitcoin.BitcoinSwapBaseProvider

Krasimir Raykov edited this page Mar 30, 2022 · 4 revisions

Class: BitcoinSwapBaseProvider

@liquality/bitcoin.BitcoinSwapBaseProvider

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new BitcoinSwapBaseProvider(options, walletProvider)

Parameters

Name Type
options BitcoinSwapProviderOptions
walletProvider IBitcoinWallet<BitcoinBaseChainProvider, any>

Overrides

Swap.constructor

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:22

Properties

_mode

Protected _mode: SwapMode

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:20


_network

Protected _network: BitcoinNetwork

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:19


walletProvider

Protected walletProvider: IBitcoinWallet<BitcoinBaseChainProvider, any>

Inherited from

Swap.walletProvider

Defined in

client/dist/lib/Swap.d.ts:4

Methods

canUpdateFee

canUpdateFee(): boolean

Returns

boolean

Overrides

Swap.canUpdateFee

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:355


claimSwap

claimSwap(swapParams, initiationTxHash, secret, feePerByte): Promise<Transaction<Transaction>>

Claim the swap

Parameters

Name Type
swapParams SwapParams
initiationTxHash string
secret string
feePerByte number

Returns

Promise<Transaction<Transaction>>

Overrides

Swap.claimSwap

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:53


doesTransactionMatchInitiation

Protected doesTransactionMatchInitiation(swapParams, transaction): boolean

Parameters

Name Type
swapParams SwapParams
transaction Transaction<Transaction>

Returns

boolean

Overrides

Swap.doesTransactionMatchInitiation

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:410


doesTransactionMatchRedeem

Protected doesTransactionMatchRedeem(initiationTxHash, tx, isRefund): boolean

Parameters

Name Type
initiationTxHash string
tx Transaction<Transaction>
isRefund boolean

Returns

boolean

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:397


extractSwapParams

Protected extractSwapParams(outputScript): Object

Parameters

Name Type
outputScript string

Returns

Object

Name Type
expiration number
recipientPublicKey string
refundPublicKey string
secretHash string

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:325


findClaimSwapTransaction

findClaimSwapTransaction(swapParams, initTxHash, blockNumber?): Promise<Transaction<any>>

Find swap claim transaction from parameters

Parameters

Name Type
swapParams SwapParams
initTxHash string
blockNumber? number

Returns

Promise<Transaction<any>>

Overrides

Swap.findClaimSwapTransaction

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:90


findInitiateSwapTransaction

findInitiateSwapTransaction(swapParams, blockNumber?): Promise<Transaction<any>>

Find swap transaction from parameters

Parameters

Name Type
swapParams SwapParams
blockNumber? number

Returns

Promise<Transaction<any>>

Overrides

Swap.findInitiateSwapTransaction

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:67


findRefundSwapTransaction

findRefundSwapTransaction(swapParams, initiationTxHash, blockNumber?): Promise<Transaction<any>>

Refund the swap

Parameters

Name Type
swapParams SwapParams
initiationTxHash string
blockNumber? number

Returns

Promise<Transaction<any>>

Overrides

Swap.findRefundSwapTransaction

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:111


findSwapTransaction

Protected Abstract findSwapTransaction(swapParams, blockNumber, predicate): Promise<Transaction<Transaction>>

Parameters

Name Type
swapParams SwapParams
blockNumber number
predicate TransactionMatchesFunction

Returns

Promise<Transaction<Transaction>>

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:423


generateSecret

generateSecret(message): Promise<string>

Generate a secret.

Parameters

Name Type
message string

Returns

Promise<string>

Inherited from

Swap.generateSecret

Defined in

client/dist/lib/Swap.d.ts:10


getInputScript

Protected getInputScript(vin): string[]

Parameters

Name Type
vin Input

Returns

string[]

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:390


getSwapOutput

Protected getSwapOutput(swapParams): Buffer

Parameters

Name Type
swapParams SwapParams

Returns

Buffer

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:124


getSwapPaymentVariants

Protected getSwapPaymentVariants(swapOutput): Object

Parameters

Name Type
swapOutput Buffer

Returns

Object

Name Type
p2sh Payment
p2shSegwit Payment
p2wsh Payment

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:169


getSwapSecret

getSwapSecret(claimTxHash, initTxHash): Promise<string>

Get secret from claim transaction hash.

Parameters

Name Type
claimTxHash string
initTxHash string

Returns

Promise<string>

Overrides

Swap.getSwapSecret

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:74


getWallet

getWallet(): IBitcoinWallet<BitcoinBaseChainProvider, any>

Returns

IBitcoinWallet<BitcoinBaseChainProvider, any>

Inherited from

Swap.getWallet

Defined in

client/dist/lib/Swap.d.ts:7


initiateSwap

initiateSwap(swapParams, feePerByte): Promise<Transaction<any>>

Initiate a swap

Parameters

Name Type
swapParams SwapParams
feePerByte number

Returns

Promise<Transaction<any>>

Overrides

Swap.initiateSwap

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:41


refundSwap

refundSwap(swapParams, initiationTxHash, feePerByte): Promise<Transaction<Transaction>>

Refund the swap

Parameters

Name Type
swapParams SwapParams
initiationTxHash string
feePerByte number

Returns

Promise<Transaction<Transaction>>

Overrides

Swap.refundSwap

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:61


setWallet

setWallet(wallet): void

Parameters

Name Type
wallet IBitcoinWallet<BitcoinBaseChainProvider, any>

Returns

void

Inherited from

Swap.setWallet

Defined in

client/dist/lib/Swap.d.ts:6


updateTransactionFee

updateTransactionFee(tx, newFeePerByte): Promise<Transaction<any>>

Parameters

Name Type
tx string | Transaction<Transaction>
newFeePerByte number

Returns

Promise<Transaction<any>>

Overrides

Swap.updateTransactionFee

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:359


validateSwapParams

validateSwapParams(swapParams): void

Parameters

Name Type
swapParams SwapParams

Returns

void

Overrides

Swap.validateSwapParams

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:33


verifyInitiateSwapTransaction

verifyInitiateSwapTransaction(swapParams, initTx): Promise<boolean>

Verifies that the given initiation transaction matches the given swap params

Parameters

Name Type
swapParams SwapParams
initTx string | Transaction<any>

Returns

Promise<boolean>

Inherited from

Swap.verifyInitiateSwapTransaction

Defined in

client/dist/lib/Swap.d.ts:8

Clone this wiki locally