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