@utexo/rgb-sdk 1.0.0-beta.8

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 (40) hide show
  1. package/LICENCE +201 -0
  2. package/Readme.md +480 -0
  3. package/cli/README.md +348 -0
  4. package/cli/commands/address.mjs +16 -0
  5. package/cli/commands/blindreceive.mjs +15 -0
  6. package/cli/commands/btcbalance.mjs +11 -0
  7. package/cli/commands/createlightninginvoice.mjs +14 -0
  8. package/cli/commands/createutxos.mjs +13 -0
  9. package/cli/commands/decodergbinvoice.mjs +9 -0
  10. package/cli/commands/generate_keys.mjs +35 -0
  11. package/cli/commands/getlightningreceiverequest.mjs +10 -0
  12. package/cli/commands/getlightningsendrequest.mjs +10 -0
  13. package/cli/commands/getonchainsendstatus.mjs +20 -0
  14. package/cli/commands/listassets.mjs +11 -0
  15. package/cli/commands/listtransfers.mjs +10 -0
  16. package/cli/commands/listunspents.mjs +10 -0
  17. package/cli/commands/onchainreceive.mjs +16 -0
  18. package/cli/commands/onchainsend.mjs +11 -0
  19. package/cli/commands/onchainsendbegin.mjs +9 -0
  20. package/cli/commands/onchainsendend.mjs +9 -0
  21. package/cli/commands/paylightninginvoice.mjs +11 -0
  22. package/cli/commands/paylightninginvoicebegin.mjs +10 -0
  23. package/cli/commands/paylightninginvoiceend.mjs +9 -0
  24. package/cli/commands/refresh.mjs +9 -0
  25. package/cli/commands/send.mjs +31 -0
  26. package/cli/commands/sign-psbt.mjs +12 -0
  27. package/cli/commands/signpsbt.mjs +10 -0
  28. package/cli/commands/witnessreceive.mjs +15 -0
  29. package/cli/data/stage2-receiver.example.json +11 -0
  30. package/cli/data/stage2-sender.example.json +11 -0
  31. package/cli/generate_keys.mjs +66 -0
  32. package/cli/run.mjs +308 -0
  33. package/cli/utils.mjs +220 -0
  34. package/dist/index.cjs +1282 -0
  35. package/dist/index.cjs.map +1 -0
  36. package/dist/index.d.mts +163 -0
  37. package/dist/index.d.ts +163 -0
  38. package/dist/index.mjs +1018 -0
  39. package/dist/index.mjs.map +1 -0
  40. package/package.json +124 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,1282 @@
