Closed Flouse closed 7 months ago
An app requests a feature in the sendBtc method of @rgbpp-sdk/btc, to prevent consecutive transactions.
sendBtc
transactionConfirmed
The purpose of this parameter is to prevent consecutive transactions from being sent before the previous one is confirmed.
false
true
input.UTXO.status.confirmed
const psbt = await sendBtc({ from: address, tos: [ { address: TARGET_ADDRESS, value: 546, }, ], transactionConfirmed: true, // If the previous transaction is not confirmed, an error will be thrown fromPubkey: pubkey, changeAddress: address, feeRate: 1, source, });
Provides more control and flexibility for developers
An app requests a feature in the
sendBtc
method of @rgbpp-sdk/btc, to prevent consecutive transactions.Add a new optional parameter
transactionConfirmed
to the sendBtc methodThe purpose of this parameter is to prevent consecutive transactions from being sent before the previous one is confirmed.
Description
Proposed Changes
transactionConfirmed
tofalse
.transactionConfirmed
:transactionConfirmed
istrue
, proceed with the transaction only if the previous transactions of the inputs has been confirmed. More specifically, theinput.UTXO.status.confirmed
should be true in this case: https://github.com/ckb-cell/rgbpp-sdk/blob/1458e40291b97ebfbbfc2007df83a24043e593a5/packages/service/src/types/btc.ts#L65-L75transactionConfirmed
isfalse
, proceed with the transaction regardless of the status of the previous transaction.transactionConfirmed
istrue
, throw an appropriate error.Example Usage
Benefits
Provides more control and flexibility for developers