@sats-connect/core 0.16.0 → 0.17.0-bac1521

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