@bestinslot/wallet-kit 0.10.0 → 0.12.0
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/README.md +4 -6
- package/dist/{balances-BWhpck6N.js → balances-Ci1sYbGa.js} +1625 -1569
- package/dist/browser.js +7 -9
- package/dist/core.js +5 -5
- package/dist/{mint-CA_-62SJ.js → mint-Dm67SjcM.js} +103 -171
- package/dist/node.js +10 -14
- package/dist/react.js +1 -1
- package/dist/{register-browser-providers-_EU6DoLd.js → register-browser-providers-BTO9Kyf2.js} +38 -73
- package/dist/types/api/swap.d.ts +17 -4
- package/dist/types/api/wallet.node.d.ts +1 -1
- package/dist/types/core/bis_swap.d.ts +64 -17
- package/dist/types/lib/fee-policy.d.ts +41 -0
- package/dist/types/lib/swap-reporting.d.ts +22 -0
- package/dist/vue.js +1 -1
- package/package.json +10 -3
|
@@ -41756,8 +41756,7 @@ async function getWallets(t) {
|
|
|
41756
41756
|
const e = await requireProvider(t).getWallets().catch((A) => {
|
|
41757
41757
|
throw console.error("Failed to get wallets.", A), new Error(A?.message || "Failed to get wallets.");
|
|
41758
41758
|
});
|
|
41759
|
-
if (!e)
|
|
41760
|
-
throw new Error("Failed to get wallets.");
|
|
41759
|
+
if (!e) throw new Error("Failed to get wallets.");
|
|
41761
41760
|
const r = {
|
|
41762
41761
|
provider: t,
|
|
41763
41762
|
wallets: e,
|
|
@@ -41772,8 +41771,7 @@ function subscribeToAccountChanges(t) {
|
|
|
41772
41771
|
}
|
|
41773
41772
|
function watchAccounts() {
|
|
41774
41773
|
const t = getWalletInfo()?.provider;
|
|
41775
|
-
if (accountWatch && accountWatch.provider === t)
|
|
41776
|
-
return;
|
|
41774
|
+
if (accountWatch && accountWatch.provider === t) return;
|
|
41777
41775
|
accountWatch?.unsubscribe(), accountWatch = null;
|
|
41778
41776
|
const e = t ? PROVIDERS[t] : void 0;
|
|
41779
41777
|
!t || !e?.onAccountsChanged || (accountWatch = {
|
|
@@ -41783,8 +41781,7 @@ function watchAccounts() {
|
|
|
41783
41781
|
}
|
|
41784
41782
|
function handleAccountsChanged(t, e) {
|
|
41785
41783
|
const r = getWalletInfo();
|
|
41786
|
-
if (!r || r.provider !== t || e.length === 0 || r.wallets.some((s) => e.includes(s.address)))
|
|
41787
|
-
return;
|
|
41784
|
+
if (!r || r.provider !== t || e.length === 0 || r.wallets.some((s) => e.includes(s.address))) return;
|
|
41788
41785
|
clearWalletInfo(), accountWatch?.unsubscribe(), accountWatch = null;
|
|
41789
41786
|
const A = {
|
|
41790
41787
|
provider: t,
|
|
@@ -41801,8 +41798,7 @@ function handleAccountsChanged(t, e) {
|
|
|
41801
41798
|
async function assertActiveAccount(t, e) {
|
|
41802
41799
|
watchAccounts();
|
|
41803
41800
|
const r = requireProvider(t);
|
|
41804
|
-
if (!r.getAccounts)
|
|
41805
|
-
return;
|
|
41801
|
+
if (!r.getAccounts) return;
|
|
41806
41802
|
let A;
|
|
41807
41803
|
try {
|
|
41808
41804
|
A = await r.getAccounts();
|
|
@@ -65179,12 +65175,10 @@ function getEvmAddressFromPkScript(t) {
|
|
|
65179
65175
|
}
|
|
65180
65176
|
async function callSmartContract(t, e, r, A, s, n, o, a, u) {
|
|
65181
65177
|
const g = getWalletInfo();
|
|
65182
|
-
if (!g || !g.wallets)
|
|
65183
|
-
throw new Error("Wallets not found");
|
|
65178
|
+
if (!g || !g.wallets) throw new Error("Wallets not found");
|
|
65184
65179
|
if (typeof t != "string")
|
|
65185
65180
|
throw new Error("smart_contract_contract_addr must be a string");
|
|
65186
|
-
if (typeof e != "string")
|
|
65187
|
-
throw new Error("input_hex must be a string");
|
|
65181
|
+
if (typeof e != "string") throw new Error("input_hex must be a string");
|
|
65188
65182
|
if (typeof s != "number" || !Number.isInteger(s))
|
|
65189
65183
|
throw new Error("fee_rate must be an integer");
|
|
65190
65184
|
if (n != null && (typeof n != "number" || !Number.isInteger(n)))
|
|
@@ -65193,8 +65187,7 @@ async function callSmartContract(t, e, r, A, s, n, o, a, u) {
|
|
|
65193
65187
|
throw new Error("payment_addr must be a string");
|
|
65194
65188
|
if (a != null && (typeof a != "number" || !Number.isInteger(a)))
|
|
65195
65189
|
throw new Error("payment must be an integer");
|
|
65196
|
-
if (typeof u != "boolean")
|
|
65197
|
-
throw new Error("dry_run must be a boolean");
|
|
65190
|
+
if (typeof u != "boolean") throw new Error("dry_run must be a boolean");
|
|
65198
65191
|
const c = await compressSmartContractData(e);
|
|
65199
65192
|
let d = Buff$3.str(
|
|
65200
65193
|
`{"p":"brc20-prog","op":"c","c":"${t}","b":"${c}"}`
|
|
@@ -65269,12 +65262,10 @@ async function callSmartContract(t, e, r, A, s, n, o, a, u) {
|
|
|
65269
65262
|
}
|
|
65270
65263
|
async function callSmartContractFromPaymentWallet(t, e, r, A, s, n, o, a, u) {
|
|
65271
65264
|
const g = getWalletInfo();
|
|
65272
|
-
if (!g || !g.wallets)
|
|
65273
|
-
throw new Error("Wallets not found");
|
|
65265
|
+
if (!g || !g.wallets) throw new Error("Wallets not found");
|
|
65274
65266
|
if (typeof t != "string")
|
|
65275
65267
|
throw new Error("smart_contract_contract_addr must be a string");
|
|
65276
|
-
if (typeof e != "string")
|
|
65277
|
-
throw new Error("input_hex must be a string");
|
|
65268
|
+
if (typeof e != "string") throw new Error("input_hex must be a string");
|
|
65278
65269
|
if (typeof s != "number" || !Number.isInteger(s))
|
|
65279
65270
|
throw new Error("fee_rate must be an integer");
|
|
65280
65271
|
if (n != null && (typeof n != "number" || !Number.isInteger(n)))
|
|
@@ -65283,8 +65274,7 @@ async function callSmartContractFromPaymentWallet(t, e, r, A, s, n, o, a, u) {
|
|
|
65283
65274
|
throw new Error("payment_addr must be a string");
|
|
65284
65275
|
if (a != null && (typeof a != "number" || !Number.isInteger(a)))
|
|
65285
65276
|
throw new Error("payment must be an integer");
|
|
65286
|
-
if (typeof u != "boolean")
|
|
65287
|
-
throw new Error("dry_run must be a boolean");
|
|
65277
|
+
if (typeof u != "boolean") throw new Error("dry_run must be a boolean");
|
|
65288
65278
|
const c = await compressSmartContractData(e);
|
|
65289
65279
|
let d = Buff$3.str(
|
|
65290
65280
|
`{"p":"brc20-prog","op":"c","c":"${t}","b":"${c}"}`
|
|
@@ -65366,12 +65356,9 @@ async function callSmartContractFromPaymentWallet(t, e, r, A, s, n, o, a, u) {
|
|
|
65366
65356
|
}
|
|
65367
65357
|
async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
65368
65358
|
const a = getWalletInfo();
|
|
65369
|
-
if (!a || !a.wallets)
|
|
65370
|
-
|
|
65371
|
-
if (typeof
|
|
65372
|
-
throw new Error("tick must be a string");
|
|
65373
|
-
if (typeof e != "string")
|
|
65374
|
-
throw new Error("amount must be a string");
|
|
65359
|
+
if (!a || !a.wallets) throw new Error("Wallets not found");
|
|
65360
|
+
if (typeof t != "string") throw new Error("tick must be a string");
|
|
65361
|
+
if (typeof e != "string") throw new Error("amount must be a string");
|
|
65375
65362
|
if (typeof r != "number" || !Number.isInteger(r))
|
|
65376
65363
|
throw new Error("fee_rate must be an integer");
|
|
65377
65364
|
if (A != null && (typeof A != "number" || !Number.isInteger(A)))
|
|
@@ -65380,8 +65367,7 @@ async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
|
65380
65367
|
throw new Error("payment_addr must be a string");
|
|
65381
65368
|
if (n != null && (typeof n != "number" || !Number.isInteger(n)))
|
|
65382
65369
|
throw new Error("payment must be an integer");
|
|
65383
|
-
if (typeof o != "boolean")
|
|
65384
|
-
throw new Error("dry_run must be a boolean");
|
|
65370
|
+
if (typeof o != "boolean") throw new Error("dry_run must be a boolean");
|
|
65385
65371
|
const u = Buff$3.str(`{"p":"brc-20","op":"transfer","tick":"${t}","amt":"${e}"}`), g = new InscriptionDetails(
|
|
65386
65372
|
Buff$3.str("text/plain"),
|
|
65387
65373
|
null,
|
|
@@ -65455,14 +65441,10 @@ async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
|
65455
65441
|
}
|
|
65456
65442
|
async function withdrawFromBrc20Prog(t, e, r, A, s, n, o, a) {
|
|
65457
65443
|
const u = getWalletInfo();
|
|
65458
|
-
if (!u || !u.wallets)
|
|
65459
|
-
|
|
65460
|
-
if (typeof
|
|
65461
|
-
|
|
65462
|
-
if (typeof e != "string")
|
|
65463
|
-
throw new Error("amount must be a string");
|
|
65464
|
-
if (typeof r != "string")
|
|
65465
|
-
throw new Error("target_addr must be a string");
|
|
65444
|
+
if (!u || !u.wallets) throw new Error("Wallets not found");
|
|
65445
|
+
if (typeof t != "string") throw new Error("tick must be a string");
|
|
65446
|
+
if (typeof e != "string") throw new Error("amount must be a string");
|
|
65447
|
+
if (typeof r != "string") throw new Error("target_addr must be a string");
|
|
65466
65448
|
if (typeof A != "number" || !Number.isInteger(A))
|
|
65467
65449
|
throw new Error("fee_rate must be an integer");
|
|
65468
65450
|
if (s != null && (typeof s != "number" || !Number.isInteger(s)))
|
|
@@ -65471,8 +65453,7 @@ async function withdrawFromBrc20Prog(t, e, r, A, s, n, o, a) {
|
|
|
65471
65453
|
throw new Error("payment_addr must be a string");
|
|
65472
65454
|
if (o != null && (typeof o != "number" || !Number.isInteger(o)))
|
|
65473
65455
|
throw new Error("payment must be an integer");
|
|
65474
|
-
if (typeof a != "boolean")
|
|
65475
|
-
throw new Error("dry_run must be a boolean");
|
|
65456
|
+
if (typeof a != "boolean") throw new Error("dry_run must be a boolean");
|
|
65476
65457
|
const g = Buff$3.str(
|
|
65477
65458
|
`{"p":"brc20-module","op":"withdraw","tick":"${t}","amt":"${e}","module":"BRC20PROG"}`
|
|
65478
65459
|
), c = new InscriptionDetails(
|
|
@@ -65608,8 +65589,7 @@ function checkIfUtxoUsedInExtras(t, e) {
|
|
|
65608
65589
|
return !1;
|
|
65609
65590
|
}
|
|
65610
65591
|
function checkIfUtxoIsExtraOrdinal(t, e) {
|
|
65611
|
-
if (currentExtraInscriptions == null)
|
|
65612
|
-
return !1;
|
|
65592
|
+
if (currentExtraInscriptions == null) return !1;
|
|
65613
65593
|
const r = currentExtraInscriptions[1].split(":")[0], A = Number.parseInt(currentExtraInscriptions[1].split(":")[1]);
|
|
65614
65594
|
return r === t && A === e;
|
|
65615
65595
|
}
|
|
@@ -65652,8 +65632,7 @@ function utxoOutputTypeFromOutputScript(t, e) {
|
|
|
65652
65632
|
throw new Error(`Unknown output type: ${r.name}`);
|
|
65653
65633
|
}
|
|
65654
65634
|
function fixCardinalUtxos(t, e) {
|
|
65655
|
-
if (currentExtraTxHexes.length === 0)
|
|
65656
|
-
return t;
|
|
65635
|
+
if (currentExtraTxHexes.length === 0) return t;
|
|
65657
65636
|
const r = getBitcoinNetwork(), A = [];
|
|
65658
65637
|
for (const s of t) {
|
|
65659
65638
|
const n = s.utxo, o = n.split(":")[0], a = Number.parseInt(n.split(":")[1]);
|
|
@@ -65692,8 +65671,7 @@ function fixCardinalUtxos(t, e) {
|
|
|
65692
65671
|
return A;
|
|
65693
65672
|
}
|
|
65694
65673
|
function fixOrdinalUtxos(t, e) {
|
|
65695
|
-
if (currentExtraTxHexes.length === 0)
|
|
65696
|
-
return t;
|
|
65674
|
+
if (currentExtraTxHexes.length === 0) return t;
|
|
65697
65675
|
const r = getBitcoinNetwork(), A = [];
|
|
65698
65676
|
for (const s of t) {
|
|
65699
65677
|
const n = s.utxo, o = n.split(":")[0], a = Number.parseInt(n.split(":")[1]);
|
|
@@ -65703,8 +65681,7 @@ function fixOrdinalUtxos(t, e) {
|
|
|
65703
65681
|
const n = srcExports.Transaction.fromHex(s), o = n.getId();
|
|
65704
65682
|
for (let a = 0; a < n.outs.length; a++) {
|
|
65705
65683
|
const u = n.outs[a];
|
|
65706
|
-
if (!checkIfUtxoIsExtraOrdinal(o, a) || checkIfUtxoUsedInExtras(o, a))
|
|
65707
|
-
continue;
|
|
65684
|
+
if (!checkIfUtxoIsExtraOrdinal(o, a) || checkIfUtxoUsedInExtras(o, a)) continue;
|
|
65708
65685
|
const g = currentExtraInscriptions ? currentExtraInscriptions[0] : null, c = currentExtraInscriptions ? currentExtraInscriptions[1] : null;
|
|
65709
65686
|
if (!(!g || !c))
|
|
65710
65687
|
try {
|
|
@@ -65912,10 +65889,8 @@ function convertInscriptionIdToBuffer(t) {
|
|
|
65912
65889
|
return Buff$3.hex(e).reverse().append(n);
|
|
65913
65890
|
}
|
|
65914
65891
|
function getDustValue(t) {
|
|
65915
|
-
if (t.isOpReturn)
|
|
65916
|
-
|
|
65917
|
-
if (t.addr == null)
|
|
65918
|
-
throw new Error("Wallet address is null");
|
|
65892
|
+
if (t.isOpReturn) return 0;
|
|
65893
|
+
if (t.addr == null) throw new Error("Wallet address is null");
|
|
65919
65894
|
return Address$2.decode(t.addr).type === "p2sh" ? DUST_VALUE_P2SH : Address$2.decode(t.addr).type === "p2w-pkh" ? DUST_VALUE_P2WPKH : Address$2.decode(t.addr).type === "p2tr" ? DUST_VALUE_P2TR : Address$2.decode(t.addr).type === "p2pkh" ? DUST_VALUE_P2PKH : DUST_VALUE_MAX;
|
|
65920
65895
|
}
|
|
65921
65896
|
function repeatStr(t, e) {
|
|
@@ -65932,8 +65907,7 @@ function calculateAdditionalFee(t, e) {
|
|
|
65932
65907
|
const TO_X_ONLY = (t) => t.length === 32 ? t : t.slice(1, 33);
|
|
65933
65908
|
async function getMintMultipleFeeAll(t, e, r, A, s) {
|
|
65934
65909
|
const n = getPaymentWallet(), o = getOrdinalsWallet();
|
|
65935
|
-
if (!n || !o)
|
|
65936
|
-
throw new Error("Wallets not found");
|
|
65910
|
+
if (!n || !o) throw new Error("Wallets not found");
|
|
65937
65911
|
const a = n.address, u = n.pubkey, g = o.address, c = o.pubkey, d = new WalletInfo(!1, null, a, null, u), h = new WalletInfo(
|
|
65938
65912
|
!1,
|
|
65939
65913
|
null,
|
|
@@ -65963,8 +65937,7 @@ async function getMintMultipleFeeAll(t, e, r, A, s) {
|
|
|
65963
65937
|
}
|
|
65964
65938
|
async function getInscribeMultipleFee(t, e, r, A) {
|
|
65965
65939
|
const s = getWalletInfo();
|
|
65966
|
-
if (!s || !s.wallets)
|
|
65967
|
-
throw new Error("Wallets not found");
|
|
65940
|
+
if (!s || !s.wallets) throw new Error("Wallets not found");
|
|
65968
65941
|
if (!Array.isArray(t))
|
|
65969
65942
|
throw new Error("inscriptionDetailsArray must be of type array [bis.InscriptionDetails]");
|
|
65970
65943
|
for (const n of t)
|
|
@@ -65990,8 +65963,7 @@ async function getInscribeMultipleFee(t, e, r, A) {
|
|
|
65990
65963
|
}
|
|
65991
65964
|
async function inscribeWithParent(t, e, r, A, s, n) {
|
|
65992
65965
|
const o = getWalletInfo();
|
|
65993
|
-
if (!o || !o.wallets)
|
|
65994
|
-
throw new Error("Wallets not found");
|
|
65966
|
+
if (!o || !o.wallets) throw new Error("Wallets not found");
|
|
65995
65967
|
if (!(t instanceof InscriptionDetails))
|
|
65996
65968
|
throw new Error("inscriptionDetails must be of type bis.InscriptionDetails");
|
|
65997
65969
|
if (typeof e != "string")
|
|
@@ -66020,8 +65992,7 @@ async function inscribeWithParent(t, e, r, A, s, n) {
|
|
|
66020
65992
|
}
|
|
66021
65993
|
async function inscribeMultiple(t, e, r, A, s) {
|
|
66022
65994
|
const n = getWalletInfo();
|
|
66023
|
-
if (!n || !n.wallets)
|
|
66024
|
-
throw new Error("Wallets not found");
|
|
65995
|
+
if (!n || !n.wallets) throw new Error("Wallets not found");
|
|
66025
65996
|
if (!Array.isArray(t))
|
|
66026
65997
|
throw new Error("inscriptionDetailsArray must be of type array [bis.InscriptionDetails]");
|
|
66027
65998
|
for (const a of t)
|
|
@@ -66038,8 +66009,7 @@ async function inscribeMultiple(t, e, r, A, s) {
|
|
|
66038
66009
|
if (u != null && (typeof u != "number" || !Number.isInteger(u)))
|
|
66039
66010
|
throw new Error("paymentAmount must be an integer");
|
|
66040
66011
|
}
|
|
66041
|
-
if (typeof A != "boolean")
|
|
66042
|
-
throw new Error("dryRun must be a boolean");
|
|
66012
|
+
if (typeof A != "boolean") throw new Error("dryRun must be a boolean");
|
|
66043
66013
|
const o = getSignFn(n.provider);
|
|
66044
66014
|
return await mintMultipleAll(
|
|
66045
66015
|
t,
|
|
@@ -66086,8 +66056,7 @@ async function buildRevealTxMultiple(t, e, r, A, s, n, o, a) {
|
|
|
66086
66056
|
],
|
|
66087
66057
|
vout: l
|
|
66088
66058
|
}), p = Signer$1.taproot.sign(u, C, 0, { extension: d });
|
|
66089
|
-
if (C.vin[0].witness = [p, c, I], !Signer$1.taproot.verify(C, 0, { pubkey: g, throws: !0 }))
|
|
66090
|
-
throw new Error("Invalid signature");
|
|
66059
|
+
if (C.vin[0].witness = [p, c, I], !Signer$1.taproot.verify(C, 0, { pubkey: g, throws: !0 })) throw new Error("Invalid signature");
|
|
66091
66060
|
return {
|
|
66092
66061
|
txid: Tx.util.getTxid(C),
|
|
66093
66062
|
signed_reveal_tx_hex: Tx.encode(C).hex
|
|
@@ -66095,8 +66064,7 @@ async function buildRevealTxMultiple(t, e, r, A, s, n, o, a) {
|
|
|
66095
66064
|
}
|
|
66096
66065
|
async function mintMultipleAll(t, e, r, A, s, n, o) {
|
|
66097
66066
|
const a = getPaymentWallet(), u = getOrdinalsWallet();
|
|
66098
|
-
if (!a || !u)
|
|
66099
|
-
throw new Error("Wallets not found");
|
|
66067
|
+
if (!a || !u) throw new Error("Wallets not found");
|
|
66100
66068
|
const g = a.address, c = a.pubkey, d = u.address, h = u.pubkey, I = new WalletInfo(!1, null, g, null, c), B = new WalletInfo(
|
|
66101
66069
|
!1,
|
|
66102
66070
|
null,
|
|
@@ -66131,7 +66099,9 @@ async function mintMultipleAll(t, e, r, A, s, n, o) {
|
|
|
66131
66099
|
s
|
|
66132
66100
|
), M = await validateTxes([Q.signedTxHex, R.signed_reveal_tx_hex]);
|
|
66133
66101
|
if (M == null)
|
|
66134
|
-
throw new Error(
|
|
66102
|
+
throw new Error(
|
|
66103
|
+
"Multiple inscription commit/reveal validation failed (testmempoolaccept request failed)"
|
|
66104
|
+
);
|
|
66135
66105
|
for (const P of M)
|
|
66136
66106
|
if (!P.allowed)
|
|
66137
66107
|
throw new Error(P["reject-reason"]);
|
|
@@ -66306,8 +66276,7 @@ function buildTransaction(t, e, r, A, s, n, o, a, u, g) {
|
|
|
66306
66276
|
for (; B < a + l; ) {
|
|
66307
66277
|
let M = a + l - B;
|
|
66308
66278
|
for (; M > 0; ) {
|
|
66309
|
-
if (c.length === 0)
|
|
66310
|
-
throw new Error("Not enough funds");
|
|
66279
|
+
if (c.length === 0) throw new Error("Not enough funds");
|
|
66311
66280
|
const F = c[c.length - 1], P = M + calculateAdditionalFee(F.script_type, o);
|
|
66312
66281
|
if (F.value >= P) {
|
|
66313
66282
|
for (const $ of c.filter((H) => H.value > 1e4)) {
|
|
@@ -66353,8 +66322,7 @@ function buildTransaction(t, e, r, A, s, n, o, a, u, g) {
|
|
|
66353
66322
|
throw new Error("Not enough funds to pay fee");
|
|
66354
66323
|
} else {
|
|
66355
66324
|
const M = h[Q].wallet;
|
|
66356
|
-
if (!M)
|
|
66357
|
-
throw new Error("Fee payer output does not exist");
|
|
66325
|
+
if (!M) throw new Error("Fee payer output does not exist");
|
|
66358
66326
|
if (h[Q].value - l < getDustValue(M))
|
|
66359
66327
|
throw new Error("Fee payer output cannot pay the fee");
|
|
66360
66328
|
h[Q].value -= l;
|
|
@@ -66387,8 +66355,7 @@ async function buildPsbtFromTx(t, e, r, A) {
|
|
|
66387
66355
|
break;
|
|
66388
66356
|
}
|
|
66389
66357
|
}
|
|
66390
|
-
if (g == null)
|
|
66391
|
-
throw new Error("Cannot find utxo in cardinal_utxos");
|
|
66358
|
+
if (g == null) throw new Error("Cannot find utxo in cardinal_utxos");
|
|
66392
66359
|
const d = await getTxhex(a.hash.toString("hex")), h = srcExports.Transaction.fromHex(d);
|
|
66393
66360
|
for (const I in h.outs)
|
|
66394
66361
|
try {
|
|
@@ -66440,8 +66407,7 @@ async function buildPsbtFromTx(t, e, r, A) {
|
|
|
66440
66407
|
const I = h.outs[a.index];
|
|
66441
66408
|
g.witnessUtxoScript != null && (I.script = g.witnessUtxoScript);
|
|
66442
66409
|
let B = ENABLE_RBF_NO_LOCKTIME;
|
|
66443
|
-
if (g.sequence != null && (B = g.sequence), !c.publicKey)
|
|
66444
|
-
throw new Error("publicKey is null on p2tr input");
|
|
66410
|
+
if (g.sequence != null && (B = g.sequence), !c.publicKey) throw new Error("publicKey is null on p2tr input");
|
|
66445
66411
|
g.tapLeafScript == null ? n.addInput({
|
|
66446
66412
|
hash: a.hash.toString("hex"),
|
|
66447
66413
|
index: a.index,
|
|
@@ -66472,8 +66438,7 @@ async function buildPsbtFromTx(t, e, r, A) {
|
|
|
66472
66438
|
async function buildCommitTx(t, e, r, A, s, n, o, a, u) {
|
|
66473
66439
|
(a == null || a < 0) && (a = 0);
|
|
66474
66440
|
const g = t;
|
|
66475
|
-
if (!t.addr)
|
|
66476
|
-
throw new Error("Payer wallet address is not set.");
|
|
66441
|
+
if (!t.addr) throw new Error("Payer wallet address is not set.");
|
|
66477
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({
|
|
66478
66443
|
pubkey: Buffer$1.from(l, "hex"),
|
|
66479
66444
|
network: p
|
|
@@ -66484,8 +66449,7 @@ async function buildCommitTx(t, e, r, A, s, n, o, a, u) {
|
|
|
66484
66449
|
}
|
|
66485
66450
|
];
|
|
66486
66451
|
if (a > 0) {
|
|
66487
|
-
if (!o)
|
|
66488
|
-
throw new Error("Payment wallet is not available.");
|
|
66452
|
+
if (!o) throw new Error("Payment wallet is not available.");
|
|
66489
66453
|
v.push({
|
|
66490
66454
|
value: 0,
|
|
66491
66455
|
scriptPubKey: o.outputScript
|
|
@@ -66617,8 +66581,7 @@ async function assembleReclaimCommitAndReveal(t, e, r, A, s, n, o, a) {
|
|
|
66617
66581
|
if (I == null)
|
|
66618
66582
|
throw new Error("Reclaim commit/reveal validation failed (testmempoolaccept request failed)");
|
|
66619
66583
|
for (const B of I)
|
|
66620
|
-
if (!B.allowed)
|
|
66621
|
-
throw new Error(B["reject-reason"]);
|
|
66584
|
+
if (!B.allowed) throw new Error(B["reject-reason"]);
|
|
66622
66585
|
return {
|
|
66623
66586
|
commitTxId: d.txId,
|
|
66624
66587
|
signedCommitTxHex: d.signedTxHex,
|
|
@@ -66632,8 +66595,7 @@ async function assembleReclaimCommitAndReveal(t, e, r, A, s, n, o, a) {
|
|
|
66632
66595
|
}
|
|
66633
66596
|
async function mintWithReclaimsAll(t, e, r, A, s, n) {
|
|
66634
66597
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
66635
|
-
if (!o || !a)
|
|
66636
|
-
throw new Error("Wallets not found");
|
|
66598
|
+
if (!o || !a) throw new Error("Wallets not found");
|
|
66637
66599
|
const u = new WalletInfo(
|
|
66638
66600
|
!1,
|
|
66639
66601
|
null,
|
|
@@ -66662,8 +66624,7 @@ async function mintWithReclaimsAll(t, e, r, A, s, n) {
|
|
|
66662
66624
|
}
|
|
66663
66625
|
async function mintWithReclaimsCheckFees(t, e, r, A) {
|
|
66664
66626
|
const s = getPaymentWallet(), n = getOrdinalsWallet();
|
|
66665
|
-
if (!s || !n)
|
|
66666
|
-
throw new Error("Wallets not found");
|
|
66627
|
+
if (!s || !n) throw new Error("Wallets not found");
|
|
66667
66628
|
const o = new WalletInfo(
|
|
66668
66629
|
!1,
|
|
66669
66630
|
null,
|
|
@@ -66781,10 +66742,8 @@ async function buildCommitTxMultiple(t, e, r, A, s, n, o, a) {
|
|
|
66781
66742
|
}
|
|
66782
66743
|
async function buildCommitTxWithParent(t, e, r, A, s, n, o) {
|
|
66783
66744
|
const a = t, u = convertInscriptionIdToBuffer(o);
|
|
66784
|
-
if (!t.addr)
|
|
66785
|
-
|
|
66786
|
-
if (!e.addr)
|
|
66787
|
-
throw new Error("Inscription wallet address is not set.");
|
|
66745
|
+
if (!t.addr) throw new Error("Payer wallet address is not set.");
|
|
66746
|
+
if (!e.addr) throw new Error("Inscription wallet address is not set.");
|
|
66788
66747
|
const g = await getOrdinalUtxos(e.addr);
|
|
66789
66748
|
let c = null;
|
|
66790
66749
|
for (const $ of g) {
|
|
@@ -66793,11 +66752,9 @@ async function buildCommitTxWithParent(t, e, r, A, s, n, o) {
|
|
|
66793
66752
|
c = $;
|
|
66794
66753
|
break;
|
|
66795
66754
|
}
|
|
66796
|
-
if (c)
|
|
66797
|
-
break;
|
|
66755
|
+
if (c) break;
|
|
66798
66756
|
}
|
|
66799
|
-
if (!c)
|
|
66800
|
-
throw new Error("Parent inscription utxo not found in ordinal utxos");
|
|
66757
|
+
if (!c) throw new Error("Parent inscription utxo not found in ordinal utxos");
|
|
66801
66758
|
const d = await getCardinalUtxos(t.addr), h = get_seckey(r), I = get_pubkey(h, !0), B = buildRevealScript(I, A, u), l = Tap.encodeScript(B), [C] = Tap.getPubKey(I, { target: l }), p = getBitcoinNetwork(), Q = srcExports.payments.p2tr({
|
|
66802
66759
|
pubkey: Buffer$1.from(C, "hex"),
|
|
66803
66760
|
network: p
|
|
@@ -66845,8 +66802,7 @@ function buildTransactionMultiOutput(t, e, r, A, s, n, o) {
|
|
|
66845
66802
|
for (; d < c + h; ) {
|
|
66846
66803
|
let Q = c + h - d;
|
|
66847
66804
|
for (; Q > 0; ) {
|
|
66848
|
-
if (a.length === 0)
|
|
66849
|
-
throw new Error("Not enough funds");
|
|
66805
|
+
if (a.length === 0) throw new Error("Not enough funds");
|
|
66850
66806
|
const v = a[a.length - 1], R = Q + calculateAdditionalFee(v.script_type, o);
|
|
66851
66807
|
if (v.value >= R) {
|
|
66852
66808
|
for (const M of a.filter((F) => F.value > 1e4)) {
|
|
@@ -66905,8 +66861,7 @@ function buildTransactionMultiOutput(t, e, r, A, s, n, o) {
|
|
|
66905
66861
|
}
|
|
66906
66862
|
async function sendInscriptionAll(t, e, r, A, s, n) {
|
|
66907
66863
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
66908
|
-
if (!o || !a)
|
|
66909
|
-
throw new Error("Wallets not found");
|
|
66864
|
+
if (!o || !a) throw new Error("Wallets not found");
|
|
66910
66865
|
const u = o.address, g = o.pubkey, c = a.address, d = a.pubkey, h = new WalletInfo(!1, null, u, null, g), I = new WalletInfo(
|
|
66911
66866
|
!1,
|
|
66912
66867
|
null,
|
|
@@ -66914,15 +66869,13 @@ async function sendInscriptionAll(t, e, r, A, s, n) {
|
|
|
66914
66869
|
null,
|
|
66915
66870
|
d
|
|
66916
66871
|
);
|
|
66917
|
-
if (!I.addr)
|
|
66918
|
-
throw new Error("inscription_wallet is null");
|
|
66872
|
+
if (!I.addr) throw new Error("inscription_wallet is null");
|
|
66919
66873
|
const B = await getInscriptionDetails(t, I.addr);
|
|
66920
66874
|
if (B == null)
|
|
66921
66875
|
throw new Error("Inscription cannot be found in wallet");
|
|
66922
66876
|
if (B.satpoint.split(":")[2] !== "0")
|
|
66923
66877
|
throw new Error("Inscription is at the first sat of utxo");
|
|
66924
|
-
if (!h.addr)
|
|
66925
|
-
throw new Error("payer_wallet.addr is null");
|
|
66878
|
+
if (!h.addr) throw new Error("payer_wallet.addr is null");
|
|
66926
66879
|
const l = await getCardinalUtxos(h.addr);
|
|
66927
66880
|
(r == null || r <= 0) && (r = getDustValue(e));
|
|
66928
66881
|
const C = {
|
|
@@ -66986,8 +66939,7 @@ async function buildRevealTx(t, e, r, A, s, n, o, a, u, g = 0) {
|
|
|
66986
66939
|
}
|
|
66987
66940
|
];
|
|
66988
66941
|
if (u > 0) {
|
|
66989
|
-
if (!a)
|
|
66990
|
-
throw new Error("Payment wallet is not available.");
|
|
66942
|
+
if (!a) throw new Error("Payment wallet is not available.");
|
|
66991
66943
|
p.push({
|
|
66992
66944
|
value: u,
|
|
66993
66945
|
scriptPubKey: a.outputScript
|
|
@@ -67011,8 +66963,7 @@ async function buildRevealTx(t, e, r, A, s, n, o, a, u, g = 0) {
|
|
|
67011
66963
|
],
|
|
67012
66964
|
vout: p
|
|
67013
66965
|
}), v = Signer$1.taproot.sign(c, Q, 0, { extension: I });
|
|
67014
|
-
if (Q.vin[0].witness = [v, h, l], !Signer$1.taproot.verify(Q, 0, { pubkey: d, throws: !0 }))
|
|
67015
|
-
throw new Error("Invalid signature");
|
|
66966
|
+
if (Q.vin[0].witness = [v, h, l], !Signer$1.taproot.verify(Q, 0, { pubkey: d, throws: !0 })) throw new Error("Invalid signature");
|
|
67016
66967
|
return {
|
|
67017
66968
|
txId: Tx.util.getTxid(Q),
|
|
67018
66969
|
signedTxHex: Tx.encode(Q).hex
|
|
@@ -67021,10 +66972,8 @@ async function buildRevealTx(t, e, r, A, s, n, o, a, u, g = 0) {
|
|
|
67021
66972
|
async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
67022
66973
|
(g == null || g < 0) && (g = 0);
|
|
67023
66974
|
const c = t, d = convertInscriptionIdToBuffer(o);
|
|
67024
|
-
if (!e.addr)
|
|
67025
|
-
|
|
67026
|
-
if (!t.addr)
|
|
67027
|
-
throw new Error("Payer wallet address is not set.");
|
|
66975
|
+
if (!e.addr) throw new Error("Inscription wallet address is not set.");
|
|
66976
|
+
if (!t.addr) throw new Error("Payer wallet address is not set.");
|
|
67028
66977
|
const h = await getOrdinalUtxos(e.addr);
|
|
67029
66978
|
let I = null;
|
|
67030
66979
|
for (const Y of h) {
|
|
@@ -67033,11 +66982,9 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67033
66982
|
I = Y;
|
|
67034
66983
|
break;
|
|
67035
66984
|
}
|
|
67036
|
-
if (I)
|
|
67037
|
-
break;
|
|
66985
|
+
if (I) break;
|
|
67038
66986
|
}
|
|
67039
|
-
if (!I)
|
|
67040
|
-
throw new Error("Parent inscription utxo not found in ordinal utxos");
|
|
66987
|
+
if (!I) throw new Error("Parent inscription utxo not found in ordinal utxos");
|
|
67041
66988
|
const B = await getCardinalUtxos(t.addr), l = get_seckey(s), C = get_pubkey(l, !0), p = buildRevealScript(C, n, d), Q = Buffer$1.from(Script.encode(p, !1)), v = Tap.encodeScript(p), [R, M] = Tap.getPubKey(C, { target: v }), F = {
|
|
67042
66989
|
leafVersion: 192,
|
|
67043
66990
|
script: Q,
|
|
@@ -67082,8 +67029,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67082
67029
|
}
|
|
67083
67030
|
];
|
|
67084
67031
|
if (g > 0) {
|
|
67085
|
-
if (!u)
|
|
67086
|
-
throw new Error("Payment wallet is not available.");
|
|
67032
|
+
if (!u) throw new Error("Payment wallet is not available.");
|
|
67087
67033
|
w.push({
|
|
67088
67034
|
out_script: u.outputScript,
|
|
67089
67035
|
value: g
|
|
@@ -67093,8 +67039,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67093
67039
|
for (; y < m; ) {
|
|
67094
67040
|
let Y = m - y;
|
|
67095
67041
|
for (; Y > 0; ) {
|
|
67096
|
-
if (J.length === 0)
|
|
67097
|
-
throw new Error("Not enough funds");
|
|
67042
|
+
if (J.length === 0) throw new Error("Not enough funds");
|
|
67098
67043
|
if (J[J.length - 1].value >= Y + calculateAdditionalFee(J[J.length - 1].script_type, a)) {
|
|
67099
67044
|
for (const V of J.filter((Ae) => Ae.value > 1e4))
|
|
67100
67045
|
if (V.value >= Y + calculateAdditionalFee(V.script_type, a)) {
|
|
@@ -67117,8 +67062,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67117
67062
|
}
|
|
67118
67063
|
m = estimateFee(K, w, a);
|
|
67119
67064
|
}
|
|
67120
|
-
if (!c.outputScript)
|
|
67121
|
-
throw new Error("Change wallet output script is not set.");
|
|
67065
|
+
if (!c.outputScript) throw new Error("Change wallet output script is not set.");
|
|
67122
67066
|
const E = Math.ceil(c.outputScript.length + 9) * a, S = getDustValue(c), _ = y - m;
|
|
67123
67067
|
if (_ > S + E) {
|
|
67124
67068
|
const Y = _ - E;
|
|
@@ -67159,10 +67103,8 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67159
67103
|
}
|
|
67160
67104
|
];
|
|
67161
67105
|
if (g > 0) {
|
|
67162
|
-
if (!u)
|
|
67163
|
-
|
|
67164
|
-
if (!u.outputScript)
|
|
67165
|
-
throw new Error("Payment wallet output script is not set.");
|
|
67106
|
+
if (!u) throw new Error("Payment wallet is not available.");
|
|
67107
|
+
if (!u.outputScript) throw new Error("Payment wallet output script is not set.");
|
|
67166
67108
|
D.push({
|
|
67167
67109
|
value: g,
|
|
67168
67110
|
scriptPubKey: u.outputScript
|
|
@@ -67170,8 +67112,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67170
67112
|
}
|
|
67171
67113
|
for (let Y = b.length; Y < K.length; Y++) {
|
|
67172
67114
|
const V = K[Y], Ae = V.utxo, ue = Ae.utxo.split(":")[0], re = Number.parseInt(Ae.utxo.split(":")[1]), X = V.wallet;
|
|
67173
|
-
if (!X.outputScript)
|
|
67174
|
-
throw new Error("Input wallet output script is not set.");
|
|
67115
|
+
if (!X.outputScript) throw new Error("Input wallet output script is not set.");
|
|
67175
67116
|
b.push({
|
|
67176
67117
|
txid: ue,
|
|
67177
67118
|
vout: re,
|
|
@@ -67183,8 +67124,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67183
67124
|
}
|
|
67184
67125
|
for (let Y = D.length; Y < w.length; Y++) {
|
|
67185
67126
|
const V = w[Y], Ae = V.out_script, ue = V.value;
|
|
67186
|
-
if (!Ae)
|
|
67187
|
-
throw new Error("Output script is not set.");
|
|
67127
|
+
if (!Ae) throw new Error("Output script is not set.");
|
|
67188
67128
|
D.push({
|
|
67189
67129
|
value: ue,
|
|
67190
67130
|
scriptPubKey: Ae
|
|
@@ -67194,8 +67134,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67194
67134
|
vin: b,
|
|
67195
67135
|
vout: D
|
|
67196
67136
|
}), k = Signer$1.taproot.sign(l, x, 0, { extension: v });
|
|
67197
|
-
if (x.vin[0].witness = [k, p, M], !Signer$1.taproot.verify(x, 0, { pubkey: C, throws: !0 }))
|
|
67198
|
-
throw new Error("Invalid signature");
|
|
67137
|
+
if (x.vin[0].witness = [k, p, M], !Signer$1.taproot.verify(x, 0, { pubkey: C, throws: !0 })) throw new Error("Invalid signature");
|
|
67199
67138
|
const O = {
|
|
67200
67139
|
ins: [],
|
|
67201
67140
|
outs: []
|
|
@@ -67241,8 +67180,7 @@ async function buildRevealTxWithParent(t, e, r, A, s, n, o, a, u, g) {
|
|
|
67241
67180
|
}
|
|
67242
67181
|
async function mintAll(t, e, r, A, s, n, o) {
|
|
67243
67182
|
const a = getPaymentWallet(), u = getOrdinalsWallet();
|
|
67244
|
-
if (!a || !u)
|
|
67245
|
-
throw new Error("Wallets not found");
|
|
67183
|
+
if (!a || !u) throw new Error("Wallets not found");
|
|
67246
67184
|
const g = a.address, c = a.pubkey, d = u.address, h = u.pubkey, I = new WalletInfo(!1, null, g, null, c), B = new WalletInfo(
|
|
67247
67185
|
!1,
|
|
67248
67186
|
null,
|
|
@@ -67295,8 +67233,7 @@ async function mintAll(t, e, r, A, s, n, o) {
|
|
|
67295
67233
|
}
|
|
67296
67234
|
async function mintAllPaymentWallet(t, e, r, A, s, n, o) {
|
|
67297
67235
|
const a = getPaymentWallet(), u = getOrdinalsWallet();
|
|
67298
|
-
if (!a || !u)
|
|
67299
|
-
throw new Error("Wallets not found");
|
|
67236
|
+
if (!a || !u) throw new Error("Wallets not found");
|
|
67300
67237
|
const g = a.address, c = a.pubkey, d = u.address, h = new WalletInfo(!1, null, g, null, c);
|
|
67301
67238
|
let I = null;
|
|
67302
67239
|
A != null && (I = new WalletInfo(!1, null, A, null, null)), (r == null || r <= 0) && (r = getDustValue(h));
|
|
@@ -67327,7 +67264,9 @@ async function mintAllPaymentWallet(t, e, r, A, s, n, o) {
|
|
|
67327
67264
|
s
|
|
67328
67265
|
), v = await validateTxes([C.signedTxHex, Q.signedTxHex]);
|
|
67329
67266
|
if (v == null)
|
|
67330
|
-
throw new Error(
|
|
67267
|
+
throw new Error(
|
|
67268
|
+
"Payment-wallet mint commit/reveal validation failed (testmempoolaccept request failed)"
|
|
67269
|
+
);
|
|
67331
67270
|
for (const R of v)
|
|
67332
67271
|
if (!R.allowed)
|
|
67333
67272
|
throw new Error(R["reject-reason"]);
|
|
@@ -67343,8 +67282,7 @@ async function mintAllPaymentWallet(t, e, r, A, s, n, o) {
|
|
|
67343
67282
|
}
|
|
67344
67283
|
async function mintAllCheckFees(t, e, r, A, s) {
|
|
67345
67284
|
const n = getPaymentWallet(), o = getOrdinalsWallet();
|
|
67346
|
-
if (!n || !o)
|
|
67347
|
-
throw new Error("Wallets not found");
|
|
67285
|
+
if (!n || !o) throw new Error("Wallets not found");
|
|
67348
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(
|
|
67349
67287
|
!1,
|
|
67350
67288
|
null,
|
|
@@ -67387,8 +67325,7 @@ async function mintAllCheckFees(t, e, r, A, s) {
|
|
|
67387
67325
|
}
|
|
67388
67326
|
async function sendInscriptionToOpReturnAll(t, e, r, A, s, n) {
|
|
67389
67327
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
67390
|
-
if (!o || !a)
|
|
67391
|
-
throw new Error("Wallets not found");
|
|
67328
|
+
if (!o || !a) throw new Error("Wallets not found");
|
|
67392
67329
|
(r == null || r <= 0) && (r = 1);
|
|
67393
67330
|
const u = o.address, g = o.pubkey, c = a.address, d = a.pubkey, h = new WalletInfo(!1, null, u, null, g), I = new WalletInfo(
|
|
67394
67331
|
!1,
|
|
@@ -67397,15 +67334,13 @@ async function sendInscriptionToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67397
67334
|
null,
|
|
67398
67335
|
d
|
|
67399
67336
|
);
|
|
67400
|
-
if (!I.addr)
|
|
67401
|
-
throw new Error("Inscription wallet address is not set.");
|
|
67337
|
+
if (!I.addr) throw new Error("Inscription wallet address is not set.");
|
|
67402
67338
|
const B = await getInscriptionDetails(t, I.addr);
|
|
67403
67339
|
if (B == null)
|
|
67404
67340
|
throw new Error("Inscription cannot be found in wallet");
|
|
67405
67341
|
if (B.satpoint.split(":")[2] !== "0")
|
|
67406
67342
|
throw new Error("Inscription is at the first sat of utxo");
|
|
67407
|
-
if (!h.addr)
|
|
67408
|
-
throw new Error("Payer wallet address is not set.");
|
|
67343
|
+
if (!h.addr) throw new Error("Payer wallet address is not set.");
|
|
67409
67344
|
const l = await getCardinalUtxos(h.addr);
|
|
67410
67345
|
(r <= 0 || r == null) && (r = 1);
|
|
67411
67346
|
const C = {
|
|
@@ -67424,7 +67359,9 @@ async function sendInscriptionToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67424
67359
|
r
|
|
67425
67360
|
).tx, R = (await buildPsbtFromTx(Q, l, h, [C])).toHex(), M = await n(R, h.addr, I.addr, [0]), F = await validateTxes([M.signedTxHex]);
|
|
67426
67361
|
if (F == null)
|
|
67427
|
-
throw new Error(
|
|
67362
|
+
throw new Error(
|
|
67363
|
+
"OP_RETURN inscription send validation failed (testmempoolaccept request failed)"
|
|
67364
|
+
);
|
|
67428
67365
|
for (const P of F)
|
|
67429
67366
|
if (!P.allowed)
|
|
67430
67367
|
throw new Error(P["reject-reason"]);
|
|
@@ -67442,21 +67379,17 @@ async function sendInscriptionToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67442
67379
|
}
|
|
67443
67380
|
async function sendInscriptionInPaymentWalletToOpReturnAll(t, e, r, A, s, n) {
|
|
67444
67381
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
67445
|
-
if (!o || !a)
|
|
67446
|
-
throw new Error("Wallets not found");
|
|
67382
|
+
if (!o || !a) throw new Error("Wallets not found");
|
|
67447
67383
|
(r == null || r <= 0) && (r = 1);
|
|
67448
67384
|
const u = o.address, g = o.pubkey, c = a.address, d = a.pubkey, h = new WalletInfo(!1, null, u, null, g), I = new WalletInfo(!1, null, c, null, d);
|
|
67449
|
-
if (!h.addr)
|
|
67450
|
-
|
|
67451
|
-
if (!I.addr)
|
|
67452
|
-
throw new Error("Inscription wallet address is not set.");
|
|
67385
|
+
if (!h.addr) throw new Error("Payment wallet address is not set.");
|
|
67386
|
+
if (!I.addr) throw new Error("Inscription wallet address is not set.");
|
|
67453
67387
|
const B = await getInscriptionDetails(t, h.addr);
|
|
67454
67388
|
if (B == null)
|
|
67455
67389
|
throw new Error("Inscription cannot be found in wallet");
|
|
67456
67390
|
if (B.satpoint.split(":")[2] !== "0")
|
|
67457
67391
|
throw new Error("Inscription is at the first sat of utxo");
|
|
67458
|
-
if (!h.addr)
|
|
67459
|
-
throw new Error("Payer wallet address is not set.");
|
|
67392
|
+
if (!h.addr) throw new Error("Payer wallet address is not set.");
|
|
67460
67393
|
const l = await getCardinalUtxos(h.addr);
|
|
67461
67394
|
(r <= 0 || r == null) && (r = 1);
|
|
67462
67395
|
const C = {
|
|
@@ -67475,7 +67408,9 @@ async function sendInscriptionInPaymentWalletToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67475
67408
|
r
|
|
67476
67409
|
).tx, R = (await buildPsbtFromTx(Q, l, h, [C])).toHex(), M = await n(R, h.addr, I.addr, []), F = await validateTxes([M.signedTxHex]);
|
|
67477
67410
|
if (F == null)
|
|
67478
|
-
throw new Error(
|
|
67411
|
+
throw new Error(
|
|
67412
|
+
"Payment-wallet OP_RETURN inscription send validation failed (testmempoolaccept request failed)"
|
|
67413
|
+
);
|
|
67479
67414
|
for (const P of F)
|
|
67480
67415
|
if (!P.allowed)
|
|
67481
67416
|
throw new Error(P["reject-reason"]);
|
|
@@ -67493,8 +67428,7 @@ async function sendInscriptionInPaymentWalletToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67493
67428
|
}
|
|
67494
67429
|
async function mintWithParentAll(t, e, r, A, s, n, o, a) {
|
|
67495
67430
|
const u = getPaymentWallet(), g = getOrdinalsWallet();
|
|
67496
|
-
if (!u || !g)
|
|
67497
|
-
throw new Error("Wallets not found");
|
|
67431
|
+
if (!u || !g) throw new Error("Wallets not found");
|
|
67498
67432
|
const c = u.address, d = u.pubkey, h = g.address, I = g.pubkey, B = new WalletInfo(!1, null, c, null, d), l = new WalletInfo(
|
|
67499
67433
|
!1,
|
|
67500
67434
|
null,
|
|
@@ -67549,7 +67483,9 @@ async function mintWithParentAll(t, e, r, A, s, n, o, a) {
|
|
|
67549
67483
|
}
|
|
67550
67484
|
const F = await validateTxes([v.signedTxHex, M.signedTxHex]);
|
|
67551
67485
|
if (F == null)
|
|
67552
|
-
throw new Error(
|
|
67486
|
+
throw new Error(
|
|
67487
|
+
"Mint-with-parent commit/reveal validation failed (testmempoolaccept request failed)"
|
|
67488
|
+
);
|
|
67553
67489
|
for (const P of F)
|
|
67554
67490
|
if (!P.allowed)
|
|
67555
67491
|
throw new Error(P["reject-reason"]);
|
|
@@ -67573,8 +67509,7 @@ async function mintWithParentAll(t, e, r, A, s, n, o, a) {
|
|
|
67573
67509
|
}
|
|
67574
67510
|
async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll(t, e, r, A, s, n, o, a) {
|
|
67575
67511
|
const u = getPaymentWallet(), g = getOrdinalsWallet();
|
|
67576
|
-
if (!u || !g)
|
|
67577
|
-
throw new Error("Wallets not found");
|
|
67512
|
+
if (!u || !g) throw new Error("Wallets not found");
|
|
67578
67513
|
const c = u.address, d = u.pubkey, h = g.address, I = g.pubkey, B = new WalletInfo(!1, null, c, null, d), l = new WalletInfo(
|
|
67579
67514
|
!1,
|
|
67580
67515
|
null,
|
|
@@ -67582,15 +67517,13 @@ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll(t, e, r
|
|
|
67582
67517
|
null,
|
|
67583
67518
|
I
|
|
67584
67519
|
);
|
|
67585
|
-
if (!l.addr)
|
|
67586
|
-
throw new Error("Inscription wallet address is not set.");
|
|
67520
|
+
if (!l.addr) throw new Error("Inscription wallet address is not set.");
|
|
67587
67521
|
const C = await getInscriptionDetails(t, l.addr);
|
|
67588
67522
|
if (C == null)
|
|
67589
67523
|
throw new Error("Inscription cannot be found in wallet");
|
|
67590
67524
|
if (C.satpoint.split(":")[2] !== "0")
|
|
67591
67525
|
throw new Error("Inscription is not at the first sat of utxo");
|
|
67592
|
-
if (!B.addr)
|
|
67593
|
-
throw new Error("Payer wallet address is not set.");
|
|
67526
|
+
if (!B.addr) throw new Error("Payer wallet address is not set.");
|
|
67594
67527
|
const p = await getCardinalUtxos(B.addr), v = [{
|
|
67595
67528
|
utxo: `${C.satpoint.split(":")[0]}:${C.satpoint.split(":")[1]}`,
|
|
67596
67529
|
value: C.value,
|
|
@@ -67612,7 +67545,9 @@ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll(t, e, r
|
|
|
67612
67545
|
n
|
|
67613
67546
|
).tx, H = (await buildPsbtFromTx(P, p, B, v)).toHex(), J = await a(H, B.addr, l.addr, [0]), K = await validateTxes([J.signedTxHex]);
|
|
67614
67547
|
if (K == null)
|
|
67615
|
-
throw new Error(
|
|
67548
|
+
throw new Error(
|
|
67549
|
+
"OP_RETURN inscription send with extra inputs/output validation failed (testmempoolaccept request failed)"
|
|
67550
|
+
);
|
|
67616
67551
|
for (const w of K)
|
|
67617
67552
|
if (!w.allowed)
|
|
67618
67553
|
throw new Error(w["reject-reason"]);
|
|
@@ -67623,8 +67558,7 @@ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll(t, e, r
|
|
|
67623
67558
|
}
|
|
67624
67559
|
async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(t, e, r, A, s, n) {
|
|
67625
67560
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
67626
|
-
if (!o || !a)
|
|
67627
|
-
throw new Error("Wallets not found");
|
|
67561
|
+
if (!o || !a) throw new Error("Wallets not found");
|
|
67628
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(
|
|
67629
67563
|
!1,
|
|
67630
67564
|
null,
|
|
@@ -67632,15 +67566,13 @@ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(t,
|
|
|
67632
67566
|
null,
|
|
67633
67567
|
d
|
|
67634
67568
|
);
|
|
67635
|
-
if (!I.addr)
|
|
67636
|
-
throw new Error("Inscription wallet address is not set.");
|
|
67569
|
+
if (!I.addr) throw new Error("Inscription wallet address is not set.");
|
|
67637
67570
|
const B = await getInscriptionDetails(t, I.addr);
|
|
67638
67571
|
if (B == null)
|
|
67639
67572
|
throw new Error("Inscription cannot be found in wallet");
|
|
67640
67573
|
if (B.satpoint.split(":")[2] !== "0")
|
|
67641
67574
|
throw new Error("Inscription is not at the first sat of utxo");
|
|
67642
|
-
if (!h.addr)
|
|
67643
|
-
throw new Error("Payer wallet address is not set.");
|
|
67575
|
+
if (!h.addr) throw new Error("Payer wallet address is not set.");
|
|
67644
67576
|
const l = await getCardinalUtxos(h.addr), p = [{
|
|
67645
67577
|
utxo: `${B.satpoint.split(":")[0]}:${B.satpoint.split(":")[1]}`,
|
|
67646
67578
|
value: B.value,
|
|
@@ -67669,8 +67601,7 @@ async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(t,
|
|
|
67669
67601
|
}
|
|
67670
67602
|
async function mintWithExtraInputInCommitAll(t, e, r, A, s, n, o, a) {
|
|
67671
67603
|
const u = getPaymentWallet(), g = getOrdinalsWallet();
|
|
67672
|
-
if (!u || !g)
|
|
67673
|
-
throw new Error("Wallets not found");
|
|
67604
|
+
if (!u || !g) throw new Error("Wallets not found");
|
|
67674
67605
|
const c = u.address, d = u.pubkey, h = g.address, I = g.pubkey, B = new WalletInfo(!1, null, c, null, d), l = new WalletInfo(
|
|
67675
67606
|
!1,
|
|
67676
67607
|
null,
|
|
@@ -67707,7 +67638,9 @@ async function mintWithExtraInputInCommitAll(t, e, r, A, s, n, o, a) {
|
|
|
67707
67638
|
n
|
|
67708
67639
|
), F = await validateTxes([v.signedTxHex, M.signedTxHex]);
|
|
67709
67640
|
if (F == null)
|
|
67710
|
-
throw new Error(
|
|
67641
|
+
throw new Error(
|
|
67642
|
+
"Mint with extra commit input validation failed (testmempoolaccept request failed)"
|
|
67643
|
+
);
|
|
67711
67644
|
for (const P of F)
|
|
67712
67645
|
if (!P.allowed)
|
|
67713
67646
|
throw new Error(P["reject-reason"]);
|
|
@@ -67723,8 +67656,7 @@ async function mintWithExtraInputInCommitAll(t, e, r, A, s, n, o, a) {
|
|
|
67723
67656
|
}
|
|
67724
67657
|
async function mintWithExtraInputInCommitFeeRate(t, e, r, A, s, n) {
|
|
67725
67658
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
67726
|
-
if (!o || !a)
|
|
67727
|
-
throw new Error("Wallets not found");
|
|
67659
|
+
if (!o || !a) throw new Error("Wallets not found");
|
|
67728
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(
|
|
67729
67661
|
!1,
|
|
67730
67662
|
null,
|