-
Notifications
You must be signed in to change notification settings - Fork 69
@liquality.client.<internal>.SwapProvider
@liquality/client..SwapProvider
- claimSwap
- findClaimSwapTransaction
- findInitiateSwapTransaction
- findRefundSwapTransaction
- generateSecret
- getSwapSecret
- initiateSwap
- refundSwap
- verifyInitiateSwapTransaction
▸ claimSwap(swapParams
, initiationTxHash
, secret
, fee
): Promise
<Transaction
<any
>>
Claim the swap
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 |
- |
Promise
<Transaction
<any
>>
Resolves with swap claim transaction. Rejects with InvalidProviderResponseError if provider's response is invalid.
types/dist/lib/Swap.d.ts:89
▸ findClaimSwapTransaction(swapParams
, initiationTxHash
, blockNumber?
): Promise
<Transaction
<any
>>
Find swap claim transaction from parameters
Name | Type | Description |
---|---|---|
swapParams |
SwapParams |
The parameters of the swap |
initiationTxHash |
string |
Swap initiation transaction hash/identifier |
blockNumber? |
number |
- |
Promise
<Transaction
<any
>>
Resolves with the claim transaction if found, otherwise null.
types/dist/lib/Swap.d.ts:42
▸ findInitiateSwapTransaction(swapParams
, blockNumber?
): Promise
<Transaction
<any
>>
Find swap transaction from parameters
Name | Type | Description |
---|---|---|
swapParams |
SwapParams |
The parameters of the swap |
blockNumber? |
number |
- |
Promise
<Transaction
<any
>>
Resolves with the initiation transaction if found, otherwise null.
types/dist/lib/Swap.d.ts:34
▸ findRefundSwapTransaction(swapParams
, initiationTxHash
, blockNumber?
): Promise
<Transaction
<any
>>
Refund the swap
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 |
Promise
<Transaction
<any
>>
Resolves with the refund transaction if found, otherwise null. Rejects with InvalidProviderResponseError if provider's response is invalid.
types/dist/lib/Swap.d.ts:51
▸ generateSecret(message
): Promise
<string
>
Generate a secret.
Name | Type | Description |
---|---|---|
message |
string |
Message to be used for generating secret. |
Promise
<string
>
Resolves with a 32 byte secret
types/dist/lib/Swap.d.ts:57
▸ getSwapSecret(claimTxHash
, initTxHash?
): Promise
<string
>
Get secret from claim transaction hash.
Name | Type |
---|---|
claimTxHash |
string |
initTxHash? |
string |
Promise
<string
>
Resolves with secret
types/dist/lib/Swap.d.ts:63
▸ initiateSwap(swapParams
, fee
): Promise
<Transaction
<any
>>
Initiate a swap
Name | Type | Description |
---|---|---|
swapParams |
SwapParams |
The parameters of the swap |
fee |
FeeType |
- |
Promise
<Transaction
<any
>>
Resolves with swap initiation transaction. Rejects with InvalidProviderResponseError if provider's response is invalid.
types/dist/lib/Swap.d.ts:71
▸ refundSwap(swapParams
, initiationTxHash
, fee
): Promise
<Transaction
<any
>>
Refund the swap
Name | Type | Description |
---|---|---|
swapParams |
SwapParams |
The parameters of the swap |
initiationTxHash |
string |
The transaction hash of the swap initiation. |
fee |
FeeType |
- |
Promise
<Transaction
<any
>>
Resolves with refund swap transaction hash. Rejects with InvalidProviderResponseError if provider's response is invalid.
types/dist/lib/Swap.d.ts:98
▸ verifyInitiateSwapTransaction(swapParams
, initiationTxHash
): Promise
<boolean
>
Verifies that the given initiation transaction matches the given swap params
Name | Type | Description |
---|---|---|
swapParams |
SwapParams |
The parameters of the swap |
initiationTxHash |
string | Transaction <any > |
The transaction hash of the swap initiation. |
Promise
<boolean
>
Resolves with true if verification has passed. Rejects with InvalidProviderResponseError if provider's response is invalid.
types/dist/lib/Swap.d.ts:79