@bestinslot/wallet-kit 0.15.0-rc.8 → 0.15.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/dist/balances-vRSi3fDl.js +13479 -0
- package/dist/browser.js +5 -5
- package/dist/core.js +5 -5
- package/dist/{helpers-DPIq8Luz.js → helpers-DhmRTIg0.js} +313 -185
- package/dist/node.js +4 -4
- package/dist/react.js +1 -1
- package/dist/{register-browser-providers-Cgt7ptMx.js → register-browser-providers-tIzKBBB3.js} +1 -1
- package/dist/types/api/brc20.d.ts +61 -7
- package/dist/types/core/brc20-send.d.ts +4 -2
- package/dist/types/core/brc20-transact.d.ts +58 -0
- package/dist/types/core/brc20.d.ts +8 -12
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/dist/balances-CZOB6nhC.js +0 -10466
|
@@ -65817,15 +65817,19 @@ async function mintMultipleAll(t, e, r, A, s, n, o) {
|
|
|
65817
65817
|
const F = [];
|
|
65818
65818
|
for (let P = 0; P < t.length; P++)
|
|
65819
65819
|
F.push(`${R.txid}i${P}`);
|
|
65820
|
-
|
|
65821
|
-
|
|
65822
|
-
|
|
65823
|
-
|
|
65824
|
-
|
|
65825
|
-
|
|
65826
|
-
|
|
65827
|
-
|
|
65828
|
-
|
|
65820
|
+
if (n)
|
|
65821
|
+
return {
|
|
65822
|
+
commitTxId: Q.txId,
|
|
65823
|
+
signedCommitTxHex: Q.signedTxHex,
|
|
65824
|
+
revealTxId: R.txid,
|
|
65825
|
+
signedRevealTxHex: R.signed_reveal_tx_hex,
|
|
65826
|
+
inscriptionIds: F,
|
|
65827
|
+
postage: r,
|
|
65828
|
+
secret: C
|
|
65829
|
+
};
|
|
65830
|
+
if (await broadcastTxes([Q.signedTxHex, R.signed_reveal_tx_hex]) == null)
|
|
65831
|
+
throw new Error("Broadcast request failed");
|
|
65832
|
+
return {
|
|
65829
65833
|
commitTxId: Q.txId,
|
|
65830
65834
|
signedCommitTxHex: Q.signedTxHex,
|
|
65831
65835
|
revealTxId: R.txid,
|
|
@@ -65833,7 +65837,7 @@ async function mintMultipleAll(t, e, r, A, s, n, o) {
|
|
|
65833
65837
|
inscriptionIds: F,
|
|
65834
65838
|
postage: r,
|
|
65835
65839
|
secret: C
|
|
65836
|
-
}
|
|
65840
|
+
};
|
|
65837
65841
|
}
|
|
65838
65842
|
function constructTxFromInOuts(t, e) {
|
|
65839
65843
|
const r = new srcExports.Transaction();
|
|
@@ -66954,17 +66958,21 @@ async function sendInscriptionAll(t, e, r, A, s, n) {
|
|
|
66954
66958
|
for (const P of F)
|
|
66955
66959
|
if (!P.allowed)
|
|
66956
66960
|
throw new Error(P["reject-reason"]);
|
|
66957
|
-
|
|
66958
|
-
txId
|
|
66959
|
-
|
|
66960
|
-
|
|
66961
|
-
|
|
66962
|
-
|
|
66961
|
+
if (s)
|
|
66962
|
+
return txHexByIdCache[M.txId] = M.signedTxHex, {
|
|
66963
|
+
txId: M.txId,
|
|
66964
|
+
signedTxHex: M.signedTxHex,
|
|
66965
|
+
vout: 0,
|
|
66966
|
+
outputValue: Q.outs[0].value
|
|
66967
|
+
};
|
|
66968
|
+
if (await broadcastTxes([M.signedTxHex]) == null)
|
|
66969
|
+
throw new Error("Broadcast request failed");
|
|
66970
|
+
return {
|
|
66963
66971
|
txId: M.txId,
|
|
66964
66972
|
signedTxHex: M.signedTxHex,
|
|
66965
66973
|
vout: 0,
|
|
66966
66974
|
outputValue: Q.outs[0].value
|
|
66967
|
-
}
|
|
66975
|
+
};
|
|
66968
66976
|
}
|
|
66969
66977
|
async function getInscriptionDetails(t, e, r) {
|
|
66970
66978
|
const A = await getInscriptionUtxo(e, t);
|
|
@@ -67420,17 +67428,21 @@ async function sendInscriptionToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67420
67428
|
for (const P of F)
|
|
67421
67429
|
if (!P.allowed)
|
|
67422
67430
|
throw new Error(P["reject-reason"]);
|
|
67423
|
-
|
|
67424
|
-
|
|
67425
|
-
|
|
67426
|
-
|
|
67427
|
-
|
|
67428
|
-
|
|
67431
|
+
if (s)
|
|
67432
|
+
return {
|
|
67433
|
+
txId: M.txId,
|
|
67434
|
+
signedTxHex: M.signedTxHex,
|
|
67435
|
+
vout: 0,
|
|
67436
|
+
outputValue: r
|
|
67437
|
+
};
|
|
67438
|
+
if (await broadcastTxes([M.signedTxHex]) == null)
|
|
67439
|
+
throw new Error("Broadcast request failed");
|
|
67440
|
+
return {
|
|
67429
67441
|
txId: M.txId,
|
|
67430
67442
|
signedTxHex: M.signedTxHex,
|
|
67431
67443
|
vout: 0,
|
|
67432
67444
|
outputValue: r
|
|
67433
|
-
}
|
|
67445
|
+
};
|
|
67434
67446
|
}
|
|
67435
67447
|
async function sendInscriptionInPaymentWalletToOpReturnAll(t, e, r, A, s, n) {
|
|
67436
67448
|
const o = getPaymentWallet(), a = getOrdinalsWallet();
|
|
@@ -67471,17 +67483,21 @@ async function sendInscriptionInPaymentWalletToOpReturnAll(t, e, r, A, s, n) {
|
|
|
67471
67483
|
for (const P of F)
|
|
67472
67484
|
if (!P.allowed)
|
|
67473
67485
|
throw new Error(P["reject-reason"]);
|
|
67474
|
-
|
|
67475
|
-
|
|
67476
|
-
|
|
67477
|
-
|
|
67478
|
-
|
|
67479
|
-
|
|
67486
|
+
if (s)
|
|
67487
|
+
return {
|
|
67488
|
+
txId: M.txId,
|
|
67489
|
+
signedTxHex: M.signedTxHex,
|
|
67490
|
+
vout: 0,
|
|
67491
|
+
outputValue: r
|
|
67492
|
+
};
|
|
67493
|
+
if (await broadcastTxes([M.signedTxHex]) == null)
|
|
67494
|
+
throw new Error("Broadcast request failed");
|
|
67495
|
+
return {
|
|
67480
67496
|
txId: M.txId,
|
|
67481
67497
|
signedTxHex: M.signedTxHex,
|
|
67482
67498
|
vout: 0,
|
|
67483
67499
|
outputValue: r
|
|
67484
|
-
}
|
|
67500
|
+
};
|
|
67485
67501
|
}
|
|
67486
67502
|
async function mintWithParentAll(t, e, r, A, s, n, o, a) {
|
|
67487
67503
|
const u = getPaymentWallet(), g = getOrdinalsWallet();
|
|
@@ -67547,15 +67563,19 @@ async function mintWithParentAll(t, e, r, A, s, n, o, a) {
|
|
|
67547
67563
|
for (const P of F)
|
|
67548
67564
|
if (!P.allowed)
|
|
67549
67565
|
throw new Error(P["reject-reason"]);
|
|
67550
|
-
|
|
67551
|
-
|
|
67552
|
-
|
|
67553
|
-
|
|
67554
|
-
|
|
67555
|
-
|
|
67556
|
-
|
|
67557
|
-
|
|
67558
|
-
|
|
67566
|
+
if (o)
|
|
67567
|
+
return {
|
|
67568
|
+
commitTxId: b.txId,
|
|
67569
|
+
signedCommitTxHex: b.signedTxHex,
|
|
67570
|
+
revealTxId: M.txId,
|
|
67571
|
+
signedRevealTxHex: M.signedTxHex,
|
|
67572
|
+
inscriptionId: `${M.txId}i0`,
|
|
67573
|
+
postage: A,
|
|
67574
|
+
secret: p
|
|
67575
|
+
};
|
|
67576
|
+
if (await broadcastTxes([b.signedTxHex, M.signedTxHex]) == null)
|
|
67577
|
+
throw new Error("Broadcast request failed");
|
|
67578
|
+
return {
|
|
67559
67579
|
commitTxId: b.txId,
|
|
67560
67580
|
signedCommitTxHex: b.signedTxHex,
|
|
67561
67581
|
revealTxId: M.txId,
|
|
@@ -67563,7 +67583,7 @@ async function mintWithParentAll(t, e, r, A, s, n, o, a) {
|
|
|
67563
67583
|
inscriptionId: `${M.txId}i0`,
|
|
67564
67584
|
postage: A,
|
|
67565
67585
|
secret: p
|
|
67566
|
-
}
|
|
67586
|
+
};
|
|
67567
67587
|
}
|
|
67568
67588
|
async function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll(t, e, r, A, s, n, o, a) {
|
|
67569
67589
|
const u = getPaymentWallet(), g = getOrdinalsWallet();
|
|
@@ -67765,6 +67785,12 @@ async function mintWithExtraInputInCommitFeeRate(t, e, r, A, s, n, o, a = 0) {
|
|
|
67765
67785
|
postage: A
|
|
67766
67786
|
};
|
|
67767
67787
|
}
|
|
67788
|
+
const GAS_PER_BYTE = 12e3;
|
|
67789
|
+
function padContentToGas(t, e) {
|
|
67790
|
+
if (t.length * GAS_PER_BYTE >= e) return t;
|
|
67791
|
+
const r = Math.ceil((e - t.length * GAS_PER_BYTE) / GAS_PER_BYTE);
|
|
67792
|
+
return t.append("20".repeat(r));
|
|
67793
|
+
}
|
|
67768
67794
|
async function compressSmartContractData(t) {
|
|
67769
67795
|
await init$2(), t.startsWith("0x") && (t = t.slice(2));
|
|
67770
67796
|
const e = Buff$3.hex(t).to_bytes(), r = compress(new Uint8Array(e), 22), A = r.length > 0 && r.every((d) => d === 0), s = [0, ...Array.from(e)], n = [1, ...nadaExports.encode(e)], o = [s, n];
|
|
@@ -67775,6 +67801,11 @@ async function compressSmartContractData(t) {
|
|
|
67775
67801
|
const a = o.reduce((d, h) => d.length <= h.length ? d : h), u = Uint8Array.from(a);
|
|
67776
67802
|
return encode(u.buffer).replace(/=+$/, "");
|
|
67777
67803
|
}
|
|
67804
|
+
function evmEncodeDeploy(t, e, r) {
|
|
67805
|
+
t.slice(0, 2) !== "0x" && (t = `0x${t}`);
|
|
67806
|
+
const A = getWeb3();
|
|
67807
|
+
return new A.eth.Contract(e).deploy({ data: t, arguments: r }).encodeABI();
|
|
67808
|
+
}
|
|
67778
67809
|
function evmEncodeFunctionCall(t, e, r) {
|
|
67779
67810
|
const A = getWeb3(), s = new A.eth.Contract(t);
|
|
67780
67811
|
if (typeof s.methods[e] != "function")
|
|
@@ -67789,46 +67820,137 @@ function getEvmAddressFromPkScript(t) {
|
|
|
67789
67820
|
const e = Buff$3.hex(t);
|
|
67790
67821
|
return `0x${getWeb3().utils.keccak256(e).slice(-40)}`;
|
|
67791
67822
|
}
|
|
67792
|
-
async function
|
|
67793
|
-
const
|
|
67794
|
-
if (!
|
|
67823
|
+
async function deploySmartContract(t, e, r, A, s, n, o) {
|
|
67824
|
+
const a = getWalletInfo();
|
|
67825
|
+
if (!a || !a.wallets) throw new Error("Wallets not found");
|
|
67826
|
+
if (typeof t != "string") throw new Error("input_hex must be a string");
|
|
67827
|
+
if (assertFeeRate(r), A != null && (typeof A != "number" || !Number.isInteger(A)))
|
|
67828
|
+
throw new Error("postage must be an integer or null");
|
|
67829
|
+
if (s != null && typeof s != "string")
|
|
67830
|
+
throw new Error("payment_addr must be a string");
|
|
67831
|
+
if (n != null && (typeof n != "number" || !Number.isInteger(n)))
|
|
67832
|
+
throw new Error("payment must be an integer");
|
|
67833
|
+
if (typeof o != "boolean") throw new Error("dry_run must be a boolean");
|
|
67834
|
+
const u = await compressSmartContractData(t);
|
|
67835
|
+
let g = Buff$3.str(`{"p":"brc20-prog","op":"d","b":"${u}"}`);
|
|
67836
|
+
g = padContentToGas(g, e);
|
|
67837
|
+
const c = new InscriptionDetails(
|
|
67838
|
+
Buff$3.str("text/plain"),
|
|
67839
|
+
null,
|
|
67840
|
+
null,
|
|
67841
|
+
null,
|
|
67842
|
+
null,
|
|
67843
|
+
g
|
|
67844
|
+
), d = getSignFn(a.provider), h = await mintAll(
|
|
67845
|
+
c,
|
|
67846
|
+
r,
|
|
67847
|
+
A,
|
|
67848
|
+
s,
|
|
67849
|
+
n,
|
|
67850
|
+
!0,
|
|
67851
|
+
d
|
|
67852
|
+
), I = h.inscription_id, B = `${I.split("i")[0]}:0:0`;
|
|
67853
|
+
let l = null;
|
|
67854
|
+
try {
|
|
67855
|
+
saveExtraUtxos([h.signed_commit_tx_hex, h.signed_reveal_tx_hex], [I, B]);
|
|
67856
|
+
const Q = new WalletInfo(
|
|
67857
|
+
!0,
|
|
67858
|
+
Buffer$1.from(Script.encode(["OP_RETURN", Buff$3.str("BRC20PROG")], !1)),
|
|
67859
|
+
null,
|
|
67860
|
+
null,
|
|
67861
|
+
null
|
|
67862
|
+
);
|
|
67863
|
+
l = await sendInscriptionToOpReturnAll(
|
|
67864
|
+
I,
|
|
67865
|
+
Q,
|
|
67866
|
+
1,
|
|
67867
|
+
r,
|
|
67868
|
+
!0,
|
|
67869
|
+
d
|
|
67870
|
+
);
|
|
67871
|
+
} finally {
|
|
67872
|
+
clearExtraUtxos();
|
|
67873
|
+
}
|
|
67874
|
+
if (l == null)
|
|
67875
|
+
throw new Error("Failed to send inscription to OP_RETURN");
|
|
67876
|
+
if (o)
|
|
67877
|
+
return {
|
|
67878
|
+
commitTxId: h.commit_txid,
|
|
67879
|
+
signedCommitTxHex: h.signed_commit_tx_hex,
|
|
67880
|
+
revealTxId: h.reveal_txid,
|
|
67881
|
+
signedRevealTxHex: h.signed_reveal_tx_hex,
|
|
67882
|
+
inscriptionId: h.inscription_id,
|
|
67883
|
+
postage: h.postage,
|
|
67884
|
+
secret: h.secret,
|
|
67885
|
+
sendToOpReturnTxId: l.txId,
|
|
67886
|
+
signedSendToOpReturnTxHex: l.signedTxHex
|
|
67887
|
+
};
|
|
67888
|
+
const C = [h.signed_commit_tx_hex, h.signed_reveal_tx_hex, l.signedTxHex];
|
|
67889
|
+
if (await broadcastTxes(C) == null) throw new Error("Broadcast request failed");
|
|
67890
|
+
return {
|
|
67891
|
+
commitTxId: h.commit_txid,
|
|
67892
|
+
signedCommitTxHex: h.signed_commit_tx_hex,
|
|
67893
|
+
revealTxId: h.reveal_txid,
|
|
67894
|
+
signedRevealTxHex: h.signed_reveal_tx_hex,
|
|
67895
|
+
inscriptionId: h.inscription_id,
|
|
67896
|
+
postage: h.postage,
|
|
67897
|
+
secret: h.secret,
|
|
67898
|
+
sendToOpReturnTxId: l.txId,
|
|
67899
|
+
signedSendToOpReturnTxHex: l.signedTxHex
|
|
67900
|
+
};
|
|
67901
|
+
}
|
|
67902
|
+
async function deploySmartContractAbi(t, e, r, A, s, n, o, a, u) {
|
|
67903
|
+
if (typeof e != "object") throw new Error("abi must be an object");
|
|
67904
|
+
if (typeof t != "string") throw new Error("bytecode must be a string");
|
|
67905
|
+
if (!Array.isArray(r)) throw new Error("params must be an array");
|
|
67906
|
+
const g = evmEncodeDeploy(t, e, r);
|
|
67907
|
+
return await deploySmartContract(
|
|
67908
|
+
g,
|
|
67909
|
+
A,
|
|
67910
|
+
s,
|
|
67911
|
+
n,
|
|
67912
|
+
o,
|
|
67913
|
+
a,
|
|
67914
|
+
u
|
|
67915
|
+
);
|
|
67916
|
+
}
|
|
67917
|
+
async function callSmartContract(t, e, r, A, s, n, o, a) {
|
|
67918
|
+
const u = getWalletInfo();
|
|
67919
|
+
if (!u || !u.wallets) throw new Error("Wallets not found");
|
|
67795
67920
|
if (typeof t != "string")
|
|
67796
67921
|
throw new Error("smart_contract_contract_addr must be a string");
|
|
67797
67922
|
if (typeof e != "string") throw new Error("input_hex must be a string");
|
|
67798
|
-
if (assertFeeRate(
|
|
67923
|
+
if (assertFeeRate(A), s != null && (typeof s != "number" || !Number.isInteger(s)))
|
|
67799
67924
|
throw new Error("postage must be an integer or null");
|
|
67800
|
-
if (
|
|
67925
|
+
if (n != null && typeof n != "string")
|
|
67801
67926
|
throw new Error("payment_addr must be a string");
|
|
67802
|
-
if (
|
|
67927
|
+
if (o != null && (typeof o != "number" || !Number.isInteger(o)))
|
|
67803
67928
|
throw new Error("payment must be an integer");
|
|
67804
|
-
if (typeof
|
|
67805
|
-
const
|
|
67806
|
-
let
|
|
67807
|
-
`{"p":"brc20-prog","op":"c","c":"${t}","b":"${
|
|
67929
|
+
if (typeof a != "boolean") throw new Error("dry_run must be a boolean");
|
|
67930
|
+
const g = await compressSmartContractData(e);
|
|
67931
|
+
let c = Buff$3.str(
|
|
67932
|
+
`{"p":"brc20-prog","op":"c","c":"${t}","b":"${g}"}`
|
|
67808
67933
|
);
|
|
67809
|
-
|
|
67810
|
-
|
|
67811
|
-
d = d.append(M);
|
|
67812
|
-
}
|
|
67813
|
-
const h = new InscriptionDetails(
|
|
67934
|
+
c = padContentToGas(c, r);
|
|
67935
|
+
const d = new InscriptionDetails(
|
|
67814
67936
|
Buff$3.str("text/plain"),
|
|
67815
67937
|
null,
|
|
67816
67938
|
null,
|
|
67817
67939
|
null,
|
|
67818
67940
|
null,
|
|
67819
|
-
|
|
67820
|
-
),
|
|
67821
|
-
|
|
67941
|
+
c
|
|
67942
|
+
), h = getSignFn(u.provider), I = await mintAll(
|
|
67943
|
+
d,
|
|
67944
|
+
A,
|
|
67822
67945
|
s,
|
|
67823
67946
|
n,
|
|
67824
67947
|
o,
|
|
67825
|
-
a,
|
|
67826
67948
|
!0,
|
|
67827
|
-
|
|
67828
|
-
),
|
|
67829
|
-
let
|
|
67949
|
+
h
|
|
67950
|
+
), B = I.inscription_id, l = `${B.split("i")[0]}:0:0`;
|
|
67951
|
+
let C = null;
|
|
67830
67952
|
try {
|
|
67831
|
-
saveExtraUtxos([
|
|
67953
|
+
saveExtraUtxos([I.signed_commit_tx_hex, I.signed_reveal_tx_hex], [B, l]);
|
|
67832
67954
|
const b = new WalletInfo(
|
|
67833
67955
|
!0,
|
|
67834
67956
|
Buffer$1.from(Script.encode(["OP_RETURN", Buff$3.str("BRC20PROG")], !1)),
|
|
@@ -67836,86 +67958,84 @@ async function callSmartContract(t, e, r, A, s, n, o, a, u) {
|
|
|
67836
67958
|
null,
|
|
67837
67959
|
null
|
|
67838
67960
|
);
|
|
67839
|
-
|
|
67840
|
-
|
|
67961
|
+
C = await sendInscriptionToOpReturnAll(
|
|
67962
|
+
B,
|
|
67841
67963
|
b,
|
|
67842
67964
|
1,
|
|
67843
|
-
|
|
67965
|
+
A,
|
|
67844
67966
|
!0,
|
|
67845
|
-
|
|
67967
|
+
h
|
|
67846
67968
|
);
|
|
67847
67969
|
} finally {
|
|
67848
67970
|
clearExtraUtxos();
|
|
67849
67971
|
}
|
|
67850
|
-
if (
|
|
67972
|
+
if (C == null)
|
|
67851
67973
|
throw new Error("Failed to send inscription to OP_RETURN");
|
|
67852
|
-
if (
|
|
67974
|
+
if (a)
|
|
67853
67975
|
return {
|
|
67854
|
-
commitTxId:
|
|
67855
|
-
signedCommitTxHex:
|
|
67856
|
-
revealTxId:
|
|
67857
|
-
signedRevealTxHex:
|
|
67858
|
-
inscriptionId:
|
|
67859
|
-
postage:
|
|
67860
|
-
secret:
|
|
67861
|
-
sendToOpReturnTxId:
|
|
67862
|
-
signedSendToOpReturnTxHex:
|
|
67976
|
+
commitTxId: I.commit_txid,
|
|
67977
|
+
signedCommitTxHex: I.signed_commit_tx_hex,
|
|
67978
|
+
revealTxId: I.reveal_txid,
|
|
67979
|
+
signedRevealTxHex: I.signed_reveal_tx_hex,
|
|
67980
|
+
inscriptionId: I.inscription_id,
|
|
67981
|
+
postage: I.postage,
|
|
67982
|
+
secret: I.secret,
|
|
67983
|
+
sendToOpReturnTxId: C.txId,
|
|
67984
|
+
signedSendToOpReturnTxHex: C.signedTxHex
|
|
67863
67985
|
};
|
|
67864
|
-
const
|
|
67865
|
-
|
|
67866
|
-
|
|
67867
|
-
|
|
67868
|
-
|
|
67869
|
-
|
|
67870
|
-
|
|
67871
|
-
|
|
67872
|
-
|
|
67873
|
-
|
|
67874
|
-
|
|
67986
|
+
const p = [I.signed_commit_tx_hex, I.signed_reveal_tx_hex, C.signedTxHex];
|
|
67987
|
+
if (await broadcastTxes(p) == null) throw new Error("Broadcast request failed");
|
|
67988
|
+
return {
|
|
67989
|
+
commitTxId: I.commit_txid,
|
|
67990
|
+
signedCommitTxHex: I.signed_commit_tx_hex,
|
|
67991
|
+
revealTxId: I.reveal_txid,
|
|
67992
|
+
signedRevealTxHex: I.signed_reveal_tx_hex,
|
|
67993
|
+
inscriptionId: I.inscription_id,
|
|
67994
|
+
postage: I.postage,
|
|
67995
|
+
secret: I.secret,
|
|
67996
|
+
sendToOpReturnTxId: C.txId,
|
|
67997
|
+
signedSendToOpReturnTxHex: C.signedTxHex
|
|
67875
67998
|
};
|
|
67876
67999
|
}
|
|
67877
|
-
async function callSmartContractFromPaymentWallet(t, e, r, A, s, n, o, a
|
|
67878
|
-
const
|
|
67879
|
-
if (!
|
|
68000
|
+
async function callSmartContractFromPaymentWallet(t, e, r, A, s, n, o, a) {
|
|
68001
|
+
const u = getWalletInfo();
|
|
68002
|
+
if (!u || !u.wallets) throw new Error("Wallets not found");
|
|
67880
68003
|
if (typeof t != "string")
|
|
67881
68004
|
throw new Error("smart_contract_contract_addr must be a string");
|
|
67882
68005
|
if (typeof e != "string") throw new Error("input_hex must be a string");
|
|
67883
|
-
if (assertFeeRate(
|
|
68006
|
+
if (assertFeeRate(A), s != null && (typeof s != "number" || !Number.isInteger(s)))
|
|
67884
68007
|
throw new Error("postage must be an integer or null");
|
|
67885
|
-
if (
|
|
68008
|
+
if (n != null && typeof n != "string")
|
|
67886
68009
|
throw new Error("payment_addr must be a string");
|
|
67887
|
-
if (
|
|
68010
|
+
if (o != null && (typeof o != "number" || !Number.isInteger(o)))
|
|
67888
68011
|
throw new Error("payment must be an integer");
|
|
67889
|
-
if (typeof
|
|
67890
|
-
const
|
|
67891
|
-
let
|
|
67892
|
-
`{"p":"brc20-prog","op":"c","c":"${t}","b":"${
|
|
68012
|
+
if (typeof a != "boolean") throw new Error("dry_run must be a boolean");
|
|
68013
|
+
const g = await compressSmartContractData(e);
|
|
68014
|
+
let c = Buff$3.str(
|
|
68015
|
+
`{"p":"brc20-prog","op":"c","c":"${t}","b":"${g}"}`
|
|
67893
68016
|
);
|
|
67894
|
-
|
|
67895
|
-
|
|
67896
|
-
d = d.append(M);
|
|
67897
|
-
}
|
|
67898
|
-
const h = new InscriptionDetails(
|
|
68017
|
+
c = padContentToGas(c, r);
|
|
68018
|
+
const d = new InscriptionDetails(
|
|
67899
68019
|
Buff$3.str("text/plain"),
|
|
67900
68020
|
null,
|
|
67901
68021
|
null,
|
|
67902
68022
|
null,
|
|
67903
68023
|
null,
|
|
67904
|
-
|
|
67905
|
-
),
|
|
67906
|
-
|
|
68024
|
+
c
|
|
68025
|
+
), h = getSignFn(u.provider), I = await mintAllPaymentWallet(
|
|
68026
|
+
d,
|
|
68027
|
+
A,
|
|
67907
68028
|
s,
|
|
67908
68029
|
n,
|
|
67909
68030
|
o,
|
|
67910
|
-
a,
|
|
67911
68031
|
!0,
|
|
67912
|
-
|
|
67913
|
-
),
|
|
67914
|
-
let
|
|
68032
|
+
h
|
|
68033
|
+
), B = I.inscriptionId, l = `${B.split("i")[0]}:0:0`;
|
|
68034
|
+
let C = null;
|
|
67915
68035
|
try {
|
|
67916
68036
|
saveExtraUtxos(
|
|
67917
|
-
[
|
|
67918
|
-
[
|
|
68037
|
+
[I.signedCommitTxHex, I.signedRevealTxHex],
|
|
68038
|
+
[B, l]
|
|
67919
68039
|
);
|
|
67920
68040
|
const b = new WalletInfo(
|
|
67921
68041
|
!0,
|
|
@@ -67924,46 +68044,47 @@ async function callSmartContractFromPaymentWallet(t, e, r, A, s, n, o, a, u) {
|
|
|
67924
68044
|
null,
|
|
67925
68045
|
null
|
|
67926
68046
|
);
|
|
67927
|
-
|
|
67928
|
-
|
|
68047
|
+
C = await sendInscriptionInPaymentWalletToOpReturnAll(
|
|
68048
|
+
B,
|
|
67929
68049
|
b,
|
|
67930
68050
|
1,
|
|
67931
|
-
|
|
68051
|
+
A,
|
|
67932
68052
|
!0,
|
|
67933
|
-
|
|
68053
|
+
h
|
|
67934
68054
|
);
|
|
67935
68055
|
} finally {
|
|
67936
68056
|
clearExtraUtxos();
|
|
67937
68057
|
}
|
|
67938
|
-
if (
|
|
68058
|
+
if (C == null)
|
|
67939
68059
|
throw new Error("Failed to send inscription to OP_RETURN");
|
|
67940
|
-
if (
|
|
68060
|
+
if (a)
|
|
67941
68061
|
return {
|
|
67942
|
-
commitTxId:
|
|
67943
|
-
signedCommitTxHex:
|
|
67944
|
-
revealTxId:
|
|
67945
|
-
signedRevealTxHex:
|
|
67946
|
-
inscriptionId:
|
|
67947
|
-
postage:
|
|
67948
|
-
secret:
|
|
67949
|
-
sendToOpReturnTxId:
|
|
67950
|
-
signedSendToOpReturnTxHex:
|
|
68062
|
+
commitTxId: I.commitTxId,
|
|
68063
|
+
signedCommitTxHex: I.signedCommitTxHex,
|
|
68064
|
+
revealTxId: I.revealTxId,
|
|
68065
|
+
signedRevealTxHex: I.signedRevealTxHex,
|
|
68066
|
+
inscriptionId: I.inscriptionId,
|
|
68067
|
+
postage: I.postage,
|
|
68068
|
+
secret: I.secret,
|
|
68069
|
+
sendToOpReturnTxId: C.txId,
|
|
68070
|
+
signedSendToOpReturnTxHex: C.signedTxHex
|
|
67951
68071
|
};
|
|
67952
|
-
const
|
|
67953
|
-
|
|
67954
|
-
|
|
67955
|
-
|
|
68072
|
+
const p = [
|
|
68073
|
+
I.signedCommitTxHex,
|
|
68074
|
+
I.signedRevealTxHex,
|
|
68075
|
+
C.signedTxHex
|
|
67956
68076
|
];
|
|
67957
|
-
|
|
67958
|
-
|
|
67959
|
-
|
|
67960
|
-
|
|
67961
|
-
|
|
67962
|
-
|
|
67963
|
-
|
|
67964
|
-
|
|
67965
|
-
|
|
67966
|
-
|
|
68077
|
+
if (await broadcastTxes(p) == null) throw new Error("Broadcast request failed");
|
|
68078
|
+
return {
|
|
68079
|
+
commitTxId: I.commitTxId,
|
|
68080
|
+
signedCommitTxHex: I.signedCommitTxHex,
|
|
68081
|
+
revealTxId: I.revealTxId,
|
|
68082
|
+
signedRevealTxHex: I.signedRevealTxHex,
|
|
68083
|
+
inscriptionId: I.inscriptionId,
|
|
68084
|
+
postage: I.postage,
|
|
68085
|
+
secret: I.secret,
|
|
68086
|
+
sendToOpReturnTxId: C.txId,
|
|
68087
|
+
signedSendToOpReturnTxHex: C.signedTxHex
|
|
67967
68088
|
};
|
|
67968
68089
|
}
|
|
67969
68090
|
async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
@@ -68000,7 +68121,7 @@ async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
|
68000
68121
|
[d.signed_commit_tx_hex, d.signed_reveal_tx_hex],
|
|
68001
68122
|
[h, I]
|
|
68002
68123
|
);
|
|
68003
|
-
const
|
|
68124
|
+
const p = new WalletInfo(
|
|
68004
68125
|
!0,
|
|
68005
68126
|
Buffer$1.from(Script.encode(["OP_RETURN", Buff$3.str("BRC20PROG")], !1)),
|
|
68006
68127
|
null,
|
|
@@ -68009,7 +68130,7 @@ async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
|
68009
68130
|
);
|
|
68010
68131
|
B = await sendInscriptionToOpReturnAll(
|
|
68011
68132
|
h,
|
|
68012
|
-
|
|
68133
|
+
p,
|
|
68013
68134
|
1,
|
|
68014
68135
|
r,
|
|
68015
68136
|
!0,
|
|
@@ -68037,7 +68158,8 @@ async function depositToBrc20Prog(t, e, r, A, s, n, o) {
|
|
|
68037
68158
|
d.signed_reveal_tx_hex,
|
|
68038
68159
|
B.signedTxHex
|
|
68039
68160
|
];
|
|
68040
|
-
|
|
68161
|
+
if (await broadcastTxes(l) == null) throw new Error("Broadcast request failed");
|
|
68162
|
+
return {
|
|
68041
68163
|
commitTxId: d.commit_txid,
|
|
68042
68164
|
signedCommitTxHex: d.signed_commit_tx_hex,
|
|
68043
68165
|
revealTxId: d.reveal_txid,
|
|
@@ -68086,10 +68208,10 @@ async function withdrawFromBrc20Prog(t, e, r, A, s, n, o, a) {
|
|
|
68086
68208
|
[h.signed_commit_tx_hex, h.signed_reveal_tx_hex],
|
|
68087
68209
|
[I, B]
|
|
68088
68210
|
);
|
|
68089
|
-
const
|
|
68211
|
+
const Q = new WalletInfo(!1, null, r, null, null);
|
|
68090
68212
|
l = await sendInscriptionAll(
|
|
68091
68213
|
I,
|
|
68092
|
-
|
|
68214
|
+
Q,
|
|
68093
68215
|
null,
|
|
68094
68216
|
A,
|
|
68095
68217
|
!0,
|
|
@@ -68117,7 +68239,8 @@ async function withdrawFromBrc20Prog(t, e, r, A, s, n, o, a) {
|
|
|
68117
68239
|
h.signed_reveal_tx_hex,
|
|
68118
68240
|
l.signedTxHex
|
|
68119
68241
|
];
|
|
68120
|
-
|
|
68242
|
+
if (await broadcastTxes(C) == null) throw new Error("Broadcast request failed");
|
|
68243
|
+
return {
|
|
68121
68244
|
commitTxId: h.commit_txid,
|
|
68122
68245
|
signedCommitTxHex: h.signed_commit_tx_hex,
|
|
68123
68246
|
revealTxId: h.reveal_txid,
|
|
@@ -68565,42 +68688,47 @@ export {
|
|
|
68565
68688
|
sendInscriptionToOpReturnAll as a6,
|
|
68566
68689
|
sendInscriptionInPaymentWalletToOpReturnAll as a7,
|
|
68567
68690
|
sendInscriptionAll as a8,
|
|
68568
|
-
|
|
68569
|
-
|
|
68570
|
-
|
|
68571
|
-
|
|
68572
|
-
|
|
68573
|
-
|
|
68574
|
-
|
|
68575
|
-
|
|
68576
|
-
|
|
68577
|
-
|
|
68578
|
-
|
|
68579
|
-
|
|
68580
|
-
|
|
68581
|
-
|
|
68582
|
-
|
|
68583
|
-
|
|
68584
|
-
|
|
68585
|
-
|
|
68586
|
-
|
|
68587
|
-
|
|
68588
|
-
|
|
68589
|
-
|
|
68590
|
-
|
|
68591
|
-
|
|
68592
|
-
|
|
68593
|
-
|
|
68594
|
-
|
|
68595
|
-
|
|
68596
|
-
|
|
68597
|
-
|
|
68598
|
-
|
|
68599
|
-
|
|
68600
|
-
|
|
68601
|
-
|
|
68602
|
-
|
|
68603
|
-
|
|
68691
|
+
global$1 as a9,
|
|
68692
|
+
evmEncodeFunctionCall as aA,
|
|
68693
|
+
GAS_PER_BYTE as aB,
|
|
68694
|
+
getDustValue as aC,
|
|
68695
|
+
getBrc20RpcProvider as aD,
|
|
68696
|
+
ethCallOnPublicRpc as aE,
|
|
68697
|
+
callSmartContract as aF,
|
|
68698
|
+
callSmartContractFromPaymentWallet as aG,
|
|
68699
|
+
deploySmartContract as aH,
|
|
68700
|
+
deploySmartContractAbi as aI,
|
|
68701
|
+
depositToBrc20Prog as aJ,
|
|
68702
|
+
withdrawFromBrc20Prog as aK,
|
|
68703
|
+
inscribeMultiple as aL,
|
|
68704
|
+
inscribeWithParent as aM,
|
|
68705
|
+
getInscribeMultipleFee as aN,
|
|
68706
|
+
saveSwapWalletInfo as aa,
|
|
68707
|
+
readSwapWalletInfo as ab,
|
|
68708
|
+
getSwapBackendUrl as ac,
|
|
68709
|
+
fetchWithErrors as ad,
|
|
68710
|
+
compressSmartContractData as ae,
|
|
68711
|
+
Buff$3 as af,
|
|
68712
|
+
InscriptionDetails as ag,
|
|
68713
|
+
resolveReclaimInputs as ah,
|
|
68714
|
+
getInscribeAllToOpReturnFee as ai,
|
|
68715
|
+
fetchCardinalUtxos as aj,
|
|
68716
|
+
mintWithReclaimsCheckFees as ak,
|
|
68717
|
+
mintAllCheckFees as al,
|
|
68718
|
+
saveExtraUtxos as am,
|
|
68719
|
+
Script as an,
|
|
68720
|
+
sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate as ao,
|
|
68721
|
+
clearExtraUtxos as ap,
|
|
68722
|
+
utxoOutputTypeFromOutputScript as aq,
|
|
68723
|
+
mintWithExtraInputInCommitFeeRate as ar,
|
|
68724
|
+
getSignManyFn as as,
|
|
68725
|
+
mintWithReclaimsAll as at,
|
|
68726
|
+
mintAll as au,
|
|
68727
|
+
sendInscriptionToOpReturnWithExtraInputsAndExtraOutputAll as av,
|
|
68728
|
+
mintWithExtraInputInCommitAll as aw,
|
|
68729
|
+
isInscribed as ax,
|
|
68730
|
+
inscribeAllToOpReturn as ay,
|
|
68731
|
+
assertFeeRate as az,
|
|
68604
68732
|
getCardinalBalance as b,
|
|
68605
68733
|
clearWalletInfo as c,
|
|
68606
68734
|
getCardinalBalances as d,
|