@sats-connect/core 0.1.2-3c27b78 → 0.1.2-515ef3b
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 +66 -3
- package/dist/index.mjs +793 -712
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ declare const createRepeatInscriptions: (options: CreateRepeatInscriptionsOption
|
|
|
35
35
|
interface SignMessagePayload extends RequestPayload {
|
|
36
36
|
address: string;
|
|
37
37
|
message: string;
|
|
38
|
+
protocol?: MessageSigningProtocols;
|
|
38
39
|
}
|
|
39
40
|
type SignMessageResponse = string;
|
|
40
41
|
type SignMessageOptions = RequestOptions<SignMessagePayload, SignMessageResponse>;
|
|
@@ -93,6 +94,25 @@ declare const signTransaction: (options: SignTransactionOptions) => Promise<void
|
|
|
93
94
|
|
|
94
95
|
declare const signMultipleTransactions: (options: SignMultipleTransactionOptions) => Promise<void>;
|
|
95
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;
|
|
96
116
|
interface BaseBitcoinProvider {
|
|
97
117
|
request: <Method extends keyof Requests>(method: Method, options: Params<Method>, providerId?: string) => Promise<RpcResponse<Method>>;
|
|
98
118
|
connect: (request: string) => Promise<GetAddressResponse>;
|
|
@@ -102,6 +122,7 @@ interface BaseBitcoinProvider {
|
|
|
102
122
|
createInscription: (request: string) => Promise<CreateInscriptionResponse>;
|
|
103
123
|
createRepeatInscriptions: (request: string) => Promise<CreateRepeatInscriptionsResponse>;
|
|
104
124
|
signMultipleTransactions: (request: string) => Promise<SignMultipleTransactionsResponse>;
|
|
125
|
+
addListener: AddListener;
|
|
105
126
|
}
|
|
106
127
|
type Capability = keyof BaseBitcoinProvider;
|
|
107
128
|
interface BitcoinProvider extends BaseBitcoinProvider {
|
|
@@ -365,6 +386,10 @@ declare const getAddressesRequestMessageSchema: v.ObjectSchema<{
|
|
|
365
386
|
type GetAddressesRequestMessage = v.InferOutput<typeof getAddressesRequestMessageSchema>;
|
|
366
387
|
type GetAddresses = MethodParamsAndResult<v.InferOutput<typeof getAddressesParamsSchema>, v.InferOutput<typeof getAddressesResultSchema>>;
|
|
367
388
|
declare const signMessageMethodName = "signMessage";
|
|
389
|
+
declare enum MessageSigningProtocols {
|
|
390
|
+
ECDSA = "ECDSA",
|
|
391
|
+
BIP322 = "BIP322"
|
|
392
|
+
}
|
|
368
393
|
declare const signMessageParamsSchema: v.ObjectSchema<{
|
|
369
394
|
/**
|
|
370
395
|
* The address used for signing.
|
|
@@ -374,6 +399,10 @@ declare const signMessageParamsSchema: v.ObjectSchema<{
|
|
|
374
399
|
* The message to sign.
|
|
375
400
|
**/
|
|
376
401
|
readonly message: v.StringSchema<undefined>;
|
|
402
|
+
/**
|
|
403
|
+
* The protocol to use for signing the message.
|
|
404
|
+
*/
|
|
405
|
+
readonly protocol: v.OptionalSchema<v.EnumSchema<typeof MessageSigningProtocols, undefined>, never>;
|
|
377
406
|
}, undefined>;
|
|
378
407
|
type SignMessageParams = v.InferOutput<typeof signMessageParamsSchema>;
|
|
379
408
|
declare const signMessageResultSchema: v.ObjectSchema<{
|
|
@@ -389,6 +418,10 @@ declare const signMessageResultSchema: v.ObjectSchema<{
|
|
|
389
418
|
* The address used for signing.
|
|
390
419
|
*/
|
|
391
420
|
readonly address: v.StringSchema<undefined>;
|
|
421
|
+
/**
|
|
422
|
+
* The protocol to use for signing the message.
|
|
423
|
+
*/
|
|
424
|
+
readonly protocol: v.EnumSchema<typeof MessageSigningProtocols, undefined>;
|
|
392
425
|
}, undefined>;
|
|
393
426
|
type SignMessageResult = v.InferOutput<typeof signMessageResultSchema>;
|
|
394
427
|
declare const signMessageRequestMessageSchema: v.ObjectSchema<{
|
|
@@ -402,6 +435,10 @@ declare const signMessageRequestMessageSchema: v.ObjectSchema<{
|
|
|
402
435
|
* The message to sign.
|
|
403
436
|
**/
|
|
404
437
|
readonly message: v.StringSchema<undefined>;
|
|
438
|
+
/**
|
|
439
|
+
* The protocol to use for signing the message.
|
|
440
|
+
*/
|
|
441
|
+
readonly protocol: v.OptionalSchema<v.EnumSchema<typeof MessageSigningProtocols, undefined>, never>;
|
|
405
442
|
}, undefined>;
|
|
406
443
|
readonly id: v.StringSchema<undefined>;
|
|
407
444
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
@@ -568,6 +605,28 @@ declare const getInscriptionsSchema: v.ObjectSchema<{
|
|
|
568
605
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
569
606
|
}, undefined>;
|
|
570
607
|
type GetInscriptions = MethodParamsAndResult<v.InferOutput<typeof getInscriptionsParamsSchema>, v.InferOutput<typeof getInscriptionsResultSchema>>;
|
|
608
|
+
declare const sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
609
|
+
declare const sendInscriptionsParamsSchema: v.ObjectSchema<{
|
|
610
|
+
readonly transfers: v.ArraySchema<v.ObjectSchema<{
|
|
611
|
+
readonly address: v.StringSchema<undefined>;
|
|
612
|
+
readonly inscriptionId: v.StringSchema<undefined>;
|
|
613
|
+
}, undefined>, undefined>;
|
|
614
|
+
}, undefined>;
|
|
615
|
+
declare const sendInscriptionsResultSchema: v.ObjectSchema<{
|
|
616
|
+
readonly txid: v.StringSchema<undefined>;
|
|
617
|
+
}, undefined>;
|
|
618
|
+
declare const sendInscriptionsSchema: v.ObjectSchema<{
|
|
619
|
+
readonly method: v.LiteralSchema<"ord_sendInscriptions", undefined>;
|
|
620
|
+
readonly params: v.ObjectSchema<{
|
|
621
|
+
readonly transfers: v.ArraySchema<v.ObjectSchema<{
|
|
622
|
+
readonly address: v.StringSchema<undefined>;
|
|
623
|
+
readonly inscriptionId: v.StringSchema<undefined>;
|
|
624
|
+
}, undefined>, undefined>;
|
|
625
|
+
}, undefined>;
|
|
626
|
+
readonly id: v.StringSchema<undefined>;
|
|
627
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
628
|
+
}, undefined>;
|
|
629
|
+
type SendInscriptions = MethodParamsAndResult<v.InferOutput<typeof sendInscriptionsParamsSchema>, v.InferOutput<typeof sendInscriptionsResultSchema>>;
|
|
571
630
|
|
|
572
631
|
type CreateMintOrderRequest = {
|
|
573
632
|
runeName: string;
|
|
@@ -1022,6 +1081,7 @@ interface RunesRequests {
|
|
|
1022
1081
|
type RunesRequestMethod = keyof RunesRequests;
|
|
1023
1082
|
interface OrdinalsRequests {
|
|
1024
1083
|
ord_getInscriptions: GetInscriptions;
|
|
1084
|
+
ord_sendInscriptions: SendInscriptions;
|
|
1025
1085
|
}
|
|
1026
1086
|
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
1027
1087
|
interface WalletRequests {
|
|
@@ -1033,7 +1093,8 @@ type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & Ord
|
|
|
1033
1093
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
1034
1094
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
1035
1095
|
|
|
1036
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests |
|
|
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>;
|
|
1037
1098
|
|
|
1038
1099
|
declare abstract class SatsConnectAdapter {
|
|
1039
1100
|
abstract readonly id: string;
|
|
@@ -1045,16 +1106,18 @@ declare abstract class SatsConnectAdapter {
|
|
|
1045
1106
|
private estimateRbfOrder;
|
|
1046
1107
|
private rbfOrder;
|
|
1047
1108
|
request<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method>>;
|
|
1109
|
+
abstract addListener: AddListener;
|
|
1048
1110
|
protected abstract requestInternal<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method>>;
|
|
1049
1111
|
}
|
|
1050
1112
|
|
|
1051
1113
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
1052
1114
|
id: string;
|
|
1053
1115
|
constructor(providerId: string);
|
|
1054
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests |
|
|
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;
|
|
1055
1118
|
}
|
|
1056
1119
|
|
|
1057
1120
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
1058
1121
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
1059
1122
|
|
|
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 };
|
|
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 };
|