Skip to content

@liquality.client.Swap

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

Class: Swap<T, S, WalletProvider>

@liquality/client.Swap

Type parameters

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

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/lib/Swap.ts:9

Properties

walletProvider

Protected walletProvider: WalletProvider

Defined in

client/lib/Swap.ts:7

Methods

canUpdateFee

Abstract canUpdateFee(): boolean

Returns

boolean

Defined in

client/lib/Swap.ts:70


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/lib/Swap.ts:62


doesTransactionMatchInitiation

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

Parameters

Name Type
swapParams SwapParams
transaction Transaction<any>

Returns

boolean | Promise<boolean>

Defined in

client/lib/Swap.ts:73


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/lib/Swap.ts:63


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/lib/Swap.ts:60


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/lib/Swap.ts:66


generateSecret

generateSecret(message): Promise<string>

Generate a secret.

Parameters

Name Type
message string

Returns

Promise<string>

Implementation of

SwapProvider.generateSecret

Defined in

client/lib/Swap.ts:52


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/lib/Swap.ts:68


getWallet

getWallet(): WalletProvider

Returns

WalletProvider

Defined in

client/lib/Swap.ts:17


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/lib/Swap.ts:59


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/lib/Swap.ts:65


setWallet

setWallet(wallet): void

Parameters

Name Type
wallet WalletProvider

Returns

void

Defined in

client/lib/Swap.ts:13


updateTransactionFee

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

Parameters

Name Type
tx string | Transaction<any>
newFee FeeType

Returns

Promise<Transaction<any>>

Defined in

client/lib/Swap.ts:71


validateSwapParams

validateSwapParams(swapParams): void

Parameters

Name Type
swapParams SwapParams

Returns

void

Defined in

client/lib/Swap.ts:46


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/lib/Swap.ts:21

Clone this wiki locally