@sats-connect/core 0.0.11-aaf7b1c → 0.0.11-c7e675e
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 +56 -21
- package/dist/index.mjs +61 -24
- 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>;
|
|
@@ -828,26 +859,26 @@ type SignTransactionParams = Transaction & Partial<Pubkey>;
|
|
|
828
859
|
type SignTransactionResult = Transaction;
|
|
829
860
|
type StxSignTransaction = MethodParamsAndResult<SignTransactionParams, SignTransactionResult>;
|
|
830
861
|
|
|
831
|
-
declare const
|
|
832
|
-
declare const
|
|
833
|
-
declare const
|
|
834
|
-
declare const
|
|
835
|
-
readonly method: v.LiteralSchema<"
|
|
862
|
+
declare const requestPermissionsMethodName = "wallet_requestPermissions";
|
|
863
|
+
declare const requestPermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
864
|
+
declare const requestPermissionsResultSchema: v.LiteralSchema<true, undefined>;
|
|
865
|
+
declare const requestPermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
866
|
+
readonly method: v.LiteralSchema<"wallet_requestPermissions", undefined>;
|
|
836
867
|
readonly params: v.UndefinedSchema<undefined>;
|
|
837
868
|
readonly id: v.StringSchema<undefined>;
|
|
838
869
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
839
870
|
}, undefined>;
|
|
840
|
-
type
|
|
841
|
-
declare const
|
|
842
|
-
declare const
|
|
843
|
-
declare const
|
|
844
|
-
declare const
|
|
845
|
-
readonly method: v.LiteralSchema<"
|
|
871
|
+
type RequestPermissions = MethodParamsAndResult<v.InferOutput<typeof requestPermissionsParamsSchema>, v.InferOutput<typeof requestPermissionsResultSchema>>;
|
|
872
|
+
declare const renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
873
|
+
declare const renouncePermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
874
|
+
declare const renouncePermissionsResultSchema: v.LiteralSchema<true, undefined>;
|
|
875
|
+
declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
876
|
+
readonly method: v.LiteralSchema<"wallet_renouncePermissions", undefined>;
|
|
846
877
|
readonly params: v.UndefinedSchema<undefined>;
|
|
847
878
|
readonly id: v.StringSchema<undefined>;
|
|
848
879
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
849
880
|
}, undefined>;
|
|
850
|
-
type
|
|
881
|
+
type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
|
|
851
882
|
|
|
852
883
|
interface StxRequests {
|
|
853
884
|
stx_callContract: StxCallContract;
|
|
@@ -881,15 +912,19 @@ interface RunesRequests {
|
|
|
881
912
|
runes_getBalance: GetRunesBalance;
|
|
882
913
|
}
|
|
883
914
|
type RunesRequestMethod = keyof RunesRequests;
|
|
915
|
+
interface OrdinalsRequests {
|
|
916
|
+
ord_getInscriptions: GetInscriptions;
|
|
917
|
+
}
|
|
918
|
+
type OrdinalsRequestMethod = keyof OrdinalsRequests;
|
|
884
919
|
interface WalletMethods {
|
|
885
|
-
|
|
886
|
-
|
|
920
|
+
wallet_requestPermissions: RequestPermissions;
|
|
921
|
+
wallet_renouncePermissions: RenouncePermissions;
|
|
887
922
|
}
|
|
888
|
-
type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods;
|
|
923
|
+
type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods & OrdinalsRequests;
|
|
889
924
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
890
925
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
891
926
|
|
|
892
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods>(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
|
|
927
|
+
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
928
|
|
|
894
929
|
declare abstract class SatsConnectAdapter {
|
|
895
930
|
abstract readonly id: string;
|
|
@@ -907,10 +942,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
907
942
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
908
943
|
id: string;
|
|
909
944
|
constructor(providerId: string);
|
|
910
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods>(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
945
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests | keyof WalletMethods | "ord_getInscriptions">(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
911
946
|
}
|
|
912
947
|
|
|
913
948
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
914
949
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
915
950
|
|
|
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
|
|
951
|
+
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 GetAddressesParams, type GetAddressesResult, 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 };
|
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 v7 from "valibot";
|
|
530
530
|
|
|
531
531
|
// src/addresses/index.ts
|
|
532
532
|
import { createUnsecuredToken } from "jsontokens";
|
|
@@ -700,32 +700,32 @@ var getBalanceRequestMessageSchema = v3.object({
|
|
|
700
700
|
|
|
701
701
|
// src/request/types/walletMethods.ts
|
|
702
702
|
import * as v4 from "valibot";
|
|
703
|
-
var
|
|
704
|
-
var
|
|
705
|
-
var
|
|
706
|
-
var
|
|
703
|
+
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
704
|
+
var requestPermissionsParamsSchema = v4.undefined();
|
|
705
|
+
var requestPermissionsResultSchema = v4.literal(true);
|
|
706
|
+
var requestPermissionsRequestMessageSchema = v4.object({
|
|
707
707
|
...rpcRequestMessageSchema.entries,
|
|
708
708
|
...v4.object({
|
|
709
|
-
method: v4.literal(
|
|
710
|
-
params:
|
|
709
|
+
method: v4.literal(requestPermissionsMethodName),
|
|
710
|
+
params: requestPermissionsParamsSchema,
|
|
711
711
|
id: v4.string()
|
|
712
712
|
}).entries
|
|
713
713
|
});
|
|
714
|
-
var
|
|
715
|
-
var
|
|
716
|
-
var
|
|
717
|
-
var
|
|
714
|
+
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
715
|
+
var renouncePermissionsParamsSchema = v4.undefined();
|
|
716
|
+
var renouncePermissionsResultSchema = v4.literal(true);
|
|
717
|
+
var renouncePermissionsRequestMessageSchema = v4.object({
|
|
718
718
|
...rpcRequestMessageSchema.entries,
|
|
719
719
|
...v4.object({
|
|
720
|
-
method: v4.literal(
|
|
721
|
-
params:
|
|
720
|
+
method: v4.literal(renouncePermissionsMethodName),
|
|
721
|
+
params: renouncePermissionsParamsSchema,
|
|
722
722
|
id: v4.string()
|
|
723
723
|
}).entries
|
|
724
724
|
});
|
|
725
725
|
|
|
726
726
|
// src/request/types/runesMethods.ts
|
|
727
727
|
import * as v5 from "valibot";
|
|
728
|
-
var getRunesBalanceMethodName = "
|
|
728
|
+
var getRunesBalanceMethodName = "runes_getBalance";
|
|
729
729
|
var getRunesBalanceParamsSchema = v5.null();
|
|
730
730
|
var getRunesBalanceResultSchema = v5.object({
|
|
731
731
|
balances: v5.array(
|
|
@@ -747,6 +747,39 @@ var getRunesBalanceRequestMessageSchema = v5.object({
|
|
|
747
747
|
}).entries
|
|
748
748
|
});
|
|
749
749
|
|
|
750
|
+
// src/request/types/ordinalsMethods.ts
|
|
751
|
+
import * as v6 from "valibot";
|
|
752
|
+
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
753
|
+
var getInscriptionsParamsSchema = v6.object({
|
|
754
|
+
offset: v6.number(),
|
|
755
|
+
limit: v6.number()
|
|
756
|
+
});
|
|
757
|
+
var getInscriptionsResultSchema = v6.object({
|
|
758
|
+
inscriptions: v6.array(
|
|
759
|
+
v6.object({
|
|
760
|
+
inscriptionId: v6.string(),
|
|
761
|
+
inscriptionNumber: v6.string(),
|
|
762
|
+
address: v6.string(),
|
|
763
|
+
collectionName: v6.optional(v6.string()),
|
|
764
|
+
postage: v6.string(),
|
|
765
|
+
contentLength: v6.string(),
|
|
766
|
+
contentType: v6.string(),
|
|
767
|
+
timestamp: v6.number(),
|
|
768
|
+
offset: v6.number(),
|
|
769
|
+
genesisTransaction: v6.string(),
|
|
770
|
+
output: v6.string()
|
|
771
|
+
})
|
|
772
|
+
)
|
|
773
|
+
});
|
|
774
|
+
var getInscriptionsSchema = v6.object({
|
|
775
|
+
...rpcRequestMessageSchema.entries,
|
|
776
|
+
...v6.object({
|
|
777
|
+
method: v6.literal(getInscriptionsMethodName),
|
|
778
|
+
params: getInscriptionsParamsSchema,
|
|
779
|
+
id: v6.string()
|
|
780
|
+
}).entries
|
|
781
|
+
});
|
|
782
|
+
|
|
750
783
|
// src/request/index.ts
|
|
751
784
|
var request = async (method, params, providerId) => {
|
|
752
785
|
let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
|
|
@@ -760,13 +793,13 @@ var request = async (method, params, providerId) => {
|
|
|
760
793
|
throw new Error("A wallet method is required");
|
|
761
794
|
}
|
|
762
795
|
const response = await provider.request(method, params);
|
|
763
|
-
if (
|
|
796
|
+
if (v7.is(rpcErrorResponseMessageSchema, response)) {
|
|
764
797
|
return {
|
|
765
798
|
status: "error",
|
|
766
799
|
error: response.error
|
|
767
800
|
};
|
|
768
801
|
}
|
|
769
|
-
if (
|
|
802
|
+
if (v7.is(rpcSuccessResponseMessageSchema, response)) {
|
|
770
803
|
return {
|
|
771
804
|
status: "success",
|
|
772
805
|
result: response.result
|
|
@@ -1221,6 +1254,10 @@ export {
|
|
|
1221
1254
|
getInfoParamsSchema,
|
|
1222
1255
|
getInfoResultSchema,
|
|
1223
1256
|
getInfoSchema,
|
|
1257
|
+
getInscriptionsMethodName,
|
|
1258
|
+
getInscriptionsParamsSchema,
|
|
1259
|
+
getInscriptionsResultSchema,
|
|
1260
|
+
getInscriptionsSchema,
|
|
1224
1261
|
getProviderById,
|
|
1225
1262
|
getProviderOrThrow,
|
|
1226
1263
|
getProviders,
|
|
@@ -1229,17 +1266,17 @@ export {
|
|
|
1229
1266
|
getRunesBalanceRequestMessageSchema,
|
|
1230
1267
|
getRunesBalanceResultSchema,
|
|
1231
1268
|
getSupportedWallets,
|
|
1232
|
-
grantPermissionsMethodName,
|
|
1233
|
-
grantPermissionsParamsSchema,
|
|
1234
|
-
grantPermissionsRequestMessageSchema,
|
|
1235
|
-
grantPermissionsResultSchema,
|
|
1236
1269
|
isProviderInstalled,
|
|
1237
1270
|
removeDefaultProvider,
|
|
1271
|
+
renouncePermissionsMethodName,
|
|
1272
|
+
renouncePermissionsParamsSchema,
|
|
1273
|
+
renouncePermissionsRequestMessageSchema,
|
|
1274
|
+
renouncePermissionsResultSchema,
|
|
1238
1275
|
request,
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1276
|
+
requestPermissionsMethodName,
|
|
1277
|
+
requestPermissionsParamsSchema,
|
|
1278
|
+
requestPermissionsRequestMessageSchema,
|
|
1279
|
+
requestPermissionsResultSchema,
|
|
1243
1280
|
rpcErrorResponseMessageSchema,
|
|
1244
1281
|
rpcRequestMessageSchema,
|
|
1245
1282
|
rpcResponseMessageSchema,
|