@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.js CHANGED
@@ -411,30 +411,15 @@ var stxDeployContractRequestMessageSchema = v4.object({
411
411
  });
412
412
 
413
413
  // src/request/types/stxMethods/getAccounts.ts
414
+ var v8 = __toESM(require("valibot"));
415
+
416
+ // src/request/types/walletMethods.ts
417
+ var v7 = __toESM(require("valibot"));
418
+
419
+ // src/request/types/common.ts
414
420
  var v5 = __toESM(require("valibot"));
415
- var stxGetAccountsMethodName = "stx_getAccounts";
416
- var stxGetAccountsParamsSchema = v5.nullish(v5.null());
417
- var stxGetAccountsResultSchema = v5.object({
418
- /**
419
- * The addresses generated for the given purposes.
420
- */
421
- addresses: v5.array(
422
- v5.object({
423
- address: v5.string(),
424
- publicKey: v5.string(),
425
- gaiaHubUrl: v5.string(),
426
- gaiaAppKey: v5.string()
427
- })
428
- )
429
- });
430
- var stxGetAccountsRequestMessageSchema = v5.object({
431
- ...rpcRequestMessageSchema.entries,
432
- ...v5.object({
433
- method: v5.literal(stxGetAccountsMethodName),
434
- params: stxGetAccountsParamsSchema,
435
- id: v5.string()
436
- }).entries
437
- });
421
+ var walletTypes = ["software", "ledger", "keystone"];
422
+ var walletTypeSchema = v5.picklist(walletTypes);
438
423
 
439
424
  // src/addresses/index.ts
440
425
  var import_jsontokens = require("jsontokens");
@@ -481,185 +466,354 @@ var getAddress = async (options) => {
481
466
  }
482
467
  };
483
468
 
