@sats-connect/core 0.0.11-a271383 → 0.0.11-a949a0a
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 +5 -30
- package/dist/index.mjs +1 -44
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -162,7 +162,7 @@ interface RequestOptions<Payload extends RequestPayload, Response> {
|
|
|
162
162
|
declare const rpcRequestMessageSchema: v.ObjectSchema<{
|
|
163
163
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
164
164
|
readonly method: v.StringSchema<undefined>;
|
|
165
|
-
readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined
|
|
165
|
+
readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>], undefined>, never>;
|
|
166
166
|
readonly id: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
167
167
|
}, undefined>;
|
|
168
168
|
type RpcRequestMessage = v.InferOutput<typeof rpcRequestMessageSchema>;
|
|
@@ -765,27 +765,6 @@ type SignTransactionParams = Transaction & Partial<Pubkey>;
|
|
|
765
765
|
type SignTransactionResult = Transaction;
|
|
766
766
|
type StxSignTransaction = MethodParamsAndResult<SignTransactionParams, SignTransactionResult>;
|
|
767
767
|
|
|
768
|
-
declare const connectMethodName = "wallet_connect";
|
|
769
|
-
declare const connectParamsSchema: v.UndefinedSchema<undefined>;
|
|
770
|
-
declare const connectResultSchema: v.UndefinedSchema<undefined>;
|
|
771
|
-
declare const connectSchema: v.ObjectSchema<{
|
|
772
|
-
readonly method: v.LiteralSchema<"wallet_connect", undefined>;
|
|
773
|
-
readonly params: v.UndefinedSchema<undefined>;
|
|
774
|
-
readonly id: v.StringSchema<undefined>;
|
|
775
|
-
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
776
|
-
}, undefined>;
|
|
777
|
-
type Connect = MethodParamsAndResult<v.InferOutput<typeof connectParamsSchema>, v.InferOutput<typeof connectResultSchema>>;
|
|
778
|
-
declare const disconnectMethodName = "wallet_disconnect";
|
|
779
|
-
declare const disconnectParamsSchema: v.UndefinedSchema<undefined>;
|
|
780
|
-
declare const disconnectResultSchema: v.UndefinedSchema<undefined>;
|
|
781
|
-
declare const disconnectSchema: v.ObjectSchema<{
|
|
782
|
-
readonly method: v.LiteralSchema<"wallet_disconnect", undefined>;
|
|
783
|
-
readonly params: v.UndefinedSchema<undefined>;
|
|
784
|
-
readonly id: v.StringSchema<undefined>;
|
|
785
|
-
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
786
|
-
}, undefined>;
|
|
787
|
-
type Disconnect = MethodParamsAndResult<v.InferOutput<typeof disconnectParamsSchema>, v.InferOutput<typeof disconnectResultSchema>>;
|
|
788
|
-
|
|
789
768
|
interface StxRequests {
|
|
790
769
|
stx_callContract: StxCallContract;
|
|
791
770
|
stx_deployContract: StxDeployContract;
|
|
@@ -817,15 +796,11 @@ interface RunesRequests {
|
|
|
817
796
|
runes_getBalance: GetRunesBalance;
|
|
818
797
|
}
|
|
819
798
|
type RunesRequestMethod = keyof RunesRequests;
|
|
820
|
-
|
|
821
|
-
wallet_connect: Connect;
|
|
822
|
-
wallet_disconnect: Disconnect;
|
|
823
|
-
}
|
|
824
|
-
type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods;
|
|
799
|
+
type Requests = BtcRequests & StxRequests & RunesRequests;
|
|
825
800
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
826
801
|
type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
|
|
827
802
|
|
|
828
|
-
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests
|
|
803
|
+
declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests>(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
|
|
829
804
|
|
|
830
805
|
declare abstract class SatsConnectAdapter {
|
|
831
806
|
abstract readonly id: string;
|
|
@@ -843,10 +818,10 @@ declare abstract class SatsConnectAdapter {
|
|
|
843
818
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
844
819
|
id: string;
|
|
845
820
|
constructor(providerId: string);
|
|
846
|
-
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests
|
|
821
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests>(method: Method, params: Params<Method>) => Promise<RpcResult<Method>>;
|
|
847
822
|
}
|
|
848
823
|
|
|
849
824
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
850
825
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
851
826
|
|
|
852
|
-
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
|
|
827
|
+
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 GetAccounts, type GetAccountsResult, type GetAddressOptions, type GetAddressPayload, type GetAddressResponse, type GetAddresses, type GetAddressesParams, type GetAddressesResult, type GetCapabilitiesOptions, type GetCapabilitiesPayload, type GetCapabilitiesResponse, type GetInfo, type InputToSign, type MethodParamsAndResult, type Params, type Provider, type PsbtPayload, type Recipient$2 as Recipient, type RequestOptions, type RequestPayload, type Requests, type Return, type RpcBase, type RpcError, RpcErrorCode, type RpcErrorResponse, type RpcId, type RpcRequest, type RpcRequestMessage, type RpcResponse, type RpcResult, type RpcSuccessResponse, 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, addressSchema, createInscription, createRepeatInscriptions, defaultAdapters, getAccountsMethodName, getAccountsParamsSchema, getAccountsRequestMessageSchema, getAccountsResultSchema, getAddress, getAddressesMethodName, getAddressesParamsSchema, getAddressesRequestMessageSchema, getAddressesResultSchema, getCapabilities, getDefaultProvider, getInfoMethodName, getInfoParamsSchema, getInfoResultSchema, getInfoSchema, getProviderById, getProviderOrThrow, getProviders, getSupportedWallets, isProviderInstalled, removeDefaultProvider, request, rpcRequestMessageSchema, sendBtcTransaction, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleTransactions, signTransaction };
|
package/dist/index.mjs
CHANGED
|
@@ -9,17 +9,7 @@ var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
|
9
9
|
var rpcRequestMessageSchema = v.object({
|
|
10
10
|
jsonrpc: v.literal("2.0"),
|
|
11
11
|
method: v.string(),
|
|
12
|
-
params: v.optional(
|
|
13
|
-
v.union([
|
|
14
|
-
v.array(v.unknown()),
|
|
15
|
-
v.looseObject({}),
|
|
16
|
-
// Note: This is to support current incorrect usage of RPC 2.0. Params need
|
|
17
|
-
// to be either an array or an object when provided. Changing this now would
|
|
18
|
-
// be a breaking change, so accepting null values for now. Tracking in
|
|
19
|
-
// https://linear.app/xverseapp/issue/ENG-4538.
|
|
20
|
-
v.null()
|
|
21
|
-
])
|
|
22
|
-
),
|
|
12
|
+
params: v.optional(v.union([v.array(v.unknown()), v.looseObject({})])),
|
|
23
13
|
id: v.optional(v.union([v.string(), v.number(), v.null()]))
|
|
24
14
|
});
|
|
25
15
|
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
@@ -650,31 +640,6 @@ var getAccountsRequestMessageSchema = v3.object({
|
|
|
650
640
|
}).entries
|
|
651
641
|
});
|
|
652
642
|
|
|
653
|
-
// src/request/types/walletMethods.ts
|
|
654
|
-
import * as v4 from "valibot";
|
|
655
|
-
var connectMethodName = "wallet_connect";
|
|
656
|
-
var connectParamsSchema = v4.undefined();
|
|
657
|
-
var connectResultSchema = v4.undefined();
|
|
658
|
-
var connectSchema = v4.object({
|
|
659
|
-
...rpcRequestMessageSchema.entries,
|
|
660
|
-
...v4.object({
|
|
661
|
-
method: v4.literal(connectMethodName),
|
|
662
|
-
params: connectParamsSchema,
|
|
663
|
-
id: v4.string()
|
|
664
|
-
}).entries
|
|
665
|
-
});
|
|
666
|
-
var disconnectMethodName = "wallet_disconnect";
|
|
667
|
-
var disconnectParamsSchema = v4.undefined();
|
|
668
|
-
var disconnectResultSchema = v4.undefined();
|
|
669
|
-
var disconnectSchema = v4.object({
|
|
670
|
-
...rpcRequestMessageSchema.entries,
|
|
671
|
-
...v4.object({
|
|
672
|
-
method: v4.literal(disconnectMethodName),
|
|
673
|
-
params: disconnectParamsSchema,
|
|
674
|
-
id: v4.string()
|
|
675
|
-
}).entries
|
|
676
|
-
});
|
|
677
|
-
|
|
678
643
|
// src/request/index.ts
|
|
679
644
|
var request = async (method, params, providerId) => {
|
|
680
645
|
let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
|
|
@@ -1119,17 +1084,9 @@ export {
|
|
|
1119
1084
|
RpcErrorCode,
|
|
1120
1085
|
SatsConnectAdapter,
|
|
1121
1086
|
addressSchema,
|
|
1122
|
-
connectMethodName,
|
|
1123
|
-
connectParamsSchema,
|
|
1124
|
-
connectResultSchema,
|
|
1125
|
-
connectSchema,
|
|
1126
1087
|
createInscription,
|
|
1127
1088
|
createRepeatInscriptions,
|
|
1128
1089
|
defaultAdapters,
|
|
1129
|
-
disconnectMethodName,
|
|
1130
|
-
disconnectParamsSchema,
|
|
1131
|
-
disconnectResultSchema,
|
|
1132
|
-
disconnectSchema,
|
|
1133
1090
|
getAccountsMethodName,
|
|
1134
1091
|
getAccountsParamsSchema,
|
|
1135
1092
|
getAccountsRequestMessageSchema,
|