@arkade-os/sdk 0.5.3 → 0.5.5

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.
Files changed (114) hide show
  1. package/README.md +138 -50
  2. package/dist/adapters/expo.cjs +10 -5
  3. package/dist/adapters/expo.d.cts +13 -8
  4. package/dist/adapters/expo.d.ts +13 -8
  5. package/dist/adapters/expo.js +4 -3
  6. package/dist/{asyncStorageTaskQueue-C9PkPcW_.d.cts → asyncStorageTaskQueue-BbH-THYJ.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-B3U5gQ-i.d.ts → asyncStorageTaskQueue-BlvkJyTa.d.ts} +2 -2
  8. package/dist/base-C-Y5t_0F.d.cts +359 -0
  9. package/dist/base-C-Y5t_0F.d.ts +359 -0
  10. package/dist/{chunk-OPX2HRWM.js → chunk-4I53THL6.js} +210 -937
  11. package/dist/chunk-4I53THL6.js.map +1 -0
  12. package/dist/{chunk-5WRA66RV.cjs → chunk-5SYUEVJH.cjs} +10 -10
  13. package/dist/chunk-5SYUEVJH.cjs.map +1 -0
  14. package/dist/{chunk-6FL4N4S2.js → chunk-7GIKLFHC.js} +83 -20
  15. package/dist/chunk-7GIKLFHC.js.map +1 -0
  16. package/dist/{chunk-BYPBVHVA.cjs → chunk-AMH7Q3DF.cjs} +61 -935
  17. package/dist/chunk-AMH7Q3DF.cjs.map +1 -0
  18. package/dist/{chunk-P7B4LQ3H.js → chunk-BCA6D255.js} +18 -842
  19. package/dist/chunk-BCA6D255.js.map +1 -0
  20. package/dist/{chunk-T7C3E2HL.js → chunk-CE46RS6L.js} +20 -39
  21. package/dist/chunk-CE46RS6L.js.map +1 -0
  22. package/dist/chunk-DNFTHG73.js +829 -0
  23. package/dist/chunk-DNFTHG73.js.map +1 -0
  24. package/dist/chunk-FDJ734CH.js +882 -0
  25. package/dist/chunk-FDJ734CH.js.map +1 -0
  26. package/dist/chunk-FLPWNMX3.cjs +930 -0
  27. package/dist/chunk-FLPWNMX3.cjs.map +1 -0
  28. package/dist/{chunk-Y4BL3YYX.js → chunk-FVVXCDNE.js} +4 -4
  29. package/dist/chunk-FVVXCDNE.js.map +1 -0
  30. package/dist/{chunk-ZPF4I3K2.cjs → chunk-HQQ4NRXI.cjs} +29 -47
  31. package/dist/chunk-HQQ4NRXI.cjs.map +1 -0
  32. package/dist/chunk-JFJNB7ZH.cjs +884 -0
  33. package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
  34. package/dist/{chunk-KW7ZEWYS.cjs → chunk-KCL5AVML.cjs} +223 -985
  35. package/dist/chunk-KCL5AVML.cjs.map +1 -0
  36. package/dist/{chunk-HAQAWBYG.js → chunk-OO2KEK64.js} +2860 -1366
  37. package/dist/chunk-OO2KEK64.js.map +1 -0
  38. package/dist/{chunk-OUTWUYJ4.cjs → chunk-T254PXSN.cjs} +3337 -1824
  39. package/dist/chunk-T254PXSN.cjs.map +1 -0
  40. package/dist/chunk-V3ZLL5VY.js +380 -0
  41. package/dist/chunk-V3ZLL5VY.js.map +1 -0
  42. package/dist/chunk-X6ZI53DZ.cjs +383 -0
  43. package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
  44. package/dist/{chunk-ZMSM3NOH.cjs → chunk-XWUCNMPN.cjs} +98 -34
  45. package/dist/chunk-XWUCNMPN.cjs.map +1 -0
  46. package/dist/compiler.cjs +50 -0
  47. package/dist/compiler.cjs.map +1 -0
  48. package/dist/compiler.d.cts +38 -0
  49. package/dist/compiler.d.ts +38 -0
  50. package/dist/compiler.js +47 -0
  51. package/dist/compiler.js.map +1 -0
  52. package/dist/contracts/handlers/index.cjs +11 -9
  53. package/dist/contracts/handlers/index.d.cts +6 -4
  54. package/dist/contracts/handlers/index.d.ts +6 -4
  55. package/dist/contracts/handlers/index.js +4 -2
  56. package/dist/{delegate-Cd28gxpM.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
  57. package/dist/{delegate-ByfKszb6.d.cts → delegate-iyDum4fw.d.ts} +1 -1
  58. package/dist/{index-B6X2E7W_.d.ts → index-BWwVnJhU.d.cts} +7 -272
  59. package/dist/{index-DgH_0j14.d.cts → index-Bx-iArDs.d.ts} +7 -272
  60. package/dist/{index-BURzbRup.d.cts → index-DCml4QJn.d.ts} +1090 -1140
  61. package/dist/{index-BURzbRup.d.ts → index-DkyzIzKL.d.cts} +1090 -1140
  62. package/dist/index.cjs +470 -371
  63. package/dist/index.d.cts +687 -410
  64. package/dist/index.d.ts +687 -410
  65. package/dist/index.js +7 -4
  66. package/dist/{wallet-BnmhohgZ.d.ts → keyringDescriptorProvider-CS4w4PWd.d.ts} +427 -372
  67. package/dist/{wallet-BjQugVUt.d.cts → keyringDescriptorProvider-CmHXrIXd.d.cts} +427 -372
  68. package/dist/program-BARSNg3X.d.ts +286 -0
  69. package/dist/program-znrWkxE4.d.cts +286 -0
  70. package/dist/repositories/realm/index.cjs +100 -51
  71. package/dist/repositories/realm/index.cjs.map +1 -1
  72. package/dist/repositories/realm/index.d.cts +25 -10
  73. package/dist/repositories/realm/index.d.ts +25 -10
  74. package/dist/repositories/realm/index.js +72 -24
  75. package/dist/repositories/realm/index.js.map +1 -1
  76. package/dist/repositories/sqlite/index.cjs +222 -131
  77. package/dist/repositories/sqlite/index.cjs.map +1 -1
  78. package/dist/repositories/sqlite/index.d.cts +36 -17
  79. package/dist/repositories/sqlite/index.d.ts +36 -17
  80. package/dist/repositories/sqlite/index.js +196 -107
  81. package/dist/repositories/sqlite/index.js.map +1 -1
  82. package/dist/{taskRunner-BaNCSxqK.d.ts → taskRunner-DgMLSk_O.d.ts} +4 -4
  83. package/dist/{taskRunner-i56-drQV.d.cts → taskRunner-buh6aFpG.d.cts} +4 -4
  84. package/dist/wallet/expo/background.cjs +17 -14
  85. package/dist/wallet/expo/background.cjs.map +1 -1
  86. package/dist/wallet/expo/background.d.cts +5 -4
  87. package/dist/wallet/expo/background.d.ts +5 -4
  88. package/dist/wallet/expo/background.js +10 -7
  89. package/dist/wallet/expo/background.js.map +1 -1
  90. package/dist/wallet/expo/index.cjs +29 -16
  91. package/dist/wallet/expo/index.cjs.map +1 -1
  92. package/dist/wallet/expo/index.d.cts +12 -7
  93. package/dist/wallet/expo/index.d.ts +12 -7
  94. package/dist/wallet/expo/index.js +20 -7
  95. package/dist/wallet/expo/index.js.map +1 -1
  96. package/dist/worker/expo/index.cjs +12 -9
  97. package/dist/worker/expo/index.cjs.map +1 -1
  98. package/dist/worker/expo/index.d.cts +6 -5
  99. package/dist/worker/expo/index.d.ts +6 -5
  100. package/dist/worker/expo/index.js +8 -5
  101. package/dist/worker/expo/index.js.map +1 -1
  102. package/package.json +16 -1
  103. package/dist/chunk-5WRA66RV.cjs.map +0 -1
  104. package/dist/chunk-6FL4N4S2.js.map +0 -1
  105. package/dist/chunk-BYPBVHVA.cjs.map +0 -1
  106. package/dist/chunk-HAQAWBYG.js.map +0 -1
  107. package/dist/chunk-KW7ZEWYS.cjs.map +0 -1
  108. package/dist/chunk-OPX2HRWM.js.map +0 -1
  109. package/dist/chunk-OUTWUYJ4.cjs.map +0 -1
  110. package/dist/chunk-P7B4LQ3H.js.map +0 -1
  111. package/dist/chunk-T7C3E2HL.js.map +0 -1
  112. package/dist/chunk-Y4BL3YYX.js.map +0 -1
  113. package/dist/chunk-ZMSM3NOH.cjs.map +0 -1
  114. package/dist/chunk-ZPF4I3K2.cjs.map +0 -1
@@ -1,904 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var utils_js = require('@scure/btc-signer/utils.js');
4
- var base = require('@scure/base');
5
- var script_js = require('@scure/btc-signer/script.js');
6
- var bip68 = require('bip68');
3
+ var chunkFLPWNMX3_cjs = require('./chunk-FLPWNMX3.cjs');
7
4
  var btcSigner = require('@scure/btc-signer');
8
- var payment_js = require('@scure/btc-signer/payment.js');
9
- var P = require('micro-packed');
10
5
  var psbt_js = require('@scure/btc-signer/psbt.js');
6
+ var utils_js = require('@scure/btc-signer/utils.js');
11
7
  var secp256k1_js = require('@noble/curves/secp256k1.js');
8
+ var base = require('@scure/base');
12
9
 
13
- function _interopNamespace(e) {
14
- if (e && e.__esModule) return e;
15
- var n = Object.create(null);
16
- if (e) {
17
- Object.keys(e).forEach(function (k) {
18
- if (k !== 'default') {
19
- var d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () { return e[k]; }
23
- });
24
- }
25
- });
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
-
31
- var bip68__namespace = /*#__PURE__*/_interopNamespace(bip68);
32
- var P__namespace = /*#__PURE__*/_interopNamespace(P);
33
-
34
- var __defProp = Object.defineProperty;
35
- var __export = (target, all) => {
36
- for (var name in all)
37
- __defProp(target, name, { get: all[name], enumerable: true });
38
- };
39
- var getNetwork = (network) => {
40
- const found = networks[network];
41
- if (!found) throw new Error(`Unsupported network: ${network}`);
42
- return found;
43
- };
44
- var networkFromArkadeInfo = (info) => getNetwork(info.network);
45
- var networks = {
46
- bitcoin: withArkPrefix(utils_js.NETWORK, "ark", "bitcoin"),
47
- testnet: withArkPrefix(utils_js.TEST_NETWORK, "tark", "testnet"),
48
- signet: withArkPrefix(utils_js.TEST_NETWORK, "tark", "signet"),
49
- mutinynet: withArkPrefix(utils_js.TEST_NETWORK, "tark", "mutinynet"),
50
- regtest: withArkPrefix(
51
- {
52
- ...utils_js.TEST_NETWORK,
53
- bech32: "bcrt",
54
- pubKeyHash: 111,
55
- scriptHash: 196
56
- },
57
- "tark",
58
- "regtest"
59
- )
60
- };
61
- function withArkPrefix(network, prefix, name) {
62
- return {
63
- ...network,
64
- hrp: prefix,
65
- name
66
- };
67
- }
68
- var DEFAULT_ARKADE_SERVER_URL = "https://arkade.computer";
69
- var DEFAULT_ARKADE_EMULATOR_URL = "https://emulator.arkade.computer";
70
- var DEFAULT_NETWORK = networks.bitcoin;
71
- var DEFAULT_NETWORK_NAME = "bitcoin";
72
- var COMPRESSED_PUBKEY = /^0[23][0-9a-f]{64}$/;
73
- var BITCOIN_EMULATOR_PUBKEY = "0239c196415da47b26456a101daaa12ba9e445bfe153197f1e2b750bf40e52092e";
74
- var MUTINYNET_EMULATOR_PUBKEY = "03f823b9b2febc81f4af967e77aed2f541cbd3397c6d8f5a72e32eb7b471af889a";
75
- var REGTEST_EMULATOR_PUBKEY = "02999413c46fa10ada5cbc4bcc79a1d09160c2ba3cfc812705d7a13e5e545fb2a9";
76
- var EMULATOR_PUBKEYS = {
77
- bitcoin: BITCOIN_EMULATOR_PUBKEY,
78
- mutinynet: MUTINYNET_EMULATOR_PUBKEY,
79
- regtest: REGTEST_EMULATOR_PUBKEY
80
- };
81
- function defaultEmulatorPubkey(network) {
82
- const pinned = network.name ? EMULATOR_PUBKEYS[network.name] : void 0;
83
- if (!pinned) {
84
- const cause = network.name ? `no emulator is deployed for ${network.name}` : `this Network carries no name, so it cannot be matched (build it with getNetwork(...) rather than by hand)`;
85
- throw new Error(
86
- `No emulator co-signer key is pinned for this network: ${cause}; pass emulatorPubkey: "<33-byte compressed hex>" to Arkade.connect to co-sign with your own emulator instead. Pinned networks: ${Object.keys(EMULATOR_PUBKEYS).join(", ")}`
87
- );
88
- }
89
- return pinned;
90
- }
91
- function resolveEmulatorPubkey(network, override) {
92
- if (override === void 0) return defaultEmulatorPubkey(network);
93
- if (!COMPRESSED_PUBKEY.test(override)) {
94
- throw new Error(
95
- `Emulator pubkey override must be 33-byte compressed secp256k1 hex (66 lowercase chars, 02/03 prefix), got ${JSON.stringify(override)}.`
96
- );
97
- }
98
- return override;
99
- }
100
- var ArkAddress = class _ArkAddress {
101
- /**
102
- * Create an Arkade address from its server public key, Taproot output key, and prefix.
103
- *
104
- * @param serverPubKey - 32-byte Arkade server public key
105
- * @param vtxoTaprootKey - 32-byte Taproot output key (a.k.a. tweaked public key)
106
- * @param hrp - Bech32 human-readable prefix
107
- * @param version - Address version byte
108
- * @defaultValue `version = 0`
109
- * @throws Error if either public key is not 32 bytes long
110
- */
111
- constructor(serverPubKey, vtxoTaprootKey, hrp = DEFAULT_NETWORK.hrp, version2 = 0) {
112
- this.serverPubKey = serverPubKey;
113
- this.vtxoTaprootKey = vtxoTaprootKey;
114
- this.hrp = hrp;
115
- this.version = version2;
116
- if (serverPubKey.length !== 32) {
117
- throw new Error(
118
- "Invalid server public key length, expected 32 bytes, got " + serverPubKey.length
119
- );
120
- }
121
- if (vtxoTaprootKey.length !== 32) {
122
- throw new Error(
123
- "Invalid vtxo taproot public key length, expected 32 bytes, got " + vtxoTaprootKey.length
124
- );
125
- }
126
- }
127
- serverPubKey;
128
- vtxoTaprootKey;
129
- hrp;
130
- version;
131
- /**
132
- * Decode an Arkade address from its bech32m string form.
133
- *
134
- * @param address - Bech32m-encoded Arkade address
135
- * @returns Decoded Arkade address
136
- * @throws Error if the address is malformed or has an invalid payload length
137
- * @see encode
138
- */
139
- static decode(address) {
140
- const decoded = base.bech32m.decodeUnsafe(address, 1023);
141
- if (!decoded) {
142
- throw new Error("Invalid address");
143
- }
144
- const data = new Uint8Array(base.bech32m.fromWords(decoded.words));
145
- if (data.length !== 1 + 32 + 32) {
146
- throw new Error("Invalid data length, expected 65 bytes, got " + data.length);
147
- }
148
- const version2 = data[0];
149
- const serverPubKey = data.slice(1, 33);
150
- const vtxoTaprootPubKey = data.slice(33, 65);
151
- return new _ArkAddress(serverPubKey, vtxoTaprootPubKey, decoded.prefix, version2);
152
- }
153
- /**
154
- * Encode the address to its bech32m string form.
155
- *
156
- * @returns Bech32m-encoded Arkade address
157
- * @see decode
158
- */
159
- encode() {
160
- const data = new Uint8Array(1 + 32 + 32);
161
- data[0] = this.version;
162
- data.set(this.serverPubKey, 1);
163
- data.set(this.vtxoTaprootKey, 33);
164
- const words = base.bech32m.toWords(data);
165
- return base.bech32m.encode(this.hrp, words, 1023);
166
- }
167
- /** ScriptPubKey used to send non-dust funds to the address. */
168
- get pkScript() {
169
- return script_js.Script.encode(["OP_1", this.vtxoTaprootKey]);
170
- }
171
- /** ScriptPubKey used to send sub-dust funds to the address. */
172
- get subdustPkScript() {
173
- return script_js.Script.encode(["RETURN", this.vtxoTaprootKey]);
174
- }
175
- };
176
- function timelockToSequence(timelock) {
177
- return bip68__namespace.encode(
178
- timelock.type === "blocks" ? { blocks: Number(timelock.value) } : { seconds: Number(timelock.value) }
179
- );
180
- }
181
- function sequenceToTimelock(sequence) {
182
- const decoded = bip68__namespace.decode(sequence);
183
- if ("blocks" in decoded && decoded.blocks !== void 0) {
184
- return { type: "blocks", value: BigInt(decoded.blocks) };
185
- }
186
- if ("seconds" in decoded && decoded.seconds !== void 0) {
187
- return { type: "seconds", value: BigInt(decoded.seconds) };
188
- }
189
- throw new Error(`Invalid BIP68 sequence: ${sequence}`);
190
- }
191
- function sequenceToCanonicalTimelock(sequence) {
192
- if (sequence < 0n || sequence >= 0x80000000n) return void 0;
193
- const timelock = sequenceToTimelock(Number(sequence));
194
- return BigInt(timelockToSequence(timelock)) === sequence ? timelock : void 0;
195
- }
196
- var MinimalScriptNum = btcSigner.ScriptNum(void 0, true);
197
- function decodeTapscript(script) {
198
- const types = [
199
- exports.MultisigTapscript,
200
- exports.CSVMultisigTapscript,
201
- exports.ConditionCSVMultisigTapscript,
202
- exports.ConditionMultisigTapscript,
203
- exports.CLTVMultisigTapscript
204
- ];
205
- for (const type of types) {
206
- try {
207
- return type.decode(script);
208
- } catch (error) {
209
- continue;
210
- }
211
- }
212
- throw new Error(`Failed to decode: script ${base.hex.encode(script)} is not a valid tapscript`);
213
- }
214
- exports.MultisigTapscript = void 0;
215
- ((MultisigTapscript2) => {
216
- ((MultisigType2) => {
217
- MultisigType2[MultisigType2["CHECKSIG"] = 0] = "CHECKSIG";
218
- MultisigType2[MultisigType2["CHECKSIGADD"] = 1] = "CHECKSIGADD";
219
- })(MultisigTapscript2.MultisigType || (MultisigTapscript2.MultisigType = {}));
220
- function encode2(params) {
221
- if (params.pubkeys.length === 0) {
222
- throw new Error("At least 1 pubkey is required");
223
- }
224
- for (const pubkey of params.pubkeys) {
225
- if (pubkey.length !== 32) {
226
- throw new Error(`Invalid pubkey length: expected 32, got ${pubkey.length}`);
227
- }
228
- }
229
- if (!params.type) {
230
- params.type = 0 /* CHECKSIG */;
231
- }
232
- if (params.type === 1 /* CHECKSIGADD */) {
233
- return {
234
- type: "multisig" /* Multisig */,
235
- params,
236
- script: btcSigner.p2tr_ms(params.pubkeys.length, params.pubkeys).script
237
- };
238
- }
239
- const asm = [];
240
- for (let i = 0; i < params.pubkeys.length; i++) {
241
- asm.push(params.pubkeys[i]);
242
- if (i < params.pubkeys.length - 1) {
243
- asm.push("CHECKSIGVERIFY");
244
- } else {
245
- asm.push("CHECKSIG");
246
- }
247
- }
248
- return {
249
- type: "multisig" /* Multisig */,
250
- params,
251
- script: btcSigner.Script.encode(asm)
252
- };
253
- }
254
- MultisigTapscript2.encode = encode2;
255
- function decode2(script) {
256
- if (script.length === 0) {
257
- throw new Error("Failed to decode: script is empty");
258
- }
259
- try {
260
- return decodeChecksigAdd(script);
261
- } catch (error) {
262
- try {
263
- return decodeChecksig(script);
264
- } catch (error2) {
265
- throw new Error(
266
- `Failed to decode script: ${error2 instanceof Error ? error2.message : String(error2)}`
267
- );
268
- }
269
- }
270
- }
271
- MultisigTapscript2.decode = decode2;
272
- function decodeChecksigAdd(script) {
273
- const asm = btcSigner.Script.decode(script);
274
- const pubkeys = [];
275
- let foundNumEqual = false;
276
- for (let i = 0; i < asm.length; i++) {
277
- const op = asm[i];
278
- if (typeof op !== "string" && typeof op !== "number") {
279
- if (op.length !== 32) {
280
- throw new Error(`Invalid pubkey length: expected 32, got ${op.length}`);
281
- }
282
- pubkeys.push(op);
283
- if (i + 1 >= asm.length || asm[i + 1] !== "CHECKSIGADD" && asm[i + 1] !== "CHECKSIG") {
284
- throw new Error("Expected CHECKSIGADD or CHECKSIG after pubkey");
285
- }
286
- i++;
287
- continue;
288
- }
289
- if (i === asm.length - 1) {
290
- if (op !== "NUMEQUAL") {
291
- throw new Error("Expected NUMEQUAL at end of script");
292
- }
293
- foundNumEqual = true;
294
- }
295
- }
296
- if (!foundNumEqual) {
297
- throw new Error("Missing NUMEQUAL operation");
298
- }
299
- if (pubkeys.length === 0) {
300
- throw new Error("Invalid script: must have at least 1 pubkey");
301
- }
302
- const reconstructed = encode2({
303
- pubkeys,
304
- type: 1 /* CHECKSIGADD */
305
- });
306
- if (base.hex.encode(reconstructed.script) !== base.hex.encode(script)) {
307
- throw new Error("Invalid script format: script reconstruction mismatch");
308
- }
309
- return {
310
- type: "multisig" /* Multisig */,
311
- params: { pubkeys, type: 1 /* CHECKSIGADD */ },
312
- script
313
- };
314
- }
315
- function decodeChecksig(script) {
316
- const asm = btcSigner.Script.decode(script);
317
- const pubkeys = [];
318
- for (let i = 0; i < asm.length; i++) {
319
- const op = asm[i];
320
- if (typeof op !== "string" && typeof op !== "number") {
321
- if (op.length !== 32) {
322
- throw new Error(`Invalid pubkey length: expected 32, got ${op.length}`);
323
- }
324
- pubkeys.push(op);
325
- if (i + 1 >= asm.length) {
326
- throw new Error("Unexpected end of script");
327
- }
328
- const nextOp = asm[i + 1];
329
- if (nextOp !== "CHECKSIGVERIFY" && nextOp !== "CHECKSIG") {
330
- throw new Error("Expected CHECKSIGVERIFY or CHECKSIG after pubkey");
331
- }
332
- if (i === asm.length - 2 && nextOp !== "CHECKSIG") {
333
- throw new Error("Last operation must be CHECKSIG");
334
- }
335
- i++;
336
- continue;
337
- }
338
- }
339
- if (pubkeys.length === 0) {
340
- throw new Error("Invalid script: must have at least 1 pubkey");
341
- }
342
- const reconstructed = encode2({ pubkeys, type: 0 /* CHECKSIG */ });
343
- if (base.hex.encode(reconstructed.script) !== base.hex.encode(script)) {
344
- throw new Error("Invalid script format: script reconstruction mismatch");
345
- }
346
- return {
347
- type: "multisig" /* Multisig */,
348
- params: { pubkeys, type: 0 /* CHECKSIG */ },
349
- script
350
- };
351
- }
352
- function is(tapscript) {
353
- return tapscript.type === "multisig" /* Multisig */;
354
- }
355
- MultisigTapscript2.is = is;
356
- })(exports.MultisigTapscript || (exports.MultisigTapscript = {}));
357
- exports.CSVMultisigTapscript = void 0;
358
- ((CSVMultisigTapscript2) => {
359
- function encode2(params) {
360
- for (const pubkey of params.pubkeys) {
361
- if (pubkey.length !== 32) {
362
- throw new Error(`Invalid pubkey length: expected 32, got ${pubkey.length}`);
363
- }
364
- }
365
- const sequence = MinimalScriptNum.encode(BigInt(timelockToSequence(params.timelock)));
366
- const asm = [
367
- sequence.length === 1 ? sequence[0] : sequence,
368
- "CHECKSEQUENCEVERIFY",
369
- "DROP"
370
- ];
371
- const multisigScript = exports.MultisigTapscript.encode(params);
372
- const script = new Uint8Array([...btcSigner.Script.encode(asm), ...multisigScript.script]);
373
- return {
374
- type: "csv-multisig" /* CSVMultisig */,
375
- params,
376
- script
377
- };
378
- }
379
- CSVMultisigTapscript2.encode = encode2;
380
- function decode2(script) {
381
- if (script.length === 0) {
382
- throw new Error("Failed to decode: script is empty");
383
- }
384
- const isValid = isScriptValid(script);
385
- if (isValid instanceof Error) {
386
- throw isValid;
387
- }
388
- const asm = btcSigner.Script.decode(script);
389
- const sequence = asm[0];
390
- const multisigScript = new Uint8Array(btcSigner.Script.encode(asm.slice(3)));
391
- let multisig;
392
- try {
393
- multisig = exports.MultisigTapscript.decode(multisigScript);
394
- } catch (error) {
395
- throw new Error(
396
- `Invalid multisig script: ${error instanceof Error ? error.message : String(error)}`
397
- );
398
- }
399
- let sequenceNum;
400
- if (typeof sequence === "number") {
401
- sequenceNum = sequence;
402
- } else {
403
- sequenceNum = Number(MinimalScriptNum.decode(sequence));
404
- }
405
- const timelock = sequenceToTimelock(sequenceNum);
406
- const reconstructed = encode2({
407
- timelock,
408
- ...multisig.params
409
- });
410
- if (base.hex.encode(reconstructed.script) !== base.hex.encode(script)) {
411
- throw new Error("Invalid script format: script reconstruction mismatch");
412
- }
413
- return {
414
- type: "csv-multisig" /* CSVMultisig */,
415
- params: {
416
- timelock,
417
- ...multisig.params
418
- },
419
- script
420
- };
421
- }
422
- CSVMultisigTapscript2.decode = decode2;
423
- function is(tapscript) {
424
- return tapscript.type === "csv-multisig" /* CSVMultisig */;
425
- }
426
- CSVMultisigTapscript2.is = is;
427
- function isScriptValid(script) {
428
- const asm = btcSigner.Script.decode(script);
429
- if (asm.length < 3) {
430
- return new Error(`Invalid script: too short (expected at least 3)`);
431
- }
432
- const sequence = asm[0];
433
- if (typeof sequence === "string") {
434
- return new Error("Invalid script: expected sequence number");
435
- }
436
- if (asm[1] !== "CHECKSEQUENCEVERIFY" || asm[2] !== "DROP") {
437
- return new Error("Invalid script: expected CHECKSEQUENCEVERIFY DROP");
438
- }
439
- return true;
440
- }
441
- CSVMultisigTapscript2.isScriptValid = isScriptValid;
442
- })(exports.CSVMultisigTapscript || (exports.CSVMultisigTapscript = {}));
443
- function isConditionScriptValid(script) {
444
- const asm = btcSigner.Script.decode(script);
445
- if (asm.length < 1) {
446
- return new Error(`Invalid script: too short (expected at least 1)`);
447
- }
448
- if (asm.lastIndexOf("VERIFY") === -1) {
449
- return new Error("Invalid script: missing VERIFY operation");
450
- }
451
- return true;
452
- }
453
- exports.ConditionCSVMultisigTapscript = void 0;
454
- ((ConditionCSVMultisigTapscript2) => {
455
- function encode2(params) {
456
- const script = new Uint8Array([
457
- ...params.conditionScript,
458
- ...btcSigner.Script.encode(["VERIFY"]),
459
- ...exports.CSVMultisigTapscript.encode(params).script
460
- ]);
461
- return {
462
- type: "condition-csv-multisig" /* ConditionCSVMultisig */,
463
- params,
464
- script
465
- };
466
- }
467
- ConditionCSVMultisigTapscript2.encode = encode2;
468
- function decode2(script) {
469
- if (script.length === 0) {
470
- throw new Error("Failed to decode: script is empty");
471
- }
472
- const isValid = isScriptValid(script);
473
- if (isValid instanceof Error) {
474
- throw isValid;
475
- }
476
- const asm = btcSigner.Script.decode(script);
477
- const verifyIndex = asm.lastIndexOf("VERIFY");
478
- if (verifyIndex === -1) {
479
- throw Error("Invalid script: missing VERIFY operation");
480
- }
481
- const conditionScript = new Uint8Array(btcSigner.Script.encode(asm.slice(0, verifyIndex)));
482
- const csvMultisigScript = new Uint8Array(btcSigner.Script.encode(asm.slice(verifyIndex + 1)));
483
- let csvMultisig;
484
- try {
485
- csvMultisig = exports.CSVMultisigTapscript.decode(csvMultisigScript);
486
- } catch (error) {
487
- throw new Error(
488
- `Invalid CSV multisig script: ${error instanceof Error ? error.message : String(error)}`
489
- );
490
- }
491
- const reconstructed = encode2({
492
- conditionScript,
493
- ...csvMultisig.params
494
- });
495
- if (base.hex.encode(reconstructed.script) !== base.hex.encode(script)) {
496
- throw new Error("Invalid script format: script reconstruction mismatch");
497
- }
498
- return {
499
- type: "condition-csv-multisig" /* ConditionCSVMultisig */,
500
- params: {
501
- conditionScript,
502
- ...csvMultisig.params
503
- },
504
- script
505
- };
506
- }
507
- ConditionCSVMultisigTapscript2.decode = decode2;
508
- function is(tapscript) {
509
- return tapscript.type === "condition-csv-multisig" /* ConditionCSVMultisig */;
510
- }
511
- ConditionCSVMultisigTapscript2.is = is;
512
- function isScriptValid(script) {
513
- return isConditionScriptValid(script);
514
- }
515
- ConditionCSVMultisigTapscript2.isScriptValid = isScriptValid;
516
- })(exports.ConditionCSVMultisigTapscript || (exports.ConditionCSVMultisigTapscript = {}));
517
- exports.ConditionMultisigTapscript = void 0;
518
- ((ConditionMultisigTapscript2) => {
519
- function encode2(params) {
520
- const script = new Uint8Array([
521
- ...params.conditionScript,
522
- ...btcSigner.Script.encode(["VERIFY"]),
523
- ...exports.MultisigTapscript.encode(params).script
524
- ]);
525
- return {
526
- type: "condition-multisig" /* ConditionMultisig */,
527
- params,
528
- script
529
- };
530
- }
531
- ConditionMultisigTapscript2.encode = encode2;
532
- function decode2(script) {
533
- if (script.length === 0) {
534
- throw new Error("Failed to decode: script is empty");
535
- }
536
- const isValid = isScriptValid(script);
537
- if (isValid instanceof Error) {
538
- throw isValid;
539
- }
540
- const asm = btcSigner.Script.decode(script);
541
- const verifyIndex = asm.lastIndexOf("VERIFY");
542
- if (verifyIndex === -1) {
543
- throw Error("Invalid script: missing VERIFY operation");
544
- }
545
- const conditionScript = new Uint8Array(btcSigner.Script.encode(asm.slice(0, verifyIndex)));
546
- const multisigScript = new Uint8Array(btcSigner.Script.encode(asm.slice(verifyIndex + 1)));
547
- let multisig;
548
- try {
549
- multisig = exports.MultisigTapscript.decode(multisigScript);
550
- } catch (error) {
551
- throw new Error(
552
- `Invalid multisig script: ${error instanceof Error ? error.message : String(error)}`
553
- );
554
- }
555
- const reconstructed = encode2({
556
- conditionScript,
557
- ...multisig.params
558
- });
559
- if (base.hex.encode(reconstructed.script) !== base.hex.encode(script)) {
560
- throw new Error("Invalid script format: script reconstruction mismatch");
561
- }
562
- return {
563
- type: "condition-multisig" /* ConditionMultisig */,
564
- params: {
565
- conditionScript,
566
- ...multisig.params
567
- },
568
- script
569
- };
570
- }
571
- ConditionMultisigTapscript2.decode = decode2;
572
- function is(tapscript) {
573
- return tapscript.type === "condition-multisig" /* ConditionMultisig */;
574
- }
575
- ConditionMultisigTapscript2.is = is;
576
- function isScriptValid(script) {
577
- return isConditionScriptValid(script);
578
- }
579
- ConditionMultisigTapscript2.isScriptValid = isScriptValid;
580
- })(exports.ConditionMultisigTapscript || (exports.ConditionMultisigTapscript = {}));
581
- exports.CLTVMultisigTapscript = void 0;
582
- ((CLTVMultisigTapscript2) => {
583
- function encode2(params) {
584
- const locktime = MinimalScriptNum.encode(params.absoluteTimelock);
585
- const asm = [
586
- locktime.length === 1 ? locktime[0] : locktime,
587
- "CHECKLOCKTIMEVERIFY",
588
- "DROP"
589
- ];
590
- const timelockedScript = btcSigner.Script.encode(asm);
591
- const script = new Uint8Array([
592
- ...timelockedScript,
593
- ...exports.MultisigTapscript.encode(params).script
594
- ]);
595
- return {
596
- type: "cltv-multisig" /* CLTVMultisig */,
597
- params,
598
- script
599
- };
600
- }
601
- CLTVMultisigTapscript2.encode = encode2;
602
- function decode2(script) {
603
- if (script.length === 0) {
604
- throw new Error("Failed to decode: script is empty");
605
- }
606
- const isValid = isScriptValid(script);
607
- if (isValid instanceof Error) {
608
- throw isValid;
609
- }
610
- const asm = btcSigner.Script.decode(script);
611
- const locktime = asm[0];
612
- if (typeof locktime === "string") {
613
- throw new Error("Invalid script: expected locktime number");
614
- }
615
- if (asm[1] !== "CHECKLOCKTIMEVERIFY" || asm[2] !== "DROP") {
616
- throw new Error("Invalid script: expected CHECKLOCKTIMEVERIFY DROP");
617
- }
618
- const multisigScript = new Uint8Array(btcSigner.Script.encode(asm.slice(3)));
619
- let multisig;
620
- try {
621
- multisig = exports.MultisigTapscript.decode(multisigScript);
622
- } catch (error) {
623
- throw new Error(
624
- `Invalid multisig script: ${error instanceof Error ? error.message : String(error)}`
625
- );
626
- }
627
- let absoluteTimelock;
628
- if (typeof locktime === "number") {
629
- absoluteTimelock = BigInt(locktime);
630
- } else {
631
- absoluteTimelock = MinimalScriptNum.decode(locktime);
632
- }
633
- const reconstructed = encode2({
634
- absoluteTimelock,
635
- ...multisig.params
636
- });
637
- if (base.hex.encode(reconstructed.script) !== base.hex.encode(script)) {
638
- throw new Error("Invalid script format: script reconstruction mismatch");
639
- }
640
- return {
641
- type: "cltv-multisig" /* CLTVMultisig */,
642
- params: {
643
- absoluteTimelock,
644
- ...multisig.params
645
- },
646
- script
647
- };
648
- }
649
- CLTVMultisigTapscript2.decode = decode2;
650
- function is(tapscript) {
651
- return tapscript.type === "cltv-multisig" /* CLTVMultisig */;
652
- }
653
- CLTVMultisigTapscript2.is = is;
654
- function isScriptValid(script) {
655
- const asm = btcSigner.Script.decode(script);
656
- if (asm.length < 3) {
657
- return new Error(`Invalid script: too short (expected at least 3)`);
658
- }
659
- const locktime = asm[0];
660
- if (typeof locktime === "string") {
661
- return new Error("Invalid script: expected locktime as number or bytes");
662
- }
663
- if (asm[1] !== "CHECKLOCKTIMEVERIFY" || asm[2] !== "DROP") {
664
- return new Error("Invalid script: expected CHECKLOCKTIMEVERIFY DROP");
665
- }
666
- return true;
667
- }
668
- CLTVMultisigTapscript2.isScriptValid = isScriptValid;
669
- })(exports.CLTVMultisigTapscript || (exports.CLTVMultisigTapscript = {}));
670
- function assembleBtcdTaprootTree(scripts) {
671
- if (scripts.length === 0) {
672
- throw new Error("assembleBtcdTaprootTree: empty scripts list");
673
- }
674
- const leaves = scripts.map((script) => ({
675
- script,
676
- leafVersion: payment_js.TAP_LEAF_VERSION
677
- }));
678
- if (leaves.length === 1) {
679
- return leaves[0];
680
- }
681
- const branches = [];
682
- for (let i = 0; i < leaves.length; i += 2) {
683
- if (i === leaves.length - 1) {
684
- const last = branches.pop();
685
- if (last === void 0) {
686
- throw new Error(
687
- `assembleBtcdTaprootTree: unexpected odd leaf at i=${i} with no prior branch`
688
- );
689
- }
690
- branches.push([last, leaves[i]]);
691
- } else {
692
- branches.push([leaves[i], leaves[i + 1]]);
693
- }
694
- }
695
- while (branches.length >= 2) {
696
- const left = branches.shift();
697
- const right = branches.shift();
698
- branches.push([left, right]);
699
- }
700
- return branches[0];
701
- }
702
- function btcdLeafLayout(count) {
703
- const placeholders = Array.from({ length: count }, () => new Uint8Array());
704
- const indexOf = new Map(placeholders.map((script, index) => [script, index]));
705
- const layout = [];
706
- const walk = (node, depth) => {
707
- if (Array.isArray(node)) {
708
- walk(node[0], depth + 1);
709
- walk(node[1], depth + 1);
710
- } else {
711
- layout.push({ index: indexOf.get(node.script), depth });
712
- }
713
- };
714
- walk(assembleBtcdTaprootTree(placeholders), 0);
715
- return layout;
716
- }
717
- var TapTreeCoder = P__namespace.array(
718
- null,
719
- P__namespace.struct({ depth: P__namespace.U8, version: P__namespace.U8, script: script_js.VarBytes })
720
- );
721
- function scriptFromTapLeafScript(leaf) {
722
- return leaf[1].subarray(0, leaf[1].length - 1);
723
- }
724
- var VtxoScript = class _VtxoScript {
725
- /**
726
- * Create a virtual output script from its tapleaf scripts.
727
- *
728
- * The Taproot script tree is assembled using btcd's algorithm
729
- * (`txscript.AssembleTaprootScriptTree`) so the derived taproot output
730
- * key agrees with arkd for any leaf count. `@scure/btc-signer`'s
731
- * default `taprootListToTree` is a Huffman builder that only agrees
732
- * with arkd for power-of-2 leaf counts.
733
- *
734
- * @param scripts - Raw tapscript bytes for each leaf
735
- * @throws Error if the provided leaves cannot produce a valid Taproot tree
736
- */
737
- constructor(scripts) {
738
- this.scripts = scripts;
739
- const tapTree = assembleBtcdTaprootTree(scripts);
740
- const payment = btcSigner.p2tr(btcSigner.taprootNumsKey(), tapTree, void 0, true);
741
- if (!payment.tapLeafScript || payment.tapLeafScript.length !== scripts.length) {
742
- throw new Error("invalid scripts");
743
- }
744
- this.leaves = payment.tapLeafScript;
745
- this.tweakedPublicKey = payment.tweakedPubkey;
746
- this.pkScript = payment.script;
747
- }
748
- scripts;
749
- leaves;
750
- tweakedPublicKey;
751
- pkScript;
752
- /**
753
- * Decode a virtual output script from an encoded TapTree.
754
- *
755
- * Leaves are normally read in construction order and their depths
756
- * ignored: that covers the {@link encode} form (every depth 1) and the
757
- * placeholder depths other writers use, such as arkd's. The exception is
758
- * the BIP-371 form {@link toBIP371TapTree} writes, whose leaves are in the
759
- * tree's DFS order: for some leaf counts (6, 7, 10, ...) that differs from
760
- * construction order. A tree whose depths are exactly the shape
761
- * `assembleBtcdTaprootTree` builds is that form, so its leaves are mapped
762
- * back to construction order first. No construction-order writer produces
763
- * that depth sequence when the two orders differ, so this never reorders
764
- * a tree that decoded correctly before.
765
- *
766
- * Every leaf must carry the base tapscript version: the tree is rebuilt
767
- * with {@link TAP_LEAF_VERSION} leaves, so any other version would
768
- * silently derive a different taproot key.
769
- *
770
- * @param tapTree - Encoded TapTree bytes
771
- * @returns Decoded virtual output script
772
- * @throws Error if the TapTree cannot be decoded into a valid script set
773
- * or a leaf carries a version other than {@link TAP_LEAF_VERSION}
774
- * @see encode
775
- */
776
- static decode(tapTree) {
777
- const leaves = TapTreeCoder.decode(tapTree);
778
- const foreign = leaves.find((leaf) => leaf.version !== payment_js.TAP_LEAF_VERSION);
779
- if (foreign) {
780
- throw new Error(`unsupported tap leaf version 0x${foreign.version.toString(16)}`);
781
- }
782
- const scripts = leaves.map((leaf) => leaf.script);
783
- if (leaves.every((leaf) => leaf.depth === 1)) {
784
- return new _VtxoScript(scripts);
785
- }
786
- const layout = btcdLeafLayout(leaves.length);
787
- if (layout.some((slot, i) => slot.depth !== leaves[i].depth)) {
788
- return new _VtxoScript(scripts);
789
- }
790
- const ordered = new Array(leaves.length);
791
- layout.forEach((slot, i) => {
792
- ordered[slot.index] = scripts[i];
793
- });
794
- return new _VtxoScript(ordered);
795
- }
796
- /**
797
- * Encode the virtual output script to a TapTree byte representation.
798
- *
799
- * @returns Encoded TapTree bytes
800
- * @see decode
801
- */
802
- encode() {
803
- const tapTree = TapTreeCoder.encode(
804
- this.scripts.map((script) => ({
805
- depth: 1,
806
- version: payment_js.TAP_LEAF_VERSION,
807
- script
808
- }))
809
- );
810
- return tapTree;
811
- }
812
- /**
813
- * Build the Arkade address corresponding to this virtual output script.
814
- *
815
- * @param prefix - Bech32 human-readable prefix
816
- * @param serverPubKey - 32-byte Arkade server public key
817
- * @returns Arkade address for this script
818
- * @see ArkAddress
819
- */
820
- address(prefix = DEFAULT_NETWORK.hrp, serverPubKey) {
821
- return new ArkAddress(serverPubKey, this.tweakedPublicKey, prefix);
822
- }
823
- /**
824
- * Build the Taproot onchain address corresponding to this virtual output script.
825
- *
826
- * @param network - Bitcoin network descriptor
827
- * @returns Taproot onchain address
828
- * @see address
829
- */
830
- onchainAddress(network = DEFAULT_NETWORK) {
831
- return btcSigner.Address(network).encode({
832
- type: "tr",
833
- pubkey: this.tweakedPublicKey
834
- });
835
- }
836
- /**
837
- * Look up a tapleaf script by its hex-encoded tapscript body.
838
- *
839
- * @param scriptHex - Hex-encoded tapscript body without the leaf version byte
840
- * @returns Matching tapleaf script
841
- * @throws Error if no matching leaf exists
842
- */
843
- findLeaf(scriptHex) {
844
- const leaf = this.leaves.find(
845
- (leaf2) => base.hex.encode(scriptFromTapLeafScript(leaf2)) === scriptHex
846
- );
847
- if (!leaf) {
848
- throw new Error(`leaf '${scriptHex}' not found`);
849
- }
850
- return leaf;
851
- }
852
- /**
853
- * Return all unilateral exit paths embedded in the virtual output script.
854
- *
855
- * @returns CSV-based exit paths found in the leaves
856
- * @see getSequence
857
- */
858
- exitPaths() {
859
- const paths = [];
860
- for (const leaf of this.leaves) {
861
- try {
862
- const script = scriptFromTapLeafScript(leaf);
863
- if (exports.CSVMultisigTapscript.isScriptValid(script) === true) {
864
- const tapScript = exports.CSVMultisigTapscript.decode(script);
865
- paths.push(tapScript);
866
- } else if (exports.ConditionCSVMultisigTapscript.isScriptValid(script) === true) {
867
- const tapScript = exports.ConditionCSVMultisigTapscript.decode(script);
868
- paths.push(tapScript);
869
- }
870
- } catch (e) {
871
- console.debug("Failed to decode script", e);
872
- }
873
- }
874
- return paths;
875
- }
876
- };
877
- function toBIP371TapTree(tapTree) {
878
- const scripts = TapTreeCoder.decode(tapTree).map((leaf) => leaf.script);
879
- const vtxoScript = new VtxoScript(scripts);
880
- return vtxoScript.leaves.map((leaf) => ({
881
- depth: leaf[0].merklePath.length,
882
- version: payment_js.TAP_LEAF_VERSION,
883
- script: scriptFromTapLeafScript(leaf)
884
- }));
885
- }
886
- function getSequence(tapLeafScript) {
887
- let sequence = void 0;
888
- try {
889
- const scriptWithLeafVersion = tapLeafScript[1];
890
- const script = scriptWithLeafVersion.subarray(0, scriptWithLeafVersion.length - 1);
891
- try {
892
- const params = exports.CSVMultisigTapscript.decode(script).params;
893
- sequence = timelockToSequence(params.timelock);
894
- } catch {
895
- const params = exports.CLTVMultisigTapscript.decode(script).params;
896
- sequence = Number(params.absoluteTimelock);
897
- }
898
- } catch {
899
- }
900
- return sequence;
901
- }
902
10
  var Transaction = class extends btcSigner.Transaction {
903
11
  static ARK_TX_OPTS = {
904
12
  unknown: "ignore",
@@ -962,13 +70,13 @@ function legacyTapTreeToBIP371(value) {
962
70
  }
963
71
  let leaves;
964
72
  try {
965
- leaves = TapTreeCoder.decode(value);
73
+ leaves = chunkFLPWNMX3_cjs.TapTreeCoder.decode(value);
966
74
  } catch {
967
75
  return void 0;
968
76
  }
969
77
  if (leaves.length === 0 || leaves.some((leaf) => leaf.depth !== 1)) return void 0;
970
78
  try {
971
- return TapTreeCoder.encode(toBIP371TapTree(value));
79
+ return chunkFLPWNMX3_cjs.TapTreeCoder.encode(chunkFLPWNMX3_cjs.toBIP371TapTree(value));
972
80
  } catch {
973
81
  return void 0;
974
82
  }
@@ -1169,7 +277,7 @@ var VtxoTreeExpiry = {
1169
277
  if (!checkKeyMatch(unknown[0], "expiry" /* VtxoTreeExpiry */)) return null;
1170
278
  const v = btcSigner.ScriptNum(6, true).decode(unknown[1]);
1171
279
  if (!v) return null;
1172
- return sequenceToTimelock(Number(v));
280
+ return chunkFLPWNMX3_cjs.sequenceToTimelock(Number(v));
1173
281
  })
1174
282
  };
1175
283
  var encodedPsbtFieldKey = Object.fromEntries(
@@ -1193,32 +301,8 @@ function checkKeyMatch(key, arkPsbtFieldKey, prefixOnly = false) {
1193
301
  return true;
1194
302
  }
1195
303
 
1196
- // src/providers/eventSource.ts
1197
- var GUIDANCE = "Pass one with configureEventSource(url => new EventSource(url)) \u2014 in Node, from the `eventsource` package or by running with --experimental-eventsource. In React Native, use ExpoArkProvider / ExpoIndexerProvider instead.";
1198
- var EventSourceUnavailableError = class extends Error {
1199
- constructor() {
1200
- super(`no EventSource is available, so server-sent events cannot be opened. ${GUIDANCE}`);
1201
- this.name = "EventSourceUnavailableError";
1202
- }
1203
- };
1204
- function isEventSourceUnavailableError(error) {
1205
- return error instanceof EventSourceUnavailableError || error instanceof Error && error.name === "EventSourceUnavailableError";
1206
- }
1207
- var configured;
1208
- function configureEventSource(factory) {
1209
- configured = factory;
1210
- }
1211
- function getConfiguredEventSource() {
1212
- return configured;
1213
- }
1214
- function resolveEventSource(override) {
1215
- const factory = override ?? configured ?? (typeof EventSource === "undefined" ? void 0 : (url) => new EventSource(url));
1216
- if (!factory) throw new EventSourceUnavailableError();
1217
- return factory;
1218
- }
1219
-
1220
304
  // package.json
1221
- var version = "0.5.3";
305
+ var version = "0.5.5";
1222
306
 
1223
307
  // src/utils/fetch.ts
1224
308
  var buildVersion = "0.9.9";
@@ -1284,6 +368,103 @@ function describeRequest(input, init) {
1284
368
  return { url, method };
1285
369
  }
1286
370
 
371
+ // src/providers/sseFrames.ts
372
+ async function* readSseFrames(body) {
373
+ const reader = body.getReader();
374
+ const decoder = new TextDecoder();
375
+ let buffer = "";
376
+ let pendingCR = false;
377
+ let event = "";
378
+ let data = [];
379
+ try {
380
+ for (; ; ) {
381
+ const { done, value: chunk } = await reader.read();
382
+ if (done) return;
383
+ const text = decoder.decode(chunk, { stream: true });
384
+ if (!text) continue;
385
+ const skipLF = pendingCR && text.startsWith("\n");
386
+ pendingCR = text.endsWith("\r");
387
+ buffer += (skipLF ? text.slice(1) : text).replace(/\r\n?/g, "\n");
388
+ const lines = buffer.split("\n");
389
+ buffer = lines.pop() ?? "";
390
+ for (const line of lines) {
391
+ if (line === "") {
392
+ const joined = data.join("\n");
393
+ if (joined) yield { event: event || "message", data: joined };
394
+ event = "";
395
+ data = [];
396
+ continue;
397
+ }
398
+ const colon = line.indexOf(":");
399
+ const field = colon === -1 ? line : line.slice(0, colon);
400
+ const value = colon === -1 ? "" : line.slice(colon + 1).replace(/^ /, "");
401
+ if (field === "event") event = value;
402
+ else if (field === "data") data.push(value);
403
+ }
404
+ }
405
+ } finally {
406
+ await reader.cancel().catch(() => {
407
+ });
408
+ }
409
+ }
410
+
411
+ // src/providers/eventSource.ts
412
+ var GUIDANCE = "Pass one with configureEventSource(url => new EventSource(url)) \u2014 in Node, from the `eventsource` package or by running with --experimental-eventsource. In React Native, use ExpoOperatorProvider / ExpoIndexerProvider instead.";
413
+ var EventSourceUnavailableError = class extends Error {
414
+ constructor() {
415
+ super(`no EventSource is available, so server-sent events cannot be opened. ${GUIDANCE}`);
416
+ this.name = "EventSourceUnavailableError";
417
+ }
418
+ };
419
+ function isEventSourceUnavailableError(error) {
420
+ return error instanceof EventSourceUnavailableError || error instanceof Error && error.name === "EventSourceUnavailableError";
421
+ }
422
+ var configured;
423
+ function configureEventSource(factory) {
424
+ configured = factory;
425
+ }
426
+ function getConfiguredEventSource() {
427
+ return configured;
428
+ }
429
+ function resolveEventSource(override) {
430
+ const factory = override ?? configured ?? (typeof globalThis.fetch === "function" && typeof ReadableStream !== "undefined" ? (url, headers) => new FetchEventSource(url, headers) : void 0) ?? (typeof EventSource === "undefined" ? void 0 : (url) => new EventSource(url));
431
+ if (!factory) throw new EventSourceUnavailableError();
432
+ return factory;
433
+ }
434
+ var FetchEventSource = class {
435
+ events = new EventTarget();
436
+ controller = new AbortController();
437
+ constructor(url, headers = {}) {
438
+ this.read(url, headers).catch(() => {
439
+ if (!this.controller.signal.aborted) this.events.dispatchEvent(new Event("error"));
440
+ });
441
+ }
442
+ addEventListener(type, listener) {
443
+ this.events.addEventListener(type, listener);
444
+ }
445
+ removeEventListener(type, listener) {
446
+ this.events.removeEventListener(type, listener);
447
+ }
448
+ close() {
449
+ this.controller.abort();
450
+ }
451
+ async read(url, headers) {
452
+ const response = await baseFetch(url, {
453
+ headers: { Accept: "text/event-stream", ...headers },
454
+ signal: this.controller.signal
455
+ });
456
+ const type = response.headers.get("Content-Type") ?? "";
457
+ if (response.status !== 200 || !response.body || !/^text\/event-stream\s*(;|$)/i.test(type)) {
458
+ await response.body?.cancel();
459
+ throw new Error(`SSE response ${response.status} ${type}`);
460
+ }
461
+ for await (const { event, data } of readSseFrames(response.body)) {
462
+ this.events.dispatchEvent(new MessageEvent(event, { data }));
463
+ }
464
+ throw new Error("SSE stream ended");
465
+ }
466
+ };
467
+
1287
468
  // src/providers/errors.ts
1288
469
  var ArkError = class extends Error {
1289
470
  constructor(code, message, name, metadata) {
@@ -1310,7 +491,8 @@ var ArkErrorName = {
1310
491
  * timestamp**, not wall clock, so a prompt spend is rejected until a later block lands.
1311
492
  */
1312
493
  FORFEIT_CLOSURE_LOCKED: "FORFEIT_CLOSURE_LOCKED",
1313
- INVALID_INTENT_PROOF: "INVALID_INTENT_PROOF"
494
+ INVALID_INTENT_PROOF: "INVALID_INTENT_PROOF",
495
+ INTERNAL_ERROR: "INTERNAL_ERROR"
1314
496
  };
1315
497
  function isArkError(error, name) {
1316
498
  return error instanceof ArkError && (name === void 0 || error.name === name);
@@ -1378,42 +560,42 @@ function maybeArkError(error) {
1378
560
  function isMetadata(value) {
1379
561
  return typeof value === "object" && value !== null && !Array.isArray(value);
1380
562
  }
1381
- exports.Intent = void 0;
1382
- ((Intent2) => {
563
+ exports.Proof = void 0;
564
+ ((Proof2) => {
1383
565
  function create(message, ins, outputs = []) {
1384
566
  if (typeof message !== "string") {
1385
567
  message = encodeMessage(message);
1386
568
  }
1387
- if (ins.length == 0) throw new Error("intent proof requires at least one input");
1388
- const inputs = ins.map(prepareCoinAsIntentProofInput);
569
+ if (ins.length == 0) throw new Error("proof requires at least one input");
570
+ const inputs = ins.map(prepareProofInput);
1389
571
  validateInputs(inputs);
1390
572
  validateOutputs(outputs);
1391
573
  const toSpend = craftToSpendTx(message, inputs[0].witnessUtxo.script);
1392
574
  return craftToSignTx(toSpend, inputs, outputs, message);
1393
575
  }
1394
- Intent2.create = create;
576
+ Proof2.create = create;
1395
577
  function fee(proof) {
1396
578
  let sumOfInputs = 0n;
1397
579
  for (let i = 0; i < proof.inputsLength; i++) {
1398
580
  const input = proof.getInput(i);
1399
581
  if (input.witnessUtxo === void 0)
1400
- throw new Error("intent proof input requires witness utxo");
582
+ throw new Error("proof input requires witness utxo");
1401
583
  sumOfInputs += input.witnessUtxo.amount;
1402
584
  }
1403
585
  let sumOfOutputs = 0n;
1404
586
  for (let i = 0; i < proof.outputsLength; i++) {
1405
587
  const output = proof.getOutput(i);
1406
- if (output.amount === void 0) throw new Error("intent proof output requires amount");
588
+ if (output.amount === void 0) throw new Error("proof output requires amount");
1407
589
  sumOfOutputs += output.amount;
1408
590
  }
1409
591
  if (sumOfOutputs > sumOfInputs) {
1410
592
  throw new Error(
1411
- `intent proof output amount is greater than input amount: ${sumOfOutputs} > ${sumOfInputs}`
593
+ `proof output amount is greater than input amount: ${sumOfOutputs} > ${sumOfInputs}`
1412
594
  );
1413
595
  }
1414
596
  return Number(sumOfInputs - sumOfOutputs);
1415
597
  }
1416
- Intent2.fee = fee;
598
+ Proof2.fee = fee;
1417
599
  function encodeMessage(message) {
1418
600
  switch (message.type) {
1419
601
  case "register":
@@ -1436,31 +618,31 @@ exports.Intent = void 0;
1436
618
  });
1437
619
  }
1438
620
  }
1439
- Intent2.encodeMessage = encodeMessage;
1440
- })(exports.Intent || (exports.Intent = {}));
621
+ Proof2.encodeMessage = encodeMessage;
622
+ })(exports.Proof || (exports.Proof = {}));
623
+ var Intent = exports.Proof;
1441
624
  var OP_RETURN_EMPTY_PKSCRIPT = new Uint8Array([btcSigner.OP.RETURN]);
1442
625
  var ZERO_32 = new Uint8Array(32).fill(0);
1443
626
  var MAX_INDEX = 4294967295;
1444
- var TAG_INTENT_PROOF = "ark-intent-proof-message";
627
+ var TAG_PROOF = "ark-intent-proof-message";
1445
628
  function validateInput(input) {
1446
- if (input.index === void 0) throw new Error("intent proof input requires index");
1447
- if (input.txid === void 0) throw new Error("intent proof input requires txid");
1448
- if (input.witnessUtxo === void 0)
1449
- throw new Error("intent proof input requires witness utxo");
629
+ if (input.index === void 0) throw new Error("proof input requires index");
630
+ if (input.txid === void 0) throw new Error("proof input requires txid");
631
+ if (input.witnessUtxo === void 0) throw new Error("proof input requires witness utxo");
1450
632
  return true;
1451
633
  }
1452
634
  function validateInputs(inputs) {
1453
635
  inputs.forEach(validateInput);
1454
636
  }
1455
637
  function validateOutput(output) {
1456
- if (output.amount === void 0) throw new Error("intent proof output requires amount");
1457
- if (output.script === void 0) throw new Error("intent proof output requires script");
638
+ if (output.amount === void 0) throw new Error("proof output requires amount");
639
+ if (output.script === void 0) throw new Error("proof output requires script");
1458
640
  return true;
1459
641
  }
1460
642
  function validateOutputs(outputs) {
1461
643
  outputs.forEach(validateOutput);
1462
644
  }
1463
- function craftToSpendTx(message, pkScript, tag = TAG_INTENT_PROOF) {
645
+ function craftToSpendTx(message, pkScript, tag = TAG_PROOF) {
1464
646
  const messageHash = hashMessage(message, tag);
1465
647
  const tx = new Transaction({
1466
648
  version: 0
@@ -1525,15 +707,15 @@ function craftToSignTx(toSpend, inputs, outputs, message) {
1525
707
  tx.global.genericSignedMessage = new TextEncoder().encode(message);
1526
708
  return tx;
1527
709
  }
1528
- function hashMessage(message, tag = TAG_INTENT_PROOF) {
710
+ function hashMessage(message, tag = TAG_PROOF) {
1529
711
  return secp256k1_js.schnorr.utils.taggedHash(tag, new TextEncoder().encode(message));
1530
712
  }
1531
- function prepareCoinAsIntentProofInput(coin) {
713
+ function prepareProofInput(coin) {
1532
714
  if (!("tapTree" in coin)) {
1533
715
  return coin;
1534
716
  }
1535
- const vtxoScript = VtxoScript.decode(coin.tapTree);
1536
- const sequence = getSequence(coin.intentTapLeafScript);
717
+ const vtxoScript = chunkFLPWNMX3_cjs.VtxoScript.decode(coin.tapTree);
718
+ const sequence = chunkFLPWNMX3_cjs.getSequence(chunkFLPWNMX3_cjs.proofTapLeafScriptOf(coin));
1537
719
  const unknown = [VtxoTaprootTree.encode(coin.tapTree)];
1538
720
  if (coin.extraWitness) {
1539
721
  unknown.push(ConditionWitness.encode(coin.extraWitness));
@@ -1549,7 +731,7 @@ function prepareCoinAsIntentProofInput(coin) {
1549
731
  script: vtxoScript.pkScript
1550
732
  },
1551
733
  sequence,
1552
- tapLeafScript: [coin.intentTapLeafScript],
734
+ tapLeafScript: [chunkFLPWNMX3_cjs.proofTapLeafScriptOf(coin)],
1553
735
  unknown
1554
736
  };
1555
737
  }
@@ -1812,6 +994,35 @@ var DigestMismatchError = class extends Error {
1812
994
  this.name = "DigestMismatchError";
1813
995
  }
1814
996
  };
997
+ var ONCHAIN_COSIGN_UNSUPPORTED_PREFIX = "Arkade server does not support onchain cosigning";
998
+ var ONCHAIN_COSIGN_REJECTED_PREFIX = "Arkade server refused to cosign onchain tx: ";
999
+ var OnchainCosignUnsupportedError = class extends Error {
1000
+ constructor() {
1001
+ super(ONCHAIN_COSIGN_UNSUPPORTED_PREFIX);
1002
+ this.name = "OnchainCosignUnsupportedError";
1003
+ }
1004
+ };
1005
+ var OnchainCosignRejectedError = class extends Error {
1006
+ constructor(serverMessage, arkErrorName) {
1007
+ super(
1008
+ `${ONCHAIN_COSIGN_REJECTED_PREFIX}${arkErrorName ? `[${arkErrorName}] ` : ""}${serverMessage}`
1009
+ );
1010
+ this.serverMessage = serverMessage;
1011
+ this.arkErrorName = arkErrorName;
1012
+ this.name = "OnchainCosignRejectedError";
1013
+ }
1014
+ serverMessage;
1015
+ arkErrorName;
1016
+ };
1017
+ var ONCHAIN_COSIGN_AMBIGUOUS_PREFIX = "Onchain cosign outcome unknown, the transaction may have been broadcast: ";
1018
+ var OnchainCosignAmbiguousError = class extends Error {
1019
+ constructor(detail, options) {
1020
+ super(`${ONCHAIN_COSIGN_AMBIGUOUS_PREFIX}${detail}`, options);
1021
+ this.detail = detail;
1022
+ this.name = "OnchainCosignAmbiguousError";
1023
+ }
1024
+ detail;
1025
+ };
1815
1026
  var SettlementEventType = /* @__PURE__ */ ((SettlementEventType2) => {
1816
1027
  SettlementEventType2["BatchStarted"] = "batch_started";
1817
1028
  SettlementEventType2["BatchFinalization"] = "batch_finalization";
@@ -1829,8 +1040,8 @@ function advertisedLimit(fromServer) {
1829
1040
  const limit = BigInt(fromServer);
1830
1041
  return limit > 0n ? limit : void 0;
1831
1042
  }
1832
- var RestArkProvider = class {
1833
- constructor(serverUrl = DEFAULT_ARKADE_SERVER_URL, options = {}) {
1043
+ var RestOperatorProvider = class {
1044
+ constructor(serverUrl = chunkFLPWNMX3_cjs.DEFAULT_ARKADE_SERVER_URL, options = {}) {
1834
1045
  this.serverUrl = serverUrl;
1835
1046
  this.eventSource = options.eventSource;
1836
1047
  }
@@ -1838,16 +1049,17 @@ var RestArkProvider = class {
1838
1049
  /** Overrides {@link configureEventSource} for this provider's streams. */
1839
1050
  eventSource;
1840
1051
  /**
1841
- * Last server-info digest seen (from {@link getInfo}). Sent as `X-Digest`
1052
+ * Last operator info digest seen (from {@link getInfo}). Sent as `X-Digest`
1842
1053
  * on outgoing requests so arkd can reject a client whose cached info is
1843
1054
  * stale. Empty until the first {@link getInfo}.
1844
1055
  */
1845
1056
  _digest = "";
1057
+ _onchainCosignUnsupported = false;
1846
1058
  _hasServerInfo = false;
1847
1059
  _suppressNextGetInfoChangeEmit = false;
1848
1060
  _serverInfoListeners = /* @__PURE__ */ new Set();
1849
1061
  /**
1850
- * Subscribe to server-info changes. Fired after a stale-info
1062
+ * Subscribe to operator info changes. Fired after a stale-info
1851
1063
  * `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
1852
1064
  * Returns an unsubscribe function.
1853
1065
  */
@@ -1858,6 +1070,7 @@ var RestArkProvider = class {
1858
1070
  };
1859
1071
  }
1860
1072
  emitServerInfoChanged(info) {
1073
+ this._onchainCosignUnsupported = false;
1861
1074
  for (const listener of this._serverInfoListeners) {
1862
1075
  try {
1863
1076
  listener(info);
@@ -1867,7 +1080,7 @@ var RestArkProvider = class {
1867
1080
  }
1868
1081
  }
1869
1082
  /**
1870
- * `fetch` wrapper for arkd requests that participates in server-info digest
1083
+ * `fetch` wrapper for arkd requests that participates in operator info digest
1871
1084
  * negotiation. Sends the cached `X-Digest`; when arkd rejects a request with
1872
1085
  * `DIGEST_MISMATCH`, refreshes {@link getInfo} (updating the digest), fires
1873
1086
  * {@link onServerInfoChanged}, and THROWS {@link DigestMismatchError} — it
@@ -1901,7 +1114,7 @@ var RestArkProvider = class {
1901
1114
  return response;
1902
1115
  }
1903
1116
  const arkError = maybeArkError(new Error(body));
1904
- if (!arkError) throwIfHttpUnavailable(response, "arkade");
1117
+ if (!arkError && response.status !== 501) throwIfHttpUnavailable(response, "arkade");
1905
1118
  if (!isArkError(arkError, ArkErrorName.DIGEST_MISMATCH)) return response;
1906
1119
  this._digest = "";
1907
1120
  this._suppressNextGetInfoChangeEmit = true;
@@ -2013,6 +1226,41 @@ var RestArkProvider = class {
2013
1226
  signedCheckpointTxs: data.signedCheckpointTxs
2014
1227
  };
2015
1228
  }
1229
+ async cosignOnchainTx(psbtB64) {
1230
+ if (this._onchainCosignUnsupported) throw new OnchainCosignUnsupportedError();
1231
+ let response;
1232
+ let text;
1233
+ try {
1234
+ response = await this.authedFetch(`${this.serverUrl}/v1/tx/onchain/cosign`, {
1235
+ method: "POST",
1236
+ headers: { "Content-Type": "application/json" },
1237
+ body: JSON.stringify({ tx: psbtB64 })
1238
+ });
1239
+ if (response.ok) {
1240
+ const { txid } = await response.json();
1241
+ if (typeof txid !== "string" || !txid)
1242
+ throw new Error("cosign response has no txid");
1243
+ return txid;
1244
+ }
1245
+ text = await response.text();
1246
+ } catch (e) {
1247
+ if (e instanceof DigestMismatchError) throw e;
1248
+ throw new OnchainCosignAmbiguousError(e instanceof Error ? e.message : String(e), {
1249
+ cause: e
1250
+ });
1251
+ }
1252
+ const arkError = maybeArkError(new Error(text));
1253
+ if (!arkError && (response.status === 404 || response.status === 501)) {
1254
+ this._onchainCosignUnsupported = true;
1255
+ throw new OnchainCosignUnsupportedError();
1256
+ }
1257
+ if (!arkError || arkError.name === ArkErrorName.INTERNAL_ERROR) {
1258
+ throw new OnchainCosignAmbiguousError(
1259
+ arkError?.message ?? `${response.status} ${text}`
1260
+ );
1261
+ }
1262
+ throw new OnchainCosignRejectedError(arkError.message, arkError.name);
1263
+ }
2016
1264
  async finalizeTx(arkTxid, finalCheckpointTxs) {
2017
1265
  const url = `${this.serverUrl}/v1/tx/finalize`;
2018
1266
  await this.postJson(
@@ -2031,7 +1279,7 @@ var RestArkProvider = class {
2031
1279
  {
2032
1280
  intent: {
2033
1281
  proof: intent.proof,
2034
- message: exports.Intent.encodeMessage(intent.message)
1282
+ message: exports.Proof.encodeMessage(intent.message)
2035
1283
  }
2036
1284
  },
2037
1285
  (errorText) => `Failed to register intent: ${errorText}`
@@ -2046,7 +1294,7 @@ var RestArkProvider = class {
2046
1294
  {
2047
1295
  intent: {
2048
1296
  proof: intent.proof,
2049
- message: exports.Intent.encodeMessage(intent.message)
1297
+ message: exports.Proof.encodeMessage(intent.message)
2050
1298
  }
2051
1299
  },
2052
1300
  (errorText) => `Failed to delete intent: ${errorText}`
@@ -2109,7 +1357,10 @@ var RestArkProvider = class {
2109
1357
  try {
2110
1358
  while (!signal?.aborted) {
2111
1359
  const currentIterator = eventSourceIterator(
2112
- resolveEventSource(self.eventSource)(url + queryParams)
1360
+ resolveEventSource(self.eventSource)(
1361
+ url + queryParams,
1362
+ ARKADE_VERSION_HEADERS
1363
+ )
2113
1364
  );
2114
1365
  iterator = currentIterator;
2115
1366
  try {
@@ -2169,7 +1420,7 @@ var RestArkProvider = class {
2169
1420
  while (!signal?.aborted) {
2170
1421
  try {
2171
1422
  const currentIterator = eventSourceIterator(
2172
- resolveEventSource(self.eventSource)(url)
1423
+ resolveEventSource(self.eventSource)(url, ARKADE_VERSION_HEADERS)
2173
1424
  );
2174
1425
  iterator = currentIterator;
2175
1426
  for await (const event of currentIterator) {
@@ -2223,7 +1474,7 @@ var RestArkProvider = class {
2223
1474
  {
2224
1475
  intent: {
2225
1476
  proof: intent.proof,
2226
- message: exports.Intent.encodeMessage(intent.message)
1477
+ message: exports.Proof.encodeMessage(intent.message)
2227
1478
  }
2228
1479
  },
2229
1480
  (errorText) => `Failed to get pending transactions: ${errorText}`
@@ -2415,6 +1666,7 @@ function handleError(errorText, defaultMessage) {
2415
1666
  const arkError = maybeArkError(error);
2416
1667
  throw arkError ?? new Error(defaultMessage);
2417
1668
  }
1669
+ var RestArkProvider = RestOperatorProvider;
2418
1670
 
2419
1671
  // src/providers/availability.ts
2420
1672
  function isRetryableProviderError(error) {
@@ -2585,42 +1837,39 @@ function isVirtualCoin(input) {
2585
1837
  }
2586
1838
 
2587
1839
  exports.ARKADE_VERSION_HEADERS = ARKADE_VERSION_HEADERS;
2588
- exports.ArkAddress = ArkAddress;
2589
1840
  exports.ArkError = ArkError;
2590
1841
  exports.ArkErrorName = ArkErrorName;
2591
1842
  exports.ArkPsbtFieldKey = ArkPsbtFieldKey;
2592
1843
  exports.ArkPsbtFieldKeyType = ArkPsbtFieldKeyType;
2593
- exports.BITCOIN_EMULATOR_PUBKEY = BITCOIN_EMULATOR_PUBKEY;
2594
1844
  exports.ConditionWitness = ConditionWitness;
2595
1845
  exports.CosignerPublicKey = CosignerPublicKey;
2596
- exports.DEFAULT_ARKADE_EMULATOR_URL = DEFAULT_ARKADE_EMULATOR_URL;
2597
- exports.DEFAULT_ARKADE_SERVER_URL = DEFAULT_ARKADE_SERVER_URL;
2598
- exports.DEFAULT_NETWORK = DEFAULT_NETWORK;
2599
- exports.DEFAULT_NETWORK_NAME = DEFAULT_NETWORK_NAME;
2600
1846
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
2601
1847
  exports.DigestMismatchError = DigestMismatchError;
2602
1848
  exports.EXPIRY_MIN_PLAUSIBLE_MS = EXPIRY_MIN_PLAUSIBLE_MS;
2603
1849
  exports.EventSourceUnavailableError = EventSourceUnavailableError;
2604
1850
  exports.FetchError = FetchError;
2605
1851
  exports.INFO_FETCH_TIMEOUT_MS = INFO_FETCH_TIMEOUT_MS;
2606
- exports.MUTINYNET_EMULATOR_PUBKEY = MUTINYNET_EMULATOR_PUBKEY;
1852
+ exports.Intent = Intent;
1853
+ exports.ONCHAIN_COSIGN_AMBIGUOUS_PREFIX = ONCHAIN_COSIGN_AMBIGUOUS_PREFIX;
1854
+ exports.ONCHAIN_COSIGN_REJECTED_PREFIX = ONCHAIN_COSIGN_REJECTED_PREFIX;
1855
+ exports.ONCHAIN_COSIGN_UNSUPPORTED_PREFIX = ONCHAIN_COSIGN_UNSUPPORTED_PREFIX;
2607
1856
  exports.OP_RETURN_EMPTY_PKSCRIPT = OP_RETURN_EMPTY_PKSCRIPT;
1857
+ exports.OUTPOINT_QUERY_CHUNK_SIZE = OUTPOINT_QUERY_CHUNK_SIZE;
1858
+ exports.OnchainCosignAmbiguousError = OnchainCosignAmbiguousError;
1859
+ exports.OnchainCosignRejectedError = OnchainCosignRejectedError;
1860
+ exports.OnchainCosignUnsupportedError = OnchainCosignUnsupportedError;
2608
1861
  exports.PrevArkTxField = PrevArkTxField;
2609
1862
  exports.PrevoutTxField = PrevoutTxField;
2610
1863
  exports.ProviderUnavailableError = ProviderUnavailableError;
2611
1864
  exports.READ_TIMEOUT_MS = READ_TIMEOUT_MS;
2612
- exports.REGTEST_EMULATOR_PUBKEY = REGTEST_EMULATOR_PUBKEY;
2613
1865
  exports.RestArkProvider = RestArkProvider;
1866
+ exports.RestOperatorProvider = RestOperatorProvider;
2614
1867
  exports.SCRIPT_QUERY_CHUNK_SIZE = SCRIPT_QUERY_CHUNK_SIZE;
2615
1868
  exports.ServerResponseMismatchError = ServerResponseMismatchError;
2616
1869
  exports.SettlementEventType = SettlementEventType;
2617
- exports.TapTreeCoder = TapTreeCoder;
2618
1870
  exports.Transaction = Transaction;
2619
- exports.VtxoScript = VtxoScript;
2620
1871
  exports.VtxoTaprootTree = VtxoTaprootTree;
2621
1872
  exports.VtxoTreeExpiry = VtxoTreeExpiry;
2622
- exports.__export = __export;
2623
- exports.assembleBtcdTaprootTree = assembleBtcdTaprootTree;
2624
1873
  exports.assertAllowedSighashTypes = assertAllowedSighashTypes;
2625
1874
  exports.assertNonNegativeMs = assertNonNegativeMs;
2626
1875
  exports.assertTimerMs = assertTimerMs;
@@ -2632,17 +1881,13 @@ exports.canSweepOnchain = canSweepOnchain;
2632
1881
  exports.configureEventSource = configureEventSource;
2633
1882
  exports.convertVtxo = convertVtxo;
2634
1883
  exports.craftToSpendTx = craftToSpendTx;
2635
- exports.decodeTapscript = decodeTapscript;
2636
- exports.defaultEmulatorPubkey = defaultEmulatorPubkey;
2637
1884
  exports.eventSourceIterator = eventSourceIterator;
2638
1885
  exports.fetchVtxoCreatedAtByTxid = fetchVtxoCreatedAtByTxid;
2639
1886
  exports.formatSighash = formatSighash;
2640
1887
  exports.getAllNormalizedVtxos = getAllNormalizedVtxos;
2641
1888
  exports.getArkPsbtFields = getArkPsbtFields;
2642
1889
  exports.getConfiguredEventSource = getConfiguredEventSource;
2643
- exports.getNetwork = getNetwork;
2644
1890
  exports.getNormalizedVtxos = getNormalizedVtxos;
2645
- exports.getSequence = getSequence;
2646
1891
  exports.isArkError = isArkError;
2647
1892
  exports.isEventSourceError = isEventSourceError;
2648
1893
  exports.isEventSourceUnavailableError = isEventSourceUnavailableError;
@@ -2652,24 +1897,17 @@ exports.isRetryableProviderError = isRetryableProviderError;
2652
1897
  exports.isVirtualCoin = isVirtualCoin;
2653
1898
  exports.isVtxoSpent = isVtxoSpent;
2654
1899
  exports.maybeArkError = maybeArkError;
2655
- exports.networkFromArkadeInfo = networkFromArkadeInfo;
2656
- exports.networks = networks;
2657
1900
  exports.normalizeVtxo = normalizeVtxo;
2658
1901
  exports.rateGate = rateGate;
1902
+ exports.readSseFrames = readSseFrames;
2659
1903
  exports.requiresForfeit = requiresForfeit;
2660
- exports.resolveEmulatorPubkey = resolveEmulatorPubkey;
2661
1904
  exports.resolveEventSource = resolveEventSource;
2662
1905
  exports.resolveTimeHeight = resolveTimeHeight;
2663
- exports.scriptFromTapLeafScript = scriptFromTapLeafScript;
2664
1906
  exports.sdkVersion = sdkVersion;
2665
- exports.sequenceToCanonicalTimelock = sequenceToCanonicalTimelock;
2666
- exports.sequenceToTimelock = sequenceToTimelock;
2667
1907
  exports.setArkPsbtField = setArkPsbtField;
2668
1908
  exports.streamFailureError = streamFailureError;
2669
1909
  exports.throwIfHttpUnavailable = throwIfHttpUnavailable;
2670
- exports.timelockToSequence = timelockToSequence;
2671
- exports.toBIP371TapTree = toBIP371TapTree;
2672
1910
  exports.toOffchainInputFeeParams = toOffchainInputFeeParams;
2673
1911
  exports.toProviderUnavailable = toProviderUnavailable;
2674
- //# sourceMappingURL=chunk-KW7ZEWYS.cjs.map
2675
- //# sourceMappingURL=chunk-KW7ZEWYS.cjs.map
1912
+ //# sourceMappingURL=chunk-KCL5AVML.cjs.map
1913
+ //# sourceMappingURL=chunk-KCL5AVML.cjs.map