@sats-connect/core 0.5.7-8d89b71 → 0.5.7-a6b13fd

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.mjs CHANGED
@@ -208,30 +208,15 @@ var stxDeployContractRequestMessageSchema = v4.object({
208
208
  });
209
209
 
210
210
  // src/request/types/stxMethods/getAccounts.ts
211
+ import * as v8 from "valibot";
212
+
213
+ // src/request/types/walletMethods.ts
214
+ import * as v7 from "valibot";
215
+
216
+ // src/request/types/common.ts
211
217
  import * as v5 from "valibot";
212
- var stxGetAccountsMethodName = "stx_getAccounts";
213
- var stxGetAccountsParamsSchema = v5.nullish(v5.null());
214
- var stxGetAccountsResultSchema = v5.object({
215
- /**
216
- * The addresses generated for the given purposes.
217
- */
218
- addresses: v5.array(
219
- v5.object({
220
- address: v5.string(),
221
- publicKey: v5.string(),
222
- gaiaHubUrl: v5.string(),
223
- gaiaAppKey: v5.string()
224
- })
225
- )
226
- });
227
- var stxGetAccountsRequestMessageSchema = v5.object({
228
- ...rpcRequestMessageSchema.entries,
229
- ...v5.object({
230
- method: v5.literal(stxGetAccountsMethodName),
231
- params: stxGetAccountsParamsSchema,
232
- id: v5.string()
233
- }).entries
234
- });
218
+ var walletTypes = ["software", "ledger", "keystone"];
219
+ var walletTypeSchema = v5.picklist(walletTypes);
235
220
 
236
221
  // src/addresses/index.ts
237
222
  import { createUnsecuredToken } from "jsontokens";
@@ -278,185 +263,354 @@ var getAddress = async (options) => {
278
263
  }
279
264
  };
280
265
 
