@sats-connect/core 0.17.3 → 0.17.4-021a85c

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