@sats-connect/core 0.1.2-7cad6d5 → 0.1.2-b66f8be

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
@@ -94,6 +94,25 @@ declare const signTransaction: (options: SignTransactionOptions) => Promise<void
94
94
 
95
95
  declare const signMultipleTransactions: (options: SignMultipleTransactionOptions) => Promise<void>;
96
96
 
97
+ declare const accountChangeEventName = "accountChange";
98
+ declare const accountChangeSchema: v.ObjectSchema<{
99
+ readonly type: v.LiteralSchema<"accountChange", undefined>;
100
+ }, undefined>;
101
+ type AccountChangeEvent = v.InferOutput<typeof accountChangeSchema>;
102
+ declare const networkChangeEventName = "networkChange";
103
+ declare const networkChangeSchema: v.ObjectSchema<{
104
+ readonly type: v.LiteralSchema<"networkChange", undefined>;
105
+ }, undefined>;
106
+ type NetworkChangeEvent = v.InferOutput<typeof networkChangeSchema>;
107
+ declare const walletEventSchema: v.VariantSchema<"type", [v.ObjectSchema<{
108
+ readonly type: v.LiteralSchema<"accountChange", undefined>;
109
+ }, undefined>, v.ObjectSchema<{
110
+ readonly type: v.LiteralSchema<"networkChange", undefined>;
111
+ }, undefined>], undefined>;
112
+ type WalletEvent = v.InferOutput<typeof walletEventSchema>;
113
+ type AddListener = <const WalletEventName extends WalletEvent['type']>(eventName: WalletEventName, cb: (event: Extract<WalletEvent, {
114
+ type: WalletEventName;
115
+ }>) => void) => () => void;
97
116
  interface BaseBitcoinProvider {
98
117
  request: <Method extends keyof Requests>(method: Method, options: Params<Method>, providerId?: string) => Promise<RpcResponse<Method>>;
99
118
  connect: (request: string) => Promise<GetAddressResponse>;
@@ -103,6 +122,7 @@ interface BaseBitcoinProvider {
103
122
  createInscription: (request: string) => Promise<CreateInscriptionResponse>;
104
123
  createRepeatInscriptions: (request: string) => Promise<CreateRepeatInscriptionsResponse>;
105
124
  signMultipleTransactions: (request: string) => Promise<SignMultipleTransactionsResponse>;
125
+ addListener: AddListener;
106
126
  }
107
127
  type Capability = keyof BaseBitcoinProvider;
108
128
  interface BitcoinProvider extends BaseBitcoinProvider {
@@ -740,33 +760,6 @@ declare const getRunesBalanceRequestMessageSchema: v.ObjectSchema<{
740
760
  }, undefined>;
741
761
  type GetRunesBalanceRequestMessage = v.InferOutput<typeof getRunesBalanceRequestMessageSchema>;
742
762
  type GetRunesBalance = MethodParamsAndResult<v.InferOutput<typeof getRunesBalanceParamsSchema>, v.InferOutput<typeof getRunesBalanceResultSchema>>;
743
- declare const transferRunesMethodName = "runes_transfer";
744
- declare const transferRunesParamsSchema: v.ObjectSchema<{
745
- readonly recipients: v.ArraySchema<v.ObjectSchema<{
746
- readonly runeName: v.StringSchema<undefined>;
747
- readonly amount: v.StringSchema<undefined>;
748
- readonly address: v.StringSchema<undefined>;
749
- }, undefined>, undefined>;
750
- }, undefined>;
751
- type TransferRunesParams = v.InferOutput<typeof transferRunesParamsSchema>;
752
- declare const transferRunesRequestSchema: v.ObjectSchema<{
753
- readonly method: v.LiteralSchema<"runes_transfer", undefined>;
754
- readonly params: v.ObjectSchema<{
755
- readonly recipients: v.ArraySchema<v.ObjectSchema<{
756
- readonly runeName: v.StringSchema<undefined>;
757
- readonly amount: v.StringSchema<undefined>;
758
- readonly address: v.StringSchema<undefined>;
759
- }, undefined>, undefined>;
760
- }, undefined>;
761
- readonly id: v.StringSchema<undefined>;
762
- readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
763
- }, undefined>;
764
- type TransferRunesRequest = v.InferOutput<typeof transferRunesRequestSchema>;
765
- declare const TransferRunesResultSchema: v.ObjectSchema<{
766
- readonly txid: v.StringSchema<undefined>;
767
- }, undefined>;
768
- type TransferRunesResult = v.InferOutput<typeof TransferRunesResultSchema>;
769
- type TransferRunes = MethodParamsAndResult<TransferRunesParams, TransferRunesResult>;
770
763
 
771
764
  interface Pubkey {
772
765
  /**
@@ -1084,7 +1077,6 @@ interface RunesRequests {
1084
1077
  runes_estimateRbfOrder: EstimateRbfOrder;
1085
1078
  runes_rbfOrder: RbfOrder;
1086
1079
  runes_getBalance: GetRunesBalance;
1087
- runes_transfer: TransferRunes;
1088
1080
  }
1089
1081
  type RunesRequestMethod = keyof RunesRequests;
1090
1082
  interface OrdinalsRequests {
@@ -1102,6 +1094,7 @@ type Return<Method> = Method extends keyof Requests ? Requests[Method]['result']
1102
1094
  type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
1103
1095
 
1104
1096
  declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | keyof OrdinalsRequests>(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
1097
+ declare const addListener: (event: Parameters<AddListener>[0], cb: Parameters<AddListener>[1], providerId?: string) => ReturnType<AddListener>;
1105
1098
 
1106
1099
  declare abstract class SatsConnectAdapter {
1107
1100
  abstract readonly id: string;
@@ -1113,6 +1106,7 @@ declare abstract class SatsConnectAdapter {
1113
1106
  private estimateRbfOrder;
1114
1107
  private rbfOrder;
1115
1108
  request<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method>>;
1109
+ abstract addListener: AddListener;
1116
1110
  protected abstract requestInternal<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method>>;
1117
1111
  }
1118
1112
 
@@ -1120,9 +1114,10 @@ declare class BaseAdapter extends SatsConnectAdapter {
1120
1114
  id: string;
1121
1115
  constructor(providerId: string);
1122
1116
  requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | keyof OrdinalsRequests>(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
1117
+ addListener: AddListener;
1123
1118
  }
1124
1119
 
1125
1120
  declare const DefaultAdaptersInfo: Record<string, Provider>;
1126
1121
  declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
1127
1122
 
1128
- 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, MessageSigningProtocols, 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 SendInscriptions, 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, type TransferRunesParams, type TransferRunesRequest, 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, sendInscriptionsMethodName, sendInscriptionsParamsSchema, sendInscriptionsResultSchema, sendInscriptionsSchema, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleTransactions, signTransaction, stxGetAddressesMethodName, stxGetAddressesParamsSchema, stxGetAddressesRequestMessageSchema, stxGetAddressesResultSchema, stxSignTransactionMethodName, stxSignTransactionParamsSchema, stxSignTransactionRequestMessageSchema, stxSignTransactionResultSchema, transferRunesMethodName, transferRunesParamsSchema, transferRunesRequestSchema, walletTypeSchema, walletTypes };
1123
+ export { type AccountChangeEvent, type AddListener, 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, MessageSigningProtocols, type MethodParamsAndResult, type MintRunes, type MintRunesParams, type MintRunesResult, type NetworkChangeEvent, 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 SendInscriptions, 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 WalletEvent, type WalletRequests, type WalletType, accountChangeEventName, accountChangeSchema, addListener, 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, networkChangeEventName, networkChangeSchema, removeDefaultProvider, renouncePermissionsMethodName, renouncePermissionsParamsSchema, renouncePermissionsRequestMessageSchema, renouncePermissionsResultSchema, request, requestPermissionsMethodName, requestPermissionsParamsSchema, requestPermissionsRequestMessageSchema, requestPermissionsResultSchema, rpcErrorResponseMessageSchema, rpcRequestMessageSchema, rpcResponseMessageSchema, rpcSuccessResponseMessageSchema, sendBtcTransaction, sendInscriptionsMethodName, sendInscriptionsParamsSchema, sendInscriptionsResultSchema, sendInscriptionsSchema, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleTransactions, signTransaction, stxGetAddressesMethodName, stxGetAddressesParamsSchema, stxGetAddressesRequestMessageSchema, stxGetAddressesResultSchema, stxSignTransactionMethodName, stxSignTransactionParamsSchema, stxSignTransactionRequestMessageSchema, stxSignTransactionResultSchema, walletEventSchema, walletTypeSchema, walletTypes };