Skip to content

@liquality.bitcoin.<internal>.Swap

Krasimir Raykov edited this page Mar 30, 2022 · 1 revision

Class: Swap<T, S, WalletProvider>

@liquality/bitcoin..Swap

Type parameters

Name Type
T T
S S
WalletProvider extends Wallet<T, S> = any

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Swap<T, S, WalletProvider>(walletProvider?)

Type parameters

Name Type
T T
S S
WalletProvider extends Wallet<T, S, WalletProvider> = any

Parameters

Name Type
walletProvider? WalletProvider

Defined in

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

Properties

walletProvider

Protected walletProvider: WalletProvider

Defined in

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

Methods

canUpdateFee

Abstract canUpdateFee(): boolean

Returns

boolean

Defined in

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


claimSwap

Abstract claimSwap(swapParams, initTx, secret, fee?): Promise<Transaction<any>>

Claim the swap

Parameters

Name Type
swapParams SwapParams
initTx string
secret string
fee? FeeType

Returns

Promise<Transaction<any>>

Implementation of

SwapProvider.claimSwap

Defined in

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


doesTransactionMatchInitiation

Protected Abstract doesTransactionMatchInitiation(swapParams, transaction): boolean | Promise<boolean>

Parameters

Name Type
swapParams SwapParams
transaction Transaction<any>

Returns

boolean | Promise<boolean>

Defined in

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


findClaimSwapTransaction

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

Implementation of

SwapProvider.findClaimSwapTransaction

Defined in

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


findInitiateSwapTransaction

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

Find swap transaction from parameters

Parameters

Name Type
swapParams SwapParams
_blockNumber? number

Returns

Promise<Transaction<any>>

Implementation of

SwapProvider.findInitiateSwapTransaction

Defined in

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


findRefundSwapTransaction

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

Refund the swap

Parameters

Name Type
swapParams SwapParams
initiationTxHash string
blockNumber? number

Returns

Promise<Transaction<any>>

Implementation of

SwapProvider.findRefundSwapTransaction

Defined in

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


generateSecret

generateSecret(message): Promise<string>

Generate a secret.

Parameters

Name Type
message string

Returns

Promise<string>

Implementation of

SwapProvider.generateSecret

Defined in

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


getSwapSecret

Abstract getSwapSecret(claimTxHash, initTxHash?): Promise<string>

Get secret from claim transaction hash.

Parameters

Name Type
claimTxHash string
initTxHash? string

Returns

Promise<string>

Implementation of

SwapProvider.getSwapSecret

Defined in

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


getWallet

getWallet(): WalletProvider

Returns

WalletProvider

Defined in

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


initiateSwap

Abstract initiateSwap(swapParams, fee?): Promise<Transaction<any>>

Initiate a swap

Parameters

Name Type
swapParams SwapParams
fee? FeeType

Returns

Promise<Transaction<any>>

Implementation of

SwapProvider.initiateSwap

Defined in

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


refundSwap

Abstract refundSwap(swapParams, initTx, fee?): Promise<Transaction<any>>

Refund the swap

Parameters

Name Type
swapParams SwapParams
initTx string
fee? FeeType

Returns

Promise<Transaction<any>>

Implementation of

SwapProvider.refundSwap

Defined in

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


setWallet

setWallet(wallet): void

Parameters

Name Type
wallet WalletProvider

Returns

void

Defined in

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


updateTransactionFee

Abstract updateTransactionFee(tx, newFee): Promise<Transaction<any>>

Parameters

Name Type
tx string | Transaction<any>
newFee FeeType

Returns

Promise<Transaction<any>>

Defined in

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


validateSwapParams

validateSwapParams(swapParams): void

Parameters

Name Type
swapParams SwapParams

Returns

void

Defined in

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


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>

Implementation of

SwapProvider.verifyInitiateSwapTransaction

Defined in

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

Clone this wiki locally