@sats-connect/core 0.1.0-b9085f0 → 0.1.0
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 +27 -7
- package/dist/index.mjs +140 -100
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -339,7 +339,9 @@ declare const getAddressesResultSchema: v.ObjectSchema<{
|
|
|
339
339
|
readonly addresses: v.ArraySchema<v.ObjectSchema<{
|
|
340
340
|
readonly address: v.StringSchema<undefined>;
|
|
341
341
|
readonly publicKey: v.StringSchema<undefined>;
|
|
342
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
342
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>; /**
|
|
343
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
344
|
+
*/
|
|
343
345
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
344
346
|
}, undefined>, undefined>;
|
|
345
347
|
}, undefined>;
|
|
@@ -476,9 +478,12 @@ declare const getAccountsParamsSchema: v.ObjectSchema<{
|
|
|
476
478
|
}, undefined>;
|
|
477
479
|
type GetAccountsParams = v.InferOutput<typeof getAccountsParamsSchema>;
|
|
478
480
|
declare const getAccountsResultSchema: v.ArraySchema<v.ObjectSchema<{
|
|
481
|
+
readonly walletType: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
479
482
|
readonly address: v.StringSchema<undefined>;
|
|
480
483
|
readonly publicKey: v.StringSchema<undefined>;
|
|
481
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
484
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>; /**
|
|
485
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
486
|
+
*/
|
|
482
487
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
483
488
|
}, undefined>, undefined>;
|
|
484
489
|
type GetAccountsResult = v.InferOutput<typeof getAccountsResultSchema>;
|
|
@@ -968,6 +973,20 @@ declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
|
968
973
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
969
974
|
}, undefined>;
|
|
970
975
|
type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
|
|
976
|
+
declare const getWalletTypeMethodName = "wallet_getWalletType";
|
|
977
|
+
declare const getWalletTypeParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
|
|
978
|
+
declare const getWalletTypeResultSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
979
|
+
declare const getWalletTypeRequestMessageSchema: v.ObjectSchema<{
|
|
980
|
+
readonly method: v.LiteralSchema<"wallet_getWalletType", undefined>;
|
|
981
|
+
readonly id: v.StringSchema<undefined>;
|
|
982
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
983
|
+
readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
984
|
+
}, undefined>;
|
|
985
|
+
type GetWalletType = MethodParamsAndResult<v.InferOutput<typeof getWalletTypeParamsSchema>, v.InferOutput<typeof getWalletTypeResultSchema>>;
|
|
986
|
+
|
|
987
|
+
declare const walletTypes: readonly ["software", "ledger"];
|
|
988
|
+
declare const walletTypeSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
989
|
+
type WalletType = v.InferOutput<typeof walletTypeSchema>;
|
|
971
990
|
|
|
972
991
|
interface StxRequests {
|
|
973
992
|
stx_callContract: StxCallContract;
|
|
@@ -1005,15 +1024,16 @@ interface OrdinalsRequests {
|
|
|
1005
1024
|
ord_getInscriptions: GetInscriptions;
|
|
1006
1025
|
}
|
|
1007
1026
|
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
1008
|
-
interface
|
|
1027
|
+
interface WalletRequests {
|
|
1009
1028
|
wallet_requestPermissions: RequestPermissions;
|
|
1010
1029
|
wallet_renouncePermissions: RenouncePermissions;
|
|
1030
|
+
wallet_getWalletType: GetWalletType;
|
|
1011
1031
|
}
|
|
1012
|
-
type Requests = BtcRequests & StxRequests & RunesRequests &
|
|
1032
|
+
type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & OrdinalsRequests;
|
|
1013
1033
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
1014
1034
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
1015
1035
|
|
|
1016
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof
|
|
1036
|
+
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
1037
|
|
|
1018
1038
|
declare abstract class SatsConnectAdapter {
|
|
1019
1039
|
abstract readonly id: string;
|
|
@@ -1031,10 +1051,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
1031
1051
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
1032
1052
|
id: string;
|
|
1033
1053
|
constructor(providerId: string);
|
|
1034
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof
|
|
1054
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
1035
1055
|
}
|
|
1036
1056
|
|
|
1037
1057
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
1038
1058
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
1039
1059
|
|
|
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
|
|
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 };
|
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,247 @@ 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 signMessageParamsSchema =
|
|
721
|
+
var signMessageParamsSchema = v5.object({
|
|
715
722
|
/**
|
|
716
723
|
* The address used for signing.
|
|
717
724
|
**/
|
|
718
|
-
address:
|
|
725
|
+
address: v5.string(),
|
|
719
726
|
/**
|
|
720
727
|
* The message to sign.
|
|
721
728
|
**/
|
|
722
|
-
message:
|
|
729
|
+
message: v5.string()
|
|
723
730
|
});
|
|
724
|
-
var signMessageResultSchema =
|
|
731
|
+
var signMessageResultSchema = v5.object({
|
|
725
732
|
/**
|
|
726
733
|
* The signature of the message.
|
|
727
734
|
*/
|
|
728
|
-
signature:
|
|
735
|
+
signature: v5.string(),
|
|
729
736
|
/**
|
|
730
737
|
* hash of the message.
|
|
731
738
|
*/
|
|
732
|
-
messageHash:
|
|
739
|
+
messageHash: v5.string(),
|
|
733
740
|
/**
|
|
734
741
|
* The address used for signing.
|
|
735
742
|
*/
|
|
736
|
-
address:
|
|
743
|
+
address: v5.string()
|
|
737
744
|
});
|
|
738
|
-
var signMessageRequestMessageSchema =
|
|
745
|
+
var signMessageRequestMessageSchema = v5.object({
|
|
739
746
|
...rpcRequestMessageSchema.entries,
|
|
740
|
-
...
|
|
741
|
-
method:
|
|
747
|
+
...v5.object({
|
|
748
|
+
method: v5.literal(signMessageMethodName),
|
|
742
749
|
params: signMessageParamsSchema,
|
|
743
|
-
id:
|
|
750
|
+
id: v5.string()
|
|
744
751
|
}).entries
|
|
745
752
|
});
|
|
746
753
|
var getAccountsMethodName = "getAccounts";
|
|
747
|
-
var getAccountsParamsSchema =
|
|
748
|
-
|
|
749
|
-
|
|
754
|
+
var getAccountsParamsSchema = v5.object({
|
|
755
|
+
/**
|
|
756
|
+
* The purposes for which to generate addresses. See
|
|
757
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
758
|
+
*/
|
|
759
|
+
purposes: v5.array(v5.enum(AddressPurpose)),
|
|
760
|
+
/**
|
|
761
|
+
* A message to be displayed to the user in the request prompt.
|
|
762
|
+
*/
|
|
763
|
+
message: v5.optional(v5.string())
|
|
764
|
+
});
|
|
765
|
+
var getAccountsResultSchema = v5.array(
|
|
766
|
+
v5.object({
|
|
767
|
+
...addressSchema.entries,
|
|
768
|
+
...v5.object({
|
|
769
|
+
walletType: walletTypeSchema
|
|
770
|
+
}).entries
|
|
771
|
+
})
|
|
772
|
+
);
|
|
773
|
+
var getAccountsRequestMessageSchema = v5.object({
|
|
750
774
|
...rpcRequestMessageSchema.entries,
|
|
751
|
-
...
|
|
752
|
-
method:
|
|
775
|
+
...v5.object({
|
|
776
|
+
method: v5.literal(getAccountsMethodName),
|
|
753
777
|
params: getAccountsParamsSchema,
|
|
754
|
-
id:
|
|
778
|
+
id: v5.string()
|
|
755
779
|
}).entries
|
|
756
780
|
});
|
|
757
781
|
var getBalanceMethodName = "getBalance";
|
|
758
|
-
var getBalanceParamsSchema =
|
|
759
|
-
var getBalanceResultSchema =
|
|
782
|
+
var getBalanceParamsSchema = v5.nullish(v5.null());
|
|
783
|
+
var getBalanceResultSchema = v5.object({
|
|
760
784
|
/**
|
|
761
785
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
762
786
|
* messages not supporting bigint
|
|
763
787
|
* (https://issues.chromium.org/issues/40116184).
|
|
764
788
|
*/
|
|
765
|
-
confirmed:
|
|
789
|
+
confirmed: v5.string(),
|
|
766
790
|
/**
|
|
767
791
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
768
792
|
* messages not supporting bigint
|
|
769
793
|
* (https://issues.chromium.org/issues/40116184).
|
|
770
794
|
*/
|
|
771
|
-
unconfirmed:
|
|
795
|
+
unconfirmed: v5.string(),
|
|
772
796
|
/**
|
|
773
797
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
774
798
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
775
799
|
* (https://issues.chromium.org/issues/40116184).
|
|
776
800
|
*/
|
|
777
|
-
total:
|
|
801
|
+
total: v5.string()
|
|
778
802
|
});
|
|
779
|
-
var getBalanceRequestMessageSchema =
|
|
803
|
+
var getBalanceRequestMessageSchema = v5.object({
|
|
780
804
|
...rpcRequestMessageSchema.entries,
|
|
781
|
-
...
|
|
782
|
-
method:
|
|
783
|
-
id:
|
|
805
|
+
...v5.object({
|
|
806
|
+
method: v5.literal(getBalanceMethodName),
|
|
807
|
+
id: v5.string()
|
|
784
808
|
}).entries
|
|
785
809
|
});
|
|
786
810
|
|
|
787
811
|
// src/request/types/walletMethods.ts
|
|
788
|
-
import * as
|
|
812
|
+
import * as v6 from "valibot";
|
|
789
813
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
790
|
-
var requestPermissionsParamsSchema =
|
|
791
|
-
var requestPermissionsResultSchema =
|
|
792
|
-
var requestPermissionsRequestMessageSchema =
|
|
814
|
+
var requestPermissionsParamsSchema = v6.undefined();
|
|
815
|
+
var requestPermissionsResultSchema = v6.literal(true);
|
|
816
|
+
var requestPermissionsRequestMessageSchema = v6.object({
|
|
793
817
|
...rpcRequestMessageSchema.entries,
|
|
794
|
-
...
|
|
795
|
-
method:
|
|
818
|
+
...v6.object({
|
|
819
|
+
method: v6.literal(requestPermissionsMethodName),
|
|
796
820
|
params: requestPermissionsParamsSchema,
|
|
797
|
-
id:
|
|
821
|
+
id: v6.string()
|
|
798
822
|
}).entries
|
|
799
823
|
});
|
|
800
824
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
801
|
-
var renouncePermissionsParamsSchema =
|
|
802
|
-
var renouncePermissionsResultSchema =
|
|
803
|
-
var renouncePermissionsRequestMessageSchema =
|
|
825
|
+
var renouncePermissionsParamsSchema = v6.undefined();
|
|
826
|
+
var renouncePermissionsResultSchema = v6.literal(true);
|
|
827
|
+
var renouncePermissionsRequestMessageSchema = v6.object({
|
|
804
828
|
...rpcRequestMessageSchema.entries,
|
|
805
|
-
...
|
|
806
|
-
method:
|
|
829
|
+
...v6.object({
|
|
830
|
+
method: v6.literal(renouncePermissionsMethodName),
|
|
807
831
|
params: renouncePermissionsParamsSchema,
|
|
808
|
-
id:
|
|
832
|
+
id: v6.string()
|
|
833
|
+
}).entries
|
|
834
|
+
});
|
|
835
|
+
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
836
|
+
var getWalletTypeParamsSchema = v6.nullish(v6.null());
|
|
837
|
+
var getWalletTypeResultSchema = walletTypeSchema;
|
|
838
|
+
var getWalletTypeRequestMessageSchema = v6.object({
|
|
839
|
+
...rpcRequestMessageSchema.entries,
|
|
840
|
+
...v6.object({
|
|
841
|
+
method: v6.literal(getWalletTypeMethodName),
|
|
842
|
+
id: v6.string()
|
|
809
843
|
}).entries
|
|
810
844
|
});
|
|
811
845
|
|
|
812
846
|
// src/request/types/runesMethods.ts
|
|
813
|
-
import * as
|
|
847
|
+
import * as v7 from "valibot";
|
|
814
848
|
var getRunesBalanceMethodName = "runes_getBalance";
|
|
815
|
-
var getRunesBalanceParamsSchema =
|
|
816
|
-
var getRunesBalanceResultSchema =
|
|
817
|
-
balances:
|
|
818
|
-
|
|
819
|
-
runeName:
|
|
820
|
-
amount:
|
|
821
|
-
divisibility:
|
|
822
|
-
symbol:
|
|
823
|
-
inscriptionId:
|
|
849
|
+
var getRunesBalanceParamsSchema = v7.nullish(v7.null());
|
|
850
|
+
var getRunesBalanceResultSchema = v7.object({
|
|
851
|
+
balances: v7.array(
|
|
852
|
+
v7.object({
|
|
853
|
+
runeName: v7.string(),
|
|
854
|
+
amount: v7.string(),
|
|
855
|
+
divisibility: v7.number(),
|
|
856
|
+
symbol: v7.string(),
|
|
857
|
+
inscriptionId: v7.nullish(v7.string())
|
|
824
858
|
})
|
|
825
859
|
)
|
|
826
860
|
});
|
|
827
|
-
var getRunesBalanceRequestMessageSchema =
|
|
861
|
+
var getRunesBalanceRequestMessageSchema = v7.object({
|
|
828
862
|
...rpcRequestMessageSchema.entries,
|
|
829
|
-
...
|
|
830
|
-
method:
|
|
863
|
+
...v7.object({
|
|
864
|
+
method: v7.literal(getRunesBalanceMethodName),
|
|
831
865
|
params: getRunesBalanceParamsSchema,
|
|
832
|
-
id:
|
|
866
|
+
id: v7.string()
|
|
833
867
|
}).entries
|
|
834
868
|
});
|
|
835
869
|
|
|
836
870
|
// src/request/types/ordinalsMethods.ts
|
|
837
|
-
import * as
|
|
871
|
+
import * as v8 from "valibot";
|
|
838
872
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
839
|
-
var getInscriptionsParamsSchema =
|
|
840
|
-
offset:
|
|
841
|
-
limit:
|
|
873
|
+
var getInscriptionsParamsSchema = v8.object({
|
|
874
|
+
offset: v8.number(),
|
|
875
|
+
limit: v8.number()
|
|
842
876
|
});
|
|
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:
|
|
877
|
+
var getInscriptionsResultSchema = v8.object({
|
|
878
|
+
total: v8.number(),
|
|
879
|
+
limit: v8.number(),
|
|
880
|
+
offset: v8.number(),
|
|
881
|
+
inscriptions: v8.array(
|
|
882
|
+
v8.object({
|
|
883
|
+
inscriptionId: v8.string(),
|
|
884
|
+
inscriptionNumber: v8.string(),
|
|
885
|
+
address: v8.string(),
|
|
886
|
+
collectionName: v8.optional(v8.string()),
|
|
887
|
+
postage: v8.string(),
|
|
888
|
+
contentLength: v8.string(),
|
|
889
|
+
contentType: v8.string(),
|
|
890
|
+
timestamp: v8.number(),
|
|
891
|
+
offset: v8.number(),
|
|
892
|
+
genesisTransaction: v8.string(),
|
|
893
|
+
output: v8.string()
|
|
860
894
|
})
|
|
861
895
|
)
|
|
862
896
|
});
|
|
863
|
-
var getInscriptionsSchema =
|
|
897
|
+
var getInscriptionsSchema = v8.object({
|
|
864
898
|
...rpcRequestMessageSchema.entries,
|
|
865
|
-
...
|
|
866
|
-
method:
|
|
899
|
+
...v8.object({
|
|
900
|
+
method: v8.literal(getInscriptionsMethodName),
|
|
867
901
|
params: getInscriptionsParamsSchema,
|
|
868
|
-
id:
|
|
902
|
+
id: v8.string()
|
|
869
903
|
}).entries
|
|
870
904
|
});
|
|
871
905
|
|
|
@@ -882,13 +916,13 @@ var request = async (method, params, providerId) => {
|
|
|
882
916
|
throw new Error("A wallet method is required");
|
|
883
917
|
}
|
|
884
918
|
const response = await provider.request(method, params);
|
|
885
|
-
if (
|
|
919
|
+
if (v9.is(rpcErrorResponseMessageSchema, response)) {
|
|
886
920
|
return {
|
|
887
921
|
status: "error",
|
|
888
922
|
error: response.error
|
|
889
923
|
};
|
|
890
924
|
}
|
|
891
|
-
if (
|
|
925
|
+
if (v9.is(rpcSuccessResponseMessageSchema, response)) {
|
|
892
926
|
return {
|
|
893
927
|
status: "success",
|
|
894
928
|
result: response.result
|
|
@@ -1355,6 +1389,10 @@ export {
|
|
|
1355
1389
|
getRunesBalanceRequestMessageSchema,
|
|
1356
1390
|
getRunesBalanceResultSchema,
|
|
1357
1391
|
getSupportedWallets,
|
|
1392
|
+
getWalletTypeMethodName,
|
|
1393
|
+
getWalletTypeParamsSchema,
|
|
1394
|
+
getWalletTypeRequestMessageSchema,
|
|
1395
|
+
getWalletTypeResultSchema,
|
|
1358
1396
|
isProviderInstalled,
|
|
1359
1397
|
removeDefaultProvider,
|
|
1360
1398
|
renouncePermissionsMethodName,
|
|
@@ -1386,5 +1424,7 @@ export {
|
|
|
1386
1424
|
stxSignTransactionMethodName,
|
|
1387
1425
|
stxSignTransactionParamsSchema,
|
|
1388
1426
|
stxSignTransactionRequestMessageSchema,
|
|
1389
|
-
stxSignTransactionResultSchema
|
|
1427
|
+
stxSignTransactionResultSchema,
|
|
1428
|
+
walletTypeSchema,
|
|
1429
|
+
walletTypes
|
|
1390
1430
|
};
|