FromBTCSwap<T>
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:120
Legacy escrow (PrTLC) based swap for Bitcoin -> Smart chains, requires manual initiation of the swap escrow on the destination chain.
Extends
IFromBTCSelfInitSwap<T,FromBTCDefinition<T>,FromBTCSwapState>
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends ChainType | ChainType |
Implements
IBTCWalletSwapIClaimableSwap<T,FromBTCDefinition<T>,FromBTCSwapState>IAddressSwap
Constructors
Constructor
new FromBTCSwap<T>(wrapper, init): FromBTCSwap<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:161
Parameters
| Parameter | Type |
|---|---|
wrapper | FromBTCWrapper<T> |
init | FromBTCSwapInit<T["Data"]> |
Returns
FromBTCSwap<T>
Overrides
IFromBTCSelfInitSwap.constructor
Constructor
new FromBTCSwap<T>(wrapper, obj): FromBTCSwap<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:162
Parameters
| Parameter | Type |
|---|---|
wrapper | FromBTCWrapper<T> |
obj | any |
Returns
FromBTCSwap<T>
Overrides
IFromBTCSelfInitSwap.constructor
Properties
chainIdentifier
readonly chainIdentifier: T["ChainId"];
Defined in: atomiq-sdk/src/swaps/ISwap.ts:148
Smart chain identifier string corresponding to this swap
Implementation of
IClaimableSwap.chainIdentifier
Inherited from
IFromBTCSelfInitSwap.chainIdentifier
createdAt
createdAt: number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:156
A UNIX milliseconds timestamps of when this swap was created
Implementation of
Inherited from
IFromBTCSelfInitSwap.createdAt
events
readonly events: EventEmitter<{
swapState: [FromBTCSwap<T>];
}>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:140
Event emitter emitting "swapState" event when swap's state changes
Implementation of
Inherited from
exactIn
readonly exactIn: boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:152
Whether a swap is an exact input swap
Implementation of
Inherited from
url?
readonly optional url: string;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:144
URL of the intermediary (LP) used for this swap, already has the swap service specific path appended
Implementation of
Inherited from
TYPE
protected readonly TYPE: FROM_BTC = SwapType.FROM_BTC;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:124
Swap type
Implementation of
Overrides
Methods
_verifyQuoteDefinitelyExpired()
_verifyQuoteDefinitelyExpired(): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts:178
Checks if the swap's quote is expired for good (i.e. the swap strictly cannot be committed on-chain anymore)
Returns
Promise<boolean>
Implementation of
IClaimableSwap._verifyQuoteDefinitelyExpired
Inherited from
IFromBTCSelfInitSwap._verifyQuoteDefinitelyExpired
_verifyQuoteValid()
_verifyQuoteValid(): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts:189
Checks if the swap's quote is still valid
Returns
Promise<boolean>
Implementation of
IClaimableSwap._verifyQuoteValid
Inherited from
IFromBTCSelfInitSwap._verifyQuoteValid
claim()
claim(
_signer,
abortSignal?,
onBeforeTxSent?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1001
Settles the swap by claiming the funds on the destination chain if the swap requires manual settlement, you can check so with isClaimable.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | Signer to use for signing the settlement transactions, can also be different to the recipient |
abortSignal? | AbortSignal | Abort signal |
onBeforeTxSent? | (txId) => void | Optional callback triggered before the claim transaction is broadcasted |
Returns
Promise<string>
Transaction ID of the settlement (claim) transaction on the destination smart chain
Remarks
Might also sync the bitcoin light client during the process.
Implementation of
Overrides
commit()
commit(
_signer,
abortSignal?,
skipChecks?,
onBeforeTxSent?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:889
Creates the escrow on the destination smart chain side, pre-locking the tokens from the intermediary (LP) into an escrow.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | Signer to sign the transactions with, must be the same as used in the initialization |
abortSignal? | AbortSignal | Abort signal |
skipChecks? | boolean | Skip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true) |
onBeforeTxSent? | (txId) => void | - |
Returns
Promise<string>
Throws
If invalid signer is provided that doesn't match the swap data
Overrides
estimateBitcoinFee()
estimateBitcoinFee(_bitcoinWallet, feeRate?): Promise<TokenAmount<any, BtcToken<false>, true>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:664
Estimates a bitcoin on-chain fee paid for the bitcoin swap transaction
Parameters
| Parameter | Type | Description |
|---|---|---|
_bitcoinWallet | | IBitcoinWallet | MinimalBitcoinWalletInterface | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
Returns
Promise<TokenAmount<any, BtcToken<false>, true>>
Implementation of
IBTCWalletSwap.estimateBitcoinFee
execute()
execute(
dstSigner,
wallet?,
callbacks?,
options?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:716
Executes the swap with the provided bitcoin wallet,
Parameters
| Parameter | Type | Description |
|---|---|---|
dstSigner | T["Signer"] | T["NativeSigner"] | Signer on the destination network, needs to have the same address as the one specified when quote was created, this is required for legacy swaps because the destination wallet needs to actively open a bitcoin swap address to which the BTC is then sent, this means that the address also needs to have enough native tokens to pay for gas on the destination network |
wallet? | | IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner | Bitcoin wallet to use to sign the bitcoin transaction, can also be null - then the execution waits till a transaction is received from an external wallet |
callbacks? | { onDestinationCommitSent?: (destinationCommitTxId) => void; onSourceTransactionConfirmationStatus?: (sourceTxId?, confirmations?, targetConfirations?, etaMs?) => void; onSourceTransactionConfirmed?: (sourceTxId) => void; onSourceTransactionSent?: (sourceTxId) => void; onSwapSettled?: (destinationTxId) => void; } | Callbacks to track the progress of the swap |
callbacks.onDestinationCommitSent? | (destinationCommitTxId) => void | - |
callbacks.onSourceTransactionConfirmationStatus? | (sourceTxId?, confirmations?, targetConfirations?, etaMs?) => void | - |
callbacks.onSourceTransactionConfirmed? | (sourceTxId) => void | - |
callbacks.onSourceTransactionSent? | (sourceTxId) => void | - |
callbacks.onSwapSettled? | (destinationTxId) => void | - |
options? | { abortSignal?: AbortSignal; btcTxCheckIntervalSeconds?: number; feeRate?: number; maxWaitTillAutomaticSettlementSeconds?: number; } | Optional options for the swap like feeRate, AbortSignal, and timeouts/intervals |
options.abortSignal? | AbortSignal | - |
options.btcTxCheckIntervalSeconds? | number | - |
options.feeRate? | number | - |
options.maxWaitTillAutomaticSettlementSeconds? | number | - |
Returns
Promise<boolean>
Whether a swap was settled automatically by swap watchtowers or requires manual claim by the
user, in case false is returned the user should call swap.claim() to settle the swap on the destination manually
Implementation of
Overrides
getAddress()
getAddress(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:231
Returns bitcoin address where the on-chain BTC should be sent to
Returns
string
Implementation of
Overrides
IFromBTCSelfInitSwap.getAddress
getClaimerBounty()
getClaimerBounty(): TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:368
Returns claimer bounty, acting as a reward for watchtowers to claim the swap automatically, this amount is pre-funded by the user on the destination chain when the swap escrow is initiated. For total pre-funded deposit amount see getTotalDeposit.
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
getClaimHash()
getClaimHash(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:123
Returns the claim data hash specifying the claim path of the escrow - i.e. hash passed to the claim handler
Returns
string
Inherited from
IFromBTCSelfInitSwap.getClaimHash
getClaimNetworkFee()
getClaimNetworkFee(): Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:276
Returns the transaction fee required for the claim transaction to settle the escrow on the destination smart chain
Returns
Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>
Inherited from
IFromBTCSelfInitSwap.getClaimNetworkFee
getCurrentActions()
getCurrentActions(options?): Promise<SwapExecutionAction<T>[]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:852
Returns a state-dependent set of actions for the user to execute, or empty array if there is currently no action required from the user to execute.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; maxWaitTillAutomaticSettlementSeconds?: number; skipChecks?: boolean; } | - |
options.bitcoinFeeRate? | number | Optional fee rate to use for the created Bitcoin transaction |
options.bitcoinWallet? | MinimalBitcoinWalletInterface | Bitcoin wallet to use, when provided the function returns a funded psbt ("FUNDED_PSBT"), if not passed just a bitcoin receive address is returned ("ADDRESS") |
options.manualSettlementSmartChainSigner? | string | T["Signer"] | T["NativeSigner"] | Optional smart chain signer to create a manual claim (settlement) transaction |
options.maxWaitTillAutomaticSettlementSeconds? | number | Maximum time to wait for an automatic settlement after the bitcoin transaction is confirmed (defaults to 60 seconds) |
options.skipChecks? | boolean | Skip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true) |
Returns
Promise<SwapExecutionAction<T>[]>
Implementation of
IClaimableSwap.getCurrentActions
Overrides
IFromBTCSelfInitSwap.getCurrentActions
getDirection()
getDirection(): SwapDirection;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:506
Returns the direction of the swap
Returns
Implementation of
Inherited from
IFromBTCSelfInitSwap.getDirection
getEscrowClaimTxId()
getEscrowClaimTxId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:144
Returns the smart chain transaction ID of the tx that claimed (settled) the escrow
Returns
string
Inherited from
IFromBTCSelfInitSwap.getEscrowClaimTxId
getEscrowHash()
getEscrowHash(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:116
Returns the escrow hash - i.e. hash of the escrow data
Returns
string
Inherited from
IFromBTCSelfInitSwap.getEscrowHash
getEscrowInitTxId()
getEscrowInitTxId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:137
Returns the smart chain transaction ID of the tx that initiated the escrow
Returns
string
Inherited from
IFromBTCSelfInitSwap.getEscrowInitTxId
getEscrowRefundTxId()
getEscrowRefundTxId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:151
Returns the smart chain transaction ID of the tx that refunded the escrow
Returns
string
Inherited from
IFromBTCSelfInitSwap.getEscrowRefundTxId
getFee()
getFee(): Fee;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:148
Returns total fee for the swap, the fee is represented in source currency & destination currency, but is paid only once
Returns
Implementation of
Inherited from
getFeeBreakdown()
getFeeBreakdown(): [{
fee: Fee<T["ChainId"], BtcToken, SCToken<T["ChainId"]>>;
type: SWAP;
}];
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:155
Returns the breakdown of all the fees paid
Returns
[{
fee: Fee<T["ChainId"], BtcToken, SCToken<T["ChainId"]>>;
type: SWAP;
}]
Implementation of
IClaimableSwap.getFeeBreakdown
Inherited from
IFromBTCSelfInitSwap.getFeeBreakdown
getFundedPsbt()
getFundedPsbt(
_bitcoinWallet,
feeRate?,
additionalOutputs?): Promise<{
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:621
Returns the PSBT that is already funded with wallet's UTXOs (runs a coin-selection algorithm to choose UTXOs to use), also returns inputs indices that need to be signed by the wallet before submitting the PSBT back to the SDK with submitPsbt
Parameters
| Parameter | Type | Description |
|---|---|---|
_bitcoinWallet | | IBitcoinWallet | MinimalBitcoinWalletInterface | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
additionalOutputs? | ( | { amount: bigint; outputScript: Uint8Array; } | { address: string; amount: bigint; })[] | additional outputs to add to the PSBT - can be used to collect fees from users |
Returns
Promise<{
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>
Implementation of
getHyperlink()
getHyperlink(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:248
A hyperlink representation of the address + amount that the user needs to sends on the source chain. This is suitable to be displayed in a form of QR code.
Returns
string
Implementation of
Overrides
IFromBTCSelfInitSwap.getHyperlink
getId()
getId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:130
Returns the ID of the swap, as used in the storage
Returns
string
Implementation of
Inherited from
getInput()
getInput(): TokenAmount<T["ChainId"], BtcToken<false>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:359
Returns input amount of the swap, user needs to pay this much
Returns
TokenAmount<T["ChainId"], BtcToken<false>>
Implementation of
Overrides
getInputAddress()
getInputAddress(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:256
Returns source address of the swap
Returns
string
Implementation of
IClaimableSwap.getInputAddress
Overrides
IFromBTCSelfInitSwap.getInputAddress
getInputToken()
getInputToken(): BtcToken<false>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:352
Returns the input token of the swap
Returns
BtcToken<false>
Implementation of
Overrides
IFromBTCSelfInitSwap.getInputToken
getInputTxId()
getInputTxId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:263
Returns swap input transaction ID on the source chain
Returns
string
Implementation of
Overrides
IFromBTCSelfInitSwap.getInputTxId
getInputWithoutFee()
getInputWithoutFee(): TokenAmount<T["ChainId"], BtcToken>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:184
Returns input amount of the swap without the fees (swap fee, network fee)
Returns
TokenAmount<T["ChainId"], BtcToken>
Implementation of
IClaimableSwap.getInputWithoutFee
Inherited from
IFromBTCSelfInitSwap.getInputWithoutFee
getOutput()
getOutput(): TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:172
Returns output amount of the swap, user receives this much
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
Implementation of
Inherited from
IFromBTCSelfInitSwap.getOutput
getOutputAddress()
getOutputAddress(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:94
Returns destination address of the swap
Returns
string
Implementation of
IClaimableSwap.getOutputAddress
Inherited from
IFromBTCSelfInitSwap.getOutputAddress
getOutputToken()
getOutputToken(): SCToken<T["ChainId"]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:165
Returns the output token of the swap
Returns
SCToken<T["ChainId"]>
Implementation of
Inherited from
IFromBTCSelfInitSwap.getOutputToken
getOutputTxId()
getOutputTxId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:87
Returns swap output transaction ID on the destination chain
Returns
string
Implementation of
Inherited from
IFromBTCSelfInitSwap.getOutputTxId
getPriceInfo()
getPriceInfo(): object;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:346
Returns pricing info about the swap
Returns
object
| Name | Type | Defined in |
|---|---|---|
difference | PercentagePPM | atomiq-sdk/src/swaps/ISwap.ts:349 |
marketPrice? | number | atomiq-sdk/src/swaps/ISwap.ts:347 |
swapPrice | number | atomiq-sdk/src/swaps/ISwap.ts:348 |
Implementation of
Inherited from
IFromBTCSelfInitSwap.getPriceInfo
getQuoteExpiry()
getQuoteExpiry(): number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:492
Returns quote expiry in UNIX millis
Returns
number
Implementation of
Inherited from
IFromBTCSelfInitSwap.getQuoteExpiry
getRequiredConfirmationsCount()
getRequiredConfirmationsCount(): number;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:402
Returns the number of confirmations required for the bitcoin transaction for this swap to complete and settle
Returns
number
Implementation of
IBTCWalletSwap.getRequiredConfirmationsCount
getSecurityDeposit()
getSecurityDeposit(): TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:215
Returns the amount of native token of the destination chain locked up during initialization of the escrow to act as a security deposit that can be taken by the intermediary (LP) if the user doesn't go through with the swap
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
Inherited from
IFromBTCSelfInitSwap.getSecurityDeposit
getSmartChainNetworkFee()
getSmartChainNetworkFee(): Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts:115
Returns the transaction fee paid on the smart chain side to initiate the escrow
Returns
Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>
Inherited from
IFromBTCSelfInitSwap.getSmartChainNetworkFee
getState()
getState(): FromBTCSwapState;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:513
Returns the current state of the swap
Returns
Implementation of
Inherited from
getStateInfo()
getStateInfo(): SwapStateInfo<FromBTCSwapState>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:520
Returns the current state of the swap along with the human-readable description of the state
Returns
SwapStateInfo<FromBTCSwapState>
Implementation of
Inherited from
IFromBTCSelfInitSwap.getStateInfo
getTimeoutTime()
getTimeoutTime(): number;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:271
Returns timeout time (in UNIX milliseconds) when the on-chain address will expire and no funds should be sent to that address anymore
Returns
number
getTotalDeposit()
getTotalDeposit(): TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:224
Returns the total amount of native token of the destination chain locked up during initialization of the escrow. This covers the security deposit and the watchtower fee (if applicable), it is calculated a maximum of those two values.
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
Inherited from
IFromBTCSelfInitSwap.getTotalDeposit
getType()
getType(): SwapType;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:499
Returns the type of the swap
Returns
Implementation of
Inherited from
hasEnoughForTxFees()
hasEnoughForTxFees(): Promise<{
balance: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
enoughBalance: boolean;
required: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
}>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:193
Checks if the initiator/sender has enough balance on the smart chain side to cover the transaction fee for processing the swap
Returns
Promise<{
balance: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
enoughBalance: boolean;
required: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
}>
Inherited from
IFromBTCSelfInitSwap.hasEnoughForTxFees
hasValidPrice()
hasValidPrice(): boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:338
Checks if the pricing for the swap is valid, according to max allowed price difference set in the ISwapPrice
Returns
boolean
Implementation of
Inherited from
IFromBTCSelfInitSwap.hasValidPrice
isClaimable()
isClaimable(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:292
Checks whether a swap currently requires a manual claiming (settlement)
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isClaimable
isFailed()
isFailed(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:306
Returns whether the swap failed (e.g. was refunded)
Returns
boolean
Implementation of
Overrides
isFinished()
isFinished(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:285
Returns whether the swap is finished and in its terminal state (this can mean successful, refunded or failed)
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isFinished
isInitiated()
isInitiated(): boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:485
Whether a swap was initialized, a swap is considered initialized on first interaction with it, i.e. calling commit() on a Smart chain -> Bitcoin swaps, calling waitForPayment() or similar on the other direction. Not initiated swaps are not saved to the persistent storage by default (see SwapperOptions.saveUninitializedSwaps)
Returns
boolean
Implementation of
Inherited from
IFromBTCSelfInitSwap.isInitiated
isInProgress()
isInProgress(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:313
Returns whether the swap is currently being processed
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isInProgress
isQuoteExpired()
isQuoteExpired(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:321
Checks whether the swap's quote has definitely expired and cannot be committed anymore, we can remove such swap
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isQuoteExpired
isQuoteSoftExpired()
isQuoteSoftExpired(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:328
Checks whether the swap's quote is soft expired (this means there is not enough time buffer for it to commit, but it still can happen)
Returns
boolean
Implementation of
IClaimableSwap.isQuoteSoftExpired
Overrides
IFromBTCSelfInitSwap.isQuoteSoftExpired
isSuccessful()
isSuccessful(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:299
Returns whether the swap finished successful
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isSuccessful
refreshPriceData()
refreshPriceData(): Promise<void>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:305
Re-fetches & revalidates the price data based on the current market prices
Returns
Promise<void>
Implementation of
IClaimableSwap.refreshPriceData
Inherited from
IFromBTCSelfInitSwap.refreshPriceData
requiresAction()
requiresAction(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:278
Checks whether there is some action required from the user for this swap - can mean either refundable or claimable
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.requiresAction
sendBitcoinTransaction()
sendBitcoinTransaction(wallet, feeRate?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:675
Sends a swap bitcoin transaction via the passed bitcoin wallet
Parameters
| Parameter | Type | Description |
|---|---|---|
wallet | | IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
Returns
Promise<string>
Implementation of
IBTCWalletSwap.sendBitcoinTransaction
serialize()
serialize(): any;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1116
Serializes the swap to a JSON stringifiable representation (i.e. no bigints, buffers etc.)
Returns
any
Implementation of
Overrides
IFromBTCSelfInitSwap.serialize
submitPsbt()
submitPsbt(_psbt): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:637
Submits a PSBT signed by the wallet back to the SDK
Parameters
| Parameter | Type | Description |
|---|---|---|
_psbt | any | A PSBT, either a Transaction object or a hex or base64 encoded PSBT string |
Returns
Promise<string>
Implementation of
txsClaim()
txsClaim(_signer?): Promise<T["TX"][]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:954
Returns transactions for settling (claiming) the swap if the swap requires manual settlement, you can check so with isClaimable. After sending the transaction manually be sure to call the waitTillClaimed function to wait till the claim transaction is observed, processed by the SDK and state of the swap properly updated.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer? | string | T["Signer"] | T["NativeSigner"] | Address of the signer to create the claim transactions for |
Returns
Promise<T["TX"][]>
Remarks
Might also return transactions necessary to sync the bitcoin light client.
Throws
If the swap is in invalid state (must be FromBTCSwapState.BTC_TX_CONFIRMED)
Implementation of
Overrides
txsCommit()
txsCommit(skipChecks?): Promise<T["TX"][]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:241
Returns transactions for initiating (committing) the escrow on the destination smart chain side, pre-locking the tokens from the intermediary (LP) into an escrow.
Parameters
| Parameter | Type | Description |
|---|---|---|
skipChecks? | boolean | Skip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true) |
Returns
Promise<T["TX"][]>
Throws
When in invalid state to commit the swap
Inherited from
IFromBTCSelfInitSwap.txsCommit
txsExecute()
txsExecute(options?): Promise<(
| {
chain: T["ChainId"];
description: string;
name: "Commit";
txs: T["TX"][];
}
| {
chain: "BITCOIN";
description: string;
name: "Payment";
txs: (
| {
address: string;
amount: number;
hyperlink: string;
type: "ADDRESS";
}
| {
address?: undefined;
amount?: undefined;
hyperlink?: undefined;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
type: "FUNDED_PSBT";
})[];
})[]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:780
Returns a list of steps or transactions required to finish and settle the swap
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; skipChecks?: boolean; } | Additional options for executing the swap |
options.bitcoinFeeRate? | number | Optional fee rate to use for the created Bitcoin transaction |
options.bitcoinWallet? | MinimalBitcoinWalletInterface | Bitcoin wallet to use, when provided the function returns a funded psbt ("FUNDED_PSBT"), if not passed just a bitcoin receive address is returned ("ADDRESS") |
options.skipChecks? | boolean | Skip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true) |
Returns
Promise<(
| {
chain: T["ChainId"];
description: string;
name: "Commit";
txs: T["TX"][];
}
| {
chain: "BITCOIN";
description: string;
name: "Payment";
txs: (
| {
address: string;
amount: number;
hyperlink: string;
type: "ADDRESS";
}
| {
address?: undefined;
amount?: undefined;
hyperlink?: undefined;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
type: "FUNDED_PSBT";
})[];
})[]>
Implementation of
Overrides
IFromBTCSelfInitSwap.txsExecute
waitForBitcoinTransaction()
waitForBitcoinTransaction(
updateCallback?,
checkIntervalSeconds?,
abortSignal?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:484
Waits till the bitcoin transaction gets the required number of confirmations
Parameters
| Parameter | Type | Description |
|---|---|---|
updateCallback? | (txId?, confirmations?, targetConfirmations?, txEtaMs?) => void | Callback called when txId is found, and also called with subsequent confirmations |
checkIntervalSeconds? | number | How often to check the bitcoin transaction |
abortSignal? | AbortSignal | Abort signal |
Returns
Promise<string>
Throws
if in invalid state
Implementation of
IBTCWalletSwap.waitForBitcoinTransaction
waitTillClaimed()
waitTillClaimed(maxWaitTimeSeconds?, abortSignal?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1048
Waits till the swap is successfully settled (claimed), should be called after sending the claim (settlement) transactions manually to wait till the SDK processes the settlement and updates the swap state accordingly
Parameters
| Parameter | Type | Description |
|---|---|---|
maxWaitTimeSeconds? | number | Maximum time in seconds to wait for the swap to be settled |
abortSignal? | AbortSignal | AbortSignal |
Returns
Promise<boolean>
whether the swap was claimed in time or not
Implementation of
IClaimableSwap.waitTillClaimed
Overrides
IFromBTCSelfInitSwap.waitTillClaimed
waitTillCommited()
waitTillCommited(abortSignal?): Promise<void>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:912
Waits till a swap is initiated (committed) on-chain, should be called after sending the commit transactions (txsCommit) manually to wait till the SDK processes the escrow initialization and updates the swap state accordingly
Parameters
| Parameter | Type | Description |
|---|---|---|
abortSignal? | AbortSignal | AbortSignal |
Returns
Promise<void>