This repository was archived by the owner on May 27, 2025. It is now read-only.

Description
Feature request
Currently the BTC APIs are designed to return a PSBT, like the following exmaple:
// Build
const psbt = await sendBtc({
from: account.address,
to: {
address: 'btc_to_address',
value: 10000,
},
source,
});
// Sign
psbt.signAllInputs(account.keyPair);
psbt.finalizeAllInputs();
// Broadcast
const tx = psbt.extractTransaction();
const txid = await service.sendTransaction(tx.toHex());
@duanyytop wish the build/sign/send process can be wrapped/simplified to a single call, like:
const txid = await sendBtc({
from: signer,
to: {
address: 'btc_to_address',
value: 10000,
},
source,
service,
});
Estimation
In my mind, it would take some steps to support this feature:
- Keep the current design of the BTC APIs, but rename them to be more accurate (
sendBtc -> buildSendBtcTx)
- Design a
Wallet interface that provides publicKey, address and signTransaction to the APIs
- Wrap BTC APIs to create new APIs and accept wallet/signer as prop, simplifying things