@btc-vision/transaction 1.8.7 → 1.8.9
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/browser/btc-vision-bitcoin.js +705 -703
- package/browser/index.js +116 -108
- package/browser/noble-curves.js +4 -4
- package/browser/noble-hashes.js +88 -88
- package/browser/rolldown-runtime.js +26 -19
- package/browser/src/epoch/validator/EpochValidator.d.ts +28 -6
- package/browser/vendors.js +3065 -3027
- package/build/epoch/validator/EpochValidator.d.ts +28 -6
- package/build/epoch/validator/EpochValidator.js +44 -10
- package/build/transaction/builders/TransactionBuilder.js +18 -2
- package/package.json +1 -1
- package/src/epoch/validator/EpochValidator.ts +67 -6
- package/src/transaction/builders/TransactionBuilder.ts +19 -2
- package/tsconfig.build.tsbuildinfo +1 -1
package/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ae, r as Ai } from "./rolldown-runtime.js";
|
|
2
2
|
import { a as bi, c as ce, d as xt, i as Le, l as ot, n as Ei, o as Ii, r as Pi, s as vt, t as vi, u as Re } from "./vendors.js";
|
|
3
|
-
import { A as Oi, B as D, C as E, D as _i, E as b, F as ht, I as Ie, L as qt, M as Ui, N as Bi, O as ki, P as Li, R as f, S as Rt, T as Ce, V as d, _ as Pe, a as Ke, b as y, c as Ri, d as C, f as Ci, g as Gt, h as Ki, i as H, j as Xt, k as g, l as Di, m as
|
|
3
|
+
import { A as Oi, B as D, C as E, D as _i, E as b, F as ht, I as Ie, L as qt, M as Ui, N as Bi, O as ki, P as Li, R as f, S as Rt, T as Ce, V as d, _ as Pe, a as Ke, b as y, c as Ri, d as C, f as Ci, g as Gt, h as Ki, i as H, j as Xt, k as g, l as Di, m as Ni, n as U, o as Mi, p as xi, r as Fi, s as it, t as M, u as Wi, v as Hi, w as L, x as Vi, y as O, z as zi } from "./btc-vision-bitcoin.js";
|
|
4
4
|
import { D as qi, T as Ft, a as zt, i as Gi, n as Xi, r as $i, t as Yi, w as ue } from "./noble-curves.js";
|
|
5
5
|
var Ct = Symbol;
|
|
6
6
|
typeof Ct.dispose != "symbol" && (Ct.dispose = /* @__PURE__ */ Symbol.for("Symbol.dispose"));
|
|
@@ -251,12 +251,12 @@ function jt(e) {
|
|
|
251
251
|
}
|
|
252
252
|
sr(!1, "invalid hashing algorithm name", "algorithm", e);
|
|
253
253
|
}
|
|
254
|
-
var or = /^[0-9a-fA-F]+$/, W = class
|
|
254
|
+
var or = /^[0-9a-fA-F]+$/, W = class Ne {
|
|
255
255
|
static btcToSatoshi(t) {
|
|
256
256
|
return BigInt(t * 1e8);
|
|
257
257
|
}
|
|
258
258
|
static rndBytes() {
|
|
259
|
-
return
|
|
259
|
+
return Ne.getSafeRandomValues(64);
|
|
260
260
|
}
|
|
261
261
|
static getSafeRandomValues(t) {
|
|
262
262
|
if (typeof globalThis.window < "u" && globalThis.window.crypto && typeof globalThis.window.crypto.getRandomValues == "function") {
|
|
@@ -326,7 +326,7 @@ var or = /^[0-9a-fA-F]+$/, W = class Me {
|
|
|
326
326
|
}
|
|
327
327
|
static createSimpleP2WDAWitness(e, t) {
|
|
328
328
|
const i = [e];
|
|
329
|
-
for (let r = 0; r < 10; r++) i.push(new Uint8Array(0));
|
|
329
|
+
for (let r = 0; r < 10; r++) i.push(/* @__PURE__ */ new Uint8Array(0));
|
|
330
330
|
return i.push(t), i;
|
|
331
331
|
}
|
|
332
332
|
static validateP2WDASignature(e, t, i) {
|
|
@@ -508,7 +508,7 @@ var or = /^[0-9a-fA-F]+$/, W = class Me {
|
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
}, at = 115792089237316195423570985008687907853269984665640564039457584007908834671663n,
|
|
511
|
+
}, at = 115792089237316195423570985008687907853269984665640564039457584007908834671663n, Me = class {
|
|
512
512
|
maxTries;
|
|
513
513
|
constructor(e = 1e4) {
|
|
514
514
|
this.maxTries = e;
|
|
@@ -531,7 +531,7 @@ var or = /^[0-9a-fA-F]+$/, W = class Me {
|
|
|
531
531
|
return e < t ? e : t;
|
|
532
532
|
}
|
|
533
533
|
getHybridPublicKey(e, t) {
|
|
534
|
-
const i = t % 2n === 0n ? 6 : 7, r = this.bigIntTo32Bytes(e), s = this.bigIntTo32Bytes(t), n = new Uint8Array(65);
|
|
534
|
+
const i = t % 2n === 0n ? 6 : 7, r = this.bigIntTo32Bytes(e), s = this.bigIntTo32Bytes(t), n = /* @__PURE__ */ new Uint8Array(65);
|
|
535
535
|
return n[0] = i, n.set(r, 1), n.set(s, 33), n;
|
|
536
536
|
}
|
|
537
537
|
isValidX(e) {
|
|
@@ -554,13 +554,13 @@ var or = /^[0-9a-fA-F]+$/, W = class Me {
|
|
|
554
554
|
return t;
|
|
555
555
|
}
|
|
556
556
|
bigIntTo32Bytes(e) {
|
|
557
|
-
const t = new Uint8Array(32);
|
|
557
|
+
const t = /* @__PURE__ */ new Uint8Array(32);
|
|
558
558
|
for (let i = 31; i >= 0; i--)
|
|
559
559
|
t[i] = Number(e & 255n), e >>= 8n;
|
|
560
560
|
return t;
|
|
561
561
|
}
|
|
562
562
|
}, ar = class {
|
|
563
|
-
deriver = new
|
|
563
|
+
deriver = new Me();
|
|
564
564
|
generateHybridKeyFromHash(e) {
|
|
565
565
|
const t = this.deriver.findOrDeriveValidPoint(new Uint8Array(e), !1), i = this.deriver.getCanonicalY(t.y1, t.y2);
|
|
566
566
|
return new Uint8Array(this.deriver.getHybridPublicKey(t.x, i));
|
|
@@ -692,18 +692,19 @@ var cr = [
|
|
|
692
692
|
return new Y(t);
|
|
693
693
|
}
|
|
694
694
|
static uncompressedToCompressed(t) {
|
|
695
|
-
const i = Uint8Array.from(t), r = i.slice(1, 33), s = i.slice(33), n = new Uint8Array(33);
|
|
695
|
+
const i = Uint8Array.from(t), r = i.slice(1, 33), s = i.slice(33), n = /* @__PURE__ */ new Uint8Array(33);
|
|
696
696
|
return n[0] = 2 + (s[s.length - 1] & 1), n.set(r, 1), n;
|
|
697
697
|
}
|
|
698
698
|
static fromBigInt(t, i) {
|
|
699
|
-
|
|
699
|
+
const r = Y.bigintToUint8Array(t), s = i !== void 0 ? Y.bigintToUint8Array(i) : void 0;
|
|
700
|
+
return new Y(r, s);
|
|
700
701
|
}
|
|
701
702
|
static fromUint64Array(t, i, r, s) {
|
|
702
|
-
const n = new Uint8Array(32), o = new DataView(n.buffer);
|
|
703
|
+
const n = /* @__PURE__ */ new Uint8Array(32), o = new DataView(n.buffer);
|
|
703
704
|
return o.setBigUint64(0, t, !1), o.setBigUint64(8, i, !1), o.setBigUint64(16, r, !1), o.setBigUint64(24, s, !1), new Y(n);
|
|
704
705
|
}
|
|
705
706
|
static bigintToUint8Array(t) {
|
|
706
|
-
const i = new Uint8Array(32), r = new DataView(i.buffer);
|
|
707
|
+
const i = /* @__PURE__ */ new Uint8Array(32), r = new DataView(i.buffer);
|
|
707
708
|
return r.setBigUint64(0, t >> 192n & 18446744073709551615n, !1), r.setBigUint64(8, t >> 128n & 18446744073709551615n, !1), r.setBigUint64(16, t >> 64n & 18446744073709551615n, !1), r.setBigUint64(24, t & 18446744073709551615n, !1), i;
|
|
708
709
|
}
|
|
709
710
|
[Symbol.dispose]() {
|
|
@@ -1619,7 +1620,7 @@ var cr = [
|
|
|
1619
1620
|
super(e, t, i);
|
|
1620
1621
|
}
|
|
1621
1622
|
static getPubKeyAsBuffer(e, t) {
|
|
1622
|
-
let i = new Uint8Array(0);
|
|
1623
|
+
let i = /* @__PURE__ */ new Uint8Array(0);
|
|
1623
1624
|
for (const s of e) {
|
|
1624
1625
|
if (!I.fromPublicKey(s, t).compressed) throw new Error("Public key must be compressed");
|
|
1625
1626
|
if (s.byteLength !== 33) throw new Error(`Public key must be 33 bytes, got ${s.byteLength} bytes.`);
|
|
@@ -1878,10 +1879,10 @@ var cr = [
|
|
|
1878
1879
|
}
|
|
1879
1880
|
}, ur = class extends tt {
|
|
1880
1881
|
constructor(e, t = y.bitcoin) {
|
|
1881
|
-
super(e, new Uint8Array(0), t);
|
|
1882
|
+
super(e, /* @__PURE__ */ new Uint8Array(0), t);
|
|
1882
1883
|
}
|
|
1883
1884
|
static getPubKeyAsBuffer(e, t) {
|
|
1884
|
-
let i = new Uint8Array(0);
|
|
1885
|
+
let i = /* @__PURE__ */ new Uint8Array(0);
|
|
1885
1886
|
for (const s of e) {
|
|
1886
1887
|
if (!I.fromPublicKey(s, t).compressed) throw new Error("Public key must be compressed");
|
|
1887
1888
|
if (s.byteLength !== 33) throw new Error(`Public key must be 33 bytes, got ${s.byteLength} bytes.`);
|
|
@@ -1933,7 +1934,7 @@ var cr = [
|
|
|
1933
1934
|
if (t.length < i) throw new Error("The amount of public keys is lower than the minimum required");
|
|
1934
1935
|
if (i > Zt.MAXIMUM_SUPPORTED_SIGNATURE) throw new Error(`The maximum amount of signatures is ${Zt.MAXIMUM_SUPPORTED_SIGNATURE}`);
|
|
1935
1936
|
const s = qt(1);
|
|
1936
|
-
s[0] = i, t = t.filter((u, l, h) => l === h.findIndex((p) => C(u, p))), t = t.sort((u, l) =>
|
|
1937
|
+
s[0] = i, t = t.filter((u, l, h) => l === h.findIndex((p) => C(u, p))), t = t.sort((u, l) => Ni(u, l));
|
|
1937
1938
|
let n = !1;
|
|
1938
1939
|
const o = t.map((u) => {
|
|
1939
1940
|
const l = O(u);
|
|
@@ -1976,7 +1977,7 @@ var cr = [
|
|
|
1976
1977
|
}
|
|
1977
1978
|
};
|
|
1978
1979
|
function It(e) {
|
|
1979
|
-
let t = new Uint8Array(0);
|
|
1980
|
+
let t = /* @__PURE__ */ new Uint8Array(0);
|
|
1980
1981
|
function i(a, c) {
|
|
1981
1982
|
const u = new Uint8Array(a.length + c.length);
|
|
1982
1983
|
return u.set(a, 0), u.set(c, a.length), u;
|
|
@@ -2065,7 +2066,7 @@ var Ut = g("50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"),
|
|
|
2065
2066
|
}
|
|
2066
2067
|
static buildDummyWitness(e) {
|
|
2067
2068
|
const { config: t, tapscript: i, controlBlock: r } = e, s = [];
|
|
2068
|
-
for (let n = 0; n < t.pubkeys.length; n++) t.pubkeys.length - 1 - n < t.threshold ? s.push(new Uint8Array(64)) : s.push(new Uint8Array(0));
|
|
2069
|
+
for (let n = 0; n < t.pubkeys.length; n++) t.pubkeys.length - 1 - n < t.threshold ? s.push(/* @__PURE__ */ new Uint8Array(64)) : s.push(/* @__PURE__ */ new Uint8Array(0));
|
|
2069
2070
|
return s.push(i), s.push(r), s;
|
|
2070
2071
|
}
|
|
2071
2072
|
static buildFinalWitnessFromTapScriptSigs(e, t) {
|
|
@@ -2079,7 +2080,7 @@ var Ut = g("50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"),
|
|
|
2079
2080
|
if (l) {
|
|
2080
2081
|
if (l.length !== 64 && l.length !== 65) throw new Error(`Invalid Schnorr signature length ${l.length} for CSV multisig spend`);
|
|
2081
2082
|
o.push(l), a++;
|
|
2082
|
-
} else o.push(new Uint8Array(0));
|
|
2083
|
+
} else o.push(/* @__PURE__ */ new Uint8Array(0));
|
|
2083
2084
|
}
|
|
2084
2085
|
if (a < i.threshold) throw new Error(`CSV multisig spend needs ${i.threshold} signatures, got ${a}`);
|
|
2085
2086
|
const c = [];
|
|
@@ -2409,7 +2410,7 @@ var Tt = /* @__PURE__ */ (function(e) {
|
|
|
2409
2410
|
else if (c.length === h) p = c.subarray(0, l);
|
|
2410
2411
|
else throw new Error(`Invalid ML-DSA key length for security level ${s}. Expected ${l} bytes (private only) or ${h} bytes (private+public), got ${c.length} bytes.`);
|
|
2411
2412
|
if (n && n.length !== 32) throw new Error("Chain code must be 32 bytes");
|
|
2412
|
-
this._chainCode = n || new Uint8Array(32), this._mldsaKeypair = v.QuantumBIP32Factory.fromPrivateKey(p, this._chainCode, this.network, s);
|
|
2413
|
+
this._chainCode = n || /* @__PURE__ */ new Uint8Array(32), this._mldsaKeypair = v.QuantumBIP32Factory.fromPrivateKey(p, this._chainCode, this.network, s);
|
|
2413
2414
|
} else
|
|
2414
2415
|
this._mldsaKeypair = v.QuantumBIP32Factory.fromBase58(a), this._chainCode = new Uint8Array(this._mldsaKeypair.chainCode), this._securityLevel = this._mldsaKeypair.securityLevel;
|
|
2415
2416
|
this._bufferPubKey = this._keypair.publicKey, this._address = new z(this._mldsaKeypair.publicKey, this._keypair.publicKey), this._p2tr = this._address.p2tr(this.network), this._p2wpkh = this._address.p2wpkh(this.network), this._legacy = this._address.p2pkh(this.network), this._segwitLegacy = this._address.p2shp2wpkh(this.network), this._p2wda = this._address.p2wda(this.network), this._tweakedKey = this._address.tweakedPublicKeyToBuffer();
|
|
@@ -2566,7 +2567,8 @@ var gr = (0, v.BIP32Factory)(K), Sr = class je {
|
|
|
2566
2567
|
return mt.generateMnemonic(t);
|
|
2567
2568
|
}
|
|
2568
2569
|
static generate(t = ee.MAXIMUM, i = "", r = y.bitcoin, s = v.MLDSASecurityLevel.LEVEL2) {
|
|
2569
|
-
|
|
2570
|
+
const n = mt.generateMnemonic(t);
|
|
2571
|
+
return new je(n, i, r, s);
|
|
2570
2572
|
}
|
|
2571
2573
|
static validate(t) {
|
|
2572
2574
|
return mt.validateMnemonic(t);
|
|
@@ -2805,7 +2807,7 @@ var Tr = class extends we {
|
|
|
2805
2807
|
toSignInputs: a
|
|
2806
2808
|
});
|
|
2807
2809
|
}
|
|
2808
|
-
const r = await this.unisat.signPsbt(t[0], i[0]), s =
|
|
2810
|
+
const r = await this.unisat.signPsbt(t[0], i[0]), s = M.fromHex(r);
|
|
2809
2811
|
e[0].combine(s);
|
|
2810
2812
|
}
|
|
2811
2813
|
hasAlreadySignedTapScriptSig(e) {
|
|
@@ -2842,7 +2844,7 @@ var Tr = class extends we {
|
|
|
2842
2844
|
disableTweakSigner: i
|
|
2843
2845
|
}]).flat()
|
|
2844
2846
|
}, n = e.toHex(), o = await this.unisat.signPsbt(n, s);
|
|
2845
|
-
return
|
|
2847
|
+
return M.fromHex(o);
|
|
2846
2848
|
}
|
|
2847
2849
|
getNonDuplicateScriptSig(e, t) {
|
|
2848
2850
|
const i = [];
|
|
@@ -3676,7 +3678,7 @@ var ke = new Uint8Array([
|
|
|
3676
3678
|
optionalOutputsAdded = !1;
|
|
3677
3679
|
constructor(t) {
|
|
3678
3680
|
if (super(t), t.estimatedFees && (this.estimatedFees = t.estimatedFees), this.signer = t.signer, this.network = t.network, this.feeRate = t.feeRate, this.priorityFee = t.priorityFee ?? 0n, this.gasSatFee = t.gasSatFee ?? 0n, this.utxos = t.utxos, this.optionalInputs = t.optionalInputs || [], this.to = t.to || void 0, this.debugFees = t.debugFees || !1, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), t.note && (typeof t.note == "string" ? this.note = new TextEncoder().encode(t.note) : this.note = t.note), this.anchor = t.anchor ?? !1, this.isPubKeyDestination = this.to ? Et.isValidPublicKey(this.to, this.network) : !1, this.optionalOutputs = t.optionalOutputs, this.from = R.getFrom(t.from, this.signer, this.network), this.totalInputAmount = this.calculateTotalUTXOAmount(), this.calculateTotalVOutAmount() < this.totalInputAmount) throw new Error("Vout value is less than the value to send");
|
|
3679
|
-
this.transaction = new
|
|
3681
|
+
this.transaction = new M({
|
|
3680
3682
|
network: this.network,
|
|
3681
3683
|
version: this.txVersion
|
|
3682
3684
|
});
|
|
@@ -3775,9 +3777,9 @@ var ke = new Uint8Array([
|
|
|
3775
3777
|
}
|
|
3776
3778
|
async estimateTransactionFees() {
|
|
3777
3779
|
await Promise.resolve();
|
|
3778
|
-
const t = new
|
|
3780
|
+
const t = new M({ network: this.network }), i = this.getInputs(), r = this.getOutputs();
|
|
3779
3781
|
t.addInputs(i), t.addOutputs(r);
|
|
3780
|
-
const s = new Uint8Array(64), n = new Uint8Array(72), o = new Uint8Array(33).fill(2), a = (h, p) => {
|
|
3782
|
+
const s = /* @__PURE__ */ new Uint8Array(64), n = /* @__PURE__ */ new Uint8Array(72), o = (/* @__PURE__ */ new Uint8Array(33)).fill(2), a = (h, p) => {
|
|
3781
3783
|
if (p.isPayToAnchor || this.anchorInputIndices.has(h)) return {
|
|
3782
3784
|
finalScriptSig: void 0,
|
|
3783
3785
|
finalScriptWitness: Uint8Array.from([0])
|
|
@@ -3786,8 +3788,8 @@ var ke = new Uint8Array([
|
|
|
3786
3788
|
if (w) return { finalScriptWitness: R.witnessStackToScriptWitness(rt.buildDummyWitness(w)) };
|
|
3787
3789
|
if (p.witnessScript && X.isP2WDAWitnessScript(p.witnessScript)) {
|
|
3788
3790
|
const A = [];
|
|
3789
|
-
for (let x = 0; x < 10; x++) A.push(new Uint8Array(0));
|
|
3790
|
-
const k = new Uint8Array(72);
|
|
3791
|
+
for (let x = 0; x < 10; x++) A.push(/* @__PURE__ */ new Uint8Array(0));
|
|
3792
|
+
const k = /* @__PURE__ */ new Uint8Array(72);
|
|
3791
3793
|
return { finalScriptWitness: R.witnessStackToScriptWitness([
|
|
3792
3794
|
...A,
|
|
3793
3795
|
k,
|
|
@@ -3795,7 +3797,7 @@ var ke = new Uint8Array([
|
|
|
3795
3797
|
]) };
|
|
3796
3798
|
}
|
|
3797
3799
|
if (h === 0 && this.tapLeafScript) {
|
|
3798
|
-
const A = new Uint8Array(32), k = this.tapLeafScript.script, x = this.useP2MR ? 33 : 65, yt = new Uint8Array(x);
|
|
3800
|
+
const A = /* @__PURE__ */ new Uint8Array(32), k = this.tapLeafScript.script, x = this.useP2MR ? 33 : 65, yt = new Uint8Array(x);
|
|
3799
3801
|
return { finalScriptWitness: R.witnessStackToScriptWitness([
|
|
3800
3802
|
A,
|
|
3801
3803
|
s,
|
|
@@ -3827,7 +3829,7 @@ var ke = new Uint8Array([
|
|
|
3827
3829
|
const yt = k - d.OP_1 + 1, be = [];
|
|
3828
3830
|
for (let Ee = 0; Ee < yt; Ee++) be.push(n);
|
|
3829
3831
|
return { finalScriptWitness: R.witnessStackToScriptWitness([
|
|
3830
|
-
new Uint8Array(0),
|
|
3832
|
+
/* @__PURE__ */ new Uint8Array(0),
|
|
3831
3833
|
...be,
|
|
3832
3834
|
p.witnessScript
|
|
3833
3835
|
]) };
|
|
@@ -3863,7 +3865,7 @@ var ke = new Uint8Array([
|
|
|
3863
3865
|
return this.debugFees && this.log(`Estimating fees: feeRate=${this.feeRate}, accurate_vSize=${c}, fee=${l}n`), l;
|
|
3864
3866
|
}
|
|
3865
3867
|
async rebuildFromBase64(t) {
|
|
3866
|
-
return this.transaction =
|
|
3868
|
+
return this.transaction = M.fromBase64(t, {
|
|
3867
3869
|
network: this.network,
|
|
3868
3870
|
version: this.txVersion
|
|
3869
3871
|
}), this.signed = !1, this.sighashTypes = [Xt.SIGHASH_ANYONECANPAY, Xt.SIGHASH_ALL], await this.signPSBT();
|
|
@@ -3943,22 +3945,22 @@ var ke = new Uint8Array([
|
|
|
3943
3945
|
return new Uint8Array(a.signature);
|
|
3944
3946
|
}
|
|
3945
3947
|
generateMLDSALinkRequest(t, i) {
|
|
3946
|
-
const r = this.mldsaSigner, s = this.generateLegacySignature();
|
|
3947
|
-
let
|
|
3948
|
-
|
|
3949
|
-
const
|
|
3948
|
+
const r = this.mldsaSigner, s = this.generateLegacySignature(), n = t.revealMLDSAPublicKey ?? !0;
|
|
3949
|
+
let o = null;
|
|
3950
|
+
n && (o = this.generateMLDSASignature());
|
|
3951
|
+
const a = {
|
|
3950
3952
|
priority: J.MLDSA_LINK_PUBKEY,
|
|
3951
3953
|
opcode: q.MLDSA_LINK_PUBKEY,
|
|
3952
3954
|
data: {
|
|
3953
|
-
verifyRequest:
|
|
3955
|
+
verifyRequest: n,
|
|
3954
3956
|
publicKey: r.publicKey,
|
|
3955
3957
|
hashedPublicKey: this.hashedPublicKey,
|
|
3956
3958
|
level: ie(r.publicKey.length),
|
|
3957
3959
|
legacySignature: s,
|
|
3958
|
-
mldsaSignature:
|
|
3960
|
+
mldsaSignature: o
|
|
3959
3961
|
}
|
|
3960
3962
|
};
|
|
3961
|
-
i.push(
|
|
3963
|
+
i.push(a);
|
|
3962
3964
|
}
|
|
3963
3965
|
getTransactionOPNetFee() {
|
|
3964
3966
|
const t = this.priorityFee + this.gasSatFee;
|
|
@@ -4559,7 +4561,7 @@ var ke = new Uint8Array([
|
|
|
4559
4561
|
version: 192
|
|
4560
4562
|
}];
|
|
4561
4563
|
}
|
|
4562
|
-
},
|
|
4564
|
+
}, Nt = class extends B {
|
|
4563
4565
|
type = m.FUNDING;
|
|
4564
4566
|
amount;
|
|
4565
4567
|
splitInputsInto;
|
|
@@ -4622,7 +4624,7 @@ var ke = new Uint8Array([
|
|
|
4622
4624
|
getSignerKey() {
|
|
4623
4625
|
return this.signer;
|
|
4624
4626
|
}
|
|
4625
|
-
},
|
|
4627
|
+
}, Mt = class extends ye {
|
|
4626
4628
|
type = m.INTERACTION;
|
|
4627
4629
|
compiledTargetScript;
|
|
4628
4630
|
scriptTree;
|
|
@@ -4745,7 +4747,7 @@ var ke = new Uint8Array([
|
|
|
4745
4747
|
const r = i.partialSig[0].signature, s = ht([r, this.compiledOperationData]), n = st.signMessage(this.signer, s).signature, o = ht([n, this.compiledOperationData]), a = Z.compress(o), c = this.splitIntoWitnessChunks(a);
|
|
4746
4748
|
if (c.length > lt.MAX_WITNESS_FIELDS) throw new Error(`Compressed data needs ${c.length} witness fields, max is ${lt.MAX_WITNESS_FIELDS}`);
|
|
4747
4749
|
const u = [r];
|
|
4748
|
-
for (let l = 0; l < lt.MAX_WITNESS_FIELDS; l++) u.push(l < c.length ? c[l] : new Uint8Array(0));
|
|
4750
|
+
for (let l = 0; l < lt.MAX_WITNESS_FIELDS; l++) u.push(l < c.length ? c[l] : /* @__PURE__ */ new Uint8Array(0));
|
|
4749
4751
|
return u.push(i.witnessScript), {
|
|
4750
4752
|
finalScriptSig: void 0,
|
|
4751
4753
|
finalScriptWitness: B.witnessStackToScriptWitness(u)
|
|
@@ -4773,8 +4775,8 @@ var ke = new Uint8Array([
|
|
|
4773
4775
|
gasSatFee: 1n,
|
|
4774
4776
|
isCancellation: !0,
|
|
4775
4777
|
priorityFee: 1n,
|
|
4776
|
-
calldata: new Uint8Array(0)
|
|
4777
|
-
}), this.contractSecret = new Uint8Array(0), e.compiledTargetScript instanceof Uint8Array ? this.compiledTargetScript = e.compiledTargetScript : this.compiledTargetScript = g(e.compiledTargetScript), this.scriptTree = this.getMinimalScriptTree(), this.internalInit();
|
|
4778
|
+
calldata: /* @__PURE__ */ new Uint8Array(0)
|
|
4779
|
+
}), this.contractSecret = /* @__PURE__ */ new Uint8Array(0), e.compiledTargetScript instanceof Uint8Array ? this.compiledTargetScript = e.compiledTargetScript : this.compiledTargetScript = g(e.compiledTargetScript), this.scriptTree = this.getMinimalScriptTree(), this.internalInit();
|
|
4778
4780
|
}
|
|
4779
4781
|
async buildTransaction() {
|
|
4780
4782
|
if (!this.from) throw new Error("From address is required");
|
|
@@ -4936,7 +4938,7 @@ var ke = new Uint8Array([
|
|
|
4936
4938
|
};
|
|
4937
4939
|
}
|
|
4938
4940
|
buildRevealTransaction(e) {
|
|
4939
|
-
const t = new
|
|
4941
|
+
const t = new M({ network: this.network }), i = this.calculateValuePerOutput();
|
|
4940
4942
|
for (let h = 0; h < this.commitmentOutputs.length; h++) {
|
|
4941
4943
|
const p = this.commitmentOutputs[h];
|
|
4942
4944
|
t.addInput({
|
|
@@ -5043,7 +5045,7 @@ var ke = new Uint8Array([
|
|
|
5043
5045
|
}
|
|
5044
5046
|
}, ni = class {
|
|
5045
5047
|
debug = !1;
|
|
5046
|
-
DUMMY_PUBKEY = new Uint8Array(32).fill(1);
|
|
5048
|
+
DUMMY_PUBKEY = (/* @__PURE__ */ new Uint8Array(32)).fill(1);
|
|
5047
5049
|
P2TR_SCRIPT = Uint8Array.from([
|
|
5048
5050
|
81,
|
|
5049
5051
|
32,
|
|
@@ -5118,7 +5120,7 @@ var ke = new Uint8Array([
|
|
|
5118
5120
|
const i = this.parseOptionalInputs(e.optionalInputs), { finalTransaction: r, estimatedAmount: s, challenge: n } = await this.iterateFundingAmount({
|
|
5119
5121
|
...e,
|
|
5120
5122
|
optionalInputs: i
|
|
5121
|
-
},
|
|
5123
|
+
}, Mt, async (p) => {
|
|
5122
5124
|
const w = await p.estimateTransactionFees() + p.getTotalOutputValue();
|
|
5123
5125
|
if (e.subtractExtraUTXOFromAmountRequired && e.optionalInputs && e.optionalInputs.length > 0) {
|
|
5124
5126
|
const T = e.optionalInputs.reduce((k, x) => k + x.value, 0n), A = w > T ? w - T : 0n;
|
|
@@ -5142,7 +5144,7 @@ var ke = new Uint8Array([
|
|
|
5142
5144
|
optionalInputs: []
|
|
5143
5145
|
});
|
|
5144
5146
|
if (!c) throw new Error("Could not sign funding transaction.");
|
|
5145
|
-
const u = this.getUTXOAsTransaction(c.tx, r.getScriptAddress(), 0), l = new
|
|
5147
|
+
const u = this.getUTXOAsTransaction(c.tx, r.getScriptAddress(), 0), l = new Mt({
|
|
5146
5148
|
...e,
|
|
5147
5149
|
utxos: u,
|
|
5148
5150
|
randomBytes: r.getRndBytes(),
|
|
@@ -5208,7 +5210,7 @@ var ke = new Uint8Array([
|
|
|
5208
5210
|
});
|
|
5209
5211
|
if (!a) throw new Error("Could not sign funding transaction.");
|
|
5210
5212
|
o.estimatedFees = a.estimatedFees;
|
|
5211
|
-
const c = await new
|
|
5213
|
+
const c = await new Nt({
|
|
5212
5214
|
...o,
|
|
5213
5215
|
optionalInputs: [],
|
|
5214
5216
|
optionalOutputs: []
|
|
@@ -5341,7 +5343,7 @@ var ke = new Uint8Array([
|
|
|
5341
5343
|
}
|
|
5342
5344
|
async createFundTransaction(e) {
|
|
5343
5345
|
if (!e.to) throw new Error('Field "to" not provided.');
|
|
5344
|
-
const t = new
|
|
5346
|
+
const t = new Nt(e), i = await t.signTransaction();
|
|
5345
5347
|
if (!i) throw new Error("Could not sign funding transaction.");
|
|
5346
5348
|
return {
|
|
5347
5349
|
tx: i,
|
|
@@ -5385,7 +5387,7 @@ var ke = new Uint8Array([
|
|
|
5385
5387
|
const h = new Xt();
|
|
5386
5388
|
h.addOutput(this.P2TR_SCRIPT, L(o));
|
|
5387
5389
|
const p = {
|
|
5388
|
-
transactionId: f(new Uint8Array(32)),
|
|
5390
|
+
transactionId: f(/* @__PURE__ */ new Uint8Array(32)),
|
|
5389
5391
|
outputIndex: 0,
|
|
5390
5392
|
scriptPubKey: {
|
|
5391
5393
|
hex: f(this.P2TR_SCRIPT),
|
|
@@ -5472,7 +5474,7 @@ var ke = new Uint8Array([
|
|
|
5472
5474
|
t.psbt && (this.log("Using provided PSBT."), this.transaction = t.psbt, this.originalInputCount = this.transaction.data.inputs.length), this.refundVault = t.refundVault, this.requestedAmount = t.requestedAmount, this.receiver = t.receiver, this.publicKeys = t.pubkeys, this.minimumSignatures = t.minimumSignatures, this.compiledTargetScript = Ge.compile(t.pubkeys, this.minimumSignatures), this.scriptTree = this.getScriptTree(), this.internalInit();
|
|
5473
5475
|
}
|
|
5474
5476
|
static fromBase64(t) {
|
|
5475
|
-
const i =
|
|
5477
|
+
const i = M.fromBase64(t.psbt, { network: t.network });
|
|
5476
5478
|
return new F({
|
|
5477
5479
|
...t,
|
|
5478
5480
|
psbt: i
|
|
@@ -5545,7 +5547,7 @@ var ke = new Uint8Array([
|
|
|
5545
5547
|
for (const u of s) {
|
|
5546
5548
|
let l = !1;
|
|
5547
5549
|
for (const h of i.tapScriptSig) C(h.pubkey, O(u)) && (o.push(h.signature), l = !0);
|
|
5548
|
-
l || o.push(new Uint8Array(0));
|
|
5550
|
+
l || o.push(/* @__PURE__ */ new Uint8Array(0));
|
|
5549
5551
|
}
|
|
5550
5552
|
o = o.reverse();
|
|
5551
5553
|
}
|
|
@@ -6361,7 +6363,7 @@ var P = class {
|
|
|
6361
6363
|
return Qe.Bitcoin;
|
|
6362
6364
|
}
|
|
6363
6365
|
};
|
|
6364
|
-
function
|
|
6366
|
+
function N(e) {
|
|
6365
6367
|
return g(e.startsWith("0x") ? e.slice(2) : e);
|
|
6366
6368
|
}
|
|
6367
6369
|
var wt = class {
|
|
@@ -6369,11 +6371,17 @@ var wt = class {
|
|
|
6369
6371
|
static sha1(e) {
|
|
6370
6372
|
return D.sha1(e);
|
|
6371
6373
|
}
|
|
6372
|
-
static calculatePreimage(e, t, i) {
|
|
6374
|
+
static calculatePreimage(e, t, i, r = !1) {
|
|
6373
6375
|
if (e.length !== 32 || t.length !== 32 || i.length !== 32) throw new Error("All inputs must be 32 bytes");
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6376
|
+
if (r) return this.concatenatePreimage(e, t, i);
|
|
6377
|
+
const s = /* @__PURE__ */ new Uint8Array(32);
|
|
6378
|
+
for (let n = 0; n < 32; n++) s[n] = e[n] ^ t[n] ^ i[n];
|
|
6379
|
+
return s;
|
|
6380
|
+
}
|
|
6381
|
+
static concatenatePreimage(e, t, i) {
|
|
6382
|
+
if (e.length !== 32 || t.length !== 32 || i.length !== 32) throw new Error("All inputs must be 32 bytes");
|
|
6383
|
+
const r = /* @__PURE__ */ new Uint8Array(96);
|
|
6384
|
+
return r.set(e, 0), r.set(t, 32), r.set(i, 64), r;
|
|
6377
6385
|
}
|
|
6378
6386
|
static countMatchingBits(e, t) {
|
|
6379
6387
|
let i = 0;
|
|
@@ -6387,43 +6395,43 @@ var wt = class {
|
|
|
6387
6395
|
}
|
|
6388
6396
|
return i;
|
|
6389
6397
|
}
|
|
6390
|
-
static verifySolution(e, t = !1) {
|
|
6398
|
+
static verifySolution(e, t = !1, i = !1) {
|
|
6391
6399
|
try {
|
|
6392
|
-
const
|
|
6393
|
-
if (!C(
|
|
6394
|
-
const
|
|
6395
|
-
return !(
|
|
6396
|
-
} catch (
|
|
6397
|
-
return t && console.error("Verification error:",
|
|
6400
|
+
const r = e.verification, s = this.calculatePreimage(r.targetChecksum, e.publicKey.toBuffer(), e.salt, i), n = this.sha1(s);
|
|
6401
|
+
if (!C(n, e.solution) || this.countMatchingBits(n, r.targetHash) !== e.difficulty) return !1;
|
|
6402
|
+
const o = e.epochNumber * this.BLOCKS_PER_EPOCH, a = o + this.BLOCKS_PER_EPOCH - 1n;
|
|
6403
|
+
return !(r.startBlock !== o || r.endBlock !== a);
|
|
6404
|
+
} catch (r) {
|
|
6405
|
+
return t && console.error("Verification error:", r), !1;
|
|
6398
6406
|
}
|
|
6399
6407
|
}
|
|
6400
6408
|
static getMiningTargetBlock(e) {
|
|
6401
6409
|
return e === 0n ? null : e * this.BLOCKS_PER_EPOCH - 1n;
|
|
6402
6410
|
}
|
|
6403
|
-
static validateEpochWinner(e) {
|
|
6411
|
+
static validateEpochWinner(e, t = !1) {
|
|
6404
6412
|
try {
|
|
6405
|
-
const
|
|
6406
|
-
epochHash:
|
|
6407
|
-
epochRoot:
|
|
6408
|
-
targetHash:
|
|
6409
|
-
targetChecksum:
|
|
6413
|
+
const i = BigInt(e.epochNumber), r = z.fromString(e.mldsaPublicKey, e.legacyPublicKey), s = N(e.solution), n = N(e.salt), o = e.difficulty, a = {
|
|
6414
|
+
epochHash: N(e.verification.epochHash),
|
|
6415
|
+
epochRoot: N(e.verification.epochRoot),
|
|
6416
|
+
targetHash: N(e.verification.targetHash),
|
|
6417
|
+
targetChecksum: N(e.verification.targetChecksum),
|
|
6410
6418
|
startBlock: BigInt(e.verification.startBlock),
|
|
6411
6419
|
endBlock: BigInt(e.verification.endBlock),
|
|
6412
|
-
proofs: Object.freeze(e.verification.proofs.map((
|
|
6413
|
-
},
|
|
6414
|
-
if (!C(
|
|
6415
|
-
const
|
|
6416
|
-
return !(
|
|
6420
|
+
proofs: Object.freeze(e.verification.proofs.map((p) => N(p)))
|
|
6421
|
+
}, c = this.calculatePreimage(a.targetChecksum, r.toBuffer(), n, t), u = this.sha1(c);
|
|
6422
|
+
if (!C(u, s) || this.countMatchingBits(u, a.targetHash) !== o) return !1;
|
|
6423
|
+
const l = i * this.BLOCKS_PER_EPOCH, h = l + this.BLOCKS_PER_EPOCH - 1n;
|
|
6424
|
+
return !(a.startBlock !== l || a.endBlock !== h);
|
|
6417
6425
|
} catch {
|
|
6418
6426
|
return !1;
|
|
6419
6427
|
}
|
|
6420
6428
|
}
|
|
6421
|
-
static validateChallengeSolution(e) {
|
|
6422
|
-
return this.verifySolution(e);
|
|
6429
|
+
static validateChallengeSolution(e, t = !1) {
|
|
6430
|
+
return this.verifySolution(e, !1, t);
|
|
6423
6431
|
}
|
|
6424
|
-
static calculateSolution(e, t, i) {
|
|
6425
|
-
const
|
|
6426
|
-
return this.sha1(
|
|
6432
|
+
static calculateSolution(e, t, i, r = !1) {
|
|
6433
|
+
const s = this.calculatePreimage(e, t, i, r);
|
|
6434
|
+
return this.sha1(s);
|
|
6427
6435
|
}
|
|
6428
6436
|
static checkDifficulty(e, t, i) {
|
|
6429
6437
|
const r = this.countMatchingBits(e, t);
|
|
@@ -6441,7 +6449,7 @@ var wt = class {
|
|
|
6441
6449
|
endBlock;
|
|
6442
6450
|
proofs;
|
|
6443
6451
|
constructor(e) {
|
|
6444
|
-
this.epochHash =
|
|
6452
|
+
this.epochHash = N(e.epochHash), this.epochRoot = N(e.epochRoot), this.targetHash = N(e.targetHash), this.targetChecksum = N(e.targetChecksum), this.startBlock = BigInt(e.startBlock), this.endBlock = BigInt(e.endBlock), this.proofs = Object.freeze(e.proofs.map((t) => N(t)));
|
|
6445
6453
|
}
|
|
6446
6454
|
}, fi = class {
|
|
6447
6455
|
epochNumber;
|
|
@@ -6450,7 +6458,7 @@ var wt = class {
|
|
|
6450
6458
|
graffiti;
|
|
6451
6459
|
signature;
|
|
6452
6460
|
constructor(e, t) {
|
|
6453
|
-
this.epochNumber = t, this.publicKey = z.fromString(e.mldsaPublicKey, e.legacyPublicKey), this.solution =
|
|
6461
|
+
this.epochNumber = t, this.publicKey = z.fromString(e.mldsaPublicKey, e.legacyPublicKey), this.solution = N(e.solution), this.graffiti = e.graffiti ? N(e.graffiti) : void 0, this.signature = N(e.signature);
|
|
6454
6462
|
}
|
|
6455
6463
|
verifySignature() {
|
|
6456
6464
|
const e = new V();
|
|
@@ -6468,7 +6476,7 @@ var wt = class {
|
|
|
6468
6476
|
verification;
|
|
6469
6477
|
submission;
|
|
6470
6478
|
constructor(e) {
|
|
6471
|
-
this.epochNumber = BigInt(e.epochNumber), this.publicKey = z.fromString(e.mldsaPublicKey, e.legacyPublicKey), this.solution =
|
|
6479
|
+
this.epochNumber = BigInt(e.epochNumber), this.publicKey = z.fromString(e.mldsaPublicKey, e.legacyPublicKey), this.solution = N(e.solution), this.salt = N(e.salt), this.graffiti = N(e.graffiti), this.difficulty = e.difficulty, this.verification = new pi(e.verification), this.submission = e.submission ? new fi(e.submission, this.epochNumber + 2n) : e.submission;
|
|
6472
6480
|
}
|
|
6473
6481
|
static validateRaw(e) {
|
|
6474
6482
|
return wt.validateEpochWinner(e);
|
|
@@ -6553,7 +6561,7 @@ var wt = class {
|
|
|
6553
6561
|
throw new Error(`Unsupported transaction type: ${e.header.transactionType}`);
|
|
6554
6562
|
}
|
|
6555
6563
|
static reconstructFunding(e, t) {
|
|
6556
|
-
return new
|
|
6564
|
+
return new Nt({
|
|
6557
6565
|
...e,
|
|
6558
6566
|
amount: BigInt(t.amount),
|
|
6559
6567
|
splitInputsInto: t.splitInputsInto
|
|
@@ -6574,7 +6582,7 @@ var wt = class {
|
|
|
6574
6582
|
static reconstructInteraction(e, t, i) {
|
|
6575
6583
|
const r = new ne(t.challenge);
|
|
6576
6584
|
if (!e.to) throw new Error('InteractionTransaction requires a "to" address');
|
|
6577
|
-
return new
|
|
6585
|
+
return new Mt({
|
|
6578
6586
|
...e,
|
|
6579
6587
|
to: e.to,
|
|
6580
6588
|
calldata: g(t.calldata),
|
|
@@ -6796,7 +6804,7 @@ var wt = class {
|
|
|
6796
6804
|
const r = i.typeSpecificData, s = r.pubkeys.map((p) => g(p));
|
|
6797
6805
|
let n;
|
|
6798
6806
|
const o = j.nameToNetwork(i.baseParams.networkName);
|
|
6799
|
-
r.existingPsbtBase64 ? n =
|
|
6807
|
+
r.existingPsbtBase64 ? n = M.fromBase64(r.existingPsbtBase64, { network: o }) : n = await this.importForSigning(e, { signer: t }).signPSBT();
|
|
6800
6808
|
const a = [];
|
|
6801
6809
|
for (let p = r.originalInputCount; p < n.data.inputs.length; p++) a.push(r.minimumSignatures);
|
|
6802
6810
|
const c = Q.signPartial(n, t, r.originalInputCount, a), u = [];
|
|
@@ -6821,7 +6829,7 @@ var wt = class {
|
|
|
6821
6829
|
if (!et(i.typeSpecificData)) throw new Error("State is not a multisig transaction");
|
|
6822
6830
|
const r = i.typeSpecificData;
|
|
6823
6831
|
if (!r.existingPsbtBase64) return !1;
|
|
6824
|
-
const s = j.nameToNetwork(i.baseParams.networkName), n =
|
|
6832
|
+
const s = j.nameToNetwork(i.baseParams.networkName), n = M.fromBase64(r.existingPsbtBase64, { network: s }), o = t instanceof Uint8Array ? t : g(t);
|
|
6825
6833
|
return Q.verifyIfSigned(n, o);
|
|
6826
6834
|
}
|
|
6827
6835
|
static multiSigGetSignatureStatus(e) {
|
|
@@ -6834,7 +6842,7 @@ var wt = class {
|
|
|
6834
6842
|
isComplete: !1,
|
|
6835
6843
|
signers: []
|
|
6836
6844
|
};
|
|
6837
|
-
const s = j.nameToNetwork(t.baseParams.networkName), n =
|
|
6845
|
+
const s = j.nameToNetwork(t.baseParams.networkName), n = M.fromBase64(i.existingPsbtBase64, { network: s }), o = /* @__PURE__ */ new Set();
|
|
6838
6846
|
for (let c = i.originalInputCount; c < n.data.inputs.length; c++) {
|
|
6839
6847
|
const u = n.data.inputs[c];
|
|
6840
6848
|
if (u.tapScriptSig) for (const l of u.tapScriptSig) o.add(f(l.pubkey));
|
|
@@ -6859,7 +6867,7 @@ var wt = class {
|
|
|
6859
6867
|
if (!et(t.typeSpecificData)) throw new Error("State is not a multisig transaction");
|
|
6860
6868
|
const i = t.typeSpecificData;
|
|
6861
6869
|
if (!i.existingPsbtBase64) throw new Error("No PSBT found in state - transaction has not been signed");
|
|
6862
|
-
const r = j.nameToNetwork(t.baseParams.networkName), s =
|
|
6870
|
+
const r = j.nameToNetwork(t.baseParams.networkName), s = M.fromBase64(i.existingPsbtBase64, { network: r }), n = i.pubkeys.map((a) => g(a)), o = [];
|
|
6863
6871
|
for (let a = i.originalInputCount; a < s.data.inputs.length; a++) o.push(n);
|
|
6864
6872
|
if (!Q.attemptFinalizeInputs(s, i.originalInputCount, o, !0)) throw new Error("Failed to finalize multisig transaction - not enough signatures");
|
|
6865
6873
|
return s.extractTransaction(!0, !0).toHex();
|
|
@@ -6884,13 +6892,13 @@ var wt = class {
|
|
|
6884
6892
|
static csvMultisigGetStatus(e) {
|
|
6885
6893
|
const t = P.fromBase64(e);
|
|
6886
6894
|
if (!t.partialPsbtBase64) return [];
|
|
6887
|
-
const i = j.nameToNetwork(t.baseParams.networkName), r =
|
|
6895
|
+
const i = j.nameToNetwork(t.baseParams.networkName), r = M.fromBase64(t.partialPsbtBase64, { network: i });
|
|
6888
6896
|
return this.computeCSVMultisigStatus(t, r, i);
|
|
6889
6897
|
}
|
|
6890
6898
|
static async addCSVMultisigSignature(e, t) {
|
|
6891
6899
|
const i = P.fromBase64(e), r = j.nameToNetwork(i.baseParams.networkName);
|
|
6892
6900
|
let s;
|
|
6893
|
-
i.partialPsbtBase64 ? (s =
|
|
6901
|
+
i.partialPsbtBase64 ? (s = M.fromBase64(i.partialPsbtBase64, { network: r }), this.addSignerToCSVInputs(s, t, r)) : (s = await this.importForSigning(e, { signer: t }).signPSBT(), this.addSignerToCSVInputs(s, t, r));
|
|
6894
6902
|
const n = this.computeCSVMultisigStatus(i, s, r), o = n.length > 0 && n.every((c) => c.collected >= c.required), a = {
|
|
6895
6903
|
...i,
|
|
6896
6904
|
partialPsbtBase64: s.toBase64()
|
|
@@ -6904,7 +6912,7 @@ var wt = class {
|
|
|
6904
6912
|
static csvMultisigFinalize(e) {
|
|
6905
6913
|
const t = P.fromBase64(e);
|
|
6906
6914
|
if (!t.partialPsbtBase64) throw new Error("No partial PSBT in state — call addCSVMultisigSignature first");
|
|
6907
|
-
const i = j.nameToNetwork(t.baseParams.networkName), r =
|
|
6915
|
+
const i = j.nameToNetwork(t.baseParams.networkName), r = M.fromBase64(t.partialPsbtBase64, { network: i });
|
|
6908
6916
|
for (let s = 0; s < r.data.inputs.length; s++) {
|
|
6909
6917
|
const n = r.data.inputs[s];
|
|
6910
6918
|
if (!n.tapLeafScript || n.tapLeafScript.length === 0) continue;
|
|
@@ -6985,7 +6993,7 @@ var wt = class {
|
|
|
6985
6993
|
const k = n[A];
|
|
6986
6994
|
if (!k) throw new Error(`Invalid raw index ${A} - not found in raw transactions array`);
|
|
6987
6995
|
let x = p.get(A);
|
|
6988
|
-
if (x === void 0 && (x =
|
|
6996
|
+
if (x === void 0 && (x = Mi(k), p.set(A, x)), l += T, u.push({
|
|
6989
6997
|
transactionId: w.transactionId,
|
|
6990
6998
|
outputIndex: w.outputIndex,
|
|
6991
6999
|
value: T,
|
|
@@ -7189,7 +7197,7 @@ function Lt(e) {
|
|
|
7189
7197
|
const t = e[0];
|
|
7190
7198
|
return e.length === 1 && t !== void 0 ? `${Lt(t)}[]` : `tuple(${e.map((i) => Lt(i)).join(",")})[]`;
|
|
7191
7199
|
}
|
|
7192
|
-
var
|
|
7200
|
+
var Nr = class {
|
|
7193
7201
|
decodeData(e, t) {
|
|
7194
7202
|
const i = new Ht(e), r = [];
|
|
7195
7203
|
for (const s of t) r.push(this.decodeSingleValue(i, s));
|
|
@@ -7299,7 +7307,7 @@ var Mr = class {
|
|
|
7299
7307
|
sha256(e) {
|
|
7300
7308
|
return new Uint8Array(new Kr.default.sha256().update(e).digest());
|
|
7301
7309
|
}
|
|
7302
|
-
},
|
|
7310
|
+
}, Mr = class yi {
|
|
7303
7311
|
items;
|
|
7304
7312
|
keys;
|
|
7305
7313
|
constructor(t = []) {
|
|
@@ -7591,7 +7599,7 @@ var zr = class extends we {
|
|
|
7591
7599
|
signInputs: r
|
|
7592
7600
|
});
|
|
7593
7601
|
if ("error" in s) throw new Error(s.error.message);
|
|
7594
|
-
const n =
|
|
7602
|
+
const n = M.fromBase64(s.result.psbt);
|
|
7595
7603
|
e[0].combine(n);
|
|
7596
7604
|
}
|
|
7597
7605
|
hasAlreadySignedTapScriptSig(e) {
|
|
@@ -7632,7 +7640,7 @@ var zr = class extends we {
|
|
|
7632
7640
|
signInputs: o
|
|
7633
7641
|
});
|
|
7634
7642
|
if ("error" in a) throw new Error(a.error.message);
|
|
7635
|
-
return
|
|
7643
|
+
return M.fromBase64(a.result.psbt);
|
|
7636
7644
|
}
|
|
7637
7645
|
getNonDuplicateScriptSig(e, t) {
|
|
7638
7646
|
const i = [];
|
|
@@ -7764,7 +7772,7 @@ var zr = class extends we {
|
|
|
7764
7772
|
return !0;
|
|
7765
7773
|
}
|
|
7766
7774
|
getBytes(t) {
|
|
7767
|
-
return t instanceof ArrayBuffer ? new Uint8Array(t) : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(0);
|
|
7775
|
+
return t instanceof ArrayBuffer ? new Uint8Array(t) : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : /* @__PURE__ */ new Uint8Array(0);
|
|
7768
7776
|
}
|
|
7769
7777
|
findIndex(t) {
|
|
7770
7778
|
let i = this.hash(t);
|
|
@@ -7788,7 +7796,7 @@ var zr = class extends we {
|
|
|
7788
7796
|
for (let r = 0; r < t.length; r++) t[r] !== void 0 && !this.deleted[r] && this.set(t[r], i[r]);
|
|
7789
7797
|
}
|
|
7790
7798
|
}, ms = /* @__PURE__ */ Ai({
|
|
7791
|
-
ABICoder: () =>
|
|
7799
|
+
ABICoder: () => Nr,
|
|
7792
7800
|
ABIDataTypes: () => S,
|
|
7793
7801
|
ADDRESS_BYTE_LENGTH: () => 32,
|
|
7794
7802
|
ANCHOR_SCRIPT: () => se,
|
|
@@ -7796,7 +7804,7 @@ var zr = class extends we {
|
|
|
7796
7804
|
Address: () => z,
|
|
7797
7805
|
AddressGenerator: () => de,
|
|
7798
7806
|
AddressMap: () => Fe,
|
|
7799
|
-
AddressSet: () =>
|
|
7807
|
+
AddressSet: () => Mr,
|
|
7800
7808
|
AddressTypes: () => ct,
|
|
7801
7809
|
AddressVerificator: () => Et,
|
|
7802
7810
|
BIPStandard: () => kt,
|
|
@@ -7833,7 +7841,7 @@ var zr = class extends we {
|
|
|
7833
7841
|
FastMap: () => Wt,
|
|
7834
7842
|
FeaturePriority: () => J,
|
|
7835
7843
|
Features: () => q,
|
|
7836
|
-
FundingTransaction: () =>
|
|
7844
|
+
FundingTransaction: () => Nt,
|
|
7837
7845
|
Generator: () => tt,
|
|
7838
7846
|
HashCommitmentGenerator: () => St,
|
|
7839
7847
|
I128_BYTE_LENGTH: () => 16,
|
|
@@ -7842,7 +7850,7 @@ var zr = class extends we {
|
|
|
7842
7850
|
I32_BYTE_LENGTH: () => 4,
|
|
7843
7851
|
I64_BYTE_LENGTH: () => 8,
|
|
7844
7852
|
I8_BYTE_LENGTH: () => 1,
|
|
7845
|
-
InteractionTransaction: () =>
|
|
7853
|
+
InteractionTransaction: () => Mt,
|
|
7846
7854
|
InteractionTransactionP2WDA: () => ri,
|
|
7847
7855
|
LEAF_VERSION_TAPSCRIPT: () => 192,
|
|
7848
7856
|
LegacyCalldataGenerator: () => ur,
|
|
@@ -7874,7 +7882,7 @@ var zr = class extends we {
|
|
|
7874
7882
|
SELECTOR_BYTE_LENGTH: () => 4,
|
|
7875
7883
|
SERIALIZATION_FORMAT_VERSION: () => 2,
|
|
7876
7884
|
SERIALIZATION_MAGIC_BYTE: () => 66,
|
|
7877
|
-
Secp256k1PointDeriver: () =>
|
|
7885
|
+
Secp256k1PointDeriver: () => Me,
|
|
7878
7886
|
SharedInteractionTransaction: () => ye,
|
|
7879
7887
|
SignatureType: () => te,
|
|
7880
7888
|
SigningProtocol: () => Vr,
|
|
@@ -7929,7 +7937,7 @@ var zr = class extends we {
|
|
|
7929
7937
|
versionBuffer: () => qe
|
|
7930
7938
|
}), Ts = v.MLDSASecurityLevel, As = v.QuantumBIP32Factory, bs = v.QuantumDerivationPath;
|
|
7931
7939
|
export {
|
|
7932
|
-
|
|
7940
|
+
Nr as ABICoder,
|
|
7933
7941
|
S as ABIDataTypes,
|
|
7934
7942
|
jr as ADDRESS_BYTE_LENGTH,
|
|
7935
7943
|
se as ANCHOR_SCRIPT,
|
|
@@ -7937,7 +7945,7 @@ export {
|
|
|
7937
7945
|
z as Address,
|
|
7938
7946
|
de as AddressGenerator,
|
|
7939
7947
|
Fe as AddressMap,
|
|
7940
|
-
|
|
7948
|
+
Mr as AddressSet,
|
|
7941
7949
|
ct as AddressTypes,
|
|
7942
7950
|
Et as AddressVerificator,
|
|
7943
7951
|
kt as BIPStandard,
|
|
@@ -7974,7 +7982,7 @@ export {
|
|
|
7974
7982
|
Wt as FastMap,
|
|
7975
7983
|
J as FeaturePriority,
|
|
7976
7984
|
q as Features,
|
|
7977
|
-
|
|
7985
|
+
Nt as FundingTransaction,
|
|
7978
7986
|
tt as Generator,
|
|
7979
7987
|
St as HashCommitmentGenerator,
|
|
7980
7988
|
as as I128_BYTE_LENGTH,
|
|
@@ -7983,7 +7991,7 @@ export {
|
|
|
7983
7991
|
us as I32_BYTE_LENGTH,
|
|
7984
7992
|
cs as I64_BYTE_LENGTH,
|
|
7985
7993
|
hs as I8_BYTE_LENGTH,
|
|
7986
|
-
|
|
7994
|
+
Mt as InteractionTransaction,
|
|
7987
7995
|
ri as InteractionTransactionP2WDA,
|
|
7988
7996
|
gs as LEAF_VERSION_TAPSCRIPT,
|
|
7989
7997
|
ur as LegacyCalldataGenerator,
|
|
@@ -8015,7 +8023,7 @@ export {
|
|
|
8015
8023
|
Jr as SELECTOR_BYTE_LENGTH,
|
|
8016
8024
|
ws as SERIALIZATION_FORMAT_VERSION,
|
|
8017
8025
|
ys as SERIALIZATION_MAGIC_BYTE,
|
|
8018
|
-
|
|
8026
|
+
Me as Secp256k1PointDeriver,
|
|
8019
8027
|
ye as SharedInteractionTransaction,
|
|
8020
8028
|
te as SignatureType,
|
|
8021
8029
|
Vr as SigningProtocol,
|