1
+ 'use strict';
2
+
3
+ var path3 = require('path');
4
+ var fs2 = require('fs');
5
+ var rgbSdkCore = require('@utexo/rgb-sdk-core');
6
+ var rgblib = require('@utexo/rgb-lib');
7
+ var bitcoinjsLib = require('bitcoinjs-lib');
8
+ var bdkNode = require('@bitcoindevkit/bdk-wallet-node');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var path3__namespace = /*#__PURE__*/_interopNamespace(path3);
31
+ var fs2__namespace = /*#__PURE__*/_interopNamespace(fs2);
32
+ var rgblib__default = /*#__PURE__*/_interopDefault(rgblib);
33
+ var bdkNode__namespace = /*#__PURE__*/_interopNamespace(bdkNode);
34
+
35
+ // src/binding/NodeRgbLibBinding.ts
36
+ function mapNetworkToRgbLib(network) {
37
+ const networkMap = {
38
+ mainnet: "Mainnet",
39
+ testnet: "Testnet",
40
+ testnet4: "Testnet4",
41
+ signet: "Signet",
42
+ utexo: "Signet",
43
+ regtest: "Regtest"
44
+ };
45
+ const networkStr = String(network).toLowerCase();
46
+ return networkMap[networkStr] || "Regtest";
47
+ }
48
+ var restoreWallet = (params) => {
49
+ const { backupFilePath, password, dataDir } = params;
50
+ if (!fs2__namespace.existsSync(backupFilePath)) {
51
+ throw new rgbSdkCore.ValidationError("Backup file not found", "backup");
52
+ }
53
+ if (!fs2__namespace.existsSync(dataDir)) {
54
+ throw new rgbSdkCore.ValidationError(
55
+ `Restore directory does not exist: ${dataDir}`,
56
+ "restoreDir"
57
+ );
58
+ }
59
+ rgblib__default.default.restoreBackup(backupFilePath, password, dataDir);
60
+ return {
61
+ message: "Wallet restored successfully"
62
+ };
63
+ };
64
+ var restoreFromVss = (params) => {
65
+ const anyLib = rgblib__default.default;
66
+ if (typeof anyLib.restoreFromVss !== "function") {
67
+ throw new rgbSdkCore.WalletError(
68
+ "VSS restore is not available in the current rgb-lib build."
69
+ );
70
+ }
71
+ if (!params.targetDir) {
72
+ throw new rgbSdkCore.ValidationError("targetDir is required", "targetDir");
73
+ }
74
+ const { config, targetDir } = params;
75
+ const mappedConfig = {
76
+ server_url: config.serverUrl,
77
+ store_id: config.storeId,
78
+ signing_key: config.signingKey
79
+ };
80
+ const walletPath = anyLib.restoreFromVss(mappedConfig, targetDir);
81
+ return {
82
+ message: "Wallet restored from VSS successfully",
83
+ walletPath
84
+ };
85
+ };
86
+ var NodeRgbLibBinding = class {
87
+ constructor(params) {
88
+ this.online = null;
89
+ this.xpubVan = params.xpubVan;
90
+ this.xpubCol = params.xpubCol;
91
+ this.masterFingerprint = params.masterFingerprint;
92
+ this.originalNetwork = params.network;
93
+ this.network = rgbSdkCore.normalizeNetwork(this.originalNetwork);
94
+ this.dataDir = params.dataDir;
95
+ this.transportEndpoint = params.transportEndpoint || rgbSdkCore.DEFAULT_TRANSPORT_ENDPOINTS[this.network] || rgbSdkCore.DEFAULT_TRANSPORT_ENDPOINTS.signet;
96
+ if (params.indexerUrl) {
97
+ this.indexerUrl = params.indexerUrl;
98
+ } else {
99
+ this.indexerUrl = rgbSdkCore.DEFAULT_INDEXER_URLS[this.network] || rgbSdkCore.DEFAULT_INDEXER_URLS.signet;
100
+ }
101
+ if (!fs2__namespace.existsSync(this.dataDir)) {
102
+ fs2__namespace.mkdirSync(this.dataDir, { recursive: true });
103
+ }
104
+ const walletData = {
105
+ dataDir: this.dataDir,
106
+ bitcoinNetwork: mapNetworkToRgbLib(this.originalNetwork),
107
+ databaseType: rgblib__default.default.DatabaseType.Sqlite,
108
+ accountXpubVanilla: this.xpubVan,
109
+ accountXpubColored: this.xpubCol,
110
+ masterFingerprint: this.masterFingerprint,
111
+ maxAllocationsPerUtxo: "1",
112
+ vanillaKeychain: "0",
113
+ supportedSchemas: [
114
+ rgblib__default.default.AssetSchema.Cfa,
115
+ rgblib__default.default.AssetSchema.Nia,
116
+ rgblib__default.default.AssetSchema.Uda
117
+ ]
118
+ };
119
+ try {
120
+ this.wallet = new rgblib__default.default.Wallet(new rgblib__default.default.WalletData(walletData));
121
+ } catch (error) {
122
+ throw new rgbSdkCore.WalletError(
123
+ "Failed to initialize rgb-lib wallet",
124
+ void 0,
125
+ error
126
+ );
127
+ }
128
+ }
129
+ /**
130
+ * Ensure online connection is established
131
+ */
132
+ ensureOnline() {
133
+ if (this.online) {
134
+ return;
135
+ }
136
+ try {
137
+ this.online = this.wallet.goOnline(false, this.indexerUrl);
138
+ } catch (error) {
139
+ throw new rgbSdkCore.WalletError(
140
+ "Failed to establish online connection",
141
+ void 0,
142
+ error
143
+ );
144
+ }
145
+ }
146
+ /**
147
+ * Get online object, creating it if needed
148
+ */
149
+ getOnline() {
150
+ this.ensureOnline();
151
+ return this.online;
152
+ }
153
+ registerWallet() {
154
+ const online = this.getOnline();
155
+ const address = this.wallet.getAddress();
156
+ const btcBalance = this.wallet.getBtcBalance(online, false);
157
+ return {
158
+ address,
159
+ btcBalance
160
+ };
161
+ }
162
+ async getBtcBalance() {
163
+ const online = this.getOnline();
164
+ return this.wallet.getBtcBalance(online, false);
165
+ }
166
+ async getAddress() {
167
+ return this.wallet.getAddress();
168
+ }
169
+ listUnspents() {
170
+ const online = this.getOnline();
171
+ const raw = this.wallet.listUnspents(online, false, false);
172
+ return Promise.resolve(
173
+ raw.map((unspent) => ({
174
+ utxo: {
175
+ ...unspent.utxo,
176
+ exists: unspent.utxo.exists ?? true
177
+ },
178
+ rgbAllocations: unspent.rgbAllocations.map((allocation) => {
179
+ const assignmentKeys = Object.keys(allocation.assignment);
180
+ const assignmentType = assignmentKeys[0];
181
+ const assignment = {
182
+ type: assignmentType ?? "Any",
183
+ amount: assignmentType && allocation.assignment[assignmentType] ? Number(allocation.assignment[assignmentType]) : void 0
184
+ };
185
+ return {
186
+ assetId: allocation.assetId,
187
+ assignment,
188
+ settled: allocation.settled
189
+ };
190
+ }),
191
+ pendingBlinded: unspent.pendingBlinded ?? 0
192
+ }))
193
+ );
194
+ }
195
+ async createUtxosBegin(params) {
196
+ const online = this.getOnline();
197
+ const upTo = params.upTo ?? false;
198
+ const num = params.num !== void 0 ? String(params.num) : null;
199
+ const size = params.size !== void 0 ? String(params.size) : null;
200
+ const feeRate = params.feeRate ? String(params.feeRate) : "1";
201
+ const skipSync = false;
202
+ return this.wallet.createUtxosBegin(
203
+ online,
204
+ upTo,
205
+ num,
206
+ size,
207
+ feeRate,
208
+ skipSync
209
+ );
210
+ }
211
+ async createUtxosEnd(params) {
212
+ const online = this.getOnline();
213
+ const signedPsbt = params.signedPsbt;
214
+ const skipSync = params.skipSync ?? false;
215
+ return this.wallet.createUtxosEnd(online, signedPsbt, skipSync);
216
+ }
217
+ async sendBegin(params) {
218
+ const online = this.getOnline();
219
+ const feeRate = String(params.feeRate ?? 1);
220
+ const minConfirmations = String(params.minConfirmations ?? 1);
221
+ const donation = params.donation ?? false;
222
+ let assetId = params.assetId;
223
+ let amount = params.amount;
224
+ let recipientId;
225
+ let transportEndpoints = [];
226
+ let witnessData = null;
227
+ if (params.witnessData && params.witnessData.amountSat) {
228
+ witnessData = {
229
+ amountSat: String(params.witnessData.amountSat),
230
+ blinding: params.witnessData.blinding ? Number(params.witnessData.blinding) : null
231
+ };
232
+ }
233
+ if (params.invoice) {
234
+ const invoiceData = this.decodeRGBInvoiceRaw({ invoice: params.invoice });
235
+ recipientId = invoiceData.recipientId;
236
+ transportEndpoints = invoiceData.transportEndpoints;
237
+ }
238
+ if (transportEndpoints.length === 0) {
239
+ transportEndpoints = [this.transportEndpoint];
240
+ }
241
+ if (!assetId) {
242
+ throw new rgbSdkCore.ValidationError(
243
+ "asset_id is required for send operation",
244
+ "asset_id"
245
+ );
246
+ }
247
+ if (!recipientId) {
248
+ throw new rgbSdkCore.ValidationError(
249
+ "Could not extract recipient_id from invoice",
250
+ "invoice"
251
+ );
252
+ }
253
+ if (!amount) {
254
+ throw new rgbSdkCore.ValidationError(
255
+ "amount is required for send operation",
256
+ "amount"
257
+ );
258
+ }
259
+ const assignment = { Fungible: amount };
260
+ const recipientMap = {
261
+ [assetId]: [
262
+ {
263
+ recipientId,
264
+ witnessData,
265
+ assignment,
266
+ transportEndpoints
267
+ }
268
+ ]
269
+ };
270
+ const psbt = this.wallet.sendBegin(
271
+ online,
272
+ recipientMap,
273
+ donation,
274
+ feeRate,
275
+ minConfirmations
276
+ );
277
+ return psbt;
278
+ }
279
+ /**
280
+ * Batch send: accepts an already-built recipientMap and calls sendBegin.
281
+ */
282
+ async sendBeginBatch(params) {
283
+ const online = this.getOnline();
284
+ const feeRate = String(params.feeRate ?? 1);
285
+ const minConfirmations = String(params.minConfirmations ?? 1);
286
+ const donation = params.donation ?? true;
287
+ const { recipientMap } = params;
288
+ if (!recipientMap || typeof recipientMap !== "object") {
289
+ throw new rgbSdkCore.ValidationError(
290
+ "recipientMap is required and must be a non-empty object",
291
+ "recipientMap"
292
+ );
293
+ }
294
+ const assetIds = Object.keys(recipientMap);
295
+ if (assetIds.length === 0) {
296
+ throw new rgbSdkCore.ValidationError(
297
+ "recipientMap must contain at least one asset id",
298
+ "recipientMap"
299
+ );
300
+ }
301
+ for (const assetId of assetIds) {
302
+ const recipients = recipientMap[assetId];
303
+ if (!Array.isArray(recipients) || recipients.length === 0) {
304
+ throw new rgbSdkCore.ValidationError(
305
+ `recipientMap["${assetId}"] must be a non-empty array of recipients`,
306
+ "recipientMap"
307
+ );
308
+ }
309
+ }
310
+ const psbt = this.wallet.sendBegin(
311
+ online,
312
+ recipientMap,
313
+ donation,
314
+ feeRate,
315
+ minConfirmations
316
+ );
317
+ return psbt;
318
+ }
319
+ async sendEnd(params) {
320
+ const online = this.getOnline();
321
+ const signedPsbt = params.signedPsbt;
322
+ const skipSync = params.skipSync ?? false;
323
+ return this.wallet.sendEnd(online, signedPsbt, skipSync);
324
+ }
325
+ async sendBtcBegin(params) {
326
+ const online = this.getOnline();
327
+ const address = params.address;
328
+ const amount = String(params.amount);
329
+ const feeRate = String(params.feeRate);
330
+ const skipSync = params.skipSync ?? false;
331
+ return this.wallet.sendBtcBegin(online, address, amount, feeRate, skipSync);
332
+ }
333
+ async sendBtcEnd(params) {
334
+ const online = this.getOnline();
335
+ const signedPsbt = params.signedPsbt;
336
+ const skipSync = params.skipSync ?? false;
337
+ return this.wallet.sendBtcEnd(online, signedPsbt, skipSync);
338
+ }
339
+ async getFeeEstimation(params) {
340
+ const online = this.getOnline();
341
+ const blocks = String(params.blocks);
342
+ try {
343
+ const result = this.wallet.getFeeEstimation(online, blocks);
344
+ if (typeof result === "string") {
345
+ try {
346
+ return JSON.parse(result);
347
+ } catch {
348
+ return result;
349
+ }
350
+ }
351
+ return result;
352
+ } catch (_error) {
353
+ rgbSdkCore.logger.warn(
354
+ "rgb-lib estimation fee are not available, using default fee rate 2"
355
+ );
356
+ return 2;
357
+ }
358
+ }
359
+ async blindReceive(params) {
360
+ const assetId = params.assetId || null;
361
+ const assignment = `{"Fungible":${params.amount}}`;
362
+ const durationSeconds = String(params.durationSeconds ?? 2e3);
363
+ const transportEndpoints = [this.transportEndpoint];
364
+ const minConfirmations = String(params.minConfirmations ?? 3);
365
+ const raw = this.wallet.blindReceive(
366
+ assetId,
367
+ assignment,
368
+ durationSeconds,
369
+ transportEndpoints,
370
+ minConfirmations
371
+ );
372
+ return {
373
+ invoice: raw.invoice,
374
+ recipientId: raw.recipientId,
375
+ expirationTimestamp: raw.expirationTimestamp ?? null,
376
+ batchTransferIdx: raw.batchTransferIdx
377
+ };
378
+ }
379
+ async witnessReceive(params) {
380
+ const assetId = params.assetId || null;
381
+ const assignment = `{"Fungible":${params.amount}}`;
382
+ const durationSeconds = String(params.durationSeconds ?? 2e3);
383
+ const transportEndpoints = [this.transportEndpoint];
384
+ const minConfirmations = String(params.minConfirmations ?? 3);
385
+ const raw = this.wallet.witnessReceive(
386
+ assetId,
387
+ assignment,
388
+ durationSeconds,
389
+ transportEndpoints,
390
+ minConfirmations
391
+ );
392
+ return {
393
+ invoice: raw.invoice,
394
+ recipientId: raw.recipientId,
395
+ expirationTimestamp: raw.expirationTimestamp ?? null,
396
+ batchTransferIdx: raw.batchTransferIdx
397
+ };
398
+ }
399
+ async getAssetBalance(asset_id) {
400
+ const balance = this.wallet.getAssetBalance(asset_id);
401
+ return {
402
+ settled: balance.settled ?? 0,
403
+ future: balance.future ?? 0,
404
+ spendable: balance.spendable ?? 0,
405
+ offchainOutbound: balance.offchainOutbound ?? 0,
406
+ offchainInbound: balance.offchainInbound ?? 0
407
+ };
408
+ }
409
+ async issueAssetNia(params) {
410
+ const ticker = params.ticker;
411
+ const name = params.name;
412
+ const precision = String(params.precision);
413
+ const amounts = params.amounts.map((a) => String(a));
414
+ return this.wallet.issueAssetNIA(ticker, name, precision, amounts);
415
+ }
416
+ async issueAssetIfa(_params) {
417
+ throw new rgbSdkCore.ValidationError(
418
+ "issueAssetIfa is not fully supported in rgb-lib. Use RGB Node server for IFA assets.",
419
+ "asset"
420
+ );
421
+ }
422
+ async inflateBegin(_params) {
423
+ throw new rgbSdkCore.ValidationError(
424
+ "inflateBegin is not fully supported in rgb-lib. Use RGB Node server for inflation operations.",
425
+ "asset"
426
+ );
427
+ }
428
+ async inflateEnd(_params) {
429
+ throw new rgbSdkCore.ValidationError(
430
+ "inflateEnd is not fully supported in rgb-lib. Use RGB Node server for inflation operations.",
431
+ "asset"
432
+ );
433
+ }
434
+ async listAssets() {
435
+ const filterAssetSchemas = [];
436
+ return this.wallet.listAssets(filterAssetSchemas);
437
+ }
438
+ decodeRGBInvoiceRaw(params) {
439
+ const invoice = new rgblib__default.default.Invoice(params.invoice);
440
+ try {
441
+ return invoice.invoiceData();
442
+ } finally {
443
+ invoice.drop();
444
+ }
445
+ }
446
+ async decodeRGBInvoice(params) {
447
+ const raw = this.decodeRGBInvoiceRaw(params);
448
+ const assignmentKeys = Object.keys(raw.assignment);
449
+ const assignmentType = assignmentKeys[0];
450
+ const assignment = {
451
+ type: assignmentType ?? "Any",
452
+ amount: assignmentType && raw.assignment[assignmentType] ? Number(raw.assignment[assignmentType]) : void 0
453
+ };
454
+ return {
455
+ invoice: params.invoice,
456
+ recipientId: raw.recipientId,
457
+ assetSchema: raw.assetSchema,
458
+ assetId: raw.assetId,
459
+ network: raw.network,
460
+ assignment,
461
+ assignmentName: raw.assignmentName,
462
+ expirationTimestamp: raw.expirationTimestamp ?? null,
463
+ transportEndpoints: raw.transportEndpoints
464
+ };
465
+ }
466
+ refreshWallet() {
467
+ const online = this.getOnline();
468
+ const assetId = null;
469
+ const filter = [];
470
+ const skipSync = false;
471
+ return this.wallet.refresh(online, assetId, filter, skipSync);
472
+ }
473
+ dropWallet() {
474
+ if (this.online) {
475
+ rgblib__default.default.dropOnline(this.online);
476
+ this.online = null;
477
+ }
478
+ if (this.wallet) {
479
+ this.wallet.drop();
480
+ this.wallet = null;
481
+ }
482
+ }
483
+ async listTransactions() {
484
+ const online = this.getOnline();
485
+ const skipSync = false;
486
+ return this.wallet.listTransactions(online, skipSync);
487
+ }
488
+ async listTransfers(asset_id) {
489
+ return this.wallet.listTransfers(asset_id ? asset_id : null);
490
+ }
491
+ async failTransfers(params) {
492
+ const online = this.getOnline();
493
+ const batchTransferIdx = params.batchTransferIdx !== void 0 ? params.batchTransferIdx : null;
494
+ const noAssetOnly = params.noAssetOnly ?? false;
495
+ const skipSync = params.skipSync ?? false;
496
+ return this.wallet.failTransfers(
497
+ online,
498
+ batchTransferIdx,
499
+ noAssetOnly,
500
+ skipSync
501
+ );
502
+ }
503
+ deleteTransfers(params) {
504
+ const batchTransferIdx = params.batchTransferIdx !== void 0 ? params.batchTransferIdx : null;
505
+ const noAssetOnly = params.noAssetOnly ?? false;
506
+ return this.wallet.deleteTransfers(batchTransferIdx, noAssetOnly);
507
+ }
508
+ syncWallet() {
509
+ const online = this.getOnline();
510
+ this.wallet.sync(online);
511
+ }
512
+ async createBackup(params) {
513
+ if (!params.backupPath) {
514
+ throw new rgbSdkCore.ValidationError("backupPath is required", "backupPath");
515
+ }
516
+ if (!params.password) {
517
+ throw new rgbSdkCore.ValidationError("password is required", "password");
518
+ }
519
+ if (!fs2__namespace.existsSync(params.backupPath)) {
520
+ throw new rgbSdkCore.ValidationError(
521
+ `Backup directory does not exist: ${params.backupPath}`,
522
+ "backupPath"
523
+ );
524
+ }
525
+ const fullBackupPath = path3__namespace.join(
526
+ params.backupPath,
527
+ `${this.masterFingerprint}.backup`
528
+ );
529
+ this.wallet.backup(fullBackupPath, params.password);
530
+ return {
531
+ message: "Backup created successfully",
532
+ backupPath: fullBackupPath
533
+ };
534
+ }
535
+ /**
536
+ * Ensure VSS backup support is available in the underlying rgb-lib bindings.
537
+ * Returns the wallet instance and rgb-lib namespace as `any` for internal use.
538
+ */
539
+ getVssBindingsOrThrow(methodName) {
540
+ const walletAny = this.wallet;
541
+ const anyLib = rgblib__default.default;
542
+ if (!walletAny || typeof anyLib.VssBackupClient !== "function" || typeof walletAny[methodName] !== "function") {
543
+ throw new rgbSdkCore.WalletError(
544
+ "VSS backup is not available in the current rgb-lib build."
545
+ );
546
+ }
547
+ return { walletAny, anyLib };
548
+ }
549
+ /**
550
+ * Configure VSS cloud backup for this wallet.
551
+ */
552
+ configureVssBackup(config) {
553
+ const walletAny = this.wallet;
554
+ if (!walletAny || typeof walletAny.configureVssBackup !== "function") {
555
+ throw new rgbSdkCore.WalletError(
556
+ "VSS backup is not available in the current rgb-lib build."
557
+ );
558
+ }
559
+ const mappedConfig = {
560
+ server_url: config.serverUrl,
561
+ store_id: config.storeId,
562
+ signing_key: config.signingKey
563
+ };
564
+ if (config.encryptionEnabled !== void 0) {
565
+ mappedConfig.encryptionEnabled = config.encryptionEnabled;
566
+ }
567
+ if (config.autoBackup !== void 0) {
568
+ mappedConfig.autoBackup = config.autoBackup;
569
+ }
570
+ if (config.backupMode !== void 0) {
571
+ mappedConfig.backupMode = config.backupMode;
572
+ }
573
+ walletAny.configureVssBackup(mappedConfig);
574
+ }
575
+ /**
576
+ * Disable automatic VSS backup for this wallet.
577
+ */
578
+ disableVssAutoBackup() {
579
+ const walletAny = this.wallet;
580
+ if (!walletAny || typeof walletAny.disableVssAutoBackup !== "function") {
581
+ throw new rgbSdkCore.WalletError(
582
+ "VSS backup is not available in the current rgb-lib build."
583
+ );
584
+ }
585
+ walletAny.disableVssAutoBackup();
586
+ }
587
+ /**
588
+ * Trigger a VSS backup immediately using a one-off client created from config.
589
+ * Returns the server version of the stored backup.
590
+ */
591
+ async vssBackup(config) {
592
+ const { walletAny, anyLib } = this.getVssBindingsOrThrow("vssBackup");
593
+ const client = new anyLib.VssBackupClient({
594
+ server_url: config.serverUrl,
595
+ store_id: config.storeId,
596
+ signing_key: config.signingKey
597
+ });
598
+ try {
599
+ const version = walletAny.vssBackup(client);
600
+ return version;
601
+ } finally {
602
+ if (typeof client.drop === "function") {
603
+ client.drop();
604
+ }
605
+ }
606
+ }
607
+ /**
608
+ * Get VSS backup status information for this wallet using a one-off client.
609
+ */
610
+ async vssBackupInfo(config) {
611
+ const { walletAny, anyLib } = this.getVssBindingsOrThrow("vssBackupInfo");
612
+ const client = new anyLib.VssBackupClient({
613
+ server_url: config.serverUrl,
614
+ store_id: config.storeId,
615
+ signing_key: config.signingKey
616
+ });
617
+ try {
618
+ const info = walletAny.vssBackupInfo(client);
619
+ return {
620
+ backupExists: Boolean(info.backupExists ?? info.backup_exists),
621
+ serverVersion: info.serverVersion ?? info.server_version ?? null,
622
+ backupRequired: Boolean(info.backupRequired ?? info.backup_required)
623
+ };
624
+ } finally {
625
+ if (typeof client.drop === "function") {
626
+ client.drop();
627
+ }
628
+ }
629
+ }
630
+ /**
631
+ * Cleanup resources
632
+ */
633
+ dispose() {
634
+ this.dropWallet();
635
+ }
636
+ };
637
+ var bdk = bdkNode__namespace;
638
+ async function signPsbtFromSeedInternal(seed, psbtBase64, network, options) {
639
+ rgbSdkCore.validatePsbt(psbtBase64, "psbtBase64");
640
+ let rootNode;
641
+ try {
642
+ rootNode = rgbSdkCore.bip32Factory().fromSeed(
643
+ rgbSdkCore.normalizeSeedBuffer(seed),
644
+ rgbSdkCore.getNetworkVersions(network)
645
+ );
646
+ } catch (error) {
647
+ throw new rgbSdkCore.CryptoError(
648
+ "Failed to derive root node from seed",
649
+ error
650
+ );
651
+ }
652
+ const fp = await rgbSdkCore.calculateMasterFingerprint(rootNode);
653
+ const psbtType = rgbSdkCore.detectPsbtType(psbtBase64);
654
+ const bdkNetwork = network === "utexo" ? "signet" : network;
655
+ const trySign = (type) => {
656
+ const { external, internal } = rgbSdkCore.deriveDescriptors(
657
+ rootNode,
658
+ fp,
659
+ bdkNetwork,
660
+ type
661
+ );
662
+ let wallet2;
663
+ try {
664
+ wallet2 = bdk.Wallet.create(bdkNetwork, external, internal);
665
+ } catch (error) {
666
+ throw new rgbSdkCore.CryptoError("Failed to create BDK wallet", error);
667
+ }
668
+ const pstb2 = bdk.Psbt.from_string(psbtBase64.trim());
669
+ wallet2.sign(pstb2, options.signOptions || new bdk.SignOptions());
670
+ return pstb2;
671
+ };
672
+ let pstb;
673
+ try {
674
+ pstb = trySign(psbtType);
675
+ } catch {
676
+ const fallback = psbtType === "create_utxo" ? "send" : "create_utxo";
677
+ try {
678
+ pstb = trySign(fallback);
679
+ } catch (error) {
680
+ throw new rgbSdkCore.CryptoError(
681
+ "Failed to sign PSBT \u2014 both descriptor types failed",
682
+ error
683
+ );
684
+ }
685
+ }
686
+ return pstb.toString().trim();
687
+ }
688
+ async function signPsbt(mnemonic, psbtBase64, network = "testnet", options = {}) {
689
+ try {
690
+ rgbSdkCore.validateMnemonic(mnemonic, "mnemonic");
691
+ let seed;
692
+ try {
693
+ seed = rgbSdkCore.bip39.mnemonicToSeedSync(mnemonic);
694
+ } catch {
695
+ throw new rgbSdkCore.ValidationError("Invalid mnemonic format", "mnemonic");
696
+ }
697
+ const normalizedNetwork = rgbSdkCore.normalizeNetwork(network);
698
+ return await signPsbtFromSeedInternal(
699
+ seed,
700
+ psbtBase64,
701
+ normalizedNetwork,
702
+ options
703
+ );
704
+ } catch (error) {
705
+ if (error instanceof rgbSdkCore.ValidationError || error instanceof rgbSdkCore.CryptoError)
706
+ throw error;
707
+ throw new rgbSdkCore.CryptoError(
708
+ "Unexpected error during PSBT signing",
709
+ error
710
+ );
711
+ }
712
+ }
713
+ async function signPsbtFromSeed(seed, psbtBase64, network = "testnet", options = {}) {
714
+ const normalizedSeed = rgbSdkCore.normalizeSeedInput(seed);
715
+ const normalizedNetwork = rgbSdkCore.normalizeNetwork(network);
716
+ return signPsbtFromSeedInternal(
717
+ normalizedSeed,
718
+ psbtBase64,
719
+ normalizedNetwork,
720
+ options
721
+ );
722
+ }
723
+ async function estimatePsbt(psbtBase64) {
724
+ if (!psbtBase64) throw new rgbSdkCore.ValidationError("psbt is required", "psbt");
725
+ try {
726
+ const psbt = bitcoinjsLib.Psbt.fromBase64(psbtBase64.trim());
727
+ return {
728
+ fee: psbt.getFee(),
729
+ feeRate: psbt.getFeeRate(),
730
+ vbytes: psbt.extractTransaction().virtualSize()
731
+ };
732
+ } catch {
733
+ throw new rgbSdkCore.ValidationError("Invalid PSBT provided", "psbt");
734
+ }
735
+ }
736
+
737
+ // src/signer/NodeSigner.ts
738
+ var NodeSigner = class {
739
+ async signPsbtWithMnemonic(mnemonic, psbt, network) {
740
+ return signPsbt(mnemonic, psbt, network);
741
+ }
742
+ async signPsbtWithSeed(seed, psbt, network) {
743
+ return signPsbtFromSeed(seed, psbt, network);
744
+ }
745
+ async signMessage(params) {
746
+ return rgbSdkCore.signMessage(params);
747
+ }
748
+ async verifyMessage(params) {
749
+ return rgbSdkCore.verifyMessage(params);
750
+ }
751
+ async estimateFee(psbt) {
752
+ return estimatePsbt(psbt);
753
+ }
754
+ };
755
+ var restoreFromBackup = (params) => {
756
+ const { backupFilePath, password, dataDir } = params;
757
+ if (!backupFilePath) {
758
+ throw new rgbSdkCore.ValidationError("backup file is required", "backup");
759
+ }
760
+ if (!password) {
761
+ throw new rgbSdkCore.ValidationError("password is required", "password");
762
+ }
763
+ if (!dataDir) {
764
+ throw new rgbSdkCore.ValidationError("restore directory is required", "restoreDir");
765
+ }
766
+ return restoreWallet({ backupFilePath, password, dataDir });
767
+ };
768
+ var createWallet = async (network = "regtest") => {
769
+ return await rgbSdkCore.generateKeys(network);
770
+ };
771
+ var WalletManager = class extends rgbSdkCore.BaseWalletManager {
772
+ constructor(params) {
773
+ const dataDir = params.dataDir ?? path3__namespace.default.join(
774
+ process.cwd(),
775
+ ".rgb-wallet",
776
+ String(params.network ?? "regtest"),
777
+ params.masterFingerprint
778
+ );
779
+ const client = new NodeRgbLibBinding({
780
+ xpubVan: params.xpubVan,
781
+ xpubCol: params.xpubCol,
782
+ masterFingerprint: params.masterFingerprint,
783
+ network: String(params.network ?? "regtest"),
784
+ transportEndpoint: params.transportEndpoint,
785
+ indexerUrl: params.indexerUrl,
786
+ dataDir
787
+ });
788
+ super(params, client, new NodeSigner());
789
+ this.client = client;
790
+ }
791
+ async initialize() {
792
+ }
793
+ async goOnline(_indexerUrl, _skipConsistencyCheck) {
794
+ this.client.getOnline();
795
+ }
796
+ /**
797
+ * Register wallet with the network — Node-specific convenience method.
798
+ * Not part of IWalletManager; used directly by UTEXOWallet and callers
799
+ * that need the initial address + balance snapshot.
800
+ */
801
+ registerWallet() {
802
+ return this.client.registerWallet();
803
+ }
804
+ };
805
+ function createWalletManager(params) {
806
+ return new WalletManager(params);
807
+ }
808
+ var wallet = new Proxy({}, {
809
+ get(target, prop) {
810
+ {
811
+ throw new rgbSdkCore.WalletError(
812
+ "The legacy singleton wallet instance is deprecated. Please use `new WalletManager(params)` or `createWalletManager(params)` instead. Example: const wallet = new WalletManager({ xpubVan, xpubCol, masterFingerprint, network, transportEndpoint, indexerUrl })"
813
+ );
814
+ }
815
+ }
816
+ });
817
+ var BACKUP_FILE_SUFFIX = ".backup";
818
+ var LAYER1_BACKUP_SUFFIX = "_layer1.backup";
819
+ var UTEXO_BACKUP_SUFFIX = "_utexo.backup";
820
+ var UTEXO_BACKUP_TMP_LAYER1 = ".layer1";
821
+ var UTEXO_BACKUP_TMP_UTEXO = ".utexo";
822
+ function prepareUtxoBackupDirs(backupPath, masterFingerprint) {
823
+ const storeId = rgbSdkCore.getBackupStoreId(masterFingerprint);
824
+ if (!fs2__namespace.default.existsSync(backupPath)) {
825
+ fs2__namespace.default.mkdirSync(backupPath, { recursive: true });
826
+ }
827
+ const layer1TmpDir = path3__namespace.default.join(backupPath, UTEXO_BACKUP_TMP_LAYER1);
828
+ const utexoTmpDir = path3__namespace.default.join(backupPath, UTEXO_BACKUP_TMP_UTEXO);
829
+ fs2__namespace.default.mkdirSync(layer1TmpDir, { recursive: true });
830
+ fs2__namespace.default.mkdirSync(utexoTmpDir, { recursive: true });
831
+ return {
832
+ storeId,
833
+ layer1TmpDir,
834
+ utexoTmpDir,
835
+ layer1FinalPath: path3__namespace.default.join(
836
+ backupPath,
837
+ `${storeId}_layer1${BACKUP_FILE_SUFFIX}`
838
+ ),
839
+ utexoFinalPath: path3__namespace.default.join(
840
+ backupPath,
841
+ `${storeId}_utexo${BACKUP_FILE_SUFFIX}`
842
+ )
843
+ };
844
+ }
845
+ function finalizeUtxoBackupPaths(params) {
846
+ const {
847
+ layer1BackupPath,
848
+ utexoBackupPath,
849
+ layer1FinalPath,
850
+ utexoFinalPath,
851
+ layer1TmpDir,
852
+ utexoTmpDir
853
+ } = params;
854
+ fs2__namespace.default.renameSync(layer1BackupPath, layer1FinalPath);
855
+ fs2__namespace.default.renameSync(utexoBackupPath, utexoFinalPath);
856
+ fs2__namespace.default.rmdirSync(layer1TmpDir);
857
+ fs2__namespace.default.rmdirSync(utexoTmpDir);
858
+ }
859
+ async function restoreUtxoWalletFromVss(params) {
860
+ const {
861
+ mnemonic,
862
+ targetDir,
863
+ config: providedConfig,
864
+ networkPreset = "testnet",
865
+ vssServerUrl
866
+ } = params;
867
+ if (!mnemonic || !mnemonic.trim()) {
868
+ throw new rgbSdkCore.ValidationError("mnemonic is required", "mnemonic");
869
+ }
870
+ if (!targetDir) {
871
+ throw new rgbSdkCore.ValidationError("targetDir is required", "targetDir");
872
+ }
873
+ const serverUrl = vssServerUrl ?? rgbSdkCore.DEFAULT_VSS_SERVER_URL;
874
+ const config = providedConfig ?? await rgbSdkCore.buildVssConfigFromMnemonic(
875
+ mnemonic.trim(),
876
+ serverUrl,
877
+ networkPreset
878
+ );
879
+ const presetConfig = rgbSdkCore.getUtxoNetworkConfig(networkPreset);
880
+ const layer1Network = String(presetConfig.networkMap.mainnet);
881
+ const utexoNetwork = String(presetConfig.networkMap.utexo);
882
+ const masterFingerprint = config.storeId.replace(/^wallet_/, "") || config.storeId;
883
+ const layer1Config = {
884
+ ...config,
885
+ storeId: `${config.storeId}_layer1`
886
+ };
887
+ const utexoConfig = {
888
+ ...config,
889
+ storeId: `${config.storeId}_utexo`
890
+ };
891
+ const { walletPath: layer1Path } = restoreFromVss({
892
+ config: layer1Config,
893
+ targetDir: path3__namespace.default.join(targetDir, layer1Network, masterFingerprint)
894
+ });
895
+ const { walletPath: utexoPath } = restoreFromVss({
896
+ config: utexoConfig,
897
+ targetDir: path3__namespace.default.join(targetDir, utexoNetwork, masterFingerprint)
898
+ });
899
+ return { layer1Path, utexoPath, targetDir };
900
+ }
901
+ function restoreUtxoWalletFromBackup(params) {
902
+ const { backupPath, password, targetDir, networkPreset = "testnet" } = params;
903
+ if (!backupPath || !password || !targetDir) {
904
+ throw new rgbSdkCore.ValidationError(
905
+ "backupPath, password, and targetDir are required",
906
+ "restoreUtxoWalletFromBackup"
907
+ );
908
+ }
909
+ if (!fs2__namespace.default.existsSync(backupPath) || !fs2__namespace.default.statSync(backupPath).isDirectory()) {
910
+ throw new rgbSdkCore.ValidationError(
911
+ "backupPath must be an existing directory",
912
+ "backupPath"
913
+ );
914
+ }
915
+ const files = fs2__namespace.default.readdirSync(backupPath);
916
+ const layer1File = files.find((f) => f.endsWith(LAYER1_BACKUP_SUFFIX));
917
+ const utexoFile = files.find((f) => f.endsWith(UTEXO_BACKUP_SUFFIX));
918
+ if (!layer1File || !utexoFile) {
919
+ throw new rgbSdkCore.ValidationError(
920
+ `backupPath must contain wallet_<fp>_layer1.backup and wallet_<fp>_utexo.backup (from createBackup)`,
921
+ "backupPath"
922
+ );
923
+ }
924
+ const masterFingerprint = layer1File.slice(0, -LAYER1_BACKUP_SUFFIX.length).replace(/^wallet_/, "");
925
+ const expectedUtexoFile = `wallet_${masterFingerprint}${UTEXO_BACKUP_SUFFIX}`;
926
+ if (utexoFile !== expectedUtexoFile) {
927
+ throw new rgbSdkCore.ValidationError(
928
+ `Layer1 and utexo backup filenames must share the same wallet id (expected ${expectedUtexoFile})`,
929
+ "backupPath"
930
+ );
931
+ }
932
+ const layer1BackupFile = path3__namespace.default.join(backupPath, layer1File);
933
+ const utexoBackupFile = path3__namespace.default.join(backupPath, utexoFile);
934
+ if (!fs2__namespace.default.existsSync(layer1BackupFile) || !fs2__namespace.default.existsSync(utexoBackupFile)) {
935
+ throw new rgbSdkCore.ValidationError("Backup files not found", "backupPath");
936
+ }
937
+ const presetConfig = rgbSdkCore.getUtxoNetworkConfig(networkPreset);
938
+ const layer1Network = String(presetConfig.networkMap.mainnet);
939
+ const utexoNetwork = String(presetConfig.networkMap.utexo);
940
+ const layer1DataDir = path3__namespace.default.join(targetDir, layer1Network, masterFingerprint);
941
+ const utexoDataDir = path3__namespace.default.join(targetDir, utexoNetwork, masterFingerprint);
942
+ for (const dir of [layer1DataDir, utexoDataDir]) {
943
+ if (!fs2__namespace.default.existsSync(path3__namespace.default.dirname(dir))) {
944
+ fs2__namespace.default.mkdirSync(path3__namespace.default.dirname(dir), { recursive: true });
945
+ }
946
+ if (!fs2__namespace.default.existsSync(dir)) {
947
+ fs2__namespace.default.mkdirSync(dir, { recursive: true });
948
+ }
949
+ }
950
+ restoreWallet({
951
+ backupFilePath: layer1BackupFile,
952
+ password,
953
+ dataDir: layer1DataDir
954
+ });
955
+ restoreWallet({
956
+ backupFilePath: utexoBackupFile,
957
+ password,
958
+ dataDir: utexoDataDir
959
+ });
960
+ return {
961
+ layer1Path: layer1DataDir,
962
+ utexoPath: utexoDataDir,
963
+ targetDir
964
+ };
965
+ }
966
+ var UTEXOWallet = class extends rgbSdkCore.UTEXOWalletCore {
967
+ constructor() {
968
+ super(...arguments);
969
+ this._masterFingerprint = null;
970
+ }
971
+ async initialize() {
972
+ const layer1Keys = await this.derivePublicKeys(this.networkMap.mainnet);
973
+ const utexoKeys = await this.derivePublicKeys(this.networkMap.utexo);
974
+ this._masterFingerprint = utexoKeys.masterFingerprint;
975
+ const fp = utexoKeys.masterFingerprint;
976
+ const dataDir = this.options.dataDir;
977
+ this.utexoWallet = new WalletManager({
978
+ xpubVan: utexoKeys.accountXpubVanilla,
979
+ xpubCol: utexoKeys.accountXpubColored,
980
+ masterFingerprint: utexoKeys.masterFingerprint,
981
+ network: this.networkMap.utexo,
982
+ mnemonic: this.mnemonicOrSeed,
983
+ dataDir: dataDir ? path3__namespace.default.join(dataDir, String(this.networkMap.utexo), fp) : void 0
984
+ });
985
+ this.layer1Wallet = new WalletManager({
986
+ xpubVan: layer1Keys.accountXpubVanilla,
987
+ xpubCol: layer1Keys.accountXpubColored,
988
+ masterFingerprint: layer1Keys.masterFingerprint,
989
+ network: this.networkMap.mainnet,
990
+ mnemonic: this.mnemonicOrSeed,
991
+ dataDir: dataDir ? path3__namespace.default.join(dataDir, String(this.networkMap.mainnet), fp) : void 0
992
+ });
993
+ }
994
+ /**
995
+ * Create backup for both layer1 and utexo stores in one folder.
996
+ * Writes backupPath/wallet_{masterFingerprint}_layer1.backup and
997
+ * backupPath/wallet_{masterFingerprint}_utexo.backup
998
+ */
999
+ async createBackup(params) {
1000
+ this.ensureInitialized();
1001
+ const { backupPath, password } = params;
1002
+ if (!backupPath || !password) {
1003
+ throw new rgbSdkCore.ValidationError(
1004
+ "backupPath and password are required",
1005
+ "createBackup"
1006
+ );
1007
+ }
1008
+ const fp = this._masterFingerprint;
1009
+ const { layer1TmpDir, utexoTmpDir, layer1FinalPath, utexoFinalPath } = prepareUtxoBackupDirs(backupPath, fp);
1010
+ const layer1Result = await this.layer1Wallet.createBackup({
1011
+ backupPath: layer1TmpDir,
1012
+ password
1013
+ });
1014
+ const utexoResult = await this.utexoWallet.createBackup({
1015
+ backupPath: utexoTmpDir,
1016
+ password
1017
+ });
1018
+ finalizeUtxoBackupPaths({
1019
+ layer1BackupPath: layer1Result.backupPath,
1020
+ utexoBackupPath: utexoResult.backupPath,
1021
+ layer1FinalPath,
1022
+ utexoFinalPath,
1023
+ layer1TmpDir,
1024
+ utexoTmpDir
1025
+ });
1026
+ return {
1027
+ message: "Backup created successfully (layer1 + utexo)",
1028
+ backupPath,
1029
+ layer1BackupPath: layer1FinalPath,
1030
+ utexoBackupPath: utexoFinalPath
1031
+ };
1032
+ }
1033
+ };
1034
+
1035
+ // src/utils/environment.ts
1036
+ function isNode() {
1037
+ return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
1038
+ }
1039
+
1040
+ Object.defineProperty(exports, "BIP32_VERSIONS", {
1041
+ enumerable: true,
1042
+ get: function () { return rgbSdkCore.BIP32_VERSIONS; }
1043
+ });
1044
+ Object.defineProperty(exports, "BadRequestError", {
1045
+ enumerable: true,
1046
+ get: function () { return rgbSdkCore.BadRequestError; }
1047
+ });
1048
+ Object.defineProperty(exports, "COIN_BITCOIN_MAINNET", {
1049
+ enumerable: true,
1050
+ get: function () { return rgbSdkCore.COIN_BITCOIN_MAINNET; }
1051
+ });
1052
+ Object.defineProperty(exports, "COIN_BITCOIN_TESTNET", {
1053
+ enumerable: true,
1054
+ get: function () { return rgbSdkCore.COIN_BITCOIN_TESTNET; }
1055
+ });
1056
+ Object.defineProperty(exports, "COIN_RGB_MAINNET", {
1057
+ enumerable: true,
1058
+ get: function () { return rgbSdkCore.COIN_RGB_MAINNET; }
1059
+ });
1060
+ Object.defineProperty(exports, "COIN_RGB_TESTNET", {
1061
+ enumerable: true,
1062
+ get: function () { return rgbSdkCore.COIN_RGB_TESTNET; }
1063
+ });
1064
+ Object.defineProperty(exports, "ConfigurationError", {
1065
+ enumerable: true,
1066
+ get: function () { return rgbSdkCore.ConfigurationError; }
1067
+ });
1068
+ Object.defineProperty(exports, "ConflictError", {
1069
+ enumerable: true,
1070
+ get: function () { return rgbSdkCore.ConflictError; }
1071
+ });
1072
+ Object.defineProperty(exports, "CryptoError", {
1073
+ enumerable: true,
1074
+ get: function () { return rgbSdkCore.CryptoError; }
1075
+ });
1076
+ Object.defineProperty(exports, "DEFAULT_API_TIMEOUT", {
1077
+ enumerable: true,
1078
+ get: function () { return rgbSdkCore.DEFAULT_API_TIMEOUT; }
1079
+ });
1080
+ Object.defineProperty(exports, "DEFAULT_LOG_LEVEL", {
1081
+ enumerable: true,
1082
+ get: function () { return rgbSdkCore.DEFAULT_LOG_LEVEL; }
1083
+ });
1084
+ Object.defineProperty(exports, "DEFAULT_MAX_RETRIES", {
1085
+ enumerable: true,
1086
+ get: function () { return rgbSdkCore.DEFAULT_MAX_RETRIES; }
1087
+ });
1088
+ Object.defineProperty(exports, "DEFAULT_NETWORK", {
1089
+ enumerable: true,
1090
+ get: function () { return rgbSdkCore.DEFAULT_NETWORK; }
1091
+ });
1092
+ Object.defineProperty(exports, "DEFAULT_VSS_SERVER_URL", {
1093
+ enumerable: true,
1094
+ get: function () { return rgbSdkCore.DEFAULT_VSS_SERVER_URL; }
1095
+ });
1096
+ Object.defineProperty(exports, "DERIVATION_ACCOUNT", {
1097
+ enumerable: true,
1098
+ get: function () { return rgbSdkCore.DERIVATION_ACCOUNT; }
1099
+ });
1100
+ Object.defineProperty(exports, "DERIVATION_PURPOSE", {
1101
+ enumerable: true,
1102
+ get: function () { return rgbSdkCore.DERIVATION_PURPOSE; }
1103
+ });
1104
+ Object.defineProperty(exports, "KEYCHAIN_BTC", {
1105
+ enumerable: true,
1106
+ get: function () { return rgbSdkCore.KEYCHAIN_BTC; }
1107
+ });
1108
+ Object.defineProperty(exports, "KEYCHAIN_RGB", {
1109
+ enumerable: true,
1110
+ get: function () { return rgbSdkCore.KEYCHAIN_RGB; }
1111
+ });
1112
+ Object.defineProperty(exports, "LightningProtocol", {
1113
+ enumerable: true,
1114
+ get: function () { return rgbSdkCore.LightningProtocol; }
1115
+ });
1116
+ Object.defineProperty(exports, "LogLevel", {
1117
+ enumerable: true,
1118
+ get: function () { return rgbSdkCore.LogLevel; }
1119
+ });
1120
+ Object.defineProperty(exports, "NETWORK_MAP", {
1121
+ enumerable: true,
1122
+ get: function () { return rgbSdkCore.NETWORK_MAP; }
1123
+ });
1124
+ Object.defineProperty(exports, "NetworkError", {
1125
+ enumerable: true,
1126
+ get: function () { return rgbSdkCore.NetworkError; }
1127
+ });
1128
+ Object.defineProperty(exports, "NotFoundError", {
1129
+ enumerable: true,
1130
+ get: function () { return rgbSdkCore.NotFoundError; }
1131
+ });
1132
+ Object.defineProperty(exports, "OnchainProtocol", {
1133
+ enumerable: true,
1134
+ get: function () { return rgbSdkCore.OnchainProtocol; }
1135
+ });
1136
+ Object.defineProperty(exports, "RgbNodeError", {
1137
+ enumerable: true,
1138
+ get: function () { return rgbSdkCore.RgbNodeError; }
1139
+ });
1140
+ Object.defineProperty(exports, "SDKError", {
1141
+ enumerable: true,
1142
+ get: function () { return rgbSdkCore.SDKError; }
1143
+ });
1144
+ Object.defineProperty(exports, "UTEXOProtocol", {
1145
+ enumerable: true,
1146
+ get: function () { return rgbSdkCore.UTEXOProtocol; }
1147
+ });
1148
+ Object.defineProperty(exports, "ValidationError", {
1149
+ enumerable: true,
1150
+ get: function () { return rgbSdkCore.ValidationError; }
1151
+ });
1152
+ Object.defineProperty(exports, "WalletError", {
1153
+ enumerable: true,
1154
+ get: function () { return rgbSdkCore.WalletError; }
1155
+ });
1156
+ Object.defineProperty(exports, "accountXpubsFromMnemonic", {
1157
+ enumerable: true,
1158
+ get: function () { return rgbSdkCore.accountXpubsFromMnemonic; }
1159
+ });
1160
+ Object.defineProperty(exports, "bip39", {
1161
+ enumerable: true,
1162
+ get: function () { return rgbSdkCore.bip39; }
1163
+ });
1164
+ Object.defineProperty(exports, "configureLogging", {
1165
+ enumerable: true,
1166
+ get: function () { return rgbSdkCore.configureLogging; }
1167
+ });
1168
+ Object.defineProperty(exports, "deriveKeysFromMnemonic", {
1169
+ enumerable: true,
1170
+ get: function () { return rgbSdkCore.deriveKeysFromMnemonic; }
1171
+ });
1172
+ Object.defineProperty(exports, "deriveKeysFromMnemonicOrSeed", {
1173
+ enumerable: true,
1174
+ get: function () { return rgbSdkCore.deriveKeysFromMnemonicOrSeed; }
1175
+ });
1176
+ Object.defineProperty(exports, "deriveKeysFromSeed", {
1177
+ enumerable: true,
1178
+ get: function () { return rgbSdkCore.deriveKeysFromSeed; }
1179
+ });
1180
+ Object.defineProperty(exports, "deriveKeysFromXpriv", {
1181
+ enumerable: true,
1182
+ get: function () { return rgbSdkCore.deriveKeysFromXpriv; }
1183
+ });
1184
+ Object.defineProperty(exports, "deriveVssSigningKeyFromMnemonic", {
1185
+ enumerable: true,
1186
+ get: function () { return rgbSdkCore.deriveVssSigningKeyFromMnemonic; }
1187
+ });
1188
+ Object.defineProperty(exports, "generateKeys", {
1189
+ enumerable: true,
1190
+ get: function () { return rgbSdkCore.generateKeys; }
1191
+ });
1192
+ Object.defineProperty(exports, "getDestinationAsset", {
1193
+ enumerable: true,
1194
+ get: function () { return rgbSdkCore.getDestinationAsset; }
1195
+ });
1196
+ Object.defineProperty(exports, "getUtxoNetworkConfig", {
1197
+ enumerable: true,
1198
+ get: function () { return rgbSdkCore.getUtxoNetworkConfig; }
1199
+ });
1200
+ Object.defineProperty(exports, "getXprivFromMnemonic", {
1201
+ enumerable: true,
1202
+ get: function () { return rgbSdkCore.getXprivFromMnemonic; }
1203
+ });
1204
+ Object.defineProperty(exports, "getXpubFromXpriv", {
1205
+ enumerable: true,
1206
+ get: function () { return rgbSdkCore.getXpubFromXpriv; }
1207
+ });
1208
+ Object.defineProperty(exports, "isNetwork", {
1209
+ enumerable: true,
1210
+ get: function () { return rgbSdkCore.isNetwork; }
1211
+ });
1212
+ Object.defineProperty(exports, "logger", {
1213
+ enumerable: true,
1214
+ get: function () { return rgbSdkCore.logger; }
1215
+ });
1216
+ Object.defineProperty(exports, "normalizeNetwork", {
1217
+ enumerable: true,
1218
+ get: function () { return rgbSdkCore.normalizeNetwork; }
1219
+ });
1220
+ Object.defineProperty(exports, "restoreKeys", {
1221
+ enumerable: true,
1222
+ get: function () { return rgbSdkCore.restoreKeys; }
1223
+ });
1224
+ Object.defineProperty(exports, "signMessage", {
1225
+ enumerable: true,
1226
+ get: function () { return rgbSdkCore.signMessage; }
1227
+ });
1228
+ Object.defineProperty(exports, "utexoNetworkIdMap", {
1229
+ enumerable: true,
1230
+ get: function () { return rgbSdkCore.utexoNetworkIdMap; }
1231
+ });
1232
+ Object.defineProperty(exports, "utexoNetworkMap", {
1233
+ enumerable: true,
1234
+ get: function () { return rgbSdkCore.utexoNetworkMap; }
1235
+ });
1236
+ Object.defineProperty(exports, "validateBase64", {
1237
+ enumerable: true,
1238
+ get: function () { return rgbSdkCore.validateBase64; }
1239
+ });
1240
+ Object.defineProperty(exports, "validateHex", {
1241
+ enumerable: true,
1242
+ get: function () { return rgbSdkCore.validateHex; }
1243
+ });
1244
+ Object.defineProperty(exports, "validateMnemonic", {
1245
+ enumerable: true,
1246
+ get: function () { return rgbSdkCore.validateMnemonic; }
1247
+ });
1248
+ Object.defineProperty(exports, "validateNetwork", {
1249
+ enumerable: true,
1250
+ get: function () { return rgbSdkCore.validateNetwork; }
1251
+ });
1252
+ Object.defineProperty(exports, "validatePsbt", {
1253
+ enumerable: true,
1254
+ get: function () { return rgbSdkCore.validatePsbt; }
1255
+ });
1256
+ Object.defineProperty(exports, "validateRequired", {
1257
+ enumerable: true,
1258
+ get: function () { return rgbSdkCore.validateRequired; }
1259
+ });
1260
+ Object.defineProperty(exports, "validateString", {
1261
+ enumerable: true,
1262
+ get: function () { return rgbSdkCore.validateString; }
1263
+ });
1264
+ Object.defineProperty(exports, "verifyMessage", {
1265
+ enumerable: true,
1266
+ get: function () { return rgbSdkCore.verifyMessage; }
1267
+ });
1268
+ exports.UTEXOWallet = UTEXOWallet;
1269
+ exports.WalletManager = WalletManager;
1270
+ exports.createWallet = createWallet;
1271
+ exports.createWalletManager = createWalletManager;
1272
+ exports.estimatePsbt = estimatePsbt;
1273
+ exports.isNode = isNode;
1274
+ exports.restoreFromBackup = restoreFromBackup;
1275
+ exports.restoreFromVss = restoreFromVss;
1276
+ exports.restoreUtxoWalletFromBackup = restoreUtxoWalletFromBackup;
1277
+ exports.restoreUtxoWalletFromVss = restoreUtxoWalletFromVss;
1278
+ exports.signPsbt = signPsbt;
1279
+ exports.signPsbtFromSeed = signPsbtFromSeed;
1280
+ exports.wallet = wallet;
1281
+ //# sourceMappingURL=index.cjs.map
1282
+ //# sourceMappingURL=index.cjs.map