-
Notifications
You must be signed in to change notification settings - Fork 69
@liquality.bitcoin.BitcoinSwapBaseProvider
@liquality/bitcoin.BitcoinSwapBaseProvider
-
Swap
<BitcoinBaseChainProvider
,null
,IBitcoinWallet
<BitcoinBaseChainProvider
>>↳
BitcoinSwapBaseProvider
- canUpdateFee
- claimSwap
- doesTransactionMatchInitiation
- doesTransactionMatchRedeem
- extractSwapParams
- findClaimSwapTransaction
- findInitiateSwapTransaction
- findRefundSwapTransaction
- findSwapTransaction
- generateSecret
- getInputScript
- getSwapOutput
- getSwapPaymentVariants
- getSwapSecret
- getWallet
- initiateSwap
- refundSwap
- setWallet
- updateTransactionFee
- validateSwapParams
- verifyInitiateSwapTransaction
• new BitcoinSwapBaseProvider(options
, walletProvider
)
Name | Type |
---|---|
options |
BitcoinSwapProviderOptions |
walletProvider |
IBitcoinWallet <BitcoinBaseChainProvider , any > |
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:22
• Protected
_mode: SwapMode
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:20
• Protected
_network: BitcoinNetwork
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:19
• Protected
walletProvider: IBitcoinWallet
<BitcoinBaseChainProvider
, any
>
client/dist/lib/Swap.d.ts:4
▸ canUpdateFee(): boolean
boolean
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:355
▸ claimSwap(swapParams
, initiationTxHash
, secret
, feePerByte
): Promise
<Transaction
<Transaction
>>
Claim the swap
Name | Type |
---|---|
swapParams |
SwapParams |
initiationTxHash |
string |
secret |
string |
feePerByte |
number |
Promise
<Transaction
<Transaction
>>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:53
▸ Protected
doesTransactionMatchInitiation(swapParams
, transaction
): boolean
Name | Type |
---|---|
swapParams |
SwapParams |
transaction |
Transaction <Transaction > |
boolean
Swap.doesTransactionMatchInitiation
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:410
▸ Protected
doesTransactionMatchRedeem(initiationTxHash
, tx
, isRefund
): boolean
Name | Type |
---|---|
initiationTxHash |
string |
tx |
Transaction <Transaction > |
isRefund |
boolean |
boolean
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:397
▸ Protected
extractSwapParams(outputScript
): Object
Name | Type |
---|---|
outputScript |
string |
Object
Name | Type |
---|---|
expiration |
number |
recipientPublicKey |
string |
refundPublicKey |
string |
secretHash |
string |
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:325
▸ findClaimSwapTransaction(swapParams
, initTxHash
, blockNumber?
): Promise
<Transaction
<any
>>
Find swap claim transaction from parameters
Name | Type |
---|---|
swapParams |
SwapParams |
initTxHash |
string |
blockNumber? |
number |
Promise
<Transaction
<any
>>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:90
▸ findInitiateSwapTransaction(swapParams
, blockNumber?
): Promise
<Transaction
<any
>>
Find swap transaction from parameters
Name | Type |
---|---|
swapParams |
SwapParams |
blockNumber? |
number |
Promise
<Transaction
<any
>>
Swap.findInitiateSwapTransaction
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:67
▸ findRefundSwapTransaction(swapParams
, initiationTxHash
, blockNumber?
): Promise
<Transaction
<any
>>
Refund the swap
Name | Type |
---|---|
swapParams |
SwapParams |
initiationTxHash |
string |
blockNumber? |
number |
Promise
<Transaction
<any
>>
Swap.findRefundSwapTransaction
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:111
▸ Protected
Abstract
findSwapTransaction(swapParams
, blockNumber
, predicate
): Promise
<Transaction
<Transaction
>>
Name | Type |
---|---|
swapParams |
SwapParams |
blockNumber |
number |
predicate |
TransactionMatchesFunction |
Promise
<Transaction
<Transaction
>>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:423
▸ generateSecret(message
): Promise
<string
>
Generate a secret.
Name | Type |
---|---|
message |
string |
Promise
<string
>
client/dist/lib/Swap.d.ts:10
▸ Protected
getInputScript(vin
): string
[]
Name | Type |
---|---|
vin |
Input |
string
[]
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:390
▸ Protected
getSwapOutput(swapParams
): Buffer
Name | Type |
---|---|
swapParams |
SwapParams |
Buffer
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:124
▸ Protected
getSwapPaymentVariants(swapOutput
): Object
Name | Type |
---|---|
swapOutput |
Buffer |
Object
Name | Type |
---|---|
p2sh |
Payment |
p2shSegwit |
Payment |
p2wsh |
Payment |
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:169
▸ getSwapSecret(claimTxHash
, initTxHash
): Promise
<string
>
Get secret from claim transaction hash.
Name | Type |
---|---|
claimTxHash |
string |
initTxHash |
string |
Promise
<string
>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:74
▸ getWallet(): IBitcoinWallet
<BitcoinBaseChainProvider
, any
>
IBitcoinWallet
<BitcoinBaseChainProvider
, any
>
client/dist/lib/Swap.d.ts:7
▸ initiateSwap(swapParams
, feePerByte
): Promise
<Transaction
<any
>>
Initiate a swap
Name | Type |
---|---|
swapParams |
SwapParams |
feePerByte |
number |
Promise
<Transaction
<any
>>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:41
▸ refundSwap(swapParams
, initiationTxHash
, feePerByte
): Promise
<Transaction
<Transaction
>>
Refund the swap
Name | Type |
---|---|
swapParams |
SwapParams |
initiationTxHash |
string |
feePerByte |
number |
Promise
<Transaction
<Transaction
>>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:61
▸ setWallet(wallet
): void
Name | Type |
---|---|
wallet |
IBitcoinWallet <BitcoinBaseChainProvider , any > |
void
client/dist/lib/Swap.d.ts:6
▸ updateTransactionFee(tx
, newFeePerByte
): Promise
<Transaction
<any
>>
Name | Type |
---|---|
tx |
string | Transaction <Transaction > |
newFeePerByte |
number |
Promise
<Transaction
<any
>>
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:359
▸ validateSwapParams(swapParams
): void
Name | Type |
---|---|
swapParams |
SwapParams |
void
bitcoin/lib/swap/BitcoinSwapBaseProvider.ts:33
▸ verifyInitiateSwapTransaction(swapParams
, initTx
): Promise
<boolean
>
Verifies that the given initiation transaction matches the given swap params
Name | Type |
---|---|
swapParams |
SwapParams |
initTx |
string | Transaction <any > |
Promise
<boolean
>
Swap.verifyInitiateSwapTransaction
client/dist/lib/Swap.d.ts:8