@sats-connect/core 0.0.15 → 0.1.0-695c201

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>;
@@ -696,6 +701,25 @@ declare const getRunesBalanceRequestMessageSchema: v.ObjectSchema<{
696
701
  }, undefined>;
697
702
  type GetRunesBalanceRequestMessage = v.InferOutput<typeof getRunesBalanceRequestMessageSchema>;
698
703
  type GetRunesBalance = MethodParamsAndResult<v.InferOutput<typeof getRunesBalanceParamsSchema>, v.InferOutput<typeof getRunesBalanceResultSchema>>;
704
+ declare const RuneTransferRecipientsSchema: v.ArraySchema<v.ObjectSchema<{
705
+ readonly runeName: v.StringSchema<undefined>;
706
+ readonly amount: v.StringSchema<undefined>;
707
+ readonly address: v.StringSchema<undefined>;
708
+ }, undefined>, undefined>;
709
+ declare const TransferRunesMethodName = "runes_transfer";
710
+ declare const TransferRunesParamsSchema: v.ObjectSchema<{
711
+ readonly recipients: v.ArraySchema<v.ObjectSchema<{
712
+ readonly runeName: v.StringSchema<undefined>;
713
+ readonly amount: v.StringSchema<undefined>;
714
+ readonly address: v.StringSchema<undefined>;
715
+ }, undefined>, undefined>;
716
+ }, undefined>;
717
+ type TransferRunesParams = v.InferOutput<typeof TransferRunesParamsSchema>;
718
+ declare const TransferRunesResultSchema: v.ObjectSchema<{
719
+ readonly txid: v.StringSchema<undefined>;
720
+ }, undefined>;
721
+ type TransferRunesResult = v.InferOutput<typeof TransferRunesResultSchema>;
722
+ type TransferRunes = MethodParamsAndResult<TransferRunesParams, TransferRunesResult>;
699
723
 
700
724
  interface Pubkey {
701
725
  /**
@@ -901,9 +925,52 @@ declare const stxGetAddressesRequestMessageSchema: v.ObjectSchema<{
901
925
  }, undefined>;
902
926
  type StxGetAddressesRequestMessage = v.InferOutput<typeof stxGetAddressesRequestMessageSchema>;
903
927
  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>;
928
+ declare const stxSignTransactionMethodName = "stx_signTransaction";
929
+ declare const stxSignTransactionParamsSchema: v.ObjectSchema<{
930
+ /**
931
+ * The transaction to sign as a hex-encoded string.
932
+ */
933
+ readonly transaction: v.StringSchema<undefined>;
934
+ /**
935
+ * The public key to sign the transaction with. The wallet may use any key
936
+ * when not provided.
937
+ */
938
+ readonly pubkey: v.OptionalSchema<v.StringSchema<undefined>, never>;
939
+ /**
940
+ * Whether to broadcast the transaction after signing. Defaults to `true`.
941
+ */
942
+ readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
943
+ }, undefined>;
944
+ type StxSignTransactionParams = v.InferOutput<typeof stxSignTransactionParamsSchema>;
945
+ declare const stxSignTransactionResultSchema: v.ObjectSchema<{
946
+ /**
947
+ * The signed transaction as a hex-encoded string.
948
+ */
949
+ readonly transaction: v.StringSchema<undefined>;
950
+ }, undefined>;
951
+ type StxSignTransactionResult = v.InferOutput<typeof stxSignTransactionResultSchema>;
952
+ declare const stxSignTransactionRequestMessageSchema: v.ObjectSchema<{
953
+ readonly method: v.LiteralSchema<"stx_signTransaction", undefined>;
954
+ readonly params: v.ObjectSchema<{
955
+ /**
956
+ * The transaction to sign as a hex-encoded string.
957
+ */
958
+ readonly transaction: v.StringSchema<undefined>;
959
+ /**
960
+ * The public key to sign the transaction with. The wallet may use any key
961
+ * when not provided.
962
+ */
963
+ readonly pubkey: v.OptionalSchema<v.StringSchema<undefined>, never>;
964
+ /**
965
+ * Whether to broadcast the transaction after signing. Defaults to `true`.
966
+ */
967
+ readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
968
+ }, undefined>;
969
+ readonly id: v.StringSchema<undefined>;
970
+ readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
971
+ }, undefined>;
972
+ type StxSignTransactionRequestMessage = v.InferOutput<typeof stxSignTransactionRequestMessageSchema>;
973
+ type StxSignTransaction = MethodParamsAndResult<StxSignTransactionParams, StxSignTransactionResult>;
907
974
 
