@sats-connect/core 0.0.15 → 0.1.0-6ee3e3f

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 CHANGED
@@ -339,7 +339,9 @@ declare const getAddressesResultSchema: v.ObjectSchema<{
339
339
  readonly addresses: v.ArraySchema<v.ObjectSchema<{
340
340
  readonly address: v.StringSchema<undefined>;
341
341
  readonly publicKey: v.StringSchema<undefined>;
342
- readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
342
+ readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>; /**
343
+ * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
344
+ */
343
345
  readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
344
346
  }, undefined>, undefined>;
345
347
  }, undefined>;
@@ -476,9 +478,12 @@ declare const getAccountsParamsSchema: v.ObjectSchema<{
476
478
  }, undefined>;
477
479
  type GetAccountsParams = v.InferOutput<typeof getAccountsParamsSchema>;
478
480
  declare const getAccountsResultSchema: v.ArraySchema<v.ObjectSchema<{
481
+ readonly walletType: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
479
482
  readonly address: v.StringSchema<undefined>;
480
483
  readonly publicKey: v.StringSchema<undefined>;
481
- readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
484
+ readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>; /**
485
+ * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
486
+ */
482
487
  readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
483
488
  }, undefined>, undefined>;
484
489
  type GetAccountsResult = v.InferOutput<typeof getAccountsResultSchema>;
@@ -901,9 +906,52 @@ declare const stxGetAddressesRequestMessageSchema: v.ObjectSchema<{
901
906
  }, undefined>;
902
907
  type StxGetAddressesRequestMessage = v.InferOutput<typeof stxGetAddressesRequestMessageSchema>;
903
908
  type StxGetAddresses = MethodParamsAndResult<v.InferOutput<typeof stxGetAddressesParamsSchema>, v.InferOutput<typeof stxGetAddressesResultSchema>>;
904
- type SignTransactionParams = Transaction & Partial<Pubkey>;
905
- type SignTransactionResult = Transaction;
906
- type StxSignTransaction = MethodParamsAndResult<SignTransactionParams, SignTransactionResult>;
909
+ declare const stxSignTransactionMethodName = "stx_signTransaction";
910
+ declare const stxSignTransactionParamsSchema: v.ObjectSchema<{
911
+ /**
912
+ * The transaction to sign as a hex-encoded string.
913
+ */
914
+ readonly transaction: v.StringSchema<undefined>;
915
+ /**
916
+ * The public key to sign the transaction with. The wallet may use any key
917
+ * when not provided.
918
+ */
919
+ readonly pubkey: v.OptionalSchema<v.StringSchema<undefined>, never>;
920
+ /**
921
+ * Whether to broadcast the transaction after signing. Defaults to `true`.
922
+ */
923
+ readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
924
+ }, undefined>;
925
+ type StxSignTransactionParams = v.InferOutput<typeof stxSignTransactionParamsSchema>;
926
+ declare const stxSignTransactionResultSchema: v.ObjectSchema<{
927
+ /**
928
+ * The signed transaction as a hex-encoded string.
929
+ */
930
+ readonly transaction: v.StringSchema<undefined>;
931
+ }, undefined>;
932
+ type StxSignTransactionResult = v.InferOutput<typeof stxSignTransactionResultSchema>;
933
+ declare const stxSignTransactionRequestMessageSchema: v.ObjectSchema<{
934
+ readonly method: v.LiteralSchema<"stx_signTransaction", undefined>;
935
+ readonly params: v.ObjectSchema<{
936
+ /**
937
+ * The transaction to sign as a hex-encoded string.
938
+ */
939
+ readonly transaction: v.StringSchema<undefined>;
940
+ /**
941
+ * The public key to sign the transaction with. The wallet may use any key
942
+ * when not provided.
943
+ */
944
+ readonly pubkey: v.OptionalSchema<v.StringSchema<undefined>, never>;
945
+ /**
946
+ * Whether to broadcast the transaction after signing. Defaults to `true`.
947
+ */
948
+ readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
949
+ }, undefined>;
950
+ readonly id: v.StringSchema<undefined>;
951
+ readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
952
+ }, undefined>;
953
+ type StxSignTransactionRequestMessage = v.InferOutput<typeof stxSignTransactionRequestMessageSchema>;
954
+ type StxSignTransaction = MethodParamsAndResult<StxSignTransactionParams, StxSignTransactionResult>;
907
955
 
908
956
  declare const requestPermissionsMethodName = "wallet_requestPermissions";
909
957
  declare const requestPermissionsParamsSchema: v.UndefinedSchema<undefined>;
