@btc-vision/transaction 1.7.23 → 1.7.25
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 +1 -1
- package/browser/_version.d.ts +1 -1
- package/browser/btc-vision-logger.js +73 -260
- package/browser/index.js +81 -76
- package/browser/polyfills.js +3732 -3370
- package/browser/vendors.js +10697 -7231
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/keypair/Address.js +4 -4
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/documentation/README.md +0 -2
- package/package.json +21 -19
- package/src/_version.ts +1 -1
- package/src/keypair/Address.ts +7 -4
- package/src/shims/vm-browser.js +19 -0
- package/src/shims/zlib-browser.js +24 -0
- package/tsconfig.build.json +5 -0
- package/vite.config.browser.ts +4 -2
- package/build/crypto/crypto-browser.d.ts +0 -11
- package/build/crypto/crypto-browser.js +0 -56
- package/gulpfile.js +0 -42
package/browser/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { z as Te,
|
|
1
|
+
import { z as Te, o as Jt, s as vi } from "./vendors.js";
|
|
2
2
|
import { B as a, a as I } from "./polyfills.js";
|
|
3
|
-
import { i as at, b as T, p as
|
|
3
|
+
import { i as at, b as T, p as Li, a as dt, c as te, t as O, d as st, e as rt, f as k, g as ve, h as ee, j as St, k as Ie, l as ki, o as g, m as F, n as Dt, q as jt, r as Le, s as Ui, u as G, v as ft, w as _i, x as Ki, y as ke, z as xt, A as Yt, B as Ue, C as Di, D as _e, P as v, E as Ci, F as Pe, G as Ri, H as Ee, I as Fi, J as Wi, K as Mi, L as Ni, M as _, T as ie, N as Hi } from "./btc-vision-bitcoin.js";
|
|
4
4
|
import { f as Q, s as Vi, d as Ct, g as Ft, b as zi, c as qi, e as $i } from "./bitcoin-utils.js";
|
|
5
5
|
import { b as Ae, c as P } from "./btc-vision-bip32.js";
|
|
6
6
|
import { s as Xi, m as Yi, e as Gi } from "./noble-curves.js";
|
|
7
7
|
import { A as Qi, z as oe, x as ji, u as Zi } from "./noble-hashes.js";
|
|
8
|
-
import {
|
|
8
|
+
import { L as Ke } from "./btc-vision-logger.js";
|
|
9
9
|
import { s as gt } from "./bip39.js";
|
|
10
|
-
const Ji = "1.7.
|
|
10
|
+
const Ji = "1.7.25";
|
|
11
11
|
class N {
|
|
12
12
|
static {
|
|
13
13
|
this.zlibOptions = {
|
|
@@ -93,7 +93,7 @@ class A {
|
|
|
93
93
|
static generateMultiSigAddress(t, e, i = T) {
|
|
94
94
|
const r = this.verifyPubKeys(t, i);
|
|
95
95
|
if (r.length !== t.length) throw new Error("Contains invalid public keys");
|
|
96
|
-
const s =
|
|
96
|
+
const s = Li({
|
|
97
97
|
m: e,
|
|
98
98
|
pubkeys: r,
|
|
99
99
|
network: i
|
|
@@ -171,7 +171,7 @@ class A {
|
|
|
171
171
|
]);
|
|
172
172
|
if (r.length < 2 || r.length > 40)
|
|
173
173
|
throw new Error("Witness program must be 2-40 bytes.");
|
|
174
|
-
const s =
|
|
174
|
+
const s = k([g.OP_16, r]);
|
|
175
175
|
return ve(s, e);
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
@@ -315,7 +315,7 @@ class A {
|
|
|
315
315
|
* @returns {string} - The legacy address
|
|
316
316
|
*/
|
|
317
317
|
static getP2PKAddress(t, e = T) {
|
|
318
|
-
const i =
|
|
318
|
+
const i = ki({ pubkey: a.from(t.publicKey), network: e });
|
|
319
319
|
if (!i.output)
|
|
320
320
|
throw new Error("Failed to generate wallet");
|
|
321
321
|
return "0x" + i.output.toString("hex");
|
|
@@ -518,7 +518,7 @@ class q {
|
|
|
518
518
|
static generateP2WDAAddress(t, e) {
|
|
519
519
|
if (t.length !== 33)
|
|
520
520
|
throw new Error("Public key must be 33 bytes (compressed)");
|
|
521
|
-
const i =
|
|
521
|
+
const i = k([
|
|
522
522
|
g.OP_2DROP,
|
|
523
523
|
g.OP_2DROP,
|
|
524
524
|
g.OP_2DROP,
|
|
@@ -1043,8 +1043,8 @@ class M {
|
|
|
1043
1043
|
return s.address;
|
|
1044
1044
|
}
|
|
1045
1045
|
static generateTimeLockScript(t, e = M.CSV_BLOCKS) {
|
|
1046
|
-
return
|
|
1047
|
-
|
|
1046
|
+
return k([
|
|
1047
|
+
Le.encode(e),
|
|
1048
1048
|
g.OP_CHECKSEQUENCEVERIFY,
|
|
1049
1049
|
g.OP_DROP,
|
|
1050
1050
|
t,
|
|
@@ -1052,7 +1052,7 @@ class M {
|
|
|
1052
1052
|
]);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
class
|
|
1055
|
+
class L extends Uint8Array {
|
|
1056
1056
|
#t;
|
|
1057
1057
|
#e;
|
|
1058
1058
|
#s;
|
|
@@ -1072,7 +1072,14 @@ class k extends Uint8Array {
|
|
|
1072
1072
|
// After processing, this is 32-byte tweaked x-only (same as original behavior)
|
|
1073
1073
|
#c;
|
|
1074
1074
|
constructor(t, e) {
|
|
1075
|
-
super(D), t
|
|
1075
|
+
if (super(D), !!t) {
|
|
1076
|
+
if (e) {
|
|
1077
|
+
if (![D, 33, 65].includes(e.length))
|
|
1078
|
+
throw new Error(`Invalid public key length ${e.length}`);
|
|
1079
|
+
this.#d = new Uint8Array(e.length), this.#d.set(e);
|
|
1080
|
+
}
|
|
1081
|
+
this.setMldsaKey(t);
|
|
1082
|
+
}
|
|
1076
1083
|
}
|
|
1077
1084
|
get mldsaLevel() {
|
|
1078
1085
|
return this.#p;
|
|
@@ -1113,7 +1120,7 @@ class k extends Uint8Array {
|
|
|
1113
1120
|
return this.#u;
|
|
1114
1121
|
}
|
|
1115
1122
|
static dead() {
|
|
1116
|
-
return
|
|
1123
|
+
return L.fromString(
|
|
1117
1124
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
1118
1125
|
// DEAD ADDRESS
|
|
1119
1126
|
"0x04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"
|
|
@@ -1140,7 +1147,7 @@ class k extends Uint8Array {
|
|
|
1140
1147
|
);
|
|
1141
1148
|
i = a.from(e, "hex");
|
|
1142
1149
|
}
|
|
1143
|
-
return new
|
|
1150
|
+
return new L(a.from(t, "hex"), i);
|
|
1144
1151
|
}
|
|
1145
1152
|
/**
|
|
1146
1153
|
* Create an address from a public key
|
|
@@ -1148,7 +1155,7 @@ class k extends Uint8Array {
|
|
|
1148
1155
|
* @param {ArrayLike<number>} bytes The public key
|
|
1149
1156
|
*/
|
|
1150
1157
|
static wrap(t) {
|
|
1151
|
-
return new
|
|
1158
|
+
return new L(t);
|
|
1152
1159
|
}
|
|
1153
1160
|
static uncompressedToCompressed(t) {
|
|
1154
1161
|
const e = Uint8Array.from(t), i = e.slice(1, 33), r = e.slice(33), s = a.alloc(33);
|
|
@@ -1175,7 +1182,7 @@ class k extends Uint8Array {
|
|
|
1175
1182
|
*/
|
|
1176
1183
|
static fromBigInt(t) {
|
|
1177
1184
|
const e = new Uint8Array(32), i = new DataView(e.buffer);
|
|
1178
|
-
return i.setBigUint64(0, t >> 192n & 0xffffffffffffffffn, !1), i.setBigUint64(8, t >> 128n & 0xffffffffffffffffn, !1), i.setBigUint64(16, t >> 64n & 0xffffffffffffffffn, !1), i.setBigUint64(24, t & 0xffffffffffffffffn, !1), new
|
|
1185
|
+
return i.setBigUint64(0, t >> 192n & 0xffffffffffffffffn, !1), i.setBigUint64(8, t >> 128n & 0xffffffffffffffffn, !1), i.setBigUint64(16, t >> 64n & 0xffffffffffffffffn, !1), i.setBigUint64(24, t & 0xffffffffffffffffn, !1), new L(e);
|
|
1179
1186
|
}
|
|
1180
1187
|
/**
|
|
1181
1188
|
* Creates an Address instance from four 64-bit unsigned integers.
|
|
@@ -1205,7 +1212,7 @@ class k extends Uint8Array {
|
|
|
1205
1212
|
*/
|
|
1206
1213
|
static fromUint64Array(t, e, i, r) {
|
|
1207
1214
|
const s = new Uint8Array(32), o = new DataView(s.buffer);
|
|
1208
|
-
return o.setBigUint64(0, t, !1), o.setBigUint64(8, e, !1), o.setBigUint64(16, i, !1), o.setBigUint64(24, r, !1), new
|
|
1215
|
+
return o.setBigUint64(0, t, !1), o.setBigUint64(8, e, !1), o.setBigUint64(16, i, !1), o.setBigUint64(24, r, !1), new L(s);
|
|
1209
1216
|
}
|
|
1210
1217
|
/**
|
|
1211
1218
|
* Converts the address to four 64-bit unsigned integers.
|
|
@@ -1574,14 +1581,12 @@ class k extends Uint8Array {
|
|
|
1574
1581
|
if (this.#g) return;
|
|
1575
1582
|
this.#g = !0;
|
|
1576
1583
|
const t = this.#d;
|
|
1577
|
-
if (
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
} else
|
|
1584
|
-
this.autoFormat(t);
|
|
1584
|
+
if (t)
|
|
1585
|
+
if (t.length === D) {
|
|
1586
|
+
const e = a.alloc(D);
|
|
1587
|
+
e.set(t), this.#n = re.generateHybridKeyFromHash(e), this.#c = t;
|
|
1588
|
+
} else
|
|
1589
|
+
this.autoFormat(t);
|
|
1585
1590
|
}
|
|
1586
1591
|
/**
|
|
1587
1592
|
* Processes a 33 or 65 byte public key, performing EC operations.
|
|
@@ -1589,7 +1594,7 @@ class k extends Uint8Array {
|
|
|
1589
1594
|
*/
|
|
1590
1595
|
autoFormat(t) {
|
|
1591
1596
|
const e = t[0];
|
|
1592
|
-
e === 3 || e === 2 || (e === 4 || e === 6 || e === 7) && (t =
|
|
1597
|
+
e === 3 || e === 2 || (e === 4 || e === 6 || e === 7) && (t = L.uncompressedToCompressed(t)), this.#i = Uint8Array.from(t), this.#u = A.fromPublicKey(this.#i), this.#r = Ui(this.#i);
|
|
1593
1598
|
const i = O(
|
|
1594
1599
|
A.tweakPublicKey(a.from(this.#i))
|
|
1595
1600
|
);
|
|
@@ -1694,11 +1699,11 @@ class Re {
|
|
|
1694
1699
|
*/
|
|
1695
1700
|
*entries() {
|
|
1696
1701
|
for (const [t, e] of this.items.entries())
|
|
1697
|
-
yield [
|
|
1702
|
+
yield [L.fromBigInt(t), e];
|
|
1698
1703
|
}
|
|
1699
1704
|
*keys() {
|
|
1700
1705
|
for (const t of this.items.keys())
|
|
1701
|
-
yield
|
|
1706
|
+
yield L.fromBigInt(t);
|
|
1702
1707
|
}
|
|
1703
1708
|
*values() {
|
|
1704
1709
|
for (const t of this.items.values())
|
|
@@ -1706,7 +1711,7 @@ class Re {
|
|
|
1706
1711
|
}
|
|
1707
1712
|
forEach(t, e) {
|
|
1708
1713
|
for (const [i, r] of this.items.entries()) {
|
|
1709
|
-
const s =
|
|
1714
|
+
const s = L.fromBigInt(i);
|
|
1710
1715
|
t.call(e, r, s, this);
|
|
1711
1716
|
}
|
|
1712
1717
|
}
|
|
@@ -1854,7 +1859,7 @@ class Gt {
|
|
|
1854
1859
|
*/
|
|
1855
1860
|
readAddress() {
|
|
1856
1861
|
const t = Array.from(this.readBytes(D));
|
|
1857
|
-
return new
|
|
1862
|
+
return new L(t);
|
|
1858
1863
|
}
|
|
1859
1864
|
/**
|
|
1860
1865
|
* Reads bytes written as [u32 length][bytes].
|
|
@@ -2235,7 +2240,7 @@ class $ {
|
|
|
2235
2240
|
const i = new C();
|
|
2236
2241
|
i.writeU16(Object.keys(t.data).length);
|
|
2237
2242
|
for (const r in t.data) {
|
|
2238
|
-
const s =
|
|
2243
|
+
const s = L.fromString(r), o = t.data[r];
|
|
2239
2244
|
i.writeAddress(s), i.writeU32(o.length);
|
|
2240
2245
|
for (const c of o) {
|
|
2241
2246
|
const u = a.from(c, "base64");
|
|
@@ -2347,7 +2352,7 @@ class ae extends $ {
|
|
|
2347
2352
|
g.OP_1,
|
|
2348
2353
|
g.OP_ENDIF
|
|
2349
2354
|
);
|
|
2350
|
-
const l = h.flat(), d =
|
|
2355
|
+
const l = h.flat(), d = k(l);
|
|
2351
2356
|
if (!F(d))
|
|
2352
2357
|
throw new Error("Failed to decompile script??");
|
|
2353
2358
|
return d;
|
|
@@ -2364,7 +2369,7 @@ class Fe extends $ {
|
|
|
2364
2369
|
* @throws {Error} - If something goes wrong
|
|
2365
2370
|
*/
|
|
2366
2371
|
compile(t) {
|
|
2367
|
-
const e = t.flat(), i =
|
|
2372
|
+
const e = t.flat(), i = k(e);
|
|
2368
2373
|
if (!F(i))
|
|
2369
2374
|
throw new Error("Failed to decompile script??");
|
|
2370
2375
|
return i;
|
|
@@ -2393,7 +2398,7 @@ class Nt extends $ {
|
|
|
2393
2398
|
r,
|
|
2394
2399
|
s,
|
|
2395
2400
|
o
|
|
2396
|
-
), u =
|
|
2401
|
+
), u = k(c);
|
|
2397
2402
|
if (!F(u))
|
|
2398
2403
|
throw new Error("Failed to decompile script??");
|
|
2399
2404
|
return u;
|
|
@@ -2676,7 +2681,7 @@ class E extends Ke {
|
|
|
2676
2681
|
const e = [];
|
|
2677
2682
|
for (let i = t.length - 1; i >= 0; i--)
|
|
2678
2683
|
e.push(g.OP_HASH160), e.push(t[i]), e.push(g.OP_EQUALVERIFY);
|
|
2679
|
-
return e.push(this.publicKey), e.push(g.OP_CHECKSIG),
|
|
2684
|
+
return e.push(this.publicKey), e.push(g.OP_CHECKSIG), k(e);
|
|
2680
2685
|
}
|
|
2681
2686
|
/**
|
|
2682
2687
|
* Generate a P2WSH address from a witness script.
|
|
@@ -2817,7 +2822,7 @@ class dr extends $ {
|
|
|
2817
2822
|
g.OP_1,
|
|
2818
2823
|
g.OP_ENDIF
|
|
2819
2824
|
);
|
|
2820
|
-
const l = h.flat(), d =
|
|
2825
|
+
const l = h.flat(), d = k(l);
|
|
2821
2826
|
if (!F(d))
|
|
2822
2827
|
throw new Error("Failed to decompile script??");
|
|
2823
2828
|
return d;
|
|
@@ -2860,7 +2865,7 @@ class At {
|
|
|
2860
2865
|
r,
|
|
2861
2866
|
g.OP_NUMEQUAL
|
|
2862
2867
|
// Use NUMEQUALVERIFY to ensure the correct number of signatures
|
|
2863
|
-
].flat(), h =
|
|
2868
|
+
].flat(), h = k(u);
|
|
2864
2869
|
if (!F(h))
|
|
2865
2870
|
throw new Error("Failed to decompile script.");
|
|
2866
2871
|
return h;
|
|
@@ -2970,7 +2975,7 @@ class et {
|
|
|
2970
2975
|
t.priorityFee,
|
|
2971
2976
|
t.calldata,
|
|
2972
2977
|
t.features
|
|
2973
|
-
), s =
|
|
2978
|
+
), s = k([
|
|
2974
2979
|
O(t.deployerPubKey),
|
|
2975
2980
|
g.OP_CHECKSIG
|
|
2976
2981
|
]), o = [
|
|
@@ -2997,7 +3002,7 @@ class et {
|
|
|
2997
3002
|
t.priorityFee,
|
|
2998
3003
|
t.calldata,
|
|
2999
3004
|
t.features
|
|
3000
|
-
), o =
|
|
3005
|
+
), o = k([
|
|
3001
3006
|
O(t.deployerPubKey),
|
|
3002
3007
|
g.OP_CHECKSIG
|
|
3003
3008
|
]), c = [
|
|
@@ -3060,7 +3065,7 @@ function Ne(n) {
|
|
|
3060
3065
|
}
|
|
3061
3066
|
class fr {
|
|
3062
3067
|
sha256(t) {
|
|
3063
|
-
return
|
|
3068
|
+
return ke(a.from(t));
|
|
3064
3069
|
}
|
|
3065
3070
|
/**
|
|
3066
3071
|
* Attempts to sign a message using OP_WALLET if available in browser environment.
|
|
@@ -3319,7 +3324,7 @@ class J {
|
|
|
3319
3324
|
);
|
|
3320
3325
|
} else
|
|
3321
3326
|
this._mldsaKeypair = P.QuantumBIP32Factory.fromBase58(c), this._chainCode = a.from(this._mldsaKeypair.chainCode), this._securityLevel = this._mldsaKeypair.securityLevel;
|
|
3322
|
-
this._bufferPubKey = this._keypair.publicKey, this._address = new
|
|
3327
|
+
this._bufferPubKey = this._keypair.publicKey, this._address = new L(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();
|
|
3323
3328
|
}
|
|
3324
3329
|
/**
|
|
3325
3330
|
* Get the address for the wallet
|
|
@@ -3888,9 +3893,9 @@ function yr() {
|
|
|
3888
3893
|
signerMap: /* @__PURE__ */ new Map()
|
|
3889
3894
|
};
|
|
3890
3895
|
}
|
|
3891
|
-
var y = /* @__PURE__ */ ((n) => (n[n.GENERIC = 0] = "GENERIC", n[n.FUNDING = 1] = "FUNDING", n[n.DEPLOYMENT = 2] = "DEPLOYMENT", n[n.INTERACTION = 3] = "INTERACTION", n[n.MULTI_SIG = 4] = "MULTI_SIG", n[n.CUSTOM_CODE = 5] = "CUSTOM_CODE", n[n.CANCEL = 6] = "CANCEL", n[n.CONSOLIDATED_SETUP = 7] = "CONSOLIDATED_SETUP", n[n.CONSOLIDATED_REVEAL = 8] = "CONSOLIDATED_REVEAL", n))(y || {}),
|
|
3896
|
+
var y = /* @__PURE__ */ ((n) => (n[n.GENERIC = 0] = "GENERIC", n[n.FUNDING = 1] = "FUNDING", n[n.DEPLOYMENT = 2] = "DEPLOYMENT", n[n.INTERACTION = 3] = "INTERACTION", n[n.MULTI_SIG = 4] = "MULTI_SIG", n[n.CUSTOM_CODE = 5] = "CUSTOM_CODE", n[n.CANCEL = 6] = "CANCEL", n[n.CONSOLIDATED_SETUP = 7] = "CONSOLIDATED_SETUP", n[n.CONSOLIDATED_REVEAL = 8] = "CONSOLIDATED_REVEAL", n))(y || {}), Lt = /* @__PURE__ */ ((n) => (n[n.Roswell = 0] = "Roswell", n[n.Rachel = 1] = "Rachel", n[n.Kecksburg = 2] = "Kecksburg", n[n.Phoenix = 3] = "Phoenix", n[n.Aurora = 4] = "Aurora", n[n.Rendlesham = 5] = "Rendlesham", n[n.Lazar = 6] = "Lazar", n[n.ShagHarbor = 7] = "ShagHarbor", n[n.Exeter = 8] = "Exeter", n[n.Stephenville = 9] = "Stephenville", n[n.Valensole = 10] = "Valensole", n[n.Socorro = 11] = "Socorro", n[n.Pascagoula = 12] = "Pascagoula", n[n.Tehran = 13] = "Tehran", n[n.Westall = 14] = "Westall", n[n.Hopkinsville = 15] = "Hopkinsville", n[n.Belgium = 16] = "Belgium", n[n.Breeze = 17] = "Breeze", n[n.Flatwoods = 18] = "Flatwoods", n[n.Maury = 20] = "Maury", n[n.Varginha = 21] = "Varginha", n[n.Trindade = 22] = "Trindade", n[n.Levelland = 23] = "Levelland", n[n.Wanaque = 24] = "Wanaque", n[n.Coyame = 25] = "Coyame", n[n.Delphos = 26] = "Delphos", n))(Lt || {});
|
|
3892
3897
|
const qe = {
|
|
3893
|
-
CONSENSUS:
|
|
3898
|
+
CONSENSUS: Lt.Roswell,
|
|
3894
3899
|
CONSENSUS_NAME: "Roswell",
|
|
3895
3900
|
// The block height at which this consensus was enabled.
|
|
3896
3901
|
ENABLED_AT_BLOCK: 0n
|
|
@@ -3907,8 +3912,8 @@ const qe = {
|
|
|
3907
3912
|
// Equivalent to 56500 satoshis, calculated from UNWRAP_CONSOLIDATION_PREPAID_FEES.
|
|
3908
3913
|
//UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT: 56500n,
|
|
3909
3914
|
}, $e = {
|
|
3910
|
-
[
|
|
3911
|
-
}, Qt =
|
|
3915
|
+
[Lt.Roswell]: qe
|
|
3916
|
+
}, Qt = Lt.Roswell, mr = $e[Qt];
|
|
3912
3917
|
function le(n) {
|
|
3913
3918
|
return n && !!(n.tapInternalKey || n.tapMerkleRoot || n.tapLeafScript && n.tapLeafScript.length || n.tapBip32Derivation && n.tapBip32Derivation.length || n.witnessUtxo && Ue(n.witnessUtxo.script));
|
|
3914
3919
|
}
|
|
@@ -3925,14 +3930,14 @@ function fe(n, t) {
|
|
|
3925
3930
|
return Di(n, t) !== -1;
|
|
3926
3931
|
}
|
|
3927
3932
|
var Xe = /* @__PURE__ */ ((n) => (n[n.REPLACE_BY_FEE = 4294967293] = "REPLACE_BY_FEE", n[n.FINAL = 4294967295] = "FINAL", n))(Xe || {}), Ye = /* @__PURE__ */ ((n) => (n[n.BLOCKS = 0] = "BLOCKS", n[n.TIMESTAMPS = 1] = "TIMESTAMPS", n))(Ye || {});
|
|
3928
|
-
class
|
|
3933
|
+
class kt extends Ke {
|
|
3929
3934
|
constructor(t) {
|
|
3930
3935
|
super(), this.logColor = "#00ffe1", this.finalized = !1, this.signed = !1, this.scriptData = null, this.tapData = null, this.inputs = [], this.sequence = 4294967293, this.tapLeafScript = null, this.isBrowser = !1, this.csvInputIndices = /* @__PURE__ */ new Set(), this.anchorInputIndices = /* @__PURE__ */ new Set(), this.regenerated = !1, this.ignoreSignatureErrors = !1, this.noSignatures = !1, this.txVersion = 2, this._mldsaSigner = null, this._hashedPublicKey = null, this.addressRotationEnabled = !1, this.signerMap = /* @__PURE__ */ new Map(), this.inputSignerMap = /* @__PURE__ */ new Map(), this.tweakedSignerCache = /* @__PURE__ */ new Map(), this.customFinalizerP2SH = (e, i, r, s, o, c) => {
|
|
3931
3936
|
const u = this.inputs[e];
|
|
3932
3937
|
if (o && i.partialSig && u && u.redeemScript) {
|
|
3933
3938
|
const h = i.partialSig.map((d) => d.signature) || [];
|
|
3934
3939
|
return {
|
|
3935
|
-
finalScriptSig:
|
|
3940
|
+
finalScriptSig: k([...h, u.redeemScript]),
|
|
3936
3941
|
finalScriptWitness: void 0
|
|
3937
3942
|
};
|
|
3938
3943
|
}
|
|
@@ -4321,13 +4326,13 @@ class Lt extends Ke {
|
|
|
4321
4326
|
}).output;
|
|
4322
4327
|
}
|
|
4323
4328
|
generateP2SHRedeemScriptLegacy(t) {
|
|
4324
|
-
const e = ft(this.signer.publicKey), i =
|
|
4329
|
+
const e = ft(this.signer.publicKey), i = k([
|
|
4325
4330
|
g.OP_DUP,
|
|
4326
4331
|
g.OP_HASH160,
|
|
4327
4332
|
e,
|
|
4328
4333
|
g.OP_EQUALVERIFY,
|
|
4329
4334
|
g.OP_CHECKSIG
|
|
4330
|
-
]), r = ft(i), s =
|
|
4335
|
+
]), r = ft(i), s = k([
|
|
4331
4336
|
g.OP_HASH160,
|
|
4332
4337
|
r,
|
|
4333
4338
|
g.OP_EQUAL
|
|
@@ -4414,7 +4419,7 @@ class Lt extends Ke {
|
|
|
4414
4419
|
t.nonWitnessUtxo && (s.nonWitnessUtxo = I.isBuffer(t.nonWitnessUtxo) ? t.nonWitnessUtxo : I.from(t.nonWitnessUtxo, "hex")), Pe(u) ? delete s.nonWitnessUtxo : Ee(u) ? (delete s.nonWitnessUtxo, this.processP2WSHInput(t, s, e)) : delete s.witnessUtxo;
|
|
4415
4420
|
} else if (Ue(r)) {
|
|
4416
4421
|
if (this.sighashTypes) {
|
|
4417
|
-
const o =
|
|
4422
|
+
const o = kt.calculateSignHash(this.sighashTypes);
|
|
4418
4423
|
o && (s.sighashType = o);
|
|
4419
4424
|
}
|
|
4420
4425
|
this.addressRotationEnabled ? s.tapInternalKey = this.internalPubKeyToXOnlyForInput(e) : (this.tweakSigner(), s.tapInternalKey = this.internalPubKeyToXOnly());
|
|
@@ -4501,7 +4506,7 @@ class Lt extends Ke {
|
|
|
4501
4506
|
if (t[e] === g.OP_CHECKSEQUENCEVERIFY && e > 0) {
|
|
4502
4507
|
const i = t[e - 1];
|
|
4503
4508
|
if (I.isBuffer(i))
|
|
4504
|
-
return
|
|
4509
|
+
return Le.decode(i);
|
|
4505
4510
|
if (typeof i == "number") {
|
|
4506
4511
|
if (i === g.OP_0 || i === g.OP_FALSE)
|
|
4507
4512
|
return 0;
|
|
@@ -4577,7 +4582,7 @@ const xe = Uint8Array.from(
|
|
|
4577
4582
|
);
|
|
4578
4583
|
at(Q);
|
|
4579
4584
|
const z = 330n, wt = 297n, ne = a.from("51024e73", "hex");
|
|
4580
|
-
class m extends
|
|
4585
|
+
class m extends kt {
|
|
4581
4586
|
constructor(t) {
|
|
4582
4587
|
if (super(t), this.logColor = "#785def", this.debugFees = !1, this.overflowFees = 0n, this.transactionFee = 0n, this.estimatedFees = 0n, this.updateInputs = [], this.outputs = [], this.feeOutput = null, this._maximumFeeRate = 1e8, this.optionalOutputsAdded = !1, 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 = a.from(t.note, "utf8") : this.note = t.note), this.anchor = t.anchor ?? !1, this.isPubKeyDestination = this.to ? H.isValidPublicKey(this.to, this.network) : !1, this.optionalOutputs = t.optionalOutputs, this.from = m.getFrom(t.from, this.signer, this.network), this.totalInputAmount = this.calculateTotalUTXOAmount(), this.calculateTotalVOutAmount() < this.totalInputAmount)
|
|
4583
4588
|
throw new Error("Vout value is less than the value to send");
|
|
@@ -4616,7 +4621,7 @@ class m extends Lt {
|
|
|
4616
4621
|
return o(t), e;
|
|
4617
4622
|
}
|
|
4618
4623
|
addOPReturn(t) {
|
|
4619
|
-
const e =
|
|
4624
|
+
const e = k([g.OP_RETURN, t]);
|
|
4620
4625
|
this.addOutput({
|
|
4621
4626
|
value: 0,
|
|
4622
4627
|
script: e
|
|
@@ -4959,7 +4964,7 @@ class m extends Lt {
|
|
|
4959
4964
|
tapInternalKey: this.internalPubKeyToXOnly()
|
|
4960
4965
|
};
|
|
4961
4966
|
else if (H.isValidPublicKey(this.from, this.network)) {
|
|
4962
|
-
const h =
|
|
4967
|
+
const h = k([
|
|
4963
4968
|
a.from(this.from.replace("0x", ""), "hex"),
|
|
4964
4969
|
g.OP_CHECKSIG
|
|
4965
4970
|
]);
|
|
@@ -4993,7 +4998,7 @@ class m extends Lt {
|
|
|
4993
4998
|
);
|
|
4994
4999
|
}
|
|
4995
5000
|
defineLockScript() {
|
|
4996
|
-
return
|
|
5001
|
+
return k([O(a.from(this.signer.publicKey)), g.OP_CHECKSIG]);
|
|
4997
5002
|
}
|
|
4998
5003
|
/**
|
|
4999
5004
|
* @description Adds the value to the output
|
|
@@ -5775,7 +5780,7 @@ class pt extends m {
|
|
|
5775
5780
|
this.calldata,
|
|
5776
5781
|
this.generateFeatures(t)
|
|
5777
5782
|
);
|
|
5778
|
-
this.scriptTree = this.getScriptTree(), this.internalInit(), this._contractPubKey = "0x" + this.contractSeed.toString("hex"), this._contractAddress = new
|
|
5783
|
+
this.scriptTree = this.getScriptTree(), this.internalInit(), this._contractPubKey = "0x" + this.contractSeed.toString("hex"), this._contractAddress = new L(this.contractSeed);
|
|
5779
5784
|
}
|
|
5780
5785
|
static {
|
|
5781
5786
|
this.MAXIMUM_CONTRACT_SIZE = 128 * 1024;
|
|
@@ -6011,7 +6016,7 @@ class zt extends m {
|
|
|
6011
6016
|
if (this.addInputsFromUTXO(), this.splitInputsInto > 1)
|
|
6012
6017
|
this.splitInputs(this.amount);
|
|
6013
6018
|
else if (this.isPubKeyDestination) {
|
|
6014
|
-
const e =
|
|
6019
|
+
const e = k([
|
|
6015
6020
|
a.from(this.to.replace("0x", ""), "hex"),
|
|
6016
6021
|
g.OP_CHECKSIG
|
|
6017
6022
|
]);
|
|
@@ -7216,7 +7221,7 @@ class Qe {
|
|
|
7216
7221
|
* @returns {Promise<{finalTransaction: T, estimatedAmount: bigint, challenge: ChallengeSolution | null}>} - The final transaction and estimated amount
|
|
7217
7222
|
*/
|
|
7218
7223
|
async iterateFundingAmount(t, e, i, r) {
|
|
7219
|
-
const s = "randomBytes" in t ? t.randomBytes ?? K.rndBytes() : K.rndBytes(), o =
|
|
7224
|
+
const s = "randomBytes" in t ? t.randomBytes ?? K.rndBytes() : K.rndBytes(), o = L.dead().p2tr(t.network);
|
|
7220
7225
|
let c = this.INITIAL_FUNDING_ESTIMATE, u = 0n, h = 0, l = null, d = null;
|
|
7221
7226
|
for (; h < this.MAX_ITERATIONS && c !== u; ) {
|
|
7222
7227
|
u = c;
|
|
@@ -7302,7 +7307,7 @@ class x extends m {
|
|
|
7302
7307
|
if (super({
|
|
7303
7308
|
...t,
|
|
7304
7309
|
signer: A.fromPrivateKey(
|
|
7305
|
-
|
|
7310
|
+
ke(a.from("aaaaaaaa", "utf-8"))
|
|
7306
7311
|
),
|
|
7307
7312
|
priorityFee: 0n,
|
|
7308
7313
|
gasSatFee: 0n
|
|
@@ -7321,7 +7326,7 @@ class x extends m {
|
|
|
7321
7326
|
), this.scriptTree = this.getScriptTree(), this.internalInit();
|
|
7322
7327
|
}
|
|
7323
7328
|
static {
|
|
7324
|
-
this.LOCK_LEAF_SCRIPT =
|
|
7329
|
+
this.LOCK_LEAF_SCRIPT = k([
|
|
7325
7330
|
g.OP_XOR,
|
|
7326
7331
|
g.OP_NOP,
|
|
7327
7332
|
g.OP_CODESEPARATOR
|
|
@@ -8549,7 +8554,7 @@ class ii {
|
|
|
8549
8554
|
}
|
|
8550
8555
|
class ri {
|
|
8551
8556
|
constructor(t, e) {
|
|
8552
|
-
this.epochNumber = e, this.publicKey =
|
|
8557
|
+
this.epochNumber = e, this.publicKey = L.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = V(t.solution), this.graffiti = t.graffiti ? V(t.graffiti) : void 0, this.signature = V(t.signature);
|
|
8553
8558
|
}
|
|
8554
8559
|
verifySignature() {
|
|
8555
8560
|
const t = new C();
|
|
@@ -8564,7 +8569,7 @@ class ri {
|
|
|
8564
8569
|
}
|
|
8565
8570
|
class $t {
|
|
8566
8571
|
constructor(t) {
|
|
8567
|
-
this.epochNumber = BigInt(t.epochNumber), this.publicKey =
|
|
8572
|
+
this.epochNumber = BigInt(t.epochNumber), this.publicKey = L.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = V(t.solution), this.salt = V(t.salt), this.graffiti = V(t.graffiti), this.difficulty = t.difficulty, this.verification = new ii(t.verification), this.submission = t.submission ? new ri(t.submission, this.epochNumber + 2n) : t.submission;
|
|
8568
8573
|
}
|
|
8569
8574
|
/**
|
|
8570
8575
|
* Static method to validate from raw data directly
|
|
@@ -9482,7 +9487,7 @@ class Pr {
|
|
|
9482
9487
|
return new UnwrapGeneration(result as UnwrappedGenerationParameters);
|
|
9483
9488
|
}*/
|
|
9484
9489
|
}
|
|
9485
|
-
class Tt extends
|
|
9490
|
+
class Tt extends kt {
|
|
9486
9491
|
constructor(t) {
|
|
9487
9492
|
super(t), this.logColor = "#00ffe1", this.feesAddition = 10000n, this.sighashTypes = [], this.signer = t.signer, this.network = t.network, this.transaction = t.psbt, this.ignoreSignatureError(), this.tweakSigner(), this.internalInit();
|
|
9488
9493
|
}
|
|
@@ -10051,7 +10056,7 @@ function vr(n, t) {
|
|
|
10051
10056
|
if (r === null) throw new Error("Unknown script error");
|
|
10052
10057
|
return r.findIndex((s) => typeof s == "number" ? !1 : a.isBuffer(s) && (s.equals(n) || s.equals(e) || s.equals(i)));
|
|
10053
10058
|
}
|
|
10054
|
-
class
|
|
10059
|
+
class Lr extends be {
|
|
10055
10060
|
constructor() {
|
|
10056
10061
|
if (super(), this.isInitialized = !1, !window)
|
|
10057
10062
|
throw new Error("XverseSigner can only be used in a browser environment");
|
|
@@ -10241,7 +10246,7 @@ class kr extends be {
|
|
|
10241
10246
|
}
|
|
10242
10247
|
var ui = /* @__PURE__ */ ((n) => (n.mainnet = "mainnet", n.testnet = "testnet", n.signet = "Signet", n))(ui || {}), hi = /* @__PURE__ */ ((n) => (n.ECDSA = "ECDSA", n.BIP322 = "BIP322", n))(hi || {});
|
|
10243
10248
|
function R() {
|
|
10244
|
-
return
|
|
10249
|
+
return L.dead();
|
|
10245
10250
|
}
|
|
10246
10251
|
const li = R(), di = R(), fi = R(), pi = R(), gi = R(), Si = R(), wi = R(), yi = R(), mi = R(), bi = R(), Ti = R(), Ii = R(), Pi = R(), Ei = R(), Ai = R();
|
|
10247
10252
|
var Oi = /* @__PURE__ */ ((n) => (n.Mainnet = "mainnet", n.Testnet = "testnet", n.Regtest = "regtest", n))(Oi || {});
|
|
@@ -10316,7 +10321,7 @@ class Bi {
|
|
|
10316
10321
|
return i;
|
|
10317
10322
|
}
|
|
10318
10323
|
}
|
|
10319
|
-
const
|
|
10324
|
+
const kr = new Bi();
|
|
10320
10325
|
class Xt {
|
|
10321
10326
|
constructor() {
|
|
10322
10327
|
this._size = 0, this.capacity = Xt.INITIAL_CAPACITY, this.#t = new Array(this.capacity), this.#e = new Array(this.capacity), this.deleted = new Array(this.capacity).fill(!1);
|
|
@@ -10483,7 +10488,7 @@ const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10483
10488
|
ABIDataTypes: ni,
|
|
10484
10489
|
ADDRESS_BYTE_LENGTH: D,
|
|
10485
10490
|
ANCHOR_SCRIPT: ne,
|
|
10486
|
-
Address:
|
|
10491
|
+
Address: L,
|
|
10487
10492
|
AddressGenerator: ce,
|
|
10488
10493
|
AddressMap: Re,
|
|
10489
10494
|
AddressSet: we,
|
|
@@ -10503,7 +10508,7 @@ const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10503
10508
|
ChallengeSubmission: ri,
|
|
10504
10509
|
ChallengeVerification: ii,
|
|
10505
10510
|
Compressor: N,
|
|
10506
|
-
Consensus:
|
|
10511
|
+
Consensus: Lt,
|
|
10507
10512
|
ConsolidatedInteractionTransaction: Ge,
|
|
10508
10513
|
ContractAddress: re,
|
|
10509
10514
|
ContractBaseMetadata: Sr,
|
|
@@ -10552,7 +10557,7 @@ const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10552
10557
|
OPNET_DEPLOYMENT_VERSION: We,
|
|
10553
10558
|
OPNetConsensusConfig: $e,
|
|
10554
10559
|
OPNetLimitedProvider: Pr,
|
|
10555
|
-
OPNetMetadata:
|
|
10560
|
+
OPNetMetadata: kr,
|
|
10556
10561
|
OPNetNetwork: Oi,
|
|
10557
10562
|
OPNetTokenAddressManager: Bi,
|
|
10558
10563
|
OfflineTransactionManager: Ir,
|
|
@@ -10590,7 +10595,7 @@ const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10590
10595
|
TransactionStateCapture: X,
|
|
10591
10596
|
TransactionType: y,
|
|
10592
10597
|
TweakedSigner: ue,
|
|
10593
|
-
TweakedTransaction:
|
|
10598
|
+
TweakedTransaction: kt,
|
|
10594
10599
|
U128_BYTE_LENGTH: yt,
|
|
10595
10600
|
U16_BYTE_LENGTH: Et,
|
|
10596
10601
|
U256_BYTE_LENGTH: Pt,
|
|
@@ -10605,7 +10610,7 @@ const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10605
10610
|
WBTC_ADDRESS_TESTNET: yi,
|
|
10606
10611
|
Wallet: J,
|
|
10607
10612
|
XverseNetwork: ui,
|
|
10608
|
-
XverseSigner:
|
|
10613
|
+
XverseSigner: Lr,
|
|
10609
10614
|
buildBIPPath: He,
|
|
10610
10615
|
createAddressRotation: wr,
|
|
10611
10616
|
createSignerMap: ze,
|
|
@@ -10630,7 +10635,7 @@ export {
|
|
|
10630
10635
|
ni as ABIDataTypes,
|
|
10631
10636
|
D as ADDRESS_BYTE_LENGTH,
|
|
10632
10637
|
ne as ANCHOR_SCRIPT,
|
|
10633
|
-
|
|
10638
|
+
L as Address,
|
|
10634
10639
|
ce as AddressGenerator,
|
|
10635
10640
|
Re as AddressMap,
|
|
10636
10641
|
we as AddressSet,
|
|
@@ -10650,7 +10655,7 @@ export {
|
|
|
10650
10655
|
ri as ChallengeSubmission,
|
|
10651
10656
|
ii as ChallengeVerification,
|
|
10652
10657
|
N as Compressor,
|
|
10653
|
-
|
|
10658
|
+
Lt as Consensus,
|
|
10654
10659
|
Ge as ConsolidatedInteractionTransaction,
|
|
10655
10660
|
re as ContractAddress,
|
|
10656
10661
|
Sr as ContractBaseMetadata,
|
|
@@ -10699,7 +10704,7 @@ export {
|
|
|
10699
10704
|
We as OPNET_DEPLOYMENT_VERSION,
|
|
10700
10705
|
$e as OPNetConsensusConfig,
|
|
10701
10706
|
Pr as OPNetLimitedProvider,
|
|
10702
|
-
|
|
10707
|
+
kr as OPNetMetadata,
|
|
10703
10708
|
Oi as OPNetNetwork,
|
|
10704
10709
|
Bi as OPNetTokenAddressManager,
|
|
10705
10710
|
Ir as OfflineTransactionManager,
|
|
@@ -10737,7 +10742,7 @@ export {
|
|
|
10737
10742
|
X as TransactionStateCapture,
|
|
10738
10743
|
y as TransactionType,
|
|
10739
10744
|
ue as TweakedSigner,
|
|
10740
|
-
|
|
10745
|
+
kt as TweakedTransaction,
|
|
10741
10746
|
yt as U128_BYTE_LENGTH,
|
|
10742
10747
|
Et as U16_BYTE_LENGTH,
|
|
10743
10748
|
Pt as U256_BYTE_LENGTH,
|
|
@@ -10752,7 +10757,7 @@ export {
|
|
|
10752
10757
|
yi as WBTC_ADDRESS_TESTNET,
|
|
10753
10758
|
J as Wallet,
|
|
10754
10759
|
ui as XverseNetwork,
|
|
10755
|
-
|
|
10760
|
+
Lr as XverseSigner,
|
|
10756
10761
|
He as buildBIPPath,
|
|
10757
10762
|
wr as createAddressRotation,
|
|
10758
10763
|
ze as createSignerMap,
|