@sats-connect/core 0.9.0-6f299e4 → 0.10.0-2560ac8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,2376 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ let valibot = require("valibot");
25
+ valibot = __toESM(valibot);
26
+ let jsontokens = require("jsontokens");
27
+ jsontokens = __toESM(jsontokens);
28
+ let axios = require("axios");
29
+ axios = __toESM(axios);
30
+ let bitcoin_address_validation = require("bitcoin-address-validation");
31
+ bitcoin_address_validation = __toESM(bitcoin_address_validation);
32
+ let buffer = require("buffer");
33
+ buffer = __toESM(buffer);
34
+
35
+ //#region src/request/types/common.ts
36
+ const walletTypes = [
37
+ "software",
38
+ "ledger",
39
+ "keystone"
40
+ ];
41
+ const walletTypeSchema = valibot.picklist(walletTypes);
42
+
43
+ //#endregion
44
+ //#region src/addresses/types.ts
45
+ let AddressPurpose = /* @__PURE__ */ function(AddressPurpose$1) {
46
+ AddressPurpose$1["Ordinals"] = "ordinals";
47
+ AddressPurpose$1["Payment"] = "payment";
48
+ AddressPurpose$1["Stacks"] = "stacks";
49
+ AddressPurpose$1["Starknet"] = "starknet";
50
+ AddressPurpose$1["Spark"] = "spark";
51
+ return AddressPurpose$1;
52
+ }({});
53
+ let AddressType = /* @__PURE__ */ function(AddressType$2) {
54
+ AddressType$2["p2pkh"] = "p2pkh";
55
+ AddressType$2["p2sh"] = "p2sh";
56
+ AddressType$2["p2wpkh"] = "p2wpkh";
57
+ AddressType$2["p2wsh"] = "p2wsh";
58
+ AddressType$2["p2tr"] = "p2tr";
59
+ AddressType$2["stacks"] = "stacks";
60
+ AddressType$2["starknet"] = "starknet";
61
+ AddressType$2["spark"] = "spark";
62
+ return AddressType$2;
63
+ }({});
64
+ const addressSchema = valibot.object({
65
+ address: valibot.string(),
66
+ publicKey: valibot.string(),
67
+ purpose: valibot.enum(AddressPurpose),
68
+ addressType: valibot.enum(AddressType),
69
+ walletType: walletTypeSchema
70
+ });
71
+
72
+ //#endregion
73
+ //#region src/addresses/index.ts
74
+ /**
75
+ * @deprecated Use `request()` instead
76
+ */
77
+ const getAddress = async (options) => {
78
+ const provider = await getProviderOrThrow(options.getProvider);
79
+ const { purposes } = options.payload;
80
+ if (!purposes) throw new Error("Address purposes are required");
81
+ try {
82
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
83
+ const response = await provider.connect(request$1);
84
+ options.onFinish?.(response);
85
+ } catch (error) {
86
+ console.error("[Connect] Error during address request", error);
87
+ options.onCancel?.();
88
+ }
89
+ };
90
+
91
+ //#endregion
92
+ //#region src/request/types/walletMethods/utils.ts
93
+ const commonNetworkSchema = valibot.object({
94
+ id: valibot.string(),
95
+ name: valibot.string(),
96
+ mode: valibot.picklist([]),
97
+ blockExplorerUrl: valibot.optional(valibot.pipe(valibot.string(), valibot.url()))
98
+ });
99
+ const bitcoinChainModeSchema = valibot.picklist([
100
+ "mainnet",
101
+ "testnet",
102
+ "testnet4",
103
+ "signet",
104
+ "regtest"
105
+ ]);
106
+ const bitcoinNetworkSchema = valibot.object({
107
+ chain: valibot.literal("bitcoin"),
108
+ ...commonNetworkSchema.entries,
109
+ mode: bitcoinChainModeSchema,
110
+ xverseApiUrl: valibot.string(),
111
+ electrsApiUrl: valibot.string()
112
+ });
113
+ const sparkChainModeSchema = valibot.picklist(["mainnet", "regtest"]);
114
+ const sparkNetworkSchema = valibot.object({
115
+ chain: valibot.literal("spark"),
116
+ ...commonNetworkSchema.entries,
117
+ mode: sparkChainModeSchema,
118
+ electrsApiUrl: valibot.string()
119
+ });
120
+ const stacksChainModeSchema = valibot.picklist([
121
+ "mainnet",
122
+ "testnet",
123
+ "devnet",
124
+ "mocknet"
125
+ ]);
126
+ const stacksNetworkSchema = valibot.object({
127
+ chain: valibot.literal("stacks"),
128
+ ...commonNetworkSchema.entries,
129
+ mode: stacksChainModeSchema,
130
+ stacksApiUrl: valibot.string(),
131
+ xverseApiUrl: valibot.string()
132
+ });
133
+ const starknetChainModeSchema = valibot.picklist(["mainnet", "sepolia"]);
134
+ const starknetNetworkSchema = valibot.object({
135
+ chain: valibot.literal("starknet"),
136
+ ...commonNetworkSchema.entries,
137
+ mode: starknetChainModeSchema,
138
+ rpcApiUrl: valibot.string(),
139
+ xverseApiUrl: valibot.string()
140
+ });
141
+ const networkSchema = valibot.variant("chain", [
142
+ bitcoinNetworkSchema,
143
+ sparkNetworkSchema,
144
+ stacksNetworkSchema,
145
+ starknetNetworkSchema
146
+ ]);
147
+
148
+ //#endregion
149
+ //#region src/provider/types.ts
150
+ const accountChangeEventName = "accountChange";
151
+ const accountChangeSchema = valibot.object({
152
+ type: valibot.literal(accountChangeEventName),
153
+ addresses: valibot.optional(valibot.array(addressSchema))
154
+ });
155
+ const networkChangeEventName = "networkChange";
156
+ const networkChangeSchema = valibot.object({
157
+ type: valibot.literal(networkChangeEventName),
158
+ networks: valibot.object({
159
+ bitcoin: bitcoinNetworkSchema,
160
+ spark: sparkNetworkSchema,
161
+ stacks: stacksNetworkSchema,
162
+ starknet: starknetNetworkSchema
163
+ }),
164
+ addresses: valibot.optional(valibot.array(addressSchema))
165
+ });
166
+ const disconnectEventName = "disconnect";
167
+ const disconnectSchema = valibot.object({ type: valibot.literal(disconnectEventName) });
168
+ const walletEventSchema = valibot.variant("type", [
169
+ accountChangeSchema,
170
+ networkChangeSchema,
171
+ disconnectSchema
172
+ ]);
173
+
174
+ //#endregion
175
+ //#region src/provider/index.ts
176
+ async function getProviderOrThrow(getProvider) {
177
+ const provider = await getProvider?.() || window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
178
+ if (!provider) throw new Error("No Bitcoin wallet installed");
179
+ return provider;
180
+ }
181
+ function getProviders() {
182
+ if (!window.btc_providers) window.btc_providers = [];
183
+ return window.btc_providers;
184
+ }
185
+ function getProviderById(providerId) {
186
+ return providerId?.split(".").reduce((acc, part) => acc?.[part], window);
187
+ }
188
+ function isProviderInstalled(providerId) {
189
+ return !!getProviderById(providerId);
190
+ }
191
+ function setDefaultProvider(providerId) {
192
+ localStorage.setItem("sats-connect_defaultProvider", providerId);
193
+ }
194
+ function getDefaultProvider() {
195
+ return localStorage.getItem("sats-connect_defaultProvider");
196
+ }
197
+ function removeDefaultProvider() {
198
+ localStorage.removeItem("sats-connect_defaultProvider");
199
+ }
200
+ function getSupportedWallets() {
201
+ return Object.values(DefaultAdaptersInfo).map((provider) => {
202
+ return {
203
+ ...provider,
204
+ isInstalled: isProviderInstalled(provider.id)
205
+ };
206
+ });
207
+ }
208
+
209
+ //#endregion
210
+ //#region src/types.ts
211
+ let BitcoinNetworkType = /* @__PURE__ */ function(BitcoinNetworkType$1) {
212
+ BitcoinNetworkType$1["Mainnet"] = "Mainnet";
213
+ BitcoinNetworkType$1["Testnet"] = "Testnet";
214
+ BitcoinNetworkType$1["Testnet4"] = "Testnet4";
215
+ BitcoinNetworkType$1["Signet"] = "Signet";
216
+ BitcoinNetworkType$1["Regtest"] = "Regtest";
217
+ return BitcoinNetworkType$1;
218
+ }({});
219
+ let StacksNetworkType = /* @__PURE__ */ function(StacksNetworkType$1) {
220
+ StacksNetworkType$1["Mainnet"] = "mainnet";
221
+ StacksNetworkType$1["Testnet"] = "testnet";
222
+ return StacksNetworkType$1;
223
+ }({});
224
+ let StarknetNetworkType = /* @__PURE__ */ function(StarknetNetworkType$1) {
225
+ StarknetNetworkType$1["Mainnet"] = "mainnet";
226
+ StarknetNetworkType$1["Sepolia"] = "sepolia";
227
+ return StarknetNetworkType$1;
228
+ }({});
229
+ let SparkNetworkType = /* @__PURE__ */ function(SparkNetworkType$1) {
230
+ SparkNetworkType$1["Mainnet"] = "mainnet";
231
+ SparkNetworkType$1["Regtest"] = "regtest";
232
+ return SparkNetworkType$1;
233
+ }({});
234
+ const RpcIdSchema = valibot.optional(valibot.union([
235
+ valibot.string(),
236
+ valibot.number(),
237
+ valibot.null()
238
+ ]));
239
+ const rpcRequestMessageSchema = valibot.object({
240
+ jsonrpc: valibot.literal("2.0"),
241
+ method: valibot.string(),
242
+ params: valibot.optional(valibot.union([
243
+ valibot.array(valibot.unknown()),
244
+ valibot.looseObject({}),
245
+ valibot.null()
246
+ ])),
247
+ id: valibot.unwrap(RpcIdSchema)
248
+ });
249
+ /**
250
+ * @enum {number} RpcErrorCode
251
+ * @description JSON-RPC error codes
252
+ * @see https://www.jsonrpc.org/specification#error_object
253
+ */
254
+ let RpcErrorCode = /* @__PURE__ */ function(RpcErrorCode$1) {
255
+ /**
256
+ * Parse error Invalid JSON
257
+ **/
258
+ RpcErrorCode$1[RpcErrorCode$1["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
259
+ /**
260
+ * The JSON sent is not a valid Request object.
261
+ **/
262
+ RpcErrorCode$1[RpcErrorCode$1["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
263
+ /**
264
+ * The method does not exist/is not available.
265
+ **/
266
+ RpcErrorCode$1[RpcErrorCode$1["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
267
+ /**
268
+ * Invalid method parameter(s).
269
+ */
270
+ RpcErrorCode$1[RpcErrorCode$1["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
271
+ /**
272
+ * Internal JSON-RPC error.
273
+ * This is a generic error, used when the server encounters an error in performing the request.
274
+ **/
275
+ RpcErrorCode$1[RpcErrorCode$1["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
276
+ /**
277
+ * user rejected/canceled the request
278
+ */
279
+ RpcErrorCode$1[RpcErrorCode$1["USER_REJECTION"] = -32e3] = "USER_REJECTION";
280
+ /**
281
+ * method is not supported for the address provided
282
+ */
283
+ RpcErrorCode$1[RpcErrorCode$1["METHOD_NOT_SUPPORTED"] = -32001] = "METHOD_NOT_SUPPORTED";
284
+ /**
285
+ * The client does not have permission to access the requested resource.
286
+ */
287
+ RpcErrorCode$1[RpcErrorCode$1["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
288
+ return RpcErrorCode$1;
289
+ }({});
290
+ const rpcSuccessResponseMessageSchema = valibot.object({
291
+ jsonrpc: valibot.literal("2.0"),
292
+ result: valibot.nonOptional(valibot.unknown()),
293
+ id: RpcIdSchema
294
+ });
295
+ const rpcErrorResponseMessageSchema = valibot.object({
296
+ jsonrpc: valibot.literal("2.0"),
297
+ error: valibot.nonOptional(valibot.unknown()),
298
+ id: RpcIdSchema
299
+ });
300
+ const rpcResponseMessageSchema = valibot.union([rpcSuccessResponseMessageSchema, rpcErrorResponseMessageSchema]);
301
+
302
+ //#endregion
303
+ //#region src/request/sanitizeRequest.ts
304
+ const sanitizeRequest = (method, params, providerInfo) => {
305
+ try {
306
+ const [major, minor, patch] = providerInfo.version.split(".").map((part) => parseInt(part, 10));
307
+ const platform = providerInfo.platform;
308
+ if (!platform || platform === ProviderPlatform.Web && major <= 1 && minor <= 4 || platform === ProviderPlatform.Mobile && major <= 1 && minor <= 54) {
309
+ const v1Sanitized = sanitizeAddressPurposeRequest(method, params);
310
+ method = v1Sanitized.method;
311
+ params = v1Sanitized.params;
312
+ }
313
+ } catch {}
314
+ return {
315
+ method,
316
+ params
317
+ };
318
+ };
319
+ const sanitizeAddressPurposeRequest = (method, params) => {
320
+ const filterPurposes = (purposes) => purposes?.filter((purpose) => purpose !== AddressPurpose.Spark && purpose !== AddressPurpose.Starknet);
321
+ if (method === "wallet_connect") {
322
+ const typedParams = params;
323
+ if (!typedParams) return {
324
+ method,
325
+ params
326
+ };
327
+ const { addresses,...rest } = typedParams;
328
+ return {
329
+ method,
330
+ params: {
331
+ ...rest,
332
+ addresses: filterPurposes(addresses)
333
+ }
334
+ };
335
+ }
336
+ if (method === "getAccounts") {
337
+ const { purposes,...rest } = params;
338
+ return {
339
+ method,
340
+ params: {
341
+ ...rest,
342
+ purposes: filterPurposes(purposes)
343
+ }
344
+ };
345
+ }
346
+ if (method === "getAddresses") {
347
+ const { purposes,...rest } = params;
348
+ return {
349
+ method,
350
+ params: {
351
+ ...rest,
352
+ purposes: filterPurposes(purposes)
353
+ }
354
+ };
355
+ }
356
+ return {
357
+ method,
358
+ params
359
+ };
360
+ };
361
+
362
+ //#endregion
363
+ //#region src/request/types/btcMethods.ts
364
+ let ProviderPlatform = /* @__PURE__ */ function(ProviderPlatform$1) {
365
+ ProviderPlatform$1["Web"] = "web";
366
+ ProviderPlatform$1["Mobile"] = "mobile";
367
+ return ProviderPlatform$1;
368
+ }({});
369
+ const getInfoMethodName = "getInfo";
370
+ const getInfoParamsSchema = valibot.nullish(valibot.null());
371
+ const getInfoResultSchema = valibot.object({
372
+ version: valibot.string(),
373
+ platform: valibot.optional(valibot.enum(ProviderPlatform)),
374
+ methods: valibot.optional(valibot.array(valibot.string())),
375
+ supports: valibot.array(valibot.string())
376
+ });
377
+ const getInfoRequestMessageSchema = valibot.object({
378
+ ...rpcRequestMessageSchema.entries,
379
+ ...valibot.object({
380
+ method: valibot.literal(getInfoMethodName),
381
+ params: getInfoParamsSchema,
382
+ id: valibot.string()
383
+ }).entries
384
+ });
385
+ const getAddressesMethodName = "getAddresses";
386
+ const getAddressesParamsSchema = valibot.object({
387
+ purposes: valibot.array(valibot.enum(AddressPurpose)),
388
+ message: valibot.optional(valibot.string())
389
+ });
390
+ const getAddressesResultSchema = valibot.object({
391
+ addresses: valibot.array(addressSchema),
392
+ network: bitcoinNetworkSchema
393
+ });
394
+ const getAddressesRequestMessageSchema = valibot.object({
395
+ ...rpcRequestMessageSchema.entries,
396
+ ...valibot.object({
397
+ method: valibot.literal(getAddressesMethodName),
398
+ params: getAddressesParamsSchema,
399
+ id: valibot.string()
400
+ }).entries
401
+ });
402
+ const signMessageMethodName = "signMessage";
403
+ let MessageSigningProtocols = /* @__PURE__ */ function(MessageSigningProtocols$1) {
404
+ MessageSigningProtocols$1["ECDSA"] = "ECDSA";
405
+ MessageSigningProtocols$1["BIP322"] = "BIP322";
406
+ return MessageSigningProtocols$1;
407
+ }({});
408
+ const signMessageParamsSchema = valibot.object({
409
+ address: valibot.string(),
410
+ message: valibot.string(),
411
+ protocol: valibot.optional(valibot.enum(MessageSigningProtocols))
412
+ });
413
+ const signMessageResultSchema = valibot.object({
414
+ signature: valibot.string(),
415
+ messageHash: valibot.string(),
416
+ address: valibot.string(),
417
+ protocol: valibot.enum(MessageSigningProtocols)
418
+ });
419
+ const signMessageRequestMessageSchema = valibot.object({
420
+ ...rpcRequestMessageSchema.entries,
421
+ ...valibot.object({
422
+ method: valibot.literal(signMessageMethodName),
423
+ params: signMessageParamsSchema,
424
+ id: valibot.string()
425
+ }).entries
426
+ });
427
+ const sendTransferMethodName = "sendTransfer";
428
+ const sendTransferParamsSchema = valibot.object({ recipients: valibot.array(valibot.object({
429
+ address: valibot.string(),
430
+ amount: valibot.number()
431
+ })) });
432
+ const sendTransferResultSchema = valibot.object({ txid: valibot.string() });
433
+ const sendTransferRequestMessageSchema = valibot.object({
434
+ ...rpcRequestMessageSchema.entries,
435
+ ...valibot.object({
436
+ method: valibot.literal(sendTransferMethodName),
437
+ params: sendTransferParamsSchema,
438
+ id: valibot.string()
439
+ }).entries
440
+ });
441
+ const signPsbtMethodName = "signPsbt";
442
+ const signPsbtParamsSchema = valibot.object({
443
+ psbt: valibot.string(),
444
+ signInputs: valibot.optional(valibot.record(valibot.string(), valibot.array(valibot.number()))),
445
+ broadcast: valibot.optional(valibot.boolean())
446
+ });
447
+ const signPsbtResultSchema = valibot.object({
448
+ psbt: valibot.string(),
449
+ txid: valibot.optional(valibot.string())
450
+ });
451
+ const signPsbtRequestMessageSchema = valibot.object({
452
+ ...rpcRequestMessageSchema.entries,
453
+ ...valibot.object({
454
+ method: valibot.literal(signPsbtMethodName),
455
+ params: signPsbtParamsSchema,
456
+ id: valibot.string()
457
+ }).entries
458
+ });
459
+ const getAccountsMethodName = "getAccounts";
460
+ const getAccountsParamsSchema = valibot.object({
461
+ purposes: valibot.array(valibot.enum(AddressPurpose)),
462
+ message: valibot.optional(valibot.string())
463
+ });
464
+ const getAccountsResultSchema = valibot.array(valibot.object({
465
+ ...addressSchema.entries,
466
+ ...valibot.object({ walletType: walletTypeSchema }).entries
467
+ }));
468
+ const getAccountsRequestMessageSchema = valibot.object({
469
+ ...rpcRequestMessageSchema.entries,
470
+ ...valibot.object({
471
+ method: valibot.literal(getAccountsMethodName),
472
+ params: getAccountsParamsSchema,
473
+ id: valibot.string()
474
+ }).entries
475
+ });
476
+ const getBalanceMethodName = "getBalance";
477
+ const getBalanceParamsSchema = valibot.nullish(valibot.null());
478
+ const getBalanceResultSchema = valibot.object({
479
+ confirmed: valibot.string(),
480
+ unconfirmed: valibot.string(),
481
+ total: valibot.string()
482
+ });
483
+ const getBalanceRequestMessageSchema = valibot.object({
484
+ ...rpcRequestMessageSchema.entries,
485
+ ...valibot.object({
486
+ method: valibot.literal(getBalanceMethodName),
487
+ id: valibot.string()
488
+ }).entries
489
+ });
490
+
491
+ //#endregion
492
+ //#region src/request/types/ordinalsMethods.ts
493
+ const getInscriptionsMethodName = "ord_getInscriptions";
494
+ const getInscriptionsParamsSchema = valibot.object({
495
+ offset: valibot.number(),
496
+ limit: valibot.number()
497
+ });
498
+ const getInscriptionsResultSchema = valibot.object({
499
+ total: valibot.number(),
500
+ limit: valibot.number(),
501
+ offset: valibot.number(),
502
+ inscriptions: valibot.array(valibot.object({
503
+ inscriptionId: valibot.string(),
504
+ inscriptionNumber: valibot.string(),
505
+ address: valibot.string(),
506
+ collectionName: valibot.optional(valibot.string()),
507
+ postage: valibot.string(),
508
+ contentLength: valibot.string(),
509
+ contentType: valibot.string(),
510
+ timestamp: valibot.number(),
511
+ offset: valibot.number(),
512
+ genesisTransaction: valibot.string(),
513
+ output: valibot.string()
514
+ }))
515
+ });
516
+ const getInscriptionsRequestMessageSchema = valibot.object({
517
+ ...rpcRequestMessageSchema.entries,
518
+ ...valibot.object({
519
+ method: valibot.literal(getInscriptionsMethodName),
520
+ params: getInscriptionsParamsSchema,
521
+ id: valibot.string()
522
+ }).entries
523
+ });
524
+ const sendInscriptionsMethodName = "ord_sendInscriptions";
525
+ const sendInscriptionsParamsSchema = valibot.object({ transfers: valibot.array(valibot.object({
526
+ address: valibot.string(),
527
+ inscriptionId: valibot.string()
528
+ })) });
529
+ const sendInscriptionsResultSchema = valibot.object({ txid: valibot.string() });
530
+ const sendInscriptionsRequestMessageSchema = valibot.object({
531
+ ...rpcRequestMessageSchema.entries,
532
+ ...valibot.object({
533
+ method: valibot.literal(sendInscriptionsMethodName),
534
+ params: sendInscriptionsParamsSchema,
535
+ id: valibot.string()
536
+ }).entries
537
+ });
538
+
539
+ //#endregion
540
+ //#region src/request/types/runesMethods/etch.ts
541
+ const runesEtchMethodName = "runes_etch";
542
+ const etchTermsSchema = valibot.object({
543
+ amount: valibot.string(),
544
+ cap: valibot.string(),
545
+ heightStart: valibot.optional(valibot.string()),
546
+ heightEnd: valibot.optional(valibot.string()),
547
+ offsetStart: valibot.optional(valibot.string()),
548
+ offsetEnd: valibot.optional(valibot.string())
549
+ });
550
+ const inscriptionDetailsSchema = valibot.object({
551
+ contentType: valibot.string(),
552
+ contentBase64: valibot.string()
553
+ });
554
+ const runesEtchParamsSchema = valibot.object({
555
+ runeName: valibot.string(),
556
+ divisibility: valibot.optional(valibot.number()),
557
+ symbol: valibot.optional(valibot.string()),
558
+ premine: valibot.optional(valibot.string()),
559
+ isMintable: valibot.boolean(),
560
+ delegateInscriptionId: valibot.optional(valibot.string()),
561
+ destinationAddress: valibot.string(),
562
+ refundAddress: valibot.string(),
563
+ feeRate: valibot.number(),
564
+ appServiceFee: valibot.optional(valibot.number()),
565
+ appServiceFeeAddress: valibot.optional(valibot.string()),
566
+ terms: valibot.optional(etchTermsSchema),
567
+ inscriptionDetails: valibot.optional(inscriptionDetailsSchema),
568
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
569
+ });
570
+ const runesEtchResultSchema = valibot.object({
571
+ orderId: valibot.string(),
572
+ fundTransactionId: valibot.string(),
573
+ fundingAddress: valibot.string()
574
+ });
575
+ const runesEtchRequestMessageSchema = valibot.object({
576
+ ...rpcRequestMessageSchema.entries,
577
+ ...valibot.object({
578
+ method: valibot.literal(runesEtchMethodName),
579
+ params: runesEtchParamsSchema,
580
+ id: valibot.string()
581
+ }).entries
582
+ });
583
+
584
+ //#endregion
585
+ //#region src/request/types/runesMethods/getBalance.ts
586
+ const runesGetBalanceMethodName = "runes_getBalance";
587
+ const runesGetBalanceParamsSchema = valibot.nullish(valibot.null());
588
+ const runesGetBalanceResultSchema = valibot.object({ balances: valibot.array(valibot.object({
589
+ runeName: valibot.string(),
590
+ amount: valibot.string(),
591
+ divisibility: valibot.number(),
592
+ symbol: valibot.string(),
593
+ inscriptionId: valibot.nullish(valibot.string()),
594
+ spendableBalance: valibot.string()
595
+ })) });
596
+ const runesGetBalanceRequestMessageSchema = valibot.object({
597
+ ...rpcRequestMessageSchema.entries,
598
+ ...valibot.object({
599
+ method: valibot.literal(runesGetBalanceMethodName),
600
+ params: runesGetBalanceParamsSchema,
601
+ id: valibot.string()
602
+ }).entries
603
+ });
604
+
605
+ //#endregion
606
+ //#region src/request/types/runesMethods/mint.ts
607
+ const runesMintMethodName = "runes_mint";
608
+ const runesMintParamsSchema = valibot.object({
609
+ appServiceFee: valibot.optional(valibot.number()),
610
+ appServiceFeeAddress: valibot.optional(valibot.string()),
611
+ destinationAddress: valibot.string(),
612
+ feeRate: valibot.number(),
613
+ refundAddress: valibot.string(),
614
+ repeats: valibot.number(),
615
+ runeName: valibot.string(),
616
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
617
+ });
618
+ const runesMintResultSchema = valibot.object({
619
+ orderId: valibot.string(),
620
+ fundTransactionId: valibot.string(),
621
+ fundingAddress: valibot.string()
622
+ });
623
+ const runesMintRequestMessageSchema = valibot.object({
624
+ ...rpcRequestMessageSchema.entries,
625
+ ...valibot.object({
626
+ method: valibot.literal(runesMintMethodName),
627
+ params: runesMintParamsSchema,
628
+ id: valibot.string()
629
+ }).entries
630
+ });
631
+
632
+ //#endregion
633
+ //#region src/request/types/runesMethods/transfer.ts
634
+ const runesTransferMethodName = "runes_transfer";
635
+ const runesTransferParamsSchema = valibot.object({ recipients: valibot.array(valibot.object({
636
+ runeName: valibot.string(),
637
+ amount: valibot.string(),
638
+ address: valibot.string()
639
+ })) });
640
+ const runesTransferResultSchema = valibot.object({ txid: valibot.string() });
641
+ const runesTransferRequestMessageSchema = valibot.object({
642
+ ...rpcRequestMessageSchema.entries,
643
+ ...valibot.object({
644
+ method: valibot.literal(runesTransferMethodName),
645
+ params: runesTransferParamsSchema,
646
+ id: valibot.string()
647
+ }).entries
648
+ });
649
+
650
+ //#endregion
651
+ //#region src/request/types/sparkMethods/flashnetMethods/getJwt.ts
652
+ const sparkFlashnetGetJwtMethodName = "spark_flashnet_getJwt";
653
+ const sparkFlashnetGetJwtParamsSchema = valibot.null();
654
+ const sparkFlashnetGetJwtResultSchema = valibot.object({ jwt: valibot.string() });
655
+ const sparkFlashnetGetJwtRequestMessageSchema = valibot.object({
656
+ ...rpcRequestMessageSchema.entries,
657
+ ...valibot.object({
658
+ method: valibot.literal(sparkFlashnetGetJwtMethodName),
659
+ params: sparkFlashnetGetJwtParamsSchema,
660
+ id: valibot.string()
661
+ }).entries
662
+ });
663
+
664
+ //#endregion
665
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/addLiquidity.ts
666
+ const sparkFlashnetAddLiquidityIntentSchema = valibot.object({
667
+ type: valibot.literal("addLiquidity"),
668
+ data: valibot.object({
669
+ userPublicKey: valibot.string(),
670
+ poolId: valibot.string(),
671
+ assetAAmount: valibot.string(),
672
+ assetBAmount: valibot.string(),
673
+ assetAMinAmountIn: valibot.string(),
674
+ assetBMinAmountIn: valibot.string(),
675
+ assetATransferId: valibot.string(),
676
+ assetBTransferId: valibot.string(),
677
+ nonce: valibot.string()
678
+ })
679
+ });
680
+
681
+ //#endregion
682
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/clawback.ts
683
+ const sparkFlashnetClawbackIntentSchema = valibot.object({
684
+ type: valibot.literal("clawback"),
685
+ data: valibot.object({
686
+ senderPublicKey: valibot.string(),
687
+ sparkTransferId: valibot.string(),
688
+ lpIdentityPublicKey: valibot.string(),
689
+ nonce: valibot.string()
690
+ })
691
+ });
692
+
693
+ //#endregion
694
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/confirmInitialDeposit.ts
695
+ const sparkFlashnetConfirmInitialDepositIntentSchema = valibot.object({
696
+ type: valibot.literal("confirmInitialDeposit"),
697
+ data: valibot.object({
698
+ poolId: valibot.string(),
699
+ assetASparkTransferId: valibot.string(),
700
+ poolOwnerPublicKey: valibot.string(),
701
+ nonce: valibot.string()
702
+ })
703
+ });
704
+
705
+ //#endregion
706
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/createConstantProductPool.ts
707
+ const sparkFlashnetCreateConstantProductPoolIntentSchema = valibot.object({
708
+ type: valibot.literal("createConstantProductPool"),
709
+ data: valibot.object({
710
+ poolOwnerPublicKey: valibot.string(),
711
+ assetAAddress: valibot.string(),
712
+ assetBAddress: valibot.string(),
713
+ lpFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
714
+ totalHostFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
715
+ nonce: valibot.string()
716
+ })
717
+ });
718
+
719
+ //#endregion
720
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/createSingleSidedPool.ts
721
+ const sparkFlashnetCreateSingleSidedPoolIntentSchema = valibot.object({
722
+ type: valibot.literal("createSingleSidedPool"),
723
+ data: valibot.object({
724
+ assetAAddress: valibot.string(),
725
+ assetBAddress: valibot.string(),
726
+ assetAInitialReserve: valibot.string(),
727
+ virtualReserveA: valibot.union([valibot.number(), valibot.string()]),
728
+ virtualReserveB: valibot.union([valibot.number(), valibot.string()]),
729
+ threshold: valibot.union([valibot.number(), valibot.string()]),
730
+ lpFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
731
+ totalHostFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
732
+ poolOwnerPublicKey: valibot.string(),
733
+ nonce: valibot.string()
734
+ })
735
+ });
736
+
737
+ //#endregion
738
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/removeLiquidity.ts
739
+ const sparkFlashnetRemoveLiquidityIntentSchema = valibot.object({
740
+ type: valibot.literal("removeLiquidity"),
741
+ data: valibot.object({
742
+ userPublicKey: valibot.string(),
743
+ poolId: valibot.string(),
744
+ lpTokensToRemove: valibot.string(),
745
+ nonce: valibot.string()
746
+ })
747
+ });
748
+
749
+ //#endregion
750
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/routeSwap.ts
751
+ const sparkFlashnetRouteSwapIntentSchema = valibot.object({
752
+ type: valibot.literal("executeRouteSwap"),
753
+ data: valibot.object({
754
+ userPublicKey: valibot.string(),
755
+ initialSparkTransferId: valibot.string(),
756
+ hops: valibot.array(valibot.object({
757
+ poolId: valibot.string(),
758
+ inputAssetAddress: valibot.string(),
759
+ outputAssetAddress: valibot.string(),
760
+ hopIntegratorFeeRateBps: valibot.optional(valibot.union([valibot.number(), valibot.string()]))
761
+ })),
762
+ inputAmount: valibot.string(),
763
+ maxRouteSlippageBps: valibot.union([valibot.number(), valibot.string()]),
764
+ minAmountOut: valibot.string(),
765
+ defaultIntegratorFeeRateBps: valibot.optional(valibot.union([valibot.number(), valibot.string()])),
766
+ nonce: valibot.string()
767
+ })
768
+ });
769
+
770
+ //#endregion
771
+ //#region src/request/types/sparkMethods/flashnetMethods/intents/swap.ts
772
+ const sparkFlashnetSwapIntentSchema = valibot.object({
773
+ type: valibot.literal("executeSwap"),
774
+ data: valibot.object({
775
+ userPublicKey: valibot.string(),
776
+ poolId: valibot.string(),
777
+ transferId: valibot.string(),
778
+ assetInAddress: valibot.string(),
779
+ assetOutAddress: valibot.string(),
780
+ amountIn: valibot.string(),
781
+ maxSlippageBps: valibot.union([valibot.number(), valibot.string()]),
782
+ minAmountOut: valibot.string(),
783
+ totalIntegratorFeeRateBps: valibot.optional(valibot.union([valibot.number(), valibot.string()])),
784
+ nonce: valibot.string()
785
+ })
786
+ });
787
+
788
+ //#endregion
789
+ //#region src/request/types/sparkMethods/flashnetMethods/signIntent.ts
790
+ const sparkFlashnetSignIntentMethodName = "spark_flashnet_signIntent";
791
+ const sparkFlashnetSignIntentParamsSchema = valibot.union([
792
+ sparkFlashnetSwapIntentSchema,
793
+ sparkFlashnetRouteSwapIntentSchema,
794
+ sparkFlashnetAddLiquidityIntentSchema,
795
+ sparkFlashnetClawbackIntentSchema,
796
+ sparkFlashnetConfirmInitialDepositIntentSchema,
797
+ sparkFlashnetCreateConstantProductPoolIntentSchema,
798
+ sparkFlashnetCreateSingleSidedPoolIntentSchema,
799
+ sparkFlashnetRemoveLiquidityIntentSchema
800
+ ]);
801
+ const sparkFlashnetSignIntentResultSchema = valibot.object({ signature: valibot.string() });
802
+ const sparkFlashnetSignIntentRequestMessageSchema = valibot.object({
803
+ ...rpcRequestMessageSchema.entries,
804
+ ...valibot.object({
805
+ method: valibot.literal(sparkFlashnetSignIntentMethodName),
806
+ params: sparkFlashnetSignIntentParamsSchema,
807
+ id: valibot.string()
808
+ }).entries
809
+ });
810
+
811
+ //#endregion
812
+ //#region src/request/types/sparkMethods/flashnetMethods/signStructuredMessage.ts
813
+ const sparkFlashnetSignStructuredMessageMethodName = "spark_flashnet_signStructuredMessage";
814
+ const sparkFlashnetSignStructuredMessageParamsSchema = valibot.object({ message: valibot.string() });
815
+ const sparkFlashnetSignStructuredMessageResultSchema = valibot.object({
816
+ message: valibot.string(),
817
+ signature: valibot.string()
818
+ });
819
+ const sparkFlashnetSignStructuredMessageRequestMessageSchema = valibot.object({
820
+ ...rpcRequestMessageSchema.entries,
821
+ ...valibot.object({
822
+ method: valibot.literal(sparkFlashnetSignStructuredMessageMethodName),
823
+ params: sparkFlashnetSignStructuredMessageParamsSchema,
824
+ id: valibot.string()
825
+ }).entries
826
+ });
827
+
828
+ //#endregion
829
+ //#region src/request/types/sparkMethods/getAddresses.ts
830
+ const sparkGetAddressesMethodName = "spark_getAddresses";
831
+ const sparkGetAddressesParamsSchema = valibot.nullish(valibot.object({ message: valibot.optional(valibot.string()) }));
832
+ const sparkGetAddressesResultSchema = valibot.object({
833
+ addresses: valibot.array(addressSchema),
834
+ network: sparkNetworkSchema
835
+ });
836
+ const sparkGetAddressesRequestMessageSchema = valibot.object({
837
+ ...rpcRequestMessageSchema.entries,
838
+ ...valibot.object({
839
+ method: valibot.literal(sparkGetAddressesMethodName),
840
+ params: sparkGetAddressesParamsSchema,
841
+ id: valibot.string()
842
+ }).entries
843
+ });
844
+
845
+ //#endregion
846
+ //#region src/request/types/sparkMethods/getBalance.ts
847
+ const sparkGetBalanceMethodName = "spark_getBalance";
848
+ const sparkGetBalanceParamsSchema = valibot.nullish(valibot.null());
849
+ const sparkGetBalanceResultSchema = valibot.object({
850
+ balance: valibot.string(),
851
+ tokenBalances: valibot.array(valibot.object({
852
+ balance: valibot.string(),
853
+ tokenMetadata: valibot.object({
854
+ tokenIdentifier: valibot.string(),
855
+ tokenName: valibot.string(),
856
+ tokenTicker: valibot.string(),
857
+ decimals: valibot.number(),
858
+ maxSupply: valibot.string()
859
+ })
860
+ }))
861
+ });
862
+ const sparkGetBalanceRequestMessageSchema = valibot.object({
863
+ ...rpcRequestMessageSchema.entries,
864
+ ...valibot.object({
865
+ method: valibot.literal(sparkGetBalanceMethodName),
866
+ params: sparkGetBalanceParamsSchema,
867
+ id: valibot.string()
868
+ }).entries
869
+ });
870
+
871
+ //#endregion
872
+ //#region src/request/types/sparkMethods/signMessage.ts
873
+ const sparkSignMessageMethodName = "spark_signMessage";
874
+ const sparkSignMessageParamsSchema = valibot.object({ message: valibot.string() });
875
+ const sparkSignMessageResultSchema = valibot.object({ signature: valibot.string() });
876
+ const sparkSignMessageRequestMessageSchema = valibot.object({
877
+ ...rpcRequestMessageSchema.entries,
878
+ ...valibot.object({
879
+ method: valibot.literal(sparkSignMessageMethodName),
880
+ params: sparkSignMessageParamsSchema,
881
+ id: valibot.string()
882
+ }).entries
883
+ });
884
+
885
+ //#endregion
886
+ //#region src/request/types/sparkMethods/transfer.ts
887
+ const sparkTransferMethodName = "spark_transfer";
888
+ const sparkTransferParamsSchema = valibot.object({
889
+ amountSats: valibot.union([valibot.number(), valibot.string()]),
890
+ receiverSparkAddress: valibot.string()
891
+ });
892
+ const sparkTransferResultSchema = valibot.object({ id: valibot.string() });
893
+ const sparkTransferRequestMessageSchema = valibot.object({
894
+ ...rpcRequestMessageSchema.entries,
895
+ ...valibot.object({
896
+ method: valibot.literal(sparkTransferMethodName),
897
+ params: sparkTransferParamsSchema,
898
+ id: valibot.string()
899
+ }).entries
900
+ });
901
+
902
+ //#endregion
903
+ //#region src/request/types/sparkMethods/transferToken.ts
904
+ const sparkTransferTokenMethodName = "spark_transferToken";
905
+ const sparkTransferTokenParamsSchema = valibot.object({
906
+ tokenAmount: valibot.union([valibot.number(), valibot.string()]),
907
+ tokenIdentifier: valibot.string(),
908
+ receiverSparkAddress: valibot.string()
909
+ });
910
+ const sparkTransferTokenResultSchema = valibot.object({ id: valibot.string() });
911
+ const sparkTransferTokenRequestMessageSchema = valibot.object({
912
+ ...rpcRequestMessageSchema.entries,
913
+ ...valibot.object({
914
+ method: valibot.literal(sparkTransferTokenMethodName),
915
+ params: sparkTransferTokenParamsSchema,
916
+ id: valibot.string()
917
+ }).entries
918
+ });
919
+
920
+ //#endregion
921
+ //#region src/request/types/stxMethods/callContract.ts
922
+ const stxCallContractMethodName = "stx_callContract";
923
+ const stxCallContractParamsSchema = valibot.object({
924
+ contract: valibot.string(),
925
+ functionName: valibot.string(),
926
+ arguments: valibot.optional(valibot.array(valibot.string())),
927
+ functionArgs: valibot.optional(valibot.array(valibot.string())),
928
+ postConditions: valibot.optional(valibot.array(valibot.string())),
929
+ postConditionMode: valibot.optional(valibot.union([valibot.literal("allow"), valibot.literal("deny")]))
930
+ });
931
+ const stxCallContractResultSchema = valibot.object({
932
+ txid: valibot.string(),
933
+ transaction: valibot.string()
934
+ });
935
+ const stxCallContractRequestMessageSchema = valibot.object({
936
+ ...rpcRequestMessageSchema.entries,
937
+ ...valibot.object({
938
+ method: valibot.literal(stxCallContractMethodName),
939
+ params: stxCallContractParamsSchema,
940
+ id: valibot.string()
941
+ }).entries
942
+ });
943
+
944
+ //#endregion
945
+ //#region src/request/types/stxMethods/deployContract.ts
946
+ const stxDeployContractMethodName = "stx_deployContract";
947
+ const stxDeployContractParamsSchema = valibot.object({
948
+ name: valibot.string(),
949
+ clarityCode: valibot.string(),
950
+ clarityVersion: valibot.optional(valibot.number()),
951
+ postConditions: valibot.optional(valibot.array(valibot.string())),
952
+ postConditionMode: valibot.optional(valibot.union([valibot.literal("allow"), valibot.literal("deny")]))
953
+ });
954
+ const stxDeployContractResultSchema = valibot.object({
955
+ txid: valibot.string(),
956
+ transaction: valibot.string()
957
+ });
958
+ const stxDeployContractRequestMessageSchema = valibot.object({
959
+ ...rpcRequestMessageSchema.entries,
960
+ ...valibot.object({
961
+ method: valibot.literal(stxDeployContractMethodName),
962
+ params: stxDeployContractParamsSchema,
963
+ id: valibot.string()
964
+ }).entries
965
+ });
966
+
967
+ //#endregion
968
+ //#region src/request/types/walletMethods.ts
969
+ const accountActionsSchema = valibot.object({ read: valibot.optional(valibot.boolean()) });
970
+ const walletActionsSchema = valibot.object({ readNetwork: valibot.optional(valibot.boolean()) });
971
+ const accountPermissionSchema = valibot.object({
972
+ type: valibot.literal("account"),
973
+ resourceId: valibot.string(),
974
+ clientId: valibot.string(),
975
+ actions: accountActionsSchema
976
+ });
977
+ const walletPermissionSchema = valibot.object({
978
+ type: valibot.literal("wallet"),
979
+ resourceId: valibot.string(),
980
+ clientId: valibot.string(),
981
+ actions: walletActionsSchema
982
+ });
983
+ /**
984
+ * Permissions with the clientId field omitted and optional actions. Used for
985
+ * permission requests, since the wallet performs authentication based on the
986
+ * client's tab origin and should not rely on the client authenticating
987
+ * themselves.
988
+ */
989
+ const PermissionRequestParams = valibot.variant("type", [valibot.object({ ...valibot.omit(accountPermissionSchema, ["clientId"]).entries }), valibot.object({ ...valibot.omit(walletPermissionSchema, ["clientId"]).entries })]);
990
+ const permission = valibot.variant("type", [accountPermissionSchema, walletPermissionSchema]);
991
+ const requestPermissionsMethodName = "wallet_requestPermissions";
992
+ const requestPermissionsParamsSchema = valibot.nullish(valibot.array(PermissionRequestParams));
993
+ const requestPermissionsResultSchema = valibot.literal(true);
994
+ const requestPermissionsRequestMessageSchema = valibot.object({
995
+ ...rpcRequestMessageSchema.entries,
996
+ ...valibot.object({
997
+ method: valibot.literal(requestPermissionsMethodName),
998
+ params: requestPermissionsParamsSchema,
999
+ id: valibot.string()
1000
+ }).entries
1001
+ });
1002
+ const renouncePermissionsMethodName = "wallet_renouncePermissions";
1003
+ const renouncePermissionsParamsSchema = valibot.nullish(valibot.null());
1004
+ const renouncePermissionsResultSchema = valibot.nullish(valibot.null());
1005
+ const renouncePermissionsRequestMessageSchema = valibot.object({
1006
+ ...rpcRequestMessageSchema.entries,
1007
+ ...valibot.object({
1008
+ method: valibot.literal(renouncePermissionsMethodName),
1009
+ params: renouncePermissionsParamsSchema,
1010
+ id: valibot.string()
1011
+ }).entries
1012
+ });
1013
+ const disconnectMethodName = "wallet_disconnect";
1014
+ const disconnectParamsSchema = valibot.nullish(valibot.null());
1015
+ const disconnectResultSchema = valibot.nullish(valibot.null());
1016
+ const disconnectRequestMessageSchema = valibot.object({
1017
+ ...rpcRequestMessageSchema.entries,
1018
+ ...valibot.object({
1019
+ method: valibot.literal(disconnectMethodName),
1020
+ params: disconnectParamsSchema,
1021
+ id: valibot.string()
1022
+ }).entries
1023
+ });
1024
+ const getWalletTypeMethodName = "wallet_getWalletType";
1025
+ const getWalletTypeParamsSchema = valibot.nullish(valibot.null());
1026
+ const getWalletTypeResultSchema = walletTypeSchema;
1027
+ const getWalletTypeRequestMessageSchema = valibot.object({
1028
+ ...rpcRequestMessageSchema.entries,
1029
+ ...valibot.object({
1030
+ method: valibot.literal(getWalletTypeMethodName),
1031
+ params: getWalletTypeParamsSchema,
1032
+ id: valibot.string()
1033
+ }).entries
1034
+ });
1035
+ const getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
1036
+ const getCurrentPermissionsParamsSchema = valibot.nullish(valibot.null());
1037
+ const getCurrentPermissionsResultSchema = valibot.array(permission);
1038
+ const getCurrentPermissionsRequestMessageSchema = valibot.object({
1039
+ ...rpcRequestMessageSchema.entries,
1040
+ ...valibot.object({
1041
+ method: valibot.literal(getCurrentPermissionsMethodName),
1042
+ params: getCurrentPermissionsParamsSchema,
1043
+ id: valibot.string()
1044
+ }).entries
1045
+ });
1046
+ const getNetworkMethodName = "wallet_getNetwork";
1047
+ const getNetworkParamsSchema = valibot.nullish(valibot.null());
1048
+ const getNetworkResultSchema = valibot.object({
1049
+ bitcoin: valibot.object({ name: valibot.enum(BitcoinNetworkType) }),
1050
+ stacks: valibot.object({ name: valibot.enum(StacksNetworkType) }),
1051
+ spark: valibot.object({ name: valibot.enum(SparkNetworkType) })
1052
+ });
1053
+ const getNetworkRequestMessageSchema = valibot.object({
1054
+ ...rpcRequestMessageSchema.entries,
1055
+ ...valibot.object({
1056
+ method: valibot.literal(getNetworkMethodName),
1057
+ params: getNetworkParamsSchema,
1058
+ id: valibot.string()
1059
+ }).entries
1060
+ });
1061
+ const getNetworksMethodName = "wallet_getNetworks";
1062
+ const getNetworksParamsSchema = valibot.nullish(valibot.null());
1063
+ const getNetworksResultSchema = valibot.object({
1064
+ active: valibot.object({
1065
+ bitcoin: bitcoinNetworkSchema,
1066
+ stacks: stacksNetworkSchema,
1067
+ spark: sparkNetworkSchema,
1068
+ starknet: starknetNetworkSchema
1069
+ }),
1070
+ builtin: valibot.object({
1071
+ bitcoin: valibot.array(bitcoinNetworkSchema),
1072
+ stacks: valibot.array(stacksNetworkSchema),
1073
+ spark: valibot.array(sparkNetworkSchema),
1074
+ starknet: valibot.array(starknetNetworkSchema)
1075
+ }),
1076
+ custom: valibot.object({
1077
+ bitcoin: valibot.array(bitcoinNetworkSchema),
1078
+ stacks: valibot.array(stacksNetworkSchema),
1079
+ spark: valibot.array(sparkNetworkSchema),
1080
+ starknet: valibot.array(starknetNetworkSchema)
1081
+ })
1082
+ });
1083
+ const getNetworksRequestMessageSchema = valibot.object({
1084
+ ...rpcRequestMessageSchema.entries,
1085
+ ...valibot.object({
1086
+ method: valibot.literal(getNetworksMethodName),
1087
+ params: getNetworksParamsSchema,
1088
+ id: valibot.string()
1089
+ }).entries
1090
+ });
1091
+ const changeNetworkMethodName = "wallet_changeNetwork";
1092
+ const changeNetworkParamsSchema = valibot.object({ name: valibot.enum(BitcoinNetworkType) });
1093
+ const changeNetworkResultSchema = valibot.nullish(valibot.null());
1094
+ const changeNetworkRequestMessageSchema = valibot.object({
1095
+ ...rpcRequestMessageSchema.entries,
1096
+ ...valibot.object({
1097
+ method: valibot.literal(changeNetworkMethodName),
1098
+ params: changeNetworkParamsSchema,
1099
+ id: valibot.string()
1100
+ }).entries
1101
+ });
1102
+ const changeNetworkByIdMethodName = "wallet_changeNetworkById";
1103
+ const changeNetworkByIdParamsSchema = valibot.object({ id: valibot.string() });
1104
+ const changeNetworkByIdResultSchema = valibot.nullish(valibot.null());
1105
+ const changeNetworkByIdRequestMessageSchema = valibot.object({
1106
+ ...rpcRequestMessageSchema.entries,
1107
+ ...valibot.object({
1108
+ method: valibot.literal(changeNetworkByIdMethodName),
1109
+ params: changeNetworkByIdParamsSchema,
1110
+ id: valibot.string()
1111
+ }).entries
1112
+ });
1113
+ const getAccountMethodName = "wallet_getAccount";
1114
+ const getAccountParamsSchema = valibot.nullish(valibot.null());
1115
+ const getAccountResultSchema = valibot.object({
1116
+ id: valibot.string(),
1117
+ addresses: valibot.array(addressSchema),
1118
+ walletType: walletTypeSchema,
1119
+ networks: getNetworksResultSchema
1120
+ });
1121
+ const getAccountRequestMessageSchema = valibot.object({
1122
+ ...rpcRequestMessageSchema.entries,
1123
+ ...valibot.object({
1124
+ method: valibot.literal(getAccountMethodName),
1125
+ params: getAccountParamsSchema,
1126
+ id: valibot.string()
1127
+ }).entries
1128
+ });
1129
+ const connectMethodName = "wallet_connect";
1130
+ const connectParamsSchema = valibot.nullish(valibot.object({
1131
+ permissions: valibot.optional(valibot.array(PermissionRequestParams)),
1132
+ addresses: valibot.optional(valibot.array(valibot.enum(AddressPurpose))),
1133
+ message: valibot.optional(valibot.pipe(valibot.string(), valibot.maxLength(80, "The message must not exceed 80 characters."))),
1134
+ networkId: valibot.optional(valibot.string())
1135
+ }));
1136
+ const connectResultSchema = valibot.object({
1137
+ id: valibot.string(),
1138
+ addresses: valibot.array(addressSchema),
1139
+ walletType: walletTypeSchema,
1140
+ networks: getNetworksResultSchema
1141
+ });
1142
+ const connectRequestMessageSchema = valibot.object({
1143
+ ...rpcRequestMessageSchema.entries,
1144
+ ...valibot.object({
1145
+ method: valibot.literal(connectMethodName),
1146
+ params: connectParamsSchema,
1147
+ id: valibot.string()
1148
+ }).entries
1149
+ });
1150
+ const addNetworkMethodName = "wallet_addNetwork";
1151
+ const bitcoinNetworkDefinitionSchema = valibot.omit(bitcoinNetworkSchema, ["id"]);
1152
+ const sparkNetworkDefinitionSchema = valibot.omit(sparkNetworkSchema, ["id"]);
1153
+ const stacksNetworkDefinitionSchema = valibot.omit(stacksNetworkSchema, ["id"]);
1154
+ const starknetNetworkDefinitionSchema = valibot.omit(starknetNetworkSchema, ["id"]);
1155
+ const newNetworkDefinitionSchema = valibot.variant("chain", [
1156
+ bitcoinNetworkDefinitionSchema,
1157
+ sparkNetworkDefinitionSchema,
1158
+ stacksNetworkDefinitionSchema,
1159
+ starknetNetworkDefinitionSchema
1160
+ ]);
1161
+ const addNetworkParamsSchema = valibot.object({
1162
+ network: newNetworkDefinitionSchema,
1163
+ isActive: valibot.optional(valibot.boolean())
1164
+ });
1165
+ const addNetworkRequestMessageSchema = valibot.object({
1166
+ ...rpcRequestMessageSchema.entries,
1167
+ ...valibot.object({
1168
+ method: valibot.literal(addNetworkMethodName),
1169
+ params: addNetworkParamsSchema,
1170
+ id: valibot.string()
1171
+ }).entries
1172
+ });
1173
+ const addNetworkResultSchema = valibot.object({ id: valibot.string() });
1174
+
1175
+ //#endregion
1176
+ //#region src/request/types/stxMethods/getAccounts.ts
1177
+ const stxGetAccountsMethodName = "stx_getAccounts";
1178
+ const stxGetAccountsParamsSchema = valibot.nullish(valibot.null());
1179
+ const stxGetAccountsResultSchema = valibot.object({
1180
+ addresses: valibot.array(valibot.object({
1181
+ address: valibot.string(),
1182
+ publicKey: valibot.string(),
1183
+ gaiaHubUrl: valibot.string(),
1184
+ gaiaAppKey: valibot.string()
1185
+ })),
1186
+ network: getNetworkResultSchema
1187
+ });
1188
+ const stxGetAccountsRequestMessageSchema = valibot.object({
1189
+ ...rpcRequestMessageSchema.entries,
1190
+ ...valibot.object({
1191
+ method: valibot.literal(stxGetAccountsMethodName),
1192
+ params: stxGetAccountsParamsSchema,
1193
+ id: valibot.string()
1194
+ }).entries
1195
+ });
1196
+
1197
+ //#endregion
1198
+ //#region src/request/types/stxMethods/getAddresses.ts
1199
+ const stxGetAddressesMethodName = "stx_getAddresses";
1200
+ const stxGetAddressesParamsSchema = valibot.nullish(valibot.object({ message: valibot.optional(valibot.string()) }));
1201
+ const stxGetAddressesResultSchema = valibot.object({
1202
+ addresses: valibot.array(addressSchema),
1203
+ network: stacksNetworkSchema
1204
+ });
1205
+ const stxGetAddressesRequestMessageSchema = valibot.object({
1206
+ ...rpcRequestMessageSchema.entries,
1207
+ ...valibot.object({
1208
+ method: valibot.literal(stxGetAddressesMethodName),
1209
+ params: stxGetAddressesParamsSchema,
1210
+ id: valibot.string()
1211
+ }).entries
1212
+ });
1213
+
1214
+ //#endregion
1215
+ //#region src/request/types/stxMethods/signMessage.ts
1216
+ const stxSignMessageMethodName = "stx_signMessage";
1217
+ const stxSignMessageParamsSchema = valibot.object({ message: valibot.string() });
1218
+ const stxSignMessageResultSchema = valibot.object({
1219
+ signature: valibot.string(),
1220
+ publicKey: valibot.string()
1221
+ });
1222
+ const stxSignMessageRequestMessageSchema = valibot.object({
1223
+ ...rpcRequestMessageSchema.entries,
1224
+ ...valibot.object({
1225
+ method: valibot.literal(stxSignMessageMethodName),
1226
+ params: stxSignMessageParamsSchema,
1227
+ id: valibot.string()
1228
+ }).entries
1229
+ });
1230
+
1231
+ //#endregion
1232
+ //#region src/request/types/stxMethods/signStructuredMessage.ts
1233
+ const stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
1234
+ const stxSignStructuredMessageParamsSchema = valibot.object({
1235
+ domain: valibot.string(),
1236
+ message: valibot.string(),
1237
+ publicKey: valibot.optional(valibot.string())
1238
+ });
1239
+ const stxSignStructuredMessageResultSchema = valibot.object({
1240
+ signature: valibot.string(),
1241
+ publicKey: valibot.string()
1242
+ });
1243
+ const stxSignStructuredMessageRequestMessageSchema = valibot.object({
1244
+ ...rpcRequestMessageSchema.entries,
1245
+ ...valibot.object({
1246
+ method: valibot.literal(stxSignStructuredMessageMethodName),
1247
+ params: stxSignStructuredMessageParamsSchema,
1248
+ id: valibot.string()
1249
+ }).entries
1250
+ });
1251
+
1252
+ //#endregion
1253
+ //#region src/request/types/stxMethods/signTransaction.ts
1254
+ const stxSignTransactionMethodName = "stx_signTransaction";
1255
+ const stxSignTransactionParamsSchema = valibot.object({
1256
+ transaction: valibot.string(),
1257
+ pubkey: valibot.optional(valibot.string()),
1258
+ broadcast: valibot.optional(valibot.boolean())
1259
+ });
1260
+ const stxSignTransactionResultSchema = valibot.object({ transaction: valibot.string() });
1261
+ const stxSignTransactionRequestMessageSchema = valibot.object({
1262
+ ...rpcRequestMessageSchema.entries,
1263
+ ...valibot.object({
1264
+ method: valibot.literal(stxSignTransactionMethodName),
1265
+ params: stxSignTransactionParamsSchema,
1266
+ id: valibot.string()
1267
+ }).entries
1268
+ });
1269
+
1270
+ //#endregion
1271
+ //#region src/request/types/stxMethods/signTransactions.ts
1272
+ const stxSignTransactionsMethodName = "stx_signTransactions";
1273
+ const stxSignTransactionsParamsSchema = valibot.object({
1274
+ transactions: valibot.pipe(valibot.array(valibot.pipe(valibot.string(), valibot.check((hex) => {
1275
+ return true;
1276
+ }, "Invalid hex-encoded Stacks transaction."))), valibot.minLength(1)),
1277
+ broadcast: valibot.optional(valibot.boolean())
1278
+ });
1279
+ const stxSignTransactionsResultSchema = valibot.object({ transactions: valibot.array(valibot.string()) });
1280
+ const stxSignTransactionsRequestMessageSchema = valibot.object({
1281
+ ...rpcRequestMessageSchema.entries,
1282
+ ...valibot.object({
1283
+ method: valibot.literal(stxSignTransactionsMethodName),
1284
+ params: stxSignTransactionsParamsSchema,
1285
+ id: valibot.string()
1286
+ }).entries
1287
+ });
1288
+
1289
+ //#endregion
1290
+ //#region src/request/types/stxMethods/transferStx.ts
1291
+ const stxTransferStxMethodName = "stx_transferStx";
1292
+ const stxTransferStxParamsSchema = valibot.object({
1293
+ amount: valibot.union([valibot.number(), valibot.string()]),
1294
+ recipient: valibot.string(),
1295
+ memo: valibot.optional(valibot.string()),
1296
+ version: valibot.optional(valibot.string()),
1297
+ postConditionMode: valibot.optional(valibot.number()),
1298
+ postConditions: valibot.optional(valibot.array(valibot.string())),
1299
+ pubkey: valibot.optional(valibot.string())
1300
+ });
1301
+ const stxTransferStxResultSchema = valibot.object({
1302
+ txid: valibot.string(),
1303
+ transaction: valibot.string()
1304
+ });
1305
+ const stxTransferStxRequestMessageSchema = valibot.object({
1306
+ ...rpcRequestMessageSchema.entries,
1307
+ ...valibot.object({
1308
+ method: valibot.literal(stxTransferStxMethodName),
1309
+ params: stxTransferStxParamsSchema,
1310
+ id: valibot.string()
1311
+ }).entries
1312
+ });
1313
+
1314
+ //#endregion
1315
+ //#region src/request/index.ts
1316
+ const cache = {};
1317
+ const requestInternal = async (provider, method, params) => {
1318
+ const response = await provider.request(method, params);
1319
+ if (valibot.is(rpcErrorResponseMessageSchema, response)) return {
1320
+ status: "error",
1321
+ error: response.error
1322
+ };
1323
+ if (valibot.is(rpcSuccessResponseMessageSchema, response)) return {
1324
+ status: "success",
1325
+ result: response.result
1326
+ };
1327
+ return {
1328
+ status: "error",
1329
+ error: {
1330
+ code: RpcErrorCode.INTERNAL_ERROR,
1331
+ message: "Received unknown response from provider.",
1332
+ data: response
1333
+ }
1334
+ };
1335
+ };
1336
+ const request = async (method, params, providerId) => {
1337
+ let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
1338
+ if (providerId) provider = await getProviderById(providerId);
1339
+ if (!provider) throw new Error("no wallet provider was found");
1340
+ if (!method) throw new Error("A wallet method is required");
1341
+ if (!cache.providerInfo) {
1342
+ const infoResult = await requestInternal(provider, "getInfo", null);
1343
+ if (infoResult.status === "success") cache.providerInfo = infoResult.result;
1344
+ }
1345
+ if (cache.providerInfo) {
1346
+ if (method === "getInfo") return {
1347
+ status: "success",
1348
+ result: cache.providerInfo
1349
+ };
1350
+ const sanitized = sanitizeRequest(method, params, cache.providerInfo);
1351
+ if (sanitized.overrideResponse) return sanitized.overrideResponse;
1352
+ method = sanitized.method;
1353
+ params = sanitized.params;
1354
+ }
1355
+ return requestInternal(provider, method, params);
1356
+ };
1357
+ /**
1358
+ * Adds an event listener.
1359
+ *
1360
+ * Currently expects 2 arguments, although is also capable of handling legacy
1361
+ * calls with 3 arguments consisting of:
1362
+ *
1363
+ * - event name (string)
1364
+ * - callback (function)
1365
+ * - provider ID (optional string)
1366
+ */
1367
+ const addListener = (...rawArgs) => {
1368
+ const [listenerInfo, providerId] = (() => {
1369
+ if (rawArgs.length === 1) return [rawArgs[0], void 0];
1370
+ if (rawArgs.length === 2) if (typeof rawArgs[1] === "function") return [{
1371
+ eventName: rawArgs[0],
1372
+ cb: rawArgs[1]
1373
+ }, void 0];
1374
+ else return rawArgs;
1375
+ if (rawArgs.length === 3) return [{
1376
+ eventName: rawArgs[0],
1377
+ cb: rawArgs[1]
1378
+ }, rawArgs[2]];
1379
+ throw new Error("Unexpected number of arguments. Expecting 2 (or 3 for legacy requests).", { cause: rawArgs });
1380
+ })();
1381
+ let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
1382
+ if (providerId) provider = getProviderById(providerId);
1383
+ if (!provider) throw new Error("no wallet provider was found");
1384
+ if (!provider.addListener) {
1385
+ console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
1386
+ return () => {};
1387
+ }
1388
+ return provider.addListener(listenerInfo);
1389
+ };
1390
+
1391
+ //#endregion
1392
+ //#region src/runes/api.ts
1393
+ const urlNetworkSuffix = {
1394
+ [BitcoinNetworkType.Mainnet]: "",
1395
+ [BitcoinNetworkType.Testnet]: "-testnet",
1396
+ [BitcoinNetworkType.Testnet4]: "-testnet4",
1397
+ [BitcoinNetworkType.Signet]: "-signet"
1398
+ };
1399
+ const ORDINALS_API_BASE_URL = (network = BitcoinNetworkType.Mainnet) => {
1400
+ if (network === BitcoinNetworkType.Regtest) throw new Error(`Ordinals API does not support ${network} network`);
1401
+ return `https://ordinals${urlNetworkSuffix[network]}.xverse.app/v1`;
1402
+ };
1403
+ var RunesApi = class {
1404
+ client;
1405
+ constructor(network) {
1406
+ this.client = axios.default.create({ baseURL: ORDINALS_API_BASE_URL(network) });
1407
+ }
1408
+ parseError = (error) => {
1409
+ return {
1410
+ code: error.response?.status,
1411
+ message: JSON.stringify(error.response?.data)
1412
+ };
1413
+ };
1414
+ estimateMintCost = async (mintParams) => {
1415
+ try {
1416
+ return { data: (await this.client.post("/runes/mint/estimate", { ...mintParams })).data };
1417
+ } catch (error) {
1418
+ const err = error;
1419
+ return { error: this.parseError(err) };
1420
+ }
1421
+ };
1422
+ estimateEtchCost = async (etchParams) => {
1423
+ try {
1424
+ return { data: (await this.client.post("/runes/etch/estimate", { ...etchParams })).data };
1425
+ } catch (error) {
1426
+ const err = error;
1427
+ return { error: this.parseError(err) };
1428
+ }
1429
+ };
1430
+ createMintOrder = async (mintOrderParams) => {
1431
+ try {
1432
+ return { data: (await this.client.post("/runes/mint/orders", { ...mintOrderParams })).data };
1433
+ } catch (error) {
1434
+ const err = error;
1435
+ return { error: this.parseError(err) };
1436
+ }
1437
+ };
1438
+ createEtchOrder = async (etchOrderParams) => {
1439
+ try {
1440
+ return { data: (await this.client.post("/runes/etch/orders", { ...etchOrderParams })).data };
1441
+ } catch (error) {
1442
+ const err = error;
1443
+ return { error: this.parseError(err) };
1444
+ }
1445
+ };
1446
+ executeMint = async (orderId, fundTransactionId) => {
1447
+ try {
1448
+ return { data: (await this.client.post(`/runes/mint/orders/${orderId}/execute`, { fundTransactionId })).data };
1449
+ } catch (error) {
1450
+ const err = error;
1451
+ return { error: this.parseError(err) };
1452
+ }
1453
+ };
1454
+ executeEtch = async (orderId, fundTransactionId) => {
1455
+ try {
1456
+ return { data: (await this.client.post(`/runes/etch/orders/${orderId}/execute`, { fundTransactionId })).data };
1457
+ } catch (error) {
1458
+ const err = error;
1459
+ return { error: this.parseError(err) };
1460
+ }
1461
+ };
1462
+ getOrder = async (orderId) => {
1463
+ try {
1464
+ return { data: (await this.client.get(`/orders/${orderId}`)).data };
1465
+ } catch (error) {
1466
+ const err = error;
1467
+ return { error: this.parseError(err) };
1468
+ }
1469
+ };
1470
+ rbfOrder = async (rbfRequest) => {
1471
+ const { orderId, newFeeRate } = rbfRequest;
1472
+ try {
1473
+ return { data: (await this.client.post(`/orders/${orderId}/rbf-estimate`, { newFeeRate })).data };
1474
+ } catch (error) {
1475
+ const err = error;
1476
+ return { error: this.parseError(err) };
1477
+ }
1478
+ };
1479
+ };
1480
+ const clients = {};
1481
+ const getRunesApiClient = (network = BitcoinNetworkType.Mainnet) => {
1482
+ if (!clients[network]) clients[network] = new RunesApi(network);
1483
+ return clients[network];
1484
+ };
1485
+
1486
+ //#endregion
1487
+ //#region src/adapters/satsConnectAdapter.ts
1488
+ var SatsConnectAdapter = class {
1489
+ async mintRunes(params) {
1490
+ try {
1491
+ const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
1492
+ if (walletInfo && walletInfo.status === "success") {
1493
+ if (walletInfo.result.methods?.includes("runes_mint")) {
1494
+ const response = await this.requestInternal("runes_mint", params);
1495
+ if (response) {
1496
+ if (response.status === "success") return response;
1497
+ if (response.status === "error" && response.error.code !== RpcErrorCode.METHOD_NOT_FOUND) return response;
1498
+ }
1499
+ }
1500
+ }
1501
+ const mintRequest = {
1502
+ destinationAddress: params.destinationAddress,
1503
+ feeRate: params.feeRate,
1504
+ refundAddress: params.refundAddress,
1505
+ repeats: params.repeats,
1506
+ runeName: params.runeName,
1507
+ appServiceFee: params.appServiceFee,
1508
+ appServiceFeeAddress: params.appServiceFeeAddress
1509
+ };
1510
+ const orderResponse = await new RunesApi(params.network).createMintOrder(mintRequest);
1511
+ if (!orderResponse.data) return {
1512
+ status: "error",
1513
+ error: {
1514
+ code: orderResponse.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1515
+ message: orderResponse.error.message
1516
+ }
1517
+ };
1518
+ const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
1519
+ address: orderResponse.data.fundAddress,
1520
+ amount: orderResponse.data.fundAmount
1521
+ }] });
1522
+ if (paymentResponse.status !== "success") return paymentResponse;
1523
+ await new RunesApi(params.network).executeMint(orderResponse.data.orderId, paymentResponse.result.txid);
1524
+ return {
1525
+ status: "success",
1526
+ result: {
1527
+ orderId: orderResponse.data.orderId,
1528
+ fundTransactionId: paymentResponse.result.txid,
1529
+ fundingAddress: orderResponse.data.fundAddress
1530
+ }
1531
+ };
1532
+ } catch (error) {
1533
+ return {
1534
+ status: "error",
1535
+ error: {
1536
+ code: RpcErrorCode.INTERNAL_ERROR,
1537
+ message: error.message
1538
+ }
1539
+ };
1540
+ }
1541
+ }
1542
+ async etchRunes(params) {
1543
+ const etchRequest = {
1544
+ destinationAddress: params.destinationAddress,
1545
+ refundAddress: params.refundAddress,
1546
+ feeRate: params.feeRate,
1547
+ runeName: params.runeName,
1548
+ divisibility: params.divisibility,
1549
+ symbol: params.symbol,
1550
+ premine: params.premine,
1551
+ isMintable: params.isMintable,
1552
+ terms: params.terms,
1553
+ inscriptionDetails: params.inscriptionDetails,
1554
+ delegateInscriptionId: params.delegateInscriptionId,
1555
+ appServiceFee: params.appServiceFee,
1556
+ appServiceFeeAddress: params.appServiceFeeAddress
1557
+ };
1558
+ try {
1559
+ const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
1560
+ if (walletInfo && walletInfo.status === "success") {
1561
+ if (walletInfo.result.methods?.includes("runes_etch")) {
1562
+ const response = await this.requestInternal("runes_etch", params);
1563
+ if (response) {
1564
+ if (response.status === "success") return response;
1565
+ if (response.status === "error" && response.error.code !== RpcErrorCode.METHOD_NOT_FOUND) return response;
1566
+ }
1567
+ }
1568
+ }
1569
+ const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
1570
+ if (!orderResponse.data) return {
1571
+ status: "error",
1572
+ error: {
1573
+ code: orderResponse.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1574
+ message: orderResponse.error.message
1575
+ }
1576
+ };
1577
+ const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
1578
+ address: orderResponse.data.fundAddress,
1579
+ amount: orderResponse.data.fundAmount
1580
+ }] });
1581
+ if (paymentResponse.status !== "success") return paymentResponse;
1582
+ await new RunesApi(params.network).executeEtch(orderResponse.data.orderId, paymentResponse.result.txid);
1583
+ return {
1584
+ status: "success",
1585
+ result: {
1586
+ orderId: orderResponse.data.orderId,
1587
+ fundTransactionId: paymentResponse.result.txid,
1588
+ fundingAddress: orderResponse.data.fundAddress
1589
+ }
1590
+ };
1591
+ } catch (error) {
1592
+ return {
1593
+ status: "error",
1594
+ error: {
1595
+ code: RpcErrorCode.INTERNAL_ERROR,
1596
+ message: error.message
1597
+ }
1598
+ };
1599
+ }
1600
+ }
1601
+ async estimateMint(params) {
1602
+ const estimateMintRequest = {
1603
+ destinationAddress: params.destinationAddress,
1604
+ feeRate: params.feeRate,
1605
+ repeats: params.repeats,
1606
+ runeName: params.runeName,
1607
+ appServiceFee: params.appServiceFee,
1608
+ appServiceFeeAddress: params.appServiceFeeAddress
1609
+ };
1610
+ const response = await getRunesApiClient(params.network).estimateMintCost(estimateMintRequest);
1611
+ if (response.data) return {
1612
+ status: "success",
1613
+ result: response.data
1614
+ };
1615
+ return {
1616
+ status: "error",
1617
+ error: {
1618
+ code: response.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1619
+ message: response.error.message
1620
+ }
1621
+ };
1622
+ }
1623
+ async estimateEtch(params) {
1624
+ const estimateEtchRequest = {
1625
+ destinationAddress: params.destinationAddress,
1626
+ feeRate: params.feeRate,
1627
+ runeName: params.runeName,
1628
+ divisibility: params.divisibility,
1629
+ symbol: params.symbol,
1630
+ premine: params.premine,
1631
+ isMintable: params.isMintable,
1632
+ terms: params.terms,
1633
+ inscriptionDetails: params.inscriptionDetails,
1634
+ delegateInscriptionId: params.delegateInscriptionId,
1635
+ appServiceFee: params.appServiceFee,
1636
+ appServiceFeeAddress: params.appServiceFeeAddress
1637
+ };
1638
+ const response = await getRunesApiClient(params.network).estimateEtchCost(estimateEtchRequest);
1639
+ if (response.data) return {
1640
+ status: "success",
1641
+ result: response.data
1642
+ };
1643
+ return {
1644
+ status: "error",
1645
+ error: {
1646
+ code: response.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1647
+ message: response.error.message
1648
+ }
1649
+ };
1650
+ }
1651
+ async getOrder(params) {
1652
+ const response = await getRunesApiClient(params.network).getOrder(params.id);
1653
+ if (response.data) return {
1654
+ status: "success",
1655
+ result: response.data
1656
+ };
1657
+ return {
1658
+ status: "error",
1659
+ error: {
1660
+ code: response.error.code === 400 || response.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1661
+ message: response.error.message
1662
+ }
1663
+ };
1664
+ }
1665
+ async estimateRbfOrder(params) {
1666
+ const rbfOrderRequest = {
1667
+ newFeeRate: params.newFeeRate,
1668
+ orderId: params.orderId
1669
+ };
1670
+ const response = await getRunesApiClient(params.network).rbfOrder(rbfOrderRequest);
1671
+ if (response.data) return {
1672
+ status: "success",
1673
+ result: {
1674
+ fundingAddress: response.data.fundingAddress,
1675
+ rbfCost: response.data.rbfCost
1676
+ }
1677
+ };
1678
+ return {
1679
+ status: "error",
1680
+ error: {
1681
+ code: response.error.code === 400 || response.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1682
+ message: response.error.message
1683
+ }
1684
+ };
1685
+ }
1686
+ async rbfOrder(params) {
1687
+ try {
1688
+ const rbfOrderRequest = {
1689
+ newFeeRate: params.newFeeRate,
1690
+ orderId: params.orderId
1691
+ };
1692
+ const orderResponse = await getRunesApiClient(params.network).rbfOrder(rbfOrderRequest);
1693
+ if (!orderResponse.data) return {
1694
+ status: "error",
1695
+ error: {
1696
+ code: orderResponse.error.code === 400 || orderResponse.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1697
+ message: orderResponse.error.message
1698
+ }
1699
+ };
1700
+ const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
1701
+ address: orderResponse.data.fundingAddress,
1702
+ amount: orderResponse.data.rbfCost
1703
+ }] });
1704
+ if (paymentResponse.status !== "success") return paymentResponse;
1705
+ return {
1706
+ status: "success",
1707
+ result: {
1708
+ fundingAddress: orderResponse.data.fundingAddress,
1709
+ orderId: rbfOrderRequest.orderId,
1710
+ fundRBFTransactionId: paymentResponse.result.txid
1711
+ }
1712
+ };
1713
+ } catch (error) {
1714
+ return {
1715
+ status: "error",
1716
+ error: {
1717
+ code: RpcErrorCode.INTERNAL_ERROR,
1718
+ message: error.message
1719
+ }
1720
+ };
1721
+ }
1722
+ }
1723
+ async request(method, params) {
1724
+ switch (method) {
1725
+ case "runes_mint": return this.mintRunes(params);
1726
+ case "runes_etch": return this.etchRunes(params);
1727
+ case "runes_estimateMint": return this.estimateMint(params);
1728
+ case "runes_estimateEtch": return this.estimateEtch(params);
1729
+ case "runes_getOrder": return this.getOrder(params);
1730
+ case "runes_estimateRbfOrder": return this.estimateRbfOrder(params);
1731
+ case "runes_rbfOrder": return this.rbfOrder(params);
1732
+ default: return this.requestInternal(method, params);
1733
+ }
1734
+ }
1735
+ };
1736
+
1737
+ //#endregion
1738
+ //#region src/adapters/xverse.ts
1739
+ var XverseAdapter = class extends SatsConnectAdapter {
1740
+ id = DefaultAdaptersInfo.xverse.id;
1741
+ requestInternal = async (method, params) => {
1742
+ return request(method, params, this.id);
1743
+ };
1744
+ addListener = (listenerInfo) => {
1745
+ return addListener(listenerInfo, this.id);
1746
+ };
1747
+ };
1748
+
1749
+ //#endregion
1750
+ //#region src/adapters/unisat.ts
1751
+ function convertSignInputsToInputType(signInputs) {
1752
+ let result = [];
1753
+ if (!signInputs) return result;
1754
+ for (let address in signInputs) {
1755
+ let indexes = signInputs[address];
1756
+ for (let index of indexes) result.push({
1757
+ index,
1758
+ address
1759
+ });
1760
+ }
1761
+ return result;
1762
+ }
1763
+ var UnisatAdapter = class extends SatsConnectAdapter {
1764
+ id = DefaultAdaptersInfo.unisat.id;
1765
+ async getAccounts(params) {
1766
+ const { purposes } = params;
1767
+ if (purposes.includes(AddressPurpose.Stacks) || purposes.includes(AddressPurpose.Starknet) || purposes.includes(AddressPurpose.Spark)) throw new Error("Only bitcoin addresses are supported");
1768
+ const accounts = await window.unisat.requestAccounts();
1769
+ const publicKey = await window.unisat.getPublicKey();
1770
+ const address = accounts[0];
1771
+ const addressType = (0, bitcoin_address_validation.getAddressInfo)(accounts[0]).type;
1772
+ const pk = addressType === bitcoin_address_validation.AddressType.p2tr ? publicKey.slice(2) : publicKey;
1773
+ const paymentAddress = {
1774
+ address,
1775
+ publicKey: pk,
1776
+ addressType,
1777
+ purpose: AddressPurpose.Payment,
1778
+ walletType: "software"
1779
+ };
1780
+ const ordinalsAddress = {
1781
+ address,
1782
+ publicKey: pk,
1783
+ addressType,
1784
+ purpose: AddressPurpose.Ordinals,
1785
+ walletType: "software"
1786
+ };
1787
+ const response = [];
1788
+ if (purposes.includes(AddressPurpose.Payment)) response.push({
1789
+ ...paymentAddress,
1790
+ walletType: "software"
1791
+ });
1792
+ if (purposes.includes(AddressPurpose.Ordinals)) response.push({
1793
+ ...ordinalsAddress,
1794
+ walletType: "software"
1795
+ });
1796
+ return response;
1797
+ }
1798
+ async signMessage(params) {
1799
+ const { message, address } = params;
1800
+ const addressType = (0, bitcoin_address_validation.getAddressInfo)(address).type;
1801
+ if ([bitcoin_address_validation.AddressType.p2wpkh, bitcoin_address_validation.AddressType.p2tr].includes(addressType)) return {
1802
+ address,
1803
+ messageHash: "",
1804
+ signature: await window.unisat.signMessage(message, "bip322-simple"),
1805
+ protocol: MessageSigningProtocols.BIP322
1806
+ };
1807
+ return {
1808
+ address,
1809
+ messageHash: "",
1810
+ signature: await window.unisat.signMessage(message, "ecdsa"),
1811
+ protocol: MessageSigningProtocols.ECDSA
1812
+ };
1813
+ }
1814
+ async sendTransfer(params) {
1815
+ const { recipients } = params;
1816
+ if (recipients.length > 1) throw new Error("Only one recipient is supported by this wallet provider");
1817
+ return { txid: await window.unisat.sendBitcoin(recipients[0].address, recipients[0].amount) };
1818
+ }
1819
+ async signPsbt(params) {
1820
+ const { psbt, signInputs, broadcast } = params;
1821
+ const psbtHex = buffer.Buffer.from(psbt, "base64").toString("hex");
1822
+ const signedPsbt = await window.unisat.signPsbt(psbtHex, {
1823
+ autoFinalized: broadcast,
1824
+ toSignInputs: convertSignInputsToInputType(signInputs)
1825
+ });
1826
+ const signedPsbtBase64 = buffer.Buffer.from(signedPsbt, "hex").toString("base64");
1827
+ let txid;
1828
+ if (broadcast) txid = await window.unisat.pushPsbt(signedPsbt);
1829
+ return {
1830
+ psbt: signedPsbtBase64,
1831
+ txid
1832
+ };
1833
+ }
1834
+ requestInternal = async (method, params) => {
1835
+ try {
1836
+ switch (method) {
1837
+ case "getAccounts": return {
1838
+ status: "success",
1839
+ result: await this.getAccounts(params)
1840
+ };
1841
+ case "sendTransfer": return {
1842
+ status: "success",
1843
+ result: await this.sendTransfer(params)
1844
+ };
1845
+ case "signMessage": return {
1846
+ status: "success",
1847
+ result: await this.signMessage(params)
1848
+ };
1849
+ case "signPsbt": return {
1850
+ status: "success",
1851
+ result: await this.signPsbt(params)
1852
+ };
1853
+ default: {
1854
+ const error = {
1855
+ code: RpcErrorCode.METHOD_NOT_SUPPORTED,
1856
+ message: "Method not supported by the selected wallet"
1857
+ };
1858
+ console.error("Error calling the method", error);
1859
+ return {
1860
+ status: "error",
1861
+ error
1862
+ };
1863
+ }
1864
+ }
1865
+ } catch (error) {
1866
+ console.error("Error calling the method", error);
1867
+ return {
1868
+ status: "error",
1869
+ error: {
1870
+ code: error.code === 4001 ? RpcErrorCode.USER_REJECTION : RpcErrorCode.INTERNAL_ERROR,
1871
+ message: error.message ? error.message : "Wallet method call error",
1872
+ data: error
1873
+ }
1874
+ };
1875
+ }
1876
+ };
1877
+ addListener = ({ eventName, cb }) => {
1878
+ switch (eventName) {
1879
+ case "accountChange": {
1880
+ const handler = () => {
1881
+ cb({ type: "accountChange" });
1882
+ };
1883
+ window.unisat.on("accountsChanged", handler);
1884
+ return () => {
1885
+ window.unisat.removeListener("accountsChanged", handler);
1886
+ };
1887
+ }
1888
+ case "networkChange": {
1889
+ const handler = () => {
1890
+ cb({ type: "networkChange" });
1891
+ };
1892
+ window.unisat.on("networkChanged", handler);
1893
+ return () => {
1894
+ window.unisat.removeListener("networkChanged", handler);
1895
+ };
1896
+ }
1897
+ default:
1898
+ console.error("Event not supported by the selected wallet");
1899
+ return () => {};
1900
+ }
1901
+ };
1902
+ };
1903
+
1904
+ //#endregion
1905
+ //#region src/adapters/fordefi.ts
1906
+ var FordefiAdapter = class extends SatsConnectAdapter {
1907
+ id = DefaultAdaptersInfo.fordefi.id;
1908
+ requestInternal = async (method, params) => {
1909
+ const provider = getProviderById(this.id);
1910
+ if (!provider) throw new Error("no wallet provider was found");
1911
+ if (!method) throw new Error("A wallet method is required");
1912
+ return await provider.request(method, params);
1913
+ };
1914
+ addListener = ({ eventName, cb }) => {
1915
+ const provider = getProviderById(this.id);
1916
+ if (!provider) throw new Error("no wallet provider was found");
1917
+ if (!provider.addListener) {
1918
+ console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
1919
+ return () => {};
1920
+ }
1921
+ return provider.addListener(eventName, cb);
1922
+ };
1923
+ };
1924
+
1925
+ //#endregion
1926
+ //#region src/adapters/BaseAdapter.ts
1927
+ var BaseAdapter = class extends SatsConnectAdapter {
1928
+ id = "";
1929
+ constructor(providerId) {
1930
+ super();
1931
+ this.id = providerId;
1932
+ }
1933
+ requestInternal = async (method, params) => {
1934
+ return request(method, params, this.id);
1935
+ };
1936
+ addListener = (..._args) => {
1937
+ throw new Error("Method not supported for `BaseAdapter`.");
1938
+ };
1939
+ };
1940
+
1941
+ //#endregion
1942
+ //#region src/adapters/index.ts
1943
+ const DefaultAdaptersInfo = {
1944
+ fordefi: {
1945
+ id: "FordefiProviders.UtxoProvider",
1946
+ name: "Fordefi",
1947
+ webUrl: "https://www.fordefi.com/",
1948
+ chromeWebStoreUrl: "https://chromewebstore.google.com/detail/fordefi/hcmehenccjdmfbojapcbcofkgdpbnlle",
1949
+ icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzEzNDk0XzY2MjU0KSI+CjxwYXRoIGQ9Ik0xMC44NzY5IDE1LjYzNzhIMS41VjE4LjM5OUMxLjUgMTkuODAxMyAyLjYzNDQ3IDIwLjkzOCA0LjAzMzkyIDIwLjkzOEg4LjI0OTkyTDEwLjg3NjkgMTUuNjM3OFoiIGZpbGw9IiM3OTk0RkYiLz4KPHBhdGggZD0iTTEuNSA5Ljc3NTUxSDE5LjA1MTZMMTcuMDEzOSAxMy44NzExSDEuNVY5Ljc3NTUxWiIgZmlsbD0iIzQ4NkRGRiIvPgo8cGF0aCBkPSJNNy42NTk5NiAzSDEuNTI0NDFWOC4wMDcwNEgyMi40NjEyVjNIMTYuMzI1NlY2LjczOTQ0SDE1LjA2MDZWM0g4LjkyNTAyVjYuNzM5NDRINy42NTk5NlYzWiIgZmlsbD0iIzVDRDFGQSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzEzNDk0XzY2MjU0Ij4KPHJlY3Qgd2lkdGg9IjIxIiBoZWlnaHQ9IjE4IiBmaWxsPSJ3aGl0ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMS41IDMpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="
1950
+ },
1951
+ xverse: {
1952
+ id: "XverseProviders.BitcoinProvider",
1953
+ name: "Xverse",
1954
+ webUrl: "https://www.xverse.app/",
1955
+ googlePlayStoreUrl: "https://play.google.com/store/apps/details?id=com.secretkeylabs.xverse",
1956
+ iOSAppStoreUrl: "https://apps.apple.com/app/xverse-bitcoin-web3-wallet/id1552272513",
1957
+ chromeWebStoreUrl: "https://chromewebstore.google.com/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg",
1958
+ icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgdmlld0JveD0iMCAwIDEwMiAxMDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGlkPSJJY29uX0FydCAoRWRpdCBNZSkiPgo8cmVjdCB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgZmlsbD0iIzE4MTgxOCIvPgo8ZyBpZD0iTG9nby9FbWJsZW0iIGNsaXAtcGF0aD0idXJsKCNjbGlwMF8yMF8xMjIzKSI+CjxwYXRoIGlkPSJWZWN0b3IiIGQ9Ik03NC42NTQyIDczLjg4ODNWNjUuMjMxMkM3NC42NTQyIDY0Ljg4OCA3NC41MTc3IDY0LjU2MDYgNzQuMjc0NSA2NC4zMTc0TDM3LjQzOTcgMjcuNDgyNUMzNy4xOTY1IDI3LjIzOTIgMzYuODY5MSAyNy4xMDI4IDM2LjUyNTggMjcuMTAyOEgyNy44NjlDMjcuNDQxNiAyNy4xMDI4IDI3LjA5MzggMjcuNDUwNiAyNy4wOTM4IDI3Ljg3OFYzNS45MjExQzI3LjA5MzggMzYuMjY0NCAyNy4yMzAyIDM2LjU5MTcgMjcuNDczNCAzNi44MzVMNDAuNjk1MiA1MC4wNTY3QzQwLjk5NzUgNTAuMzU5MSA0MC45OTc1IDUwLjg1MDEgNDAuNjk1MiA1MS4xNTI0TDI3LjMyMTEgNjQuNTI2NUMyNy4xNzU2IDY0LjY3MiAyNy4wOTM4IDY0Ljg2OTggMjcuMDkzOCA2NS4wNzQ0VjczLjg4OD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+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="
1965
+ }
1966
+ };
1967
+ const defaultAdapters = {
1968
+ [DefaultAdaptersInfo.fordefi.id]: FordefiAdapter,
1969
+ [DefaultAdaptersInfo.xverse.id]: XverseAdapter,
1970
+ [DefaultAdaptersInfo.unisat.id]: UnisatAdapter
1971
+ };
1972
+
1973
+ //#endregion
1974
+ //#region src/capabilities/index.ts
1975
+ const extractOrValidateCapabilities = (provider, reportedCapabilities) => {
1976
+ const validateCapability = (capability) => {
1977
+ if (!provider[capability]) return false;
1978
+ if (reportedCapabilities && !reportedCapabilities.has(capability)) return false;
1979
+ return true;
1980
+ };
1981
+ const capabilityMap = {
1982
+ request: validateCapability("request"),
1983
+ connect: validateCapability("connect"),
1984
+ signMessage: validateCapability("signMessage"),
1985
+ signTransaction: validateCapability("signTransaction"),
1986
+ sendBtcTransaction: validateCapability("sendBtcTransaction"),
1987
+ createInscription: validateCapability("createInscription"),
1988
+ createRepeatInscriptions: validateCapability("createRepeatInscriptions"),
1989
+ signMultipleTransactions: validateCapability("signMultipleTransactions"),
1990
+ addListener: validateCapability("addListener")
1991
+ };
1992
+ return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
1993
+ if (value) return [...acc, capability];
1994
+ return acc;
1995
+ }, []);
1996
+ };
1997
+ const getCapabilities = async (options) => {
1998
+ const provider = await getProviderOrThrow(options.getProvider);
1999
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
2000
+ if (provider.getCapabilities) try {
2001
+ const response = await provider.getCapabilities(request$1);
2002
+ options.onFinish?.(extractOrValidateCapabilities(provider, new Set(response)));
2003
+ } catch (error) {
2004
+ console.error("[Connect] Error during capabilities request", error);
2005
+ }
2006
+ try {
2007
+ const inferredCapabilities = extractOrValidateCapabilities(provider);
2008
+ options.onFinish?.(inferredCapabilities);
2009
+ } catch (error) {
2010
+ console.error("[Connect] Error during capabilities request", error);
2011
+ options.onCancel?.();
2012
+ }
2013
+ };
2014
+
2015
+ //#endregion
2016
+ //#region src/inscriptions/utils.ts
2017
+ const MAX_CONTENT_LENGTH_MAINNET = 4e5;
2018
+ const MAX_CONTENT_LENGTH_TESTNET = 6e4;
2019
+ const validateInscriptionPayload = (payload) => {
2020
+ const { contentType, content, payloadType, network, appFeeAddress, appFee } = payload;
2021
+ if (!/^[a-z]+\/[a-z0-9\-\.\+]+(?=;.*|$)/.test(contentType)) throw new Error("Invalid content type detected");
2022
+ if (!content || content.length === 0) throw new Error("Empty content not allowed");
2023
+ if (!payloadType || payloadType !== "BASE_64" && payloadType !== "PLAIN_TEXT") throw new Error("Empty invalid payloadType specified");
2024
+ if (content.length > (network.type === "Mainnet" ? MAX_CONTENT_LENGTH_MAINNET : MAX_CONTENT_LENGTH_TESTNET)) throw new Error("Content too large");
2025
+ if ((appFeeAddress?.length ?? 0) > 0 && (appFee ?? 0) <= 0) throw new Error("Invalid combination of app fee address and fee provided");
2026
+ };
2027
+
2028
+ //#endregion
2029
+ //#region src/inscriptions/createInscription.ts
2030
+ const createInscription = async (options) => {
2031
+ const { getProvider } = options;
2032
+ const provider = await getProviderOrThrow(getProvider);
2033
+ validateInscriptionPayload(options.payload);
2034
+ try {
2035
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
2036
+ const response = await provider.createInscription(request$1);
2037
+ options.onFinish?.(response);
2038
+ } catch (error) {
2039
+ console.error("[Connect] Error during create inscription", error);
2040
+ options.onCancel?.();
2041
+ }
2042
+ };
2043
+
2044
+ //#endregion
2045
+ //#region src/inscriptions/createRepeatInscriptions.ts
2046
+ const createRepeatInscriptions = async (options) => {
2047
+ const { getProvider } = options;
2048
+ const provider = await getProviderOrThrow(getProvider);
2049
+ validateInscriptionPayload(options.payload);
2050
+ try {
2051
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
2052
+ const response = await provider.createRepeatInscriptions(request$1);
2053
+ options.onFinish?.(response);
2054
+ } catch (error) {
2055
+ console.error("[Connect] Error during create repeat inscriptions", error);
2056
+ options.onCancel?.();
2057
+ }
2058
+ };
2059
+
2060
+ //#endregion
2061
+ //#region src/messages/index.ts
2062
+ const signMessage = async (options) => {
2063
+ const provider = await getProviderOrThrow(options.getProvider);
2064
+ const { address, message } = options.payload;
2065
+ if (!address) throw new Error("An address is required to sign a message");
2066
+ if (!message) throw new Error("A message to be signed is required");
2067
+ try {
2068
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
2069
+ const response = await provider.signMessage(request$1);
2070
+ options.onFinish?.(response);
2071
+ } catch (error) {
2072
+ console.error("[Connect] Error during sign message request", error);
2073
+ options.onCancel?.();
2074
+ }
2075
+ };
2076
+
2077
+ //#endregion
2078
+ //#region src/transactions/sendBtcTransaction.ts
2079
+ const serializer = (recipient) => {
2080
+ return recipient.map((value) => {
2081
+ const { address, amountSats } = value;
2082
+ return {
2083
+ address,
2084
+ amountSats: amountSats.toString()
2085
+ };
2086
+ });
2087
+ };
2088
+ const sendBtcTransaction = async (options) => {
2089
+ const provider = await getProviderOrThrow(options.getProvider);
2090
+ const { recipients, senderAddress, network, message } = options.payload;
2091
+ if (!recipients || recipients.length === 0) throw new Error("At least one recipient is required");
2092
+ if (recipients.some((item) => typeof item.address !== "string" || typeof item.amountSats !== "bigint")) throw new Error("Incorrect recipient format");
2093
+ if (!senderAddress) throw new Error("The sender address is required");
2094
+ try {
2095
+ const request$1 = (0, jsontokens.createUnsecuredToken)({
2096
+ network,
2097
+ senderAddress,
2098
+ message,
2099
+ recipients: serializer(recipients)
2100
+ });
2101
+ const response = await provider.sendBtcTransaction(request$1);
2102
+ options.onFinish?.(response);
2103
+ } catch (error) {
2104
+ console.error("[Connect] Error during send BTC transaction request", error);
2105
+ options.onCancel?.();
2106
+ }
2107
+ };
2108
+
2109
+ //#endregion
2110
+ //#region src/transactions/signTransaction.ts
2111
+ const signTransaction = async (options) => {
2112
+ const provider = await getProviderOrThrow(options.getProvider);
2113
+ const { psbtBase64, inputsToSign } = options.payload;
2114
+ if (!psbtBase64) throw new Error("A value for psbtBase64 representing the tx hash is required");
2115
+ if (!inputsToSign) throw new Error("An array specifying the inputs to be signed by the wallet is required");
2116
+ try {
2117
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
2118
+ const response = await provider.signTransaction(request$1);
2119
+ options.onFinish?.(response);
2120
+ } catch (error) {
2121
+ console.error("[Connect] Error during sign transaction request", error);
2122
+ options.onCancel?.();
2123
+ }
2124
+ };
2125
+
2126
+ //#endregion
2127
+ //#region src/transactions/signMultipleTransactions.ts
2128
+ const signMultipleTransactions = async (options) => {
2129
+ const provider = await getProviderOrThrow(options.getProvider);
2130
+ const { psbts } = options.payload;
2131
+ if (!psbts || !psbts.length) throw new Error("psbts array is required");
2132
+ if (psbts.length > 100) throw new Error("psbts array must contain less than 100 psbts");
2133
+ try {
2134
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
2135
+ const response = await provider.signMultipleTransactions(request$1);
2136
+ options.onFinish?.(response);
2137
+ } catch (error) {
2138
+ console.error("[Connect] Error during sign Multiple transactions request", error);
2139
+ options.onCancel?.();
2140
+ }
2141
+ };
2142
+
2143
+ //#endregion
2144
+ exports.AddressPurpose = AddressPurpose;
2145
+ exports.AddressType = AddressType;
2146
+ exports.BaseAdapter = BaseAdapter;
2147
+ exports.BitcoinNetworkType = BitcoinNetworkType;
2148
+ exports.DefaultAdaptersInfo = DefaultAdaptersInfo;
2149
+ exports.MessageSigningProtocols = MessageSigningProtocols;
2150
+ exports.PermissionRequestParams = PermissionRequestParams;
2151
+ exports.ProviderPlatform = ProviderPlatform;
2152
+ exports.RpcErrorCode = RpcErrorCode;
2153
+ exports.RpcIdSchema = RpcIdSchema;
2154
+ exports.SatsConnectAdapter = SatsConnectAdapter;
2155
+ exports.SparkNetworkType = SparkNetworkType;
2156
+ exports.StacksNetworkType = StacksNetworkType;
2157
+ exports.StarknetNetworkType = StarknetNetworkType;
2158
+ exports.accountActionsSchema = accountActionsSchema;
2159
+ exports.accountChangeEventName = accountChangeEventName;
2160
+ exports.accountChangeSchema = accountChangeSchema;
2161
+ exports.accountPermissionSchema = accountPermissionSchema;
2162
+ exports.addListener = addListener;
2163
+ exports.addNetworkMethodName = addNetworkMethodName;
2164
+ exports.addNetworkParamsSchema = addNetworkParamsSchema;
2165
+ exports.addNetworkRequestMessageSchema = addNetworkRequestMessageSchema;
2166
+ exports.addNetworkResultSchema = addNetworkResultSchema;
2167
+ exports.addressSchema = addressSchema;
2168
+ exports.bitcoinNetworkDefinitionSchema = bitcoinNetworkDefinitionSchema;
2169
+ exports.changeNetworkByIdMethodName = changeNetworkByIdMethodName;
2170
+ exports.changeNetworkByIdParamsSchema = changeNetworkByIdParamsSchema;
2171
+ exports.changeNetworkByIdRequestMessageSchema = changeNetworkByIdRequestMessageSchema;
2172
+ exports.changeNetworkByIdResultSchema = changeNetworkByIdResultSchema;
2173
+ exports.changeNetworkMethodName = changeNetworkMethodName;
2174
+ exports.changeNetworkParamsSchema = changeNetworkParamsSchema;
2175
+ exports.changeNetworkRequestMessageSchema = changeNetworkRequestMessageSchema;
2176
+ exports.changeNetworkResultSchema = changeNetworkResultSchema;
2177
+ exports.connectMethodName = connectMethodName;
2178
+ exports.connectParamsSchema = connectParamsSchema;
2179
+ exports.connectRequestMessageSchema = connectRequestMessageSchema;
2180
+ exports.connectResultSchema = connectResultSchema;
2181
+ exports.createInscription = createInscription;
2182
+ exports.createRepeatInscriptions = createRepeatInscriptions;
2183
+ exports.defaultAdapters = defaultAdapters;
2184
+ exports.disconnectEventName = disconnectEventName;
2185
+ exports.disconnectMethodName = disconnectMethodName;
2186
+ exports.disconnectParamsSchema = disconnectParamsSchema;
2187
+ exports.disconnectRequestMessageSchema = disconnectRequestMessageSchema;
2188
+ exports.disconnectResultSchema = disconnectResultSchema;
2189
+ exports.disconnectSchema = disconnectSchema;
2190
+ exports.getAccountMethodName = getAccountMethodName;
2191
+ exports.getAccountParamsSchema = getAccountParamsSchema;
2192
+ exports.getAccountRequestMessageSchema = getAccountRequestMessageSchema;
2193
+ exports.getAccountResultSchema = getAccountResultSchema;
2194
+ exports.getAccountsMethodName = getAccountsMethodName;
2195
+ exports.getAccountsParamsSchema = getAccountsParamsSchema;
2196
+ exports.getAccountsRequestMessageSchema = getAccountsRequestMessageSchema;
2197
+ exports.getAccountsResultSchema = getAccountsResultSchema;
2198
+ exports.getAddress = getAddress;
2199
+ exports.getAddressesMethodName = getAddressesMethodName;
2200
+ exports.getAddressesParamsSchema = getAddressesParamsSchema;
2201
+ exports.getAddressesRequestMessageSchema = getAddressesRequestMessageSchema;
2202
+ exports.getAddressesResultSchema = getAddressesResultSchema;
2203
+ exports.getBalanceMethodName = getBalanceMethodName;
2204
+ exports.getBalanceParamsSchema = getBalanceParamsSchema;
2205
+ exports.getBalanceRequestMessageSchema = getBalanceRequestMessageSchema;
2206
+ exports.getBalanceResultSchema = getBalanceResultSchema;
2207
+ exports.getCapabilities = getCapabilities;
2208
+ exports.getCurrentPermissionsMethodName = getCurrentPermissionsMethodName;
2209
+ exports.getCurrentPermissionsParamsSchema = getCurrentPermissionsParamsSchema;
2210
+ exports.getCurrentPermissionsRequestMessageSchema = getCurrentPermissionsRequestMessageSchema;
2211
+ exports.getCurrentPermissionsResultSchema = getCurrentPermissionsResultSchema;
2212
+ exports.getDefaultProvider = getDefaultProvider;
2213
+ exports.getInfoMethodName = getInfoMethodName;
2214
+ exports.getInfoParamsSchema = getInfoParamsSchema;
2215
+ exports.getInfoRequestMessageSchema = getInfoRequestMessageSchema;
2216
+ exports.getInfoResultSchema = getInfoResultSchema;
2217
+ exports.getInscriptionsMethodName = getInscriptionsMethodName;
2218
+ exports.getInscriptionsParamsSchema = getInscriptionsParamsSchema;
2219
+ exports.getInscriptionsRequestMessageSchema = getInscriptionsRequestMessageSchema;
2220
+ exports.getInscriptionsResultSchema = getInscriptionsResultSchema;
2221
+ exports.getNetworkMethodName = getNetworkMethodName;
2222
+ exports.getNetworkParamsSchema = getNetworkParamsSchema;
2223
+ exports.getNetworkRequestMessageSchema = getNetworkRequestMessageSchema;
2224
+ exports.getNetworkResultSchema = getNetworkResultSchema;
2225
+ exports.getNetworksMethodName = getNetworksMethodName;
2226
+ exports.getNetworksParamsSchema = getNetworksParamsSchema;
2227
+ exports.getNetworksRequestMessageSchema = getNetworksRequestMessageSchema;
2228
+ exports.getNetworksResultSchema = getNetworksResultSchema;
2229
+ exports.getProviderById = getProviderById;
2230
+ exports.getProviderOrThrow = getProviderOrThrow;
2231
+ exports.getProviders = getProviders;
2232
+ exports.getSupportedWallets = getSupportedWallets;
2233
+ exports.getWalletTypeMethodName = getWalletTypeMethodName;
2234
+ exports.getWalletTypeParamsSchema = getWalletTypeParamsSchema;
2235
+ exports.getWalletTypeRequestMessageSchema = getWalletTypeRequestMessageSchema;
2236
+ exports.getWalletTypeResultSchema = getWalletTypeResultSchema;
2237
+ exports.isProviderInstalled = isProviderInstalled;
2238
+ exports.networkChangeEventName = networkChangeEventName;
2239
+ exports.networkChangeSchema = networkChangeSchema;
2240
+ exports.newNetworkDefinitionSchema = newNetworkDefinitionSchema;
2241
+ exports.permission = permission;
2242
+ exports.removeDefaultProvider = removeDefaultProvider;
2243
+ exports.renouncePermissionsMethodName = renouncePermissionsMethodName;
2244
+ exports.renouncePermissionsParamsSchema = renouncePermissionsParamsSchema;
2245
+ exports.renouncePermissionsRequestMessageSchema = renouncePermissionsRequestMessageSchema;
2246
+ exports.renouncePermissionsResultSchema = renouncePermissionsResultSchema;
2247
+ exports.request = request;
2248
+ exports.requestPermissionsMethodName = requestPermissionsMethodName;
2249
+ exports.requestPermissionsParamsSchema = requestPermissionsParamsSchema;
2250
+ exports.requestPermissionsRequestMessageSchema = requestPermissionsRequestMessageSchema;
2251
+ exports.requestPermissionsResultSchema = requestPermissionsResultSchema;
2252
+ exports.rpcErrorResponseMessageSchema = rpcErrorResponseMessageSchema;
2253
+ exports.rpcRequestMessageSchema = rpcRequestMessageSchema;
2254
+ exports.rpcResponseMessageSchema = rpcResponseMessageSchema;
2255
+ exports.rpcSuccessResponseMessageSchema = rpcSuccessResponseMessageSchema;
2256
+ exports.runesEtchMethodName = runesEtchMethodName;
2257
+ exports.runesEtchParamsSchema = runesEtchParamsSchema;
2258
+ exports.runesEtchRequestMessageSchema = runesEtchRequestMessageSchema;
2259
+ exports.runesEtchResultSchema = runesEtchResultSchema;
2260
+ exports.runesGetBalanceMethodName = runesGetBalanceMethodName;
2261
+ exports.runesGetBalanceParamsSchema = runesGetBalanceParamsSchema;
2262
+ exports.runesGetBalanceRequestMessageSchema = runesGetBalanceRequestMessageSchema;
2263
+ exports.runesGetBalanceResultSchema = runesGetBalanceResultSchema;
2264
+ exports.runesMintMethodName = runesMintMethodName;
2265
+ exports.runesMintParamsSchema = runesMintParamsSchema;
2266
+ exports.runesMintRequestMessageSchema = runesMintRequestMessageSchema;
2267
+ exports.runesMintResultSchema = runesMintResultSchema;
2268
+ exports.runesTransferMethodName = runesTransferMethodName;
2269
+ exports.runesTransferParamsSchema = runesTransferParamsSchema;
2270
+ exports.runesTransferRequestMessageSchema = runesTransferRequestMessageSchema;
2271
+ exports.runesTransferResultSchema = runesTransferResultSchema;
2272
+ exports.sendBtcTransaction = sendBtcTransaction;
2273
+ exports.sendInscriptionsMethodName = sendInscriptionsMethodName;
2274
+ exports.sendInscriptionsParamsSchema = sendInscriptionsParamsSchema;
2275
+ exports.sendInscriptionsRequestMessageSchema = sendInscriptionsRequestMessageSchema;
2276
+ exports.sendInscriptionsResultSchema = sendInscriptionsResultSchema;
2277
+ exports.sendTransferMethodName = sendTransferMethodName;
2278
+ exports.sendTransferParamsSchema = sendTransferParamsSchema;
2279
+ exports.sendTransferRequestMessageSchema = sendTransferRequestMessageSchema;
2280
+ exports.sendTransferResultSchema = sendTransferResultSchema;
2281
+ exports.setDefaultProvider = setDefaultProvider;
2282
+ exports.signMessage = signMessage;
2283
+ exports.signMessageMethodName = signMessageMethodName;
2284
+ exports.signMessageParamsSchema = signMessageParamsSchema;
2285
+ exports.signMessageRequestMessageSchema = signMessageRequestMessageSchema;
2286
+ exports.signMessageResultSchema = signMessageResultSchema;
2287
+ exports.signMultipleTransactions = signMultipleTransactions;
2288
+ exports.signPsbtMethodName = signPsbtMethodName;
2289
+ exports.signPsbtParamsSchema = signPsbtParamsSchema;
2290
+ exports.signPsbtRequestMessageSchema = signPsbtRequestMessageSchema;
2291
+ exports.signPsbtResultSchema = signPsbtResultSchema;
2292
+ exports.signTransaction = signTransaction;
2293
+ exports.sparkFlashnetAddLiquidityIntentSchema = sparkFlashnetAddLiquidityIntentSchema;
2294
+ exports.sparkFlashnetClawbackIntentSchema = sparkFlashnetClawbackIntentSchema;
2295
+ exports.sparkFlashnetConfirmInitialDepositIntentSchema = sparkFlashnetConfirmInitialDepositIntentSchema;
2296
+ exports.sparkFlashnetCreateConstantProductPoolIntentSchema = sparkFlashnetCreateConstantProductPoolIntentSchema;
2297
+ exports.sparkFlashnetCreateSingleSidedPoolIntentSchema = sparkFlashnetCreateSingleSidedPoolIntentSchema;
2298
+ exports.sparkFlashnetGetJwtMethodName = sparkFlashnetGetJwtMethodName;
2299
+ exports.sparkFlashnetGetJwtParamsSchema = sparkFlashnetGetJwtParamsSchema;
2300
+ exports.sparkFlashnetGetJwtRequestMessageSchema = sparkFlashnetGetJwtRequestMessageSchema;
2301
+ exports.sparkFlashnetGetJwtResultSchema = sparkFlashnetGetJwtResultSchema;
2302
+ exports.sparkFlashnetRemoveLiquidityIntentSchema = sparkFlashnetRemoveLiquidityIntentSchema;
2303
+ exports.sparkFlashnetRouteSwapIntentSchema = sparkFlashnetRouteSwapIntentSchema;
2304
+ exports.sparkFlashnetSignIntentMethodName = sparkFlashnetSignIntentMethodName;
2305
+ exports.sparkFlashnetSignIntentParamsSchema = sparkFlashnetSignIntentParamsSchema;
2306
+ exports.sparkFlashnetSignIntentRequestMessageSchema = sparkFlashnetSignIntentRequestMessageSchema;
2307
+ exports.sparkFlashnetSignIntentResultSchema = sparkFlashnetSignIntentResultSchema;
2308
+ exports.sparkFlashnetSignStructuredMessageMethodName = sparkFlashnetSignStructuredMessageMethodName;
2309
+ exports.sparkFlashnetSignStructuredMessageParamsSchema = sparkFlashnetSignStructuredMessageParamsSchema;
2310
+ exports.sparkFlashnetSignStructuredMessageRequestMessageSchema = sparkFlashnetSignStructuredMessageRequestMessageSchema;
2311
+ exports.sparkFlashnetSignStructuredMessageResultSchema = sparkFlashnetSignStructuredMessageResultSchema;
2312
+ exports.sparkFlashnetSwapIntentSchema = sparkFlashnetSwapIntentSchema;
2313
+ exports.sparkGetAddressesMethodName = sparkGetAddressesMethodName;
2314
+ exports.sparkGetAddressesParamsSchema = sparkGetAddressesParamsSchema;
2315
+ exports.sparkGetAddressesRequestMessageSchema = sparkGetAddressesRequestMessageSchema;
2316
+ exports.sparkGetAddressesResultSchema = sparkGetAddressesResultSchema;
2317
+ exports.sparkGetBalanceMethodName = sparkGetBalanceMethodName;
2318
+ exports.sparkGetBalanceParamsSchema = sparkGetBalanceParamsSchema;
2319
+ exports.sparkGetBalanceRequestMessageSchema = sparkGetBalanceRequestMessageSchema;
2320
+ exports.sparkGetBalanceResultSchema = sparkGetBalanceResultSchema;
2321
+ exports.sparkNetworkDefinitionSchema = sparkNetworkDefinitionSchema;
2322
+ exports.sparkSignMessageMethodName = sparkSignMessageMethodName;
2323
+ exports.sparkSignMessageParamsSchema = sparkSignMessageParamsSchema;
2324
+ exports.sparkSignMessageRequestMessageSchema = sparkSignMessageRequestMessageSchema;
2325
+ exports.sparkSignMessageResultSchema = sparkSignMessageResultSchema;
2326
+ exports.sparkTransferMethodName = sparkTransferMethodName;
2327
+ exports.sparkTransferParamsSchema = sparkTransferParamsSchema;
2328
+ exports.sparkTransferRequestMessageSchema = sparkTransferRequestMessageSchema;
2329
+ exports.sparkTransferResultSchema = sparkTransferResultSchema;
2330
+ exports.sparkTransferTokenMethodName = sparkTransferTokenMethodName;
2331
+ exports.sparkTransferTokenParamsSchema = sparkTransferTokenParamsSchema;
2332
+ exports.sparkTransferTokenRequestMessageSchema = sparkTransferTokenRequestMessageSchema;
2333
+ exports.sparkTransferTokenResultSchema = sparkTransferTokenResultSchema;
2334
+ exports.stacksNetworkDefinitionSchema = stacksNetworkDefinitionSchema;
2335
+ exports.starknetNetworkDefinitionSchema = starknetNetworkDefinitionSchema;
2336
+ exports.stxCallContractMethodName = stxCallContractMethodName;
2337
+ exports.stxCallContractParamsSchema = stxCallContractParamsSchema;
2338
+ exports.stxCallContractRequestMessageSchema = stxCallContractRequestMessageSchema;
2339
+ exports.stxCallContractResultSchema = stxCallContractResultSchema;
2340
+ exports.stxDeployContractMethodName = stxDeployContractMethodName;
2341
+ exports.stxDeployContractParamsSchema = stxDeployContractParamsSchema;
2342
+ exports.stxDeployContractRequestMessageSchema = stxDeployContractRequestMessageSchema;
2343
+ exports.stxDeployContractResultSchema = stxDeployContractResultSchema;
2344
+ exports.stxGetAccountsMethodName = stxGetAccountsMethodName;
2345
+ exports.stxGetAccountsParamsSchema = stxGetAccountsParamsSchema;
2346
+ exports.stxGetAccountsRequestMessageSchema = stxGetAccountsRequestMessageSchema;
2347
+ exports.stxGetAccountsResultSchema = stxGetAccountsResultSchema;
2348
+ exports.stxGetAddressesMethodName = stxGetAddressesMethodName;
2349
+ exports.stxGetAddressesParamsSchema = stxGetAddressesParamsSchema;
2350
+ exports.stxGetAddressesRequestMessageSchema = stxGetAddressesRequestMessageSchema;
2351
+ exports.stxGetAddressesResultSchema = stxGetAddressesResultSchema;
2352
+ exports.stxSignMessageMethodName = stxSignMessageMethodName;
2353
+ exports.stxSignMessageParamsSchema = stxSignMessageParamsSchema;
2354
+ exports.stxSignMessageRequestMessageSchema = stxSignMessageRequestMessageSchema;
2355
+ exports.stxSignMessageResultSchema = stxSignMessageResultSchema;
2356
+ exports.stxSignStructuredMessageMethodName = stxSignStructuredMessageMethodName;
2357
+ exports.stxSignStructuredMessageParamsSchema = stxSignStructuredMessageParamsSchema;
2358
+ exports.stxSignStructuredMessageRequestMessageSchema = stxSignStructuredMessageRequestMessageSchema;
2359
+ exports.stxSignStructuredMessageResultSchema = stxSignStructuredMessageResultSchema;
2360
+ exports.stxSignTransactionMethodName = stxSignTransactionMethodName;
2361
+ exports.stxSignTransactionParamsSchema = stxSignTransactionParamsSchema;
2362
+ exports.stxSignTransactionRequestMessageSchema = stxSignTransactionRequestMessageSchema;
2363
+ exports.stxSignTransactionResultSchema = stxSignTransactionResultSchema;
2364
+ exports.stxSignTransactionsMethodName = stxSignTransactionsMethodName;
2365
+ exports.stxSignTransactionsParamsSchema = stxSignTransactionsParamsSchema;
2366
+ exports.stxSignTransactionsRequestMessageSchema = stxSignTransactionsRequestMessageSchema;
2367
+ exports.stxSignTransactionsResultSchema = stxSignTransactionsResultSchema;
2368
+ exports.stxTransferStxMethodName = stxTransferStxMethodName;
2369
+ exports.stxTransferStxParamsSchema = stxTransferStxParamsSchema;
2370
+ exports.stxTransferStxRequestMessageSchema = stxTransferStxRequestMessageSchema;
2371
+ exports.stxTransferStxResultSchema = stxTransferStxResultSchema;
2372
+ exports.walletActionsSchema = walletActionsSchema;
2373
+ exports.walletEventSchema = walletEventSchema;
2374
+ exports.walletPermissionSchema = walletPermissionSchema;
2375
+ exports.walletTypeSchema = walletTypeSchema;
2376
+ exports.walletTypes = walletTypes;