@btc-vision/transaction 1.8.0-rc.1 → 1.8.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/_version.d.ts +1 -1
- package/browser/_version.d.ts.map +1 -1
- package/browser/btc-vision-bitcoin.js +3560 -3170
- package/browser/buffer/BinaryWriter.d.ts +1 -1
- package/browser/buffer/BinaryWriter.d.ts.map +1 -1
- package/browser/bytecode/Compressor.d.ts +6 -6
- package/browser/bytecode/Compressor.d.ts.map +1 -1
- package/browser/epoch/ChallengeSolution.d.ts +14 -14
- package/browser/epoch/ChallengeSolution.d.ts.map +1 -1
- package/browser/generators/MLDSAData.d.ts +4 -4
- package/browser/generators/MLDSAData.d.ts.map +1 -1
- package/browser/index.js +966 -967
- package/browser/noble-curves.js +1 -1
- package/browser/noble-hashes.js +867 -1758
- package/browser/transaction/browser/types/Unisat.d.ts +1 -1
- package/browser/transaction/browser/types/Unisat.d.ts.map +1 -1
- package/browser/transaction/builders/CustomScriptTransaction.d.ts +1 -1
- package/browser/transaction/builders/DeploymentTransaction.d.ts +2 -2
- package/browser/transaction/builders/MultiSignTransaction.d.ts +5 -5
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +5 -5
- package/browser/transaction/builders/TransactionBuilder.d.ts +4 -4
- package/browser/transaction/offline/OfflineTransactionManager.d.ts +1 -1
- package/browser/transaction/shared/P2TR_MS.d.ts +1 -1
- package/browser/transaction/shared/TweakedTransaction.d.ts +2 -2
- package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -1
- package/browser/utils/BitcoinUtils.d.ts +5 -5
- package/browser/utils/BitcoinUtils.d.ts.map +1 -1
- package/browser/utils/BufferHelper.d.ts +1 -1
- package/browser/utils/BufferHelper.d.ts.map +1 -1
- package/browser/utils/StringToBuffer.d.ts +1 -1
- package/browser/utils/StringToBuffer.d.ts.map +1 -1
- package/browser/utils/types.d.ts +1 -1
- package/browser/utils/types.d.ts.map +1 -1
- package/browser/utxo/OPNetLimitedProvider.d.ts.map +1 -1
- package/browser/vendors.js +7732 -13160
- package/build/_version.d.ts +1 -1
- package/build/_version.d.ts.map +1 -1
- package/build/_version.js +1 -1
- package/build/_version.js.map +1 -1
- package/build/abi/ABICoder.js +3 -3
- package/build/abi/ABICoder.js.map +1 -1
- package/build/buffer/BinaryReader.js +1 -1
- package/build/buffer/BinaryReader.js.map +1 -1
- package/build/buffer/BinaryWriter.d.ts +1 -1
- package/build/buffer/BinaryWriter.d.ts.map +1 -1
- package/build/buffer/BinaryWriter.js.map +1 -1
- package/build/bytecode/Compressor.d.ts +6 -6
- package/build/bytecode/Compressor.d.ts.map +1 -1
- package/build/bytecode/Compressor.js +6 -6
- package/build/bytecode/Compressor.js.map +1 -1
- package/build/epoch/ChallengeSolution.d.ts +14 -14
- package/build/epoch/ChallengeSolution.d.ts.map +1 -1
- package/build/epoch/ChallengeSolution.js +11 -10
- package/build/epoch/ChallengeSolution.js.map +1 -1
- package/build/generators/MLDSAData.d.ts +4 -4
- package/build/generators/MLDSAData.d.ts.map +1 -1
- package/build/transaction/browser/types/Unisat.d.ts +1 -1
- package/build/transaction/browser/types/Unisat.d.ts.map +1 -1
- package/build/transaction/builders/CancelTransaction.js +1 -1
- package/build/transaction/builders/CancelTransaction.js.map +1 -1
- package/build/transaction/builders/ChallengeSolutionTransaction.js +5 -5
- package/build/transaction/builders/CustomScriptTransaction.d.ts +1 -1
- package/build/transaction/builders/CustomScriptTransaction.js +1 -1
- package/build/transaction/builders/DeploymentTransaction.d.ts +2 -2
- package/build/transaction/builders/DeploymentTransaction.js +2 -2
- package/build/transaction/builders/MultiSignTransaction.d.ts +5 -5
- package/build/transaction/builders/MultiSignTransaction.js +5 -5
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +5 -5
- package/build/transaction/builders/SharedInteractionTransaction.js +5 -5
- package/build/transaction/builders/TransactionBuilder.d.ts +4 -4
- package/build/transaction/builders/TransactionBuilder.js +4 -4
- package/build/transaction/offline/OfflineTransactionManager.d.ts +1 -1
- package/build/transaction/offline/OfflineTransactionManager.js +1 -1
- package/build/transaction/shared/P2TR_MS.d.ts +1 -1
- package/build/transaction/shared/P2TR_MS.js +1 -1
- package/build/transaction/shared/TweakedTransaction.d.ts +2 -2
- package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -1
- package/build/transaction/shared/TweakedTransaction.js +2 -13
- package/build/transaction/shared/TweakedTransaction.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utils/BitcoinUtils.d.ts +5 -5
- package/build/utils/BitcoinUtils.d.ts.map +1 -1
- package/build/utils/BitcoinUtils.js +7 -7
- package/build/utils/BitcoinUtils.js.map +1 -1
- package/build/utils/BufferHelper.d.ts +1 -1
- package/build/utils/BufferHelper.d.ts.map +1 -1
- package/build/utils/BufferHelper.js.map +1 -1
- package/build/utils/StringToBuffer.d.ts +1 -1
- package/build/utils/StringToBuffer.d.ts.map +1 -1
- package/build/utils/StringToBuffer.js +2 -1
- package/build/utils/StringToBuffer.js.map +1 -1
- package/build/utils/types.d.ts +1 -1
- package/build/utils/types.d.ts.map +1 -1
- package/build/utxo/OPNetLimitedProvider.d.ts +1 -1
- package/build/utxo/OPNetLimitedProvider.d.ts.map +1 -1
- package/build/utxo/OPNetLimitedProvider.js +2 -1
- package/build/utxo/OPNetLimitedProvider.js.map +1 -1
- package/documentation/README.md +322 -25
- package/documentation/abi/abi-coder.md +440 -0
- package/documentation/addresses/address-types.md +459 -0
- package/documentation/api-reference/interfaces.md +806 -0
- package/documentation/api-reference/response-types.md +480 -0
- package/documentation/api-reference/transaction-types.md +348 -0
- package/documentation/binary/binary-reader.md +526 -0
- package/documentation/binary/binary-writer.md +484 -0
- package/documentation/browser/wallet-extensions.md +278 -0
- package/documentation/browser/web3-provider.md +300 -0
- package/documentation/deterministic/deterministic-collections.md +489 -0
- package/documentation/epoch/challenge-solution.md +462 -0
- package/documentation/epoch/epoch-validator.md +316 -0
- package/documentation/generators/generators.md +636 -0
- package/documentation/getting-started/installation.md +256 -0
- package/documentation/getting-started/overview.md +348 -0
- package/documentation/getting-started/quick-start.md +582 -0
- package/documentation/keypair/address-verificator.md +459 -0
- package/documentation/keypair/address.md +702 -0
- package/documentation/keypair/ec-keypair.md +558 -0
- package/documentation/keypair/message-signer.md +840 -0
- package/documentation/keypair/mnemonic.md +560 -0
- package/documentation/keypair/wallet.md +401 -0
- package/documentation/offline/offline-transaction-signing.md +819 -0
- package/documentation/quantum-support/04-message-signing.md +244 -10
- package/documentation/signer/address-rotation.md +419 -0
- package/documentation/signer/parallel-signer.md +245 -0
- package/documentation/signer/tweaked-signer.md +214 -0
- package/documentation/transaction-building/cancel-transactions.md +285 -0
- package/documentation/transaction-building/consolidated-transactions.md +441 -0
- package/documentation/transaction-building/custom-script-transactions.md +280 -0
- package/documentation/transaction-building/deployment-transactions.md +241 -0
- package/documentation/transaction-building/funding-transactions.md +282 -0
- package/documentation/transaction-building/interaction-transactions.md +292 -0
- package/documentation/transaction-building/multisig-transactions.md +340 -0
- package/documentation/transaction-building/transaction-factory-interfaces.md +726 -0
- package/documentation/transaction-building/transaction-factory.md +746 -0
- package/documentation/utils/bitcoin-utils.md +196 -0
- package/documentation/utils/buffer-helper.md +259 -0
- package/documentation/utils/compressor.md +182 -0
- package/documentation/utils/types-and-constants.md +259 -0
- package/documentation/utxo/opnet-limited-provider.md +363 -0
- package/package.json +4 -4
- package/src/_version.ts +1 -1
- package/src/abi/ABICoder.ts +4 -4
- package/src/buffer/BinaryReader.ts +1 -1
- package/src/buffer/BinaryWriter.ts +1 -1
- package/src/bytecode/Compressor.ts +8 -8
- package/src/epoch/ChallengeSolution.ts +23 -22
- package/src/generators/MLDSAData.ts +4 -4
- package/src/shims/zlib-browser.js +4 -4
- package/src/transaction/browser/types/Unisat.ts +1 -1
- package/src/transaction/builders/CancelTransaction.ts +1 -1
- package/src/transaction/builders/ChallengeSolutionTransaction.ts +5 -5
- package/src/transaction/builders/CustomScriptTransaction.ts +1 -1
- package/src/transaction/builders/DeploymentTransaction.ts +2 -2
- package/src/transaction/builders/MultiSignTransaction.ts +5 -5
- package/src/transaction/builders/SharedInteractionTransaction.ts +5 -5
- package/src/transaction/builders/TransactionBuilder.ts +4 -4
- package/src/transaction/offline/OfflineTransactionManager.ts +1 -1
- package/src/transaction/shared/P2TR_MS.ts +1 -1
- package/src/transaction/shared/TweakedTransaction.ts +3 -15
- package/src/utils/BitcoinUtils.ts +11 -11
- package/src/utils/BufferHelper.ts +1 -1
- package/src/utils/StringToBuffer.ts +4 -2
- package/src/utils/types.ts +1 -1
- package/src/utxo/OPNetLimitedProvider.ts +2 -2
- package/documentation/offline-transaction-signing.md +0 -652
- package/documentation/transaction-building.md +0 -603
package/browser/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { p as jt, N as Ti, s as at, c as U, b as Be, L as Ce, d as Ct, a as bt, l as le, z as Fe, e as Ii } from "./vendors.js";
|
|
2
|
+
import { y as Ei, Y as A, H as _, n as y, V as O, v as ut, i as nt, w as v, z as f, I as Pi, x as g, P as $, K as vi, r as Oi, a as ee, g as C, b as D, c as Ui, j as Bi, d as _i, e as Ne, l as ki, C as V, X as ie, f as x, h as Li, N as Ki, Z as xi, A as Ri, k as _e, m as Di, o as ke, S as Ci, B as Fi, E as Ni, p as Mi, Q as Me, q as k, s as re, _ as Wi } from "./btc-vision-bitcoin.js";
|
|
3
3
|
import { s as Hi, m as Vi, b as zi } from "./noble-curves.js";
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
typeof
|
|
7
|
-
typeof
|
|
8
|
-
const $i = "1.8.0-
|
|
4
|
+
import { s as Qt, c as te, e as qi, v as Xi } from "./noble-hashes.js";
|
|
5
|
+
const Ht = Symbol;
|
|
6
|
+
typeof Ht.dispose != "symbol" && (Ht.dispose = /* @__PURE__ */ Symbol.for("Symbol.dispose"));
|
|
7
|
+
typeof Ht.asyncDispose != "symbol" && (Ht.asyncDispose = /* @__PURE__ */ Symbol.for("Symbol.asyncDispose"));
|
|
8
|
+
const $i = "1.8.0-rc.2";
|
|
9
9
|
function Yi(n, t = {}) {
|
|
10
|
-
return
|
|
10
|
+
return new Uint8Array(jt.gzip(n, { level: t.level || 6 }));
|
|
11
11
|
}
|
|
12
12
|
function Gi(n) {
|
|
13
|
-
return
|
|
13
|
+
return new Uint8Array(jt.ungzip(n));
|
|
14
14
|
}
|
|
15
15
|
function ji(n, t = {}) {
|
|
16
|
-
return
|
|
16
|
+
return new Uint8Array(jt.deflate(n, { level: t.level || 6 }));
|
|
17
17
|
}
|
|
18
18
|
function Qi(n) {
|
|
19
|
-
return
|
|
19
|
+
return new Uint8Array(jt.inflate(n));
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const Le = {
|
|
22
22
|
gzipSync: Yi,
|
|
23
23
|
gunzipSync: Gi,
|
|
24
24
|
deflateSync: ji,
|
|
25
25
|
inflateSync: Qi
|
|
26
26
|
};
|
|
27
|
-
class
|
|
27
|
+
class X {
|
|
28
28
|
static zlibOptions = {
|
|
29
29
|
level: 9,
|
|
30
30
|
maxOutputLength: 1024 * 1024 * 16
|
|
@@ -32,35 +32,35 @@ class $ {
|
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* Compresses the data using gzip.
|
|
35
|
-
* @param {Uint8Array
|
|
36
|
-
* @returns {
|
|
35
|
+
* @param {Uint8Array} data The data to compress.
|
|
36
|
+
* @returns {Uint8Array} The compressed data.
|
|
37
37
|
*/
|
|
38
38
|
static compress(t) {
|
|
39
|
-
return
|
|
39
|
+
return new Uint8Array(Le.gzipSync(t, X.zlibOptions));
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Decompresses the data using gunzip.
|
|
43
|
-
* @param {Uint8Array
|
|
44
|
-
* @returns {
|
|
43
|
+
* @param {Uint8Array} data The data to decompress.
|
|
44
|
+
* @returns {Uint8Array} The decompressed data.
|
|
45
45
|
*/
|
|
46
46
|
static decompress(t) {
|
|
47
|
-
return
|
|
47
|
+
return new Uint8Array(Le.gunzipSync(t, X.zlibOptions));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const W =
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
50
|
+
const W = Ti(), Zi = W;
|
|
51
|
+
Ei(Zi);
|
|
52
|
+
const We = typeof Be == "function" ? Be : U.BIP32Factory;
|
|
53
|
+
if (!We)
|
|
54
54
|
throw new Error("Failed to load BIP32 library");
|
|
55
|
-
const
|
|
55
|
+
const ht = Hi.Point, Ji = ht.Fn.ORDER, tr = new Uint8Array([84, 97, 112, 84, 119, 101, 97, 107]), Ke = Qt(tr);
|
|
56
56
|
function er(n) {
|
|
57
|
-
return
|
|
57
|
+
return Qt(qi(Ke, Ke, n));
|
|
58
58
|
}
|
|
59
59
|
class P {
|
|
60
|
-
static BIP32 =
|
|
61
|
-
static ECPairSigner =
|
|
60
|
+
static BIP32 = We(W);
|
|
61
|
+
static ECPairSigner = at;
|
|
62
62
|
static {
|
|
63
|
-
|
|
63
|
+
ht.BASE.precompute(8);
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Generate a keypair from a WIF
|
|
@@ -69,7 +69,7 @@ class P {
|
|
|
69
69
|
* @returns {UniversalSigner} - The generated keypair
|
|
70
70
|
*/
|
|
71
71
|
static fromWIF(t, e = A.bitcoin) {
|
|
72
|
-
return
|
|
72
|
+
return at.fromWIF(W, t, e);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Generate a keypair from a private key
|
|
@@ -78,7 +78,7 @@ class P {
|
|
|
78
78
|
* @returns {UniversalSigner} - The generated keypair
|
|
79
79
|
*/
|
|
80
80
|
static fromPrivateKey(t, e = A.bitcoin) {
|
|
81
|
-
return
|
|
81
|
+
return at.fromPrivateKey(W, t, e);
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Generate a keypair from a public key
|
|
@@ -87,7 +87,7 @@ class P {
|
|
|
87
87
|
* @returns {UniversalSigner} - The generated keypair
|
|
88
88
|
*/
|
|
89
89
|
static fromPublicKey(t, e = A.bitcoin) {
|
|
90
|
-
return
|
|
90
|
+
return at.fromPublicKey(W, t, e);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Generate a multi-sig address
|
|
@@ -172,14 +172,14 @@ class P {
|
|
|
172
172
|
* @returns {string} - The generated P2OP address
|
|
173
173
|
*/
|
|
174
174
|
static p2op(t, e = A.bitcoin, i = 0) {
|
|
175
|
-
const r =
|
|
175
|
+
const r = ut([
|
|
176
176
|
new Uint8Array([i]),
|
|
177
|
-
|
|
177
|
+
nt.crypto.hash160(t)
|
|
178
178
|
]);
|
|
179
179
|
if (r.length < 2 || r.length > 40)
|
|
180
180
|
throw new Error("Witness program must be 2-40 bytes.");
|
|
181
181
|
const s = v.compile([f.OP_16, r]);
|
|
182
|
-
return
|
|
182
|
+
return Pi(s, e);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Get the address of a xOnly tweaked public key
|
|
@@ -209,8 +209,8 @@ class P {
|
|
|
209
209
|
*/
|
|
210
210
|
static tweakPublicKey(t) {
|
|
211
211
|
typeof t == "string" && t.startsWith("0x") && (t = t.slice(2));
|
|
212
|
-
const e = typeof t == "string" ? t :
|
|
213
|
-
return r.add(
|
|
212
|
+
const e = typeof t == "string" ? t : g(t), i = ht.fromHex(e), r = (i.y & 1n) === 0n ? i : i.negate(), s = r.toBytes(!0).subarray(1), o = er(s), a = Vi(zi(o), Ji);
|
|
213
|
+
return r.add(ht.BASE.multiply(a)).toBytes(!0);
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
216
|
* Tweak a batch of public keys
|
|
@@ -219,9 +219,9 @@ class P {
|
|
|
219
219
|
* @returns {Uint8Array[]} - The tweaked public keys
|
|
220
220
|
*/
|
|
221
221
|
static tweakBatchSharedT(t, e) {
|
|
222
|
-
const i =
|
|
222
|
+
const i = ht.BASE.multiply(e);
|
|
223
223
|
return t.map((r) => {
|
|
224
|
-
const s =
|
|
224
|
+
const s = ht.fromHex(g(r));
|
|
225
225
|
return (s.y % 2n === 0n ? s : s.negate()).add(i).toBytes(!0);
|
|
226
226
|
});
|
|
227
227
|
}
|
|
@@ -233,8 +233,8 @@ class P {
|
|
|
233
233
|
* @returns An object containing both classical and quantum key information
|
|
234
234
|
*/
|
|
235
235
|
static generateWallet(t = A.bitcoin, e = U.MLDSASecurityLevel.LEVEL2) {
|
|
236
|
-
const i =
|
|
237
|
-
rng: (o) =>
|
|
236
|
+
const i = at.makeRandom(W, t, {
|
|
237
|
+
rng: (o) => te(o)
|
|
238
238
|
}), r = this.getP2WPKHAddress(i, t);
|
|
239
239
|
if (!r)
|
|
240
240
|
throw new Error("Failed to generate wallet");
|
|
@@ -242,9 +242,9 @@ class P {
|
|
|
242
242
|
return {
|
|
243
243
|
address: r,
|
|
244
244
|
privateKey: i.toWIF(),
|
|
245
|
-
publicKey:
|
|
246
|
-
quantumPrivateKey:
|
|
247
|
-
quantumPublicKey:
|
|
245
|
+
publicKey: g(i.publicKey),
|
|
246
|
+
quantumPrivateKey: g(s.privateKey),
|
|
247
|
+
quantumPublicKey: g(s.publicKey)
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
@@ -258,7 +258,7 @@ class P {
|
|
|
258
258
|
* @returns A random ML-DSA keypair
|
|
259
259
|
*/
|
|
260
260
|
static generateQuantumKeyPair(t = U.MLDSASecurityLevel.LEVEL2, e = A.bitcoin) {
|
|
261
|
-
const i =
|
|
261
|
+
const i = te(64), r = U.QuantumBIP32Factory.fromSeed(i, e, t);
|
|
262
262
|
if (!r.privateKey || !r.publicKey)
|
|
263
263
|
throw new Error("Failed to generate quantum keypair");
|
|
264
264
|
return {
|
|
@@ -273,7 +273,7 @@ class P {
|
|
|
273
273
|
* @returns {boolean} - Whether the address is valid
|
|
274
274
|
*/
|
|
275
275
|
static verifyContractAddress(t, e = A.bitcoin) {
|
|
276
|
-
return
|
|
276
|
+
return !!$.toOutputScript(t, e);
|
|
277
277
|
}
|
|
278
278
|
/**
|
|
279
279
|
* Get the legacy segwit address from a keypair
|
|
@@ -324,7 +324,7 @@ class P {
|
|
|
324
324
|
const i = _.p2pk({ pubkey: t.publicKey, network: e });
|
|
325
325
|
if (!i.output)
|
|
326
326
|
throw new Error("Failed to generate wallet");
|
|
327
|
-
return "0x" +
|
|
327
|
+
return "0x" + g(i.output);
|
|
328
328
|
}
|
|
329
329
|
/**
|
|
330
330
|
* Generate a random keypair
|
|
@@ -332,8 +332,8 @@ class P {
|
|
|
332
332
|
* @returns {UniversalSigner} - The generated keypair
|
|
333
333
|
*/
|
|
334
334
|
static generateRandomKeyPair(t = A.bitcoin) {
|
|
335
|
-
return
|
|
336
|
-
rng: (e) =>
|
|
335
|
+
return at.makeRandom(W, t, {
|
|
336
|
+
rng: (e) => te(e)
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
@@ -384,11 +384,11 @@ class P {
|
|
|
384
384
|
static fromSeedKeyPair(t, e = A.bitcoin) {
|
|
385
385
|
const r = this.BIP32.fromSeed(t, e).privateKey;
|
|
386
386
|
if (!r) throw new Error("Failed to generate key pair");
|
|
387
|
-
return
|
|
387
|
+
return at.fromPrivateKey(W, r, e);
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
var
|
|
391
|
-
const R = 32,
|
|
390
|
+
var z = /* @__PURE__ */ ((n) => (n[n.ACCESS_LIST = 1] = "ACCESS_LIST", n[n.EPOCH_SUBMISSION = 2] = "EPOCH_SUBMISSION", n[n.MLDSA_LINK_PUBKEY = 4] = "MLDSA_LINK_PUBKEY", n))(z || {}), J = /* @__PURE__ */ ((n) => (n[n.ACCESS_LIST = 1] = "ACCESS_LIST", n[n.EPOCH_SUBMISSION = 2] = "EPOCH_SUBMISSION", n[n.MLDSA_LINK_PUBKEY = 3] = "MLDSA_LINK_PUBKEY", n))(J || {});
|
|
391
|
+
const R = 32, ft = 64, gt = 64, ir = 4, vt = 32, Tt = 16, Vt = 8, St = 4, yt = 2, zt = 1, rr = 32, It = 16, Ot = 8, Ut = 4, Bt = 2, _t = 1, sr = 1;
|
|
392
392
|
function nr(n, t, e, i) {
|
|
393
393
|
throw new Error(`${t} (${e}: ${i})`);
|
|
394
394
|
}
|
|
@@ -401,12 +401,12 @@ function or() {
|
|
|
401
401
|
return globalThis;
|
|
402
402
|
throw new Error("unable to locate global object");
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
function
|
|
404
|
+
const xe = or();
|
|
405
|
+
xe.crypto || xe.msCrypto;
|
|
406
|
+
function se(n) {
|
|
407
407
|
switch (n) {
|
|
408
408
|
case "sha256":
|
|
409
|
-
return
|
|
409
|
+
return Qt.create();
|
|
410
410
|
case "sha512":
|
|
411
411
|
return Xi.create();
|
|
412
412
|
}
|
|
@@ -425,19 +425,18 @@ class M {
|
|
|
425
425
|
/**
|
|
426
426
|
* Generates random bytes.
|
|
427
427
|
* @public
|
|
428
|
-
* @returns {
|
|
428
|
+
* @returns {Uint8Array} The random bytes
|
|
429
429
|
*/
|
|
430
430
|
static rndBytes() {
|
|
431
|
-
|
|
432
|
-
return V.from(t);
|
|
431
|
+
return M.getSafeRandomValues(64);
|
|
433
432
|
}
|
|
434
433
|
static getSafeRandomValues(t) {
|
|
435
434
|
if (typeof globalThis.window < "u" && globalThis.window.crypto && typeof globalThis.window.crypto.getRandomValues == "function") {
|
|
436
435
|
const e = new Uint8Array(t);
|
|
437
|
-
return window.crypto.getRandomValues(e),
|
|
436
|
+
return window.crypto.getRandomValues(e), e;
|
|
438
437
|
} else if (globalThis.crypto && typeof globalThis.crypto.getRandomValues == "function") {
|
|
439
438
|
const e = new Uint8Array(t);
|
|
440
|
-
return globalThis.crypto.getRandomValues(e),
|
|
439
|
+
return globalThis.crypto.getRandomValues(e), e;
|
|
441
440
|
} else
|
|
442
441
|
throw console.log(
|
|
443
442
|
"No secure random number generator available. Please upgrade your environment.",
|
|
@@ -452,17 +451,17 @@ class M {
|
|
|
452
451
|
}
|
|
453
452
|
/**
|
|
454
453
|
* Hashes the given data
|
|
455
|
-
* @param {
|
|
454
|
+
* @param {Uint8Array} data - The data to hash
|
|
456
455
|
* @returns {string} The hashed data
|
|
457
456
|
*/
|
|
458
457
|
static opnetHash(t) {
|
|
459
|
-
const e =
|
|
458
|
+
const e = se("sha512");
|
|
460
459
|
e.update(t);
|
|
461
460
|
const i = e.digest();
|
|
462
|
-
return `0x${
|
|
461
|
+
return `0x${g(new Uint8Array(i))}`;
|
|
463
462
|
}
|
|
464
463
|
}
|
|
465
|
-
class
|
|
464
|
+
class j {
|
|
466
465
|
/**
|
|
467
466
|
* Check if a UTXO is a P2WDA output by examining its script structure
|
|
468
467
|
*/
|
|
@@ -559,13 +558,13 @@ class Q {
|
|
|
559
558
|
return t.length === 34 && t[0] === 0 && t[1] === 32;
|
|
560
559
|
}
|
|
561
560
|
}
|
|
562
|
-
var
|
|
563
|
-
class
|
|
561
|
+
var it = /* @__PURE__ */ ((n) => (n.P2PKH = "P2PKH", n.P2OP = "P2OP", n.P2SH_OR_P2SH_P2WPKH = "P2SH_OR_P2SH-P2WPKH", n.P2PK = "P2PK", n.P2TR = "P2TR", n.P2WPKH = "P2WPKH", n.P2WSH = "P2WSH", n.P2WDA = "P2WDA", n))(it || {});
|
|
562
|
+
class Y {
|
|
564
563
|
static isValidP2TRAddress(t, e) {
|
|
565
564
|
if (!t || t.length < 50) return !1;
|
|
566
565
|
let i = !1;
|
|
567
566
|
try {
|
|
568
|
-
|
|
567
|
+
$.toOutputScript(t, e), i = $.fromBech32(t).version === 1;
|
|
569
568
|
} catch {
|
|
570
569
|
}
|
|
571
570
|
return i;
|
|
@@ -574,18 +573,18 @@ class G {
|
|
|
574
573
|
if (!t || t.length < 20 || t.length > 50) return !1;
|
|
575
574
|
let i = !1;
|
|
576
575
|
try {
|
|
577
|
-
const r =
|
|
578
|
-
|
|
576
|
+
const r = $.fromBech32(t);
|
|
577
|
+
$.toOutputScript(t, e), i = r.version === 0 && r.data.length === 20;
|
|
579
578
|
} catch {
|
|
580
579
|
}
|
|
581
580
|
return i;
|
|
582
581
|
}
|
|
583
582
|
static isP2WDAWitnessScript(t) {
|
|
584
|
-
return
|
|
583
|
+
return j.isP2WDAWitnessScript(t);
|
|
585
584
|
}
|
|
586
585
|
static isP2PKHOrP2SH(t, e) {
|
|
587
586
|
try {
|
|
588
|
-
const i =
|
|
587
|
+
const i = $.fromBase58Check(t);
|
|
589
588
|
return i.version === e.pubKeyHash ? !0 : i.version === e.scriptHash;
|
|
590
589
|
} catch {
|
|
591
590
|
return !1;
|
|
@@ -634,7 +633,7 @@ class G {
|
|
|
634
633
|
static isValidP2OPAddress(t, e) {
|
|
635
634
|
if (!t || t.length < 20) return !1;
|
|
636
635
|
try {
|
|
637
|
-
const i =
|
|
636
|
+
const i = $.fromBech32(t);
|
|
638
637
|
return i.prefix === e.bech32 || i.prefix === e.bech32Opnet ? i.version === 16 && i.data.length === 21 : !1;
|
|
639
638
|
} catch {
|
|
640
639
|
return !1;
|
|
@@ -642,17 +641,17 @@ class G {
|
|
|
642
641
|
}
|
|
643
642
|
static requireRedeemScript(t, e) {
|
|
644
643
|
try {
|
|
645
|
-
const i =
|
|
644
|
+
const i = $.fromBase58Check(t);
|
|
646
645
|
return i.version === e.pubKeyHash ? !1 : i.version === e.scriptHash;
|
|
647
646
|
} catch {
|
|
648
647
|
return !1;
|
|
649
648
|
}
|
|
650
649
|
}
|
|
651
650
|
static detectAddressType(t, e) {
|
|
652
|
-
if (
|
|
651
|
+
if (Y.isValidPublicKey(t, e))
|
|
653
652
|
return "P2PK";
|
|
654
653
|
try {
|
|
655
|
-
const i =
|
|
654
|
+
const i = $.fromBase58Check(t);
|
|
656
655
|
if (i.version === e.pubKeyHash)
|
|
657
656
|
return "P2PKH";
|
|
658
657
|
if (i.version === e.scriptHash)
|
|
@@ -660,7 +659,7 @@ class G {
|
|
|
660
659
|
} catch {
|
|
661
660
|
}
|
|
662
661
|
try {
|
|
663
|
-
const i =
|
|
662
|
+
const i = $.fromBech32(t);
|
|
664
663
|
if ((i.prefix === e.bech32Opnet || i.prefix === e.bech32) && i.version === 16 && i.data.length === 21)
|
|
665
664
|
return "P2OP";
|
|
666
665
|
if (i.prefix === e.bech32) {
|
|
@@ -676,12 +675,12 @@ class G {
|
|
|
676
675
|
return null;
|
|
677
676
|
}
|
|
678
677
|
static detectAddressTypeWithWitnessScript(t, e, i) {
|
|
679
|
-
const r =
|
|
680
|
-
return r === "P2WSH" && i &&
|
|
678
|
+
const r = Y.detectAddressType(t, e);
|
|
679
|
+
return r === "P2WSH" && i && Y.isP2WDAWitnessScript(i) ? "P2WDA" : r;
|
|
681
680
|
}
|
|
682
681
|
static validateP2WDAAddress(t, e, i) {
|
|
683
682
|
try {
|
|
684
|
-
if (
|
|
683
|
+
if (Y.detectAddressType(t, e) !== "P2WSH")
|
|
685
684
|
return {
|
|
686
685
|
isValid: !1,
|
|
687
686
|
isPotentiallyP2WDA: !1,
|
|
@@ -694,7 +693,7 @@ class G {
|
|
|
694
693
|
isPotentiallyP2WDA: !0,
|
|
695
694
|
isDefinitelyP2WDA: !1
|
|
696
695
|
};
|
|
697
|
-
if (!
|
|
696
|
+
if (!Y.isP2WDAWitnessScript(i))
|
|
698
697
|
return {
|
|
699
698
|
isValid: !0,
|
|
700
699
|
isPotentiallyP2WDA: !0,
|
|
@@ -711,7 +710,7 @@ class G {
|
|
|
711
710
|
isDefinitelyP2WDA: !1,
|
|
712
711
|
error: "Witness script does not match address"
|
|
713
712
|
};
|
|
714
|
-
const o =
|
|
713
|
+
const o = j.extractPublicKeyFromP2WDA(i);
|
|
715
714
|
return o ? {
|
|
716
715
|
isValid: !0,
|
|
717
716
|
isPotentiallyP2WDA: !0,
|
|
@@ -733,8 +732,8 @@ class G {
|
|
|
733
732
|
}
|
|
734
733
|
}
|
|
735
734
|
}
|
|
736
|
-
const
|
|
737
|
-
class
|
|
735
|
+
const ct = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;
|
|
736
|
+
class He {
|
|
738
737
|
/**
|
|
739
738
|
* The maximum increments to try before giving up on deriving a valid x.
|
|
740
739
|
*/
|
|
@@ -758,14 +757,14 @@ class Ve {
|
|
|
758
757
|
findOrDeriveValidPoint(t, e = !0, i = this.maxTries) {
|
|
759
758
|
if (t.length !== 32)
|
|
760
759
|
throw new Error("xBytes must be exactly 32 bytes.");
|
|
761
|
-
let r = this.bytesToBigInt(t) %
|
|
760
|
+
let r = this.bytesToBigInt(t) % ct, s = this.isValidX(r);
|
|
762
761
|
if (e && s === null)
|
|
763
762
|
throw new Error("The given x is not a valid curve point.");
|
|
764
763
|
let o = 0;
|
|
765
764
|
for (; s === null; )
|
|
766
|
-
if (r = (r + 1n) %
|
|
765
|
+
if (r = (r + 1n) % ct, s = this.isValidX(r), o++, o > i)
|
|
767
766
|
throw new Error(`Could not find a valid X point within ${i} increments.`);
|
|
768
|
-
const a = s, c = (
|
|
767
|
+
const a = s, c = (ct - a) % ct;
|
|
769
768
|
return { x: r, y1: a, y2: c };
|
|
770
769
|
}
|
|
771
770
|
/**
|
|
@@ -797,8 +796,8 @@ class Ve {
|
|
|
797
796
|
* Returns the square root if it is, or null if not.
|
|
798
797
|
*/
|
|
799
798
|
isValidX(t) {
|
|
800
|
-
const e = (this.modPow(t, 3n,
|
|
801
|
-
return this.sqrtModP(e,
|
|
799
|
+
const e = (this.modPow(t, 3n, ct) + 7n) % ct;
|
|
800
|
+
return this.sqrtModP(e, ct);
|
|
802
801
|
}
|
|
803
802
|
/**
|
|
804
803
|
* Computes base^exp (mod m) using exponentiation by squaring.
|
|
@@ -841,14 +840,14 @@ class Ve {
|
|
|
841
840
|
}
|
|
842
841
|
}
|
|
843
842
|
class cr {
|
|
844
|
-
deriver = new
|
|
843
|
+
deriver = new He();
|
|
845
844
|
generateHybridKeyFromHash(t) {
|
|
846
845
|
const e = this.deriver.findOrDeriveValidPoint(new Uint8Array(t), !1), i = this.deriver.getCanonicalY(e.y1, e.y2);
|
|
847
846
|
return new Uint8Array(this.deriver.getHybridPublicKey(e.x, i));
|
|
848
847
|
}
|
|
849
848
|
}
|
|
850
|
-
const
|
|
851
|
-
class
|
|
849
|
+
const ne = new cr();
|
|
850
|
+
class q {
|
|
852
851
|
static UNSPENDABLE_INTERNAL_KEY = y(
|
|
853
852
|
"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"
|
|
854
853
|
);
|
|
@@ -857,8 +856,8 @@ class X {
|
|
|
857
856
|
* Generate a P2WSH address with CSV timelock
|
|
858
857
|
* Note: This uses ECDSA, not Schnorr (Schnorr only available in Taproot)
|
|
859
858
|
*/
|
|
860
|
-
static generateTimeLockAddress(t, e = A.bitcoin, i =
|
|
861
|
-
const r = this.generateTimeLockScript(t, i), s =
|
|
859
|
+
static generateTimeLockAddress(t, e = A.bitcoin, i = q.CSV_BLOCKS) {
|
|
860
|
+
const r = this.generateTimeLockScript(t, i), s = nt.payments.p2wsh({
|
|
862
861
|
redeem: { output: r },
|
|
863
862
|
network: e
|
|
864
863
|
});
|
|
@@ -873,19 +872,19 @@ class X {
|
|
|
873
872
|
* Generate a P2TR address with CSV time lock
|
|
874
873
|
* Note: This uses Schnorr signatures
|
|
875
874
|
*/
|
|
876
|
-
static generateTimeLockAddressP2TR(t, e = A.bitcoin, i =
|
|
875
|
+
static generateTimeLockAddressP2TR(t, e = A.bitcoin, i = q.CSV_BLOCKS) {
|
|
877
876
|
if (t.length !== 32)
|
|
878
877
|
throw new Error("Public key must be 32 bytes for Taproot");
|
|
879
|
-
const r = this.generateTimeLockScript(t, i), s =
|
|
878
|
+
const r = this.generateTimeLockScript(t, i), s = nt.payments.p2tr({
|
|
880
879
|
redeem: { output: r },
|
|
881
880
|
network: e,
|
|
882
|
-
internalPubkey:
|
|
881
|
+
internalPubkey: q.UNSPENDABLE_INTERNAL_KEY
|
|
883
882
|
});
|
|
884
883
|
if (!s.address)
|
|
885
884
|
throw new Error("Failed to generate P2TR address");
|
|
886
885
|
return s.address;
|
|
887
886
|
}
|
|
888
|
-
static generateTimeLockScript(t, e =
|
|
887
|
+
static generateTimeLockScript(t, e = q.CSV_BLOCKS) {
|
|
889
888
|
return v.compile([
|
|
890
889
|
v.number.encode(e),
|
|
891
890
|
f.OP_CHECKSEQUENCEVERIFY,
|
|
@@ -896,7 +895,7 @@ class X {
|
|
|
896
895
|
}
|
|
897
896
|
}
|
|
898
897
|
const ur = [1312, 1952, 2592];
|
|
899
|
-
class
|
|
898
|
+
class K extends Uint8Array {
|
|
900
899
|
#t;
|
|
901
900
|
#e;
|
|
902
901
|
#n;
|
|
@@ -974,7 +973,7 @@ class x extends Uint8Array {
|
|
|
974
973
|
return this.#h;
|
|
975
974
|
}
|
|
976
975
|
static dead() {
|
|
977
|
-
return
|
|
976
|
+
return K.fromString(
|
|
978
977
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
979
978
|
// DEAD ADDRESS
|
|
980
979
|
"0x04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"
|
|
@@ -1001,7 +1000,7 @@ class x extends Uint8Array {
|
|
|
1001
1000
|
);
|
|
1002
1001
|
i = y(e);
|
|
1003
1002
|
}
|
|
1004
|
-
return new
|
|
1003
|
+
return new K(y(t), i);
|
|
1005
1004
|
}
|
|
1006
1005
|
/**
|
|
1007
1006
|
* Create an address from a public key
|
|
@@ -1009,7 +1008,7 @@ class x extends Uint8Array {
|
|
|
1009
1008
|
* @param {ArrayLike<number>} bytes The public key
|
|
1010
1009
|
*/
|
|
1011
1010
|
static wrap(t) {
|
|
1012
|
-
return new
|
|
1011
|
+
return new K(t);
|
|
1013
1012
|
}
|
|
1014
1013
|
static uncompressedToCompressed(t) {
|
|
1015
1014
|
const e = Uint8Array.from(t), i = e.slice(1, 33), r = e.slice(33), s = new Uint8Array(33);
|
|
@@ -1036,8 +1035,8 @@ class x extends Uint8Array {
|
|
|
1036
1035
|
* ```
|
|
1037
1036
|
*/
|
|
1038
1037
|
static fromBigInt(t, e) {
|
|
1039
|
-
const i =
|
|
1040
|
-
return new
|
|
1038
|
+
const i = K.bigintToUint8Array(t), r = e !== void 0 ? K.bigintToUint8Array(e) : void 0;
|
|
1039
|
+
return new K(i, r);
|
|
1041
1040
|
}
|
|
1042
1041
|
/**
|
|
1043
1042
|
* Creates an Address instance from four 64-bit unsigned integers.
|
|
@@ -1067,7 +1066,7 @@ class x extends Uint8Array {
|
|
|
1067
1066
|
*/
|
|
1068
1067
|
static fromUint64Array(t, e, i, r) {
|
|
1069
1068
|
const s = new Uint8Array(32), o = new DataView(s.buffer);
|
|
1070
|
-
return o.setBigUint64(0, t, !1), o.setBigUint64(8, e, !1), o.setBigUint64(16, i, !1), o.setBigUint64(24, r, !1), new
|
|
1069
|
+
return o.setBigUint64(0, t, !1), o.setBigUint64(8, e, !1), o.setBigUint64(16, i, !1), o.setBigUint64(24, r, !1), new K(s);
|
|
1071
1070
|
}
|
|
1072
1071
|
static bigintToUint8Array(t) {
|
|
1073
1072
|
const e = new Uint8Array(32), i = new DataView(e.buffer);
|
|
@@ -1120,7 +1119,7 @@ class x extends Uint8Array {
|
|
|
1120
1119
|
* @returns {string} The hex string
|
|
1121
1120
|
*/
|
|
1122
1121
|
toHex() {
|
|
1123
|
-
return "0x" +
|
|
1122
|
+
return "0x" + g(this);
|
|
1124
1123
|
}
|
|
1125
1124
|
/**
|
|
1126
1125
|
* Converts the classical public key to a hex string
|
|
@@ -1130,7 +1129,7 @@ class x extends Uint8Array {
|
|
|
1130
1129
|
const t = this.legacyPublicKey;
|
|
1131
1130
|
if (!t)
|
|
1132
1131
|
throw new Error("Legacy public key not set");
|
|
1133
|
-
return "0x" +
|
|
1132
|
+
return "0x" + g(t);
|
|
1134
1133
|
}
|
|
1135
1134
|
/**
|
|
1136
1135
|
* Converts the address content (SHA256 hash of ML-DSA public key) to a Uint8Array
|
|
@@ -1152,7 +1151,7 @@ class x extends Uint8Array {
|
|
|
1152
1151
|
toUncompressedHex() {
|
|
1153
1152
|
if (this.ensureLegacyProcessed(), !this.#r)
|
|
1154
1153
|
throw new Error("Legacy public key not set");
|
|
1155
|
-
return "0x" +
|
|
1154
|
+
return "0x" + g(this.#r.uncompressed);
|
|
1156
1155
|
}
|
|
1157
1156
|
toUncompressedBuffer() {
|
|
1158
1157
|
if (this.ensureLegacyProcessed(), !this.#r)
|
|
@@ -1162,7 +1161,7 @@ class x extends Uint8Array {
|
|
|
1162
1161
|
toHybridPublicKeyHex() {
|
|
1163
1162
|
if (this.ensureLegacyProcessed(), !this.#r)
|
|
1164
1163
|
throw new Error("Legacy public key not set");
|
|
1165
|
-
return "0x" +
|
|
1164
|
+
return "0x" + g(this.#r.hybrid);
|
|
1166
1165
|
}
|
|
1167
1166
|
toHybridPublicKeyBuffer() {
|
|
1168
1167
|
if (this.ensureLegacyProcessed(), !this.#r)
|
|
@@ -1276,7 +1275,7 @@ class x extends Uint8Array {
|
|
|
1276
1275
|
const e = this.legacyPublicKey;
|
|
1277
1276
|
if (!e)
|
|
1278
1277
|
throw new Error("Legacy key not set.");
|
|
1279
|
-
return
|
|
1278
|
+
return Y.isValidPublicKey(g(e), t);
|
|
1280
1279
|
}
|
|
1281
1280
|
/**
|
|
1282
1281
|
* Get the public key as address
|
|
@@ -1363,7 +1362,7 @@ class x extends Uint8Array {
|
|
|
1363
1362
|
if (e.length !== 33)
|
|
1364
1363
|
throw new Error("P2WDA requires a compressed public key (33 bytes)");
|
|
1365
1364
|
try {
|
|
1366
|
-
const i =
|
|
1365
|
+
const i = j.generateP2WDAAddress(e, t);
|
|
1367
1366
|
return this.#n = t, this.#d = i, {
|
|
1368
1367
|
address: i.address,
|
|
1369
1368
|
witnessScript: i.witnessScript
|
|
@@ -1389,7 +1388,7 @@ class x extends Uint8Array {
|
|
|
1389
1388
|
if (this.ensureLegacyProcessed(), !this.#i)
|
|
1390
1389
|
throw new Error("Cannot create CSV address: public key not set");
|
|
1391
1390
|
const r = new Uint8Array(this.#i);
|
|
1392
|
-
return
|
|
1391
|
+
return q.generateTimeLockAddress(r, e, i);
|
|
1393
1392
|
}
|
|
1394
1393
|
/**
|
|
1395
1394
|
* Generate a P2TR address with CSV (CheckSequenceVerify) time lock
|
|
@@ -1407,7 +1406,7 @@ class x extends Uint8Array {
|
|
|
1407
1406
|
throw new Error("CSV block number must be between 1 and 65535");
|
|
1408
1407
|
if (this.ensureLegacyProcessed(), !this.#i)
|
|
1409
1408
|
throw new Error("Cannot create CSV address: public key not set");
|
|
1410
|
-
return
|
|
1409
|
+
return q.generateTimeLockAddressP2TR(
|
|
1411
1410
|
this.tweakedPublicKeyToBuffer(),
|
|
1412
1411
|
e,
|
|
1413
1412
|
i
|
|
@@ -1434,7 +1433,7 @@ class x extends Uint8Array {
|
|
|
1434
1433
|
toTweakedHybridPublicKeyHex() {
|
|
1435
1434
|
if (this.ensureLegacyProcessed(), this.ensureTweakedUncompressed(), !this.#s)
|
|
1436
1435
|
throw new Error("Legacy public key not set");
|
|
1437
|
-
return "0x" +
|
|
1436
|
+
return "0x" + g(this.#s);
|
|
1438
1437
|
}
|
|
1439
1438
|
toTweakedHybridPublicKeyBuffer() {
|
|
1440
1439
|
if (this.ensureLegacyProcessed(), this.ensureTweakedUncompressed(), !this.#s)
|
|
@@ -1450,7 +1449,7 @@ class x extends Uint8Array {
|
|
|
1450
1449
|
const t = this.#o;
|
|
1451
1450
|
if (t && t.length === R && !this.#i)
|
|
1452
1451
|
try {
|
|
1453
|
-
this.#s =
|
|
1452
|
+
this.#s = ne.generateHybridKeyFromHash(t);
|
|
1454
1453
|
} catch {
|
|
1455
1454
|
}
|
|
1456
1455
|
}
|
|
@@ -1468,7 +1467,7 @@ class x extends Uint8Array {
|
|
|
1468
1467
|
`Invalid ML-DSA public key length: ${t.length}. Expected 1312 (ML-DSA-44/LEVEL2), 1952 (ML-DSA-65/LEVEL3), or 2592 (ML-DSA-87/LEVEL5) bytes.`
|
|
1469
1468
|
);
|
|
1470
1469
|
this.#a = new Uint8Array(t.length), this.#a.set(t);
|
|
1471
|
-
const e =
|
|
1470
|
+
const e = Qt(new Uint8Array(t)), i = new Uint8Array(R);
|
|
1472
1471
|
i.set(e), super.set(i);
|
|
1473
1472
|
}
|
|
1474
1473
|
}
|
|
@@ -1488,18 +1487,18 @@ class x extends Uint8Array {
|
|
|
1488
1487
|
*/
|
|
1489
1488
|
autoFormat(t) {
|
|
1490
1489
|
const e = t[0];
|
|
1491
|
-
e === 3 || e === 2 || (e === 4 || e === 6 || e === 7) && (t =
|
|
1490
|
+
e === 3 || e === 2 || (e === 4 || e === 6 || e === 7) && (t = K.uncompressedToCompressed(t)), this.#i = Uint8Array.from(t), this.#h = P.fromPublicKey(this.#i), this.#r = vi(this.#i);
|
|
1492
1491
|
const i = O(
|
|
1493
1492
|
P.tweakPublicKey(this.#i)
|
|
1494
1493
|
);
|
|
1495
|
-
this.#s =
|
|
1494
|
+
this.#s = ne.generateHybridKeyFromHash(i), this.#o = new Uint8Array(R), this.#o.set(i);
|
|
1496
1495
|
}
|
|
1497
1496
|
}
|
|
1498
|
-
class
|
|
1497
|
+
class mt {
|
|
1499
1498
|
_keys = [];
|
|
1500
1499
|
_values = {};
|
|
1501
1500
|
constructor(t) {
|
|
1502
|
-
if (t instanceof
|
|
1501
|
+
if (t instanceof mt)
|
|
1503
1502
|
this.setAll(t);
|
|
1504
1503
|
else if (t)
|
|
1505
1504
|
for (const [e, i] of t)
|
|
@@ -1564,10 +1563,10 @@ class bt {
|
|
|
1564
1563
|
yield [t, this._values[t]];
|
|
1565
1564
|
}
|
|
1566
1565
|
}
|
|
1567
|
-
class
|
|
1566
|
+
class Ve {
|
|
1568
1567
|
items;
|
|
1569
1568
|
constructor(t) {
|
|
1570
|
-
if (this.items = new
|
|
1569
|
+
if (this.items = new mt(), t)
|
|
1571
1570
|
for (const [e, i] of t)
|
|
1572
1571
|
this.set(e, i);
|
|
1573
1572
|
}
|
|
@@ -1602,11 +1601,11 @@ class ze {
|
|
|
1602
1601
|
*/
|
|
1603
1602
|
*entries() {
|
|
1604
1603
|
for (const [t, e] of this.items.entries())
|
|
1605
|
-
yield [
|
|
1604
|
+
yield [K.fromBigInt(t), e];
|
|
1606
1605
|
}
|
|
1607
1606
|
*keys() {
|
|
1608
1607
|
for (const t of this.items.keys())
|
|
1609
|
-
yield
|
|
1608
|
+
yield K.fromBigInt(t);
|
|
1610
1609
|
}
|
|
1611
1610
|
*values() {
|
|
1612
1611
|
for (const t of this.items.values())
|
|
@@ -1614,7 +1613,7 @@ class ze {
|
|
|
1614
1613
|
}
|
|
1615
1614
|
forEach(t, e) {
|
|
1616
1615
|
for (const [i, r] of this.items.entries()) {
|
|
1617
|
-
const s =
|
|
1616
|
+
const s = K.fromBigInt(i);
|
|
1618
1617
|
t.call(e, r, s, this);
|
|
1619
1618
|
}
|
|
1620
1619
|
}
|
|
@@ -1622,14 +1621,14 @@ class ze {
|
|
|
1622
1621
|
yield* this.entries();
|
|
1623
1622
|
}
|
|
1624
1623
|
}
|
|
1625
|
-
class
|
|
1624
|
+
class ze {
|
|
1626
1625
|
// Store tweaked bigint -> index mapping for fast lookup
|
|
1627
1626
|
indexMap;
|
|
1628
1627
|
// Store actual addresses and values
|
|
1629
1628
|
_keys = [];
|
|
1630
1629
|
_values = [];
|
|
1631
1630
|
constructor(t) {
|
|
1632
|
-
if (this.indexMap = new
|
|
1631
|
+
if (this.indexMap = new mt(), t)
|
|
1633
1632
|
for (const [e, i] of t)
|
|
1634
1633
|
this.set(e, i);
|
|
1635
1634
|
}
|
|
@@ -1693,14 +1692,14 @@ class qe {
|
|
|
1693
1692
|
yield* this.entries();
|
|
1694
1693
|
}
|
|
1695
1694
|
}
|
|
1696
|
-
class
|
|
1695
|
+
class Ft {
|
|
1697
1696
|
static EXPECTED_BUFFER_LENGTH = 32;
|
|
1698
1697
|
static bufferToUint8Array(t) {
|
|
1699
1698
|
const e = new Uint8Array(t.byteLength);
|
|
1700
1699
|
return e.set(t), e;
|
|
1701
1700
|
}
|
|
1702
1701
|
static uint8ArrayToHex(t) {
|
|
1703
|
-
return
|
|
1702
|
+
return g(t);
|
|
1704
1703
|
}
|
|
1705
1704
|
static hexToUint8Array(t) {
|
|
1706
1705
|
let e = t;
|
|
@@ -1715,9 +1714,9 @@ class Nt {
|
|
|
1715
1714
|
return y(e);
|
|
1716
1715
|
}
|
|
1717
1716
|
static uint8ArrayToPointer(t) {
|
|
1718
|
-
return t.length === 0 ? 0n : BigInt("0x" +
|
|
1717
|
+
return t.length === 0 ? 0n : BigInt("0x" + g(t));
|
|
1719
1718
|
}
|
|
1720
|
-
static valueToUint8Array(t, e =
|
|
1719
|
+
static valueToUint8Array(t, e = vt) {
|
|
1721
1720
|
if (t < 0n)
|
|
1722
1721
|
throw new RangeError("Value cannot be negative");
|
|
1723
1722
|
const i = t.toString(16).padStart(e * 2, "0");
|
|
@@ -1726,10 +1725,10 @@ class Nt {
|
|
|
1726
1725
|
return y(i);
|
|
1727
1726
|
}
|
|
1728
1727
|
static uint8ArrayToValue(t) {
|
|
1729
|
-
return t.length === 0 ? 0n : BigInt("0x" +
|
|
1728
|
+
return t.length === 0 ? 0n : BigInt("0x" + g(t));
|
|
1730
1729
|
}
|
|
1731
1730
|
}
|
|
1732
|
-
class
|
|
1731
|
+
class Zt {
|
|
1733
1732
|
buffer;
|
|
1734
1733
|
currentOffset = 0;
|
|
1735
1734
|
constructor(t) {
|
|
@@ -1762,79 +1761,79 @@ class Jt {
|
|
|
1762
1761
|
* Reads a single signed byte (i8).
|
|
1763
1762
|
*/
|
|
1764
1763
|
readI8() {
|
|
1765
|
-
this.verifyEnd(this.currentOffset +
|
|
1764
|
+
this.verifyEnd(this.currentOffset + _t);
|
|
1766
1765
|
const t = this.buffer.getInt8(this.currentOffset);
|
|
1767
|
-
return this.currentOffset +=
|
|
1766
|
+
return this.currentOffset += _t, t;
|
|
1768
1767
|
}
|
|
1769
1768
|
/**
|
|
1770
1769
|
* Reads a signed 16-bit integer. By default, big-endian.
|
|
1771
1770
|
* @param be - Endianness; true means big-endian (the default).
|
|
1772
1771
|
*/
|
|
1773
1772
|
readI16(t = !0) {
|
|
1774
|
-
this.verifyEnd(this.currentOffset +
|
|
1773
|
+
this.verifyEnd(this.currentOffset + Bt);
|
|
1775
1774
|
const e = this.buffer.getInt16(this.currentOffset, !t);
|
|
1776
|
-
return this.currentOffset +=
|
|
1775
|
+
return this.currentOffset += Bt, e;
|
|
1777
1776
|
}
|
|
1778
1777
|
/**
|
|
1779
1778
|
* Reads a signed 32-bit integer. By default, big-endian.
|
|
1780
1779
|
* @param be - Endianness; true means big-endian (the default).
|
|
1781
1780
|
*/
|
|
1782
1781
|
readI32(t = !0) {
|
|
1783
|
-
this.verifyEnd(this.currentOffset +
|
|
1782
|
+
this.verifyEnd(this.currentOffset + Ut);
|
|
1784
1783
|
const e = this.buffer.getInt32(this.currentOffset, !t);
|
|
1785
|
-
return this.currentOffset +=
|
|
1784
|
+
return this.currentOffset += Ut, e;
|
|
1786
1785
|
}
|
|
1787
1786
|
/**
|
|
1788
1787
|
* Reads a signed 64-bit integer. By default, big-endian.
|
|
1789
1788
|
* @param be - Endianness; true means big-endian (the default).
|
|
1790
1789
|
*/
|
|
1791
1790
|
readI64(t = !0) {
|
|
1792
|
-
this.verifyEnd(this.currentOffset +
|
|
1791
|
+
this.verifyEnd(this.currentOffset + Ot);
|
|
1793
1792
|
const e = this.buffer.getBigInt64(this.currentOffset, !t);
|
|
1794
|
-
return this.currentOffset +=
|
|
1793
|
+
return this.currentOffset += Ot, e;
|
|
1795
1794
|
}
|
|
1796
1795
|
// ------------------- Unsigned Integer Readers ------------------- //
|
|
1797
1796
|
/**
|
|
1798
1797
|
* Reads a single unsigned byte (u8).
|
|
1799
1798
|
*/
|
|
1800
1799
|
readU8() {
|
|
1801
|
-
this.verifyEnd(this.currentOffset +
|
|
1800
|
+
this.verifyEnd(this.currentOffset + zt);
|
|
1802
1801
|
const t = this.buffer.getUint8(this.currentOffset);
|
|
1803
|
-
return this.currentOffset +=
|
|
1802
|
+
return this.currentOffset += zt, t;
|
|
1804
1803
|
}
|
|
1805
1804
|
/**
|
|
1806
1805
|
* Reads an unsigned 16-bit integer. By default, big-endian.
|
|
1807
1806
|
* @param be - Endianness; true means big-endian (the default).
|
|
1808
1807
|
*/
|
|
1809
1808
|
readU16(t = !0) {
|
|
1810
|
-
this.verifyEnd(this.currentOffset +
|
|
1809
|
+
this.verifyEnd(this.currentOffset + yt);
|
|
1811
1810
|
const e = this.buffer.getUint16(this.currentOffset, !t);
|
|
1812
|
-
return this.currentOffset +=
|
|
1811
|
+
return this.currentOffset += yt, e;
|
|
1813
1812
|
}
|
|
1814
1813
|
/**
|
|
1815
1814
|
* Reads an unsigned 32-bit integer. By default, big-endian.
|
|
1816
1815
|
* @param be - Endianness; true means big-endian (the default).
|
|
1817
1816
|
*/
|
|
1818
1817
|
readU32(t = !0) {
|
|
1819
|
-
this.verifyEnd(this.currentOffset +
|
|
1818
|
+
this.verifyEnd(this.currentOffset + St);
|
|
1820
1819
|
const e = this.buffer.getUint32(this.currentOffset, !t);
|
|
1821
|
-
return this.currentOffset +=
|
|
1820
|
+
return this.currentOffset += St, e;
|
|
1822
1821
|
}
|
|
1823
1822
|
/**
|
|
1824
1823
|
* Reads an unsigned 64-bit integer. By default, big-endian.
|
|
1825
1824
|
* @param be - Endianness; true means big-endian (the default).
|
|
1826
1825
|
*/
|
|
1827
1826
|
readU64(t = !0) {
|
|
1828
|
-
this.verifyEnd(this.currentOffset +
|
|
1827
|
+
this.verifyEnd(this.currentOffset + Vt);
|
|
1829
1828
|
const e = this.buffer.getBigUint64(this.currentOffset, !t);
|
|
1830
|
-
return this.currentOffset +=
|
|
1829
|
+
return this.currentOffset += Vt, e;
|
|
1831
1830
|
}
|
|
1832
1831
|
/**
|
|
1833
1832
|
* Reads a 128-bit unsigned integer. By default, read big-endian.
|
|
1834
1833
|
* @param be - Endianness; true => big-endian (default).
|
|
1835
1834
|
*/
|
|
1836
1835
|
readU128(t = !0) {
|
|
1837
|
-
const e = this.readBytes(
|
|
1836
|
+
const e = this.readBytes(Tt);
|
|
1838
1837
|
let i = e;
|
|
1839
1838
|
return t || (i = this.reverseBytes(e)), BigInt("0x" + this.toHexString(i));
|
|
1840
1839
|
}
|
|
@@ -1843,7 +1842,7 @@ class Jt {
|
|
|
1843
1842
|
* @param be - Endianness; true => big-endian (default).
|
|
1844
1843
|
*/
|
|
1845
1844
|
readU256(t = !0) {
|
|
1846
|
-
const e = this.readBytes(
|
|
1845
|
+
const e = this.readBytes(vt);
|
|
1847
1846
|
let i = e;
|
|
1848
1847
|
return t || (i = this.reverseBytes(e)), BigInt("0x" + this.toHexString(i));
|
|
1849
1848
|
}
|
|
@@ -1852,7 +1851,7 @@ class Jt {
|
|
|
1852
1851
|
* @param be - Endianness; true => big-endian (default).
|
|
1853
1852
|
*/
|
|
1854
1853
|
readI128(t = !0) {
|
|
1855
|
-
const e = this.readBytes(
|
|
1854
|
+
const e = this.readBytes(It);
|
|
1856
1855
|
let i = e;
|
|
1857
1856
|
t || (i = this.reverseBytes(e));
|
|
1858
1857
|
let r = BigInt("0x" + this.toHexString(i));
|
|
@@ -1884,7 +1883,7 @@ class Jt {
|
|
|
1884
1883
|
for (let r = 0; r < t; r++) {
|
|
1885
1884
|
const s = this.buffer.getUint8(this.currentOffset++);
|
|
1886
1885
|
if (e && s === 0) {
|
|
1887
|
-
i =
|
|
1886
|
+
i = new Uint8Array(i.subarray(0, r));
|
|
1888
1887
|
break;
|
|
1889
1888
|
}
|
|
1890
1889
|
i[r] = s;
|
|
@@ -1911,7 +1910,7 @@ class Jt {
|
|
|
1911
1910
|
*/
|
|
1912
1911
|
readAddress() {
|
|
1913
1912
|
const t = Array.from(this.readBytes(R));
|
|
1914
|
-
return new
|
|
1913
|
+
return new K(t);
|
|
1915
1914
|
}
|
|
1916
1915
|
/**
|
|
1917
1916
|
* Reads the tweaked public key portion (32 bytes) and returns it as a raw Uint8Array.
|
|
@@ -1929,9 +1928,9 @@ class Jt {
|
|
|
1929
1928
|
* @returns An Address instance with both keys set
|
|
1930
1929
|
*/
|
|
1931
1930
|
readExtendedAddress() {
|
|
1932
|
-
this.verifyEnd(this.currentOffset +
|
|
1931
|
+
this.verifyEnd(this.currentOffset + ft);
|
|
1933
1932
|
const t = Array.from(this.readBytes(R)), e = Array.from(this.readBytes(R));
|
|
1934
|
-
return new
|
|
1933
|
+
return new K(e, t);
|
|
1935
1934
|
}
|
|
1936
1935
|
/**
|
|
1937
1936
|
* Reads a Schnorr signature with its associated full Address.
|
|
@@ -1944,9 +1943,9 @@ class Jt {
|
|
|
1944
1943
|
*/
|
|
1945
1944
|
readSchnorrSignature() {
|
|
1946
1945
|
this.verifyEnd(
|
|
1947
|
-
this.currentOffset +
|
|
1946
|
+
this.currentOffset + ft + gt
|
|
1948
1947
|
);
|
|
1949
|
-
const t = this.readExtendedAddress(), e = this.readBytes(
|
|
1948
|
+
const t = this.readExtendedAddress(), e = this.readBytes(gt);
|
|
1950
1949
|
return { address: t, signature: e };
|
|
1951
1950
|
}
|
|
1952
1951
|
/**
|
|
@@ -2025,7 +2024,7 @@ class Jt {
|
|
|
2025
2024
|
* Reads [u16 length][ (address, u256) pairs ].
|
|
2026
2025
|
*/
|
|
2027
2026
|
readAddressValueTuple(t = !0) {
|
|
2028
|
-
const e = this.readU16(t), i = new
|
|
2027
|
+
const e = this.readU16(t), i = new Ve();
|
|
2029
2028
|
for (let r = 0; r < e; r++) {
|
|
2030
2029
|
const s = this.readAddress(), o = this.readU256(t);
|
|
2031
2030
|
if (i.has(s))
|
|
@@ -2051,7 +2050,7 @@ class Jt {
|
|
|
2051
2050
|
* This is the equivalent of btc-runtime's readExtendedAddressMapU256().
|
|
2052
2051
|
*/
|
|
2053
2052
|
readExtendedAddressMapU256(t = !0) {
|
|
2054
|
-
const e = this.readU16(t), i = new
|
|
2053
|
+
const e = this.readU16(t), i = new ze();
|
|
2055
2054
|
for (let r = 0; r < e; r++) {
|
|
2056
2055
|
const s = this.readExtendedAddress(), o = this.readU256(t);
|
|
2057
2056
|
if (i.has(s))
|
|
@@ -2100,26 +2099,26 @@ class H {
|
|
|
2100
2099
|
}
|
|
2101
2100
|
static estimateArrayOfBufferLength(t) {
|
|
2102
2101
|
if (t.length > 65535) throw new Error("Array size is too large");
|
|
2103
|
-
let e =
|
|
2102
|
+
let e = yt;
|
|
2104
2103
|
for (let i = 0; i < t.length; i++)
|
|
2105
|
-
e +=
|
|
2104
|
+
e += St + t[i].length;
|
|
2106
2105
|
return e;
|
|
2107
2106
|
}
|
|
2108
2107
|
writeU8(t) {
|
|
2109
2108
|
if (t > 255) throw new Error("u8 value is too large.");
|
|
2110
|
-
this.allocSafe(
|
|
2109
|
+
this.allocSafe(zt), this.buffer.setUint8(this.currentOffset++, t);
|
|
2111
2110
|
}
|
|
2112
2111
|
writeU16(t, e = !0) {
|
|
2113
2112
|
if (t > 65535) throw new Error("u16 value is too large.");
|
|
2114
|
-
this.allocSafe(
|
|
2113
|
+
this.allocSafe(yt), this.buffer.setUint16(this.currentOffset, t, !e), this.currentOffset += 2;
|
|
2115
2114
|
}
|
|
2116
2115
|
writeU32(t, e = !0) {
|
|
2117
2116
|
if (t > 4294967295) throw new Error("u32 value is too large.");
|
|
2118
|
-
this.allocSafe(
|
|
2117
|
+
this.allocSafe(St), this.buffer.setUint32(this.currentOffset, t, !e), this.currentOffset += 4;
|
|
2119
2118
|
}
|
|
2120
2119
|
writeU64(t, e = !0) {
|
|
2121
2120
|
if (t > 18446744073709551615n) throw new Error("u64 value is too large.");
|
|
2122
|
-
this.allocSafe(
|
|
2121
|
+
this.allocSafe(Vt), this.buffer.setBigUint64(this.currentOffset, t, !e), this.currentOffset += 8;
|
|
2123
2122
|
}
|
|
2124
2123
|
// ------------------- Signed Integer Writers ------------------- //
|
|
2125
2124
|
/**
|
|
@@ -2127,14 +2126,14 @@ class H {
|
|
|
2127
2126
|
*/
|
|
2128
2127
|
writeI8(t) {
|
|
2129
2128
|
if (t < -128 || t > 127) throw new Error("i8 value is out of range.");
|
|
2130
|
-
this.allocSafe(
|
|
2129
|
+
this.allocSafe(_t), this.buffer.setInt8(this.currentOffset, t), this.currentOffset += _t;
|
|
2131
2130
|
}
|
|
2132
2131
|
/**
|
|
2133
2132
|
* Writes a signed 16-bit integer. By default big-endian (be = true).
|
|
2134
2133
|
*/
|
|
2135
2134
|
writeI16(t, e = !0) {
|
|
2136
2135
|
if (t < -32768 || t > 32767) throw new Error("i16 value is out of range.");
|
|
2137
|
-
this.allocSafe(
|
|
2136
|
+
this.allocSafe(Bt), this.buffer.setInt16(this.currentOffset, t, !e), this.currentOffset += Bt;
|
|
2138
2137
|
}
|
|
2139
2138
|
/**
|
|
2140
2139
|
* Writes a signed 32-bit integer. By default big-endian (be = true).
|
|
@@ -2142,7 +2141,7 @@ class H {
|
|
|
2142
2141
|
writeI32(t, e = !0) {
|
|
2143
2142
|
if (t < -2147483648 || t > 2147483647)
|
|
2144
2143
|
throw new Error("i32 value is out of range.");
|
|
2145
|
-
this.allocSafe(
|
|
2144
|
+
this.allocSafe(Ut), this.buffer.setInt32(this.currentOffset, t, !e), this.currentOffset += Ut;
|
|
2146
2145
|
}
|
|
2147
2146
|
/**
|
|
2148
2147
|
* Writes a signed 64-bit integer. By default big-endian (be = true).
|
|
@@ -2150,7 +2149,7 @@ class H {
|
|
|
2150
2149
|
writeI64(t, e = !0) {
|
|
2151
2150
|
if (t < -9223372036854775808n || t > 9223372036854775807n)
|
|
2152
2151
|
throw new Error("i64 value is out of range.");
|
|
2153
|
-
this.allocSafe(
|
|
2152
|
+
this.allocSafe(Ot), this.buffer.setBigInt64(this.currentOffset, t, !e), this.currentOffset += Ot;
|
|
2154
2153
|
}
|
|
2155
2154
|
// ---------------------------------------------------------------- //
|
|
2156
2155
|
writeSelector(t) {
|
|
@@ -2162,9 +2161,9 @@ class H {
|
|
|
2162
2161
|
writeI128(t, e = !0) {
|
|
2163
2162
|
if (t > 170141183460469231731687303715884105727n || t < -170141183460469231731687303715884105728n)
|
|
2164
2163
|
throw new Error("i128 value is too large.");
|
|
2165
|
-
this.allocSafe(
|
|
2166
|
-
const i =
|
|
2167
|
-
if (i.byteLength !==
|
|
2164
|
+
this.allocSafe(It);
|
|
2165
|
+
const i = Ft.valueToUint8Array(t, It);
|
|
2166
|
+
if (i.byteLength !== It)
|
|
2168
2167
|
throw new Error(`Invalid i128 value: ${t}`);
|
|
2169
2168
|
if (e)
|
|
2170
2169
|
for (let r = 0; r < i.byteLength; r++)
|
|
@@ -2176,9 +2175,9 @@ class H {
|
|
|
2176
2175
|
writeU256(t, e = !0) {
|
|
2177
2176
|
if (t > 115792089237316195423570985008687907853269984665640564039457584007913129639935n && t < 0n)
|
|
2178
2177
|
throw new Error("u256 value is too large or negative.");
|
|
2179
|
-
this.allocSafe(
|
|
2180
|
-
const i =
|
|
2181
|
-
if (i.byteLength !==
|
|
2178
|
+
this.allocSafe(vt);
|
|
2179
|
+
const i = Ft.valueToUint8Array(t);
|
|
2180
|
+
if (i.byteLength !== vt)
|
|
2182
2181
|
throw new Error(`Invalid u256 value: ${t}`);
|
|
2183
2182
|
if (e)
|
|
2184
2183
|
for (let r = 0; r < i.byteLength; r++)
|
|
@@ -2190,9 +2189,9 @@ class H {
|
|
|
2190
2189
|
writeU128(t, e = !0) {
|
|
2191
2190
|
if (t > 340282366920938463463374607431768211455n && t < 0n)
|
|
2192
2191
|
throw new Error("u128 value is too large or negative.");
|
|
2193
|
-
this.allocSafe(
|
|
2194
|
-
const i =
|
|
2195
|
-
if (i.byteLength !==
|
|
2192
|
+
this.allocSafe(Tt);
|
|
2193
|
+
const i = Ft.valueToUint8Array(t, Tt);
|
|
2194
|
+
if (i.byteLength !== Tt)
|
|
2196
2195
|
throw new Error(`Invalid u128 value: ${t}`);
|
|
2197
2196
|
if (e)
|
|
2198
2197
|
for (let r = 0; r < i.byteLength; r++)
|
|
@@ -2212,7 +2211,7 @@ class H {
|
|
|
2212
2211
|
}
|
|
2213
2212
|
writeStringWithLength(t) {
|
|
2214
2213
|
const i = new TextEncoder().encode(t);
|
|
2215
|
-
this.allocSafe(
|
|
2214
|
+
this.allocSafe(St + i.length), this.writeU32(i.length), this.writeBytes(i);
|
|
2216
2215
|
}
|
|
2217
2216
|
/**
|
|
2218
2217
|
* Writes an address (32 bytes MLDSA key hash only).
|
|
@@ -2237,7 +2236,7 @@ class H {
|
|
|
2237
2236
|
* @param value - The Address containing both keys
|
|
2238
2237
|
*/
|
|
2239
2238
|
writeExtendedAddress(t) {
|
|
2240
|
-
this.allocSafe(
|
|
2239
|
+
this.allocSafe(ft), this.writeTweakedPublicKey(t), this.writeBytes(t);
|
|
2241
2240
|
}
|
|
2242
2241
|
/**
|
|
2243
2242
|
* Writes a Schnorr signature with its associated full Address.
|
|
@@ -2251,11 +2250,11 @@ class H {
|
|
|
2251
2250
|
* @throws {Error} If signature is not exactly 64 bytes
|
|
2252
2251
|
*/
|
|
2253
2252
|
writeSchnorrSignature(t, e) {
|
|
2254
|
-
if (e.length !==
|
|
2253
|
+
if (e.length !== gt)
|
|
2255
2254
|
throw new Error(
|
|
2256
|
-
`Invalid Schnorr signature length: expected ${
|
|
2255
|
+
`Invalid Schnorr signature length: expected ${gt}, got ${e.length}`
|
|
2257
2256
|
);
|
|
2258
|
-
this.allocSafe(
|
|
2257
|
+
this.allocSafe(ft + gt), this.writeExtendedAddress(t), this.writeBytes(e);
|
|
2259
2258
|
}
|
|
2260
2259
|
getBuffer(t = !0) {
|
|
2261
2260
|
const e = new Uint8Array(this.buffer.byteLength);
|
|
@@ -2267,7 +2266,7 @@ class H {
|
|
|
2267
2266
|
this.currentOffset = 0, this.buffer = this.getDefaultBuffer(4);
|
|
2268
2267
|
}
|
|
2269
2268
|
toBytesReader() {
|
|
2270
|
-
return new
|
|
2269
|
+
return new Zt(this.getBuffer());
|
|
2271
2270
|
}
|
|
2272
2271
|
getOffset() {
|
|
2273
2272
|
return this.currentOffset;
|
|
@@ -2327,7 +2326,7 @@ class H {
|
|
|
2327
2326
|
*/
|
|
2328
2327
|
writeExtendedAddressArray(t) {
|
|
2329
2328
|
if (t.length > 65535) throw new Error("Array size is too large");
|
|
2330
|
-
this.allocSafe(
|
|
2329
|
+
this.allocSafe(yt + t.length * ft), this.writeU16(t.length);
|
|
2331
2330
|
for (let e = 0; e < t.length; e++)
|
|
2332
2331
|
this.writeExtendedAddress(t[e]);
|
|
2333
2332
|
}
|
|
@@ -2395,7 +2394,7 @@ class H {
|
|
|
2395
2394
|
return new DataView(new ArrayBuffer(t));
|
|
2396
2395
|
}
|
|
2397
2396
|
}
|
|
2398
|
-
class
|
|
2397
|
+
class Q {
|
|
2399
2398
|
/**
|
|
2400
2399
|
* The maximum size of a data chunk
|
|
2401
2400
|
*/
|
|
@@ -2403,7 +2402,7 @@ class Z {
|
|
|
2403
2402
|
/**
|
|
2404
2403
|
* The magic number of OPNet
|
|
2405
2404
|
*/
|
|
2406
|
-
static MAGIC =
|
|
2405
|
+
static MAGIC = Oi("op");
|
|
2407
2406
|
/**
|
|
2408
2407
|
* The public key of the sender
|
|
2409
2408
|
* @protected
|
|
@@ -2431,7 +2430,7 @@ class Z {
|
|
|
2431
2430
|
let e = 0;
|
|
2432
2431
|
for (const r of t)
|
|
2433
2432
|
e |= r;
|
|
2434
|
-
const i =
|
|
2433
|
+
const i = ee(3);
|
|
2435
2434
|
return i[0] = e >> 16 & 255, i[1] = e >> 8 & 255, i[2] = e & 255, Uint8Array.from([this.senderPubKey[0], ...i]);
|
|
2436
2435
|
}
|
|
2437
2436
|
getHeader(t, e = []) {
|
|
@@ -2445,10 +2444,10 @@ class Z {
|
|
|
2445
2444
|
* @protected
|
|
2446
2445
|
* @returns {Array<Uint8Array[]>} - The chunks
|
|
2447
2446
|
*/
|
|
2448
|
-
splitBufferIntoChunks(t, e =
|
|
2447
|
+
splitBufferIntoChunks(t, e = Q.DATA_CHUNK_SIZE) {
|
|
2449
2448
|
const i = [];
|
|
2450
2449
|
for (let r = 0; r < t.length; r += e) {
|
|
2451
|
-
const s = Math.min(e, t.length - r), o =
|
|
2450
|
+
const s = Math.min(e, t.length - r), o = ee(s);
|
|
2452
2451
|
for (let a = 0; a < s; a++)
|
|
2453
2452
|
o[a] = t[r + a];
|
|
2454
2453
|
i.push([o]);
|
|
@@ -2457,14 +2456,14 @@ class Z {
|
|
|
2457
2456
|
}
|
|
2458
2457
|
encodeFeature(t, e) {
|
|
2459
2458
|
switch (t.opcode) {
|
|
2460
|
-
case
|
|
2459
|
+
case z.ACCESS_LIST:
|
|
2461
2460
|
return this.encodeAccessListFeature(t, e);
|
|
2462
|
-
case
|
|
2461
|
+
case z.EPOCH_SUBMISSION:
|
|
2463
2462
|
return this.encodeChallengeSubmission(
|
|
2464
2463
|
t,
|
|
2465
2464
|
e
|
|
2466
2465
|
);
|
|
2467
|
-
case
|
|
2466
|
+
case z.MLDSA_LINK_PUBKEY:
|
|
2468
2467
|
return this.encodeLinkRequest(t, e);
|
|
2469
2468
|
default:
|
|
2470
2469
|
throw new Error(`Unknown feature type: ${t.opcode}`);
|
|
@@ -2474,7 +2473,7 @@ class Z {
|
|
|
2474
2473
|
const i = new H();
|
|
2475
2474
|
i.writeU16(Object.keys(t.data).length);
|
|
2476
2475
|
for (const r in t.data) {
|
|
2477
|
-
const s =
|
|
2476
|
+
const s = K.fromString(r), o = t.data[r];
|
|
2478
2477
|
i.writeAddress(s), i.writeU32(o.length);
|
|
2479
2478
|
for (const a of o) {
|
|
2480
2479
|
const c = Uint8Array.from(atob(a), (u) => u.charCodeAt(0));
|
|
@@ -2483,7 +2482,7 @@ class Z {
|
|
|
2483
2482
|
i.writeBytes(c);
|
|
2484
2483
|
}
|
|
2485
2484
|
}
|
|
2486
|
-
e.writeBytesWithLength(
|
|
2485
|
+
e.writeBytesWithLength(X.compress(new Uint8Array(i.getBuffer())));
|
|
2487
2486
|
}
|
|
2488
2487
|
encodeChallengeSubmission(t, e) {
|
|
2489
2488
|
if ("verifySignature" in t.data && !t.data.verifySignature())
|
|
@@ -2505,7 +2504,7 @@ class Z {
|
|
|
2505
2504
|
r.writeBytes(i.legacySignature), e.writeBytesWithLength(r.getBuffer());
|
|
2506
2505
|
}
|
|
2507
2506
|
}
|
|
2508
|
-
class
|
|
2507
|
+
class he extends Q {
|
|
2509
2508
|
constructor(t, e, i = A.bitcoin) {
|
|
2510
2509
|
super(t, e, i);
|
|
2511
2510
|
}
|
|
@@ -2523,9 +2522,9 @@ class de extends Z {
|
|
|
2523
2522
|
throw new Error("Public key must be compressed");
|
|
2524
2523
|
if (s.byteLength !== 33)
|
|
2525
2524
|
throw new Error(`Public key must be 33 bytes, got ${s.byteLength} bytes.`);
|
|
2526
|
-
i =
|
|
2525
|
+
i = ut([i, s]);
|
|
2527
2526
|
}
|
|
2528
|
-
const r =
|
|
2527
|
+
const r = X.compress(i);
|
|
2529
2528
|
return r.byteLength >= i.byteLength ? i : r;
|
|
2530
2529
|
}
|
|
2531
2530
|
/**
|
|
@@ -2578,7 +2577,7 @@ class de extends Z {
|
|
|
2578
2577
|
f.OP_1,
|
|
2579
2578
|
f.OP_NUMEQUAL,
|
|
2580
2579
|
f.OP_IF,
|
|
2581
|
-
|
|
2580
|
+
Q.MAGIC
|
|
2582
2581
|
];
|
|
2583
2582
|
u = u.concat(
|
|
2584
2583
|
...c,
|
|
@@ -2594,7 +2593,7 @@ class de extends Z {
|
|
|
2594
2593
|
return h;
|
|
2595
2594
|
}
|
|
2596
2595
|
}
|
|
2597
|
-
class
|
|
2596
|
+
class qe extends Q {
|
|
2598
2597
|
constructor(t, e = A.bitcoin) {
|
|
2599
2598
|
super(t, void 0, e);
|
|
2600
2599
|
}
|
|
@@ -2611,8 +2610,8 @@ class Xe extends Z {
|
|
|
2611
2610
|
return i;
|
|
2612
2611
|
}
|
|
2613
2612
|
}
|
|
2614
|
-
const
|
|
2615
|
-
class
|
|
2613
|
+
const Xe = 0, $e = Uint8Array.from([Xe]);
|
|
2614
|
+
class de extends Q {
|
|
2616
2615
|
constructor(t, e, i = A.bitcoin) {
|
|
2617
2616
|
super(t, e, i);
|
|
2618
2617
|
}
|
|
@@ -2677,7 +2676,7 @@ class pe extends Z {
|
|
|
2677
2676
|
f.OP_1,
|
|
2678
2677
|
f.OP_NUMEQUAL,
|
|
2679
2678
|
f.OP_IF,
|
|
2680
|
-
|
|
2679
|
+
Q.MAGIC,
|
|
2681
2680
|
...l,
|
|
2682
2681
|
f.OP_0,
|
|
2683
2682
|
...c,
|
|
@@ -2689,7 +2688,7 @@ class pe extends Z {
|
|
|
2689
2688
|
].flat();
|
|
2690
2689
|
}
|
|
2691
2690
|
}
|
|
2692
|
-
class E extends
|
|
2691
|
+
class E extends Ce {
|
|
2693
2692
|
/**
|
|
2694
2693
|
* Maximum chunk size per Bitcoin P2WSH stack item limit.
|
|
2695
2694
|
* See policy.h: MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80
|
|
@@ -3005,7 +3004,7 @@ class E extends Fe {
|
|
|
3005
3004
|
), s;
|
|
3006
3005
|
}
|
|
3007
3006
|
}
|
|
3008
|
-
class lr extends
|
|
3007
|
+
class lr extends Q {
|
|
3009
3008
|
constructor(t, e = A.bitcoin) {
|
|
3010
3009
|
super(t, new Uint8Array(0), e);
|
|
3011
3010
|
}
|
|
@@ -3023,9 +3022,9 @@ class lr extends Z {
|
|
|
3023
3022
|
throw new Error("Public key must be compressed");
|
|
3024
3023
|
if (s.byteLength !== 33)
|
|
3025
3024
|
throw new Error(`Public key must be 33 bytes, got ${s.byteLength} bytes.`);
|
|
3026
|
-
i =
|
|
3025
|
+
i = ut([i, s]);
|
|
3027
3026
|
}
|
|
3028
|
-
const r =
|
|
3027
|
+
const r = X.compress(i);
|
|
3029
3028
|
return r.byteLength >= i.byteLength ? i : r;
|
|
3030
3029
|
}
|
|
3031
3030
|
/**
|
|
@@ -3072,7 +3071,7 @@ class lr extends Z {
|
|
|
3072
3071
|
f.OP_1,
|
|
3073
3072
|
f.OP_NUMEQUAL,
|
|
3074
3073
|
f.OP_IF,
|
|
3075
|
-
|
|
3074
|
+
Q.MAGIC
|
|
3076
3075
|
];
|
|
3077
3076
|
u = u.concat(
|
|
3078
3077
|
...c,
|
|
@@ -3088,21 +3087,21 @@ class lr extends Z {
|
|
|
3088
3087
|
return h;
|
|
3089
3088
|
}
|
|
3090
3089
|
}
|
|
3091
|
-
class
|
|
3090
|
+
class kt {
|
|
3092
3091
|
static MAXIMUM_SUPPORTED_SIGNATURE = 255;
|
|
3093
3092
|
static compile(t, e = 0, i) {
|
|
3094
3093
|
if (e < 2)
|
|
3095
3094
|
throw new Error("Minimum signatures must be greater than 1");
|
|
3096
3095
|
if (t.length < e)
|
|
3097
3096
|
throw new Error("The amount of public keys is lower than the minimum required");
|
|
3098
|
-
if (e >
|
|
3097
|
+
if (e > kt.MAXIMUM_SUPPORTED_SIGNATURE)
|
|
3099
3098
|
throw new Error(
|
|
3100
|
-
`The maximum amount of signatures is ${
|
|
3099
|
+
`The maximum amount of signatures is ${kt.MAXIMUM_SUPPORTED_SIGNATURE}`
|
|
3101
3100
|
);
|
|
3102
|
-
const r =
|
|
3101
|
+
const r = ee(1);
|
|
3103
3102
|
r[0] = e, t = t.filter(
|
|
3104
3103
|
(h, p, d) => p === d.findIndex((m) => D(h, m))
|
|
3105
|
-
), t = t.sort((h, p) =>
|
|
3104
|
+
), t = t.sort((h, p) => Ui(h, p));
|
|
3106
3105
|
let s = !1;
|
|
3107
3106
|
const o = t.map((h) => {
|
|
3108
3107
|
const p = O(h);
|
|
@@ -3129,7 +3128,7 @@ class Lt {
|
|
|
3129
3128
|
return u;
|
|
3130
3129
|
}
|
|
3131
3130
|
}
|
|
3132
|
-
class
|
|
3131
|
+
class Lt extends Q {
|
|
3133
3132
|
static P2WDA_VERSION = 1;
|
|
3134
3133
|
constructor(t, e, i = A.bitcoin) {
|
|
3135
3134
|
super(t, e, i);
|
|
@@ -3168,7 +3167,7 @@ class xt extends Z {
|
|
|
3168
3167
|
if (e.length !== 32)
|
|
3169
3168
|
throw new Error("Contract secret must be exactly 32 bytes");
|
|
3170
3169
|
const o = new H();
|
|
3171
|
-
o.writeU8(
|
|
3170
|
+
o.writeU8(Lt.P2WDA_VERSION);
|
|
3172
3171
|
const a = s.sort((c, u) => c.priority - u.priority);
|
|
3173
3172
|
return o.writeBytes(
|
|
3174
3173
|
this.getHeader(
|
|
@@ -3195,39 +3194,39 @@ class xt extends Z {
|
|
|
3195
3194
|
t.writeU8(i.opcode), this.encodeFeature(i, t);
|
|
3196
3195
|
}
|
|
3197
3196
|
}
|
|
3198
|
-
class
|
|
3197
|
+
class pe {
|
|
3199
3198
|
// Generate a valid SegWit address from random bytes
|
|
3200
3199
|
static generatePKSH(t, e) {
|
|
3201
3200
|
if (t.length !== 32) throw new Error("Invalid hash length");
|
|
3202
|
-
const i =
|
|
3201
|
+
const i = Bi(t);
|
|
3203
3202
|
return this.toSegwitAddress(i, e);
|
|
3204
3203
|
}
|
|
3205
3204
|
// Generate a valid Taproot address from a public key
|
|
3206
3205
|
static generateTaprootAddress(t, e) {
|
|
3207
3206
|
if (t.length !== 32) throw new Error("Invalid public key length");
|
|
3208
|
-
const i =
|
|
3209
|
-
return i.unshift(1),
|
|
3207
|
+
const i = Ct.bech32m.toWords(t);
|
|
3208
|
+
return i.unshift(1), Ct.bech32m.encode(e.bech32, i);
|
|
3210
3209
|
}
|
|
3211
3210
|
// Convert a hash to a SegWit address
|
|
3212
3211
|
static toSegwitAddress(t, e) {
|
|
3213
|
-
const i =
|
|
3214
|
-
return i.unshift(0),
|
|
3212
|
+
const i = Ct.bech32.toWords(t);
|
|
3213
|
+
return i.unshift(0), Ct.bech32.encode(e.bech32, i);
|
|
3215
3214
|
}
|
|
3216
3215
|
}
|
|
3217
|
-
class
|
|
3216
|
+
class rt {
|
|
3218
3217
|
static TAP_SCRIPT_VERSION = 192;
|
|
3219
3218
|
static getContractAddress(t) {
|
|
3220
|
-
const { scriptTree: e } =
|
|
3221
|
-
return
|
|
3219
|
+
const { scriptTree: e } = rt.buildScriptTree(t);
|
|
3220
|
+
return rt.generateAddressFromScript(t, e);
|
|
3222
3221
|
}
|
|
3223
3222
|
static verifyControlBlock(t, e) {
|
|
3224
|
-
const { scriptTree: i, compiledTargetScript: r, network: s } =
|
|
3223
|
+
const { scriptTree: i, compiledTargetScript: r, network: s } = rt.buildScriptTree(t), a = _.p2tr({
|
|
3225
3224
|
internalPubkey: O(t.deployerPubKey),
|
|
3226
3225
|
network: s,
|
|
3227
3226
|
scriptTree: i,
|
|
3228
3227
|
redeem: {
|
|
3229
3228
|
output: r,
|
|
3230
|
-
redeemVersion:
|
|
3229
|
+
redeemVersion: rt.TAP_SCRIPT_VERSION
|
|
3231
3230
|
}
|
|
3232
3231
|
}).witness;
|
|
3233
3232
|
if (!a || a.length === 0)
|
|
@@ -3236,7 +3235,7 @@ class st {
|
|
|
3236
3235
|
return D(c, e);
|
|
3237
3236
|
}
|
|
3238
3237
|
static getContractSeed(t, e, i) {
|
|
3239
|
-
const r = C.hash256(e), s =
|
|
3238
|
+
const r = C.hash256(e), s = ut([t, i, r]);
|
|
3240
3239
|
return C.hash256(s);
|
|
3241
3240
|
}
|
|
3242
3241
|
static generateAddressFromScript(t, e) {
|
|
@@ -3248,7 +3247,7 @@ class st {
|
|
|
3248
3247
|
return _.p2tr(r).address;
|
|
3249
3248
|
}
|
|
3250
3249
|
static buildScriptTree(t) {
|
|
3251
|
-
const e = t.network || A.bitcoin, r = new
|
|
3250
|
+
const e = t.network || A.bitcoin, r = new de(
|
|
3252
3251
|
t.deployerPubKey,
|
|
3253
3252
|
O(t.contractSaltPubKey),
|
|
3254
3253
|
e
|
|
@@ -3266,19 +3265,19 @@ class st {
|
|
|
3266
3265
|
return { scriptTree: [
|
|
3267
3266
|
{
|
|
3268
3267
|
output: r,
|
|
3269
|
-
version:
|
|
3268
|
+
version: rt.TAP_SCRIPT_VERSION
|
|
3270
3269
|
},
|
|
3271
3270
|
{
|
|
3272
3271
|
output: s,
|
|
3273
|
-
version:
|
|
3272
|
+
version: rt.TAP_SCRIPT_VERSION
|
|
3274
3273
|
}
|
|
3275
3274
|
], compiledTargetScript: r, network: e };
|
|
3276
3275
|
}
|
|
3277
3276
|
}
|
|
3278
|
-
function
|
|
3277
|
+
function lt(n) {
|
|
3279
3278
|
return "privateKey" in n && n.privateKey != null;
|
|
3280
3279
|
}
|
|
3281
|
-
class
|
|
3280
|
+
class fe {
|
|
3282
3281
|
/**
|
|
3283
3282
|
* Tweak a signer
|
|
3284
3283
|
* @param {UniversalSigner} signer - The signer to tweak (must have privateKey)
|
|
@@ -3292,14 +3291,14 @@ class ge {
|
|
|
3292
3291
|
t.publicKey[0] === 3 && (i = W.privateNegate(i));
|
|
3293
3292
|
const r = W.privateAdd(
|
|
3294
3293
|
i,
|
|
3295
|
-
|
|
3294
|
+
_i(O(t.publicKey), e.tweakHash)
|
|
3296
3295
|
);
|
|
3297
3296
|
if (!r)
|
|
3298
3297
|
throw new Error("Invalid tweaked private key!");
|
|
3299
3298
|
return P.fromPrivateKey(r, e.network);
|
|
3300
3299
|
}
|
|
3301
3300
|
}
|
|
3302
|
-
function
|
|
3301
|
+
function Ye(n) {
|
|
3303
3302
|
return typeof n == "object" && n !== null && "web3" in n && typeof n.web3 == "object" && "getMLDSAPublicKey" in n.web3 && "signMLDSAMessage" in n.web3;
|
|
3304
3303
|
}
|
|
3305
3304
|
class hr {
|
|
@@ -3310,7 +3309,7 @@ class hr {
|
|
|
3310
3309
|
const e = this.getOPWallet();
|
|
3311
3310
|
if (!e)
|
|
3312
3311
|
return null;
|
|
3313
|
-
const i = typeof t == "string" ? new TextEncoder().encode(t) : t, r = this.sha256(i), s =
|
|
3312
|
+
const i = typeof t == "string" ? new TextEncoder().encode(t) : t, r = this.sha256(i), s = g(r), o = await e.web3.signSchnorr(s);
|
|
3314
3313
|
return {
|
|
3315
3314
|
signature: y(o),
|
|
3316
3315
|
message: r
|
|
@@ -3320,7 +3319,7 @@ class hr {
|
|
|
3320
3319
|
const e = this.getOPWallet();
|
|
3321
3320
|
if (!e)
|
|
3322
3321
|
return null;
|
|
3323
|
-
const i = typeof t == "string" ? new TextEncoder().encode(t) : t, r = this.sha256(i), s =
|
|
3322
|
+
const i = typeof t == "string" ? new TextEncoder().encode(t) : t, r = this.sha256(i), s = g(r), o = await e.web3.signMLDSAMessage(s);
|
|
3324
3323
|
return {
|
|
3325
3324
|
signature: y(o.signature),
|
|
3326
3325
|
message: r,
|
|
@@ -3362,12 +3361,12 @@ class hr {
|
|
|
3362
3361
|
if (!i)
|
|
3363
3362
|
return null;
|
|
3364
3363
|
const r = typeof t == "string" ? new TextEncoder().encode(t) : t, s = this.sha256(r), o = {
|
|
3365
|
-
signature:
|
|
3366
|
-
publicKey:
|
|
3364
|
+
signature: g(e.signature),
|
|
3365
|
+
publicKey: g(e.publicKey),
|
|
3367
3366
|
securityLevel: e.securityLevel,
|
|
3368
|
-
messageHash:
|
|
3367
|
+
messageHash: g(s)
|
|
3369
3368
|
};
|
|
3370
|
-
return i.web3.verifyMLDSASignature(
|
|
3369
|
+
return i.web3.verifyMLDSASignature(g(s), o);
|
|
3371
3370
|
}
|
|
3372
3371
|
async getMLDSAPublicKeyFromOPWallet() {
|
|
3373
3372
|
const t = this.getOPWallet();
|
|
@@ -3377,7 +3376,7 @@ class hr {
|
|
|
3377
3376
|
return y(e);
|
|
3378
3377
|
}
|
|
3379
3378
|
tweakAndSignMessage(t, e, i) {
|
|
3380
|
-
const r =
|
|
3379
|
+
const r = fe.tweakSigner(t, { network: i });
|
|
3381
3380
|
return this.signMessage(r, e);
|
|
3382
3381
|
}
|
|
3383
3382
|
signMessage(t, e) {
|
|
@@ -3430,11 +3429,11 @@ class hr {
|
|
|
3430
3429
|
if (typeof window > "u")
|
|
3431
3430
|
return null;
|
|
3432
3431
|
const t = window;
|
|
3433
|
-
return !t.opnet || !
|
|
3432
|
+
return !t.opnet || !Ye(t.opnet) ? null : t.opnet;
|
|
3434
3433
|
}
|
|
3435
3434
|
}
|
|
3436
|
-
const
|
|
3437
|
-
class
|
|
3435
|
+
const ot = new hr();
|
|
3436
|
+
class et {
|
|
3438
3437
|
constructor(t, e, i = A.bitcoin, r = U.MLDSASecurityLevel.LEVEL2, s) {
|
|
3439
3438
|
this.network = i, this._securityLevel = r;
|
|
3440
3439
|
const o = t.startsWith("0x") ? t.replace("0x", "") : t;
|
|
@@ -3461,7 +3460,7 @@ class it {
|
|
|
3461
3460
|
);
|
|
3462
3461
|
} else
|
|
3463
3462
|
this._mldsaKeypair = U.QuantumBIP32Factory.fromBase58(a), this._chainCode = new Uint8Array(this._mldsaKeypair.chainCode), this._securityLevel = this._mldsaKeypair.securityLevel;
|
|
3464
|
-
this._bufferPubKey = this._keypair.publicKey, this._address = new
|
|
3463
|
+
this._bufferPubKey = this._keypair.publicKey, this._address = new K(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();
|
|
3465
3464
|
}
|
|
3466
3465
|
_keypair;
|
|
3467
3466
|
_mldsaKeypair;
|
|
@@ -3525,25 +3524,25 @@ class it {
|
|
|
3525
3524
|
return new Uint8Array(this._mldsaKeypair.privateKey);
|
|
3526
3525
|
}
|
|
3527
3526
|
get quantumPublicKeyHex() {
|
|
3528
|
-
return
|
|
3527
|
+
return g(new Uint8Array(this._mldsaKeypair.publicKey));
|
|
3529
3528
|
}
|
|
3530
3529
|
get quantumPrivateKeyHex() {
|
|
3531
3530
|
if (!this._mldsaKeypair.privateKey)
|
|
3532
3531
|
throw new Error("Quantum private key not set");
|
|
3533
|
-
return
|
|
3532
|
+
return g(new Uint8Array(this._mldsaKeypair.privateKey));
|
|
3534
3533
|
}
|
|
3535
3534
|
get xOnly() {
|
|
3536
3535
|
if (!this.keypair) throw new Error("Keypair not set");
|
|
3537
3536
|
return O(this._bufferPubKey);
|
|
3538
3537
|
}
|
|
3539
3538
|
static fromWif(t, e, i = A.bitcoin, r = U.MLDSASecurityLevel.LEVEL2, s) {
|
|
3540
|
-
return new
|
|
3539
|
+
return new et(t, e, i, r, s);
|
|
3541
3540
|
}
|
|
3542
3541
|
static generate(t = A.bitcoin, e = U.MLDSASecurityLevel.LEVEL2) {
|
|
3543
3542
|
const i = P.generateWallet(t, e);
|
|
3544
3543
|
if (!i.quantumPrivateKey)
|
|
3545
3544
|
throw new Error("Failed to generate quantum keys");
|
|
3546
|
-
return new
|
|
3545
|
+
return new et(
|
|
3547
3546
|
i.privateKey,
|
|
3548
3547
|
i.quantumPrivateKey,
|
|
3549
3548
|
t,
|
|
@@ -3551,7 +3550,7 @@ class it {
|
|
|
3551
3550
|
);
|
|
3552
3551
|
}
|
|
3553
3552
|
static fromPrivateKeys(t, e, i = A.bitcoin, r = U.MLDSASecurityLevel.LEVEL2, s) {
|
|
3554
|
-
return new
|
|
3553
|
+
return new et(
|
|
3555
3554
|
t,
|
|
3556
3555
|
e,
|
|
3557
3556
|
i,
|
|
@@ -3565,10 +3564,10 @@ class it {
|
|
|
3565
3564
|
toPrivateKeyHex() {
|
|
3566
3565
|
if (!this._keypair.privateKey)
|
|
3567
3566
|
throw new Error("Private key not available");
|
|
3568
|
-
return
|
|
3567
|
+
return g(this._keypair.privateKey);
|
|
3569
3568
|
}
|
|
3570
3569
|
toPublicKeyHex() {
|
|
3571
|
-
return
|
|
3570
|
+
return g(this._bufferPubKey);
|
|
3572
3571
|
}
|
|
3573
3572
|
toQuantumBase58() {
|
|
3574
3573
|
return this._mldsaKeypair.toBase58();
|
|
@@ -3600,8 +3599,8 @@ class it {
|
|
|
3600
3599
|
throw new Error("Failed to derive classical private key");
|
|
3601
3600
|
if (!r.chainCode)
|
|
3602
3601
|
throw new Error("Failed to derive classical chain code");
|
|
3603
|
-
return new
|
|
3604
|
-
|
|
3602
|
+
return new et(
|
|
3603
|
+
g(new Uint8Array(r.privateKey)),
|
|
3605
3604
|
e.toBase58(),
|
|
3606
3605
|
this.network,
|
|
3607
3606
|
this._securityLevel,
|
|
@@ -3609,7 +3608,7 @@ class it {
|
|
|
3609
3608
|
);
|
|
3610
3609
|
}
|
|
3611
3610
|
}
|
|
3612
|
-
var
|
|
3611
|
+
var qt = /* @__PURE__ */ ((n) => (n[n.MINIMUM = 128] = "MINIMUM", n[n.LOW = 160] = "LOW", n[n.MEDIUM = 192] = "MEDIUM", n[n.HIGH = 224] = "HIGH", n[n.MAXIMUM = 256] = "MAXIMUM", n))(qt || {}), Et = /* @__PURE__ */ ((n) => (n[n.BIP44 = 44] = "BIP44", n[n.BIP49 = 49] = "BIP49", n[n.BIP84 = 84] = "BIP84", n[n.BIP86 = 86] = "BIP86", n))(Et || {});
|
|
3613
3612
|
function dr(n) {
|
|
3614
3613
|
switch (n) {
|
|
3615
3614
|
case 44:
|
|
@@ -3624,11 +3623,11 @@ function dr(n) {
|
|
|
3624
3623
|
return "Unknown BIP standard";
|
|
3625
3624
|
}
|
|
3626
3625
|
}
|
|
3627
|
-
function
|
|
3626
|
+
function Ge(n, t, e, i, r) {
|
|
3628
3627
|
return `m/${n}'/${t}'/${e}'/${i}/${r}`;
|
|
3629
3628
|
}
|
|
3630
3629
|
const pr = U.BIP32Factory(W);
|
|
3631
|
-
class
|
|
3630
|
+
class ge {
|
|
3632
3631
|
_phrase;
|
|
3633
3632
|
_passphrase;
|
|
3634
3633
|
_network;
|
|
@@ -3637,9 +3636,9 @@ class Se {
|
|
|
3637
3636
|
_classicalRoot;
|
|
3638
3637
|
_quantumRoot;
|
|
3639
3638
|
constructor(t, e = "", i = A.bitcoin, r = U.MLDSASecurityLevel.LEVEL2) {
|
|
3640
|
-
if (!
|
|
3639
|
+
if (!bt.validateMnemonic(t))
|
|
3641
3640
|
throw new Error("Invalid mnemonic phrase");
|
|
3642
|
-
this._phrase = t, this._passphrase = e, this._network = i, this._securityLevel = r, this._seed =
|
|
3641
|
+
this._phrase = t, this._passphrase = e, this._network = i, this._securityLevel = r, this._seed = bt.mnemonicToSeedSync(this._phrase, this._passphrase), this._classicalRoot = pr.fromSeed(this._seed, this._network), this._quantumRoot = U.QuantumBIP32Factory.fromSeed(
|
|
3643
3642
|
this._seed,
|
|
3644
3643
|
this._network,
|
|
3645
3644
|
this._securityLevel
|
|
@@ -3657,15 +3656,15 @@ class Se {
|
|
|
3657
3656
|
get seed() {
|
|
3658
3657
|
return new Uint8Array(this._seed);
|
|
3659
3658
|
}
|
|
3660
|
-
static generatePhrase(t =
|
|
3661
|
-
return
|
|
3659
|
+
static generatePhrase(t = qt.MAXIMUM) {
|
|
3660
|
+
return bt.generateMnemonic(t);
|
|
3662
3661
|
}
|
|
3663
|
-
static generate(t =
|
|
3664
|
-
const s =
|
|
3665
|
-
return new
|
|
3662
|
+
static generate(t = qt.MAXIMUM, e = "", i = A.bitcoin, r = U.MLDSASecurityLevel.LEVEL2) {
|
|
3663
|
+
const s = bt.generateMnemonic(t);
|
|
3664
|
+
return new ge(s, e, i, r);
|
|
3666
3665
|
}
|
|
3667
3666
|
static validate(t) {
|
|
3668
|
-
return
|
|
3667
|
+
return bt.validateMnemonic(t);
|
|
3669
3668
|
}
|
|
3670
3669
|
/**
|
|
3671
3670
|
* Best-effort zeroing of secret material held by this mnemonic.
|
|
@@ -3679,34 +3678,34 @@ class Se {
|
|
|
3679
3678
|
[Symbol.dispose]() {
|
|
3680
3679
|
this.zeroize();
|
|
3681
3680
|
}
|
|
3682
|
-
derive(t = 0, e = 0, i = !1, r =
|
|
3681
|
+
derive(t = 0, e = 0, i = !1, r = Et.BIP84) {
|
|
3683
3682
|
const s = this.buildClassicalPath(e, t, i, r), o = this._classicalRoot.derivePath(s);
|
|
3684
3683
|
if (!o.privateKey)
|
|
3685
3684
|
throw new Error(`Failed to derive classical private key at index ${t}`);
|
|
3686
3685
|
const a = this.buildQuantumPath(e, t, i), c = this._quantumRoot.derivePath(a);
|
|
3687
3686
|
if (!c.privateKey)
|
|
3688
3687
|
throw new Error(`Failed to derive quantum private key at index ${t}`);
|
|
3689
|
-
return new
|
|
3690
|
-
|
|
3691
|
-
|
|
3688
|
+
return new et(
|
|
3689
|
+
g(new Uint8Array(o.privateKey)),
|
|
3690
|
+
g(new Uint8Array(c.privateKey)),
|
|
3692
3691
|
this._network,
|
|
3693
3692
|
this._securityLevel,
|
|
3694
3693
|
new Uint8Array(this._quantumRoot.chainCode)
|
|
3695
3694
|
);
|
|
3696
3695
|
}
|
|
3697
|
-
deriveOPWallet(t =
|
|
3696
|
+
deriveOPWallet(t = it.P2TR, e = 0, i = 0, r = !1) {
|
|
3698
3697
|
let s;
|
|
3699
3698
|
switch (t) {
|
|
3700
|
-
case
|
|
3699
|
+
case it.P2PKH:
|
|
3701
3700
|
s = 44;
|
|
3702
3701
|
break;
|
|
3703
|
-
case
|
|
3702
|
+
case it.P2SH_OR_P2SH_P2WPKH:
|
|
3704
3703
|
s = 49;
|
|
3705
3704
|
break;
|
|
3706
|
-
case
|
|
3705
|
+
case it.P2WPKH:
|
|
3707
3706
|
s = 84;
|
|
3708
3707
|
break;
|
|
3709
|
-
case
|
|
3708
|
+
case it.P2TR:
|
|
3710
3709
|
s = 86;
|
|
3711
3710
|
break;
|
|
3712
3711
|
default:
|
|
@@ -3718,21 +3717,21 @@ class Se {
|
|
|
3718
3717
|
const l = `m/360'/${o}'/${i}'/${a}/${e}`, h = this._quantumRoot.derivePath(l);
|
|
3719
3718
|
if (!h.privateKey)
|
|
3720
3719
|
throw new Error(`Failed to derive quantum private key at path ${l}`);
|
|
3721
|
-
return new
|
|
3722
|
-
|
|
3723
|
-
|
|
3720
|
+
return new et(
|
|
3721
|
+
g(new Uint8Array(u.privateKey)),
|
|
3722
|
+
g(new Uint8Array(h.privateKey)),
|
|
3724
3723
|
this._network,
|
|
3725
3724
|
this._securityLevel,
|
|
3726
3725
|
new Uint8Array(this._quantumRoot.chainCode)
|
|
3727
3726
|
);
|
|
3728
3727
|
}
|
|
3729
|
-
deriveMultipleUnisat(t =
|
|
3728
|
+
deriveMultipleUnisat(t = it.P2TR, e = 5, i = 0, r = 0, s = !1) {
|
|
3730
3729
|
const o = [];
|
|
3731
3730
|
for (let a = 0; a < e; a++)
|
|
3732
3731
|
o.push(this.deriveOPWallet(t, i + a, r, s));
|
|
3733
3732
|
return o;
|
|
3734
3733
|
}
|
|
3735
|
-
deriveMultiple(t, e = 0, i = 0, r = !1, s =
|
|
3734
|
+
deriveMultiple(t, e = 0, i = 0, r = !1, s = Et.BIP84) {
|
|
3736
3735
|
const o = [];
|
|
3737
3736
|
for (let a = 0; a < t; a++)
|
|
3738
3737
|
o.push(this.derive(e + a, i, r, s));
|
|
@@ -3744,9 +3743,9 @@ class Se {
|
|
|
3744
3743
|
throw new Error(`Failed to derive classical private key at path ${t}`);
|
|
3745
3744
|
if (!r.privateKey)
|
|
3746
3745
|
throw new Error(`Failed to derive quantum private key at path ${e}`);
|
|
3747
|
-
return new
|
|
3748
|
-
|
|
3749
|
-
|
|
3746
|
+
return new et(
|
|
3747
|
+
g(new Uint8Array(i.privateKey)),
|
|
3748
|
+
g(new Uint8Array(r.privateKey)),
|
|
3750
3749
|
this._network,
|
|
3751
3750
|
this._securityLevel,
|
|
3752
3751
|
new Uint8Array(this._quantumRoot.chainCode)
|
|
@@ -3758,9 +3757,9 @@ class Se {
|
|
|
3758
3757
|
getQuantumRoot() {
|
|
3759
3758
|
return this._quantumRoot;
|
|
3760
3759
|
}
|
|
3761
|
-
buildClassicalPath(t, e, i, r =
|
|
3760
|
+
buildClassicalPath(t, e, i, r = Et.BIP84) {
|
|
3762
3761
|
const s = this.getCoinType();
|
|
3763
|
-
return
|
|
3762
|
+
return Ge(r, s, t, i ? 1 : 0, e);
|
|
3764
3763
|
}
|
|
3765
3764
|
buildQuantumPath(t, e, i) {
|
|
3766
3765
|
return `m/360'/${this.getCoinType()}'/${t}'/${i ? 1 : 0}/${e}`;
|
|
@@ -3769,8 +3768,8 @@ class Se {
|
|
|
3769
3768
|
return this._network.bech32 === A.testnet.bech32 || this._network.bech32 === A.regtest.bech32 ? 1 : 0;
|
|
3770
3769
|
}
|
|
3771
3770
|
}
|
|
3772
|
-
var
|
|
3773
|
-
function
|
|
3771
|
+
var je = /* @__PURE__ */ ((n) => (n[n.MLDSA44 = 1312] = "MLDSA44", n[n.MLDSA65 = 1952] = "MLDSA65", n[n.MLDSA87 = 2592] = "MLDSA87", n))(je || {});
|
|
3772
|
+
function oe(n) {
|
|
3774
3773
|
switch (n) {
|
|
3775
3774
|
case 1312:
|
|
3776
3775
|
return U.MLDSASecurityLevel.LEVEL2;
|
|
@@ -3800,28 +3799,28 @@ class fr {
|
|
|
3800
3799
|
return this.address;
|
|
3801
3800
|
}
|
|
3802
3801
|
}
|
|
3803
|
-
var
|
|
3804
|
-
function
|
|
3805
|
-
return n && !!(n.tapInternalKey || n.tapMerkleRoot || n.tapLeafScript && n.tapLeafScript.length || n.tapBip32Derivation && n.tapBip32Derivation.length || n.witnessUtxo &&
|
|
3802
|
+
var Se = /* @__PURE__ */ ((n) => (n[n.Bitcoin = 0] = "Bitcoin", n[n.Fractal = 1] = "Fractal", n))(Se || {});
|
|
3803
|
+
function ye(n) {
|
|
3804
|
+
return n && !!(n.tapInternalKey || n.tapMerkleRoot || n.tapLeafScript && n.tapLeafScript.length || n.tapBip32Derivation && n.tapBip32Derivation.length || n.witnessUtxo && Ne(n.witnessUtxo.script));
|
|
3806
3805
|
}
|
|
3807
3806
|
function gr(n) {
|
|
3808
3807
|
return n.redeemScript ? n.redeemScript : n.witnessScript ? n.witnessScript : n.witnessUtxo ? n.witnessUtxo.script : (n.nonWitnessUtxo, null);
|
|
3809
3808
|
}
|
|
3810
|
-
function
|
|
3809
|
+
function we(n, t) {
|
|
3811
3810
|
if (n.nonWitnessUtxo && !n.redeemScript && !n.witnessScript && !n.witnessUtxo || n.redeemScript)
|
|
3812
3811
|
return !0;
|
|
3813
3812
|
const e = gr(n);
|
|
3814
|
-
return e ?
|
|
3813
|
+
return e ? me(t, e) : !1;
|
|
3815
3814
|
}
|
|
3816
|
-
function
|
|
3817
|
-
return
|
|
3815
|
+
function me(n, t) {
|
|
3816
|
+
return ki(n, t) !== -1;
|
|
3818
3817
|
}
|
|
3819
|
-
class
|
|
3818
|
+
class be {
|
|
3820
3819
|
constructor() {
|
|
3821
3820
|
}
|
|
3822
3821
|
}
|
|
3823
|
-
var
|
|
3824
|
-
class Sr extends
|
|
3822
|
+
var Pt = /* @__PURE__ */ ((n) => (n.Mainnet = "mainnet", n.Testnet = "testnet", n.Regtest = "regtest", n))(Pt || {}), Qe = /* @__PURE__ */ ((n) => (n.BITCOIN_MAINNET = "BITCOIN_MAINNET", n.BITCOIN_TESTNET = "BITCOIN_TESTNET", n.BITCOIN_TESTNET4 = "BITCOIN_TESTNET4", n.BITCOIN_REGTEST = "BITCOIN_REGTEST", n.BITCOIN_SIGNET = "BITCOIN_SIGNET", n.FRACTAL_BITCOIN_MAINNET = "FRACTAL_BITCOIN_MAINNET", n.FRACTAL_BITCOIN_TESTNET = "FRACTAL_BITCOIN_TESTNET", n))(Qe || {}), Ze = /* @__PURE__ */ ((n) => (n.ecdsa = "ecdsa", n.bip322 = "bip322-simple", n))(Ze || {}), Je = /* @__PURE__ */ ((n) => (n.ecdsa = "ecdsa", n.schnorr = "schnorr", n))(Je || {});
|
|
3823
|
+
class Sr extends be {
|
|
3825
3824
|
isInitialized = !1;
|
|
3826
3825
|
constructor() {
|
|
3827
3826
|
if (super(), !window)
|
|
@@ -3865,7 +3864,7 @@ class Sr extends Ae {
|
|
|
3865
3864
|
return t;
|
|
3866
3865
|
}
|
|
3867
3866
|
async signData(t, e) {
|
|
3868
|
-
const i =
|
|
3867
|
+
const i = g(t), r = await this.unisat.signData(i, e);
|
|
3869
3868
|
return y(r);
|
|
3870
3869
|
}
|
|
3871
3870
|
async init() {
|
|
@@ -3873,13 +3872,13 @@ class Sr extends Ae {
|
|
|
3873
3872
|
return;
|
|
3874
3873
|
const t = await this.unisat.getNetwork();
|
|
3875
3874
|
switch (t) {
|
|
3876
|
-
case
|
|
3875
|
+
case Pt.Mainnet:
|
|
3877
3876
|
this._network = A.bitcoin;
|
|
3878
3877
|
break;
|
|
3879
|
-
case
|
|
3878
|
+
case Pt.Testnet:
|
|
3880
3879
|
this._network = A.testnet;
|
|
3881
3880
|
break;
|
|
3882
|
-
case
|
|
3881
|
+
case Pt.Regtest:
|
|
3883
3882
|
this._network = A.regtest;
|
|
3884
3883
|
break;
|
|
3885
3884
|
default:
|
|
@@ -3888,7 +3887,7 @@ class Sr extends Ae {
|
|
|
3888
3887
|
const e = await this.unisat.getPublicKey();
|
|
3889
3888
|
if (e === "")
|
|
3890
3889
|
throw new Error("Unlock your wallet first");
|
|
3891
|
-
this._publicKey =
|
|
3890
|
+
this._publicKey = le(y(e)), this._p2wpkh = P.getP2WPKHAddress(this, this.network), this._p2tr = P.getTaprootAddress(this, this.network), this._addresses = [this._p2wpkh, this._p2tr], this.isInitialized = !0;
|
|
3892
3891
|
}
|
|
3893
3892
|
getPublicKey() {
|
|
3894
3893
|
if (!this.isInitialized)
|
|
@@ -3925,7 +3924,7 @@ class Sr extends Ae {
|
|
|
3925
3924
|
e.push(a);
|
|
3926
3925
|
const c = o.data.inputs.map((u, l) => {
|
|
3927
3926
|
let h = !1, p = !1;
|
|
3928
|
-
if (
|
|
3927
|
+
if (ye(u)) {
|
|
3929
3928
|
if (u.tapLeafScript && u.tapLeafScript.length > 0) {
|
|
3930
3929
|
for (const d of u.tapLeafScript)
|
|
3931
3930
|
if (yr(this.publicKey, d.script)) {
|
|
@@ -3937,10 +3936,10 @@ class Sr extends Ae {
|
|
|
3937
3936
|
const d = u.tapInternalKey, m = O(this.publicKey);
|
|
3938
3937
|
D(d, m) && (h = !0, p = !0);
|
|
3939
3938
|
}
|
|
3940
|
-
} else
|
|
3939
|
+
} else we(u, this.publicKey) && (h = !0, p = !1);
|
|
3941
3940
|
return h ? {
|
|
3942
3941
|
index: l,
|
|
3943
|
-
publicKey:
|
|
3942
|
+
publicKey: g(this.publicKey),
|
|
3944
3943
|
disableTweakSigner: !p
|
|
3945
3944
|
} : null;
|
|
3946
3945
|
}).filter((u) => u !== null);
|
|
@@ -3952,7 +3951,7 @@ class Sr extends Ae {
|
|
|
3952
3951
|
const r = await this.unisat.signPsbt(
|
|
3953
3952
|
e[0],
|
|
3954
3953
|
i[0]
|
|
3955
|
-
), s =
|
|
3954
|
+
), s = V.fromHex(r);
|
|
3956
3955
|
t[0].combine(s);
|
|
3957
3956
|
}
|
|
3958
3957
|
hasAlreadySignedTapScriptSig(t) {
|
|
@@ -3986,7 +3985,7 @@ class Sr extends Ae {
|
|
|
3986
3985
|
}
|
|
3987
3986
|
}
|
|
3988
3987
|
async signAllTweaked(t, e, i = !1) {
|
|
3989
|
-
const r =
|
|
3988
|
+
const r = g(this.publicKey), o = {
|
|
3990
3989
|
autoFinalized: !1,
|
|
3991
3990
|
toSignInputs: t.data.inputs.map((u, l) => [
|
|
3992
3991
|
{
|
|
@@ -3997,7 +3996,7 @@ class Sr extends Ae {
|
|
|
3997
3996
|
}
|
|
3998
3997
|
]).flat()
|
|
3999
3998
|
}, a = t.toHex(), c = await this.unisat.signPsbt(a, o);
|
|
4000
|
-
return
|
|
3999
|
+
return V.fromHex(c);
|
|
4001
4000
|
}
|
|
4002
4001
|
getNonDuplicateScriptSig(t, e) {
|
|
4003
4002
|
const i = [];
|
|
@@ -4016,13 +4015,13 @@ function wr(n, t) {
|
|
|
4016
4015
|
if (r === null) throw new Error("Unknown script error");
|
|
4017
4016
|
return r.findIndex((s) => typeof s == "number" ? !1 : s instanceof Uint8Array && (D(s, n) || D(s, e) || D(s, i)));
|
|
4018
4017
|
}
|
|
4019
|
-
function
|
|
4018
|
+
function ti(n) {
|
|
4020
4019
|
return new Map(n);
|
|
4021
4020
|
}
|
|
4022
4021
|
function mr(n) {
|
|
4023
4022
|
return {
|
|
4024
4023
|
enabled: !0,
|
|
4025
|
-
signerMap: n instanceof Map ? n :
|
|
4024
|
+
signerMap: n instanceof Map ? n : ti(n)
|
|
4026
4025
|
};
|
|
4027
4026
|
}
|
|
4028
4027
|
function br() {
|
|
@@ -4037,7 +4036,7 @@ function Ar(n) {
|
|
|
4037
4036
|
getPrivateKey() {
|
|
4038
4037
|
if (!n.privateKey)
|
|
4039
4038
|
throw new Error("Signer does not have a private key");
|
|
4040
|
-
return
|
|
4039
|
+
return Fe(n.privateKey);
|
|
4041
4040
|
},
|
|
4042
4041
|
sign(t, e) {
|
|
4043
4042
|
return n.sign(t, e);
|
|
@@ -4049,13 +4048,13 @@ function Ar(n) {
|
|
|
4049
4048
|
}
|
|
4050
4049
|
};
|
|
4051
4050
|
}
|
|
4052
|
-
function
|
|
4051
|
+
function ei(n, t) {
|
|
4053
4052
|
return {
|
|
4054
|
-
publicKey:
|
|
4053
|
+
publicKey: le(n.publicKey),
|
|
4055
4054
|
getPrivateKey() {
|
|
4056
4055
|
if (!t.privateKey)
|
|
4057
4056
|
throw new Error("Tweaked signer does not have a private key");
|
|
4058
|
-
return
|
|
4057
|
+
return Fe(t.privateKey);
|
|
4059
4058
|
},
|
|
4060
4059
|
sign(e, i) {
|
|
4061
4060
|
return t.sign(e, i);
|
|
@@ -4070,7 +4069,7 @@ function ii(n, t) {
|
|
|
4070
4069
|
};
|
|
4071
4070
|
}
|
|
4072
4071
|
var b = /* @__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))(b || {});
|
|
4073
|
-
function
|
|
4072
|
+
function ae(n) {
|
|
4074
4073
|
let t = new Uint8Array(0);
|
|
4075
4074
|
function e(a, c) {
|
|
4076
4075
|
const u = new Uint8Array(a.length + c.length);
|
|
@@ -4080,8 +4079,8 @@ function ce(n) {
|
|
|
4080
4079
|
t = e(t, a);
|
|
4081
4080
|
}
|
|
4082
4081
|
function r(a) {
|
|
4083
|
-
const c = t.length, u =
|
|
4084
|
-
l.set(t, 0), t = l,
|
|
4082
|
+
const c = t.length, u = ie.encodingLength(a), l = new Uint8Array(c + u);
|
|
4083
|
+
l.set(t, 0), t = l, ie.encode(a, t, c);
|
|
4085
4084
|
}
|
|
4086
4085
|
function s(a) {
|
|
4087
4086
|
r(a.length), i(a);
|
|
@@ -4091,8 +4090,8 @@ function ce(n) {
|
|
|
4091
4090
|
}
|
|
4092
4091
|
return o(n), t;
|
|
4093
4092
|
}
|
|
4094
|
-
var
|
|
4095
|
-
class
|
|
4093
|
+
var ii = /* @__PURE__ */ ((n) => (n[n.REPLACE_BY_FEE = 4294967293] = "REPLACE_BY_FEE", n[n.FINAL = 4294967295] = "FINAL", n))(ii || {}), ri = /* @__PURE__ */ ((n) => (n[n.BLOCKS = 0] = "BLOCKS", n[n.TIMESTAMPS = 1] = "TIMESTAMPS", n))(ri || {});
|
|
4094
|
+
class Jt extends Ce {
|
|
4096
4095
|
logColor = "#00ffe1";
|
|
4097
4096
|
finalized = !1;
|
|
4098
4097
|
/**
|
|
@@ -4185,7 +4184,7 @@ class te extends Fe {
|
|
|
4185
4184
|
*/
|
|
4186
4185
|
parallelSigningConfig;
|
|
4187
4186
|
constructor(t) {
|
|
4188
|
-
super(), this.signer = t.signer, this.network = t.network, this.noSignatures = t.noSignatures || !1, t.nonWitnessUtxo !== void 0 && (this.nonWitnessUtxo = t.nonWitnessUtxo), t.unlockScript !== void 0 && (this.unlockScript = t.unlockScript), this.isBrowser = typeof window < "u", t.txVersion && (this.txVersion = t.txVersion), t.mldsaSigner && (this._mldsaSigner = t.mldsaSigner, this._hashedPublicKey =
|
|
4187
|
+
super(), this.signer = t.signer, this.network = t.network, this.noSignatures = t.noSignatures || !1, t.nonWitnessUtxo !== void 0 && (this.nonWitnessUtxo = t.nonWitnessUtxo), t.unlockScript !== void 0 && (this.unlockScript = t.unlockScript), this.isBrowser = typeof window < "u", t.txVersion && (this.txVersion = t.txVersion), t.mldsaSigner && (this._mldsaSigner = t.mldsaSigner, this._hashedPublicKey = ot.sha256(this._mldsaSigner.publicKey)), t.addressRotation?.enabled && (this.addressRotationEnabled = !0, this.signerMap = t.addressRotation.signerMap), t.parallelSigning && (this.parallelSigningConfig = t.parallelSigning);
|
|
4189
4188
|
}
|
|
4190
4189
|
/**
|
|
4191
4190
|
* Get the MLDSA signer
|
|
@@ -4223,7 +4222,7 @@ class te extends Fe {
|
|
|
4223
4222
|
return e += a, c;
|
|
4224
4223
|
}
|
|
4225
4224
|
function r() {
|
|
4226
|
-
const a =
|
|
4225
|
+
const a = ie.decode(t, e);
|
|
4227
4226
|
return e += a.bytes, a.numberValue || 0;
|
|
4228
4227
|
}
|
|
4229
4228
|
function s() {
|
|
@@ -4322,7 +4321,7 @@ class te extends Fe {
|
|
|
4322
4321
|
* Get the tweaked hash
|
|
4323
4322
|
* @private
|
|
4324
4323
|
*
|
|
4325
|
-
* @returns {
|
|
4324
|
+
* @returns {Uint8Array | undefined} The tweaked hash
|
|
4326
4325
|
*/
|
|
4327
4326
|
getTweakerHash() {
|
|
4328
4327
|
return this.tapData?.hash;
|
|
@@ -4403,7 +4402,7 @@ class te extends Fe {
|
|
|
4403
4402
|
return {
|
|
4404
4403
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
4405
4404
|
network: this.network,
|
|
4406
|
-
name:
|
|
4405
|
+
name: x.P2TR
|
|
4407
4406
|
};
|
|
4408
4407
|
}
|
|
4409
4408
|
/**
|
|
@@ -4415,7 +4414,7 @@ class te extends Fe {
|
|
|
4415
4414
|
return {
|
|
4416
4415
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
4417
4416
|
network: this.network,
|
|
4418
|
-
name:
|
|
4417
|
+
name: x.P2TR
|
|
4419
4418
|
};
|
|
4420
4419
|
}
|
|
4421
4420
|
/**
|
|
@@ -4439,7 +4438,7 @@ class te extends Fe {
|
|
|
4439
4438
|
async signInput(t, e, i, r, s = !1, o = !1) {
|
|
4440
4439
|
if (this.anchorInputIndices.has(i)) return;
|
|
4441
4440
|
const a = r.publicKey;
|
|
4442
|
-
let c =
|
|
4441
|
+
let c = ye(e);
|
|
4443
4442
|
s && (c = !c);
|
|
4444
4443
|
let u = !1, l = !1;
|
|
4445
4444
|
if (c)
|
|
@@ -4450,7 +4449,7 @@ class te extends Fe {
|
|
|
4450
4449
|
`Failed to sign Taproot script path input ${i} (reverse: ${s}): ${h.message}`
|
|
4451
4450
|
), l = !0;
|
|
4452
4451
|
}
|
|
4453
|
-
else if (s ||
|
|
4452
|
+
else if (s || we(e, a))
|
|
4454
4453
|
try {
|
|
4455
4454
|
await this.signNonTaprootInput(r, t, i), u = !0;
|
|
4456
4455
|
} catch (h) {
|
|
@@ -4489,7 +4488,7 @@ class te extends Fe {
|
|
|
4489
4488
|
}
|
|
4490
4489
|
async signInputsNonWalletBased(t) {
|
|
4491
4490
|
if (!this.noSignatures)
|
|
4492
|
-
if (this.canUseParallelSigning &&
|
|
4491
|
+
if (this.canUseParallelSigning && lt(this.signer)) {
|
|
4493
4492
|
let e = /* @__PURE__ */ new Set();
|
|
4494
4493
|
try {
|
|
4495
4494
|
const i = await this.signKeyPathInputsParallel(t);
|
|
@@ -4554,7 +4553,7 @@ class te extends Fe {
|
|
|
4554
4553
|
/**
|
|
4555
4554
|
* Converts the public key to x-only.
|
|
4556
4555
|
* @protected
|
|
4557
|
-
* @returns {
|
|
4556
|
+
* @returns {Uint8Array}
|
|
4558
4557
|
*/
|
|
4559
4558
|
internalPubKeyToXOnly() {
|
|
4560
4559
|
return O(this.signer.publicKey);
|
|
@@ -4588,8 +4587,8 @@ class te extends Fe {
|
|
|
4588
4587
|
const r = this.getTweakerHash();
|
|
4589
4588
|
r !== void 0 && (i.tweakHash = r);
|
|
4590
4589
|
}
|
|
4591
|
-
if (
|
|
4592
|
-
return
|
|
4590
|
+
if (lt(e))
|
|
4591
|
+
return fe.tweakSigner(e, i);
|
|
4593
4592
|
}
|
|
4594
4593
|
/**
|
|
4595
4594
|
* Signs key-path taproot inputs in parallel using worker threads.
|
|
@@ -4601,7 +4600,7 @@ class te extends Fe {
|
|
|
4601
4600
|
const i = this.signer, r = this.getTweakedSigner(!0);
|
|
4602
4601
|
if (!r)
|
|
4603
4602
|
throw new Error("Cannot create tweaked signer for parallel signing");
|
|
4604
|
-
const s =
|
|
4603
|
+
const s = ei(i, r), o = Li(t, s), a = e ? o.filter((l) => !e.has(l.inputIndex)) : o;
|
|
4605
4604
|
if (a.length === 0)
|
|
4606
4605
|
return {
|
|
4607
4606
|
success: !0,
|
|
@@ -4615,7 +4614,7 @@ class te extends Fe {
|
|
|
4615
4614
|
await c.initialize();
|
|
4616
4615
|
const l = await c.signBatch(a, s);
|
|
4617
4616
|
if (l.success)
|
|
4618
|
-
|
|
4617
|
+
xi(t, l, s);
|
|
4619
4618
|
else {
|
|
4620
4619
|
const p = [...l.errors.entries()].map(([d, m]) => `Input ${d}: ${m}`).join(", ");
|
|
4621
4620
|
this.error(`Parallel signing had errors: ${p}`);
|
|
@@ -4655,7 +4654,7 @@ class te extends Fe {
|
|
|
4655
4654
|
// The P2WSH is wrapped inside the P2SH
|
|
4656
4655
|
network: this.network
|
|
4657
4656
|
});
|
|
4658
|
-
if (
|
|
4657
|
+
if ($.fromOutputScript(s, this.network) === t && a.redeem && a.redeem.output)
|
|
4659
4658
|
return {
|
|
4660
4659
|
redeemScript: i,
|
|
4661
4660
|
outputScript: a.redeem.output
|
|
@@ -4695,14 +4694,14 @@ class te extends Fe {
|
|
|
4695
4694
|
script: r
|
|
4696
4695
|
}
|
|
4697
4696
|
};
|
|
4698
|
-
if (
|
|
4697
|
+
if (Ri(r))
|
|
4699
4698
|
if (t.nonWitnessUtxo)
|
|
4700
4699
|
s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo);
|
|
4701
4700
|
else
|
|
4702
4701
|
throw new Error("Missing nonWitnessUtxo for P2PKH UTXO");
|
|
4703
|
-
else if (!(
|
|
4702
|
+
else if (!(_e(r) || Di(r))) if (ke(r))
|
|
4704
4703
|
this.processP2WSHInput(t, s, e);
|
|
4705
|
-
else if (
|
|
4704
|
+
else if (Ci(r)) {
|
|
4706
4705
|
let o;
|
|
4707
4706
|
if (t.redeemScript)
|
|
4708
4707
|
o = t.redeemScript instanceof Uint8Array ? t.redeemScript : y(t.redeemScript);
|
|
@@ -4726,16 +4725,16 @@ class te extends Fe {
|
|
|
4726
4725
|
const c = a.redeem.output;
|
|
4727
4726
|
if (!c)
|
|
4728
4727
|
throw new Error("Failed to extract redeem output from P2SH UTXO");
|
|
4729
|
-
t.nonWitnessUtxo && (s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo)),
|
|
4730
|
-
} else if (
|
|
4728
|
+
t.nonWitnessUtxo && (s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo)), _e(c) ? Reflect.deleteProperty(s, "nonWitnessUtxo") : ke(c) ? (Reflect.deleteProperty(s, "nonWitnessUtxo"), this.processP2WSHInput(t, s, e)) : Reflect.deleteProperty(s, "witnessUtxo");
|
|
4729
|
+
} else if (Ne(r)) {
|
|
4731
4730
|
if (this.sighashTypes) {
|
|
4732
|
-
const o =
|
|
4731
|
+
const o = Jt.calculateSignHash(this.sighashTypes);
|
|
4733
4732
|
o && (s.sighashType = o);
|
|
4734
4733
|
}
|
|
4735
4734
|
this.addressRotationEnabled ? s.tapInternalKey = this.internalPubKeyToXOnlyForInput(e) : (this.tweakSigner(), s.tapInternalKey = this.internalPubKeyToXOnly());
|
|
4736
|
-
} else if (
|
|
4735
|
+
} else if (Fi(r))
|
|
4737
4736
|
this.anchorInputIndices.add(e), s.isPayToAnchor = !0;
|
|
4738
|
-
else if (
|
|
4737
|
+
else if (Ni(r) || Mi(r))
|
|
4739
4738
|
if (t.nonWitnessUtxo)
|
|
4740
4739
|
s.nonWitnessUtxo = t.nonWitnessUtxo instanceof Uint8Array ? t.nonWitnessUtxo : y(t.nonWitnessUtxo);
|
|
4741
4740
|
else
|
|
@@ -4793,7 +4792,7 @@ class te extends Fe {
|
|
|
4793
4792
|
if (o && r && e.witnessScript) {
|
|
4794
4793
|
if (!e.partialSig || e.partialSig.length === 0)
|
|
4795
4794
|
throw new Error(`No signatures for P2WSH input #${t}`);
|
|
4796
|
-
if (
|
|
4795
|
+
if (j.isP2WDAWitnessScript(e.witnessScript))
|
|
4797
4796
|
return this.finalizeSecondaryP2WDA(t, e);
|
|
4798
4797
|
if (this.csvInputIndices.has(t)) {
|
|
4799
4798
|
const h = [
|
|
@@ -4802,11 +4801,11 @@ class te extends Fe {
|
|
|
4802
4801
|
];
|
|
4803
4802
|
return {
|
|
4804
4803
|
finalScriptSig: void 0,
|
|
4805
|
-
finalScriptWitness:
|
|
4804
|
+
finalScriptWitness: ae(h)
|
|
4806
4805
|
};
|
|
4807
4806
|
}
|
|
4808
4807
|
}
|
|
4809
|
-
return
|
|
4808
|
+
return Me(
|
|
4810
4809
|
t,
|
|
4811
4810
|
e,
|
|
4812
4811
|
i,
|
|
@@ -4825,13 +4824,13 @@ class te extends Fe {
|
|
|
4825
4824
|
throw new Error(`No signature for P2WDA input #${t}`);
|
|
4826
4825
|
if (!e.witnessScript)
|
|
4827
4826
|
throw new Error(`No witness script for P2WDA input #${t}`);
|
|
4828
|
-
const i =
|
|
4827
|
+
const i = j.createSimpleP2WDAWitness(
|
|
4829
4828
|
e.partialSig[0].signature,
|
|
4830
4829
|
e.witnessScript
|
|
4831
4830
|
);
|
|
4832
4831
|
return {
|
|
4833
4832
|
finalScriptSig: void 0,
|
|
4834
|
-
finalScriptWitness:
|
|
4833
|
+
finalScriptWitness: ae(i)
|
|
4835
4834
|
};
|
|
4836
4835
|
}
|
|
4837
4836
|
async signInputsWalletBased(t) {
|
|
@@ -4893,7 +4892,7 @@ class te extends Fe {
|
|
|
4893
4892
|
isTaprootScriptSpend(t, e) {
|
|
4894
4893
|
if (t.tapLeafScript && t.tapLeafScript.length > 0) {
|
|
4895
4894
|
for (const i of t.tapLeafScript)
|
|
4896
|
-
if (
|
|
4895
|
+
if (me(e, i.script))
|
|
4897
4896
|
return !0;
|
|
4898
4897
|
}
|
|
4899
4898
|
return !1;
|
|
@@ -4912,12 +4911,12 @@ class te extends Fe {
|
|
|
4912
4911
|
"signInput" in t ? await t.signInput(e, i) : e.signInput(i, t);
|
|
4913
4912
|
}
|
|
4914
4913
|
}
|
|
4915
|
-
function
|
|
4914
|
+
function Nt(n) {
|
|
4916
4915
|
return `${n.messagePrefix}|${n.bech32}`;
|
|
4917
4916
|
}
|
|
4918
4917
|
const Tr = /* @__PURE__ */ new Map([
|
|
4919
4918
|
[
|
|
4920
|
-
|
|
4919
|
+
Nt(A.bitcoin),
|
|
4921
4920
|
new Uint8Array([
|
|
4922
4921
|
0,
|
|
4923
4922
|
0,
|
|
@@ -4954,7 +4953,7 @@ const Tr = /* @__PURE__ */ new Map([
|
|
|
4954
4953
|
])
|
|
4955
4954
|
],
|
|
4956
4955
|
[
|
|
4957
|
-
|
|
4956
|
+
Nt(A.testnet),
|
|
4958
4957
|
new Uint8Array([
|
|
4959
4958
|
0,
|
|
4960
4959
|
0,
|
|
@@ -4991,7 +4990,7 @@ const Tr = /* @__PURE__ */ new Map([
|
|
|
4991
4990
|
])
|
|
4992
4991
|
],
|
|
4993
4992
|
[
|
|
4994
|
-
|
|
4993
|
+
Nt(A.regtest),
|
|
4995
4994
|
new Uint8Array([
|
|
4996
4995
|
15,
|
|
4997
4996
|
145,
|
|
@@ -5028,12 +5027,12 @@ const Tr = /* @__PURE__ */ new Map([
|
|
|
5028
5027
|
])
|
|
5029
5028
|
]
|
|
5030
5029
|
]);
|
|
5031
|
-
function
|
|
5032
|
-
const t = Tr.get(
|
|
5030
|
+
function Re(n) {
|
|
5031
|
+
const t = Tr.get(Nt(n));
|
|
5033
5032
|
if (!t) throw new Error("Unsupported network for chain ID retrieval");
|
|
5034
5033
|
return t.slice();
|
|
5035
5034
|
}
|
|
5036
|
-
const
|
|
5035
|
+
const De = new Uint8Array([
|
|
5037
5036
|
231,
|
|
5038
5037
|
132,
|
|
5039
5038
|
153,
|
|
@@ -5066,8 +5065,8 @@ const Ce = new Uint8Array([
|
|
|
5066
5065
|
64,
|
|
5067
5066
|
121,
|
|
5068
5067
|
57
|
|
5069
|
-
]),
|
|
5070
|
-
class T extends
|
|
5068
|
+
]), G = 330n, At = 297n, ce = y("51024e73");
|
|
5069
|
+
class T extends Jt {
|
|
5071
5070
|
static MINIMUM_DUST = 330n;
|
|
5072
5071
|
logColor = "#785def";
|
|
5073
5072
|
debugFees = !1;
|
|
@@ -5163,9 +5162,9 @@ class T extends te {
|
|
|
5163
5162
|
note;
|
|
5164
5163
|
optionalOutputsAdded = !1;
|
|
5165
5164
|
constructor(t) {
|
|
5166
|
-
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 ?
|
|
5165
|
+
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 ? Y.isValidPublicKey(this.to, this.network) : !1, this.optionalOutputs = t.optionalOutputs, this.from = T.getFrom(t.from, this.signer, this.network), this.totalInputAmount = this.calculateTotalUTXOAmount(), this.calculateTotalVOutAmount() < this.totalInputAmount)
|
|
5167
5166
|
throw new Error("Vout value is less than the value to send");
|
|
5168
|
-
this.transaction = new
|
|
5167
|
+
this.transaction = new V({
|
|
5169
5168
|
network: this.network,
|
|
5170
5169
|
version: this.txVersion
|
|
5171
5170
|
});
|
|
@@ -5175,12 +5174,12 @@ class T extends te {
|
|
|
5175
5174
|
}
|
|
5176
5175
|
/**
|
|
5177
5176
|
* @description Converts the witness stack to a script witness
|
|
5178
|
-
* @param {
|
|
5177
|
+
* @param {Uint8Array[]} witness - The witness stack
|
|
5179
5178
|
* @protected
|
|
5180
|
-
* @returns {
|
|
5179
|
+
* @returns {Uint8Array}
|
|
5181
5180
|
*/
|
|
5182
5181
|
static witnessStackToScriptWitness(t) {
|
|
5183
|
-
return
|
|
5182
|
+
return ae(t);
|
|
5184
5183
|
}
|
|
5185
5184
|
[Symbol.dispose]() {
|
|
5186
5185
|
super[Symbol.dispose](), this.updateInputs.length = 0, this.outputs.length = 0, this.feeOutput = null, this.optionalOutputs = void 0, this.utxos = [], this.optionalInputs = [];
|
|
@@ -5195,7 +5194,7 @@ class T extends te {
|
|
|
5195
5194
|
addAnchor() {
|
|
5196
5195
|
this.addOutput({
|
|
5197
5196
|
value: k(0n),
|
|
5198
|
-
script:
|
|
5197
|
+
script: ce
|
|
5199
5198
|
});
|
|
5200
5199
|
}
|
|
5201
5200
|
async getFundingTransactionParameters() {
|
|
@@ -5301,7 +5300,7 @@ class T extends te {
|
|
|
5301
5300
|
throw new Error("Output value is 0 and no script provided");
|
|
5302
5301
|
if (i.script.length < 2)
|
|
5303
5302
|
throw new Error("Output script is too short");
|
|
5304
|
-
if (i.script[0] !== f.OP_RETURN && !D(i.script,
|
|
5303
|
+
if (i.script[0] !== f.OP_RETURN && !D(i.script, ce))
|
|
5305
5304
|
throw new Error(
|
|
5306
5305
|
"Output script must start with OP_RETURN or be an ANCHOR when value is 0"
|
|
5307
5306
|
);
|
|
@@ -5346,7 +5345,7 @@ class T extends te {
|
|
|
5346
5345
|
*/
|
|
5347
5346
|
async estimateTransactionFees() {
|
|
5348
5347
|
await Promise.resolve();
|
|
5349
|
-
const t = new
|
|
5348
|
+
const t = new V({ network: this.network }), e = this.getInputs(), i = this.getOutputs();
|
|
5350
5349
|
t.addInputs(e), t.addOutputs(i);
|
|
5351
5350
|
const r = new Uint8Array(64), s = new Uint8Array(72), o = new Uint8Array(33).fill(2), a = (p, d) => {
|
|
5352
5351
|
if (d.isPayToAnchor || this.anchorInputIndices.has(p))
|
|
@@ -5354,7 +5353,7 @@ class T extends te {
|
|
|
5354
5353
|
finalScriptSig: void 0,
|
|
5355
5354
|
finalScriptWitness: Uint8Array.from([0])
|
|
5356
5355
|
};
|
|
5357
|
-
if (d.witnessScript &&
|
|
5356
|
+
if (d.witnessScript && j.isP2WDAWitnessScript(d.witnessScript)) {
|
|
5358
5357
|
const w = [];
|
|
5359
5358
|
for (let N = 0; N < 10; N++)
|
|
5360
5359
|
w.push(new Uint8Array(0));
|
|
@@ -5382,10 +5381,10 @@ class T extends te {
|
|
|
5382
5381
|
};
|
|
5383
5382
|
}
|
|
5384
5383
|
if (d.witnessUtxo) {
|
|
5385
|
-
const w = d.witnessUtxo.script, I =
|
|
5384
|
+
const w = d.witnessUtxo.script, I = nt.script.decompile(w);
|
|
5386
5385
|
if (I && I.length === 5 && I[0] === f.OP_DUP && I[1] === f.OP_HASH160 && I[3] === f.OP_EQUALVERIFY && I[4] === f.OP_CHECKSIG)
|
|
5387
5386
|
return {
|
|
5388
|
-
finalScriptSig:
|
|
5387
|
+
finalScriptSig: nt.script.compile([
|
|
5389
5388
|
s,
|
|
5390
5389
|
o
|
|
5391
5390
|
]),
|
|
@@ -5407,18 +5406,18 @@ class T extends te {
|
|
|
5407
5406
|
finalScriptWitness: T.witnessStackToScriptWitness(I)
|
|
5408
5407
|
};
|
|
5409
5408
|
}
|
|
5410
|
-
const w =
|
|
5409
|
+
const w = nt.script.decompile(d.witnessScript);
|
|
5411
5410
|
if (w && w.length >= 4) {
|
|
5412
5411
|
const I = w[0], N = w[w.length - 1];
|
|
5413
5412
|
if (typeof I == "number" && I >= f.OP_1 && N === f.OP_CHECKMULTISIG) {
|
|
5414
|
-
const
|
|
5415
|
-
for (let
|
|
5416
|
-
|
|
5413
|
+
const xt = I - f.OP_1 + 1, Rt = [];
|
|
5414
|
+
for (let Dt = 0; Dt < xt; Dt++)
|
|
5415
|
+
Rt.push(s);
|
|
5417
5416
|
return {
|
|
5418
5417
|
finalScriptWitness: T.witnessStackToScriptWitness([
|
|
5419
5418
|
new Uint8Array(0),
|
|
5420
5419
|
// OP_0 due to multisig bug
|
|
5421
|
-
...
|
|
5420
|
+
...Rt,
|
|
5422
5421
|
d.witnessScript
|
|
5423
5422
|
])
|
|
5424
5423
|
};
|
|
@@ -5431,7 +5430,7 @@ class T extends te {
|
|
|
5431
5430
|
])
|
|
5432
5431
|
};
|
|
5433
5432
|
} else if (d.redeemScript) {
|
|
5434
|
-
const w =
|
|
5433
|
+
const w = nt.script.decompile(d.redeemScript);
|
|
5435
5434
|
if (w && w.length === 2 && w[0] === f.OP_0 && w[1] instanceof Uint8Array && w[1].length === 20)
|
|
5436
5435
|
return {
|
|
5437
5436
|
finalScriptSig: d.redeemScript,
|
|
@@ -5443,7 +5442,7 @@ class T extends te {
|
|
|
5443
5442
|
}
|
|
5444
5443
|
if (d.redeemScript && !d.witnessScript && !d.witnessUtxo)
|
|
5445
5444
|
return {
|
|
5446
|
-
finalScriptSig:
|
|
5445
|
+
finalScriptSig: nt.script.compile([s, d.redeemScript]),
|
|
5447
5446
|
finalScriptWitness: void 0
|
|
5448
5447
|
};
|
|
5449
5448
|
const m = d.witnessUtxo?.script;
|
|
@@ -5461,7 +5460,7 @@ class T extends te {
|
|
|
5461
5460
|
s,
|
|
5462
5461
|
o
|
|
5463
5462
|
])
|
|
5464
|
-
} :
|
|
5463
|
+
} : Me(
|
|
5465
5464
|
p,
|
|
5466
5465
|
d,
|
|
5467
5466
|
m,
|
|
@@ -5484,10 +5483,10 @@ class T extends te {
|
|
|
5484
5483
|
), h;
|
|
5485
5484
|
}
|
|
5486
5485
|
async rebuildFromBase64(t) {
|
|
5487
|
-
return this.transaction =
|
|
5486
|
+
return this.transaction = V.fromBase64(t, {
|
|
5488
5487
|
network: this.network,
|
|
5489
5488
|
version: this.txVersion
|
|
5490
|
-
}), this.signed = !1, this.sighashTypes = [
|
|
5489
|
+
}), this.signed = !1, this.sighashTypes = [re.SIGHASH_ANYONECANPAY, re.SIGHASH_ALL], await this.signPSBT();
|
|
5491
5490
|
}
|
|
5492
5491
|
setPSBT(t) {
|
|
5493
5492
|
this.transaction = t;
|
|
@@ -5573,10 +5572,10 @@ class T extends te {
|
|
|
5573
5572
|
const t = O(this.tweakedSigner.publicKey), e = this.signer.publicKey;
|
|
5574
5573
|
if (e.length !== 33)
|
|
5575
5574
|
throw new Error("Original public key must be compressed (33 bytes)");
|
|
5576
|
-
const i =
|
|
5577
|
-
r.writeU8(U.MLDSASecurityLevel.LEVEL2), r.writeBytes(this.hashedPublicKey), r.writeBytes(t), r.writeBytes(e), r.writeBytes(
|
|
5578
|
-
const s = r.getBuffer(), o =
|
|
5579
|
-
if (!
|
|
5575
|
+
const i = Re(this.network), r = new H();
|
|
5576
|
+
r.writeU8(U.MLDSASecurityLevel.LEVEL2), r.writeBytes(this.hashedPublicKey), r.writeBytes(t), r.writeBytes(e), r.writeBytes(De), r.writeBytes(i);
|
|
5577
|
+
const s = r.getBuffer(), o = ot.signMessage(this.tweakedSigner, s);
|
|
5578
|
+
if (!ot.verifySignature(t, s, o.signature))
|
|
5580
5579
|
throw new Error("Could not verify generated legacy signature for MLDSA link request");
|
|
5581
5580
|
return new Uint8Array(o.signature);
|
|
5582
5581
|
}
|
|
@@ -5588,13 +5587,13 @@ class T extends te {
|
|
|
5588
5587
|
const t = O(this.tweakedSigner.publicKey), e = this.signer.publicKey;
|
|
5589
5588
|
if (e.length !== 33)
|
|
5590
5589
|
throw new Error("Original public key must be compressed (33 bytes)");
|
|
5591
|
-
const i =
|
|
5590
|
+
const i = Re(this.network), r = oe(this.mldsaSigner.publicKey.length);
|
|
5592
5591
|
if (r !== U.MLDSASecurityLevel.LEVEL2)
|
|
5593
5592
|
throw new Error("Only MLDSA level 2 is supported for link requests");
|
|
5594
5593
|
const s = new H();
|
|
5595
|
-
s.writeU8(r), s.writeBytes(this.hashedPublicKey), s.writeBytes(this.mldsaSigner.publicKey), s.writeBytes(t), s.writeBytes(e), s.writeBytes(
|
|
5596
|
-
const o = s.getBuffer(), a =
|
|
5597
|
-
if (!
|
|
5594
|
+
s.writeU8(r), s.writeBytes(this.hashedPublicKey), s.writeBytes(this.mldsaSigner.publicKey), s.writeBytes(t), s.writeBytes(e), s.writeBytes(De), s.writeBytes(i);
|
|
5595
|
+
const o = s.getBuffer(), a = ot.signMLDSAMessage(this.mldsaSigner, o);
|
|
5596
|
+
if (!ot.verifyMLDSASignature(
|
|
5598
5597
|
this.mldsaSigner,
|
|
5599
5598
|
o,
|
|
5600
5599
|
a.signature
|
|
@@ -5607,13 +5606,13 @@ class T extends te {
|
|
|
5607
5606
|
let s = null;
|
|
5608
5607
|
t.revealMLDSAPublicKey && (s = this.generateMLDSASignature());
|
|
5609
5608
|
const o = {
|
|
5610
|
-
priority:
|
|
5611
|
-
opcode:
|
|
5609
|
+
priority: J.MLDSA_LINK_PUBKEY,
|
|
5610
|
+
opcode: z.MLDSA_LINK_PUBKEY,
|
|
5612
5611
|
data: {
|
|
5613
5612
|
verifyRequest: !!t.revealMLDSAPublicKey,
|
|
5614
5613
|
publicKey: i.publicKey,
|
|
5615
5614
|
hashedPublicKey: this.hashedPublicKey,
|
|
5616
|
-
level:
|
|
5615
|
+
level: oe(i.publicKey.length),
|
|
5617
5616
|
legacySignature: r,
|
|
5618
5617
|
mldsaSignature: s
|
|
5619
5618
|
}
|
|
@@ -5722,13 +5721,13 @@ class T extends te {
|
|
|
5722
5721
|
addFeeToOutput(t, e, i, r) {
|
|
5723
5722
|
if (r) {
|
|
5724
5723
|
let s;
|
|
5725
|
-
t >
|
|
5724
|
+
t > G + At ? s = At : s = t, this.addOutput(
|
|
5726
5725
|
{
|
|
5727
5726
|
value: k(s),
|
|
5728
5727
|
address: e
|
|
5729
5728
|
},
|
|
5730
5729
|
!0
|
|
5731
|
-
), s ===
|
|
5730
|
+
), s === At && t - At > G && this.addOutput(
|
|
5732
5731
|
{
|
|
5733
5732
|
value: k(t - s),
|
|
5734
5733
|
address: i.address
|
|
@@ -5736,7 +5735,7 @@ class T extends te {
|
|
|
5736
5735
|
!0
|
|
5737
5736
|
);
|
|
5738
5737
|
} else {
|
|
5739
|
-
const s = t <
|
|
5738
|
+
const s = t < G ? G : t;
|
|
5740
5739
|
this.addOutput(
|
|
5741
5740
|
{
|
|
5742
5741
|
value: k(s),
|
|
@@ -5749,7 +5748,7 @@ class T extends te {
|
|
|
5749
5748
|
/**
|
|
5750
5749
|
* Returns the witness of the tap transaction.
|
|
5751
5750
|
* @protected
|
|
5752
|
-
* @returns {
|
|
5751
|
+
* @returns {Uint8Array}
|
|
5753
5752
|
*/
|
|
5754
5753
|
getWitness() {
|
|
5755
5754
|
if (!this.tapData || !this.tapData.witness)
|
|
@@ -5761,7 +5760,7 @@ class T extends te {
|
|
|
5761
5760
|
/**
|
|
5762
5761
|
* Returns the tap output.
|
|
5763
5762
|
* @protected
|
|
5764
|
-
* @returns {
|
|
5763
|
+
* @returns {Uint8Array}
|
|
5765
5764
|
*/
|
|
5766
5765
|
getTapOutput() {
|
|
5767
5766
|
if (!this.tapData || !this.tapData.output)
|
|
@@ -5807,13 +5806,13 @@ class T extends te {
|
|
|
5807
5806
|
return !1;
|
|
5808
5807
|
}
|
|
5809
5808
|
createChangeOutput(t) {
|
|
5810
|
-
if (
|
|
5809
|
+
if (Y.isValidP2TRAddress(this.from, this.network))
|
|
5811
5810
|
return {
|
|
5812
5811
|
value: k(t),
|
|
5813
5812
|
address: this.from,
|
|
5814
5813
|
tapInternalKey: this.internalPubKeyToXOnly()
|
|
5815
5814
|
};
|
|
5816
|
-
if (
|
|
5815
|
+
if (Y.isValidPublicKey(this.from, this.network)) {
|
|
5817
5816
|
const e = v.compile([
|
|
5818
5817
|
y(this.from.replace("0x", "")),
|
|
5819
5818
|
f.OP_CHECKSIG
|
|
@@ -5829,7 +5828,7 @@ class T extends te {
|
|
|
5829
5828
|
};
|
|
5830
5829
|
}
|
|
5831
5830
|
}
|
|
5832
|
-
class
|
|
5831
|
+
class Xt extends T {
|
|
5833
5832
|
type = b.CUSTOM_CODE;
|
|
5834
5833
|
/**
|
|
5835
5834
|
* The contract address
|
|
@@ -5890,7 +5889,7 @@ class $t extends T {
|
|
|
5890
5889
|
constructor(t) {
|
|
5891
5890
|
if (super(t), !t.script) throw new Error("Bitcoin script is required");
|
|
5892
5891
|
if (!t.witnesses) throw new Error("Witness(es) are required");
|
|
5893
|
-
this.witnesses = t.witnesses, this.randomBytes = t.randomBytes || M.rndBytes(), this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.scriptSeed = this.getContractSeed(), this.contractSigner = P.fromSeedKeyPair(this.scriptSeed, this.network), this.generator = new
|
|
5892
|
+
this.witnesses = t.witnesses, this.randomBytes = t.randomBytes || M.rndBytes(), this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.scriptSeed = this.getContractSeed(), this.contractSigner = P.fromSeedKeyPair(this.scriptSeed, this.network), this.generator = new qe(this.internalPubKeyToXOnly(), this.network), this.compiledTargetScript = this.generator.compile(t.script), this.scriptTree = this.getScriptTree(), this.internalInit(), this._scriptAddress = pe.generatePKSH(this.scriptSeed, this.network);
|
|
5894
5893
|
}
|
|
5895
5894
|
/**
|
|
5896
5895
|
* @description Get the contract address (PKSH)
|
|
@@ -5909,7 +5908,7 @@ class $t extends T {
|
|
|
5909
5908
|
}
|
|
5910
5909
|
/**
|
|
5911
5910
|
* Get the random bytes used for the interaction
|
|
5912
|
-
* @returns {
|
|
5911
|
+
* @returns {Uint8Array} The random bytes
|
|
5913
5912
|
*/
|
|
5914
5913
|
getRndBytes() {
|
|
5915
5914
|
return this.randomBytes;
|
|
@@ -5961,7 +5960,7 @@ class $t extends T {
|
|
|
5961
5960
|
}
|
|
5962
5961
|
t.signInput(0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer);
|
|
5963
5962
|
const e = /* @__PURE__ */ new Set([0]);
|
|
5964
|
-
if (this.canUseParallelSigning &&
|
|
5963
|
+
if (this.canUseParallelSigning && lt(this.signer))
|
|
5965
5964
|
try {
|
|
5966
5965
|
const i = await this.signKeyPathInputsParallel(t, /* @__PURE__ */ new Set([0]));
|
|
5967
5966
|
if (i.success)
|
|
@@ -5990,7 +5989,7 @@ class $t extends T {
|
|
|
5990
5989
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
5991
5990
|
network: this.network,
|
|
5992
5991
|
scriptTree: this.scriptTree,
|
|
5993
|
-
name:
|
|
5992
|
+
name: x.P2TR
|
|
5994
5993
|
};
|
|
5995
5994
|
}
|
|
5996
5995
|
/**
|
|
@@ -6008,7 +6007,7 @@ class $t extends T {
|
|
|
6008
6007
|
network: this.network,
|
|
6009
6008
|
scriptTree: this.scriptTree,
|
|
6010
6009
|
redeem: t,
|
|
6011
|
-
name:
|
|
6010
|
+
name: x.P2TR
|
|
6012
6011
|
};
|
|
6013
6012
|
}
|
|
6014
6013
|
getScriptSolution(t) {
|
|
@@ -6056,12 +6055,12 @@ class $t extends T {
|
|
|
6056
6055
|
*/
|
|
6057
6056
|
generateRedeemScripts() {
|
|
6058
6057
|
this.targetScriptRedeem = {
|
|
6059
|
-
name:
|
|
6058
|
+
name: x.P2TR,
|
|
6060
6059
|
//pubkeys: this.getPubKeys(),
|
|
6061
6060
|
output: this.compiledTargetScript,
|
|
6062
6061
|
redeemVersion: 192
|
|
6063
6062
|
}, this.leftOverFundsScriptRedeem = {
|
|
6064
|
-
name:
|
|
6063
|
+
name: x.P2TR,
|
|
6065
6064
|
//pubkeys: this.getPubKeys(),
|
|
6066
6065
|
output: this.getLeafScript(),
|
|
6067
6066
|
redeemVersion: 192
|
|
@@ -6091,12 +6090,12 @@ class $t extends T {
|
|
|
6091
6090
|
];
|
|
6092
6091
|
}
|
|
6093
6092
|
}
|
|
6094
|
-
class
|
|
6093
|
+
class Ae extends T {
|
|
6095
6094
|
static MAXIMUM_CALLDATA_SIZE = 1024 * 1024;
|
|
6096
6095
|
// 1MB
|
|
6097
6096
|
/**
|
|
6098
6097
|
* Random salt for the interaction
|
|
6099
|
-
* @type {
|
|
6098
|
+
* @type {Uint8Array}
|
|
6100
6099
|
*/
|
|
6101
6100
|
randomBytes;
|
|
6102
6101
|
targetScriptRedeem = null;
|
|
@@ -6124,10 +6123,10 @@ class Te extends T {
|
|
|
6124
6123
|
throw new Error("Calldata is required");
|
|
6125
6124
|
if (!t.challenge)
|
|
6126
6125
|
throw new Error("Challenge solution is required");
|
|
6127
|
-
this.challenge = t.challenge, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.disableAutoRefund = t.disableAutoRefund || !1, this.epochChallenge =
|
|
6126
|
+
this.challenge = t.challenge, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.disableAutoRefund = t.disableAutoRefund || !1, this.epochChallenge = q.generateTimeLockAddress(
|
|
6128
6127
|
this.challenge.publicKey.originalPublicKeyBuffer(),
|
|
6129
6128
|
this.network
|
|
6130
|
-
), this.calldata =
|
|
6129
|
+
), this.calldata = X.compress(t.calldata), this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = this.generateKeyPairFromSeed(), this.calldataGenerator = new he(
|
|
6131
6130
|
this.signer.publicKey,
|
|
6132
6131
|
this.scriptSignerXOnlyPubKey(),
|
|
6133
6132
|
this.network
|
|
@@ -6138,14 +6137,14 @@ class Te extends T {
|
|
|
6138
6137
|
}
|
|
6139
6138
|
/**
|
|
6140
6139
|
* Get the contract secret
|
|
6141
|
-
* @returns {
|
|
6140
|
+
* @returns {Uint8Array} The contract secret
|
|
6142
6141
|
*/
|
|
6143
6142
|
getContractSecret() {
|
|
6144
6143
|
return this.contractSecret;
|
|
6145
6144
|
}
|
|
6146
6145
|
/**
|
|
6147
6146
|
* Get the random bytes used for the interaction
|
|
6148
|
-
* @returns {
|
|
6147
|
+
* @returns {Uint8Array} The random bytes
|
|
6149
6148
|
*/
|
|
6150
6149
|
getRndBytes() {
|
|
6151
6150
|
return this.randomBytes;
|
|
@@ -6159,7 +6158,7 @@ class Te extends T {
|
|
|
6159
6158
|
/**
|
|
6160
6159
|
* Get the internal pubkey as an x-only key
|
|
6161
6160
|
* @protected
|
|
6162
|
-
* @returns {
|
|
6161
|
+
* @returns {Uint8Array} The internal pubkey as an x-only key
|
|
6163
6162
|
*/
|
|
6164
6163
|
scriptSignerXOnlyPubKey() {
|
|
6165
6164
|
return O(this.scriptSigner.publicKey);
|
|
@@ -6213,7 +6212,7 @@ class Te extends T {
|
|
|
6213
6212
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
6214
6213
|
network: this.network,
|
|
6215
6214
|
scriptTree: this.scriptTree,
|
|
6216
|
-
name:
|
|
6215
|
+
name: x.P2TR
|
|
6217
6216
|
};
|
|
6218
6217
|
}
|
|
6219
6218
|
generateTapData() {
|
|
@@ -6227,7 +6226,7 @@ class Te extends T {
|
|
|
6227
6226
|
network: this.network,
|
|
6228
6227
|
scriptTree: this.scriptTree,
|
|
6229
6228
|
redeem: t,
|
|
6230
|
-
name:
|
|
6229
|
+
name: x.P2TR
|
|
6231
6230
|
};
|
|
6232
6231
|
}
|
|
6233
6232
|
/**
|
|
@@ -6235,7 +6234,7 @@ class Te extends T {
|
|
|
6235
6234
|
* @param {PsbtInput} input The input
|
|
6236
6235
|
* @protected
|
|
6237
6236
|
*
|
|
6238
|
-
* @returns {
|
|
6237
|
+
* @returns {Uint8Array[]} The script solution
|
|
6239
6238
|
*/
|
|
6240
6239
|
getScriptSolution(t) {
|
|
6241
6240
|
if (!t.tapScriptSig)
|
|
@@ -6311,7 +6310,7 @@ class Te extends T {
|
|
|
6311
6310
|
t.data.inputs[0],
|
|
6312
6311
|
0,
|
|
6313
6312
|
this.getSignerKey()
|
|
6314
|
-
), t.finalizeInput(0, this.customFinalizer.bind(this)), this.canUseParallelSigning &&
|
|
6313
|
+
), t.finalizeInput(0, this.customFinalizer.bind(this)), this.canUseParallelSigning && lt(this.signer)) {
|
|
6315
6314
|
let e = /* @__PURE__ */ new Set();
|
|
6316
6315
|
try {
|
|
6317
6316
|
const i = await this.signKeyPathInputsParallel(t, /* @__PURE__ */ new Set([0]));
|
|
@@ -6351,7 +6350,7 @@ class Te extends T {
|
|
|
6351
6350
|
if (!this.to) throw new Error("To address is required");
|
|
6352
6351
|
const t = this.getTransactionOPNetFee();
|
|
6353
6352
|
this.addFeeToOutput(t, this.to, this.epochChallenge, !1);
|
|
6354
|
-
const e = t <
|
|
6353
|
+
const e = t < G ? G : t, i = this.addOptionalOutputsAndGetAmount();
|
|
6355
6354
|
this.disableAutoRefund || await this.addRefundOutput(e + i);
|
|
6356
6355
|
}
|
|
6357
6356
|
/**
|
|
@@ -6366,17 +6365,17 @@ class Te extends T {
|
|
|
6366
6365
|
*/
|
|
6367
6366
|
generateRedeemScripts() {
|
|
6368
6367
|
this.targetScriptRedeem = {
|
|
6369
|
-
name:
|
|
6368
|
+
name: x.P2TR,
|
|
6370
6369
|
output: this.compiledTargetScript,
|
|
6371
6370
|
redeemVersion: 192
|
|
6372
6371
|
}, this.leftOverFundsScriptRedeem = {
|
|
6373
|
-
name:
|
|
6372
|
+
name: x.P2TR,
|
|
6374
6373
|
output: this.LOCK_LEAF_SCRIPT,
|
|
6375
6374
|
redeemVersion: 192
|
|
6376
6375
|
};
|
|
6377
6376
|
}
|
|
6378
6377
|
}
|
|
6379
|
-
class
|
|
6378
|
+
class wt extends T {
|
|
6380
6379
|
static MAXIMUM_CONTRACT_SIZE = 128 * 1024;
|
|
6381
6380
|
type = b.DEPLOYMENT;
|
|
6382
6381
|
challenge;
|
|
@@ -6451,13 +6450,13 @@ class mt extends T {
|
|
|
6451
6450
|
constructor(t) {
|
|
6452
6451
|
if (super(t), !this.hashedPublicKey)
|
|
6453
6452
|
throw new Error("MLDSA signer must be defined to deploy a contract.");
|
|
6454
|
-
if (this.bytecode =
|
|
6455
|
-
new Uint8Array([
|
|
6453
|
+
if (this.bytecode = X.compress(
|
|
6454
|
+
new Uint8Array([...$e, ...t.bytecode])
|
|
6456
6455
|
), this.verifyBytecode(), t.calldata && (this.calldata = t.calldata, this.verifyCalldata()), !t.challenge) throw new Error("Challenge solution is required");
|
|
6457
|
-
if (this.randomBytes = t.randomBytes || M.rndBytes(), this.challenge = t.challenge, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.epochChallenge =
|
|
6456
|
+
if (this.randomBytes = t.randomBytes || M.rndBytes(), this.challenge = t.challenge, this.LOCK_LEAF_SCRIPT = this.defineLockScript(), this.epochChallenge = q.generateTimeLockAddress(
|
|
6458
6457
|
this.challenge.publicKey.originalPublicKeyBuffer(),
|
|
6459
6458
|
this.network
|
|
6460
|
-
), this.contractSeed = this.getContractSeed(), this.contractSigner = P.fromSeedKeyPair(this.contractSeed, this.network), this.deploymentGenerator = new
|
|
6459
|
+
), this.contractSeed = this.getContractSeed(), this.contractSigner = P.fromSeedKeyPair(this.contractSeed, this.network), this.deploymentGenerator = new de(
|
|
6461
6460
|
this.signer.publicKey,
|
|
6462
6461
|
this.contractSignerXOnlyPubKey(),
|
|
6463
6462
|
this.network
|
|
@@ -6477,7 +6476,7 @@ class mt extends T {
|
|
|
6477
6476
|
this.calldata,
|
|
6478
6477
|
this.generateFeatures(t)
|
|
6479
6478
|
);
|
|
6480
|
-
this.scriptTree = this.getScriptTree(), this.internalInit(), this._contractPubKey = "0x" +
|
|
6479
|
+
this.scriptTree = this.getScriptTree(), this.internalInit(), this._contractPubKey = "0x" + g(this.contractSeed), this._contractAddress = new K(this.contractSeed);
|
|
6481
6480
|
}
|
|
6482
6481
|
/**
|
|
6483
6482
|
* Get the contract public key
|
|
@@ -6502,14 +6501,14 @@ class mt extends T {
|
|
|
6502
6501
|
}
|
|
6503
6502
|
/**
|
|
6504
6503
|
* Get the random bytes used for the interaction
|
|
6505
|
-
* @returns {
|
|
6504
|
+
* @returns {Uint8Array} The random bytes
|
|
6506
6505
|
*/
|
|
6507
6506
|
getRndBytes() {
|
|
6508
6507
|
return this.randomBytes;
|
|
6509
6508
|
}
|
|
6510
6509
|
/**
|
|
6511
6510
|
* Get the contract bytecode
|
|
6512
|
-
* @returns {
|
|
6511
|
+
* @returns {Uint8Array} The contract bytecode
|
|
6513
6512
|
*/
|
|
6514
6513
|
getChallenge() {
|
|
6515
6514
|
return this.challenge;
|
|
@@ -6583,7 +6582,7 @@ class mt extends T {
|
|
|
6583
6582
|
}
|
|
6584
6583
|
t.signInput(0, this.contractSigner), t.signInput(0, this.getSignerKey()), t.finalizeInput(0, this.customFinalizer.bind(this));
|
|
6585
6584
|
const e = /* @__PURE__ */ new Set([0]);
|
|
6586
|
-
if (this.canUseParallelSigning &&
|
|
6585
|
+
if (this.canUseParallelSigning && lt(this.signer))
|
|
6587
6586
|
try {
|
|
6588
6587
|
const i = await this.signKeyPathInputsParallel(t, /* @__PURE__ */ new Set([0]));
|
|
6589
6588
|
if (i.success)
|
|
@@ -6609,7 +6608,7 @@ class mt extends T {
|
|
|
6609
6608
|
*/
|
|
6610
6609
|
generateScriptAddress() {
|
|
6611
6610
|
return {
|
|
6612
|
-
name:
|
|
6611
|
+
name: x.P2TR,
|
|
6613
6612
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
6614
6613
|
network: this.network,
|
|
6615
6614
|
scriptTree: this.scriptTree
|
|
@@ -6626,7 +6625,7 @@ class mt extends T {
|
|
|
6626
6625
|
if (!this.scriptTree)
|
|
6627
6626
|
throw new Error("Script tree is required");
|
|
6628
6627
|
return {
|
|
6629
|
-
name:
|
|
6628
|
+
name: x.P2TR,
|
|
6630
6629
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
6631
6630
|
network: this.network,
|
|
6632
6631
|
scriptTree: this.scriptTree,
|
|
@@ -6636,8 +6635,8 @@ class mt extends T {
|
|
|
6636
6635
|
generateFeatures(t) {
|
|
6637
6636
|
const e = [], i = t.challenge.getSubmission();
|
|
6638
6637
|
if (i && e.push({
|
|
6639
|
-
priority:
|
|
6640
|
-
opcode:
|
|
6638
|
+
priority: J.MLDSA_LINK_PUBKEY,
|
|
6639
|
+
opcode: z.EPOCH_SUBMISSION,
|
|
6641
6640
|
data: i
|
|
6642
6641
|
}), t.revealMLDSAPublicKey && !t.linkMLDSAPublicKeyToAddress)
|
|
6643
6642
|
throw new Error(
|
|
@@ -6646,12 +6645,12 @@ class mt extends T {
|
|
|
6646
6645
|
return t.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(t, e), e;
|
|
6647
6646
|
}
|
|
6648
6647
|
verifyCalldata() {
|
|
6649
|
-
if (this.calldata && this.calldata.length >
|
|
6648
|
+
if (this.calldata && this.calldata.length > Ae.MAXIMUM_CALLDATA_SIZE)
|
|
6650
6649
|
throw new Error("Calldata size overflow.");
|
|
6651
6650
|
}
|
|
6652
6651
|
verifyBytecode() {
|
|
6653
6652
|
if (!this.bytecode) throw new Error("Bytecode is required");
|
|
6654
|
-
if (this.bytecode.length >
|
|
6653
|
+
if (this.bytecode.length > wt.MAXIMUM_CONTRACT_SIZE)
|
|
6655
6654
|
throw new Error("Contract size overflow.");
|
|
6656
6655
|
}
|
|
6657
6656
|
/**
|
|
@@ -6661,7 +6660,7 @@ class mt extends T {
|
|
|
6661
6660
|
getContractSeed() {
|
|
6662
6661
|
if (!this.bytecode)
|
|
6663
6662
|
throw new Error("Bytecode is required");
|
|
6664
|
-
const t = this.internalPubKeyToXOnly(), e = C.hash256(this.randomBytes), i = C.hash256(this.bytecode), r =
|
|
6663
|
+
const t = this.internalPubKeyToXOnly(), e = C.hash256(this.randomBytes), i = C.hash256(this.bytecode), r = ut([t, e, i]);
|
|
6665
6664
|
return C.hash256(r);
|
|
6666
6665
|
}
|
|
6667
6666
|
/**
|
|
@@ -6689,12 +6688,12 @@ class mt extends T {
|
|
|
6689
6688
|
*/
|
|
6690
6689
|
generateRedeemScripts() {
|
|
6691
6690
|
this.targetScriptRedeem = {
|
|
6692
|
-
name:
|
|
6691
|
+
name: x.P2TR,
|
|
6693
6692
|
//pubkeys: this.getPubKeys(),
|
|
6694
6693
|
output: this.compiledTargetScript,
|
|
6695
6694
|
redeemVersion: 192
|
|
6696
6695
|
}, this.leftOverFundsScriptRedeem = {
|
|
6697
|
-
name:
|
|
6696
|
+
name: x.P2TR,
|
|
6698
6697
|
//pubkeys: this.getPubKeys(),
|
|
6699
6698
|
output: this.getLeafScript(),
|
|
6700
6699
|
redeemVersion: 192
|
|
@@ -6726,7 +6725,7 @@ class mt extends T {
|
|
|
6726
6725
|
];
|
|
6727
6726
|
}
|
|
6728
6727
|
}
|
|
6729
|
-
class
|
|
6728
|
+
class $t extends T {
|
|
6730
6729
|
type = b.FUNDING;
|
|
6731
6730
|
amount;
|
|
6732
6731
|
splitInputsInto;
|
|
@@ -6798,7 +6797,7 @@ class Yt extends T {
|
|
|
6798
6797
|
return this.signer;
|
|
6799
6798
|
}
|
|
6800
6799
|
}
|
|
6801
|
-
class
|
|
6800
|
+
class Yt extends Ae {
|
|
6802
6801
|
type = b.INTERACTION;
|
|
6803
6802
|
compiledTargetScript;
|
|
6804
6803
|
scriptTree;
|
|
@@ -6833,14 +6832,14 @@ class Gt extends Te {
|
|
|
6833
6832
|
generateFeatures(t) {
|
|
6834
6833
|
const e = [];
|
|
6835
6834
|
t.loadedStorage && e.push({
|
|
6836
|
-
priority:
|
|
6837
|
-
opcode:
|
|
6835
|
+
priority: J.ACCESS_LIST,
|
|
6836
|
+
opcode: z.ACCESS_LIST,
|
|
6838
6837
|
data: t.loadedStorage
|
|
6839
6838
|
});
|
|
6840
6839
|
const i = t.challenge.getSubmission();
|
|
6841
6840
|
if (i && e.push({
|
|
6842
|
-
priority:
|
|
6843
|
-
opcode:
|
|
6841
|
+
priority: J.EPOCH_SUBMISSION,
|
|
6842
|
+
opcode: z.EPOCH_SUBMISSION,
|
|
6844
6843
|
data: i
|
|
6845
6844
|
}), t.revealMLDSAPublicKey && !t.linkMLDSAPublicKeyToAddress)
|
|
6846
6845
|
throw new Error(
|
|
@@ -6849,7 +6848,7 @@ class Gt extends Te {
|
|
|
6849
6848
|
return t.linkMLDSAPublicKeyToAddress && this.generateMLDSALinkRequest(t, e), e;
|
|
6850
6849
|
}
|
|
6851
6850
|
}
|
|
6852
|
-
class
|
|
6851
|
+
class tt extends T {
|
|
6853
6852
|
static MAX_WITNESS_FIELDS = 10;
|
|
6854
6853
|
static MAX_BYTES_PER_WITNESS = 80;
|
|
6855
6854
|
type = b.INTERACTION;
|
|
@@ -6880,13 +6879,13 @@ class et extends T {
|
|
|
6880
6879
|
throw new Error("Calldata is required");
|
|
6881
6880
|
if (!t.challenge)
|
|
6882
6881
|
throw new Error("Challenge solution is required");
|
|
6883
|
-
if (this.disableAutoRefund = t.disableAutoRefund || !1, this.contractSecret = y(t.contract.replace("0x", "")), this.calldata =
|
|
6882
|
+
if (this.disableAutoRefund = t.disableAutoRefund || !1, this.contractSecret = y(t.contract.replace("0x", "")), this.calldata = X.compress(t.calldata), this.challenge = t.challenge, this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = this.generateKeyPairFromSeed(), this.p2wdaGenerator = new Lt(
|
|
6884
6883
|
this.signer.publicKey,
|
|
6885
6884
|
this.scriptSignerXOnlyPubKey(),
|
|
6886
6885
|
this.network
|
|
6887
6886
|
), this.contractSecret.length !== 32)
|
|
6888
6887
|
throw new Error("Invalid contract secret length. Expected 32 bytes.");
|
|
6889
|
-
if (this.epochChallenge =
|
|
6888
|
+
if (this.epochChallenge = q.generateTimeLockAddress(
|
|
6890
6889
|
this.challenge.publicKey.originalPublicKeyBuffer(),
|
|
6891
6890
|
this.network
|
|
6892
6891
|
), this.validateP2WDAInputs(), t.compiledTargetScript)
|
|
@@ -6958,14 +6957,14 @@ class et extends T {
|
|
|
6958
6957
|
generateFeatures(t) {
|
|
6959
6958
|
const e = [];
|
|
6960
6959
|
t.loadedStorage && e.push({
|
|
6961
|
-
priority:
|
|
6962
|
-
opcode:
|
|
6960
|
+
priority: J.ACCESS_LIST,
|
|
6961
|
+
opcode: z.ACCESS_LIST,
|
|
6963
6962
|
data: t.loadedStorage
|
|
6964
6963
|
});
|
|
6965
6964
|
const i = t.challenge.getSubmission();
|
|
6966
6965
|
return i && e.push({
|
|
6967
|
-
priority:
|
|
6968
|
-
opcode:
|
|
6966
|
+
priority: J.EPOCH_SUBMISSION,
|
|
6967
|
+
opcode: z.EPOCH_SUBMISSION,
|
|
6969
6968
|
data: i
|
|
6970
6969
|
}), e;
|
|
6971
6970
|
}
|
|
@@ -6985,13 +6984,13 @@ class et extends T {
|
|
|
6985
6984
|
* Validate that input 0 is P2WDA
|
|
6986
6985
|
*/
|
|
6987
6986
|
validateP2WDAInputs() {
|
|
6988
|
-
if (this.utxos.length === 0 || !
|
|
6987
|
+
if (this.utxos.length === 0 || !j.isP2WDAUTXO(this.utxos[0]))
|
|
6989
6988
|
throw new Error("Input 0 must be a P2WDA UTXO");
|
|
6990
6989
|
for (let t = 0; t < this.utxos.length; t++)
|
|
6991
|
-
|
|
6990
|
+
j.isP2WDAUTXO(this.utxos[t]) && this.p2wdaInputIndices.add(t);
|
|
6992
6991
|
for (let t = 0; t < this.optionalInputs.length; t++) {
|
|
6993
6992
|
const e = this.utxos.length + t;
|
|
6994
|
-
|
|
6993
|
+
j.isP2WDAUTXO(this.optionalInputs[t]) && this.p2wdaInputIndices.add(e);
|
|
6995
6994
|
}
|
|
6996
6995
|
}
|
|
6997
6996
|
/**
|
|
@@ -7001,12 +7000,12 @@ class et extends T {
|
|
|
7001
7000
|
if (!this.compiledOperationData)
|
|
7002
7001
|
throw new Error("Operation data not compiled");
|
|
7003
7002
|
const t = this.compiledOperationData.length;
|
|
7004
|
-
if (!
|
|
7003
|
+
if (!Lt.validateWitnessSize(t)) {
|
|
7005
7004
|
const i = t + 64, r = Math.ceil(i * 0.7), s = Math.ceil(
|
|
7006
|
-
r /
|
|
7005
|
+
r / tt.MAX_BYTES_PER_WITNESS
|
|
7007
7006
|
);
|
|
7008
7007
|
throw new Error(
|
|
7009
|
-
`Please dont use P2WDA for this operation. Data too large. Raw size: ${t} bytes, estimated compressed: ${r} bytes, needs ${s} witness fields, max is ${
|
|
7008
|
+
`Please dont use P2WDA for this operation. Data too large. Raw size: ${t} bytes, estimated compressed: ${r} bytes, needs ${s} witness fields, max is ${tt.MAX_WITNESS_FIELDS}`
|
|
7010
7009
|
);
|
|
7011
7010
|
}
|
|
7012
7011
|
}
|
|
@@ -7021,16 +7020,16 @@ class et extends T {
|
|
|
7021
7020
|
throw new Error(`No witness script for P2WDA input #${t}`);
|
|
7022
7021
|
if (!this.compiledOperationData)
|
|
7023
7022
|
throw new Error("Operation data not compiled");
|
|
7024
|
-
const i = e.partialSig[0].signature, r =
|
|
7023
|
+
const i = e.partialSig[0].signature, r = ut([i, this.compiledOperationData]), o = ot.signMessage(
|
|
7025
7024
|
this.signer,
|
|
7026
7025
|
r
|
|
7027
|
-
).signature, a =
|
|
7028
|
-
if (u.length >
|
|
7026
|
+
).signature, a = ut([o, this.compiledOperationData]), c = X.compress(a), u = this.splitIntoWitnessChunks(c);
|
|
7027
|
+
if (u.length > tt.MAX_WITNESS_FIELDS)
|
|
7029
7028
|
throw new Error(
|
|
7030
|
-
`Compressed data needs ${u.length} witness fields, max is ${
|
|
7029
|
+
`Compressed data needs ${u.length} witness fields, max is ${tt.MAX_WITNESS_FIELDS}`
|
|
7031
7030
|
);
|
|
7032
7031
|
const l = [i];
|
|
7033
|
-
for (let h = 0; h <
|
|
7032
|
+
for (let h = 0; h < tt.MAX_WITNESS_FIELDS; h++)
|
|
7034
7033
|
l.push(h < u.length ? u[h] : new Uint8Array(0));
|
|
7035
7034
|
return l.push(e.witnessScript), {
|
|
7036
7035
|
finalScriptSig: void 0,
|
|
@@ -7045,7 +7044,7 @@ class et extends T {
|
|
|
7045
7044
|
let i = 0;
|
|
7046
7045
|
for (; i < t.length; ) {
|
|
7047
7046
|
const r = Math.min(
|
|
7048
|
-
|
|
7047
|
+
tt.MAX_BYTES_PER_WITNESS,
|
|
7049
7048
|
t.length - i
|
|
7050
7049
|
);
|
|
7051
7050
|
e.push(t.slice(i, i + r)), i += r;
|
|
@@ -7053,7 +7052,7 @@ class et extends T {
|
|
|
7053
7052
|
return e;
|
|
7054
7053
|
}
|
|
7055
7054
|
}
|
|
7056
|
-
class
|
|
7055
|
+
class Te extends T {
|
|
7057
7056
|
type = b.CANCEL;
|
|
7058
7057
|
/**
|
|
7059
7058
|
* The tap leaf script for spending
|
|
@@ -7069,7 +7068,7 @@ class Ie extends T {
|
|
|
7069
7068
|
gasSatFee: 1n,
|
|
7070
7069
|
isCancellation: !0,
|
|
7071
7070
|
priorityFee: 1n,
|
|
7072
|
-
calldata:
|
|
7071
|
+
calldata: new Uint8Array(0)
|
|
7073
7072
|
}), this.contractSecret = new Uint8Array(0), t.compiledTargetScript instanceof Uint8Array ? this.compiledTargetScript = t.compiledTargetScript : this.compiledTargetScript = y(t.compiledTargetScript), this.scriptTree = this.getMinimalScriptTree(), this.internalInit();
|
|
7074
7073
|
}
|
|
7075
7074
|
async buildTransaction() {
|
|
@@ -7123,7 +7122,7 @@ class Ie extends T {
|
|
|
7123
7122
|
internalPubkey: this.internalPubKeyToXOnly(),
|
|
7124
7123
|
network: this.network,
|
|
7125
7124
|
scriptTree: this.scriptTree,
|
|
7126
|
-
name:
|
|
7125
|
+
name: x.P2TR
|
|
7127
7126
|
};
|
|
7128
7127
|
}
|
|
7129
7128
|
/**
|
|
@@ -7150,7 +7149,7 @@ class Ie extends T {
|
|
|
7150
7149
|
network: this.network,
|
|
7151
7150
|
scriptTree: this.scriptTree,
|
|
7152
7151
|
redeem: t,
|
|
7153
|
-
name:
|
|
7152
|
+
name: x.P2TR
|
|
7154
7153
|
};
|
|
7155
7154
|
}
|
|
7156
7155
|
/**
|
|
@@ -7189,7 +7188,7 @@ class Ie extends T {
|
|
|
7189
7188
|
this.getSignerKey()
|
|
7190
7189
|
), t.finalizeInput(0, this.customFinalizer.bind(this));
|
|
7191
7190
|
let e = /* @__PURE__ */ new Set();
|
|
7192
|
-
if (this.canUseParallelSigning &&
|
|
7191
|
+
if (this.canUseParallelSigning && lt(this.signer))
|
|
7193
7192
|
try {
|
|
7194
7193
|
const i = await this.signKeyPathInputsParallel(t, /* @__PURE__ */ new Set([0]));
|
|
7195
7194
|
i.success && (e = new Set(i.signatures.keys()));
|
|
@@ -7238,13 +7237,13 @@ class Ie extends T {
|
|
|
7238
7237
|
*/
|
|
7239
7238
|
generateLeftoverFundsRedeem() {
|
|
7240
7239
|
this.leftOverFundsScriptRedeem = {
|
|
7241
|
-
name:
|
|
7240
|
+
name: x.P2TR,
|
|
7242
7241
|
output: this.LOCK_LEAF_SCRIPT,
|
|
7243
7242
|
redeemVersion: 192
|
|
7244
7243
|
};
|
|
7245
7244
|
}
|
|
7246
7245
|
}
|
|
7247
|
-
class
|
|
7246
|
+
class si extends T {
|
|
7248
7247
|
type = b.INTERACTION;
|
|
7249
7248
|
/** Random bytes for interaction (same as InteractionTransaction) */
|
|
7250
7249
|
randomBytes;
|
|
@@ -7285,10 +7284,10 @@ class ni extends T {
|
|
|
7285
7284
|
throw new Error("Challenge solution is required");
|
|
7286
7285
|
if (this.contractAddress = t.to, this.contractSecret = y(t.contract.replace("0x", "")), this.disableAutoRefund = t.disableAutoRefund || !1, this.maxChunkSize = t.maxChunkSize ?? E.MAX_CHUNK_SIZE, this.contractSecret.length !== 32)
|
|
7287
7286
|
throw new Error("Invalid contract secret length. Expected 32 bytes.");
|
|
7288
|
-
if (this.calldata =
|
|
7287
|
+
if (this.calldata = X.compress(t.calldata), this.randomBytes = t.randomBytes || M.rndBytes(), this.scriptSigner = P.fromSeedKeyPair(this.randomBytes, this.network), this.challenge = t.challenge, this.epochChallenge = q.generateTimeLockAddress(
|
|
7289
7288
|
this.challenge.publicKey.originalPublicKeyBuffer(),
|
|
7290
7289
|
this.network
|
|
7291
|
-
), this.calldataGenerator = new
|
|
7290
|
+
), this.calldataGenerator = new he(
|
|
7292
7291
|
this.signer.publicKey,
|
|
7293
7292
|
O(this.scriptSigner.publicKey),
|
|
7294
7293
|
this.network
|
|
@@ -7397,7 +7396,7 @@ class ni extends T {
|
|
|
7397
7396
|
* @param setupTxId The transaction ID of the setup transaction
|
|
7398
7397
|
*/
|
|
7399
7398
|
buildRevealTransaction(t) {
|
|
7400
|
-
const e = new
|
|
7399
|
+
const e = new V({ network: this.network }), i = this.calculateValuePerOutput();
|
|
7401
7400
|
for (let p = 0; p < this.commitmentOutputs.length; p++) {
|
|
7402
7401
|
const d = this.commitmentOutputs[p];
|
|
7403
7402
|
e.addInput({
|
|
@@ -7410,7 +7409,7 @@ class ni extends T {
|
|
|
7410
7409
|
witnessScript: d.witnessScript
|
|
7411
7410
|
});
|
|
7412
7411
|
}
|
|
7413
|
-
const r = BigInt(this.commitmentOutputs.length) * i, s = this.getTransactionOPNetFee(), o = s <
|
|
7412
|
+
const r = BigInt(this.commitmentOutputs.length) * i, s = this.getTransactionOPNetFee(), o = s < G ? G : s;
|
|
7414
7413
|
e.addOutput({
|
|
7415
7414
|
address: this.epochChallenge.address,
|
|
7416
7415
|
value: k(o)
|
|
@@ -7505,14 +7504,14 @@ class ni extends T {
|
|
|
7505
7504
|
calculateValuePerOutput() {
|
|
7506
7505
|
if (this.cachedValuePerOutput !== null)
|
|
7507
7506
|
return this.cachedValuePerOutput;
|
|
7508
|
-
const t = this.commitmentOutputs.length, e = this.getTransactionOPNetFee(), i = e <
|
|
7507
|
+
const t = this.commitmentOutputs.length, e = this.getTransactionOPNetFee(), i = e < G ? G : e, r = this.estimateRevealVBytes(), s = BigInt(Math.ceil(r * this.feeRate)), o = i + s + T.MINIMUM_DUST, a = BigInt(Math.ceil(Number(o) / t)), c = E.MIN_OUTPUT_VALUE;
|
|
7509
7508
|
return this.cachedValuePerOutput = a > c ? a : c, this.cachedValuePerOutput;
|
|
7510
7509
|
}
|
|
7511
7510
|
/**
|
|
7512
7511
|
* Get refund address.
|
|
7513
7512
|
*/
|
|
7514
7513
|
getRefundAddress() {
|
|
7515
|
-
return this.from ? this.from :
|
|
7514
|
+
return this.from ? this.from : pe.generatePKSH(this.signer.publicKey, this.network);
|
|
7516
7515
|
}
|
|
7517
7516
|
/**
|
|
7518
7517
|
* Generate features (same as InteractionTransaction).
|
|
@@ -7520,14 +7519,14 @@ class ni extends T {
|
|
|
7520
7519
|
generateFeatures(t) {
|
|
7521
7520
|
const e = [];
|
|
7522
7521
|
t.loadedStorage && e.push({
|
|
7523
|
-
priority:
|
|
7524
|
-
opcode:
|
|
7522
|
+
priority: J.ACCESS_LIST,
|
|
7523
|
+
opcode: z.ACCESS_LIST,
|
|
7525
7524
|
data: t.loadedStorage
|
|
7526
7525
|
});
|
|
7527
7526
|
const i = t.challenge.getSubmission();
|
|
7528
7527
|
if (i && e.push({
|
|
7529
|
-
priority:
|
|
7530
|
-
opcode:
|
|
7528
|
+
priority: J.EPOCH_SUBMISSION,
|
|
7529
|
+
opcode: z.EPOCH_SUBMISSION,
|
|
7531
7530
|
data: i
|
|
7532
7531
|
}), t.revealMLDSAPublicKey && !t.linkMLDSAPublicKeyToAddress)
|
|
7533
7532
|
throw new Error(
|
|
@@ -7548,7 +7547,7 @@ class ni extends T {
|
|
|
7548
7547
|
}
|
|
7549
7548
|
}
|
|
7550
7549
|
}
|
|
7551
|
-
class
|
|
7550
|
+
class ni {
|
|
7552
7551
|
debug = !1;
|
|
7553
7552
|
DUMMY_PUBKEY = new Uint8Array(32).fill(1);
|
|
7554
7553
|
P2TR_SCRIPT = Uint8Array.from([81, 32, ...this.DUMMY_PUBKEY]);
|
|
@@ -7571,7 +7570,7 @@ class oi {
|
|
|
7571
7570
|
return e;
|
|
7572
7571
|
if (!("signer" in t))
|
|
7573
7572
|
throw new Error('Field "signer" not provided, OP_WALLET not detected.');
|
|
7574
|
-
const r = await new
|
|
7573
|
+
const r = await new Te(t).signTransaction();
|
|
7575
7574
|
return {
|
|
7576
7575
|
transaction: r.toHex(),
|
|
7577
7576
|
nextUTXOs: this.getUTXOAsTransaction(r, t.from, 0),
|
|
@@ -7594,7 +7593,7 @@ class oi {
|
|
|
7594
7593
|
throw new Error('Field "signer" not provided, OP_WALLET not detected.');
|
|
7595
7594
|
const e = this.parseOptionalInputs(t.optionalInputs), { finalTransaction: i, estimatedAmount: r } = await this.iterateFundingAmount(
|
|
7596
7595
|
{ ...t, optionalInputs: e },
|
|
7597
|
-
|
|
7596
|
+
Xt,
|
|
7598
7597
|
async (h) => {
|
|
7599
7598
|
const p = await h.estimateTransactionFees(), d = this.getPriorityFee(t), m = h.getOptionalOutputValue();
|
|
7600
7599
|
return p + d + m;
|
|
@@ -7625,7 +7624,7 @@ class oi {
|
|
|
7625
7624
|
estimatedFees: i.estimatedFees,
|
|
7626
7625
|
compiledTargetScript: i.exportCompiledTargetScript(),
|
|
7627
7626
|
optionalInputs: e
|
|
7628
|
-
}, l = await new
|
|
7627
|
+
}, l = await new Xt(c).signTransaction();
|
|
7629
7628
|
return [
|
|
7630
7629
|
a.tx.toHex(),
|
|
7631
7630
|
l.toHex(),
|
|
@@ -7654,7 +7653,7 @@ class oi {
|
|
|
7654
7653
|
return this.signP2WDAInteraction(t);
|
|
7655
7654
|
const r = this.parseOptionalInputs(t.optionalInputs), { finalTransaction: s, estimatedAmount: o, challenge: a } = await this.iterateFundingAmount(
|
|
7656
7655
|
{ ...t, optionalInputs: r },
|
|
7657
|
-
|
|
7656
|
+
Yt,
|
|
7658
7657
|
async (w) => {
|
|
7659
7658
|
const I = await w.estimateTransactionFees(), N = w.getTotalOutputValue();
|
|
7660
7659
|
return I + N;
|
|
@@ -7693,7 +7692,7 @@ class oi {
|
|
|
7693
7692
|
nonWitnessUtxo: l.tx.toBuffer(),
|
|
7694
7693
|
estimatedFees: s.estimatedFees,
|
|
7695
7694
|
optionalInputs: r
|
|
7696
|
-
}, d = new
|
|
7695
|
+
}, d = new Yt(p), m = await d.signTransaction();
|
|
7697
7696
|
return {
|
|
7698
7697
|
interactionAddress: s.getScriptAddress(),
|
|
7699
7698
|
fundingTransaction: l.tx.toHex(),
|
|
@@ -7707,7 +7706,7 @@ class oi {
|
|
|
7707
7706
|
challenge: a.toRaw(),
|
|
7708
7707
|
fundingUTXOs: h,
|
|
7709
7708
|
fundingInputUtxos: t.utxos,
|
|
7710
|
-
compiledTargetScript:
|
|
7709
|
+
compiledTargetScript: g(d.exportCompiledTargetScript())
|
|
7711
7710
|
};
|
|
7712
7711
|
}
|
|
7713
7712
|
/**
|
|
@@ -7737,7 +7736,7 @@ class oi {
|
|
|
7737
7736
|
throw new Error('Field "signer" not provided.');
|
|
7738
7737
|
if (!t.challenge)
|
|
7739
7738
|
throw new Error('Field "challenge" not provided.');
|
|
7740
|
-
const e = this.parseOptionalInputs(t.optionalInputs), i = new
|
|
7739
|
+
const e = this.parseOptionalInputs(t.optionalInputs), i = new si({
|
|
7741
7740
|
...t,
|
|
7742
7741
|
optionalInputs: e
|
|
7743
7742
|
}), r = await i.build();
|
|
@@ -7751,7 +7750,7 @@ class oi {
|
|
|
7751
7750
|
dataSize: r.setup.totalDataSize,
|
|
7752
7751
|
challenge: i.getChallenge().toRaw(),
|
|
7753
7752
|
inputUtxos: t.utxos,
|
|
7754
|
-
compiledTargetScript:
|
|
7753
|
+
compiledTargetScript: g(i.exportCompiledTargetScript())
|
|
7755
7754
|
};
|
|
7756
7755
|
}
|
|
7757
7756
|
/**
|
|
@@ -7767,10 +7766,10 @@ class oi {
|
|
|
7767
7766
|
throw new Error('Field "signer" not provided, OP_WALLET not detected.');
|
|
7768
7767
|
const i = this.parseOptionalInputs(t.optionalInputs), { finalTransaction: r, estimatedAmount: s, challenge: o } = await this.iterateFundingAmount(
|
|
7769
7768
|
{ ...t, optionalInputs: i },
|
|
7770
|
-
|
|
7771
|
-
async (
|
|
7772
|
-
const
|
|
7773
|
-
return
|
|
7769
|
+
wt,
|
|
7770
|
+
async (xt) => {
|
|
7771
|
+
const Rt = await xt.estimateTransactionFees(), Dt = this.getPriorityFee(t), Ai = xt.getOptionalOutputValue();
|
|
7772
|
+
return Rt + Dt + Ai;
|
|
7774
7773
|
},
|
|
7775
7774
|
"Deployment"
|
|
7776
7775
|
);
|
|
@@ -7786,7 +7785,7 @@ class oi {
|
|
|
7786
7785
|
if (!c)
|
|
7787
7786
|
throw new Error("Could not sign funding transaction.");
|
|
7788
7787
|
a.estimatedFees = c.estimatedFees;
|
|
7789
|
-
const l = await new
|
|
7788
|
+
const l = await new $t({
|
|
7790
7789
|
...a,
|
|
7791
7790
|
optionalInputs: [],
|
|
7792
7791
|
optionalOutputs: []
|
|
@@ -7797,7 +7796,7 @@ class oi {
|
|
|
7797
7796
|
transactionId: l.getId(),
|
|
7798
7797
|
outputIndex: 0,
|
|
7799
7798
|
scriptPubKey: {
|
|
7800
|
-
hex:
|
|
7799
|
+
hex: g(h.script),
|
|
7801
7800
|
address: r.getScriptAddress()
|
|
7802
7801
|
},
|
|
7803
7802
|
value: BigInt(h.value)
|
|
@@ -7810,11 +7809,11 @@ class oi {
|
|
|
7810
7809
|
nonWitnessUtxo: l.toBuffer(),
|
|
7811
7810
|
estimatedFees: r.estimatedFees,
|
|
7812
7811
|
optionalInputs: i
|
|
7813
|
-
}, m = new
|
|
7812
|
+
}, m = new wt(d), w = await m.signTransaction(), I = l.outs[1], N = {
|
|
7814
7813
|
transactionId: l.getId(),
|
|
7815
7814
|
outputIndex: 1,
|
|
7816
7815
|
scriptPubKey: {
|
|
7817
|
-
hex:
|
|
7816
|
+
hex: g(I.script),
|
|
7818
7817
|
address: t.from
|
|
7819
7818
|
},
|
|
7820
7819
|
value: BigInt(I.value)
|
|
@@ -7954,7 +7953,7 @@ class oi {
|
|
|
7954
7953
|
*/
|
|
7955
7954
|
async createFundTransaction(t) {
|
|
7956
7955
|
if (!t.to) throw new Error('Field "to" not provided.');
|
|
7957
|
-
const e = new
|
|
7956
|
+
const e = new $t(t), i = await e.signTransaction();
|
|
7958
7957
|
if (!i)
|
|
7959
7958
|
throw new Error("Could not sign funding transaction.");
|
|
7960
7959
|
return {
|
|
@@ -7976,7 +7975,7 @@ class oi {
|
|
|
7976
7975
|
* @returns {boolean} - true if any UTXO is P2WDA, false otherwise
|
|
7977
7976
|
*/
|
|
7978
7977
|
hasP2WDAInputs(t) {
|
|
7979
|
-
return t.some((e) =>
|
|
7978
|
+
return t.some((e) => j.isP2WDAUTXO(e));
|
|
7980
7979
|
}
|
|
7981
7980
|
/**
|
|
7982
7981
|
* Sign a P2WDA interaction transaction
|
|
@@ -8002,7 +8001,7 @@ class oi {
|
|
|
8002
8001
|
throw new Error(
|
|
8003
8002
|
"P2WDA interactions require a signer. OP_WALLET is not supported for P2WDA."
|
|
8004
8003
|
);
|
|
8005
|
-
const e = this.parseOptionalInputs(t.optionalInputs), i = new
|
|
8004
|
+
const e = this.parseOptionalInputs(t.optionalInputs), i = new tt({
|
|
8006
8005
|
...t,
|
|
8007
8006
|
optionalInputs: e
|
|
8008
8007
|
}), r = await i.signTransaction();
|
|
@@ -8044,17 +8043,17 @@ class oi {
|
|
|
8044
8043
|
* @returns {Promise<{finalTransaction: T extends InteractionTransaction | DeploymentTransaction | CustomScriptTransaction, estimatedAmount: bigint, challenge: IChallengeSolution | null}>} - The final transaction and estimated amount
|
|
8045
8044
|
*/
|
|
8046
8045
|
async iterateFundingAmount(t, e, i, r) {
|
|
8047
|
-
const s = "randomBytes" in t ? t.randomBytes ?? M.rndBytes() : M.rndBytes(), o =
|
|
8046
|
+
const s = "randomBytes" in t ? t.randomBytes ?? M.rndBytes() : M.rndBytes(), o = K.dead().p2tr(t.network);
|
|
8048
8047
|
let a = this.INITIAL_FUNDING_ESTIMATE, c = 0n, u = 0, l = null, h = null;
|
|
8049
8048
|
for (; u < this.MAX_ITERATIONS && a !== c; ) {
|
|
8050
8049
|
c = a;
|
|
8051
|
-
const p = new
|
|
8050
|
+
const p = new re();
|
|
8052
8051
|
p.addOutput(this.P2TR_SCRIPT, k(a));
|
|
8053
8052
|
const d = {
|
|
8054
|
-
transactionId:
|
|
8053
|
+
transactionId: g(new Uint8Array(32)),
|
|
8055
8054
|
outputIndex: 0,
|
|
8056
8055
|
scriptPubKey: {
|
|
8057
|
-
hex:
|
|
8056
|
+
hex: g(this.P2TR_SCRIPT),
|
|
8058
8057
|
address: o
|
|
8059
8058
|
},
|
|
8060
8059
|
value: a,
|
|
@@ -8112,7 +8111,7 @@ class oi {
|
|
|
8112
8111
|
transactionId: t.getId(),
|
|
8113
8112
|
outputIndex: i,
|
|
8114
8113
|
scriptPubKey: {
|
|
8115
|
-
hex:
|
|
8114
|
+
hex: g(r.script),
|
|
8116
8115
|
address: e
|
|
8117
8116
|
},
|
|
8118
8117
|
value: BigInt(r.value)
|
|
@@ -8164,7 +8163,7 @@ class L extends T {
|
|
|
8164
8163
|
gasSatFee: 0n
|
|
8165
8164
|
}), !t.pubkeys)
|
|
8166
8165
|
throw new Error("Pubkeys are required");
|
|
8167
|
-
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 =
|
|
8166
|
+
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 = kt.compile(
|
|
8168
8167
|
t.pubkeys,
|
|
8169
8168
|
this.minimumSignatures
|
|
8170
8169
|
), this.scriptTree = this.getScriptTree(), this.internalInit();
|
|
@@ -8175,7 +8174,7 @@ class L extends T {
|
|
|
8175
8174
|
* @returns {MultiSignTransaction} The multisig transaction
|
|
8176
8175
|
*/
|
|
8177
8176
|
static fromBase64(t) {
|
|
8178
|
-
const e =
|
|
8177
|
+
const e = V.fromBase64(t.psbt, { network: t.network });
|
|
8179
8178
|
return new L({
|
|
8180
8179
|
...t,
|
|
8181
8180
|
psbt: e
|
|
@@ -8184,7 +8183,7 @@ class L extends T {
|
|
|
8184
8183
|
/**
|
|
8185
8184
|
* Verify if that public key already signed the transaction
|
|
8186
8185
|
* @param {Psbt} psbt The psbt
|
|
8187
|
-
* @param {
|
|
8186
|
+
* @param {Uint8Array} signerPubKey The signer public key
|
|
8188
8187
|
* @returns {boolean} True if the public key signed the transaction
|
|
8189
8188
|
*/
|
|
8190
8189
|
static verifyIfSigned(t, e) {
|
|
@@ -8258,8 +8257,8 @@ class L extends T {
|
|
|
8258
8257
|
* Partially finalize a P2TR MS transaction
|
|
8259
8258
|
* @param {number} inputIndex The input index
|
|
8260
8259
|
* @param {PsbtInput} input The input
|
|
8261
|
-
* @param {
|
|
8262
|
-
* @param {
|
|
8260
|
+
* @param {Uint8Array[]} partialSignatures The partial signatures
|
|
8261
|
+
* @param {Uint8Array[]} orderedPubKeys The ordered public keys
|
|
8263
8262
|
* @param {boolean} isFinal If the transaction is final
|
|
8264
8263
|
*/
|
|
8265
8264
|
static partialFinalizer = (t, e, i, r, s) => {
|
|
@@ -8294,16 +8293,16 @@ class L extends T {
|
|
|
8294
8293
|
static dedupeSignatures(t, e) {
|
|
8295
8294
|
const i = /* @__PURE__ */ new Map();
|
|
8296
8295
|
for (const r of t)
|
|
8297
|
-
i.set(
|
|
8296
|
+
i.set(g(r.pubkey), r);
|
|
8298
8297
|
for (const r of e)
|
|
8299
|
-
i.has(
|
|
8298
|
+
i.has(g(r.pubkey)) || i.set(g(r.pubkey), r);
|
|
8300
8299
|
return Array.from(i.values());
|
|
8301
8300
|
}
|
|
8302
8301
|
/**
|
|
8303
8302
|
* Attempt to finalize the inputs
|
|
8304
8303
|
* @param {Psbt} psbt The psbt
|
|
8305
8304
|
* @param {number} startIndex The start index
|
|
8306
|
-
* @param {
|
|
8305
|
+
* @param {Uint8Array[]} orderedPubKeys The ordered public keys
|
|
8307
8306
|
* @param {boolean} isFinal If the transaction is final
|
|
8308
8307
|
* @returns {boolean} True if the inputs were finalized
|
|
8309
8308
|
*/
|
|
@@ -8443,7 +8442,7 @@ class L extends T {
|
|
|
8443
8442
|
//this.internalPubKeyToXOnly(),
|
|
8444
8443
|
network: this.network,
|
|
8445
8444
|
scriptTree: this.scriptTree,
|
|
8446
|
-
name:
|
|
8445
|
+
name: x.P2TR
|
|
8447
8446
|
};
|
|
8448
8447
|
}
|
|
8449
8448
|
generateTapData() {
|
|
@@ -8458,7 +8457,7 @@ class L extends T {
|
|
|
8458
8457
|
network: this.network,
|
|
8459
8458
|
scriptTree: this.scriptTree,
|
|
8460
8459
|
redeem: t,
|
|
8461
|
-
name:
|
|
8460
|
+
name: x.P2TR
|
|
8462
8461
|
};
|
|
8463
8462
|
}
|
|
8464
8463
|
/**
|
|
@@ -8466,7 +8465,7 @@ class L extends T {
|
|
|
8466
8465
|
* @param {PsbtInput} input The input
|
|
8467
8466
|
* @protected
|
|
8468
8467
|
*
|
|
8469
|
-
* @returns {
|
|
8468
|
+
* @returns {Uint8Array[]} The script solution
|
|
8470
8469
|
*/
|
|
8471
8470
|
getScriptSolution(t) {
|
|
8472
8471
|
return t.tapScriptSig ? t.tapScriptSig.map((e) => e.signature) : [];
|
|
@@ -8528,33 +8527,33 @@ class L extends T {
|
|
|
8528
8527
|
*/
|
|
8529
8528
|
generateRedeemScripts() {
|
|
8530
8529
|
this.targetScriptRedeem = {
|
|
8531
|
-
name:
|
|
8530
|
+
name: x.P2TR,
|
|
8532
8531
|
output: this.compiledTargetScript,
|
|
8533
8532
|
redeemVersion: 192
|
|
8534
8533
|
}, this.leftOverFundsScriptRedeem = {
|
|
8535
|
-
name:
|
|
8534
|
+
name: x.P2TR,
|
|
8536
8535
|
output: L.LOCK_LEAF_SCRIPT,
|
|
8537
8536
|
redeemVersion: 192
|
|
8538
8537
|
};
|
|
8539
8538
|
}
|
|
8540
8539
|
}
|
|
8541
|
-
const
|
|
8542
|
-
function
|
|
8540
|
+
const Ie = 1, Mt = 66;
|
|
8541
|
+
function oi(n) {
|
|
8543
8542
|
return n.type === b.FUNDING;
|
|
8544
8543
|
}
|
|
8545
|
-
function
|
|
8544
|
+
function ai(n) {
|
|
8546
8545
|
return n.type === b.DEPLOYMENT;
|
|
8547
8546
|
}
|
|
8548
|
-
function
|
|
8547
|
+
function ci(n) {
|
|
8549
8548
|
return n.type === b.INTERACTION;
|
|
8550
8549
|
}
|
|
8551
|
-
function
|
|
8550
|
+
function st(n) {
|
|
8552
8551
|
return n.type === b.MULTI_SIG;
|
|
8553
8552
|
}
|
|
8554
|
-
function
|
|
8553
|
+
function ui(n) {
|
|
8555
8554
|
return n.type === b.CUSTOM_CODE;
|
|
8556
8555
|
}
|
|
8557
|
-
function
|
|
8556
|
+
function li(n) {
|
|
8558
8557
|
return n.type === b.CANCEL;
|
|
8559
8558
|
}
|
|
8560
8559
|
class B {
|
|
@@ -8581,8 +8580,8 @@ class B {
|
|
|
8581
8580
|
const e = t.subarray(-32), i = t.subarray(0, -32), r = this.calculateChecksum(i);
|
|
8582
8581
|
if (!this.bytesEqual(e, r))
|
|
8583
8582
|
throw new Error("Invalid checksum - data may be corrupted");
|
|
8584
|
-
const s = new
|
|
8585
|
-
if (o.formatVersion >
|
|
8583
|
+
const s = new Zt(i), o = this.readHeader(s);
|
|
8584
|
+
if (o.formatVersion > Ie)
|
|
8586
8585
|
throw new Error(`Unsupported format version: ${o.formatVersion}`);
|
|
8587
8586
|
const a = this.readBaseParams(s), c = this.readUTXOArray(s), u = this.readUTXOArray(s), l = this.readOutputArray(s), h = s.readBoolean(), p = this.readSignerMappings(s), d = this.readTypeSpecificData(s, o.transactionType), m = this.readPrecomputedData(s);
|
|
8588
8587
|
return {
|
|
@@ -8620,7 +8619,7 @@ class B {
|
|
|
8620
8619
|
* @returns Hex-encoded string
|
|
8621
8620
|
*/
|
|
8622
8621
|
static toHex(t) {
|
|
8623
|
-
return
|
|
8622
|
+
return g(this.serialize(t));
|
|
8624
8623
|
}
|
|
8625
8624
|
/**
|
|
8626
8625
|
* Import state from hex string
|
|
@@ -8631,13 +8630,13 @@ class B {
|
|
|
8631
8630
|
return this.deserialize(y(t));
|
|
8632
8631
|
}
|
|
8633
8632
|
static writeHeader(t, e) {
|
|
8634
|
-
t.writeU8(
|
|
8633
|
+
t.writeU8(Mt), t.writeU8(e.formatVersion), t.writeU8(e.consensusVersion), t.writeU8(e.transactionType), t.writeU32(e.chainId), t.writeU64(BigInt(e.timestamp));
|
|
8635
8634
|
}
|
|
8636
8635
|
static readHeader(t) {
|
|
8637
8636
|
const e = t.readU8();
|
|
8638
|
-
if (e !==
|
|
8637
|
+
if (e !== Mt)
|
|
8639
8638
|
throw new Error(
|
|
8640
|
-
`Invalid magic byte: expected 0x${
|
|
8639
|
+
`Invalid magic byte: expected 0x${Mt.toString(16)}, got 0x${e.toString(16)}`
|
|
8641
8640
|
);
|
|
8642
8641
|
return {
|
|
8643
8642
|
formatVersion: t.readU8(),
|
|
@@ -8651,7 +8650,7 @@ class B {
|
|
|
8651
8650
|
t.writeStringWithLength(e.from), t.writeBoolean(e.to !== void 0), e.to !== void 0 && t.writeStringWithLength(e.to), t.writeU32(Math.floor(e.feeRate * 1e3)), t.writeU64(BigInt(e.priorityFee)), t.writeU64(BigInt(e.gasSatFee)), t.writeU8(this.networkNameToU8(e.networkName)), t.writeU8(e.txVersion), t.writeBoolean(e.note !== void 0), e.note !== void 0 && t.writeBytesWithLength(y(e.note)), t.writeBoolean(e.anchor), t.writeBoolean(e.debugFees ?? !1);
|
|
8652
8651
|
}
|
|
8653
8652
|
static readBaseParams(t) {
|
|
8654
|
-
const e = t.readStringWithLength(), r = t.readBoolean() ? t.readStringWithLength() : void 0, s = t.readU32() / 1e3, o = t.readU64().toString(), a = t.readU64().toString(), c = this.u8ToNetworkName(t.readU8()), u = t.readU8(), h = t.readBoolean() ?
|
|
8653
|
+
const e = t.readStringWithLength(), r = t.readBoolean() ? t.readStringWithLength() : void 0, s = t.readU32() / 1e3, o = t.readU64().toString(), a = t.readU64().toString(), c = this.u8ToNetworkName(t.readU8()), u = t.readU8(), h = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, p = t.readBoolean(), d = t.readBoolean();
|
|
8655
8654
|
return {
|
|
8656
8655
|
from: e,
|
|
8657
8656
|
feeRate: s,
|
|
@@ -8680,7 +8679,7 @@ class B {
|
|
|
8680
8679
|
return i;
|
|
8681
8680
|
}
|
|
8682
8681
|
static readUTXO(t) {
|
|
8683
|
-
const e =
|
|
8682
|
+
const e = g(t.readBytes(32)), i = t.readU32(), r = t.readU64().toString(), s = g(t.readBytesWithLength()), a = t.readBoolean() ? t.readStringWithLength() : void 0, u = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, h = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, d = t.readBoolean() ? g(t.readBytesWithLength()) : void 0;
|
|
8684
8683
|
return {
|
|
8685
8684
|
transactionId: e,
|
|
8686
8685
|
outputIndex: i,
|
|
@@ -8707,7 +8706,7 @@ class B {
|
|
|
8707
8706
|
return i;
|
|
8708
8707
|
}
|
|
8709
8708
|
static readOutput(t) {
|
|
8710
|
-
const e = Number(t.readU64()), r = t.readBoolean() ? t.readStringWithLength() : void 0, o = t.readBoolean() ?
|
|
8709
|
+
const e = Number(t.readU64()), r = t.readBoolean() ? t.readStringWithLength() : void 0, o = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, c = t.readBoolean() ? g(t.readBytesWithLength()) : void 0;
|
|
8711
8710
|
return {
|
|
8712
8711
|
value: e,
|
|
8713
8712
|
...r !== void 0 ? { address: r } : {},
|
|
@@ -8791,7 +8790,7 @@ class B {
|
|
|
8791
8790
|
t.writeBytesWithLength(y(e.bytecode)), t.writeBoolean(e.calldata !== void 0), e.calldata !== void 0 && t.writeBytesWithLength(y(e.calldata)), this.writeChallenge(t, e.challenge), t.writeBoolean(e.revealMLDSAPublicKey ?? !1), t.writeBoolean(e.linkMLDSAPublicKeyToAddress ?? !1), t.writeBoolean(e.hashedPublicKey !== void 0), e.hashedPublicKey !== void 0 && t.writeBytesWithLength(y(e.hashedPublicKey));
|
|
8792
8791
|
}
|
|
8793
8792
|
static readDeploymentData(t) {
|
|
8794
|
-
const e =
|
|
8793
|
+
const e = g(t.readBytesWithLength()), r = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, s = this.readChallenge(t), o = t.readBoolean(), a = t.readBoolean(), u = t.readBoolean() ? g(t.readBytesWithLength()) : void 0;
|
|
8795
8794
|
return {
|
|
8796
8795
|
type: b.DEPLOYMENT,
|
|
8797
8796
|
bytecode: e,
|
|
@@ -8807,7 +8806,7 @@ class B {
|
|
|
8807
8806
|
t.writeBytesWithLength(y(e.calldata)), t.writeBoolean(e.contract !== void 0), e.contract !== void 0 && t.writeStringWithLength(e.contract), this.writeChallenge(t, e.challenge), t.writeBoolean(e.loadedStorage !== void 0), e.loadedStorage !== void 0 && this.writeLoadedStorage(t, e.loadedStorage), t.writeBoolean(e.isCancellation ?? !1), t.writeBoolean(e.disableAutoRefund ?? !1), t.writeBoolean(e.revealMLDSAPublicKey ?? !1), t.writeBoolean(e.linkMLDSAPublicKeyToAddress ?? !1), t.writeBoolean(e.hashedPublicKey !== void 0), e.hashedPublicKey !== void 0 && t.writeBytesWithLength(y(e.hashedPublicKey));
|
|
8808
8807
|
}
|
|
8809
8808
|
static readInteractionData(t) {
|
|
8810
|
-
const e =
|
|
8809
|
+
const e = g(t.readBytesWithLength()), r = t.readBoolean() ? t.readStringWithLength() : void 0, s = this.readChallenge(t), a = t.readBoolean() ? this.readLoadedStorage(t) : void 0, c = t.readBoolean(), u = t.readBoolean(), l = t.readBoolean(), h = t.readBoolean(), d = t.readBoolean() ? g(t.readBytesWithLength()) : void 0;
|
|
8811
8810
|
return {
|
|
8812
8811
|
type: b.INTERACTION,
|
|
8813
8812
|
calldata: e,
|
|
@@ -8831,7 +8830,7 @@ class B {
|
|
|
8831
8830
|
static readMultiSigData(t) {
|
|
8832
8831
|
const e = t.readU16(), i = [];
|
|
8833
8832
|
for (let h = 0; h < e; h++)
|
|
8834
|
-
i.push(
|
|
8833
|
+
i.push(g(t.readBytesWithLength()));
|
|
8835
8834
|
const r = t.readU8(), s = t.readStringWithLength(), o = t.readU64().toString(), a = t.readStringWithLength(), c = t.readU16(), l = t.readBoolean() ? t.readStringWithLength() : void 0;
|
|
8836
8835
|
return {
|
|
8837
8836
|
type: b.MULTI_SIG,
|
|
@@ -8863,8 +8862,8 @@ class B {
|
|
|
8863
8862
|
i.push(this.readScriptElement(t));
|
|
8864
8863
|
const r = t.readU16(), s = [];
|
|
8865
8864
|
for (let c = 0; c < r; c++)
|
|
8866
|
-
s.push(
|
|
8867
|
-
const a = t.readBoolean() ?
|
|
8865
|
+
s.push(g(t.readBytesWithLength()));
|
|
8866
|
+
const a = t.readBoolean() ? g(t.readBytesWithLength()) : void 0;
|
|
8868
8867
|
return {
|
|
8869
8868
|
type: b.CUSTOM_CODE,
|
|
8870
8869
|
scriptElements: i,
|
|
@@ -8875,7 +8874,7 @@ class B {
|
|
|
8875
8874
|
static readScriptElement(t) {
|
|
8876
8875
|
return t.readU8() === 0 ? {
|
|
8877
8876
|
elementType: "buffer",
|
|
8878
|
-
value:
|
|
8877
|
+
value: g(t.readBytesWithLength())
|
|
8879
8878
|
} : {
|
|
8880
8879
|
elementType: "opcode",
|
|
8881
8880
|
value: t.readU32()
|
|
@@ -8888,7 +8887,7 @@ class B {
|
|
|
8888
8887
|
static readCancelData(t) {
|
|
8889
8888
|
return {
|
|
8890
8889
|
type: b.CANCEL,
|
|
8891
|
-
compiledTargetScript:
|
|
8890
|
+
compiledTargetScript: g(t.readBytesWithLength())
|
|
8892
8891
|
};
|
|
8893
8892
|
}
|
|
8894
8893
|
static writeChallenge(t, e) {
|
|
@@ -8902,10 +8901,10 @@ class B {
|
|
|
8902
8901
|
t.writeBytesWithLength(y(i.replace("0x", "")));
|
|
8903
8902
|
}
|
|
8904
8903
|
static readChallenge(t) {
|
|
8905
|
-
const e = t.readU64().toString(), i = t.readStringWithLength(), r = t.readStringWithLength(), s = "0x" +
|
|
8904
|
+
const e = t.readU64().toString(), i = t.readStringWithLength(), r = t.readStringWithLength(), s = "0x" + g(t.readBytesWithLength()), o = "0x" + g(t.readBytesWithLength()), a = "0x" + g(t.readBytesWithLength()), c = t.readU8(), u = this.readChallengeVerification(t), l = t.readBoolean();
|
|
8906
8905
|
let h;
|
|
8907
8906
|
if (l) {
|
|
8908
|
-
const p = t.readStringWithLength(), d = t.readStringWithLength(), m = "0x" +
|
|
8907
|
+
const p = t.readStringWithLength(), d = t.readStringWithLength(), m = "0x" + g(t.readBytesWithLength()), I = t.readBoolean() ? "0x" + g(t.readBytesWithLength()) : void 0, N = "0x" + g(t.readBytesWithLength());
|
|
8909
8908
|
h = {
|
|
8910
8909
|
mldsaPublicKey: p,
|
|
8911
8910
|
legacyPublicKey: d,
|
|
@@ -8927,9 +8926,9 @@ class B {
|
|
|
8927
8926
|
};
|
|
8928
8927
|
}
|
|
8929
8928
|
static readChallengeVerification(t) {
|
|
8930
|
-
const e = "0x" +
|
|
8929
|
+
const e = "0x" + g(t.readBytesWithLength()), i = "0x" + g(t.readBytesWithLength()), r = "0x" + g(t.readBytesWithLength()), s = "0x" + g(t.readBytesWithLength()), o = t.readU64().toString(), a = t.readU64().toString(), c = t.readU16(), u = [];
|
|
8931
8930
|
for (let l = 0; l < c; l++)
|
|
8932
|
-
u.push("0x" +
|
|
8931
|
+
u.push("0x" + g(t.readBytesWithLength()));
|
|
8933
8932
|
return {
|
|
8934
8933
|
epochHash: e,
|
|
8935
8934
|
epochRoot: i,
|
|
@@ -8958,7 +8957,7 @@ class B {
|
|
|
8958
8957
|
t.writeBoolean(e.compiledTargetScript !== void 0), e.compiledTargetScript !== void 0 && t.writeBytesWithLength(y(e.compiledTargetScript)), t.writeBoolean(e.randomBytes !== void 0), e.randomBytes !== void 0 && t.writeBytesWithLength(y(e.randomBytes)), t.writeBoolean(e.estimatedFees !== void 0), e.estimatedFees !== void 0 && t.writeU64(BigInt(e.estimatedFees)), t.writeBoolean(e.contractSeed !== void 0), e.contractSeed !== void 0 && t.writeStringWithLength(e.contractSeed), t.writeBoolean(e.contractAddress !== void 0), e.contractAddress !== void 0 && t.writeStringWithLength(e.contractAddress);
|
|
8959
8958
|
}
|
|
8960
8959
|
static readPrecomputedData(t) {
|
|
8961
|
-
const i = t.readBoolean() ?
|
|
8960
|
+
const i = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, s = t.readBoolean() ? g(t.readBytesWithLength()) : void 0, a = t.readBoolean() ? t.readU64().toString() : void 0, u = t.readBoolean() ? t.readStringWithLength() : void 0, h = t.readBoolean() ? t.readStringWithLength() : void 0;
|
|
8962
8961
|
return {
|
|
8963
8962
|
...i !== void 0 ? { compiledTargetScript: i } : {},
|
|
8964
8963
|
...s !== void 0 ? { randomBytes: s } : {},
|
|
@@ -8971,8 +8970,8 @@ class B {
|
|
|
8971
8970
|
* Calculate double SHA256 checksum (Bitcoin standard)
|
|
8972
8971
|
*/
|
|
8973
8972
|
static calculateChecksum(t) {
|
|
8974
|
-
const e =
|
|
8975
|
-
return new Uint8Array(
|
|
8973
|
+
const e = se("sha256").update(t).digest();
|
|
8974
|
+
return new Uint8Array(se("sha256").update(e).digest());
|
|
8976
8975
|
}
|
|
8977
8976
|
/**
|
|
8978
8977
|
* Compare two Uint8Arrays for equality
|
|
@@ -9027,15 +9026,15 @@ class B {
|
|
|
9027
9026
|
}
|
|
9028
9027
|
}
|
|
9029
9028
|
var Kt = /* @__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))(Kt || {});
|
|
9030
|
-
const
|
|
9029
|
+
const hi = {
|
|
9031
9030
|
CONSENSUS: Kt.Roswell,
|
|
9032
9031
|
CONSENSUS_NAME: "Roswell",
|
|
9033
9032
|
// The block height at which this consensus was enabled.
|
|
9034
9033
|
ENABLED_AT_BLOCK: 0n
|
|
9035
|
-
},
|
|
9036
|
-
[Kt.Roswell]:
|
|
9037
|
-
},
|
|
9038
|
-
class
|
|
9034
|
+
}, di = {
|
|
9035
|
+
[Kt.Roswell]: hi
|
|
9036
|
+
}, Ee = Kt.Roswell, Ir = di[Ee];
|
|
9037
|
+
class Z {
|
|
9039
9038
|
/**
|
|
9040
9039
|
* Capture state from a FundingTransaction
|
|
9041
9040
|
*/
|
|
@@ -9118,8 +9117,8 @@ class J {
|
|
|
9118
9117
|
*/
|
|
9119
9118
|
static createHeader(t, e, i) {
|
|
9120
9119
|
return {
|
|
9121
|
-
formatVersion:
|
|
9122
|
-
consensusVersion:
|
|
9120
|
+
formatVersion: Ie,
|
|
9121
|
+
consensusVersion: Ee,
|
|
9123
9122
|
transactionType: t,
|
|
9124
9123
|
chainId: i ?? this.networkToChainId(e),
|
|
9125
9124
|
timestamp: Date.now()
|
|
@@ -9129,7 +9128,7 @@ class J {
|
|
|
9129
9128
|
* Extract base parameters common to all transaction types
|
|
9130
9129
|
*/
|
|
9131
9130
|
static extractBaseParams(t) {
|
|
9132
|
-
const e = t.note ? t.note instanceof Uint8Array ?
|
|
9131
|
+
const e = t.note ? t.note instanceof Uint8Array ? g(t.note) : g(new TextEncoder().encode(t.note)) : void 0, i = t.priorityFee ?? 0n, r = t.gasSatFee ?? 0n;
|
|
9133
9132
|
return {
|
|
9134
9133
|
from: t.from || "",
|
|
9135
9134
|
feeRate: t.feeRate,
|
|
@@ -9199,9 +9198,9 @@ class J {
|
|
|
9199
9198
|
static extractDeploymentData(t) {
|
|
9200
9199
|
return {
|
|
9201
9200
|
type: b.DEPLOYMENT,
|
|
9202
|
-
bytecode:
|
|
9201
|
+
bytecode: g(t.bytecode),
|
|
9203
9202
|
challenge: t.challenge.toRaw(),
|
|
9204
|
-
...t.calldata ? { calldata:
|
|
9203
|
+
...t.calldata ? { calldata: g(t.calldata) } : {},
|
|
9205
9204
|
...t.revealMLDSAPublicKey !== void 0 ? { revealMLDSAPublicKey: t.revealMLDSAPublicKey } : {},
|
|
9206
9205
|
...t.linkMLDSAPublicKeyToAddress !== void 0 ? { linkMLDSAPublicKeyToAddress: t.linkMLDSAPublicKeyToAddress } : {}
|
|
9207
9206
|
};
|
|
@@ -9209,7 +9208,7 @@ class J {
|
|
|
9209
9208
|
static extractInteractionData(t) {
|
|
9210
9209
|
return {
|
|
9211
9210
|
type: b.INTERACTION,
|
|
9212
|
-
calldata:
|
|
9211
|
+
calldata: g(t.calldata),
|
|
9213
9212
|
challenge: t.challenge.toRaw(),
|
|
9214
9213
|
...t.contract !== void 0 ? { contract: t.contract } : {},
|
|
9215
9214
|
...t.loadedStorage !== void 0 ? { loadedStorage: t.loadedStorage } : {},
|
|
@@ -9222,7 +9221,7 @@ class J {
|
|
|
9222
9221
|
static extractMultiSigData(t) {
|
|
9223
9222
|
return {
|
|
9224
9223
|
type: b.MULTI_SIG,
|
|
9225
|
-
pubkeys: (t.pubkeys || []).map((e) =>
|
|
9224
|
+
pubkeys: (t.pubkeys || []).map((e) => g(e)),
|
|
9226
9225
|
minimumSignatures: t.minimumSignatures || 0,
|
|
9227
9226
|
receiver: t.receiver || "",
|
|
9228
9227
|
requestedAmount: (t.requestedAmount || 0n).toString(),
|
|
@@ -9235,7 +9234,7 @@ class J {
|
|
|
9235
9234
|
const e = (t.scriptElements || []).map(
|
|
9236
9235
|
(i) => i instanceof Uint8Array ? {
|
|
9237
9236
|
elementType: "buffer",
|
|
9238
|
-
value:
|
|
9237
|
+
value: g(i)
|
|
9239
9238
|
} : {
|
|
9240
9239
|
elementType: "opcode",
|
|
9241
9240
|
value: i
|
|
@@ -9244,12 +9243,12 @@ class J {
|
|
|
9244
9243
|
return {
|
|
9245
9244
|
type: b.CUSTOM_CODE,
|
|
9246
9245
|
scriptElements: e,
|
|
9247
|
-
witnesses: (t.witnesses || []).map((i) =>
|
|
9248
|
-
...t.annex ? { annex:
|
|
9246
|
+
witnesses: (t.witnesses || []).map((i) => g(i)),
|
|
9247
|
+
...t.annex ? { annex: g(t.annex) } : {}
|
|
9249
9248
|
};
|
|
9250
9249
|
}
|
|
9251
9250
|
static extractCancelData(t) {
|
|
9252
|
-
const e = t.compiledTargetScript, i = e ? e instanceof Uint8Array ?
|
|
9251
|
+
const e = t.compiledTargetScript, i = e ? e instanceof Uint8Array ? g(e) : e : "";
|
|
9253
9252
|
return {
|
|
9254
9253
|
type: b.CANCEL,
|
|
9255
9254
|
compiledTargetScript: i
|
|
@@ -9272,7 +9271,7 @@ class J {
|
|
|
9272
9271
|
*/
|
|
9273
9272
|
static serializeUTXOs(t) {
|
|
9274
9273
|
return t.map((e) => {
|
|
9275
|
-
const i = e.redeemScript ? e.redeemScript instanceof Uint8Array ?
|
|
9274
|
+
const i = e.redeemScript ? e.redeemScript instanceof Uint8Array ? g(e.redeemScript) : e.redeemScript : void 0, r = e.witnessScript ? e.witnessScript instanceof Uint8Array ? g(e.witnessScript) : e.witnessScript : void 0, s = e.nonWitnessUtxo ? e.nonWitnessUtxo instanceof Uint8Array ? g(e.nonWitnessUtxo) : e.nonWitnessUtxo : void 0;
|
|
9276
9275
|
return {
|
|
9277
9276
|
transactionId: e.transactionId,
|
|
9278
9277
|
outputIndex: e.outputIndex,
|
|
@@ -9290,7 +9289,7 @@ class J {
|
|
|
9290
9289
|
*/
|
|
9291
9290
|
static serializeOutputs(t) {
|
|
9292
9291
|
return t.map((e) => {
|
|
9293
|
-
const i = "address" in e ? e.address : void 0, r = "script" in e ? e.script : void 0, s = r ?
|
|
9292
|
+
const i = "address" in e ? e.address : void 0, r = "script" in e ? e.script : void 0, s = r ? g(r) : void 0, o = e.tapInternalKey ? g(e.tapInternalKey) : void 0;
|
|
9294
9293
|
return {
|
|
9295
9294
|
value: Number(e.value),
|
|
9296
9295
|
...i !== void 0 ? { address: i } : {},
|
|
@@ -9309,13 +9308,13 @@ class J {
|
|
|
9309
9308
|
* Convert network to chain ID
|
|
9310
9309
|
*/
|
|
9311
9310
|
static networkToChainId(t) {
|
|
9312
|
-
return
|
|
9311
|
+
return Se.Bitcoin;
|
|
9313
9312
|
}
|
|
9314
9313
|
}
|
|
9315
9314
|
function F(n) {
|
|
9316
|
-
return
|
|
9315
|
+
return y(n.replace("0x", ""));
|
|
9317
9316
|
}
|
|
9318
|
-
class
|
|
9317
|
+
class dt {
|
|
9319
9318
|
static BLOCKS_PER_EPOCH = 5n;
|
|
9320
9319
|
/**
|
|
9321
9320
|
* Calculate SHA-1 hash
|
|
@@ -9384,7 +9383,7 @@ class pt {
|
|
|
9384
9383
|
*/
|
|
9385
9384
|
static validateEpochWinner(t) {
|
|
9386
9385
|
try {
|
|
9387
|
-
const e = BigInt(t.epochNumber), i =
|
|
9386
|
+
const e = BigInt(t.epochNumber), i = K.fromString(
|
|
9388
9387
|
t.mldsaPublicKey,
|
|
9389
9388
|
t.legacyPublicKey
|
|
9390
9389
|
), r = F(t.solution), s = F(t.salt), o = t.difficulty, a = {
|
|
@@ -9436,7 +9435,7 @@ class pt {
|
|
|
9436
9435
|
};
|
|
9437
9436
|
}
|
|
9438
9437
|
}
|
|
9439
|
-
class
|
|
9438
|
+
class pi {
|
|
9440
9439
|
epochHash;
|
|
9441
9440
|
epochRoot;
|
|
9442
9441
|
targetHash;
|
|
@@ -9448,9 +9447,9 @@ class fi {
|
|
|
9448
9447
|
this.epochHash = F(t.epochHash), this.epochRoot = F(t.epochRoot), this.targetHash = F(t.targetHash), this.targetChecksum = F(t.targetChecksum), this.startBlock = BigInt(t.startBlock), this.endBlock = BigInt(t.endBlock), this.proofs = Object.freeze(t.proofs.map((e) => F(e)));
|
|
9449
9448
|
}
|
|
9450
9449
|
}
|
|
9451
|
-
class
|
|
9450
|
+
class fi {
|
|
9452
9451
|
constructor(t, e) {
|
|
9453
|
-
this.epochNumber = e, this.publicKey =
|
|
9452
|
+
this.epochNumber = e, this.publicKey = K.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = F(t.solution), this.graffiti = t.graffiti ? F(t.graffiti) : void 0, this.signature = F(t.signature);
|
|
9454
9453
|
}
|
|
9455
9454
|
publicKey;
|
|
9456
9455
|
solution;
|
|
@@ -9460,14 +9459,14 @@ class gi {
|
|
|
9460
9459
|
const t = new H();
|
|
9461
9460
|
t.writeAddress(this.publicKey), t.writeU64(this.epochNumber), t.writeBytes(this.solution), this.graffiti && t.writeBytes(this.graffiti);
|
|
9462
9461
|
const e = t.getBuffer();
|
|
9463
|
-
return
|
|
9462
|
+
return ot.verifySignature(
|
|
9464
9463
|
this.publicKey.tweakedPublicKeyToBuffer(),
|
|
9465
9464
|
e,
|
|
9466
9465
|
this.signature
|
|
9467
9466
|
);
|
|
9468
9467
|
}
|
|
9469
9468
|
}
|
|
9470
|
-
class
|
|
9469
|
+
class ue {
|
|
9471
9470
|
epochNumber;
|
|
9472
9471
|
publicKey;
|
|
9473
9472
|
solution;
|
|
@@ -9477,13 +9476,13 @@ class le {
|
|
|
9477
9476
|
verification;
|
|
9478
9477
|
submission;
|
|
9479
9478
|
constructor(t) {
|
|
9480
|
-
this.epochNumber = BigInt(t.epochNumber), this.publicKey =
|
|
9479
|
+
this.epochNumber = BigInt(t.epochNumber), this.publicKey = K.fromString(t.mldsaPublicKey, t.legacyPublicKey), this.solution = F(t.solution), this.salt = F(t.salt), this.graffiti = F(t.graffiti), this.difficulty = t.difficulty, this.verification = new pi(t.verification), this.submission = t.submission ? new fi(t.submission, this.epochNumber + 2n) : t.submission;
|
|
9481
9480
|
}
|
|
9482
9481
|
/**
|
|
9483
9482
|
* Static method to validate from raw data directly
|
|
9484
9483
|
*/
|
|
9485
9484
|
static validateRaw(t) {
|
|
9486
|
-
return
|
|
9485
|
+
return dt.validateEpochWinner(t);
|
|
9487
9486
|
}
|
|
9488
9487
|
verifySubmissionSignature() {
|
|
9489
9488
|
if (!this.submission)
|
|
@@ -9502,11 +9501,11 @@ class le {
|
|
|
9502
9501
|
* @returns {boolean} True if the challenge is valid
|
|
9503
9502
|
*/
|
|
9504
9503
|
verify() {
|
|
9505
|
-
return
|
|
9504
|
+
return dt.validateChallengeSolution(this);
|
|
9506
9505
|
}
|
|
9507
9506
|
/**
|
|
9508
9507
|
* Get the preimage challenge
|
|
9509
|
-
* @returns {
|
|
9508
|
+
* @returns {Uint8Array} The solution/challenge as a Uint8Array
|
|
9510
9509
|
*/
|
|
9511
9510
|
toBuffer() {
|
|
9512
9511
|
return this.solution;
|
|
@@ -9516,7 +9515,7 @@ class le {
|
|
|
9516
9515
|
* @returns {string} The solution as a hex string with 0x prefix
|
|
9517
9516
|
*/
|
|
9518
9517
|
toHex() {
|
|
9519
|
-
return "0x" + this.solution
|
|
9518
|
+
return "0x" + g(this.solution);
|
|
9520
9519
|
}
|
|
9521
9520
|
/**
|
|
9522
9521
|
* Convert to raw format for serialization
|
|
@@ -9527,26 +9526,26 @@ class le {
|
|
|
9527
9526
|
mldsaPublicKey: this.publicKey.toHex(),
|
|
9528
9527
|
legacyPublicKey: this.publicKey.tweakedToHex(),
|
|
9529
9528
|
solution: this.toHex(),
|
|
9530
|
-
salt: "0x" + this.salt
|
|
9531
|
-
graffiti: "0x" + this.graffiti
|
|
9529
|
+
salt: "0x" + g(this.salt),
|
|
9530
|
+
graffiti: "0x" + g(this.graffiti),
|
|
9532
9531
|
difficulty: this.difficulty,
|
|
9533
9532
|
verification: {
|
|
9534
|
-
epochHash: "0x" + this.verification.epochHash
|
|
9535
|
-
epochRoot: "0x" + this.verification.epochRoot
|
|
9536
|
-
targetHash: "0x" + this.verification.targetHash
|
|
9537
|
-
targetChecksum: "0x" + this.verification.targetChecksum
|
|
9533
|
+
epochHash: "0x" + g(this.verification.epochHash),
|
|
9534
|
+
epochRoot: "0x" + g(this.verification.epochRoot),
|
|
9535
|
+
targetHash: "0x" + g(this.verification.targetHash),
|
|
9536
|
+
targetChecksum: "0x" + g(this.verification.targetChecksum),
|
|
9538
9537
|
startBlock: this.verification.startBlock.toString(),
|
|
9539
9538
|
endBlock: this.verification.endBlock.toString(),
|
|
9540
|
-
proofs: this.verification.proofs.map((t) => "0x" + t
|
|
9539
|
+
proofs: this.verification.proofs.map((t) => "0x" + g(t))
|
|
9541
9540
|
}
|
|
9542
9541
|
};
|
|
9543
9542
|
}
|
|
9544
9543
|
/**
|
|
9545
9544
|
* Calculate the expected solution hash for this challenge
|
|
9546
|
-
* @returns {
|
|
9545
|
+
* @returns {Uint8Array} The calculated solution hash
|
|
9547
9546
|
*/
|
|
9548
9547
|
calculateSolution() {
|
|
9549
|
-
return
|
|
9548
|
+
return dt.calculateSolution(
|
|
9550
9549
|
this.verification.targetChecksum,
|
|
9551
9550
|
this.publicKey.toBuffer(),
|
|
9552
9551
|
this.salt
|
|
@@ -9558,7 +9557,7 @@ class le {
|
|
|
9558
9557
|
* @returns {Promise<{valid: boolean; difficulty: number}>} Validation result
|
|
9559
9558
|
*/
|
|
9560
9559
|
checkDifficulty(t) {
|
|
9561
|
-
return
|
|
9560
|
+
return dt.checkDifficulty(
|
|
9562
9561
|
this.solution,
|
|
9563
9562
|
this.verification.targetHash,
|
|
9564
9563
|
t
|
|
@@ -9569,10 +9568,10 @@ class le {
|
|
|
9569
9568
|
* @returns {bigint | null} The target block number or null if epoch 0
|
|
9570
9569
|
*/
|
|
9571
9570
|
getMiningTargetBlock() {
|
|
9572
|
-
return
|
|
9571
|
+
return dt.getMiningTargetBlock(this.epochNumber);
|
|
9573
9572
|
}
|
|
9574
9573
|
}
|
|
9575
|
-
class
|
|
9574
|
+
class pt {
|
|
9576
9575
|
/**
|
|
9577
9576
|
* Reconstruct and optionally rebuild transaction with new parameters
|
|
9578
9577
|
* @param state - Serialized transaction state
|
|
@@ -9604,17 +9603,17 @@ class ft {
|
|
|
9604
9603
|
...t.precomputedData.estimatedFees !== void 0 ? { estimatedFees: BigInt(t.precomputedData.estimatedFees) } : {},
|
|
9605
9604
|
...t.precomputedData.compiledTargetScript !== void 0 ? { compiledTargetScript: y(t.precomputedData.compiledTargetScript) } : {}
|
|
9606
9605
|
}, p = t.typeSpecificData;
|
|
9607
|
-
if (
|
|
9606
|
+
if (oi(p))
|
|
9608
9607
|
return this.reconstructFunding(h, p);
|
|
9609
|
-
if (
|
|
9608
|
+
if (ai(p))
|
|
9610
9609
|
return this.reconstructDeployment(h, p, t);
|
|
9611
|
-
if (
|
|
9610
|
+
if (ci(p))
|
|
9612
9611
|
return this.reconstructInteraction(h, p, t);
|
|
9613
|
-
if (
|
|
9612
|
+
if (st(p))
|
|
9614
9613
|
return this.reconstructMultiSig(h, p);
|
|
9615
|
-
if (
|
|
9614
|
+
if (ui(p))
|
|
9616
9615
|
return this.reconstructCustomScript(h, p, t);
|
|
9617
|
-
if (
|
|
9616
|
+
if (li(p))
|
|
9618
9617
|
return this.reconstructCancel(h, p);
|
|
9619
9618
|
throw new Error(`Unsupported transaction type: ${t.header.transactionType}`);
|
|
9620
9619
|
}
|
|
@@ -9627,13 +9626,13 @@ class ft {
|
|
|
9627
9626
|
amount: BigInt(e.amount),
|
|
9628
9627
|
splitInputsInto: e.splitInputsInto
|
|
9629
9628
|
};
|
|
9630
|
-
return new
|
|
9629
|
+
return new $t(i);
|
|
9631
9630
|
}
|
|
9632
9631
|
/**
|
|
9633
9632
|
* Reconstruct a DeploymentTransaction
|
|
9634
9633
|
*/
|
|
9635
9634
|
static reconstructDeployment(t, e, i) {
|
|
9636
|
-
const r = new
|
|
9635
|
+
const r = new ue(e.challenge), s = {
|
|
9637
9636
|
...t,
|
|
9638
9637
|
bytecode: y(e.bytecode),
|
|
9639
9638
|
challenge: r,
|
|
@@ -9642,13 +9641,13 @@ class ft {
|
|
|
9642
9641
|
...e.revealMLDSAPublicKey !== void 0 ? { revealMLDSAPublicKey: e.revealMLDSAPublicKey } : {},
|
|
9643
9642
|
...e.linkMLDSAPublicKeyToAddress !== void 0 ? { linkMLDSAPublicKeyToAddress: e.linkMLDSAPublicKeyToAddress } : {}
|
|
9644
9643
|
};
|
|
9645
|
-
return new
|
|
9644
|
+
return new wt(s);
|
|
9646
9645
|
}
|
|
9647
9646
|
/**
|
|
9648
9647
|
* Reconstruct an InteractionTransaction
|
|
9649
9648
|
*/
|
|
9650
9649
|
static reconstructInteraction(t, e, i) {
|
|
9651
|
-
const r = new
|
|
9650
|
+
const r = new ue(e.challenge);
|
|
9652
9651
|
if (!t.to)
|
|
9653
9652
|
throw new Error('InteractionTransaction requires a "to" address');
|
|
9654
9653
|
const s = {
|
|
@@ -9664,7 +9663,7 @@ class ft {
|
|
|
9664
9663
|
...e.revealMLDSAPublicKey !== void 0 ? { revealMLDSAPublicKey: e.revealMLDSAPublicKey } : {},
|
|
9665
9664
|
...e.linkMLDSAPublicKeyToAddress !== void 0 ? { linkMLDSAPublicKeyToAddress: e.linkMLDSAPublicKeyToAddress } : {}
|
|
9666
9665
|
};
|
|
9667
|
-
return new
|
|
9666
|
+
return new Yt(s);
|
|
9668
9667
|
}
|
|
9669
9668
|
/**
|
|
9670
9669
|
* Reconstruct a MultiSignTransaction
|
|
@@ -9718,7 +9717,7 @@ class ft {
|
|
|
9718
9717
|
...e.annex !== void 0 ? { annex: y(e.annex) } : {},
|
|
9719
9718
|
...i.precomputedData.randomBytes !== void 0 ? { randomBytes: y(i.precomputedData.randomBytes) } : {}
|
|
9720
9719
|
};
|
|
9721
|
-
return new
|
|
9720
|
+
return new Xt(o);
|
|
9722
9721
|
}
|
|
9723
9722
|
/**
|
|
9724
9723
|
* Reconstruct a CancelTransaction
|
|
@@ -9728,7 +9727,7 @@ class ft {
|
|
|
9728
9727
|
...t,
|
|
9729
9728
|
compiledTargetScript: y(e.compiledTargetScript)
|
|
9730
9729
|
};
|
|
9731
|
-
return new
|
|
9730
|
+
return new Te(i);
|
|
9732
9731
|
}
|
|
9733
9732
|
/**
|
|
9734
9733
|
* Build address rotation config from options
|
|
@@ -9795,7 +9794,7 @@ class Er {
|
|
|
9795
9794
|
* @returns Base64-encoded serialized state
|
|
9796
9795
|
*/
|
|
9797
9796
|
static exportFunding(t, e) {
|
|
9798
|
-
const i =
|
|
9797
|
+
const i = Z.fromFunding(t, e);
|
|
9799
9798
|
return B.toBase64(i);
|
|
9800
9799
|
}
|
|
9801
9800
|
/**
|
|
@@ -9805,7 +9804,7 @@ class Er {
|
|
|
9805
9804
|
* @returns Base64-encoded serialized state
|
|
9806
9805
|
*/
|
|
9807
9806
|
static exportDeployment(t, e) {
|
|
9808
|
-
const i =
|
|
9807
|
+
const i = Z.fromDeployment(t, e);
|
|
9809
9808
|
return B.toBase64(i);
|
|
9810
9809
|
}
|
|
9811
9810
|
/**
|
|
@@ -9815,7 +9814,7 @@ class Er {
|
|
|
9815
9814
|
* @returns Base64-encoded serialized state
|
|
9816
9815
|
*/
|
|
9817
9816
|
static exportInteraction(t, e) {
|
|
9818
|
-
const i =
|
|
9817
|
+
const i = Z.fromInteraction(t, e);
|
|
9819
9818
|
return B.toBase64(i);
|
|
9820
9819
|
}
|
|
9821
9820
|
/**
|
|
@@ -9825,7 +9824,7 @@ class Er {
|
|
|
9825
9824
|
* @returns Base64-encoded serialized state
|
|
9826
9825
|
*/
|
|
9827
9826
|
static exportMultiSig(t, e) {
|
|
9828
|
-
const i =
|
|
9827
|
+
const i = Z.fromMultiSig(t, e);
|
|
9829
9828
|
return B.toBase64(i);
|
|
9830
9829
|
}
|
|
9831
9830
|
/**
|
|
@@ -9835,7 +9834,7 @@ class Er {
|
|
|
9835
9834
|
* @returns Base64-encoded serialized state
|
|
9836
9835
|
*/
|
|
9837
9836
|
static exportCustomScript(t, e) {
|
|
9838
|
-
const i =
|
|
9837
|
+
const i = Z.fromCustomScript(t, e);
|
|
9839
9838
|
return B.toBase64(i);
|
|
9840
9839
|
}
|
|
9841
9840
|
/**
|
|
@@ -9845,7 +9844,7 @@ class Er {
|
|
|
9845
9844
|
* @returns Base64-encoded serialized state
|
|
9846
9845
|
*/
|
|
9847
9846
|
static exportCancel(t, e) {
|
|
9848
|
-
const i =
|
|
9847
|
+
const i = Z.fromCancel(t, e);
|
|
9849
9848
|
return B.toBase64(i);
|
|
9850
9849
|
}
|
|
9851
9850
|
/**
|
|
@@ -9861,19 +9860,19 @@ class Er {
|
|
|
9861
9860
|
let s;
|
|
9862
9861
|
switch (r) {
|
|
9863
9862
|
case b.FUNDING:
|
|
9864
|
-
s =
|
|
9863
|
+
s = Z.fromFunding(
|
|
9865
9864
|
e,
|
|
9866
9865
|
i
|
|
9867
9866
|
);
|
|
9868
9867
|
break;
|
|
9869
9868
|
case b.DEPLOYMENT:
|
|
9870
|
-
s =
|
|
9869
|
+
s = Z.fromDeployment(
|
|
9871
9870
|
e,
|
|
9872
9871
|
i
|
|
9873
9872
|
);
|
|
9874
9873
|
break;
|
|
9875
9874
|
case b.INTERACTION:
|
|
9876
|
-
s =
|
|
9875
|
+
s = Z.fromInteraction(
|
|
9877
9876
|
e,
|
|
9878
9877
|
i
|
|
9879
9878
|
);
|
|
@@ -9891,7 +9890,7 @@ class Er {
|
|
|
9891
9890
|
*/
|
|
9892
9891
|
static importForSigning(t, e) {
|
|
9893
9892
|
const i = B.fromBase64(t);
|
|
9894
|
-
return
|
|
9893
|
+
return pt.reconstruct(i, e);
|
|
9895
9894
|
}
|
|
9896
9895
|
/**
|
|
9897
9896
|
* Complete signing and export signed transaction
|
|
@@ -10014,12 +10013,12 @@ class Er {
|
|
|
10014
10013
|
*/
|
|
10015
10014
|
static async multiSigAddSignature(t, e) {
|
|
10016
10015
|
const i = B.fromBase64(t);
|
|
10017
|
-
if (!
|
|
10016
|
+
if (!st(i.typeSpecificData))
|
|
10018
10017
|
throw new Error("State is not a multisig transaction");
|
|
10019
10018
|
const r = i.typeSpecificData, s = r.pubkeys.map((d) => y(d));
|
|
10020
10019
|
let o;
|
|
10021
|
-
const a =
|
|
10022
|
-
r.existingPsbtBase64 ? o =
|
|
10020
|
+
const a = pt.nameToNetwork(i.baseParams.networkName);
|
|
10021
|
+
r.existingPsbtBase64 ? o = V.fromBase64(r.existingPsbtBase64, { network: a }) : o = await this.importForSigning(t, {
|
|
10023
10022
|
signer: e
|
|
10024
10023
|
}).signPSBT();
|
|
10025
10024
|
const c = [];
|
|
@@ -10057,17 +10056,17 @@ class Er {
|
|
|
10057
10056
|
* Check if a public key has already signed a multisig transaction
|
|
10058
10057
|
*
|
|
10059
10058
|
* @param serializedState - Base64-encoded multisig state
|
|
10060
|
-
* @param signerPubKey - Public key to check (
|
|
10059
|
+
* @param signerPubKey - Public key to check (Uint8Array or hex string)
|
|
10061
10060
|
* @returns True if the public key has already signed
|
|
10062
10061
|
*/
|
|
10063
10062
|
static multiSigHasSigned(t, e) {
|
|
10064
10063
|
const i = B.fromBase64(t);
|
|
10065
|
-
if (!
|
|
10064
|
+
if (!st(i.typeSpecificData))
|
|
10066
10065
|
throw new Error("State is not a multisig transaction");
|
|
10067
10066
|
const r = i.typeSpecificData;
|
|
10068
10067
|
if (!r.existingPsbtBase64)
|
|
10069
10068
|
return !1;
|
|
10070
|
-
const s =
|
|
10069
|
+
const s = pt.nameToNetwork(i.baseParams.networkName), o = V.fromBase64(r.existingPsbtBase64, { network: s }), a = e instanceof Uint8Array ? e : y(e);
|
|
10071
10070
|
return L.verifyIfSigned(o, a);
|
|
10072
10071
|
}
|
|
10073
10072
|
/**
|
|
@@ -10078,7 +10077,7 @@ class Er {
|
|
|
10078
10077
|
*/
|
|
10079
10078
|
static multiSigGetSignatureStatus(t) {
|
|
10080
10079
|
const e = B.fromBase64(t);
|
|
10081
|
-
if (!
|
|
10080
|
+
if (!st(e.typeSpecificData))
|
|
10082
10081
|
throw new Error("State is not a multisig transaction");
|
|
10083
10082
|
const i = e.typeSpecificData, r = i.minimumSignatures;
|
|
10084
10083
|
if (!i.existingPsbtBase64)
|
|
@@ -10088,19 +10087,19 @@ class Er {
|
|
|
10088
10087
|
isComplete: !1,
|
|
10089
10088
|
signers: []
|
|
10090
10089
|
};
|
|
10091
|
-
const s =
|
|
10090
|
+
const s = pt.nameToNetwork(e.baseParams.networkName), o = V.fromBase64(i.existingPsbtBase64, { network: s }), a = /* @__PURE__ */ new Set();
|
|
10092
10091
|
for (let u = i.originalInputCount; u < o.data.inputs.length; u++) {
|
|
10093
10092
|
const l = o.data.inputs[u];
|
|
10094
10093
|
if (l.tapScriptSig)
|
|
10095
10094
|
for (const h of l.tapScriptSig)
|
|
10096
|
-
a.add(
|
|
10095
|
+
a.add(g(h.pubkey));
|
|
10097
10096
|
if (l.finalScriptWitness) {
|
|
10098
10097
|
const h = T.readScriptWitnessToWitnessStack(
|
|
10099
10098
|
l.finalScriptWitness
|
|
10100
10099
|
);
|
|
10101
10100
|
for (let p = 0; p < h.length - 2; p += 3) {
|
|
10102
10101
|
const d = h[p + 2];
|
|
10103
|
-
a.add(
|
|
10102
|
+
a.add(g(d));
|
|
10104
10103
|
}
|
|
10105
10104
|
}
|
|
10106
10105
|
}
|
|
@@ -10121,12 +10120,12 @@ class Er {
|
|
|
10121
10120
|
*/
|
|
10122
10121
|
static multiSigFinalize(t) {
|
|
10123
10122
|
const e = B.fromBase64(t);
|
|
10124
|
-
if (!
|
|
10123
|
+
if (!st(e.typeSpecificData))
|
|
10125
10124
|
throw new Error("State is not a multisig transaction");
|
|
10126
10125
|
const i = e.typeSpecificData;
|
|
10127
10126
|
if (!i.existingPsbtBase64)
|
|
10128
10127
|
throw new Error("No PSBT found in state - transaction has not been signed");
|
|
10129
|
-
const r =
|
|
10128
|
+
const r = pt.nameToNetwork(e.baseParams.networkName), s = V.fromBase64(i.existingPsbtBase64, { network: r }), o = i.pubkeys.map((u) => y(u)), a = [];
|
|
10130
10129
|
for (let u = i.originalInputCount; u < s.data.inputs.length; u++)
|
|
10131
10130
|
a.push(o);
|
|
10132
10131
|
if (!L.attemptFinalizeInputs(
|
|
@@ -10147,7 +10146,7 @@ class Er {
|
|
|
10147
10146
|
*/
|
|
10148
10147
|
static multiSigGetPsbt(t) {
|
|
10149
10148
|
const e = B.fromBase64(t);
|
|
10150
|
-
if (!
|
|
10149
|
+
if (!st(e.typeSpecificData))
|
|
10151
10150
|
throw new Error("State is not a multisig transaction");
|
|
10152
10151
|
return e.typeSpecificData.existingPsbtBase64 || null;
|
|
10153
10152
|
}
|
|
@@ -10160,7 +10159,7 @@ class Er {
|
|
|
10160
10159
|
*/
|
|
10161
10160
|
static multiSigUpdatePsbt(t, e) {
|
|
10162
10161
|
const i = B.fromBase64(t);
|
|
10163
|
-
if (!
|
|
10162
|
+
if (!st(i.typeSpecificData))
|
|
10164
10163
|
throw new Error("State is not a multisig transaction");
|
|
10165
10164
|
const r = {
|
|
10166
10165
|
...i,
|
|
@@ -10226,7 +10225,7 @@ class Pr {
|
|
|
10226
10225
|
outputIndex: d.outputIndex,
|
|
10227
10226
|
value: m,
|
|
10228
10227
|
scriptPubKey: d.scriptPubKey,
|
|
10229
|
-
nonWitnessUtxo:
|
|
10228
|
+
nonWitnessUtxo: Wi(I)
|
|
10230
10229
|
}), h > p)
|
|
10231
10230
|
break;
|
|
10232
10231
|
}
|
|
@@ -10298,7 +10297,7 @@ class Pr {
|
|
|
10298
10297
|
priorityFee: 0n,
|
|
10299
10298
|
gasSatFee: 330n,
|
|
10300
10299
|
mldsaSigner: null
|
|
10301
|
-
}, l = await new
|
|
10300
|
+
}, l = await new ni().createBTCTransfer(c), h = await this.broadcastTransaction(l.tx, !1);
|
|
10302
10301
|
return h || { error: "Could not broadcast transaction" };
|
|
10303
10302
|
}
|
|
10304
10303
|
/**
|
|
@@ -10385,11 +10384,11 @@ class Pr {
|
|
|
10385
10384
|
return new UnwrapGeneration(result as UnwrappedGenerationParameters);
|
|
10386
10385
|
}*/
|
|
10387
10386
|
}
|
|
10388
|
-
var
|
|
10387
|
+
var gi = /* @__PURE__ */ ((n) => (n[n.UNWRAP = 0] = "UNWRAP", n))(gi || {});
|
|
10389
10388
|
class vr {
|
|
10390
10389
|
/**
|
|
10391
10390
|
* Generate a multi-sig address
|
|
10392
|
-
* @param {
|
|
10391
|
+
* @param {Uint8Array[]} pubKeys - The public keys to use
|
|
10393
10392
|
* @param {number} minimumSignatureRequired - The minimum number of signatures required
|
|
10394
10393
|
* @param {Network} network - The network to use
|
|
10395
10394
|
* @returns {string} - The generated address
|
|
@@ -10413,106 +10412,106 @@ class vr {
|
|
|
10413
10412
|
return o;
|
|
10414
10413
|
}
|
|
10415
10414
|
}
|
|
10416
|
-
var
|
|
10415
|
+
var S = /* @__PURE__ */ ((n) => (n.UINT8 = "UINT8", n.UINT16 = "UINT16", n.UINT32 = "UINT32", n.UINT64 = "UINT64", n.UINT128 = "UINT128", n.UINT256 = "UINT256", n.INT8 = "INT8", n.INT16 = "INT16", n.INT32 = "INT32", n.INT64 = "INT64", n.INT128 = "INT128", n.BOOL = "BOOL", n.ADDRESS = "ADDRESS", n.EXTENDED_ADDRESS = "EXTENDED_ADDRESS", n.STRING = "STRING", n.BYTES4 = "BYTES4", n.BYTES32 = "BYTES32", n.BYTES = "BYTES", n.ADDRESS_UINT256_TUPLE = "ADDRESS_UINT256_TUPLE", n.EXTENDED_ADDRESS_UINT256_TUPLE = "EXTENDED_ADDRESS_UINT256_TUPLE", n.SCHNORR_SIGNATURE = "SCHNORR_SIGNATURE", n.ARRAY_OF_ADDRESSES = "ARRAY_OF_ADDRESSES", n.ARRAY_OF_EXTENDED_ADDRESSES = "ARRAY_OF_EXTENDED_ADDRESSES", n.ARRAY_OF_UINT256 = "ARRAY_OF_UINT256", n.ARRAY_OF_UINT128 = "ARRAY_OF_UINT128", n.ARRAY_OF_UINT64 = "ARRAY_OF_UINT64", n.ARRAY_OF_UINT32 = "ARRAY_OF_UINT32", n.ARRAY_OF_UINT16 = "ARRAY_OF_UINT16", n.ARRAY_OF_UINT8 = "ARRAY_OF_UINT8", n.ARRAY_OF_STRING = "ARRAY_OF_STRING", n.ARRAY_OF_BYTES = "ARRAY_OF_BYTES", n.ARRAY_OF_BUFFERS = "ARRAY_OF_BUFFERS", n))(S || {});
|
|
10417
10416
|
const Or = {
|
|
10418
|
-
address:
|
|
10419
|
-
extendedAddress:
|
|
10420
|
-
bool:
|
|
10421
|
-
bytes:
|
|
10422
|
-
uint256:
|
|
10423
|
-
uint128:
|
|
10424
|
-
uint64:
|
|
10425
|
-
uint32:
|
|
10426
|
-
uint16:
|
|
10427
|
-
uint8:
|
|
10428
|
-
int128:
|
|
10429
|
-
int64:
|
|
10430
|
-
int32:
|
|
10431
|
-
int16:
|
|
10432
|
-
int8:
|
|
10433
|
-
string:
|
|
10434
|
-
bytes4:
|
|
10435
|
-
bytes32:
|
|
10436
|
-
schnorrSignature:
|
|
10437
|
-
"tuple(address,uint256)[]":
|
|
10438
|
-
"tuple(extendedAddress,uint256)[]":
|
|
10439
|
-
"address[]":
|
|
10440
|
-
"extendedAddress[]":
|
|
10441
|
-
"uint256[]":
|
|
10442
|
-
"uint128[]":
|
|
10443
|
-
"uint64[]":
|
|
10444
|
-
"uint32[]":
|
|
10445
|
-
"uint16[]":
|
|
10446
|
-
"uint8[]":
|
|
10447
|
-
"bytes[]":
|
|
10448
|
-
"buffer[]":
|
|
10449
|
-
"string[]":
|
|
10450
|
-
boolean:
|
|
10451
|
-
},
|
|
10452
|
-
[
|
|
10453
|
-
[
|
|
10454
|
-
[
|
|
10455
|
-
[
|
|
10456
|
-
[
|
|
10457
|
-
[
|
|
10458
|
-
[
|
|
10459
|
-
[
|
|
10460
|
-
[
|
|
10461
|
-
[
|
|
10462
|
-
[
|
|
10463
|
-
[
|
|
10464
|
-
[
|
|
10465
|
-
[
|
|
10466
|
-
[
|
|
10467
|
-
[
|
|
10468
|
-
[
|
|
10469
|
-
[
|
|
10470
|
-
[
|
|
10471
|
-
[
|
|
10472
|
-
[
|
|
10473
|
-
[
|
|
10474
|
-
[
|
|
10475
|
-
[
|
|
10476
|
-
[
|
|
10477
|
-
[
|
|
10478
|
-
[
|
|
10479
|
-
[
|
|
10480
|
-
[
|
|
10481
|
-
[
|
|
10482
|
-
[
|
|
10483
|
-
[
|
|
10417
|
+
address: S.ADDRESS,
|
|
10418
|
+
extendedAddress: S.EXTENDED_ADDRESS,
|
|
10419
|
+
bool: S.BOOL,
|
|
10420
|
+
bytes: S.BYTES,
|
|
10421
|
+
uint256: S.UINT256,
|
|
10422
|
+
uint128: S.UINT128,
|
|
10423
|
+
uint64: S.UINT64,
|
|
10424
|
+
uint32: S.UINT32,
|
|
10425
|
+
uint16: S.UINT16,
|
|
10426
|
+
uint8: S.UINT8,
|
|
10427
|
+
int128: S.INT128,
|
|
10428
|
+
int64: S.INT64,
|
|
10429
|
+
int32: S.INT32,
|
|
10430
|
+
int16: S.INT16,
|
|
10431
|
+
int8: S.INT8,
|
|
10432
|
+
string: S.STRING,
|
|
10433
|
+
bytes4: S.BYTES4,
|
|
10434
|
+
bytes32: S.BYTES32,
|
|
10435
|
+
schnorrSignature: S.SCHNORR_SIGNATURE,
|
|
10436
|
+
"tuple(address,uint256)[]": S.ADDRESS_UINT256_TUPLE,
|
|
10437
|
+
"tuple(extendedAddress,uint256)[]": S.EXTENDED_ADDRESS_UINT256_TUPLE,
|
|
10438
|
+
"address[]": S.ARRAY_OF_ADDRESSES,
|
|
10439
|
+
"extendedAddress[]": S.ARRAY_OF_EXTENDED_ADDRESSES,
|
|
10440
|
+
"uint256[]": S.ARRAY_OF_UINT256,
|
|
10441
|
+
"uint128[]": S.ARRAY_OF_UINT128,
|
|
10442
|
+
"uint64[]": S.ARRAY_OF_UINT64,
|
|
10443
|
+
"uint32[]": S.ARRAY_OF_UINT32,
|
|
10444
|
+
"uint16[]": S.ARRAY_OF_UINT16,
|
|
10445
|
+
"uint8[]": S.ARRAY_OF_UINT8,
|
|
10446
|
+
"bytes[]": S.ARRAY_OF_BYTES,
|
|
10447
|
+
"buffer[]": S.ARRAY_OF_BUFFERS,
|
|
10448
|
+
"string[]": S.ARRAY_OF_STRING,
|
|
10449
|
+
boolean: S.BOOL
|
|
10450
|
+
}, Si = {
|
|
10451
|
+
[S.ADDRESS]: "address",
|
|
10452
|
+
[S.EXTENDED_ADDRESS]: "extendedAddress",
|
|
10453
|
+
[S.BOOL]: "bool",
|
|
10454
|
+
[S.BYTES]: "bytes",
|
|
10455
|
+
[S.BYTES32]: "bytes32",
|
|
10456
|
+
[S.BYTES4]: "bytes4",
|
|
10457
|
+
[S.UINT256]: "uint256",
|
|
10458
|
+
[S.UINT128]: "uint128",
|
|
10459
|
+
[S.UINT64]: "uint64",
|
|
10460
|
+
[S.UINT32]: "uint32",
|
|
10461
|
+
[S.UINT16]: "uint16",
|
|
10462
|
+
[S.UINT8]: "uint8",
|
|
10463
|
+
[S.INT128]: "int128",
|
|
10464
|
+
[S.INT64]: "int64",
|
|
10465
|
+
[S.INT32]: "int32",
|
|
10466
|
+
[S.INT16]: "int16",
|
|
10467
|
+
[S.INT8]: "int8",
|
|
10468
|
+
[S.STRING]: "string",
|
|
10469
|
+
[S.ADDRESS_UINT256_TUPLE]: "tuple(address,uint256)[]",
|
|
10470
|
+
[S.EXTENDED_ADDRESS_UINT256_TUPLE]: "tuple(extendedAddress,uint256)[]",
|
|
10471
|
+
[S.SCHNORR_SIGNATURE]: "schnorrSignature",
|
|
10472
|
+
[S.ARRAY_OF_ADDRESSES]: "address[]",
|
|
10473
|
+
[S.ARRAY_OF_EXTENDED_ADDRESSES]: "extendedAddress[]",
|
|
10474
|
+
[S.ARRAY_OF_UINT256]: "uint256[]",
|
|
10475
|
+
[S.ARRAY_OF_UINT128]: "uint128[]",
|
|
10476
|
+
[S.ARRAY_OF_UINT64]: "uint64[]",
|
|
10477
|
+
[S.ARRAY_OF_UINT32]: "uint32[]",
|
|
10478
|
+
[S.ARRAY_OF_UINT16]: "uint16[]",
|
|
10479
|
+
[S.ARRAY_OF_UINT8]: "uint8[]",
|
|
10480
|
+
[S.ARRAY_OF_BYTES]: "bytes[]",
|
|
10481
|
+
[S.ARRAY_OF_STRING]: "string[]",
|
|
10482
|
+
[S.ARRAY_OF_BUFFERS]: "buffer[]"
|
|
10484
10483
|
};
|
|
10485
|
-
function
|
|
10484
|
+
function yi(n) {
|
|
10486
10485
|
return Array.isArray(n);
|
|
10487
10486
|
}
|
|
10488
|
-
function
|
|
10487
|
+
function Pe(n) {
|
|
10489
10488
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
10490
10489
|
}
|
|
10491
|
-
function
|
|
10490
|
+
function wi(n) {
|
|
10492
10491
|
return typeof n == "string";
|
|
10493
10492
|
}
|
|
10494
|
-
function
|
|
10495
|
-
if (
|
|
10496
|
-
const i =
|
|
10493
|
+
function Wt(n) {
|
|
10494
|
+
if (wi(n)) {
|
|
10495
|
+
const i = Si[n];
|
|
10497
10496
|
if (!i)
|
|
10498
10497
|
throw new Error(`Unknown ABI type: ${n}`);
|
|
10499
10498
|
return i;
|
|
10500
10499
|
}
|
|
10501
|
-
if (
|
|
10502
|
-
return `tuple(${Object.values(n).map((r) =>
|
|
10500
|
+
if (Pe(n))
|
|
10501
|
+
return `tuple(${Object.values(n).map((r) => Wt(r)).join(",")})`;
|
|
10503
10502
|
const t = n[0];
|
|
10504
|
-
return n.length === 1 && t !== void 0 ? `${
|
|
10503
|
+
return n.length === 1 && t !== void 0 ? `${Wt(t)}[]` : `tuple(${n.map((i) => Wt(i)).join(",")})[]`;
|
|
10505
10504
|
}
|
|
10506
10505
|
class Ur {
|
|
10507
10506
|
decodeData(t, e) {
|
|
10508
|
-
const i = new
|
|
10507
|
+
const i = new Zt(t), r = [];
|
|
10509
10508
|
for (const s of e)
|
|
10510
10509
|
r.push(this.decodeSingleValue(i, s));
|
|
10511
10510
|
return r;
|
|
10512
10511
|
}
|
|
10513
10512
|
encodeSelector(t) {
|
|
10514
|
-
const
|
|
10515
|
-
return
|
|
10513
|
+
const i = this.sha256(t).subarray(0, 4);
|
|
10514
|
+
return Array.from(i, (r) => r.toString(16).padStart(2, "0")).join("");
|
|
10516
10515
|
}
|
|
10517
10516
|
numericSelectorToHex(t) {
|
|
10518
10517
|
return t.toString(16);
|
|
@@ -10522,76 +10521,76 @@ class Ur {
|
|
|
10522
10521
|
* Supports ABIDataTypes enum values, tuple arrays, and struct objects.
|
|
10523
10522
|
*/
|
|
10524
10523
|
decodeSingleValue(t, e) {
|
|
10525
|
-
if (
|
|
10524
|
+
if (yi(e)) {
|
|
10526
10525
|
const i = e[0];
|
|
10527
10526
|
return e.length === 1 && i !== void 0 ? this.decodeArray(t, i) : this.decodeTuple(t, e);
|
|
10528
10527
|
}
|
|
10529
|
-
if (
|
|
10528
|
+
if (Pe(e))
|
|
10530
10529
|
return this.decodeStruct(t, e);
|
|
10531
10530
|
switch (e) {
|
|
10532
|
-
case
|
|
10531
|
+
case S.UINT8:
|
|
10533
10532
|
return t.readU8();
|
|
10534
|
-
case
|
|
10533
|
+
case S.UINT16:
|
|
10535
10534
|
return t.readU16();
|
|
10536
|
-
case
|
|
10535
|
+
case S.UINT32:
|
|
10537
10536
|
return t.readU32();
|
|
10538
|
-
case
|
|
10537
|
+
case S.BYTES4:
|
|
10539
10538
|
return t.readBytes(4);
|
|
10540
|
-
case
|
|
10539
|
+
case S.BYTES32:
|
|
10541
10540
|
return t.readBytes(32);
|
|
10542
|
-
case
|
|
10541
|
+
case S.BOOL:
|
|
10543
10542
|
return t.readBoolean();
|
|
10544
|
-
case
|
|
10543
|
+
case S.ADDRESS:
|
|
10545
10544
|
return t.readAddress();
|
|
10546
|
-
case
|
|
10545
|
+
case S.STRING:
|
|
10547
10546
|
return t.readStringWithLength();
|
|
10548
|
-
case
|
|
10547
|
+
case S.UINT128:
|
|
10549
10548
|
return t.readU128();
|
|
10550
|
-
case
|
|
10549
|
+
case S.UINT256:
|
|
10551
10550
|
return t.readU256();
|
|
10552
|
-
case
|
|
10551
|
+
case S.INT8:
|
|
10553
10552
|
return t.readI8();
|
|
10554
|
-
case
|
|
10553
|
+
case S.INT16:
|
|
10555
10554
|
return t.readI16();
|
|
10556
|
-
case
|
|
10555
|
+
case S.INT32:
|
|
10557
10556
|
return t.readI32();
|
|
10558
|
-
case
|
|
10557
|
+
case S.INT64:
|
|
10559
10558
|
return t.readI64();
|
|
10560
|
-
case
|
|
10559
|
+
case S.INT128:
|
|
10561
10560
|
return t.readI128();
|
|
10562
|
-
case
|
|
10561
|
+
case S.EXTENDED_ADDRESS:
|
|
10563
10562
|
return t.readExtendedAddress();
|
|
10564
|
-
case
|
|
10563
|
+
case S.ADDRESS_UINT256_TUPLE:
|
|
10565
10564
|
return t.readAddressValueTuple();
|
|
10566
|
-
case
|
|
10565
|
+
case S.EXTENDED_ADDRESS_UINT256_TUPLE:
|
|
10567
10566
|
return t.readExtendedAddressMapU256();
|
|
10568
|
-
case
|
|
10567
|
+
case S.SCHNORR_SIGNATURE:
|
|
10569
10568
|
return t.readSchnorrSignature();
|
|
10570
|
-
case
|
|
10569
|
+
case S.BYTES:
|
|
10571
10570
|
return t.readBytesWithLength();
|
|
10572
|
-
case
|
|
10571
|
+
case S.UINT64:
|
|
10573
10572
|
return t.readU64();
|
|
10574
|
-
case
|
|
10573
|
+
case S.ARRAY_OF_ADDRESSES:
|
|
10575
10574
|
return t.readAddressArray();
|
|
10576
|
-
case
|
|
10575
|
+
case S.ARRAY_OF_EXTENDED_ADDRESSES:
|
|
10577
10576
|
return t.readExtendedAddressArray();
|
|
10578
|
-
case
|
|
10577
|
+
case S.ARRAY_OF_UINT256:
|
|
10579
10578
|
return t.readU256Array();
|
|
10580
|
-
case
|
|
10579
|
+
case S.ARRAY_OF_UINT128:
|
|
10581
10580
|
return t.readU128Array();
|
|
10582
|
-
case
|
|
10581
|
+
case S.ARRAY_OF_UINT64:
|
|
10583
10582
|
return t.readU64Array();
|
|
10584
|
-
case
|
|
10583
|
+
case S.ARRAY_OF_UINT32:
|
|
10585
10584
|
return t.readU32Array();
|
|
10586
|
-
case
|
|
10585
|
+
case S.ARRAY_OF_UINT16:
|
|
10587
10586
|
return t.readU16Array();
|
|
10588
|
-
case
|
|
10587
|
+
case S.ARRAY_OF_UINT8:
|
|
10589
10588
|
return t.readU8Array();
|
|
10590
|
-
case
|
|
10589
|
+
case S.ARRAY_OF_STRING:
|
|
10591
10590
|
return t.readStringArray();
|
|
10592
|
-
case
|
|
10591
|
+
case S.ARRAY_OF_BYTES:
|
|
10593
10592
|
return t.readBytesArray();
|
|
10594
|
-
case
|
|
10593
|
+
case S.ARRAY_OF_BUFFERS:
|
|
10595
10594
|
return t.readArrayOfBuffer();
|
|
10596
10595
|
default:
|
|
10597
10596
|
throw new Error(`Unsupported ABI type: ${e}`);
|
|
@@ -10623,10 +10622,10 @@ class Ur {
|
|
|
10623
10622
|
return i;
|
|
10624
10623
|
}
|
|
10625
10624
|
sha256(t) {
|
|
10626
|
-
return new
|
|
10625
|
+
return new Uint8Array(new Ii.sha256().update(t).digest());
|
|
10627
10626
|
}
|
|
10628
10627
|
}
|
|
10629
|
-
class
|
|
10628
|
+
class ve {
|
|
10630
10629
|
items;
|
|
10631
10630
|
keys;
|
|
10632
10631
|
constructor(t = []) {
|
|
@@ -10649,7 +10648,7 @@ class Oe {
|
|
|
10649
10648
|
this.items.delete(e) && (this.keys = this.keys.filter((i) => i.toBigInt() !== e));
|
|
10650
10649
|
}
|
|
10651
10650
|
clone() {
|
|
10652
|
-
return new
|
|
10651
|
+
return new ve(this.keys);
|
|
10653
10652
|
}
|
|
10654
10653
|
clear() {
|
|
10655
10654
|
this.items.clear(), this.keys = [];
|
|
@@ -10667,9 +10666,9 @@ class Oe {
|
|
|
10667
10666
|
yield* this.keys;
|
|
10668
10667
|
}
|
|
10669
10668
|
}
|
|
10670
|
-
class
|
|
10669
|
+
class Oe {
|
|
10671
10670
|
constructor(t) {
|
|
10672
|
-
this.compareFn = t, this.map = new
|
|
10671
|
+
this.compareFn = t, this.map = new mt(), this.#t = [];
|
|
10673
10672
|
}
|
|
10674
10673
|
map;
|
|
10675
10674
|
#t;
|
|
@@ -10677,7 +10676,7 @@ class Ue {
|
|
|
10677
10676
|
return this.map.size;
|
|
10678
10677
|
}
|
|
10679
10678
|
static fromMap(t, e) {
|
|
10680
|
-
const i = new
|
|
10679
|
+
const i = new Oe(e);
|
|
10681
10680
|
for (const [r, s] of t)
|
|
10682
10681
|
i.set(r, s);
|
|
10683
10682
|
return i;
|
|
@@ -10744,7 +10743,7 @@ class Ue {
|
|
|
10744
10743
|
yield [t, this.map.get(t)];
|
|
10745
10744
|
}
|
|
10746
10745
|
}
|
|
10747
|
-
class
|
|
10746
|
+
class Ue {
|
|
10748
10747
|
constructor(t) {
|
|
10749
10748
|
this.compareFn = t, this.elements = [];
|
|
10750
10749
|
}
|
|
@@ -10753,7 +10752,7 @@ class Be {
|
|
|
10753
10752
|
return this.elements.length;
|
|
10754
10753
|
}
|
|
10755
10754
|
static fromSet(t, e) {
|
|
10756
|
-
const i = new
|
|
10755
|
+
const i = new Ue(e);
|
|
10757
10756
|
for (const r of t)
|
|
10758
10757
|
i.add(r);
|
|
10759
10758
|
return i;
|
|
@@ -10801,8 +10800,8 @@ class Br {
|
|
|
10801
10800
|
this.type = t, this.data = e;
|
|
10802
10801
|
}
|
|
10803
10802
|
}
|
|
10804
|
-
var
|
|
10805
|
-
class _r extends
|
|
10803
|
+
var mi = /* @__PURE__ */ ((n) => (n.mainnet = "mainnet", n.testnet = "testnet", n.signet = "Signet", n))(mi || {}), bi = /* @__PURE__ */ ((n) => (n.ECDSA = "ECDSA", n.BIP322 = "BIP322", n))(bi || {});
|
|
10804
|
+
class _r extends be {
|
|
10806
10805
|
isInitialized = !1;
|
|
10807
10806
|
constructor() {
|
|
10808
10807
|
if (super(), !window)
|
|
@@ -10855,7 +10854,7 @@ class _r extends Ae {
|
|
|
10855
10854
|
throw new Error("Payment address not found");
|
|
10856
10855
|
const i = e.address.startsWith("tb") ? A.testnet : e.address.startsWith("bc") ? A.bitcoin : null;
|
|
10857
10856
|
if (!i) throw new Error("Network not supported");
|
|
10858
|
-
this._network = i, this._publicKey =
|
|
10857
|
+
this._network = i, this._publicKey = le(y(e.publicKey)), this._p2wpkh = P.getP2WPKHAddress(this, this.network), this._p2tr = P.getTaprootAddress(this, this.network), this._addresses = [this._p2wpkh, this._p2tr], this.isInitialized = !0;
|
|
10859
10858
|
}
|
|
10860
10859
|
async signData(t, e, i) {
|
|
10861
10860
|
if (!this.isInitialized)
|
|
@@ -10906,10 +10905,10 @@ class _r extends Ae {
|
|
|
10906
10905
|
e.push(c);
|
|
10907
10906
|
const u = a.data.inputs.map((l, h) => {
|
|
10908
10907
|
let p = !1, d = !1;
|
|
10909
|
-
if (
|
|
10908
|
+
if (ye(l)) {
|
|
10910
10909
|
if (l.tapLeafScript && l.tapLeafScript.length > 0) {
|
|
10911
10910
|
for (const m of l.tapLeafScript)
|
|
10912
|
-
if (
|
|
10911
|
+
if (me(this.publicKey, m.script)) {
|
|
10913
10912
|
p = !0, d = !1;
|
|
10914
10913
|
break;
|
|
10915
10914
|
}
|
|
@@ -10918,10 +10917,10 @@ class _r extends Ae {
|
|
|
10918
10917
|
const m = l.tapInternalKey, w = O(this.publicKey);
|
|
10919
10918
|
D(m, w) && (p = !0, d = !0);
|
|
10920
10919
|
}
|
|
10921
|
-
} else
|
|
10920
|
+
} else we(l, this.publicKey) && (p = !0, d = !1);
|
|
10922
10921
|
return p ? {
|
|
10923
10922
|
index: h,
|
|
10924
|
-
publicKey:
|
|
10923
|
+
publicKey: g(this.publicKey),
|
|
10925
10924
|
disableTweakSigner: !d
|
|
10926
10925
|
} : null;
|
|
10927
10926
|
}).filter((l) => l !== null);
|
|
@@ -10937,7 +10936,7 @@ class _r extends Ae {
|
|
|
10937
10936
|
signInputs: r
|
|
10938
10937
|
});
|
|
10939
10938
|
if ("error" in s) throw new Error(s.error.message);
|
|
10940
|
-
const o =
|
|
10939
|
+
const o = V.fromBase64(s.result.psbt);
|
|
10941
10940
|
t[0].combine(o);
|
|
10942
10941
|
}
|
|
10943
10942
|
hasAlreadySignedTapScriptSig(t) {
|
|
@@ -10971,7 +10970,7 @@ class _r extends Ae {
|
|
|
10971
10970
|
}
|
|
10972
10971
|
}
|
|
10973
10972
|
async signAllTweaked(t, e, i = !1) {
|
|
10974
|
-
const r =
|
|
10973
|
+
const r = g(this.publicKey), o = {
|
|
10975
10974
|
toSignInputs: t.data.inputs.map((l, h) => [
|
|
10976
10975
|
{
|
|
10977
10976
|
index: h,
|
|
@@ -10987,7 +10986,7 @@ class _r extends Ae {
|
|
|
10987
10986
|
signInputs: c
|
|
10988
10987
|
});
|
|
10989
10988
|
if ("error" in u) throw new Error(u.error.message);
|
|
10990
|
-
return
|
|
10989
|
+
return V.fromBase64(u.result.psbt);
|
|
10991
10990
|
}
|
|
10992
10991
|
getNonDuplicateScriptSig(t, e) {
|
|
10993
10992
|
const i = [];
|
|
@@ -10998,7 +10997,7 @@ class _r extends Ae {
|
|
|
10998
10997
|
return i;
|
|
10999
10998
|
}
|
|
11000
10999
|
}
|
|
11001
|
-
class
|
|
11000
|
+
class Gt {
|
|
11002
11001
|
static INITIAL_CAPACITY = 16;
|
|
11003
11002
|
static LOAD_FACTOR = 0.75;
|
|
11004
11003
|
#t;
|
|
@@ -11006,7 +11005,7 @@ class jt {
|
|
|
11006
11005
|
deleted;
|
|
11007
11006
|
capacity;
|
|
11008
11007
|
constructor() {
|
|
11009
|
-
this.capacity =
|
|
11008
|
+
this.capacity = Gt.INITIAL_CAPACITY, this.#t = new Array(this.capacity), this.#e = new Array(this.capacity), this.deleted = new Array(this.capacity).fill(!1);
|
|
11010
11009
|
}
|
|
11011
11010
|
_size = 0;
|
|
11012
11011
|
get size() {
|
|
@@ -11015,7 +11014,7 @@ class jt {
|
|
|
11015
11014
|
set(t, e) {
|
|
11016
11015
|
let i = !0;
|
|
11017
11016
|
const r = this.findInsertIndex(t);
|
|
11018
|
-
return (this.#t[r] === void 0 || this.deleted[r]) && (this._size++, i = !1), this.#t[r] = t, this.#e[r] = e, this.deleted[r] = !1, this._size > this.capacity *
|
|
11017
|
+
return (this.#t[r] === void 0 || this.deleted[r]) && (this._size++, i = !1), this.#t[r] = t, this.#e[r] = e, this.deleted[r] = !1, this._size > this.capacity * Gt.LOAD_FACTOR && this.resize(), i;
|
|
11019
11018
|
}
|
|
11020
11019
|
get(t) {
|
|
11021
11020
|
const e = this.findIndex(t);
|
|
@@ -11163,274 +11162,274 @@ class jt {
|
|
|
11163
11162
|
const Rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
11164
11163
|
__proto__: null,
|
|
11165
11164
|
ABICoder: Ur,
|
|
11166
|
-
ABIDataTypes:
|
|
11165
|
+
ABIDataTypes: S,
|
|
11167
11166
|
ADDRESS_BYTE_LENGTH: R,
|
|
11168
|
-
ANCHOR_SCRIPT:
|
|
11169
|
-
AbiTypeToStr:
|
|
11170
|
-
Address:
|
|
11171
|
-
AddressGenerator:
|
|
11172
|
-
AddressMap:
|
|
11173
|
-
AddressSet:
|
|
11174
|
-
AddressTypes:
|
|
11175
|
-
AddressVerificator:
|
|
11176
|
-
BIPStandard:
|
|
11167
|
+
ANCHOR_SCRIPT: ce,
|
|
11168
|
+
AbiTypeToStr: Si,
|
|
11169
|
+
Address: K,
|
|
11170
|
+
AddressGenerator: pe,
|
|
11171
|
+
AddressMap: Ve,
|
|
11172
|
+
AddressSet: ve,
|
|
11173
|
+
AddressTypes: it,
|
|
11174
|
+
AddressVerificator: Y,
|
|
11175
|
+
BIPStandard: Et,
|
|
11177
11176
|
BOOLEAN_BYTE_LENGTH: sr,
|
|
11178
|
-
BinaryReader:
|
|
11177
|
+
BinaryReader: Zt,
|
|
11179
11178
|
BinaryWriter: H,
|
|
11180
11179
|
BitcoinUtils: M,
|
|
11181
|
-
BufferHelper:
|
|
11182
|
-
CSVModes:
|
|
11183
|
-
CalldataGenerator:
|
|
11184
|
-
CancelTransaction:
|
|
11185
|
-
ChainId:
|
|
11186
|
-
ChallengeSolution:
|
|
11187
|
-
ChallengeSubmission:
|
|
11188
|
-
ChallengeVerification:
|
|
11189
|
-
Compressor:
|
|
11180
|
+
BufferHelper: Ft,
|
|
11181
|
+
CSVModes: ri,
|
|
11182
|
+
CalldataGenerator: he,
|
|
11183
|
+
CancelTransaction: Te,
|
|
11184
|
+
ChainId: Se,
|
|
11185
|
+
ChallengeSolution: ue,
|
|
11186
|
+
ChallengeSubmission: fi,
|
|
11187
|
+
ChallengeVerification: pi,
|
|
11188
|
+
Compressor: X,
|
|
11190
11189
|
Consensus: Kt,
|
|
11191
|
-
ConsolidatedInteractionTransaction:
|
|
11192
|
-
ContractAddress:
|
|
11190
|
+
ConsolidatedInteractionTransaction: si,
|
|
11191
|
+
ContractAddress: ne,
|
|
11193
11192
|
ContractBaseMetadata: fr,
|
|
11194
|
-
CustomGenerator:
|
|
11195
|
-
CustomKeypair:
|
|
11196
|
-
CustomMap:
|
|
11197
|
-
CustomScriptTransaction:
|
|
11198
|
-
DeploymentGenerator:
|
|
11199
|
-
DeploymentTransaction:
|
|
11200
|
-
DeterministicMap:
|
|
11201
|
-
DeterministicSet:
|
|
11202
|
-
EXTENDED_ADDRESS_BYTE_LENGTH:
|
|
11193
|
+
CustomGenerator: qe,
|
|
11194
|
+
CustomKeypair: be,
|
|
11195
|
+
CustomMap: Gt,
|
|
11196
|
+
CustomScriptTransaction: Xt,
|
|
11197
|
+
DeploymentGenerator: de,
|
|
11198
|
+
DeploymentTransaction: wt,
|
|
11199
|
+
DeterministicMap: Oe,
|
|
11200
|
+
DeterministicSet: Ue,
|
|
11201
|
+
EXTENDED_ADDRESS_BYTE_LENGTH: ft,
|
|
11203
11202
|
EcKeyPair: P,
|
|
11204
|
-
EpochValidator:
|
|
11205
|
-
ExtendedAddressMap:
|
|
11206
|
-
FastMap:
|
|
11207
|
-
FeaturePriority:
|
|
11208
|
-
Features:
|
|
11209
|
-
FundingTransaction:
|
|
11210
|
-
Generator:
|
|
11203
|
+
EpochValidator: dt,
|
|
11204
|
+
ExtendedAddressMap: ze,
|
|
11205
|
+
FastMap: mt,
|
|
11206
|
+
FeaturePriority: J,
|
|
11207
|
+
Features: z,
|
|
11208
|
+
FundingTransaction: $t,
|
|
11209
|
+
Generator: Q,
|
|
11211
11210
|
HashCommitmentGenerator: E,
|
|
11212
|
-
I128_BYTE_LENGTH:
|
|
11213
|
-
I16_BYTE_LENGTH:
|
|
11211
|
+
I128_BYTE_LENGTH: It,
|
|
11212
|
+
I16_BYTE_LENGTH: Bt,
|
|
11214
11213
|
I256_BYTE_LENGTH: rr,
|
|
11215
|
-
I32_BYTE_LENGTH:
|
|
11216
|
-
I64_BYTE_LENGTH:
|
|
11217
|
-
I8_BYTE_LENGTH:
|
|
11218
|
-
InteractionTransaction:
|
|
11219
|
-
InteractionTransactionP2WDA:
|
|
11214
|
+
I32_BYTE_LENGTH: Ut,
|
|
11215
|
+
I64_BYTE_LENGTH: Ot,
|
|
11216
|
+
I8_BYTE_LENGTH: _t,
|
|
11217
|
+
InteractionTransaction: Yt,
|
|
11218
|
+
InteractionTransactionP2WDA: tt,
|
|
11220
11219
|
LegacyCalldataGenerator: lr,
|
|
11221
|
-
MINIMUM_AMOUNT_CA:
|
|
11222
|
-
MINIMUM_AMOUNT_REWARD:
|
|
11223
|
-
MLDSAPublicKeyMetadata:
|
|
11220
|
+
MINIMUM_AMOUNT_CA: At,
|
|
11221
|
+
MINIMUM_AMOUNT_REWARD: G,
|
|
11222
|
+
MLDSAPublicKeyMetadata: je,
|
|
11224
11223
|
MLDSASecurityLevel: U.MLDSASecurityLevel,
|
|
11225
|
-
MessageSigner:
|
|
11226
|
-
MessageType:
|
|
11227
|
-
Mnemonic:
|
|
11228
|
-
MnemonicStrength:
|
|
11229
|
-
MultiSignGenerator:
|
|
11224
|
+
MessageSigner: ot,
|
|
11225
|
+
MessageType: Ze,
|
|
11226
|
+
Mnemonic: ge,
|
|
11227
|
+
MnemonicStrength: qt,
|
|
11228
|
+
MultiSignGenerator: kt,
|
|
11230
11229
|
MultiSignTransaction: L,
|
|
11231
11230
|
NetEvent: Br,
|
|
11232
|
-
OPNET_DEPLOYMENT_VERSION:
|
|
11233
|
-
OPNetConsensusConfig:
|
|
11231
|
+
OPNET_DEPLOYMENT_VERSION: Xe,
|
|
11232
|
+
OPNetConsensusConfig: di,
|
|
11234
11233
|
OPNetLimitedProvider: Pr,
|
|
11235
11234
|
OfflineTransactionManager: Er,
|
|
11236
11235
|
P2TR_MS: vr,
|
|
11237
|
-
P2WDADetector:
|
|
11238
|
-
P2WDAGenerator:
|
|
11239
|
-
PSBTTypes:
|
|
11236
|
+
P2WDADetector: j,
|
|
11237
|
+
P2WDAGenerator: Lt,
|
|
11238
|
+
PSBTTypes: gi,
|
|
11240
11239
|
QuantumBIP32Factory: U.QuantumBIP32Factory,
|
|
11241
11240
|
QuantumDerivationPath: U.QuantumDerivationPath,
|
|
11242
|
-
RoswellConsensus:
|
|
11243
|
-
SCHNORR_SIGNATURE_BYTE_LENGTH:
|
|
11241
|
+
RoswellConsensus: hi,
|
|
11242
|
+
SCHNORR_SIGNATURE_BYTE_LENGTH: gt,
|
|
11244
11243
|
SELECTOR_BYTE_LENGTH: ir,
|
|
11245
|
-
SERIALIZATION_FORMAT_VERSION:
|
|
11246
|
-
SERIALIZATION_MAGIC_BYTE:
|
|
11247
|
-
Secp256k1PointDeriver:
|
|
11248
|
-
SharedInteractionTransaction:
|
|
11249
|
-
SignatureType:
|
|
11250
|
-
SigningProtocol:
|
|
11244
|
+
SERIALIZATION_FORMAT_VERSION: Ie,
|
|
11245
|
+
SERIALIZATION_MAGIC_BYTE: Mt,
|
|
11246
|
+
Secp256k1PointDeriver: He,
|
|
11247
|
+
SharedInteractionTransaction: Ae,
|
|
11248
|
+
SignatureType: Je,
|
|
11249
|
+
SigningProtocol: bi,
|
|
11251
11250
|
StrToAbiType: Or,
|
|
11252
|
-
TapscriptVerificator:
|
|
11253
|
-
TimeLockGenerator:
|
|
11251
|
+
TapscriptVerificator: rt,
|
|
11252
|
+
TimeLockGenerator: q,
|
|
11254
11253
|
TransactionBuilder: T,
|
|
11255
|
-
TransactionFactory:
|
|
11256
|
-
TransactionReconstructor:
|
|
11257
|
-
TransactionSequence:
|
|
11254
|
+
TransactionFactory: ni,
|
|
11255
|
+
TransactionReconstructor: pt,
|
|
11256
|
+
TransactionSequence: ii,
|
|
11258
11257
|
TransactionSerializer: B,
|
|
11259
|
-
TransactionStateCapture:
|
|
11258
|
+
TransactionStateCapture: Z,
|
|
11260
11259
|
TransactionType: b,
|
|
11261
|
-
TweakedSigner:
|
|
11262
|
-
TweakedTransaction:
|
|
11263
|
-
U128_BYTE_LENGTH:
|
|
11264
|
-
U16_BYTE_LENGTH:
|
|
11265
|
-
U256_BYTE_LENGTH:
|
|
11266
|
-
U32_BYTE_LENGTH:
|
|
11267
|
-
U64_BYTE_LENGTH:
|
|
11268
|
-
U8_BYTE_LENGTH:
|
|
11269
|
-
UnisatChainType:
|
|
11260
|
+
TweakedSigner: fe,
|
|
11261
|
+
TweakedTransaction: Jt,
|
|
11262
|
+
U128_BYTE_LENGTH: Tt,
|
|
11263
|
+
U16_BYTE_LENGTH: yt,
|
|
11264
|
+
U256_BYTE_LENGTH: vt,
|
|
11265
|
+
U32_BYTE_LENGTH: St,
|
|
11266
|
+
U64_BYTE_LENGTH: Vt,
|
|
11267
|
+
U8_BYTE_LENGTH: zt,
|
|
11268
|
+
UnisatChainType: Qe,
|
|
11270
11269
|
UnisatSigner: Sr,
|
|
11271
|
-
Wallet:
|
|
11272
|
-
WalletNetworks:
|
|
11273
|
-
XverseNetwork:
|
|
11270
|
+
Wallet: et,
|
|
11271
|
+
WalletNetworks: Pt,
|
|
11272
|
+
XverseNetwork: mi,
|
|
11274
11273
|
XverseSigner: _r,
|
|
11275
|
-
abiTypeToSelectorString:
|
|
11276
|
-
buildBIPPath:
|
|
11274
|
+
abiTypeToSelectorString: Wt,
|
|
11275
|
+
buildBIPPath: Ge,
|
|
11277
11276
|
createAddressRotation: mr,
|
|
11278
|
-
createSignerMap:
|
|
11279
|
-
currentConsensus:
|
|
11277
|
+
createSignerMap: ti,
|
|
11278
|
+
currentConsensus: Ee,
|
|
11280
11279
|
currentConsensusConfig: Ir,
|
|
11281
11280
|
disabledAddressRotation: br,
|
|
11282
11281
|
getBIPDescription: dr,
|
|
11283
|
-
getLevelFromPublicKeyLength:
|
|
11284
|
-
isAbiStruct:
|
|
11285
|
-
isAbiTuple:
|
|
11286
|
-
isCancelSpecificData:
|
|
11287
|
-
isCustomScriptSpecificData:
|
|
11288
|
-
isDeploymentSpecificData:
|
|
11289
|
-
isFundingSpecificData:
|
|
11290
|
-
isInteractionSpecificData:
|
|
11291
|
-
isMultiSigSpecificData:
|
|
11292
|
-
isOPWallet:
|
|
11293
|
-
isSimpleAbiType:
|
|
11294
|
-
isUniversalSigner:
|
|
11282
|
+
getLevelFromPublicKeyLength: oe,
|
|
11283
|
+
isAbiStruct: Pe,
|
|
11284
|
+
isAbiTuple: yi,
|
|
11285
|
+
isCancelSpecificData: li,
|
|
11286
|
+
isCustomScriptSpecificData: ui,
|
|
11287
|
+
isDeploymentSpecificData: ai,
|
|
11288
|
+
isFundingSpecificData: oi,
|
|
11289
|
+
isInteractionSpecificData: ci,
|
|
11290
|
+
isMultiSigSpecificData: st,
|
|
11291
|
+
isOPWallet: Ye,
|
|
11292
|
+
isSimpleAbiType: wi,
|
|
11293
|
+
isUniversalSigner: lt,
|
|
11295
11294
|
toParallelKeyPair: Ar,
|
|
11296
|
-
toTweakedParallelKeyPair:
|
|
11295
|
+
toTweakedParallelKeyPair: ei,
|
|
11297
11296
|
version: $i,
|
|
11298
|
-
versionBuffer:
|
|
11297
|
+
versionBuffer: $e
|
|
11299
11298
|
}, Symbol.toStringTag, { value: "Module" })), Dr = U.MLDSASecurityLevel, Cr = U.QuantumBIP32Factory, Fr = U.QuantumDerivationPath;
|
|
11300
11299
|
export {
|
|
11301
11300
|
Ur as ABICoder,
|
|
11302
|
-
|
|
11301
|
+
S as ABIDataTypes,
|
|
11303
11302
|
R as ADDRESS_BYTE_LENGTH,
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11303
|
+
ce as ANCHOR_SCRIPT,
|
|
11304
|
+
Si as AbiTypeToStr,
|
|
11305
|
+
K as Address,
|
|
11306
|
+
pe as AddressGenerator,
|
|
11307
|
+
Ve as AddressMap,
|
|
11308
|
+
ve as AddressSet,
|
|
11309
|
+
it as AddressTypes,
|
|
11310
|
+
Y as AddressVerificator,
|
|
11311
|
+
Et as BIPStandard,
|
|
11313
11312
|
sr as BOOLEAN_BYTE_LENGTH,
|
|
11314
|
-
|
|
11313
|
+
Zt as BinaryReader,
|
|
11315
11314
|
H as BinaryWriter,
|
|
11316
11315
|
M as BitcoinUtils,
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11316
|
+
Ft as BufferHelper,
|
|
11317
|
+
ri as CSVModes,
|
|
11318
|
+
he as CalldataGenerator,
|
|
11319
|
+
Te as CancelTransaction,
|
|
11320
|
+
Se as ChainId,
|
|
11321
|
+
ue as ChallengeSolution,
|
|
11322
|
+
fi as ChallengeSubmission,
|
|
11323
|
+
pi as ChallengeVerification,
|
|
11324
|
+
X as Compressor,
|
|
11326
11325
|
Kt as Consensus,
|
|
11327
|
-
|
|
11328
|
-
|
|
11326
|
+
si as ConsolidatedInteractionTransaction,
|
|
11327
|
+
ne as ContractAddress,
|
|
11329
11328
|
fr as ContractBaseMetadata,
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11329
|
+
qe as CustomGenerator,
|
|
11330
|
+
be as CustomKeypair,
|
|
11331
|
+
Gt as CustomMap,
|
|
11332
|
+
Xt as CustomScriptTransaction,
|
|
11333
|
+
de as DeploymentGenerator,
|
|
11334
|
+
wt as DeploymentTransaction,
|
|
11335
|
+
Oe as DeterministicMap,
|
|
11336
|
+
Ue as DeterministicSet,
|
|
11337
|
+
ft as EXTENDED_ADDRESS_BYTE_LENGTH,
|
|
11339
11338
|
P as EcKeyPair,
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11339
|
+
dt as EpochValidator,
|
|
11340
|
+
ze as ExtendedAddressMap,
|
|
11341
|
+
mt as FastMap,
|
|
11342
|
+
J as FeaturePriority,
|
|
11343
|
+
z as Features,
|
|
11344
|
+
$t as FundingTransaction,
|
|
11345
|
+
Q as Generator,
|
|
11347
11346
|
E as HashCommitmentGenerator,
|
|
11348
|
-
|
|
11349
|
-
|
|
11347
|
+
It as I128_BYTE_LENGTH,
|
|
11348
|
+
Bt as I16_BYTE_LENGTH,
|
|
11350
11349
|
rr as I256_BYTE_LENGTH,
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11350
|
+
Ut as I32_BYTE_LENGTH,
|
|
11351
|
+
Ot as I64_BYTE_LENGTH,
|
|
11352
|
+
_t as I8_BYTE_LENGTH,
|
|
11353
|
+
Yt as InteractionTransaction,
|
|
11354
|
+
tt as InteractionTransactionP2WDA,
|
|
11356
11355
|
lr as LegacyCalldataGenerator,
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11356
|
+
At as MINIMUM_AMOUNT_CA,
|
|
11357
|
+
G as MINIMUM_AMOUNT_REWARD,
|
|
11358
|
+
je as MLDSAPublicKeyMetadata,
|
|
11360
11359
|
Dr as MLDSASecurityLevel,
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11360
|
+
ot as MessageSigner,
|
|
11361
|
+
Ze as MessageType,
|
|
11362
|
+
ge as Mnemonic,
|
|
11363
|
+
qt as MnemonicStrength,
|
|
11364
|
+
kt as MultiSignGenerator,
|
|
11366
11365
|
L as MultiSignTransaction,
|
|
11367
11366
|
Br as NetEvent,
|
|
11368
|
-
|
|
11369
|
-
|
|
11367
|
+
Xe as OPNET_DEPLOYMENT_VERSION,
|
|
11368
|
+
di as OPNetConsensusConfig,
|
|
11370
11369
|
Pr as OPNetLimitedProvider,
|
|
11371
11370
|
Er as OfflineTransactionManager,
|
|
11372
11371
|
vr as P2TR_MS,
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11372
|
+
j as P2WDADetector,
|
|
11373
|
+
Lt as P2WDAGenerator,
|
|
11374
|
+
gi as PSBTTypes,
|
|
11376
11375
|
Cr as QuantumBIP32Factory,
|
|
11377
11376
|
Fr as QuantumDerivationPath,
|
|
11378
|
-
|
|
11379
|
-
|
|
11377
|
+
hi as RoswellConsensus,
|
|
11378
|
+
gt as SCHNORR_SIGNATURE_BYTE_LENGTH,
|
|
11380
11379
|
ir as SELECTOR_BYTE_LENGTH,
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11380
|
+
Ie as SERIALIZATION_FORMAT_VERSION,
|
|
11381
|
+
Mt as SERIALIZATION_MAGIC_BYTE,
|
|
11382
|
+
He as Secp256k1PointDeriver,
|
|
11383
|
+
Ae as SharedInteractionTransaction,
|
|
11384
|
+
Je as SignatureType,
|
|
11385
|
+
bi as SigningProtocol,
|
|
11387
11386
|
Or as StrToAbiType,
|
|
11388
|
-
|
|
11389
|
-
|
|
11387
|
+
rt as TapscriptVerificator,
|
|
11388
|
+
q as TimeLockGenerator,
|
|
11390
11389
|
T as TransactionBuilder,
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11390
|
+
ni as TransactionFactory,
|
|
11391
|
+
pt as TransactionReconstructor,
|
|
11392
|
+
ii as TransactionSequence,
|
|
11394
11393
|
B as TransactionSerializer,
|
|
11395
|
-
|
|
11394
|
+
Z as TransactionStateCapture,
|
|
11396
11395
|
b as TransactionType,
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11396
|
+
fe as TweakedSigner,
|
|
11397
|
+
Jt as TweakedTransaction,
|
|
11398
|
+
Tt as U128_BYTE_LENGTH,
|
|
11399
|
+
yt as U16_BYTE_LENGTH,
|
|
11400
|
+
vt as U256_BYTE_LENGTH,
|
|
11401
|
+
St as U32_BYTE_LENGTH,
|
|
11402
|
+
Vt as U64_BYTE_LENGTH,
|
|
11403
|
+
zt as U8_BYTE_LENGTH,
|
|
11404
|
+
Qe as UnisatChainType,
|
|
11406
11405
|
Sr as UnisatSigner,
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11406
|
+
et as Wallet,
|
|
11407
|
+
Pt as WalletNetworks,
|
|
11408
|
+
mi as XverseNetwork,
|
|
11410
11409
|
_r as XverseSigner,
|
|
11411
|
-
|
|
11412
|
-
|
|
11410
|
+
Wt as abiTypeToSelectorString,
|
|
11411
|
+
Ge as buildBIPPath,
|
|
11413
11412
|
mr as createAddressRotation,
|
|
11414
|
-
|
|
11415
|
-
|
|
11413
|
+
ti as createSignerMap,
|
|
11414
|
+
Ee as currentConsensus,
|
|
11416
11415
|
Ir as currentConsensusConfig,
|
|
11417
11416
|
br as disabledAddressRotation,
|
|
11418
11417
|
dr as getBIPDescription,
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11418
|
+
oe as getLevelFromPublicKeyLength,
|
|
11419
|
+
Pe as isAbiStruct,
|
|
11420
|
+
yi as isAbiTuple,
|
|
11421
|
+
li as isCancelSpecificData,
|
|
11422
|
+
ui as isCustomScriptSpecificData,
|
|
11423
|
+
ai as isDeploymentSpecificData,
|
|
11424
|
+
oi as isFundingSpecificData,
|
|
11425
|
+
ci as isInteractionSpecificData,
|
|
11426
|
+
st as isMultiSigSpecificData,
|
|
11427
|
+
Ye as isOPWallet,
|
|
11428
|
+
wi as isSimpleAbiType,
|
|
11429
|
+
lt as isUniversalSigner,
|
|
11431
11430
|
Rr as opnet,
|
|
11432
11431
|
Ar as toParallelKeyPair,
|
|
11433
|
-
|
|
11432
|
+
ei as toTweakedParallelKeyPair,
|
|
11434
11433
|
$i as version,
|
|
11435
|
-
|
|
11434
|
+
$e as versionBuffer
|
|
11436
11435
|
};
|