@sats-connect/core 0.0.11-aaf7b1c → 0.0.11-c2da35e
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 +86 -26
- package/dist/index.mjs +155 -88
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -116,7 +116,7 @@ interface Provider {
|
|
|
116
116
|
mozillaAddOnsUrl?: string;
|
|
117
117
|
googlePlayStoreUrl?: string;
|
|
118
118
|
iOSAppStoreUrl?: string;
|
|
119
|
-
methods?: (StxRequestMethod | BtcRequestMethod | RunesRequestMethod)[];
|
|
119
|
+
methods?: (StxRequestMethod | BtcRequestMethod | RunesRequestMethod | OrdinalsRequestMethod)[];
|
|
120
120
|
}
|
|
121
121
|
interface SupportedWallet extends Provider {
|
|
122
122
|
isInstalled: boolean;
|
|
@@ -518,6 +518,37 @@ declare const getBalanceRequestMessageSchema: v.ObjectSchema<{
|
|
|
518
518
|
}, undefined>;
|
|
519
519
|
type GetBalance = MethodParamsAndResult<v.InferOutput<typeof getBalanceParamsSchema>, v.InferOutput<typeof getBalanceResultSchema>>;
|
|
520
520
|
|
|
521
|
+
declare const getInscriptionsMethodName = "ord_getInscriptions";
|
|
522
|
+
declare const getInscriptionsParamsSchema: v.ObjectSchema<{
|
|
523
|
+
readonly offset: v.NumberSchema<undefined>;
|
|
524
|
+
readonly limit: v.NumberSchema<undefined>;
|
|
525
|
+
}, undefined>;
|
|
526
|
+
declare const getInscriptionsResultSchema: v.ObjectSchema<{
|
|
527
|
+
readonly inscriptions: v.ArraySchema<v.ObjectSchema<{
|
|
528
|
+
readonly inscriptionId: v.StringSchema<undefined>;
|
|
529
|
+
readonly inscriptionNumber: v.StringSchema<undefined>;
|
|
530
|
+
readonly address: v.StringSchema<undefined>;
|
|
531
|
+
readonly collectionName: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
532
|
+
readonly postage: v.StringSchema<undefined>;
|
|
533
|
+
readonly contentLength: v.StringSchema<undefined>;
|
|
534
|
+
readonly contentType: v.StringSchema<undefined>;
|
|
535
|
+
readonly timestamp: v.NumberSchema<undefined>;
|
|
536
|
+
readonly offset: v.NumberSchema<undefined>;
|
|
537
|
+
readonly genesisTransaction: v.StringSchema<undefined>;
|
|
538
|
+
readonly output: v.StringSchema<undefined>;
|
|
539
|
+
}, undefined>, undefined>;
|
|
540
|
+
}, undefined>;
|
|
541
|
+
declare const getInscriptionsSchema: v.ObjectSchema<{
|
|
542
|
+
readonly method: v.LiteralSchema<"ord_getInscriptions", undefined>;
|
|
543
|
+
readonly params: v.ObjectSchema<{
|
|
544
|
+
readonly offset: v.NumberSchema<undefined>;
|
|
545
|
+
readonly limit: v.NumberSchema<undefined>;
|
|
546
|
+
}, undefined>;
|
|
547
|
+
readonly id: v.StringSchema<undefined>;
|
|
548
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
549
|
+
}, undefined>;
|
|
550
|
+
type GetInscriptions = MethodParamsAndResult<v.InferOutput<typeof getInscriptionsParamsSchema>, v.InferOutput<typeof getInscriptionsResultSchema>>;
|
|
551
|
+
|
|
521
552
|
type CreateMintOrderRequest = {
|
|
522
553
|
runeName: string;
|
|
523
554
|
repeats: number;
|
|
@@ -629,7 +660,7 @@ interface RbfOrderResult {
|
|
|
629
660
|
fundingAddress: string;
|
|
630
661
|
}
|
|
631
662
|
type RbfOrder = MethodParamsAndResult<RbfOrderParams, RbfOrderResult>;
|
|
632
|
-
declare const getRunesBalanceMethodName = "
|
|
663
|
+
declare const getRunesBalanceMethodName = "runes_getBalance";
|
|
633
664
|
declare const getRunesBalanceParamsSchema: v.NullSchema<undefined>;
|
|
634
665
|
declare const getRunesBalanceResultSchema: v.ObjectSchema<{
|
|
635
666
|
readonly balances: v.ArraySchema<v.ObjectSchema<{
|
|
@@ -641,7 +672,7 @@ declare const getRunesBalanceResultSchema: v.ObjectSchema<{
|
|
|
641
672
|
}, undefined>, undefined>;
|
|
642
673
|
}, undefined>;
|
|
643
674
|
declare const getRunesBalanceRequestMessageSchema: v.ObjectSchema<{
|
|
644
|
-
readonly method: v.LiteralSchema<"
|
|
675
|
+
readonly method: v.LiteralSchema<"runes_getBalance", undefined>;
|
|
645
676
|
readonly params: v.NullSchema<undefined>;
|
|
646
677
|
readonly id: v.StringSchema<undefined>;
|
|
647
678
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
@@ -819,35 +850,60 @@ type GetAccountsResult = {
|
|
|
819
850
|
}>;
|
|
820
851
|
};
|
|
821
852
|
type StxGetAccounts = MethodParamsAndResult<{}, GetAccountsResult>;
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
853
|
+
declare const stxGetAddressesMethodName = "stx_getAddresses";
|
|
854
|
+
declare const stxGetAddressesParamsSchema: v.NullishSchema<v.ObjectSchema<{
|
|
855
|
+
/**
|
|
856
|
+
* A message to be displayed to the user in the request prompt.
|
|
857
|
+
*/
|
|
858
|
+
readonly message: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
859
|
+
}, undefined>, never>;
|
|
860
|
+
declare const stxGetAddressesResultSchema: v.ObjectSchema<{
|
|
861
|
+
/**
|
|
862
|
+
* The addresses generated for the given purposes.
|
|
863
|
+
*/
|
|
864
|
+
readonly addresses: v.ArraySchema<v.ObjectSchema<{
|
|
865
|
+
readonly address: v.StringSchema<undefined>;
|
|
866
|
+
readonly publicKey: v.StringSchema<undefined>;
|
|
867
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
868
|
+
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
869
|
+
}, undefined>, undefined>;
|
|
870
|
+
}, undefined>;
|
|
871
|
+
declare const stxGetAddressesRequestMessageSchema: v.ObjectSchema<{
|
|
872
|
+
readonly method: v.LiteralSchema<"stx_getAddresses", undefined>;
|
|
873
|
+
readonly params: v.NullishSchema<v.ObjectSchema<{
|
|
874
|
+
/**
|
|
875
|
+
* A message to be displayed to the user in the request prompt.
|
|
876
|
+
*/
|
|
877
|
+
readonly message: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
878
|
+
}, undefined>, never>;
|
|
879
|
+
readonly id: v.StringSchema<undefined>;
|
|
880
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
881
|
+
}, undefined>;
|
|
882
|
+
type StxGetAddresses = MethodParamsAndResult<v.InferOutput<typeof stxGetAddressesParamsSchema>, v.InferOutput<typeof stxGetAddressesResultSchema>>;
|
|
827
883
|
type SignTransactionParams = Transaction & Partial<Pubkey>;
|
|
828
884
|
type SignTransactionResult = Transaction;
|
|
829
885
|
type StxSignTransaction = MethodParamsAndResult<SignTransactionParams, SignTransactionResult>;
|
|
830
886
|
|
|
831
|
-
declare const
|
|
832
|
-
declare const
|
|
833
|
-
declare const
|
|
834
|
-
declare const
|
|
835
|
-
readonly method: v.LiteralSchema<"
|
|
887
|
+
declare const requestPermissionsMethodName = "wallet_requestPermissions";
|
|
888
|
+
declare const requestPermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
889
|
+
declare const requestPermissionsResultSchema: v.LiteralSchema<true, undefined>;
|
|
890
|
+
declare const requestPermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
891
|
+
readonly method: v.LiteralSchema<"wallet_requestPermissions", undefined>;
|
|
836
892
|
readonly params: v.UndefinedSchema<undefined>;
|
|
837
893
|
readonly id: v.StringSchema<undefined>;
|
|
838
894
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
839
895
|
}, undefined>;
|
|
840
|
-
type
|
|
841
|
-
declare const
|
|
842
|
-
declare const
|
|
843
|
-
declare const
|
|
844
|
-
declare const
|
|
845
|
-
readonly method: v.LiteralSchema<"
|
|
896
|
+
type RequestPermissions = MethodParamsAndResult<v.InferOutput<typeof requestPermissionsParamsSchema>, v.InferOutput<typeof requestPermissionsResultSchema>>;
|
|
897
|
+
declare const renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
898
|
+
declare const renouncePermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
899
|
+
declare const renouncePermissionsResultSchema: v.LiteralSchema<true, undefined>;
|
|
900
|
+
declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
901
|
+
readonly method: v.LiteralSchema<"wallet_renouncePermissions", undefined>;
|
|
846
902
|
readonly params: v.UndefinedSchema<undefined>;
|
|
847
903
|
readonly id: v.StringSchema<undefined>;
|
|
848
904
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
849
905
|
}, undefined>;
|
|
850
|
-
type
|
|
906
|
+
type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
|
|
851
907
|
|
|
852
908
|
interface StxRequests {
|
|
853
909
|
stx_callContract: StxCallContract;
|
|
@@ -881,15 +937,19 @@ interface RunesRequests {
|
|
|
881
937
|
runes_getBalance: GetRunesBalance;
|
|
882
938
|
}
|
|
883
939
|
type RunesRequestMethod = keyof RunesRequests;
|
|
940
|
+
interface OrdinalsRequests {
|
|
941
|
+
ord_getInscriptions: GetInscriptions;
|
|
942
|
+
}
|
|
943
|
+
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
884
944
|
interface WalletMethods {
|
|
885
|
-
|
|
886
|
-
|
|
945
|
+
wallet_requestPermissions: RequestPermissions;
|
|
946
|
+
wallet_renouncePermissions: RenouncePermissions;
|
|
887
947
|
}
|
|
888
|
-
type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods;
|
|
948
|
+
type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods & OrdinalsRequests;
|
|
889
949
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
890
950
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
891
951
|
|
|
892
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods>(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
|
|
952
|
+
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>>;
|
|
893
953
|
|
|
894
954
|
declare abstract class SatsConnectAdapter {
|
|
895
955
|
abstract readonly id: string;
|
|
@@ -907,10 +967,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
907
967
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
908
968
|
id: string;
|
|
909
969
|
constructor(providerId: string);
|
|
910
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods>(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
970
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
911
971
|
}
|
|
912
972
|
|
|
913
973
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
914
974
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
915
975
|
|
|
916
|
-
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
|
|
976
|
+
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 GetAccountsResult, type GetAddressOptions, type GetAddressPayload, type GetAddressResponse, type GetAddresses, type GetBalance, type GetCapabilitiesOptions, type GetCapabilitiesPayload, type GetCapabilitiesResponse, type GetInfo, type GetInscriptions, type GetOrder, type GetRunesBalance, 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 SignMessagePayload, type SignMessageResponse, 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 StxGetAddresses, type StxRequestMethod, type StxRequests, type StxSignStructuredMessage, type StxSignStxMessage, type StxSignTransaction, 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, getInfoResultSchema, getInfoSchema, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -526,7 +526,7 @@ function getSupportedWallets() {
|
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
// src/request/index.ts
|
|
529
|
-
import * as
|
|
529
|
+
import * as v8 from "valibot";
|
|
530
530
|
|
|
531
531
|
// src/addresses/index.ts
|
|
532
532
|
import { createUnsecuredToken } from "jsontokens";
|
|
@@ -572,178 +572,237 @@ var getAddress = async (options) => {
|
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
574
|
|
|
575
|
-
// src/request/types/
|
|
575
|
+
// src/request/types/stxMethods.ts
|
|
576
576
|
import * as v3 from "valibot";
|
|
577
|
+
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
578
|
+
var stxGetAddressesParamsSchema = v3.nullish(
|
|
579
|
+
v3.object({
|
|
580
|
+
/**
|
|
581
|
+
* A message to be displayed to the user in the request prompt.
|
|
582
|
+
*/
|
|
583
|
+
message: v3.optional(v3.string())
|
|
584
|
+
})
|
|
585
|
+
);
|
|
586
|
+
var stxGetAddressesResultSchema = v3.object({
|
|
587
|
+
/**
|
|
588
|
+
* The addresses generated for the given purposes.
|
|
589
|
+
*/
|
|
590
|
+
addresses: v3.array(addressSchema)
|
|
591
|
+
});
|
|
592
|
+
var stxGetAddressesRequestMessageSchema = v3.object({
|
|
593
|
+
...rpcRequestMessageSchema.entries,
|
|
594
|
+
...v3.object({
|
|
595
|
+
method: v3.literal(stxGetAddressesMethodName),
|
|
596
|
+
params: stxGetAddressesParamsSchema,
|
|
597
|
+
id: v3.string()
|
|
598
|
+
}).entries
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// src/request/types/btcMethods.ts
|
|
602
|
+
import * as v4 from "valibot";
|
|
577
603
|
var getInfoMethodName = "getInfo";
|
|
578
|
-
var getInfoParamsSchema =
|
|
579
|
-
var getInfoResultSchema =
|
|
604
|
+
var getInfoParamsSchema = v4.null();
|
|
605
|
+
var getInfoResultSchema = v4.object({
|
|
580
606
|
/**
|
|
581
607
|
* Version of the wallet.
|
|
582
608
|
*/
|
|
583
|
-
version:
|
|
609
|
+
version: v4.string(),
|
|
584
610
|
/**
|
|
585
611
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
586
612
|
*/
|
|
587
|
-
methods:
|
|
613
|
+
methods: v4.optional(v4.array(v4.string())),
|
|
588
614
|
/**
|
|
589
615
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
590
616
|
*/
|
|
591
|
-
supports:
|
|
617
|
+
supports: v4.array(v4.string())
|
|
592
618
|
});
|
|
593
|
-
var getInfoSchema =
|
|
619
|
+
var getInfoSchema = v4.object({
|
|
594
620
|
...rpcRequestMessageSchema.entries,
|
|
595
|
-
...
|
|
596
|
-
method:
|
|
621
|
+
...v4.object({
|
|
622
|
+
method: v4.literal(getInfoMethodName),
|
|
597
623
|
params: getInfoParamsSchema,
|
|
598
|
-
id:
|
|
624
|
+
id: v4.string()
|
|
599
625
|
}).entries
|
|
600
626
|
});
|
|
601
627
|
var getAddressesMethodName = "getAddresses";
|
|
602
|
-
var getAddressesParamsSchema =
|
|
628
|
+
var getAddressesParamsSchema = v4.object({
|
|
603
629
|
/**
|
|
604
630
|
* The purposes for which to generate addresses. See
|
|
605
631
|
* {@linkcode AddressPurpose} for available purposes.
|
|
606
632
|
*/
|
|
607
|
-
purposes:
|
|
633
|
+
purposes: v4.array(v4.enum(AddressPurpose)),
|
|
608
634
|
/**
|
|
609
635
|
* A message to be displayed to the user in the request prompt.
|
|
610
636
|
*/
|
|
611
|
-
message:
|
|
637
|
+
message: v4.optional(v4.string())
|
|
612
638
|
});
|
|
613
|
-
var getAddressesResultSchema =
|
|
639
|
+
var getAddressesResultSchema = v4.object({
|
|
614
640
|
/**
|
|
615
641
|
* The addresses generated for the given purposes.
|
|
616
642
|
*/
|
|
617
|
-
addresses:
|
|
643
|
+
addresses: v4.array(addressSchema)
|
|
618
644
|
});
|
|
619
|
-
var getAddressesRequestMessageSchema =
|
|
645
|
+
var getAddressesRequestMessageSchema = v4.object({
|
|
620
646
|
...rpcRequestMessageSchema.entries,
|
|
621
|
-
...
|
|
622
|
-
method:
|
|
647
|
+
...v4.object({
|
|
648
|
+
method: v4.literal(getAddressesMethodName),
|
|
623
649
|
params: getAddressesParamsSchema,
|
|
624
|
-
id:
|
|
650
|
+
id: v4.string()
|
|
625
651
|
}).entries
|
|
626
652
|
});
|
|
627
653
|
var signMessageMethodName = "signMessage";
|
|
628
|
-
var signMessageParamsSchema =
|
|
654
|
+
var signMessageParamsSchema = v4.object({
|
|
629
655
|
/**
|
|
630
656
|
* The address used for signing.
|
|
631
657
|
**/
|
|
632
|
-
address:
|
|
658
|
+
address: v4.string(),
|
|
633
659
|
/**
|
|
634
660
|
* The message to sign.
|
|
635
661
|
**/
|
|
636
|
-
message:
|
|
662
|
+
message: v4.string()
|
|
637
663
|
});
|
|
638
|
-
var signMessageResultSchema =
|
|
664
|
+
var signMessageResultSchema = v4.object({
|
|
639
665
|
/**
|
|
640
666
|
* The signature of the message.
|
|
641
667
|
*/
|
|
642
|
-
signature:
|
|
668
|
+
signature: v4.string(),
|
|
643
669
|
/**
|
|
644
670
|
* hash of the message.
|
|
645
671
|
*/
|
|
646
|
-
messageHash:
|
|
672
|
+
messageHash: v4.string(),
|
|
647
673
|
/**
|
|
648
674
|
* The address used for signing.
|
|
649
675
|
*/
|
|
650
|
-
address:
|
|
676
|
+
address: v4.string()
|
|
651
677
|
});
|
|
652
|
-
var signMessageRequestMessageSchema =
|
|
678
|
+
var signMessageRequestMessageSchema = v4.object({
|
|
653
679
|
...rpcRequestMessageSchema.entries,
|
|
654
|
-
...
|
|
655
|
-
method:
|
|
680
|
+
...v4.object({
|
|
681
|
+
method: v4.literal(signMessageMethodName),
|
|
656
682
|
params: signMessageParamsSchema,
|
|
657
|
-
id:
|
|
683
|
+
id: v4.string()
|
|
658
684
|
}).entries
|
|
659
685
|
});
|
|
660
686
|
var getAccountsMethodName = "getAccounts";
|
|
661
687
|
var getAccountsParamsSchema = getAddressesParamsSchema;
|
|
662
|
-
var getAccountsResultSchema =
|
|
663
|
-
var getAccountsRequestMessageSchema =
|
|
688
|
+
var getAccountsResultSchema = v4.array(addressSchema);
|
|
689
|
+
var getAccountsRequestMessageSchema = v4.object({
|
|
664
690
|
...rpcRequestMessageSchema.entries,
|
|
665
|
-
...
|
|
666
|
-
method:
|
|
691
|
+
...v4.object({
|
|
692
|
+
method: v4.literal(getAccountsMethodName),
|
|
667
693
|
params: getAccountsParamsSchema,
|
|
668
|
-
id:
|
|
694
|
+
id: v4.string()
|
|
669
695
|
}).entries
|
|
670
696
|
});
|
|
671
697
|
var getBalanceMethodName = "getBalance";
|
|
672
|
-
var getBalanceParamsSchema =
|
|
673
|
-
var getBalanceResultSchema =
|
|
698
|
+
var getBalanceParamsSchema = v4.undefined();
|
|
699
|
+
var getBalanceResultSchema = v4.object({
|
|
674
700
|
/**
|
|
675
701
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
676
702
|
* messages not supporting bigint
|
|
677
703
|
* (https://issues.chromium.org/issues/40116184).
|
|
678
704
|
*/
|
|
679
|
-
confirmed:
|
|
705
|
+
confirmed: v4.string(),
|
|
680
706
|
/**
|
|
681
707
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
682
708
|
* messages not supporting bigint
|
|
683
709
|
* (https://issues.chromium.org/issues/40116184).
|
|
684
710
|
*/
|
|
685
|
-
unconfirmed:
|
|
711
|
+
unconfirmed: v4.string(),
|
|
686
712
|
/**
|
|
687
713
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
688
714
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
689
715
|
* (https://issues.chromium.org/issues/40116184).
|
|
690
716
|
*/
|
|
691
|
-
total:
|
|
717
|
+
total: v4.string()
|
|
692
718
|
});
|
|
693
|
-
var getBalanceRequestMessageSchema =
|
|
719
|
+
var getBalanceRequestMessageSchema = v4.object({
|
|
694
720
|
...rpcRequestMessageSchema.entries,
|
|
695
|
-
...
|
|
696
|
-
method:
|
|
697
|
-
id:
|
|
721
|
+
...v4.object({
|
|
722
|
+
method: v4.literal(getBalanceMethodName),
|
|
723
|
+
id: v4.string()
|
|
698
724
|
}).entries
|
|
699
725
|
});
|
|
700
726
|
|
|
701
727
|
// src/request/types/walletMethods.ts
|
|
702
|
-
import * as
|
|
703
|
-
var
|
|
704
|
-
var
|
|
705
|
-
var
|
|
706
|
-
var
|
|
728
|
+
import * as v5 from "valibot";
|
|
729
|
+
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
730
|
+
var requestPermissionsParamsSchema = v5.undefined();
|
|
731
|
+
var requestPermissionsResultSchema = v5.literal(true);
|
|
732
|
+
var requestPermissionsRequestMessageSchema = v5.object({
|
|
707
733
|
...rpcRequestMessageSchema.entries,
|
|
708
|
-
...
|
|
709
|
-
method:
|
|
710
|
-
params:
|
|
711
|
-
id:
|
|
734
|
+
...v5.object({
|
|
735
|
+
method: v5.literal(requestPermissionsMethodName),
|
|
736
|
+
params: requestPermissionsParamsSchema,
|
|
737
|
+
id: v5.string()
|
|
712
738
|
}).entries
|
|
713
739
|
});
|
|
714
|
-
var
|
|
715
|
-
var
|
|
716
|
-
var
|
|
717
|
-
var
|
|
740
|
+
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
741
|
+
var renouncePermissionsParamsSchema = v5.undefined();
|
|
742
|
+
var renouncePermissionsResultSchema = v5.literal(true);
|
|
743
|
+
var renouncePermissionsRequestMessageSchema = v5.object({
|
|
718
744
|
...rpcRequestMessageSchema.entries,
|
|
719
|
-
...
|
|
720
|
-
method:
|
|
721
|
-
params:
|
|
722
|
-
id:
|
|
745
|
+
...v5.object({
|
|
746
|
+
method: v5.literal(renouncePermissionsMethodName),
|
|
747
|
+
params: renouncePermissionsParamsSchema,
|
|
748
|
+
id: v5.string()
|
|
723
749
|
}).entries
|
|
724
750
|
});
|
|
725
751
|
|
|
726
752
|
// src/request/types/runesMethods.ts
|
|
727
|
-
import * as
|
|
728
|
-
var getRunesBalanceMethodName = "
|
|
729
|
-
var getRunesBalanceParamsSchema =
|
|
730
|
-
var getRunesBalanceResultSchema =
|
|
731
|
-
balances:
|
|
732
|
-
|
|
733
|
-
runeName:
|
|
734
|
-
amount:
|
|
735
|
-
divisibility:
|
|
736
|
-
symbol:
|
|
737
|
-
inscriptionId:
|
|
753
|
+
import * as v6 from "valibot";
|
|
754
|
+
var getRunesBalanceMethodName = "runes_getBalance";
|
|
755
|
+
var getRunesBalanceParamsSchema = v6.null();
|
|
756
|
+
var getRunesBalanceResultSchema = v6.object({
|
|
757
|
+
balances: v6.array(
|
|
758
|
+
v6.object({
|
|
759
|
+
runeName: v6.string(),
|
|
760
|
+
amount: v6.string(),
|
|
761
|
+
divisibility: v6.number(),
|
|
762
|
+
symbol: v6.string(),
|
|
763
|
+
inscriptionId: v6.nullish(v6.string())
|
|
738
764
|
})
|
|
739
765
|
)
|
|
740
766
|
});
|
|
741
|
-
var getRunesBalanceRequestMessageSchema =
|
|
767
|
+
var getRunesBalanceRequestMessageSchema = v6.object({
|
|
742
768
|
...rpcRequestMessageSchema.entries,
|
|
743
|
-
...
|
|
744
|
-
method:
|
|
769
|
+
...v6.object({
|
|
770
|
+
method: v6.literal(getRunesBalanceMethodName),
|
|
745
771
|
params: getRunesBalanceParamsSchema,
|
|
746
|
-
id:
|
|
772
|
+
id: v6.string()
|
|
773
|
+
}).entries
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
// src/request/types/ordinalsMethods.ts
|
|
777
|
+
import * as v7 from "valibot";
|
|
778
|
+
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
779
|
+
var getInscriptionsParamsSchema = v7.object({
|
|
780
|
+
offset: v7.number(),
|
|
781
|
+
limit: v7.number()
|
|
782
|
+
});
|
|
783
|
+
var getInscriptionsResultSchema = v7.object({
|
|
784
|
+
inscriptions: v7.array(
|
|
785
|
+
v7.object({
|
|
786
|
+
inscriptionId: v7.string(),
|
|
787
|
+
inscriptionNumber: v7.string(),
|
|
788
|
+
address: v7.string(),
|
|
789
|
+
collectionName: v7.optional(v7.string()),
|
|
790
|
+
postage: v7.string(),
|
|
791
|
+
contentLength: v7.string(),
|
|
792
|
+
contentType: v7.string(),
|
|
793
|
+
timestamp: v7.number(),
|
|
794
|
+
offset: v7.number(),
|
|
795
|
+
genesisTransaction: v7.string(),
|
|
796
|
+
output: v7.string()
|
|
797
|
+
})
|
|
798
|
+
)
|
|
799
|
+
});
|
|
800
|
+
var getInscriptionsSchema = v7.object({
|
|
801
|
+
...rpcRequestMessageSchema.entries,
|
|
802
|
+
...v7.object({
|
|
803
|
+
method: v7.literal(getInscriptionsMethodName),
|
|
804
|
+
params: getInscriptionsParamsSchema,
|
|
805
|
+
id: v7.string()
|
|
747
806
|
}).entries
|
|
748
807
|
});
|
|
749
808
|
|
|
@@ -760,13 +819,13 @@ var request = async (method, params, providerId) => {
|
|
|
760
819
|
throw new Error("A wallet method is required");
|
|
761
820
|
}
|
|
762
821
|
const response = await provider.request(method, params);
|
|
763
|
-
if (
|
|
822
|
+
if (v8.is(rpcErrorResponseMessageSchema, response)) {
|
|
764
823
|
return {
|
|
765
824
|
status: "error",
|
|
766
825
|
error: response.error
|
|
767
826
|
};
|
|
768
827
|
}
|
|
769
|
-
if (
|
|
828
|
+
if (v8.is(rpcSuccessResponseMessageSchema, response)) {
|
|
770
829
|
return {
|
|
771
830
|
status: "success",
|
|
772
831
|
result: response.result
|
|
@@ -1221,6 +1280,10 @@ export {
|
|
|
1221
1280
|
getInfoParamsSchema,
|
|
1222
1281
|
getInfoResultSchema,
|
|
1223
1282
|
getInfoSchema,
|
|
1283
|
+
getInscriptionsMethodName,
|
|
1284
|
+
getInscriptionsParamsSchema,
|
|
1285
|
+
getInscriptionsResultSchema,
|
|
1286
|
+
getInscriptionsSchema,
|
|
1224
1287
|
getProviderById,
|
|
1225
1288
|
getProviderOrThrow,
|
|
1226
1289
|
getProviders,
|
|
@@ -1229,17 +1292,17 @@ export {
|
|
|
1229
1292
|
getRunesBalanceRequestMessageSchema,
|
|
1230
1293
|
getRunesBalanceResultSchema,
|
|
1231
1294
|
getSupportedWallets,
|
|
1232
|
-
grantPermissionsMethodName,
|
|
1233
|
-
grantPermissionsParamsSchema,
|
|
1234
|
-
grantPermissionsRequestMessageSchema,
|
|
1235
|
-
grantPermissionsResultSchema,
|
|
1236
1295
|
isProviderInstalled,
|
|
1237
1296
|
removeDefaultProvider,
|
|
1297
|
+
renouncePermissionsMethodName,
|
|
1298
|
+
renouncePermissionsParamsSchema,
|
|
1299
|
+
renouncePermissionsRequestMessageSchema,
|
|
1300
|
+
renouncePermissionsResultSchema,
|
|
1238
1301
|
request,
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1302
|
+
requestPermissionsMethodName,
|
|
1303
|
+
requestPermissionsParamsSchema,
|
|
1304
|
+
requestPermissionsRequestMessageSchema,
|
|
1305
|
+
requestPermissionsResultSchema,
|
|
1243
1306
|
rpcErrorResponseMessageSchema,
|
|
1244
1307
|
rpcRequestMessageSchema,
|
|
1245
1308
|
rpcResponseMessageSchema,
|
|
@@ -1252,5 +1315,9 @@ export {
|
|
|
1252
1315
|
signMessageRequestMessageSchema,
|
|
1253
1316
|
signMessageResultSchema,
|
|
1254
1317
|
signMultipleTransactions,
|
|
1255
|
-
signTransaction
|
|
1318
|
+
signTransaction,
|
|
1319
|
+
stxGetAddressesMethodName,
|
|
1320
|
+
stxGetAddressesParamsSchema,
|
|
1321
|
+
stxGetAddressesRequestMessageSchema,
|
|
1322
|
+
stxGetAddressesResultSchema
|
|
1256
1323
|
};
|