@sats-connect/core 0.16.0-c18e93a → 0.16.0-c4a8b07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/dist/index.cjs +3062 -1857
  2. package/dist/index.d.cts +13212 -3328
  3. package/dist/index.d.mts +13212 -3328
  4. package/dist/index.mjs +2780 -1666
  5. package/package.json +16 -3
package/dist/index.mjs CHANGED
@@ -3,8 +3,105 @@ import { createUnsecuredToken } from "jsontokens";
3
3
  import axios from "axios";
4
4
  import { AddressType as AddressType$1, getAddressInfo } from "bitcoin-address-validation";
5
5
  import { Buffer } from "buffer";
6
+ import { match } from "ts-pattern";
6
7
 
7
- //#region src/request/types/common.ts
8
+ //#region src/request/rpc/objects/namespaces/wallet/shared/networks.ts
9
+ const commonNetworkConfigurationSchema = v.object({
10
+ id: v.string(),
11
+ name: v.string(),
12
+ mode: v.picklist([]),
13
+ blockExplorerUrl: v.optional(v.union([v.pipe(v.literal(""), v.transform(() => void 0)), v.pipe(v.string(), v.url())]))
14
+ });
15
+ const bitcoinChainModeSchema = v.enum({
16
+ mainnet: "mainnet",
17
+ testnet: "testnet",
18
+ testnet4: "testnet4",
19
+ signet: "signet",
20
+ regtest: "regtest"
21
+ });
22
+ const bitcoinNetworkConfigurationSchema = v.object({
23
+ chain: v.literal("bitcoin"),
24
+ ...commonNetworkConfigurationSchema.entries,
25
+ mode: v.pipe(v.string(), bitcoinChainModeSchema),
26
+ xverseApiUrl: v.pipe(v.string(), v.url()),
27
+ electrsApiUrl: v.pipe(v.string(), v.url())
28
+ });
29
+ const sparkChainMode = {
30
+ mainnet: "mainnet",
31
+ regtest: "regtest"
32
+ };
33
+ const sparkChainModeSchema = v.enum(sparkChainMode);
34
+ const sparkNetworkConfigurationSchema = v.object({
35
+ chain: v.literal("spark"),
36
+ ...commonNetworkConfigurationSchema.entries,
37
+ mode: v.pipe(v.string(), sparkChainModeSchema),
38
+ electrsApiUrl: v.pipe(v.string(), v.url())
39
+ });
40
+ const stacksChainMode = {
41
+ mainnet: "mainnet",
42
+ testnet: "testnet",
43
+ devnet: "devnet",
44
+ mocknet: "mocknet"
45
+ };
46
+ const stacksChainModeSchema = v.enum(stacksChainMode);
47
+ const stacksNetworkConfigurationSchema = v.object({
48
+ chain: v.literal("stacks"),
49
+ ...commonNetworkConfigurationSchema.entries,
50
+ mode: v.pipe(v.string(), stacksChainModeSchema),
51
+ stacksApiUrl: v.pipe(v.string(), v.url()),
52
+ xverseApiUrl: v.pipe(v.string(), v.url())
53
+ });
54
+ const starknetChainMode = {
55
+ mainnet: "mainnet",
56
+ sepolia: "sepolia"
57
+ };
58
+ const starknetChainModeSchema = v.enum(starknetChainMode);
59
+ const starknetNetworkConfigurationSchema = v.object({
60
+ chain: v.literal("starknet"),
61
+ ...commonNetworkConfigurationSchema.entries,
62
+ mode: v.pipe(v.string(), starknetChainModeSchema),
63
+ rpcApiUrl: v.pipe(v.string(), v.url()),
64
+ xverseApiUrl: v.pipe(v.string(), v.url())
65
+ });
66
+ const networkConfigurationSchema = v.variant("chain", [
67
+ bitcoinNetworkConfigurationSchema,
68
+ sparkNetworkConfigurationSchema,
69
+ stacksNetworkConfigurationSchema,
70
+ starknetNetworkConfigurationSchema
71
+ ]);
72
+ const bitcoinNetworkConfigurationOptionsSchema = v.omit(bitcoinNetworkConfigurationSchema, ["id"]);
73
+ const sparkNetworkConfigurationOptionsSchema = v.omit(sparkNetworkConfigurationSchema, ["id"]);
74
+ const stacksNetworkConfigurationOptionsSchema = v.omit(stacksNetworkConfigurationSchema, ["id"]);
75
+ const starknetNetworkConfigurationOptionsSchema = v.omit(starknetNetworkConfigurationSchema, ["id"]);
76
+ const networkConfigurationOptionsSchema = v.variant("chain", [
77
+ bitcoinNetworkConfigurationOptionsSchema,
78
+ sparkNetworkConfigurationOptionsSchema,
79
+ stacksNetworkConfigurationOptionsSchema,
80
+ starknetNetworkConfigurationOptionsSchema
81
+ ]);
82
+ const allResolvedNetworksSchema = v.object({
83
+ active: v.object({
84
+ bitcoin: bitcoinNetworkConfigurationSchema,
85
+ spark: sparkNetworkConfigurationSchema,
86
+ stacks: stacksNetworkConfigurationSchema,
87
+ starknet: starknetNetworkConfigurationSchema
88
+ }),
89
+ builtin: v.object({
90
+ bitcoin: v.array(bitcoinNetworkConfigurationSchema),
91
+ spark: v.array(sparkNetworkConfigurationSchema),
92
+ stacks: v.array(stacksNetworkConfigurationSchema),
93
+ starknet: v.array(starknetNetworkConfigurationSchema)
94
+ }),
95
+ custom: v.object({
96
+ bitcoin: v.array(bitcoinNetworkConfigurationSchema),
97
+ spark: v.array(sparkNetworkConfigurationSchema),
98
+ stacks: v.array(stacksNetworkConfigurationSchema),
99
+ starknet: v.array(starknetNetworkConfigurationSchema)
100
+ })
101
+ });
102
+
103
+ //#endregion
104
+ //#region src/request/rpc/objects/shared/index.ts
8
105
  const walletTypes = [
9
106
  "software",
10
107
  "ledger",
@@ -60,124 +157,6 @@ const getAddress = async (options) => {
60
157
  }
61
158
  };
62
159
 
63
- //#endregion
64
- //#region src/request/types/walletMethods/utils.ts
65
- const commonNetworkSchema = v.object({
66
- id: v.string(),
67
- name: v.string(),
68
- mode: v.picklist([]),
69
- blockExplorerUrl: v.optional(v.pipe(v.string(), v.url()))
70
- });
71
- const bitcoinChainModeSchema = v.picklist([
72
- "mainnet",
73
- "testnet",
74
- "testnet4",
75
- "signet",
76
- "regtest"
77
- ]);
78
- const bitcoinNetworkSchema = v.object({
79
- chain: v.literal("bitcoin"),
80
- ...commonNetworkSchema.entries,
81
- mode: bitcoinChainModeSchema,
82
- xverseApiUrl: v.string(),
83
- electrsApiUrl: v.string()
84
- });
85
- const sparkChainModeSchema = v.picklist(["mainnet", "regtest"]);
86
- const sparkNetworkSchema = v.object({
87
- chain: v.literal("spark"),
88
- ...commonNetworkSchema.entries,
89
- mode: sparkChainModeSchema,
90
- electrsApiUrl: v.string()
91
- });
92
- const stacksChainModeSchema = v.picklist([
93
- "mainnet",
94
- "testnet",
95
- "devnet",
96
- "mocknet"
97
- ]);
98
- const stacksNetworkSchema = v.object({
99
- chain: v.literal("stacks"),
100
- ...commonNetworkSchema.entries,
101
- mode: stacksChainModeSchema,
102
- stacksApiUrl: v.string(),
103
- xverseApiUrl: v.string()
104
- });
105
- const starknetChainModeSchema = v.picklist(["mainnet", "sepolia"]);
106
- const starknetNetworkSchema = v.object({
107
- chain: v.literal("starknet"),
108
- ...commonNetworkSchema.entries,
109
- mode: starknetChainModeSchema,
110
- rpcApiUrl: v.string(),
111
- xverseApiUrl: v.string()
112
- });
113
- const networkSchema = v.variant("chain", [
114
- bitcoinNetworkSchema,
115
- sparkNetworkSchema,
116
- stacksNetworkSchema,
117
- starknetNetworkSchema
118
- ]);
119
-
120
- //#endregion
121
- //#region src/provider/types.ts
122
- const accountChangeEventName = "accountChange";
123
- const accountChangeSchema = v.object({
124
- type: v.literal(accountChangeEventName),
125
- addresses: v.optional(v.array(addressSchema))
126
- });
127
- const networkChangeEventName = "networkChange";
128
- const networkChangeSchema = v.object({
129
- type: v.literal(networkChangeEventName),
130
- networks: v.object({
131
- bitcoin: bitcoinNetworkSchema,
132
- spark: sparkNetworkSchema,
133
- stacks: stacksNetworkSchema,
134
- starknet: starknetNetworkSchema
135
- }),
136
- addresses: v.optional(v.array(addressSchema))
137
- });
138
- const disconnectEventName = "disconnect";
139
- const disconnectSchema = v.object({ type: v.literal(disconnectEventName) });
140
- const walletEventSchema = v.variant("type", [
141
- accountChangeSchema,
142
- networkChangeSchema,
143
- disconnectSchema
144
- ]);
145
-
146
- //#endregion
147
- //#region src/provider/index.ts
148
- async function getProviderOrThrow(getProvider) {
149
- const provider = await getProvider?.() || window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
150
- if (!provider) throw new Error("No Bitcoin wallet installed");
151
- return provider;
152
- }
153
- function getProviders() {
154
- if (!window.btc_providers) window.btc_providers = [];
155
- return window.btc_providers;
156
- }
157
- function getProviderById(providerId) {
158
- return providerId?.split(".").reduce((acc, part) => acc?.[part], window);
159
- }
160
- function isProviderInstalled(providerId) {
161
- return !!getProviderById(providerId);
162
- }
163
- function setDefaultProvider(providerId) {
164
- localStorage.setItem("sats-connect_defaultProvider", providerId);
165
- }
166
- function getDefaultProvider() {
167
- return localStorage.getItem("sats-connect_defaultProvider");
168
- }
169
- function removeDefaultProvider() {
170
- localStorage.removeItem("sats-connect_defaultProvider");
171
- }
172
- function getSupportedWallets() {
173
- return Object.values(DefaultAdaptersInfo).map((provider) => {
174
- return {
175
- ...provider,
176
- isInstalled: isProviderInstalled(provider.id)
177
- };
178
- });
179
- }
180
-
181
160
  //#endregion
182
161
  //#region src/types.ts
