@sats-connect/core 0.0.11-4a437ed → 0.0.11-69eb4c5
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 +21 -33
- package/dist/index.mjs +20 -53
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -492,25 +492,20 @@ declare const getBalanceMethodName = "getBalance";
|
|
|
492
492
|
declare const getBalanceParamsSchema: v.UndefinedSchema<undefined>;
|
|
493
493
|
declare const getBalanceResultSchema: v.ObjectSchema<{
|
|
494
494
|
/**
|
|
495
|
-
* The confirmed balance of the wallet in sats.
|
|
496
|
-
* messages not supporting bigint
|
|
497
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
495
|
+
* The confirmed balance of the wallet in sats.
|
|
498
496
|
*/
|
|
499
|
-
readonly confirmed: v.
|
|
497
|
+
readonly confirmed: v.BigintSchema<undefined>;
|
|
500
498
|
/**
|
|
501
|
-
* The unconfirmed balance of the wallet in sats.
|
|
502
|
-
* messages not supporting bigint
|
|
503
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
499
|
+
* The unconfirmed balance of the wallet in sats.
|
|
504
500
|
*/
|
|
505
|
-
readonly unconfirmed: v.
|
|
501
|
+
readonly unconfirmed: v.BigintSchema<undefined>;
|
|
506
502
|
/**
|
|
507
503
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
508
|
-
* sats.
|
|
509
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
504
|
+
* sats.
|
|
510
505
|
*/
|
|
511
|
-
readonly total: v.
|
|
506
|
+
readonly total: v.BigintSchema<undefined>;
|
|
512
507
|
}, undefined>;
|
|
513
|
-
declare const
|
|
508
|
+
declare const getBalanceSchema: v.ObjectSchema<{
|
|
514
509
|
readonly method: v.LiteralSchema<"getBalance", undefined>;
|
|
515
510
|
readonly id: v.StringSchema<undefined>;
|
|
516
511
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
@@ -629,24 +624,17 @@ interface RbfOrderResult {
|
|
|
629
624
|
fundingAddress: string;
|
|
630
625
|
}
|
|
631
626
|
type RbfOrder = MethodParamsAndResult<RbfOrderParams, RbfOrderResult>;
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
declare const getRunesBalanceRequestMessageSchema: v.ObjectSchema<{
|
|
644
|
-
readonly method: v.LiteralSchema<"getRunesBalance", undefined>;
|
|
645
|
-
readonly params: v.NullSchema<undefined>;
|
|
646
|
-
readonly id: v.StringSchema<undefined>;
|
|
647
|
-
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
648
|
-
}, undefined>;
|
|
649
|
-
type GetRunesBalance = MethodParamsAndResult<v.InferOutput<typeof getRunesBalanceParamsSchema>, v.InferOutput<typeof getRunesBalanceResultSchema>>;
|
|
627
|
+
type GetRunesBalanceParams = null;
|
|
628
|
+
interface GetRunesBalanceResult {
|
|
629
|
+
balances: {
|
|
630
|
+
runeName: string;
|
|
631
|
+
amount: string;
|
|
632
|
+
divisibility: number;
|
|
633
|
+
symbol: string;
|
|
634
|
+
inscriptionId: string | null;
|
|
635
|
+
}[];
|
|
636
|
+
}
|
|
637
|
+
type GetRunesBalance = MethodParamsAndResult<GetRunesBalanceParams, GetRunesBalanceResult>;
|
|
650
638
|
|
|
651
639
|
interface Pubkey {
|
|
652
640
|
/**
|
|
@@ -831,7 +819,7 @@ type StxSignTransaction = MethodParamsAndResult<SignTransactionParams, SignTrans
|
|
|
831
819
|
declare const connectMethodName = "wallet_connect";
|
|
832
820
|
declare const connectParamsSchema: v.UndefinedSchema<undefined>;
|
|
833
821
|
declare const connectResultSchema: v.LiteralSchema<true, undefined>;
|
|
834
|
-
declare const
|
|
822
|
+
declare const connectSchema: v.ObjectSchema<{
|
|
835
823
|
readonly method: v.LiteralSchema<"wallet_connect", undefined>;
|
|
836
824
|
readonly params: v.UndefinedSchema<undefined>;
|
|
837
825
|
readonly id: v.StringSchema<undefined>;
|
|
@@ -841,7 +829,7 @@ type Connect = MethodParamsAndResult<v.InferOutput<typeof connectParamsSchema>,
|
|
|
841
829
|
declare const disconnectMethodName = "wallet_disconnect";
|
|
842
830
|
declare const disconnectParamsSchema: v.UndefinedSchema<undefined>;
|
|
843
831
|
declare const disconnectResultSchema: v.LiteralSchema<true, undefined>;
|
|
844
|
-
declare const
|
|
832
|
+
declare const disconnectSchema: v.ObjectSchema<{
|
|
845
833
|
readonly method: v.LiteralSchema<"wallet_disconnect", undefined>;
|
|
846
834
|
readonly params: v.UndefinedSchema<undefined>;
|
|
847
835
|
readonly id: v.StringSchema<undefined>;
|
|
@@ -913,4 +901,4 @@ declare class BaseAdapter extends SatsConnectAdapter {
|
|
|
913
901
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
914
902
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
915
903
|
|
|
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 Connect, type CreateInscriptionOptions, type CreateInscriptionPayload, type CreateInscriptionResponse, type CreateRepeatInscriptionsOptions, type CreateRepeatInscriptionsPayload, type CreateRepeatInscriptionsResponse, DefaultAdaptersInfo, type DeployContractParams, type DeployContractResult, type Disconnect, type
|
|
904
|
+
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 Connect, type CreateInscriptionOptions, type CreateInscriptionPayload, type CreateInscriptionResponse, type CreateRepeatInscriptionsOptions, type CreateRepeatInscriptionsPayload, type CreateRepeatInscriptionsResponse, DefaultAdaptersInfo, type DeployContractParams, type DeployContractResult, type Disconnect, 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 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 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, connectMethodName, connectParamsSchema, connectResultSchema, connectSchema, createInscription, createRepeatInscriptions, defaultAdapters, disconnectMethodName, disconnectParamsSchema, disconnectResultSchema, disconnectSchema, getAccountsMethodName, getAccountsParamsSchema, getAccountsRequestMessageSchema, getAccountsResultSchema, getAddress, getAddressesMethodName, getAddressesParamsSchema, getAddressesRequestMessageSchema, getAddressesResultSchema, getBalanceMethodName, getBalanceParamsSchema, getBalanceResultSchema, getBalanceSchema, getCapabilities, getDefaultProvider, getInfoMethodName, getInfoParamsSchema, getInfoResultSchema, getInfoSchema, getProviderById, getProviderOrThrow, getProviders, getSupportedWallets, isProviderInstalled, removeDefaultProvider, request, rpcErrorResponseMessageSchema, rpcRequestMessageSchema, rpcResponseMessageSchema, rpcSuccessResponseMessageSchema, sendBtcTransaction, setDefaultProvider, signMessage, signMessageMethodName, signMessageParamsSchema, signMessageRequestMessageSchema, signMessageResultSchema, signMultipleTransactions, signTransaction };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/types.ts
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
var BitcoinNetworkType = /* @__PURE__ */ ((
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
3
|
+
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
4
|
+
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
5
|
+
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
6
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
7
|
+
return BitcoinNetworkType2;
|
|
8
8
|
})(BitcoinNetworkType || {});
|
|
9
9
|
var RpcIdSchema = v.optional(v.union([v.string(), v.number(), v.null()]));
|
|
10
10
|
var rpcRequestMessageSchema = v.object({
|
|
@@ -526,7 +526,7 @@ function getSupportedWallets() {
|
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
// src/request/index.ts
|
|
529
|
-
import * as
|
|
529
|
+
import * as v5 from "valibot";
|
|
530
530
|
|
|
531
531
|
// src/addresses/index.ts
|
|
532
532
|
import { createUnsecuredToken } from "jsontokens";
|
|
@@ -672,25 +672,20 @@ var getBalanceMethodName = "getBalance";
|
|
|
672
672
|
var getBalanceParamsSchema = v3.undefined();
|
|
673
673
|
var getBalanceResultSchema = v3.object({
|
|
674
674
|
/**
|
|
675
|
-
* The confirmed balance of the wallet in sats.
|
|
676
|
-
* messages not supporting bigint
|
|
677
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
675
|
+
* The confirmed balance of the wallet in sats.
|
|
678
676
|
*/
|
|
679
|
-
confirmed: v3.
|
|
677
|
+
confirmed: v3.bigint(),
|
|
680
678
|
/**
|
|
681
|
-
* The unconfirmed balance of the wallet in sats.
|
|
682
|
-
* messages not supporting bigint
|
|
683
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
679
|
+
* The unconfirmed balance of the wallet in sats.
|
|
684
680
|
*/
|
|
685
|
-
unconfirmed: v3.
|
|
681
|
+
unconfirmed: v3.bigint(),
|
|
686
682
|
/**
|
|
687
683
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
688
|
-
* sats.
|
|
689
|
-
* (https://issues.chromium.org/issues/40116184).
|
|
684
|
+
* sats.
|
|
690
685
|
*/
|
|
691
|
-
total: v3.
|
|
686
|
+
total: v3.bigint()
|
|
692
687
|
});
|
|
693
|
-
var
|
|
688
|
+
var getBalanceSchema = v3.object({
|
|
694
689
|
...rpcRequestMessageSchema.entries,
|
|
695
690
|
...v3.object({
|
|
696
691
|
method: v3.literal(getBalanceMethodName),
|
|
@@ -703,7 +698,7 @@ import * as v4 from "valibot";
|
|
|
703
698
|
var connectMethodName = "wallet_connect";
|
|
704
699
|
var connectParamsSchema = v4.undefined();
|
|
705
700
|
var connectResultSchema = v4.literal(true);
|
|
706
|
-
var
|
|
701
|
+
var connectSchema = v4.object({
|
|
707
702
|
...rpcRequestMessageSchema.entries,
|
|
708
703
|
...v4.object({
|
|
709
704
|
method: v4.literal(connectMethodName),
|
|
@@ -714,7 +709,7 @@ var connectRequestMessageSchema = v4.object({
|
|
|
714
709
|
var disconnectMethodName = "wallet_disconnect";
|
|
715
710
|
var disconnectParamsSchema = v4.undefined();
|
|
716
711
|
var disconnectResultSchema = v4.literal(true);
|
|
717
|
-
var
|
|
712
|
+
var disconnectSchema = v4.object({
|
|
718
713
|
...rpcRequestMessageSchema.entries,
|
|
719
714
|
...v4.object({
|
|
720
715
|
method: v4.literal(disconnectMethodName),
|
|
@@ -723,30 +718,6 @@ var disconnectRequestMessageSchema = v4.object({
|
|
|
723
718
|
}).entries
|
|
724
719
|
});
|
|
725
720
|
|
|
726
|
-
// src/request/types/runesMethods.ts
|
|
727
|
-
import * as v5 from "valibot";
|
|
728
|
-
var getRunesBalanceMethodName = "getRunesBalance";
|
|
729
|
-
var getRunesBalanceParamsSchema = v5.null();
|
|
730
|
-
var getRunesBalanceResultSchema = v5.object({
|
|
731
|
-
balances: v5.array(
|
|
732
|
-
v5.object({
|
|
733
|
-
runeName: v5.string(),
|
|
734
|
-
amount: v5.string(),
|
|
735
|
-
divisibility: v5.number(),
|
|
736
|
-
symbol: v5.string(),
|
|
737
|
-
inscriptionId: v5.nullish(v5.string())
|
|
738
|
-
})
|
|
739
|
-
)
|
|
740
|
-
});
|
|
741
|
-
var getRunesBalanceRequestMessageSchema = v5.object({
|
|
742
|
-
...rpcRequestMessageSchema.entries,
|
|
743
|
-
...v5.object({
|
|
744
|
-
method: v5.literal(getRunesBalanceMethodName),
|
|
745
|
-
params: getRunesBalanceParamsSchema,
|
|
746
|
-
id: v5.string()
|
|
747
|
-
}).entries
|
|
748
|
-
});
|
|
749
|
-
|
|
750
721
|
// src/request/index.ts
|
|
751
722
|
var request = async (method, params, providerId) => {
|
|
752
723
|
let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
|
|
@@ -760,13 +731,13 @@ var request = async (method, params, providerId) => {
|
|
|
760
731
|
throw new Error("A wallet method is required");
|
|
761
732
|
}
|
|
762
733
|
const response = await provider.request(method, params);
|
|
763
|
-
if (
|
|
734
|
+
if (v5.is(rpcErrorResponseMessageSchema, response)) {
|
|
764
735
|
return {
|
|
765
736
|
status: "error",
|
|
766
737
|
error: response.error
|
|
767
738
|
};
|
|
768
739
|
}
|
|
769
|
-
if (
|
|
740
|
+
if (v5.is(rpcSuccessResponseMessageSchema, response)) {
|
|
770
741
|
return {
|
|
771
742
|
status: "success",
|
|
772
743
|
result: response.result
|
|
@@ -1201,15 +1172,15 @@ export {
|
|
|
1201
1172
|
addressSchema,
|
|
1202
1173
|
connectMethodName,
|
|
1203
1174
|
connectParamsSchema,
|
|
1204
|
-
connectRequestMessageSchema,
|
|
1205
1175
|
connectResultSchema,
|
|
1176
|
+
connectSchema,
|
|
1206
1177
|
createInscription,
|
|
1207
1178
|
createRepeatInscriptions,
|
|
1208
1179
|
defaultAdapters,
|
|
1209
1180
|
disconnectMethodName,
|
|
1210
1181
|
disconnectParamsSchema,
|
|
1211
|
-
disconnectRequestMessageSchema,
|
|
1212
1182
|
disconnectResultSchema,
|
|
1183
|
+
disconnectSchema,
|
|
1213
1184
|
getAccountsMethodName,
|
|
1214
1185
|
getAccountsParamsSchema,
|
|
1215
1186
|
getAccountsRequestMessageSchema,
|
|
@@ -1221,8 +1192,8 @@ export {
|
|
|
1221
1192
|
getAddressesResultSchema,
|
|
1222
1193
|
getBalanceMethodName,
|
|
1223
1194
|
getBalanceParamsSchema,
|
|
1224
|
-
getBalanceRequestMessageSchema,
|
|
1225
1195
|
getBalanceResultSchema,
|
|
1196
|
+
getBalanceSchema,
|
|
1226
1197
|
getCapabilities,
|
|
1227
1198
|
getDefaultProvider,
|
|
1228
1199
|
getInfoMethodName,
|
|
@@ -1232,10 +1203,6 @@ export {
|
|
|
1232
1203
|
getProviderById,
|
|
1233
1204
|
getProviderOrThrow,
|
|
1234
1205
|
getProviders,
|
|
1235
|
-
getRunesBalanceMethodName,
|
|
1236
|
-
getRunesBalanceParamsSchema,
|
|
1237
|
-
getRunesBalanceRequestMessageSchema,
|
|
1238
|
-
getRunesBalanceResultSchema,
|
|
1239
1206
|
getSupportedWallets,
|
|
1240
1207
|
isProviderInstalled,
|
|
1241
1208
|
removeDefaultProvider,
|