@utexo/rgb-sdk 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/README.md CHANGED
@@ -323,7 +323,7 @@ utexo paylightninginvoice testwallet --lnInvoice "lnbc..."
323
323
  utexo send testwallet --invoice "<inv>" --assetId <id> --amount <n>
324
324
  ```
325
325
 
326
- **WalletManager (standard RGB, same keys):** `utexo wm address|btcbalance|refresh|sync|createutxos|blindreceive|listassets|listtransfers|sendbatch <wallet> [options]`
326
+ **WalletManager (standard RGB, same keys):** `utexo wm address|btcbalance|refresh|sync|createutxos|blindreceive|listassets|listtransfers|sendbatch|sendbtc <wallet> [options]`
327
327
 
328
328
  ## Security Warning
329
329
 
package/cli/run.mjs CHANGED
@@ -48,8 +48,8 @@ if (command === 'wm') {
48
48
  const wmSubcommand = args[1];
49
49
  walletName = args[2];
50
50
  flagArgs = args.slice(3);
51
- if (!wmSubcommand || !['address', 'btcbalance', 'refresh', 'sync', 'createutxos', 'blindreceive', 'listassets', 'listtransfers', 'sendbatch'].includes(wmSubcommand)) {
52
- console.error('Usage: utexo wm <address|btcbalance|refresh|sync|createutxos|blindreceive|listassets|listtransfers|sendbatch> <wallet_name> [options...]');
51
+ if (!wmSubcommand || !['address', 'btcbalance', 'refresh', 'sync', 'createutxos', 'blindreceive', 'listassets', 'listtransfers', 'sendbatch', 'sendbtc'].includes(wmSubcommand)) {
52
+ console.error('Usage: utexo wm <address|btcbalance|refresh|sync|createutxos|blindreceive|listassets|listtransfers|sendbatch|sendbtc> <wallet_name> [options...]');
53
53
  process.exit(1);
54
54
  }
55
55
  command = `wm_${wmSubcommand}`;
@@ -102,6 +102,7 @@ WalletManager (same keys file, standard RGB wallet):
102
102
  utexo wm listassets <wallet> # list assets and BTC balance
103
103
  utexo wm listtransfers <wallet> [--assetId <id>]
104
104
  utexo wm sendbatch <wallet> --assetId <id> --amount <n> --invoices "<inv1>,<inv2>,..." [--feeRate <n>] [--minConfirmations <n>]
105
+ utexo wm sendbtc <wallet> --address <addr> --amount <sats> [--feeRate <n>]
105
106
 
106
107
  Or run script with hardcoded params: node cli/scripts/send-batch-wm.mjs`;
107
108
 
@@ -214,6 +215,21 @@ async function buildRecipientMap(wallet, assetId, amount, invoices) {
214
215
  return { [assetId]: recipients };
215
216
  }
216
217
 
218
+ async function runWmSendbtc(walletName, flagArgs) {
219
+ const opts = parseFlags(flagArgs, {
220
+ required: ['address', 'amount'],
221
+ optional: ['feeRate', 'skipSync'],
222
+ }, { usage: USAGE });
223
+ const address = opts.address;
224
+ const amount = parseInt(opts.amount, 10);
225
+ const feeRate = opts.feeRate ? parseInt(opts.feeRate, 10) : 1;
226
+ const skipSync = opts.skipSync === 'true' || opts.skipSync === '1';
227
+ await runWithWalletManager(walletName, async (wallet) => {
228
+ const txid = await wallet.sendBtc({ address, amount, feeRate, ...(skipSync && { skipSync }) });
229
+ console.log(`✅ BTC sent. Txid: ${txid}`);
230
+ }, { quiet: true });
231
+ }
232
+
217
233
  async function runWmSendbatch(walletName, flagArgs) {
218
234
  const opts = parseFlags(flagArgs, {
219
235
  required: ['assetId', 'amount', 'invoices'],
@@ -273,6 +289,7 @@ const commands = {
273
289
  wm_listassets: runWmListassets,
274
290
  wm_listtransfers: runWmListtransfers,
275
291
  wm_sendbatch: runWmSendbatch,
292
+ wm_sendbtc: runWmSendbtc,
276
293
  };
277
294
 
278
295
  async function main() {