266
+ // src/request/types/walletMethods.ts
267
+ var accountActionsSchema = v7.object({
268
+ read: v7.optional(v7.boolean())
269
+ });
270
+ var walletActionsSchema = v7.object({
271
+ readNetwork: v7.optional(v7.boolean())
272
+ });
273
+ var accountPermissionSchema = v7.object({
274
+ type: v7.literal("account"),
275
+ resourceId: v7.string(),
276
+ clientId: v7.string(),
277
+ actions: accountActionsSchema
278
+ });
279
+ var walletPermissionSchema = v7.object({
280
+ type: v7.literal("wallet"),
281
+ resourceId: v7.string(),
282
+ clientId: v7.string(),
283
+ actions: walletActionsSchema
284
+ });
285
+ var PermissionRequestParams = v7.variant("type", [
286
+ v7.object({
287
+ ...v7.omit(accountPermissionSchema, ["clientId"]).entries
288
+ }),
289
+ v7.object({
290
+ ...v7.omit(walletPermissionSchema, ["clientId"]).entries
291
+ })
292
+ ]);
293
+ var permission = v7.variant("type", [accountPermissionSchema, walletPermissionSchema]);
294
+ var requestPermissionsMethodName = "wallet_requestPermissions";
295
+ var requestPermissionsParamsSchema = v7.nullish(v7.array(PermissionRequestParams));
296
+ var requestPermissionsResultSchema = v7.literal(true);
297
+ var requestPermissionsRequestMessageSchema = v7.object({
298
+ ...rpcRequestMessageSchema.entries,
299
+ ...v7.object({
300
+ method: v7.literal(requestPermissionsMethodName),
301
+ params: requestPermissionsParamsSchema,
302
+ id: v7.string()
303
+ }).entries
304
+ });
305
+ var renouncePermissionsMethodName = "wallet_renouncePermissions";
306
+ var renouncePermissionsParamsSchema = v7.nullish(v7.null());
307
+ var renouncePermissionsResultSchema = v7.nullish(v7.null());
308
+ var renouncePermissionsRequestMessageSchema = v7.object({
309
+ ...rpcRequestMessageSchema.entries,
310
+ ...v7.object({
311
+ method: v7.literal(renouncePermissionsMethodName),
312
+ params: renouncePermissionsParamsSchema,
313
+ id: v7.string()
314
+ }).entries
315
+ });
316
+ var disconnectMethodName = "wallet_disconnect";
317
+ var disconnectParamsSchema = v7.nullish(v7.null());
318
+ var disconnectResultSchema = v7.nullish(v7.null());
319
+ var disconnectRequestMessageSchema = v7.object({
320
+ ...rpcRequestMessageSchema.entries,
321
+ ...v7.object({
322
+ method: v7.literal(disconnectMethodName),
323
+ params: disconnectParamsSchema,
324
+ id: v7.string()
325
+ }).entries
326
+ });
327
+ var getWalletTypeMethodName = "wallet_getWalletType";
328
+ var getWalletTypeParamsSchema = v7.nullish(v7.null());
329
+ var getWalletTypeResultSchema = walletTypeSchema;
330
+ var getWalletTypeRequestMessageSchema = v7.object({
331
+ ...rpcRequestMessageSchema.entries,
332
+ ...v7.object({
333
+ method: v7.literal(getWalletTypeMethodName),
334
+ params: getWalletTypeParamsSchema,
335
+ id: v7.string()
336
+ }).entries
337
+ });
338
+ var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
339
+ var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
340
+ var getCurrentPermissionsResultSchema = v7.array(permission);
341
+ var getCurrentPermissionsRequestMessageSchema = v7.object({
342
+ ...rpcRequestMessageSchema.entries,
343
+ ...v7.object({
344
+ method: v7.literal(getCurrentPermissionsMethodName),
345
+ params: getCurrentPermissionsParamsSchema,
346
+ id: v7.string()
347
+ }).entries
348
+ });
349
+ var getNetworkMethodName = "wallet_getNetwork";
350
+ var getNetworkParamsSchema = v7.nullish(v7.null());
351
+ var getNetworkResultSchema = v7.object({
352
+ bitcoin: v7.object({
353
+ name: v7.enum(BitcoinNetworkType)
354
+ }),
355
+ stacks: v7.object({
356
+ name: v7.string()
357
+ })
358
+ });
359
+ var getNetworkRequestMessageSchema = v7.object({
360
+ ...rpcRequestMessageSchema.entries,
361
+ ...v7.object({
362
+ method: v7.literal(getNetworkMethodName),
363
+ params: getNetworkParamsSchema,
364
+ id: v7.string()
365
+ }).entries
366
+ });
367
+ var getAccountMethodName = "wallet_getAccount";
368
+ var getAccountParamsSchema = v7.nullish(v7.null());
369
+ var getAccountResultSchema = v7.object({
370
+ id: v7.string(),
371
+ addresses: v7.array(addressSchema),
372
+ walletType: walletTypeSchema,
373
+ network: getNetworkResultSchema
374
+ });
375
+ var getAccountRequestMessageSchema = v7.object({
376
+ ...rpcRequestMessageSchema.entries,
377
+ ...v7.object({
378
+ method: v7.literal(getAccountMethodName),
379
+ params: getAccountParamsSchema,
380
+ id: v7.string()
381
+ }).entries
382
+ });
383
+ var connectMethodName = "wallet_connect";
384
+ var connectParamsSchema = v7.nullish(
385
+ v7.object({
386
+ permissions: v7.optional(v7.array(PermissionRequestParams)),
387
+ addresses: v7.optional(v7.array(v7.enum(AddressPurpose))),
388
+ message: v7.optional(
389
+ v7.pipe(v7.string(), v7.maxLength(80, "The message must not exceed 80 characters."))
390
+ )
391
+ })
392
+ );
393
+ var connectResultSchema = v7.object({
394
+ id: v7.string(),
395
+ addresses: v7.array(addressSchema),
396
+ walletType: walletTypeSchema,
397
+ network: getNetworkResultSchema
398
+ });
399
+ var connectRequestMessageSchema = v7.object({
400
+ ...rpcRequestMessageSchema.entries,
401
+ ...v7.object({
402
+ method: v7.literal(connectMethodName),
403
+ params: connectParamsSchema,
404
+ id: v7.string()
405
+ }).entries
406
+ });
407
+
408
+ // src/request/types/stxMethods/getAccounts.ts
409
+ var stxGetAccountsMethodName = "stx_getAccounts";
410
+ var stxGetAccountsParamsSchema = v8.nullish(v8.null());
411
+ var stxGetAccountsResultSchema = v8.object({
412
+ /**
413
+ * The addresses generated for the given purposes.
414
+ */
415
+ addresses: v8.array(
416
+ v8.object({
417
+ address: v8.string(),
418
+ publicKey: v8.string(),
419
+ gaiaHubUrl: v8.string(),
420
+ gaiaAppKey: v8.string()
421
+ })
422
+ ),
423
+ network: getNetworkResultSchema
424
+ });
425
+ var stxGetAccountsRequestMessageSchema = v8.object({
426
+ ...rpcRequestMessageSchema.entries,
427
+ ...v8.object({
428
+ method: v8.literal(stxGetAccountsMethodName),
429
+ params: stxGetAccountsParamsSchema,
430
+ id: v8.string()
431
+ }).entries
432
+ });
433
+
281
434
  // src/request/types/stxMethods/getAddresses.ts
282
- import * as v7 from "valibot";
435
+ import * as v9 from "valibot";
283
436
  var stxGetAddressesMethodName = "stx_getAddresses";
