@sats-connect/core 0.7.0 → 0.7.1-07f514f
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.d.mts +385 -177
- package/dist/index.d.ts +385 -177
- package/dist/index.js +930 -734
- package/dist/index.mjs +910 -731
- package/package.json +9 -12
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,8 @@ var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
|
17
17
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
18
18
|
AddressPurpose2["Payment"] = "payment";
|
|
19
19
|
AddressPurpose2["Stacks"] = "stacks";
|
|
20
|
+
AddressPurpose2["Starknet"] = "starknet";
|
|
21
|
+
AddressPurpose2["Spark"] = "spark";
|
|
20
22
|
return AddressPurpose2;
|
|
21
23
|
})(AddressPurpose || {});
|
|
22
24
|
var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
@@ -26,11 +28,13 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
26
28
|
AddressType3["p2wsh"] = "p2wsh";
|
|
27
29
|
AddressType3["p2tr"] = "p2tr";
|
|
28
30
|
AddressType3["stacks"] = "stacks";
|
|
31
|
+
AddressType3["starknet"] = "starknet";
|
|
32
|
+
AddressType3["spark"] = "spark";
|
|
29
33
|
return AddressType3;
|
|
30
34
|
})(AddressType || {});
|
|
31
35
|
var addressSchema = v2.object({
|
|
32
36
|
address: v2.string(),
|
|
33
|
-
publicKey: v2.string(),
|
|
37
|
+
publicKey: v2.optional(v2.string()),
|
|
34
38
|
purpose: v2.enum(AddressPurpose),
|
|
35
39
|
addressType: v2.enum(AddressType),
|
|
36
40
|
walletType: walletTypeSchema
|
|
@@ -73,6 +77,11 @@ var StarknetNetworkType = /* @__PURE__ */ ((StarknetNetworkType2) => {
|
|
|
73
77
|
StarknetNetworkType2["Sepolia"] = "sepolia";
|
|
74
78
|
return StarknetNetworkType2;
|
|
75
79
|
})(StarknetNetworkType || {});
|
|
80
|
+
var SparkNetworkType = /* @__PURE__ */ ((SparkNetworkType2) => {
|
|
81
|
+
SparkNetworkType2["Mainnet"] = "mainnet";
|
|
82
|
+
SparkNetworkType2["Regtest"] = "regtest";
|
|
83
|
+
return SparkNetworkType2;
|
|
84
|
+
})(SparkNetworkType || {});
|
|
76
85
|
var RpcIdSchema = v3.optional(v3.union([v3.string(), v3.number(), v3.null()]));
|
|
77
86
|
var rpcRequestMessageSchema = v3.object({
|
|
78
87
|
jsonrpc: v3.literal("2.0"),
|
|
@@ -183,29 +192,760 @@ function getSupportedWallets() {
|
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
// src/request/index.ts
|
|
186
|
-
import * as
|
|
195
|
+
import * as v25 from "valibot";
|
|
196
|
+
|
|
197
|
+
// src/request/types/btcMethods.ts
|
|
198
|
+
import * as v6 from "valibot";
|
|
199
|
+
|
|
200
|
+
// src/request/types/walletMethods.ts
|
|
201
|
+
import * as v5 from "valibot";
|
|
202
|
+
var accountActionsSchema = v5.object({
|
|
203
|
+
read: v5.optional(v5.boolean())
|
|
204
|
+
});
|
|
205
|
+
var walletActionsSchema = v5.object({
|
|
206
|
+
readNetwork: v5.optional(v5.boolean())
|
|
207
|
+
});
|
|
208
|
+
var accountPermissionSchema = v5.object({
|
|
209
|
+
type: v5.literal("account"),
|
|
210
|
+
resourceId: v5.string(),
|
|
211
|
+
clientId: v5.string(),
|
|
212
|
+
actions: accountActionsSchema
|
|
213
|
+
});
|
|
214
|
+
var walletPermissionSchema = v5.object({
|
|
215
|
+
type: v5.literal("wallet"),
|
|
216
|
+
resourceId: v5.string(),
|
|
217
|
+
clientId: v5.string(),
|
|
218
|
+
actions: walletActionsSchema
|
|
219
|
+
});
|
|
220
|
+
var PermissionRequestParams = v5.variant("type", [
|
|
221
|
+
v5.object({
|
|
222
|
+
...v5.omit(accountPermissionSchema, ["clientId"]).entries
|
|
223
|
+
}),
|
|
224
|
+
v5.object({
|
|
225
|
+
...v5.omit(walletPermissionSchema, ["clientId"]).entries
|
|
226
|
+
})
|
|
227
|
+
]);
|
|
228
|
+
var permission = v5.variant("type", [accountPermissionSchema, walletPermissionSchema]);
|
|
229
|
+
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
230
|
+
var requestPermissionsParamsSchema = v5.nullish(v5.array(PermissionRequestParams));
|
|
231
|
+
var requestPermissionsResultSchema = v5.literal(true);
|
|
232
|
+
var requestPermissionsRequestMessageSchema = v5.object({
|
|
233
|
+
...rpcRequestMessageSchema.entries,
|
|
234
|
+
...v5.object({
|
|
235
|
+
method: v5.literal(requestPermissionsMethodName),
|
|
236
|
+
params: requestPermissionsParamsSchema,
|
|
237
|
+
id: v5.string()
|
|
238
|
+
}).entries
|
|
239
|
+
});
|
|
240
|
+
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
241
|
+
var renouncePermissionsParamsSchema = v5.nullish(v5.null());
|
|
242
|
+
var renouncePermissionsResultSchema = v5.nullish(v5.null());
|
|
243
|
+
var renouncePermissionsRequestMessageSchema = v5.object({
|
|
244
|
+
...rpcRequestMessageSchema.entries,
|
|
245
|
+
...v5.object({
|
|
246
|
+
method: v5.literal(renouncePermissionsMethodName),
|
|
247
|
+
params: renouncePermissionsParamsSchema,
|
|
248
|
+
id: v5.string()
|
|
249
|
+
}).entries
|
|
250
|
+
});
|
|
251
|
+
var disconnectMethodName = "wallet_disconnect";
|
|
252
|
+
var disconnectParamsSchema = v5.nullish(v5.null());
|
|
253
|
+
var disconnectResultSchema = v5.nullish(v5.null());
|
|
254
|
+
var disconnectRequestMessageSchema = v5.object({
|
|
255
|
+
...rpcRequestMessageSchema.entries,
|
|
256
|
+
...v5.object({
|
|
257
|
+
method: v5.literal(disconnectMethodName),
|
|
258
|
+
params: disconnectParamsSchema,
|
|
259
|
+
id: v5.string()
|
|
260
|
+
}).entries
|
|
261
|
+
});
|
|
262
|
+
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
263
|
+
var getWalletTypeParamsSchema = v5.nullish(v5.null());
|
|
264
|
+
var getWalletTypeResultSchema = walletTypeSchema;
|
|
265
|
+
var getWalletTypeRequestMessageSchema = v5.object({
|
|
266
|
+
...rpcRequestMessageSchema.entries,
|
|
267
|
+
...v5.object({
|
|
268
|
+
method: v5.literal(getWalletTypeMethodName),
|
|
269
|
+
params: getWalletTypeParamsSchema,
|
|
270
|
+
id: v5.string()
|
|
271
|
+
}).entries
|
|
272
|
+
});
|
|
273
|
+
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
274
|
+
var getCurrentPermissionsParamsSchema = v5.nullish(v5.null());
|
|
275
|
+
var getCurrentPermissionsResultSchema = v5.array(permission);
|
|
276
|
+
var getCurrentPermissionsRequestMessageSchema = v5.object({
|
|
277
|
+
...rpcRequestMessageSchema.entries,
|
|
278
|
+
...v5.object({
|
|
279
|
+
method: v5.literal(getCurrentPermissionsMethodName),
|
|
280
|
+
params: getCurrentPermissionsParamsSchema,
|
|
281
|
+
id: v5.string()
|
|
282
|
+
}).entries
|
|
283
|
+
});
|
|
284
|
+
var getNetworkMethodName = "wallet_getNetwork";
|
|
285
|
+
var getNetworkParamsSchema = v5.nullish(v5.null());
|
|
286
|
+
var getNetworkResultSchema = v5.object({
|
|
287
|
+
bitcoin: v5.object({
|
|
288
|
+
name: v5.enum(BitcoinNetworkType)
|
|
289
|
+
}),
|
|
290
|
+
stacks: v5.object({
|
|
291
|
+
name: v5.enum(StacksNetworkType)
|
|
292
|
+
}),
|
|
293
|
+
spark: v5.object({
|
|
294
|
+
name: v5.enum(SparkNetworkType)
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
var getNetworkRequestMessageSchema = v5.object({
|
|
298
|
+
...rpcRequestMessageSchema.entries,
|
|
299
|
+
...v5.object({
|
|
300
|
+
method: v5.literal(getNetworkMethodName),
|
|
301
|
+
params: getNetworkParamsSchema,
|
|
302
|
+
id: v5.string()
|
|
303
|
+
}).entries
|
|
304
|
+
});
|
|
305
|
+
var changeNetworkMethodName = "wallet_changeNetwork";
|
|
306
|
+
var changeNetworkParamsSchema = v5.object({
|
|
307
|
+
name: v5.enum(BitcoinNetworkType)
|
|
308
|
+
});
|
|
309
|
+
var changeNetworkResultSchema = v5.nullish(v5.null());
|
|
310
|
+
var changeNetworkRequestMessageSchema = v5.object({
|
|
311
|
+
...rpcRequestMessageSchema.entries,
|
|
312
|
+
...v5.object({
|
|
313
|
+
method: v5.literal(changeNetworkMethodName),
|
|
314
|
+
params: changeNetworkParamsSchema,
|
|
315
|
+
id: v5.string()
|
|
316
|
+
}).entries
|
|
317
|
+
});
|
|
318
|
+
var changeNetworkByIdMethodName = "wallet_changeNetworkById";
|
|
319
|
+
var changeNetworkByIdParamsSchema = v5.object({
|
|
320
|
+
id: v5.string()
|
|
321
|
+
});
|
|
322
|
+
var changeNetworkByIdResultSchema = v5.nullish(v5.null());
|
|
323
|
+
var changeNetworkByIdRequestMessageSchema = v5.object({
|
|
324
|
+
...rpcRequestMessageSchema.entries,
|
|
325
|
+
...v5.object({
|
|
326
|
+
method: v5.literal(changeNetworkByIdMethodName),
|
|
327
|
+
params: changeNetworkByIdParamsSchema,
|
|
328
|
+
id: v5.string()
|
|
329
|
+
}).entries
|
|
330
|
+
});
|
|
331
|
+
var getAccountMethodName = "wallet_getAccount";
|
|
332
|
+
var getAccountParamsSchema = v5.nullish(v5.null());
|
|
333
|
+
var getAccountResultSchema = v5.object({
|
|
334
|
+
id: v5.string(),
|
|
335
|
+
addresses: v5.array(addressSchema),
|
|
336
|
+
walletType: walletTypeSchema,
|
|
337
|
+
network: getNetworkResultSchema
|
|
338
|
+
});
|
|
339
|
+
var getAccountRequestMessageSchema = v5.object({
|
|
340
|
+
...rpcRequestMessageSchema.entries,
|
|
341
|
+
...v5.object({
|
|
342
|
+
method: v5.literal(getAccountMethodName),
|
|
343
|
+
params: getAccountParamsSchema,
|
|
344
|
+
id: v5.string()
|
|
345
|
+
}).entries
|
|
346
|
+
});
|
|
347
|
+
var connectMethodName = "wallet_connect";
|
|
348
|
+
var connectParamsSchema = v5.nullish(
|
|
349
|
+
v5.object({
|
|
350
|
+
permissions: v5.optional(v5.array(PermissionRequestParams)),
|
|
351
|
+
addresses: v5.optional(v5.array(v5.enum(AddressPurpose))),
|
|
352
|
+
message: v5.optional(
|
|
353
|
+
v5.pipe(v5.string(), v5.maxLength(80, "The message must not exceed 80 characters."))
|
|
354
|
+
),
|
|
355
|
+
network: v5.optional(v5.enum(BitcoinNetworkType))
|
|
356
|
+
})
|
|
357
|
+
);
|
|
358
|
+
var connectResultSchema = v5.object({
|
|
359
|
+
id: v5.string(),
|
|
360
|
+
addresses: v5.array(addressSchema),
|
|
361
|
+
walletType: walletTypeSchema,
|
|
362
|
+
network: getNetworkResultSchema
|
|
363
|
+
});
|
|
364
|
+
var connectRequestMessageSchema = v5.object({
|
|
365
|
+
...rpcRequestMessageSchema.entries,
|
|
366
|
+
...v5.object({
|
|
367
|
+
method: v5.literal(connectMethodName),
|
|
368
|
+
params: connectParamsSchema,
|
|
369
|
+
id: v5.string()
|
|
370
|
+
}).entries
|
|
371
|
+
});
|
|
372
|
+
var addNetworkMethodName = "wallet_addNetwork";
|
|
373
|
+
var addNetworkParamsSchema = v5.variant("chain", [
|
|
374
|
+
v5.object({
|
|
375
|
+
chain: v5.literal("bitcoin"),
|
|
376
|
+
type: v5.enum(BitcoinNetworkType),
|
|
377
|
+
name: v5.string(),
|
|
378
|
+
rpcUrl: v5.string(),
|
|
379
|
+
rpcFallbackUrl: v5.optional(v5.string()),
|
|
380
|
+
indexerUrl: v5.optional(v5.string()),
|
|
381
|
+
blockExplorerUrl: v5.optional(v5.string()),
|
|
382
|
+
switch: v5.optional(v5.boolean())
|
|
383
|
+
}),
|
|
384
|
+
v5.object({
|
|
385
|
+
chain: v5.literal("stacks"),
|
|
386
|
+
name: v5.string(),
|
|
387
|
+
type: v5.enum(StacksNetworkType),
|
|
388
|
+
rpcUrl: v5.string(),
|
|
389
|
+
blockExplorerUrl: v5.optional(v5.string()),
|
|
390
|
+
switch: v5.optional(v5.boolean())
|
|
391
|
+
}),
|
|
392
|
+
v5.object({
|
|
393
|
+
chain: v5.literal("starknet"),
|
|
394
|
+
name: v5.string(),
|
|
395
|
+
type: v5.enum(StarknetNetworkType),
|
|
396
|
+
rpcUrl: v5.string(),
|
|
397
|
+
blockExplorerUrl: v5.optional(v5.string()),
|
|
398
|
+
switch: v5.optional(v5.boolean())
|
|
399
|
+
})
|
|
400
|
+
]);
|
|
401
|
+
var addNetworkRequestMessageSchema = v5.object({
|
|
402
|
+
...rpcRequestMessageSchema.entries,
|
|
403
|
+
...v5.object({
|
|
404
|
+
method: v5.literal(addNetworkMethodName),
|
|
405
|
+
params: addNetworkParamsSchema,
|
|
406
|
+
id: v5.string()
|
|
407
|
+
}).entries
|
|
408
|
+
});
|
|
409
|
+
var addNetworkResultSchema = v5.object({
|
|
410
|
+
id: v5.string()
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// src/request/types/btcMethods.ts
|
|
414
|
+
var getInfoMethodName = "getInfo";
|
|
415
|
+
var getInfoParamsSchema = v6.nullish(v6.null());
|
|
416
|
+
var getInfoResultSchema = v6.object({
|
|
417
|
+
/**
|
|
418
|
+
* Version of the wallet.
|
|
419
|
+
*/
|
|
420
|
+
version: v6.string(),
|
|
421
|
+
/**
|
|
422
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
423
|
+
*/
|
|
424
|
+
methods: v6.optional(v6.array(v6.string())),
|
|
425
|
+
/**
|
|
426
|
+
* List of WBIP standards supported by the wallet. Not currently used.
|
|
427
|
+
*/
|
|
428
|
+
supports: v6.array(v6.string())
|
|
429
|
+
});
|
|
430
|
+
var getInfoRequestMessageSchema = v6.object({
|
|
431
|
+
...rpcRequestMessageSchema.entries,
|
|
432
|
+
...v6.object({
|
|
433
|
+
method: v6.literal(getInfoMethodName),
|
|
434
|
+
params: getInfoParamsSchema,
|
|
435
|
+
id: v6.string()
|
|
436
|
+
}).entries
|
|
437
|
+
});
|
|
438
|
+
var getAddressesMethodName = "getAddresses";
|
|
439
|
+
var getAddressesParamsSchema = v6.object({
|
|
440
|
+
/**
|
|
441
|
+
* The purposes for which to generate addresses. See
|
|
442
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
443
|
+
*/
|
|
444
|
+
purposes: v6.array(v6.enum(AddressPurpose)),
|
|
445
|
+
/**
|
|
446
|
+
* A message to be displayed to the user in the request prompt.
|
|
447
|
+
*/
|
|
448
|
+
message: v6.optional(v6.string())
|
|
449
|
+
});
|
|
450
|
+
var getAddressesResultSchema = v6.object({
|
|
451
|
+
/**
|
|
452
|
+
* The addresses generated for the given purposes.
|
|
453
|
+
*/
|
|
454
|
+
addresses: v6.array(addressSchema),
|
|
455
|
+
network: getNetworkResultSchema
|
|
456
|
+
});
|
|
457
|
+
var getAddressesRequestMessageSchema = v6.object({
|
|
458
|
+
...rpcRequestMessageSchema.entries,
|
|
459
|
+
...v6.object({
|
|
460
|
+
method: v6.literal(getAddressesMethodName),
|
|
461
|
+
params: getAddressesParamsSchema,
|
|
462
|
+
id: v6.string()
|
|
463
|
+
}).entries
|
|
464
|
+
});
|
|
465
|
+
var signMessageMethodName = "signMessage";
|
|
466
|
+
var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
467
|
+
MessageSigningProtocols2["ECDSA"] = "ECDSA";
|
|
468
|
+
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
469
|
+
return MessageSigningProtocols2;
|
|
470
|
+
})(MessageSigningProtocols || {});
|
|
471
|
+
var signMessageParamsSchema = v6.object({
|
|
472
|
+
/**
|
|
473
|
+
* The address used for signing.
|
|
474
|
+
**/
|
|
475
|
+
address: v6.string(),
|
|
476
|
+
/**
|
|
477
|
+
* The message to sign.
|
|
478
|
+
**/
|
|
479
|
+
message: v6.string(),
|
|
480
|
+
/**
|
|
481
|
+
* The protocol to use for signing the message.
|
|
482
|
+
*/
|
|
483
|
+
protocol: v6.optional(v6.enum(MessageSigningProtocols))
|
|
484
|
+
});
|
|
485
|
+
var signMessageResultSchema = v6.object({
|
|
486
|
+
/**
|
|
487
|
+
* The signature of the message.
|
|
488
|
+
*/
|
|
489
|
+
signature: v6.string(),
|
|
490
|
+
/**
|
|
491
|
+
* hash of the message.
|
|
492
|
+
*/
|
|
493
|
+
messageHash: v6.string(),
|
|
494
|
+
/**
|
|
495
|
+
* The address used for signing.
|
|
496
|
+
*/
|
|
497
|
+
address: v6.string(),
|
|
498
|
+
/**
|
|
499
|
+
* The protocol to use for signing the message.
|
|
500
|
+
*/
|
|
501
|
+
protocol: v6.enum(MessageSigningProtocols)
|
|
502
|
+
});
|
|
503
|
+
var signMessageRequestMessageSchema = v6.object({
|
|
504
|
+
...rpcRequestMessageSchema.entries,
|
|
505
|
+
...v6.object({
|
|
506
|
+
method: v6.literal(signMessageMethodName),
|
|
507
|
+
params: signMessageParamsSchema,
|
|
508
|
+
id: v6.string()
|
|
509
|
+
}).entries
|
|
510
|
+
});
|
|
511
|
+
var sendTransferMethodName = "sendTransfer";
|
|
512
|
+
var sendTransferParamsSchema = v6.object({
|
|
513
|
+
/**
|
|
514
|
+
* Array of recipients to send to.
|
|
515
|
+
* The amount to send to each recipient is in satoshis.
|
|
516
|
+
*/
|
|
517
|
+
recipients: v6.array(
|
|
518
|
+
v6.object({
|
|
519
|
+
address: v6.string(),
|
|
520
|
+
amount: v6.number()
|
|
521
|
+
})
|
|
522
|
+
)
|
|
523
|
+
});
|
|
524
|
+
var sendTransferResultSchema = v6.object({
|
|
525
|
+
/**
|
|
526
|
+
* The transaction id as a hex-encoded string.
|
|
527
|
+
*/
|
|
528
|
+
txid: v6.string()
|
|
529
|
+
});
|
|
530
|
+
var sendTransferRequestMessageSchema = v6.object({
|
|
531
|
+
...rpcRequestMessageSchema.entries,
|
|
532
|
+
...v6.object({
|
|
533
|
+
method: v6.literal(sendTransferMethodName),
|
|
534
|
+
params: sendTransferParamsSchema,
|
|
535
|
+
id: v6.string()
|
|
536
|
+
}).entries
|
|
537
|
+
});
|
|
538
|
+
var signPsbtMethodName = "signPsbt";
|
|
539
|
+
var signPsbtParamsSchema = v6.object({
|
|
540
|
+
/**
|
|
541
|
+
* The base64 encoded PSBT to sign.
|
|
542
|
+
*/
|
|
543
|
+
psbt: v6.string(),
|
|
544
|
+
/**
|
|
545
|
+
* The inputs to sign.
|
|
546
|
+
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
547
|
+
*/
|
|
548
|
+
signInputs: v6.optional(v6.record(v6.string(), v6.array(v6.number()))),
|
|
549
|
+
/**
|
|
550
|
+
* Whether to broadcast the transaction after signing.
|
|
551
|
+
**/
|
|
552
|
+
broadcast: v6.optional(v6.boolean())
|
|
553
|
+
});
|
|
554
|
+
var signPsbtResultSchema = v6.object({
|
|
555
|
+
/**
|
|
556
|
+
* The base64 encoded PSBT after signing.
|
|
557
|
+
*/
|
|
558
|
+
psbt: v6.string(),
|
|
559
|
+
/**
|
|
560
|
+
* The transaction id as a hex-encoded string.
|
|
561
|
+
* This is only returned if the transaction was broadcast.
|
|
562
|
+
**/
|
|
563
|
+
txid: v6.optional(v6.string())
|
|
564
|
+
});
|
|
565
|
+
var signPsbtRequestMessageSchema = v6.object({
|
|
566
|
+
...rpcRequestMessageSchema.entries,
|
|
567
|
+
...v6.object({
|
|
568
|
+
method: v6.literal(signPsbtMethodName),
|
|
569
|
+
params: signPsbtParamsSchema,
|
|
570
|
+
id: v6.string()
|
|
571
|
+
}).entries
|
|
572
|
+
});
|
|
573
|
+
var getAccountsMethodName = "getAccounts";
|
|
574
|
+
var getAccountsParamsSchema = v6.object({
|
|
575
|
+
/**
|
|
576
|
+
* The purposes for which to generate addresses. See
|
|
577
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
578
|
+
*/
|
|
579
|
+
purposes: v6.array(v6.enum(AddressPurpose)),
|
|
580
|
+
/**
|
|
581
|
+
* A message to be displayed to the user in the request prompt.
|
|
582
|
+
*/
|
|
583
|
+
message: v6.optional(v6.string())
|
|
584
|
+
});
|
|
585
|
+
var getAccountsResultSchema = v6.array(
|
|
586
|
+
v6.object({
|
|
587
|
+
...addressSchema.entries,
|
|
588
|
+
...v6.object({
|
|
589
|
+
walletType: walletTypeSchema
|
|
590
|
+
}).entries
|
|
591
|
+
})
|
|
592
|
+
);
|
|
593
|
+
var getAccountsRequestMessageSchema = v6.object({
|
|
594
|
+
...rpcRequestMessageSchema.entries,
|
|
595
|
+
...v6.object({
|
|
596
|
+
method: v6.literal(getAccountsMethodName),
|
|
597
|
+
params: getAccountsParamsSchema,
|
|
598
|
+
id: v6.string()
|
|
599
|
+
}).entries
|
|
600
|
+
});
|
|
601
|
+
var getBalanceMethodName = "getBalance";
|
|
602
|
+
var getBalanceParamsSchema = v6.nullish(v6.null());
|
|
603
|
+
var getBalanceResultSchema = v6.object({
|
|
604
|
+
/**
|
|
605
|
+
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
606
|
+
* messages not supporting bigint
|
|
607
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
608
|
+
*/
|
|
609
|
+
confirmed: v6.string(),
|
|
610
|
+
/**
|
|
611
|
+
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
612
|
+
* messages not supporting bigint
|
|
613
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
614
|
+
*/
|
|
615
|
+
unconfirmed: v6.string(),
|
|
616
|
+
/**
|
|
617
|
+
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
618
|
+
* sats. Using a string due to chrome messages not supporting bigint
|
|
619
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
620
|
+
*/
|
|
621
|
+
total: v6.string()
|
|
622
|
+
});
|
|
623
|
+
var getBalanceRequestMessageSchema = v6.object({
|
|
624
|
+
...rpcRequestMessageSchema.entries,
|
|
625
|
+
...v6.object({
|
|
626
|
+
method: v6.literal(getBalanceMethodName),
|
|
627
|
+
id: v6.string()
|
|
628
|
+
}).entries
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// src/request/types/ordinalsMethods.ts
|
|
632
|
+
import * as v7 from "valibot";
|
|
633
|
+
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
634
|
+
var getInscriptionsParamsSchema = v7.object({
|
|
635
|
+
offset: v7.number(),
|
|
636
|
+
limit: v7.number()
|
|
637
|
+
});
|
|
638
|
+
var getInscriptionsResultSchema = v7.object({
|
|
639
|
+
total: v7.number(),
|
|
640
|
+
limit: v7.number(),
|
|
641
|
+
offset: v7.number(),
|
|
642
|
+
inscriptions: v7.array(
|
|
643
|
+
v7.object({
|
|
644
|
+
inscriptionId: v7.string(),
|
|
645
|
+
inscriptionNumber: v7.string(),
|
|
646
|
+
address: v7.string(),
|
|
647
|
+
collectionName: v7.optional(v7.string()),
|
|
648
|
+
postage: v7.string(),
|
|
649
|
+
contentLength: v7.string(),
|
|
650
|
+
contentType: v7.string(),
|
|
651
|
+
timestamp: v7.number(),
|
|
652
|
+
offset: v7.number(),
|
|
653
|
+
genesisTransaction: v7.string(),
|
|
654
|
+
output: v7.string()
|
|
655
|
+
})
|
|
656
|
+
)
|
|
657
|
+
});
|
|
658
|
+
var getInscriptionsRequestMessageSchema = v7.object({
|
|
659
|
+
...rpcRequestMessageSchema.entries,
|
|
660
|
+
...v7.object({
|
|
661
|
+
method: v7.literal(getInscriptionsMethodName),
|
|
662
|
+
params: getInscriptionsParamsSchema,
|
|
663
|
+
id: v7.string()
|
|
664
|
+
}).entries
|
|
665
|
+
});
|
|
666
|
+
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
667
|
+
var sendInscriptionsParamsSchema = v7.object({
|
|
668
|
+
transfers: v7.array(
|
|
669
|
+
v7.object({
|
|
670
|
+
address: v7.string(),
|
|
671
|
+
inscriptionId: v7.string()
|
|
672
|
+
})
|
|
673
|
+
)
|
|
674
|
+
});
|
|
675
|
+
var sendInscriptionsResultSchema = v7.object({
|
|
676
|
+
txid: v7.string()
|
|
677
|
+
});
|
|
678
|
+
var sendInscriptionsRequestMessageSchema = v7.object({
|
|
679
|
+
...rpcRequestMessageSchema.entries,
|
|
680
|
+
...v7.object({
|
|
681
|
+
method: v7.literal(sendInscriptionsMethodName),
|
|
682
|
+
params: sendInscriptionsParamsSchema,
|
|
683
|
+
id: v7.string()
|
|
684
|
+
}).entries
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
// src/request/types/runesMethods/etch.ts
|
|
688
|
+
import * as v8 from "valibot";
|
|
689
|
+
var runesEtchMethodName = "runes_etch";
|
|
690
|
+
var etchTermsSchema = v8.object({
|
|
691
|
+
amount: v8.string(),
|
|
692
|
+
cap: v8.string(),
|
|
693
|
+
heightStart: v8.optional(v8.string()),
|
|
694
|
+
heightEnd: v8.optional(v8.string()),
|
|
695
|
+
offsetStart: v8.optional(v8.string()),
|
|
696
|
+
offsetEnd: v8.optional(v8.string())
|
|
697
|
+
});
|
|
698
|
+
var inscriptionDetailsSchema = v8.object({
|
|
699
|
+
contentType: v8.string(),
|
|
700
|
+
contentBase64: v8.string()
|
|
701
|
+
});
|
|
702
|
+
var runesEtchParamsSchema = v8.object({
|
|
703
|
+
runeName: v8.string(),
|
|
704
|
+
divisibility: v8.optional(v8.number()),
|
|
705
|
+
symbol: v8.optional(v8.string()),
|
|
706
|
+
premine: v8.optional(v8.string()),
|
|
707
|
+
isMintable: v8.boolean(),
|
|
708
|
+
delegateInscriptionId: v8.optional(v8.string()),
|
|
709
|
+
destinationAddress: v8.string(),
|
|
710
|
+
refundAddress: v8.string(),
|
|
711
|
+
feeRate: v8.number(),
|
|
712
|
+
appServiceFee: v8.optional(v8.number()),
|
|
713
|
+
appServiceFeeAddress: v8.optional(v8.string()),
|
|
714
|
+
terms: v8.optional(etchTermsSchema),
|
|
715
|
+
inscriptionDetails: v8.optional(inscriptionDetailsSchema),
|
|
716
|
+
network: v8.optional(v8.enum(BitcoinNetworkType))
|
|
717
|
+
});
|
|
718
|
+
var runesEtchResultSchema = v8.object({
|
|
719
|
+
orderId: v8.string(),
|
|
720
|
+
fundTransactionId: v8.string(),
|
|
721
|
+
fundingAddress: v8.string()
|
|
722
|
+
});
|
|
723
|
+
var runesEtchRequestMessageSchema = v8.object({
|
|
724
|
+
...rpcRequestMessageSchema.entries,
|
|
725
|
+
...v8.object({
|
|
726
|
+
method: v8.literal(runesEtchMethodName),
|
|
727
|
+
params: runesEtchParamsSchema,
|
|
728
|
+
id: v8.string()
|
|
729
|
+
}).entries
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
// src/request/types/runesMethods/getBalance.ts
|
|
733
|
+
import * as v9 from "valibot";
|
|
734
|
+
var runesGetBalanceMethodName = "runes_getBalance";
|
|
735
|
+
var runesGetBalanceParamsSchema = v9.nullish(v9.null());
|
|
736
|
+
var runesGetBalanceResultSchema = v9.object({
|
|
737
|
+
balances: v9.array(
|
|
738
|
+
v9.object({
|
|
739
|
+
runeName: v9.string(),
|
|
740
|
+
amount: v9.string(),
|
|
741
|
+
divisibility: v9.number(),
|
|
742
|
+
symbol: v9.string(),
|
|
743
|
+
inscriptionId: v9.nullish(v9.string()),
|
|
744
|
+
spendableBalance: v9.string()
|
|
745
|
+
})
|
|
746
|
+
)
|
|
747
|
+
});
|
|
748
|
+
var runesGetBalanceRequestMessageSchema = v9.object({
|
|
749
|
+
...rpcRequestMessageSchema.entries,
|
|
750
|
+
...v9.object({
|
|
751
|
+
method: v9.literal(runesGetBalanceMethodName),
|
|
752
|
+
params: runesGetBalanceParamsSchema,
|
|
753
|
+
id: v9.string()
|
|
754
|
+
}).entries
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
// src/request/types/runesMethods/mint.ts
|
|
758
|
+
import * as v10 from "valibot";
|
|
759
|
+
var runesMintMethodName = "runes_mint";
|
|
760
|
+
var runesMintParamsSchema = v10.object({
|
|
761
|
+
appServiceFee: v10.optional(v10.number()),
|
|
762
|
+
appServiceFeeAddress: v10.optional(v10.string()),
|
|
763
|
+
destinationAddress: v10.string(),
|
|
764
|
+
feeRate: v10.number(),
|
|
765
|
+
refundAddress: v10.string(),
|
|
766
|
+
repeats: v10.number(),
|
|
767
|
+
runeName: v10.string(),
|
|
768
|
+
network: v10.optional(v10.enum(BitcoinNetworkType))
|
|
769
|
+
});
|
|
770
|
+
var runesMintResultSchema = v10.object({
|
|
771
|
+
orderId: v10.string(),
|
|
772
|
+
fundTransactionId: v10.string(),
|
|
773
|
+
fundingAddress: v10.string()
|
|
774
|
+
});
|
|
775
|
+
var runesMintRequestMessageSchema = v10.object({
|
|
776
|
+
...rpcRequestMessageSchema.entries,
|
|
777
|
+
...v10.object({
|
|
778
|
+
method: v10.literal(runesMintMethodName),
|
|
779
|
+
params: runesMintParamsSchema,
|
|
780
|
+
id: v10.string()
|
|
781
|
+
}).entries
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
// src/request/types/runesMethods/transfer.ts
|
|
785
|
+
import * as v11 from "valibot";
|
|
786
|
+
var runesTransferMethodName = "runes_transfer";
|
|
787
|
+
var runesTransferParamsSchema = v11.object({
|
|
788
|
+
recipients: v11.array(
|
|
789
|
+
v11.object({
|
|
790
|
+
runeName: v11.string(),
|
|
791
|
+
amount: v11.string(),
|
|
792
|
+
address: v11.string()
|
|
793
|
+
})
|
|
794
|
+
)
|
|
795
|
+
});
|
|
796
|
+
var runesTransferResultSchema = v11.object({
|
|
797
|
+
txid: v11.string()
|
|
798
|
+
});
|
|
799
|
+
var runesTransferRequestMessageSchema = v11.object({
|
|
800
|
+
...rpcRequestMessageSchema.entries,
|
|
801
|
+
...v11.object({
|
|
802
|
+
method: v11.literal(runesTransferMethodName),
|
|
803
|
+
params: runesTransferParamsSchema,
|
|
804
|
+
id: v11.string()
|
|
805
|
+
}).entries
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
// src/request/types/sparkMethods/getAddresses.ts
|
|
809
|
+
import * as v12 from "valibot";
|
|
810
|
+
var sparkGetAddressesMethodName = "spark_getAddresses";
|
|
811
|
+
var sparkGetAddressesParamsSchema = v12.nullish(
|
|
812
|
+
v12.object({
|
|
813
|
+
/**
|
|
814
|
+
* A message to be displayed to the user in the request prompt.
|
|
815
|
+
*/
|
|
816
|
+
message: v12.optional(v12.string())
|
|
817
|
+
})
|
|
818
|
+
);
|
|
819
|
+
var sparkGetAddressesResultSchema = v12.object({
|
|
820
|
+
/**
|
|
821
|
+
* The addresses generated for the given purposes.
|
|
822
|
+
*/
|
|
823
|
+
addresses: v12.array(addressSchema),
|
|
824
|
+
network: getNetworkResultSchema
|
|
825
|
+
});
|
|
826
|
+
var sparkGetAddressesRequestMessageSchema = v12.object({
|
|
827
|
+
...rpcRequestMessageSchema.entries,
|
|
828
|
+
...v12.object({
|
|
829
|
+
method: v12.literal(sparkGetAddressesMethodName),
|
|
830
|
+
params: sparkGetAddressesParamsSchema,
|
|
831
|
+
id: v12.string()
|
|
832
|
+
}).entries
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
// src/request/types/sparkMethods/getBalance.ts
|
|
836
|
+
import * as v13 from "valibot";
|
|
837
|
+
var sparkGetBalanceMethodName = "spark_getBalance";
|
|
838
|
+
var sparkGetBalanceParamsSchema = v13.nullish(v13.null());
|
|
839
|
+
var sparkGetBalanceResultSchema = v13.object({
|
|
840
|
+
/**
|
|
841
|
+
* The Spark Bitcoin address balance in sats in string form.
|
|
842
|
+
*/
|
|
843
|
+
balance: v13.string(),
|
|
844
|
+
tokenBalances: v13.array(
|
|
845
|
+
v13.object({
|
|
846
|
+
/* The address balance of the token in string form as it can overflow a js number */
|
|
847
|
+
balance: v13.string(),
|
|
848
|
+
tokenMetadata: v13.object({
|
|
849
|
+
tokenIdentifier: v13.string(),
|
|
850
|
+
tokenPublicKey: v13.string(),
|
|
851
|
+
tokenName: v13.string(),
|
|
852
|
+
tokenTicker: v13.string(),
|
|
853
|
+
decimals: v13.number(),
|
|
854
|
+
maxSupply: v13.string()
|
|
855
|
+
})
|
|
856
|
+
})
|
|
857
|
+
)
|
|
858
|
+
});
|
|
859
|
+
var sparkGetBalanceRequestMessageSchema = v13.object({
|
|
860
|
+
...rpcRequestMessageSchema.entries,
|
|
861
|
+
...v13.object({
|
|
862
|
+
method: v13.literal(sparkGetBalanceMethodName),
|
|
863
|
+
params: sparkGetBalanceParamsSchema,
|
|
864
|
+
id: v13.string()
|
|
865
|
+
}).entries
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
// src/request/types/sparkMethods/transfer.ts
|
|
869
|
+
import * as v14 from "valibot";
|
|
870
|
+
var sparkTransferMethodName = "spark_transfer";
|
|
871
|
+
var sparkTransferParamsSchema = v14.object({
|
|
872
|
+
/**
|
|
873
|
+
* Amount of SATS to transfer as a string or number.
|
|
874
|
+
*/
|
|
875
|
+
amountSats: v14.union([v14.number(), v14.string()]),
|
|
876
|
+
/**
|
|
877
|
+
* The recipient's spark address.
|
|
878
|
+
*/
|
|
879
|
+
receiverSparkAddress: v14.string()
|
|
880
|
+
});
|
|
881
|
+
var sparkTransferResultSchema = v14.object({
|
|
882
|
+
/**
|
|
883
|
+
* The ID of the transaction.
|
|
884
|
+
*/
|
|
885
|
+
id: v14.string()
|
|
886
|
+
});
|
|
887
|
+
var sparkTransferRequestMessageSchema = v14.object({
|
|
888
|
+
...rpcRequestMessageSchema.entries,
|
|
889
|
+
...v14.object({
|
|
890
|
+
method: v14.literal(sparkTransferMethodName),
|
|
891
|
+
params: sparkTransferParamsSchema,
|
|
892
|
+
id: v14.string()
|
|
893
|
+
}).entries
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
// src/request/types/sparkMethods/transferToken.ts
|
|
897
|
+
import * as v15 from "valibot";
|
|
898
|
+
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
899
|
+
var sparkTransferTokenParamsSchema = v15.object({
|
|
900
|
+
/**
|
|
901
|
+
* Amount of units of the token to transfer as a string or number.
|
|
902
|
+
*/
|
|
903
|
+
tokenAmount: v15.union([v15.number(), v15.string()]),
|
|
904
|
+
/**
|
|
905
|
+
* The token identifier.
|
|
906
|
+
*/
|
|
907
|
+
tokenIdentifier: v15.string(),
|
|
908
|
+
/**
|
|
909
|
+
* The recipient's spark address.
|
|
910
|
+
*/
|
|
911
|
+
receiverSparkAddress: v15.string()
|
|
912
|
+
});
|
|
913
|
+
var sparkTransferTokenResultSchema = v15.object({
|
|
914
|
+
/**
|
|
915
|
+
* The ID of the transaction.
|
|
916
|
+
*/
|
|
917
|
+
id: v15.string()
|
|
918
|
+
});
|
|
919
|
+
var sparkTransferTokenRequestMessageSchema = v15.object({
|
|
920
|
+
...rpcRequestMessageSchema.entries,
|
|
921
|
+
...v15.object({
|
|
922
|
+
method: v15.literal(sparkTransferTokenMethodName),
|
|
923
|
+
params: sparkTransferTokenParamsSchema,
|
|
924
|
+
id: v15.string()
|
|
925
|
+
}).entries
|
|
926
|
+
});
|
|
187
927
|
|
|
188
928
|
// src/request/types/stxMethods/callContract.ts
|
|
189
|
-
import * as
|
|
929
|
+
import * as v16 from "valibot";
|
|
190
930
|
var stxCallContractMethodName = "stx_callContract";
|
|
191
|
-
var stxCallContractParamsSchema =
|
|
931
|
+
var stxCallContractParamsSchema = v16.object({
|
|
192
932
|
/**
|
|
193
933
|
* The contract principal.
|
|
194
934
|
*
|
|
195
935
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
196
936
|
*/
|
|
197
|
-
contract:
|
|
937
|
+
contract: v16.string(),
|
|
198
938
|
/**
|
|
199
939
|
* The name of the function to call.
|
|
200
940
|
*
|
|
201
941
|
* Note: spec changes ongoing,
|
|
202
942
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
203
943
|
*/
|
|
204
|
-
functionName:
|
|
944
|
+
functionName: v16.string(),
|
|
205
945
|
/**
|
|
206
946
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
207
947
|
*/
|
|
208
|
-
arguments:
|
|
948
|
+
arguments: v16.optional(v16.array(v16.string())),
|
|
209
949
|
/**
|
|
210
950
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
211
951
|
* strings of Clarity values.
|
|
@@ -220,486 +960,274 @@ var stxCallContractParamsSchema = v5.object({
|
|
|
220
960
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
221
961
|
* ```
|
|
222
962
|
*/
|
|
223
|
-
functionArgs:
|
|
963
|
+
functionArgs: v16.optional(v16.array(v16.string())),
|
|
224
964
|
/**
|
|
225
965
|
* The post conditions to apply to the contract call.
|
|
226
966
|
*/
|
|
227
|
-
postConditions:
|
|
967
|
+
postConditions: v16.optional(v16.array(v16.string())),
|
|
228
968
|
/**
|
|
229
969
|
* The mode to apply to the post conditions.
|
|
230
970
|
*/
|
|
231
|
-
postConditionMode:
|
|
971
|
+
postConditionMode: v16.optional(v16.union([v16.literal("allow"), v16.literal("deny")]))
|
|
232
972
|
});
|
|
233
|
-
var stxCallContractResultSchema =
|
|
973
|
+
var stxCallContractResultSchema = v16.object({
|
|
234
974
|
/**
|
|
235
975
|
* The ID of the transaction.
|
|
236
976
|
*/
|
|
237
|
-
txid:
|
|
977
|
+
txid: v16.string(),
|
|
238
978
|
/**
|
|
239
979
|
* A Stacks transaction as a hex-encoded string.
|
|
240
980
|
*/
|
|
241
|
-
transaction:
|
|
981
|
+
transaction: v16.string()
|
|
242
982
|
});
|
|
243
|
-
var stxCallContractRequestMessageSchema =
|
|
983
|
+
var stxCallContractRequestMessageSchema = v16.object({
|
|
244
984
|
...rpcRequestMessageSchema.entries,
|
|
245
|
-
...
|
|
246
|
-
method:
|
|
985
|
+
...v16.object({
|
|
986
|
+
method: v16.literal(stxCallContractMethodName),
|
|
247
987
|
params: stxCallContractParamsSchema,
|
|
248
|
-
id:
|
|
988
|
+
id: v16.string()
|
|
249
989
|
}).entries
|
|
250
990
|
});
|
|
251
991
|
|
|
252
992
|
// src/request/types/stxMethods/deployContract.ts
|
|
253
|
-
import * as
|
|
993
|
+
import * as v17 from "valibot";
|
|
254
994
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
255
|
-
var stxDeployContractParamsSchema =
|
|
995
|
+
var stxDeployContractParamsSchema = v17.object({
|
|
256
996
|
/**
|
|
257
997
|
* Name of the contract.
|
|
258
998
|
*/
|
|
259
|
-
name:
|
|
999
|
+
name: v17.string(),
|
|
260
1000
|
/**
|
|
261
1001
|
* The source code of the Clarity contract.
|
|
262
1002
|
*/
|
|
263
|
-
clarityCode:
|
|
1003
|
+
clarityCode: v17.string(),
|
|
264
1004
|
/**
|
|
265
1005
|
* The version of the Clarity contract.
|
|
266
1006
|
*/
|
|
267
|
-
clarityVersion:
|
|
1007
|
+
clarityVersion: v17.optional(v17.number()),
|
|
268
1008
|
/**
|
|
269
1009
|
* The post conditions to apply to the contract call.
|
|
270
1010
|
*/
|
|
271
|
-
postConditions:
|
|
1011
|
+
postConditions: v17.optional(v17.array(v17.string())),
|
|
272
1012
|
/**
|
|
273
1013
|
* The mode to apply to the post conditions.
|
|
274
1014
|
*/
|
|
275
|
-
postConditionMode:
|
|
1015
|
+
postConditionMode: v17.optional(v17.union([v17.literal("allow"), v17.literal("deny")]))
|
|
276
1016
|
});
|
|
277
|
-
var stxDeployContractResultSchema =
|
|
1017
|
+
var stxDeployContractResultSchema = v17.object({
|
|
278
1018
|
/**
|
|
279
1019
|
* The ID of the transaction.
|
|
280
1020
|
*/
|
|
281
|
-
txid:
|
|
1021
|
+
txid: v17.string(),
|
|
282
1022
|
/**
|
|
283
1023
|
* A Stacks transaction as a hex-encoded string.
|
|
284
1024
|
*/
|
|
285
|
-
transaction:
|
|
1025
|
+
transaction: v17.string()
|
|
286
1026
|
});
|
|
287
|
-
var stxDeployContractRequestMessageSchema =
|
|
1027
|
+
var stxDeployContractRequestMessageSchema = v17.object({
|
|
288
1028
|
...rpcRequestMessageSchema.entries,
|
|
289
|
-
...
|
|
290
|
-
method:
|
|
1029
|
+
...v17.object({
|
|
1030
|
+
method: v17.literal(stxDeployContractMethodName),
|
|
291
1031
|
params: stxDeployContractParamsSchema,
|
|
292
|
-
id:
|
|
293
|
-
}).entries
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
// src/request/types/stxMethods/getAccounts.ts
|
|
297
|
-
import * as v8 from "valibot";
|
|
298
|
-
|
|
299
|
-
// src/request/types/walletMethods.ts
|
|
300
|
-
import * as v7 from "valibot";
|
|
301
|
-
var accountActionsSchema = v7.object({
|
|
302
|
-
read: v7.optional(v7.boolean())
|
|
303
|
-
});
|
|
304
|
-
var walletActionsSchema = v7.object({
|
|
305
|
-
readNetwork: v7.optional(v7.boolean())
|
|
306
|
-
});
|
|
307
|
-
var accountPermissionSchema = v7.object({
|
|
308
|
-
type: v7.literal("account"),
|
|
309
|
-
resourceId: v7.string(),
|
|
310
|
-
clientId: v7.string(),
|
|
311
|
-
actions: accountActionsSchema
|
|
312
|
-
});
|
|
313
|
-
var walletPermissionSchema = v7.object({
|
|
314
|
-
type: v7.literal("wallet"),
|
|
315
|
-
resourceId: v7.string(),
|
|
316
|
-
clientId: v7.string(),
|
|
317
|
-
actions: walletActionsSchema
|
|
318
|
-
});
|
|
319
|
-
var PermissionRequestParams = v7.variant("type", [
|
|
320
|
-
v7.object({
|
|
321
|
-
...v7.omit(accountPermissionSchema, ["clientId"]).entries
|
|
322
|
-
}),
|
|
323
|
-
v7.object({
|
|
324
|
-
...v7.omit(walletPermissionSchema, ["clientId"]).entries
|
|
325
|
-
})
|
|
326
|
-
]);
|
|
327
|
-
var permission = v7.variant("type", [accountPermissionSchema, walletPermissionSchema]);
|
|
328
|
-
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
329
|
-
var requestPermissionsParamsSchema = v7.nullish(v7.array(PermissionRequestParams));
|
|
330
|
-
var requestPermissionsResultSchema = v7.literal(true);
|
|
331
|
-
var requestPermissionsRequestMessageSchema = v7.object({
|
|
332
|
-
...rpcRequestMessageSchema.entries,
|
|
333
|
-
...v7.object({
|
|
334
|
-
method: v7.literal(requestPermissionsMethodName),
|
|
335
|
-
params: requestPermissionsParamsSchema,
|
|
336
|
-
id: v7.string()
|
|
337
|
-
}).entries
|
|
338
|
-
});
|
|
339
|
-
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
340
|
-
var renouncePermissionsParamsSchema = v7.nullish(v7.null());
|
|
341
|
-
var renouncePermissionsResultSchema = v7.nullish(v7.null());
|
|
342
|
-
var renouncePermissionsRequestMessageSchema = v7.object({
|
|
343
|
-
...rpcRequestMessageSchema.entries,
|
|
344
|
-
...v7.object({
|
|
345
|
-
method: v7.literal(renouncePermissionsMethodName),
|
|
346
|
-
params: renouncePermissionsParamsSchema,
|
|
347
|
-
id: v7.string()
|
|
348
|
-
}).entries
|
|
349
|
-
});
|
|
350
|
-
var disconnectMethodName = "wallet_disconnect";
|
|
351
|
-
var disconnectParamsSchema = v7.nullish(v7.null());
|
|
352
|
-
var disconnectResultSchema = v7.nullish(v7.null());
|
|
353
|
-
var disconnectRequestMessageSchema = v7.object({
|
|
354
|
-
...rpcRequestMessageSchema.entries,
|
|
355
|
-
...v7.object({
|
|
356
|
-
method: v7.literal(disconnectMethodName),
|
|
357
|
-
params: disconnectParamsSchema,
|
|
358
|
-
id: v7.string()
|
|
359
|
-
}).entries
|
|
360
|
-
});
|
|
361
|
-
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
362
|
-
var getWalletTypeParamsSchema = v7.nullish(v7.null());
|
|
363
|
-
var getWalletTypeResultSchema = walletTypeSchema;
|
|
364
|
-
var getWalletTypeRequestMessageSchema = v7.object({
|
|
365
|
-
...rpcRequestMessageSchema.entries,
|
|
366
|
-
...v7.object({
|
|
367
|
-
method: v7.literal(getWalletTypeMethodName),
|
|
368
|
-
params: getWalletTypeParamsSchema,
|
|
369
|
-
id: v7.string()
|
|
370
|
-
}).entries
|
|
371
|
-
});
|
|
372
|
-
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
373
|
-
var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
|
|
374
|
-
var getCurrentPermissionsResultSchema = v7.array(permission);
|
|
375
|
-
var getCurrentPermissionsRequestMessageSchema = v7.object({
|
|
376
|
-
...rpcRequestMessageSchema.entries,
|
|
377
|
-
...v7.object({
|
|
378
|
-
method: v7.literal(getCurrentPermissionsMethodName),
|
|
379
|
-
params: getCurrentPermissionsParamsSchema,
|
|
380
|
-
id: v7.string()
|
|
381
|
-
}).entries
|
|
382
|
-
});
|
|
383
|
-
var getNetworkMethodName = "wallet_getNetwork";
|
|
384
|
-
var getNetworkParamsSchema = v7.nullish(v7.null());
|
|
385
|
-
var getNetworkResultSchema = v7.object({
|
|
386
|
-
bitcoin: v7.object({
|
|
387
|
-
name: v7.enum(BitcoinNetworkType)
|
|
388
|
-
}),
|
|
389
|
-
stacks: v7.object({
|
|
390
|
-
name: v7.string()
|
|
391
|
-
})
|
|
392
|
-
});
|
|
393
|
-
var getNetworkRequestMessageSchema = v7.object({
|
|
394
|
-
...rpcRequestMessageSchema.entries,
|
|
395
|
-
...v7.object({
|
|
396
|
-
method: v7.literal(getNetworkMethodName),
|
|
397
|
-
params: getNetworkParamsSchema,
|
|
398
|
-
id: v7.string()
|
|
399
|
-
}).entries
|
|
400
|
-
});
|
|
401
|
-
var changeNetworkMethodName = "wallet_changeNetwork";
|
|
402
|
-
var changeNetworkParamsSchema = v7.object({
|
|
403
|
-
name: v7.enum(BitcoinNetworkType)
|
|
404
|
-
});
|
|
405
|
-
var changeNetworkResultSchema = v7.nullish(v7.null());
|
|
406
|
-
var changeNetworkRequestMessageSchema = v7.object({
|
|
407
|
-
...rpcRequestMessageSchema.entries,
|
|
408
|
-
...v7.object({
|
|
409
|
-
method: v7.literal(changeNetworkMethodName),
|
|
410
|
-
params: changeNetworkParamsSchema,
|
|
411
|
-
id: v7.string()
|
|
412
|
-
}).entries
|
|
413
|
-
});
|
|
414
|
-
var changeNetworkByIdMethodName = "wallet_changeNetworkById";
|
|
415
|
-
var changeNetworkByIdParamsSchema = v7.object({
|
|
416
|
-
id: v7.string()
|
|
417
|
-
});
|
|
418
|
-
var changeNetworkByIdResultSchema = v7.nullish(v7.null());
|
|
419
|
-
var changeNetworkByIdRequestMessageSchema = v7.object({
|
|
420
|
-
...rpcRequestMessageSchema.entries,
|
|
421
|
-
...v7.object({
|
|
422
|
-
method: v7.literal(changeNetworkByIdMethodName),
|
|
423
|
-
params: changeNetworkByIdParamsSchema,
|
|
424
|
-
id: v7.string()
|
|
425
|
-
}).entries
|
|
426
|
-
});
|
|
427
|
-
var getAccountMethodName = "wallet_getAccount";
|
|
428
|
-
var getAccountParamsSchema = v7.nullish(v7.null());
|
|
429
|
-
var getAccountResultSchema = v7.object({
|
|
430
|
-
id: v7.string(),
|
|
431
|
-
addresses: v7.array(addressSchema),
|
|
432
|
-
walletType: walletTypeSchema,
|
|
433
|
-
network: getNetworkResultSchema
|
|
434
|
-
});
|
|
435
|
-
var getAccountRequestMessageSchema = v7.object({
|
|
436
|
-
...rpcRequestMessageSchema.entries,
|
|
437
|
-
...v7.object({
|
|
438
|
-
method: v7.literal(getAccountMethodName),
|
|
439
|
-
params: getAccountParamsSchema,
|
|
440
|
-
id: v7.string()
|
|
441
|
-
}).entries
|
|
442
|
-
});
|
|
443
|
-
var connectMethodName = "wallet_connect";
|
|
444
|
-
var connectParamsSchema = v7.nullish(
|
|
445
|
-
v7.object({
|
|
446
|
-
permissions: v7.optional(v7.array(PermissionRequestParams)),
|
|
447
|
-
addresses: v7.optional(v7.array(v7.enum(AddressPurpose))),
|
|
448
|
-
message: v7.optional(
|
|
449
|
-
v7.pipe(v7.string(), v7.maxLength(80, "The message must not exceed 80 characters."))
|
|
450
|
-
),
|
|
451
|
-
network: v7.optional(v7.enum(BitcoinNetworkType))
|
|
452
|
-
})
|
|
453
|
-
);
|
|
454
|
-
var connectResultSchema = v7.object({
|
|
455
|
-
id: v7.string(),
|
|
456
|
-
addresses: v7.array(addressSchema),
|
|
457
|
-
walletType: walletTypeSchema,
|
|
458
|
-
network: getNetworkResultSchema
|
|
459
|
-
});
|
|
460
|
-
var connectRequestMessageSchema = v7.object({
|
|
461
|
-
...rpcRequestMessageSchema.entries,
|
|
462
|
-
...v7.object({
|
|
463
|
-
method: v7.literal(connectMethodName),
|
|
464
|
-
params: connectParamsSchema,
|
|
465
|
-
id: v7.string()
|
|
466
|
-
}).entries
|
|
467
|
-
});
|
|
468
|
-
var addNetworkMethodName = "wallet_addNetwork";
|
|
469
|
-
var addNetworkParamsSchema = v7.variant("chain", [
|
|
470
|
-
v7.object({
|
|
471
|
-
chain: v7.literal("bitcoin"),
|
|
472
|
-
type: v7.enum(BitcoinNetworkType),
|
|
473
|
-
name: v7.string(),
|
|
474
|
-
rpcUrl: v7.string(),
|
|
475
|
-
rpcFallbackUrl: v7.optional(v7.string()),
|
|
476
|
-
indexerUrl: v7.optional(v7.string()),
|
|
477
|
-
blockExplorerUrl: v7.optional(v7.string()),
|
|
478
|
-
switch: v7.optional(v7.boolean())
|
|
479
|
-
}),
|
|
480
|
-
v7.object({
|
|
481
|
-
chain: v7.literal("stacks"),
|
|
482
|
-
name: v7.string(),
|
|
483
|
-
type: v7.enum(StacksNetworkType),
|
|
484
|
-
rpcUrl: v7.string(),
|
|
485
|
-
blockExplorerUrl: v7.optional(v7.string()),
|
|
486
|
-
switch: v7.optional(v7.boolean())
|
|
487
|
-
}),
|
|
488
|
-
v7.object({
|
|
489
|
-
chain: v7.literal("starknet"),
|
|
490
|
-
name: v7.string(),
|
|
491
|
-
type: v7.enum(StarknetNetworkType),
|
|
492
|
-
rpcUrl: v7.string(),
|
|
493
|
-
blockExplorerUrl: v7.optional(v7.string()),
|
|
494
|
-
switch: v7.optional(v7.boolean())
|
|
495
|
-
})
|
|
496
|
-
]);
|
|
497
|
-
var addNetworkRequestMessageSchema = v7.object({
|
|
498
|
-
...rpcRequestMessageSchema.entries,
|
|
499
|
-
...v7.object({
|
|
500
|
-
method: v7.literal(addNetworkMethodName),
|
|
501
|
-
params: addNetworkParamsSchema,
|
|
502
|
-
id: v7.string()
|
|
1032
|
+
id: v17.string()
|
|
503
1033
|
}).entries
|
|
504
1034
|
});
|
|
505
|
-
var addNetworkResultSchema = v7.object({
|
|
506
|
-
id: v7.string()
|
|
507
|
-
});
|
|
508
1035
|
|
|
509
1036
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1037
|
+
import * as v18 from "valibot";
|
|
510
1038
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
511
|
-
var stxGetAccountsParamsSchema =
|
|
512
|
-
var stxGetAccountsResultSchema =
|
|
1039
|
+
var stxGetAccountsParamsSchema = v18.nullish(v18.null());
|
|
1040
|
+
var stxGetAccountsResultSchema = v18.object({
|
|
513
1041
|
/**
|
|
514
1042
|
* The addresses generated for the given purposes.
|
|
515
1043
|
*/
|
|
516
|
-
addresses:
|
|
517
|
-
|
|
518
|
-
address:
|
|
519
|
-
publicKey:
|
|
520
|
-
gaiaHubUrl:
|
|
521
|
-
gaiaAppKey:
|
|
1044
|
+
addresses: v18.array(
|
|
1045
|
+
v18.object({
|
|
1046
|
+
address: v18.string(),
|
|
1047
|
+
publicKey: v18.string(),
|
|
1048
|
+
gaiaHubUrl: v18.string(),
|
|
1049
|
+
gaiaAppKey: v18.string()
|
|
522
1050
|
})
|
|
523
1051
|
),
|
|
524
1052
|
network: getNetworkResultSchema
|
|
525
1053
|
});
|
|
526
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1054
|
+
var stxGetAccountsRequestMessageSchema = v18.object({
|
|
527
1055
|
...rpcRequestMessageSchema.entries,
|
|
528
|
-
...
|
|
529
|
-
method:
|
|
1056
|
+
...v18.object({
|
|
1057
|
+
method: v18.literal(stxGetAccountsMethodName),
|
|
530
1058
|
params: stxGetAccountsParamsSchema,
|
|
531
|
-
id:
|
|
1059
|
+
id: v18.string()
|
|
532
1060
|
}).entries
|
|
533
1061
|
});
|
|
534
1062
|
|
|
535
1063
|
// src/request/types/stxMethods/getAddresses.ts
|
|
536
|
-
import * as
|
|
1064
|
+
import * as v19 from "valibot";
|
|
537
1065
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
538
|
-
var stxGetAddressesParamsSchema =
|
|
539
|
-
|
|
1066
|
+
var stxGetAddressesParamsSchema = v19.nullish(
|
|
1067
|
+
v19.object({
|
|
540
1068
|
/**
|
|
541
1069
|
* A message to be displayed to the user in the request prompt.
|
|
542
1070
|
*/
|
|
543
|
-
message:
|
|
1071
|
+
message: v19.optional(v19.string())
|
|
544
1072
|
})
|
|
545
1073
|
);
|
|
546
|
-
var stxGetAddressesResultSchema =
|
|
1074
|
+
var stxGetAddressesResultSchema = v19.object({
|
|
547
1075
|
/**
|
|
548
1076
|
* The addresses generated for the given purposes.
|
|
549
1077
|
*/
|
|
550
|
-
addresses:
|
|
1078
|
+
addresses: v19.array(addressSchema),
|
|
551
1079
|
network: getNetworkResultSchema
|
|
552
1080
|
});
|
|
553
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1081
|
+
var stxGetAddressesRequestMessageSchema = v19.object({
|
|
554
1082
|
...rpcRequestMessageSchema.entries,
|
|
555
|
-
...
|
|
556
|
-
method:
|
|
1083
|
+
...v19.object({
|
|
1084
|
+
method: v19.literal(stxGetAddressesMethodName),
|
|
557
1085
|
params: stxGetAddressesParamsSchema,
|
|
558
|
-
id:
|
|
1086
|
+
id: v19.string()
|
|
559
1087
|
}).entries
|
|
560
1088
|
});
|
|
561
1089
|
|
|
562
1090
|
// src/request/types/stxMethods/signMessage.ts
|
|
563
|
-
import * as
|
|
1091
|
+
import * as v20 from "valibot";
|
|
564
1092
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
565
|
-
var stxSignMessageParamsSchema =
|
|
1093
|
+
var stxSignMessageParamsSchema = v20.object({
|
|
566
1094
|
/**
|
|
567
1095
|
* The message to sign.
|
|
568
1096
|
*/
|
|
569
|
-
message:
|
|
1097
|
+
message: v20.string()
|
|
570
1098
|
});
|
|
571
|
-
var stxSignMessageResultSchema =
|
|
1099
|
+
var stxSignMessageResultSchema = v20.object({
|
|
572
1100
|
/**
|
|
573
1101
|
* The signature of the message.
|
|
574
1102
|
*/
|
|
575
|
-
signature:
|
|
1103
|
+
signature: v20.string(),
|
|
576
1104
|
/**
|
|
577
1105
|
* The public key used to sign the message.
|
|
578
1106
|
*/
|
|
579
|
-
publicKey:
|
|
1107
|
+
publicKey: v20.string()
|
|
580
1108
|
});
|
|
581
|
-
var stxSignMessageRequestMessageSchema =
|
|
1109
|
+
var stxSignMessageRequestMessageSchema = v20.object({
|
|
582
1110
|
...rpcRequestMessageSchema.entries,
|
|
583
|
-
...
|
|
584
|
-
method:
|
|
1111
|
+
...v20.object({
|
|
1112
|
+
method: v20.literal(stxSignMessageMethodName),
|
|
585
1113
|
params: stxSignMessageParamsSchema,
|
|
586
|
-
id:
|
|
1114
|
+
id: v20.string()
|
|
587
1115
|
}).entries
|
|
588
1116
|
});
|
|
589
1117
|
|
|
590
1118
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
591
|
-
import * as
|
|
1119
|
+
import * as v21 from "valibot";
|
|
592
1120
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
593
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1121
|
+
var stxSignStructuredMessageParamsSchema = v21.object({
|
|
594
1122
|
/**
|
|
595
1123
|
* The domain to be signed.
|
|
596
1124
|
*/
|
|
597
|
-
domain:
|
|
1125
|
+
domain: v21.string(),
|
|
598
1126
|
/**
|
|
599
1127
|
* Message payload to be signed.
|
|
600
1128
|
*/
|
|
601
|
-
message:
|
|
1129
|
+
message: v21.string(),
|
|
602
1130
|
/**
|
|
603
1131
|
* The public key to sign the message with.
|
|
604
1132
|
*/
|
|
605
|
-
publicKey:
|
|
1133
|
+
publicKey: v21.optional(v21.string())
|
|
606
1134
|
});
|
|
607
|
-
var stxSignStructuredMessageResultSchema =
|
|
1135
|
+
var stxSignStructuredMessageResultSchema = v21.object({
|
|
608
1136
|
/**
|
|
609
1137
|
* Signature of the message.
|
|
610
1138
|
*/
|
|
611
|
-
signature:
|
|
1139
|
+
signature: v21.string(),
|
|
612
1140
|
/**
|
|
613
1141
|
* Public key as hex-encoded string.
|
|
614
1142
|
*/
|
|
615
|
-
publicKey:
|
|
1143
|
+
publicKey: v21.string()
|
|
616
1144
|
});
|
|
617
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1145
|
+
var stxSignStructuredMessageRequestMessageSchema = v21.object({
|
|
618
1146
|
...rpcRequestMessageSchema.entries,
|
|
619
|
-
...
|
|
620
|
-
method:
|
|
1147
|
+
...v21.object({
|
|
1148
|
+
method: v21.literal(stxSignStructuredMessageMethodName),
|
|
621
1149
|
params: stxSignStructuredMessageParamsSchema,
|
|
622
|
-
id:
|
|
1150
|
+
id: v21.string()
|
|
623
1151
|
}).entries
|
|
624
1152
|
});
|
|
625
1153
|
|
|
626
1154
|
// src/request/types/stxMethods/signTransaction.ts
|
|
627
|
-
import * as
|
|
1155
|
+
import * as v22 from "valibot";
|
|
628
1156
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
629
|
-
var stxSignTransactionParamsSchema =
|
|
1157
|
+
var stxSignTransactionParamsSchema = v22.object({
|
|
630
1158
|
/**
|
|
631
1159
|
* The transaction to sign as a hex-encoded string.
|
|
632
1160
|
*/
|
|
633
|
-
transaction:
|
|
1161
|
+
transaction: v22.string(),
|
|
634
1162
|
/**
|
|
635
1163
|
* The public key to sign the transaction with. The wallet may use any key
|
|
636
1164
|
* when not provided.
|
|
637
1165
|
*/
|
|
638
|
-
pubkey:
|
|
1166
|
+
pubkey: v22.optional(v22.string()),
|
|
639
1167
|
/**
|
|
640
1168
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
641
1169
|
*/
|
|
642
|
-
broadcast:
|
|
1170
|
+
broadcast: v22.optional(v22.boolean())
|
|
643
1171
|
});
|
|
644
|
-
var stxSignTransactionResultSchema =
|
|
1172
|
+
var stxSignTransactionResultSchema = v22.object({
|
|
645
1173
|
/**
|
|
646
1174
|
* The signed transaction as a hex-encoded string.
|
|
647
1175
|
*/
|
|
648
|
-
transaction:
|
|
1176
|
+
transaction: v22.string()
|
|
649
1177
|
});
|
|
650
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1178
|
+
var stxSignTransactionRequestMessageSchema = v22.object({
|
|
651
1179
|
...rpcRequestMessageSchema.entries,
|
|
652
|
-
...
|
|
653
|
-
method:
|
|
1180
|
+
...v22.object({
|
|
1181
|
+
method: v22.literal(stxSignTransactionMethodName),
|
|
654
1182
|
params: stxSignTransactionParamsSchema,
|
|
655
|
-
id:
|
|
1183
|
+
id: v22.string()
|
|
656
1184
|
}).entries
|
|
657
1185
|
});
|
|
658
1186
|
|
|
659
1187
|
// src/request/types/stxMethods/signTransactions.ts
|
|
660
|
-
import * as
|
|
1188
|
+
import * as v23 from "valibot";
|
|
661
1189
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
662
|
-
var stxSignTransactionsParamsSchema =
|
|
1190
|
+
var stxSignTransactionsParamsSchema = v23.object({
|
|
663
1191
|
/**
|
|
664
1192
|
* The transactions to sign as hex-encoded strings.
|
|
665
1193
|
*/
|
|
666
|
-
transactions:
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
1194
|
+
transactions: v23.pipe(
|
|
1195
|
+
v23.array(
|
|
1196
|
+
v23.pipe(
|
|
1197
|
+
v23.string(),
|
|
1198
|
+
v23.check((hex) => {
|
|
671
1199
|
return true;
|
|
672
1200
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
673
1201
|
)
|
|
674
1202
|
),
|
|
675
|
-
|
|
1203
|
+
v23.minLength(1)
|
|
676
1204
|
),
|
|
677
1205
|
/**
|
|
678
1206
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
679
1207
|
* to `true`.
|
|
680
1208
|
*/
|
|
681
|
-
broadcast:
|
|
1209
|
+
broadcast: v23.optional(v23.boolean())
|
|
682
1210
|
});
|
|
683
|
-
var stxSignTransactionsResultSchema =
|
|
1211
|
+
var stxSignTransactionsResultSchema = v23.object({
|
|
684
1212
|
/**
|
|
685
1213
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
686
1214
|
* sign request.
|
|
687
1215
|
*/
|
|
688
|
-
transactions:
|
|
1216
|
+
transactions: v23.array(v23.string())
|
|
689
1217
|
});
|
|
690
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1218
|
+
var stxSignTransactionsRequestMessageSchema = v23.object({
|
|
691
1219
|
...rpcRequestMessageSchema.entries,
|
|
692
|
-
...
|
|
693
|
-
method:
|
|
1220
|
+
...v23.object({
|
|
1221
|
+
method: v23.literal(stxSignTransactionsMethodName),
|
|
694
1222
|
params: stxSignTransactionsParamsSchema,
|
|
695
|
-
id:
|
|
1223
|
+
id: v23.string()
|
|
696
1224
|
}).entries
|
|
697
1225
|
});
|
|
698
1226
|
|
|
699
1227
|
// src/request/types/stxMethods/transferStx.ts
|
|
700
|
-
import * as
|
|
1228
|
+
import * as v24 from "valibot";
|
|
701
1229
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
702
|
-
var stxTransferStxParamsSchema =
|
|
1230
|
+
var stxTransferStxParamsSchema = v24.object({
|
|
703
1231
|
/**
|
|
704
1232
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
705
1233
|
* parseable by `BigInt` is acceptable.
|
|
@@ -712,23 +1240,23 @@ var stxTransferStxParamsSchema = v14.object({
|
|
|
712
1240
|
* const amount3 = '1234';
|
|
713
1241
|
* ```
|
|
714
1242
|
*/
|
|
715
|
-
amount:
|
|
1243
|
+
amount: v24.union([v24.number(), v24.string()]),
|
|
716
1244
|
/**
|
|
717
|
-
* The
|
|
1245
|
+
* The recipient's principal.
|
|
718
1246
|
*/
|
|
719
|
-
recipient:
|
|
1247
|
+
recipient: v24.string(),
|
|
720
1248
|
/**
|
|
721
1249
|
* A string representing the memo.
|
|
722
1250
|
*/
|
|
723
|
-
memo:
|
|
1251
|
+
memo: v24.optional(v24.string()),
|
|
724
1252
|
/**
|
|
725
1253
|
* Version of parameter format.
|
|
726
1254
|
*/
|
|
727
|
-
version:
|
|
1255
|
+
version: v24.optional(v24.string()),
|
|
728
1256
|
/**
|
|
729
1257
|
* The mode of the post conditions.
|
|
730
1258
|
*/
|
|
731
|
-
postConditionMode:
|
|
1259
|
+
postConditionMode: v24.optional(v24.number()),
|
|
732
1260
|
/**
|
|
733
1261
|
* A hex-encoded string representing the post conditions.
|
|
734
1262
|
*
|
|
@@ -741,425 +1269,29 @@ var stxTransferStxParamsSchema = v14.object({
|
|
|
741
1269
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
742
1270
|
* ```
|
|
743
1271
|
*/
|
|
744
|
-
postConditions:
|
|
1272
|
+
postConditions: v24.optional(v24.array(v24.string())),
|
|
745
1273
|
/**
|
|
746
1274
|
* The public key to sign the transaction with. The wallet may use any key
|
|
747
1275
|
* when not provided.
|
|
748
1276
|
*/
|
|
749
|
-
pubkey:
|
|
1277
|
+
pubkey: v24.optional(v24.string())
|
|
750
1278
|
});
|
|
751
|
-
var stxTransferStxResultSchema =
|
|
1279
|
+
var stxTransferStxResultSchema = v24.object({
|
|
752
1280
|
/**
|
|
753
1281
|
* The ID of the transaction.
|
|
754
1282
|
*/
|
|
755
|
-
txid:
|
|
1283
|
+
txid: v24.string(),
|
|
756
1284
|
/**
|
|
757
1285
|
* A Stacks transaction as a hex-encoded string.
|
|
758
1286
|
*/
|
|
759
|
-
transaction:
|
|
1287
|
+
transaction: v24.string()
|
|
760
1288
|
});
|
|
761
|
-
var stxTransferStxRequestMessageSchema =
|
|
1289
|
+
var stxTransferStxRequestMessageSchema = v24.object({
|
|
762
1290
|
...rpcRequestMessageSchema.entries,
|
|
763
|
-
...
|
|
764
|
-
method:
|
|
1291
|
+
...v24.object({
|
|
1292
|
+
method: v24.literal(stxTransferStxMethodName),
|
|
765
1293
|
params: stxTransferStxParamsSchema,
|
|
766
|
-
id:
|
|
767
|
-
}).entries
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
// src/request/types/btcMethods.ts
|
|
771
|
-
import * as v15 from "valibot";
|
|
772
|
-
var getInfoMethodName = "getInfo";
|
|
773
|
-
var getInfoParamsSchema = v15.nullish(v15.null());
|
|
774
|
-
var getInfoResultSchema = v15.object({
|
|
775
|
-
/**
|
|
776
|
-
* Version of the wallet.
|
|
777
|
-
*/
|
|
778
|
-
version: v15.string(),
|
|
779
|
-
/**
|
|
780
|
-
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
781
|
-
*/
|
|
782
|
-
methods: v15.optional(v15.array(v15.string())),
|
|
783
|
-
/**
|
|
784
|
-
* List of WBIP standards supported by the wallet. Not currently used.
|
|
785
|
-
*/
|
|
786
|
-
supports: v15.array(v15.string())
|
|
787
|
-
});
|
|
788
|
-
var getInfoRequestMessageSchema = v15.object({
|
|
789
|
-
...rpcRequestMessageSchema.entries,
|
|
790
|
-
...v15.object({
|
|
791
|
-
method: v15.literal(getInfoMethodName),
|
|
792
|
-
params: getInfoParamsSchema,
|
|
793
|
-
id: v15.string()
|
|
794
|
-
}).entries
|
|
795
|
-
});
|
|
796
|
-
var getAddressesMethodName = "getAddresses";
|
|
797
|
-
var getAddressesParamsSchema = v15.object({
|
|
798
|
-
/**
|
|
799
|
-
* The purposes for which to generate addresses. See
|
|
800
|
-
* {@linkcode AddressPurpose} for available purposes.
|
|
801
|
-
*/
|
|
802
|
-
purposes: v15.array(v15.enum(AddressPurpose)),
|
|
803
|
-
/**
|
|
804
|
-
* A message to be displayed to the user in the request prompt.
|
|
805
|
-
*/
|
|
806
|
-
message: v15.optional(v15.string())
|
|
807
|
-
});
|
|
808
|
-
var getAddressesResultSchema = v15.object({
|
|
809
|
-
/**
|
|
810
|
-
* The addresses generated for the given purposes.
|
|
811
|
-
*/
|
|
812
|
-
addresses: v15.array(addressSchema),
|
|
813
|
-
network: getNetworkResultSchema
|
|
814
|
-
});
|
|
815
|
-
var getAddressesRequestMessageSchema = v15.object({
|
|
816
|
-
...rpcRequestMessageSchema.entries,
|
|
817
|
-
...v15.object({
|
|
818
|
-
method: v15.literal(getAddressesMethodName),
|
|
819
|
-
params: getAddressesParamsSchema,
|
|
820
|
-
id: v15.string()
|
|
821
|
-
}).entries
|
|
822
|
-
});
|
|
823
|
-
var signMessageMethodName = "signMessage";
|
|
824
|
-
var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
825
|
-
MessageSigningProtocols2["ECDSA"] = "ECDSA";
|
|
826
|
-
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
827
|
-
return MessageSigningProtocols2;
|
|
828
|
-
})(MessageSigningProtocols || {});
|
|
829
|
-
var signMessageParamsSchema = v15.object({
|
|
830
|
-
/**
|
|
831
|
-
* The address used for signing.
|
|
832
|
-
**/
|
|
833
|
-
address: v15.string(),
|
|
834
|
-
/**
|
|
835
|
-
* The message to sign.
|
|
836
|
-
**/
|
|
837
|
-
message: v15.string(),
|
|
838
|
-
/**
|
|
839
|
-
* The protocol to use for signing the message.
|
|
840
|
-
*/
|
|
841
|
-
protocol: v15.optional(v15.enum(MessageSigningProtocols))
|
|
842
|
-
});
|
|
843
|
-
var signMessageResultSchema = v15.object({
|
|
844
|
-
/**
|
|
845
|
-
* The signature of the message.
|
|
846
|
-
*/
|
|
847
|
-
signature: v15.string(),
|
|
848
|
-
/**
|
|
849
|
-
* hash of the message.
|
|
850
|
-
*/
|
|
851
|
-
messageHash: v15.string(),
|
|
852
|
-
/**
|
|
853
|
-
* The address used for signing.
|
|
854
|
-
*/
|
|
855
|
-
address: v15.string(),
|
|
856
|
-
/**
|
|
857
|
-
* The protocol to use for signing the message.
|
|
858
|
-
*/
|
|
859
|
-
protocol: v15.enum(MessageSigningProtocols)
|
|
860
|
-
});
|
|
861
|
-
var signMessageRequestMessageSchema = v15.object({
|
|
862
|
-
...rpcRequestMessageSchema.entries,
|
|
863
|
-
...v15.object({
|
|
864
|
-
method: v15.literal(signMessageMethodName),
|
|
865
|
-
params: signMessageParamsSchema,
|
|
866
|
-
id: v15.string()
|
|
867
|
-
}).entries
|
|
868
|
-
});
|
|
869
|
-
var sendTransferMethodName = "sendTransfer";
|
|
870
|
-
var sendTransferParamsSchema = v15.object({
|
|
871
|
-
/**
|
|
872
|
-
* Array of recipients to send to.
|
|
873
|
-
* The amount to send to each recipient is in satoshis.
|
|
874
|
-
*/
|
|
875
|
-
recipients: v15.array(
|
|
876
|
-
v15.object({
|
|
877
|
-
address: v15.string(),
|
|
878
|
-
amount: v15.number()
|
|
879
|
-
})
|
|
880
|
-
)
|
|
881
|
-
});
|
|
882
|
-
var sendTransferResultSchema = v15.object({
|
|
883
|
-
/**
|
|
884
|
-
* The transaction id as a hex-encoded string.
|
|
885
|
-
*/
|
|
886
|
-
txid: v15.string()
|
|
887
|
-
});
|
|
888
|
-
var sendTransferRequestMessageSchema = v15.object({
|
|
889
|
-
...rpcRequestMessageSchema.entries,
|
|
890
|
-
...v15.object({
|
|
891
|
-
method: v15.literal(sendTransferMethodName),
|
|
892
|
-
params: sendTransferParamsSchema,
|
|
893
|
-
id: v15.string()
|
|
894
|
-
}).entries
|
|
895
|
-
});
|
|
896
|
-
var signPsbtMethodName = "signPsbt";
|
|
897
|
-
var signPsbtParamsSchema = v15.object({
|
|
898
|
-
/**
|
|
899
|
-
* The base64 encoded PSBT to sign.
|
|
900
|
-
*/
|
|
901
|
-
psbt: v15.string(),
|
|
902
|
-
/**
|
|
903
|
-
* The inputs to sign.
|
|
904
|
-
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
905
|
-
*/
|
|
906
|
-
signInputs: v15.optional(v15.record(v15.string(), v15.array(v15.number()))),
|
|
907
|
-
/**
|
|
908
|
-
* Whether to broadcast the transaction after signing.
|
|
909
|
-
**/
|
|
910
|
-
broadcast: v15.optional(v15.boolean())
|
|
911
|
-
});
|
|
912
|
-
var signPsbtResultSchema = v15.object({
|
|
913
|
-
/**
|
|
914
|
-
* The base64 encoded PSBT after signing.
|
|
915
|
-
*/
|
|
916
|
-
psbt: v15.string(),
|
|
917
|
-
/**
|
|
918
|
-
* The transaction id as a hex-encoded string.
|
|
919
|
-
* This is only returned if the transaction was broadcast.
|
|
920
|
-
**/
|
|
921
|
-
txid: v15.optional(v15.string())
|
|
922
|
-
});
|
|
923
|
-
var signPsbtRequestMessageSchema = v15.object({
|
|
924
|
-
...rpcRequestMessageSchema.entries,
|
|
925
|
-
...v15.object({
|
|
926
|
-
method: v15.literal(signPsbtMethodName),
|
|
927
|
-
params: signPsbtParamsSchema,
|
|
928
|
-
id: v15.string()
|
|
929
|
-
}).entries
|
|
930
|
-
});
|
|
931
|
-
var getAccountsMethodName = "getAccounts";
|
|
932
|
-
var getAccountsParamsSchema = v15.object({
|
|
933
|
-
/**
|
|
934
|
-
* The purposes for which to generate addresses. See
|
|
935
|
-
* {@linkcode AddressPurpose} for available purposes.
|
|
936
|
-
*/
|
|
937
|
-
purposes: v15.array(v15.enum(AddressPurpose)),
|
|
938
|
-
/**
|
|
939
|
-
* A message to be displayed to the user in the request prompt.
|
|
940
|
-
*/
|
|
941
|
-
message: v15.optional(v15.string())
|
|
942
|
-
});
|
|
943
|
-
var getAccountsResultSchema = v15.array(
|
|
944
|
-
v15.object({
|
|
945
|
-
...addressSchema.entries,
|
|
946
|
-
...v15.object({
|
|
947
|
-
walletType: walletTypeSchema
|
|
948
|
-
}).entries
|
|
949
|
-
})
|
|
950
|
-
);
|
|
951
|
-
var getAccountsRequestMessageSchema = v15.object({
|
|
952
|
-
...rpcRequestMessageSchema.entries,
|
|
953
|
-
...v15.object({
|
|
954
|
-
method: v15.literal(getAccountsMethodName),
|
|
955
|
-
params: getAccountsParamsSchema,
|
|
956
|
-
id: v15.string()
|
|
957
|
-
}).entries
|
|
958
|
-
});
|
|
959
|
-
var getBalanceMethodName = "getBalance";
|
|
960
|
-
var getBalanceParamsSchema = v15.nullish(v15.null());
|
|
961
|
-
var getBalanceResultSchema = v15.object({
|
|
962
|
-
/**
|
|
963
|
-
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
964
|
-
* messages not supporting bigint
|
|
965
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
966
|
-
*/
|
|
967
|
-
confirmed: v15.string(),
|
|
968
|
-
/**
|
|
969
|
-
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
970
|
-
* messages not supporting bigint
|
|
971
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
972
|
-
*/
|
|
973
|
-
unconfirmed: v15.string(),
|
|
974
|
-
/**
|
|
975
|
-
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
976
|
-
* sats. Using a string due to chrome messages not supporting bigint
|
|
977
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
978
|
-
*/
|
|
979
|
-
total: v15.string()
|
|
980
|
-
});
|
|
981
|
-
var getBalanceRequestMessageSchema = v15.object({
|
|
982
|
-
...rpcRequestMessageSchema.entries,
|
|
983
|
-
...v15.object({
|
|
984
|
-
method: v15.literal(getBalanceMethodName),
|
|
985
|
-
id: v15.string()
|
|
986
|
-
}).entries
|
|
987
|
-
});
|
|
988
|
-
|
|
989
|
-
// src/request/types/runesMethods/etch.ts
|
|
990
|
-
import * as v16 from "valibot";
|
|
991
|
-
var runesEtchMethodName = "runes_etch";
|
|
992
|
-
var etchTermsSchema = v16.object({
|
|
993
|
-
amount: v16.string(),
|
|
994
|
-
cap: v16.string(),
|
|
995
|
-
heightStart: v16.optional(v16.string()),
|
|
996
|
-
heightEnd: v16.optional(v16.string()),
|
|
997
|
-
offsetStart: v16.optional(v16.string()),
|
|
998
|
-
offsetEnd: v16.optional(v16.string())
|
|
999
|
-
});
|
|
1000
|
-
var inscriptionDetailsSchema = v16.object({
|
|
1001
|
-
contentType: v16.string(),
|
|
1002
|
-
contentBase64: v16.string()
|
|
1003
|
-
});
|
|
1004
|
-
var runesEtchParamsSchema = v16.object({
|
|
1005
|
-
runeName: v16.string(),
|
|
1006
|
-
divisibility: v16.optional(v16.number()),
|
|
1007
|
-
symbol: v16.optional(v16.string()),
|
|
1008
|
-
premine: v16.optional(v16.string()),
|
|
1009
|
-
isMintable: v16.boolean(),
|
|
1010
|
-
delegateInscriptionId: v16.optional(v16.string()),
|
|
1011
|
-
destinationAddress: v16.string(),
|
|
1012
|
-
refundAddress: v16.string(),
|
|
1013
|
-
feeRate: v16.number(),
|
|
1014
|
-
appServiceFee: v16.optional(v16.number()),
|
|
1015
|
-
appServiceFeeAddress: v16.optional(v16.string()),
|
|
1016
|
-
terms: v16.optional(etchTermsSchema),
|
|
1017
|
-
inscriptionDetails: v16.optional(inscriptionDetailsSchema),
|
|
1018
|
-
network: v16.optional(v16.enum(BitcoinNetworkType))
|
|
1019
|
-
});
|
|
1020
|
-
var runesEtchResultSchema = v16.object({
|
|
1021
|
-
orderId: v16.string(),
|
|
1022
|
-
fundTransactionId: v16.string(),
|
|
1023
|
-
fundingAddress: v16.string()
|
|
1024
|
-
});
|
|
1025
|
-
var runesEtchRequestMessageSchema = v16.object({
|
|
1026
|
-
...rpcRequestMessageSchema.entries,
|
|
1027
|
-
...v16.object({
|
|
1028
|
-
method: v16.literal(runesEtchMethodName),
|
|
1029
|
-
params: runesEtchParamsSchema,
|
|
1030
|
-
id: v16.string()
|
|
1031
|
-
}).entries
|
|
1032
|
-
});
|
|
1033
|
-
|
|
1034
|
-
// src/request/types/runesMethods/getBalance.ts
|
|
1035
|
-
import * as v17 from "valibot";
|
|
1036
|
-
var runesGetBalanceMethodName = "runes_getBalance";
|
|
1037
|
-
var runesGetBalanceParamsSchema = v17.nullish(v17.null());
|
|
1038
|
-
var runesGetBalanceResultSchema = v17.object({
|
|
1039
|
-
balances: v17.array(
|
|
1040
|
-
v17.object({
|
|
1041
|
-
runeName: v17.string(),
|
|
1042
|
-
amount: v17.string(),
|
|
1043
|
-
divisibility: v17.number(),
|
|
1044
|
-
symbol: v17.string(),
|
|
1045
|
-
inscriptionId: v17.nullish(v17.string()),
|
|
1046
|
-
spendableBalance: v17.string()
|
|
1047
|
-
})
|
|
1048
|
-
)
|
|
1049
|
-
});
|
|
1050
|
-
var runesGetBalanceRequestMessageSchema = v17.object({
|
|
1051
|
-
...rpcRequestMessageSchema.entries,
|
|
1052
|
-
...v17.object({
|
|
1053
|
-
method: v17.literal(runesGetBalanceMethodName),
|
|
1054
|
-
params: runesGetBalanceParamsSchema,
|
|
1055
|
-
id: v17.string()
|
|
1056
|
-
}).entries
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
// src/request/types/runesMethods/mint.ts
|
|
1060
|
-
import * as v18 from "valibot";
|
|
1061
|
-
var runesMintMethodName = "runes_mint";
|
|
1062
|
-
var runesMintParamsSchema = v18.object({
|
|
1063
|
-
appServiceFee: v18.optional(v18.number()),
|
|
1064
|
-
appServiceFeeAddress: v18.optional(v18.string()),
|
|
1065
|
-
destinationAddress: v18.string(),
|
|
1066
|
-
feeRate: v18.number(),
|
|
1067
|
-
refundAddress: v18.string(),
|
|
1068
|
-
repeats: v18.number(),
|
|
1069
|
-
runeName: v18.string(),
|
|
1070
|
-
network: v18.optional(v18.enum(BitcoinNetworkType))
|
|
1071
|
-
});
|
|
1072
|
-
var runesMintResultSchema = v18.object({
|
|
1073
|
-
orderId: v18.string(),
|
|
1074
|
-
fundTransactionId: v18.string(),
|
|
1075
|
-
fundingAddress: v18.string()
|
|
1076
|
-
});
|
|
1077
|
-
var runesMintRequestMessageSchema = v18.object({
|
|
1078
|
-
...rpcRequestMessageSchema.entries,
|
|
1079
|
-
...v18.object({
|
|
1080
|
-
method: v18.literal(runesMintMethodName),
|
|
1081
|
-
params: runesMintParamsSchema,
|
|
1082
|
-
id: v18.string()
|
|
1083
|
-
}).entries
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
// src/request/types/runesMethods/transfer.ts
|
|
1087
|
-
import * as v19 from "valibot";
|
|
1088
|
-
var runesTransferMethodName = "runes_transfer";
|
|
1089
|
-
var runesTransferParamsSchema = v19.object({
|
|
1090
|
-
recipients: v19.array(
|
|
1091
|
-
v19.object({
|
|
1092
|
-
runeName: v19.string(),
|
|
1093
|
-
amount: v19.string(),
|
|
1094
|
-
address: v19.string()
|
|
1095
|
-
})
|
|
1096
|
-
)
|
|
1097
|
-
});
|
|
1098
|
-
var runesTransferResultSchema = v19.object({
|
|
1099
|
-
txid: v19.string()
|
|
1100
|
-
});
|
|
1101
|
-
var runesTransferRequestMessageSchema = v19.object({
|
|
1102
|
-
...rpcRequestMessageSchema.entries,
|
|
1103
|
-
...v19.object({
|
|
1104
|
-
method: v19.literal(runesTransferMethodName),
|
|
1105
|
-
params: runesTransferParamsSchema,
|
|
1106
|
-
id: v19.string()
|
|
1107
|
-
}).entries
|
|
1108
|
-
});
|
|
1109
|
-
|
|
1110
|
-
// src/request/types/ordinalsMethods.ts
|
|
1111
|
-
import * as v20 from "valibot";
|
|
1112
|
-
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
1113
|
-
var getInscriptionsParamsSchema = v20.object({
|
|
1114
|
-
offset: v20.number(),
|
|
1115
|
-
limit: v20.number()
|
|
1116
|
-
});
|
|
1117
|
-
var getInscriptionsResultSchema = v20.object({
|
|
1118
|
-
total: v20.number(),
|
|
1119
|
-
limit: v20.number(),
|
|
1120
|
-
offset: v20.number(),
|
|
1121
|
-
inscriptions: v20.array(
|
|
1122
|
-
v20.object({
|
|
1123
|
-
inscriptionId: v20.string(),
|
|
1124
|
-
inscriptionNumber: v20.string(),
|
|
1125
|
-
address: v20.string(),
|
|
1126
|
-
collectionName: v20.optional(v20.string()),
|
|
1127
|
-
postage: v20.string(),
|
|
1128
|
-
contentLength: v20.string(),
|
|
1129
|
-
contentType: v20.string(),
|
|
1130
|
-
timestamp: v20.number(),
|
|
1131
|
-
offset: v20.number(),
|
|
1132
|
-
genesisTransaction: v20.string(),
|
|
1133
|
-
output: v20.string()
|
|
1134
|
-
})
|
|
1135
|
-
)
|
|
1136
|
-
});
|
|
1137
|
-
var getInscriptionsRequestMessageSchema = v20.object({
|
|
1138
|
-
...rpcRequestMessageSchema.entries,
|
|
1139
|
-
...v20.object({
|
|
1140
|
-
method: v20.literal(getInscriptionsMethodName),
|
|
1141
|
-
params: getInscriptionsParamsSchema,
|
|
1142
|
-
id: v20.string()
|
|
1143
|
-
}).entries
|
|
1144
|
-
});
|
|
1145
|
-
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
1146
|
-
var sendInscriptionsParamsSchema = v20.object({
|
|
1147
|
-
transfers: v20.array(
|
|
1148
|
-
v20.object({
|
|
1149
|
-
address: v20.string(),
|
|
1150
|
-
inscriptionId: v20.string()
|
|
1151
|
-
})
|
|
1152
|
-
)
|
|
1153
|
-
});
|
|
1154
|
-
var sendInscriptionsResultSchema = v20.object({
|
|
1155
|
-
txid: v20.string()
|
|
1156
|
-
});
|
|
1157
|
-
var sendInscriptionsRequestMessageSchema = v20.object({
|
|
1158
|
-
...rpcRequestMessageSchema.entries,
|
|
1159
|
-
...v20.object({
|
|
1160
|
-
method: v20.literal(sendInscriptionsMethodName),
|
|
1161
|
-
params: sendInscriptionsParamsSchema,
|
|
1162
|
-
id: v20.string()
|
|
1294
|
+
id: v24.string()
|
|
1163
1295
|
}).entries
|
|
1164
1296
|
});
|
|
1165
1297
|
|
|
@@ -1176,13 +1308,13 @@ var request = async (method, params, providerId) => {
|
|
|
1176
1308
|
throw new Error("A wallet method is required");
|
|
1177
1309
|
}
|
|
1178
1310
|
const response = await provider.request(method, params);
|
|
1179
|
-
if (
|
|
1311
|
+
if (v25.is(rpcErrorResponseMessageSchema, response)) {
|
|
1180
1312
|
return {
|
|
1181
1313
|
status: "error",
|
|
1182
1314
|
error: response.error
|
|
1183
1315
|
};
|
|
1184
1316
|
}
|
|
1185
|
-
if (
|
|
1317
|
+
if (v25.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1186
1318
|
return {
|
|
1187
1319
|
status: "success",
|
|
1188
1320
|
result: response.result
|
|
@@ -1197,7 +1329,37 @@ var request = async (method, params, providerId) => {
|
|
|
1197
1329
|
}
|
|
1198
1330
|
};
|
|
1199
1331
|
};
|
|
1200
|
-
var addListener = (
|
|
1332
|
+
var addListener = (...rawArgs) => {
|
|
1333
|
+
const [listenerInfo, providerId] = (() => {
|
|
1334
|
+
if (rawArgs.length === 1) {
|
|
1335
|
+
return [rawArgs[0], void 0];
|
|
1336
|
+
}
|
|
1337
|
+
if (rawArgs.length === 2) {
|
|
1338
|
+
if (typeof rawArgs[1] === "function") {
|
|
1339
|
+
return [
|
|
1340
|
+
{
|
|
1341
|
+
eventName: rawArgs[0],
|
|
1342
|
+
cb: rawArgs[1]
|
|
1343
|
+
},
|
|
1344
|
+
void 0
|
|
1345
|
+
];
|
|
1346
|
+
} else {
|
|
1347
|
+
return rawArgs;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
if (rawArgs.length === 3) {
|
|
1351
|
+
return [
|
|
1352
|
+
{
|
|
1353
|
+
eventName: rawArgs[0],
|
|
1354
|
+
cb: rawArgs[1]
|
|
1355
|
+
},
|
|
1356
|
+
rawArgs[2]
|
|
1357
|
+
];
|
|
1358
|
+
}
|
|
1359
|
+
throw new Error("Unexpected number of arguments. Expecting 2 (or 3 for legacy requests).", {
|
|
1360
|
+
cause: rawArgs
|
|
1361
|
+
});
|
|
1362
|
+
})();
|
|
1201
1363
|
let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
|
|
1202
1364
|
if (providerId) {
|
|
1203
1365
|
provider = getProviderById(providerId);
|
|
@@ -1715,7 +1877,7 @@ var UnisatAdapter = class extends SatsConnectAdapter {
|
|
|
1715
1877
|
id = DefaultAdaptersInfo.unisat.id;
|
|
1716
1878
|
async getAccounts(params) {
|
|
1717
1879
|
const { purposes } = params;
|
|
1718
|
-
if (purposes.includes("stacks" /* Stacks */)) {
|
|
1880
|
+
if (purposes.includes("stacks" /* Stacks */) || purposes.includes("starknet" /* Starknet */) || purposes.includes("spark" /* Spark */)) {
|
|
1719
1881
|
throw new Error("Only bitcoin addresses are supported");
|
|
1720
1882
|
}
|
|
1721
1883
|
const accounts = await window.unisat.requestAccounts();
|
|
@@ -2174,6 +2336,7 @@ export {
|
|
|
2174
2336
|
RpcErrorCode,
|
|
2175
2337
|
RpcIdSchema,
|
|
2176
2338
|
SatsConnectAdapter,
|
|
2339
|
+
SparkNetworkType,
|
|
2177
2340
|
StacksNetworkType,
|
|
2178
2341
|
StarknetNetworkType,
|
|
2179
2342
|
accountActionsSchema,
|
|
@@ -2305,6 +2468,22 @@ export {
|
|
|
2305
2468
|
signPsbtRequestMessageSchema,
|
|
2306
2469
|
signPsbtResultSchema,
|
|
2307
2470
|
signTransaction,
|
|
2471
|
+
sparkGetAddressesMethodName,
|
|
2472
|
+
sparkGetAddressesParamsSchema,
|
|
2473
|
+
sparkGetAddressesRequestMessageSchema,
|
|
2474
|
+
sparkGetAddressesResultSchema,
|
|
2475
|
+
sparkGetBalanceMethodName,
|
|
2476
|
+
sparkGetBalanceParamsSchema,
|
|
2477
|
+
sparkGetBalanceRequestMessageSchema,
|
|
2478
|
+
sparkGetBalanceResultSchema,
|
|
2479
|
+
sparkTransferMethodName,
|
|
2480
|
+
sparkTransferParamsSchema,
|
|
2481
|
+
sparkTransferRequestMessageSchema,
|
|
2482
|
+
sparkTransferResultSchema,
|
|
2483
|
+
sparkTransferTokenMethodName,
|
|
2484
|
+
sparkTransferTokenParamsSchema,
|
|
2485
|
+
sparkTransferTokenRequestMessageSchema,
|
|
2486
|
+
sparkTransferTokenResultSchema,
|
|
2308
2487
|
stxCallContractMethodName,
|
|
2309
2488
|
stxCallContractParamsSchema,
|
|
2310
2489
|
stxCallContractRequestMessageSchema,
|