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