183
162
  let BitcoinNetworkType = /* @__PURE__ */ function(BitcoinNetworkType$1) {
@@ -203,21 +182,6 @@ let SparkNetworkType = /* @__PURE__ */ function(SparkNetworkType$1) {
203
182
  SparkNetworkType$1["Regtest"] = "regtest";
204
183
  return SparkNetworkType$1;
205
184
  }({});
206
- const RpcIdSchema = v.optional(v.union([
207
- v.string(),
208
- v.number(),
209
- v.null()
210
- ]));
211
- const rpcRequestMessageSchema = v.object({
212
- jsonrpc: v.literal("2.0"),
213
- method: v.string(),
214
- params: v.optional(v.union([
215
- v.array(v.unknown()),
216
- v.looseObject({}),
217
- v.null()
218
- ])),
219
- id: v.unwrap(RpcIdSchema)
220
- });
221
185
  /**
222
186
  * @enum {number} RpcErrorCode
223
187
  * @description JSON-RPC error codes
@@ -259,638 +223,1583 @@ let RpcErrorCode = /* @__PURE__ */ function(RpcErrorCode$1) {
259
223
  RpcErrorCode$1[RpcErrorCode$1["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
260
224
  return RpcErrorCode$1;
261
225
  }({});
262
- const rpcSuccessResponseMessageSchema = v.object({
263
- jsonrpc: v.literal("2.0"),
264
- result: v.nonOptional(v.unknown()),
265
- id: RpcIdSchema
226
+
227
+ //#endregion
228
+ //#region src/provider/types.ts
229
+ const accountChangeEventName = "accountChange";
230
+ const accountChangeSchema = v.object({
231
+ type: v.literal(accountChangeEventName),
232
+ addresses: v.optional(v.array(addressSchema))
266
233
  });
267
- const rpcErrorResponseMessageSchema = v.object({
268
- jsonrpc: v.literal("2.0"),
269
- error: v.nonOptional(v.unknown()),
270
- id: RpcIdSchema
234
+ const networkChangeEventName = "networkChange";
235
+ const networkChangeSchema = v.object({
236
+ type: v.literal(networkChangeEventName),
237
+ bitcoin: v.object({ name: v.enum(BitcoinNetworkType) }),
238
+ stacks: v.object({ name: v.string() }),
239
+ addresses: v.optional(v.array(addressSchema))
240
+ });
241
+ const networkChangeEventNameV2 = "networkChangeV2";
242
+ const networkChangeV2Schema = v.object({
243
+ type: v.literal(networkChangeEventName),
244
+ networks: v.object({
245
+ bitcoin: bitcoinNetworkConfigurationSchema,
246
+ spark: sparkNetworkConfigurationSchema,
247
+ stacks: stacksNetworkConfigurationSchema,
248
+ starknet: starknetNetworkConfigurationSchema
249
+ }),
250
+ addresses: v.optional(v.array(addressSchema))
271
251
  });
272
- const rpcResponseMessageSchema = v.union([rpcSuccessResponseMessageSchema, rpcErrorResponseMessageSchema]);
252
+ const disconnectEventName = "disconnect";
253
+ const disconnectSchema = v.object({ type: v.literal(disconnectEventName) });
254
+ const walletEventSchema = v.variant("type", [
255
+ accountChangeSchema,
256
+ networkChangeSchema,
257
+ disconnectSchema
258
+ ]);
273
259
 
274
260
  //#endregion
275
- //#region src/request/sanitizeRequest.ts
276
- const sanitizeRequest = (method, params, providerInfo) => {
277
- try {
278
- const [major, minor, patch] = providerInfo.version.split(".").map((part) => parseInt(part, 10));
279
- const platform = providerInfo.platform;
280
- if (!platform || platform === ProviderPlatform.Web && major <= 1 && minor <= 4 || platform === ProviderPlatform.Mobile && major <= 1 && minor <= 54) {
281
- const v1Sanitized = sanitizeAddressPurposeRequest(method, params);
282
- method = v1Sanitized.method;
283
- params = v1Sanitized.params;
284
- }
285
- } catch {}
286
- return {
287
- method,
288
- params
289
- };
290
- };
291
- const sanitizeAddressPurposeRequest = (method, params) => {
292
- const filterPurposes = (purposes) => purposes?.filter((purpose) => purpose !== AddressPurpose.Spark && purpose !== AddressPurpose.Starknet);
293
- if (method === "wallet_connect") {
294
- const typedParams = params;
295
- if (!typedParams) return {
296
- method,
297
- params
298
- };
299
- const { addresses, ...rest } = typedParams;
300
- return {
301
- method,
302
- params: {
303
- ...rest,
304
- addresses: filterPurposes(addresses)
305
- }
306
- };
307
- }
308
- if (method === "getAccounts") {
309
- const { purposes, ...rest } = params;
261
+ //#region src/provider/index.ts
262
+ async function getProviderOrThrow(getProvider) {
263
+ const provider = await getProvider?.() || window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
264
+ if (!provider) throw new Error("No Bitcoin wallet installed");
265
+ return provider;
266
+ }
267
+ function getProviders() {
268
+ if (!window.btc_providers) window.btc_providers = [];
269
+ return window.btc_providers;
270
+ }
271
+ function getProviderById(providerId) {
272
+ return providerId?.split(".").reduce((acc, part) => acc?.[part], window);
273
+ }
274
+ function isProviderInstalled(providerId) {
275
+ return !!getProviderById(providerId);
276
+ }
277
+ function setDefaultProvider(providerId) {
278
+ localStorage.setItem("sats-connect_defaultProvider", providerId);
279
+ }
280
+ function getDefaultProvider() {
281
+ return localStorage.getItem("sats-connect_defaultProvider");
282
+ }
283
+ function removeDefaultProvider() {
284
+ localStorage.removeItem("sats-connect_defaultProvider");
285
+ }
286
+ function getSupportedWallets() {
287
+ return Object.values(DefaultAdaptersInfo).map((provider) => {
310
288
  return {
311
- method,
312
- params: {
313
- ...rest,
314
- purposes: filterPurposes(purposes)
315
- }
289
+ ...provider,
290
+ isInstalled: isProviderInstalled(provider.id)
316
291
  };
292
+ });
293
+ }
294
+
295
+ //#endregion
296
+ //#region src/runes/api.ts
297
+ const urlNetworkSuffix = {
298
+ [BitcoinNetworkType.Mainnet]: "",
299
+ [BitcoinNetworkType.Testnet]: "-testnet",
300
+ [BitcoinNetworkType.Testnet4]: "-testnet4",
301
+ [BitcoinNetworkType.Signet]: "-signet"
302
+ };
303
+ const ORDINALS_API_BASE_URL = (network = BitcoinNetworkType.Mainnet) => {
304
+ if (network === BitcoinNetworkType.Regtest) throw new Error(`Ordinals API does not support ${network} network`);
305
+ return `https://ordinals${urlNetworkSuffix[network]}.xverse.app/v1`;
306
+ };
307
+ var RunesApi = class {
308
+ client;
309
+ constructor(network) {
310
+ this.client = axios.create({ baseURL: ORDINALS_API_BASE_URL(network) });
317
311
  }
318
- if (method === "getAddresses") {
319
- const { purposes, ...rest } = params;
312
+ parseError = (error) => {
320
313
  return {
321
- method,
322
- params: {
323
- ...rest,
324
- purposes: filterPurposes(purposes)
325
- }
314
+ code: error.response?.status,
315
+ message: JSON.stringify(error.response?.data)
326
316
  };
327
- }
328
- return {
329
- method,
330
- params
331
317
  };
332
- };
333
-
334
- //#endregion
335
- //#region src/request/types/btcMethods/common.ts
336
- let MessageSigningProtocols = /* @__PURE__ */ function(MessageSigningProtocols$1) {
337
- MessageSigningProtocols$1["ECDSA"] = "ECDSA";
338
- MessageSigningProtocols$1["BIP322"] = "BIP322";
339
- return MessageSigningProtocols$1;
340
- }({});
341
-
342
- //#endregion
343
- //#region src/request/types/btcMethods/getAccounts.ts
344
- const getAccountsMethodName = "getAccounts";
345
- const getAccountsParamsSchema = v.object({
346
- purposes: v.array(v.enum(AddressPurpose)),
347
- message: v.optional(v.string())
348
- });
349
- const getAccountsResultSchema = v.array(v.object({
350
- ...addressSchema.entries,
351
- ...v.object({ walletType: walletTypeSchema }).entries
352
- }));
353
- const getAccountsRequestMessageSchema = v.object({
354
- ...rpcRequestMessageSchema.entries,
355
- ...v.object({
356
- method: v.literal(getAccountsMethodName),
357
- params: getAccountsParamsSchema,
358
- id: v.string()
359
- }).entries
360
- });
361
-
362
- //#endregion
363
- //#region src/request/types/walletMethods/addNetwork.ts
364
- const addNetworkMethodName = "wallet_addNetwork";
365
- const bitcoinNetworkDefinitionSchema = v.omit(bitcoinNetworkSchema, ["id"]);
366
- const sparkNetworkDefinitionSchema = v.omit(sparkNetworkSchema, ["id"]);
367
- const stacksNetworkDefinitionSchema = v.omit(stacksNetworkSchema, ["id"]);
368
- const starknetNetworkDefinitionSchema = v.omit(starknetNetworkSchema, ["id"]);
369
- const newNetworkDefinitionSchema = v.variant("chain", [
370
- bitcoinNetworkDefinitionSchema,
371
- sparkNetworkDefinitionSchema,
372
- stacksNetworkDefinitionSchema,
373
- starknetNetworkDefinitionSchema
374
- ]);
375
- const addNetworkParamsSchema = v.object({
376
- network: newNetworkDefinitionSchema,
377
- isActive: v.optional(v.boolean())
378
- });
379
- const addNetworkRequestMessageSchema = v.object({
380
- ...rpcRequestMessageSchema.entries,
381
- ...v.object({
382
- method: v.literal(addNetworkMethodName),
383
- params: addNetworkParamsSchema,
384
- id: v.string()
385
- }).entries
386
- });
387
- const addNetworkResultSchema = v.object({ id: v.string() });
388
-
389
- //#endregion
390
- //#region src/request/types/walletMethods/changeNetwork.ts
391
- const changeNetworkMethodName = "wallet_changeNetwork";
392
- const changeNetworkParamsSchema = v.object({ name: v.enum(BitcoinNetworkType) });
393
- const changeNetworkResultSchema = v.nullish(v.null());
394
- const changeNetworkRequestMessageSchema = v.object({
395
- ...rpcRequestMessageSchema.entries,
396
- ...v.object({
397
- method: v.literal(changeNetworkMethodName),
398
- params: changeNetworkParamsSchema,
399
- id: v.string()
400
- }).entries
401
- });
402
-
403
- //#endregion
404
- //#region src/request/types/walletMethods/changeNetworkById.ts
405
- const changeNetworkByIdMethodName = "wallet_changeNetworkById";
406
- const changeNetworkByIdParamsSchema = v.object({ id: v.string() });
407
- const changeNetworkByIdResultSchema = v.nullish(v.null());
408
- const changeNetworkByIdRequestMessageSchema = v.object({
409
- ...rpcRequestMessageSchema.entries,
410
- ...v.object({
411
- method: v.literal(changeNetworkByIdMethodName),
412
- params: changeNetworkByIdParamsSchema,
413
- id: v.string()
414
- }).entries
415
- });
416
-
417
- //#endregion
418
- //#region src/request/types/walletMethods/common.ts
419
- const accountActionsSchema = v.object({ read: v.optional(v.boolean()) });
420
- const walletActionsSchema = v.object({ readNetwork: v.optional(v.boolean()) });
421
- const accountPermissionSchema = v.object({
422
- type: v.literal("account"),
423
- resourceId: v.string(),
424
- clientId: v.string(),
425
- actions: accountActionsSchema
426
- });
427
- const walletPermissionSchema = v.object({
428
- type: v.literal("wallet"),
429
- resourceId: v.string(),
430
- clientId: v.string(),
431
- actions: walletActionsSchema
432
- });
433
- /**
434
- * Permissions with the clientId field omitted and optional actions. Used for
435
- * permission requests, since the wallet performs authentication based on the
436
- * client's tab origin and should not rely on the client authenticating
437
- * themselves.
438
- */
439
- const PermissionRequestParams = v.variant("type", [v.object({ ...v.omit(accountPermissionSchema, ["clientId"]).entries }), v.object({ ...v.omit(walletPermissionSchema, ["clientId"]).entries })]);
440
- const permission = v.variant("type", [accountPermissionSchema, walletPermissionSchema]);
441
-
442
- //#endregion
443
- //#region src/request/types/walletMethods/getNetwork.ts
444
- const getNetworkMethodName = "wallet_getNetwork";
445
- const getNetworkParamsSchema = v.nullish(v.null());
446
- const getNetworkResultSchema = v.object({
447
- bitcoin: v.object({ name: v.enum(BitcoinNetworkType) }),
448
- stacks: v.object({ name: v.enum(StacksNetworkType) }),
449
- spark: v.object({ name: v.enum(SparkNetworkType) })
450
- });
451
- const getNetworkRequestMessageSchema = v.object({
452
- ...rpcRequestMessageSchema.entries,
453
- ...v.object({
454
- method: v.literal(getNetworkMethodName),
455
- params: getNetworkParamsSchema,
456
- id: v.string()
457
- }).entries
458
- });
459
-
460
- //#endregion
461
- //#region src/request/types/walletMethods/connect.ts
462
- const connectMethodName = "wallet_connect";
463
- const connectParamsSchema = v.nullish(v.object({
464
- permissions: v.optional(v.array(PermissionRequestParams)),
465
- addresses: v.optional(v.array(v.enum(AddressPurpose))),
466
- message: v.optional(v.pipe(v.string(), v.maxLength(80, "The message must not exceed 80 characters."))),
467
- network: v.optional(v.enum(BitcoinNetworkType))
468
- }));
469
- const connectResultSchema = v.object({
470
- id: v.string(),
471
- addresses: v.array(addressSchema),
472
- walletType: walletTypeSchema,
473
- network: getNetworkResultSchema
474
- });
475
- const connectRequestMessageSchema = v.object({
476
- ...rpcRequestMessageSchema.entries,
477
- ...v.object({
478
- method: v.literal(connectMethodName),
479
- params: connectParamsSchema,
480
- id: v.string()
481
- }).entries
482
- });
483
-
484
- //#endregion
485
- //#region src/request/types/walletMethods/disconnect.ts
486
- const disconnectMethodName = "wallet_disconnect";
487
- const disconnectParamsSchema = v.nullish(v.null());
488
- const disconnectResultSchema = v.nullish(v.null());
489
- const disconnectRequestMessageSchema = v.object({
490
- ...rpcRequestMessageSchema.entries,
491
- ...v.object({
492
- method: v.literal(disconnectMethodName),
493
- params: disconnectParamsSchema,
494
- id: v.string()
495
- }).entries
496
- });
497
-
498
- //#endregion
499
- //#region src/request/types/walletMethods/getAccount.ts
500
- const getAccountMethodName = "wallet_getAccount";
501
- const getAccountParamsSchema = v.nullish(v.null());
502
- const getAccountResultSchema = v.object({
503
- id: v.string(),
504
- addresses: v.array(addressSchema),
505
- walletType: walletTypeSchema,
506
- network: getNetworkResultSchema
507
- });
508
- const getAccountRequestMessageSchema = v.object({
509
- ...rpcRequestMessageSchema.entries,
510
- ...v.object({
511
- method: v.literal(getAccountMethodName),
512
- params: getAccountParamsSchema,
513
- id: v.string()
514
- }).entries
515
- });
516
-
517
- //#endregion
518
- //#region src/request/types/walletMethods/getCurrentPermissions.ts
519
- const getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
520
- const getCurrentPermissionsParamsSchema = v.nullish(v.null());
521
- const getCurrentPermissionsResultSchema = v.array(permission);
522
- const getCurrentPermissionsRequestMessageSchema = v.object({
523
- ...rpcRequestMessageSchema.entries,
524
- ...v.object({
525
- method: v.literal(getCurrentPermissionsMethodName),
526
- params: getCurrentPermissionsParamsSchema,
527
- id: v.string()
528
- }).entries
529
- });
530
-
531
- //#endregion
532
- //#region src/request/types/walletMethods/getNetworks.ts
533
- const getNetworksMethodName = "wallet_getNetworks";
534
- const getNetworksParamsSchema = v.nullish(v.null());
535
- const getNetworksResultSchema = v.object({
536
- active: v.object({
537
- bitcoin: bitcoinNetworkSchema,
538
- stacks: stacksNetworkSchema,
539
- spark: sparkNetworkSchema,
540
- starknet: starknetNetworkSchema
541
- }),
542
- builtin: v.object({
543
- bitcoin: v.array(bitcoinNetworkSchema),
544
- stacks: v.array(stacksNetworkSchema),
545
- spark: v.array(sparkNetworkSchema),
546
- starknet: v.array(starknetNetworkSchema)
547
- }),
548
- custom: v.object({
549
- bitcoin: v.array(bitcoinNetworkSchema),
550
- stacks: v.array(stacksNetworkSchema),
551
- spark: v.array(sparkNetworkSchema),
552
- starknet: v.array(starknetNetworkSchema)
553
- })
554
- });
555
- const getNetworksRequestMessageSchema = v.object({
556
- ...rpcRequestMessageSchema.entries,
557
- ...v.object({
558
- method: v.literal(getNetworksMethodName),
559
- params: getNetworksParamsSchema,
560
- id: v.string()
561
- }).entries
562
- });
563
-
564
- //#endregion
565
- //#region src/request/types/walletMethods/getWalletType.ts
566
- const getWalletTypeMethodName = "wallet_getWalletType";
567
- const getWalletTypeParamsSchema = v.nullish(v.null());
568
- const getWalletTypeResultSchema = walletTypeSchema;
569
- const getWalletTypeRequestMessageSchema = v.object({
570
- ...rpcRequestMessageSchema.entries,
571
- ...v.object({
572
- method: v.literal(getWalletTypeMethodName),
573
- params: getWalletTypeParamsSchema,
574
- id: v.string()
575
- }).entries
576
- });
577
-
578
- //#endregion
579
- //#region src/request/types/walletMethods/openBridge.ts
580
- const openBridgeMethodName = "wallet_openBridge";
581
- const openBridgeParamsSchema = v.object({
582
- fromAsset: v.string(),
583
- toAsset: v.string()
584
- });
585
- const openBridgeResultSchema = v.nullish(v.null());
586
- const openBridgeRequestMessageSchema = v.object({
587
- ...rpcRequestMessageSchema.entries,
588
- ...v.object({
589
- method: v.literal(openBridgeMethodName),
590
- params: openBridgeParamsSchema,
591
- id: v.string()
592
- }).entries
593
- });
594
-
595
- //#endregion
596
- //#region src/request/types/walletMethods/openBuy.ts
597
- const openBuyMethodName = "wallet_openBuy";
598
- const openBuyParamsSchema = v.object({ asset: v.string() });
599
- const openBuyResultSchema = v.nullish(v.null());
600
- const openBuyRequestMessageSchema = v.object({
601
- ...rpcRequestMessageSchema.entries,
602
- ...v.object({
603
- method: v.literal(openBuyMethodName),
604
- params: openBuyParamsSchema,
605
- id: v.string()
606
- }).entries
607
- });
608
-
609
- //#endregion
610
- //#region src/request/types/walletMethods/openReceive.ts
611
- const openReceiveMethodName = "wallet_openReceive";
612
- const openReceiveParamsSchema = v.object({ address: v.string() });
613
- const openReceiveResultSchema = addressSchema;
614
- const openReceiveRequestMessageSchema = v.object({
615
- ...rpcRequestMessageSchema.entries,
616
- ...v.object({
617
- method: v.literal(openReceiveMethodName),
618
- params: openReceiveParamsSchema,
619
- id: v.string()
620
- }).entries
621
- });
622
-
623
- //#endregion
624
- //#region src/request/types/walletMethods/renouncePermissions.ts
625
- const renouncePermissionsMethodName = "wallet_renouncePermissions";
626
- const renouncePermissionsParamsSchema = v.nullish(v.null());
627
- const renouncePermissionsResultSchema = v.nullish(v.null());
628
- const renouncePermissionsRequestMessageSchema = v.object({
629
- ...rpcRequestMessageSchema.entries,
630
- ...v.object({
631
- method: v.literal(renouncePermissionsMethodName),
632
- params: renouncePermissionsParamsSchema,
633
- id: v.string()
634
- }).entries
635
- });
636
-
637
- //#endregion
638
- //#region src/request/types/walletMethods/requestPermissions.ts
639
- const requestPermissionsMethodName = "wallet_requestPermissions";
640
- const requestPermissionsParamsSchema = v.nullish(v.array(PermissionRequestParams));
641
- const requestPermissionsResultSchema = v.literal(true);
642
- const requestPermissionsRequestMessageSchema = v.object({
643
- ...rpcRequestMessageSchema.entries,
644
- ...v.object({
645
- method: v.literal(requestPermissionsMethodName),
646
- params: requestPermissionsParamsSchema,
647
- id: v.string()
648
- }).entries
649
- });
650
-
651
- //#endregion
652
- //#region src/request/types/btcMethods/getAddresses.ts
653
- const getAddressesMethodName = "getAddresses";
654
- const getAddressesParamsSchema = v.object({
655
- purposes: v.array(v.enum(AddressPurpose)),
656
- message: v.optional(v.string())
657
- });
658
- const getAddressesResultSchema = v.object({
659
- addresses: v.array(addressSchema),
660
- network: getNetworkResultSchema
661
- });
662
- const getAddressesRequestMessageSchema = v.object({
663
- ...rpcRequestMessageSchema.entries,
664
- ...v.object({
665
- method: v.literal(getAddressesMethodName),
666
- params: getAddressesParamsSchema,
667
- id: v.string()
668
- }).entries
669
- });
670
-
671
- //#endregion
672
- //#region src/request/types/btcMethods/getBalance.ts
673
- const getBalanceMethodName = "getBalance";
674
- const getBalanceParamsSchema = v.nullish(v.null());
675
- const getBalanceResultSchema = v.object({
676
- confirmed: v.string(),
677
- unconfirmed: v.string(),
678
- total: v.string()
679
- });
680
- const getBalanceRequestMessageSchema = v.object({
681
- ...rpcRequestMessageSchema.entries,
682
- ...v.object({
683
- method: v.literal(getBalanceMethodName),
684
- id: v.string()
685
- }).entries
686
- });
687
-
688
- //#endregion
689
- //#region src/request/types/btcMethods/getInfo.ts
690
- let ProviderPlatform = /* @__PURE__ */ function(ProviderPlatform$1) {
691
- ProviderPlatform$1["Web"] = "web";
692
- ProviderPlatform$1["Mobile"] = "mobile";
693
- return ProviderPlatform$1;
694
- }({});
695
- const getInfoMethodName = "getInfo";
696
- const getInfoParamsSchema = v.nullish(v.null());
697
- const getInfoResultSchema = v.object({
698
- version: v.string(),
699
- platform: v.optional(v.enum(ProviderPlatform)),
700
- methods: v.optional(v.array(v.string())),
701
- supports: v.array(v.string())
702
- });
703
- const getInfoRequestMessageSchema = v.object({
704
- ...rpcRequestMessageSchema.entries,
705
- ...v.object({
706
- method: v.literal(getInfoMethodName),
707
- params: getInfoParamsSchema,
708
- id: v.string()
709
- }).entries
710
- });
711
-
712
- //#endregion
713
- //#region src/request/types/btcMethods/sendTransfer.ts
714
- const sendTransferMethodName = "sendTransfer";
715
- const sendTransferParamsSchema = v.object({ recipients: v.array(v.object({
716
- address: v.string(),
717
- amount: v.number()
718
- })) });
719
- const sendTransferResultSchema = v.object({ txid: v.string() });
720
- const sendTransferRequestMessageSchema = v.object({
721
- ...rpcRequestMessageSchema.entries,
722
- ...v.object({
723
- method: v.literal(sendTransferMethodName),
724
- params: sendTransferParamsSchema,
725
- id: v.string()
726
- }).entries
727
- });
728
-
729
- //#endregion
730
- //#region src/request/types/btcMethods/signMessage.ts
731
- const signMessageMethodName = "signMessage";
732
- const signMessageParamsSchema = v.object({
733
- address: v.string(),
734
- message: v.string(),
735
- protocol: v.optional(v.enum(MessageSigningProtocols))
736
- });
737
- const signMessageResultSchema = v.object({
738
- signature: v.string(),
739
- messageHash: v.string(),
740
- address: v.string(),
741
- protocol: v.enum(MessageSigningProtocols)
742
- });
743
- const signMessageRequestMessageSchema = v.object({
744
- ...rpcRequestMessageSchema.entries,
745
- ...v.object({
746
- method: v.literal(signMessageMethodName),
747
- params: signMessageParamsSchema,
748
- id: v.string()
749
- }).entries
750
- });
751
-
752
- //#endregion
753
- //#region src/request/types/btcMethods/signMultipleMessages.ts
754
- const signMultipleMessagesMethodName = "signMultipleMessages";
755
- const signMultipleMessagesParamsSchema = v.array(v.object({
756
- address: v.string(),
757
- message: v.string(),
758
- protocol: v.optional(v.enum(MessageSigningProtocols))
759
- }));
760
- const signMultipleMessagesResultSchema = v.array(v.object({
761
- signature: v.string(),
762
- message: v.string(),
763
- messageHash: v.string(),
764
- address: v.string(),
765
- protocol: v.enum(MessageSigningProtocols)
766
- }));
767
- const signMultipleMessagesRequestMessageSchema = v.object({
768
- ...rpcRequestMessageSchema.entries,
769
- ...v.object({
770
- method: v.literal(signMultipleMessagesMethodName),
771
- params: signMultipleMessagesParamsSchema,
772
- id: v.string()
773
- }).entries
774
- });
775
-
776
- //#endregion
777
- //#region src/request/types/btcMethods/signPSBT.ts
778
- const signPsbtMethodName = "signPsbt";
779
- const signPsbtParamsSchema = v.object({
780
- psbt: v.string(),
781
- signInputs: v.optional(v.record(v.string(), v.array(v.number()))),
782
- broadcast: v.optional(v.boolean())
783
- });
784
- const signPsbtResultSchema = v.object({
785
- psbt: v.string(),
786
- txid: v.optional(v.string())
787
- });
788
- const signPsbtRequestMessageSchema = v.object({
789
- ...rpcRequestMessageSchema.entries,
790
- ...v.object({
791
- method: v.literal(signPsbtMethodName),
792
- params: signPsbtParamsSchema,
793
- id: v.string()
794
- }).entries
795
- });
796
-
797
- //#endregion
798
- //#region src/request/types/ordinalsMethods.ts
799
- const getInscriptionsMethodName = "ord_getInscriptions";
800
- const getInscriptionsParamsSchema = v.object({
801
- offset: v.number(),
802
- limit: v.number()
803
- });
804
- const getInscriptionsResultSchema = v.object({
805
- total: v.number(),
806
- limit: v.number(),
807
- offset: v.number(),
808
- inscriptions: v.array(v.object({
809
- inscriptionId: v.string(),
810
- inscriptionNumber: v.string(),
811
- address: v.string(),
812
- collectionName: v.optional(v.string()),
813
- postage: v.string(),
814
- contentLength: v.string(),
815
- contentType: v.string(),
816
- timestamp: v.number(),
817
- offset: v.number(),
818
- genesisTransaction: v.string(),
819
- output: v.string()
820
- }))
821
- });
822
- const getInscriptionsRequestMessageSchema = v.object({
823
- ...rpcRequestMessageSchema.entries,
824
- ...v.object({
825
- method: v.literal(getInscriptionsMethodName),
826
- params: getInscriptionsParamsSchema,
827
- id: v.string()
828
- }).entries
829
- });
830
- const sendInscriptionsMethodName = "ord_sendInscriptions";
831
- const sendInscriptionsParamsSchema = v.object({ transfers: v.array(v.object({
832
- address: v.string(),
833
- inscriptionId: v.string()
834
- })) });
835
- const sendInscriptionsResultSchema = v.object({ txid: v.string() });
836
- const sendInscriptionsRequestMessageSchema = v.object({
837
- ...rpcRequestMessageSchema.entries,
838
- ...v.object({
839
- method: v.literal(sendInscriptionsMethodName),
840
- params: sendInscriptionsParamsSchema,
841
- id: v.string()
842
- }).entries
843
- });
318
+ estimateMintCost = async (mintParams) => {
319
+ try {
320
+ return { data: (await this.client.post("/runes/mint/estimate", { ...mintParams })).data };
321
+ } catch (error) {
322
+ const err = error;
323
+ return { error: this.parseError(err) };
324
+ }
325
+ };
326
+ estimateEtchCost = async (etchParams) => {
327
+ try {
328
+ return { data: (await this.client.post("/runes/etch/estimate", { ...etchParams })).data };
329
+ } catch (error) {
330
+ const err = error;
331
+ return { error: this.parseError(err) };
332
+ }
333
+ };
334
+ createMintOrder = async (mintOrderParams) => {
335
+ try {
336
+ return { data: (await this.client.post("/runes/mint/orders", { ...mintOrderParams })).data };
337
+ } catch (error) {
338
+ const err = error;
339
+ return { error: this.parseError(err) };
340
+ }
341
+ };
342
+ createEtchOrder = async (etchOrderParams) => {
343
+ try {
344
+ return { data: (await this.client.post("/runes/etch/orders", { ...etchOrderParams })).data };
345
+ } catch (error) {
346
+ const err = error;
347
+ return { error: this.parseError(err) };
348
+ }
349
+ };
350
+ executeMint = async (orderId, fundTransactionId) => {
351
+ try {
352
+ return { data: (await this.client.post(`/runes/mint/orders/${orderId}/execute`, { fundTransactionId })).data };
353
+ } catch (error) {
354
+ const err = error;
355
+ return { error: this.parseError(err) };
356
+ }
357
+ };
358
+ executeEtch = async (orderId, fundTransactionId) => {
359
+ try {
360
+ return { data: (await this.client.post(`/runes/etch/orders/${orderId}/execute`, { fundTransactionId })).data };
361
+ } catch (error) {
362
+ const err = error;
363
+ return { error: this.parseError(err) };
364
+ }
365
+ };
366
+ getOrder = async (orderId) => {
367
+ try {
368
+ return { data: (await this.client.get(`/orders/${orderId}`)).data };
369
+ } catch (error) {
370
+ const err = error;
371
+ return { error: this.parseError(err) };
372
+ }
373
+ };
374
+ rbfOrder = async (rbfRequest) => {
375
+ const { orderId, newFeeRate } = rbfRequest;
376
+ try {
377
+ return { data: (await this.client.post(`/orders/${orderId}/rbf-estimate`, { newFeeRate })).data };
378
+ } catch (error) {
379
+ const err = error;
380
+ return { error: this.parseError(err) };
381
+ }
382
+ };
383
+ };
384
+ const clients = {};
385
+ const getRunesApiClient = (network = BitcoinNetworkType.Mainnet) => {
386
+ if (!clients[network]) clients[network] = new RunesApi(network);
387
+ return clients[network];
388
+ };
844
389
 
845
390
  //#endregion
846
- //#region src/request/types/runesMethods/etch.ts
847
- const runesEtchMethodName = "runes_etch";
848
- const etchTermsSchema = v.object({
849
- amount: v.string(),
850
- cap: v.string(),
851
- heightStart: v.optional(v.string()),
852
- heightEnd: v.optional(v.string()),
853
- offsetStart: v.optional(v.string()),
854
- offsetEnd: v.optional(v.string())
855
- });
856
- const inscriptionDetailsSchema = v.object({
857
- contentType: v.string(),
858
- contentBase64: v.string()
859
- });
860
- const runesEtchParamsSchema = v.object({
861
- runeName: v.string(),
391
+ //#region src/adapters/satsConnectAdapter.ts
392
+ var SatsConnectAdapter = class {
393
+ async mintRunes(params) {
394
+ try {
395
+ const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
396
+ if (walletInfo && walletInfo.status === "success") {
397
+ if (walletInfo.result.methods?.includes("runes_mint")) {
398
+ const response = await this.requestInternal("runes_mint", params);
399
+ if (response) {
400
+ if (response.status === "success") return response;
401
+ if (response.status === "error" && response.error.code !== RpcErrorCode.METHOD_NOT_FOUND) return response;
402
+ }
403
+ }
404
+ }
405
+ const mintRequest = {
406
+ destinationAddress: params.destinationAddress,
407
+ feeRate: params.feeRate,
408
+ refundAddress: params.refundAddress,
409
+ repeats: params.repeats,
410
+ runeName: params.runeName,
411
+ appServiceFee: params.appServiceFee,
412
+ appServiceFeeAddress: params.appServiceFeeAddress
413
+ };
414
+ const orderResponse = await new RunesApi(params.network).createMintOrder(mintRequest);
415
+ if (!orderResponse.data) return {
416
+ status: "error",
417
+ error: {
418
+ code: orderResponse.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
419
+ message: orderResponse.error.message
420
+ }
421
+ };
422
+ const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
423
+ address: orderResponse.data.fundAddress,
424
+ amount: orderResponse.data.fundAmount
425
+ }] });
426
+ if (paymentResponse.status !== "success") return paymentResponse;
427
+ await new RunesApi(params.network).executeMint(orderResponse.data.orderId, paymentResponse.result.txid);
428
+ return {
429
+ status: "success",
430
+ result: {
431
+ orderId: orderResponse.data.orderId,
432
+ fundTransactionId: paymentResponse.result.txid,
433
+ fundingAddress: orderResponse.data.fundAddress
434
+ }
435
+ };
436
+ } catch (error) {
437
+ return {
438
+ status: "error",
439
+ error: {
440
+ code: RpcErrorCode.INTERNAL_ERROR,
441
+ message: error.message
442
+ }
443
+ };
444
+ }
445
+ }
446
+ async etchRunes(params) {
447
+ const etchRequest = {
448
+ destinationAddress: params.destinationAddress,
449
+ refundAddress: params.refundAddress,
450
+ feeRate: params.feeRate,
451
+ runeName: params.runeName,
452
+ divisibility: params.divisibility,
453
+ symbol: params.symbol,
454
+ premine: params.premine,
455
+ isMintable: params.isMintable,
456
+ terms: params.terms,
457
+ inscriptionDetails: params.inscriptionDetails,
458
+ delegateInscriptionId: params.delegateInscriptionId,
459
+ appServiceFee: params.appServiceFee,
460
+ appServiceFeeAddress: params.appServiceFeeAddress
461
+ };
462
+ try {
463
+ const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
464
+ if (walletInfo && walletInfo.status === "success") {
465
+ if (walletInfo.result.methods?.includes("runes_etch")) {
466
+ const response = await this.requestInternal("runes_etch", params);
467
+ if (response) {
468
+ if (response.status === "success") return response;
469
+ if (response.status === "error" && response.error.code !== RpcErrorCode.METHOD_NOT_FOUND) return response;
470
+ }
471
+ }
472
+ }
473
+ const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
474
+ if (!orderResponse.data) return {
475
+ status: "error",
476
+ error: {
477
+ code: orderResponse.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
478
+ message: orderResponse.error.message
479
+ }
480
+ };
481
+ const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
482
+ address: orderResponse.data.fundAddress,
483
+ amount: orderResponse.data.fundAmount
484
+ }] });
485
+ if (paymentResponse.status !== "success") return paymentResponse;
486
+ await new RunesApi(params.network).executeEtch(orderResponse.data.orderId, paymentResponse.result.txid);
487
+ return {
488
+ status: "success",
489
+ result: {
490
+ orderId: orderResponse.data.orderId,
491
+ fundTransactionId: paymentResponse.result.txid,
492
+ fundingAddress: orderResponse.data.fundAddress
493
+ }
494
+ };
495
+ } catch (error) {
496
+ return {
497
+ status: "error",
498
+ error: {
499
+ code: RpcErrorCode.INTERNAL_ERROR,
500
+ message: error.message
501
+ }
502
+ };
503
+ }
504
+ }
505
+ async estimateMint(params) {
506
+ const estimateMintRequest = {
507
+ destinationAddress: params.destinationAddress,
508
+ feeRate: params.feeRate,
509
+ repeats: params.repeats,
510
+ runeName: params.runeName,
511
+ appServiceFee: params.appServiceFee,
512
+ appServiceFeeAddress: params.appServiceFeeAddress
513
+ };
514
+ const response = await getRunesApiClient(params.network).estimateMintCost(estimateMintRequest);
515
+ if (response.data) return {
516
+ status: "success",
517
+ result: response.data
518
+ };
519
+ return {
520
+ status: "error",
521
+ error: {
522
+ code: response.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
523
+ message: response.error.message
524
+ }
525
+ };
526
+ }
527
+ async estimateEtch(params) {
528
+ const estimateEtchRequest = {
529
+ destinationAddress: params.destinationAddress,
530
+ feeRate: params.feeRate,
531
+ runeName: params.runeName,
532
+ divisibility: params.divisibility,
533
+ symbol: params.symbol,
534
+ premine: params.premine,
535
+ isMintable: params.isMintable,
536
+ terms: params.terms,
537
+ inscriptionDetails: params.inscriptionDetails,
538
+ delegateInscriptionId: params.delegateInscriptionId,
539
+ appServiceFee: params.appServiceFee,
540
+ appServiceFeeAddress: params.appServiceFeeAddress
541
+ };
542
+ const response = await getRunesApiClient(params.network).estimateEtchCost(estimateEtchRequest);
543
+ if (response.data) return {
544
+ status: "success",
545
+ result: response.data
546
+ };
547
+ return {
548
+ status: "error",
549
+ error: {
550
+ code: response.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
551
+ message: response.error.message
552
+ }
553
+ };
554
+ }
555
+ async getOrder(params) {
556
+ const response = await getRunesApiClient(params.network).getOrder(params.id);
557
+ if (response.data) return {
558
+ status: "success",
559
+ result: response.data
560
+ };
561
+ return {
562
+ status: "error",
563
+ error: {
564
+ code: response.error.code === 400 || response.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
565
+ message: response.error.message
566
+ }
567
+ };
568
+ }
569
+ async estimateRbfOrder(params) {
570
+ const rbfOrderRequest = {
571
+ newFeeRate: params.newFeeRate,
572
+ orderId: params.orderId
573
+ };
574
+ const response = await getRunesApiClient(params.network).rbfOrder(rbfOrderRequest);
575
+ if (response.data) return {
576
+ status: "success",
577
+ result: {
578
+ fundingAddress: response.data.fundingAddress,
579
+ rbfCost: response.data.rbfCost
580
+ }
581
+ };
582
+ return {
583
+ status: "error",
584
+ error: {
585
+ code: response.error.code === 400 || response.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
586
+ message: response.error.message
587
+ }
588
+ };
589
+ }
590
+ async rbfOrder(params) {
591
+ try {
592
+ const rbfOrderRequest = {
593
+ newFeeRate: params.newFeeRate,
594
+ orderId: params.orderId
595
+ };
596
+ const orderResponse = await getRunesApiClient(params.network).rbfOrder(rbfOrderRequest);
597
+ if (!orderResponse.data) return {
598
+ status: "error",
599
+ error: {
600
+ code: orderResponse.error.code === 400 || orderResponse.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
601
+ message: orderResponse.error.message
602
+ }
603
+ };
604
+ const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
605
+ address: orderResponse.data.fundingAddress,
606
+ amount: orderResponse.data.rbfCost
607
+ }] });
608
+ if (paymentResponse.status !== "success") return paymentResponse;
609
+ return {
610
+ status: "success",
611
+ result: {
612
+ fundingAddress: orderResponse.data.fundingAddress,
613
+ orderId: rbfOrderRequest.orderId,
614
+ fundRBFTransactionId: paymentResponse.result.txid
615
+ }
616
+ };
617
+ } catch (error) {
618
+ return {
619
+ status: "error",
620
+ error: {
621
+ code: RpcErrorCode.INTERNAL_ERROR,
622
+ message: error.message
623
+ }
624
+ };
625
+ }
626
+ }
627
+ async request(method, params) {
628
+ switch (method) {
629
+ case "runes_mint": return this.mintRunes(params);
630
+ case "runes_etch": return this.etchRunes(params);
631
+ case "runes_estimateMint": return this.estimateMint(params);
632
+ case "runes_estimateEtch": return this.estimateEtch(params);
633
+ case "runes_getOrder": return this.getOrder(params);
634
+ case "runes_estimateRbfOrder": return this.estimateRbfOrder(params);
635
+ case "runes_rbfOrder": return this.rbfOrder(params);
636
+ default: return this.requestInternal(method, params);
637
+ }
638
+ }
639
+ };
640
+
641
+ //#endregion
642
+ //#region src/adapters/fordefi.ts
643
+ var FordefiAdapter = class extends SatsConnectAdapter {
644
+ id = DefaultAdaptersInfo.fordefi.id;
645
+ requestInternal = async (method, params) => {
646
+ const provider = getProviderById(this.id);
647
+ if (!provider) throw new Error("no wallet provider was found");
648
+ if (!method) throw new Error("A wallet method is required");
649
+ return await provider.request(method, params);
650
+ };
651
+ addListener = ({ eventName, cb }) => {
652
+ const provider = getProviderById(this.id);
653
+ if (!provider) throw new Error("no wallet provider was found");
654
+ if (!provider.addListener) {
655
+ console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
656
+ return () => {};
657
+ }
658
+ return provider.addListener(eventName, cb);
659
+ };
660
+ };
661
+
662
+ //#endregion
663
+ //#region src/request/rpc/objects/namespaces/bitcoin/shared/index.ts
664
+ let MessageSigningProtocols = /* @__PURE__ */ function(MessageSigningProtocols$1) {
665
+ MessageSigningProtocols$1["ECDSA"] = "ECDSA";
666
+ MessageSigningProtocols$1["BIP322"] = "BIP322";
667
+ return MessageSigningProtocols$1;
668
+ }({});
669
+ let ProviderPlatform = /* @__PURE__ */ function(ProviderPlatform$1) {
670
+ ProviderPlatform$1["Web"] = "web";
671
+ ProviderPlatform$1["Mobile"] = "mobile";
672
+ return ProviderPlatform$1;
673
+ }({});
674
+
675
+ //#endregion
676
+ //#region src/adapters/unisat.ts
677
+ function convertSignInputsToInputType(signInputs) {
678
+ const result = [];
679
+ if (!signInputs) return result;
680
+ for (const address in signInputs) {
681
+ const indexes = signInputs[address];
682
+ for (const index of indexes) result.push({
683
+ index,
684
+ address
685
+ });
686
+ }
687
+ return result;
688
+ }
689
+ var UnisatAdapter = class extends SatsConnectAdapter {
690
+ id = DefaultAdaptersInfo.unisat.id;
691
+ async getAccounts(params) {
692
+ const { purposes } = params;
693
+ if (purposes.includes(AddressPurpose.Stacks) || purposes.includes(AddressPurpose.Starknet) || purposes.includes(AddressPurpose.Spark)) throw new Error("Only bitcoin addresses are supported");
694
+ const accounts = await window.unisat.requestAccounts();
695
+ const publicKey = await window.unisat.getPublicKey();
696
+ const address = accounts[0];
697
+ const addressType = getAddressInfo(accounts[0]).type;
698
+ const pk = addressType === AddressType$1.p2tr ? publicKey.slice(2) : publicKey;
699
+ const paymentAddress = {
700
+ address,
701
+ publicKey: pk,
702
+ addressType,
703
+ purpose: AddressPurpose.Payment,
704
+ walletType: "software"
705
+ };
706
+ const ordinalsAddress = {
707
+ address,
708
+ publicKey: pk,
709
+ addressType,
710
+ purpose: AddressPurpose.Ordinals,
711
+ walletType: "software"
712
+ };
713
+ const response = [];
714
+ if (purposes.includes(AddressPurpose.Payment)) response.push({
715
+ ...paymentAddress,
716
+ walletType: "software"
717
+ });
718
+ if (purposes.includes(AddressPurpose.Ordinals)) response.push({
719
+ ...ordinalsAddress,
720
+ walletType: "software"
721
+ });
722
+ return response;
723
+ }
724
+ async signMessage(params) {
725
+ const { message, address } = params;
726
+ const addressType = getAddressInfo(address).type;
727
+ if ([AddressType$1.p2wpkh, AddressType$1.p2tr].includes(addressType)) return {
728
+ address,
729
+ messageHash: "",
730
+ signature: await window.unisat.signMessage(message, "bip322-simple"),
731
+ protocol: MessageSigningProtocols.BIP322
732
+ };
733
+ return {
734
+ address,
735
+ messageHash: "",
736
+ signature: await window.unisat.signMessage(message, "ecdsa"),
737
+ protocol: MessageSigningProtocols.ECDSA
738
+ };
739
+ }
740
+ async sendTransfer(params) {
741
+ const { recipients } = params;
742
+ if (recipients.length > 1) throw new Error("Only one recipient is supported by this wallet provider");
743
+ return { txid: await window.unisat.sendBitcoin(recipients[0].address, recipients[0].amount) };
744
+ }
745
+ async signPsbt(params) {
746
+ const { psbt, signInputs, broadcast } = params;
747
+ const psbtHex = Buffer.from(psbt, "base64").toString("hex");
748
+ const signedPsbt = await window.unisat.signPsbt(psbtHex, {
749
+ autoFinalized: broadcast,
750
+ toSignInputs: convertSignInputsToInputType(signInputs)
751
+ });
752
+ const signedPsbtBase64 = Buffer.from(signedPsbt, "hex").toString("base64");
753
+ let txid;
754
+ if (broadcast) txid = await window.unisat.pushPsbt(signedPsbt);
755
+ return {
756
+ psbt: signedPsbtBase64,
757
+ txid
758
+ };
759
+ }
760
+ requestInternal = async (method, params) => {
761
+ try {
762
+ switch (method) {
763
+ case "getAccounts": return {
764
+ status: "success",
765
+ result: await this.getAccounts(params)
766
+ };
767
+ case "sendTransfer": return {
768
+ status: "success",
769
+ result: await this.sendTransfer(params)
770
+ };
771
+ case "signMessage": return {
772
+ status: "success",
773
+ result: await this.signMessage(params)
774
+ };
775
+ case "signPsbt": return {
776
+ status: "success",
777
+ result: await this.signPsbt(params)
778
+ };
779
+ default: {
780
+ const error = {
781
+ code: RpcErrorCode.METHOD_NOT_SUPPORTED,
782
+ message: "Method not supported by the selected wallet"
783
+ };
784
+ console.error("Error calling the method", error);
785
+ return {
786
+ status: "error",
787
+ error
788
+ };
789
+ }
790
+ }
791
+ } catch (error) {
792
+ console.error("Error calling the method", error);
793
+ return {
794
+ status: "error",
795
+ error: {
796
+ code: error.code === 4001 ? RpcErrorCode.USER_REJECTION : RpcErrorCode.INTERNAL_ERROR,
797
+ message: error.message ? error.message : "Wallet method call error",
798
+ data: error
799
+ }
800
+ };
801
+ }
802
+ };
803
+ addListener = ({ eventName, cb }) => {
804
+ switch (eventName) {
805
+ case "accountChange": {
806
+ const handler = () => {
807
+ cb({ type: "accountChange" });
808
+ };
809
+ window.unisat.on("accountsChanged", handler);
810
+ return () => {
811
+ window.unisat.removeListener("accountsChanged", handler);
812
+ };
813
+ }
814
+ case "networkChange": {
815
+ const handler = () => {
816
+ cb({ type: "networkChange" });
817
+ };
818
+ window.unisat.on("networkChanged", handler);
819
+ return () => {
820
+ window.unisat.removeListener("networkChanged", handler);
821
+ };
822
+ }
823
+ default:
824
+ console.error("Event not supported by the selected wallet");
825
+ return () => {};
826
+ }
827
+ };
828
+ };
829
+
830
+ //#endregion
831
+ //#region src/request/rpcSpec.ts
832
+ const specIdSchema = v.union([
833
+ v.string(),
834
+ v.number(),
835
+ v.null()
836
+ ]);
837
+ const specRequestSchema = v.object({
838
+ jsonrpc: v.literal("2.0"),
839
+ method: v.string(),
840
+ params: v.optional(v.union([
841
+ v.array(v.unknown()),
842
+ v.looseObject({}),
843
+ v.null()
844
+ ])),
845
+ id: v.optional(specIdSchema)
846
+ });
847
+ const specSuccessResponseSchema = v.object({
848
+ jsonrpc: v.literal("2.0"),
849
+ result: v.unknown(),
850
+ id: specIdSchema
851
+ });
852
+ const warningSchema = v.variant("code", [v.object({
853
+ code: v.literal("DEPRECATION_NOTICE"),
854
+ message: v.string(),
855
+ sunsetDate: v.pipe(v.string(), v.isoDate())
856
+ })]);
857
+ /**
858
+ * Extends the standard JSON RPC 2.0 with an additional field as a means of
859
+ * providing clients with extra data, such as deprecation warnings, without
860
+ * altering the main payloads.
861
+ *
862
+ * A JSON-RPC response must either be a result (success) or an error (failure).
863
+ * To provide additional data, conventions must be layered atop these two types.
864
+ * Having an additional property is the least disruptive approach, and is
865
+ * acceptable when clients are known to be able to handle such a structure,
866
+ * which they can since they're all part of Sats Connect.
867
+ */
868
+ const specSuccessWithExtensionsResponseSchema = v.object({
869
+ ...specSuccessResponseSchema.entries,
870
+ extensions: v.optional(v.object({ warnings: v.array(warningSchema) }))
871
+ });
872
+ const specErrorObjectSchema = v.object({
873
+ code: v.number(),
874
+ message: v.string(),
875
+ data: v.optional(v.unknown())
876
+ });
877
+ const specErrorResponseSchema = v.object({
878
+ jsonrpc: v.literal("2.0"),
879
+ error: specErrorObjectSchema,
880
+ id: specIdSchema
881
+ });
882
+ const specResponseSchema = v.union([specSuccessWithExtensionsResponseSchema, specErrorResponseSchema]);
883
+
884
+ //#endregion
885
+ //#region src/request/sanitizeRequest.ts
886
+ const sanitizeRequest = (method, params, providerInfo) => {
887
+ try {
888
+ const [major, minor] = providerInfo.version.split(".").map((part) => parseInt(part, 10));
889
+ const platform = providerInfo.platform;
890
+ if (!platform || platform === ProviderPlatform.Web && major <= 1 && minor <= 4 || platform === ProviderPlatform.Mobile && major <= 1 && minor <= 54) {
891
+ const v1Sanitized = sanitizeAddressPurposeRequest(method, params);
892
+ method = v1Sanitized.method;
893
+ params = v1Sanitized.params;
894
+ }
895
+ } catch {}
896
+ return {
897
+ method,
898
+ params
899
+ };
900
+ };
901
+ const sanitizeAddressPurposeRequest = (method, params) => {
902
+ const filterPurposes = (purposes) => purposes?.filter((purpose) => purpose !== AddressPurpose.Spark && purpose !== AddressPurpose.Starknet);
903
+ if (method === "wallet_connect") {
904
+ const typedParams = params;
905
+ if (!typedParams) return {
906
+ method,
907
+ params
908
+ };
909
+ const { addresses, ...rest } = typedParams;
910
+ return {
911
+ method,
912
+ params: {
913
+ ...rest,
914
+ addresses: filterPurposes(addresses)
915
+ }
916
+ };
917
+ }
918
+ if (method === "getAccounts") {
919
+ const { purposes, ...rest } = params;
920
+ return {
921
+ method,
922
+ params: {
923
+ ...rest,
924
+ purposes: filterPurposes(purposes)
925
+ }
926
+ };
927
+ }
928
+ if (method === "getAddresses") {
929
+ const { purposes, ...rest } = params;
930
+ return {
931
+ method,
932
+ params: {
933
+ ...rest,
934
+ purposes: filterPurposes(purposes)
935
+ }
936
+ };
937
+ }
938
+ return {
939
+ method,
940
+ params
941
+ };
942
+ };
943
+
944
+ //#endregion
945
+ //#region src/request/methods.ts
946
+ const bitcoinMethods = {
947
+ getAccounts: "getAccounts",
948
+ bitcoin_getAccountsV2: "bitcoin_getAccountsV2",
949
+ getAddresses: "getAddresses",
950
+ bitcoin_getAddressesV2: "bitcoin_getAddressesV2",
951
+ getBalance: "getBalance",
952
+ bitcoin_getBalanceV2: "bitcoin_getBalanceV2",
953
+ getInfo: "getInfo",
954
+ bitcoin_getInfoV2: "bitcoin_getInfoV2",
955
+ sendTransfer: "sendTransfer",
956
+ bitcoin_sendTransferV2: "bitcoin_sendTransferV2",
957
+ signMessage: "signMessage",
958
+ bitcoin_signMessageV2: "bitcoin_signMessageV2",
959
+ signMultipleMessages: "signMultipleMessages",
960
+ bitcoin_signMultipleMessagesV2: "bitcoin_signMultipleMessagesV2",
961
+ signPsbt: "signPsbt",
962
+ bitcoin_signPsbtV2: "bitcoin_signPsbtV2"
963
+ };
964
+ const stacksMethods = {
965
+ stx_callContract: "stx_callContract",
966
+ stx_deployContract: "stx_deployContract",
967
+ stx_getAccounts: "stx_getAccounts",
968
+ stx_getAddresses: "stx_getAddresses",
969
+ stacks_getAddressesV2: "stacks_getAddressesV2",
970
+ stx_signMessage: "stx_signMessage",
971
+ stx_signStructuredMessage: "stx_signStructuredMessage",
972
+ stx_signTransaction: "stx_signTransaction",
973
+ stx_signTransactions: "stx_signTransactions",
974
+ stx_transferStx: "stx_transferStx"
975
+ };
976
+ const sparkMethods = {
977
+ spark_getAddresses: "spark_getAddresses",
978
+ spark_getAddressesV2: "spark_getAddressesV2",
979
+ spark_getBalance: "spark_getBalance",
980
+ spark_transfer: "spark_transfer",
981
+ spark_transferToken: "spark_transferToken",
982
+ spark_signMessage: "spark_signMessage",
983
+ spark_flashnet_getJwt: "spark_flashnet_getJwt",
984
+ spark_flashnet_signIntent: "spark_flashnet_signIntent",
985
+ spark_flashnet_signStructuredMessage: "spark_flashnet_signStructuredMessage",
986
+ spark_flashnet_executeSwap: "spark_flashnet_executeSwap",
987
+ spark_flashnet_executeRouteSwap: "spark_flashnet_executeRouteSwap",
988
+ spark_flashnet_clawbackFunds: "spark_flashnet_clawbackFunds",
989
+ spark_flashnet_getClawbackEligibleTransfers: "spark_flashnet_getClawbackEligibleTransfers"
990
+ };
991
+ const runesMethods = {
992
+ runes_estimateEtch: "runes_estimateEtch",
993
+ runes_estimateMint: "runes_estimateMint",
994
+ runes_estimateRbfOrder: "runes_estimateRbfOrder",
995
+ runes_etch: "runes_etch",
996
+ runes_getBalance: "runes_getBalance",
997
+ runes_getOrder: "runes_getOrder",
998
+ runes_mint: "runes_mint",
999
+ runes_rbfOrder: "runes_rbfOrder",
1000
+ runes_transfer: "runes_transfer"
1001
+ };
1002
+ const ordinalsMethods = {
1003
+ ord_getInscriptions: "ord_getInscriptions",
1004
+ ord_sendInscriptions: "ord_sendInscriptions"
1005
+ };
1006
+ const walletMethods = {
1007
+ wallet_addNetwork: "wallet_addNetwork",
1008
+ wallet_addNetworkV2: "wallet_addNetworkV2",
1009
+ wallet_changeNetworkById: "wallet_changeNetworkById",
1010
+ wallet_changeNetwork: "wallet_changeNetwork",
1011
+ wallet_connect: "wallet_connect",
1012
+ wallet_connectV2: "wallet_connectV2",
1013
+ wallet_disconnect: "wallet_disconnect",
1014
+ wallet_getAccount: "wallet_getAccount",
1015
+ wallet_getAccountV2: "wallet_getAccountV2",
1016
+ wallet_getCurrentPermissions: "wallet_getCurrentPermissions",
1017
+ wallet_getNetwork: "wallet_getNetwork",
1018
+ wallet_getNetworks: "wallet_getNetworks",
1019
+ wallet_getWalletType: "wallet_getWalletType",
1020
+ wallet_openBridge: "wallet_openBridge",
1021
+ wallet_openBuy: "wallet_openBuy",
1022
+ wallet_openReceive: "wallet_openReceive",
1023
+ wallet_renouncePermissions: "wallet_renouncePermissions",
1024
+ wallet_requestPermissions: "wallet_requestPermissions"
1025
+ };
1026
+
1027
+ //#endregion
1028
+ //#region src/request/rpc/compat.ts
1029
+ function bitcoinModeToLegacyBitcoinNetworkType(mode) {
1030
+ return match(mode).with("mainnet", () => BitcoinNetworkType.Mainnet).with("testnet", () => BitcoinNetworkType.Testnet).with("regtest", () => BitcoinNetworkType.Regtest).with("signet", () => BitcoinNetworkType.Signet).with("testnet4", () => BitcoinNetworkType.Testnet4).exhaustive();
1031
+ }
1032
+ function stacksModeToLegacyStacksNetworkType(mode) {
1033
+ return match(mode).with("mainnet", () => StacksNetworkType.Mainnet).with("testnet", () => StacksNetworkType.Testnet).otherwise(() => StacksNetworkType.Testnet);
1034
+ }
1035
+ function sparkModeToLegacySparkNetworkType(mode) {
1036
+ return match(mode).with("mainnet", () => SparkNetworkType.Mainnet).with("regtest", () => SparkNetworkType.Regtest).exhaustive();
1037
+ }
1038
+
1039
+ //#endregion
1040
+ //#region src/request/rpc/methodSupport.ts
1041
+ const { active } = {
1042
+ active: "active",
1043
+ deprecated: "deprecated",
1044
+ removed: "removed"
1045
+ };
1046
+ const methodSupport = {
1047
+ [bitcoinMethods.getAccounts]: active,
1048
+ [bitcoinMethods.bitcoin_getAccountsV2]: active,
1049
+ [bitcoinMethods.getAddresses]: active,
1050
+ [bitcoinMethods.bitcoin_getAddressesV2]: active,
1051
+ [bitcoinMethods.getBalance]: active,
1052
+ [bitcoinMethods.bitcoin_getBalanceV2]: active,
1053
+ [bitcoinMethods.getInfo]: active,
1054
+ [bitcoinMethods.bitcoin_getInfoV2]: active,
1055
+ [bitcoinMethods.sendTransfer]: active,
1056
+ [bitcoinMethods.bitcoin_sendTransferV2]: active,
1057
+ [bitcoinMethods.signMessage]: active,
1058
+ [bitcoinMethods.bitcoin_signMessageV2]: active,
1059
+ [bitcoinMethods.signMultipleMessages]: active,
1060
+ [bitcoinMethods.bitcoin_signMultipleMessagesV2]: active,
1061
+ [bitcoinMethods.signPsbt]: active,
1062
+ [bitcoinMethods.bitcoin_signPsbtV2]: active,
1063
+ [stacksMethods.stx_callContract]: active,
1064
+ [stacksMethods.stx_deployContract]: active,
1065
+ [stacksMethods.stx_getAccounts]: active,
1066
+ [stacksMethods.stx_getAddresses]: active,
1067
+ [stacksMethods.stacks_getAddressesV2]: active,
1068
+ [stacksMethods.stx_signMessage]: active,
1069
+ [stacksMethods.stx_signStructuredMessage]: active,
1070
+ [stacksMethods.stx_signTransaction]: active,
1071
+ [stacksMethods.stx_signTransactions]: active,
1072
+ [stacksMethods.stx_transferStx]: active,
1073
+ [sparkMethods.spark_getAddresses]: active,
1074
+ [sparkMethods.spark_getAddressesV2]: active,
1075
+ [sparkMethods.spark_getBalance]: active,
1076
+ [sparkMethods.spark_transfer]: active,
1077
+ [sparkMethods.spark_transferToken]: active,
1078
+ [sparkMethods.spark_signMessage]: active,
1079
+ [sparkMethods.spark_flashnet_getJwt]: active,
1080
+ [sparkMethods.spark_flashnet_signIntent]: active,
1081
+ [sparkMethods.spark_flashnet_signStructuredMessage]: active,
1082
+ [sparkMethods.spark_flashnet_executeSwap]: active,
1083
+ [sparkMethods.spark_flashnet_executeRouteSwap]: active,
1084
+ [sparkMethods.spark_flashnet_clawbackFunds]: active,
1085
+ [sparkMethods.spark_flashnet_getClawbackEligibleTransfers]: active,
1086
+ [runesMethods.runes_estimateEtch]: active,
1087
+ [runesMethods.runes_estimateMint]: active,
1088
+ [runesMethods.runes_estimateRbfOrder]: active,
1089
+ [runesMethods.runes_etch]: active,
1090
+ [runesMethods.runes_getBalance]: active,
1091
+ [runesMethods.runes_getOrder]: active,
1092
+ [runesMethods.runes_mint]: active,
1093
+ [runesMethods.runes_rbfOrder]: active,
1094
+ [runesMethods.runes_transfer]: active,
1095
+ [ordinalsMethods.ord_getInscriptions]: active,
1096
+ [ordinalsMethods.ord_sendInscriptions]: active,
1097
+ [walletMethods.wallet_addNetwork]: active,
1098
+ [walletMethods.wallet_addNetworkV2]: active,
1099
+ [walletMethods.wallet_changeNetworkById]: active,
1100
+ [walletMethods.wallet_changeNetwork]: active,
1101
+ [walletMethods.wallet_connect]: active,
1102
+ [walletMethods.wallet_connectV2]: active,
1103
+ [walletMethods.wallet_disconnect]: active,
1104
+ [walletMethods.wallet_getAccount]: active,
1105
+ [walletMethods.wallet_getAccountV2]: active,
1106
+ [walletMethods.wallet_getCurrentPermissions]: active,
1107
+ [walletMethods.wallet_getNetwork]: active,
1108
+ [walletMethods.wallet_getNetworks]: active,
1109
+ [walletMethods.wallet_getWalletType]: active,
1110
+ [walletMethods.wallet_openBridge]: active,
1111
+ [walletMethods.wallet_openBuy]: active,
1112
+ [walletMethods.wallet_openReceive]: active,
1113
+ [walletMethods.wallet_renouncePermissions]: active,
1114
+ [walletMethods.wallet_requestPermissions]: active
1115
+ };
1116
+
1117
+ //#endregion
1118
+ //#region src/request/shared.ts
1119
+ const rpcIdSchema = v.string();
1120
+
1121
+ //#endregion
1122
+ //#region src/request/createRequestSchema.ts
1123
+ function createRequestSchema({ paramsSchema, method }) {
1124
+ return v.object({
1125
+ ...specRequestSchema.entries,
1126
+ id: rpcIdSchema,
1127
+ method: v.literal(method),
1128
+ params: paramsSchema
1129
+ });
1130
+ }
1131
+
1132
+ //#endregion
1133
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAccounts/request.ts
1134
+ const bitcoinGetAccountsParamsSchema = v.object({
1135
+ purposes: v.array(v.enum(AddressPurpose)),
1136
+ message: v.optional(v.string())
1137
+ });
1138
+ const bitcoinGetAccountsRequestSchema = createRequestSchema({
1139
+ paramsSchema: bitcoinGetAccountsParamsSchema,
1140
+ method: bitcoinMethods.getAccounts
1141
+ });
1142
+
1143
+ //#endregion
1144
+ //#region src/request/createSuccessResponseSchema.ts
1145
+ function createSuccessResponseSchema({ method, resultSchema }) {
1146
+ return v.object({
1147
+ ...specSuccessWithExtensionsResponseSchema.entries,
1148
+ id: rpcIdSchema,
1149
+ result: resultSchema,
1150
+ "~sats-connect-method": v.literal(method)
1151
+ });
1152
+ }
1153
+
1154
+ //#endregion
1155
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAccounts/response.ts
1156
+ const bitcoinGetAccountsResultSchema = v.array(v.object({
1157
+ ...addressSchema.entries,
1158
+ ...v.object({ walletType: walletTypeSchema }).entries
1159
+ }));
1160
+ const bitcoinGetAccountsSuccessResponseSchema = createSuccessResponseSchema({
1161
+ resultSchema: bitcoinGetAccountsResultSchema,
1162
+ method: bitcoinMethods.getAccounts
1163
+ });
1164
+
1165
+ //#endregion
1166
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAccountsV2/request.ts
1167
+ const bitcoinGetAccountsV2ParamsSchema = v.object({
1168
+ purposes: v.array(v.enum(AddressPurpose)),
1169
+ message: v.optional(v.string())
1170
+ });
1171
+ const bitcoinGetAccountsV2RequestSchema = createRequestSchema({
1172
+ paramsSchema: bitcoinGetAccountsV2ParamsSchema,
1173
+ method: bitcoinMethods.bitcoin_getAccountsV2
1174
+ });
1175
+
1176
+ //#endregion
1177
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAccountsV2/response.ts
1178
+ const bitcoinGetAccountsV2ResultSchema = v.array(v.object({
1179
+ ...addressSchema.entries,
1180
+ ...v.object({ walletType: walletTypeSchema }).entries
1181
+ }));
1182
+ const bitcoinGetAccountsV2SuccessResponseSchema = createSuccessResponseSchema({
1183
+ resultSchema: bitcoinGetAccountsV2ResultSchema,
1184
+ method: bitcoinMethods.bitcoin_getAccountsV2
1185
+ });
1186
+
1187
+ //#endregion
1188
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddresses/request.ts
1189
+ const bitcoinGetAddressesParamsSchema = v.object({
1190
+ purposes: v.array(v.enum(AddressPurpose)),
1191
+ message: v.optional(v.string())
1192
+ });
1193
+ const bitcoinGetAddressesRequestSchema = createRequestSchema({
1194
+ paramsSchema: bitcoinGetAddressesParamsSchema,
1195
+ method: bitcoinMethods.getAddresses
1196
+ });
1197
+
1198
+ //#endregion
1199
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddresses/response.ts
1200
+ const getNetworkResultSchema = v.object({
1201
+ bitcoin: v.object({ name: v.string() }),
1202
+ stacks: v.object({ name: v.string() }),
1203
+ spark: v.object({ name: v.string() })
1204
+ });
1205
+ const bitcoinGetAddressesResultSchema = v.object({
1206
+ addresses: v.array(addressSchema),
1207
+ network: getNetworkResultSchema
1208
+ });
1209
+ const bitcoinGetAddressesSuccessResponseSchema = createSuccessResponseSchema({
1210
+ resultSchema: bitcoinGetAddressesResultSchema,
1211
+ method: bitcoinMethods.getAddresses
1212
+ });
1213
+
1214
+ //#endregion
1215
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddressesV2/request.ts
1216
+ const bitcoinGetAddressesV2ParamsSchema = v.object({
1217
+ purposes: v.array(v.enum(AddressPurpose)),
1218
+ message: v.optional(v.string())
1219
+ });
1220
+ const bitcoinGetAddressesV2RequestSchema = createRequestSchema({
1221
+ paramsSchema: bitcoinGetAddressesV2ParamsSchema,
1222
+ method: bitcoinMethods.bitcoin_getAddressesV2
1223
+ });
1224
+
1225
+ //#endregion
1226
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddressesV2/response.ts
1227
+ const getNetworksResultSchema = v.object({
1228
+ active: v.object({
1229
+ bitcoin: v.object({
1230
+ id: v.string(),
1231
+ type: v.string(),
1232
+ name: v.string()
1233
+ }),
1234
+ stacks: v.object({
1235
+ id: v.string(),
1236
+ type: v.string(),
1237
+ name: v.string()
1238
+ }),
1239
+ spark: v.object({
1240
+ id: v.string(),
1241
+ type: v.string(),
1242
+ name: v.string()
1243
+ }),
1244
+ starknet: v.object({
1245
+ id: v.string(),
1246
+ type: v.string(),
1247
+ name: v.string()
1248
+ })
1249
+ }),
1250
+ builtin: v.object({
1251
+ bitcoin: v.array(v.any()),
1252
+ stacks: v.array(v.any()),
1253
+ spark: v.array(v.any()),
1254
+ starknet: v.array(v.any())
1255
+ }),
1256
+ custom: v.object({
1257
+ bitcoin: v.array(v.any()),
1258
+ stacks: v.array(v.any()),
1259
+ spark: v.array(v.any()),
1260
+ starknet: v.array(v.any())
1261
+ })
1262
+ });
1263
+ const bitcoinGetAddressesV2ResultSchema = v.object({
1264
+ addresses: v.array(addressSchema),
1265
+ networks: getNetworksResultSchema
1266
+ });
1267
+ const bitcoinGetAddressesV2SuccessResponseSchema = createSuccessResponseSchema({
1268
+ resultSchema: bitcoinGetAddressesV2ResultSchema,
1269
+ method: bitcoinMethods.bitcoin_getAddressesV2
1270
+ });
1271
+
1272
+ //#endregion
1273
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalance/request.ts
1274
+ const bitcoinGetBalanceParamsSchema = v.nullish(v.null());
1275
+ const bitcoinGetBalanceRequestSchema = createRequestSchema({
1276
+ paramsSchema: bitcoinGetBalanceParamsSchema,
1277
+ method: bitcoinMethods.getBalance
1278
+ });
1279
+
1280
+ //#endregion
1281
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalance/response.ts
1282
+ const bitcoinGetBalanceResultSchema = v.object({
1283
+ confirmed: v.string(),
1284
+ unconfirmed: v.string(),
1285
+ total: v.string()
1286
+ });
1287
+ const bitcoinGetBalanceSuccessResponseSchema = createSuccessResponseSchema({
1288
+ resultSchema: bitcoinGetBalanceResultSchema,
1289
+ method: bitcoinMethods.getBalance
1290
+ });
1291
+
1292
+ //#endregion
1293
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalanceV2/request.ts
1294
+ const bitcoinGetBalanceV2ParamsSchema = v.nullish(v.null());
1295
+ const bitcoinGetBalanceV2RequestSchema = createRequestSchema({
1296
+ paramsSchema: bitcoinGetBalanceV2ParamsSchema,
1297
+ method: bitcoinMethods.bitcoin_getBalanceV2
1298
+ });
1299
+
1300
+ //#endregion
1301
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalanceV2/response.ts
1302
+ const bitcoinGetBalanceV2ResultSchema = v.object({
1303
+ confirmed: v.string(),
1304
+ unconfirmed: v.string(),
1305
+ total: v.string()
1306
+ });
1307
+ const bitcoinGetBalanceV2SuccessResponseSchema = createSuccessResponseSchema({
1308
+ resultSchema: bitcoinGetBalanceV2ResultSchema,
1309
+ method: bitcoinMethods.bitcoin_getBalanceV2
1310
+ });
1311
+
1312
+ //#endregion
1313
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getInfo/request.ts
1314
+ const bitcoinGetInfoParamsSchema = v.nullish(v.null());
1315
+ const bitcoinGetInfoRequestSchema = createRequestSchema({
1316
+ paramsSchema: bitcoinGetInfoParamsSchema,
1317
+ method: bitcoinMethods.getInfo
1318
+ });
1319
+
1320
+ //#endregion
1321
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getInfo/response.ts
1322
+ const bitcoinGetInfoResultSchema = v.object({
1323
+ version: v.string(),
1324
+ platform: v.optional(v.enum(ProviderPlatform)),
1325
+ methods: v.optional(v.array(v.string())),
1326
+ supports: v.array(v.string())
1327
+ });
1328
+ const bitcoinGetInfoSuccessResponseSchema = createSuccessResponseSchema({
1329
+ resultSchema: bitcoinGetInfoResultSchema,
1330
+ method: bitcoinMethods.getInfo
1331
+ });
1332
+
1333
+ //#endregion
1334
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getInfoV2/request.ts
1335
+ const bitcoinGetInfoV2ParamsSchema = v.nullish(v.null());
1336
+ const bitcoinGetInfoV2RequestSchema = createRequestSchema({
1337
+ paramsSchema: bitcoinGetInfoV2ParamsSchema,
1338
+ method: bitcoinMethods.bitcoin_getInfoV2
1339
+ });
1340
+
1341
+ //#endregion
1342
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getInfoV2/response.ts
1343
+ const bitcoinGetInfoV2ResultSchema = v.object({
1344
+ version: v.string(),
1345
+ platform: v.optional(v.enum(ProviderPlatform)),
1346
+ methods: v.optional(v.array(v.string())),
1347
+ supports: v.array(v.string())
1348
+ });
1349
+ const bitcoinGetInfoV2SuccessResponseSchema = createSuccessResponseSchema({
1350
+ resultSchema: bitcoinGetInfoV2ResultSchema,
1351
+ method: bitcoinMethods.bitcoin_getInfoV2
1352
+ });
1353
+
1354
+ //#endregion
1355
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransfer/request.ts
1356
+ const bitcoinSendTransferParamsSchema = v.object({ recipients: v.array(v.object({
1357
+ address: v.string(),
1358
+ amount: v.number()
1359
+ })) });
1360
+ const bitcoinSendTransferRequestSchema = createRequestSchema({
1361
+ paramsSchema: bitcoinSendTransferParamsSchema,
1362
+ method: bitcoinMethods.sendTransfer
1363
+ });
1364
+
1365
+ //#endregion
1366
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransfer/response.ts
1367
+ const bitcoinSendTransferResultSchema = v.object({ txid: v.string() });
1368
+ const bitcoinSendTransferSuccessResponseSchema = createSuccessResponseSchema({
1369
+ resultSchema: bitcoinSendTransferResultSchema,
1370
+ method: bitcoinMethods.sendTransfer
1371
+ });
1372
+
1373
+ //#endregion
1374
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransferV2/request.ts
1375
+ const bitcoinSendTransferV2ParamsSchema = v.object({ recipients: v.array(v.object({
1376
+ address: v.string(),
1377
+ amount: v.number()
1378
+ })) });
1379
+ const bitcoinSendTransferV2RequestSchema = createRequestSchema({
1380
+ paramsSchema: bitcoinSendTransferV2ParamsSchema,
1381
+ method: bitcoinMethods.bitcoin_sendTransferV2
1382
+ });
1383
+
1384
+ //#endregion
1385
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransferV2/response.ts
1386
+ const bitcoinSendTransferV2ResultSchema = v.object({ txid: v.string() });
1387
+ const bitcoinSendTransferV2SuccessResponseSchema = createSuccessResponseSchema({
1388
+ resultSchema: bitcoinSendTransferV2ResultSchema,
1389
+ method: bitcoinMethods.bitcoin_sendTransferV2
1390
+ });
1391
+
1392
+ //#endregion
1393
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessage/request.ts
1394
+ const bitcoinSignMessageParamsSchema = v.object({
1395
+ address: v.string(),
1396
+ message: v.string(),
1397
+ protocol: v.optional(v.enum(MessageSigningProtocols))
1398
+ });
1399
+ const bitcoinSignMessageRequestSchema = createRequestSchema({
1400
+ paramsSchema: bitcoinSignMessageParamsSchema,
1401
+ method: bitcoinMethods.signMessage
1402
+ });
1403
+
1404
+ //#endregion
1405
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessage/response.ts
1406
+ const bitcoinSignMessageResultSchema = v.object({
1407
+ signature: v.string(),
1408
+ messageHash: v.string(),
1409
+ address: v.string(),
1410
+ protocol: v.enum(MessageSigningProtocols)
1411
+ });
1412
+ const bitcoinSignMessageSuccessResponseSchema = createSuccessResponseSchema({
1413
+ resultSchema: bitcoinSignMessageResultSchema,
1414
+ method: bitcoinMethods.signMessage
1415
+ });
1416
+
1417
+ //#endregion
1418
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessageV2/request.ts
1419
+ const bitcoinSignMessageV2ParamsSchema = v.object({
1420
+ address: v.string(),
1421
+ message: v.string(),
1422
+ protocol: v.optional(v.enum(MessageSigningProtocols))
1423
+ });
1424
+ const bitcoinSignMessageV2RequestSchema = createRequestSchema({
1425
+ paramsSchema: bitcoinSignMessageV2ParamsSchema,
1426
+ method: bitcoinMethods.bitcoin_signMessageV2
1427
+ });
1428
+
1429
+ //#endregion
1430
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessageV2/response.ts
1431
+ const bitcoinSignMessageV2ResultSchema = v.object({
1432
+ signature: v.string(),
1433
+ messageHash: v.string(),
1434
+ address: v.string(),
1435
+ protocol: v.enum(MessageSigningProtocols)
1436
+ });
1437
+ const bitcoinSignMessageV2SuccessResponseSchema = createSuccessResponseSchema({
1438
+ resultSchema: bitcoinSignMessageV2ResultSchema,
1439
+ method: bitcoinMethods.bitcoin_signMessageV2
1440
+ });
1441
+
1442
+ //#endregion
1443
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessages/request.ts
1444
+ const bitcoinSignMultipleMessagesParamsSchema = v.array(v.object({
1445
+ address: v.string(),
1446
+ message: v.string(),
1447
+ protocol: v.optional(v.enum(MessageSigningProtocols))
1448
+ }));
1449
+ const bitcoinSignMultipleMessagesRequestSchema = createRequestSchema({
1450
+ paramsSchema: bitcoinSignMultipleMessagesParamsSchema,
1451
+ method: bitcoinMethods.signMultipleMessages
1452
+ });
1453
+
1454
+ //#endregion
1455
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessages/response.ts
1456
+ const bitcoinSignMultipleMessagesResultSchema = v.array(v.object({
1457
+ signature: v.string(),
1458
+ message: v.string(),
1459
+ messageHash: v.string(),
1460
+ address: v.string(),
1461
+ protocol: v.enum(MessageSigningProtocols)
1462
+ }));
1463
+ const bitcoinSignMultipleMessagesSuccessResponseSchema = createSuccessResponseSchema({
1464
+ resultSchema: bitcoinSignMultipleMessagesResultSchema,
1465
+ method: bitcoinMethods.signMultipleMessages
1466
+ });
1467
+
1468
+ //#endregion
1469
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessagesV2/request.ts
1470
+ const bitcoinSignMultipleMessagesV2ParamsSchema = v.array(v.object({
1471
+ address: v.string(),
1472
+ message: v.string(),
1473
+ protocol: v.optional(v.enum(MessageSigningProtocols))
1474
+ }));
1475
+ const bitcoinSignMultipleMessagesV2RequestSchema = createRequestSchema({
1476
+ paramsSchema: bitcoinSignMultipleMessagesV2ParamsSchema,
1477
+ method: bitcoinMethods.bitcoin_signMultipleMessagesV2
1478
+ });
1479
+
1480
+ //#endregion
1481
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessagesV2/response.ts
1482
+ const bitcoinSignMultipleMessagesV2ResultSchema = v.array(v.object({
1483
+ signature: v.string(),
1484
+ message: v.string(),
1485
+ messageHash: v.string(),
1486
+ address: v.string(),
1487
+ protocol: v.enum(MessageSigningProtocols)
1488
+ }));
1489
+ const bitcoinSignMultipleMessagesV2SuccessResponseSchema = createSuccessResponseSchema({
1490
+ resultSchema: bitcoinSignMultipleMessagesV2ResultSchema,
1491
+ method: bitcoinMethods.bitcoin_signMultipleMessagesV2
1492
+ });
1493
+
1494
+ //#endregion
1495
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbt/request.ts
1496
+ const bitcoinSignPsbtParamsSchema = v.object({
1497
+ psbt: v.string(),
1498
+ signInputs: v.optional(v.record(v.string(), v.array(v.number()))),
1499
+ broadcast: v.optional(v.boolean())
1500
+ });
1501
+ const bitcoinSignPsbtRequestSchema = createRequestSchema({
1502
+ paramsSchema: bitcoinSignPsbtParamsSchema,
1503
+ method: bitcoinMethods.signPsbt
1504
+ });
1505
+
1506
+ //#endregion
1507
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbt/response.ts
1508
+ const bitcoinSignPsbtResultSchema = v.object({
1509
+ psbt: v.string(),
1510
+ txid: v.optional(v.string())
1511
+ });
1512
+ const bitcoinSignPsbtSuccessResponseSchema = createSuccessResponseSchema({
1513
+ resultSchema: bitcoinSignPsbtResultSchema,
1514
+ method: bitcoinMethods.signPsbt
1515
+ });
1516
+
1517
+ //#endregion
1518
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbtV2/request.ts
1519
+ const bitcoinSignPsbtV2ParamsSchema = v.object({
1520
+ psbt: v.string(),
1521
+ signInputs: v.optional(v.record(v.string(), v.array(v.number()))),
1522
+ broadcast: v.optional(v.boolean())
1523
+ });
1524
+ const bitcoinSignPsbtV2RequestSchema = createRequestSchema({
1525
+ paramsSchema: bitcoinSignPsbtV2ParamsSchema,
1526
+ method: bitcoinMethods.bitcoin_signPsbtV2
1527
+ });
1528
+
1529
+ //#endregion
1530
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbtV2/response.ts
1531
+ const bitcoinSignPsbtV2ResultSchema = v.object({
1532
+ psbt: v.string(),
1533
+ txid: v.optional(v.string())
1534
+ });
1535
+ const bitcoinSignPsbtV2SuccessResponseSchema = createSuccessResponseSchema({
1536
+ resultSchema: bitcoinSignPsbtV2ResultSchema,
1537
+ method: bitcoinMethods.bitcoin_signPsbtV2
1538
+ });
1539
+
1540
+ //#endregion
1541
+ //#region src/request/rpc/objects/namespaces/bitcoin/index.ts
1542
+ const bitcoinRequestSchema = v.variant("method", [
1543
+ bitcoinGetAccountsRequestSchema,
1544
+ bitcoinGetAccountsV2RequestSchema,
1545
+ bitcoinGetAddressesRequestSchema,
1546
+ bitcoinGetAddressesV2RequestSchema,
1547
+ bitcoinGetBalanceRequestSchema,
1548
+ bitcoinGetBalanceV2RequestSchema,
1549
+ bitcoinGetInfoRequestSchema,
1550
+ bitcoinGetInfoV2RequestSchema,
1551
+ bitcoinSendTransferRequestSchema,
1552
+ bitcoinSendTransferV2RequestSchema,
1553
+ bitcoinSignMessageRequestSchema,
1554
+ bitcoinSignMessageV2RequestSchema,
1555
+ bitcoinSignMultipleMessagesRequestSchema,
1556
+ bitcoinSignMultipleMessagesV2RequestSchema,
1557
+ bitcoinSignPsbtRequestSchema,
1558
+ bitcoinSignPsbtV2RequestSchema
1559
+ ]);
1560
+ const bitcoinSuccessResponseSchema = v.variant("~sats-connect-method", [
1561
+ bitcoinGetAccountsSuccessResponseSchema,
1562
+ bitcoinGetAccountsV2SuccessResponseSchema,
1563
+ bitcoinGetAddressesSuccessResponseSchema,
1564
+ bitcoinGetAddressesV2SuccessResponseSchema,
1565
+ bitcoinGetBalanceSuccessResponseSchema,
1566
+ bitcoinGetBalanceV2SuccessResponseSchema,
1567
+ bitcoinGetInfoSuccessResponseSchema,
1568
+ bitcoinGetInfoV2SuccessResponseSchema,
1569
+ bitcoinSendTransferSuccessResponseSchema,
1570
+ bitcoinSendTransferV2SuccessResponseSchema,
1571
+ bitcoinSignMessageSuccessResponseSchema,
1572
+ bitcoinSignMessageV2SuccessResponseSchema,
1573
+ bitcoinSignMultipleMessagesSuccessResponseSchema,
1574
+ bitcoinSignMultipleMessagesV2SuccessResponseSchema,
1575
+ bitcoinSignPsbtSuccessResponseSchema,
1576
+ bitcoinSignPsbtV2SuccessResponseSchema
1577
+ ]);
1578
+
1579
+ //#endregion
1580
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/getInscriptions/request.ts
1581
+ const ordinalsGetInscriptionsParamsSchema = v.object({
1582
+ offset: v.number(),
1583
+ limit: v.number()
1584
+ });
1585
+ const ordinalsGetInscriptionsRequestSchema = createRequestSchema({
1586
+ paramsSchema: ordinalsGetInscriptionsParamsSchema,
1587
+ method: ordinalsMethods.ord_getInscriptions
1588
+ });
1589
+
1590
+ //#endregion
1591
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/getInscriptions/response.ts
1592
+ const ordinalsGetInscriptionsResultSchema = v.object({
1593
+ total: v.number(),
1594
+ limit: v.number(),
1595
+ offset: v.number(),
1596
+ inscriptions: v.array(v.object({
1597
+ inscriptionId: v.string(),
1598
+ inscriptionNumber: v.string(),
1599
+ address: v.string(),
1600
+ collectionName: v.optional(v.string()),
1601
+ postage: v.string(),
1602
+ contentLength: v.string(),
1603
+ contentType: v.string(),
1604
+ timestamp: v.number(),
1605
+ offset: v.number(),
1606
+ genesisTransaction: v.string(),
1607
+ output: v.string()
1608
+ }))
1609
+ });
1610
+ const ordinalsGetInscriptionsSuccessResponseSchema = createSuccessResponseSchema({
1611
+ resultSchema: ordinalsGetInscriptionsResultSchema,
1612
+ method: ordinalsMethods.ord_getInscriptions
1613
+ });
1614
+
1615
+ //#endregion
1616
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/sendInscriptions/request.ts
1617
+ const ordinalsSendInscriptionsParamsSchema = v.object({ transfers: v.array(v.object({
1618
+ address: v.string(),
1619
+ inscriptionId: v.string()
1620
+ })) });
1621
+ const ordinalsSendInscriptionsRequestSchema = createRequestSchema({
1622
+ paramsSchema: ordinalsSendInscriptionsParamsSchema,
1623
+ method: ordinalsMethods.ord_sendInscriptions
1624
+ });
1625
+
1626
+ //#endregion
1627
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/sendInscriptions/response.ts
1628
+ const ordinalsSendInscriptionsResultSchema = v.object({ txid: v.string() });
1629
+ const ordinalsSendInscriptionsSuccessResponseSchema = createSuccessResponseSchema({
1630
+ resultSchema: ordinalsSendInscriptionsResultSchema,
1631
+ method: ordinalsMethods.ord_sendInscriptions
1632
+ });
1633
+
1634
+ //#endregion
1635
+ //#region src/request/rpc/objects/namespaces/ordinals/index.ts
1636
+ const ordinalsRequestSchema = v.variant("method", [ordinalsGetInscriptionsRequestSchema, ordinalsSendInscriptionsRequestSchema]);
1637
+ const ordinalsSuccessResponseSchema = v.variant("~sats-connect-method", [ordinalsGetInscriptionsSuccessResponseSchema, ordinalsSendInscriptionsSuccessResponseSchema]);
1638
+
1639
+ //#endregion
1640
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateEtch/request.ts
1641
+ const etchTermsSchema$1 = v.object({
1642
+ amount: v.optional(v.string()),
1643
+ cap: v.optional(v.string()),
1644
+ heightStart: v.optional(v.string()),
1645
+ heightEnd: v.optional(v.string()),
1646
+ offsetStart: v.optional(v.string()),
1647
+ offsetEnd: v.optional(v.string())
1648
+ });
1649
+ const inscriptionDetailsSchema$1 = v.object({
1650
+ contentType: v.string(),
1651
+ contentBase64: v.string()
1652
+ });
1653
+ const runesEstimateEtchParamsSchema = v.object({
1654
+ runeName: v.string(),
862
1655
  divisibility: v.optional(v.number()),
863
1656
  symbol: v.optional(v.string()),
864
1657
  premine: v.optional(v.string()),
865
1658
  isMintable: v.boolean(),
1659
+ terms: v.optional(etchTermsSchema$1),
1660
+ inscriptionDetails: v.optional(inscriptionDetailsSchema$1),
866
1661
  delegateInscriptionId: v.optional(v.string()),
867
1662
  destinationAddress: v.string(),
868
- refundAddress: v.string(),
869
1663
  feeRate: v.number(),
870
1664
  appServiceFee: v.optional(v.number()),
871
1665
  appServiceFeeAddress: v.optional(v.string()),
1666
+ network: v.optional(v.enum(BitcoinNetworkType))
1667
+ });
1668
+ const runesEstimateEtchRequestSchema = createRequestSchema({
1669
+ paramsSchema: runesEstimateEtchParamsSchema,
1670
+ method: runesMethods.runes_estimateEtch
1671
+ });
1672
+
1673
+ //#endregion
1674
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateEtch/response.ts
1675
+ const runesEstimateEtchResultSchema = v.object({
1676
+ totalSize: v.number(),
1677
+ totalCost: v.number(),
1678
+ costBreakdown: v.object({
1679
+ postage: v.number(),
1680
+ networkFee: v.number(),
1681
+ serviceFee: v.number(),
1682
+ appServiceFee: v.number()
1683
+ })
1684
+ });
1685
+ const runesEstimateEtchSuccessResponseSchema = createSuccessResponseSchema({
1686
+ resultSchema: runesEstimateEtchResultSchema,
1687
+ method: runesMethods.runes_estimateEtch
1688
+ });
1689
+
1690
+ //#endregion
1691
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateMint/request.ts
1692
+ const runesEstimateMintParamsSchema = v.object({
1693
+ runeName: v.string(),
1694
+ repeats: v.number(),
1695
+ destinationAddress: v.string(),
1696
+ feeRate: v.number(),
1697
+ appServiceFee: v.optional(v.number()),
1698
+ appServiceFeeAddress: v.optional(v.string()),
1699
+ network: v.optional(v.enum(BitcoinNetworkType))
1700
+ });
1701
+ const runesEstimateMintRequestSchema = createRequestSchema({
1702
+ paramsSchema: runesEstimateMintParamsSchema,
1703
+ method: runesMethods.runes_estimateMint
1704
+ });
1705
+
1706
+ //#endregion
1707
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateMint/response.ts
1708
+ const runesEstimateMintResultSchema = v.object({
1709
+ totalSize: v.number(),
1710
+ totalCost: v.number(),
1711
+ costBreakdown: v.object({
1712
+ postage: v.number(),
1713
+ networkFee: v.number(),
1714
+ serviceFee: v.number(),
1715
+ appServiceFee: v.number()
1716
+ })
1717
+ });
1718
+ const runesEstimateMintSuccessResponseSchema = createSuccessResponseSchema({
1719
+ resultSchema: runesEstimateMintResultSchema,
1720
+ method: runesMethods.runes_estimateMint
1721
+ });
1722
+
1723
+ //#endregion
1724
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateRbfOrder/request.ts
1725
+ const runesEstimateRbfOrderParamsSchema = v.object({
1726
+ orderId: v.string(),
1727
+ newFeeRate: v.number(),
1728
+ network: v.optional(v.enum(BitcoinNetworkType))
1729
+ });
1730
+ const runesEstimateRbfOrderRequestSchema = createRequestSchema({
1731
+ paramsSchema: runesEstimateRbfOrderParamsSchema,
1732
+ method: runesMethods.runes_estimateRbfOrder
1733
+ });
1734
+
1735
+ //#endregion
1736
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateRbfOrder/response.ts
1737
+ const runesEstimateRbfOrderResultSchema = v.object({
1738
+ rbfCost: v.number(),
1739
+ fundingAddress: v.string()
1740
+ });
1741
+ const runesEstimateRbfOrderSuccessResponseSchema = createSuccessResponseSchema({
1742
+ resultSchema: runesEstimateRbfOrderResultSchema,
1743
+ method: runesMethods.runes_estimateRbfOrder
1744
+ });
1745
+
1746
+ //#endregion
1747
+ //#region src/request/rpc/objects/namespaces/runes/methods/etch/request.ts
1748
+ const etchTermsSchema = v.object({
1749
+ amount: v.optional(v.string()),
1750
+ cap: v.optional(v.string()),
1751
+ heightStart: v.optional(v.string()),
1752
+ heightEnd: v.optional(v.string()),
1753
+ offsetStart: v.optional(v.string()),
1754
+ offsetEnd: v.optional(v.string())
1755
+ });
1756
+ const inscriptionDetailsSchema = v.object({
1757
+ contentType: v.string(),
1758
+ contentBase64: v.string()
1759
+ });
1760
+ const runesEtchParamsSchema = v.object({
1761
+ runeName: v.string(),
1762
+ divisibility: v.optional(v.number()),
1763
+ symbol: v.optional(v.string()),
1764
+ premine: v.optional(v.string()),
1765
+ isMintable: v.boolean(),
872
1766
  terms: v.optional(etchTermsSchema),
873
1767
  inscriptionDetails: v.optional(inscriptionDetailsSchema),
1768
+ delegateInscriptionId: v.optional(v.string()),
1769
+ destinationAddress: v.string(),
1770
+ refundAddress: v.string(),
1771
+ feeRate: v.number(),
1772
+ appServiceFee: v.optional(v.number()),
1773
+ appServiceFeeAddress: v.optional(v.string()),
874
1774
  network: v.optional(v.enum(BitcoinNetworkType))
875
1775
  });