469
+ // src/request/types/walletMethods.ts
470
+ var accountActionsSchema = v7.object({
471
+ read: v7.optional(v7.boolean())
472
+ });
473
+ var walletActionsSchema = v7.object({
474
+ readNetwork: v7.optional(v7.boolean())
475
+ });
476
+ var accountPermissionSchema = v7.object({
477
+ type: v7.literal("account"),
478
+ resourceId: v7.string(),
479
+ clientId: v7.string(),
480
+ actions: accountActionsSchema
481
+ });
482
+ var walletPermissionSchema = v7.object({
483
+ type: v7.literal("wallet"),
484
+ resourceId: v7.string(),
485
+ clientId: v7.string(),
486
+ actions: walletActionsSchema
487
+ });
488
+ var PermissionRequestParams = v7.variant("type", [
489
+ v7.object({
490
+ ...v7.omit(accountPermissionSchema, ["clientId"]).entries
491
+ }),
492
+ v7.object({
493
+ ...v7.omit(walletPermissionSchema, ["clientId"]).entries
494
+ })
495
+ ]);
496
+ var permission = v7.variant("type", [accountPermissionSchema, walletPermissionSchema]);
497
+ var requestPermissionsMethodName = "wallet_requestPermissions";
498
+ var requestPermissionsParamsSchema = v7.nullish(v7.array(PermissionRequestParams));
499
+ var requestPermissionsResultSchema = v7.literal(true);
500
+ var requestPermissionsRequestMessageSchema = v7.object({
501
+ ...rpcRequestMessageSchema.entries,
502
+ ...v7.object({
503
+ method: v7.literal(requestPermissionsMethodName),
504
+ params: requestPermissionsParamsSchema,
505
+ id: v7.string()
506
+ }).entries
507
+ });
508
+ var renouncePermissionsMethodName = "wallet_renouncePermissions";
509
+ var renouncePermissionsParamsSchema = v7.nullish(v7.null());
510
+ var renouncePermissionsResultSchema = v7.nullish(v7.null());
511
+ var renouncePermissionsRequestMessageSchema = v7.object({
512
+ ...rpcRequestMessageSchema.entries,
513
+ ...v7.object({
514
+ method: v7.literal(renouncePermissionsMethodName),
515
+ params: renouncePermissionsParamsSchema,
516
+ id: v7.string()
517
+ }).entries
518
+ });
519
+ var disconnectMethodName = "wallet_disconnect";
520
+ var disconnectParamsSchema = v7.nullish(v7.null());
521
+ var disconnectResultSchema = v7.nullish(v7.null());
522
+ var disconnectRequestMessageSchema = v7.object({
523
+ ...rpcRequestMessageSchema.entries,
524
+ ...v7.object({
525
+ method: v7.literal(disconnectMethodName),
526
+ params: disconnectParamsSchema,
527
+ id: v7.string()
528
+ }).entries
529
+ });
530
+ var getWalletTypeMethodName = "wallet_getWalletType";
531
+ var getWalletTypeParamsSchema = v7.nullish(v7.null());
532
+ var getWalletTypeResultSchema = walletTypeSchema;
533
+ var getWalletTypeRequestMessageSchema = v7.object({
534
+ ...rpcRequestMessageSchema.entries,
535
+ ...v7.object({
536
+ method: v7.literal(getWalletTypeMethodName),
537
+ params: getWalletTypeParamsSchema,
538
+ id: v7.string()
539
+ }).entries
540
+ });
541
+ var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
542
+ var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
543
+ var getCurrentPermissionsResultSchema = v7.array(permission);
544
+ var getCurrentPermissionsRequestMessageSchema = v7.object({
545
+ ...rpcRequestMessageSchema.entries,
546
+ ...v7.object({
547
+ method: v7.literal(getCurrentPermissionsMethodName),
548
+ params: getCurrentPermissionsParamsSchema,
549
+ id: v7.string()
550
+ }).entries
551
+ });
552
+ var getNetworkMethodName = "wallet_getNetwork";
553
+ var getNetworkParamsSchema = v7.nullish(v7.null());
554
+ var getNetworkResultSchema = v7.object({
555
+ bitcoin: v7.object({
556
+ name: v7.enum(BitcoinNetworkType)
557
+ }),
558
+ stacks: v7.object({
559
+ name: v7.string()
560
+ })
561
+ });
562
+ var getNetworkRequestMessageSchema = v7.object({
563
+ ...rpcRequestMessageSchema.entries,
564
+ ...v7.object({
565
+ method: v7.literal(getNetworkMethodName),
566
+ params: getNetworkParamsSchema,
567
+ id: v7.string()
568
+ }).entries
569
+ });
570
+ var getAccountMethodName = "wallet_getAccount";
571
+ var getAccountParamsSchema = v7.nullish(v7.null());
572
+ var getAccountResultSchema = v7.object({
573
+ id: v7.string(),
574
+ addresses: v7.array(addressSchema),
575
+ walletType: walletTypeSchema,
576
+ network: getNetworkResultSchema
577
+ });
578
+ var getAccountRequestMessageSchema = v7.object({
579
+ ...rpcRequestMessageSchema.entries,
580
+ ...v7.object({
581
+ method: v7.literal(getAccountMethodName),
582
+ params: getAccountParamsSchema,
583
+ id: v7.string()
584
+ }).entries
585
+ });
586
+ var connectMethodName = "wallet_connect";
587
+ var connectParamsSchema = v7.nullish(
588
+ v7.object({
589
+ permissions: v7.optional(v7.array(PermissionRequestParams)),
590
+ addresses: v7.optional(v7.array(v7.enum(AddressPurpose))),
591
+ message: v7.optional(
592
+ v7.pipe(v7.string(), v7.maxLength(80, "The message must not exceed 80 characters."))
593
+ )
594
+ })
595
+ );
596
+ var connectResultSchema = v7.object({
597
+ id: v7.string(),
598
+ addresses: v7.array(addressSchema),
599
+ walletType: walletTypeSchema,
600
+ network: getNetworkResultSchema
601
+ });
602
+ var connectRequestMessageSchema = v7.object({
603
+ ...rpcRequestMessageSchema.entries,
604
+ ...v7.object({
605
+ method: v7.literal(connectMethodName),
606
+ params: connectParamsSchema,
607
+ id: v7.string()
608
+ }).entries
609
+ });
610
+
611
+ // src/request/types/stxMethods/getAccounts.ts
612
+ var stxGetAccountsMethodName = "stx_getAccounts";
613
+ var stxGetAccountsParamsSchema = v8.nullish(v8.null());
614
+ var stxGetAccountsResultSchema = v8.object({
615
+ /**
616
+ * The addresses generated for the given purposes.
617
+ */
618
+ addresses: v8.array(
619
+ v8.object({
620
+ address: v8.string(),
621
+ publicKey: v8.string(),
622
+ gaiaHubUrl: v8.string(),
623
+ gaiaAppKey: v8.string()
624
+ })
625
+ ),
626
+ network: getNetworkResultSchema
627
+ });
628
+ var stxGetAccountsRequestMessageSchema = v8.object({
629
+ ...rpcRequestMessageSchema.entries,
630
+ ...v8.object({
631
+ method: v8.literal(stxGetAccountsMethodName),
632
+ params: stxGetAccountsParamsSchema,
633
+ id: v8.string()
634
+ }).entries
635
+ });
636
+
484
637
  // src/request/types/stxMethods/getAddresses.ts
485
- var v7 = __toESM(require("valibot"));
638
+ var v9 = __toESM(require("valibot"));
486
639
  var stxGetAddressesMethodName = "stx_getAddresses";
