@sats-connect/core 0.1.0-b9085f0 → 0.1.1-18f772e
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 +44 -7
- package/dist/index.mjs +154 -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>;
|
|
@@ -968,6 +990,20 @@ declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
|
968
990
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
969
991
|
}, undefined>;
|
|
970
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>;
|
|
971
1007
|
|
|
972
1008
|
interface StxRequests {
|
|
973
1009
|
stx_callContract: StxCallContract;
|
|
@@ -1005,15 +1041,16 @@ interface OrdinalsRequests {
|
|
|
1005
1041
|
ord_getInscriptions: GetInscriptions;
|
|
1006
1042
|
}
|
|
1007
1043
|
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
1008
|
-
interface
|
|
1044
|
+
interface WalletRequests {
|
|
1009
1045
|
wallet_requestPermissions: RequestPermissions;
|
|
1010
1046
|
wallet_renouncePermissions: RenouncePermissions;
|
|
1047
|
+
wallet_getWalletType: GetWalletType;
|
|
1011
1048
|
}
|
|
1012
|
-
type Requests = BtcRequests & StxRequests & RunesRequests &
|
|
1049
|
+
type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & OrdinalsRequests;
|
|
1013
1050
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
1014
1051
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
1015
1052
|
|
|
1016
|
-
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>>;
|
|
1017
1054
|
|
|
1018
1055
|
declare abstract class SatsConnectAdapter {
|
|
1019
1056
|
abstract readonly id: string;
|
|
@@ -1031,10 +1068,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
1031
1068
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
1032
1069
|
id: string;
|
|
1033
1070
|
constructor(providerId: string);
|
|
1034
|
-
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>>;
|
|
1035
1072
|
}
|
|
1036
1073
|
|
|
1037
1074
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
1038
1075
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
1039
1076
|
|
|
1040
|
-
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 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
|
|
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";
|
|
@@ -659,213 +659,260 @@ var stxSignTransactionRequestMessageSchema = v3.object({
|
|
|
659
659
|
});
|
|
660
660
|
|
|
661
661
|
// src/request/types/btcMethods.ts
|
|
662
|
+
import * as v5 from "valibot";
|
|
663
|
+
|
|
664
|
+
// src/request/types/common.ts
|
|
662
665
|
import * as v4 from "valibot";
|
|
666
|
+
var walletTypes = ["software", "ledger"];
|
|
667
|
+
var walletTypeSchema = v4.picklist(walletTypes);
|
|
668
|
+
|
|
669
|
+
// src/request/types/btcMethods.ts
|
|
663
670
|
var getInfoMethodName = "getInfo";
|
|
664
|
-
var getInfoParamsSchema =
|
|
665
|
-
var getInfoResultSchema =
|
|
671
|
+
var getInfoParamsSchema = v5.nullish(v5.null());
|
|
672
|
+
var getInfoResultSchema = v5.object({
|
|
666
673
|
/**
|
|
667
674
|
* Version of the wallet.
|
|
668
675
|
*/
|
|
669
|
-
version:
|
|
676
|
+
version: v5.string(),
|
|
670
677
|
/**
|
|
671
678
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
672
679
|
*/
|
|
673
|
-
methods:
|
|
680
|
+
methods: v5.optional(v5.array(v5.string())),
|
|
674
681
|
/**
|
|
675
682
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
676
683
|
*/
|
|
677
|
-
supports:
|
|
684
|
+
supports: v5.array(v5.string())
|
|
678
685
|
});
|
|
679
|
-
var getInfoRequestMessageSchema =
|
|
686
|
+
var getInfoRequestMessageSchema = v5.object({
|
|
680
687
|
...rpcRequestMessageSchema.entries,
|
|
681
|
-
...
|
|
682
|
-
method:
|
|
688
|
+
...v5.object({
|
|
689
|
+
method: v5.literal(getInfoMethodName),
|
|
683
690
|
params: getInfoParamsSchema,
|
|
684
|
-
id:
|
|
691
|
+
id: v5.string()
|
|
685
692
|
}).entries
|
|
686
693
|
});
|
|
687
694
|
var getAddressesMethodName = "getAddresses";
|
|
688
|
-
var getAddressesParamsSchema =
|
|
695
|
+
var getAddressesParamsSchema = v5.object({
|
|
689
696
|
/**
|
|
690
697
|
* The purposes for which to generate addresses. See
|
|
691
698
|
* {@linkcode AddressPurpose} for available purposes.
|
|
692
699
|
*/
|
|
693
|
-
purposes:
|
|
700
|
+
purposes: v5.array(v5.enum(AddressPurpose)),
|
|
694
701
|
/**
|
|
695
702
|
* A message to be displayed to the user in the request prompt.
|
|
696
703
|
*/
|
|
697
|
-
message:
|
|
704
|
+
message: v5.optional(v5.string())
|
|
698
705
|
});
|
|
699
|
-
var getAddressesResultSchema =
|
|
706
|
+
var getAddressesResultSchema = v5.object({
|
|
700
707
|
/**
|
|
701
708
|
* The addresses generated for the given purposes.
|
|
702
709
|
*/
|
|
703
|
-
addresses:
|
|
710
|
+
addresses: v5.array(addressSchema)
|
|
704
711
|
});
|
|
705
|
-
var getAddressesRequestMessageSchema =
|
|
712
|
+
var getAddressesRequestMessageSchema = v5.object({
|
|
706
713
|
...rpcRequestMessageSchema.entries,
|
|
707
|
-
...
|
|
708
|
-
method:
|
|
714
|
+
...v5.object({
|
|
715
|
+
method: v5.literal(getAddressesMethodName),
|
|
709
716
|
params: getAddressesParamsSchema,
|
|
710
|
-
id:
|
|
717
|
+
id: v5.string()
|
|
711
718
|
}).entries
|
|
712
719
|
});
|
|
713
720
|
var signMessageMethodName = "signMessage";
|
|
714
|
-
var
|
|
721
|
+
var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
722
|
+
MessageSigningProtocols2["ECDSA"] = "ECDSA";
|
|
723
|
+
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
724
|
+
return MessageSigningProtocols2;
|
|
725
|
+
})(MessageSigningProtocols || {});
|
|
726
|
+
var signMessageParamsSchema = v5.object({
|
|
715
727
|
/**
|
|
716
728
|
* The address used for signing.
|
|
717
729
|
**/
|
|
718
|
-
address:
|
|
730
|
+
address: v5.string(),
|
|
719
731
|
/**
|
|
720
732
|
* The message to sign.
|
|
721
733
|
**/
|
|
722
|
-
message:
|
|
734
|
+
message: v5.string(),
|
|
735
|
+
/**
|
|
736
|
+
* The protocol to use for signing the message.
|
|
737
|
+
*/
|
|
738
|
+
protocol: v5.optional(v5.enum(MessageSigningProtocols))
|
|
723
739
|
});
|
|
724
|
-
var signMessageResultSchema =
|
|
740
|
+
var signMessageResultSchema = v5.object({
|
|
725
741
|
/**
|
|
726
742
|
* The signature of the message.
|
|
727
743
|
*/
|
|
728
|
-
signature:
|
|
744
|
+
signature: v5.string(),
|
|
729
745
|
/**
|
|
730
746
|
* hash of the message.
|
|
731
747
|
*/
|
|
732
|
-
messageHash:
|
|
748
|
+
messageHash: v5.string(),
|
|
733
749
|
/**
|
|
734
750
|
* The address used for signing.
|
|
735
751
|
*/
|
|
736
|
-
address:
|
|
752
|
+
address: v5.string(),
|
|
753
|
+
/**
|
|
754
|
+
* The protocol to use for signing the message.
|
|
755
|
+
*/
|
|
756
|
+
protocol: v5.enum(MessageSigningProtocols)
|
|
737
757
|
});
|
|
738
|
-
var signMessageRequestMessageSchema =
|
|
758
|
+
var signMessageRequestMessageSchema = v5.object({
|
|
739
759
|
...rpcRequestMessageSchema.entries,
|
|
740
|
-
...
|
|
741
|
-
method:
|
|
760
|
+
...v5.object({
|
|
761
|
+
method: v5.literal(signMessageMethodName),
|
|
742
762
|
params: signMessageParamsSchema,
|
|
743
|
-
id:
|
|
763
|
+
id: v5.string()
|
|
744
764
|
}).entries
|
|
745
765
|
});
|
|
746
766
|
var getAccountsMethodName = "getAccounts";
|
|
747
|
-
var getAccountsParamsSchema =
|
|
748
|
-
|
|
749
|
-
|
|
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({
|
|
750
787
|
...rpcRequestMessageSchema.entries,
|
|
751
|
-
...
|
|
752
|
-
method:
|
|
788
|
+
...v5.object({
|
|
789
|
+
method: v5.literal(getAccountsMethodName),
|
|
753
790
|
params: getAccountsParamsSchema,
|
|
754
|
-
id:
|
|
791
|
+
id: v5.string()
|
|
755
792
|
}).entries
|
|
756
793
|
});
|
|
757
794
|
var getBalanceMethodName = "getBalance";
|
|
758
|
-
var getBalanceParamsSchema =
|
|
759
|
-
var getBalanceResultSchema =
|
|
795
|
+
var getBalanceParamsSchema = v5.nullish(v5.null());
|
|
796
|
+
var getBalanceResultSchema = v5.object({
|
|
760
797
|
/**
|
|
761
798
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
762
799
|
* messages not supporting bigint
|
|
763
800
|
* (https://issues.chromium.org/issues/40116184).
|
|
764
801
|
*/
|
|
765
|
-
confirmed:
|
|
802
|
+
confirmed: v5.string(),
|
|
766
803
|
/**
|
|
767
804
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
768
805
|
* messages not supporting bigint
|
|
769
806
|
* (https://issues.chromium.org/issues/40116184).
|
|
770
807
|
*/
|
|
771
|
-
unconfirmed:
|
|
808
|
+
unconfirmed: v5.string(),
|
|
772
809
|
/**
|
|
773
810
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
774
811
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
775
812
|
* (https://issues.chromium.org/issues/40116184).
|
|
776
813
|
*/
|
|
777
|
-
total:
|
|
814
|
+
total: v5.string()
|
|
778
815
|
});
|
|
779
|
-
var getBalanceRequestMessageSchema =
|
|
816
|
+
var getBalanceRequestMessageSchema = v5.object({
|
|
780
817
|
...rpcRequestMessageSchema.entries,
|
|
781
|
-
...
|
|
782
|
-
method:
|
|
783
|
-
id:
|
|
818
|
+
...v5.object({
|
|
819
|
+
method: v5.literal(getBalanceMethodName),
|
|
820
|
+
id: v5.string()
|
|
784
821
|
}).entries
|
|
785
822
|
});
|
|
786
823
|
|
|
787
824
|
// src/request/types/walletMethods.ts
|
|
788
|
-
import * as
|
|
825
|
+
import * as v6 from "valibot";
|
|
789
826
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
790
|
-
var requestPermissionsParamsSchema =
|
|
791
|
-
var requestPermissionsResultSchema =
|
|
792
|
-
var requestPermissionsRequestMessageSchema =
|
|
827
|
+
var requestPermissionsParamsSchema = v6.undefined();
|
|
828
|
+
var requestPermissionsResultSchema = v6.literal(true);
|
|
829
|
+
var requestPermissionsRequestMessageSchema = v6.object({
|
|
793
830
|
...rpcRequestMessageSchema.entries,
|
|
794
|
-
...
|
|
795
|
-
method:
|
|
831
|
+
...v6.object({
|
|
832
|
+
method: v6.literal(requestPermissionsMethodName),
|
|
796
833
|
params: requestPermissionsParamsSchema,
|
|
797
|
-
id:
|
|
834
|
+
id: v6.string()
|
|
798
835
|
}).entries
|
|
799
836
|
});
|
|
800
837
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
801
|
-
var renouncePermissionsParamsSchema =
|
|
802
|
-
var renouncePermissionsResultSchema =
|
|
803
|
-
var renouncePermissionsRequestMessageSchema =
|
|
838
|
+
var renouncePermissionsParamsSchema = v6.undefined();
|
|
839
|
+
var renouncePermissionsResultSchema = v6.literal(true);
|
|
840
|
+
var renouncePermissionsRequestMessageSchema = v6.object({
|
|
804
841
|
...rpcRequestMessageSchema.entries,
|
|
805
|
-
...
|
|
806
|
-
method:
|
|
842
|
+
...v6.object({
|
|
843
|
+
method: v6.literal(renouncePermissionsMethodName),
|
|
807
844
|
params: renouncePermissionsParamsSchema,
|
|
808
|
-
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()
|
|
809
856
|
}).entries
|
|
810
857
|
});
|
|
811
858
|
|
|
812
859
|
// src/request/types/runesMethods.ts
|
|
813
|
-
import * as
|
|
860
|
+
import * as v7 from "valibot";
|
|
814
861
|
var getRunesBalanceMethodName = "runes_getBalance";
|
|
815
|
-
var getRunesBalanceParamsSchema =
|
|
816
|
-
var getRunesBalanceResultSchema =
|
|
817
|
-
balances:
|
|
818
|
-
|
|
819
|
-
runeName:
|
|
820
|
-
amount:
|
|
821
|
-
divisibility:
|
|
822
|
-
symbol:
|
|
823
|
-
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())
|
|
824
871
|
})
|
|
825
872
|
)
|
|
826
873
|
});
|
|
827
|
-
var getRunesBalanceRequestMessageSchema =
|
|
874
|
+
var getRunesBalanceRequestMessageSchema = v7.object({
|
|
828
875
|
...rpcRequestMessageSchema.entries,
|
|
829
|
-
...
|
|
830
|
-
method:
|
|
876
|
+
...v7.object({
|
|
877
|
+
method: v7.literal(getRunesBalanceMethodName),
|
|
831
878
|
params: getRunesBalanceParamsSchema,
|
|
832
|
-
id:
|
|
879
|
+
id: v7.string()
|
|
833
880
|
}).entries
|
|
834
881
|
});
|
|
835
882
|
|
|
836
883
|
// src/request/types/ordinalsMethods.ts
|
|
837
|
-
import * as
|
|
884
|
+
import * as v8 from "valibot";
|
|
838
885
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
839
|
-
var getInscriptionsParamsSchema =
|
|
840
|
-
offset:
|
|
841
|
-
limit:
|
|
886
|
+
var getInscriptionsParamsSchema = v8.object({
|
|
887
|
+
offset: v8.number(),
|
|
888
|
+
limit: v8.number()
|
|
842
889
|
});
|
|
843
|
-
var getInscriptionsResultSchema =
|
|
844
|
-
total:
|
|
845
|
-
limit:
|
|
846
|
-
offset:
|
|
847
|
-
inscriptions:
|
|
848
|
-
|
|
849
|
-
inscriptionId:
|
|
850
|
-
inscriptionNumber:
|
|
851
|
-
address:
|
|
852
|
-
collectionName:
|
|
853
|
-
postage:
|
|
854
|
-
contentLength:
|
|
855
|
-
contentType:
|
|
856
|
-
timestamp:
|
|
857
|
-
offset:
|
|
858
|
-
genesisTransaction:
|
|
859
|
-
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()
|
|
860
907
|
})
|
|
861
908
|
)
|
|
862
909
|
});
|
|
863
|
-
var getInscriptionsSchema =
|
|
910
|
+
var getInscriptionsSchema = v8.object({
|
|
864
911
|
...rpcRequestMessageSchema.entries,
|
|
865
|
-
...
|
|
866
|
-
method:
|
|
912
|
+
...v8.object({
|
|
913
|
+
method: v8.literal(getInscriptionsMethodName),
|
|
867
914
|
params: getInscriptionsParamsSchema,
|
|
868
|
-
id:
|
|
915
|
+
id: v8.string()
|
|
869
916
|
}).entries
|
|
870
917
|
});
|
|
871
918
|
|
|
@@ -882,13 +929,13 @@ var request = async (method, params, providerId) => {
|
|
|
882
929
|
throw new Error("A wallet method is required");
|
|
883
930
|
}
|
|
884
931
|
const response = await provider.request(method, params);
|
|
885
|
-
if (
|
|
932
|
+
if (v9.is(rpcErrorResponseMessageSchema, response)) {
|
|
886
933
|
return {
|
|
887
934
|
status: "error",
|
|
888
935
|
error: response.error
|
|
889
936
|
};
|
|
890
937
|
}
|
|
891
|
-
if (
|
|
938
|
+
if (v9.is(rpcSuccessResponseMessageSchema, response)) {
|
|
892
939
|
return {
|
|
893
940
|
status: "success",
|
|
894
941
|
result: response.result
|
|
@@ -1317,6 +1364,7 @@ export {
|
|
|
1317
1364
|
BaseAdapter,
|
|
1318
1365
|
BitcoinNetworkType,
|
|
1319
1366
|
DefaultAdaptersInfo,
|
|
1367
|
+
MessageSigningProtocols,
|
|
1320
1368
|
RpcErrorCode,
|
|
1321
1369
|
RpcIdSchema,
|
|
1322
1370
|
SatsConnectAdapter,
|
|
@@ -1355,6 +1403,10 @@ export {
|
|
|
1355
1403
|
getRunesBalanceRequestMessageSchema,
|
|
1356
1404
|
getRunesBalanceResultSchema,
|
|
1357
1405
|
getSupportedWallets,
|
|
1406
|
+
getWalletTypeMethodName,
|
|
1407
|
+
getWalletTypeParamsSchema,
|
|
1408
|
+
getWalletTypeRequestMessageSchema,
|
|
1409
|
+
getWalletTypeResultSchema,
|
|
1358
1410
|
isProviderInstalled,
|
|
1359
1411
|
removeDefaultProvider,
|
|
1360
1412
|
renouncePermissionsMethodName,
|
|
@@ -1386,5 +1438,7 @@ export {
|
|
|
1386
1438
|
stxSignTransactionMethodName,
|
|
1387
1439
|
stxSignTransactionParamsSchema,
|
|
1388
1440
|
stxSignTransactionRequestMessageSchema,
|
|
1389
|
-
stxSignTransactionResultSchema
|
|
1441
|
+
stxSignTransactionResultSchema,
|
|
1442
|
+
walletTypeSchema,
|
|
1443
|
+
walletTypes
|
|
1390
1444
|
};
|