@bestinslot/wallet-kit 0.13.0 → 0.13.2

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.
@@ -65672,44 +65672,49 @@ function fixCardinalUtxos(t, e) {
65672
65672
  }
65673
65673
  function fixOrdinalUtxos(t, e) {
65674
65674
  if (currentExtraTxHexes.length === 0) return t;
65675
- const r = getBitcoinNetwork(), A = [];
65676
- for (const s of t) {
65677
- const n = s.utxo, o = n.split(":")[0], a = Number.parseInt(n.split(":")[1]);
65678
- checkIfUtxoUsedInExtras(o, a) || A.push(s);
65679
- }
65680
- for (const s of currentExtraTxHexes) {
65681
- const n = srcExports.Transaction.fromHex(s), o = n.getId();
65682
- for (let a = 0; a < n.outs.length; a++) {
65683
- const u = n.outs[a];
65684
- if (!checkIfUtxoIsExtraOrdinal(o, a) || checkIfUtxoUsedInExtras(o, a)) continue;
65685
- const g = currentExtraInscriptions ? currentExtraInscriptions[0] : null, c = currentExtraInscriptions ? currentExtraInscriptions[1] : null;
65686
- if (!(!g || !c))
65675
+ const r = [];
65676
+ for (const A of t) {
65677
+ const s = A.utxo, n = s.split(":")[0], o = Number.parseInt(s.split(":")[1]);
65678
+ checkIfUtxoUsedInExtras(n, o) || r.push(A);
65679
+ }
65680
+ return r.push(...getExtraOrdinalUtxos(e)), r;
65681
+ }
65682
+ function getExtraOrdinalUtxos(t) {
65683
+ if (currentExtraTxHexes.length === 0) return [];
65684
+ const e = getBitcoinNetwork(), r = [];
65685
+ for (const A of currentExtraTxHexes) {
65686
+ const s = srcExports.Transaction.fromHex(A), n = s.getId();
65687
+ for (let o = 0; o < s.outs.length; o++) {
65688
+ const a = s.outs[o];
65689
+ if (!checkIfUtxoIsExtraOrdinal(n, o) || checkIfUtxoUsedInExtras(n, o)) continue;
65690
+ const u = currentExtraInscriptions ? currentExtraInscriptions[0] : null, g = currentExtraInscriptions ? currentExtraInscriptions[1] : null;
65691
+ if (!(!u || !g))
65687
65692
  try {
65688
- if (srcExports.address.fromOutputScript(u.script, r) === e) {
65689
- const h = {
65690
- address: e,
65693
+ if (srcExports.address.fromOutputScript(a.script, e) === t) {
65694
+ const d = {
65695
+ address: t,
65691
65696
  amounts: null,
65692
65697
  block_height: null,
65693
- inscription_ids: [g],
65698
+ inscription_ids: [u],
65694
65699
  rune_ids: null,
65695
- satpoints: [c],
65696
- script: n.outs[a].script.toString("hex"),
65697
- script_type: utxoOutputTypeFromOutputScript(u.script, r),
65700
+ satpoints: [g],
65701
+ script: s.outs[o].script.toString("hex"),
65702
+ script_type: utxoOutputTypeFromOutputScript(a.script, e),
65698
65703
  txfee: null,
65699
- txid: o,
65700
- utxo: `${o}:${a}`,
65701
- value: u.value,
65702
- vout: a,
65704
+ txid: n,
65705
+ utxo: `${n}:${o}`,
65706
+ value: a.value,
65707
+ vout: o,
65703
65708
  vsize: null
65704
65709
  };
65705
- A.push(h);
65710
+ r.push(d);
65706
65711
  }
65707
- } catch (d) {
65708
- console.error(`Error processing output script for txid ${o}, vout ${a}`), console.error(d);
65712
+ } catch (c) {
65713
+ console.error(`Error processing output script for txid ${n}, vout ${o}`), console.error(c);
65709
65714
  }
65710
65715
  }
65711
65716
  }
65712
- return A;
65717
+ return r;
65713
65718
  }
65714
65719
  function witnessStackToScriptWitness(t) {
65715
65720
  let e = new Uint8Array(0);
@@ -65728,9 +65733,13 @@ function witnessStackToScriptWitness(t) {
65728
65733
  }
65729
65734
  return n(t), e;
65730
65735
  }
65731
- async function getCardinalUtxos(t) {
65732
- const e = getBackendUrl(`cardinal_utxos/${t}`), r = await fetchWithErrors(e, { method: "GET" });
65733
- return fixCardinalUtxos(r.data, t);
65736
+ async function getCardinalUtxos(t, e) {
65737
+ const r = e ? structuredClone(e) : await fetchCardinalUtxos(t);
65738
+ return fixCardinalUtxos(r, t);
65739
+ }
65740
+ async function fetchCardinalUtxos(t) {
65741
+ const e = getBackendUrl(`cardinal_utxos/${t}`);
65742
+ return (await fetchWithErrors(e, { method: "GET" })).data;
65734
65743
  }
65735
65744
  async function getCardinalBalance(t) {
65736
65745
  const e = getBackendUrl(`cardinal_utxos/${t}`), r = await fetchWithErrors(e, { method: "GET" }), A = fixCardinalUtxos(r.data, t);
@@ -66435,14 +66444,14 @@ async function buildPsbtFromTx(t, e, r, A) {
66435
66444
  n.updateInput(a.idx, { finalScriptWitness: a.signature });
66436
66445
  return n;
66437
66446
  }
66438
- async function buildCommitTx(t, e, r, A, s, n, o, a, u) {
66447
+ async function buildCommitTx(t, e, r, A, s, n, o, a, u, g) {
66439
66448
  (a == null || a < 0) && (a = 0);
66440
- const g = t;
66449
+ const c = t;
66441
66450
  if (!t.addr) throw new Error("Payer wallet address is not set.");
66442
- const c = await getCardinalUtxos(t.addr), d = get_seckey(r), h = get_pubkey(d, !0), I = buildRevealScript(h, A), B = Tap.encodeScript(I), [l, C] = Tap.getPubKey(h, { target: B }), p = getBitcoinNetwork(), Q = srcExports.payments.p2tr({
66443
- pubkey: Buffer$1.from(l, "hex"),
66444
- network: p
66445
- }), v = [
66451
+ const d = await getCardinalUtxos(t.addr, g), h = get_seckey(r), I = get_pubkey(h, !0), B = buildRevealScript(I, A), l = Tap.encodeScript(B), [C, p] = Tap.getPubKey(I, { target: l }), Q = getBitcoinNetwork(), v = srcExports.payments.p2tr({
66452
+ pubkey: Buffer$1.from(C, "hex"),
66453
+ network: Q
66454
+ }), R = [
66446
66455
  {
66447
66456
  value: 0,
66448
66457
  scriptPubKey: e.outputScript
@@ -66450,12 +66459,12 @@ async function buildCommitTx(t, e, r, A, s, n, o, a, u) {
66450
66459
  ];
66451
66460
  if (a > 0) {
66452
66461
  if (!o) throw new Error("Payment wallet is not available.");
66453
- v.push({
66462
+ R.push({
66454
66463
  value: 0,
66455
66464
  scriptPubKey: o.outputScript
66456
66465
  });
66457
66466
  }
66458
- const R = Tx.create({
66467
+ const M = Tx.create({
66459
66468
  vin: [
66460
66469
  {
66461
66470
  // Use the txid of the funding transaction used to send the sats.
@@ -66467,40 +66476,40 @@ async function buildCommitTx(t, e, r, A, s, n, o, a, u) {
66467
66476
  // Feel free to change this if you sent a different amount.
66468
66477
  value: 0,
66469
66478
  // This is what our address looks like in script form.
66470
- scriptPubKey: ["OP_1", l]
66479
+ scriptPubKey: ["OP_1", C]
66471
66480
  }
66472
66481
  }
66473
66482
  ],
66474
- vout: v
66483
+ vout: R
66475
66484
  });
66476
- R.vin[0].witness = [
66485
+ M.vin[0].witness = [
66477
66486
  Buff$3.hex(
66478
66487
  "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
66479
66488
  ),
66480
- I,
66481
- C
66489
+ B,
66490
+ p
66482
66491
  ];
66483
- const M = Tx.util.getTxSize(R).vsize * s, F = new WalletInfo(!1, null, Q.address, null, l), P = buildTransaction(
66484
- c,
66492
+ const F = Tx.util.getTxSize(M).vsize * s, P = new WalletInfo(!1, null, v.address, null, C), $ = buildTransaction(
66493
+ d,
66485
66494
  u,
66486
66495
  t,
66487
66496
  [],
66488
- F,
66489
- g,
66490
- s,
66491
- n + M + a
66492
- ), $ = P.tx, H = P.tx_fee, J = await buildPsbtFromTx(
66493
- $,
66497
+ P,
66494
66498
  c,
66499
+ s,
66500
+ n + F + a
66501
+ ), H = $.tx, J = $.tx_fee, K = await buildPsbtFromTx(
66502
+ H,
66503
+ d,
66495
66504
  t,
66496
66505
  u
66497
66506
  );
66498
66507
  return {
66499
- unsigned_commit_tx: $,
66500
- unsigned_psbt_hex: J.toHex(),
66501
- output_value: $.outs[0].value,
66502
- commit_fee: H,
66503
- reveal_fee: M
66508
+ unsigned_commit_tx: H,
66509
+ unsigned_psbt_hex: K.toHex(),
66510
+ output_value: H.outs[0].value,
66511
+ commit_fee: J,
66512
+ reveal_fee: F
66504
66513
  };
66505
66514
  }
66506
66515
  async function buildReclaimCommitTx(t, e, r, A, s, n, o, a) {
@@ -66622,50 +66631,50 @@ async function mintWithReclaimsAll(t, e, r, A, s, n) {
66622
66631
  n
66623
66632
  );
66624
66633
  }
66625
- async function mintWithReclaimsCheckFees(t, e, r, A) {
66626
- const s = getPaymentWallet(), n = getOrdinalsWallet();
66627
- if (!s || !n) throw new Error("Wallets not found");
66628
- const o = new WalletInfo(
66634
+ async function mintWithReclaimsCheckFees(t, e, r, A, s) {
66635
+ const n = getPaymentWallet(), o = getOrdinalsWallet();
66636
+ if (!n || !o) throw new Error("Wallets not found");
66637
+ const a = new WalletInfo(
66629
66638
  !1,
66630
66639
  null,
66631
- s.address,
66640
+ n.address,
66632
66641
  null,
66633
- s.pubkey
66634
- ), a = new WalletInfo(
66642
+ n.pubkey
66643
+ ), u = new WalletInfo(
66635
66644
  !1,
66636
66645
  null,
66637
- n.address,
66646
+ o.address,
66638
66647
  null,
66639
- n.pubkey
66648
+ o.pubkey
66640
66649
  );
66641
- (A == null || A <= 0) && (A = getDustValue(a));
66642
- const u = await getCardinalUtxos(o.addr), g = createSecretToken(), c = await buildReclaimCommitTx(
66643
- u,
66650
+ (A == null || A <= 0) && (A = getDustValue(u));
66651
+ const g = await getCardinalUtxos(a.addr, s), c = createSecretToken(), d = await buildReclaimCommitTx(
66652
+ g,
66644
66653
  e,
66645
- o,
66646
66654
  a,
66647
- g,
66655
+ u,
66656
+ c,
66648
66657
  t,
66649
66658
  r,
66650
66659
  A
66651
- ), d = c.unsignedCommitTx.getId(), h = await buildRevealTx(
66652
- a,
66653
- d,
66654
- c.commitOutputValue,
66655
- g,
66660
+ ), h = d.unsignedCommitTx.getId(), I = await buildRevealTx(
66661
+ u,
66662
+ h,
66663
+ d.commitOutputValue,
66664
+ c,
66656
66665
  t,
66657
66666
  r,
66658
66667
  A,
66659
66668
  null,
66660
66669
  null,
66661
- c.commitVout
66670
+ d.commitVout
66662
66671
  );
66663
66672
  return {
66664
- unsigned_commit_tx_hex: c.unsignedCommitTx.toHex(),
66665
- signed_reveal_tx_hex: h.signedTxHex,
66666
- inscription_id: `${h.txId}i0`,
66667
- total_fee: c.commitFee + c.revealFee,
66668
- commit_vout: c.commitVout
66673
+ unsigned_commit_tx_hex: d.unsignedCommitTx.toHex(),
66674
+ signed_reveal_tx_hex: I.signedTxHex,
66675
+ inscription_id: `${I.txId}i0`,
66676
+ total_fee: d.commitFee + d.revealFee,
66677
+ commit_vout: d.commitVout
66669
66678
  };
66670
66679
  }
66671
66680
  async function resolveReclaimInputs(t, e) {
@@ -66911,17 +66920,18 @@ async function sendInscriptionAll(t, e, r, A, s, n) {
66911
66920
  });
66912
66921
  }
66913
66922
  async function getInscriptionDetails(t, e, r) {
66914
- let A = null;
66915
- A = await getOrdinalUtxos(e);
66916
- for (const s of A)
66917
- for (let n = 0; n < s.inscription_ids.length; n++)
66918
- if (s.inscription_ids[n] === t)
66923
+ return findInscriptionDetails(t, getExtraOrdinalUtxos(e)) ?? findInscriptionDetails(t, await getOrdinalUtxos(e));
66924
+ }
66925
+ function findInscriptionDetails(t, e) {
66926
+ for (const r of e)
66927
+ for (let A = 0; A < r.inscription_ids.length; A++)
66928
+ if (r.inscription_ids[A] === t)
66919
66929
  return {
66920
- satpoint: s.satpoints[n],
66921
- value: s.value,
66922
- script_type: s.script_type,
66923
- block_height: s.block_height,
66924
- utxo: s.utxo
66930
+ satpoint: r.satpoints[A],
66931
+ value: r.value,
66932
+ script_type: r.script_type,
66933
+ block_height: r.block_height,
66934
+ utxo: r.utxo
66925
66935
  };
66926
66936
  return null;
66927
66937
  }
@@ -67280,46 +67290,47 @@ async function mintAllPaymentWallet(t, e, r, A, s, n, o) {
67280
67290
  secret: B
67281
67291
  };
67282
67292
  }
67283
- async function mintAllCheckFees(t, e, r, A, s) {
67284
- const n = getPaymentWallet(), o = getOrdinalsWallet();
67285
- if (!n || !o) throw new Error("Wallets not found");
67286
- const a = n.address, u = n.pubkey, g = o.address, c = o.pubkey, d = new WalletInfo(!1, null, a, null, u), h = new WalletInfo(
67293
+ async function mintAllCheckFees(t, e, r, A, s, n) {
67294
+ const o = getPaymentWallet(), a = getOrdinalsWallet();
67295
+ if (!o || !a) throw new Error("Wallets not found");
67296
+ const u = o.address, g = o.pubkey, c = a.address, d = a.pubkey, h = new WalletInfo(!1, null, u, null, g), I = new WalletInfo(
67287
67297
  !1,
67288
67298
  null,
67289
- g,
67299
+ c,
67290
67300
  null,
67291
- c
67301
+ d
67292
67302
  );
67293
- let I = null;
67294
- (r == null || r <= 0) && (r = getDustValue(h));
67295
- const B = createSecretToken(), l = await buildCommitTx(
67296
- d,
67303
+ let B = null;
67304
+ (r == null || r <= 0) && (r = getDustValue(I));
67305
+ const l = createSecretToken(), C = await buildCommitTx(
67297
67306
  h,
67298
- B,
67307
+ I,
67308
+ l,
67299
67309
  t,
67300
67310
  e,
67301
67311
  r,
67302
- I,
67303
- s,
67304
- []
67305
- ), C = l.unsigned_commit_tx.getId(), p = await buildRevealTx(
67306
- h,
67307
- C,
67308
- l.output_value,
67309
67312
  B,
67313
+ s,
67314
+ [],
67315
+ n
67316
+ ), p = C.unsigned_commit_tx.getId(), Q = await buildRevealTx(
67317
+ I,
67318
+ p,
67319
+ C.output_value,
67320
+ l,
67310
67321
  t,
67311
67322
  e,
67312
67323
  r,
67313
- I,
67324
+ B,
67314
67325
  s
67315
67326
  );
67316
67327
  return {
67317
- commit_fee: l.commit_fee,
67318
- reveal_fee: l.reveal_fee,
67319
- total_fee: l.commit_fee + l.reveal_fee,
67320
- unsigned_commit_tx_hex: l.unsigned_commit_tx.toHex(),
67321
- signed_reveal_tx_hex: p.signedTxHex,
67322
- inscription_id: `${p.txId}i0`,
67328
+ commit_fee: C.commit_fee,
67329
+ reveal_fee: C.reveal_fee,
67330
+ total_fee: C.commit_fee + C.reveal_fee,
67331
+ unsigned_commit_tx_hex: C.unsigned_commit_tx.toHex(),
67332
+ signed_reveal_tx_hex: Q.signedTxHex,
67333
+ inscription_id: `${Q.txId}i0`,
67323
67334
  postage: r
67324
67335
  };
67325
67336
  }
@@ -67556,47 +67567,47 @@ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll(t, e, r
67556
67567
  signedTxHex: J.signedTxHex
67557
67568
  };
67558
67569
  }
67559
- async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(t, e, r, A, s, n) {
67560
- const o = getPaymentWallet(), a = getOrdinalsWallet();
67561
- if (!o || !a) throw new Error("Wallets not found");
67562
- const u = o.address, g = o.pubkey, c = a.address, d = a.pubkey, h = new WalletInfo(!1, null, u, null, g), I = new WalletInfo(
67570
+ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(t, e, r, A, s, n, o) {
67571
+ const a = getPaymentWallet(), u = getOrdinalsWallet();
67572
+ if (!a || !u) throw new Error("Wallets not found");
67573
+ const g = a.address, c = a.pubkey, d = u.address, h = u.pubkey, I = new WalletInfo(!1, null, g, null, c), B = new WalletInfo(
67563
67574
  !1,
67564
67575
  null,
67565
- c,
67576
+ d,
67566
67577
  null,
67567
- d
67578
+ h
67568
67579
  );
67569
- if (!I.addr) throw new Error("Inscription wallet address is not set.");
67570
- const B = await getInscriptionDetails(t, I.addr);
67571
- if (B == null)
67580
+ if (!B.addr) throw new Error("Inscription wallet address is not set.");
67581
+ const l = await getInscriptionDetails(t, B.addr);
67582
+ if (l == null)
67572
67583
  throw new Error("Inscription cannot be found in wallet");
67573
- if (B.satpoint.split(":")[2] !== "0")
67584
+ if (l.satpoint.split(":")[2] !== "0")
67574
67585
  throw new Error("Inscription is not at the first sat of utxo");
67575
- if (!h.addr) throw new Error("Payer wallet address is not set.");
67576
- const l = await getCardinalUtxos(h.addr), p = [{
67577
- utxo: `${B.satpoint.split(":")[0]}:${B.satpoint.split(":")[1]}`,
67578
- value: B.value,
67579
- script_type: B.script_type,
67580
- wallet: I
67586
+ if (!I.addr) throw new Error("Payer wallet address is not set.");
67587
+ const C = await getCardinalUtxos(I.addr, o), Q = [{
67588
+ utxo: `${l.satpoint.split(":")[0]}:${l.satpoint.split(":")[1]}`,
67589
+ value: l.value,
67590
+ script_type: l.script_type,
67591
+ wallet: B
67581
67592
  }];
67582
- for (const F of e)
67583
- p.push(F);
67584
- const Q = [r], v = [A];
67585
- for (const F of s)
67586
- Q.push(F.wallet), v.push(F.value);
67587
- const R = buildTransactionMultiOutput(
67588
- l,
67589
- p,
67590
- h,
67593
+ for (const P of e)
67594
+ Q.push(P);
67595
+ const v = [r], R = [A];
67596
+ for (const P of s)
67597
+ v.push(P.wallet), R.push(P.value);
67598
+ const M = buildTransactionMultiOutput(
67599
+ C,
67591
67600
  Q,
67601
+ I,
67592
67602
  v,
67593
- h,
67603
+ R,
67604
+ I,
67594
67605
  n
67595
- ), M = R.tx;
67606
+ ), F = M.tx;
67596
67607
  return {
67597
- txid: M.getId(),
67598
- unsigned_tx_hex: M.toHex(),
67599
- tx_fee: R.tx_fee
67608
+ txid: F.getId(),
67609
+ unsigned_tx_hex: F.toHex(),
67610
+ tx_fee: M.tx_fee
67600
67611
  };
67601
67612
  }
67602
67613
  async function mintWithExtraInputInCommitAll(t, e, r, A, s, n, o, a) {
@@ -67654,46 +67665,47 @@ async function mintWithExtraInputInCommitAll(t, e, r, A, s, n, o, a) {
67654
67665
  secret: p
67655
67666
  };
67656
67667
  }
67657
- async function mintWithExtraInputInCommitFeeRate(t, e, r, A, s, n) {
67658
- const o = getPaymentWallet(), a = getOrdinalsWallet();
67659
- if (!o || !a) throw new Error("Wallets not found");
67660
- const u = o.address, g = o.pubkey, c = a.address, d = a.pubkey, h = new WalletInfo(!1, null, u, null, g), I = new WalletInfo(
67668
+ async function mintWithExtraInputInCommitFeeRate(t, e, r, A, s, n, o) {
67669
+ const a = getPaymentWallet(), u = getOrdinalsWallet();
67670
+ if (!a || !u) throw new Error("Wallets not found");
67671
+ const g = a.address, c = a.pubkey, d = u.address, h = u.pubkey, I = new WalletInfo(!1, null, g, null, c), B = new WalletInfo(
67661
67672
  !1,
67662
67673
  null,
67663
- c,
67674
+ d,
67664
67675
  null,
67665
- d
67676
+ h
67666
67677
  );
67667
- let B = null;
67668
- (A == null || A <= 0) && (A = getDustValue(I));
67669
- const l = createSecretToken(), C = await buildCommitTx(
67670
- h,
67678
+ let l = null;
67679
+ (A == null || A <= 0) && (A = getDustValue(B));
67680
+ const C = createSecretToken(), p = await buildCommitTx(
67671
67681
  I,
67672
- l,
67682
+ B,
67683
+ C,
67673
67684
  t,
67674
67685
  r,
67675
67686
  A,
67676
- B,
67677
- n,
67678
- e
67679
- ), p = C.unsigned_commit_tx.getId(), Q = await buildRevealTx(
67680
- I,
67681
- p,
67682
- C.output_value,
67683
67687
  l,
67688
+ n,
67689
+ e,
67690
+ o
67691
+ ), Q = p.unsigned_commit_tx.getId(), v = await buildRevealTx(
67692
+ B,
67693
+ Q,
67694
+ p.output_value,
67695
+ C,
67684
67696
  t,
67685
67697
  r,
67686
67698
  A,
67687
- B,
67699
+ l,
67688
67700
  n
67689
67701
  );
67690
67702
  return {
67691
- commit_fee: C.commit_fee,
67692
- reveal_fee: C.reveal_fee,
67693
- total_fee: C.commit_fee + C.reveal_fee,
67694
- unsigned_commit_tx_hex: C.unsigned_commit_tx.toHex(),
67695
- signed_reveal_tx_hex: Q.signedTxHex,
67696
- inscription_id: `${Q.txId}i0`,
67703
+ commit_fee: p.commit_fee,
67704
+ reveal_fee: p.reveal_fee,
67705
+ total_fee: p.commit_fee + p.reveal_fee,
67706
+ unsigned_commit_tx_hex: p.unsigned_commit_tx.toHex(),
67707
+ signed_reveal_tx_hex: v.signedTxHex,
67708
+ inscription_id: `${v.txId}i0`,
67697
67709
  postage: A
67698
67710
  };
67699
67711
  }
@@ -67729,30 +67741,31 @@ export {
67729
67741
  getAllBalanceDetails as a,
67730
67742
  Buff$3 as a0,
67731
67743
  InscriptionDetails as a1,
67732
- resolveReclaimInputs as a2,
67733
- mintWithReclaimsCheckFees as a3,
67734
- mintAllCheckFees as a4,
67735
- saveExtraUtxos as a5,
67736
- Script as a6,
67737
- sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate as a7,
67738
- clearExtraUtxos as a8,
67739
- utxoOutputTypeFromOutputScript as a9,
67740
- mintWithExtraInputInCommitFeeRate as aa,
67741
- mintWithReclaimsAll as ab,
67742
- mintAll as ac,
67743
- sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll as ad,
67744
- mintWithExtraInputInCommitAll as ae,
67745
- callSmartContract as af,
67746
- callSmartContractFromPaymentWallet as ag,
67747
- evmEncodeFunctionCall as ah,
67748
- depositToBrc20Prog as ai,
67749
- withdrawFromBrc20Prog as aj,
67750
- inscribeMultiple as ak,
67751
- inscribeWithParent as al,
67752
- getInscribeMultipleFee as am,
67753
- getSwapBackendUrl as an,
67754
- fetchWithErrors as ao,
67755
- ethCallOnPublicRpc as ap,
67744
+ fetchCardinalUtxos as a2,
67745
+ resolveReclaimInputs as a3,
67746
+ mintWithReclaimsCheckFees as a4,
67747
+ mintAllCheckFees as a5,
67748
+ saveExtraUtxos as a6,
67749
+ Script as a7,
67750
+ sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate as a8,
67751
+ clearExtraUtxos as a9,
67752
+ utxoOutputTypeFromOutputScript as aa,
67753
+ mintWithExtraInputInCommitFeeRate as ab,
67754
+ mintWithReclaimsAll as ac,
67755
+ mintAll as ad,
67756
+ sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll as ae,
67757
+ mintWithExtraInputInCommitAll as af,
67758
+ callSmartContract as ag,
67759
+ callSmartContractFromPaymentWallet as ah,
67760
+ evmEncodeFunctionCall as ai,
67761
+ depositToBrc20Prog as aj,
67762
+ withdrawFromBrc20Prog as ak,
67763
+ inscribeMultiple as al,
67764
+ inscribeWithParent as am,
67765
+ getInscribeMultipleFee as an,
67766
+ getSwapBackendUrl as ao,
67767
+ fetchWithErrors as ap,
67768
+ ethCallOnPublicRpc as aq,
67756
67769
  getCardinalBalance as b,
67757
67770
  clearWalletInfo as c,
67758
67771
  getNetwork as d,
package/dist/node.js CHANGED
@@ -1,7 +1,7 @@
1
- import { x as fI, y as KA, B as f, z as eI, A as tI, C as RA, D as d, E as SI, F as ZA, G as e, H as UA, I as nI, J as pI, K as rI, L as FI, M as sI, N as KI, O as BA, d as zA, i as eA, P as RI, c as UI, Q as qI, W as VI, a as lI, b as dI, e as xI, f as YI, h as JI, s as PI, j as vI, k as OI, l as uI, m as jI } from "./mint-Dm67SjcM.js";
2
- import { o as LQ, v as TQ, n as ZQ, r as zQ, p as mQ, q as XQ, t as WQ, w as _Q, u as $Q } from "./mint-Dm67SjcM.js";
3
- import { s as bI } from "./balances-_-oF5kR6.js";
4
- import { c as IC, b as gC, m as QC, a as CC } from "./balances-_-oF5kR6.js";
1
+ import { x as fI, y as KA, B as f, z as eI, A as tI, C as RA, D as d, E as SI, F as ZA, G as e, H as UA, I as nI, J as pI, K as rI, L as FI, M as sI, N as KI, O as BA, d as zA, i as eA, P as RI, c as UI, Q as qI, W as VI, a as lI, b as dI, e as xI, f as YI, h as JI, s as PI, j as vI, k as OI, l as uI, m as jI } from "./mint-C_wN10-d.js";
2
+ import { o as LQ, v as TQ, n as ZQ, r as zQ, p as mQ, q as XQ, t as WQ, w as _Q, u as $Q } from "./mint-C_wN10-d.js";
3
+ import { s as bI } from "./balances-CvlQK3uA.js";
4
+ import { c as IC, b as gC, m as QC, a as CC } from "./balances-CvlQK3uA.js";
5
5
  var LI = fI();
6
6
  const qA = {
7
7
  messagePrefix: `Bitcoin Signed Message:
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useSyncExternalStore as u, useCallback as r, useState as w } from "react";
2
- import { R as c, d as t, i as l, h as n } from "./mint-Dm67SjcM.js";
2
+ import { R as c, d as t, i as l, h as n } from "./mint-C_wN10-d.js";
3
3
  function m() {
4
4
  const e = u(c, t, t), s = r((o) => l(o), []);
5
5
  return [e, s];
@@ -1,4 +1,4 @@
1
- import { D as l, C as x, E as b, d, S as B, G as p, f as S, T, Q as P } from "./mint-Dm67SjcM.js";
1
+ import { D as l, C as x, E as b, d, S as B, G as p, f as S, T, Q as P } from "./mint-C_wN10-d.js";
2
2
  async function X() {
3
3
  if (!window.LeatherProvider) throw new Error("Leather extension not found.");
4
4
  const e = await window.LeatherProvider.request("getAddresses");
@@ -50,6 +50,15 @@ export declare function clearExtraUtxos(): void;
50
50
  * @returns A string representing the type of the UTXO output, such as 'pubkeyhash', 'scripthash', 'witness_v0_keyhash', 'witness_v0_scripthash', 'witness_v1_taproot', 'pubkey', 'anchor', 'witness_unknown', 'nulldata', 'multisig', or 'nonstandard'.
51
51
  */
52
52
  export declare function utxoOutputTypeFromOutputScript(output: any, network: any): 'pubkeyhash' | 'scripthash' | 'witness_v0_keyhash' | 'witness_v0_scripthash' | 'witness_v1_taproot' | 'pubkey' | 'anchor' | 'witness_unknown' | 'nulldata' | 'multisig' | 'nonstandard';
53
+ /**
54
+ * Returns the ordinal UTXOs that the saved extra transactions create for `addr`: the
55
+ * output carrying the saved extra inscription, unless another extra transaction spends it.
56
+ * These are the entries `getOrdinalUtxos` appends to the backend's list.
57
+ *
58
+ * @param addr The address the inscription output must pay to.
59
+ * @returns The extra ordinal UTXOs for `addr`, empty when no extras are saved.
60
+ */
61
+ export declare function getExtraOrdinalUtxos(addr: string): APIOrdinalUtxoInfo[];
53
62
  /**
54
63
  * Converts a witness stack to a script witness format that can be used in Bitcoin transactions.
55
64
  * @param witness An array representing the witness stack, where each element is a buffer or a string that can be converted to a buffer.
@@ -76,9 +85,17 @@ export interface APIUtxoInfo {
76
85
  * Fetches the UTXOs associated with a given address from the backend API and applies fixes to include any extra UTXOs that are currently in the process of being used in transactions but not yet confirmed on the blockchain.
77
86
  *
78
87
  * @param addr The address for which to fetch the UTXOs.
88
+ * @param fetchedUtxos A response from `fetchCardinalUtxos(addr)` to use in place of a new fetch. Each call works on its own copy, since coin selection sorts and splices the list it is given.
79
89
  * @returns A promise that resolves to an array of UTXO information objects.
80
90
  */
81
- export declare function getCardinalUtxos(addr: string): Promise<APIUtxoInfo[]>;
91
+ export declare function getCardinalUtxos(addr: string, fetchedUtxos?: APIUtxoInfo[]): Promise<APIUtxoInfo[]>;
92
+ /**
93
+ * Fetches the backend's cardinal UTXO list for an address as served, without the saved extra UTXOs applied. A dry run that prices several transactions fetches this once and passes it to each `getCardinalUtxos` call.
94
+ *
95
+ * @param addr The address for which to fetch the UTXOs.
96
+ * @returns A promise that resolves to the backend's array of UTXO information objects.
97
+ */
98
+ export declare function fetchCardinalUtxos(addr: string): Promise<APIUtxoInfo[]>;
82
99
  /**
83
100
  * This function gets the balance of a given address by fetching its UTXOs from the backend and summing
84
101
  * their values. It also applies fixes to include any extra UTXOs that are currently in the process of