487
- var stxGetAddressesParamsSchema = v7.nullish(
488
- v7.object({
640
+ var stxGetAddressesParamsSchema = v9.nullish(
641
+ v9.object({
489
642
  /**
490
643
  * A message to be displayed to the user in the request prompt.
491
644
  */
492
- message: v7.optional(v7.string())
645
+ message: v9.optional(v9.string())
493
646
  })
494
647
  );
495
- var stxGetAddressesResultSchema = v7.object({
648
+ var stxGetAddressesResultSchema = v9.object({
496
649
  /**
497
650
  * The addresses generated for the given purposes.
498
651
  */
499
- addresses: v7.array(addressSchema)
652
+ addresses: v9.array(addressSchema),
653
+ network: getNetworkResultSchema
500
654
  });
501
- var stxGetAddressesRequestMessageSchema = v7.object({
655
+ var stxGetAddressesRequestMessageSchema = v9.object({
502
656
  ...rpcRequestMessageSchema.entries,
503
- ...v7.object({
504
- method: v7.literal(stxGetAddressesMethodName),
657
+ ...v9.object({
658
+ method: v9.literal(stxGetAddressesMethodName),
505
659
  params: stxGetAddressesParamsSchema,
506
- id: v7.string()
660
+ id: v9.string()
507
661
  }).entries
508
662
  });
509
663
 
510
664
  // src/request/types/stxMethods/signMessage.ts
511
- var v8 = __toESM(require("valibot"));
665
+ var v10 = __toESM(require("valibot"));
512
666
  var stxSignMessageMethodName = "stx_signMessage";
513
- var stxSignMessageParamsSchema = v8.object({
667
+ var stxSignMessageParamsSchema = v10.object({
514
668
  /**
515
669
  * The message to sign.
516
670
  */
517
- message: v8.string(),
671
+ message: v10.string(),
518
672
  /**
519
673
  * The public key to sign the message with.
520
674
  */
521
- publicKey: v8.string(),
675
+ publicKey: v10.string(),
522
676
  /**
523
677
  * The format version of the parameter.
524
678
  */
525
- parameterFormatVersion: v8.optional(v8.number())
679
+ parameterFormatVersion: v10.optional(v10.number())
526
680
  });
527
- var stxSignMessageResultSchema = v8.object({
681
+ var stxSignMessageResultSchema = v10.object({
528
682
  /**
529
683
  * The signature of the message.
530
684
  */
531
- signature: v8.string(),
685
+ signature: v10.string(),
532
686
  /**
533
687
  * The public key used to sign the message.
534
688
  */
535
- publicKey: v8.string()
689
+ publicKey: v10.string()
536
690
  });
537
- var stxSignMessageRequestMessageSchema = v8.object({
691
+ var stxSignMessageRequestMessageSchema = v10.object({
538
692
  ...rpcRequestMessageSchema.entries,
539
- ...v8.object({
540
- method: v8.literal(stxSignMessageMethodName),
693
+ ...v10.object({
694
+ method: v10.literal(stxSignMessageMethodName),
541
695
  params: stxSignMessageParamsSchema,
542
- id: v8.string()
696
+ id: v10.string()
543
697
  }).entries
544
698
  });
545
699
 
546
700
  // src/request/types/stxMethods/signStructuredMessage.ts
547
- var v9 = __toESM(require("valibot"));
701
+ var v11 = __toESM(require("valibot"));
548
702
  var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
549
- var stxSignStructuredMessageParamsSchema = v9.object({
703
+ var stxSignStructuredMessageParamsSchema = v11.object({
550
704
  /**
551
705
  * The domain to be signed.
552
706
  */
553
- domain: v9.string(),
707
+ domain: v11.string(),
554
708
  /**
555
709
  * Message payload to be signed.
556
710
  */
557
- message: v9.string(),
711
+ message: v11.string(),
558
712
  /**
559
713
  * The format version of the parameter.
560
714
  */
561
- parameterFormatVersion: v9.optional(v9.number()),
715
+ parameterFormatVersion: v11.optional(v11.number()),
562
716
  /**
563
717
  * The public key to sign the message with.
564
718
  */
565
- publicKey: v9.optional(v9.string())
719
+ publicKey: v11.optional(v11.string())
566
720
  });
567
- var stxSignStructuredMessageResultSchema = v9.object({
721
+ var stxSignStructuredMessageResultSchema = v11.object({
568
722
  /**
569
723
  * Signature of the message.
570
724
  */
571
- signature: v9.string(),
725
+ signature: v11.string(),
572
726
  /**
573
727
  * Public key as hex-encoded string.
574
728
  */
575
- publicKey: v9.string()
729
+ publicKey: v11.string()
576
730
  });
577
- var stxSignStructuredMessageRequestMessageSchema = v9.object({
731
+ var stxSignStructuredMessageRequestMessageSchema = v11.object({
578
732
  ...rpcRequestMessageSchema.entries,
579
- ...v9.object({
580
- method: v9.literal(stxSignStructuredMessageMethodName),
733
+ ...v11.object({
734
+ method: v11.literal(stxSignStructuredMessageMethodName),
581
735
  params: stxSignStructuredMessageParamsSchema,
582
- id: v9.string()
736
+ id: v11.string()
583
737
  }).entries
584
738
  });
585
739
 
586
740
  // src/request/types/stxMethods/signTransaction.ts
587
- var v10 = __toESM(require("valibot"));
741
+ var v12 = __toESM(require("valibot"));
588
742
  var stxSignTransactionMethodName = "stx_signTransaction";
589
- var stxSignTransactionParamsSchema = v10.object({
743
+ var stxSignTransactionParamsSchema = v12.object({
590
744
  /**
591
745
  * The transaction to sign as a hex-encoded string.
592
746
  */
593
- transaction: v10.string(),
747
+ transaction: v12.string(),
594
748
  /**
595
749
  * The public key to sign the transaction with. The wallet may use any key
596
750
  * when not provided.
597
751
  */
598
- pubkey: v10.optional(v10.string()),
752
+ pubkey: v12.optional(v12.string()),
599
753
  /**
600
754
  * Whether to broadcast the transaction after signing. Defaults to `true`.
601
755
  */
602
- broadcast: v10.optional(v10.boolean())
756
+ broadcast: v12.optional(v12.boolean())
603
757
  });
604
- var stxSignTransactionResultSchema = v10.object({
758
+ var stxSignTransactionResultSchema = v12.object({
605
759
  /**
606
760
  * The signed transaction as a hex-encoded string.
607
761
  */
608
- transaction: v10.string()
762
+ transaction: v12.string()
609
763
  });
610
- var stxSignTransactionRequestMessageSchema = v10.object({
764
+ var stxSignTransactionRequestMessageSchema = v12.object({
611
765
  ...rpcRequestMessageSchema.entries,
612
- ...v10.object({
613
- method: v10.literal(stxSignTransactionMethodName),
766
+ ...v12.object({
767
+ method: v12.literal(stxSignTransactionMethodName),
614
768
  params: stxSignTransactionParamsSchema,
615
- id: v10.string()
769
+ id: v12.string()
616
770
  }).entries
617
771
  });
618
772
 
619
773
  // src/request/types/stxMethods/signTransactions.ts
620
- var v11 = __toESM(require("valibot"));
774
+ var v13 = __toESM(require("valibot"));
621
775
  var stxSignTransactionsMethodName = "stx_signTransactions";
622
- var stxSignTransactionsParamsSchema = v11.object({
776
+ var stxSignTransactionsParamsSchema = v13.object({
623
777
  /**
624
778
  * The transactions to sign as hex-encoded strings.
625
779
  */
626
- transactions: v11.pipe(
627
- v11.array(
628
- v11.pipe(
629
- v11.string(),
630
- v11.check((hex) => {
780
+ transactions: v13.pipe(
781
+ v13.array(
782
+ v13.pipe(
783
+ v13.string(),
784
+ v13.check((hex) => {
631
785
  return true;
632
786
  }, "Invalid hex-encoded Stacks transaction.")
633
787
  )
634
788
  ),
635
- v11.minLength(1)
789
+ v13.minLength(1)
636
790
  ),
637
791
  /**
638
792
  * Whether the signed transactions should be broadcast after signing. Defaults
639
793
  * to `true`.
640
794
  */
641
- broadcast: v11.optional(v11.boolean())
795
+ broadcast: v13.optional(v13.boolean())
642
796
  });
643
- var stxSignTransactionsResultSchema = v11.object({
797
+ var stxSignTransactionsResultSchema = v13.object({
644
798
  /**
645
799
  * The signed transactions as hex-encoded strings, in the same order as in the
646
800
  * sign request.
647
801
  */
648
- transactions: v11.array(v11.string())
802
+ transactions: v13.array(v13.string())
649
803
  });
650
- var stxSignTransactionsRequestMessageSchema = v11.object({
804
+ var stxSignTransactionsRequestMessageSchema = v13.object({
651
805
  ...rpcRequestMessageSchema.entries,
652
- ...v11.object({
653
- method: v11.literal(stxSignTransactionsMethodName),
806
+ ...v13.object({
807
+ method: v13.literal(stxSignTransactionsMethodName),
654
808
  params: stxSignTransactionsParamsSchema,
655
- id: v11.string()
809
+ id: v13.string()
656
810
  }).entries
657
811
  });
658
812
 
659
813
  // src/request/types/stxMethods/transferStx.ts
660
- var v12 = __toESM(require("valibot"));
814
+ var v14 = __toESM(require("valibot"));
661
815
  var stxTransferStxMethodName = "stx_transferStx";
662
- var stxTransferStxParamsSchema = v12.object({
816
+ var stxTransferStxParamsSchema = v14.object({
663
817
  /**
664
818
  * Amount of STX tokens to transfer in microstacks as a string. Anything
665
819
  * parseable by `BigInt` is acceptable.
@@ -672,23 +826,23 @@ var stxTransferStxParamsSchema = v12.object({
672
826
  * const amount3 = '1234';
673
827
  * ```
674
828
  */
675
- amount: v12.union([v12.number(), v12.string()]),
829
+ amount: v14.union([v14.number(), v14.string()]),
676
830
  /**
677
831
  * The recipeint's principal.
678
832
  */
679
- recipient: v12.string(),
833
+ recipient: v14.string(),
680
834
  /**
681
835
  * A string representing the memo.
682
836
  */
683
- memo: v12.optional(v12.string()),
837
+ memo: v14.optional(v14.string()),
684
838
  /**
685
839
  * Version of parameter format.
686
840
  */
687
- version: v12.optional(v12.string()),
841
+ version: v14.optional(v14.string()),
688
842
  /**
689
843
  * The mode of the post conditions.
690
844
  */
691
- postConditionMode: v12.optional(v12.number()),
845
+ postConditionMode: v14.optional(v14.number()),
692
846
  /**
693
847
  * A hex-encoded string representing the post conditions.
694
848
  *
@@ -701,89 +855,83 @@ var stxTransferStxParamsSchema = v12.object({
701
855
  * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
702
856
  * ```
703
857
  */
704
- postConditions: v12.optional(v12.array(v12.string())),
858
+ postConditions: v14.optional(v14.array(v14.string())),
705
859
  /**
706
860
  * The public key to sign the transaction with. The wallet may use any key
707
861
  * when not provided.
708
862
  */
709
- pubkey: v12.optional(v12.string())
863
+ pubkey: v14.optional(v14.string())
710
864
  });
711
- var stxTransferStxResultSchema = v12.object({
865
+ var stxTransferStxResultSchema = v14.object({
712
866
  /**
713
867
  * The ID of the transaction.
714
868
  */
715
- txid: v12.string(),
869
+ txid: v14.string(),
716
870
  /**
717
871
  * A Stacks transaction as a hex-encoded string.
718
872
  */
719
- transaction: v12.string()
873
+ transaction: v14.string()
720
874
  });
721
- var stxTransferStxRequestMessageSchema = v12.object({
875
+ var stxTransferStxRequestMessageSchema = v14.object({
722
876
  ...rpcRequestMessageSchema.entries,
723
- ...v12.object({
724
- method: v12.literal(stxTransferStxMethodName),
877
+ ...v14.object({
878
+ method: v14.literal(stxTransferStxMethodName),
725
879
  params: stxTransferStxParamsSchema,
726
- id: v12.string()
880
+ id: v14.string()
727
881
  }).entries
728
882
  });
729
883
 
730
884
  // src/request/types/btcMethods.ts
731
- var v14 = __toESM(require("valibot"));
732
-
733
- // src/request/types/common.ts
734
- var v13 = __toESM(require("valibot"));
735
- var walletTypes = ["software", "ledger", "keystone"];
736
- var walletTypeSchema = v13.picklist(walletTypes);
737
-
738
- // src/request/types/btcMethods.ts
885
+ var v15 = __toESM(require("valibot"));
739
886
  var getInfoMethodName = "getInfo";
740
- var getInfoParamsSchema = v14.nullish(v14.null());
741
- var getInfoResultSchema = v14.object({
887
+ var getInfoParamsSchema = v15.nullish(v15.null());
888
+ var getInfoResultSchema = v15.object({
742
889
  /**
743
890
  * Version of the wallet.
744
891
  */
745
- version: v14.string(),
892
+ version: v15.string(),
746
893
  /**
747
894
  * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
748
895
  */
749
- methods: v14.optional(v14.array(v14.string())),
896
+ methods: v15.optional(v15.array(v15.string())),
750
897
  /**
751
898
  * List of WBIP standards supported by the wallet. Not currently used.
752
899
  */
753
- supports: v14.array(v14.string())
900
+ supports: v15.array(v15.string())
754
901
  });
755
- var getInfoRequestMessageSchema = v14.object({
902
+ var getInfoRequestMessageSchema = v15.object({
756
903
  ...rpcRequestMessageSchema.entries,
757
- ...v14.object({
758
- method: v14.literal(getInfoMethodName),
904
+ ...v15.object({
905
+ method: v15.literal(getInfoMethodName),
759
906
  params: getInfoParamsSchema,
760
- id: v14.string()
907
+ id: v15.string()
761
908
  }).entries
762
909
  });
763
910
  var getAddressesMethodName = "getAddresses";
764
- var getAddressesParamsSchema = v14.object({
911
+ var getAddressesParamsSchema = v15.object({
765
912
  /**
766
913
  * The purposes for which to generate addresses. See
767
914
  * {@linkcode AddressPurpose} for available purposes.
768
915
  */
769
- purposes: v14.array(v14.enum(AddressPurpose)),
916
+ purposes: v15.array(v15.enum(AddressPurpose)),
770
917
  /**
771
918
  * A message to be displayed to the user in the request prompt.
772
919
  */
773
- message: v14.optional(v14.string())
920
+ message: v15.optional(v15.string())
774
921
  });
775
- var getAddressesResultSchema = v14.object({
922
+ var getAddressesResultSchema = v15.object({
776
923
  /**
777
924
  * The addresses generated for the given purposes.
778
925
  */
779
- addresses: v14.array(addressSchema)
926
+ addresses: v15.array(addressSchema),
927
+ network: getNetworkResultSchema
780
928
  });
781
- var getAddressesRequestMessageSchema = v14.object({
929
+ var getAddressesRequestMessageSchema = v15.object({
782
930
  ...rpcRequestMessageSchema.entries,
783
- ...v14.object({
784
- method: v14.literal(getAddressesMethodName),
931
+ ...v15.object({
932
+ method: v15.literal(getAddressesMethodName),
785
933
  params: getAddressesParamsSchema,
786
- id: v14.string()
934
+ id: v15.string()
787
935
  }).entries
788
936
  });
789
937
  var signMessageMethodName = "signMessage";
@@ -792,305 +940,162 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
792
940
  MessageSigningProtocols2["BIP322"] = "BIP322";
793
941
  return MessageSigningProtocols2;
794
942
  })(MessageSigningProtocols || {});
795
- var signMessageParamsSchema = v14.object({
943
+ var signMessageParamsSchema = v15.object({
796
944
  /**
797
945
  * The address used for signing.
798
946
  **/
799
- address: v14.string(),
947
+ address: v15.string(),
800
948
  /**
801
949
  * The message to sign.
802
950
  **/
803
- message: v14.string(),
951
+ message: v15.string(),
804
952
  /**
805
953
  * The protocol to use for signing the message.
806
954
  */
807
- protocol: v14.optional(v14.enum(MessageSigningProtocols))
955
+ protocol: v15.optional(v15.enum(MessageSigningProtocols))
808
956
  });
809
- var signMessageResultSchema = v14.object({
957
+ var signMessageResultSchema = v15.object({
810
958
  /**
811
959
  * The signature of the message.
812
960
  */
813
- signature: v14.string(),
961
+ signature: v15.string(),
814
962
  /**
815
963
  * hash of the message.
816
964
  */
817
- messageHash: v14.string(),
965
+ messageHash: v15.string(),
818
966
  /**
819
967
  * The address used for signing.
820
968
  */
821
- address: v14.string(),
969
+ address: v15.string(),
822
970
  /**
823
971
  * The protocol to use for signing the message.
824
972
  */
825
- protocol: v14.enum(MessageSigningProtocols)
973
+ protocol: v15.enum(MessageSigningProtocols)
826
974
  });
827
- var signMessageRequestMessageSchema = v14.object({
975
+ var signMessageRequestMessageSchema = v15.object({
828
976
  ...rpcRequestMessageSchema.entries,
829
- ...v14.object({
830
- method: v14.literal(signMessageMethodName),
977
+ ...v15.object({
978
+ method: v15.literal(signMessageMethodName),
831
979
  params: signMessageParamsSchema,
832
- id: v14.string()
980
+ id: v15.string()
833
981
  }).entries
834
982
  });
835
983
  var sendTransferMethodName = "sendTransfer";
836
- var sendTransferParamsSchema = v14.object({
984
+ var sendTransferParamsSchema = v15.object({
837
985
  /**
838
986
  * Array of recipients to send to.
839
987
  * The amount to send to each recipient is in satoshis.
840
988
  */
841
- recipients: v14.array(
842
- v14.object({
843
- address: v14.string(),
844
- amount: v14.number()
989
+ recipients: v15.array(
990
+ v15.object({
991
+ address: v15.string(),
992
+ amount: v15.number()
845
993
  })
846
994
  )
847
995
  });
848
- var sendTransferResultSchema = v14.object({
996
+ var sendTransferResultSchema = v15.object({
849
997
  /**
850
998
  * The transaction id as a hex-encoded string.
851
999
  */
852
- txid: v14.string()
1000
+ txid: v15.string()
853
1001
  });
854
- var sendTransferRequestMessageSchema = v14.object({
1002
+ var sendTransferRequestMessageSchema = v15.object({
855
1003
  ...rpcRequestMessageSchema.entries,
856
- ...v14.object({
857
- method: v14.literal(sendTransferMethodName),
1004
+ ...v15.object({
1005
+ method: v15.literal(sendTransferMethodName),
858
1006
  params: sendTransferParamsSchema,
859
- id: v14.string()
1007
+ id: v15.string()
860
1008
  }).entries
861
1009
  });
862
1010
  var signPsbtMethodName = "signPsbt";
863
- var signPsbtParamsSchema = v14.object({
1011
+ var signPsbtParamsSchema = v15.object({
864
1012
  /**
865
1013
  * The base64 encoded PSBT to sign.
866
1014
  */
867
- psbt: v14.string(),
1015
+ psbt: v15.string(),
868
1016
  /**
869
1017
  * The inputs to sign.
870
1018
  * The key is the address and the value is an array of indexes of the inputs to sign.
871
1019
  */
872
- signInputs: v14.record(v14.string(), v14.array(v14.number())),
1020
+ signInputs: v15.record(v15.string(), v15.array(v15.number())),
873
1021
  /**
874
1022
  * Whether to broadcast the transaction after signing.
875
1023
  **/
876
- broadcast: v14.optional(v14.boolean())
1024
+ broadcast: v15.optional(v15.boolean())
877
1025
  });
878
- var signPsbtResultSchema = v14.object({
1026
+ var signPsbtResultSchema = v15.object({
879
1027
  /**
880
1028
  * The base64 encoded PSBT after signing.
881
1029
  */
882
- psbt: v14.string(),
1030
+ psbt: v15.string(),
883
1031
  /**
884
1032
  * The transaction id as a hex-encoded string.
885
1033
  * This is only returned if the transaction was broadcast.
886
1034
  **/
887
- txid: v14.optional(v14.string())
1035
+ txid: v15.optional(v15.string())
888
1036
  });
889
- var signPsbtRequestMessageSchema = v14.object({
1037
+ var signPsbtRequestMessageSchema = v15.object({
890
1038
  ...rpcRequestMessageSchema.entries,
891
- ...v14.object({
892
- method: v14.literal(signPsbtMethodName),
1039
+ ...v15.object({
1040
+ method: v15.literal(signPsbtMethodName),
893
1041
  params: signPsbtParamsSchema,
894
- id: v14.string()
1042
+ id: v15.string()
895
1043
  }).entries
896
1044
  });
897
1045
  var getAccountsMethodName = "getAccounts";
898
- var getAccountsParamsSchema = v14.object({
1046
+ var getAccountsParamsSchema = v15.object({
899
1047
  /**
900
1048
  * The purposes for which to generate addresses. See
901
1049
  * {@linkcode AddressPurpose} for available purposes.
902
1050
  */
903
- purposes: v14.array(v14.enum(AddressPurpose)),
1051
+ purposes: v15.array(v15.enum(AddressPurpose)),
904
1052
  /**
905
1053
  * A message to be displayed to the user in the request prompt.
906
1054
  */
907
- message: v14.optional(v14.string())
1055
+ message: v15.optional(v15.string())
908
1056
  });
909
- var getAccountsResultSchema = v14.array(
910
- v14.object({
1057
+ var getAccountsResultSchema = v15.array(
1058
+ v15.object({
911
1059
  ...addressSchema.entries,
912
- ...v14.object({
1060
+ ...v15.object({
913
1061
  walletType: walletTypeSchema
914
1062
  }).entries
915
1063
  })
916
1064
  );
917
- var getAccountsRequestMessageSchema = v14.object({
1065
+ var getAccountsRequestMessageSchema = v15.object({
918
1066
  ...rpcRequestMessageSchema.entries,
919
- ...v14.object({
920
- method: v14.literal(getAccountsMethodName),
1067
+ ...v15.object({
1068
+ method: v15.literal(getAccountsMethodName),
921
1069
  params: getAccountsParamsSchema,
922
- id: v14.string()
1070
+ id: v15.string()
923
1071
  }).entries
924
1072
  });
925
1073
  var getBalanceMethodName = "getBalance";
926
- var getBalanceParamsSchema = v14.nullish(v14.null());
927
- var getBalanceResultSchema = v14.object({
1074
+ var getBalanceParamsSchema = v15.nullish(v15.null());
1075
+ var getBalanceResultSchema = v15.object({
928
1076
  /**
929
1077
  * The confirmed balance of the wallet in sats. Using a string due to chrome
930
1078
  * messages not supporting bigint
931
1079
  * (https://issues.chromium.org/issues/40116184).
932
1080
  */
933
- confirmed: v14.string(),
1081
+ confirmed: v15.string(),
934
1082
  /**
935
1083
  * The unconfirmed balance of the wallet in sats. Using a string due to chrome
936
1084
  * messages not supporting bigint
937
1085
  * (https://issues.chromium.org/issues/40116184).
938
1086
  */
939
- unconfirmed: v14.string(),
1087
+ unconfirmed: v15.string(),
940
1088
  /**
941
1089
  * The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
942
1090
  * sats. Using a string due to chrome messages not supporting bigint
943
1091
  * (https://issues.chromium.org/issues/40116184).
944
1092
  */
945
- total: v14.string()
946
- });
947
- var getBalanceRequestMessageSchema = v14.object({
948
- ...rpcRequestMessageSchema.entries,
949
- ...v14.object({
950
- method: v14.literal(getBalanceMethodName),
951
- id: v14.string()
952
- }).entries
953
- });
954
-
955
- // src/request/types/walletMethods.ts
956
- var v15 = __toESM(require("valibot"));
957
- var accountActionsSchema = v15.object({
958
- read: v15.optional(v15.boolean())
959
- });
960
- var walletActionsSchema = v15.object({
961
- readNetwork: v15.optional(v15.boolean())
962
- });
963
- var accountPermissionSchema = v15.object({
964
- type: v15.literal("account"),
965
- resourceId: v15.string(),
966
- clientId: v15.string(),
967
- actions: accountActionsSchema
968
- });
969
- var walletPermissionSchema = v15.object({
970
- type: v15.literal("wallet"),
971
- resourceId: v15.string(),
972
- clientId: v15.string(),
973
- actions: walletActionsSchema
974
- });
975
- var PermissionRequestParams = v15.variant("type", [
976
- v15.object({
977
- ...v15.omit(accountPermissionSchema, ["clientId"]).entries
978
- }),
979
- v15.object({
980
- ...v15.omit(walletPermissionSchema, ["clientId"]).entries
981
- })
982
- ]);
983
- var permission = v15.variant("type", [accountPermissionSchema, walletPermissionSchema]);
984
- var requestPermissionsMethodName = "wallet_requestPermissions";
985
- var requestPermissionsParamsSchema = v15.nullish(v15.array(PermissionRequestParams));
986
- var requestPermissionsResultSchema = v15.literal(true);
987
- var requestPermissionsRequestMessageSchema = v15.object({
988
- ...rpcRequestMessageSchema.entries,
989
- ...v15.object({
990
- method: v15.literal(requestPermissionsMethodName),
991
- params: requestPermissionsParamsSchema,
992
- id: v15.string()
993
- }).entries
1093
+ total: v15.string()
994
1094
  });
995
- var renouncePermissionsMethodName = "wallet_renouncePermissions";
996
- var renouncePermissionsParamsSchema = v15.nullish(v15.null());
997
- var renouncePermissionsResultSchema = v15.nullish(v15.null());
998
- var renouncePermissionsRequestMessageSchema = v15.object({
1095
+ var getBalanceRequestMessageSchema = v15.object({
999
1096
  ...rpcRequestMessageSchema.entries,
1000
1097
  ...v15.object({
1001
- method: v15.literal(renouncePermissionsMethodName),
1002
- params: renouncePermissionsParamsSchema,
1003
- id: v15.string()
1004
- }).entries
1005
- });
1006
- var disconnectMethodName = "wallet_disconnect";
1007
- var disconnectParamsSchema = v15.nullish(v15.null());
1008
- var disconnectResultSchema = v15.nullish(v15.null());
1009
- var disconnectRequestMessageSchema = v15.object({
1010
- ...rpcRequestMessageSchema.entries,
1011
- ...v15.object({
1012
- method: v15.literal(disconnectMethodName),
1013
- params: disconnectParamsSchema,
1014
- id: v15.string()
1015
- }).entries
1016
- });
1017
- var getWalletTypeMethodName = "wallet_getWalletType";
1018
- var getWalletTypeParamsSchema = v15.nullish(v15.null());
1019
- var getWalletTypeResultSchema = walletTypeSchema;
1020
- var getWalletTypeRequestMessageSchema = v15.object({
1021
- ...rpcRequestMessageSchema.entries,
1022
- ...v15.object({
1023
- method: v15.literal(getWalletTypeMethodName),
1024
- params: getWalletTypeParamsSchema,
1025
- id: v15.string()
1026
- }).entries
1027
- });
1028
- var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
1029
- var getCurrentPermissionsParamsSchema = v15.nullish(v15.null());
1030
- var getCurrentPermissionsResultSchema = v15.array(permission);
1031
- var getCurrentPermissionsRequestMessageSchema = v15.object({
1032
- ...rpcRequestMessageSchema.entries,
1033
- ...v15.object({
1034
- method: v15.literal(getCurrentPermissionsMethodName),
1035
- params: getCurrentPermissionsParamsSchema,
1036
- id: v15.string()
1037
- }).entries
1038
- });
1039
- var getNetworkMethodName = "wallet_getNetwork";
1040
- var getNetworkParamsSchema = v15.nullish(v15.null());
1041
- var getNetworkResultSchema = v15.object({
1042
- bitcoin: v15.object({
1043
- name: v15.enum(BitcoinNetworkType)
1044
- }),
1045
- stacks: v15.object({
1046
- name: v15.string()
1047
- })
1048
- });
1049
- var getNetworkRequestMessageSchema = v15.object({
1050
- ...rpcRequestMessageSchema.entries,
1051
- ...v15.object({
1052
- method: v15.literal(getNetworkMethodName),
1053
- params: getNetworkParamsSchema,
1054
- id: v15.string()
1055
- }).entries
1056
- });
1057
- var getAccountMethodName = "wallet_getAccount";
1058
- var getAccountParamsSchema = v15.nullish(v15.null());
1059
- var getAccountResultSchema = v15.object({
1060
- id: v15.string(),
1061
- addresses: v15.array(addressSchema),
1062
- walletType: walletTypeSchema,
1063
- network: getNetworkResultSchema
1064
- });
1065
- var getAccountRequestMessageSchema = v15.object({
1066
- ...rpcRequestMessageSchema.entries,
1067
- ...v15.object({
1068
- method: v15.literal(getAccountMethodName),
1069
- params: getAccountParamsSchema,
1070
- id: v15.string()
1071
- }).entries
1072
- });
1073
- var connectMethodName = "wallet_connect";
1074
- var connectParamsSchema = v15.nullish(
1075
- v15.object({
1076
- permissions: v15.optional(v15.array(PermissionRequestParams)),
1077
- addresses: v15.optional(v15.array(v15.enum(AddressPurpose))),
1078
- message: v15.optional(
1079
- v15.pipe(v15.string(), v15.maxLength(80, "The message must not exceed 80 characters."))
1080
- )
1081
- })
1082
- );
1083
- var connectResultSchema = v15.object({
1084
- id: v15.string(),
1085
- addresses: v15.array(addressSchema),
1086
- walletType: walletTypeSchema,
1087
- network: getNetworkResultSchema
1088
- });
1089
- var connectRequestMessageSchema = v15.object({
1090
- ...rpcRequestMessageSchema.entries,
1091
- ...v15.object({
1092
- method: v15.literal(connectMethodName),
1093
- params: connectParamsSchema,
1098
+ method: v15.literal(getBalanceMethodName),
1094
1099
  id: v15.string()
1095
1100
  }).entries
1096
1101
  });