@sats-connect/core 0.0.15-8fbc081 → 0.0.15-c57972c
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 +142 -102
- 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>;
|
|
@@ -925,6 +930,20 @@ declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
|
925
930
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
926
931
|
}, undefined>;
|
|
927
932
|
type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
|
|
933
|
+
declare const getWalletTypeMethodName = "wallet_getWalletType";
|
|
934
|
+
declare const getWalletTypeParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
|
|
935
|
+
declare const getWalletTypeResultSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
936
|
+
declare const getWalletTypeRequestMessageSchema: v.ObjectSchema<{
|
|
937
|
+
readonly method: v.LiteralSchema<"wallet_getWalletType", undefined>;
|
|
938
|
+
readonly id: v.StringSchema<undefined>;
|
|
939
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
940
|
+
readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
941
|
+
}, undefined>;
|
|
942
|
+
type GetWalletType = MethodParamsAndResult<v.InferOutput<typeof getWalletTypeParamsSchema>, v.InferOutput<typeof getWalletTypeResultSchema>>;
|
|
943
|
+
|
|
944
|
+
declare const walletTypes: readonly ["software", "ledger"];
|
|
945
|
+
declare const walletTypeSchema: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
946
|
+
type WalletType = v.InferOutput<typeof walletTypeSchema>;
|
|
928
947
|
|
|
929
948
|
interface StxRequests {
|
|
930
949
|
stx_callContract: StxCallContract;
|
|
@@ -962,15 +981,16 @@ interface OrdinalsRequests {
|
|
|
962
981
|
ord_getInscriptions: GetInscriptions;
|
|
963
982
|
}
|
|
964
983
|
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
965
|
-
interface
|
|
984
|
+
interface WalletRequests {
|
|
966
985
|
wallet_requestPermissions: RequestPermissions;
|
|
967
986
|
wallet_renouncePermissions: RenouncePermissions;
|
|
987
|
+
wallet_getWalletType: GetWalletType;
|
|
968
988
|
}
|
|
969
|
-
type Requests = BtcRequests & StxRequests & RunesRequests &
|
|
989
|
+
type Requests = BtcRequests & StxRequests & RunesRequests & WalletRequests & OrdinalsRequests;
|
|
970
990
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
971
991
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
972
992
|
|
|
973
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof
|
|
993
|
+
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
994
|
|
|
975
995
|
declare abstract class SatsConnectAdapter {
|
|
976
996
|
abstract readonly id: string;
|
|
@@ -988,10 +1008,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
988
1008
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
989
1009
|
id: string;
|
|
990
1010
|
constructor(providerId: string);
|
|
991
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof
|
|
1011
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletRequests | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
992
1012
|
}
|
|
993
1013
|
|
|
994
1014
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
995
1015
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
996
1016
|
|
|
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 SignTransactionParams, type SignTransactionPayload, type SignTransactionResponse, type SignTransactionResult, 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 StxTransferStx, type SupportedWallet, type TransferStxParams, type TransferStxResult, type
|
|
1017
|
+
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 SignTransactionParams, type SignTransactionPayload, type SignTransactionResponse, type SignTransactionResult, 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 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, walletTypeSchema, walletTypes };
|
package/dist/index.mjs
CHANGED
|
@@ -211,7 +211,7 @@ var SatsConnectAdapter = class {
|
|
|
211
211
|
if (response.status === "success") {
|
|
212
212
|
return response;
|
|
213
213
|
}
|
|
214
|
-
if (response.status === "error" && response.error.code !== -
|
|
214
|
+
if (response.status === "error" && response.error.code !== -32601 /* METHOD_NOT_FOUND */) {
|
|
215
215
|
return response;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -295,7 +295,7 @@ var SatsConnectAdapter = class {
|
|
|
295
295
|
if (response.status === "success") {
|
|
296
296
|
return response;
|
|
297
297
|
}
|
|
298
|
-
if (response.status === "error" && response.error.code !== -
|
|
298
|
+
if (response.status === "error" && response.error.code !== -32601 /* METHOD_NOT_FOUND */) {
|
|
299
299
|
return response;
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -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";
|
|
@@ -629,213 +629,247 @@ var stxGetAddressesRequestMessageSchema = v3.object({
|
|
|
629
629
|
});
|
|
630
630
|
|
|
631
631
|
// src/request/types/btcMethods.ts
|
|
632
|
+
import * as v5 from "valibot";
|
|
633
|
+
|
|
634
|
+
// src/request/types/common.ts
|
|
632
635
|
import * as v4 from "valibot";
|
|
636
|
+
var walletTypes = ["software", "ledger"];
|
|
637
|
+
var walletTypeSchema = v4.picklist(walletTypes);
|
|
638
|
+
|
|
639
|
+
// src/request/types/btcMethods.ts
|
|
633
640
|
var getInfoMethodName = "getInfo";
|
|
634
|
-
var getInfoParamsSchema =
|
|
635
|
-
var getInfoResultSchema =
|
|
641
|
+
var getInfoParamsSchema = v5.nullish(v5.null());
|
|
642
|
+
var getInfoResultSchema = v5.object({
|
|
636
643
|
/**
|
|
637
644
|
* Version of the wallet.
|
|
638
645
|
*/
|
|
639
|
-
version:
|
|
646
|
+
version: v5.string(),
|
|
640
647
|
/**
|
|
641
648
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
642
649
|
*/
|
|
643
|
-
methods:
|
|
650
|
+
methods: v5.optional(v5.array(v5.string())),
|
|
644
651
|
/**
|
|
645
652
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
646
653
|
*/
|
|
647
|
-
supports:
|
|
654
|
+
supports: v5.array(v5.string())
|
|
648
655
|
});
|
|
649
|
-
var getInfoRequestMessageSchema =
|
|
656
|
+
var getInfoRequestMessageSchema = v5.object({
|
|
650
657
|
...rpcRequestMessageSchema.entries,
|
|
651
|
-
...
|
|
652
|
-
method:
|
|
658
|
+
...v5.object({
|
|
659
|
+
method: v5.literal(getInfoMethodName),
|
|
653
660
|
params: getInfoParamsSchema,
|
|
654
|
-
id:
|
|
661
|
+
id: v5.string()
|
|
655
662
|
}).entries
|
|
656
663
|
});
|
|
657
664
|
var getAddressesMethodName = "getAddresses";
|
|
658
|
-
var getAddressesParamsSchema =
|
|
665
|
+
var getAddressesParamsSchema = v5.object({
|
|
659
666
|
/**
|
|
660
667
|
* The purposes for which to generate addresses. See
|
|
661
668
|
* {@linkcode AddressPurpose} for available purposes.
|
|
662
669
|
*/
|
|
663
|
-
purposes:
|
|
670
|
+
purposes: v5.array(v5.enum(AddressPurpose)),
|
|
664
671
|
/**
|
|
665
672
|
* A message to be displayed to the user in the request prompt.
|
|
666
673
|
*/
|
|
667
|
-
message:
|
|
674
|
+
message: v5.optional(v5.string())
|
|
668
675
|
});
|
|
669
|
-
var getAddressesResultSchema =
|
|
676
|
+
var getAddressesResultSchema = v5.object({
|
|
670
677
|
/**
|
|
671
678
|
* The addresses generated for the given purposes.
|
|
672
679
|
*/
|
|
673
|
-
addresses:
|
|
680
|
+
addresses: v5.array(addressSchema)
|
|
674
681
|
});
|
|
675
|
-
var getAddressesRequestMessageSchema =
|
|
682
|
+
var getAddressesRequestMessageSchema = v5.object({
|
|
676
683
|
...rpcRequestMessageSchema.entries,
|
|
677
|
-
...
|
|
678
|
-
method:
|
|
684
|
+
...v5.object({
|
|
685
|
+
method: v5.literal(getAddressesMethodName),
|
|
679
686
|
params: getAddressesParamsSchema,
|
|
680
|
-
id:
|
|
687
|
+
id: v5.string()
|
|
681
688
|
}).entries
|
|
682
689
|
});
|
|
683
690
|
var signMessageMethodName = "signMessage";
|
|
684
|
-
var signMessageParamsSchema =
|
|
691
|
+
var signMessageParamsSchema = v5.object({
|
|
685
692
|
/**
|
|
686
693
|
* The address used for signing.
|
|
687
694
|
**/
|
|
688
|
-
address:
|
|
695
|
+
address: v5.string(),
|
|
689
696
|
/**
|
|
690
697
|
* The message to sign.
|
|
691
698
|
**/
|
|
692
|
-
message:
|
|
699
|
+
message: v5.string()
|
|
693
700
|
});
|
|
694
|
-
var signMessageResultSchema =
|
|
701
|
+
var signMessageResultSchema = v5.object({
|
|
695
702
|
/**
|
|
696
703
|
* The signature of the message.
|
|
697
704
|
*/
|
|
698
|
-
signature:
|
|
705
|
+
signature: v5.string(),
|
|
699
706
|
/**
|
|
700
707
|
* hash of the message.
|
|
701
708
|
*/
|
|
702
|
-
messageHash:
|
|
709
|
+
messageHash: v5.string(),
|
|
703
710
|
/**
|
|
704
711
|
* The address used for signing.
|
|
705
712
|
*/
|
|
706
|
-
address:
|
|
713
|
+
address: v5.string()
|
|
707
714
|
});
|
|
708
|
-
var signMessageRequestMessageSchema =
|
|
715
|
+
var signMessageRequestMessageSchema = v5.object({
|
|
709
716
|
...rpcRequestMessageSchema.entries,
|
|
710
|
-
...
|
|
711
|
-
method:
|
|
717
|
+
...v5.object({
|
|
718
|
+
method: v5.literal(signMessageMethodName),
|
|
712
719
|
params: signMessageParamsSchema,
|
|
713
|
-
id:
|
|
720
|
+
id: v5.string()
|
|
714
721
|
}).entries
|
|
715
722
|
});
|
|
716
723
|
var getAccountsMethodName = "getAccounts";
|
|
717
|
-
var getAccountsParamsSchema =
|
|
718
|
-
|
|
719
|
-
|
|
724
|
+
var getAccountsParamsSchema = v5.object({
|
|
725
|
+
/**
|
|
726
|
+
* The purposes for which to generate addresses. See
|
|
727
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
728
|
+
*/
|
|
729
|
+
purposes: v5.array(v5.enum(AddressPurpose)),
|
|
730
|
+
/**
|
|
731
|
+
* A message to be displayed to the user in the request prompt.
|
|
732
|
+
*/
|
|
733
|
+
message: v5.optional(v5.string())
|
|
734
|
+
});
|
|
735
|
+
var getAccountsResultSchema = v5.array(
|
|
736
|
+
v5.object({
|
|
737
|
+
...addressSchema.entries,
|
|
738
|
+
...v5.object({
|
|
739
|
+
walletType: walletTypeSchema
|
|
740
|
+
}).entries
|
|
741
|
+
})
|
|
742
|
+
);
|
|
743
|
+
var getAccountsRequestMessageSchema = v5.object({
|
|
720
744
|
...rpcRequestMessageSchema.entries,
|
|
721
|
-
...
|
|
722
|
-
method:
|
|
745
|
+
...v5.object({
|
|
746
|
+
method: v5.literal(getAccountsMethodName),
|
|
723
747
|
params: getAccountsParamsSchema,
|
|
724
|
-
id:
|
|
748
|
+
id: v5.string()
|
|
725
749
|
}).entries
|
|
726
750
|
});
|
|
727
751
|
var getBalanceMethodName = "getBalance";
|
|
728
|
-
var getBalanceParamsSchema =
|
|
729
|
-
var getBalanceResultSchema =
|
|
752
|
+
var getBalanceParamsSchema = v5.nullish(v5.null());
|
|
753
|
+
var getBalanceResultSchema = v5.object({
|
|
730
754
|
/**
|
|
731
755
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
732
756
|
* messages not supporting bigint
|
|
733
757
|
* (https://issues.chromium.org/issues/40116184).
|
|
734
758
|
*/
|
|
735
|
-
confirmed:
|
|
759
|
+
confirmed: v5.string(),
|
|
736
760
|
/**
|
|
737
761
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
738
762
|
* messages not supporting bigint
|
|
739
763
|
* (https://issues.chromium.org/issues/40116184).
|
|
740
764
|
*/
|
|
741
|
-
unconfirmed:
|
|
765
|
+
unconfirmed: v5.string(),
|
|
742
766
|
/**
|
|
743
767
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
744
768
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
745
769
|
* (https://issues.chromium.org/issues/40116184).
|
|
746
770
|
*/
|
|
747
|
-
total:
|
|
771
|
+
total: v5.string()
|
|
748
772
|
});
|
|
749
|
-
var getBalanceRequestMessageSchema =
|
|
773
|
+
var getBalanceRequestMessageSchema = v5.object({
|
|
750
774
|
...rpcRequestMessageSchema.entries,
|
|
751
|
-
...
|
|
752
|
-
method:
|
|
753
|
-
id:
|
|
775
|
+
...v5.object({
|
|
776
|
+
method: v5.literal(getBalanceMethodName),
|
|
777
|
+
id: v5.string()
|
|
754
778
|
}).entries
|
|
755
779
|
});
|
|
756
780
|
|
|
757
781
|
// src/request/types/walletMethods.ts
|
|
758
|
-
import * as
|
|
782
|
+
import * as v6 from "valibot";
|
|
759
783
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
760
|
-
var requestPermissionsParamsSchema =
|
|
761
|
-
var requestPermissionsResultSchema =
|
|
762
|
-
var requestPermissionsRequestMessageSchema =
|
|
784
|
+
var requestPermissionsParamsSchema = v6.undefined();
|
|
785
|
+
var requestPermissionsResultSchema = v6.literal(true);
|
|
786
|
+
var requestPermissionsRequestMessageSchema = v6.object({
|
|
763
787
|
...rpcRequestMessageSchema.entries,
|
|
764
|
-
...
|
|
765
|
-
method:
|
|
788
|
+
...v6.object({
|
|
789
|
+
method: v6.literal(requestPermissionsMethodName),
|
|
766
790
|
params: requestPermissionsParamsSchema,
|
|
767
|
-
id:
|
|
791
|
+
id: v6.string()
|
|
768
792
|
}).entries
|
|
769
793
|
});
|
|
770
794
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
771
|
-
var renouncePermissionsParamsSchema =
|
|
772
|
-
var renouncePermissionsResultSchema =
|
|
773
|
-
var renouncePermissionsRequestMessageSchema =
|
|
795
|
+
var renouncePermissionsParamsSchema = v6.undefined();
|
|
796
|
+
var renouncePermissionsResultSchema = v6.literal(true);
|
|
797
|
+
var renouncePermissionsRequestMessageSchema = v6.object({
|
|
774
798
|
...rpcRequestMessageSchema.entries,
|
|
775
|
-
...
|
|
776
|
-
method:
|
|
799
|
+
...v6.object({
|
|
800
|
+
method: v6.literal(renouncePermissionsMethodName),
|
|
777
801
|
params: renouncePermissionsParamsSchema,
|
|
778
|
-
id:
|
|
802
|
+
id: v6.string()
|
|
803
|
+
}).entries
|
|
804
|
+
});
|
|
805
|
+
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
806
|
+
var getWalletTypeParamsSchema = v6.nullish(v6.null());
|
|
807
|
+
var getWalletTypeResultSchema = walletTypeSchema;
|
|
808
|
+
var getWalletTypeRequestMessageSchema = v6.object({
|
|
809
|
+
...rpcRequestMessageSchema.entries,
|
|
810
|
+
...v6.object({
|
|
811
|
+
method: v6.literal(getWalletTypeMethodName),
|
|
812
|
+
id: v6.string()
|
|
779
813
|
}).entries
|
|
780
814
|
});
|
|
781
815
|
|
|
782
816
|
// src/request/types/runesMethods.ts
|
|
783
|
-
import * as
|
|
817
|
+
import * as v7 from "valibot";
|
|
784
818
|
var getRunesBalanceMethodName = "runes_getBalance";
|
|
785
|
-
var getRunesBalanceParamsSchema =
|
|
786
|
-
var getRunesBalanceResultSchema =
|
|
787
|
-
balances:
|
|
788
|
-
|
|
789
|
-
runeName:
|
|
790
|
-
amount:
|
|
791
|
-
divisibility:
|
|
792
|
-
symbol:
|
|
793
|
-
inscriptionId:
|
|
819
|
+
var getRunesBalanceParamsSchema = v7.nullish(v7.null());
|
|
820
|
+
var getRunesBalanceResultSchema = v7.object({
|
|
821
|
+
balances: v7.array(
|
|
822
|
+
v7.object({
|
|
823
|
+
runeName: v7.string(),
|
|
824
|
+
amount: v7.string(),
|
|
825
|
+
divisibility: v7.number(),
|
|
826
|
+
symbol: v7.string(),
|
|
827
|
+
inscriptionId: v7.nullish(v7.string())
|
|
794
828
|
})
|
|
795
829
|
)
|
|
796
830
|
});
|
|
797
|
-
var getRunesBalanceRequestMessageSchema =
|
|
831
|
+
var getRunesBalanceRequestMessageSchema = v7.object({
|
|
798
832
|
...rpcRequestMessageSchema.entries,
|
|
799
|
-
...
|
|
800
|
-
method:
|
|
833
|
+
...v7.object({
|
|
834
|
+
method: v7.literal(getRunesBalanceMethodName),
|
|
801
835
|
params: getRunesBalanceParamsSchema,
|
|
802
|
-
id:
|
|
836
|
+
id: v7.string()
|
|
803
837
|
}).entries
|
|
804
838
|
});
|
|
805
839
|
|
|
806
840
|
// src/request/types/ordinalsMethods.ts
|
|
807
|
-
import * as
|
|
841
|
+
import * as v8 from "valibot";
|
|
808
842
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
809
|
-
var getInscriptionsParamsSchema =
|
|
810
|
-
offset:
|
|
811
|
-
limit:
|
|
843
|
+
var getInscriptionsParamsSchema = v8.object({
|
|
844
|
+
offset: v8.number(),
|
|
845
|
+
limit: v8.number()
|
|
812
846
|
});
|
|
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:
|
|
847
|
+
var getInscriptionsResultSchema = v8.object({
|
|
848
|
+
total: v8.number(),
|
|
849
|
+
limit: v8.number(),
|
|
850
|
+
offset: v8.number(),
|
|
851
|
+
inscriptions: v8.array(
|
|
852
|
+
v8.object({
|
|
853
|
+
inscriptionId: v8.string(),
|
|
854
|
+
inscriptionNumber: v8.string(),
|
|
855
|
+
address: v8.string(),
|
|
856
|
+
collectionName: v8.optional(v8.string()),
|
|
857
|
+
postage: v8.string(),
|
|
858
|
+
contentLength: v8.string(),
|
|
859
|
+
contentType: v8.string(),
|
|
860
|
+
timestamp: v8.number(),
|
|
861
|
+
offset: v8.number(),
|
|
862
|
+
genesisTransaction: v8.string(),
|
|
863
|
+
output: v8.string()
|
|
830
864
|
})
|
|
831
865
|
)
|
|
832
866
|
});
|
|
833
|
-
var getInscriptionsSchema =
|
|
867
|
+
var getInscriptionsSchema = v8.object({
|
|
834
868
|
...rpcRequestMessageSchema.entries,
|
|
835
|
-
...
|
|
836
|
-
method:
|
|
869
|
+
...v8.object({
|
|
870
|
+
method: v8.literal(getInscriptionsMethodName),
|
|
837
871
|
params: getInscriptionsParamsSchema,
|
|
838
|
-
id:
|
|
872
|
+
id: v8.string()
|
|
839
873
|
}).entries
|
|
840
874
|
});
|
|
841
875
|
|
|
@@ -852,13 +886,13 @@ var request = async (method, params, providerId) => {
|
|
|
852
886
|
throw new Error("A wallet method is required");
|
|
853
887
|
}
|
|
854
888
|
const response = await provider.request(method, params);
|
|
855
|
-
if (
|
|
889
|
+
if (v9.is(rpcErrorResponseMessageSchema, response)) {
|
|
856
890
|
return {
|
|
857
891
|
status: "error",
|
|
858
892
|
error: response.error
|
|
859
893
|
};
|
|
860
894
|
}
|
|
861
|
-
if (
|
|
895
|
+
if (v9.is(rpcSuccessResponseMessageSchema, response)) {
|
|
862
896
|
return {
|
|
863
897
|
status: "success",
|
|
864
898
|
result: response.result
|
|
@@ -1325,6 +1359,10 @@ export {
|
|
|
1325
1359
|
getRunesBalanceRequestMessageSchema,
|
|
1326
1360
|
getRunesBalanceResultSchema,
|
|
1327
1361
|
getSupportedWallets,
|
|
1362
|
+
getWalletTypeMethodName,
|
|
1363
|
+
getWalletTypeParamsSchema,
|
|
1364
|
+
getWalletTypeRequestMessageSchema,
|
|
1365
|
+
getWalletTypeResultSchema,
|
|
1328
1366
|
isProviderInstalled,
|
|
1329
1367
|
removeDefaultProvider,
|
|
1330
1368
|
renouncePermissionsMethodName,
|
|
@@ -1352,5 +1390,7 @@ export {
|
|
|
1352
1390
|
stxGetAddressesMethodName,
|
|
1353
1391
|
stxGetAddressesParamsSchema,
|
|
1354
1392
|
stxGetAddressesRequestMessageSchema,
|
|
1355
|
-
stxGetAddressesResultSchema
|
|
1393
|
+
stxGetAddressesResultSchema,
|
|
1394
|
+
walletTypeSchema,
|
|
1395
|
+
walletTypes
|
|
1356
1396
|
};
|