@sats-connect/core 0.0.15-87cf6c7 → 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 +147 -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
|
}
|
|
@@ -292,7 +292,12 @@ var SatsConnectAdapter = class {
|
|
|
292
292
|
if (isEtchSupported) {
|
|
293
293
|
const response = await this.requestInternal("runes_etch", params);
|
|
294
294
|
if (response) {
|
|
295
|
-
|
|
295
|
+
if (response.status === "success") {
|
|
296
|
+
return response;
|
|
297
|
+
}
|
|
298
|
+
if (response.status === "error" && response.error.code !== -32601 /* METHOD_NOT_FOUND */) {
|
|
299
|
+
return response;
|
|
300
|
+
}
|
|
296
301
|
}
|
|
297
302
|
}
|
|
298
303
|
}
|
|
@@ -551,7 +556,7 @@ function getSupportedWallets() {
|
|
|
551
556
|
}
|
|
552
557
|
|
|
553
558
|
// src/request/index.ts
|
|
554
|
-
import * as
|
|
559
|
+
import * as v9 from "valibot";
|
|
555
560
|
|
|
556
561
|
// src/addresses/index.ts
|
|
557
562
|
import { createUnsecuredToken } from "jsontokens";
|
|
@@ -624,213 +629,247 @@ var stxGetAddressesRequestMessageSchema = v3.object({
|
|
|
624
629
|
});
|
|
625
630
|
|
|
626
631
|
// src/request/types/btcMethods.ts
|
|
632
|
+
import * as v5 from "valibot";
|
|
633
|
+
|
|
634
|
+
// src/request/types/common.ts
|
|
627
635
|
import * as v4 from "valibot";
|
|
636
|
+
var walletTypes = ["software", "ledger"];
|
|
637
|
+
var walletTypeSchema = v4.picklist(walletTypes);
|
|
638
|
+
|
|
639
|
+
// src/request/types/btcMethods.ts
|
|
628
640
|
var getInfoMethodName = "getInfo";
|
|
629
|
-
var getInfoParamsSchema =
|
|
630
|
-
var getInfoResultSchema =
|
|
641
|
+
var getInfoParamsSchema = v5.nullish(v5.null());
|
|
642
|
+
var getInfoResultSchema = v5.object({
|
|
631
643
|
/**
|
|
632
644
|
* Version of the wallet.
|
|
633
645
|
*/
|
|
634
|
-
version:
|
|
646
|
+
version: v5.string(),
|
|
635
647
|
/**
|
|
636
648
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
637
649
|
*/
|
|
638
|
-
methods:
|
|
650
|
+
methods: v5.optional(v5.array(v5.string())),
|
|
639
651
|
/**
|
|
640
652
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
641
653
|
*/
|
|
642
|
-
supports:
|
|
654
|
+
supports: v5.array(v5.string())
|
|
643
655
|
});
|
|
644
|
-
var getInfoRequestMessageSchema =
|
|
656
|
+
var getInfoRequestMessageSchema = v5.object({
|
|
645
657
|
...rpcRequestMessageSchema.entries,
|
|
646
|
-
...
|
|
647
|
-
method:
|
|
658
|
+
...v5.object({
|
|
659
|
+
method: v5.literal(getInfoMethodName),
|
|
648
660
|
params: getInfoParamsSchema,
|
|
649
|
-
id:
|
|
661
|
+
id: v5.string()
|
|
650
662
|
}).entries
|
|
651
663
|
});
|
|
652
664
|
var getAddressesMethodName = "getAddresses";
|
|
653
|
-
var getAddressesParamsSchema =
|
|
665
|
+
var getAddressesParamsSchema = v5.object({
|
|
654
666
|
/**
|
|
655
667
|
* The purposes for which to generate addresses. See
|
|
656
668
|
* {@linkcode AddressPurpose} for available purposes.
|
|
657
669
|
*/
|
|
658
|
-
purposes:
|
|
670
|
+
purposes: v5.array(v5.enum(AddressPurpose)),
|
|
659
671
|
/**
|
|
660
672
|
* A message to be displayed to the user in the request prompt.
|
|
661
673
|
*/
|
|
662
|
-
message:
|
|
674
|
+
message: v5.optional(v5.string())
|
|
663
675
|
});
|
|
664
|
-
var getAddressesResultSchema =
|
|
676
|
+
var getAddressesResultSchema = v5.object({
|
|
665
677
|
/**
|
|
666
678
|
* The addresses generated for the given purposes.
|
|
667
679
|
*/
|
|
668
|
-
addresses:
|
|
680
|
+
addresses: v5.array(addressSchema)
|
|
669
681
|
});
|
|
670
|
-
var getAddressesRequestMessageSchema =
|
|
682
|
+
var getAddressesRequestMessageSchema = v5.object({
|
|
671
683
|
...rpcRequestMessageSchema.entries,
|
|
672
|
-
...
|
|
673
|
-
method:
|
|
684
|
+
...v5.object({
|
|
685
|
+
method: v5.literal(getAddressesMethodName),
|
|
674
686
|
params: getAddressesParamsSchema,
|
|
675
|
-
id:
|
|
687
|
+
id: v5.string()
|
|
676
688
|
}).entries
|
|
677
689
|
});
|
|
678
690
|
var signMessageMethodName = "signMessage";
|
|
679
|
-
var signMessageParamsSchema =
|
|
691
|
+
var signMessageParamsSchema = v5.object({
|
|
680
692
|
/**
|
|
681
693
|
* The address used for signing.
|
|
682
694
|
**/
|
|
683
|
-
address:
|
|
695
|
+
address: v5.string(),
|
|
684
696
|
/**
|
|
685
697
|
* The message to sign.
|
|
686
698
|
**/
|
|
687
|
-
message:
|
|
699
|
+
message: v5.string()
|
|
688
700
|
});
|
|
689
|
-
var signMessageResultSchema =
|
|
701
|
+
var signMessageResultSchema = v5.object({
|
|
690
702
|
/**
|
|
691
703
|
* The signature of the message.
|
|
692
704
|
*/
|
|
693
|
-
signature:
|
|
705
|
+
signature: v5.string(),
|
|
694
706
|
/**
|
|
695
707
|
* hash of the message.
|
|
696
708
|
*/
|
|
697
|
-
messageHash:
|
|
709
|
+
messageHash: v5.string(),
|
|
698
710
|
/**
|
|
699
711
|
* The address used for signing.
|
|
700
712
|
*/
|
|
701
|
-
address:
|
|
713
|
+
address: v5.string()
|
|
702
714
|
});
|
|
703
|
-
var signMessageRequestMessageSchema =
|
|
715
|
+
var signMessageRequestMessageSchema = v5.object({
|
|
704
716
|
...rpcRequestMessageSchema.entries,
|
|
705
|
-
...
|
|
706
|
-
method:
|
|
717
|
+
...v5.object({
|
|
718
|
+
method: v5.literal(signMessageMethodName),
|
|
707
719
|
params: signMessageParamsSchema,
|
|
708
|
-
id:
|
|
720
|
+
id: v5.string()
|
|
709
721
|
}).entries
|
|
710
722
|
});
|
|
711
723
|
var getAccountsMethodName = "getAccounts";
|
|
712
|
-
var getAccountsParamsSchema =
|
|
713
|
-
|
|
714
|
-
|
|
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({
|
|
715
744
|
...rpcRequestMessageSchema.entries,
|
|
716
|
-
...
|
|
717
|
-
method:
|
|
745
|
+
...v5.object({
|
|
746
|
+
method: v5.literal(getAccountsMethodName),
|
|
718
747
|
params: getAccountsParamsSchema,
|
|
719
|
-
id:
|
|
748
|
+
id: v5.string()
|
|
720
749
|
}).entries
|
|
721
750
|
});
|
|
722
751
|
var getBalanceMethodName = "getBalance";
|
|
723
|
-
var getBalanceParamsSchema =
|
|
724
|
-
var getBalanceResultSchema =
|
|
752
|
+
var getBalanceParamsSchema = v5.nullish(v5.null());
|
|
753
|
+
var getBalanceResultSchema = v5.object({
|
|
725
754
|
/**
|
|
726
755
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
727
756
|
* messages not supporting bigint
|
|
728
757
|
* (https://issues.chromium.org/issues/40116184).
|
|
729
758
|
*/
|
|
730
|
-
confirmed:
|
|
759
|
+
confirmed: v5.string(),
|
|
731
760
|
/**
|
|
732
761
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
733
762
|
* messages not supporting bigint
|
|
734
763
|
* (https://issues.chromium.org/issues/40116184).
|
|
735
764
|
*/
|
|
736
|
-
unconfirmed:
|
|
765
|
+
unconfirmed: v5.string(),
|
|
737
766
|
/**
|
|
738
767
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
739
768
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
740
769
|
* (https://issues.chromium.org/issues/40116184).
|
|
741
770
|
*/
|
|
742
|
-
total:
|
|
771
|
+
total: v5.string()
|
|
743
772
|
});
|
|
744
|
-
var getBalanceRequestMessageSchema =
|
|
773
|
+
var getBalanceRequestMessageSchema = v5.object({
|
|
745
774
|
...rpcRequestMessageSchema.entries,
|
|
746
|
-
...
|
|
747
|
-
method:
|
|
748
|
-
id:
|
|
775
|
+
...v5.object({
|
|
776
|
+
method: v5.literal(getBalanceMethodName),
|
|
777
|
+
id: v5.string()
|
|
749
778
|
}).entries
|
|
750
779
|
});
|
|
751
780
|
|
|
752
781
|
// src/request/types/walletMethods.ts
|
|
753
|
-
import * as
|
|
782
|
+
import * as v6 from "valibot";
|
|
754
783
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
755
|
-
var requestPermissionsParamsSchema =
|
|
756
|
-
var requestPermissionsResultSchema =
|
|
757
|
-
var requestPermissionsRequestMessageSchema =
|
|
784
|
+
var requestPermissionsParamsSchema = v6.undefined();
|
|
785
|
+
var requestPermissionsResultSchema = v6.literal(true);
|
|
786
|
+
var requestPermissionsRequestMessageSchema = v6.object({
|
|
758
787
|
...rpcRequestMessageSchema.entries,
|
|
759
|
-
...
|
|
760
|
-
method:
|
|
788
|
+
...v6.object({
|
|
789
|
+
method: v6.literal(requestPermissionsMethodName),
|
|
761
790
|
params: requestPermissionsParamsSchema,
|
|
762
|
-
id:
|
|
791
|
+
id: v6.string()
|
|
763
792
|
}).entries
|
|
764
793
|
});
|
|
765
794
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
766
|
-
var renouncePermissionsParamsSchema =
|
|
767
|
-
var renouncePermissionsResultSchema =
|
|
768
|
-
var renouncePermissionsRequestMessageSchema =
|
|
795
|
+
var renouncePermissionsParamsSchema = v6.undefined();
|
|
796
|
+
var renouncePermissionsResultSchema = v6.literal(true);
|
|
797
|
+
var renouncePermissionsRequestMessageSchema = v6.object({
|
|
769
798
|
...rpcRequestMessageSchema.entries,
|
|
770
|
-
...
|
|
771
|
-
method:
|
|
799
|
+
...v6.object({
|
|
800
|
+
method: v6.literal(renouncePermissionsMethodName),
|
|
772
801
|
params: renouncePermissionsParamsSchema,
|
|
773
|
-
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()
|
|
774
813
|
}).entries
|
|
775
814
|
});
|
|
776
815
|
|
|
777
816
|
// src/request/types/runesMethods.ts
|
|
778
|
-
import * as
|
|
817
|
+
import * as v7 from "valibot";
|
|
779
818
|
var getRunesBalanceMethodName = "runes_getBalance";
|
|
780
|
-
var getRunesBalanceParamsSchema =
|
|
781
|
-
var getRunesBalanceResultSchema =
|
|
782
|
-
balances:
|
|
783
|
-
|
|
784
|
-
runeName:
|
|
785
|
-
amount:
|
|
786
|
-
divisibility:
|
|
787
|
-
symbol:
|
|
788
|
-
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())
|
|
789
828
|
})
|
|
790
829
|
)
|
|
791
830
|
});
|
|
792
|
-
var getRunesBalanceRequestMessageSchema =
|
|
831
|
+
var getRunesBalanceRequestMessageSchema = v7.object({
|
|
793
832
|
...rpcRequestMessageSchema.entries,
|
|
794
|
-
...
|
|
795
|
-
method:
|
|
833
|
+
...v7.object({
|
|
834
|
+
method: v7.literal(getRunesBalanceMethodName),
|
|
796
835
|
params: getRunesBalanceParamsSchema,
|
|
797
|
-
id:
|
|
836
|
+
id: v7.string()
|
|
798
837
|
}).entries
|
|
799
838
|
});
|
|
800
839
|
|
|
801
840
|
// src/request/types/ordinalsMethods.ts
|
|
802
|
-
import * as
|
|
841
|
+
import * as v8 from "valibot";
|
|
803
842
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
804
|
-
var getInscriptionsParamsSchema =
|
|
805
|
-
offset:
|
|
806
|
-
limit:
|
|
843
|
+
var getInscriptionsParamsSchema = v8.object({
|
|
844
|
+
offset: v8.number(),
|
|
845
|
+
limit: v8.number()
|
|
807
846
|
});
|
|
808
|
-
var getInscriptionsResultSchema =
|
|
809
|
-
total:
|
|
810
|
-
limit:
|
|
811
|
-
offset:
|
|
812
|
-
inscriptions:
|
|
813
|
-
|
|
814
|
-
inscriptionId:
|
|
815
|
-
inscriptionNumber:
|
|
816
|
-
address:
|
|
817
|
-
collectionName:
|
|
818
|
-
postage:
|
|
819
|
-
contentLength:
|
|
820
|
-
contentType:
|
|
821
|
-
timestamp:
|
|
822
|
-
offset:
|
|
823
|
-
genesisTransaction:
|
|
824
|
-
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()
|
|
825
864
|
})
|
|
826
865
|
)
|
|
827
866
|
});
|
|
828
|
-
var getInscriptionsSchema =
|
|
867
|
+
var getInscriptionsSchema = v8.object({
|
|
829
868
|
...rpcRequestMessageSchema.entries,
|
|
830
|
-
...
|
|
831
|
-
method:
|
|
869
|
+
...v8.object({
|
|
870
|
+
method: v8.literal(getInscriptionsMethodName),
|
|
832
871
|
params: getInscriptionsParamsSchema,
|
|
833
|
-
id:
|
|
872
|
+
id: v8.string()
|
|
834
873
|
}).entries
|
|
835
874
|
});
|
|
836
875
|
|
|
@@ -847,13 +886,13 @@ var request = async (method, params, providerId) => {
|
|
|
847
886
|
throw new Error("A wallet method is required");
|
|
848
887
|
}
|
|
849
888
|
const response = await provider.request(method, params);
|
|
850
|
-
if (
|
|
889
|
+
if (v9.is(rpcErrorResponseMessageSchema, response)) {
|
|
851
890
|
return {
|
|
852
891
|
status: "error",
|
|
853
892
|
error: response.error
|
|
854
893
|
};
|
|
855
894
|
}
|
|
856
|
-
if (
|
|
895
|
+
if (v9.is(rpcSuccessResponseMessageSchema, response)) {
|
|
857
896
|
return {
|
|
858
897
|
status: "success",
|
|
859
898
|
result: response.result
|
|
@@ -1320,6 +1359,10 @@ export {
|
|
|
1320
1359
|
getRunesBalanceRequestMessageSchema,
|
|
1321
1360
|
getRunesBalanceResultSchema,
|
|
1322
1361
|
getSupportedWallets,
|
|
1362
|
+
getWalletTypeMethodName,
|
|
1363
|
+
getWalletTypeParamsSchema,
|
|
1364
|
+
getWalletTypeRequestMessageSchema,
|
|
1365
|
+
getWalletTypeResultSchema,
|
|
1323
1366
|
isProviderInstalled,
|
|
1324
1367
|
removeDefaultProvider,
|
|
1325
1368
|
renouncePermissionsMethodName,
|
|
@@ -1347,5 +1390,7 @@ export {
|
|
|
1347
1390
|
stxGetAddressesMethodName,
|
|
1348
1391
|
stxGetAddressesParamsSchema,
|
|
1349
1392
|
stxGetAddressesRequestMessageSchema,
|
|
1350
|
-
stxGetAddressesResultSchema
|
|
1393
|
+
stxGetAddressesResultSchema,
|
|
1394
|
+
walletTypeSchema,
|
|
1395
|
+
walletTypes
|
|
1351
1396
|
};
|