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