Skip to content

@liquality.evm.<internal>.SwapProvider

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

Interface: SwapProvider

@liquality/evm..SwapProvider

Implemented by

Table of contents

Methods

Methods

claimSwap

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

Claim the swap

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
initiationTxHash string The transaction hash of the swap initiation.
secret string 32 byte secret for the swap in hex.
fee FeeType -

Returns

Promise<Transaction<any>>

Resolves with swap claim transaction. Rejects with InvalidProviderResponseError if provider's response is invalid.

Defined in

types/dist/lib/Swap.d.ts:89


findClaimSwapTransaction

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

Find swap claim transaction from parameters

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
initiationTxHash string Swap initiation transaction hash/identifier
blockNumber? number -

Returns

Promise<Transaction<any>>

Resolves with the claim transaction if found, otherwise null.

Defined in

types/dist/lib/Swap.d.ts:42


findInitiateSwapTransaction

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

Find swap transaction from parameters

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
blockNumber? number -

Returns

Promise<Transaction<any>>

Resolves with the initiation transaction if found, otherwise null.

Defined in

types/dist/lib/Swap.d.ts:34


findRefundSwapTransaction

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

Refund the swap

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
initiationTxHash string The transaction hash of the swap initiation.
blockNumber? number The block number to find the transaction in

Returns

Promise<Transaction<any>>

Resolves with the refund transaction if found, otherwise null. Rejects with InvalidProviderResponseError if provider's response is invalid.

Defined in

types/dist/lib/Swap.d.ts:51


generateSecret

generateSecret(message): Promise<string>

Generate a secret.

Parameters

Name Type Description
message string Message to be used for generating secret.

Returns

Promise<string>

Resolves with a 32 byte secret

Defined in

types/dist/lib/Swap.d.ts:57


getSwapSecret

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

Get secret from claim transaction hash.

Parameters

Name Type
claimTxHash string
initTxHash? string

Returns

Promise<string>

Resolves with secret

Defined in

types/dist/lib/Swap.d.ts:63


initiateSwap

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

Initiate a swap

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
fee FeeType -

Returns

Promise<Transaction<any>>

Resolves with swap initiation transaction. Rejects with InvalidProviderResponseError if provider's response is invalid.

Defined in

types/dist/lib/Swap.d.ts:71


refundSwap

refundSwap(swapParams, initiationTxHash, fee): Promise<Transaction<any>>

Refund the swap

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
initiationTxHash string The transaction hash of the swap initiation.
fee FeeType -

Returns

Promise<Transaction<any>>

Resolves with refund swap transaction hash. Rejects with InvalidProviderResponseError if provider's response is invalid.

Defined in

types/dist/lib/Swap.d.ts:98


verifyInitiateSwapTransaction

verifyInitiateSwapTransaction(swapParams, initiationTxHash): Promise<boolean>

Verifies that the given initiation transaction matches the given swap params

Parameters

Name Type Description
swapParams SwapParams The parameters of the swap
initiationTxHash string | Transaction<any> The transaction hash of the swap initiation.

Returns

Promise<boolean>

Resolves with true if verification has passed. Rejects with InvalidProviderResponseError if provider's response is invalid.

Defined in

types/dist/lib/Swap.d.ts:79

Clone this wiki locally