@@ -925,6 +973,20 @@ declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
925
973
  readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
926
974
  }, undefined>;
927
975
  type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
976
+ declare const getWalletTypeMethodName = "wallet_getWalletType";
977
+ declare const getWalletTypeParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
978
+ declare const getWalletTypeResultSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
979
+ declare const getWalletTypeRequestMessageSchema: v.ObjectSchema<{
980
+ readonly method: v.LiteralSchema<"wallet_getWalletType", undefined>;
981
+ readonly id: v.StringSchema<undefined>;
982
+ readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
983
+ readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>, v.NullSchema<undefined>], undefined>, never>;
984
+ }, undefined>;
985
+ type GetWalletType = MethodParamsAndResult<v.InferOutput<typeof getWalletTypeParamsSchema>, v.InferOutput<typeof getWalletTypeResultSchema>>;
986
+
987
+ declare const walletTypes: readonly ["software", "ledger"];
988
+ declare const walletTypeSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
989
+ type WalletType = v.InferOutput<typeof walletTypeSchema>;
928
990
 
929
991
  interface StxRequests {
930
992
  stx_callContract: StxCallContract;
@@ -962,15 +1024,16 @@ interface OrdinalsRequests {
962
1024
  ord_getInscriptions: GetInscriptions;
963
1025
  }
964
1026
  type OrdinalsRequestMethod = keyof OrdinalsRequests;
965
- interface WalletMethods {
1027
+ interface WalletRequests {
966
1028
  wallet_requestPermissions: RequestPermissions;
967
1029
  wallet_renouncePermissions: RenouncePermissions;
1030
+ wallet_getWalletType: GetWalletType;
968
1031
  }
969
- type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods & OrdinalsRequests;
1032
+ type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & OrdinalsRequests;
970
1033
  type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
971
1034
  type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
972
1035
 
973
- declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods | "ord_getInscriptions">(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
1036
+ declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | "ord_getInscriptions">(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
974
1037
 
975
1038
  declare abstract class SatsConnectAdapter {
976
1039
  abstract readonly id: string;
@@ -988,10 +1051,10 @@ declare abstract class SatsConnectAdapter {
988
1051
  declare class BaseAdapter extends SatsConnectAdapter {
989
1052
  id: string;
990
1053
  constructor(providerId: string);
991
- requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
1054
+ requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
992
1055
  }
993
1056
 
994
1057
  declare const DefaultAdaptersInfo: Record<string, Provider>;
995
1058
  declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
996
1059
 
997
- export { type Address$1 as Address, AddressPurpose, AddressType, BaseAdapter, type BitcoinNetwork, BitcoinNetworkType, type BitcoinProvider, type BtcRequestMethod, type BtcRequests, type CallContractParams, type CallContractResult, type Capability, type CreateInscriptionOptions, type CreateInscriptionPayload, type CreateInscriptionResponse, type CreateRepeatInscriptionsOptions, type CreateRepeatInscriptionsPayload, type CreateRepeatInscriptionsResponse, DefaultAdaptersInfo, type DeployContractParams, type DeployContractResult, type EstimateRbfOrder, type EstimateRunesEtch, type EstimateRunesEtchParams, type EstimateRunesEtchResult, type EstimateRunesMint, type EstimateRunesMintParams, type EstimateRunesMintResult, type EtchRunes, type EtchRunesParams, type EtchRunesResult, type GetAccounts, type GetAccountsParams, type GetAccountsRequestMessage, type GetAccountsResult, type GetAddressOptions, type GetAddressPayload, type GetAddressResponse, type GetAddresses, type GetAddressesParams, type GetAddressesRequestMessage, type GetAddressesResult, type GetBalance, type GetCapabilitiesOptions, type GetCapabilitiesPayload, type GetCapabilitiesResponse, type GetInfo, type GetInfoParams, type GetInfoRequestMessage, type GetInfoResult, type GetInscriptions, type GetOrder, type GetRunesBalance, type GetRunesBalanceParams, type GetRunesBalanceRequestMessage, type GetRunesBalanceResult, type InputToSign, type MethodParamsAndResult, type MintRunes, type MintRunesParams, type MintRunesResult, type OrdinalsRequestMethod, type OrdinalsRequests, type Params, type Provider, type PsbtPayload, type RbfOrder, type Recipient$2 as Recipient, type RenouncePermissions, type RequestOptions, type RequestPayload, type RequestPermissions, type Requests, type Return, type RpcBase, type RpcError, RpcErrorCode, type RpcErrorResponse, type RpcErrorResponseMessage, type RpcId, RpcIdSchema, type RpcRequest, type RpcRequestMessage, type RpcResponse, type RpcResponseMessage, type RpcResult, type RpcSuccessResponse, type RpcSuccessResponseMessage, type RunesRequestMethod, type RunesRequests, SatsConnectAdapter, type SendBtcTransactionOptions, type SendBtcTransactionPayload, type SendBtcTransactionResponse, type SendTransfer, type SendTransferParams, type SerializedRecipient, type SerializedSendBtcTransactionPayload, type SignMessage, type SignMessageOptions, type SignMessageParams, type SignMessagePayload, type SignMessageRequestMessage, type SignMessageResponse, type SignMessageResult, type SignMultiplePsbtPayload, type SignMultipleTransactionOptions, type SignMultipleTransactionsPayload, type SignMultipleTransactionsResponse, type SignPsbt, type SignPsbtParams, type SignPsbtResult, type SignStructuredMessageResult, type SignStxMessageParams, type SignStxMessageResult, type SignTransactionOptions, type SignTransactionParams, type SignTransactionPayload, type SignTransactionResponse, type SignTransactionResult, type StxCallContract, type StxDeployContract, type StxGetAccounts, type StxGetAccountsResult, type StxGetAddresses, type StxGetAddressesParams, type StxGetAddressesRequestMessage, type StxGetAddressesResult, type StxRequestMethod, type StxRequests, type StxSignStructuredMessage, type StxSignStxMessage, type StxSignTransaction, type StxTransferStx, type SupportedWallet, type TransferStxParams, type TransferStxResult, type WalletMethods, addressSchema, createInscription, createRepeatInscriptions, defaultAdapters, getAccountsMethodName, getAccountsParamsSchema, getAccountsRequestMessageSchema, getAccountsResultSchema, getAddress, getAddressesMethodName, getAddressesParamsSchema, getAddressesRequestMessageSchema, getAddressesResultSchema, getBalanceMethodName, getBalanceParamsSchema, getBalanceRequestMessageSchema, getBalanceResultSchema, getCapabilities, getDefaultProvider, getInfoMethodName, getInfoParamsSchema, getInfoRequestMessageSchema, getInfoResultSchema, getInscriptionsMethodName, getInscriptionsParamsSchema, getInscriptionsResultSchema, getInscriptionsSchema, getProviderById, getProviderOrThrow, getProviders, getRunesBalanceMethodName, getRunesBalanceParamsSchema, getRunesBalanceRequestMessageSchema, getRunesBalanceResultSchema, getSupportedWallets, isProviderInstalled, removeDefaultProvider, renouncePermissionsMethodName, renouncePermissionsParamsSchema, renouncePermissionsRequestMessageSchema, renouncePermissionsResultSchema, request, requestPermissionsMethodName, requestPermissionsParamsSchema, requestPermissionsRequestMessageSchema, requestPermissionsResultSchema, rpcErrorResponseMessageSchema, rpcRequestMessageSchema, rpcResponseMessageSchema, rpcSuccessResponseMessageSchema, sendBtcTransaction, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleTransactions, signTransaction, stxGetAddressesMethodName, stxGetAddressesParamsSchema, stxGetAddressesRequestMessageSchema, stxGetAddressesResultSchema };
1060
+ export { type Address$1 as Address, AddressPurpose, AddressType, BaseAdapter, type BitcoinNetwork, BitcoinNetworkType, type BitcoinProvider, type BtcRequestMethod, type BtcRequests, type CallContractParams, type CallContractResult, type Capability, type CreateInscriptionOptions, type CreateInscriptionPayload, type CreateInscriptionResponse, type CreateRepeatInscriptionsOptions, type CreateRepeatInscriptionsPayload, type CreateRepeatInscriptionsResponse, DefaultAdaptersInfo, type DeployContractParams, type DeployContractResult, type EstimateRbfOrder, type EstimateRunesEtch, type EstimateRunesEtchParams, type EstimateRunesEtchResult, type EstimateRunesMint, type EstimateRunesMintParams, type EstimateRunesMintResult, type EtchRunes, type EtchRunesParams, type EtchRunesResult, type GetAccounts, type GetAccountsParams, type GetAccountsRequestMessage, type GetAccountsResult, type GetAddressOptions, type GetAddressPayload, type GetAddressResponse, type GetAddresses, type GetAddressesParams, type GetAddressesRequestMessage, type GetAddressesResult, type GetBalance, type GetCapabilitiesOptions, type GetCapabilitiesPayload, type GetCapabilitiesResponse, type GetInfo, type GetInfoParams, type GetInfoRequestMessage, type GetInfoResult, type GetInscriptions, type GetOrder, type GetRunesBalance, type GetRunesBalanceParams, type GetRunesBalanceRequestMessage, type GetRunesBalanceResult, type GetWalletType, type InputToSign, type MethodParamsAndResult, type MintRunes, type MintRunesParams, type MintRunesResult, type OrdinalsRequestMethod, type OrdinalsRequests, type Params, type Provider, type PsbtPayload, type RbfOrder, type Recipient$2 as Recipient, type RenouncePermissions, type RequestOptions, type RequestPayload, type RequestPermissions, type Requests, type Return, type RpcBase, type RpcError, RpcErrorCode, type RpcErrorResponse, type RpcErrorResponseMessage, type RpcId, RpcIdSchema, type RpcRequest, type RpcRequestMessage, type RpcResponse, type RpcResponseMessage, type RpcResult, type RpcSuccessResponse, type RpcSuccessResponseMessage, type RunesRequestMethod, type RunesRequests, SatsConnectAdapter, type SendBtcTransactionOptions, type SendBtcTransactionPayload, type SendBtcTransactionResponse, type SendTransfer, type SendTransferParams, type SerializedRecipient, type SerializedSendBtcTransactionPayload, type SignMessage, type SignMessageOptions, type SignMessageParams, type SignMessagePayload, type SignMessageRequestMessage, type SignMessageResponse, type SignMessageResult, type SignMultiplePsbtPayload, type SignMultipleTransactionOptions, type SignMultipleTransactionsPayload, type SignMultipleTransactionsResponse, type SignPsbt, type SignPsbtParams, type SignPsbtResult, type SignStructuredMessageResult, type SignStxMessageParams, type SignStxMessageResult, type SignTransactionOptions, type SignTransactionPayload, type SignTransactionResponse, type StxCallContract, type StxDeployContract, type StxGetAccounts, type StxGetAccountsResult, type StxGetAddresses, type StxGetAddressesParams, type StxGetAddressesRequestMessage, type StxGetAddressesResult, type StxRequestMethod, type StxRequests, type StxSignStructuredMessage, type StxSignStxMessage, type StxSignTransaction, type StxSignTransactionParams, type StxSignTransactionRequestMessage, type StxSignTransactionResult, type StxTransferStx, type SupportedWallet, type TransferStxParams, type TransferStxResult, type WalletRequests, type WalletType, addressSchema, createInscription, createRepeatInscriptions, defaultAdapters, getAccountsMethodName, getAccountsParamsSchema, getAccountsRequestMessageSchema, getAccountsResultSchema, getAddress, getAddressesMethodName, getAddressesParamsSchema, getAddressesRequestMessageSchema, getAddressesResultSchema, getBalanceMethodName, getBalanceParamsSchema, getBalanceRequestMessageSchema, getBalanceResultSchema, getCapabilities, getDefaultProvider, getInfoMethodName, getInfoParamsSchema, getInfoRequestMessageSchema, getInfoResultSchema, getInscriptionsMethodName, getInscriptionsParamsSchema, getInscriptionsResultSchema, getInscriptionsSchema, getProviderById, getProviderOrThrow, getProviders, getRunesBalanceMethodName, getRunesBalanceParamsSchema, getRunesBalanceRequestMessageSchema, getRunesBalanceResultSchema, getSupportedWallets, getWalletTypeMethodName, getWalletTypeParamsSchema, getWalletTypeRequestMessageSchema, getWalletTypeResultSchema, isProviderInstalled, removeDefaultProvider, renouncePermissionsMethodName, renouncePermissionsParamsSchema, renouncePermissionsRequestMessageSchema, renouncePermissionsResultSchema, request, requestPermissionsMethodName, requestPermissionsParamsSchema, requestPermissionsRequestMessageSchema, requestPermissionsResultSchema, rpcErrorResponseMessageSchema, rpcRequestMessageSchema, rpcResponseMessageSchema, rpcSuccessResponseMessageSchema, sendBtcTransaction, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleTransactions, signTransaction, stxGetAddressesMethodName, stxGetAddressesParamsSchema, stxGetAddressesRequestMessageSchema, stxGetAddressesResultSchema, stxSignTransactionMethodName, stxSignTransactionParamsSchema, stxSignTransactionRequestMessageSchema, stxSignTransactionResultSchema, walletTypeSchema, walletTypes };
package/dist/index.mjs CHANGED
@@ -556,7 +556,7 @@ function getSupportedWallets() {
556
556
  }
557
557
 
558
558
  // src/request/index.ts
559
- import * as v8 from "valibot";
559
+ import * as v9 from "valibot";
560
560
 
561
561
  // src/addresses/index.ts
562
562
  import { createUnsecuredToken } from "jsontokens";
@@ -627,215 +627,279 @@ var stxGetAddressesRequestMessageSchema = v3.object({
627
627
  id: v3.string()
628
628
  }).entries
629
629
  });
630
+ var stxSignTransactionMethodName = "stx_signTransaction";
631
+ var stxSignTransactionParamsSchema = v3.object({
632
+ /**
633
+ * The transaction to sign as a hex-encoded string.
634
+ */
635
+ transaction: v3.string(),
636
+ /**
637
+ * The public key to sign the transaction with. The wallet may use any key
638
+ * when not provided.
639
+ */
640
+ pubkey: v3.optional(v3.string()),
641
+ /**
642
+ * Whether to broadcast the transaction after signing. Defaults to `true`.
643
+ */
644
+ broadcast: v3.optional(v3.boolean())
645
+ });
646
+ var stxSignTransactionResultSchema = v3.object({
647
+ /**
648
+ * The signed transaction as a hex-encoded string.
649
+ */
650
+ transaction: v3.string()
651
+ });
652
+ var stxSignTransactionRequestMessageSchema = v3.object({
653
+ ...rpcRequestMessageSchema.entries,
654
+ ...v3.object({
655
+ method: v3.literal(stxSignTransactionMethodName),
656
+ params: stxSignTransactionParamsSchema,
657
+ id: v3.string()
658
+ }).entries
659
+ });
630
660
 
631
661
  // src/request/types/btcMethods.ts
662
+ import * as v5 from "valibot";
663
+
664
+ // src/request/types/common.ts
632
665
  import * as v4 from "valibot";
666
+ var walletTypes = ["software", "ledger"];
667
+ var walletTypeSchema = v4.picklist(walletTypes);
668
+
669
+ // src/request/types/btcMethods.ts
633
670
  var getInfoMethodName = "getInfo";
634
- var getInfoParamsSchema = v4.nullish(v4.null());
635
- var getInfoResultSchema = v4.object({
671
+ var getInfoParamsSchema = v5.nullish(v5.null());
672
+ var getInfoResultSchema = v5.object({
636
673
  /**
637
674
  * Version of the wallet.
638
675
  */
639
- version: v4.string(),
676
+ version: v5.string(),
640
677
  /**
641
678
  * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
642
679
  */
643
- methods: v4.optional(v4.array(v4.string())),
680
+ methods: v5.optional(v5.array(v5.string())),
644
681
  /**
645
682
  * List of WBIP standards supported by the wallet. Not currently used.
646
683
  */
647
- supports: v4.array(v4.string())
684
+ supports: v5.array(v5.string())
648
685
  });
649
- var getInfoRequestMessageSchema = v4.object({
686
+ var getInfoRequestMessageSchema = v5.object({
650
687
  ...rpcRequestMessageSchema.entries,
651
- ...v4.object({
652
- method: v4.literal(getInfoMethodName),
688
+ ...v5.object({
689
+ method: v5.literal(getInfoMethodName),
653
690
  params: getInfoParamsSchema,
654
- id: v4.string()
691
+ id: v5.string()
655
692
  }).entries
656
693
  });
657
694
  var getAddressesMethodName = "getAddresses";
658
- var getAddressesParamsSchema = v4.object({
695
+ var getAddressesParamsSchema = v5.object({
659
696
  /**
660
697
  * The purposes for which to generate addresses. See
661
698
  * {@linkcode AddressPurpose} for available purposes.
662
699
  */
663
- purposes: v4.array(v4.enum(AddressPurpose)),
700
+ purposes: v5.array(v5.enum(AddressPurpose)),
664
701
  /**
665
702
  * A message to be displayed to the user in the request prompt.
666
703
  */
667
- message: v4.optional(v4.string())
704
+ message: v5.optional(v5.string())
668
705
  });
669
- var getAddressesResultSchema = v4.object({
706
+ var getAddressesResultSchema = v5.object({
670
707
  /**
671
708
  * The addresses generated for the given purposes.
672
709
  */
673
- addresses: v4.array(addressSchema)
710
+ addresses: v5.array(addressSchema)
674
711
  });
675
- var getAddressesRequestMessageSchema = v4.object({
712
+ var getAddressesRequestMessageSchema = v5.object({
676
713
  ...rpcRequestMessageSchema.entries,
677
- ...v4.object({
678
- method: v4.literal(getAddressesMethodName),
714
+ ...v5.object({
715
+ method: v5.literal(getAddressesMethodName),
679
716
  params: getAddressesParamsSchema,
680
- id: v4.string()
717
+ id: v5.string()
681
718
  }).entries
682
719
  });
683
720
  var signMessageMethodName = "signMessage";
684
- var signMessageParamsSchema = v4.object({
721
+ var signMessageParamsSchema = v5.object({
685
722
  /**
686
723
  * The address used for signing.
687
724
  **/
688
- address: v4.string(),
725
+ address: v5.string(),
689
726
  /**
690
727
  * The message to sign.
691
728
  **/
692
- message: v4.string()
729
+ message: v5.string()
693
730
  });
694
- var signMessageResultSchema = v4.object({
731
+ var signMessageResultSchema = v5.object({
695
732
  /**
696
733
  * The signature of the message.
697
734
  */
698
- signature: v4.string(),
735
+ signature: v5.string(),
699
736
  /**
700
737
  * hash of the message.
701
738
  */
702
- messageHash: v4.string(),
739
+ messageHash: v5.string(),
703
740
  /**
704
741
  * The address used for signing.
705
742
  */
706
- address: v4.string()
743
+ address: v5.string()
707
744
  });
708
- var signMessageRequestMessageSchema = v4.object({
745
+ var signMessageRequestMessageSchema = v5.object({
709
746
  ...rpcRequestMessageSchema.entries,
710
- ...v4.object({
711
- method: v4.literal(signMessageMethodName),
747
+ ...v5.object({
748
+ method: v5.literal(signMessageMethodName),
712
749
  params: signMessageParamsSchema,
713
- id: v4.string()
750
+ id: v5.string()
714
751
  }).entries
715
752
  });
716
753
  var getAccountsMethodName = "getAccounts";
717
- var getAccountsParamsSchema = getAddressesParamsSchema;
718
- var getAccountsResultSchema = v4.array(addressSchema);
719
- var getAccountsRequestMessageSchema = v4.object({
754
+ var getAccountsParamsSchema = v5.object({
755
+ /**
756
+ * The purposes for which to generate addresses. See
757
+ * {@linkcode AddressPurpose} for available purposes.
758
+ */
759
+ purposes: v5.array(v5.enum(AddressPurpose)),
760
+ /**
761
+ * A message to be displayed to the user in the request prompt.
762
+ */
763
+ message: v5.optional(v5.string())
764
+ });
765
+ var getAccountsResultSchema = v5.array(
766
+ v5.object({
767
+ ...addressSchema.entries,
768
+ ...v5.object({
769
+ walletType: walletTypeSchema
770
+ }).entries
771
+ })
772
+ );
773
+ var getAccountsRequestMessageSchema = v5.object({
720
774
  ...rpcRequestMessageSchema.entries,
721
- ...v4.object({
722
- method: v4.literal(getAccountsMethodName),
775
+ ...v5.object({
776
+ method: v5.literal(getAccountsMethodName),
723
777
  params: getAccountsParamsSchema,
724
- id: v4.string()
778
+ id: v5.string()
725
779
  }).entries
726
780
  });
727
781
  var getBalanceMethodName = "getBalance";
728
- var getBalanceParamsSchema = v4.nullish(v4.null());
729
- var getBalanceResultSchema = v4.object({
782
+ var getBalanceParamsSchema = v5.nullish(v5.null());
783
+ var getBalanceResultSchema = v5.object({
730
784
  /**
731
785
  * The confirmed balance of the wallet in sats. Using a string due to chrome
732
786
  * messages not supporting bigint
733
787
  * (https://issues.chromium.org/issues/40116184).
734
788
  */
735
- confirmed: v4.string(),
789
+ confirmed: v5.string(),
736
790
  /**
737
791
  * The unconfirmed balance of the wallet in sats. Using a string due to chrome
738
792
  * messages not supporting bigint
739
793
  * (https://issues.chromium.org/issues/40116184).
740
794
  */
741
- unconfirmed: v4.string(),
795
+ unconfirmed: v5.string(),
742
796
  /**
743
797
  * The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
744
798
  * sats. Using a string due to chrome messages not supporting bigint
745
799
  * (https://issues.chromium.org/issues/40116184).
746
800
  */
747
- total: v4.string()
801
+ total: v5.string()
748
802
  });
749
- var getBalanceRequestMessageSchema = v4.object({
803
+ var getBalanceRequestMessageSchema = v5.object({
750
804
  ...rpcRequestMessageSchema.entries,
751
- ...v4.object({
752
- method: v4.literal(getBalanceMethodName),
753
- id: v4.string()
805
+ ...v5.object({
806
+ method: v5.literal(getBalanceMethodName),
807
+ id: v5.string()
754
808
  }).entries
755
809
  });
756
810
 
757
811
  // src/request/types/walletMethods.ts
758
- import * as v5 from "valibot";
812
+ import * as v6 from "valibot";
759
813
  var requestPermissionsMethodName = "wallet_requestPermissions";
760
- var requestPermissionsParamsSchema = v5.undefined();
761
- var requestPermissionsResultSchema = v5.literal(true);
762
- var requestPermissionsRequestMessageSchema = v5.object({
814
+ var requestPermissionsParamsSchema = v6.undefined();
815
+ var requestPermissionsResultSchema = v6.literal(true);
816
+ var requestPermissionsRequestMessageSchema = v6.object({
763
817
  ...rpcRequestMessageSchema.entries,
764
- ...v5.object({
765
- method: v5.literal(requestPermissionsMethodName),
818
+ ...v6.object({
819
+ method: v6.literal(requestPermissionsMethodName),
766
820
  params: requestPermissionsParamsSchema,
767
- id: v5.string()
821
+ id: v6.string()
768
822
  }).entries
769
823
  });
770
824
  var renouncePermissionsMethodName = "wallet_renouncePermissions";
771
- var renouncePermissionsParamsSchema = v5.undefined();
772
- var renouncePermissionsResultSchema = v5.literal(true);
773
- var renouncePermissionsRequestMessageSchema = v5.object({
825
+ var renouncePermissionsParamsSchema = v6.undefined();
826
+ var renouncePermissionsResultSchema = v6.literal(true);
827
+ var renouncePermissionsRequestMessageSchema = v6.object({
774
828
  ...rpcRequestMessageSchema.entries,
775
- ...v5.object({
776
- method: v5.literal(renouncePermissionsMethodName),
829
+ ...v6.object({
830
+ method: v6.literal(renouncePermissionsMethodName),
777
831
  params: renouncePermissionsParamsSchema,
778
- id: v5.string()
832
+ id: v6.string()
833
+ }).entries
834
+ });
835
+ var getWalletTypeMethodName = "wallet_getWalletType";
836
+ var getWalletTypeParamsSchema = v6.nullish(v6.null());
837
+ var getWalletTypeResultSchema = walletTypeSchema;
838
+ var getWalletTypeRequestMessageSchema = v6.object({
839
+ ...rpcRequestMessageSchema.entries,
840
+ ...v6.object({
841
+ method: v6.literal(getWalletTypeMethodName),
842
+ id: v6.string()
779
843
  }).entries
780
844
  });
781
845
 
782
846
  // src/request/types/runesMethods.ts
783
- import * as v6 from "valibot";
847
+ import * as v7 from "valibot";
784
848
  var getRunesBalanceMethodName = "runes_getBalance";
785
- var getRunesBalanceParamsSchema = v6.nullish(v6.null());
786
- var getRunesBalanceResultSchema = v6.object({
787
- balances: v6.array(
788
- v6.object({
789
- runeName: v6.string(),
790
- amount: v6.string(),
791
- divisibility: v6.number(),
792
- symbol: v6.string(),
793
- inscriptionId: v6.nullish(v6.string())
849
+ var getRunesBalanceParamsSchema = v7.nullish(v7.null());
850
+ var getRunesBalanceResultSchema = v7.object({
851
+ balances: v7.array(
852
+ v7.object({
853
+ runeName: v7.string(),
854
+ amount: v7.string(),
855
+ divisibility: v7.number(),
856
+ symbol: v7.string(),
857
+ inscriptionId: v7.nullish(v7.string())
794
858
  })
795
859
  )
796
860
  });
797
- var getRunesBalanceRequestMessageSchema = v6.object({
861
+ var getRunesBalanceRequestMessageSchema = v7.object({
798
862
  ...rpcRequestMessageSchema.entries,
799
- ...v6.object({
800
- method: v6.literal(getRunesBalanceMethodName),
863
+ ...v7.object({
864
+ method: v7.literal(getRunesBalanceMethodName),
801
865
  params: getRunesBalanceParamsSchema,
802
- id: v6.string()
866
+ id: v7.string()
803
867
  }).entries
804
868
  });
805
869
 
806
870
  // src/request/types/ordinalsMethods.ts
807
- import * as v7 from "valibot";
871
+ import * as v8 from "valibot";
808
872
  var getInscriptionsMethodName = "ord_getInscriptions";
809
- var getInscriptionsParamsSchema = v7.object({
810
- offset: v7.number(),
811
- limit: v7.number()
873
+ var getInscriptionsParamsSchema = v8.object({
874
+ offset: v8.number(),
875
+ limit: v8.number()
812
876
  });
813
- var getInscriptionsResultSchema = v7.object({
814
- total: v7.number(),
815
- limit: v7.number(),
816
- offset: v7.number(),
817
- inscriptions: v7.array(
818
- v7.object({
819
- inscriptionId: v7.string(),
820
- inscriptionNumber: v7.string(),
821
- address: v7.string(),
822
- collectionName: v7.optional(v7.string()),
823
- postage: v7.string(),
824
- contentLength: v7.string(),
825
- contentType: v7.string(),
826
- timestamp: v7.number(),
827
- offset: v7.number(),
828
- genesisTransaction: v7.string(),
829
- output: v7.string()
877
+ var getInscriptionsResultSchema = v8.object({
878
+ total: v8.number(),
879
+ limit: v8.number(),
880
+ offset: v8.number(),
881
+ inscriptions: v8.array(
882
+ v8.object({
883
+ inscriptionId: v8.string(),
884
+ inscriptionNumber: v8.string(),
885
+ address: v8.string(),
886
+ collectionName: v8.optional(v8.string()),
887
+ postage: v8.string(),
888
+ contentLength: v8.string(),
889
+ contentType: v8.string(),
890
+ timestamp: v8.number(),
891
+ offset: v8.number(),
892
+ genesisTransaction: v8.string(),
893
+ output: v8.string()
830
894
  })
831
895
  )
832
896
  });
833
- var getInscriptionsSchema = v7.object({
897
+ var getInscriptionsSchema = v8.object({
834
898
  ...rpcRequestMessageSchema.entries,
835
- ...v7.object({
836
- method: v7.literal(getInscriptionsMethodName),
899
+ ...v8.object({
900
+ method: v8.literal(getInscriptionsMethodName),
837
901
  params: getInscriptionsParamsSchema,
838
- id: v7.string()
902
+ id: v8.string()
839
903
  }).entries
840
904
  });
841
905
 
@@ -852,13 +916,13 @@ var request = async (method, params, providerId) => {
852
916
  throw new Error("A wallet method is required");
853
917
  }
854
918
  const response = await provider.request(method, params);
855
- if (v8.is(rpcErrorResponseMessageSchema, response)) {
919
+ if (v9.is(rpcErrorResponseMessageSchema, response)) {
856
920
  return {
857
921
  status: "error",
858
922
  error: response.error
859
923
  };
860
924
  }
861
- if (v8.is(rpcSuccessResponseMessageSchema, response)) {
925
+ if (v9.is(rpcSuccessResponseMessageSchema, response)) {
862
926
  return {
863
927
  status: "success",
864
928
  result: response.result
@@ -1325,6 +1389,10 @@ export {
1325
1389
  getRunesBalanceRequestMessageSchema,
1326
1390
  getRunesBalanceResultSchema,
1327
1391
  getSupportedWallets,
1392
+ getWalletTypeMethodName,
1393
+ getWalletTypeParamsSchema,
1394
+ getWalletTypeRequestMessageSchema,
1395
+ getWalletTypeResultSchema,
1328
1396
  isProviderInstalled,
1329
1397
  removeDefaultProvider,
1330
1398
  renouncePermissionsMethodName,
@@ -1352,5 +1420,11 @@ export {
1352
1420
  stxGetAddressesMethodName,
1353
1421
  stxGetAddressesParamsSchema,
1354
1422
  stxGetAddressesRequestMessageSchema,
1355
- stxGetAddressesResultSchema
1423
+ stxGetAddressesResultSchema,
1424
+ stxSignTransactionMethodName,
1425
+ stxSignTransactionParamsSchema,
1426
+ stxSignTransactionRequestMessageSchema,
1427
+ stxSignTransactionResultSchema,
1428
+ walletTypeSchema,
1429
+ walletTypes
1356
1430
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sats-connect/core",
3
- "version": "0.0.15",
3
+ "version": "0.1.0-6ee3e3f",
4
4
  "main": "dist/index.mjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",