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