@sats-connect/core 0.0.15 → 0.1.0-0984c63
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 +90 -10
- package/dist/index.mjs +188 -100
- package/package.json +1 -1
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>;
|
|
@@ -339,7 +340,9 @@ declare const getAddressesResultSchema: v.ObjectSchema<{
|
|
|
339
340
|
readonly addresses: v.ArraySchema<v.ObjectSchema<{
|
|
340
341
|
readonly address: v.StringSchema<undefined>;
|
|
341
342
|
readonly publicKey: v.StringSchema<undefined>;
|
|
342
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
343
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>; /**
|
|
344
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
345
|
+
*/
|
|
343
346
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
344
347
|
}, undefined>, undefined>;
|
|
345
348
|
}, undefined>;
|
|
@@ -363,6 +366,10 @@ declare const getAddressesRequestMessageSchema: v.ObjectSchema<{
|
|
|
363
366
|
type GetAddressesRequestMessage = v.InferOutput<typeof getAddressesRequestMessageSchema>;
|
|
364
367
|
type GetAddresses = MethodParamsAndResult<v.InferOutput<typeof getAddressesParamsSchema>, v.InferOutput<typeof getAddressesResultSchema>>;
|
|
365
368
|
declare const signMessageMethodName = "signMessage";
|
|
369
|
+
declare enum MessageSigningProtocols {
|
|
370
|
+
ECDSA = "ECDSA",
|
|
371
|
+
BIP322 = "BIP322"
|
|
372
|
+
}
|
|
366
373
|
declare const signMessageParamsSchema: v.ObjectSchema<{
|
|
367
374
|
/**
|
|
368
375
|
* The address used for signing.
|
|
@@ -372,6 +379,10 @@ declare const signMessageParamsSchema: v.ObjectSchema<{
|
|
|
372
379
|
* The message to sign.
|
|
373
380
|
**/
|
|
374
381
|
readonly message: v.StringSchema<undefined>;
|
|
382
|
+
/**
|
|
383
|
+
* The protocol to use for signing the message.
|
|
384
|
+
*/
|
|
385
|
+
readonly protocol: v.OptionalSchema<v.EnumSchema<typeof MessageSigningProtocols, undefined>, never>;
|
|
375
386
|
}, undefined>;
|
|
376
387
|
type SignMessageParams = v.InferOutput<typeof signMessageParamsSchema>;
|
|
377
388
|
declare const signMessageResultSchema: v.ObjectSchema<{
|
|
@@ -387,6 +398,10 @@ declare const signMessageResultSchema: v.ObjectSchema<{
|
|
|
387
398
|
* The address used for signing.
|
|
388
399
|
*/
|
|
389
400
|
readonly address: v.StringSchema<undefined>;
|
|
401
|
+
/**
|
|
402
|
+
* The protocol to use for signing the message.
|
|
403
|
+
*/
|
|
404
|
+
readonly protocol: v.EnumSchema<typeof MessageSigningProtocols, undefined>;
|
|
390
405
|
}, undefined>;
|
|
391
406
|
type SignMessageResult = v.InferOutput<typeof signMessageResultSchema>;
|
|
392
407
|
declare const signMessageRequestMessageSchema: v.ObjectSchema<{
|
|
@@ -400,6 +415,10 @@ declare const signMessageRequestMessageSchema: v.ObjectSchema<{
|
|
|
400
415
|
* The message to sign.
|
|
401
416
|
**/
|
|
402
417
|
readonly message: v.StringSchema<undefined>;
|
|
418
|
+
/**
|
|
419
|
+
* The protocol to use for signing the message.
|
|
420
|
+
*/
|
|
421
|
+
readonly protocol: v.OptionalSchema<v.EnumSchema<typeof MessageSigningProtocols, undefined>, never>;
|
|
403
422
|
}, undefined>;
|
|
404
423
|
readonly id: v.StringSchema<undefined>;
|
|
405
424
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
@@ -476,9 +495,12 @@ declare const getAccountsParamsSchema: v.ObjectSchema<{
|
|
|
476
495
|
}, undefined>;
|
|
477
496
|
type GetAccountsParams = v.InferOutput<typeof getAccountsParamsSchema>;
|
|
478
497
|
declare const getAccountsResultSchema: v.ArraySchema<v.ObjectSchema<{
|
|
498
|
+
readonly walletType: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
479
499
|
readonly address: v.StringSchema<undefined>;
|
|
480
500
|
readonly publicKey: v.StringSchema<undefined>;
|
|
481
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
501
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>; /**
|
|
502
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
503
|
+
*/
|
|
482
504
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
483
505
|
}, undefined>, undefined>;
|
|
484
506
|
type GetAccountsResult = v.InferOutput<typeof getAccountsResultSchema>;
|
|
@@ -901,9 +923,52 @@ declare const stxGetAddressesRequestMessageSchema: v.ObjectSchema<{
|
|
|
901
923
|
}, undefined>;
|
|
902
924
|
type StxGetAddressesRequestMessage = v.InferOutput<typeof stxGetAddressesRequestMessageSchema>;
|
|
903
925
|
type StxGetAddresses = MethodParamsAndResult<v.InferOutput<typeof stxGetAddressesParamsSchema>, v.InferOutput<typeof stxGetAddressesResultSchema>>;
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
926
|
+
declare const stxSignTransactionMethodName = "stx_signTransaction";
|
|
927
|
+
declare const stxSignTransactionParamsSchema: v.ObjectSchema<{
|
|
928
|
+
/**
|
|
929
|
+
* The transaction to sign as a hex-encoded string.
|
|
930
|
+
*/
|
|
931
|
+
readonly transaction: v.StringSchema<undefined>;
|
|
932
|
+
/**
|
|
933
|
+
* The public key to sign the transaction with. The wallet may use any key
|
|
934
|
+
* when not provided.
|
|
935
|
+
*/
|
|
936
|
+
readonly pubkey: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
937
|
+
/**
|
|
938
|
+
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
939
|
+
*/
|
|
940
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
941
|
+
}, undefined>;
|
|
942
|
+
type StxSignTransactionParams = v.InferOutput<typeof stxSignTransactionParamsSchema>;
|
|
943
|
+
declare const stxSignTransactionResultSchema: v.ObjectSchema<{
|
|
944
|
+
/**
|
|
945
|
+
* The signed transaction as a hex-encoded string.
|
|
946
|
+
*/
|
|
947
|
+
readonly transaction: v.StringSchema<undefined>;
|
|
948
|
+
}, undefined>;
|
|
949
|
+
type StxSignTransactionResult = v.InferOutput<typeof stxSignTransactionResultSchema>;
|
|
950
|
+
declare const stxSignTransactionRequestMessageSchema: v.ObjectSchema<{
|
|
951
|
+
readonly method: v.LiteralSchema<"stx_signTransaction", undefined>;
|
|
952
|
+
readonly params: v.ObjectSchema<{
|
|
953
|
+
/**
|
|
954
|
+
* The transaction to sign as a hex-encoded string.
|
|
955
|
+
*/
|
|
956
|
+
readonly transaction: v.StringSchema<undefined>;
|
|
957
|
+
/**
|
|
958
|
+
* The public key to sign the transaction with. The wallet may use any key
|
|
959
|
+
* when not provided.
|
|
960
|
+
*/
|
|
961
|
+
readonly pubkey: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
962
|
+
/**
|
|
963
|
+
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
964
|
+
*/
|
|
965
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
966
|
+
}, undefined>;
|
|
967
|
+
readonly id: v.StringSchema<undefined>;
|
|
968
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
969
|
+
}, undefined>;
|
|
970
|
+
type StxSignTransactionRequestMessage = v.InferOutput<typeof stxSignTransactionRequestMessageSchema>;
|
|
971
|
+
type StxSignTransaction = MethodParamsAndResult<StxSignTransactionParams, StxSignTransactionResult>;
|
|
907
972
|
|
|
908
973
|
declare const requestPermissionsMethodName = "wallet_requestPermissions";
|
|
909
974
|
declare const requestPermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
@@ -925,6 +990,20 @@ declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
|
925
990
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
926
991
|
}, undefined>;
|
|
927
992
|
type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
|
|
993
|
+
declare const getWalletTypeMethodName = "wallet_getWalletType";
|
|
994
|
+
declare const getWalletTypeParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
|
|
995
|
+
declare const getWalletTypeResultSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
996
|
+
declare const getWalletTypeRequestMessageSchema: v.ObjectSchema<{
|
|
997
|
+
readonly method: v.LiteralSchema<"wallet_getWalletType", undefined>;
|
|
998
|
+
readonly id: v.StringSchema<undefined>;
|
|
999
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
1000
|
+
readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
1001
|
+
}, undefined>;
|
|
1002
|
+
type GetWalletType = MethodParamsAndResult<v.InferOutput<typeof getWalletTypeParamsSchema>, v.InferOutput<typeof getWalletTypeResultSchema>>;
|
|
1003
|
+
|
|
1004
|
+
declare const walletTypes: readonly ["software", "ledger"];
|
|
1005
|
+
declare const walletTypeSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
1006
|
+
type WalletType = v.InferOutput<typeof walletTypeSchema>;
|
|
928
1007
|
|
|
929
1008
|
interface StxRequests {
|
|
930
1009
|
stx_callContract: StxCallContract;
|
|
@@ -962,15 +1041,16 @@ interface OrdinalsRequests {
|
|
|
962
1041
|
ord_getInscriptions: GetInscriptions;
|
|
963
1042
|
}
|
|
964
1043
|
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
965
|
-
interface
|
|
1044
|
+
interface WalletRequests {
|
|
966
1045
|
wallet_requestPermissions: RequestPermissions;
|
|
967
1046
|
wallet_renouncePermissions: RenouncePermissions;
|
|
1047
|
+
wallet_getWalletType: GetWalletType;
|
|
968
1048
|
}
|
|
969
|
-
type Requests = BtcRequests & StxRequests & RunesRequests &
|
|
1049
|
+
type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & OrdinalsRequests;
|
|
970
1050
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
971
1051
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
972
1052
|
|
|
973
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof
|
|
1053
|
+
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
1054
|
|
|
975
1055
|
declare abstract class SatsConnectAdapter {
|
|
976
1056
|
abstract readonly id: string;
|
|
@@ -988,10 +1068,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
988
1068
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
989
1069
|
id: string;
|
|
990
1070
|
constructor(providerId: string);
|
|
991
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof
|
|
1071
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
992
1072
|
}
|
|
993
1073
|
|
|
994
1074
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
995
1075
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
996
1076
|
|
|
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
|
|
1077
|
+
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 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
|
|
559
|
+
import * as v9 from "valibot";
|
|
560
560
|
|
|
561
561
|
// src/addresses/index.ts
|
|
562
562
|
import { createUnsecuredToken } from "jsontokens";
|
|
@@ -627,215 +627,292 @@ 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 =
|
|
635
|
-
var getInfoResultSchema =
|
|
671
|
+
var getInfoParamsSchema = v5.nullish(v5.null());
|
|
672
|
+
var getInfoResultSchema = v5.object({
|
|
636
673
|
/**
|
|
637
674
|
* Version of the wallet.
|
|
638
675
|
*/
|
|
639
|
-
version:
|
|
676
|
+
version: v5.string(),
|
|
640
677
|
/**
|
|
641
678
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
642
679
|
*/
|
|
643
|
-
methods:
|
|
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:
|
|
684
|
+
supports: v5.array(v5.string())
|
|
648
685
|
});
|
|
649
|
-
var getInfoRequestMessageSchema =
|
|
686
|
+
var getInfoRequestMessageSchema = v5.object({
|
|
650
687
|
...rpcRequestMessageSchema.entries,
|
|
651
|
-
...
|
|
652
|
-
method:
|
|
688
|
+
...v5.object({
|
|
689
|
+
method: v5.literal(getInfoMethodName),
|
|
653
690
|
params: getInfoParamsSchema,
|
|
654
|
-
id:
|
|
691
|
+
id: v5.string()
|
|
655
692
|
}).entries
|
|
656
693
|
});
|
|
657
694
|
var getAddressesMethodName = "getAddresses";
|
|
658
|
-
var getAddressesParamsSchema =
|
|
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:
|
|
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:
|
|
704
|
+
message: v5.optional(v5.string())
|
|
668
705
|
});
|
|
669
|
-
var getAddressesResultSchema =
|
|
706
|
+
var getAddressesResultSchema = v5.object({
|
|
670
707
|
/**
|
|
671
708
|
* The addresses generated for the given purposes.
|
|
672
709
|
*/
|
|
673
|
-
addresses:
|
|
710
|
+
addresses: v5.array(addressSchema)
|
|
674
711
|
});
|
|
675
|
-
var getAddressesRequestMessageSchema =
|
|
712
|
+
var getAddressesRequestMessageSchema = v5.object({
|
|
676
713
|
...rpcRequestMessageSchema.entries,
|
|
677
|
-
...
|
|
678
|
-
method:
|
|
714
|
+
...v5.object({
|
|
715
|
+
method: v5.literal(getAddressesMethodName),
|
|
679
716
|
params: getAddressesParamsSchema,
|
|
680
|
-
id:
|
|
717
|
+
id: v5.string()
|
|
681
718
|
}).entries
|
|
682
719
|
});
|
|
683
720
|
var signMessageMethodName = "signMessage";
|
|
684
|
-
var
|
|
721
|
+
var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
722
|
+
MessageSigningProtocols2["ECDSA"] = "ECDSA";
|
|
723
|
+
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
724
|
+
return MessageSigningProtocols2;
|
|
725
|
+
})(MessageSigningProtocols || {});
|
|
726
|
+
var signMessageParamsSchema = v5.object({
|
|
685
727
|
/**
|
|
686
728
|
* The address used for signing.
|
|
687
729
|
**/
|
|
688
|
-
address:
|
|
730
|
+
address: v5.string(),
|
|
689
731
|
/**
|
|
690
732
|
* The message to sign.
|
|
691
733
|
**/
|
|
692
|
-
message:
|
|
734
|
+
message: v5.string(),
|
|
735
|
+
/**
|
|
736
|
+
* The protocol to use for signing the message.
|
|
737
|
+
*/
|
|
738
|
+
protocol: v5.optional(v5.enum(MessageSigningProtocols))
|
|
693
739
|
});
|
|
694
|
-
var signMessageResultSchema =
|
|
740
|
+
var signMessageResultSchema = v5.object({
|
|
695
741
|
/**
|
|
696
742
|
* The signature of the message.
|
|
697
743
|
*/
|
|
698
|
-
signature:
|
|
744
|
+
signature: v5.string(),
|
|
699
745
|
/**
|
|
700
746
|
* hash of the message.
|
|
701
747
|
*/
|
|
702
|
-
messageHash:
|
|
748
|
+
messageHash: v5.string(),
|
|
703
749
|
/**
|
|
704
750
|
* The address used for signing.
|
|
705
751
|
*/
|
|
706
|
-
address:
|
|
752
|
+
address: v5.string(),
|
|
753
|
+
/**
|
|
754
|
+
* The protocol to use for signing the message.
|
|
755
|
+
*/
|
|
756
|
+
protocol: v5.enum(MessageSigningProtocols)
|
|
707
757
|
});
|
|
708
|
-
var signMessageRequestMessageSchema =
|
|
758
|
+
var signMessageRequestMessageSchema = v5.object({
|
|
709
759
|
...rpcRequestMessageSchema.entries,
|
|
710
|
-
...
|
|
711
|
-
method:
|
|
760
|
+
...v5.object({
|
|
761
|
+
method: v5.literal(signMessageMethodName),
|
|
712
762
|
params: signMessageParamsSchema,
|
|
713
|
-
id:
|
|
763
|
+
id: v5.string()
|
|
714
764
|
}).entries
|
|
715
765
|
});
|
|
716
766
|
var getAccountsMethodName = "getAccounts";
|
|
717
|
-
var getAccountsParamsSchema =
|
|
718
|
-
|
|
719
|
-
|
|
767
|
+
var getAccountsParamsSchema = v5.object({
|
|
768
|
+
/**
|
|
769
|
+
* The purposes for which to generate addresses. See
|
|
770
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
771
|
+
*/
|
|
772
|
+
purposes: v5.array(v5.enum(AddressPurpose)),
|
|
773
|
+
/**
|
|
774
|
+
* A message to be displayed to the user in the request prompt.
|
|
775
|
+
*/
|
|
776
|
+
message: v5.optional(v5.string())
|
|
777
|
+
});
|
|
778
|
+
var getAccountsResultSchema = v5.array(
|
|
779
|
+
v5.object({
|
|
780
|
+
...addressSchema.entries,
|
|
781
|
+
...v5.object({
|
|
782
|
+
walletType: walletTypeSchema
|
|
783
|
+
}).entries
|
|
784
|
+
})
|
|
785
|
+
);
|
|
786
|
+
var getAccountsRequestMessageSchema = v5.object({
|
|
720
787
|
...rpcRequestMessageSchema.entries,
|
|
721
|
-
...
|
|
722
|
-
method:
|
|
788
|
+
...v5.object({
|
|
789
|
+
method: v5.literal(getAccountsMethodName),
|
|
723
790
|
params: getAccountsParamsSchema,
|
|
724
|
-
id:
|
|
791
|
+
id: v5.string()
|
|
725
792
|
}).entries
|
|
726
793
|
});
|
|
727
794
|
var getBalanceMethodName = "getBalance";
|
|
728
|
-
var getBalanceParamsSchema =
|
|
729
|
-
var getBalanceResultSchema =
|
|
795
|
+
var getBalanceParamsSchema = v5.nullish(v5.null());
|
|
796
|
+
var getBalanceResultSchema = v5.object({
|
|
730
797
|
/**
|
|
731
798
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
732
799
|
* messages not supporting bigint
|
|
733
800
|
* (https://issues.chromium.org/issues/40116184).
|
|
734
801
|
*/
|
|
735
|
-
confirmed:
|
|
802
|
+
confirmed: v5.string(),
|
|
736
803
|
/**
|
|
737
804
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
738
805
|
* messages not supporting bigint
|
|
739
806
|
* (https://issues.chromium.org/issues/40116184).
|
|
740
807
|
*/
|
|
741
|
-
unconfirmed:
|
|
808
|
+
unconfirmed: v5.string(),
|
|
742
809
|
/**
|
|
743
810
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
744
811
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
745
812
|
* (https://issues.chromium.org/issues/40116184).
|
|
746
813
|
*/
|
|
747
|
-
total:
|
|
814
|
+
total: v5.string()
|
|
748
815
|
});
|
|
749
|
-
var getBalanceRequestMessageSchema =
|
|
816
|
+
var getBalanceRequestMessageSchema = v5.object({
|
|
750
817
|
...rpcRequestMessageSchema.entries,
|
|
751
|
-
...
|
|
752
|
-
method:
|
|
753
|
-
id:
|
|
818
|
+
...v5.object({
|
|
819
|
+
method: v5.literal(getBalanceMethodName),
|
|
820
|
+
id: v5.string()
|
|
754
821
|
}).entries
|
|
755
822
|
});
|
|
756
823
|
|
|
757
824
|
// src/request/types/walletMethods.ts
|
|
758
|
-
import * as
|
|
825
|
+
import * as v6 from "valibot";
|
|
759
826
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
760
|
-
var requestPermissionsParamsSchema =
|
|
761
|
-
var requestPermissionsResultSchema =
|
|
762
|
-
var requestPermissionsRequestMessageSchema =
|
|
827
|
+
var requestPermissionsParamsSchema = v6.undefined();
|
|
828
|
+
var requestPermissionsResultSchema = v6.literal(true);
|
|
829
|
+
var requestPermissionsRequestMessageSchema = v6.object({
|
|
763
830
|
...rpcRequestMessageSchema.entries,
|
|
764
|
-
...
|
|
765
|
-
method:
|
|
831
|
+
...v6.object({
|
|
832
|
+
method: v6.literal(requestPermissionsMethodName),
|
|
766
833
|
params: requestPermissionsParamsSchema,
|
|
767
|
-
id:
|
|
834
|
+
id: v6.string()
|
|
768
835
|
}).entries
|
|
769
836
|
});
|
|
770
837
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
771
|
-
var renouncePermissionsParamsSchema =
|
|
772
|
-
var renouncePermissionsResultSchema =
|
|
773
|
-
var renouncePermissionsRequestMessageSchema =
|
|
838
|
+
var renouncePermissionsParamsSchema = v6.undefined();
|
|
839
|
+
var renouncePermissionsResultSchema = v6.literal(true);
|
|
840
|
+
var renouncePermissionsRequestMessageSchema = v6.object({
|
|
774
841
|
...rpcRequestMessageSchema.entries,
|
|
775
|
-
...
|
|
776
|
-
method:
|
|
842
|
+
...v6.object({
|
|
843
|
+
method: v6.literal(renouncePermissionsMethodName),
|
|
777
844
|
params: renouncePermissionsParamsSchema,
|
|
778
|
-
id:
|
|
845
|
+
id: v6.string()
|
|
846
|
+
}).entries
|
|
847
|
+
});
|
|
848
|
+
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
849
|
+
var getWalletTypeParamsSchema = v6.nullish(v6.null());
|
|
850
|
+
var getWalletTypeResultSchema = walletTypeSchema;
|
|
851
|
+
var getWalletTypeRequestMessageSchema = v6.object({
|
|
852
|
+
...rpcRequestMessageSchema.entries,
|
|
853
|
+
...v6.object({
|
|
854
|
+
method: v6.literal(getWalletTypeMethodName),
|
|
855
|
+
id: v6.string()
|
|
779
856
|
}).entries
|
|
780
857
|
});
|
|
781
858
|
|
|
782
859
|
// src/request/types/runesMethods.ts
|
|
783
|
-
import * as
|
|
860
|
+
import * as v7 from "valibot";
|
|
784
861
|
var getRunesBalanceMethodName = "runes_getBalance";
|
|
785
|
-
var getRunesBalanceParamsSchema =
|
|
786
|
-
var getRunesBalanceResultSchema =
|
|
787
|
-
balances:
|
|
788
|
-
|
|
789
|
-
runeName:
|
|
790
|
-
amount:
|
|
791
|
-
divisibility:
|
|
792
|
-
symbol:
|
|
793
|
-
inscriptionId:
|
|
862
|
+
var getRunesBalanceParamsSchema = v7.nullish(v7.null());
|
|
863
|
+
var getRunesBalanceResultSchema = v7.object({
|
|
864
|
+
balances: v7.array(
|
|
865
|
+
v7.object({
|
|
866
|
+
runeName: v7.string(),
|
|
867
|
+
amount: v7.string(),
|
|
868
|
+
divisibility: v7.number(),
|
|
869
|
+
symbol: v7.string(),
|
|
870
|
+
inscriptionId: v7.nullish(v7.string())
|
|
794
871
|
})
|
|
795
872
|
)
|
|
796
873
|
});
|
|
797
|
-
var getRunesBalanceRequestMessageSchema =
|
|
874
|
+
var getRunesBalanceRequestMessageSchema = v7.object({
|
|
798
875
|
...rpcRequestMessageSchema.entries,
|
|
799
|
-
...
|
|
800
|
-
method:
|
|
876
|
+
...v7.object({
|
|
877
|
+
method: v7.literal(getRunesBalanceMethodName),
|
|
801
878
|
params: getRunesBalanceParamsSchema,
|
|
802
|
-
id:
|
|
879
|
+
id: v7.string()
|
|
803
880
|
}).entries
|
|
804
881
|
});
|
|
805
882
|
|
|
806
883
|
// src/request/types/ordinalsMethods.ts
|
|
807
|
-
import * as
|
|
884
|
+
import * as v8 from "valibot";
|
|
808
885
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
809
|
-
var getInscriptionsParamsSchema =
|
|
810
|
-
offset:
|
|
811
|
-
limit:
|
|
886
|
+
var getInscriptionsParamsSchema = v8.object({
|
|
887
|
+
offset: v8.number(),
|
|
888
|
+
limit: v8.number()
|
|
812
889
|
});
|
|
813
|
-
var getInscriptionsResultSchema =
|
|
814
|
-
total:
|
|
815
|
-
limit:
|
|
816
|
-
offset:
|
|
817
|
-
inscriptions:
|
|
818
|
-
|
|
819
|
-
inscriptionId:
|
|
820
|
-
inscriptionNumber:
|
|
821
|
-
address:
|
|
822
|
-
collectionName:
|
|
823
|
-
postage:
|
|
824
|
-
contentLength:
|
|
825
|
-
contentType:
|
|
826
|
-
timestamp:
|
|
827
|
-
offset:
|
|
828
|
-
genesisTransaction:
|
|
829
|
-
output:
|
|
890
|
+
var getInscriptionsResultSchema = v8.object({
|
|
891
|
+
total: v8.number(),
|
|
892
|
+
limit: v8.number(),
|
|
893
|
+
offset: v8.number(),
|
|
894
|
+
inscriptions: v8.array(
|
|
895
|
+
v8.object({
|
|
896
|
+
inscriptionId: v8.string(),
|
|
897
|
+
inscriptionNumber: v8.string(),
|
|
898
|
+
address: v8.string(),
|
|
899
|
+
collectionName: v8.optional(v8.string()),
|
|
900
|
+
postage: v8.string(),
|
|
901
|
+
contentLength: v8.string(),
|
|
902
|
+
contentType: v8.string(),
|
|
903
|
+
timestamp: v8.number(),
|
|
904
|
+
offset: v8.number(),
|
|
905
|
+
genesisTransaction: v8.string(),
|
|
906
|
+
output: v8.string()
|
|
830
907
|
})
|
|
831
908
|
)
|
|
832
909
|
});
|
|
833
|
-
var getInscriptionsSchema =
|
|
910
|
+
var getInscriptionsSchema = v8.object({
|
|
834
911
|
...rpcRequestMessageSchema.entries,
|
|
835
|
-
...
|
|
836
|
-
method:
|
|
912
|
+
...v8.object({
|
|
913
|
+
method: v8.literal(getInscriptionsMethodName),
|
|
837
914
|
params: getInscriptionsParamsSchema,
|
|
838
|
-
id:
|
|
915
|
+
id: v8.string()
|
|
839
916
|
}).entries
|
|
840
917
|
});
|
|
841
918
|
|
|
@@ -852,13 +929,13 @@ var request = async (method, params, providerId) => {
|
|
|
852
929
|
throw new Error("A wallet method is required");
|
|
853
930
|
}
|
|
854
931
|
const response = await provider.request(method, params);
|
|
855
|
-
if (
|
|
932
|
+
if (v9.is(rpcErrorResponseMessageSchema, response)) {
|
|
856
933
|
return {
|
|
857
934
|
status: "error",
|
|
858
935
|
error: response.error
|
|
859
936
|
};
|
|
860
937
|
}
|
|
861
|
-
if (
|
|
938
|
+
if (v9.is(rpcSuccessResponseMessageSchema, response)) {
|
|
862
939
|
return {
|
|
863
940
|
status: "success",
|
|
864
941
|
result: response.result
|
|
@@ -1287,6 +1364,7 @@ export {
|
|
|
1287
1364
|
BaseAdapter,
|
|
1288
1365
|
BitcoinNetworkType,
|
|
1289
1366
|
DefaultAdaptersInfo,
|
|
1367
|
+
MessageSigningProtocols,
|
|
1290
1368
|
RpcErrorCode,
|
|
1291
1369
|
RpcIdSchema,
|
|
1292
1370
|
SatsConnectAdapter,
|
|
@@ -1325,6 +1403,10 @@ export {
|
|
|
1325
1403
|
getRunesBalanceRequestMessageSchema,
|
|
1326
1404
|
getRunesBalanceResultSchema,
|
|
1327
1405
|
getSupportedWallets,
|
|
1406
|
+
getWalletTypeMethodName,
|
|
1407
|
+
getWalletTypeParamsSchema,
|
|
1408
|
+
getWalletTypeRequestMessageSchema,
|
|
1409
|
+
getWalletTypeResultSchema,
|
|
1328
1410
|
isProviderInstalled,
|
|
1329
1411
|
removeDefaultProvider,
|
|
1330
1412
|
renouncePermissionsMethodName,
|
|
@@ -1352,5 +1434,11 @@ export {
|
|
|
1352
1434
|
stxGetAddressesMethodName,
|
|
1353
1435
|
stxGetAddressesParamsSchema,
|
|
1354
1436
|
stxGetAddressesRequestMessageSchema,
|
|
1355
|
-
stxGetAddressesResultSchema
|
|
1437
|
+
stxGetAddressesResultSchema,
|
|
1438
|
+
stxSignTransactionMethodName,
|
|
1439
|
+
stxSignTransactionParamsSchema,
|
|
1440
|
+
stxSignTransactionRequestMessageSchema,
|
|
1441
|
+
stxSignTransactionResultSchema,
|
|
1442
|
+
walletTypeSchema,
|
|
1443
|
+
walletTypes
|
|
1356
1444
|
};
|