@sats-connect/core 0.15.0 → 0.16.0-0cb8d67

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,3687 @@
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_switchNetworkById: "wallet_switchNetworkById"
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 { active } = {
1079
+ active: "active",
1080
+ deprecated: "deprecated",
1081
+ removed: "removed"
1082
+ };
1083
+ const methodSupport = {
1084
+ [bitcoinMethods.getAccounts]: active,
1085
+ [bitcoinMethods.getAddresses]: active,
1086
+ [bitcoinMethods.bitcoin_getAddressesV2]: active,
1087
+ [bitcoinMethods.getBalance]: active,
1088
+ [bitcoinMethods.bitcoin_getBalanceV2]: active,
1089
+ [bitcoinMethods.getInfo]: active,
1090
+ [bitcoinMethods.sendTransfer]: active,
1091
+ [bitcoinMethods.bitcoin_sendTransferV2]: active,
1092
+ [bitcoinMethods.signMessage]: active,
1093
+ [bitcoinMethods.bitcoin_signMessageV2]: active,
1094
+ [bitcoinMethods.signMultipleMessages]: active,
1095
+ [bitcoinMethods.bitcoin_signMultipleMessagesV2]: active,
1096
+ [bitcoinMethods.signPsbt]: active,
1097
+ [bitcoinMethods.bitcoin_signPsbtV2]: active,
1098
+ [stacksMethods.stx_callContract]: active,
1099
+ [stacksMethods.stx_deployContract]: active,
1100
+ [stacksMethods.stx_getAccounts]: active,
1101
+ [stacksMethods.stx_getAddresses]: active,
1102
+ [stacksMethods.stx_signMessage]: active,
1103
+ [stacksMethods.stx_signStructuredMessage]: active,
1104
+ [stacksMethods.stx_signTransaction]: active,
1105
+ [stacksMethods.stx_signTransactions]: active,
1106
+ [stacksMethods.stx_transferStx]: active,
1107
+ [sparkMethods.spark_getAddresses]: active,
1108
+ [sparkMethods.spark_getAddressesV2]: active,
1109
+ [sparkMethods.spark_getBalance]: active,
1110
+ [sparkMethods.spark_transfer]: active,
1111
+ [sparkMethods.spark_transferToken]: active,
1112
+ [sparkMethods.spark_signMessage]: active,
1113
+ [sparkMethods.spark_flashnet_getJwt]: active,
1114
+ [sparkMethods.spark_flashnet_signIntent]: active,
1115
+ [sparkMethods.spark_flashnet_signStructuredMessage]: active,
1116
+ [sparkMethods.spark_flashnet_executeSwap]: active,
1117
+ [sparkMethods.spark_flashnet_executeRouteSwap]: active,
1118
+ [sparkMethods.spark_flashnet_clawbackFunds]: active,
1119
+ [sparkMethods.spark_flashnet_getClawbackEligibleTransfers]: active,
1120
+ [runesMethods.runes_estimateEtch]: active,
1121
+ [runesMethods.runes_estimateMint]: active,
1122
+ [runesMethods.runes_estimateRbfOrder]: active,
1123
+ [runesMethods.runes_etch]: active,
1124
+ [runesMethods.runes_getBalance]: active,
1125
+ [runesMethods.runes_getOrder]: active,
1126
+ [runesMethods.runes_mint]: active,
1127
+ [runesMethods.runes_rbfOrder]: active,
1128
+ [runesMethods.runes_transfer]: active,
1129
+ [ordinalsMethods.ord_getInscriptions]: active,
1130
+ [ordinalsMethods.ord_sendInscriptions]: active,
1131
+ [walletMethods.wallet_addNetwork]: active,
1132
+ [walletMethods.wallet_addNetworkV2]: active,
1133
+ [walletMethods.wallet_changeNetwork]: active,
1134
+ [walletMethods.wallet_connect]: active,
1135
+ [walletMethods.wallet_connectV2]: active,
1136
+ [walletMethods.wallet_disconnect]: active,
1137
+ [walletMethods.wallet_getAccount]: active,
1138
+ [walletMethods.wallet_getAccountV2]: active,
1139
+ [walletMethods.wallet_getCurrentPermissions]: active,
1140
+ [walletMethods.wallet_getNetwork]: active,
1141
+ [walletMethods.wallet_getNetworks]: active,
1142
+ [walletMethods.wallet_getWalletType]: active,
1143
+ [walletMethods.wallet_openBridge]: active,
1144
+ [walletMethods.wallet_openBuy]: active,
1145
+ [walletMethods.wallet_openReceive]: active,
1146
+ [walletMethods.wallet_renouncePermissions]: active,
1147
+ [walletMethods.wallet_requestPermissions]: active,
1148
+ [walletMethods.wallet_switchNetworkById]: active
1149
+ };
1150
+
1151
+ //#endregion
1152
+ //#region src/request/shared.ts
1153
+ const rpcIdSchema = valibot.string();
1154
+
1155
+ //#endregion
1156
+ //#region src/request/createRequestSchema.ts
1157
+ function createRequestSchema({ paramsSchema, method }) {
1158
+ return valibot.object({
1159
+ ...specRequestSchema.entries,
1160
+ id: rpcIdSchema,
1161
+ method: valibot.literal(method),
1162
+ params: paramsSchema
1163
+ });
1164
+ }
1165
+
1166
+ //#endregion
1167
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAccounts/request.ts
1168
+ const bitcoinGetAccountsParamsSchema = valibot.object({
1169
+ purposes: valibot.array(valibot.enum(AddressPurpose)),
1170
+ message: valibot.optional(valibot.string())
1171
+ });
1172
+ const bitcoinGetAccountsRequestSchema = createRequestSchema({
1173
+ paramsSchema: bitcoinGetAccountsParamsSchema,
1174
+ method: bitcoinMethods.getAccounts
1175
+ });
1176
+
1177
+ //#endregion
1178
+ //#region src/request/createSuccessResponseSchema.ts
1179
+ function createSuccessResponseSchema({ method, resultSchema }) {
1180
+ return valibot.object({
1181
+ ...specSuccessWithExtensionsResponseSchema.entries,
1182
+ id: rpcIdSchema,
1183
+ result: resultSchema,
1184
+ "~sats-connect-method": valibot.literal(method)
1185
+ });
1186
+ }
1187
+
1188
+ //#endregion
1189
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAccounts/response.ts
1190
+ const bitcoinGetAccountsResultSchema = valibot.array(valibot.object({
1191
+ ...addressSchema.entries,
1192
+ ...valibot.object({ walletType: walletTypeSchema }).entries
1193
+ }));
1194
+ const bitcoinGetAccountsSuccessResponseSchema = createSuccessResponseSchema({
1195
+ resultSchema: bitcoinGetAccountsResultSchema,
1196
+ method: bitcoinMethods.getAccounts
1197
+ });
1198
+
1199
+ //#endregion
1200
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddresses/request.ts
1201
+ const bitcoinGetAddressesParamsSchema = valibot.object({
1202
+ purposes: valibot.array(valibot.enum(AddressPurpose)),
1203
+ message: valibot.optional(valibot.string())
1204
+ });
1205
+ const bitcoinGetAddressesRequestSchema = createRequestSchema({
1206
+ paramsSchema: bitcoinGetAddressesParamsSchema,
1207
+ method: bitcoinMethods.getAddresses
1208
+ });
1209
+
1210
+ //#endregion
1211
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddresses/response.ts
1212
+ const getNetworkResultSchema = valibot.object({
1213
+ bitcoin: valibot.object({ name: valibot.string() }),
1214
+ stacks: valibot.object({ name: valibot.string() }),
1215
+ spark: valibot.object({ name: valibot.string() })
1216
+ });
1217
+ const bitcoinGetAddressesResultSchema = valibot.object({
1218
+ addresses: valibot.array(addressSchema),
1219
+ network: getNetworkResultSchema
1220
+ });
1221
+ const bitcoinGetAddressesSuccessResponseSchema = createSuccessResponseSchema({
1222
+ resultSchema: bitcoinGetAddressesResultSchema,
1223
+ method: bitcoinMethods.getAddresses
1224
+ });
1225
+
1226
+ //#endregion
1227
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddressesV2/request.ts
1228
+ const bitcoinGetAddressesV2ParamsSchema = valibot.object({
1229
+ purposes: valibot.array(valibot.enum(AddressPurpose)),
1230
+ message: valibot.optional(valibot.string())
1231
+ });
1232
+ const bitcoinGetAddressesV2RequestSchema = createRequestSchema({
1233
+ paramsSchema: bitcoinGetAddressesV2ParamsSchema,
1234
+ method: bitcoinMethods.bitcoin_getAddressesV2
1235
+ });
1236
+
1237
+ //#endregion
1238
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetwork/request.ts
1239
+ const walletAddNetworkParamsSchema = valibot.variant("chain", [
1240
+ valibot.object({
1241
+ chain: valibot.literal("bitcoin"),
1242
+ type: valibot.enum(BitcoinNetworkType),
1243
+ name: valibot.string(),
1244
+ rpcUrl: valibot.string(),
1245
+ rpcFallbackUrl: valibot.optional(valibot.string()),
1246
+ indexerUrl: valibot.optional(valibot.string()),
1247
+ blockExplorerUrl: valibot.optional(valibot.string()),
1248
+ switch: valibot.optional(valibot.boolean())
1249
+ }),
1250
+ valibot.object({
1251
+ chain: valibot.literal("stacks"),
1252
+ name: valibot.string(),
1253
+ type: valibot.enum(StacksNetworkType),
1254
+ rpcUrl: valibot.string(),
1255
+ blockExplorerUrl: valibot.optional(valibot.string()),
1256
+ switch: valibot.optional(valibot.boolean())
1257
+ }),
1258
+ valibot.object({
1259
+ chain: valibot.literal("starknet"),
1260
+ name: valibot.string(),
1261
+ type: valibot.enum(StarknetNetworkType),
1262
+ rpcUrl: valibot.string(),
1263
+ blockExplorerUrl: valibot.optional(valibot.string()),
1264
+ switch: valibot.optional(valibot.boolean())
1265
+ })
1266
+ ]);
1267
+ const walletAddNetworkRequestSchema = createRequestSchema({
1268
+ paramsSchema: walletAddNetworkParamsSchema,
1269
+ method: walletMethods.wallet_addNetwork
1270
+ });
1271
+
1272
+ //#endregion
1273
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetwork/response.ts
1274
+ const walletAddNetworkResultSchema = valibot.object({ id: valibot.string() });
1275
+ const walletAddNetworkSuccessResponseSchema = createSuccessResponseSchema({
1276
+ resultSchema: walletAddNetworkResultSchema,
1277
+ method: walletMethods.wallet_addNetwork
1278
+ });
1279
+
1280
+ //#endregion
1281
+ //#region src/request/rpc/objects/namespaces/wallet/shared/permissions.ts
1282
+ const accountActionsSchema = valibot.object({ read: valibot.optional(valibot.boolean()) });
1283
+ const walletActionsSchema = valibot.object({ readNetwork: valibot.optional(valibot.boolean()) });
1284
+ const accountPermissionSchema = valibot.object({
1285
+ type: valibot.literal("account"),
1286
+ resourceId: valibot.string(),
1287
+ clientId: valibot.string(),
1288
+ actions: accountActionsSchema
1289
+ });
1290
+ const walletPermissionSchema = valibot.object({
1291
+ type: valibot.literal("wallet"),
1292
+ resourceId: valibot.string(),
1293
+ clientId: valibot.string(),
1294
+ actions: walletActionsSchema
1295
+ });
1296
+ const permissionSchema = valibot.variant("type", [accountPermissionSchema, walletPermissionSchema]);
1297
+ const permission = valibot.variant("type", [accountPermissionSchema, walletPermissionSchema]);
1298
+ /**
1299
+ * Permissions with the clientId field omitted and optional actions. Used for
1300
+ * permission requests, since the wallet performs authentication based on the
1301
+ * client's tab origin and should not rely on the client authenticating
1302
+ * themselves.
1303
+ */
1304
+ const permissionRequestParamsSchema = valibot.variant("type", [valibot.object({ ...valibot.omit(accountPermissionSchema, ["clientId"]).entries }), valibot.object({ ...valibot.omit(walletPermissionSchema, ["clientId"]).entries })]);
1305
+
1306
+ //#endregion
1307
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetworkV2/request.ts
1308
+ const walletAddNetworkV2ParamsSchema = valibot.object({
1309
+ network: networkConfigurationOptionsSchema,
1310
+ switch: valibot.optional(valibot.boolean(), false)
1311
+ });
1312
+ const walletAddNetworkV2RequestSchema = createRequestSchema({
1313
+ paramsSchema: walletAddNetworkV2ParamsSchema,
1314
+ method: walletMethods.wallet_addNetworkV2
1315
+ });
1316
+
1317
+ //#endregion
1318
+ //#region src/request/rpc/objects/namespaces/wallet/methods/addNetworkV2/response.ts
1319
+ const walletAddNetworkV2ResultSchema = networkConfigurationSchema;
1320
+ const walletAddNetworkV2SuccessResponseSchema = createSuccessResponseSchema({
1321
+ resultSchema: walletAddNetworkV2ResultSchema,
1322
+ method: walletMethods.wallet_addNetworkV2
1323
+ });
1324
+
1325
+ //#endregion
1326
+ //#region src/request/rpc/objects/namespaces/wallet/methods/changeNetwork/request.ts
1327
+ const walletChangeNetworkParamsSchema = valibot.object({ name: valibot.enum(BitcoinNetworkType) });
1328
+ const walletChangeNetworkRequestSchema = createRequestSchema({
1329
+ paramsSchema: walletChangeNetworkParamsSchema,
1330
+ method: walletMethods.wallet_changeNetwork
1331
+ });
1332
+
1333
+ //#endregion
1334
+ //#region src/request/rpc/objects/namespaces/wallet/methods/changeNetwork/response.ts
1335
+ const walletChangeNetworkResultSchema = valibot.nullish(valibot.null());
1336
+ const walletChangeNetworkSuccessResponseSchema = createSuccessResponseSchema({
1337
+ resultSchema: walletChangeNetworkResultSchema,
1338
+ method: walletMethods.wallet_changeNetwork
1339
+ });
1340
+
1341
+ //#endregion
1342
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connect/request.ts
1343
+ const walletConnectParamsSchema = valibot.nullish(valibot.object({
1344
+ permissions: valibot.optional(valibot.array(permissionRequestParamsSchema)),
1345
+ addresses: valibot.optional(valibot.array(valibot.enum(AddressPurpose))),
1346
+ message: valibot.optional(valibot.pipe(valibot.string(), valibot.maxLength(80, "The message must not exceed 80 characters."))),
1347
+ network: valibot.optional(valibot.picklist([
1348
+ "Mainnet",
1349
+ "Testnet",
1350
+ "Signet"
1351
+ ]))
1352
+ }));
1353
+ const walletConnectRequestSchema = createRequestSchema({
1354
+ paramsSchema: walletConnectParamsSchema,
1355
+ method: walletMethods.wallet_connect
1356
+ });
1357
+
1358
+ //#endregion
1359
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetwork/request.ts
1360
+ const walletGetNetworkParamsSchema = valibot.nullish(valibot.null());
1361
+ const walletGetNetworkRequestSchema = createRequestSchema({
1362
+ paramsSchema: walletGetNetworkParamsSchema,
1363
+ method: walletMethods.wallet_getNetwork
1364
+ });
1365
+
1366
+ //#endregion
1367
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetwork/response.ts
1368
+ const walletGetNetworkResultSchema = valibot.object({
1369
+ bitcoin: valibot.object({ name: valibot.enum(BitcoinNetworkType) }),
1370
+ stacks: valibot.object({ name: valibot.enum(StacksNetworkType) }),
1371
+ spark: valibot.object({ name: valibot.enum(SparkNetworkType) })
1372
+ });
1373
+ const walletGetNetworkSuccessResponseSchema = createSuccessResponseSchema({
1374
+ resultSchema: walletGetNetworkResultSchema,
1375
+ method: walletMethods.wallet_getNetwork
1376
+ });
1377
+
1378
+ //#endregion
1379
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connect/response.ts
1380
+ const walletConnectResultSchema = valibot.object({
1381
+ id: valibot.string(),
1382
+ addresses: valibot.array(addressSchema),
1383
+ walletType: walletTypeSchema,
1384
+ network: walletGetNetworkResultSchema
1385
+ });
1386
+ const walletConnectSuccessResponseSchema = createSuccessResponseSchema({
1387
+ resultSchema: walletConnectResultSchema,
1388
+ method: walletMethods.wallet_connect
1389
+ });
1390
+
1391
+ //#endregion
1392
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connectV2/request.ts
1393
+ const walletConnectV2ParamsSchema = valibot.nullish(valibot.object({
1394
+ permissions: permissionRequestParamsSchema,
1395
+ addressPurposes: valibot.optional(valibot.array(valibot.enum(AddressPurpose))),
1396
+ message: valibot.optional(valibot.pipe(valibot.string(), valibot.maxLength(80, "The message must not exceed 80 characters."))),
1397
+ networkId: valibot.optional(valibot.string())
1398
+ }));
1399
+ const walletConnectV2RequestSchema = createRequestSchema({
1400
+ paramsSchema: walletConnectV2ParamsSchema,
1401
+ method: walletMethods.wallet_connectV2
1402
+ });
1403
+
1404
+ //#endregion
1405
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetworks/request.ts
1406
+ const walletGetNetworksParamsSchema = valibot.nullish(valibot.null());
1407
+ const walletGetNetworksRequestSchema = createRequestSchema({
1408
+ paramsSchema: walletGetNetworksParamsSchema,
1409
+ method: walletMethods.wallet_getNetworks
1410
+ });
1411
+
1412
+ //#endregion
1413
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getNetworks/response.ts
1414
+ const walletGetNetworksResultSchema = allResolvedNetworksSchema;
1415
+ const walletGetNetworksSuccessResponseSchema = createSuccessResponseSchema({
1416
+ resultSchema: walletGetNetworksResultSchema,
1417
+ method: walletMethods.wallet_getNetworks
1418
+ });
1419
+
1420
+ //#endregion
1421
+ //#region src/request/rpc/objects/namespaces/wallet/methods/connectV2/response.ts
1422
+ const walletConnectV2ResultSchema = valibot.object({
1423
+ accountId: valibot.string(),
1424
+ addresses: valibot.array(addressSchema),
1425
+ walletType: walletTypeSchema,
1426
+ networks: walletGetNetworksResultSchema
1427
+ });
1428
+ const walletConnectV2SuccessResponseSchema = createSuccessResponseSchema({
1429
+ resultSchema: walletConnectV2ResultSchema,
1430
+ method: walletMethods.wallet_connectV2
1431
+ });
1432
+
1433
+ //#endregion
1434
+ //#region src/request/rpc/objects/namespaces/wallet/methods/disconnect/request.ts
1435
+ const walletDisconnectParamsSchema = valibot.nullish(valibot.null());
1436
+ const walletDisconnectRequestSchema = createRequestSchema({
1437
+ paramsSchema: walletDisconnectParamsSchema,
1438
+ method: walletMethods.wallet_disconnect
1439
+ });
1440
+
1441
+ //#endregion
1442
+ //#region src/request/rpc/objects/namespaces/wallet/methods/disconnect/response.ts
1443
+ const walletDisconnectResultSchema = valibot.nullish(valibot.null());
1444
+ const walletDisconnectSuccessResponseSchema = createSuccessResponseSchema({
1445
+ resultSchema: walletDisconnectResultSchema,
1446
+ method: walletMethods.wallet_disconnect
1447
+ });
1448
+
1449
+ //#endregion
1450
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccount/request.ts
1451
+ const walletGetAccountParamsSchema = valibot.nullish(valibot.null());
1452
+ const walletGetAccountRequestSchema = createRequestSchema({
1453
+ paramsSchema: walletGetAccountParamsSchema,
1454
+ method: walletMethods.wallet_getAccount
1455
+ });
1456
+
1457
+ //#endregion
1458
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccount/response.ts
1459
+ const walletGetAccountResultSchema = valibot.object({
1460
+ id: valibot.string(),
1461
+ addresses: valibot.array(addressSchema),
1462
+ walletType: walletTypeSchema,
1463
+ network: walletGetNetworkResultSchema
1464
+ });
1465
+ const walletGetAccountSuccessResponseSchema = createSuccessResponseSchema({
1466
+ resultSchema: walletGetAccountResultSchema,
1467
+ method: walletMethods.wallet_getAccount
1468
+ });
1469
+
1470
+ //#endregion
1471
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccountV2/request.ts
1472
+ const walletGetAccountV2ParamsSchema = valibot.nullish(valibot.null());
1473
+ const walletGetAccountV2RequestSchema = createRequestSchema({
1474
+ paramsSchema: walletGetAccountV2ParamsSchema,
1475
+ method: walletMethods.wallet_getAccountV2
1476
+ });
1477
+
1478
+ //#endregion
1479
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getAccountV2/response.ts
1480
+ const walletGetAccountV2ResultSchema = valibot.object({
1481
+ id: valibot.string(),
1482
+ addresses: valibot.array(addressSchema),
1483
+ walletType: walletTypeSchema,
1484
+ networks: walletGetNetworksResultSchema
1485
+ });
1486
+ const walletGetAccountV2SuccessResponseSchema = createSuccessResponseSchema({
1487
+ resultSchema: walletGetAccountV2ResultSchema,
1488
+ method: walletMethods.wallet_getAccountV2
1489
+ });
1490
+
1491
+ //#endregion
1492
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getCurrentPermissions/request.ts
1493
+ const walletGetCurrentPermissionsParamsSchema = valibot.nullish(valibot.null());
1494
+ const walletGetCurrentPermissionsRequestSchema = createRequestSchema({
1495
+ paramsSchema: walletGetCurrentPermissionsParamsSchema,
1496
+ method: walletMethods.wallet_getCurrentPermissions
1497
+ });
1498
+
1499
+ //#endregion
1500
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getCurrentPermissions/response.ts
1501
+ const walletGetCurrentPermissionsResultSchema = permission;
1502
+ const walletGetCurrentPermissionsSuccessResponseSchema = createSuccessResponseSchema({
1503
+ resultSchema: walletGetCurrentPermissionsResultSchema,
1504
+ method: walletMethods.wallet_getCurrentPermissions
1505
+ });
1506
+
1507
+ //#endregion
1508
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getWalletType/request.ts
1509
+ const walletGetWalletTypeParamsSchema = valibot.nullish(valibot.null());
1510
+ const walletGetWalletTypeRequestSchema = createRequestSchema({
1511
+ paramsSchema: walletGetWalletTypeParamsSchema,
1512
+ method: walletMethods.wallet_getWalletType
1513
+ });
1514
+
1515
+ //#endregion
1516
+ //#region src/request/rpc/objects/namespaces/wallet/methods/getWalletType/response.ts
1517
+ const walletGetWalletTypeResultSchema = walletTypeSchema;
1518
+ const walletGetWalletTypeSuccessResponseSchema = createSuccessResponseSchema({
1519
+ resultSchema: walletGetWalletTypeResultSchema,
1520
+ method: walletMethods.wallet_getWalletType
1521
+ });
1522
+
1523
+ //#endregion
1524
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBridge/request.ts
1525
+ const walletOpenBridgeParamsSchema = valibot.object({
1526
+ fromAsset: valibot.string(),
1527
+ toAsset: valibot.string()
1528
+ });
1529
+ const walletOpenBridgeRequestSchema = createRequestSchema({
1530
+ paramsSchema: walletOpenBridgeParamsSchema,
1531
+ method: walletMethods.wallet_openBridge
1532
+ });
1533
+
1534
+ //#endregion
1535
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBridge/response.ts
1536
+ const walletOpenBridgeResultSchema = valibot.nullish(valibot.null());
1537
+ const walletOpenBridgeSuccessResponseSchema = createSuccessResponseSchema({
1538
+ resultSchema: walletOpenBridgeResultSchema,
1539
+ method: walletMethods.wallet_openBridge
1540
+ });
1541
+
1542
+ //#endregion
1543
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBuy/request.ts
1544
+ const walletOpenBuyParamsSchema = valibot.object({ asset: valibot.string() });
1545
+ const walletOpenBuyRequestSchema = createRequestSchema({
1546
+ paramsSchema: walletOpenBuyParamsSchema,
1547
+ method: walletMethods.wallet_openBuy
1548
+ });
1549
+
1550
+ //#endregion
1551
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openBuy/response.ts
1552
+ const walletOpenBuyResultSchema = valibot.nullish(valibot.null());
1553
+ const walletOpenBuySuccessResponseSchema = createSuccessResponseSchema({
1554
+ resultSchema: walletOpenBuyResultSchema,
1555
+ method: walletMethods.wallet_openBuy
1556
+ });
1557
+
1558
+ //#endregion
1559
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openReceive/request.ts
1560
+ const walletOpenReceiveParamsSchema = valibot.object({ address: valibot.string() });
1561
+ const walletOpenReceiveRequestSchema = createRequestSchema({
1562
+ paramsSchema: walletOpenReceiveParamsSchema,
1563
+ method: walletMethods.wallet_openReceive
1564
+ });
1565
+
1566
+ //#endregion
1567
+ //#region src/request/rpc/objects/namespaces/wallet/methods/openReceive/response.ts
1568
+ const walletOpenReceiveResultSchema = addressSchema;
1569
+ const walletOpenReceiveSuccessResponseSchema = createSuccessResponseSchema({
1570
+ resultSchema: walletOpenReceiveResultSchema,
1571
+ method: walletMethods.wallet_openReceive
1572
+ });
1573
+
1574
+ //#endregion
1575
+ //#region src/request/rpc/objects/namespaces/wallet/methods/renouncePermissions/request.ts
1576
+ const walletRenouncePermissionsParamsSchema = valibot.nullish(valibot.null());
1577
+ const walletRenouncePermissionsRequestSchema = createRequestSchema({
1578
+ paramsSchema: walletRenouncePermissionsParamsSchema,
1579
+ method: walletMethods.wallet_renouncePermissions
1580
+ });
1581
+
1582
+ //#endregion
1583
+ //#region src/request/rpc/objects/namespaces/wallet/methods/renouncePermissions/response.ts
1584
+ const walletRenouncePermissionsResultSchema = valibot.nullish(valibot.null());
1585
+ const walletRenouncePermissionsSuccessResponseSchema = createSuccessResponseSchema({
1586
+ resultSchema: walletRenouncePermissionsResultSchema,
1587
+ method: walletMethods.wallet_renouncePermissions
1588
+ });
1589
+
1590
+ //#endregion
1591
+ //#region src/request/rpc/objects/namespaces/wallet/methods/requestPermissions/request.ts
1592
+ const walletRequestPermissionsParamsSchema = valibot.array(permissionRequestParamsSchema);
1593
+ const walletRequestPermissionsRequestSchema = createRequestSchema({
1594
+ paramsSchema: walletRequestPermissionsParamsSchema,
1595
+ method: walletMethods.wallet_requestPermissions
1596
+ });
1597
+
1598
+ //#endregion
1599
+ //#region src/request/rpc/objects/namespaces/wallet/methods/requestPermissions/response.ts
1600
+ const walletRequestPermissionsResultSchema = valibot.literal(true);
1601
+ const walletRequestPermissionsSuccessResponseSchema = createSuccessResponseSchema({
1602
+ resultSchema: walletRequestPermissionsResultSchema,
1603
+ method: walletMethods.wallet_requestPermissions
1604
+ });
1605
+
1606
+ //#endregion
1607
+ //#region src/request/rpc/objects/namespaces/wallet/methods/switchNetworkById/request.ts
1608
+ const walletSwitchNetworkByIdParamsSchema = valibot.object({ id: valibot.string() });
1609
+ const walletSwitchNetworkByIdRequestSchema = createRequestSchema({
1610
+ paramsSchema: walletSwitchNetworkByIdParamsSchema,
1611
+ method: walletMethods.wallet_switchNetworkById
1612
+ });
1613
+
1614
+ //#endregion
1615
+ //#region src/request/rpc/objects/namespaces/wallet/methods/switchNetworkById/response.ts
1616
+ const walletChangeNetworkByIdResultSchema = valibot.nullish(valibot.null());
1617
+ const walletChangeNetworkByIdSuccessResponseSchema = createSuccessResponseSchema({
1618
+ resultSchema: walletChangeNetworkByIdResultSchema,
1619
+ method: walletMethods.wallet_switchNetworkById
1620
+ });
1621
+
1622
+ //#endregion
1623
+ //#region src/request/rpc/objects/namespaces/wallet/index.ts
1624
+ const walletRequestSchema = valibot.variant("method", [
1625
+ walletAddNetworkRequestSchema,
1626
+ walletAddNetworkV2RequestSchema,
1627
+ walletSwitchNetworkByIdRequestSchema,
1628
+ walletChangeNetworkRequestSchema,
1629
+ walletConnectRequestSchema,
1630
+ walletConnectV2RequestSchema,
1631
+ walletDisconnectRequestSchema,
1632
+ walletGetAccountRequestSchema,
1633
+ walletGetAccountV2RequestSchema,
1634
+ walletGetCurrentPermissionsRequestSchema,
1635
+ walletGetNetworkRequestSchema,
1636
+ walletGetNetworksRequestSchema,
1637
+ walletGetWalletTypeRequestSchema,
1638
+ walletOpenBridgeRequestSchema,
1639
+ walletOpenBuyRequestSchema,
1640
+ walletOpenReceiveRequestSchema,
1641
+ walletRenouncePermissionsRequestSchema,
1642
+ walletRequestPermissionsRequestSchema
1643
+ ]);
1644
+ const walletSuccessResponseSchema = valibot.variant("~sats-connect-method", [
1645
+ walletAddNetworkSuccessResponseSchema,
1646
+ walletAddNetworkV2SuccessResponseSchema,
1647
+ walletChangeNetworkByIdSuccessResponseSchema,
1648
+ walletChangeNetworkSuccessResponseSchema,
1649
+ walletConnectSuccessResponseSchema,
1650
+ walletConnectV2SuccessResponseSchema,
1651
+ walletDisconnectSuccessResponseSchema,
1652
+ walletGetAccountSuccessResponseSchema,
1653
+ walletGetAccountV2SuccessResponseSchema,
1654
+ walletGetCurrentPermissionsSuccessResponseSchema,
1655
+ walletGetNetworkSuccessResponseSchema,
1656
+ walletGetNetworksSuccessResponseSchema,
1657
+ walletGetWalletTypeSuccessResponseSchema,
1658
+ walletOpenBridgeSuccessResponseSchema,
1659
+ walletOpenBuySuccessResponseSchema,
1660
+ walletOpenReceiveSuccessResponseSchema,
1661
+ walletRenouncePermissionsSuccessResponseSchema,
1662
+ walletRequestPermissionsSuccessResponseSchema
1663
+ ]);
1664
+
1665
+ //#endregion
1666
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getAddressesV2/response.ts
1667
+ const bitcoinGetAddressesV2ResultSchema = valibot.object({
1668
+ addresses: valibot.array(addressSchema),
1669
+ networks: allResolvedNetworksSchema
1670
+ });
1671
+ const bitcoinGetAddressesV2SuccessResponseSchema = createSuccessResponseSchema({
1672
+ resultSchema: bitcoinGetAddressesV2ResultSchema,
1673
+ method: bitcoinMethods.bitcoin_getAddressesV2
1674
+ });
1675
+
1676
+ //#endregion
1677
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalance/request.ts
1678
+ const bitcoinGetBalanceParamsSchema = valibot.nullish(valibot.null());
1679
+ const bitcoinGetBalanceRequestSchema = createRequestSchema({
1680
+ paramsSchema: bitcoinGetBalanceParamsSchema,
1681
+ method: bitcoinMethods.getBalance
1682
+ });
1683
+
1684
+ //#endregion
1685
+ //#region src/request/rpc/objects/namespaces/bitcoin/shared/balanceResultSchema.ts
1686
+ const balanceResultSchema = valibot.object({
1687
+ confirmed: valibot.string(),
1688
+ unconfirmed: valibot.string(),
1689
+ total: valibot.string()
1690
+ });
1691
+
1692
+ //#endregion
1693
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalance/response.ts
1694
+ const bitcoinGetBalanceResultSchema = balanceResultSchema;
1695
+ const bitcoinGetBalanceSuccessResponseSchema = createSuccessResponseSchema({
1696
+ resultSchema: bitcoinGetBalanceResultSchema,
1697
+ method: bitcoinMethods.getBalance
1698
+ });
1699
+
1700
+ //#endregion
1701
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalanceV2/request.ts
1702
+ const bitcoinGetBalanceV2ParamsSchema = valibot.nullish(valibot.null());
1703
+ const bitcoinGetBalanceV2RequestSchema = createRequestSchema({
1704
+ paramsSchema: bitcoinGetBalanceV2ParamsSchema,
1705
+ method: bitcoinMethods.bitcoin_getBalanceV2
1706
+ });
1707
+
1708
+ //#endregion
1709
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getBalanceV2/response.ts
1710
+ const bitcoinGetBalanceV2ResultSchema = balanceResultSchema;
1711
+ const bitcoinGetBalanceV2SuccessResponseSchema = createSuccessResponseSchema({
1712
+ resultSchema: bitcoinGetBalanceV2ResultSchema,
1713
+ method: bitcoinMethods.bitcoin_getBalanceV2
1714
+ });
1715
+
1716
+ //#endregion
1717
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getInfo/request.ts
1718
+ const bitcoinGetInfoParamsSchema = valibot.nullish(valibot.null());
1719
+ const bitcoinGetInfoRequestSchema = createRequestSchema({
1720
+ paramsSchema: bitcoinGetInfoParamsSchema,
1721
+ method: bitcoinMethods.getInfo
1722
+ });
1723
+
1724
+ //#endregion
1725
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/getInfo/response.ts
1726
+ const bitcoinGetInfoResultSchema = valibot.object({
1727
+ version: valibot.string(),
1728
+ platform: valibot.optional(valibot.enum(ProviderPlatform)),
1729
+ methods: valibot.optional(valibot.array(valibot.string())),
1730
+ supports: valibot.array(valibot.string())
1731
+ });
1732
+ const bitcoinGetInfoSuccessResponseSchema = createSuccessResponseSchema({
1733
+ resultSchema: bitcoinGetInfoResultSchema,
1734
+ method: bitcoinMethods.getInfo
1735
+ });
1736
+
1737
+ //#endregion
1738
+ //#region src/request/rpc/objects/namespaces/bitcoin/shared/sendTransfer.ts
1739
+ const sendTransferParamsSchema = valibot.object({ recipients: valibot.array(valibot.object({
1740
+ address: valibot.string(),
1741
+ amount: valibot.number()
1742
+ })) });
1743
+ const sendTransferResultSchema = valibot.object({ txid: valibot.string() });
1744
+
1745
+ //#endregion
1746
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransfer/request.ts
1747
+ const bitcoinSendTransferParamsSchema = sendTransferParamsSchema;
1748
+ const bitcoinSendTransferRequestSchema = createRequestSchema({
1749
+ paramsSchema: bitcoinSendTransferParamsSchema,
1750
+ method: bitcoinMethods.sendTransfer
1751
+ });
1752
+
1753
+ //#endregion
1754
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransfer/response.ts
1755
+ const bitcoinSendTransferResultSchema = sendTransferResultSchema;
1756
+ const bitcoinSendTransferSuccessResponseSchema = createSuccessResponseSchema({
1757
+ resultSchema: bitcoinSendTransferResultSchema,
1758
+ method: bitcoinMethods.sendTransfer
1759
+ });
1760
+
1761
+ //#endregion
1762
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransferV2/request.ts
1763
+ const bitcoinSendTransferV2ParamsSchema = sendTransferParamsSchema;
1764
+ const bitcoinSendTransferV2RequestSchema = createRequestSchema({
1765
+ paramsSchema: bitcoinSendTransferV2ParamsSchema,
1766
+ method: bitcoinMethods.bitcoin_sendTransferV2
1767
+ });
1768
+
1769
+ //#endregion
1770
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransferV2/response.ts
1771
+ const bitcoinSendTransferV2ResultSchema = sendTransferResultSchema;
1772
+ const bitcoinSendTransferV2SuccessResponseSchema = createSuccessResponseSchema({
1773
+ resultSchema: bitcoinSendTransferV2ResultSchema,
1774
+ method: bitcoinMethods.bitcoin_sendTransferV2
1775
+ });
1776
+
1777
+ //#endregion
1778
+ //#region src/request/rpc/objects/namespaces/bitcoin/shared/signMessage.ts
1779
+ const signMessageParamsSchema = valibot.object({
1780
+ address: valibot.string(),
1781
+ message: valibot.string(),
1782
+ protocol: valibot.optional(valibot.enum(MessageSigningProtocols))
1783
+ });
1784
+ const signMessageResultSchema = valibot.object({
1785
+ signature: valibot.string(),
1786
+ messageHash: valibot.string(),
1787
+ address: valibot.string(),
1788
+ protocol: valibot.enum(MessageSigningProtocols)
1789
+ });
1790
+
1791
+ //#endregion
1792
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessage/request.ts
1793
+ const bitcoinSignMessageParamsSchema = signMessageParamsSchema;
1794
+ const bitcoinSignMessageRequestSchema = createRequestSchema({
1795
+ paramsSchema: bitcoinSignMessageParamsSchema,
1796
+ method: bitcoinMethods.signMessage
1797
+ });
1798
+
1799
+ //#endregion
1800
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessage/response.ts
1801
+ const bitcoinSignMessageResultSchema = signMessageResultSchema;
1802
+ const bitcoinSignMessageSuccessResponseSchema = createSuccessResponseSchema({
1803
+ resultSchema: bitcoinSignMessageResultSchema,
1804
+ method: bitcoinMethods.signMessage
1805
+ });
1806
+
1807
+ //#endregion
1808
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessageV2/request.ts
1809
+ const bitcoinSignMessageV2ParamsSchema = signMessageParamsSchema;
1810
+ const bitcoinSignMessageV2RequestSchema = createRequestSchema({
1811
+ paramsSchema: bitcoinSignMessageV2ParamsSchema,
1812
+ method: bitcoinMethods.bitcoin_signMessageV2
1813
+ });
1814
+
1815
+ //#endregion
1816
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMessageV2/response.ts
1817
+ const bitcoinSignMessageV2ResultSchema = signMessageResultSchema;
1818
+ const bitcoinSignMessageV2SuccessResponseSchema = createSuccessResponseSchema({
1819
+ resultSchema: bitcoinSignMessageV2ResultSchema,
1820
+ method: bitcoinMethods.bitcoin_signMessageV2
1821
+ });
1822
+
1823
+ //#endregion
1824
+ //#region src/request/rpc/objects/namespaces/bitcoin/shared/signMultipleMessages.ts
1825
+ const signMultipleMessagesParamsSchema = valibot.array(signMessageParamsSchema);
1826
+ const signMultipleMessagesResultSchema = valibot.array(valibot.object({
1827
+ ...signMessageResultSchema.entries,
1828
+ message: valibot.string()
1829
+ }));
1830
+
1831
+ //#endregion
1832
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessages/request.ts
1833
+ const bitcoinSignMultipleMessagesParamsSchema = signMultipleMessagesParamsSchema;
1834
+ const bitcoinSignMultipleMessagesRequestSchema = createRequestSchema({
1835
+ paramsSchema: bitcoinSignMultipleMessagesParamsSchema,
1836
+ method: bitcoinMethods.signMultipleMessages
1837
+ });
1838
+
1839
+ //#endregion
1840
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessages/response.ts
1841
+ const bitcoinSignMultipleMessagesResultSchema = signMultipleMessagesResultSchema;
1842
+ const bitcoinSignMultipleMessagesSuccessResponseSchema = createSuccessResponseSchema({
1843
+ resultSchema: bitcoinSignMultipleMessagesResultSchema,
1844
+ method: bitcoinMethods.signMultipleMessages
1845
+ });
1846
+
1847
+ //#endregion
1848
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessagesV2/request.ts
1849
+ const bitcoinSignMultipleMessagesV2ParamsSchema = signMultipleMessagesParamsSchema;
1850
+ const bitcoinSignMultipleMessagesV2RequestSchema = createRequestSchema({
1851
+ paramsSchema: bitcoinSignMultipleMessagesV2ParamsSchema,
1852
+ method: bitcoinMethods.bitcoin_signMultipleMessagesV2
1853
+ });
1854
+
1855
+ //#endregion
1856
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signMultipleMessagesV2/response.ts
1857
+ const bitcoinSignMultipleMessagesV2ResultSchema = signMultipleMessagesResultSchema;
1858
+ const bitcoinSignMultipleMessagesV2SuccessResponseSchema = createSuccessResponseSchema({
1859
+ resultSchema: bitcoinSignMultipleMessagesV2ResultSchema,
1860
+ method: bitcoinMethods.bitcoin_signMultipleMessagesV2
1861
+ });
1862
+
1863
+ //#endregion
1864
+ //#region src/request/rpc/objects/namespaces/bitcoin/shared/signPsbt.ts
1865
+ const signPsbtParamsSchema = valibot.object({
1866
+ psbt: valibot.string(),
1867
+ signInputs: valibot.optional(valibot.record(valibot.string(), valibot.array(valibot.number()))),
1868
+ broadcast: valibot.optional(valibot.boolean(), false)
1869
+ });
1870
+ const signPsbtResultSchema = valibot.object({
1871
+ psbt: valibot.string(),
1872
+ txid: valibot.optional(valibot.string())
1873
+ });
1874
+
1875
+ //#endregion
1876
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbt/request.ts
1877
+ const bitcoinSignPsbtParamsSchema = signPsbtParamsSchema;
1878
+ const bitcoinSignPsbtRequestSchema = createRequestSchema({
1879
+ paramsSchema: bitcoinSignPsbtParamsSchema,
1880
+ method: bitcoinMethods.signPsbt
1881
+ });
1882
+
1883
+ //#endregion
1884
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbt/response.ts
1885
+ const bitcoinSignPsbtResultSchema = signPsbtResultSchema;
1886
+ const bitcoinSignPsbtSuccessResponseSchema = createSuccessResponseSchema({
1887
+ resultSchema: bitcoinSignPsbtResultSchema,
1888
+ method: bitcoinMethods.signPsbt
1889
+ });
1890
+
1891
+ //#endregion
1892
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbtV2/request.ts
1893
+ const bitcoinSignPsbtV2ParamsSchema = signPsbtParamsSchema;
1894
+ const bitcoinSignPsbtV2RequestSchema = createRequestSchema({
1895
+ paramsSchema: bitcoinSignPsbtV2ParamsSchema,
1896
+ method: bitcoinMethods.bitcoin_signPsbtV2
1897
+ });
1898
+
1899
+ //#endregion
1900
+ //#region src/request/rpc/objects/namespaces/bitcoin/methods/signPsbtV2/response.ts
1901
+ const bitcoinSignPsbtV2ResultSchema = signPsbtResultSchema;
1902
+ const bitcoinSignPsbtV2SuccessResponseSchema = createSuccessResponseSchema({
1903
+ resultSchema: bitcoinSignPsbtV2ResultSchema,
1904
+ method: bitcoinMethods.bitcoin_signPsbtV2
1905
+ });
1906
+
1907
+ //#endregion
1908
+ //#region src/request/rpc/objects/namespaces/bitcoin/index.ts
1909
+ const bitcoinRequestSchema = valibot.variant("method", [
1910
+ bitcoinGetAccountsRequestSchema,
1911
+ bitcoinGetAddressesRequestSchema,
1912
+ bitcoinGetAddressesV2RequestSchema,
1913
+ bitcoinGetBalanceRequestSchema,
1914
+ bitcoinGetBalanceV2RequestSchema,
1915
+ bitcoinGetInfoRequestSchema,
1916
+ bitcoinSendTransferRequestSchema,
1917
+ bitcoinSendTransferV2RequestSchema,
1918
+ bitcoinSignMessageRequestSchema,
1919
+ bitcoinSignMessageV2RequestSchema,
1920
+ bitcoinSignMultipleMessagesRequestSchema,
1921
+ bitcoinSignMultipleMessagesV2RequestSchema,
1922
+ bitcoinSignPsbtRequestSchema,
1923
+ bitcoinSignPsbtV2RequestSchema
1924
+ ]);
1925
+ const bitcoinSuccessResponseSchema = valibot.variant("~sats-connect-method", [
1926
+ bitcoinGetAccountsSuccessResponseSchema,
1927
+ bitcoinGetAddressesSuccessResponseSchema,
1928
+ bitcoinGetAddressesV2SuccessResponseSchema,
1929
+ bitcoinGetBalanceSuccessResponseSchema,
1930
+ bitcoinGetBalanceV2SuccessResponseSchema,
1931
+ bitcoinGetInfoSuccessResponseSchema,
1932
+ bitcoinSendTransferSuccessResponseSchema,
1933
+ bitcoinSendTransferV2SuccessResponseSchema,
1934
+ bitcoinSignMessageSuccessResponseSchema,
1935
+ bitcoinSignMessageV2SuccessResponseSchema,
1936
+ bitcoinSignMultipleMessagesSuccessResponseSchema,
1937
+ bitcoinSignMultipleMessagesV2SuccessResponseSchema,
1938
+ bitcoinSignPsbtSuccessResponseSchema,
1939
+ bitcoinSignPsbtV2SuccessResponseSchema
1940
+ ]);
1941
+
1942
+ //#endregion
1943
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/getInscriptions/request.ts
1944
+ const ordinalsGetInscriptionsParamsSchema = valibot.object({
1945
+ offset: valibot.number(),
1946
+ limit: valibot.number()
1947
+ });
1948
+ const ordinalsGetInscriptionsRequestSchema = createRequestSchema({
1949
+ paramsSchema: ordinalsGetInscriptionsParamsSchema,
1950
+ method: ordinalsMethods.ord_getInscriptions
1951
+ });
1952
+
1953
+ //#endregion
1954
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/getInscriptions/response.ts
1955
+ const ordinalsGetInscriptionsResultSchema = valibot.object({
1956
+ total: valibot.number(),
1957
+ limit: valibot.number(),
1958
+ offset: valibot.number(),
1959
+ inscriptions: valibot.array(valibot.object({
1960
+ inscriptionId: valibot.string(),
1961
+ inscriptionNumber: valibot.string(),
1962
+ address: valibot.string(),
1963
+ collectionName: valibot.optional(valibot.string()),
1964
+ postage: valibot.string(),
1965
+ contentLength: valibot.string(),
1966
+ contentType: valibot.string(),
1967
+ timestamp: valibot.number(),
1968
+ offset: valibot.number(),
1969
+ genesisTransaction: valibot.string(),
1970
+ output: valibot.string()
1971
+ }))
1972
+ });
1973
+ const ordinalsGetInscriptionsSuccessResponseSchema = createSuccessResponseSchema({
1974
+ resultSchema: ordinalsGetInscriptionsResultSchema,
1975
+ method: ordinalsMethods.ord_getInscriptions
1976
+ });
1977
+
1978
+ //#endregion
1979
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/sendInscriptions/request.ts
1980
+ const ordinalsSendInscriptionsParamsSchema = valibot.object({ transfers: valibot.array(valibot.object({
1981
+ address: valibot.string(),
1982
+ inscriptionId: valibot.string()
1983
+ })) });
1984
+ const ordinalsSendInscriptionsRequestSchema = createRequestSchema({
1985
+ paramsSchema: ordinalsSendInscriptionsParamsSchema,
1986
+ method: ordinalsMethods.ord_sendInscriptions
1987
+ });
1988
+
1989
+ //#endregion
1990
+ //#region src/request/rpc/objects/namespaces/ordinals/methods/sendInscriptions/response.ts
1991
+ const ordinalsSendInscriptionsResultSchema = valibot.object({ txid: valibot.string() });
1992
+ const ordinalsSendInscriptionsSuccessResponseSchema = createSuccessResponseSchema({
1993
+ resultSchema: ordinalsSendInscriptionsResultSchema,
1994
+ method: ordinalsMethods.ord_sendInscriptions
1995
+ });
1996
+
1997
+ //#endregion
1998
+ //#region src/request/rpc/objects/namespaces/ordinals/index.ts
1999
+ const ordinalsRequestSchema = valibot.variant("method", [ordinalsGetInscriptionsRequestSchema, ordinalsSendInscriptionsRequestSchema]);
2000
+ const ordinalsSuccessResponseSchema = valibot.variant("~sats-connect-method", [ordinalsGetInscriptionsSuccessResponseSchema, ordinalsSendInscriptionsSuccessResponseSchema]);
2001
+
2002
+ //#endregion
2003
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateEtch/request.ts
2004
+ const etchTermsSchema$1 = valibot.object({
2005
+ amount: valibot.optional(valibot.string()),
2006
+ cap: valibot.optional(valibot.string()),
2007
+ heightStart: valibot.optional(valibot.string()),
2008
+ heightEnd: valibot.optional(valibot.string()),
2009
+ offsetStart: valibot.optional(valibot.string()),
2010
+ offsetEnd: valibot.optional(valibot.string())
2011
+ });
2012
+ const inscriptionDetailsSchema$1 = valibot.object({
2013
+ contentType: valibot.string(),
2014
+ contentBase64: valibot.string()
2015
+ });
2016
+ const runesEstimateEtchParamsSchema = valibot.object({
2017
+ runeName: valibot.string(),
2018
+ divisibility: valibot.optional(valibot.number()),
2019
+ symbol: valibot.optional(valibot.string()),
2020
+ premine: valibot.optional(valibot.string()),
2021
+ isMintable: valibot.boolean(),
2022
+ terms: valibot.optional(etchTermsSchema$1),
2023
+ inscriptionDetails: valibot.optional(inscriptionDetailsSchema$1),
2024
+ delegateInscriptionId: valibot.optional(valibot.string()),
2025
+ destinationAddress: valibot.string(),
2026
+ feeRate: valibot.number(),
2027
+ appServiceFee: valibot.optional(valibot.number()),
2028
+ appServiceFeeAddress: valibot.optional(valibot.string()),
2029
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2030
+ });
2031
+ const runesEstimateEtchRequestSchema = createRequestSchema({
2032
+ paramsSchema: runesEstimateEtchParamsSchema,
2033
+ method: runesMethods.runes_estimateEtch
2034
+ });
2035
+
2036
+ //#endregion
2037
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateEtch/response.ts
2038
+ const runesEstimateEtchResultSchema = valibot.object({
2039
+ totalSize: valibot.number(),
2040
+ totalCost: valibot.number(),
2041
+ costBreakdown: valibot.object({
2042
+ postage: valibot.number(),
2043
+ networkFee: valibot.number(),
2044
+ serviceFee: valibot.number(),
2045
+ appServiceFee: valibot.number()
2046
+ })
2047
+ });
2048
+ const runesEstimateEtchSuccessResponseSchema = createSuccessResponseSchema({
2049
+ resultSchema: runesEstimateEtchResultSchema,
2050
+ method: runesMethods.runes_estimateEtch
2051
+ });
2052
+
2053
+ //#endregion
2054
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateMint/request.ts
2055
+ const runesEstimateMintParamsSchema = valibot.object({
2056
+ runeName: valibot.string(),
2057
+ repeats: valibot.number(),
2058
+ destinationAddress: valibot.string(),
2059
+ feeRate: valibot.number(),
2060
+ appServiceFee: valibot.optional(valibot.number()),
2061
+ appServiceFeeAddress: valibot.optional(valibot.string()),
2062
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2063
+ });
2064
+ const runesEstimateMintRequestSchema = createRequestSchema({
2065
+ paramsSchema: runesEstimateMintParamsSchema,
2066
+ method: runesMethods.runes_estimateMint
2067
+ });
2068
+
2069
+ //#endregion
2070
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateMint/response.ts
2071
+ const runesEstimateMintResultSchema = valibot.object({
2072
+ totalSize: valibot.number(),
2073
+ totalCost: valibot.number(),
2074
+ costBreakdown: valibot.object({
2075
+ postage: valibot.number(),
2076
+ networkFee: valibot.number(),
2077
+ serviceFee: valibot.number(),
2078
+ appServiceFee: valibot.number()
2079
+ })
2080
+ });
2081
+ const runesEstimateMintSuccessResponseSchema = createSuccessResponseSchema({
2082
+ resultSchema: runesEstimateMintResultSchema,
2083
+ method: runesMethods.runes_estimateMint
2084
+ });
2085
+
2086
+ //#endregion
2087
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateRbfOrder/request.ts
2088
+ const runesEstimateRbfOrderParamsSchema = valibot.object({
2089
+ orderId: valibot.string(),
2090
+ newFeeRate: valibot.number(),
2091
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2092
+ });
2093
+ const runesEstimateRbfOrderRequestSchema = createRequestSchema({
2094
+ paramsSchema: runesEstimateRbfOrderParamsSchema,
2095
+ method: runesMethods.runes_estimateRbfOrder
2096
+ });
2097
+
2098
+ //#endregion
2099
+ //#region src/request/rpc/objects/namespaces/runes/methods/estimateRbfOrder/response.ts
2100
+ const runesEstimateRbfOrderResultSchema = valibot.object({
2101
+ rbfCost: valibot.number(),
2102
+ fundingAddress: valibot.string()
2103
+ });
2104
+ const runesEstimateRbfOrderSuccessResponseSchema = createSuccessResponseSchema({
2105
+ resultSchema: runesEstimateRbfOrderResultSchema,
2106
+ method: runesMethods.runes_estimateRbfOrder
2107
+ });
2108
+
2109
+ //#endregion
2110
+ //#region src/request/rpc/objects/namespaces/runes/methods/etch/request.ts
2111
+ const etchTermsSchema = valibot.object({
2112
+ amount: valibot.optional(valibot.string()),
2113
+ cap: valibot.optional(valibot.string()),
2114
+ heightStart: valibot.optional(valibot.string()),
2115
+ heightEnd: valibot.optional(valibot.string()),
2116
+ offsetStart: valibot.optional(valibot.string()),
2117
+ offsetEnd: valibot.optional(valibot.string())
2118
+ });
2119
+ const inscriptionDetailsSchema = valibot.object({
2120
+ contentType: valibot.string(),
2121
+ contentBase64: valibot.string()
2122
+ });
2123
+ const runesEtchParamsSchema = valibot.object({
2124
+ runeName: valibot.string(),
2125
+ divisibility: valibot.optional(valibot.number()),
2126
+ symbol: valibot.optional(valibot.string()),
2127
+ premine: valibot.optional(valibot.string()),
2128
+ isMintable: valibot.boolean(),
2129
+ terms: valibot.optional(etchTermsSchema),
2130
+ inscriptionDetails: valibot.optional(inscriptionDetailsSchema),
2131
+ delegateInscriptionId: valibot.optional(valibot.string()),
2132
+ destinationAddress: valibot.string(),
2133
+ refundAddress: valibot.string(),
2134
+ feeRate: valibot.number(),
2135
+ appServiceFee: valibot.optional(valibot.number()),
2136
+ appServiceFeeAddress: valibot.optional(valibot.string()),
2137
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2138
+ });
2139
+ const runesEtchRequestSchema = createRequestSchema({
2140
+ paramsSchema: runesEtchParamsSchema,
2141
+ method: runesMethods.runes_etch
2142
+ });
2143
+
2144
+ //#endregion
2145
+ //#region src/request/rpc/objects/namespaces/runes/methods/etch/response.ts
2146
+ const runesEtchResultSchema = valibot.object({
2147
+ orderId: valibot.string(),
2148
+ fundTransactionId: valibot.string(),
2149
+ fundingAddress: valibot.string()
2150
+ });
2151
+ const runesEtchSuccessResponseSchema = createSuccessResponseSchema({
2152
+ resultSchema: runesEtchResultSchema,
2153
+ method: runesMethods.runes_etch
2154
+ });
2155
+
2156
+ //#endregion
2157
+ //#region src/request/rpc/objects/namespaces/runes/methods/getBalance/request.ts
2158
+ const runesGetBalanceParamsSchema = valibot.nullish(valibot.null());
2159
+ const runesGetBalanceRequestSchema = createRequestSchema({
2160
+ paramsSchema: runesGetBalanceParamsSchema,
2161
+ method: runesMethods.runes_getBalance
2162
+ });
2163
+
2164
+ //#endregion
2165
+ //#region src/request/rpc/objects/namespaces/runes/methods/getBalance/response.ts
2166
+ const runesGetBalanceResultSchema = valibot.object({ balances: valibot.array(valibot.object({
2167
+ runeName: valibot.string(),
2168
+ amount: valibot.string(),
2169
+ divisibility: valibot.number(),
2170
+ symbol: valibot.string(),
2171
+ inscriptionId: valibot.nullish(valibot.string()),
2172
+ spendableBalance: valibot.string()
2173
+ })) });
2174
+ const runesGetBalanceSuccessResponseSchema = createSuccessResponseSchema({
2175
+ resultSchema: runesGetBalanceResultSchema,
2176
+ method: runesMethods.runes_getBalance
2177
+ });
2178
+
2179
+ //#endregion
2180
+ //#region src/request/rpc/objects/namespaces/runes/methods/getOrder/request.ts
2181
+ const runesGetOrderParamsSchema = valibot.object({
2182
+ id: valibot.string(),
2183
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2184
+ });
2185
+ const runesGetOrderRequestSchema = createRequestSchema({
2186
+ paramsSchema: runesGetOrderParamsSchema,
2187
+ method: runesMethods.runes_getOrder
2188
+ });
2189
+
2190
+ //#endregion
2191
+ //#region src/request/rpc/objects/namespaces/runes/methods/getOrder/response.ts
2192
+ const runesGetOrderResultSchema = valibot.object({
2193
+ id: valibot.string(),
2194
+ orderType: valibot.union([valibot.literal("rune_mint"), valibot.literal("rune_etch")]),
2195
+ state: valibot.union([
2196
+ valibot.literal("new"),
2197
+ valibot.literal("pending"),
2198
+ valibot.literal("executing"),
2199
+ valibot.literal("complete"),
2200
+ valibot.literal("failed"),
2201
+ valibot.literal("refunded"),
2202
+ valibot.literal("stale")
2203
+ ]),
2204
+ fundingAddress: valibot.string(),
2205
+ reason: valibot.optional(valibot.string()),
2206
+ createdAt: valibot.string()
2207
+ });
2208
+ const runesGetOrderSuccessResponseSchema = createSuccessResponseSchema({
2209
+ resultSchema: runesGetOrderResultSchema,
2210
+ method: runesMethods.runes_getOrder
2211
+ });
2212
+
2213
+ //#endregion
2214
+ //#region src/request/rpc/objects/namespaces/runes/methods/mint/request.ts
2215
+ const runesMintParamsSchema = valibot.object({
2216
+ appServiceFee: valibot.optional(valibot.number()),
2217
+ appServiceFeeAddress: valibot.optional(valibot.string()),
2218
+ destinationAddress: valibot.string(),
2219
+ feeRate: valibot.number(),
2220
+ refundAddress: valibot.string(),
2221
+ repeats: valibot.number(),
2222
+ runeName: valibot.string(),
2223
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2224
+ });
2225
+ const runesMintRequestSchema = createRequestSchema({
2226
+ paramsSchema: runesMintParamsSchema,
2227
+ method: runesMethods.runes_mint
2228
+ });
2229
+
2230
+ //#endregion
2231
+ //#region src/request/rpc/objects/namespaces/runes/methods/mint/response.ts
2232
+ const runesMintResultSchema = valibot.object({
2233
+ orderId: valibot.string(),
2234
+ fundTransactionId: valibot.string(),
2235
+ fundingAddress: valibot.string()
2236
+ });
2237
+ const runesMintSuccessResponseSchema = createSuccessResponseSchema({
2238
+ resultSchema: runesMintResultSchema,
2239
+ method: runesMethods.runes_mint
2240
+ });
2241
+
2242
+ //#endregion
2243
+ //#region src/request/rpc/objects/namespaces/runes/methods/rbfOrder/request.ts
2244
+ const runesRbfOrderParamsSchema = valibot.object({
2245
+ orderId: valibot.string(),
2246
+ newFeeRate: valibot.number(),
2247
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2248
+ });
2249
+ const runesRbfOrderRequestSchema = createRequestSchema({
2250
+ paramsSchema: runesRbfOrderParamsSchema,
2251
+ method: runesMethods.runes_rbfOrder
2252
+ });
2253
+
2254
+ //#endregion
2255
+ //#region src/request/rpc/objects/namespaces/runes/methods/rbfOrder/response.ts
2256
+ const runesRbfOrderResultSchema = valibot.object({
2257
+ orderId: valibot.string(),
2258
+ fundRBFTransactionId: valibot.string(),
2259
+ fundingAddress: valibot.string()
2260
+ });
2261
+ const runesRbfOrderSuccessResponseSchema = createSuccessResponseSchema({
2262
+ resultSchema: runesRbfOrderResultSchema,
2263
+ method: runesMethods.runes_rbfOrder
2264
+ });
2265
+
2266
+ //#endregion
2267
+ //#region src/request/rpc/objects/namespaces/runes/methods/transfer/request.ts
2268
+ const runesTransferParamsSchema = valibot.object({
2269
+ recipients: valibot.array(valibot.object({
2270
+ runeName: valibot.string(),
2271
+ amount: valibot.string(),
2272
+ address: valibot.string()
2273
+ })),
2274
+ network: valibot.optional(valibot.enum(BitcoinNetworkType))
2275
+ });
2276
+ const runesTransferRequestSchema = createRequestSchema({
2277
+ paramsSchema: runesTransferParamsSchema,
2278
+ method: runesMethods.runes_transfer
2279
+ });
2280
+
2281
+ //#endregion
2282
+ //#region src/request/rpc/objects/namespaces/runes/methods/transfer/response.ts
2283
+ const runesTransferResultSchema = valibot.object({ txid: valibot.string() });
2284
+ const runesTransferSuccessResponseSchema = createSuccessResponseSchema({
2285
+ resultSchema: runesTransferResultSchema,
2286
+ method: runesMethods.runes_transfer
2287
+ });
2288
+
2289
+ //#endregion
2290
+ //#region src/request/rpc/objects/namespaces/runes/index.ts
2291
+ const runesRequestSchema = valibot.variant("method", [
2292
+ runesEstimateEtchRequestSchema,
2293
+ runesEstimateMintRequestSchema,
2294
+ runesEstimateRbfOrderRequestSchema,
2295
+ runesEtchRequestSchema,
2296
+ runesGetBalanceRequestSchema,
2297
+ runesGetOrderRequestSchema,
2298
+ runesMintRequestSchema,
2299
+ runesRbfOrderRequestSchema,
2300
+ runesTransferRequestSchema
2301
+ ]);
2302
+ const runesSuccessResponseSchema = valibot.variant("~sats-connect-method", [
2303
+ runesEstimateEtchSuccessResponseSchema,
2304
+ runesEstimateMintSuccessResponseSchema,
2305
+ runesEstimateRbfOrderSuccessResponseSchema,
2306
+ runesEtchSuccessResponseSchema,
2307
+ runesGetBalanceSuccessResponseSchema,
2308
+ runesGetOrderSuccessResponseSchema,
2309
+ runesMintSuccessResponseSchema,
2310
+ runesRbfOrderSuccessResponseSchema,
2311
+ runesTransferSuccessResponseSchema
2312
+ ]);
2313
+
2314
+ //#endregion
2315
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetClawbackFunds/request.ts
2316
+ const sparkFlashnetClawbackFundsParamsSchema = valibot.object({
2317
+ sparkTransferId: valibot.string(),
2318
+ lpIdentityPublicKey: valibot.string()
2319
+ });
2320
+ const sparkFlashnetClawbackFundsRequestSchema = createRequestSchema({
2321
+ paramsSchema: sparkFlashnetClawbackFundsParamsSchema,
2322
+ method: sparkMethods.spark_flashnet_clawbackFunds
2323
+ });
2324
+
2325
+ //#endregion
2326
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetClawbackFunds/response.ts
2327
+ const sparkFlashnetClawbackFundsResultSchema = valibot.object({
2328
+ requestId: valibot.string(),
2329
+ accepted: valibot.boolean(),
2330
+ internalRequestId: valibot.optional(valibot.string()),
2331
+ sparkStatusTrackingId: valibot.optional(valibot.string()),
2332
+ error: valibot.optional(valibot.string())
2333
+ });
2334
+ const sparkFlashnetClawbackFundsSuccessResponseSchema = createSuccessResponseSchema({
2335
+ resultSchema: sparkFlashnetClawbackFundsResultSchema,
2336
+ method: sparkMethods.spark_flashnet_clawbackFunds
2337
+ });
2338
+
2339
+ //#endregion
2340
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteRouteSwap/request.ts
2341
+ const sparkFlashnetExecuteRouteSwapParamsSchema = valibot.object({
2342
+ hops: valibot.array(valibot.object({
2343
+ poolId: valibot.string(),
2344
+ assetInAddress: valibot.string(),
2345
+ assetOutAddress: valibot.string(),
2346
+ hopIntegratorFeeRateBps: valibot.optional(valibot.number())
2347
+ })),
2348
+ initialAssetAddress: valibot.string(),
2349
+ inputAmount: valibot.string(),
2350
+ maxRouteSlippageBps: valibot.string(),
2351
+ minAmountOut: valibot.optional(valibot.string()),
2352
+ integratorFeeRateBps: valibot.optional(valibot.number()),
2353
+ integratorPublicKey: valibot.optional(valibot.string())
2354
+ });
2355
+ const sparkFlashnetExecuteRouteSwapRequestSchema = createRequestSchema({
2356
+ paramsSchema: sparkFlashnetExecuteRouteSwapParamsSchema,
2357
+ method: sparkMethods.spark_flashnet_executeRouteSwap
2358
+ });
2359
+
2360
+ //#endregion
2361
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteRouteSwap/response.ts
2362
+ const sparkFlashnetExecuteRouteSwapResultSchema = valibot.object({
2363
+ requestId: valibot.string(),
2364
+ accepted: valibot.boolean(),
2365
+ outputAmount: valibot.string(),
2366
+ executionPrice: valibot.string(),
2367
+ finalOutboundTransferId: valibot.string(),
2368
+ error: valibot.optional(valibot.string())
2369
+ });
2370
+ const sparkFlashnetExecuteRouteSwapSuccessResponseSchema = createSuccessResponseSchema({
2371
+ resultSchema: sparkFlashnetExecuteRouteSwapResultSchema,
2372
+ method: sparkMethods.spark_flashnet_executeRouteSwap
2373
+ });
2374
+
2375
+ //#endregion
2376
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteSwap/request.ts
2377
+ const sparkFlashnetExecuteSwapParamsSchema = valibot.object({
2378
+ poolId: valibot.string(),
2379
+ assetInAddress: valibot.string(),
2380
+ assetOutAddress: valibot.string(),
2381
+ amountIn: valibot.string(),
2382
+ maxSlippageBps: valibot.number(),
2383
+ minAmountOut: valibot.optional(valibot.string()),
2384
+ integratorFeeRateBps: valibot.optional(valibot.number()),
2385
+ integratorPublicKey: valibot.optional(valibot.string())
2386
+ });
2387
+ const sparkFlashnetExecuteSwapRequestSchema = createRequestSchema({
2388
+ paramsSchema: sparkFlashnetExecuteSwapParamsSchema,
2389
+ method: sparkMethods.spark_flashnet_executeSwap
2390
+ });
2391
+
2392
+ //#endregion
2393
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetExecuteSwap/response.ts
2394
+ const sparkFlashnetExecuteSwapResultSchema = valibot.object({
2395
+ requestId: valibot.string(),
2396
+ accepted: valibot.boolean(),
2397
+ amountOut: valibot.optional(valibot.string()),
2398
+ feeAmount: valibot.optional(valibot.string()),
2399
+ executionPrice: valibot.optional(valibot.string()),
2400
+ assetOutAddress: valibot.optional(valibot.string()),
2401
+ assetInAddress: valibot.optional(valibot.string()),
2402
+ outboundTransferId: valibot.optional(valibot.string()),
2403
+ error: valibot.optional(valibot.string())
2404
+ });
2405
+ const sparkFlashnetExecuteSwapSuccessResponseSchema = createSuccessResponseSchema({
2406
+ resultSchema: sparkFlashnetExecuteSwapResultSchema,
2407
+ method: sparkMethods.spark_flashnet_executeSwap
2408
+ });
2409
+
2410
+ //#endregion
2411
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetClawbackEligibleTransfers/request.ts
2412
+ const sparkGetClawbackEligibleTransfersParamsSchema = valibot.nullish(valibot.null());
2413
+ const sparkGetClawbackEligibleTransfersRequestSchema = createRequestSchema({
2414
+ paramsSchema: sparkGetClawbackEligibleTransfersParamsSchema,
2415
+ method: sparkMethods.spark_flashnet_getClawbackEligibleTransfers
2416
+ });
2417
+
2418
+ //#endregion
2419
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetClawbackEligibleTransfers/response.ts
2420
+ const sparkGetClawbackEligibleTransfersResultSchema = valibot.object({ eligibleTransfers: valibot.array(valibot.object({
2421
+ txId: valibot.string(),
2422
+ createdAt: valibot.string(),
2423
+ lpIdentityPublicKey: valibot.string()
2424
+ })) });
2425
+ const sparkGetClawbackEligibleTransfersSuccessResponseSchema = createSuccessResponseSchema({
2426
+ resultSchema: sparkGetClawbackEligibleTransfersResultSchema,
2427
+ method: sparkMethods.spark_flashnet_getClawbackEligibleTransfers
2428
+ });
2429
+
2430
+ //#endregion
2431
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetJwt/request.ts
2432
+ const sparkFlashnetGetJwtParamsSchema = valibot.null();
2433
+ const sparkFlashnetGetJwtRequestSchema = createRequestSchema({
2434
+ paramsSchema: sparkFlashnetGetJwtParamsSchema,
2435
+ method: sparkMethods.spark_flashnet_getJwt
2436
+ });
2437
+
2438
+ //#endregion
2439
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetGetJwt/response.ts
2440
+ const sparkFlashnetGetJwtResultSchema = valibot.object({ jwt: valibot.string() });
2441
+ const sparkFlashnetGetJwtSuccessResponseSchema = createSuccessResponseSchema({
2442
+ resultSchema: sparkFlashnetGetJwtResultSchema,
2443
+ method: sparkMethods.spark_flashnet_getJwt
2444
+ });
2445
+
2446
+ //#endregion
2447
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/addLiquidity.ts
2448
+ const sparkFlashnetAddLiquidityIntentSchema = valibot.object({
2449
+ type: valibot.literal("addLiquidity"),
2450
+ data: valibot.object({
2451
+ userPublicKey: valibot.string(),
2452
+ poolId: valibot.string(),
2453
+ assetAAmount: valibot.string(),
2454
+ assetBAmount: valibot.string(),
2455
+ assetAMinAmountIn: valibot.string(),
2456
+ assetBMinAmountIn: valibot.string(),
2457
+ assetATransferId: valibot.string(),
2458
+ assetBTransferId: valibot.string(),
2459
+ nonce: valibot.string()
2460
+ })
2461
+ });
2462
+
2463
+ //#endregion
2464
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/clawback.ts
2465
+ const sparkFlashnetClawbackIntentSchema = valibot.object({
2466
+ type: valibot.literal("clawback"),
2467
+ data: valibot.object({
2468
+ senderPublicKey: valibot.string(),
2469
+ sparkTransferId: valibot.string(),
2470
+ lpIdentityPublicKey: valibot.string(),
2471
+ nonce: valibot.string()
2472
+ })
2473
+ });
2474
+
2475
+ //#endregion
2476
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/confirmInitialDeposit.ts
2477
+ const sparkFlashnetConfirmInitialDepositIntentSchema = valibot.object({
2478
+ type: valibot.literal("confirmInitialDeposit"),
2479
+ data: valibot.object({
2480
+ poolId: valibot.string(),
2481
+ assetASparkTransferId: valibot.string(),
2482
+ poolOwnerPublicKey: valibot.string(),
2483
+ nonce: valibot.string()
2484
+ })
2485
+ });
2486
+
2487
+ //#endregion
2488
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/createConstantProductPool.ts
2489
+ const sparkFlashnetCreateConstantProductPoolIntentSchema = valibot.object({
2490
+ type: valibot.literal("createConstantProductPool"),
2491
+ data: valibot.object({
2492
+ poolOwnerPublicKey: valibot.string(),
2493
+ assetAAddress: valibot.string(),
2494
+ assetBAddress: valibot.string(),
2495
+ lpFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
2496
+ totalHostFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
2497
+ nonce: valibot.string()
2498
+ })
2499
+ });
2500
+
2501
+ //#endregion
2502
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/createSingleSidedPool.ts
2503
+ const sparkFlashnetCreateSingleSidedPoolIntentSchema = valibot.object({
2504
+ type: valibot.literal("createSingleSidedPool"),
2505
+ data: valibot.object({
2506
+ assetAAddress: valibot.string(),
2507
+ assetBAddress: valibot.string(),
2508
+ assetAInitialReserve: valibot.string(),
2509
+ virtualReserveA: valibot.union([valibot.number(), valibot.string()]),
2510
+ virtualReserveB: valibot.union([valibot.number(), valibot.string()]),
2511
+ threshold: valibot.union([valibot.number(), valibot.string()]),
2512
+ lpFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
2513
+ totalHostFeeRateBps: valibot.union([valibot.number(), valibot.string()]),
2514
+ poolOwnerPublicKey: valibot.string(),
2515
+ nonce: valibot.string()
2516
+ })
2517
+ });
2518
+
2519
+ //#endregion
2520
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/removeLiquidity.ts
2521
+ const sparkFlashnetRemoveLiquidityIntentSchema = valibot.object({
2522
+ type: valibot.literal("removeLiquidity"),
2523
+ data: valibot.object({
2524
+ userPublicKey: valibot.string(),
2525
+ poolId: valibot.string(),
2526
+ lpTokensToRemove: valibot.string(),
2527
+ nonce: valibot.string()
2528
+ })
2529
+ });
2530
+
2531
+ //#endregion
2532
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/routeSwap.ts
2533
+ const sparkFlashnetRouteSwapIntentSchema = valibot.object({
2534
+ type: valibot.literal("executeRouteSwap"),
2535
+ data: valibot.object({
2536
+ userPublicKey: valibot.string(),
2537
+ initialSparkTransferId: valibot.string(),
2538
+ hops: valibot.array(valibot.object({
2539
+ poolId: valibot.string(),
2540
+ inputAssetAddress: valibot.string(),
2541
+ outputAssetAddress: valibot.string(),
2542
+ hopIntegratorFeeRateBps: valibot.optional(valibot.union([valibot.number(), valibot.string()]))
2543
+ })),
2544
+ inputAmount: valibot.string(),
2545
+ maxRouteSlippageBps: valibot.union([valibot.number(), valibot.string()]),
2546
+ minAmountOut: valibot.string(),
2547
+ defaultIntegratorFeeRateBps: valibot.optional(valibot.union([valibot.number(), valibot.string()])),
2548
+ nonce: valibot.string()
2549
+ })
2550
+ });
2551
+
2552
+ //#endregion
2553
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/intents/swap.ts
2554
+ const sparkFlashnetSwapIntentSchema = valibot.object({
2555
+ type: valibot.literal("executeSwap"),
2556
+ data: valibot.object({
2557
+ userPublicKey: valibot.string(),
2558
+ poolId: valibot.string(),
2559
+ transferId: valibot.string(),
2560
+ assetInAddress: valibot.string(),
2561
+ assetOutAddress: valibot.string(),
2562
+ amountIn: valibot.string(),
2563
+ maxSlippageBps: valibot.union([valibot.number(), valibot.string()]),
2564
+ minAmountOut: valibot.string(),
2565
+ totalIntegratorFeeRateBps: valibot.optional(valibot.union([valibot.number(), valibot.string()])),
2566
+ nonce: valibot.string()
2567
+ })
2568
+ });
2569
+
2570
+ //#endregion
2571
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/request.ts
2572
+ const sparkFlashnetSignIntentParamsSchema = valibot.union([
2573
+ sparkFlashnetSwapIntentSchema,
2574
+ sparkFlashnetRouteSwapIntentSchema,
2575
+ sparkFlashnetAddLiquidityIntentSchema,
2576
+ sparkFlashnetClawbackIntentSchema,
2577
+ sparkFlashnetConfirmInitialDepositIntentSchema,
2578
+ sparkFlashnetCreateConstantProductPoolIntentSchema,
2579
+ sparkFlashnetCreateSingleSidedPoolIntentSchema,
2580
+ sparkFlashnetRemoveLiquidityIntentSchema
2581
+ ]);
2582
+ const sparkFlashnetSignIntentRequestSchema = createRequestSchema({
2583
+ paramsSchema: sparkFlashnetSignIntentParamsSchema,
2584
+ method: sparkMethods.spark_flashnet_signIntent
2585
+ });
2586
+
2587
+ //#endregion
2588
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignIntent/response.ts
2589
+ const sparkFlashnetSignIntentResultSchema = valibot.object({ signature: valibot.string() });
2590
+ const sparkFlashnetSignIntentSuccessResponseSchema = createSuccessResponseSchema({
2591
+ resultSchema: sparkFlashnetSignIntentResultSchema,
2592
+ method: sparkMethods.spark_flashnet_signIntent
2593
+ });
2594
+
2595
+ //#endregion
2596
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignStructuredMessage/request.ts
2597
+ const sparkFlashnetSignStructuredMessageParamsSchema = valibot.object({ message: valibot.string() });
2598
+ const sparkFlashnetSignStructuredMessageRequestSchema = createRequestSchema({
2599
+ paramsSchema: sparkFlashnetSignStructuredMessageParamsSchema,
2600
+ method: sparkMethods.spark_flashnet_signStructuredMessage
2601
+ });
2602
+
2603
+ //#endregion
2604
+ //#region src/request/rpc/objects/namespaces/spark/methods/flashnetSignStructuredMessage/response.ts
2605
+ const sparkFlashnetSignStructuredMessageResultSchema = valibot.object({
2606
+ message: valibot.string(),
2607
+ signature: valibot.string()
2608
+ });
2609
+ const sparkFlashnetSignStructuredMessageSuccessResponseSchema = createSuccessResponseSchema({
2610
+ resultSchema: sparkFlashnetSignStructuredMessageResultSchema,
2611
+ method: sparkMethods.spark_flashnet_signStructuredMessage
2612
+ });
2613
+
2614
+ //#endregion
2615
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddresses/request.ts
2616
+ const sparkGetAddressesParamsSchema = valibot.nullish(valibot.object({ message: valibot.optional(valibot.string()) }));
2617
+ const sparkGetAddressesRequestSchema = createRequestSchema({
2618
+ paramsSchema: sparkGetAddressesParamsSchema,
2619
+ method: sparkMethods.spark_getAddresses
2620
+ });
2621
+
2622
+ //#endregion
2623
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddresses/response.ts
2624
+ const sparkGetAddressesResultSchema = valibot.object({
2625
+ addresses: valibot.array(addressSchema),
2626
+ network: walletGetNetworkResultSchema
2627
+ });
2628
+ const sparkGetAddressesSuccessResponseSchema = createSuccessResponseSchema({
2629
+ resultSchema: sparkGetAddressesResultSchema,
2630
+ method: sparkMethods.spark_getAddresses
2631
+ });
2632
+
2633
+ //#endregion
2634
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddressesV2/request.ts
2635
+ const sparkGetAddressesV2ParamsSchema = valibot.nullish(valibot.object({ message: valibot.optional(valibot.string()) }));
2636
+ const sparkGetAddressesV2RequestSchema = createRequestSchema({
2637
+ paramsSchema: sparkGetAddressesV2ParamsSchema,
2638
+ method: sparkMethods.spark_getAddressesV2
2639
+ });
2640
+
2641
+ //#endregion
2642
+ //#region src/request/rpc/objects/namespaces/spark/methods/getAddressesV2/response.ts
2643
+ const sparkGetAddressesV2ResultSchema = valibot.object({
2644
+ addresses: valibot.array(addressSchema),
2645
+ network: sparkNetworkConfigurationSchema
2646
+ });
2647
+ const sparkGetAddressesV2SuccessResponseSchema = createSuccessResponseSchema({
2648
+ resultSchema: sparkGetAddressesV2ResultSchema,
2649
+ method: sparkMethods.spark_getAddressesV2
2650
+ });
2651
+
2652
+ //#endregion
2653
+ //#region src/request/rpc/objects/namespaces/spark/methods/getBalance/request.ts
2654
+ const sparkGetBalanceParamsSchema = valibot.nullish(valibot.null());
2655
+ const sparkGetBalanceRequestSchema = createRequestSchema({
2656
+ paramsSchema: sparkGetBalanceParamsSchema,
2657
+ method: sparkMethods.spark_getBalance
2658
+ });
2659
+
2660
+ //#endregion
2661
+ //#region src/request/rpc/objects/namespaces/spark/methods/getBalance/response.ts
2662
+ const sparkGetBalanceResultSchema = valibot.object({
2663
+ balance: valibot.string(),
2664
+ tokenBalances: valibot.array(valibot.object({
2665
+ balance: valibot.string(),
2666
+ tokenMetadata: valibot.object({
2667
+ tokenIdentifier: valibot.string(),
2668
+ tokenName: valibot.string(),
2669
+ tokenTicker: valibot.string(),
2670
+ decimals: valibot.number(),
2671
+ maxSupply: valibot.string()
2672
+ })
2673
+ }))
2674
+ });
2675
+ const sparkGetBalanceSuccessResponseSchema = createSuccessResponseSchema({
2676
+ resultSchema: sparkGetBalanceResultSchema,
2677
+ method: sparkMethods.spark_getBalance
2678
+ });
2679
+
2680
+ //#endregion
2681
+ //#region src/request/rpc/objects/namespaces/spark/methods/signMessage/request.ts
2682
+ const sparkSignMessageParamsSchema = valibot.object({ message: valibot.string() });
2683
+ const sparkSignMessageRequestSchema = createRequestSchema({
2684
+ paramsSchema: sparkSignMessageParamsSchema,
2685
+ method: sparkMethods.spark_signMessage
2686
+ });
2687
+
2688
+ //#endregion
2689
+ //#region src/request/rpc/objects/namespaces/spark/methods/signMessage/response.ts
2690
+ const sparkSignMessageResultSchema = valibot.object({ signature: valibot.string() });
2691
+ const sparkSignMessageSuccessResponseSchema = createSuccessResponseSchema({
2692
+ resultSchema: sparkSignMessageResultSchema,
2693
+ method: sparkMethods.spark_signMessage
2694
+ });
2695
+
2696
+ //#endregion
2697
+ //#region src/request/rpc/objects/namespaces/spark/methods/transfer/request.ts
2698
+ const sparkTransferParamsSchema = valibot.object({
2699
+ amountSats: valibot.union([valibot.number(), valibot.string()]),
2700
+ receiverSparkAddress: valibot.string()
2701
+ });
2702
+ const sparkTransferRequestSchema = createRequestSchema({
2703
+ paramsSchema: sparkTransferParamsSchema,
2704
+ method: sparkMethods.spark_transfer
2705
+ });
2706
+
2707
+ //#endregion
2708
+ //#region src/request/rpc/objects/namespaces/spark/methods/transfer/response.ts
2709
+ const sparkTransferResultSchema = valibot.object({ id: valibot.string() });
2710
+ const sparkTransferSuccessResponseSchema = createSuccessResponseSchema({
2711
+ resultSchema: sparkTransferResultSchema,
2712
+ method: sparkMethods.spark_transfer
2713
+ });
2714
+
2715
+ //#endregion
2716
+ //#region src/request/rpc/objects/namespaces/spark/methods/transferToken/request.ts
2717
+ const sparkTransferTokenParamsSchema = valibot.object({
2718
+ tokenAmount: valibot.union([valibot.number(), valibot.string()]),
2719
+ tokenIdentifier: valibot.string(),
2720
+ receiverSparkAddress: valibot.string()
2721
+ });
2722
+ const sparkTransferTokenRequestSchema = createRequestSchema({
2723
+ paramsSchema: sparkTransferTokenParamsSchema,
2724
+ method: sparkMethods.spark_transferToken
2725
+ });
2726
+
2727
+ //#endregion
2728
+ //#region src/request/rpc/objects/namespaces/spark/methods/transferToken/response.ts
2729
+ const sparkTransferTokenResultSchema = valibot.object({ id: valibot.string() });
2730
+ const sparkTransferTokenSuccessResponseSchema = createSuccessResponseSchema({
2731
+ resultSchema: sparkTransferTokenResultSchema,
2732
+ method: sparkMethods.spark_transferToken
2733
+ });
2734
+
2735
+ //#endregion
2736
+ //#region src/request/rpc/objects/namespaces/spark/index.ts
2737
+ const sparkRequestSchema = valibot.variant("method", [
2738
+ sparkGetAddressesRequestSchema,
2739
+ sparkGetAddressesV2RequestSchema,
2740
+ sparkGetBalanceRequestSchema,
2741
+ sparkTransferRequestSchema,
2742
+ sparkTransferTokenRequestSchema,
2743
+ sparkSignMessageRequestSchema,
2744
+ sparkFlashnetGetJwtRequestSchema,
2745
+ sparkFlashnetSignIntentRequestSchema,
2746
+ sparkFlashnetSignStructuredMessageRequestSchema,
2747
+ sparkFlashnetExecuteSwapRequestSchema,
2748
+ sparkFlashnetExecuteRouteSwapRequestSchema,
2749
+ sparkFlashnetClawbackFundsRequestSchema,
2750
+ sparkGetClawbackEligibleTransfersRequestSchema
2751
+ ]);
2752
+ const sparkSuccessResponseSchema = valibot.variant("~sats-connect-method", [
2753
+ sparkGetAddressesSuccessResponseSchema,
2754
+ sparkGetAddressesV2SuccessResponseSchema,
2755
+ sparkGetBalanceSuccessResponseSchema,
2756
+ sparkTransferSuccessResponseSchema,
2757
+ sparkTransferTokenSuccessResponseSchema,
2758
+ sparkSignMessageSuccessResponseSchema,
2759
+ sparkFlashnetGetJwtSuccessResponseSchema,
2760
+ sparkFlashnetSignIntentSuccessResponseSchema,
2761
+ sparkFlashnetSignStructuredMessageSuccessResponseSchema,
2762
+ sparkFlashnetExecuteSwapSuccessResponseSchema,
2763
+ sparkFlashnetExecuteRouteSwapSuccessResponseSchema,
2764
+ sparkFlashnetClawbackFundsSuccessResponseSchema,
2765
+ sparkGetClawbackEligibleTransfersSuccessResponseSchema
2766
+ ]);
2767
+
2768
+ //#endregion
2769
+ //#region src/request/rpc/objects/namespaces/stacks/methods/callContract/request.ts
2770
+ const stacksCallContractParamsSchema = valibot.object({
2771
+ contract: valibot.string(),
2772
+ functionName: valibot.string(),
2773
+ arguments: valibot.optional(valibot.array(valibot.string())),
2774
+ functionArgs: valibot.optional(valibot.array(valibot.string())),
2775
+ postConditions: valibot.optional(valibot.array(valibot.string())),
2776
+ postConditionMode: valibot.optional(valibot.union([valibot.literal("allow"), valibot.literal("deny")]))
2777
+ });
2778
+ const stacksCallContractRequestSchema = createRequestSchema({
2779
+ paramsSchema: stacksCallContractParamsSchema,
2780
+ method: stacksMethods.stx_callContract
2781
+ });
2782
+
2783
+ //#endregion
2784
+ //#region src/request/rpc/objects/namespaces/stacks/methods/callContract/response.ts
2785
+ const stacksCallContractResultSchema = valibot.object({
2786
+ txid: valibot.string(),
2787
+ transaction: valibot.string()
2788
+ });
2789
+ const stacksCallContractSuccessResponseSchema = createSuccessResponseSchema({
2790
+ resultSchema: stacksCallContractResultSchema,
2791
+ method: stacksMethods.stx_callContract
2792
+ });
2793
+
2794
+ //#endregion
2795
+ //#region src/request/rpc/objects/namespaces/stacks/methods/deployContract/request.ts
2796
+ const stacksDeployContractParamsSchema = valibot.object({
2797
+ name: valibot.string(),
2798
+ clarityCode: valibot.string(),
2799
+ clarityVersion: valibot.optional(valibot.number()),
2800
+ postConditions: valibot.optional(valibot.array(valibot.string())),
2801
+ postConditionMode: valibot.optional(valibot.union([valibot.literal("allow"), valibot.literal("deny")]))
2802
+ });
2803
+ const stacksDeployContractRequestSchema = createRequestSchema({
2804
+ paramsSchema: stacksDeployContractParamsSchema,
2805
+ method: stacksMethods.stx_deployContract
2806
+ });
2807
+
2808
+ //#endregion
2809
+ //#region src/request/rpc/objects/namespaces/stacks/methods/deployContract/response.ts
2810
+ const stacksDeployContractResultSchema = valibot.object({
2811
+ txid: valibot.string(),
2812
+ transaction: valibot.string()
2813
+ });
2814
+ const stacksDeployContractSuccessResponseSchema = createSuccessResponseSchema({
2815
+ resultSchema: stacksDeployContractResultSchema,
2816
+ method: stacksMethods.stx_deployContract
2817
+ });
2818
+
2819
+ //#endregion
2820
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAccounts/request.ts
2821
+ const stacksGetAccountsParamsSchema = valibot.nullish(valibot.null());
2822
+ const stacksGetAccountsRequestSchema = createRequestSchema({
2823
+ paramsSchema: stacksGetAccountsParamsSchema,
2824
+ method: stacksMethods.stx_getAccounts
2825
+ });
2826
+
2827
+ //#endregion
2828
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAccounts/response.ts
2829
+ const stacksGetAccountsResultSchema = valibot.object({
2830
+ addresses: valibot.array(valibot.object({
2831
+ address: valibot.string(),
2832
+ publicKey: valibot.string(),
2833
+ gaiaHubUrl: valibot.string(),
2834
+ gaiaAppKey: valibot.string()
2835
+ })),
2836
+ network: walletGetNetworkResultSchema
2837
+ });
2838
+ const stacksGetAccountsSuccessResponseSchema = createSuccessResponseSchema({
2839
+ resultSchema: stacksGetAccountsResultSchema,
2840
+ method: stacksMethods.stx_getAccounts
2841
+ });
2842
+
2843
+ //#endregion
2844
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAddresses/request.ts
2845
+ const stacksGetAddressesParamsSchema = valibot.nullish(valibot.object({ message: valibot.optional(valibot.string()) }));
2846
+ const stacksGetAddressesRequestSchema = createRequestSchema({
2847
+ paramsSchema: stacksGetAddressesParamsSchema,
2848
+ method: stacksMethods.stx_getAddresses
2849
+ });
2850
+
2851
+ //#endregion
2852
+ //#region src/request/rpc/objects/namespaces/stacks/methods/getAddresses/response.ts
2853
+ const stacksGetAddressesResultSchema = valibot.object({
2854
+ addresses: valibot.array(addressSchema),
2855
+ network: walletGetNetworkResultSchema
2856
+ });
2857
+ const stacksGetAddressesSuccessResponseSchema = createSuccessResponseSchema({
2858
+ resultSchema: stacksGetAddressesResultSchema,
2859
+ method: stacksMethods.stx_getAddresses
2860
+ });
2861
+
2862
+ //#endregion
2863
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signMessage/request.ts
2864
+ const stacksSignMessageParamsSchema = valibot.object({ message: valibot.string() });
2865
+ const stacksSignMessageRequestSchema = createRequestSchema({
2866
+ paramsSchema: stacksSignMessageParamsSchema,
2867
+ method: stacksMethods.stx_signMessage
2868
+ });
2869
+
2870
+ //#endregion
2871
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signMessage/response.ts
2872
+ const stacksSignMessageResultSchema = valibot.object({
2873
+ signature: valibot.string(),
2874
+ publicKey: valibot.string()
2875
+ });
2876
+ const stacksSignMessageSuccessResponseSchema = createSuccessResponseSchema({
2877
+ resultSchema: stacksSignMessageResultSchema,
2878
+ method: stacksMethods.stx_signMessage
2879
+ });
2880
+
2881
+ //#endregion
2882
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signStructuredMessage/request.ts
2883
+ const stacksSignStructuredMessageParamsSchema = valibot.object({
2884
+ domain: valibot.string(),
2885
+ message: valibot.string(),
2886
+ publicKey: valibot.optional(valibot.string())
2887
+ });
2888
+ const stacksSignStructuredMessageRequestSchema = createRequestSchema({
2889
+ paramsSchema: stacksSignStructuredMessageParamsSchema,
2890
+ method: stacksMethods.stx_signStructuredMessage
2891
+ });
2892
+
2893
+ //#endregion
2894
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signStructuredMessage/response.ts
2895
+ const stacksSignStructuredMessageResultSchema = valibot.object({
2896
+ signature: valibot.string(),
2897
+ publicKey: valibot.string()
2898
+ });
2899
+ const stacksSignStructuredMessageSuccessResponseSchema = createSuccessResponseSchema({
2900
+ resultSchema: stacksSignStructuredMessageResultSchema,
2901
+ method: stacksMethods.stx_signStructuredMessage
2902
+ });
2903
+
2904
+ //#endregion
2905
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransaction/request.ts
2906
+ const stacksSignTransactionParamsSchema = valibot.object({
2907
+ transaction: valibot.string(),
2908
+ pubkey: valibot.optional(valibot.string()),
2909
+ broadcast: valibot.optional(valibot.boolean())
2910
+ });
2911
+ const stacksSignTransactionRequestSchema = createRequestSchema({
2912
+ paramsSchema: stacksSignTransactionParamsSchema,
2913
+ method: stacksMethods.stx_signTransaction
2914
+ });
2915
+
2916
+ //#endregion
2917
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransaction/response.ts
2918
+ const stacksSignTransactionResultSchema = valibot.object({ transaction: valibot.string() });
2919
+ const stacksSignTransactionSuccessResponseSchema = createSuccessResponseSchema({
2920
+ resultSchema: stacksSignTransactionResultSchema,
2921
+ method: stacksMethods.stx_signTransaction
2922
+ });
2923
+
2924
+ //#endregion
2925
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransactions/request.ts
2926
+ const stacksSignTransactionsParamsSchema = valibot.object({
2927
+ transactions: valibot.pipe(valibot.array(valibot.pipe(valibot.string(), valibot.check(() => {
2928
+ return true;
2929
+ }, "Invalid hex-encoded Stacks transaction."))), valibot.minLength(1)),
2930
+ broadcast: valibot.optional(valibot.boolean(), true)
2931
+ });
2932
+ const stacksSignTransactionsRequestSchema = createRequestSchema({
2933
+ paramsSchema: stacksSignTransactionsParamsSchema,
2934
+ method: stacksMethods.stx_signTransactions
2935
+ });
2936
+
2937
+ //#endregion
2938
+ //#region src/request/rpc/objects/namespaces/stacks/methods/signTransactions/response.ts
2939
+ const stacksSignTransactionsResultSchema = valibot.object({ transactions: valibot.array(valibot.string()) });
2940
+ const stacksSignTransactionsSuccessResponseSchema = createSuccessResponseSchema({
2941
+ resultSchema: stacksSignTransactionsResultSchema,
2942
+ method: stacksMethods.stx_signTransactions
2943
+ });
2944
+
2945
+ //#endregion
2946
+ //#region src/request/rpc/objects/namespaces/stacks/methods/transferStx/request.ts
2947
+ const stacksTransferStxParamsSchema = valibot.object({
2948
+ amount: valibot.union([valibot.number(), valibot.string()]),
2949
+ recipient: valibot.string(),
2950
+ memo: valibot.optional(valibot.string()),
2951
+ version: valibot.optional(valibot.string()),
2952
+ postConditionMode: valibot.optional(valibot.number()),
2953
+ postConditions: valibot.optional(valibot.array(valibot.string())),
2954
+ pubkey: valibot.optional(valibot.string())
2955
+ });
2956
+ const stacksTransferStxRequestSchema = createRequestSchema({
2957
+ paramsSchema: stacksTransferStxParamsSchema,
2958
+ method: stacksMethods.stx_transferStx
2959
+ });
2960
+
2961
+ //#endregion
2962
+ //#region src/request/rpc/objects/namespaces/stacks/methods/transferStx/response.ts
2963
+ const stacksTransferStxResultSchema = valibot.object({
2964
+ txid: valibot.string(),
2965
+ transaction: valibot.string()
2966
+ });
2967
+ const stacksTransferStxSuccessResponseSchema = createSuccessResponseSchema({
2968
+ resultSchema: stacksTransferStxResultSchema,
2969
+ method: stacksMethods.stx_transferStx
2970
+ });
2971
+
2972
+ //#endregion
2973
+ //#region src/request/rpc/objects/namespaces/stacks/index.ts
2974
+ const stacksRequestSchema = valibot.variant("method", [
2975
+ stacksCallContractRequestSchema,
2976
+ stacksDeployContractRequestSchema,
2977
+ stacksGetAccountsRequestSchema,
2978
+ stacksGetAddressesRequestSchema,
2979
+ stacksSignMessageRequestSchema,
2980
+ stacksSignStructuredMessageRequestSchema,
2981
+ stacksSignTransactionRequestSchema,
2982
+ stacksSignTransactionsRequestSchema,
2983
+ stacksTransferStxRequestSchema
2984
+ ]);
2985
+ const stacksSuccessResponseSchema = valibot.variant("~sats-connect-method", [
2986
+ stacksCallContractSuccessResponseSchema,
2987
+ stacksDeployContractSuccessResponseSchema,
2988
+ stacksGetAccountsSuccessResponseSchema,
2989
+ stacksGetAddressesSuccessResponseSchema,
2990
+ stacksSignMessageSuccessResponseSchema,
2991
+ stacksSignStructuredMessageSuccessResponseSchema,
2992
+ stacksSignTransactionSuccessResponseSchema,
2993
+ stacksSignTransactionsSuccessResponseSchema,
2994
+ stacksTransferStxSuccessResponseSchema
2995
+ ]);
2996
+
2997
+ //#endregion
2998
+ //#region src/request/rpc/requests.ts
2999
+ const rpcRequestSchema = valibot.variant("method", [
3000
+ bitcoinRequestSchema,
3001
+ stacksRequestSchema,
3002
+ sparkRequestSchema,
3003
+ runesRequestSchema,
3004
+ ordinalsRequestSchema,
3005
+ walletRequestSchema
3006
+ ]);
3007
+ function createRpcRequest({ method, params, id }) {
3008
+ return {
3009
+ jsonrpc: "2.0",
3010
+ method,
3011
+ params,
3012
+ id
3013
+ };
3014
+ }
3015
+
3016
+ //#endregion
3017
+ //#region src/request/rpc/responses.ts
3018
+ const rpcSuccessResponseSchema = valibot.variant("~sats-connect-method", [
3019
+ bitcoinSuccessResponseSchema,
3020
+ stacksSuccessResponseSchema,
3021
+ sparkSuccessResponseSchema,
3022
+ runesSuccessResponseSchema,
3023
+ ordinalsSuccessResponseSchema,
3024
+ walletSuccessResponseSchema
3025
+ ]);
3026
+ function createRpcSuccessResponse({ method, result, id }) {
3027
+ return {
3028
+ jsonrpc: "2.0",
3029
+ id,
3030
+ result,
3031
+ "~sats-connect-method": method
3032
+ };
3033
+ }
3034
+
3035
+ //#endregion
3036
+ //#region src/request/index.ts
3037
+ const cache = {};
3038
+ const requestInternal = async (provider, method, params) => {
3039
+ const response = await provider.request(method, params);
3040
+ if (valibot.is(specErrorResponseSchema, response)) return {
3041
+ status: "error",
3042
+ error: response.error
3043
+ };
3044
+ if (valibot.is(specSuccessWithExtensionsResponseSchema, response)) return {
3045
+ status: "success",
3046
+ result: response.result
3047
+ };
3048
+ return {
3049
+ status: "error",
3050
+ error: {
3051
+ code: RpcErrorCode.INTERNAL_ERROR,
3052
+ message: "Received unknown response from provider.",
3053
+ data: response
3054
+ }
3055
+ };
3056
+ };
3057
+ const request = async (method, params, providerId) => {
3058
+ let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
3059
+ if (providerId) provider = await getProviderById(providerId);
3060
+ if (!provider) throw new Error("no wallet provider was found");
3061
+ if (!method) throw new Error("A wallet method is required");
3062
+ if (!cache.providerInfo) {
3063
+ const infoResult = await requestInternal(provider, "getInfo", null);
3064
+ if (infoResult.status === "success") cache.providerInfo = infoResult.result;
3065
+ }
3066
+ if (cache.providerInfo) {
3067
+ if (method === "getInfo") return {
3068
+ status: "success",
3069
+ result: cache.providerInfo
3070
+ };
3071
+ const sanitized = sanitizeRequest(method, params, cache.providerInfo);
3072
+ if (sanitized.overrideResponse) return sanitized.overrideResponse;
3073
+ method = sanitized.method;
3074
+ params = sanitized.params;
3075
+ }
3076
+ return requestInternal(provider, method, params);
3077
+ };
3078
+ /**
3079
+ * Adds an event listener.
3080
+ *
3081
+ * Currently expects 2 arguments, although is also capable of handling legacy
3082
+ * calls with 3 arguments consisting of:
3083
+ *
3084
+ * - event name (string)
3085
+ * - callback (function)
3086
+ * - provider ID (optional string)
3087
+ */
3088
+ const addListener = (...rawArgs) => {
3089
+ const [listenerInfo, providerId] = (() => {
3090
+ if (rawArgs.length === 1) return [rawArgs[0], void 0];
3091
+ if (rawArgs.length === 2) if (typeof rawArgs[1] === "function") return [{
3092
+ eventName: rawArgs[0],
3093
+ cb: rawArgs[1]
3094
+ }, void 0];
3095
+ else return rawArgs;
3096
+ if (rawArgs.length === 3) return [{
3097
+ eventName: rawArgs[0],
3098
+ cb: rawArgs[1]
3099
+ }, rawArgs[2]];
3100
+ throw new Error("Unexpected number of arguments. Expecting 2 (or 3 for legacy requests).", { cause: rawArgs });
3101
+ })();
3102
+ let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
3103
+ if (providerId) provider = getProviderById(providerId);
3104
+ if (!provider) throw new Error("no wallet provider was found");
3105
+ if (!provider.addListener) {
3106
+ console.error(`The wallet provider you are using does not support the addListener method. Please update your wallet provider.`);
3107
+ return () => {};
3108
+ }
3109
+ return provider.addListener(listenerInfo);
3110
+ };
3111
+
3112
+ //#endregion
3113
+ //#region src/adapters/xverse.ts
3114
+ var XverseAdapter = class extends SatsConnectAdapter {
3115
+ id = DefaultAdaptersInfo.xverse.id;
3116
+ requestInternal = async (method, params) => {
3117
+ return request(method, params, this.id);
3118
+ };
3119
+ addListener = (listenerInfo) => {
3120
+ return addListener(listenerInfo, this.id);
3121
+ };
3122
+ };
3123
+
3124
+ //#endregion
3125
+ //#region src/adapters/BaseAdapter.ts
3126
+ var BaseAdapter = class extends SatsConnectAdapter {
3127
+ id = "";
3128
+ constructor(providerId) {
3129
+ super();
3130
+ this.id = providerId;
3131
+ }
3132
+ requestInternal = async (method, params) => {
3133
+ return request(method, params, this.id);
3134
+ };
3135
+ addListener = (..._args) => {
3136
+ throw new Error("Method not supported for `BaseAdapter`.");
3137
+ };
3138
+ };
3139
+
3140
+ //#endregion
3141
+ //#region src/adapters/index.ts
3142
+ const DefaultAdaptersInfo = {
3143
+ fordefi: {
3144
+ id: "FordefiProviders.UtxoProvider",
3145
+ name: "Fordefi",
3146
+ webUrl: "https://www.fordefi.com/",
3147
+ chromeWebStoreUrl: "https://chromewebstore.google.com/detail/fordefi/hcmehenccjdmfbojapcbcofkgdpbnlle",
3148
+ icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzEzNDk0XzY2MjU0KSI+CjxwYXRoIGQ9Ik0xMC44NzY5IDE1LjYzNzhIMS41VjE4LjM5OUMxLjUgMTkuODAxMyAyLjYzNDQ3IDIwLjkzOCA0LjAzMzkyIDIwLjkzOEg4LjI0OTkyTDEwLjg3NjkgMTUuNjM3OFoiIGZpbGw9IiM3OTk0RkYiLz4KPHBhdGggZD0iTTEuNSA5Ljc3NTUxSDE5LjA1MTZMMTcuMDEzOSAxMy44NzExSDEuNVY5Ljc3NTUxWiIgZmlsbD0iIzQ4NkRGRiIvPgo8cGF0aCBkPSJNNy42NTk5NiAzSDEuNTI0NDFWOC4wMDcwNEgyMi40NjEyVjNIMTYuMzI1NlY2LjczOTQ0SDE1LjA2MDZWM0g4LjkyNTAyVjYuNzM5NDRINy42NTk5NlYzWiIgZmlsbD0iIzVDRDFGQSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzEzNDk0XzY2MjU0Ij4KPHJlY3Qgd2lkdGg9IjIxIiBoZWlnaHQ9IjE4IiBmaWxsPSJ3aGl0ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMS41IDMpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="
3149
+ },
3150
+ xverse: {
3151
+ id: "XverseProviders.BitcoinProvider",
3152
+ name: "Xverse",
3153
+ webUrl: "https://www.xverse.app/",
3154
+ googlePlayStoreUrl: "https://play.google.com/store/apps/details?id=com.secretkeylabs.xverse",
3155
+ iOSAppStoreUrl: "https://apps.apple.com/app/xverse-bitcoin-web3-wallet/id1552272513",
3156
+ chromeWebStoreUrl: "https://chromewebstore.google.com/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg",
3157
+ icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgdmlld0JveD0iMCAwIDEwMiAxMDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGlkPSJJY29uX0FydCAoRWRpdCBNZSkiPgo8cmVjdCB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgZmlsbD0iIzE4MTgxOCIvPgo8ZyBpZD0iTG9nby9FbWJsZW0iIGNsaXAtcGF0aD0idXJsKCNjbGlwMF8yMF8xMjIzKSI+CjxwYXRoIGlkPSJWZWN0b3IiIGQ9Ik03NC42NTQyIDczLjg4ODNWNjUuMjMxMkM3NC42NTQyIDY0Ljg4OCA3NC41MTc3IDY0LjU2MDYgNzQuMjc0NSA2NC4zMTc0TDM3LjQzOTcgMjcuNDgyNUMzNy4xOTY1IDI3LjIzOTIgMzYuODY5MSAyNy4xMDI4IDM2LjUyNTggMjcuMTAyOEgyNy44NjlDMjcuNDQxNiAyNy4xMDI4IDI3LjA5MzggMjcuNDUwNiAyNy4wOTM4IDI3Ljg3OFYzNS45MjExQzI3LjA5MzggMzYuMjY0NCAyNy4yMzAyIDM2LjU5MTcgMjcuNDczNCAzNi44MzVMNDAuNjk1MiA1MC4wNTY3QzQwLjk5NzUgNTAuMzU5MSA0MC45OTc1IDUwLjg1MDEgNDAuNjk1MiA1MS4xNTI0TDI3LjMyMTEgNjQuNTI2NUMyNy4xNzU2IDY0LjY3MiAyNy4wOTM4IDY0Ljg2OTggMjcuMDkzOCA2NS4wNzQ0VjczLjg4ODNDMjcuMDkzOCA3NC4zMTUzIDI3LjQ0MTYgNzQuNjYzNSAyNy44NjkgNzQuNjYzNUg0Mi4zMzQyQzQyLjc2MTYgNzQuNjYzNSA0My4xMDk0IDc0LjMxNTMgNDMuMTA5NCA3My44ODgzVjY4LjY5NThDNDMuMTA5NCA2OC40OTEyIDQzLjE5MTIgNjguMjkzNSA0My4zMzY4IDY4LjE0NzlMNTAuNTExNCA2MC45NzMzQzUwLjgxMzggNjAuNjcwOSA1MS4zMDQ4IDYwLjY3MDkgNTEuNjA3MiA2MC45NzMzTDY0LjkxOTggNzQuMjg2MUM2NS4xNjMxIDc0LjUyOTMgNjUuNDkwNCA3NC42NjU4IDY1LjgzMzcgNzQuNjY1OEg3My44NzY3Qzc0LjMwNDIgNzQuNjY1OCA3NC42NTE5IDc0LjMxNzYgNzQuNjUxOSA3My44OTA2TDc0LjY1NDIgNzMuODg4M1oiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGlkPSJWZWN0b3JfMiIgZD0iTTU1LjM1OCAzOC41NjcySDYyLjYwMzFDNjMuMDMyOCAzOC41NjcyIDYzLjM4MjkgMzguOTE3MyA2My4zODI5IDM5LjM0NjlWNDYuNTkyMUM2My4zODI5IDQ3LjI4NzcgNjQuMjI0IDQ3LjYzNTUgNjQuNzE1MSA0Ny4xNDIyTDc0LjY1NDEgMzcuMTg3M0M3NC43OTk0IDM3LjA0MTggNzQuODgxNiAzNi44NDQgNzQuODgxNiAzNi42MzcxVjI3LjkxODlDNzQuODgxNiAyNy40ODkyIDc0LjUzMzQgMjcuMTM5MSA3NC4xMDE3IDI3LjEzOTFMNjUuMjUzOCAyNy4xMjc3QzY1LjA0NyAyNy4xMjc3IDY0Ljg0OTIgMjcuMjA5NiA2NC43MDE0IDI3LjM1NTFMNTQuODA1NiAzNy4yMzVDNTQuMzE0NSAzNy43MjYgNTQuNjYyMyAzOC41NjcyIDU1LjM1NTcgMzguNTY3Mkg1NS4zNThaIiBmaWxsPSIjRUU3QTMwIi8+CjwvZz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yMF8xMjIzIj4KPHJlY3Qgd2lkdGg9IjQ3LjgxMjUiIGhlaWdodD0iNDcuODEyNSIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI3LjA5MzggMjcuMDkzOCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K"
3158
+ },
3159
+ unisat: {
3160
+ id: "unisat",
3161
+ name: "Unisat",
3162
+ webUrl: "https://unisat.io/",
3163
+ icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDE4MCAxODAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxODAiIGhlaWdodD0iMTgwIiBmaWxsPSJibGFjayIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfMTAwNTBfNDE3MSkiPgo8cGF0aCBkPSJNMTEzLjY2IDI5LjI4OTdMMTQzLjk3IDU5LjMwOTdDMTQ2LjU1IDYxLjg1OTcgMTQ3LjgyIDY0LjQzOTcgMTQ3Ljc4IDY3LjAzOTdDMTQ3Ljc0IDY5LjYzOTcgMTQ2LjYzIDcyLjAwOTcgMTQ0LjQ2IDc0LjE1OTdDMTQyLjE5IDc2LjQwOTcgMTM5Ljc0IDc3LjU0OTcgMTM3LjEyIDc3LjU5OTdDMTM0LjUgNzcuNjM5NyAxMzEuOSA3Ni4zNzk3IDEyOS4zMiA3My44Mjk3TDk4LjMxOTkgNDMuMTI5N0M5NC43OTk5IDM5LjYzOTcgOTEuMzk5OSAzNy4xNjk3IDg4LjEyOTkgMzUuNzE5N0M4NC44NTk5IDM0LjI2OTcgODEuNDE5OSAzNC4wMzk3IDc3LjgxOTkgMzUuMDM5N0M3NC4yMDk5IDM2LjAyOTcgNzAuMzM5OSAzOC41Nzk3IDY2LjE4OTkgNDIuNjc5N0M2MC40Njk5IDQ4LjM0OTcgNTcuNzM5OSA1My42Njk3IDU4LjAxOTkgNTguNjM5N0M1OC4yOTk5IDYzLjYwOTcgNjEuMTM5OSA2OC43Njk3IDY2LjUyOTkgNzQuMDk5N0w5Ny43Nzk5IDEwNS4wNkMxMDAuMzkgMTA3LjY0IDEwMS42NyAxMTAuMjIgMTAxLjYzIDExMi43OEMxMDEuNTkgMTE1LjM1IDEwMC40NyAxMTcuNzIgOTguMjU5OSAxMTkuOTFDOTYuMDU5OSAxMjIuMDkgOTMuNjI5OSAxMjMuMjMgOTAuOTg5OSAxMjMuMzJDODguMzQ5OSAxMjMuNDEgODUuNzE5OSAxMjIuMTYgODMuMTE5OSAxMTkuNThMNTIuODA5OSA4OS41NTk3QzQ3Ljg3OTkgODQuNjc5NyA0NC4zMTk5IDgwLjA1OTcgNDIuMTI5OSA3NS42OTk3QzM5LjkzOTkgNzEuMzM5NyAzOS4xMTk5IDY2LjQwOTcgMzkuNjg5OSA2MC45MDk3QzQwLjE5OTkgNTYuMTk5NyA0MS43MDk5IDUxLjYzOTcgNDQuMjI5OSA0Ny4yMTk3QzQ2LjczOTkgNDIuNzk5NyA1MC4zMzk5IDM4LjI3OTcgNTUuMDA5OSAzMy42NDk3QzYwLjU2OTkgMjguMTM5NyA2NS44Nzk5IDIzLjkxOTcgNzAuOTM5OSAyMC45Nzk3Qzc1Ljk4OTkgMTguMDM5NyA4MC44Nzk5IDE2LjQwOTcgODUuNTk5OSAxNi4wNjk3QzkwLjMyOTkgMTUuNzI5NyA5NC45ODk5IDE2LjY2OTcgOTkuNTk5OSAxOC44ODk3QzEwNC4yMSAyMS4xMDk3IDEwOC44OSAyNC41Njk3IDExMy42NSAyOS4yODk3SDExMy42NloiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xMDA1MF80MTcxKSIvPgo8cGF0aCBkPSJNNjYuMTA5OSAxNTAuNDJMMzUuODA5OSAxMjAuNEMzMy4yMjk5IDExNy44NCAzMS45NTk5IDExNS4yNyAzMS45OTk5IDExMi42N0MzMi4wMzk5IDExMC4wNyAzMy4xNDk5IDEwNy43IDM1LjMxOTkgMTA1LjU1QzM3LjU4OTkgMTAzLjMgNDAuMDM5OSAxMDIuMTYgNDIuNjU5OSAxMDIuMTFDNDUuMjc5OSAxMDIuMDcgNDcuODc5OSAxMDMuMzIgNTAuNDU5OSAxMDUuODhMODEuNDQ5OSAxMzYuNThDODQuOTc5OSAxNDAuMDcgODguMzY5OSAxNDIuNTQgOTEuNjM5OSAxNDMuOTlDOTQuOTA5OSAxNDUuNDQgOTguMzQ5OSAxNDUuNjYgMTAxLjk2IDE0NC42N0MxMDUuNTcgMTQzLjY4IDEwOS40NCAxNDEuMTMgMTEzLjU5IDEzNy4wMkMxMTkuMzEgMTMxLjM1IDEyMi4wNCAxMjYuMDMgMTIxLjc2IDEyMS4wNkMxMjEuNDggMTE2LjA5IDExOC42NCAxMTAuOTMgMTEzLjI1IDEwNS41OUw5Ni41OTk5IDg5LjI0MDFDOTMuOTg5OSA4Ni42NjAxIDkyLjcwOTkgODQuMDgwMSA5Mi43NDk5IDgxLjUyMDFDOTIuNzg5OSA3OC45NTAxIDkzLjkwOTkgNzYuNTgwMSA5Ni4xMTk5IDc0LjM5MDFDOTguMzE5OSA3Mi4yMTAxIDEwMC43NSA3MS4wNzAxIDEwMy4zOSA3MC45ODAxQzEwNi4wMyA3MC44OTAxIDEwOC42NiA3Mi4xNDAxIDExMS4yNiA3NC43MjAxTDEyNi45NiA5MC4xMzAxQzEzMS44OSA5NS4wMTAxIDEzNS40NSA5OS42MzAxIDEzNy42NCAxMDMuOTlDMTM5LjgzIDEwOC4zNSAxNDAuNjUgMTEzLjI4IDE0MC4wOCAxMTguNzhDMTM5LjU3IDEyMy40OSAxMzguMDYgMTI4LjA1IDEzNS41NCAxMzIuNDdDMTMzLjAzIDEzNi44OSAxMjkuNDMgMTQxLjQxIDEyNC43NiAxNDYuMDRDMTE5LjIgMTUxLjU1IDExMy44OSAxNTUuNzcgMTA4LjgzIDE1OC43MUMxMDMuNzcgMTYxLjY1IDk4Ljg3OTkgMTYzLjI5IDk0LjE0OTkgMTYzLjYzQzg5LjQxOTkgMTYzLjk3IDg0Ljc1OTkgMTYzLjAzIDgwLjE0OTkgMTYwLjgxQzc1LjUzOTkgMTU4LjU5IDcwLjg1OTkgMTU1LjEzIDY2LjA5OTkgMTUwLjQxTDY2LjEwOTkgMTUwLjQyWiIgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzEwMDUwXzQxNzEpIi8+CjxwYXRoIGQ9Ik04NS4wMDk5IDcyLjk1OTJDOTEuMTU2OCA3Mi45NTkyIDk2LjEzOTkgNjcuOTc2MSA5Ni4xMzk5IDYxLjgyOTJDOTYuMTM5OSA1NS42ODIzIDkxLjE1NjggNTAuNjk5MiA4NS4wMDk5IDUwLjY5OTJDNzguODYzIDUwLjY5OTIgNzMuODc5OSA1NS42ODIzIDczLjg3OTkgNjEuODI5MkM3My44Nzk5IDY3Ljk3NjEgNzguODYzIDcyLjk1OTIgODUuMDA5OSA3Mi45NTkyWiIgZmlsbD0idXJsKCNwYWludDJfcmFkaWFsXzEwMDUwXzQxNzEpIi8+CjwvZz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMDA1MF80MTcxIiB4MT0iMTM4Ljk4NSIgeTE9IjQ2Ljc3OTUiIHgyPSI0NS4wNTI5IiB5Mj0iODguNTIzMyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjMjAxQzFCIi8+CjxzdG9wIG9mZnNldD0iMC4zNiIgc3RvcC1jb2xvcj0iIzc3MzkwRCIvPgo8c3RvcCBvZmZzZXQ9IjAuNjciIHN0b3AtY29sb3I9IiNFQTgxMDEiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRjRCODUyIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8xMDA1MF80MTcxIiB4MT0iNDMuMzgxMiIgeTE9IjEzNC4xNjciIHgyPSIxNTIuMjMxIiB5Mj0iMTAxLjc3MSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjMUYxRDFDIi8+CjxzdG9wIG9mZnNldD0iMC4zNyIgc3RvcC1jb2xvcj0iIzc3MzkwRCIvPgo8c3RvcCBvZmZzZXQ9IjAuNjciIHN0b3AtY29sb3I9IiNFQTgxMDEiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRjRGQjUyIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxyYWRpYWxHcmFkaWVudCBpZD0icGFpbnQyX3JhZGlhbF8xMDA1MF80MTcxIiBjeD0iMCIgY3k9IjAiIHI9IjEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDg1LjAwOTkgNjEuODM5Mikgc2NhbGUoMTEuMTMpIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y0Qjg1MiIvPgo8c3RvcCBvZmZzZXQ9IjAuMzMiIHN0b3AtY29sb3I9IiNFQTgxMDEiLz4KPHN0b3Agb2Zmc2V0PSIwLjY0IiBzdG9wLWNvbG9yPSIjNzczOTBEIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzIxMUMxRCIvPgo8L3JhZGlhbEdyYWRpZW50Pgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzEwMDUwXzQxNzEiPgo8cmVjdCB3aWR0aD0iMTE1Ljc3IiBoZWlnaHQ9IjE0Ny43IiBmaWxsPSJ3aGl0ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzIgMTYpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="
3164
+ }
3165
+ };
3166
+ const defaultAdapters = {
3167
+ [DefaultAdaptersInfo.fordefi.id]: FordefiAdapter,
3168
+ [DefaultAdaptersInfo.xverse.id]: XverseAdapter,
3169
+ [DefaultAdaptersInfo.unisat.id]: UnisatAdapter
3170
+ };
3171
+
3172
+ //#endregion
3173
+ //#region src/capabilities/index.ts
3174
+ const extractOrValidateCapabilities = (provider, reportedCapabilities) => {
3175
+ const validateCapability = (capability) => {
3176
+ if (!provider[capability]) return false;
3177
+ if (reportedCapabilities && !reportedCapabilities.has(capability)) return false;
3178
+ return true;
3179
+ };
3180
+ const capabilityMap = {
3181
+ request: validateCapability("request"),
3182
+ connect: validateCapability("connect"),
3183
+ signMessage: validateCapability("signMessage"),
3184
+ signTransaction: validateCapability("signTransaction"),
3185
+ sendBtcTransaction: validateCapability("sendBtcTransaction"),
3186
+ createInscription: validateCapability("createInscription"),
3187
+ createRepeatInscriptions: validateCapability("createRepeatInscriptions"),
3188
+ signMultipleTransactions: validateCapability("signMultipleTransactions"),
3189
+ addListener: validateCapability("addListener")
3190
+ };
3191
+ return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
3192
+ if (value) return [...acc, capability];
3193
+ return acc;
3194
+ }, []);
3195
+ };
3196
+ const getCapabilities = async (options) => {
3197
+ const provider = await getProviderOrThrow(options.getProvider);
3198
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
3199
+ if (provider.getCapabilities) try {
3200
+ const response = await provider.getCapabilities(request$1);
3201
+ options.onFinish?.(extractOrValidateCapabilities(provider, new Set(response)));
3202
+ } catch (error) {
3203
+ console.error("[Connect] Error during capabilities request", error);
3204
+ }
3205
+ try {
3206
+ const inferredCapabilities = extractOrValidateCapabilities(provider);
3207
+ options.onFinish?.(inferredCapabilities);
3208
+ } catch (error) {
3209
+ console.error("[Connect] Error during capabilities request", error);
3210
+ options.onCancel?.();
3211
+ }
3212
+ };
3213
+
3214
+ //#endregion
3215
+ //#region src/inscriptions/utils.ts
3216
+ const MAX_CONTENT_LENGTH_MAINNET = 4e5;
3217
+ const MAX_CONTENT_LENGTH_TESTNET = 6e4;
3218
+ const validateInscriptionPayload = (payload) => {
3219
+ const { contentType, content, payloadType, network, appFeeAddress, appFee } = payload;
3220
+ if (!/^[a-z]+\/[a-z0-9\-.+]+(?=;.*|$)/.test(contentType)) throw new Error("Invalid content type detected");
3221
+ if (!content || content.length === 0) throw new Error("Empty content not allowed");
3222
+ if (!payloadType || payloadType !== "BASE_64" && payloadType !== "PLAIN_TEXT") throw new Error("Empty invalid payloadType specified");
3223
+ if (content.length > (network.type === "Mainnet" ? MAX_CONTENT_LENGTH_MAINNET : MAX_CONTENT_LENGTH_TESTNET)) throw new Error("Content too large");
3224
+ if ((appFeeAddress?.length ?? 0) > 0 && (appFee ?? 0) <= 0) throw new Error("Invalid combination of app fee address and fee provided");
3225
+ };
3226
+
3227
+ //#endregion
3228
+ //#region src/inscriptions/createInscription.ts
3229
+ const createInscription = async (options) => {
3230
+ const { getProvider } = options;
3231
+ const provider = await getProviderOrThrow(getProvider);
3232
+ validateInscriptionPayload(options.payload);
3233
+ try {
3234
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
3235
+ const response = await provider.createInscription(request$1);
3236
+ options.onFinish?.(response);
3237
+ } catch (error) {
3238
+ console.error("[Connect] Error during create inscription", error);
3239
+ options.onCancel?.();
3240
+ }
3241
+ };
3242
+
3243
+ //#endregion
3244
+ //#region src/inscriptions/createRepeatInscriptions.ts
3245
+ const createRepeatInscriptions = async (options) => {
3246
+ const { getProvider } = options;
3247
+ const provider = await getProviderOrThrow(getProvider);
3248
+ validateInscriptionPayload(options.payload);
3249
+ try {
3250
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
3251
+ const response = await provider.createRepeatInscriptions(request$1);
3252
+ options.onFinish?.(response);
3253
+ } catch (error) {
3254
+ console.error("[Connect] Error during create repeat inscriptions", error);
3255
+ options.onCancel?.();
3256
+ }
3257
+ };
3258
+
3259
+ //#endregion
3260
+ //#region src/messages/index.ts
3261
+ const signMessage = async (options) => {
3262
+ const provider = await getProviderOrThrow(options.getProvider);
3263
+ const { address, message } = options.payload;
3264
+ if (!address) throw new Error("An address is required to sign a message");
3265
+ if (!message) throw new Error("A message to be signed is required");
3266
+ try {
3267
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
3268
+ const response = await provider.signMessage(request$1);
3269
+ options.onFinish?.(response);
3270
+ } catch (error) {
3271
+ console.error("[Connect] Error during sign message request", error);
3272
+ options.onCancel?.();
3273
+ }
3274
+ };
3275
+
3276
+ //#endregion
3277
+ //#region src/transactions/sendBtcTransaction.ts
3278
+ const serializer = (recipient) => {
3279
+ return recipient.map((value) => {
3280
+ const { address, amountSats } = value;
3281
+ return {
3282
+ address,
3283
+ amountSats: amountSats.toString()
3284
+ };
3285
+ });
3286
+ };
3287
+ const sendBtcTransaction = async (options) => {
3288
+ const provider = await getProviderOrThrow(options.getProvider);
3289
+ const { recipients, senderAddress, network, message } = options.payload;
3290
+ if (!recipients || recipients.length === 0) throw new Error("At least one recipient is required");
3291
+ if (recipients.some((item) => typeof item.address !== "string" || typeof item.amountSats !== "bigint")) throw new Error("Incorrect recipient format");
3292
+ if (!senderAddress) throw new Error("The sender address is required");
3293
+ try {
3294
+ const request$1 = (0, jsontokens.createUnsecuredToken)({
3295
+ network,
3296
+ senderAddress,
3297
+ message,
3298
+ recipients: serializer(recipients)
3299
+ });
3300
+ const response = await provider.sendBtcTransaction(request$1);
3301
+ options.onFinish?.(response);
3302
+ } catch (error) {
3303
+ console.error("[Connect] Error during send BTC transaction request", error);
3304
+ options.onCancel?.();
3305
+ }
3306
+ };
3307
+
3308
+ //#endregion
3309
+ //#region src/transactions/signMultipleTransactions.ts
3310
+ const signMultipleTransactions = async (options) => {
3311
+ const provider = await getProviderOrThrow(options.getProvider);
3312
+ const { psbts } = options.payload;
3313
+ if (!psbts || !psbts.length) throw new Error("psbts array is required");
3314
+ if (psbts.length > 100) throw new Error("psbts array must contain less than 100 psbts");
3315
+ try {
3316
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
3317
+ const response = await provider.signMultipleTransactions(request$1);
3318
+ options.onFinish?.(response);
3319
+ } catch (error) {
3320
+ console.error("[Connect] Error during sign Multiple transactions request", error);
3321
+ options.onCancel?.();
3322
+ }
3323
+ };
3324
+
3325
+ //#endregion
3326
+ //#region src/transactions/signTransaction.ts
3327
+ const signTransaction = async (options) => {
3328
+ const provider = await getProviderOrThrow(options.getProvider);
3329
+ const { psbtBase64, inputsToSign } = options.payload;
3330
+ if (!psbtBase64) throw new Error("A value for psbtBase64 representing the tx hash is required");
3331
+ if (!inputsToSign) throw new Error("An array specifying the inputs to be signed by the wallet is required");
3332
+ try {
3333
+ const request$1 = (0, jsontokens.createUnsecuredToken)(options.payload);
3334
+ const response = await provider.signTransaction(request$1);
3335
+ options.onFinish?.(response);
3336
+ } catch (error) {
3337
+ console.error("[Connect] Error during sign transaction request", error);
3338
+ options.onCancel?.();
3339
+ }
3340
+ };
3341
+
3342
+ //#endregion
3343
+ exports.AddressPurpose = AddressPurpose;
3344
+ exports.AddressType = AddressType;
3345
+ exports.BaseAdapter = BaseAdapter;
3346
+ exports.BitcoinNetworkType = BitcoinNetworkType;
3347
+ exports.DefaultAdaptersInfo = DefaultAdaptersInfo;
3348
+ exports.MessageSigningProtocols = MessageSigningProtocols;
3349
+ exports.ProviderPlatform = ProviderPlatform;
3350
+ exports.RpcErrorCode = RpcErrorCode;
3351
+ exports.SatsConnectAdapter = SatsConnectAdapter;
3352
+ exports.SparkNetworkType = SparkNetworkType;
3353
+ exports.StacksNetworkType = StacksNetworkType;
3354
+ exports.StarknetNetworkType = StarknetNetworkType;
3355
+ exports.accountChangeEventName = accountChangeEventName;
3356
+ exports.accountChangeSchema = accountChangeSchema;
3357
+ exports.addListener = addListener;
3358
+ exports.addressSchema = addressSchema;
3359
+ exports.allResolvedNetworksSchema = allResolvedNetworksSchema;
3360
+ exports.bitcoinGetAccountsParamsSchema = bitcoinGetAccountsParamsSchema;
3361
+ exports.bitcoinGetAccountsRequestSchema = bitcoinGetAccountsRequestSchema;
3362
+ exports.bitcoinGetAccountsResultSchema = bitcoinGetAccountsResultSchema;
3363
+ exports.bitcoinGetAccountsSuccessResponseSchema = bitcoinGetAccountsSuccessResponseSchema;
3364
+ exports.bitcoinGetAddressesParamsSchema = bitcoinGetAddressesParamsSchema;
3365
+ exports.bitcoinGetAddressesRequestSchema = bitcoinGetAddressesRequestSchema;
3366
+ exports.bitcoinGetAddressesResultSchema = bitcoinGetAddressesResultSchema;
3367
+ exports.bitcoinGetAddressesSuccessResponseSchema = bitcoinGetAddressesSuccessResponseSchema;
3368
+ exports.bitcoinGetAddressesV2ParamsSchema = bitcoinGetAddressesV2ParamsSchema;
3369
+ exports.bitcoinGetAddressesV2RequestSchema = bitcoinGetAddressesV2RequestSchema;
3370
+ exports.bitcoinGetAddressesV2ResultSchema = bitcoinGetAddressesV2ResultSchema;
3371
+ exports.bitcoinGetAddressesV2SuccessResponseSchema = bitcoinGetAddressesV2SuccessResponseSchema;
3372
+ exports.bitcoinGetBalanceParamsSchema = bitcoinGetBalanceParamsSchema;
3373
+ exports.bitcoinGetBalanceRequestSchema = bitcoinGetBalanceRequestSchema;
3374
+ exports.bitcoinGetBalanceResultSchema = bitcoinGetBalanceResultSchema;
3375
+ exports.bitcoinGetBalanceSuccessResponseSchema = bitcoinGetBalanceSuccessResponseSchema;
3376
+ exports.bitcoinGetBalanceV2ParamsSchema = bitcoinGetBalanceV2ParamsSchema;
3377
+ exports.bitcoinGetBalanceV2RequestSchema = bitcoinGetBalanceV2RequestSchema;
3378
+ exports.bitcoinGetBalanceV2ResultSchema = bitcoinGetBalanceV2ResultSchema;
3379
+ exports.bitcoinGetBalanceV2SuccessResponseSchema = bitcoinGetBalanceV2SuccessResponseSchema;
3380
+ exports.bitcoinGetInfoParamsSchema = bitcoinGetInfoParamsSchema;
3381
+ exports.bitcoinGetInfoRequestSchema = bitcoinGetInfoRequestSchema;
3382
+ exports.bitcoinGetInfoResultSchema = bitcoinGetInfoResultSchema;
3383
+ exports.bitcoinGetInfoSuccessResponseSchema = bitcoinGetInfoSuccessResponseSchema;
3384
+ exports.bitcoinMethods = bitcoinMethods;
3385
+ exports.bitcoinModeToLegacyBitcoinNetworkType = bitcoinModeToLegacyBitcoinNetworkType;
3386
+ exports.bitcoinNetworkConfigurationOptionsSchema = bitcoinNetworkConfigurationOptionsSchema;
3387
+ exports.bitcoinRequestSchema = bitcoinRequestSchema;
3388
+ exports.bitcoinSendTransferParamsSchema = bitcoinSendTransferParamsSchema;
3389
+ exports.bitcoinSendTransferRequestSchema = bitcoinSendTransferRequestSchema;
3390
+ exports.bitcoinSendTransferResultSchema = bitcoinSendTransferResultSchema;
3391
+ exports.bitcoinSendTransferSuccessResponseSchema = bitcoinSendTransferSuccessResponseSchema;
3392
+ exports.bitcoinSendTransferV2ParamsSchema = bitcoinSendTransferV2ParamsSchema;
3393
+ exports.bitcoinSendTransferV2RequestSchema = bitcoinSendTransferV2RequestSchema;
3394
+ exports.bitcoinSendTransferV2ResultSchema = bitcoinSendTransferV2ResultSchema;
3395
+ exports.bitcoinSendTransferV2SuccessResponseSchema = bitcoinSendTransferV2SuccessResponseSchema;
3396
+ exports.bitcoinSignMessageParamsSchema = bitcoinSignMessageParamsSchema;
3397
+ exports.bitcoinSignMessageRequestSchema = bitcoinSignMessageRequestSchema;
3398
+ exports.bitcoinSignMessageResultSchema = bitcoinSignMessageResultSchema;
3399
+ exports.bitcoinSignMessageSuccessResponseSchema = bitcoinSignMessageSuccessResponseSchema;
3400
+ exports.bitcoinSignMessageV2ParamsSchema = bitcoinSignMessageV2ParamsSchema;
3401
+ exports.bitcoinSignMessageV2RequestSchema = bitcoinSignMessageV2RequestSchema;
3402
+ exports.bitcoinSignMessageV2ResultSchema = bitcoinSignMessageV2ResultSchema;
3403
+ exports.bitcoinSignMessageV2SuccessResponseSchema = bitcoinSignMessageV2SuccessResponseSchema;
3404
+ exports.bitcoinSignMultipleMessagesParamsSchema = bitcoinSignMultipleMessagesParamsSchema;
3405
+ exports.bitcoinSignMultipleMessagesRequestSchema = bitcoinSignMultipleMessagesRequestSchema;
3406
+ exports.bitcoinSignMultipleMessagesResultSchema = bitcoinSignMultipleMessagesResultSchema;
3407
+ exports.bitcoinSignMultipleMessagesSuccessResponseSchema = bitcoinSignMultipleMessagesSuccessResponseSchema;
3408
+ exports.bitcoinSignMultipleMessagesV2ParamsSchema = bitcoinSignMultipleMessagesV2ParamsSchema;
3409
+ exports.bitcoinSignMultipleMessagesV2RequestSchema = bitcoinSignMultipleMessagesV2RequestSchema;
3410
+ exports.bitcoinSignMultipleMessagesV2ResultSchema = bitcoinSignMultipleMessagesV2ResultSchema;
3411
+ exports.bitcoinSignMultipleMessagesV2SuccessResponseSchema = bitcoinSignMultipleMessagesV2SuccessResponseSchema;
3412
+ exports.bitcoinSignPsbtParamsSchema = bitcoinSignPsbtParamsSchema;
3413
+ exports.bitcoinSignPsbtRequestSchema = bitcoinSignPsbtRequestSchema;
3414
+ exports.bitcoinSignPsbtResultSchema = bitcoinSignPsbtResultSchema;
3415
+ exports.bitcoinSignPsbtSuccessResponseSchema = bitcoinSignPsbtSuccessResponseSchema;
3416
+ exports.bitcoinSignPsbtV2ParamsSchema = bitcoinSignPsbtV2ParamsSchema;
3417
+ exports.bitcoinSignPsbtV2RequestSchema = bitcoinSignPsbtV2RequestSchema;
3418
+ exports.bitcoinSignPsbtV2ResultSchema = bitcoinSignPsbtV2ResultSchema;
3419
+ exports.bitcoinSignPsbtV2SuccessResponseSchema = bitcoinSignPsbtV2SuccessResponseSchema;
3420
+ exports.bitcoinSuccessResponseSchema = bitcoinSuccessResponseSchema;
3421
+ exports.createInscription = createInscription;
3422
+ exports.createRepeatInscriptions = createRepeatInscriptions;
3423
+ exports.createRpcRequest = createRpcRequest;
3424
+ exports.createRpcSuccessResponse = createRpcSuccessResponse;
3425
+ exports.defaultAdapters = defaultAdapters;
3426
+ exports.disconnectEventName = disconnectEventName;
3427
+ exports.disconnectSchema = disconnectSchema;
3428
+ exports.getAddress = getAddress;
3429
+ exports.getCapabilities = getCapabilities;
3430
+ exports.getDefaultProvider = getDefaultProvider;
3431
+ exports.getProviderById = getProviderById;
3432
+ exports.getProviderOrThrow = getProviderOrThrow;
3433
+ exports.getProviders = getProviders;
3434
+ exports.getSupportedWallets = getSupportedWallets;
3435
+ exports.isProviderInstalled = isProviderInstalled;
3436
+ exports.methodSupport = methodSupport;
3437
+ exports.methods = methods;
3438
+ exports.networkChangeEventName = networkChangeEventName;
3439
+ exports.networkChangeEventNameV2 = networkChangeEventNameV2;
3440
+ exports.networkChangeSchema = networkChangeSchema;
3441
+ exports.networkChangeV2Schema = networkChangeV2Schema;
3442
+ exports.networkConfigurationOptionsSchema = networkConfigurationOptionsSchema;
3443
+ exports.ordinalsGetInscriptionsParamsSchema = ordinalsGetInscriptionsParamsSchema;
3444
+ exports.ordinalsGetInscriptionsRequestSchema = ordinalsGetInscriptionsRequestSchema;
3445
+ exports.ordinalsGetInscriptionsResultSchema = ordinalsGetInscriptionsResultSchema;
3446
+ exports.ordinalsGetInscriptionsSuccessResponseSchema = ordinalsGetInscriptionsSuccessResponseSchema;
3447
+ exports.ordinalsMethods = ordinalsMethods;
3448
+ exports.ordinalsRequestSchema = ordinalsRequestSchema;
3449
+ exports.ordinalsSendInscriptionsParamsSchema = ordinalsSendInscriptionsParamsSchema;
3450
+ exports.ordinalsSendInscriptionsRequestSchema = ordinalsSendInscriptionsRequestSchema;
3451
+ exports.ordinalsSendInscriptionsResultSchema = ordinalsSendInscriptionsResultSchema;
3452
+ exports.ordinalsSendInscriptionsSuccessResponseSchema = ordinalsSendInscriptionsSuccessResponseSchema;
3453
+ exports.ordinalsSuccessResponseSchema = ordinalsSuccessResponseSchema;
3454
+ exports.permissionRequestParamsSchema = permissionRequestParamsSchema;
3455
+ exports.removeDefaultProvider = removeDefaultProvider;
3456
+ exports.request = request;
3457
+ exports.rpcIdSchema = rpcIdSchema;
3458
+ exports.rpcRequestSchema = rpcRequestSchema;
3459
+ exports.rpcSuccessResponseSchema = rpcSuccessResponseSchema;
3460
+ exports.runesEstimateEtchParamsSchema = runesEstimateEtchParamsSchema;
3461
+ exports.runesEstimateEtchRequestSchema = runesEstimateEtchRequestSchema;
3462
+ exports.runesEstimateEtchResultSchema = runesEstimateEtchResultSchema;
3463
+ exports.runesEstimateEtchSuccessResponseSchema = runesEstimateEtchSuccessResponseSchema;
3464
+ exports.runesEstimateMintParamsSchema = runesEstimateMintParamsSchema;
3465
+ exports.runesEstimateMintRequestSchema = runesEstimateMintRequestSchema;
3466
+ exports.runesEstimateMintResultSchema = runesEstimateMintResultSchema;
3467
+ exports.runesEstimateMintSuccessResponseSchema = runesEstimateMintSuccessResponseSchema;
3468
+ exports.runesEstimateRbfOrderParamsSchema = runesEstimateRbfOrderParamsSchema;
3469
+ exports.runesEstimateRbfOrderRequestSchema = runesEstimateRbfOrderRequestSchema;
3470
+ exports.runesEstimateRbfOrderResultSchema = runesEstimateRbfOrderResultSchema;
3471
+ exports.runesEstimateRbfOrderSuccessResponseSchema = runesEstimateRbfOrderSuccessResponseSchema;
3472
+ exports.runesEtchParamsSchema = runesEtchParamsSchema;
3473
+ exports.runesEtchRequestSchema = runesEtchRequestSchema;
3474
+ exports.runesEtchResultSchema = runesEtchResultSchema;
3475
+ exports.runesEtchSuccessResponseSchema = runesEtchSuccessResponseSchema;
3476
+ exports.runesGetBalanceParamsSchema = runesGetBalanceParamsSchema;
3477
+ exports.runesGetBalanceRequestSchema = runesGetBalanceRequestSchema;
3478
+ exports.runesGetBalanceResultSchema = runesGetBalanceResultSchema;
3479
+ exports.runesGetBalanceSuccessResponseSchema = runesGetBalanceSuccessResponseSchema;
3480
+ exports.runesGetOrderParamsSchema = runesGetOrderParamsSchema;
3481
+ exports.runesGetOrderRequestSchema = runesGetOrderRequestSchema;
3482
+ exports.runesGetOrderResultSchema = runesGetOrderResultSchema;
3483
+ exports.runesGetOrderSuccessResponseSchema = runesGetOrderSuccessResponseSchema;
3484
+ exports.runesMethods = runesMethods;
3485
+ exports.runesMintParamsSchema = runesMintParamsSchema;
3486
+ exports.runesMintRequestSchema = runesMintRequestSchema;
3487
+ exports.runesMintResultSchema = runesMintResultSchema;
3488
+ exports.runesMintSuccessResponseSchema = runesMintSuccessResponseSchema;
3489
+ exports.runesRbfOrderParamsSchema = runesRbfOrderParamsSchema;
3490
+ exports.runesRbfOrderRequestSchema = runesRbfOrderRequestSchema;
3491
+ exports.runesRbfOrderResultSchema = runesRbfOrderResultSchema;
3492
+ exports.runesRbfOrderSuccessResponseSchema = runesRbfOrderSuccessResponseSchema;
3493
+ exports.runesRequestSchema = runesRequestSchema;
3494
+ exports.runesSuccessResponseSchema = runesSuccessResponseSchema;
3495
+ exports.runesTransferParamsSchema = runesTransferParamsSchema;
3496
+ exports.runesTransferRequestSchema = runesTransferRequestSchema;
3497
+ exports.runesTransferResultSchema = runesTransferResultSchema;
3498
+ exports.runesTransferSuccessResponseSchema = runesTransferSuccessResponseSchema;
3499
+ exports.sendBtcTransaction = sendBtcTransaction;
3500
+ exports.setDefaultProvider = setDefaultProvider;
3501
+ exports.signMessage = signMessage;
3502
+ exports.signMultipleTransactions = signMultipleTransactions;
3503
+ exports.signTransaction = signTransaction;
3504
+ exports.sparkFlashnetClawbackFundsParamsSchema = sparkFlashnetClawbackFundsParamsSchema;
3505
+ exports.sparkFlashnetClawbackFundsRequestSchema = sparkFlashnetClawbackFundsRequestSchema;
3506
+ exports.sparkFlashnetClawbackFundsResultSchema = sparkFlashnetClawbackFundsResultSchema;
3507
+ exports.sparkFlashnetClawbackFundsSuccessResponseSchema = sparkFlashnetClawbackFundsSuccessResponseSchema;
3508
+ exports.sparkFlashnetExecuteRouteSwapParamsSchema = sparkFlashnetExecuteRouteSwapParamsSchema;
3509
+ exports.sparkFlashnetExecuteRouteSwapRequestSchema = sparkFlashnetExecuteRouteSwapRequestSchema;
3510
+ exports.sparkFlashnetExecuteRouteSwapResultSchema = sparkFlashnetExecuteRouteSwapResultSchema;
3511
+ exports.sparkFlashnetExecuteRouteSwapSuccessResponseSchema = sparkFlashnetExecuteRouteSwapSuccessResponseSchema;
3512
+ exports.sparkFlashnetExecuteSwapParamsSchema = sparkFlashnetExecuteSwapParamsSchema;
3513
+ exports.sparkFlashnetExecuteSwapRequestSchema = sparkFlashnetExecuteSwapRequestSchema;
3514
+ exports.sparkFlashnetExecuteSwapResultSchema = sparkFlashnetExecuteSwapResultSchema;
3515
+ exports.sparkFlashnetExecuteSwapSuccessResponseSchema = sparkFlashnetExecuteSwapSuccessResponseSchema;
3516
+ exports.sparkFlashnetGetJwtParamsSchema = sparkFlashnetGetJwtParamsSchema;
3517
+ exports.sparkFlashnetGetJwtRequestSchema = sparkFlashnetGetJwtRequestSchema;
3518
+ exports.sparkFlashnetGetJwtResultSchema = sparkFlashnetGetJwtResultSchema;
3519
+ exports.sparkFlashnetGetJwtSuccessResponseSchema = sparkFlashnetGetJwtSuccessResponseSchema;
3520
+ exports.sparkFlashnetSignIntentParamsSchema = sparkFlashnetSignIntentParamsSchema;
3521
+ exports.sparkFlashnetSignIntentRequestSchema = sparkFlashnetSignIntentRequestSchema;
3522
+ exports.sparkFlashnetSignIntentResultSchema = sparkFlashnetSignIntentResultSchema;
3523
+ exports.sparkFlashnetSignIntentSuccessResponseSchema = sparkFlashnetSignIntentSuccessResponseSchema;
3524
+ exports.sparkFlashnetSignStructuredMessageParamsSchema = sparkFlashnetSignStructuredMessageParamsSchema;
3525
+ exports.sparkFlashnetSignStructuredMessageRequestSchema = sparkFlashnetSignStructuredMessageRequestSchema;
3526
+ exports.sparkFlashnetSignStructuredMessageResultSchema = sparkFlashnetSignStructuredMessageResultSchema;
3527
+ exports.sparkFlashnetSignStructuredMessageSuccessResponseSchema = sparkFlashnetSignStructuredMessageSuccessResponseSchema;
3528
+ exports.sparkGetAddressesParamsSchema = sparkGetAddressesParamsSchema;
3529
+ exports.sparkGetAddressesRequestSchema = sparkGetAddressesRequestSchema;
3530
+ exports.sparkGetAddressesResultSchema = sparkGetAddressesResultSchema;
3531
+ exports.sparkGetAddressesSuccessResponseSchema = sparkGetAddressesSuccessResponseSchema;
3532
+ exports.sparkGetAddressesV2ParamsSchema = sparkGetAddressesV2ParamsSchema;
3533
+ exports.sparkGetAddressesV2RequestSchema = sparkGetAddressesV2RequestSchema;
3534
+ exports.sparkGetAddressesV2ResultSchema = sparkGetAddressesV2ResultSchema;
3535
+ exports.sparkGetAddressesV2SuccessResponseSchema = sparkGetAddressesV2SuccessResponseSchema;
3536
+ exports.sparkGetBalanceParamsSchema = sparkGetBalanceParamsSchema;
3537
+ exports.sparkGetBalanceRequestSchema = sparkGetBalanceRequestSchema;
3538
+ exports.sparkGetBalanceResultSchema = sparkGetBalanceResultSchema;
3539
+ exports.sparkGetBalanceSuccessResponseSchema = sparkGetBalanceSuccessResponseSchema;
3540
+ exports.sparkGetClawbackEligibleTransfersParamsSchema = sparkGetClawbackEligibleTransfersParamsSchema;
3541
+ exports.sparkGetClawbackEligibleTransfersRequestSchema = sparkGetClawbackEligibleTransfersRequestSchema;
3542
+ exports.sparkGetClawbackEligibleTransfersResultSchema = sparkGetClawbackEligibleTransfersResultSchema;
3543
+ exports.sparkGetClawbackEligibleTransfersSuccessResponseSchema = sparkGetClawbackEligibleTransfersSuccessResponseSchema;
3544
+ exports.sparkMethods = sparkMethods;
3545
+ exports.sparkModeToLegacySparkNetworkType = sparkModeToLegacySparkNetworkType;
3546
+ exports.sparkNetworkConfigurationOptionsSchema = sparkNetworkConfigurationOptionsSchema;
3547
+ exports.sparkRequestSchema = sparkRequestSchema;
3548
+ exports.sparkSignMessageParamsSchema = sparkSignMessageParamsSchema;
3549
+ exports.sparkSignMessageRequestSchema = sparkSignMessageRequestSchema;
3550
+ exports.sparkSignMessageResultSchema = sparkSignMessageResultSchema;
3551
+ exports.sparkSignMessageSuccessResponseSchema = sparkSignMessageSuccessResponseSchema;
3552
+ exports.sparkSuccessResponseSchema = sparkSuccessResponseSchema;
3553
+ exports.sparkTransferParamsSchema = sparkTransferParamsSchema;
3554
+ exports.sparkTransferRequestSchema = sparkTransferRequestSchema;
3555
+ exports.sparkTransferResultSchema = sparkTransferResultSchema;
3556
+ exports.sparkTransferSuccessResponseSchema = sparkTransferSuccessResponseSchema;
3557
+ exports.sparkTransferTokenParamsSchema = sparkTransferTokenParamsSchema;
3558
+ exports.sparkTransferTokenRequestSchema = sparkTransferTokenRequestSchema;
3559
+ exports.sparkTransferTokenResultSchema = sparkTransferTokenResultSchema;
3560
+ exports.sparkTransferTokenSuccessResponseSchema = sparkTransferTokenSuccessResponseSchema;
3561
+ exports.specErrorObjectSchema = specErrorObjectSchema;
3562
+ exports.specErrorResponseSchema = specErrorResponseSchema;
3563
+ exports.specIdSchema = specIdSchema;
3564
+ exports.specRequestSchema = specRequestSchema;
3565
+ exports.specResponseSchema = specResponseSchema;
3566
+ exports.specSuccessResponseSchema = specSuccessResponseSchema;
3567
+ exports.specSuccessWithExtensionsResponseSchema = specSuccessWithExtensionsResponseSchema;
3568
+ exports.stacksCallContractParamsSchema = stacksCallContractParamsSchema;
3569
+ exports.stacksCallContractRequestSchema = stacksCallContractRequestSchema;
3570
+ exports.stacksCallContractResultSchema = stacksCallContractResultSchema;
3571
+ exports.stacksCallContractSuccessResponseSchema = stacksCallContractSuccessResponseSchema;
3572
+ exports.stacksDeployContractParamsSchema = stacksDeployContractParamsSchema;
3573
+ exports.stacksDeployContractRequestSchema = stacksDeployContractRequestSchema;
3574
+ exports.stacksDeployContractResultSchema = stacksDeployContractResultSchema;
3575
+ exports.stacksDeployContractSuccessResponseSchema = stacksDeployContractSuccessResponseSchema;
3576
+ exports.stacksGetAccountsParamsSchema = stacksGetAccountsParamsSchema;
3577
+ exports.stacksGetAccountsRequestSchema = stacksGetAccountsRequestSchema;
3578
+ exports.stacksGetAccountsResultSchema = stacksGetAccountsResultSchema;
3579
+ exports.stacksGetAccountsSuccessResponseSchema = stacksGetAccountsSuccessResponseSchema;
3580
+ exports.stacksGetAddressesParamsSchema = stacksGetAddressesParamsSchema;
3581
+ exports.stacksGetAddressesRequestSchema = stacksGetAddressesRequestSchema;
3582
+ exports.stacksGetAddressesResultSchema = stacksGetAddressesResultSchema;
3583
+ exports.stacksGetAddressesSuccessResponseSchema = stacksGetAddressesSuccessResponseSchema;
3584
+ exports.stacksMethods = stacksMethods;
3585
+ exports.stacksModeToLegacyStacksNetworkType = stacksModeToLegacyStacksNetworkType;
3586
+ exports.stacksNetworkConfigurationOptionsSchema = stacksNetworkConfigurationOptionsSchema;
3587
+ exports.stacksRequestSchema = stacksRequestSchema;
3588
+ exports.stacksSignMessageParamsSchema = stacksSignMessageParamsSchema;
3589
+ exports.stacksSignMessageRequestSchema = stacksSignMessageRequestSchema;
3590
+ exports.stacksSignMessageResultSchema = stacksSignMessageResultSchema;
3591
+ exports.stacksSignMessageSuccessResponseSchema = stacksSignMessageSuccessResponseSchema;
3592
+ exports.stacksSignStructuredMessageParamsSchema = stacksSignStructuredMessageParamsSchema;
3593
+ exports.stacksSignStructuredMessageRequestSchema = stacksSignStructuredMessageRequestSchema;
3594
+ exports.stacksSignStructuredMessageResultSchema = stacksSignStructuredMessageResultSchema;
3595
+ exports.stacksSignStructuredMessageSuccessResponseSchema = stacksSignStructuredMessageSuccessResponseSchema;
3596
+ exports.stacksSignTransactionParamsSchema = stacksSignTransactionParamsSchema;
3597
+ exports.stacksSignTransactionRequestSchema = stacksSignTransactionRequestSchema;
3598
+ exports.stacksSignTransactionResultSchema = stacksSignTransactionResultSchema;
3599
+ exports.stacksSignTransactionSuccessResponseSchema = stacksSignTransactionSuccessResponseSchema;
3600
+ exports.stacksSignTransactionsParamsSchema = stacksSignTransactionsParamsSchema;
3601
+ exports.stacksSignTransactionsRequestSchema = stacksSignTransactionsRequestSchema;
3602
+ exports.stacksSignTransactionsResultSchema = stacksSignTransactionsResultSchema;
3603
+ exports.stacksSignTransactionsSuccessResponseSchema = stacksSignTransactionsSuccessResponseSchema;
3604
+ exports.stacksSuccessResponseSchema = stacksSuccessResponseSchema;
3605
+ exports.stacksTransferStxParamsSchema = stacksTransferStxParamsSchema;
3606
+ exports.stacksTransferStxRequestSchema = stacksTransferStxRequestSchema;
3607
+ exports.stacksTransferStxResultSchema = stacksTransferStxResultSchema;
3608
+ exports.stacksTransferStxSuccessResponseSchema = stacksTransferStxSuccessResponseSchema;
3609
+ exports.starknetNetworkConfigurationOptionsSchema = starknetNetworkConfigurationOptionsSchema;
3610
+ exports.walletAddNetworkParamsSchema = walletAddNetworkParamsSchema;
3611
+ exports.walletAddNetworkRequestSchema = walletAddNetworkRequestSchema;
3612
+ exports.walletAddNetworkResultSchema = walletAddNetworkResultSchema;
3613
+ exports.walletAddNetworkSuccessResponseSchema = walletAddNetworkSuccessResponseSchema;
3614
+ exports.walletAddNetworkV2ParamsSchema = walletAddNetworkV2ParamsSchema;
3615
+ exports.walletAddNetworkV2RequestSchema = walletAddNetworkV2RequestSchema;
3616
+ exports.walletAddNetworkV2ResultSchema = walletAddNetworkV2ResultSchema;
3617
+ exports.walletAddNetworkV2SuccessResponseSchema = walletAddNetworkV2SuccessResponseSchema;
3618
+ exports.walletChangeNetworkByIdResultSchema = walletChangeNetworkByIdResultSchema;
3619
+ exports.walletChangeNetworkByIdSuccessResponseSchema = walletChangeNetworkByIdSuccessResponseSchema;
3620
+ exports.walletChangeNetworkParamsSchema = walletChangeNetworkParamsSchema;
3621
+ exports.walletChangeNetworkRequestSchema = walletChangeNetworkRequestSchema;
3622
+ exports.walletChangeNetworkResultSchema = walletChangeNetworkResultSchema;
3623
+ exports.walletChangeNetworkSuccessResponseSchema = walletChangeNetworkSuccessResponseSchema;
3624
+ exports.walletConnectParamsSchema = walletConnectParamsSchema;
3625
+ exports.walletConnectRequestSchema = walletConnectRequestSchema;
3626
+ exports.walletConnectResultSchema = walletConnectResultSchema;
3627
+ exports.walletConnectSuccessResponseSchema = walletConnectSuccessResponseSchema;
3628
+ exports.walletConnectV2ParamsSchema = walletConnectV2ParamsSchema;
3629
+ exports.walletConnectV2RequestSchema = walletConnectV2RequestSchema;
3630
+ exports.walletConnectV2ResultSchema = walletConnectV2ResultSchema;
3631
+ exports.walletConnectV2SuccessResponseSchema = walletConnectV2SuccessResponseSchema;
3632
+ exports.walletDisconnectParamsSchema = walletDisconnectParamsSchema;
3633
+ exports.walletDisconnectRequestSchema = walletDisconnectRequestSchema;
3634
+ exports.walletDisconnectResultSchema = walletDisconnectResultSchema;
3635
+ exports.walletDisconnectSuccessResponseSchema = walletDisconnectSuccessResponseSchema;
3636
+ exports.walletEventSchema = walletEventSchema;
3637
+ exports.walletGetAccountParamsSchema = walletGetAccountParamsSchema;
3638
+ exports.walletGetAccountRequestSchema = walletGetAccountRequestSchema;
3639
+ exports.walletGetAccountResultSchema = walletGetAccountResultSchema;
3640
+ exports.walletGetAccountSuccessResponseSchema = walletGetAccountSuccessResponseSchema;
3641
+ exports.walletGetAccountV2ParamsSchema = walletGetAccountV2ParamsSchema;
3642
+ exports.walletGetAccountV2RequestSchema = walletGetAccountV2RequestSchema;
3643
+ exports.walletGetAccountV2ResultSchema = walletGetAccountV2ResultSchema;
3644
+ exports.walletGetAccountV2SuccessResponseSchema = walletGetAccountV2SuccessResponseSchema;
3645
+ exports.walletGetCurrentPermissionsParamsSchema = walletGetCurrentPermissionsParamsSchema;
3646
+ exports.walletGetCurrentPermissionsRequestSchema = walletGetCurrentPermissionsRequestSchema;
3647
+ exports.walletGetCurrentPermissionsResultSchema = walletGetCurrentPermissionsResultSchema;
3648
+ exports.walletGetCurrentPermissionsSuccessResponseSchema = walletGetCurrentPermissionsSuccessResponseSchema;
3649
+ exports.walletGetNetworkParamsSchema = walletGetNetworkParamsSchema;
3650
+ exports.walletGetNetworkRequestSchema = walletGetNetworkRequestSchema;
3651
+ exports.walletGetNetworkResultSchema = walletGetNetworkResultSchema;
3652
+ exports.walletGetNetworkSuccessResponseSchema = walletGetNetworkSuccessResponseSchema;
3653
+ exports.walletGetNetworksParamsSchema = walletGetNetworksParamsSchema;
3654
+ exports.walletGetNetworksRequestSchema = walletGetNetworksRequestSchema;
3655
+ exports.walletGetNetworksResultSchema = walletGetNetworksResultSchema;
3656
+ exports.walletGetNetworksSuccessResponseSchema = walletGetNetworksSuccessResponseSchema;
3657
+ exports.walletGetWalletTypeParamsSchema = walletGetWalletTypeParamsSchema;
3658
+ exports.walletGetWalletTypeRequestSchema = walletGetWalletTypeRequestSchema;
3659
+ exports.walletGetWalletTypeResultSchema = walletGetWalletTypeResultSchema;
3660
+ exports.walletGetWalletTypeSuccessResponseSchema = walletGetWalletTypeSuccessResponseSchema;
3661
+ exports.walletMethods = walletMethods;
3662
+ exports.walletOpenBridgeParamsSchema = walletOpenBridgeParamsSchema;
3663
+ exports.walletOpenBridgeRequestSchema = walletOpenBridgeRequestSchema;
3664
+ exports.walletOpenBridgeResultSchema = walletOpenBridgeResultSchema;
3665
+ exports.walletOpenBridgeSuccessResponseSchema = walletOpenBridgeSuccessResponseSchema;
3666
+ exports.walletOpenBuyParamsSchema = walletOpenBuyParamsSchema;
3667
+ exports.walletOpenBuyRequestSchema = walletOpenBuyRequestSchema;
3668
+ exports.walletOpenBuyResultSchema = walletOpenBuyResultSchema;
3669
+ exports.walletOpenBuySuccessResponseSchema = walletOpenBuySuccessResponseSchema;
3670
+ exports.walletOpenReceiveParamsSchema = walletOpenReceiveParamsSchema;
3671
+ exports.walletOpenReceiveRequestSchema = walletOpenReceiveRequestSchema;
3672
+ exports.walletOpenReceiveResultSchema = walletOpenReceiveResultSchema;
3673
+ exports.walletOpenReceiveSuccessResponseSchema = walletOpenReceiveSuccessResponseSchema;
3674
+ exports.walletRenouncePermissionsParamsSchema = walletRenouncePermissionsParamsSchema;
3675
+ exports.walletRenouncePermissionsRequestSchema = walletRenouncePermissionsRequestSchema;
3676
+ exports.walletRenouncePermissionsResultSchema = walletRenouncePermissionsResultSchema;
3677
+ exports.walletRenouncePermissionsSuccessResponseSchema = walletRenouncePermissionsSuccessResponseSchema;
3678
+ exports.walletRequestPermissionsParamsSchema = walletRequestPermissionsParamsSchema;
3679
+ exports.walletRequestPermissionsRequestSchema = walletRequestPermissionsRequestSchema;
3680
+ exports.walletRequestPermissionsResultSchema = walletRequestPermissionsResultSchema;
3681
+ exports.walletRequestPermissionsSuccessResponseSchema = walletRequestPermissionsSuccessResponseSchema;
3682
+ exports.walletRequestSchema = walletRequestSchema;
3683
+ exports.walletSuccessResponseSchema = walletSuccessResponseSchema;
3684
+ exports.walletSwitchNetworkByIdParamsSchema = walletSwitchNetworkByIdParamsSchema;
3685
+ exports.walletSwitchNetworkByIdRequestSchema = walletSwitchNetworkByIdRequestSchema;
3686
+ exports.walletTypeSchema = walletTypeSchema;
3687
+ exports.walletTypes = walletTypes;