908
975
  declare const requestPermissionsMethodName = "wallet_requestPermissions";
909
976
  declare const requestPermissionsParamsSchema: v.UndefinedSchema<undefined>;
@@ -925,6 +992,20 @@ declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
925
992
  readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
926
993
  }, undefined>;
927
994
  type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
995
+ declare const getWalletTypeMethodName = "wallet_getWalletType";
996
+ declare const getWalletTypeParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
997
+ declare const getWalletTypeResultSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
998
+ declare const getWalletTypeRequestMessageSchema: v.ObjectSchema<{
999
+ readonly method: v.LiteralSchema<"wallet_getWalletType", undefined>;
1000
+ readonly id: v.StringSchema<undefined>;
1001
+ readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
1002
+ readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>, v.NullSchema<undefined>], undefined>, never>;
1003
+ }, undefined>;
1004
+ type GetWalletType = MethodParamsAndResult<v.InferOutput<typeof getWalletTypeParamsSchema>, v.InferOutput<typeof getWalletTypeResultSchema>>;
1005
+
1006
+ declare const walletTypes: readonly ["software", "ledger"];
1007
+ declare const walletTypeSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
1008
+ type WalletType = v.InferOutput<typeof walletTypeSchema>;
928
1009
 
929
1010
  interface StxRequests {
930
1011
  stx_callContract: StxCallContract;
@@ -956,21 +1037,23 @@ interface RunesRequests {
956
1037
  runes_estimateRbfOrder: EstimateRbfOrder;
957
1038
  runes_rbfOrder: RbfOrder;
958
1039
  runes_getBalance: GetRunesBalance;
1040
+ runes_transfer: TransferRunes;
959
1041
  }
960
1042
  type RunesRequestMethod = keyof RunesRequests;
961
1043
  interface OrdinalsRequests {
962
1044
  ord_getInscriptions: GetInscriptions;
963
1045
  }
964
1046
  type OrdinalsRequestMethod = keyof OrdinalsRequests;
965
- interface WalletMethods {
1047
+ interface WalletRequests {
966
1048
  wallet_requestPermissions: RequestPermissions;
967
1049
  wallet_renouncePermissions: RenouncePermissions;
1050
+ wallet_getWalletType: GetWalletType;
968
1051
  }
969
- type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods & OrdinalsRequests;
1052
+ type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & OrdinalsRequests;
970
1053
  type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
971
1054
  type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
972
1055
 
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>>;
1056
+ 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
1057
 
975
1058
  declare abstract class SatsConnectAdapter {
976
1059
  abstract readonly id: string;
@@ -988,10 +1071,10 @@ declare abstract class SatsConnectAdapter {
988
1071
  declare class BaseAdapter extends SatsConnectAdapter {
989
1072
  id: string;
990
1073
  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>>;
1074
+ requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
992
1075
  }
993
1076
 
994
1077
  declare const DefaultAdaptersInfo: Record<string, Provider>;
995
1078
  declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
996
1079
 
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 };
1080
+ 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, RuneTransferRecipientsSchema, 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 TransferRunes, TransferRunesMethodName, type TransferRunesParams, TransferRunesParamsSchema, type TransferRunesResult, TransferRunesResultSchema, 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,293 @@ 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
  });
869
+ var RuneTransferRecipientsSchema = v7.array(
870
+ v7.object({
871
+ runeName: v7.string(),
872
+ amount: v7.string(),
873
+ address: v7.string()
874
+ })
875
+ );
876
+ var TransferRunesMethodName = "runes_transfer";
877
+ var TransferRunesParamsSchema = v7.object({
878
+ recipients: RuneTransferRecipientsSchema
879
+ });
880
+ var TransferRunesResultSchema = v7.object({
881
+ txid: v7.string()
882
+ });
805
883
 
806
884
  // src/request/types/ordinalsMethods.ts
807
- import * as v7 from "valibot";
885
+ import * as v8 from "valibot";
808
886
  var getInscriptionsMethodName = "ord_getInscriptions";
809
- var getInscriptionsParamsSchema = v7.object({
810
- offset: v7.number(),
811
- limit: v7.number()
887
+ var getInscriptionsParamsSchema = v8.object({
888
+ offset: v8.number(),
889
+ limit: v8.number()
812
890
  });
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()
891
+ var getInscriptionsResultSchema = v8.object({
892
+ total: v8.number(),
893
+ limit: v8.number(),
894
+ offset: v8.number(),
895
+ inscriptions: v8.array(
896
+ v8.object({
897
+ inscriptionId: v8.string(),
898
+ inscriptionNumber: v8.string(),
899
+ address: v8.string(),
900
+ collectionName: v8.optional(v8.string()),
901
+ postage: v8.string(),
902
+ contentLength: v8.string(),
903
+ contentType: v8.string(),
904
+ timestamp: v8.number(),
905
+ offset: v8.number(),
906
+ genesisTransaction: v8.string(),
907
+ output: v8.string()
830
908
  })
831
909
  )
832
910
  });
833
- var getInscriptionsSchema = v7.object({
911
+ var getInscriptionsSchema = v8.object({
834
912
  ...rpcRequestMessageSchema.entries,
835
- ...v7.object({
836
- method: v7.literal(getInscriptionsMethodName),
913
+ ...v8.object({
914
+ method: v8.literal(getInscriptionsMethodName),
837
915
  params: getInscriptionsParamsSchema,
838
- id: v7.string()
916
+ id: v8.string()
839
917
  }).entries
840
918
  });
841
919
 
@@ -852,13 +930,13 @@ var request = async (method, params, providerId) => {
852
930
  throw new Error("A wallet method is required");
853
931
  }
854
932
  const response = await provider.request(method, params);
855
- if (v8.is(rpcErrorResponseMessageSchema, response)) {
933
+ if (v9.is(rpcErrorResponseMessageSchema, response)) {
856
934
  return {
857
935
  status: "error",
858
936
  error: response.error
859
937
  };
860
938
  }
861
- if (v8.is(rpcSuccessResponseMessageSchema, response)) {
939
+ if (v9.is(rpcSuccessResponseMessageSchema, response)) {
862
940
  return {
863
941
  status: "success",
864
942
  result: response.result
@@ -1289,7 +1367,11 @@ export {
1289
1367
  DefaultAdaptersInfo,
1290
1368
  RpcErrorCode,
1291
1369
  RpcIdSchema,
1370
+ RuneTransferRecipientsSchema,
1292
1371
  SatsConnectAdapter,
1372
+ TransferRunesMethodName,
1373
+ TransferRunesParamsSchema,
1374
+ TransferRunesResultSchema,
1293
1375
  addressSchema,
1294
1376
  createInscription,
1295
1377
  createRepeatInscriptions,
@@ -1325,6 +1407,10 @@ export {
1325
1407
  getRunesBalanceRequestMessageSchema,
1326
1408
  getRunesBalanceResultSchema,
1327
1409
  getSupportedWallets,
1410
+ getWalletTypeMethodName,
1411
+ getWalletTypeParamsSchema,
1412
+ getWalletTypeRequestMessageSchema,
1413
+ getWalletTypeResultSchema,
1328
1414
  isProviderInstalled,
1329
1415
  removeDefaultProvider,
1330
1416
  renouncePermissionsMethodName,
@@ -1352,5 +1438,11 @@ export {
1352
1438
  stxGetAddressesMethodName,
1353
1439
  stxGetAddressesParamsSchema,
1354
1440
  stxGetAddressesRequestMessageSchema,
1355
- stxGetAddressesResultSchema
1441
+ stxGetAddressesResultSchema,
1442
+ stxSignTransactionMethodName,
1443
+ stxSignTransactionParamsSchema,
1444
+ stxSignTransactionRequestMessageSchema,
1445
+ stxSignTransactionResultSchema,
1446
+ walletTypeSchema,
1447
+ walletTypes
1356
1448
  };
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-695c201",
4
4
  "main": "dist/index.mjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",