1776
+ const runesEtchRequestSchema = createRequestSchema({
1777
+ paramsSchema: runesEtchParamsSchema,
1778
+ method: runesMethods.runes_etch
1779
+ });
1780
+
1781
+ //#endregion
1782
+ //#region src/request/rpc/objects/namespaces/runes/methods/etch/response.ts
876
1783
  const runesEtchResultSchema = v.object({
877
1784
  orderId: v.string(),
878
1785
  fundTransactionId: v.string(),
879
1786
  fundingAddress: v.string()
880
1787
  });
881
- const runesEtchRequestMessageSchema = v.object({
882
- ...rpcRequestMessageSchema.entries,
883
- ...v.object({
884
- method: v.literal(runesEtchMethodName),
885
- params: runesEtchParamsSchema,
886
- id: v.string()
887
- }).entries
1788
+ const runesEtchSuccessResponseSchema = createSuccessResponseSchema({
1789
+ resultSchema: runesEtchResultSchema,
1790
+ method: runesMethods.runes_etch
888
1791
  });
889
1792
 
890
1793
  //#endregion
891
- //#region src/request/types/runesMethods/getBalance.ts
892
- const runesGetBalanceMethodName = "runes_getBalance";
1794
+ //#region src/request/rpc/objects/namespaces/runes/methods/getBalance/request.ts
893
1795
  const runesGetBalanceParamsSchema = v.nullish(v.null());
1796
+ const runesGetBalanceRequestSchema = createRequestSchema({
1797
+ paramsSchema: runesGetBalanceParamsSchema,
1798
+ method: runesMethods.runes_getBalance
1799
+ });
1800
+
1801
+ //#endregion
1802
+ //#region src/request/rpc/objects/namespaces/runes/methods/getBalance/response.ts
894
1803
  const runesGetBalanceResultSchema = v.object({ balances: v.array(v.object({
895
1804
  runeName: v.string(),
896
1805
  amount: v.string(),
@@ -899,18 +1808,47 @@ const runesGetBalanceResultSchema = v.object({ balances: v.array(v.object({
899
1808
  inscriptionId: v.nullish(v.string()),
900
1809
  spendableBalance: v.string()
901
1810
  })) });
902
- const runesGetBalanceRequestMessageSchema = v.object({
903
- ...rpcRequestMessageSchema.entries,
904
- ...v.object({
905
- method: v.literal(runesGetBalanceMethodName),
906
- params: runesGetBalanceParamsSchema,
907
- id: v.string()
908
- }).entries
1811
+ const runesGetBalanceSuccessResponseSchema = createSuccessResponseSchema({
1812
+ resultSchema: runesGetBalanceResultSchema,
1813
+ method: runesMethods.runes_getBalance
1814
+ });
1815
+
1816
+ //#endregion
1817
+ //#region src/request/rpc/objects/namespaces/runes/methods/getOrder/request.ts
1818
+ const runesGetOrderParamsSchema = v.object({
1819
+ id: v.string(),
1820
+ network: v.optional(v.enum(BitcoinNetworkType))
1821
+ });
1822
+ const runesGetOrderRequestSchema = createRequestSchema({
1823
+ paramsSchema: runesGetOrderParamsSchema,
1824
+ method: runesMethods.runes_getOrder
909
1825
  });
910
1826
 
911
1827
  //#endregion
912
- //#region src/request/types/runesMethods/mint.ts
913
- const runesMintMethodName = "runes_mint";
1828
+ //#region src/request/rpc/objects/namespaces/runes/methods/getOrder/response.ts
1829
+ const runesGetOrderResultSchema = v.object({
1830
+ id: v.string(),
1831
+ orderType: v.union([v.literal("rune_mint"), v.literal("rune_etch")]),
1832
+ state: v.union([
1833
+ v.literal("new"),
1834
+ v.literal("pending"),
1835
+ v.literal("executing"),
1836
+ v.literal("complete"),
1837
+ v.literal("failed"),
1838
+ v.literal("refunded"),
1839
+ v.literal("stale")
1840
+ ]),
1841
+ fundingAddress: v.string(),
1842
+ reason: v.optional(v.string()),
1843
+ createdAt: v.string()
1844
+ });
1845
+ const runesGetOrderSuccessResponseSchema = createSuccessResponseSchema({
1846
+ resultSchema: runesGetOrderResultSchema,
1847
+ method: runesMethods.runes_getOrder
1848
+ });
1849
+
1850
+ //#endregion
1851
+ //#region src/request/rpc/objects/namespaces/runes/methods/mint/request.ts
914
1852
  const runesMintParamsSchema = v.object({
915
1853
  appServiceFee: v.optional(v.number()),
916
1854
  appServiceFeeAddress: v.optional(v.string()),
@@ -921,45 +1859,108 @@ const runesMintParamsSchema = v.object({
921
1859
  runeName: v.string(),
922
1860
  network: v.optional(v.enum(BitcoinNetworkType))
923
1861
  });
1862
+ const runesMintRequestSchema = createRequestSchema({
1863
+ paramsSchema: runesMintParamsSchema,
1864
+ method: runesMethods.runes_mint
1865
+ });
1866
+
1867
+ //#endregion
1868
+ //#region src/request/rpc/objects/namespaces/runes/methods/mint/response.ts
924
1869
  const runesMintResultSchema = v.object({
925
1870
  orderId: v.string(),
926
1871
  fundTransactionId: v.string(),
927
1872
  fundingAddress: v.string()
928
1873
  });
929
- const runesMintRequestMessageSchema = v.object({
930
- ...rpcRequestMessageSchema.entries,
931
- ...v.object({
932
- method: v.literal(runesMintMethodName),
933
- params: runesMintParamsSchema,
934
- id: v.string()
935
- }).entries
1874
+ const runesMintSuccessResponseSchema = createSuccessResponseSchema({
1875
+ resultSchema: runesMintResultSchema,
1876
+ method: runesMethods.runes_mint
936
1877
  });
937
1878
 
938
1879
  //#endregion
939
- //#region src/request/types/runesMethods/transfer.ts
940
- const runesTransferMethodName = "runes_transfer";
941
- const runesTransferParamsSchema = v.object({ recipients: v.array(v.object({
942
- runeName: v.string(),
943
- amount: v.string(),
944
- address: v.string()
945
- })) });
946
- const runesTransferResultSchema = v.object({ txid: v.string() });
947
- const runesTransferRequestMessageSchema = v.object({
948
- ...rpcRequestMessageSchema.entries,
949
- ...v.object({
950
- method: v.literal(runesTransferMethodName),
951
- params: runesTransferParamsSchema,
952
- id: v.string()
953
- }).entries
1880
+ //#region src/request/rpc/objects/namespaces/runes/methods/rbfOrder/request.ts
1881
+ const runesRbfOrderParamsSchema = v.object({
1882
+ orderId: v.string(),
1883
+ newFeeRate: v.number(),
1884
+ network: v.optional(v.enum(BitcoinNetworkType))
1885
+ });
1886
+ const runesRbfOrderRequestSchema = createRequestSchema({
1887
+ paramsSchema: runesRbfOrderParamsSchema,
1888
+ method: runesMethods.runes_rbfOrder
1889
+ });
1890
+
1891
+ //#endregion
1892
+ //#region src/request/rpc/objects/namespaces/runes/methods/rbfOrder/response.ts
1893
+ const runesRbfOrderResultSchema = v.object({
1894
+ orderId: v.string(),
1895
+ fundRBFTransactionId: v.string(),
1896
+ fundingAddress: v.string()
1897
+ });
1898
+ const runesRbfOrderSuccessResponseSchema = createSuccessResponseSchema({
1899
+ resultSchema: runesRbfOrderResultSchema,
1900
+ method: runesMethods.runes_rbfOrder
1901
+ });
1902
+
1903
+ //#endregion
1904
+ //#region src/request/rpc/objects/namespaces/runes/methods/transfer/request.ts
1905
+ const runesTransferParamsSchema = v.object({
1906
+ recipients: v.array(v.object({
1907
+ runeName: v.string(),
1908
+ amount: v.string(),
1909
+ address: v.string()
1910
+ })),
1911
+ network: v.optional(v.enum(BitcoinNetworkType))
954
1912
  });
1913
+ const runesTransferRequestSchema = createRequestSchema({
1914
+ paramsSchema: runesTransferParamsSchema,
1915
+ method: runesMethods.runes_transfer
1916
+ });
1917
+
1918
+ //#endregion
1919
+ //#region src/request/rpc/objects/namespaces/runes/methods/transfer/response.ts
1920
+ const runesTransferResultSchema = v.object({ txid: v.string() });
1921
+ const runesTransferSuccessResponseSchema = createSuccessResponseSchema({
1922
+ resultSchema: runesTransferResultSchema,
1923
+ method: runesMethods.runes_transfer
1924
+ });
1925
+
1926
+ //#endregion
1927
+ //#region src/request/rpc/objects/namespaces/runes/index.ts
1928
+ const runesRequestSchema = v.variant("method", [
1929
+ runesEstimateEtchRequestSchema,
1930
+ runesEstimateMintRequestSchema,
1931
+ runesEstimateRbfOrderRequestSchema,
1932
+ runesEtchRequestSchema,
1933
+ runesGetBalanceRequestSchema,
1934
+ runesGetOrderRequestSchema,
1935
+ runesMintRequestSchema,
1936
+ runesRbfOrderRequestSchema,
1937
+ runesTransferRequestSchema
1938
+ ]);
1939
+ const runesSuccessResponseSchema = v.variant("~sats-connect-method", [
1940
+ runesEstimateEtchSuccessResponseSchema,
1941
+ runesEstimateMintSuccessResponseSchema,
1942
+ runesEstimateRbfOrderSuccessResponseSchema,
1943
+ runesEtchSuccessResponseSchema,
1944
+ runesGetBalanceSuccessResponseSchema,
1945
+ runesGetOrderSuccessResponseSchema,
1946
+ runesMintSuccessResponseSchema,
1947
+ runesRbfOrderSuccessResponseSchema,
1948
+ runesTransferSuccessResponseSchema
1949
+ ]);
955
1950
 
956
1951
  //#endregion
957
- //#region src/request/types/sparkMethods/flashnetMethods/clawbackFunds.ts
958
- const sparkFlashnetClawbackFundsMethodName = "spark_flashnet_clawbackFunds";
1952
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetClawbackFunds/request.ts
959
1953
  const sparkFlashnetClawbackFundsParamsSchema = v.object({
960
1954
  sparkTransferId: v.string(),
961
1955
  lpIdentityPublicKey: v.string()
962
1956
  });
1957
+ const sparkFlashnetClawbackFundsRequestSchema = createRequestSchema({
1958
+ paramsSchema: sparkFlashnetClawbackFundsParamsSchema,
1959
+ method: sparkMethods.spark_flashnet_clawbackFunds
1960
+ });
1961
+
1962
+ //#endregion
1963
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetClawbackFunds/response.ts
963
1964
  const sparkFlashnetClawbackFundsResultSchema = v.object({
964
1965
  requestId: v.string(),
965
1966
  accepted: v.boolean(),
@@ -967,18 +1968,13 @@ const sparkFlashnetClawbackFundsResultSchema = v.object({
967
1968
  sparkStatusTrackingId: v.optional(v.string()),
968
1969
  error: v.optional(v.string())
969
1970
  });
970
- const sparkFlashnetClawbackFundsRequestMessageSchema = v.object({
971
- ...rpcRequestMessageSchema.entries,
972
- ...v.object({
973
- method: v.literal(sparkFlashnetClawbackFundsMethodName),
974
- params: sparkFlashnetClawbackFundsParamsSchema,
975
- id: v.string()
976
- }).entries
1971
+ const sparkFlashnetClawbackFundsSuccessResponseSchema = createSuccessResponseSchema({
1972
+ resultSchema: sparkFlashnetClawbackFundsResultSchema,
1973
+ method: sparkMethods.spark_flashnet_clawbackFunds
977
1974
  });
978
1975
 
979
1976
  //#endregion
980
- //#region src/request/types/sparkMethods/flashnetMethods/executeRouteSwap.ts
981
- const sparkFlashnetExecuteRouteSwapMethodName = "spark_flashnet_executeRouteSwap";
1977
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteRouteSwap/request.ts
982
1978
  const sparkFlashnetExecuteRouteSwapParamsSchema = v.object({
983
1979
  hops: v.array(v.object({
984
1980
  poolId: v.string(),
@@ -993,6 +1989,13 @@ const sparkFlashnetExecuteRouteSwapParamsSchema = v.object({
993
1989
  integratorFeeRateBps: v.optional(v.number()),
994
1990
  integratorPublicKey: v.optional(v.string())
995
1991
  });
1992
+ const sparkFlashnetExecuteRouteSwapRequestSchema = createRequestSchema({
1993
+ paramsSchema: sparkFlashnetExecuteRouteSwapParamsSchema,
1994
+ method: sparkMethods.spark_flashnet_executeRouteSwap
1995
+ });
1996
+
1997
+ //#endregion
1998
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteRouteSwap/response.ts
996
1999
  const sparkFlashnetExecuteRouteSwapResultSchema = v.object({
997
2000
  requestId: v.string(),
998
2001
  accepted: v.boolean(),
@@ -1001,18 +2004,13 @@ const sparkFlashnetExecuteRouteSwapResultSchema = v.object({
1001
2004
  finalOutboundTransferId: v.string(),
1002
2005
  error: v.optional(v.string())
1003
2006
  });
1004
- const sparkFlashnetExecuteRouteSwapRequestMessageSchema = v.object({
1005
- ...rpcRequestMessageSchema.entries,
1006
- ...v.object({
1007
- method: v.literal(sparkFlashnetExecuteRouteSwapMethodName),
1008
- params: sparkFlashnetExecuteRouteSwapParamsSchema,
1009
- id: v.string()
1010
- }).entries
2007
+ const sparkFlashnetExecuteRouteSwapSuccessResponseSchema = createSuccessResponseSchema({
2008
+ resultSchema: sparkFlashnetExecuteRouteSwapResultSchema,
2009
+ method: sparkMethods.spark_flashnet_executeRouteSwap
1011
2010
  });
1012
2011
 
1013
2012
  //#endregion
1014
- //#region src/request/types/sparkMethods/flashnetMethods/executeSwap.ts
1015
- const sparkFlashnetExecuteSwapMethodName = "spark_flashnet_executeSwap";
2013
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteSwap/request.ts
1016
2014
  const sparkFlashnetExecuteSwapParamsSchema = v.object({
1017
2015
  poolId: v.string(),
1018
2016
  assetInAddress: v.string(),
@@ -1023,6 +2021,13 @@ const sparkFlashnetExecuteSwapParamsSchema = v.object({
1023
2021
  integratorFeeRateBps: v.optional(v.number()),
1024
2022
  integratorPublicKey: v.optional(v.string())
1025
2023
  });
2024
+ const sparkFlashnetExecuteSwapRequestSchema = createRequestSchema({
2025
+ paramsSchema: sparkFlashnetExecuteSwapParamsSchema,
2026
+ method: sparkMethods.spark_flashnet_executeSwap
2027
+ });
2028
+
2029
+ //#endregion
2030
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteSwap/response.ts
1026
2031
  const sparkFlashnetExecuteSwapResultSchema = v.object({
1027
2032
  requestId: v.string(),
1028
2033
  accepted: v.boolean(),
@@ -1034,49 +2039,49 @@ const sparkFlashnetExecuteSwapResultSchema = v.object({
1034
2039
  outboundTransferId: v.optional(v.string()),
1035
2040
  error: v.optional(v.string())
1036
2041
  });
1037
- const sparkFlashnetExecuteSwapRequestMessageSchema = v.object({
1038
- ...rpcRequestMessageSchema.entries,
1039
- ...v.object({
1040
- method: v.literal(sparkFlashnetExecuteSwapMethodName),
1041
- params: sparkFlashnetExecuteSwapParamsSchema,
1042
- id: v.string()
1043
- }).entries
2042
+ const sparkFlashnetExecuteSwapSuccessResponseSchema = createSuccessResponseSchema({
2043
+ resultSchema: sparkFlashnetExecuteSwapResultSchema,
2044
+ method: sparkMethods.spark_flashnet_executeSwap
1044
2045
  });
1045
2046
 
1046
2047
  //#endregion
1047
- //#region src/request/types/sparkMethods/flashnetMethods/getClawbackEligibleTransfers.ts
1048
- const sparkGetClawbackEligibleTransfersMethodName = "spark_flashnet_getClawbackEligibleTransfers";
2048
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetClawbackEligibleTransfers/request.ts
1049
2049
  const sparkGetClawbackEligibleTransfersParamsSchema = v.nullish(v.null());
2050
+ const sparkGetClawbackEligibleTransfersRequestSchema = createRequestSchema({
2051
+ paramsSchema: sparkGetClawbackEligibleTransfersParamsSchema,
2052
+ method: sparkMethods.spark_flashnet_getClawbackEligibleTransfers
2053
+ });
2054
+
2055
+ //#endregion
2056
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetClawbackEligibleTransfers/response.ts
1050
2057
  const sparkGetClawbackEligibleTransfersResultSchema = v.object({ eligibleTransfers: v.array(v.object({
1051
2058
  txId: v.string(),
1052
2059
  createdAt: v.string(),
1053
2060
  lpIdentityPublicKey: v.string()
1054
2061
  })) });
1055
- const sparkGetClawbackEligibleTransfersRequestMessageSchema = v.object({
1056
- ...rpcRequestMessageSchema.entries,
1057
- ...v.object({
1058
- method: v.literal(sparkGetClawbackEligibleTransfersMethodName),
1059
- params: sparkGetClawbackEligibleTransfersParamsSchema,
1060
- id: v.string()
1061
- }).entries
2062
+ const sparkGetClawbackEligibleTransfersSuccessResponseSchema = createSuccessResponseSchema({
2063
+ resultSchema: sparkGetClawbackEligibleTransfersResultSchema,
2064
+ method: sparkMethods.spark_flashnet_getClawbackEligibleTransfers
1062
2065
  });
1063
2066
 
1064
2067
  //#endregion
1065
- //#region src/request/types/sparkMethods/flashnetMethods/getJwt.ts
1066
- const sparkFlashnetGetJwtMethodName = "spark_flashnet_getJwt";
2068
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetJwt/request.ts
1067
2069
  const sparkFlashnetGetJwtParamsSchema = v.null();
2070
+ const sparkFlashnetGetJwtRequestSchema = createRequestSchema({
2071
+ paramsSchema: sparkFlashnetGetJwtParamsSchema,
2072
+ method: sparkMethods.spark_flashnet_getJwt
2073
+ });
2074
+
2075
+ //#endregion
2076
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetJwt/response.ts
1068
2077
  const sparkFlashnetGetJwtResultSchema = v.object({ jwt: v.string() });
1069
- const sparkFlashnetGetJwtRequestMessageSchema = v.object({
1070
- ...rpcRequestMessageSchema.entries,
1071
- ...v.object({
1072
- method: v.literal(sparkFlashnetGetJwtMethodName),
1073
- params: sparkFlashnetGetJwtParamsSchema,
1074
- id: v.string()
1075
- }).entries
2078
+ const sparkFlashnetGetJwtSuccessResponseSchema = createSuccessResponseSchema({
2079
+ resultSchema: sparkFlashnetGetJwtResultSchema,
2080
+ method: sparkMethods.spark_flashnet_getJwt
1076
2081
  });
1077
2082
 
1078
2083
  //#endregion
1079
- //#region src/request/types/sparkMethods/flashnetMethods/intents/addLiquidity.ts
2084
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/addLiquidity.ts
1080
2085
  const sparkFlashnetAddLiquidityIntentSchema = v.object({
1081
2086
  type: v.literal("addLiquidity"),
1082
2087
  data: v.object({
@@ -1093,7 +2098,7 @@ const sparkFlashnetAddLiquidityIntentSchema = v.object({
1093
2098
  });
1094
2099
 
1095
2100
  //#endregion
1096
- //#region src/request/types/sparkMethods/flashnetMethods/intents/clawback.ts
2101
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/clawback.ts
1097
2102
  const sparkFlashnetClawbackIntentSchema = v.object({
1098
2103
  type: v.literal("clawback"),
1099
2104
  data: v.object({
@@ -1105,7 +2110,7 @@ const sparkFlashnetClawbackIntentSchema = v.object({
1105
2110
  });
1106
2111
 
1107
2112
  //#endregion
1108
- //#region src/request/types/sparkMethods/flashnetMethods/intents/confirmInitialDeposit.ts
2113
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/confirmInitialDeposit.ts
1109
2114
  const sparkFlashnetConfirmInitialDepositIntentSchema = v.object({
1110
2115
  type: v.literal("confirmInitialDeposit"),
1111
2116
  data: v.object({
@@ -1117,7 +2122,7 @@ const sparkFlashnetConfirmInitialDepositIntentSchema = v.object({
1117
2122
  });
1118
2123
 
1119
2124
  //#endregion
1120
- //#region src/request/types/sparkMethods/flashnetMethods/intents/createConstantProductPool.ts
2125
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/createConstantProductPool.ts
1121
2126
  const sparkFlashnetCreateConstantProductPoolIntentSchema = v.object({
1122
2127
  type: v.literal("createConstantProductPool"),
1123
2128
  data: v.object({
@@ -1131,7 +2136,7 @@ const sparkFlashnetCreateConstantProductPoolIntentSchema = v.object({
1131
2136
  });
1132
2137
 
1133
2138
  //#endregion
1134
- //#region src/request/types/sparkMethods/flashnetMethods/intents/createSingleSidedPool.ts
2139
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/createSingleSidedPool.ts
1135
2140
  const sparkFlashnetCreateSingleSidedPoolIntentSchema = v.object({
1136
2141
  type: v.literal("createSingleSidedPool"),
1137
2142
  data: v.object({
@@ -1149,7 +2154,7 @@ const sparkFlashnetCreateSingleSidedPoolIntentSchema = v.object({
1149
2154
  });
1150
2155
 
1151
2156
  //#endregion
1152
- //#region src/request/types/sparkMethods/flashnetMethods/intents/removeLiquidity.ts
2157
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/removeLiquidity.ts
1153
2158
  const sparkFlashnetRemoveLiquidityIntentSchema = v.object({
1154
2159
  type: v.literal("removeLiquidity"),
1155
2160
  data: v.object({
@@ -1161,7 +2166,7 @@ const sparkFlashnetRemoveLiquidityIntentSchema = v.object({
1161
2166
  });
1162
2167
 
1163
2168
  //#endregion
1164
- //#region src/request/types/sparkMethods/flashnetMethods/intents/routeSwap.ts
2169
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/routeSwap.ts
1165
2170
  const sparkFlashnetRouteSwapIntentSchema = v.object({
1166
2171
  type: v.literal("executeRouteSwap"),
1167
2172
  data: v.object({
@@ -1182,7 +2187,7 @@ const sparkFlashnetRouteSwapIntentSchema = v.object({
1182
2187
  });
1183
2188
 
1184
2189
  //#endregion
1185
- //#region src/request/types/sparkMethods/flashnetMethods/intents/swap.ts
2190
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/swap.ts
1186
2191
  const sparkFlashnetSwapIntentSchema = v.object({
1187
2192
  type: v.literal("executeSwap"),
1188
2193
  data: v.object({
@@ -1200,8 +2205,7 @@ const sparkFlashnetSwapIntentSchema = v.object({
1200
2205
  });
1201
2206
 
1202
2207
  //#endregion
1203
- //#region src/request/types/sparkMethods/flashnetMethods/signIntent.ts
1204
- const sparkFlashnetSignIntentMethodName = "spark_flashnet_signIntent";
2208
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/request.ts
1205
2209
  const sparkFlashnetSignIntentParamsSchema = v.union([
1206
2210
  sparkFlashnetSwapIntentSchema,
1207
2211
  sparkFlashnetRouteSwapIntentSchema,
@@ -1212,732 +2216,1018 @@ const sparkFlashnetSignIntentParamsSchema = v.union([
1212
2216
  sparkFlashnetCreateSingleSidedPoolIntentSchema,
1213
2217
  sparkFlashnetRemoveLiquidityIntentSchema
1214
2218
  ]);
2219
+ const sparkFlashnetSignIntentRequestSchema = createRequestSchema({
2220
+ paramsSchema: sparkFlashnetSignIntentParamsSchema,
2221
+ method: sparkMethods.spark_flashnet_signIntent
2222
+ });
2223
+
2224
+ //#endregion
2225
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/response.ts
1215
2226
  const sparkFlashnetSignIntentResultSchema = v.object({ signature: v.string() });
1216
- const sparkFlashnetSignIntentRequestMessageSchema = v.object({
1217
- ...rpcRequestMessageSchema.entries,
1218
- ...v.object({
1219
- method: v.literal(sparkFlashnetSignIntentMethodName),
1220
- params: sparkFlashnetSignIntentParamsSchema,
1221
- id: v.string()
1222
- }).entries
2227
+ const sparkFlashnetSignIntentSuccessResponseSchema = createSuccessResponseSchema({
2228
+ resultSchema: sparkFlashnetSignIntentResultSchema,
2229
+ method: sparkMethods.spark_flashnet_signIntent
1223
2230
  });
1224
2231
 
1225
2232
  //#endregion
1226
- //#region src/request/types/sparkMethods/flashnetMethods/signStructuredMessage.ts
1227
- const sparkFlashnetSignStructuredMessageMethodName = "spark_flashnet_signStructuredMessage";
2233
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignStructuredMessage/request.ts
1228
2234
  const sparkFlashnetSignStructuredMessageParamsSchema = v.object({ message: v.string() });
2235
+ const sparkFlashnetSignStructuredMessageRequestSchema = createRequestSchema({
2236
+ paramsSchema: sparkFlashnetSignStructuredMessageParamsSchema,
2237
+ method: sparkMethods.spark_flashnet_signStructuredMessage
2238
+ });
2239
+
2240
+ //#endregion
2241
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignStructuredMessage/response.ts
1229
2242
  const sparkFlashnetSignStructuredMessageResultSchema = v.object({
1230
2243
  message: v.string(),
1231
2244
  signature: v.string()
1232
2245
  });
1233
- const sparkFlashnetSignStructuredMessageRequestMessageSchema = v.object({
1234
- ...rpcRequestMessageSchema.entries,
1235
- ...v.object({
1236
- method: v.literal(sparkFlashnetSignStructuredMessageMethodName),
1237
- params: sparkFlashnetSignStructuredMessageParamsSchema,
1238
- id: v.string()
1239
- }).entries
2246
+ const sparkFlashnetSignStructuredMessageSuccessResponseSchema = createSuccessResponseSchema({
2247
+ resultSchema: sparkFlashnetSignStructuredMessageResultSchema,
2248
+ method: sparkMethods.spark_flashnet_signStructuredMessage
1240
2249
  });
1241
2250
 
1242
2251
  //#endregion
1243
- //#region src/request/types/sparkMethods/getAddresses.ts
1244
- const sparkGetAddressesMethodName = "spark_getAddresses";
2252
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddresses/request.ts
1245
2253
  const sparkGetAddressesParamsSchema = v.nullish(v.object({ message: v.optional(v.string()) }));
1246
- const sparkGetAddressesResultSchema = v.object({
1247
- addresses: v.array(addressSchema),
1248
- network: sparkNetworkSchema
2254
+ const sparkGetAddressesRequestSchema = createRequestSchema({
2255
+ paramsSchema: sparkGetAddressesParamsSchema,
2256
+ method: sparkMethods.spark_getAddresses
2257
+ });
2258
+
2259
+ //#endregion
2260
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetwork/request.ts
2261
+ const walletAddNetworkParamsSchema = v.variant("chain", [
2262
+ v.object({
2263
+ chain: v.literal("bitcoin"),
2264
+ type: v.enum(BitcoinNetworkType),
2265
+ name: v.string(),
2266
+ rpcUrl: v.string(),
2267
+ rpcFallbackUrl: v.optional(v.string()),
2268
+ indexerUrl: v.optional(v.string()),
2269
+ blockExplorerUrl: v.optional(v.string()),
2270
+ switch: v.optional(v.boolean())
2271
+ }),
2272
+ v.object({
2273
+ chain: v.literal("stacks"),
2274
+ name: v.string(),
2275
+ type: v.enum(StacksNetworkType),
2276
+ rpcUrl: v.string(),
2277
+ blockExplorerUrl: v.optional(v.string()),
2278
+ switch: v.optional(v.boolean())
2279
+ }),
2280
+ v.object({
2281
+ chain: v.literal("starknet"),
2282
+ name: v.string(),
2283
+ type: v.enum(StarknetNetworkType),
2284
+ rpcUrl: v.string(),
2285
+ blockExplorerUrl: v.optional(v.string()),
2286
+ switch: v.optional(v.boolean())
2287
+ })
2288
+ ]);
2289
+ const walletAddNetworkRequestSchema = createRequestSchema({
2290
+ paramsSchema: walletAddNetworkParamsSchema,
2291
+ method: walletMethods.wallet_addNetwork
1249
2292
  });
1250
- const sparkGetAddressesRequestMessageSchema = v.object({
1251
- ...rpcRequestMessageSchema.entries,
1252
- ...v.object({
1253
- method: v.literal(sparkGetAddressesMethodName),
1254
- params: sparkGetAddressesParamsSchema,
1255
- id: v.string()
1256
- }).entries
2293
+
2294
+ //#endregion
2295
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetwork/response.ts
2296
+ const walletAddNetworkResultSchema = v.object({ id: v.string() });
2297
+ const walletAddNetworkSuccessResponseSchema = createSuccessResponseSchema({
2298
+ resultSchema: walletAddNetworkResultSchema,
2299
+ method: walletMethods.wallet_addNetwork
1257
2300
  });
1258
2301
 
1259
2302
  //#endregion
1260
- //#region src/request/types/sparkMethods/getBalance.ts
1261
- const sparkGetBalanceMethodName = "spark_getBalance";
1262
- const sparkGetBalanceParamsSchema = v.nullish(v.null());
1263
- const sparkGetBalanceResultSchema = v.object({
1264
- balance: v.string(),
1265
- tokenBalances: v.array(v.object({
1266
- balance: v.string(),
1267
- tokenMetadata: v.object({
1268
- tokenIdentifier: v.string(),
1269
- tokenName: v.string(),
1270
- tokenTicker: v.string(),
1271
- decimals: v.number(),
1272
- maxSupply: v.string()
1273
- })
1274
- }))
2303
+ //#region src/request/rpc/objects/namespaces/wallet/shared/permissions.ts
2304
+ const accountActionsSchema$2 = v.object({ read: v.optional(v.boolean()) });
2305
+ const walletActionsSchema$2 = v.object({ readNetwork: v.optional(v.boolean()) });
2306
+ const accountPermissionSchema$1 = v.object({
2307
+ type: v.literal("account"),
2308
+ resourceId: v.string(),
2309
+ clientId: v.string(),
2310
+ actions: accountActionsSchema$2
2311
+ });
2312
+ const walletPermissionSchema$1 = v.object({
2313
+ type: v.literal("wallet"),
2314
+ resourceId: v.string(),
2315
+ clientId: v.string(),
2316
+ actions: walletActionsSchema$2
2317
+ });
2318
+ const permissionSchema$1 = v.variant("type", [accountPermissionSchema$1, walletPermissionSchema$1]);
2319
+ /**
2320
+ * Permissions with the clientId field omitted and optional actions. Used for
2321
+ * permission requests, since the wallet performs authentication based on the
2322
+ * client's tab origin and should not rely on the client authenticating
2323
+ * themselves.
2324
+ */
2325
+ const permissionRequestParamsSchema = v.variant("type", [v.object({ ...v.omit(accountPermissionSchema$1, ["clientId"]).entries }), v.object({ ...v.omit(walletPermissionSchema$1, ["clientId"]).entries })]);
2326
+
2327
+ //#endregion
2328
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetworkV2/request.ts
2329
+ const walletAddNetworkV2ParamsSchema = v.object({
2330
+ network: networkConfigurationOptionsSchema,
2331
+ isActive: v.optional(v.boolean())
1275
2332
  });
1276
- const sparkGetBalanceRequestMessageSchema = v.object({
1277
- ...rpcRequestMessageSchema.entries,
1278
- ...v.object({
1279
- method: v.literal(sparkGetBalanceMethodName),
1280
- params: sparkGetBalanceParamsSchema,
1281
- id: v.string()
1282
- }).entries
2333
+ const walletAddNetworkV2RequestSchema = createRequestSchema({
2334
+ paramsSchema: walletAddNetworkV2ParamsSchema,
2335
+ method: walletMethods.wallet_addNetworkV2
1283
2336
  });
1284
2337
 
1285
2338
  //#endregion
1286
- //#region src/request/types/sparkMethods/signMessage.ts
1287
- const sparkSignMessageMethodName = "spark_signMessage";
1288
- const sparkSignMessageParamsSchema = v.object({ message: v.string() });
1289
- const sparkSignMessageResultSchema = v.object({ signature: v.string() });
1290
- const sparkSignMessageRequestMessageSchema = v.object({
1291
- ...rpcRequestMessageSchema.entries,
1292
- ...v.object({
1293
- method: v.literal(sparkSignMessageMethodName),
1294
- params: sparkSignMessageParamsSchema,
1295
- id: v.string()
1296
- }).entries
2339
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetworkV2/response.ts
2340
+ const walletAddNetworkV2ResultSchema = v.object({ id: v.string() });
2341
+ const walletAddNetworkV2SuccessResponseSchema = createSuccessResponseSchema({
2342
+ resultSchema: walletAddNetworkV2ResultSchema,
2343
+ method: walletMethods.wallet_addNetworkV2
2344
+ });
2345
+
2346
+ //#endregion
2347
+ //#region src/request/rpc/objects/namespaces/wallet/methods/changeNetwork/request.ts
2348
+ const walletChangeNetworkParamsSchema = v.object({ name: v.enum(BitcoinNetworkType) });
2349
+ const walletChangeNetworkRequestSchema = createRequestSchema({
2350
+ paramsSchema: walletChangeNetworkParamsSchema,
2351
+ method: walletMethods.wallet_changeNetwork
2352
+ });
2353
+
2354
+ //#endregion
2355
+ //#region src/request/rpc/objects/namespaces/wallet/methods/changeNetwork/response.ts
2356
+ const walletChangeNetworkResultSchema = v.nullish(v.null());
2357
+ const walletChangeNetworkSuccessResponseSchema = createSuccessResponseSchema({
2358
+ resultSchema: walletChangeNetworkResultSchema,
2359
+ method: walletMethods.wallet_changeNetwork
2360
+ });
2361
+
2362
+ //#endregion
2363
+ //#region src/request/rpc/objects/namespaces/wallet/methods/changeNetworkById/request.ts
2364
+ const walletChangeNetworkByIdParamsSchema = v.object({ id: v.string() });
2365
+ const walletChangeNetworkByIdRequestSchema = createRequestSchema({
2366
+ paramsSchema: walletChangeNetworkByIdParamsSchema,
2367
+ method: walletMethods.wallet_changeNetworkById
2368
+ });
2369
+
2370
+ //#endregion
2371
+ //#region src/request/rpc/objects/namespaces/wallet/methods/changeNetworkById/response.ts
2372
+ const walletChangeNetworkByIdResultSchema = v.nullish(v.null());
2373
+ const walletChangeNetworkByIdSuccessResponseSchema = createSuccessResponseSchema({
2374
+ resultSchema: walletChangeNetworkByIdResultSchema,
2375
+ method: walletMethods.wallet_changeNetworkById
2376
+ });
2377
+
2378
+ //#endregion
2379
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connect/request.ts
2380
+ const walletConnectParamsSchema = v.nullish(v.object({
2381
+ permissions: v.optional(v.array(permissionRequestParamsSchema)),
2382
+ addresses: v.optional(v.array(v.enum(AddressPurpose))),
2383
+ message: v.optional(v.pipe(v.string(), v.maxLength(80, "The message must not exceed 80 characters."))),
2384
+ network: v.optional(v.picklist([
2385
+ "Mainnet",
2386
+ "Testnet",
2387
+ "Signet"
2388
+ ]))
2389
+ }));
2390
+ const walletConnectRequestSchema = createRequestSchema({
2391
+ paramsSchema: walletConnectParamsSchema,
2392
+ method: walletMethods.wallet_connect
2393
+ });
2394
+
2395
+ //#endregion
2396
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetwork/request.ts
2397
+ const walletGetNetworkParamsSchema = v.nullish(v.null());
2398
+ const walletGetNetworkRequestSchema = createRequestSchema({
2399
+ paramsSchema: walletGetNetworkParamsSchema,
2400
+ method: walletMethods.wallet_getNetwork
1297
2401
  });
1298
2402
 
1299
2403
  //#endregion
1300
- //#region src/request/types/sparkMethods/transfer.ts
1301
- const sparkTransferMethodName = "spark_transfer";
1302
- const sparkTransferParamsSchema = v.object({
1303
- amountSats: v.union([v.number(), v.string()]),
1304
- receiverSparkAddress: v.string()
2404
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetwork/response.ts
2405
+ const walletGetNetworkResultSchema = v.object({
2406
+ bitcoin: v.object({ name: v.enum(BitcoinNetworkType) }),
2407
+ stacks: v.object({ name: v.enum(StacksNetworkType) }),
2408
+ spark: v.object({ name: v.enum(SparkNetworkType) })
1305
2409
  });
1306
- const sparkTransferResultSchema = v.object({ id: v.string() });
1307
- const sparkTransferRequestMessageSchema = v.object({
1308
- ...rpcRequestMessageSchema.entries,
1309
- ...v.object({
1310
- method: v.literal(sparkTransferMethodName),
1311
- params: sparkTransferParamsSchema,
1312
- id: v.string()
1313
- }).entries
2410
+ const walletGetNetworkSuccessResponseSchema = createSuccessResponseSchema({
2411
+ resultSchema: walletGetNetworkResultSchema,
2412
+ method: walletMethods.wallet_getNetwork
1314
2413
  });
1315
2414
 
1316
2415
  //#endregion
1317
- //#region src/request/types/sparkMethods/transferToken.ts
1318
- const sparkTransferTokenMethodName = "spark_transferToken";
1319
- const sparkTransferTokenParamsSchema = v.object({
1320
- tokenAmount: v.union([v.number(), v.string()]),
1321
- tokenIdentifier: v.string(),
1322
- receiverSparkAddress: v.string()
2416
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connect/response.ts
2417
+ const walletConnectResultSchema = v.object({
2418
+ id: v.string(),
2419
+ addresses: v.array(addressSchema),
2420
+ walletType: walletTypeSchema,
2421
+ network: walletGetNetworkResultSchema
1323
2422
  });
1324
- const sparkTransferTokenResultSchema = v.object({ id: v.string() });
1325
- const sparkTransferTokenRequestMessageSchema = v.object({
1326
- ...rpcRequestMessageSchema.entries,
1327
- ...v.object({
1328
- method: v.literal(sparkTransferTokenMethodName),
1329
- params: sparkTransferTokenParamsSchema,
1330
- id: v.string()
1331
- }).entries
2423
+ const walletConnectSuccessResponseSchema = createSuccessResponseSchema({
2424
+ resultSchema: walletConnectResultSchema,
2425
+ method: walletMethods.wallet_connect
1332
2426
  });
1333
2427
 
1334
2428
  //#endregion
1335
- //#region src/request/types/stxMethods/callContract.ts
1336
- const stxCallContractMethodName = "stx_callContract";
1337
- const stxCallContractParamsSchema = v.object({
1338
- contract: v.string(),
1339
- functionName: v.string(),
1340
- arguments: v.optional(v.array(v.string())),
1341
- functionArgs: v.optional(v.array(v.string())),
1342
- postConditions: v.optional(v.array(v.string())),
1343
- postConditionMode: v.optional(v.union([v.literal("allow"), v.literal("deny")]))
1344
- });
1345
- const stxCallContractResultSchema = v.object({
1346
- txid: v.string(),
1347
- transaction: v.string()
1348
- });
1349
- const stxCallContractRequestMessageSchema = v.object({
1350
- ...rpcRequestMessageSchema.entries,
1351
- ...v.object({
1352
- method: v.literal(stxCallContractMethodName),
1353
- params: stxCallContractParamsSchema,
1354
- id: v.string()
1355
- }).entries
2429
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connectV2/request.ts
2430
+ const walletConnectV2ParamsSchema = v.nullish(v.object({
2431
+ permissions: permissionRequestParamsSchema,
2432
+ addresses: v.optional(v.array(v.enum(AddressPurpose))),
2433
+ message: v.optional(v.pipe(v.string(), v.maxLength(80, "The message must not exceed 80 characters."))),
2434
+ networkId: v.optional(v.string())
2435
+ }));
2436
+ const walletConnectV2RequestSchema = createRequestSchema({
2437
+ paramsSchema: walletConnectV2ParamsSchema,
2438
+ method: walletMethods.wallet_connectV2
1356
2439
  });
1357
2440
 
1358
2441
  //#endregion
1359
- //#region src/request/types/stxMethods/deployContract.ts
1360
- const stxDeployContractMethodName = "stx_deployContract";
1361
- const stxDeployContractParamsSchema = v.object({
1362
- name: v.string(),
1363
- clarityCode: v.string(),
1364
- clarityVersion: v.optional(v.number()),
1365
- postConditions: v.optional(v.array(v.string())),
1366
- postConditionMode: v.optional(v.union([v.literal("allow"), v.literal("deny")]))
1367
- });
1368
- const stxDeployContractResultSchema = v.object({
1369
- txid: v.string(),
1370
- transaction: v.string()
1371
- });
1372
- const stxDeployContractRequestMessageSchema = v.object({
1373
- ...rpcRequestMessageSchema.entries,
1374
- ...v.object({
1375
- method: v.literal(stxDeployContractMethodName),
1376
- params: stxDeployContractParamsSchema,
1377
- id: v.string()
1378
- }).entries
2442
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetworks/request.ts
2443
+ const walletGetNetworksParamsSchema = v.nullish(v.null());
2444
+ const walletGetNetworksRequestSchema = createRequestSchema({
2445
+ paramsSchema: walletGetNetworksParamsSchema,
2446
+ method: walletMethods.wallet_getNetworks
1379
2447
  });
1380
2448
 
1381
2449
  //#endregion
1382
- //#region src/request/types/stxMethods/getAccounts.ts
1383
- const stxGetAccountsMethodName = "stx_getAccounts";
1384
- const stxGetAccountsParamsSchema = v.nullish(v.null());
1385
- const stxGetAccountsResultSchema = v.object({
1386
- addresses: v.array(v.object({
1387
- address: v.string(),
1388
- publicKey: v.string(),
1389
- gaiaHubUrl: v.string(),
1390
- gaiaAppKey: v.string()
1391
- })),
1392
- network: getNetworkResultSchema
1393
- });
1394
- const stxGetAccountsRequestMessageSchema = v.object({
1395
- ...rpcRequestMessageSchema.entries,
1396
- ...v.object({
1397
- method: v.literal(stxGetAccountsMethodName),
1398
- params: stxGetAccountsParamsSchema,
1399
- id: v.string()
1400
- }).entries
2450
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetworks/response.ts
2451
+ const walletGetNetworksResultSchema = allResolvedNetworksSchema;
2452
+ const walletGetNetworksSuccessResponseSchema = createSuccessResponseSchema({
2453
+ resultSchema: walletGetNetworksResultSchema,
2454
+ method: walletMethods.wallet_getNetworks
1401
2455
  });
1402
2456
 
1403
2457
  //#endregion
1404
- //#region src/request/types/stxMethods/getAddresses.ts
1405
- const stxGetAddressesMethodName = "stx_getAddresses";
1406
- const stxGetAddressesParamsSchema = v.nullish(v.object({ message: v.optional(v.string()) }));
1407
- const stxGetAddressesResultSchema = v.object({
2458
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connectV2/response.ts
2459
+ const walletConnectV2ResultSchema = v.object({
2460
+ accountId: v.string(),
1408
2461
  addresses: v.array(addressSchema),
1409
- network: stacksNetworkSchema
2462
+ walletType: walletTypeSchema,
2463
+ networks: walletGetNetworksResultSchema
1410
2464
  });
1411
- const stxGetAddressesRequestMessageSchema = v.object({
1412
- ...rpcRequestMessageSchema.entries,
1413
- ...v.object({
1414
- method: v.literal(stxGetAddressesMethodName),
1415
- params: stxGetAddressesParamsSchema,
1416
- id: v.string()
1417
- }).entries
2465
+ const walletConnectV2SuccessResponseSchema = createSuccessResponseSchema({
2466
+ resultSchema: walletConnectV2ResultSchema,
2467
+ method: walletMethods.wallet_connectV2
1418
2468
  });
1419
2469
 
1420
2470
  //#endregion
1421
- //#region src/request/types/stxMethods/signMessage.ts
1422
- const stxSignMessageMethodName = "stx_signMessage";
1423
- const stxSignMessageParamsSchema = v.object({ message: v.string() });
1424
- const stxSignMessageResultSchema = v.object({
1425
- signature: v.string(),
1426
- publicKey: v.string()
1427
- });
1428
- const stxSignMessageRequestMessageSchema = v.object({
1429
- ...rpcRequestMessageSchema.entries,
1430
- ...v.object({
1431
- method: v.literal(stxSignMessageMethodName),
1432
- params: stxSignMessageParamsSchema,
1433
- id: v.string()
1434
- }).entries
2471
+ //#region src/request/rpc/objects/namespaces/wallet/methods/disconnect/request.ts
2472
+ const walletDisconnectParamsSchema = v.nullish(v.null());
2473
+ const walletDisconnectRequestSchema = createRequestSchema({
2474
+ paramsSchema: walletDisconnectParamsSchema,
2475
+ method: walletMethods.wallet_disconnect
1435
2476
  });
1436
2477
 
1437
2478
  //#endregion
1438
- //#region src/request/types/stxMethods/signStructuredMessage.ts
1439
- const stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
1440
- const stxSignStructuredMessageParamsSchema = v.object({
1441
- domain: v.string(),
1442
- message: v.string(),
1443
- publicKey: v.optional(v.string())
1444
- });
1445
- const stxSignStructuredMessageResultSchema = v.object({
1446
- signature: v.string(),
1447
- publicKey: v.string()
1448
- });
1449
- const stxSignStructuredMessageRequestMessageSchema = v.object({
1450
- ...rpcRequestMessageSchema.entries,
1451
- ...v.object({
1452
- method: v.literal(stxSignStructuredMessageMethodName),
1453
- params: stxSignStructuredMessageParamsSchema,
1454
- id: v.string()
1455
- }).entries
2479
+ //#region src/request/rpc/objects/namespaces/wallet/methods/disconnect/response.ts
2480
+ const walletDisconnectResultSchema = v.nullish(v.null());
2481
+ const walletDisconnectSuccessResponseSchema = createSuccessResponseSchema({
2482
+ resultSchema: walletDisconnectResultSchema,
2483
+ method: walletMethods.wallet_disconnect
1456
2484
  });
1457
2485
 
1458
2486
  //#endregion
1459
- //#region src/request/types/stxMethods/signTransaction.ts
1460
- const stxSignTransactionMethodName = "stx_signTransaction";
1461
- const stxSignTransactionParamsSchema = v.object({
1462
- transaction: v.string(),
1463
- pubkey: v.optional(v.string()),
1464
- broadcast: v.optional(v.boolean())
1465
- });
1466
- const stxSignTransactionResultSchema = v.object({ transaction: v.string() });
1467
- const stxSignTransactionRequestMessageSchema = v.object({
1468
- ...rpcRequestMessageSchema.entries,
1469
- ...v.object({
1470
- method: v.literal(stxSignTransactionMethodName),
1471
- params: stxSignTransactionParamsSchema,
1472
- id: v.string()
1473
- }).entries
2487
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccount/request.ts
2488
+ const walletGetAccountParamsSchema = v.nullish(v.null());
2489
+ const walletGetAccountRequestSchema = createRequestSchema({
2490
+ paramsSchema: walletGetAccountParamsSchema,
2491
+ method: walletMethods.wallet_getAccount
1474
2492
  });
1475
2493
 
1476
2494
  //#endregion
1477
- //#region src/request/types/stxMethods/signTransactions.ts
1478
- const stxSignTransactionsMethodName = "stx_signTransactions";
1479
- const stxSignTransactionsParamsSchema = v.object({
1480
- transactions: v.pipe(v.array(v.pipe(v.string(), v.check((hex) => {
1481
- return true;
1482
- }, "Invalid hex-encoded Stacks transaction."))), v.minLength(1)),
1483
- broadcast: v.optional(v.boolean())
2495
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccount/response.ts
2496
+ const walletGetAccountResultSchema = v.object({
2497
+ id: v.string(),
2498
+ addresses: v.array(addressSchema),
2499
+ walletType: walletTypeSchema,
2500
+ network: walletGetNetworkResultSchema
1484
2501
  });
1485
- const stxSignTransactionsResultSchema = v.object({ transactions: v.array(v.string()) });
1486
- const stxSignTransactionsRequestMessageSchema = v.object({
1487
- ...rpcRequestMessageSchema.entries,
1488
- ...v.object({
1489
- method: v.literal(stxSignTransactionsMethodName),
1490
- params: stxSignTransactionsParamsSchema,
1491
- id: v.string()
1492
- }).entries
2502
+ const walletGetAccountSuccessResponseSchema = createSuccessResponseSchema({
2503
+ resultSchema: walletGetAccountResultSchema,
2504
+ method: walletMethods.wallet_getAccount
1493
2505
  });
1494
2506
 
1495
2507
  //#endregion
1496
- //#region src/request/types/stxMethods/transferStx.ts
1497
- const stxTransferStxMethodName = "stx_transferStx";
1498
- const stxTransferStxParamsSchema = v.object({
1499
- amount: v.union([v.number(), v.string()]),
1500
- recipient: v.string(),
1501
- memo: v.optional(v.string()),
1502
- version: v.optional(v.string()),
1503
- postConditionMode: v.optional(v.number()),
1504
- postConditions: v.optional(v.array(v.string())),
1505
- pubkey: v.optional(v.string())
2508
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccountV2/request.ts
2509
+ const walletGetAccountV2ParamsSchema = v.nullish(v.null());
2510
+ const walletGetAccountV2RequestSchema = createRequestSchema({
2511
+ paramsSchema: walletGetAccountV2ParamsSchema,
2512
+ method: walletMethods.wallet_getAccountV2
1506
2513
  });
1507
- const stxTransferStxResultSchema = v.object({
1508
- txid: v.string(),
1509
- transaction: v.string()
2514
+
2515
+ //#endregion
2516
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccountV2/response.ts
2517
+ const walletGetAccountV2ResultSchema = v.object({
2518
+ id: v.string(),
2519
+ addresses: v.array(addressSchema),
2520
+ walletType: walletTypeSchema,
2521
+ networks: walletGetNetworksResultSchema
1510
2522
  });
1511
- const stxTransferStxRequestMessageSchema = v.object({
1512
- ...rpcRequestMessageSchema.entries,
1513
- ...v.object({
1514
- method: v.literal(stxTransferStxMethodName),
1515
- params: stxTransferStxParamsSchema,
1516
- id: v.string()
1517
- }).entries
2523
+ const walletGetAccountV2SuccessResponseSchema = createSuccessResponseSchema({
2524
+ resultSchema: walletGetAccountV2ResultSchema,
2525
+ method: walletMethods.wallet_getAccountV2
1518
2526
  });
1519
2527
 
1520
2528
  //#endregion
1521
- //#region src/request/index.ts
1522
- const cache = {};
1523
- const requestInternal = async (provider, method, params) => {
1524
- const response = await provider.request(method, params);
1525
- if (v.is(rpcErrorResponseMessageSchema, response)) return {
1526
- status: "error",
1527
- error: response.error
1528
- };
1529
- if (v.is(rpcSuccessResponseMessageSchema, response)) return {
1530
- status: "success",
1531
- result: response.result
1532
- };
1533
- return {
1534
- status: "error",
1535
- error: {
1536
- code: RpcErrorCode.INTERNAL_ERROR,
1537
- message: "Received unknown response from provider.",
1538
- data: response
1539
- }
1540
- };
1541
- };
1542
- const request = async (method, params, providerId) => {
1543
- let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
1544
- if (providerId) provider = await getProviderById(providerId);
1545
- if (!provider) throw new Error("no wallet provider was found");
1546
- if (!method) throw new Error("A wallet method is required");
1547
- if (!cache.providerInfo) {
1548
- const infoResult = await requestInternal(provider, "getInfo", null);
1549
- if (infoResult.status === "success") cache.providerInfo = infoResult.result;
1550
- }
1551
- if (cache.providerInfo) {
1552
- if (method === "getInfo") return {
1553
- status: "success",
1554
- result: cache.providerInfo
1555
- };
1556
- const sanitized = sanitizeRequest(method, params, cache.providerInfo);
1557
- if (sanitized.overrideResponse) return sanitized.overrideResponse;
1558
- method = sanitized.method;
1559
- params = sanitized.params;
1560
- }
1561
- return requestInternal(provider, method, params);
1562
- };
1563
- /**
1564
- * Adds an event listener.
1565
- *
1566
- * Currently expects 2 arguments, although is also capable of handling legacy
1567
- * calls with 3 arguments consisting of:
1568
- *
1569
- * - event name (string)
1570
- * - callback (function)
1571
- * - provider ID (optional string)
1572
- */
1573
- const addListener = (...rawArgs) => {
1574
- const [listenerInfo, providerId] = (() => {
1575
- if (rawArgs.length === 1) return [rawArgs[0], void 0];
1576
- if (rawArgs.length === 2) if (typeof rawArgs[1] === "function") return [{
1577
- eventName: rawArgs[0],
1578
- cb: rawArgs[1]
1579
- }, void 0];
1580
- else return rawArgs;
1581
- if (rawArgs.length === 3) return [{
1582
- eventName: rawArgs[0],
1583
- cb: rawArgs[1]
1584
- }, rawArgs[2]];
1585
- throw new Error("Unexpected number of arguments. Expecting 2 (or 3 for legacy requests).", { cause: rawArgs });
1586
- })();
1587
- let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
1588
- if (providerId) provider = getProviderById(providerId);
1589
- if (!provider) throw new Error("no wallet provider was found");
1590
- if (!provider.addListener) {
1591
- console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
1592
- return () => {};
1593
- }
1594
- return provider.addListener(listenerInfo);
1595
- };
2529
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getCurrentPermissions/request.ts
2530
+ const walletGetCurrentPermissionsParamsSchema = v.nullish(v.null());
2531
+ const walletGetCurrentPermissionsRequestSchema = createRequestSchema({
2532
+ paramsSchema: walletGetCurrentPermissionsParamsSchema,
2533
+ method: walletMethods.wallet_getCurrentPermissions
2534
+ });
1596
2535
 
1597
2536
  //#endregion
1598
- //#region src/runes/api.ts
1599
- const urlNetworkSuffix = {
1600
- [BitcoinNetworkType.Mainnet]: "",
1601
- [BitcoinNetworkType.Testnet]: "-testnet",
1602
- [BitcoinNetworkType.Testnet4]: "-testnet4",
1603
- [BitcoinNetworkType.Signet]: "-signet"
1604
- };
1605
- const ORDINALS_API_BASE_URL = (network = BitcoinNetworkType.Mainnet) => {
1606
- if (network === BitcoinNetworkType.Regtest) throw new Error(`Ordinals API does not support ${network} network`);
1607
- return `https://ordinals${urlNetworkSuffix[network]}.xverse.app/v1`;
1608
- };
1609
- var RunesApi = class {
1610
- client;
1611
- constructor(network) {
1612
- this.client = axios.create({ baseURL: ORDINALS_API_BASE_URL(network) });
1613
- }
1614
- parseError = (error) => {
1615
- return {
1616
- code: error.response?.status,
1617
- message: JSON.stringify(error.response?.data)
1618
- };
1619
- };
1620
- estimateMintCost = async (mintParams) => {
1621
- try {
1622
- return { data: (await this.client.post("/runes/mint/estimate", { ...mintParams })).data };
1623
- } catch (error) {
1624
- const err = error;
1625
- return { error: this.parseError(err) };
1626
- }
1627
- };
1628
- estimateEtchCost = async (etchParams) => {
1629
- try {
1630
- return { data: (await this.client.post("/runes/etch/estimate", { ...etchParams })).data };
1631
- } catch (error) {
1632
- const err = error;
1633
- return { error: this.parseError(err) };
1634
- }
1635
- };
1636
- createMintOrder = async (mintOrderParams) => {
1637
- try {
1638
- return { data: (await this.client.post("/runes/mint/orders", { ...mintOrderParams })).data };
1639
- } catch (error) {
1640
- const err = error;
1641
- return { error: this.parseError(err) };
1642
- }
1643
- };
1644
- createEtchOrder = async (etchOrderParams) => {
1645
- try {
1646
- return { data: (await this.client.post("/runes/etch/orders", { ...etchOrderParams })).data };
1647
- } catch (error) {
1648
- const err = error;
1649
- return { error: this.parseError(err) };
1650
- }
1651
- };
1652
- executeMint = async (orderId, fundTransactionId) => {
1653
- try {
1654
- return { data: (await this.client.post(`/runes/mint/orders/${orderId}/execute`, { fundTransactionId })).data };
1655
- } catch (error) {
1656
- const err = error;
1657
- return { error: this.parseError(err) };
1658
- }
1659
- };
1660
- executeEtch = async (orderId, fundTransactionId) => {
1661
- try {
1662
- return { data: (await this.client.post(`/runes/etch/orders/${orderId}/execute`, { fundTransactionId })).data };
1663
- } catch (error) {
1664
- const err = error;
1665
- return { error: this.parseError(err) };
1666
- }
1667
- };
1668
- getOrder = async (orderId) => {
1669
- try {
1670
- return { data: (await this.client.get(`/orders/${orderId}`)).data };
1671
- } catch (error) {
1672
- const err = error;
1673
- return { error: this.parseError(err) };
1674
- }
1675
- };
1676
- rbfOrder = async (rbfRequest) => {
1677
- const { orderId, newFeeRate } = rbfRequest;
1678
- try {
1679
- return { data: (await this.client.post(`/orders/${orderId}/rbf-estimate`, { newFeeRate })).data };
1680
- } catch (error) {
1681
- const err = error;
1682
- return { error: this.parseError(err) };
1683
- }
1684
- };
1685
- };
1686
- const clients = {};
1687
- const getRunesApiClient = (network = BitcoinNetworkType.Mainnet) => {
1688
- if (!clients[network]) clients[network] = new RunesApi(network);
1689
- return clients[network];
1690
- };
2537
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getCurrentPermissions/response.ts
2538
+ const accountActionsSchema$1 = v.object({ read: v.optional(v.boolean()) });
2539
+ const walletActionsSchema$1 = v.object({ readNetwork: v.optional(v.boolean()) });
2540
+ const accountPermissionSchema = v.object({
2541
+ type: v.literal("account"),
2542
+ resourceId: v.string(),
2543
+ clientId: v.string(),
2544
+ actions: accountActionsSchema$1
2545
+ });
2546
+ const walletPermissionSchema = v.object({
2547
+ type: v.literal("wallet"),
2548
+ resourceId: v.string(),
2549
+ clientId: v.string(),
2550
+ actions: walletActionsSchema$1
2551
+ });
2552
+ const permissionSchema = v.variant("type", [accountPermissionSchema, walletPermissionSchema]);
2553
+ const walletGetCurrentPermissionsResultSchema = v.array(permissionSchema);
2554
+ const walletGetCurrentPermissionsSuccessResponseSchema = createSuccessResponseSchema({
2555
+ resultSchema: walletGetCurrentPermissionsResultSchema,
2556
+ method: walletMethods.wallet_getCurrentPermissions
2557
+ });
1691
2558
 
1692
2559
  //#endregion
1693
- //#region src/adapters/satsConnectAdapter.ts
1694
- var SatsConnectAdapter = class {
1695
- async mintRunes(params) {
1696
- try {
1697
- const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
1698
- if (walletInfo && walletInfo.status === "success") {
1699
- if (walletInfo.result.methods?.includes("runes_mint")) {
1700
- const response = await this.requestInternal("runes_mint", params);
1701
- if (response) {
1702
- if (response.status === "success") return response;
1703
- if (response.status === "error" && response.error.code !== RpcErrorCode.METHOD_NOT_FOUND) return response;
1704
- }
1705
- }
1706
- }
1707
- const mintRequest = {
1708
- destinationAddress: params.destinationAddress,
1709
- feeRate: params.feeRate,
1710
- refundAddress: params.refundAddress,
1711
- repeats: params.repeats,
1712
- runeName: params.runeName,
1713
- appServiceFee: params.appServiceFee,
1714
- appServiceFeeAddress: params.appServiceFeeAddress
1715
- };
1716
- const orderResponse = await new RunesApi(params.network).createMintOrder(mintRequest);
1717
- if (!orderResponse.data) return {
1718
- status: "error",
1719
- error: {
1720
- code: orderResponse.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1721
- message: orderResponse.error.message
1722
- }
1723
- };
1724
- const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
1725
- address: orderResponse.data.fundAddress,
1726
- amount: orderResponse.data.fundAmount
1727
- }] });
1728
- if (paymentResponse.status !== "success") return paymentResponse;
1729
- await new RunesApi(params.network).executeMint(orderResponse.data.orderId, paymentResponse.result.txid);
1730
- return {
1731
- status: "success",
1732
- result: {
1733
- orderId: orderResponse.data.orderId,
1734
- fundTransactionId: paymentResponse.result.txid,
1735
- fundingAddress: orderResponse.data.fundAddress
1736
- }
1737
- };
1738
- } catch (error) {
1739
- return {
1740
- status: "error",
1741
- error: {
1742
- code: RpcErrorCode.INTERNAL_ERROR,
1743
- message: error.message
1744
- }
1745
- };
1746
- }
1747
- }
1748
- async etchRunes(params) {
1749
- const etchRequest = {
1750
- destinationAddress: params.destinationAddress,
1751
- refundAddress: params.refundAddress,
1752
- feeRate: params.feeRate,
1753
- runeName: params.runeName,
1754
- divisibility: params.divisibility,
1755
- symbol: params.symbol,
1756
- premine: params.premine,
1757
- isMintable: params.isMintable,
1758
- terms: params.terms,
1759
- inscriptionDetails: params.inscriptionDetails,
1760
- delegateInscriptionId: params.delegateInscriptionId,
1761
- appServiceFee: params.appServiceFee,
1762
- appServiceFeeAddress: params.appServiceFeeAddress
1763
- };
1764
- try {
1765
- const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
1766
- if (walletInfo && walletInfo.status === "success") {
1767
- if (walletInfo.result.methods?.includes("runes_etch")) {
1768
- const response = await this.requestInternal("runes_etch", params);
1769
- if (response) {
1770
- if (response.status === "success") return response;
1771
- if (response.status === "error" && response.error.code !== RpcErrorCode.METHOD_NOT_FOUND) return response;
1772
- }
1773
- }
1774
- }
1775
- const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
1776
- if (!orderResponse.data) return {
1777
- status: "error",
1778
- error: {
1779
- code: orderResponse.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1780
- message: orderResponse.error.message
1781
- }
1782
- };
1783
- const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
1784
- address: orderResponse.data.fundAddress,
1785
- amount: orderResponse.data.fundAmount
1786
- }] });
1787
- if (paymentResponse.status !== "success") return paymentResponse;
1788
- await new RunesApi(params.network).executeEtch(orderResponse.data.orderId, paymentResponse.result.txid);
1789
- return {
1790
- status: "success",
1791
- result: {
1792
- orderId: orderResponse.data.orderId,
1793
- fundTransactionId: paymentResponse.result.txid,
1794
- fundingAddress: orderResponse.data.fundAddress
1795
- }
1796
- };
1797
- } catch (error) {
1798
- return {
1799
- status: "error",
1800
- error: {
1801
- code: RpcErrorCode.INTERNAL_ERROR,
1802
- message: error.message
1803
- }
1804
- };
1805
- }
1806
- }
1807
- async estimateMint(params) {
1808
- const estimateMintRequest = {
1809
- destinationAddress: params.destinationAddress,
1810
- feeRate: params.feeRate,
1811
- repeats: params.repeats,
1812
- runeName: params.runeName,
1813
- appServiceFee: params.appServiceFee,
1814
- appServiceFeeAddress: params.appServiceFeeAddress
1815
- };
1816
- const response = await getRunesApiClient(params.network).estimateMintCost(estimateMintRequest);
1817
- if (response.data) return {
1818
- status: "success",
1819
- result: response.data
1820
- };
1821
- return {
1822
- status: "error",
1823
- error: {
1824
- code: response.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1825
- message: response.error.message
1826
- }
1827
- };
1828
- }
1829
- async estimateEtch(params) {
1830
- const estimateEtchRequest = {
1831
- destinationAddress: params.destinationAddress,
1832
- feeRate: params.feeRate,
1833
- runeName: params.runeName,
1834
- divisibility: params.divisibility,
1835
- symbol: params.symbol,
1836
- premine: params.premine,
1837
- isMintable: params.isMintable,
1838
- terms: params.terms,
1839
- inscriptionDetails: params.inscriptionDetails,
1840
- delegateInscriptionId: params.delegateInscriptionId,
1841
- appServiceFee: params.appServiceFee,
1842
- appServiceFeeAddress: params.appServiceFeeAddress
1843
- };
1844
- const response = await getRunesApiClient(params.network).estimateEtchCost(estimateEtchRequest);
1845
- if (response.data) return {
1846
- status: "success",
1847
- result: response.data
1848
- };
1849
- return {
1850
- status: "error",
1851
- error: {
1852
- code: response.error.code === 400 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1853
- message: response.error.message
1854
- }
1855
- };
1856
- }
1857
- async getOrder(params) {
1858
- const response = await getRunesApiClient(params.network).getOrder(params.id);
1859
- if (response.data) return {
1860
- status: "success",
1861
- result: response.data
1862
- };
1863
- return {
1864
- status: "error",
1865
- error: {
1866
- code: response.error.code === 400 || response.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1867
- message: response.error.message
1868
- }
1869
- };
1870
- }
1871
- async estimateRbfOrder(params) {
1872
- const rbfOrderRequest = {
1873
- newFeeRate: params.newFeeRate,
1874
- orderId: params.orderId
1875
- };
1876
- const response = await getRunesApiClient(params.network).rbfOrder(rbfOrderRequest);
1877
- if (response.data) return {
1878
- status: "success",
1879
- result: {
1880
- fundingAddress: response.data.fundingAddress,
1881
- rbfCost: response.data.rbfCost
1882
- }
1883
- };
1884
- return {
1885
- status: "error",
1886
- error: {
1887
- code: response.error.code === 400 || response.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1888
- message: response.error.message
1889
- }
1890
- };
1891
- }
1892
- async rbfOrder(params) {
1893
- try {
1894
- const rbfOrderRequest = {
1895
- newFeeRate: params.newFeeRate,
1896
- orderId: params.orderId
1897
- };
1898
- const orderResponse = await getRunesApiClient(params.network).rbfOrder(rbfOrderRequest);
1899
- if (!orderResponse.data) return {
1900
- status: "error",
1901
- error: {
1902
- code: orderResponse.error.code === 400 || orderResponse.error.code === 404 ? RpcErrorCode.INVALID_REQUEST : RpcErrorCode.INTERNAL_ERROR,
1903
- message: orderResponse.error.message
1904
- }
1905
- };
1906
- const paymentResponse = await this.requestInternal("sendTransfer", { recipients: [{
1907
- address: orderResponse.data.fundingAddress,
1908
- amount: orderResponse.data.rbfCost
1909
- }] });
1910
- if (paymentResponse.status !== "success") return paymentResponse;
1911
- return {
1912
- status: "success",
1913
- result: {
1914
- fundingAddress: orderResponse.data.fundingAddress,
1915
- orderId: rbfOrderRequest.orderId,
1916
- fundRBFTransactionId: paymentResponse.result.txid
1917
- }
1918
- };
1919
- } catch (error) {
1920
- return {
1921
- status: "error",
1922
- error: {
1923
- code: RpcErrorCode.INTERNAL_ERROR,
1924
- message: error.message
1925
- }
1926
- };
1927
- }
1928
- }
1929
- async request(method, params) {
1930
- switch (method) {
1931
- case "runes_mint": return this.mintRunes(params);
1932
- case "runes_etch": return this.etchRunes(params);
1933
- case "runes_estimateMint": return this.estimateMint(params);
1934
- case "runes_estimateEtch": return this.estimateEtch(params);
1935
- case "runes_getOrder": return this.getOrder(params);
1936
- case "runes_estimateRbfOrder": return this.estimateRbfOrder(params);
1937
- case "runes_rbfOrder": return this.rbfOrder(params);
1938
- default: return this.requestInternal(method, params);
2560
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getWalletType/request.ts
2561
+ const walletGetWalletTypeParamsSchema = v.nullish(v.null());
2562
+ const walletGetWalletTypeRequestSchema = createRequestSchema({
2563
+ paramsSchema: walletGetWalletTypeParamsSchema,
2564
+ method: walletMethods.wallet_getWalletType
2565
+ });
2566
+
2567
+ //#endregion
2568
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getWalletType/response.ts
2569
+ const walletGetWalletTypeResultSchema = walletTypeSchema;
2570
+ const walletGetWalletTypeSuccessResponseSchema = createSuccessResponseSchema({
2571
+ resultSchema: walletGetWalletTypeResultSchema,
2572
+ method: walletMethods.wallet_getWalletType
2573
+ });
2574
+
2575
+ //#endregion
2576
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBridge/request.ts
2577
+ const walletOpenBridgeParamsSchema = v.object({
2578
+ fromAsset: v.string(),
2579
+ toAsset: v.string()
2580
+ });
2581
+ const walletOpenBridgeRequestSchema = createRequestSchema({
2582
+ paramsSchema: walletOpenBridgeParamsSchema,
2583
+ method: walletMethods.wallet_openBridge
2584
+ });
2585
+
2586
+ //#endregion
2587
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBridge/response.ts
2588
+ const walletOpenBridgeResultSchema = v.nullish(v.null());
2589
+ const walletOpenBridgeSuccessResponseSchema = createSuccessResponseSchema({
2590
+ resultSchema: walletOpenBridgeResultSchema,
2591
+ method: walletMethods.wallet_openBridge
2592
+ });
2593
+
2594
+ //#endregion
2595
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBuy/request.ts
2596
+ const walletOpenBuyParamsSchema = v.object({ asset: v.string() });
2597
+ const walletOpenBuyRequestSchema = createRequestSchema({
2598
+ paramsSchema: walletOpenBuyParamsSchema,
2599
+ method: walletMethods.wallet_openBuy
2600
+ });
2601
+
2602
+ //#endregion
2603
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBuy/response.ts
2604
+ const walletOpenBuyResultSchema = v.nullish(v.null());
2605
+ const walletOpenBuySuccessResponseSchema = createSuccessResponseSchema({
2606
+ resultSchema: walletOpenBuyResultSchema,
2607
+ method: walletMethods.wallet_openBuy
2608
+ });
2609
+
2610
+ //#endregion
2611
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openReceive/request.ts
2612
+ const walletOpenReceiveParamsSchema = v.object({ address: v.string() });
2613
+ const walletOpenReceiveRequestSchema = createRequestSchema({
2614
+ paramsSchema: walletOpenReceiveParamsSchema,
2615
+ method: walletMethods.wallet_openReceive
2616
+ });
2617
+
2618
+ //#endregion
2619
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openReceive/response.ts
2620
+ const walletOpenReceiveResultSchema = addressSchema;
2621
+ const walletOpenReceiveSuccessResponseSchema = createSuccessResponseSchema({
2622
+ resultSchema: walletOpenReceiveResultSchema,
2623
+ method: walletMethods.wallet_openReceive
2624
+ });
2625
+
2626
+ //#endregion
2627
+ //#region src/request/rpc/objects/namespaces/wallet/methods/renouncePermissions/request.ts
2628
+ const walletRenouncePermissionsParamsSchema = v.nullish(v.null());
2629
+ const walletRenouncePermissionsRequestSchema = createRequestSchema({
2630
+ paramsSchema: walletRenouncePermissionsParamsSchema,
2631
+ method: walletMethods.wallet_renouncePermissions
2632
+ });
2633
+
2634
+ //#endregion
2635
+ //#region src/request/rpc/objects/namespaces/wallet/methods/renouncePermissions/response.ts
2636
+ const walletRenouncePermissionsResultSchema = v.nullish(v.null());
2637
+ const walletRenouncePermissionsSuccessResponseSchema = createSuccessResponseSchema({
2638
+ resultSchema: walletRenouncePermissionsResultSchema,
2639
+ method: walletMethods.wallet_renouncePermissions
2640
+ });
2641
+
2642
+ //#endregion
2643
+ //#region src/request/rpc/objects/namespaces/wallet/methods/requestPermissions/request.ts
2644
+ const accountActionsSchema = v.object({ read: v.optional(v.boolean()) });
2645
+ const walletActionsSchema = v.object({ readNetwork: v.optional(v.boolean()) });
2646
+ const accountPermissionRequestSchema = v.object({
2647
+ type: v.literal("account"),
2648
+ resourceId: v.string(),
2649
+ actions: accountActionsSchema
2650
+ });
2651
+ const walletPermissionRequestSchema = v.object({
2652
+ type: v.literal("wallet"),
2653
+ resourceId: v.string(),
2654
+ actions: walletActionsSchema
2655
+ });
2656
+ const permissionRequestParamsSchema$1 = v.variant("type", [accountPermissionRequestSchema, walletPermissionRequestSchema]);
2657
+ const walletRequestPermissionsParamsSchema = v.nullish(v.array(permissionRequestParamsSchema$1));
2658
+ const walletRequestPermissionsRequestSchema = createRequestSchema({
2659
+ paramsSchema: walletRequestPermissionsParamsSchema,
2660
+ method: walletMethods.wallet_requestPermissions
2661
+ });
2662
+
2663
+ //#endregion
2664
+ //#region src/request/rpc/objects/namespaces/wallet/methods/requestPermissions/response.ts
2665
+ const walletRequestPermissionsResultSchema = v.literal(true);
2666
+ const walletRequestPermissionsSuccessResponseSchema = createSuccessResponseSchema({
2667
+ resultSchema: walletRequestPermissionsResultSchema,
2668
+ method: walletMethods.wallet_requestPermissions
2669
+ });
2670
+
2671
+ //#endregion
2672
+ //#region src/request/rpc/objects/namespaces/wallet/index.ts
2673
+ const walletRequestSchema = v.variant("method", [
2674
+ walletAddNetworkRequestSchema,
2675
+ walletAddNetworkV2RequestSchema,
2676
+ walletChangeNetworkByIdRequestSchema,
2677
+ walletChangeNetworkRequestSchema,
2678
+ walletConnectRequestSchema,
2679
+ walletConnectV2RequestSchema,
2680
+ walletDisconnectRequestSchema,
2681
+ walletGetAccountRequestSchema,
2682
+ walletGetAccountV2RequestSchema,
2683
+ walletGetCurrentPermissionsRequestSchema,
2684
+ walletGetNetworkRequestSchema,
2685
+ walletGetNetworksRequestSchema,
2686
+ walletGetWalletTypeRequestSchema,
2687
+ walletOpenBridgeRequestSchema,
2688
+ walletOpenBuyRequestSchema,
2689
+ walletOpenReceiveRequestSchema,
2690
+ walletRenouncePermissionsRequestSchema,
2691
+ walletRequestPermissionsRequestSchema
2692
+ ]);
2693
+ const walletSuccessResponseSchema = v.variant("~sats-connect-method", [
2694
+ walletAddNetworkSuccessResponseSchema,
2695
+ walletAddNetworkV2SuccessResponseSchema,
2696
+ walletChangeNetworkByIdSuccessResponseSchema,
2697
+ walletChangeNetworkSuccessResponseSchema,
2698
+ walletConnectSuccessResponseSchema,
2699
+ walletConnectV2SuccessResponseSchema,
2700
+ walletDisconnectSuccessResponseSchema,
2701
+ walletGetAccountSuccessResponseSchema,
2702
+ walletGetAccountV2SuccessResponseSchema,
2703
+ walletGetCurrentPermissionsSuccessResponseSchema,
2704
+ walletGetNetworkSuccessResponseSchema,
2705
+ walletGetNetworksSuccessResponseSchema,
2706
+ walletGetWalletTypeSuccessResponseSchema,
2707
+ walletOpenBridgeSuccessResponseSchema,
2708
+ walletOpenBuySuccessResponseSchema,
2709
+ walletOpenReceiveSuccessResponseSchema,
2710
+ walletRenouncePermissionsSuccessResponseSchema,
2711
+ walletRequestPermissionsSuccessResponseSchema
2712
+ ]);
2713
+
2714
+ //#endregion
2715
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddresses/response.ts
2716
+ const sparkGetAddressesResultSchema = v.object({
2717
+ addresses: v.array(addressSchema),
2718
+ network: walletGetNetworkResultSchema
2719
+ });
2720
+ const sparkGetAddressesSuccessResponseSchema = createSuccessResponseSchema({
2721
+ resultSchema: sparkGetAddressesResultSchema,
2722
+ method: sparkMethods.spark_getAddresses
2723
+ });
2724
+
2725
+ //#endregion
2726
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddressesV2/request.ts
2727
+ const sparkGetAddressesV2ParamsSchema = v.nullish(v.object({ message: v.optional(v.string()) }));
2728
+ const sparkGetAddressesV2RequestSchema = createRequestSchema({
2729
+ paramsSchema: sparkGetAddressesV2ParamsSchema,
2730
+ method: sparkMethods.spark_getAddressesV2
2731
+ });
2732
+
2733
+ //#endregion
2734
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddressesV2/response.ts
2735
+ const sparkGetAddressesV2ResultSchema = v.object({
2736
+ addresses: v.array(addressSchema),
2737
+ network: sparkNetworkConfigurationSchema
2738
+ });
2739
+ const sparkGetAddressesV2SuccessResponseSchema = createSuccessResponseSchema({
2740
+ resultSchema: sparkGetAddressesV2ResultSchema,
2741
+ method: sparkMethods.spark_getAddressesV2
2742
+ });
2743
+
2744
+ //#endregion
2745
+ //#region src/request/rpc/objects/namespaces/spark/methods/getBalance/request.ts
2746
+ const sparkGetBalanceParamsSchema = v.nullish(v.null());
2747
+ const sparkGetBalanceRequestSchema = createRequestSchema({
2748
+ paramsSchema: sparkGetBalanceParamsSchema,
2749
+ method: sparkMethods.spark_getBalance
2750
+ });
2751
+
2752
+ //#endregion
2753
+ //#region src/request/rpc/objects/namespaces/spark/methods/getBalance/response.ts
2754
+ const sparkGetBalanceResultSchema = v.object({
2755
+ balance: v.string(),
2756
+ tokenBalances: v.array(v.object({
2757
+ balance: v.string(),
2758
+ tokenMetadata: v.object({
2759
+ tokenIdentifier: v.string(),
2760
+ tokenName: v.string(),
2761
+ tokenTicker: v.string(),
2762
+ decimals: v.number(),
2763
+ maxSupply: v.string()
2764
+ })
2765
+ }))
2766
+ });
2767
+ const sparkGetBalanceSuccessResponseSchema = createSuccessResponseSchema({
2768
+ resultSchema: sparkGetBalanceResultSchema,
2769
+ method: sparkMethods.spark_getBalance
2770
+ });
2771
+
2772
+ //#endregion
2773
+ //#region src/request/rpc/objects/namespaces/spark/methods/signMessage/request.ts
2774
+ const sparkSignMessageParamsSchema = v.object({ message: v.string() });
2775
+ const sparkSignMessageRequestSchema = createRequestSchema({
2776
+ paramsSchema: sparkSignMessageParamsSchema,
2777
+ method: sparkMethods.spark_signMessage
2778
+ });
2779
+
2780
+ //#endregion
2781
+ //#region src/request/rpc/objects/namespaces/spark/methods/signMessage/response.ts
2782
+ const sparkSignMessageResultSchema = v.object({ signature: v.string() });
2783
+ const sparkSignMessageSuccessResponseSchema = createSuccessResponseSchema({
2784
+ resultSchema: sparkSignMessageResultSchema,
2785
+ method: sparkMethods.spark_signMessage
2786
+ });
2787
+
2788
+ //#endregion
2789
+ //#region src/request/rpc/objects/namespaces/spark/methods/transfer/request.ts
2790
+ const sparkTransferParamsSchema = v.object({
2791
+ amountSats: v.union([v.number(), v.string()]),
2792
+ receiverSparkAddress: v.string()
2793
+ });
2794
+ const sparkTransferRequestSchema = createRequestSchema({
2795
+ paramsSchema: sparkTransferParamsSchema,
2796
+ method: sparkMethods.spark_transfer
2797
+ });
2798
+
2799
+ //#endregion
2800
+ //#region src/request/rpc/objects/namespaces/spark/methods/transfer/response.ts
2801
+ const sparkTransferResultSchema = v.object({ id: v.string() });
2802
+ const sparkTransferSuccessResponseSchema = createSuccessResponseSchema({
2803
+ resultSchema: sparkTransferResultSchema,
2804
+ method: sparkMethods.spark_transfer
2805
+ });
2806
+
2807
+ //#endregion
2808
+ //#region src/request/rpc/objects/namespaces/spark/methods/transferToken/request.ts
2809
+ const sparkTransferTokenParamsSchema = v.object({
2810
+ tokenAmount: v.union([v.number(), v.string()]),
2811
+ tokenIdentifier: v.string(),
2812
+ receiverSparkAddress: v.string()
2813
+ });
2814
+ const sparkTransferTokenRequestSchema = createRequestSchema({
2815
+ paramsSchema: sparkTransferTokenParamsSchema,
2816
+ method: sparkMethods.spark_transferToken
2817
+ });
2818
+
2819
+ //#endregion
2820
+ //#region src/request/rpc/objects/namespaces/spark/methods/transferToken/response.ts
2821
+ const sparkTransferTokenResultSchema = v.object({ id: v.string() });
2822
+ const sparkTransferTokenSuccessResponseSchema = createSuccessResponseSchema({
2823
+ resultSchema: sparkTransferTokenResultSchema,
2824
+ method: sparkMethods.spark_transferToken
2825
+ });
2826
+
2827
+ //#endregion
2828
+ //#region src/request/rpc/objects/namespaces/spark/index.ts
2829
+ const sparkRequestSchema = v.variant("method", [
2830
+ sparkGetAddressesRequestSchema,
2831
+ sparkGetAddressesV2RequestSchema,
2832
+ sparkGetBalanceRequestSchema,
2833
+ sparkTransferRequestSchema,
2834
+ sparkTransferTokenRequestSchema,
2835
+ sparkSignMessageRequestSchema,
2836
+ sparkFlashnetGetJwtRequestSchema,
2837
+ sparkFlashnetSignIntentRequestSchema,
2838
+ sparkFlashnetSignStructuredMessageRequestSchema,
2839
+ sparkFlashnetExecuteSwapRequestSchema,
2840
+ sparkFlashnetExecuteRouteSwapRequestSchema,
2841
+ sparkFlashnetClawbackFundsRequestSchema,
2842
+ sparkGetClawbackEligibleTransfersRequestSchema
2843
+ ]);
2844
+ const sparkSuccessResponseSchema = v.variant("~sats-connect-method", [
2845
+ sparkGetAddressesSuccessResponseSchema,
2846
+ sparkGetAddressesV2SuccessResponseSchema,
2847
+ sparkGetBalanceSuccessResponseSchema,
2848
+ sparkTransferSuccessResponseSchema,
2849
+ sparkTransferTokenSuccessResponseSchema,
2850
+ sparkSignMessageSuccessResponseSchema,
2851
+ sparkFlashnetGetJwtSuccessResponseSchema,
2852
+ sparkFlashnetSignIntentSuccessResponseSchema,
2853
+ sparkFlashnetSignStructuredMessageSuccessResponseSchema,
2854
+ sparkFlashnetExecuteSwapSuccessResponseSchema,
2855
+ sparkFlashnetExecuteRouteSwapSuccessResponseSchema,
2856
+ sparkFlashnetClawbackFundsSuccessResponseSchema,
2857
+ sparkGetClawbackEligibleTransfersSuccessResponseSchema
2858
+ ]);
2859
+
2860
+ //#endregion
2861
+ //#region src/request/rpc/objects/namespaces/stacks/methods/callContract/request.ts
2862
+ const stacksCallContractParamsSchema = v.object({
2863
+ contract: v.string(),
2864
+ functionName: v.string(),
2865
+ arguments: v.optional(v.array(v.string())),
2866
+ functionArgs: v.optional(v.array(v.string())),
2867
+ postConditions: v.optional(v.array(v.string())),
2868
+ postConditionMode: v.optional(v.union([v.literal("allow"), v.literal("deny")]))
2869
+ });
2870
+ const stacksCallContractRequestSchema = createRequestSchema({
2871
+ paramsSchema: stacksCallContractParamsSchema,
2872
+ method: stacksMethods.stx_callContract
2873
+ });
2874
+
2875
+ //#endregion
2876
+ //#region src/request/rpc/objects/namespaces/stacks/methods/callContract/response.ts
2877
+ const stacksCallContractResultSchema = v.object({
2878
+ txid: v.string(),
2879
+ transaction: v.string()
2880
+ });
2881
+ const stacksCallContractSuccessResponseSchema = createSuccessResponseSchema({
2882
+ resultSchema: stacksCallContractResultSchema,
2883
+ method: stacksMethods.stx_callContract
2884
+ });
2885
+
2886
+ //#endregion
2887
+ //#region src/request/rpc/objects/namespaces/stacks/methods/deployContract/request.ts
2888
+ const stacksDeployContractParamsSchema = v.object({
2889
+ name: v.string(),
2890
+ clarityCode: v.string(),
2891
+ clarityVersion: v.optional(v.number()),
2892
+ postConditions: v.optional(v.array(v.string())),
2893
+ postConditionMode: v.optional(v.union([v.literal("allow"), v.literal("deny")]))
2894
+ });
2895
+ const stacksDeployContractRequestSchema = createRequestSchema({
2896
+ paramsSchema: stacksDeployContractParamsSchema,
2897
+ method: stacksMethods.stx_deployContract
2898
+ });
2899
+
2900
+ //#endregion
2901
+ //#region src/request/rpc/objects/namespaces/stacks/methods/deployContract/response.ts
2902
+ const stacksDeployContractResultSchema = v.object({
2903
+ txid: v.string(),
2904
+ transaction: v.string()
2905
+ });
2906
+ const stacksDeployContractSuccessResponseSchema = createSuccessResponseSchema({
2907
+ resultSchema: stacksDeployContractResultSchema,
2908
+ method: stacksMethods.stx_deployContract
2909
+ });
2910
+
2911
+ //#endregion
2912
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAccounts/request.ts
2913
+ const stacksGetAccountsParamsSchema = v.nullish(v.null());
2914
+ const stacksGetAccountsRequestSchema = createRequestSchema({
2915
+ paramsSchema: stacksGetAccountsParamsSchema,
2916
+ method: stacksMethods.stx_getAccounts
2917
+ });
2918
+
2919
+ //#endregion
2920
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAccounts/response.ts
2921
+ const stacksGetAccountsResultSchema = v.object({
2922
+ addresses: v.array(v.object({
2923
+ address: v.string(),
2924
+ publicKey: v.string(),
2925
+ gaiaHubUrl: v.string(),
2926
+ gaiaAppKey: v.string()
2927
+ })),
2928
+ network: walletGetNetworkResultSchema
2929
+ });
2930
+ const stacksGetAccountsSuccessResponseSchema = createSuccessResponseSchema({
2931
+ resultSchema: stacksGetAccountsResultSchema,
2932
+ method: stacksMethods.stx_getAccounts
2933
+ });
2934
+
2935
+ //#endregion
2936
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAddresses/request.ts
2937
+ const stacksGetAddressesParamsSchema = v.nullish(v.object({ message: v.optional(v.string()) }));
2938
+ const stacksGetAddressesRequestSchema = createRequestSchema({
2939
+ paramsSchema: stacksGetAddressesParamsSchema,
2940
+ method: stacksMethods.stx_getAddresses
2941
+ });
2942
+
2943
+ //#endregion
2944
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAddresses/response.ts
2945
+ const stacksGetAddressesResultSchema = v.object({
2946
+ addresses: v.array(addressSchema),
2947
+ network: walletGetNetworkResultSchema
2948
+ });
2949
+ const stacksGetAddressesSuccessResponseSchema = createSuccessResponseSchema({
2950
+ resultSchema: stacksGetAddressesResultSchema,
2951
+ method: stacksMethods.stx_getAddresses
2952
+ });
2953
+
2954
+ //#endregion
2955
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAddressesV2/request.ts
2956
+ const stacksGetAddressesV2ParamsSchema = v.nullish(v.object({ message: v.optional(v.string()) }));
2957
+ const stacksGetAddressesV2RequestSchema = createRequestSchema({
2958
+ paramsSchema: stacksGetAddressesV2ParamsSchema,
2959
+ method: stacksMethods.stacks_getAddressesV2
2960
+ });
2961
+
2962
+ //#endregion
2963
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAddressesV2/response.ts
2964
+ const stacksGetAddressesV2ResultSchema = v.object({
2965
+ addresses: v.array(addressSchema),
2966
+ network: v.object({
2967
+ type: v.union([
2968
+ v.literal("Mainnet"),
2969
+ v.literal("Testnet"),
2970
+ v.literal("Devnet"),
2971
+ v.literal("Signet")
2972
+ ]),
2973
+ chain: v.union([v.literal("bitcoin"), v.literal("stacks")])
2974
+ })
2975
+ });
2976
+ const stacksGetAddressesV2SuccessResponseSchema = createSuccessResponseSchema({
2977
+ resultSchema: stacksGetAddressesV2ResultSchema,
2978
+ method: stacksMethods.stacks_getAddressesV2
2979
+ });
2980
+
2981
+ //#endregion
2982
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signMessage/request.ts
2983
+ const stacksSignMessageParamsSchema = v.object({ message: v.string() });
2984
+ const stacksSignMessageRequestSchema = createRequestSchema({
2985
+ paramsSchema: stacksSignMessageParamsSchema,
2986
+ method: stacksMethods.stx_signMessage
2987
+ });
2988
+
2989
+ //#endregion
2990
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signMessage/response.ts
2991
+ const stacksSignMessageResultSchema = v.object({
2992
+ signature: v.string(),
2993
+ publicKey: v.string()
2994
+ });
2995
+ const stacksSignMessageSuccessResponseSchema = createSuccessResponseSchema({
2996
+ resultSchema: stacksSignMessageResultSchema,
2997
+ method: stacksMethods.stx_signMessage
2998
+ });
2999
+
3000
+ //#endregion
3001
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signStructuredMessage/request.ts
3002
+ const stacksSignStructuredMessageParamsSchema = v.object({
3003
+ domain: v.string(),
3004
+ message: v.string(),
3005
+ publicKey: v.optional(v.string())
3006
+ });
3007
+ const stacksSignStructuredMessageRequestSchema = createRequestSchema({
3008
+ paramsSchema: stacksSignStructuredMessageParamsSchema,
3009
+ method: stacksMethods.stx_signStructuredMessage
3010
+ });
3011
+
3012
+ //#endregion
3013
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signStructuredMessage/response.ts
3014
+ const stacksSignStructuredMessageResultSchema = v.object({
3015
+ signature: v.string(),
3016
+ publicKey: v.string()
3017
+ });
3018
+ const stacksSignStructuredMessageSuccessResponseSchema = createSuccessResponseSchema({
3019
+ resultSchema: stacksSignStructuredMessageResultSchema,
3020
+ method: stacksMethods.stx_signStructuredMessage
3021
+ });
3022
+
3023
+ //#endregion
3024
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransaction/request.ts
3025
+ const stacksSignTransactionParamsSchema = v.object({
3026
+ transaction: v.string(),
3027
+ pubkey: v.optional(v.string()),
3028
+ broadcast: v.optional(v.boolean())
3029
+ });
3030
+ const stacksSignTransactionRequestSchema = createRequestSchema({
3031
+ paramsSchema: stacksSignTransactionParamsSchema,
3032
+ method: stacksMethods.stx_signTransaction
3033
+ });
3034
+
3035
+ //#endregion
3036
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransaction/response.ts
3037
+ const stacksSignTransactionResultSchema = v.object({ transaction: v.string() });
3038
+ const stacksSignTransactionSuccessResponseSchema = createSuccessResponseSchema({
3039
+ resultSchema: stacksSignTransactionResultSchema,
3040
+ method: stacksMethods.stx_signTransaction
3041
+ });
3042
+
3043
+ //#endregion
3044
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransactions/request.ts
3045
+ const stacksSignTransactionsParamsSchema = v.object({
3046
+ transactions: v.pipe(v.array(v.pipe(v.string(), v.check(() => {
3047
+ return true;
3048
+ }, "Invalid hex-encoded Stacks transaction."))), v.minLength(1)),
3049
+ broadcast: v.optional(v.boolean())
3050
+ });
3051
+ const stacksSignTransactionsRequestSchema = createRequestSchema({
3052
+ paramsSchema: stacksSignTransactionsParamsSchema,
3053
+ method: stacksMethods.stx_signTransactions
3054
+ });
3055
+
3056
+ //#endregion
3057
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransactions/response.ts
3058
+ const stacksSignTransactionsResultSchema = v.object({ transactions: v.array(v.string()) });
3059
+ const stacksSignTransactionsSuccessResponseSchema = createSuccessResponseSchema({
3060
+ resultSchema: stacksSignTransactionsResultSchema,
3061
+ method: stacksMethods.stx_signTransactions
3062
+ });
3063
+
3064
+ //#endregion
3065
+ //#region src/request/rpc/objects/namespaces/stacks/methods/transferStx/request.ts
3066
+ const stacksTransferStxParamsSchema = v.object({
3067
+ amount: v.union([v.number(), v.string()]),
3068
+ recipient: v.string(),
3069
+ memo: v.optional(v.string()),
3070
+ version: v.optional(v.string()),
3071
+ postConditionMode: v.optional(v.number()),
3072
+ postConditions: v.optional(v.array(v.string())),
3073
+ pubkey: v.optional(v.string())
3074
+ });
3075
+ const stacksTransferStxRequestSchema = createRequestSchema({
3076
+ paramsSchema: stacksTransferStxParamsSchema,
3077
+ method: stacksMethods.stx_transferStx
3078
+ });
3079
+
3080
+ //#endregion
3081
+ //#region src/request/rpc/objects/namespaces/stacks/methods/transferStx/response.ts
3082
+ const stacksTransferStxResultSchema = v.object({
3083
+ txid: v.string(),
3084
+ transaction: v.string()
3085
+ });
3086
+ const stacksTransferStxSuccessResponseSchema = createSuccessResponseSchema({
3087
+ resultSchema: stacksTransferStxResultSchema,
3088
+ method: stacksMethods.stx_transferStx
3089
+ });
3090
+
3091
+ //#endregion
3092
+ //#region src/request/rpc/objects/namespaces/stacks/index.ts
3093
+ const stacksRequestSchema = v.variant("method", [
3094
+ stacksCallContractRequestSchema,
3095
+ stacksDeployContractRequestSchema,
3096
+ stacksGetAccountsRequestSchema,
3097
+ stacksGetAddressesRequestSchema,
3098
+ stacksGetAddressesV2RequestSchema,
3099
+ stacksSignMessageRequestSchema,
3100
+ stacksSignStructuredMessageRequestSchema,
3101
+ stacksSignTransactionRequestSchema,
3102
+ stacksSignTransactionsRequestSchema,
3103
+ stacksTransferStxRequestSchema
3104
+ ]);
3105
+ const stacksSuccessResponseSchema = v.variant("~sats-connect-method", [
3106
+ stacksCallContractSuccessResponseSchema,
3107
+ stacksDeployContractSuccessResponseSchema,
3108
+ stacksGetAccountsSuccessResponseSchema,
3109
+ stacksGetAddressesSuccessResponseSchema,
3110
+ stacksGetAddressesV2SuccessResponseSchema,
3111
+ stacksSignMessageSuccessResponseSchema,
3112
+ stacksSignStructuredMessageSuccessResponseSchema,
3113
+ stacksSignTransactionSuccessResponseSchema,
3114
+ stacksSignTransactionsSuccessResponseSchema,
3115
+ stacksTransferStxSuccessResponseSchema
3116
+ ]);
3117
+
3118
+ //#endregion
3119
+ //#region src/request/rpc/requests.ts
3120
+ const rpcRequestSchema = v.variant("method", [
3121
+ bitcoinRequestSchema,
3122
+ stacksRequestSchema,
3123
+ sparkRequestSchema,
3124
+ runesRequestSchema,
3125
+ ordinalsRequestSchema,
3126
+ walletRequestSchema
3127
+ ]);
3128
+ function createRpcRequest({ method, params, id }) {
3129
+ return {
3130
+ jsonrpc: "2.0",
3131
+ method,
3132
+ params,
3133
+ id
3134
+ };
3135
+ }
3136
+
3137
+ //#endregion
3138
+ //#region src/request/rpc/responses.ts
3139
+ const rpcSuccessResponseSchema = v.variant("~sats-connect-method", [
3140
+ bitcoinSuccessResponseSchema,
3141
+ stacksSuccessResponseSchema,
3142
+ sparkSuccessResponseSchema,
3143
+ runesSuccessResponseSchema,
3144
+ ordinalsSuccessResponseSchema,
3145
+ walletSuccessResponseSchema
3146
+ ]);
3147
+ function createRpcSuccessResponse({ method, result, id }) {
3148
+ return {
3149
+ jsonrpc: "2.0",
3150
+ id,
3151
+ result,
3152
+ "~sats-connect-method": method
3153
+ };
3154
+ }
3155
+
3156
+ //#endregion
3157
+ //#region src/request/index.ts
3158
+ const cache = {};
3159
+ const requestInternal = async (provider, method, params) => {
3160
+ const response = await provider.request(method, params);
3161
+ if (v.is(specErrorResponseSchema, response)) return {
3162
+ status: "error",
3163
+ error: response.error
3164
+ };
3165
+ if (v.is(specSuccessWithExtensionsResponseSchema, response)) return {
3166
+ status: "success",
3167
+ result: response.result
3168
+ };
3169
+ return {
3170
+ status: "error",
3171
+ error: {
3172
+ code: RpcErrorCode.INTERNAL_ERROR,
3173
+ message: "Received unknown response from provider.",
3174
+ data: response
1939
3175
  }
3176
+ };
3177
+ };
3178
+ const request = async (method, params, providerId) => {
3179
+ let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
3180
+ if (providerId) provider = await getProviderById(providerId);
3181
+ if (!provider) throw new Error("no wallet provider was found");
3182
+ if (!method) throw new Error("A wallet method is required");
3183
+ if (!cache.providerInfo) {
3184
+ const infoResult = await requestInternal(provider, "getInfo", null);
3185
+ if (infoResult.status === "success") cache.providerInfo = infoResult.result;
3186
+ }
3187
+ if (cache.providerInfo) {
3188
+ if (method === "getInfo") return {
3189
+ status: "success",
3190
+ result: cache.providerInfo
3191
+ };
3192
+ const sanitized = sanitizeRequest(method, params, cache.providerInfo);
3193
+ if (sanitized.overrideResponse) return sanitized.overrideResponse;
3194
+ method = sanitized.method;
3195
+ params = sanitized.params;
3196
+ }
3197
+ return requestInternal(provider, method, params);
3198
+ };
3199
+ /**
3200
+ * Adds an event listener.
3201
+ *
3202
+ * Currently expects 2 arguments, although is also capable of handling legacy
3203
+ * calls with 3 arguments consisting of:
3204
+ *
3205
+ * - event name (string)
3206
+ * - callback (function)
3207
+ * - provider ID (optional string)
3208
+ */
3209
+ const addListener = (...rawArgs) => {
3210
+ const [listenerInfo, providerId] = (() => {
3211
+ if (rawArgs.length === 1) return [rawArgs[0], void 0];
3212
+ if (rawArgs.length === 2) if (typeof rawArgs[1] === "function") return [{
3213
+ eventName: rawArgs[0],
3214
+ cb: rawArgs[1]
3215
+ }, void 0];
3216
+ else return rawArgs;
3217
+ if (rawArgs.length === 3) return [{
3218
+ eventName: rawArgs[0],
3219
+ cb: rawArgs[1]
3220
+ }, rawArgs[2]];
3221
+ throw new Error("Unexpected number of arguments. Expecting 2 (or 3 for legacy requests).", { cause: rawArgs });
3222
+ })();
3223
+ let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
3224
+ if (providerId) provider = getProviderById(providerId);
3225
+ if (!provider) throw new Error("no wallet provider was found");
3226
+ if (!provider.addListener) {
3227
+ console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
3228
+ return () => {};
1940
3229
  }
3230
+ return provider.addListener(listenerInfo);
1941
3231
  };
1942
3232
 
1943
3233
  //#endregion
@@ -1952,182 +3242,6 @@ var XverseAdapter = class extends SatsConnectAdapter {
1952
3242
  };
1953
3243
  };
1954
3244
 
1955
- //#endregion
1956
- //#region src/adapters/unisat.ts
1957
- function convertSignInputsToInputType(signInputs) {
1958
- let result = [];
1959
- if (!signInputs) return result;
1960
- for (let address in signInputs) {
1961
- let indexes = signInputs[address];
1962
- for (let index of indexes) result.push({
1963
- index,
1964
- address
1965
- });
1966
- }
1967
- return result;
1968
- }
1969
- var UnisatAdapter = class extends SatsConnectAdapter {
1970
- id = DefaultAdaptersInfo.unisat.id;
1971
- async getAccounts(params) {
1972
- const { purposes } = params;
1973
- if (purposes.includes(AddressPurpose.Stacks) || purposes.includes(AddressPurpose.Starknet) || purposes.includes(AddressPurpose.Spark)) throw new Error("Only bitcoin addresses are supported");
1974
- const accounts = await window.unisat.requestAccounts();
1975
- const publicKey = await window.unisat.getPublicKey();
1976
- const address = accounts[0];
1977
- const addressType = getAddressInfo(accounts[0]).type;
1978
- const pk = addressType === AddressType$1.p2tr ? publicKey.slice(2) : publicKey;
1979
- const paymentAddress = {
1980
- address,
1981
- publicKey: pk,
1982
- addressType,
1983
- purpose: AddressPurpose.Payment,
1984
- walletType: "software"
1985
- };
1986
- const ordinalsAddress = {
1987
- address,
1988
- publicKey: pk,
1989
- addressType,
1990
- purpose: AddressPurpose.Ordinals,
1991
- walletType: "software"
1992
- };
1993
- const response = [];
1994
- if (purposes.includes(AddressPurpose.Payment)) response.push({
1995
- ...paymentAddress,
1996
- walletType: "software"
1997
- });
1998
- if (purposes.includes(AddressPurpose.Ordinals)) response.push({
1999
- ...ordinalsAddress,
2000
- walletType: "software"
2001
- });
2002
- return response;
2003
- }
2004
- async signMessage(params) {
2005
- const { message, address } = params;
2006
- const addressType = getAddressInfo(address).type;
2007
- if ([AddressType$1.p2wpkh, AddressType$1.p2tr].includes(addressType)) return {
2008
- address,
2009
- messageHash: "",
2010
- signature: await window.unisat.signMessage(message, "bip322-simple"),
2011
- protocol: MessageSigningProtocols.BIP322
2012
- };
2013
- return {
2014
- address,
2015
- messageHash: "",
2016
- signature: await window.unisat.signMessage(message, "ecdsa"),
2017
- protocol: MessageSigningProtocols.ECDSA
2018
- };
2019
- }
2020
- async sendTransfer(params) {
2021
- const { recipients } = params;
2022
- if (recipients.length > 1) throw new Error("Only one recipient is supported by this wallet provider");
2023
- return { txid: await window.unisat.sendBitcoin(recipients[0].address, recipients[0].amount) };
2024
- }
2025
- async signPsbt(params) {
2026
- const { psbt, signInputs, broadcast } = params;
2027
- const psbtHex = Buffer.from(psbt, "base64").toString("hex");
2028
- const signedPsbt = await window.unisat.signPsbt(psbtHex, {
2029
- autoFinalized: broadcast,
2030
- toSignInputs: convertSignInputsToInputType(signInputs)
2031
- });
2032
- const signedPsbtBase64 = Buffer.from(signedPsbt, "hex").toString("base64");
2033
- let txid;
2034
- if (broadcast) txid = await window.unisat.pushPsbt(signedPsbt);
2035
- return {
2036
- psbt: signedPsbtBase64,
2037
- txid
2038
- };
2039
- }
2040
- requestInternal = async (method, params) => {
2041
- try {
2042
- switch (method) {
2043
- case "getAccounts": return {
2044
- status: "success",
2045
- result: await this.getAccounts(params)
2046
- };
2047
- case "sendTransfer": return {
2048
- status: "success",
2049
- result: await this.sendTransfer(params)
2050
- };
2051
- case "signMessage": return {
2052
- status: "success",
2053
- result: await this.signMessage(params)
2054
- };
2055
- case "signPsbt": return {
2056
- status: "success",
2057
- result: await this.signPsbt(params)
2058
- };
2059
- default: {
2060
- const error = {
2061
- code: RpcErrorCode.METHOD_NOT_SUPPORTED,
2062
- message: "Method not supported by the selected wallet"
2063
- };
2064
- console.error("Error calling the method", error);
2065
- return {
2066
- status: "error",
2067
- error
2068
- };
2069
- }
2070
- }
2071
- } catch (error) {
2072
- console.error("Error calling the method", error);
2073
- return {
2074
- status: "error",
2075
- error: {
2076
- code: error.code === 4001 ? RpcErrorCode.USER_REJECTION : RpcErrorCode.INTERNAL_ERROR,
2077
- message: error.message ? error.message : "Wallet method call error",
2078
- data: error
2079
- }
2080
- };
2081
- }
2082
- };
2083
- addListener = ({ eventName, cb }) => {
2084
- switch (eventName) {
2085
- case "accountChange": {
2086
- const handler = () => {
2087
- cb({ type: "accountChange" });
2088
- };
2089
- window.unisat.on("accountsChanged", handler);
2090
- return () => {
2091
- window.unisat.removeListener("accountsChanged", handler);
2092
- };
2093
- }
2094
- case "networkChange": {
2095
- const handler = () => {
2096
- cb({ type: "networkChange" });
2097
- };
2098
- window.unisat.on("networkChanged", handler);
2099
- return () => {
2100
- window.unisat.removeListener("networkChanged", handler);
2101
- };
2102
- }
2103
- default:
2104
- console.error("Event not supported by the selected wallet");
2105
- return () => {};
2106
- }
2107
- };
2108
- };
2109
-
2110
- //#endregion
2111
- //#region src/adapters/fordefi.ts
2112
- var FordefiAdapter = class extends SatsConnectAdapter {
2113
- id = DefaultAdaptersInfo.fordefi.id;
2114
- requestInternal = async (method, params) => {
2115
- const provider = getProviderById(this.id);
2116
- if (!provider) throw new Error("no wallet provider was found");
2117
- if (!method) throw new Error("A wallet method is required");
2118
- return await provider.request(method, params);
2119
- };
2120
- addListener = ({ eventName, cb }) => {
2121
- const provider = getProviderById(this.id);
2122
- if (!provider) throw new Error("no wallet provider was found");
2123
- if (!provider.addListener) {
2124
- console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
2125
- return () => {};
2126
- }
2127
- return provider.addListener(eventName, cb);
2128
- };
2129
- };
2130
-
2131
3245
  //#endregion
2132
3246
  //#region src/adapters/BaseAdapter.ts
2133
3247
  var BaseAdapter = class extends SatsConnectAdapter {
@@ -2224,7 +3338,7 @@ const MAX_CONTENT_LENGTH_MAINNET = 4e5;
2224
3338
  const MAX_CONTENT_LENGTH_TESTNET = 6e4;
2225
3339
  const validateInscriptionPayload = (payload) => {
2226
3340
  const { contentType, content, payloadType, network, appFeeAddress, appFee } = payload;
2227
- if (!/^[a-z]+\/[a-z0-9\-\.\+]+(?=;.*|$)/.test(contentType)) throw new Error("Invalid content type detected");
3341
+ if (!/^[a-z]+\/[a-z0-9\-.+]+(?=;.*|$)/.test(contentType)) throw new Error("Invalid content type detected");
2228
3342
  if (!content || content.length === 0) throw new Error("Empty content not allowed");
2229
3343
  if (!payloadType || payloadType !== "BASE_64" && payloadType !== "PLAIN_TEXT") throw new Error("Empty invalid payloadType specified");
2230
3344
  if (content.length > (network.type === "Mainnet" ? MAX_CONTENT_LENGTH_MAINNET : MAX_CONTENT_LENGTH_TESTNET)) throw new Error("Content too large");
@@ -2313,38 +3427,38 @@ const sendBtcTransaction = async (options) => {
2313
3427
  };
2314
3428
 
2315
3429
  //#endregion
2316
- //#region src/transactions/signTransaction.ts
2317
- const signTransaction = async (options) => {
3430
+ //#region src/transactions/signMultipleTransactions.ts
3431
+ const signMultipleTransactions = async (options) => {
2318
3432
  const provider = await getProviderOrThrow(options.getProvider);
2319
- const { psbtBase64, inputsToSign } = options.payload;
2320
- if (!psbtBase64) throw new Error("A value for psbtBase64 representing the tx hash is required");
2321
- if (!inputsToSign) throw new Error("An array specifying the inputs to be signed by the wallet is required");
3433
+ const { psbts } = options.payload;
3434
+ if (!psbts || !psbts.length) throw new Error("psbts array is required");
3435
+ if (psbts.length > 100) throw new Error("psbts array must contain less than 100 psbts");
2322
3436
  try {
2323
3437
  const request$1 = createUnsecuredToken(options.payload);
2324
- const response = await provider.signTransaction(request$1);
3438
+ const response = await provider.signMultipleTransactions(request$1);
2325
3439
  options.onFinish?.(response);
2326
3440
  } catch (error) {
2327
- console.error("[Connect] Error during sign transaction request", error);
3441
+ console.error("[Connect] Error during sign Multiple transactions request", error);
2328
3442
  options.onCancel?.();
2329
3443
  }
2330
3444
  };
2331
3445
 
2332
3446
  //#endregion
2333
- //#region src/transactions/signMultipleTransactions.ts
2334
- const signMultipleTransactions = async (options) => {
3447
+ //#region src/transactions/signTransaction.ts
3448
+ const signTransaction = async (options) => {
2335
3449
  const provider = await getProviderOrThrow(options.getProvider);
2336
- const { psbts } = options.payload;
2337
- if (!psbts || !psbts.length) throw new Error("psbts array is required");
2338
- if (psbts.length > 100) throw new Error("psbts array must contain less than 100 psbts");
3450
+ const { psbtBase64, inputsToSign } = options.payload;
3451
+ if (!psbtBase64) throw new Error("A value for psbtBase64 representing the tx hash is required");
3452
+ if (!inputsToSign) throw new Error("An array specifying the inputs to be signed by the wallet is required");
2339
3453
  try {
2340
3454
  const request$1 = createUnsecuredToken(options.payload);
2341
- const response = await provider.signMultipleTransactions(request$1);
3455
+ const response = await provider.signTransaction(request$1);
2342
3456
  options.onFinish?.(response);
2343
3457
  } catch (error) {
2344
- console.error("[Connect] Error during sign Multiple transactions request", error);
3458
+ console.error("[Connect] Error during sign transaction request", error);
2345
3459
  options.onCancel?.();
2346
3460
  }
2347
3461
  };
2348
3462
 
2349
3463
  //#endregion
2350
- export { AddressPurpose, AddressType, BaseAdapter, BitcoinNetworkType, DefaultAdaptersInfo, MessageSigningProtocols, PermissionRequestParams, ProviderPlatform, RpcErrorCode, RpcIdSchema, SatsConnectAdapter, SparkNetworkType, StacksNetworkType, StarknetNetworkType, accountActionsSchema, accountChangeEventName, accountChangeSchema, accountPermissionSchema, addListener, addNetworkMethodName, addNetworkParamsSchema, addNetworkRequestMessageSchema, addNetworkResultSchema, addressSchema, bitcoinNetworkDefinitionSchema, changeNetworkByIdMethodName, changeNetworkByIdParamsSchema, changeNetworkByIdRequestMessageSchema, changeNetworkByIdResultSchema, changeNetworkMethodName, changeNetworkParamsSchema, changeNetworkRequestMessageSchema, changeNetworkResultSchema, connectMethodName, connectParamsSchema, connectRequestMessageSchema, connectResultSchema, createInscription, createRepeatInscriptions, defaultAdapters, disconnectEventName, disconnectMethodName, disconnectParamsSchema, disconnectRequestMessageSchema, disconnectResultSchema, disconnectSchema, getAccountMethodName, getAccountParamsSchema, getAccountRequestMessageSchema, getAccountResultSchema, getAccountsMethodName, getAccountsParamsSchema, getAccountsRequestMessageSchema, getAccountsResultSchema, getAddress, getAddressesMethodName, getAddressesParamsSchema, getAddressesRequestMessageSchema, getAddressesResultSchema, getBalanceMethodName, getBalanceParamsSchema, getBalanceRequestMessageSchema, getBalanceResultSchema, getCapabilities, getCurrentPermissionsMethodName, getCurrentPermissionsParamsSchema, getCurrentPermissionsRequestMessageSchema, getCurrentPermissionsResultSchema, getDefaultProvider, getInfoMethodName, getInfoParamsSchema, getInfoRequestMessageSchema, getInfoResultSchema, getInscriptionsMethodName, getInscriptionsParamsSchema, getInscriptionsRequestMessageSchema, getInscriptionsResultSchema, getNetworkMethodName, getNetworkParamsSchema, getNetworkRequestMessageSchema, getNetworkResultSchema, getNetworksMethodName, getNetworksParamsSchema, getNetworksRequestMessageSchema, getNetworksResultSchema, getProviderById, getProviderOrThrow, getProviders, getSupportedWallets, getWalletTypeMethodName, getWalletTypeParamsSchema, getWalletTypeRequestMessageSchema, getWalletTypeResultSchema, isProviderInstalled, networkChangeEventName, networkChangeSchema, newNetworkDefinitionSchema, openBridgeMethodName, openBridgeParamsSchema, openBridgeRequestMessageSchema, openBridgeResultSchema, openBuyMethodName, openBuyParamsSchema, openBuyRequestMessageSchema, openBuyResultSchema, openReceiveMethodName, openReceiveParamsSchema, openReceiveRequestMessageSchema, openReceiveResultSchema, permission, removeDefaultProvider, renouncePermissionsMethodName, renouncePermissionsParamsSchema, renouncePermissionsRequestMessageSchema, renouncePermissionsResultSchema, request, requestPermissionsMethodName, requestPermissionsParamsSchema, requestPermissionsRequestMessageSchema, requestPermissionsResultSchema, rpcErrorResponseMessageSchema, rpcRequestMessageSchema, rpcResponseMessageSchema, rpcSuccessResponseMessageSchema, runesEtchMethodName, runesEtchParamsSchema, runesEtchRequestMessageSchema, runesEtchResultSchema, runesGetBalanceMethodName, runesGetBalanceParamsSchema, runesGetBalanceRequestMessageSchema, runesGetBalanceResultSchema, runesMintMethodName, runesMintParamsSchema, runesMintRequestMessageSchema, runesMintResultSchema, runesTransferMethodName, runesTransferParamsSchema, runesTransferRequestMessageSchema, runesTransferResultSchema, sendBtcTransaction, sendInscriptionsMethodName, sendInscriptionsParamsSchema, sendInscriptionsRequestMessageSchema, sendInscriptionsResultSchema, sendTransferMethodName, sendTransferParamsSchema, sendTransferRequestMessageSchema, sendTransferResultSchema, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleMessagesMethodName, signMultipleMessagesParamsSchema, signMultipleMessagesRequestMessageSchema, signMultipleMessagesResultSchema, signMultipleTransactions, signPsbtMethodName, signPsbtParamsSchema, signPsbtRequestMessageSchema, signPsbtResultSchema, signTransaction, sparkFlashnetAddLiquidityIntentSchema, sparkFlashnetClawbackFundsMethodName, sparkFlashnetClawbackFundsParamsSchema, sparkFlashnetClawbackFundsRequestMessageSchema, sparkFlashnetClawbackFundsResultSchema, sparkFlashnetClawbackIntentSchema, sparkFlashnetConfirmInitialDepositIntentSchema, sparkFlashnetCreateConstantProductPoolIntentSchema, sparkFlashnetCreateSingleSidedPoolIntentSchema, sparkFlashnetExecuteRouteSwapMethodName, sparkFlashnetExecuteRouteSwapParamsSchema, sparkFlashnetExecuteRouteSwapRequestMessageSchema, sparkFlashnetExecuteRouteSwapResultSchema, sparkFlashnetExecuteSwapMethodName, sparkFlashnetExecuteSwapParamsSchema, sparkFlashnetExecuteSwapRequestMessageSchema, sparkFlashnetExecuteSwapResultSchema, sparkFlashnetGetJwtMethodName, sparkFlashnetGetJwtParamsSchema, sparkFlashnetGetJwtRequestMessageSchema, sparkFlashnetGetJwtResultSchema, sparkFlashnetRemoveLiquidityIntentSchema, sparkFlashnetRouteSwapIntentSchema, sparkFlashnetSignIntentMethodName, sparkFlashnetSignIntentParamsSchema, sparkFlashnetSignIntentRequestMessageSchema, sparkFlashnetSignIntentResultSchema, sparkFlashnetSignStructuredMessageMethodName, sparkFlashnetSignStructuredMessageParamsSchema, sparkFlashnetSignStructuredMessageRequestMessageSchema, sparkFlashnetSignStructuredMessageResultSchema, sparkFlashnetSwapIntentSchema, sparkGetAddressesMethodName, sparkGetAddressesParamsSchema, sparkGetAddressesRequestMessageSchema, sparkGetAddressesResultSchema, sparkGetBalanceMethodName, sparkGetBalanceParamsSchema, sparkGetBalanceRequestMessageSchema, sparkGetBalanceResultSchema, sparkGetClawbackEligibleTransfersMethodName, sparkGetClawbackEligibleTransfersParamsSchema, sparkGetClawbackEligibleTransfersRequestMessageSchema, sparkGetClawbackEligibleTransfersResultSchema, sparkNetworkDefinitionSchema, sparkSignMessageMethodName, sparkSignMessageParamsSchema, sparkSignMessageRequestMessageSchema, sparkSignMessageResultSchema, sparkTransferMethodName, sparkTransferParamsSchema, sparkTransferRequestMessageSchema, sparkTransferResultSchema, sparkTransferTokenMethodName, sparkTransferTokenParamsSchema, sparkTransferTokenRequestMessageSchema, sparkTransferTokenResultSchema, stacksNetworkDefinitionSchema, starknetNetworkDefinitionSchema, stxCallContractMethodName, stxCallContractParamsSchema, stxCallContractRequestMessageSchema, stxCallContractResultSchema, stxDeployContractMethodName, stxDeployContractParamsSchema, stxDeployContractRequestMessageSchema, stxDeployContractResultSchema, stxGetAccountsMethodName, stxGetAccountsParamsSchema, stxGetAccountsRequestMessageSchema, stxGetAccountsResultSchema, stxGetAddressesMethodName, stxGetAddressesParamsSchema, stxGetAddressesRequestMessageSchema, stxGetAddressesResultSchema, stxSignMessageMethodName, stxSignMessageParamsSchema, stxSignMessageRequestMessageSchema, stxSignMessageResultSchema, stxSignStructuredMessageMethodName, stxSignStructuredMessageParamsSchema, stxSignStructuredMessageRequestMessageSchema, stxSignStructuredMessageResultSchema, stxSignTransactionMethodName, stxSignTransactionParamsSchema, stxSignTransactionRequestMessageSchema, stxSignTransactionResultSchema, stxSignTransactionsMethodName, stxSignTransactionsParamsSchema, stxSignTransactionsRequestMessageSchema, stxSignTransactionsResultSchema, stxTransferStxMethodName, stxTransferStxParamsSchema, stxTransferStxRequestMessageSchema, stxTransferStxResultSchema, walletActionsSchema, walletEventSchema, walletPermissionSchema, walletTypeSchema, walletTypes };
3464
+ export { AddressPurpose, AddressType, BaseAdapter, BitcoinNetworkType, DefaultAdaptersInfo, MessageSigningProtocols, ProviderPlatform, RpcErrorCode, SatsConnectAdapter, SparkNetworkType, StacksNetworkType, StarknetNetworkType, accountChangeEventName, accountChangeSchema, addListener, addressSchema, allResolvedNetworksSchema, bitcoinGetAccountsParamsSchema, bitcoinGetAccountsRequestSchema, bitcoinGetAccountsResultSchema, bitcoinGetAccountsSuccessResponseSchema, bitcoinGetAccountsV2ParamsSchema, bitcoinGetAccountsV2RequestSchema, bitcoinGetAccountsV2ResultSchema, bitcoinGetAccountsV2SuccessResponseSchema, bitcoinGetAddressesParamsSchema, bitcoinGetAddressesRequestSchema, bitcoinGetAddressesResultSchema, bitcoinGetAddressesSuccessResponseSchema, bitcoinGetAddressesV2ParamsSchema, bitcoinGetAddressesV2RequestSchema, bitcoinGetAddressesV2ResultSchema, bitcoinGetAddressesV2SuccessResponseSchema, bitcoinGetBalanceParamsSchema, bitcoinGetBalanceRequestSchema, bitcoinGetBalanceResultSchema, bitcoinGetBalanceSuccessResponseSchema, bitcoinGetBalanceV2ParamsSchema, bitcoinGetBalanceV2RequestSchema, bitcoinGetBalanceV2ResultSchema, bitcoinGetBalanceV2SuccessResponseSchema, bitcoinGetInfoParamsSchema, bitcoinGetInfoRequestSchema, bitcoinGetInfoResultSchema, bitcoinGetInfoSuccessResponseSchema, bitcoinGetInfoV2ParamsSchema, bitcoinGetInfoV2RequestSchema, bitcoinGetInfoV2ResultSchema, bitcoinGetInfoV2SuccessResponseSchema, bitcoinMethods, bitcoinModeToLegacyBitcoinNetworkType, bitcoinNetworkConfigurationOptionsSchema, bitcoinRequestSchema, bitcoinSendTransferParamsSchema, bitcoinSendTransferRequestSchema, bitcoinSendTransferResultSchema, bitcoinSendTransferSuccessResponseSchema, bitcoinSendTransferV2ParamsSchema, bitcoinSendTransferV2RequestSchema, bitcoinSendTransferV2ResultSchema, bitcoinSendTransferV2SuccessResponseSchema, bitcoinSignMessageParamsSchema, bitcoinSignMessageRequestSchema, bitcoinSignMessageResultSchema, bitcoinSignMessageSuccessResponseSchema, bitcoinSignMessageV2ParamsSchema, bitcoinSignMessageV2RequestSchema, bitcoinSignMessageV2ResultSchema, bitcoinSignMessageV2SuccessResponseSchema, bitcoinSignMultipleMessagesParamsSchema, bitcoinSignMultipleMessagesRequestSchema, bitcoinSignMultipleMessagesResultSchema, bitcoinSignMultipleMessagesSuccessResponseSchema, bitcoinSignMultipleMessagesV2ParamsSchema, bitcoinSignMultipleMessagesV2RequestSchema, bitcoinSignMultipleMessagesV2ResultSchema, bitcoinSignMultipleMessagesV2SuccessResponseSchema, bitcoinSignPsbtParamsSchema, bitcoinSignPsbtRequestSchema, bitcoinSignPsbtResultSchema, bitcoinSignPsbtSuccessResponseSchema, bitcoinSignPsbtV2ParamsSchema, bitcoinSignPsbtV2RequestSchema, bitcoinSignPsbtV2ResultSchema, bitcoinSignPsbtV2SuccessResponseSchema, bitcoinSuccessResponseSchema, createInscription, createRepeatInscriptions, createRpcRequest, createRpcSuccessResponse, defaultAdapters, disconnectEventName, disconnectSchema, getAddress, getCapabilities, getDefaultProvider, getProviderById, getProviderOrThrow, getProviders, getSupportedWallets, isProviderInstalled, methodSupport, networkChangeEventName, networkChangeEventNameV2, networkChangeSchema, networkChangeV2Schema, networkConfigurationOptionsSchema, ordinalsGetInscriptionsParamsSchema, ordinalsGetInscriptionsRequestSchema, ordinalsGetInscriptionsResultSchema, ordinalsGetInscriptionsSuccessResponseSchema, ordinalsMethods, ordinalsRequestSchema, ordinalsSendInscriptionsParamsSchema, ordinalsSendInscriptionsRequestSchema, ordinalsSendInscriptionsResultSchema, ordinalsSendInscriptionsSuccessResponseSchema, ordinalsSuccessResponseSchema, permissionRequestParamsSchema, removeDefaultProvider, request, rpcIdSchema, rpcRequestSchema, rpcSuccessResponseSchema, runesEstimateEtchParamsSchema, runesEstimateEtchRequestSchema, runesEstimateEtchResultSchema, runesEstimateEtchSuccessResponseSchema, runesEstimateMintParamsSchema, runesEstimateMintRequestSchema, runesEstimateMintResultSchema, runesEstimateMintSuccessResponseSchema, runesEstimateRbfOrderParamsSchema, runesEstimateRbfOrderRequestSchema, runesEstimateRbfOrderResultSchema, runesEstimateRbfOrderSuccessResponseSchema, runesEtchParamsSchema, runesEtchRequestSchema, runesEtchResultSchema, runesEtchSuccessResponseSchema, runesGetBalanceParamsSchema, runesGetBalanceRequestSchema, runesGetBalanceResultSchema, runesGetBalanceSuccessResponseSchema, runesGetOrderParamsSchema, runesGetOrderRequestSchema, runesGetOrderResultSchema, runesGetOrderSuccessResponseSchema, runesMethods, runesMintParamsSchema, runesMintRequestSchema, runesMintResultSchema, runesMintSuccessResponseSchema, runesRbfOrderParamsSchema, runesRbfOrderRequestSchema, runesRbfOrderResultSchema, runesRbfOrderSuccessResponseSchema, runesRequestSchema, runesSuccessResponseSchema, runesTransferParamsSchema, runesTransferRequestSchema, runesTransferResultSchema, runesTransferSuccessResponseSchema, sendBtcTransaction, setDefaultProvider, signMessage, signMultipleTransactions, signTransaction, sparkFlashnetClawbackFundsParamsSchema, sparkFlashnetClawbackFundsRequestSchema, sparkFlashnetClawbackFundsResultSchema, sparkFlashnetClawbackFundsSuccessResponseSchema, sparkFlashnetExecuteRouteSwapParamsSchema, sparkFlashnetExecuteRouteSwapRequestSchema, sparkFlashnetExecuteRouteSwapResultSchema, sparkFlashnetExecuteRouteSwapSuccessResponseSchema, sparkFlashnetExecuteSwapParamsSchema, sparkFlashnetExecuteSwapRequestSchema, sparkFlashnetExecuteSwapResultSchema, sparkFlashnetExecuteSwapSuccessResponseSchema, sparkFlashnetGetJwtParamsSchema, sparkFlashnetGetJwtRequestSchema, sparkFlashnetGetJwtResultSchema, sparkFlashnetGetJwtSuccessResponseSchema, sparkFlashnetSignIntentParamsSchema, sparkFlashnetSignIntentRequestSchema, sparkFlashnetSignIntentResultSchema, sparkFlashnetSignIntentSuccessResponseSchema, sparkFlashnetSignStructuredMessageParamsSchema, sparkFlashnetSignStructuredMessageRequestSchema, sparkFlashnetSignStructuredMessageResultSchema, sparkFlashnetSignStructuredMessageSuccessResponseSchema, sparkGetAddressesParamsSchema, sparkGetAddressesRequestSchema, sparkGetAddressesResultSchema, sparkGetAddressesSuccessResponseSchema, sparkGetAddressesV2ParamsSchema, sparkGetAddressesV2RequestSchema, sparkGetAddressesV2ResultSchema, sparkGetAddressesV2SuccessResponseSchema, sparkGetBalanceParamsSchema, sparkGetBalanceRequestSchema, sparkGetBalanceResultSchema, sparkGetBalanceSuccessResponseSchema, sparkGetClawbackEligibleTransfersParamsSchema, sparkGetClawbackEligibleTransfersRequestSchema, sparkGetClawbackEligibleTransfersResultSchema, sparkGetClawbackEligibleTransfersSuccessResponseSchema, sparkMethods, sparkModeToLegacySparkNetworkType, sparkNetworkConfigurationOptionsSchema, sparkRequestSchema, sparkSignMessageParamsSchema, sparkSignMessageRequestSchema, sparkSignMessageResultSchema, sparkSignMessageSuccessResponseSchema, sparkSuccessResponseSchema, sparkTransferParamsSchema, sparkTransferRequestSchema, sparkTransferResultSchema, sparkTransferSuccessResponseSchema, sparkTransferTokenParamsSchema, sparkTransferTokenRequestSchema, sparkTransferTokenResultSchema, sparkTransferTokenSuccessResponseSchema, specErrorObjectSchema, specErrorResponseSchema, specIdSchema, specRequestSchema, specResponseSchema, specSuccessResponseSchema, specSuccessWithExtensionsResponseSchema, stacksCallContractParamsSchema, stacksCallContractRequestSchema, stacksCallContractResultSchema, stacksCallContractSuccessResponseSchema, stacksDeployContractParamsSchema, stacksDeployContractRequestSchema, stacksDeployContractResultSchema, stacksDeployContractSuccessResponseSchema, stacksGetAccountsParamsSchema, stacksGetAccountsRequestSchema, stacksGetAccountsResultSchema, stacksGetAccountsSuccessResponseSchema, stacksGetAddressesParamsSchema, stacksGetAddressesRequestSchema, stacksGetAddressesResultSchema, stacksGetAddressesSuccessResponseSchema, stacksGetAddressesV2ParamsSchema, stacksGetAddressesV2RequestSchema, stacksGetAddressesV2ResultSchema, stacksGetAddressesV2SuccessResponseSchema, stacksMethods, stacksModeToLegacyStacksNetworkType, stacksNetworkConfigurationOptionsSchema, stacksRequestSchema, stacksSignMessageParamsSchema, stacksSignMessageRequestSchema, stacksSignMessageResultSchema, stacksSignMessageSuccessResponseSchema, stacksSignStructuredMessageParamsSchema, stacksSignStructuredMessageRequestSchema, stacksSignStructuredMessageResultSchema, stacksSignStructuredMessageSuccessResponseSchema, stacksSignTransactionParamsSchema, stacksSignTransactionRequestSchema, stacksSignTransactionResultSchema, stacksSignTransactionSuccessResponseSchema, stacksSignTransactionsParamsSchema, stacksSignTransactionsRequestSchema, stacksSignTransactionsResultSchema, stacksSignTransactionsSuccessResponseSchema, stacksSuccessResponseSchema, stacksTransferStxParamsSchema, stacksTransferStxRequestSchema, stacksTransferStxResultSchema, stacksTransferStxSuccessResponseSchema, starknetNetworkConfigurationOptionsSchema, walletAddNetworkParamsSchema, walletAddNetworkRequestSchema, walletAddNetworkResultSchema, walletAddNetworkSuccessResponseSchema, walletAddNetworkV2ParamsSchema, walletAddNetworkV2RequestSchema, walletAddNetworkV2ResultSchema, walletAddNetworkV2SuccessResponseSchema, walletChangeNetworkByIdParamsSchema, walletChangeNetworkByIdRequestSchema, walletChangeNetworkByIdResultSchema, walletChangeNetworkByIdSuccessResponseSchema, walletChangeNetworkParamsSchema, walletChangeNetworkRequestSchema, walletChangeNetworkResultSchema, walletChangeNetworkSuccessResponseSchema, walletConnectParamsSchema, walletConnectRequestSchema, walletConnectResultSchema, walletConnectSuccessResponseSchema, walletConnectV2ParamsSchema, walletConnectV2RequestSchema, walletConnectV2ResultSchema, walletConnectV2SuccessResponseSchema, walletDisconnectParamsSchema, walletDisconnectRequestSchema, walletDisconnectResultSchema, walletDisconnectSuccessResponseSchema, walletEventSchema, walletGetAccountParamsSchema, walletGetAccountRequestSchema, walletGetAccountResultSchema, walletGetAccountSuccessResponseSchema, walletGetAccountV2ParamsSchema, walletGetAccountV2RequestSchema, walletGetAccountV2ResultSchema, walletGetAccountV2SuccessResponseSchema, walletGetCurrentPermissionsParamsSchema, walletGetCurrentPermissionsRequestSchema, walletGetCurrentPermissionsResultSchema, walletGetCurrentPermissionsSuccessResponseSchema, walletGetNetworkParamsSchema, walletGetNetworkRequestSchema, walletGetNetworkResultSchema, walletGetNetworkSuccessResponseSchema, walletGetNetworksParamsSchema, walletGetNetworksRequestSchema, walletGetNetworksResultSchema, walletGetNetworksSuccessResponseSchema, walletGetWalletTypeParamsSchema, walletGetWalletTypeRequestSchema, walletGetWalletTypeResultSchema, walletGetWalletTypeSuccessResponseSchema, walletMethods, walletOpenBridgeParamsSchema, walletOpenBridgeRequestSchema, walletOpenBridgeResultSchema, walletOpenBridgeSuccessResponseSchema, walletOpenBuyParamsSchema, walletOpenBuyRequestSchema, walletOpenBuyResultSchema, walletOpenBuySuccessResponseSchema, walletOpenReceiveParamsSchema, walletOpenReceiveRequestSchema, walletOpenReceiveResultSchema, walletOpenReceiveSuccessResponseSchema, walletRenouncePermissionsParamsSchema, walletRenouncePermissionsRequestSchema, walletRenouncePermissionsResultSchema, walletRenouncePermissionsSuccessResponseSchema, walletRequestPermissionsParamsSchema, walletRequestPermissionsRequestSchema, walletRequestPermissionsResultSchema, walletRequestPermissionsSuccessResponseSchema, walletRequestSchema, walletSuccessResponseSchema, walletTypeSchema, walletTypes };