Skip to content

@liquality.bitcoin.BitcoinSwapRpcProvider

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

Class: BitcoinSwapRpcProvider

@liquality/bitcoin.BitcoinSwapRpcProvider

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new BitcoinSwapRpcProvider(options, walletProvider)

Parameters

Name Type
options BitcoinSwapProviderOptions
walletProvider IBitcoinWallet<BitcoinBaseChainProvider, any>

Overrides

BitcoinSwapBaseProvider.constructor

Defined in

bitcoin/lib/swap/BitcoinSwapRpcProvider.ts:9

Properties

_mode

Protected _mode: SwapMode

Inherited from

BitcoinSwapBaseProvider._mode

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:20


_network

Protected _network: BitcoinNetwork

Inherited from

BitcoinSwapBaseProvider._network

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:19


walletProvider

Protected walletProvider: IBitcoinWallet<BitcoinBaseChainProvider, any>

Inherited from

BitcoinSwapBaseProvider.walletProvider

Defined in

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

Methods

canUpdateFee

canUpdateFee(): boolean

Returns

boolean

Inherited from

BitcoinSwapBaseProvider.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>>

Inherited from

BitcoinSwapBaseProvider.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

Inherited from

BitcoinSwapBaseProvider.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

Inherited from

BitcoinSwapBaseProvider.doesTransactionMatchRedeem

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

Inherited from

BitcoinSwapBaseProvider.extractSwapParams

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>>

Inherited from

BitcoinSwapBaseProvider.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>>

Inherited from

BitcoinSwapBaseProvider.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>>

Inherited from

BitcoinSwapBaseProvider.findRefundSwapTransaction

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:111


findSwapTransaction

findSwapTransaction(_swapParams, blockNumber, predicate): Promise<Transaction<any>>

Parameters

Name Type
_swapParams SwapParams
blockNumber number
predicate (tx: Transaction<Transaction>) => boolean

Returns

Promise<Transaction<any>>

Overrides

BitcoinSwapBaseProvider.findSwapTransaction

Defined in

bitcoin/lib/swap/BitcoinSwapRpcProvider.ts:13


generateSecret

generateSecret(message): Promise<string>

Generate a secret.

Parameters

Name Type
message string

Returns

Promise<string>

Inherited from

BitcoinSwapBaseProvider.generateSecret

Defined in

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


getInputScript

Protected getInputScript(vin): string[]

Parameters

Name Type
vin Input

Returns

string[]

Inherited from

BitcoinSwapBaseProvider.getInputScript

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:390


getSwapOutput

Protected getSwapOutput(swapParams): Buffer

Parameters

Name Type
swapParams SwapParams

Returns

Buffer

Inherited from

BitcoinSwapBaseProvider.getSwapOutput

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

Inherited from

BitcoinSwapBaseProvider.getSwapPaymentVariants

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>

Inherited from

BitcoinSwapBaseProvider.getSwapSecret

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:74


getWallet

getWallet(): IBitcoinWallet<BitcoinBaseChainProvider, any>

Returns

IBitcoinWallet<BitcoinBaseChainProvider, any>

Inherited from

BitcoinSwapBaseProvider.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>>

Inherited from

BitcoinSwapBaseProvider.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>>

Inherited from

BitcoinSwapBaseProvider.refundSwap

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:61


setWallet

setWallet(wallet): void

Parameters

Name Type
wallet IBitcoinWallet<BitcoinBaseChainProvider, any>

Returns

void

Inherited from

BitcoinSwapBaseProvider.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>>

Inherited from

BitcoinSwapBaseProvider.updateTransactionFee

Defined in

bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:359


validateSwapParams

validateSwapParams(swapParams): void

Parameters

Name Type
swapParams SwapParams

Returns

void

Inherited from

BitcoinSwapBaseProvider.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

BitcoinSwapBaseProvider.verifyInitiateSwapTransaction

Defined in

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

Clone this wiki locally