284
- var stxGetAddressesParamsSchema = v7.nullish(
285
- v7.object({
437
+ var stxGetAddressesParamsSchema = v9.nullish(
438
+ v9.object({
286
439
  /**
287
440
  * A message to be displayed to the user in the request prompt.
288
441
  */
289
- message: v7.optional(v7.string())
442
+ message: v9.optional(v9.string())
290
443
  })
291
444
  );
292
- var stxGetAddressesResultSchema = v7.object({
445
+ var stxGetAddressesResultSchema = v9.object({
293
446
  /**
294
447
  * The addresses generated for the given purposes.
295
448
  */
296
- addresses: v7.array(addressSchema)
449
+ addresses: v9.array(addressSchema),
450
+ network: getNetworkResultSchema
297
451
  });
298
- var stxGetAddressesRequestMessageSchema = v7.object({
452
+ var stxGetAddressesRequestMessageSchema = v9.object({
299
453
  ...rpcRequestMessageSchema.entries,
300
- ...v7.object({
301
- method: v7.literal(stxGetAddressesMethodName),
454
+ ...v9.object({
455
+ method: v9.literal(stxGetAddressesMethodName),
302
456
  params: stxGetAddressesParamsSchema,
303
- id: v7.string()
457
+ id: v9.string()
304
458
  }).entries
305
459
  });
306
460
 
307
461
  // src/request/types/stxMethods/signMessage.ts
308
- import * as v8 from "valibot";
462
+ import * as v10 from "valibot";
309
463
  var stxSignMessageMethodName = "stx_signMessage";
310
- var stxSignMessageParamsSchema = v8.object({
464
+ var stxSignMessageParamsSchema = v10.object({
311
465
  /**
312
466
  * The message to sign.
313
467
  */
314
- message: v8.string(),
468
+ message: v10.string(),
315
469
  /**
316
470
  * The public key to sign the message with.
317
471
  */
318
- publicKey: v8.string(),
472
+ publicKey: v10.string(),
319
473
  /**
320
474
  * The format version of the parameter.
321
475
  */
322
- parameterFormatVersion: v8.optional(v8.number())
476
+ parameterFormatVersion: v10.optional(v10.number())
323
477
  });
324
- var stxSignMessageResultSchema = v8.object({
478
+ var stxSignMessageResultSchema = v10.object({
325
479
  /**
326
480
  * The signature of the message.
327
481
  */
328
- signature: v8.string(),
482
+ signature: v10.string(),
329
483
  /**
330
484
  * The public key used to sign the message.
331
485
  */
332
- publicKey: v8.string()
486
+ publicKey: v10.string()
333
487
  });
334
- var stxSignMessageRequestMessageSchema = v8.object({
488
+ var stxSignMessageRequestMessageSchema = v10.object({
335
489
  ...rpcRequestMessageSchema.entries,
336
- ...v8.object({
337
- method: v8.literal(stxSignMessageMethodName),
490
+ ...v10.object({
491
+ method: v10.literal(stxSignMessageMethodName),
338
492
  params: stxSignMessageParamsSchema,
339
- id: v8.string()
493
+ id: v10.string()
340
494
  }).entries
341
495
  });
342
496
 
343
497
  // src/request/types/stxMethods/signStructuredMessage.ts
344
- import * as v9 from "valibot";
498
+ import * as v11 from "valibot";
345
499
  var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
346
- var stxSignStructuredMessageParamsSchema = v9.object({
500
+ var stxSignStructuredMessageParamsSchema = v11.object({
347
501
  /**
348
502
  * The domain to be signed.
349
503
  */
350
- domain: v9.string(),
504
+ domain: v11.string(),
351
505
  /**
352
506
  * Message payload to be signed.
353
507
  */
354
- message: v9.string(),
508
+ message: v11.string(),
355
509
  /**
356
510
  * The format version of the parameter.
357
511
  */
358
- parameterFormatVersion: v9.optional(v9.number()),
512
+ parameterFormatVersion: v11.optional(v11.number()),
359
513
  /**
360
514
  * The public key to sign the message with.
361
515
  */
362
- publicKey: v9.optional(v9.string())
516
+ publicKey: v11.optional(v11.string())
363
517
  });
364
- var stxSignStructuredMessageResultSchema = v9.object({
518
+ var stxSignStructuredMessageResultSchema = v11.object({
365
519
  /**
366
520
  * Signature of the message.
367
521
  */
368
- signature: v9.string(),
522
+ signature: v11.string(),
369
523
  /**
370
524
  * Public key as hex-encoded string.
371
525
  */
372
- publicKey: v9.string()
526
+ publicKey: v11.string()
373
527
  });
374
- var stxSignStructuredMessageRequestMessageSchema = v9.object({
528
+ var stxSignStructuredMessageRequestMessageSchema = v11.object({
375
529
  ...rpcRequestMessageSchema.entries,
376
- ...v9.object({
377
- method: v9.literal(stxSignStructuredMessageMethodName),
530
+ ...v11.object({
531
+ method: v11.literal(stxSignStructuredMessageMethodName),
378
532
  params: stxSignStructuredMessageParamsSchema,
379
- id: v9.string()
533
+ id: v11.string()
380
534
  }).entries
381
535
  });
382
536
 
383
537
  // src/request/types/stxMethods/signTransaction.ts
384
- import * as v10 from "valibot";
538
+ import * as v12 from "valibot";
385
539
  var stxSignTransactionMethodName = "stx_signTransaction";
386
- var stxSignTransactionParamsSchema = v10.object({
540
+ var stxSignTransactionParamsSchema = v12.object({
387
541
  /**
388
542
  * The transaction to sign as a hex-encoded string.
389
543
  */
390
- transaction: v10.string(),
544
+ transaction: v12.string(),
391
545
  /**
392
546
  * The public key to sign the transaction with. The wallet may use any key
393
547
  * when not provided.
394
548
  */
395
- pubkey: v10.optional(v10.string()),
549
+ pubkey: v12.optional(v12.string()),
396
550
  /**
397
551
  * Whether to broadcast the transaction after signing. Defaults to `true`.
398
552
  */
399
- broadcast: v10.optional(v10.boolean())
553
+ broadcast: v12.optional(v12.boolean())
400
554
  });
401
- var stxSignTransactionResultSchema = v10.object({
555
+ var stxSignTransactionResultSchema = v12.object({
402
556
  /**
403
557
  * The signed transaction as a hex-encoded string.
404
558
  */
405
- transaction: v10.string()
559
+ transaction: v12.string()
406
560
  });
407
- var stxSignTransactionRequestMessageSchema = v10.object({
561
+ var stxSignTransactionRequestMessageSchema = v12.object({
408
562
  ...rpcRequestMessageSchema.entries,
409
- ...v10.object({
410
- method: v10.literal(stxSignTransactionMethodName),
563
+ ...v12.object({
564
+ method: v12.literal(stxSignTransactionMethodName),
411
565
  params: stxSignTransactionParamsSchema,
412
- id: v10.string()
566
+ id: v12.string()
413
567
  }).entries
414
568
  });
415
569
 
416
570
  // src/request/types/stxMethods/signTransactions.ts
417
- import * as v11 from "valibot";
571
+ import * as v13 from "valibot";
418
572
  var stxSignTransactionsMethodName = "stx_signTransactions";
419
- var stxSignTransactionsParamsSchema = v11.object({
573
+ var stxSignTransactionsParamsSchema = v13.object({
420
574
  /**
421
575
  * The transactions to sign as hex-encoded strings.
422
576
  */
423
- transactions: v11.pipe(
424
- v11.array(
425
- v11.pipe(
426
- v11.string(),
427
- v11.check((hex) => {
577
+ transactions: v13.pipe(
578
+ v13.array(
579
+ v13.pipe(
580
+ v13.string(),
581
+ v13.check((hex) => {
428
582
  return true;
429
583
  }, "Invalid hex-encoded Stacks transaction.")
430
584
  )
431
585
  ),
432
- v11.minLength(1)
586
+ v13.minLength(1)
433
587
  ),
434
588
  /**
435
589
  * Whether the signed transactions should be broadcast after signing. Defaults
436
590
  * to `true`.
437
591
  */
438
- broadcast: v11.optional(v11.boolean())
592
+ broadcast: v13.optional(v13.boolean())
439
593
  });
440
- var stxSignTransactionsResultSchema = v11.object({
594
+ var stxSignTransactionsResultSchema = v13.object({
441
595
  /**
442
596
  * The signed transactions as hex-encoded strings, in the same order as in the
443
597
  * sign request.
444
598
  */
445
- transactions: v11.array(v11.string())
599
+ transactions: v13.array(v13.string())
446
600
  });
447
- var stxSignTransactionsRequestMessageSchema = v11.object({
601
+ var stxSignTransactionsRequestMessageSchema = v13.object({
448
602
  ...rpcRequestMessageSchema.entries,
449
- ...v11.object({
450
- method: v11.literal(stxSignTransactionsMethodName),
603
+ ...v13.object({
604
+ method: v13.literal(stxSignTransactionsMethodName),
451
605
  params: stxSignTransactionsParamsSchema,
452
- id: v11.string()
606
+ id: v13.string()
453
607
  }).entries
454
608
  });
455
609
 
456
610
  // src/request/types/stxMethods/transferStx.ts
457
- import * as v12 from "valibot";
611
+ import * as v14 from "valibot";
458
612
  var stxTransferStxMethodName = "stx_transferStx";
459
- var stxTransferStxParamsSchema = v12.object({
613
+ var stxTransferStxParamsSchema = v14.object({
460
614
  /**
461
615
  * Amount of STX tokens to transfer in microstacks as a string. Anything
462
616
  * parseable by `BigInt` is acceptable.
@@ -469,23 +623,23 @@ var stxTransferStxParamsSchema = v12.object({
469
623
  * const amount3 = '1234';
470
624
  * ```
471
625
  */
472
- amount: v12.union([v12.number(), v12.string()]),
626
+ amount: v14.union([v14.number(), v14.string()]),
473
627
  /**
474
628
  * The recipeint's principal.
475
629
  */
476
- recipient: v12.string(),
630
+ recipient: v14.string(),
477
631
  /**
478
632
  * A string representing the memo.
479
633
  */
480
- memo: v12.optional(v12.string()),
634
+ memo: v14.optional(v14.string()),
481
635
  /**
482
636
  * Version of parameter format.
483
637
  */
484
- version: v12.optional(v12.string()),
638
+ version: v14.optional(v14.string()),
485
639
  /**
486
640
  * The mode of the post conditions.
487
641
  */
488
- postConditionMode: v12.optional(v12.number()),
642
+ postConditionMode: v14.optional(v14.number()),
489
643
  /**
490
644
  * A hex-encoded string representing the post conditions.
491
645
  *
@@ -498,89 +652,83 @@ var stxTransferStxParamsSchema = v12.object({
498
652
  * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
499
653
  * ```
500
654
  */
501
- postConditions: v12.optional(v12.array(v12.string())),
655
+ postConditions: v14.optional(v14.array(v14.string())),
502
656
  /**
503
657
  * The public key to sign the transaction with. The wallet may use any key
504
658
  * when not provided.
505
659
  */
506
- pubkey: v12.optional(v12.string())
660
+ pubkey: v14.optional(v14.string())
507
661
  });
508
- var stxTransferStxResultSchema = v12.object({
662
+ var stxTransferStxResultSchema = v14.object({
509
663
  /**
510
664
  * The ID of the transaction.
511
665
  */
512
- txid: v12.string(),
666
+ txid: v14.string(),
513
667
  /**
514
668
  * A Stacks transaction as a hex-encoded string.
515
669
  */
516
- transaction: v12.string()
670
+ transaction: v14.string()
517
671
  });
518
- var stxTransferStxRequestMessageSchema = v12.object({
672
+ var stxTransferStxRequestMessageSchema = v14.object({
519
673
  ...rpcRequestMessageSchema.entries,
520
- ...v12.object({
521
- method: v12.literal(stxTransferStxMethodName),
674
+ ...v14.object({
675
+ method: v14.literal(stxTransferStxMethodName),
522
676
  params: stxTransferStxParamsSchema,
523
- id: v12.string()
677
+ id: v14.string()
524
678
  }).entries
525
679
  });
526
680
 
527
681
  // src/request/types/btcMethods.ts
528
- import * as v14 from "valibot";
529
-
530
- // src/request/types/common.ts
531
- import * as v13 from "valibot";
532
- var walletTypes = ["software", "ledger", "keystone"];
533
- var walletTypeSchema = v13.picklist(walletTypes);
534
-
535
- // src/request/types/btcMethods.ts
682
+ import * as v15 from "valibot";
536
683
  var getInfoMethodName = "getInfo";
537
- var getInfoParamsSchema = v14.nullish(v14.null());
538
- var getInfoResultSchema = v14.object({
684
+ var getInfoParamsSchema = v15.nullish(v15.null());
685
+ var getInfoResultSchema = v15.object({
539
686
  /**
540
687
  * Version of the wallet.
541
688
  */
542
- version: v14.string(),
689
+ version: v15.string(),
543
690
  /**
544
691
  * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
545
692
  */
546
- methods: v14.optional(v14.array(v14.string())),
693
+ methods: v15.optional(v15.array(v15.string())),
547
694
  /**
548
695
  * List of WBIP standards supported by the wallet. Not currently used.
549
696
  */
550
- supports: v14.array(v14.string())
697
+ supports: v15.array(v15.string())
551
698
  });
552
- var getInfoRequestMessageSchema = v14.object({
699
+ var getInfoRequestMessageSchema = v15.object({
553
700
  ...rpcRequestMessageSchema.entries,
554
- ...v14.object({
555
- method: v14.literal(getInfoMethodName),
701
+ ...v15.object({
702
+ method: v15.literal(getInfoMethodName),
556
703
  params: getInfoParamsSchema,
557
- id: v14.string()
704
+ id: v15.string()
558
705
  }).entries
559
706
  });
560
707
  var getAddressesMethodName = "getAddresses";
561
- var getAddressesParamsSchema = v14.object({
708
+ var getAddressesParamsSchema = v15.object({
562
709
  /**
563
710
  * The purposes for which to generate addresses. See
564
711
  * {@linkcode AddressPurpose} for available purposes.
565
712
  */
566
- purposes: v14.array(v14.enum(AddressPurpose)),
713
+ purposes: v15.array(v15.enum(AddressPurpose)),
567
714
  /**
568
715
  * A message to be displayed to the user in the request prompt.
569
716
  */
570
- message: v14.optional(v14.string())
717
+ message: v15.optional(v15.string())
571
718
  });
572
- var getAddressesResultSchema = v14.object({
719
+ var getAddressesResultSchema = v15.object({
573
720
  /**
574
721
  * The addresses generated for the given purposes.
575
722
  */
576
- addresses: v14.array(addressSchema)
723
+ addresses: v15.array(addressSchema),
724
+ network: getNetworkResultSchema
577
725
  });
578
- var getAddressesRequestMessageSchema = v14.object({
726
+ var getAddressesRequestMessageSchema = v15.object({
579
727
  ...rpcRequestMessageSchema.entries,
580
- ...v14.object({
581
- method: v14.literal(getAddressesMethodName),
728
+ ...v15.object({
729
+ method: v15.literal(getAddressesMethodName),
582
730
  params: getAddressesParamsSchema,
583
- id: v14.string()
731
+ id: v15.string()
584
732
  }).entries
585
733
  });
586
734
  var signMessageMethodName = "signMessage";
@@ -589,305 +737,162 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
589
737
  MessageSigningProtocols2["BIP322"] = "BIP322";
590
738
  return MessageSigningProtocols2;
591
739
  })(MessageSigningProtocols || {});
592
- var signMessageParamsSchema = v14.object({
740
+ var signMessageParamsSchema = v15.object({
593
741
  /**
594
742
  * The address used for signing.
595
743
  **/
596
- address: v14.string(),
744
+ address: v15.string(),
597
745
  /**
598
746
  * The message to sign.
599
747
  **/
600
- message: v14.string(),
748
+ message: v15.string(),
601
749
  /**
602
750
  * The protocol to use for signing the message.
603
751
  */
604
- protocol: v14.optional(v14.enum(MessageSigningProtocols))
752
+ protocol: v15.optional(v15.enum(MessageSigningProtocols))
605
753
  });
606
- var signMessageResultSchema = v14.object({
754
+ var signMessageResultSchema = v15.object({
607
755
  /**
608
756
  * The signature of the message.
609
757
  */
610
- signature: v14.string(),
758
+ signature: v15.string(),
611
759
  /**
612
760
  * hash of the message.
613
761
  */
614
- messageHash: v14.string(),
762
+ messageHash: v15.string(),
615
763
  /**
616
764
  * The address used for signing.
617
765
  */
618
- address: v14.string(),
766
+ address: v15.string(),
619
767
  /**
620
768
  * The protocol to use for signing the message.
621
769
  */
622
- protocol: v14.enum(MessageSigningProtocols)
770
+ protocol: v15.enum(MessageSigningProtocols)
623
771
  });
624
- var signMessageRequestMessageSchema = v14.object({
772
+ var signMessageRequestMessageSchema = v15.object({
625
773
  ...rpcRequestMessageSchema.entries,
626
- ...v14.object({
627
- method: v14.literal(signMessageMethodName),
774
+ ...v15.object({
775
+ method: v15.literal(signMessageMethodName),
628
776
  params: signMessageParamsSchema,
629
- id: v14.string()
777
+ id: v15.string()
630
778
  }).entries
631
779
  });
632
780
  var sendTransferMethodName = "sendTransfer";
633
- var sendTransferParamsSchema = v14.object({
781
+ var sendTransferParamsSchema = v15.object({
634
782
  /**
635
783
  * Array of recipients to send to.
636
784
  * The amount to send to each recipient is in satoshis.
637
785
  */
638
- recipients: v14.array(
639
- v14.object({
640
- address: v14.string(),
641
- amount: v14.number()
786
+ recipients: v15.array(
787
+ v15.object({
788
+ address: v15.string(),
789
+ amount: v15.number()
642
790
  })
643
791
  )
644
792
  });
645
- var sendTransferResultSchema = v14.object({
793
+ var sendTransferResultSchema = v15.object({
646
794
  /**
647
795
  * The transaction id as a hex-encoded string.
648
796
  */
649
- txid: v14.string()
797
+ txid: v15.string()
650
798
  });
651
- var sendTransferRequestMessageSchema = v14.object({
799
+ var sendTransferRequestMessageSchema = v15.object({
652
800
  ...rpcRequestMessageSchema.entries,
653
- ...v14.object({
654
- method: v14.literal(sendTransferMethodName),
801
+ ...v15.object({
802
+ method: v15.literal(sendTransferMethodName),
655
803
  params: sendTransferParamsSchema,
656
- id: v14.string()
804
+ id: v15.string()
657
805
  }).entries
658
806
  });
659
807
  var signPsbtMethodName = "signPsbt";
660
- var signPsbtParamsSchema = v14.object({
808
+ var signPsbtParamsSchema = v15.object({
661
809
  /**
662
810
  * The base64 encoded PSBT to sign.
663
811
  */
664
- psbt: v14.string(),
812
+ psbt: v15.string(),
665
813
  /**
666
814
  * The inputs to sign.
667
815
  * The key is the address and the value is an array of indexes of the inputs to sign.
668
816
  */
669
- signInputs: v14.record(v14.string(), v14.array(v14.number())),
817
+ signInputs: v15.record(v15.string(), v15.array(v15.number())),
670
818
  /**
671
819
  * Whether to broadcast the transaction after signing.
672
820
  **/
673
- broadcast: v14.optional(v14.boolean())
821
+ broadcast: v15.optional(v15.boolean())
674
822
  });
675
- var signPsbtResultSchema = v14.object({
823
+ var signPsbtResultSchema = v15.object({
676
824
  /**
677
825
  * The base64 encoded PSBT after signing.
678
826
  */
679
- psbt: v14.string(),
827
+ psbt: v15.string(),
680
828
  /**
681
829
  * The transaction id as a hex-encoded string.
682
830
  * This is only returned if the transaction was broadcast.
683
831
  **/
684
- txid: v14.optional(v14.string())
832
+ txid: v15.optional(v15.string())
685
833
  });
686
- var signPsbtRequestMessageSchema = v14.object({
834
+ var signPsbtRequestMessageSchema = v15.object({
687
835
  ...rpcRequestMessageSchema.entries,
688
- ...v14.object({
689
- method: v14.literal(signPsbtMethodName),
836
+ ...v15.object({
837
+ method: v15.literal(signPsbtMethodName),
690
838
  params: signPsbtParamsSchema,
691
- id: v14.string()
839
+ id: v15.string()
692
840
  }).entries
693
841
  });
694
842
  var getAccountsMethodName = "getAccounts";
695
- var getAccountsParamsSchema = v14.object({
843
+ var getAccountsParamsSchema = v15.object({
696
844
  /**
697
845
  * The purposes for which to generate addresses. See
698
846
  * {@linkcode AddressPurpose} for available purposes.
699
847
  */
700
- purposes: v14.array(v14.enum(AddressPurpose)),
848
+ purposes: v15.array(v15.enum(AddressPurpose)),
701
849
  /**
702
850
  * A message to be displayed to the user in the request prompt.
703
851
  */
704
- message: v14.optional(v14.string())
852
+ message: v15.optional(v15.string())
705
853
  });
706
- var getAccountsResultSchema = v14.array(
707
- v14.object({
854
+ var getAccountsResultSchema = v15.array(
855
+ v15.object({
708
856
  ...addressSchema.entries,
709
- ...v14.object({
857
+ ...v15.object({
710
858
  walletType: walletTypeSchema
711
859
  }).entries
712
860
  })
713
861
  );
714
- var getAccountsRequestMessageSchema = v14.object({
862
+ var getAccountsRequestMessageSchema = v15.object({
715
863
  ...rpcRequestMessageSchema.entries,
716
- ...v14.object({
717
- method: v14.literal(getAccountsMethodName),
864
+ ...v15.object({
865
+ method: v15.literal(getAccountsMethodName),
718
866
  params: getAccountsParamsSchema,
719
- id: v14.string()
867
+ id: v15.string()
720
868
  }).entries
721
869
  });
722
870
  var getBalanceMethodName = "getBalance";
723
- var getBalanceParamsSchema = v14.nullish(v14.null());
724
- var getBalanceResultSchema = v14.object({
871
+ var getBalanceParamsSchema = v15.nullish(v15.null());
872
+ var getBalanceResultSchema = v15.object({
725
873
  /**
726
874
  * The confirmed balance of the wallet in sats. Using a string due to chrome
727
875
  * messages not supporting bigint
728
876
  * (https://issues.chromium.org/issues/40116184).
729
877
  */
730
- confirmed: v14.string(),
878
+ confirmed: v15.string(),
731
879
  /**
732
880
  * The unconfirmed balance of the wallet in sats. Using a string due to chrome
733
881
  * messages not supporting bigint
734
882
  * (https://issues.chromium.org/issues/40116184).
735
883
  */
736
- unconfirmed: v14.string(),
884
+ unconfirmed: v15.string(),
737
885
  /**
738
886
  * The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
739
887
  * sats. Using a string due to chrome messages not supporting bigint
740
888
  * (https://issues.chromium.org/issues/40116184).
741
889
  */
742
- total: v14.string()
743
- });
744
- var getBalanceRequestMessageSchema = v14.object({
745
- ...rpcRequestMessageSchema.entries,
746
- ...v14.object({
747
- method: v14.literal(getBalanceMethodName),
748
- id: v14.string()
749
- }).entries
750
- });
751
-
752
- // src/request/types/walletMethods.ts
753
- import * as v15 from "valibot";
754
- var accountActionsSchema = v15.object({
755
- read: v15.optional(v15.boolean())
756
- });
757
- var walletActionsSchema = v15.object({
758
- readNetwork: v15.optional(v15.boolean())
759
- });
760
- var accountPermissionSchema = v15.object({
761
- type: v15.literal("account"),
762
- resourceId: v15.string(),
763
- clientId: v15.string(),
764
- actions: accountActionsSchema
765
- });
766
- var walletPermissionSchema = v15.object({
767
- type: v15.literal("wallet"),
768
- resourceId: v15.string(),
769
- clientId: v15.string(),
770
- actions: walletActionsSchema
771
- });
772
- var PermissionRequestParams = v15.variant("type", [
773
- v15.object({
774
- ...v15.omit(accountPermissionSchema, ["clientId"]).entries
775
- }),
776
- v15.object({
777
- ...v15.omit(walletPermissionSchema, ["clientId"]).entries
778
- })
779
- ]);
780
- var permission = v15.variant("type", [accountPermissionSchema, walletPermissionSchema]);
781
- var requestPermissionsMethodName = "wallet_requestPermissions";
782
- var requestPermissionsParamsSchema = v15.nullish(v15.array(PermissionRequestParams));
783
- var requestPermissionsResultSchema = v15.literal(true);
784
- var requestPermissionsRequestMessageSchema = v15.object({
785
- ...rpcRequestMessageSchema.entries,
786
- ...v15.object({
787
- method: v15.literal(requestPermissionsMethodName),
788
- params: requestPermissionsParamsSchema,
789
- id: v15.string()
790
- }).entries
890
+ total: v15.string()
791
891
  });
792
- var renouncePermissionsMethodName = "wallet_renouncePermissions";
793
- var renouncePermissionsParamsSchema = v15.nullish(v15.null());
794
- var renouncePermissionsResultSchema = v15.nullish(v15.null());
795
- var renouncePermissionsRequestMessageSchema = v15.object({
892
+ var getBalanceRequestMessageSchema = v15.object({
796
893
  ...rpcRequestMessageSchema.entries,
797
894
  ...v15.object({
798
- method: v15.literal(renouncePermissionsMethodName),
799
- params: renouncePermissionsParamsSchema,
800
- id: v15.string()
801
- }).entries
802
- });
803
- var disconnectMethodName = "wallet_disconnect";
804
- var disconnectParamsSchema = v15.nullish(v15.null());
805
- var disconnectResultSchema = v15.nullish(v15.null());
806
- var disconnectRequestMessageSchema = v15.object({
807
- ...rpcRequestMessageSchema.entries,
808
- ...v15.object({
809
- method: v15.literal(disconnectMethodName),
810
- params: disconnectParamsSchema,
811
- id: v15.string()
812
- }).entries
813
- });
814
- var getWalletTypeMethodName = "wallet_getWalletType";
815
- var getWalletTypeParamsSchema = v15.nullish(v15.null());
816
- var getWalletTypeResultSchema = walletTypeSchema;
817
- var getWalletTypeRequestMessageSchema = v15.object({
818
- ...rpcRequestMessageSchema.entries,
819
- ...v15.object({
820
- method: v15.literal(getWalletTypeMethodName),
821
- params: getWalletTypeParamsSchema,
822
- id: v15.string()
823
- }).entries
824
- });
825
- var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
826
- var getCurrentPermissionsParamsSchema = v15.nullish(v15.null());
827
- var getCurrentPermissionsResultSchema = v15.array(permission);
828
- var getCurrentPermissionsRequestMessageSchema = v15.object({
829
- ...rpcRequestMessageSchema.entries,
830
- ...v15.object({
831
- method: v15.literal(getCurrentPermissionsMethodName),
832
- params: getCurrentPermissionsParamsSchema,
833
- id: v15.string()
834
- }).entries
835
- });
836
- var getNetworkMethodName = "wallet_getNetwork";
837
- var getNetworkParamsSchema = v15.nullish(v15.null());
838
- var getNetworkResultSchema = v15.object({
839
- bitcoin: v15.object({
840
- name: v15.enum(BitcoinNetworkType)
841
- }),
842
- stacks: v15.object({
843
- name: v15.string()
844
- })
845
- });
846
- var getNetworkRequestMessageSchema = v15.object({
847
- ...rpcRequestMessageSchema.entries,
848
- ...v15.object({
849
- method: v15.literal(getNetworkMethodName),
850
- params: getNetworkParamsSchema,
851
- id: v15.string()
852
- }).entries
853
- });
854
- var getAccountMethodName = "wallet_getAccount";
855
- var getAccountParamsSchema = v15.nullish(v15.null());
856
- var getAccountResultSchema = v15.object({
857
- id: v15.string(),
858
- addresses: v15.array(addressSchema),
859
- walletType: walletTypeSchema,
860
- network: getNetworkResultSchema
861
- });
862
- var getAccountRequestMessageSchema = v15.object({
863
- ...rpcRequestMessageSchema.entries,
864
- ...v15.object({
865
- method: v15.literal(getAccountMethodName),
866
- params: getAccountParamsSchema,
867
- id: v15.string()
868
- }).entries
869
- });
870
- var connectMethodName = "wallet_connect";
871
- var connectParamsSchema = v15.nullish(
872
- v15.object({
873
- permissions: v15.optional(v15.array(PermissionRequestParams)),
874
- addresses: v15.optional(v15.array(v15.enum(AddressPurpose))),
875
- message: v15.optional(
876
- v15.pipe(v15.string(), v15.maxLength(80, "The message must not exceed 80 characters."))
877
- )
878
- })
879
- );
880
- var connectResultSchema = v15.object({
881
- id: v15.string(),
882
- addresses: v15.array(addressSchema),
883
- walletType: walletTypeSchema,
884
- network: getNetworkResultSchema
885
- });
886
- var connectRequestMessageSchema = v15.object({
887
- ...rpcRequestMessageSchema.entries,
888
- ...v15.object({
889
- method: v15.literal(connectMethodName),
890
- params: connectParamsSchema,
895
+ method: v15.literal(getBalanceMethodName),
891
896
  id: v15.string()
892
897
  }).entries
893
898
  });