@sats-connect/core 0.0.11-1501a20 → 0.0.11-1692148
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 +74 -31
- package/dist/index.mjs +106 -36
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -159,6 +159,8 @@ interface RequestOptions<Payload extends RequestPayload, Response> {
|
|
|
159
159
|
payload: Payload;
|
|
160
160
|
getProvider?: () => Promise<BitcoinProvider | undefined>;
|
|
161
161
|
}
|
|
162
|
+
declare const RpcIdSchema: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
163
|
+
type RpcId = v.InferOutput<typeof RpcIdSchema>;
|
|
162
164
|
declare const rpcRequestMessageSchema: v.ObjectSchema<{
|
|
163
165
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
164
166
|
readonly method: v.StringSchema<undefined>;
|
|
@@ -166,7 +168,6 @@ declare const rpcRequestMessageSchema: v.ObjectSchema<{
|
|
|
166
168
|
readonly id: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
167
169
|
}, undefined>;
|
|
168
170
|
type RpcRequestMessage = v.InferOutput<typeof rpcRequestMessageSchema>;
|
|
169
|
-
type RpcId = string | null;
|
|
170
171
|
interface RpcBase {
|
|
171
172
|
jsonrpc: '2.0';
|
|
172
173
|
id: RpcId;
|
|
@@ -219,6 +220,28 @@ declare enum RpcErrorCode {
|
|
|
219
220
|
*/
|
|
220
221
|
ACCESS_DENIED = -32002
|
|
221
222
|
}
|
|
223
|
+
declare const rpcSuccessResponseMessageSchema: v.ObjectSchema<{
|
|
224
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
225
|
+
readonly result: v.NonOptionalSchema<v.UnknownSchema, undefined>;
|
|
226
|
+
readonly id: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
227
|
+
}, undefined>;
|
|
228
|
+
type RpcSuccessResponseMessage = v.InferOutput<typeof rpcSuccessResponseMessageSchema>;
|
|
229
|
+
declare const rpcErrorResponseMessageSchema: v.ObjectSchema<{
|
|
230
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
231
|
+
readonly error: v.NonOptionalSchema<v.UnknownSchema, undefined>;
|
|
232
|
+
readonly id: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
233
|
+
}, undefined>;
|
|
234
|
+
type RpcErrorResponseMessage = v.InferOutput<typeof rpcErrorResponseMessageSchema>;
|
|
235
|
+
declare const rpcResponseMessageSchema: v.UnionSchema<[v.ObjectSchema<{
|
|
236
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
237
|
+
readonly result: v.NonOptionalSchema<v.UnknownSchema, undefined>;
|
|
238
|
+
readonly id: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
239
|
+
}, undefined>, v.ObjectSchema<{
|
|
240
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
241
|
+
readonly error: v.NonOptionalSchema<v.UnknownSchema, undefined>;
|
|
242
|
+
readonly id: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
243
|
+
}, undefined>], undefined>;
|
|
244
|
+
type RpcResponseMessage = v.InferOutput<typeof rpcResponseMessageSchema>;
|
|
222
245
|
interface RpcError {
|
|
223
246
|
code: number | RpcErrorCode;
|
|
224
247
|
message: string;
|
|
@@ -469,12 +492,25 @@ declare const getBalanceMethodName = "getBalance";
|
|
|
469
492
|
declare const getBalanceParamsSchema: v.UndefinedSchema<undefined>;
|
|
470
493
|
declare const getBalanceResultSchema: v.ObjectSchema<{
|
|
471
494
|
/**
|
|
472
|
-
* The balance of the wallet in sats.
|
|
495
|
+
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
496
|
+
* messages not supporting bigint
|
|
497
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
473
498
|
*/
|
|
474
|
-
readonly
|
|
475
|
-
|
|
499
|
+
readonly confirmed: v.StringSchema<undefined>;
|
|
500
|
+
/**
|
|
501
|
+
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
502
|
+
* messages not supporting bigint
|
|
503
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
504
|
+
*/
|
|
505
|
+
readonly unconfirmed: v.StringSchema<undefined>;
|
|
506
|
+
/**
|
|
507
|
+
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
508
|
+
* sats. Using a string due to chrome messages not supporting bigint
|
|
509
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
510
|
+
*/
|
|
511
|
+
readonly total: v.StringSchema<undefined>;
|
|
476
512
|
}, undefined>;
|
|
477
|
-
declare const
|
|
513
|
+
declare const getBalanceRequestMessageSchema: v.ObjectSchema<{
|
|
478
514
|
readonly method: v.LiteralSchema<"getBalance", undefined>;
|
|
479
515
|
readonly id: v.StringSchema<undefined>;
|
|
480
516
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
@@ -593,17 +629,24 @@ interface RbfOrderResult {
|
|
|
593
629
|
fundingAddress: string;
|
|
594
630
|
}
|
|
595
631
|
type RbfOrder = MethodParamsAndResult<RbfOrderParams, RbfOrderResult>;
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
632
|
+
declare const getRunesBalanceMethodName = "getRunesBalance";
|
|
633
|
+
declare const getRunesBalanceParamsSchema: v.NullSchema<undefined>;
|
|
634
|
+
declare const getRunesBalanceResultSchema: v.ObjectSchema<{
|
|
635
|
+
readonly balances: v.ArraySchema<v.ObjectSchema<{
|
|
636
|
+
readonly runeName: v.StringSchema<undefined>;
|
|
637
|
+
readonly amount: v.StringSchema<undefined>;
|
|
638
|
+
readonly divisibility: v.NumberSchema<undefined>;
|
|
639
|
+
readonly symbol: v.StringSchema<undefined>;
|
|
640
|
+
readonly inscriptionId: v.NullishSchema<v.StringSchema<undefined>, never>;
|
|
641
|
+
}, undefined>, undefined>;
|
|
642
|
+
}, undefined>;
|
|
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>>;
|
|
607
650
|
|
|
608
651
|
interface Pubkey {
|
|
609
652
|
/**
|
|
@@ -785,26 +828,26 @@ type SignTransactionParams = Transaction & Partial<Pubkey>;
|
|
|
785
828
|
type SignTransactionResult = Transaction;
|
|
786
829
|
type StxSignTransaction = MethodParamsAndResult<SignTransactionParams, SignTransactionResult>;
|
|
787
830
|
|
|
788
|
-
declare const
|
|
789
|
-
declare const
|
|
790
|
-
declare const
|
|
791
|
-
declare const
|
|
792
|
-
readonly method: v.LiteralSchema<"
|
|
831
|
+
declare const requestPermissionsMethodName = "wallet_requestPermissions";
|
|
832
|
+
declare const requestPermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
833
|
+
declare const requestPermissionsResultSchema: v.LiteralSchema<true, undefined>;
|
|
834
|
+
declare const requestPermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
835
|
+
readonly method: v.LiteralSchema<"wallet_requestPermissions", undefined>;
|
|
793
836
|
readonly params: v.UndefinedSchema<undefined>;
|
|
794
837
|
readonly id: v.StringSchema<undefined>;
|
|
795
838
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
796
839
|
}, undefined>;
|
|
797
|
-
type
|
|
798
|
-
declare const
|
|
799
|
-
declare const
|
|
800
|
-
declare const
|
|
801
|
-
declare const
|
|
802
|
-
readonly method: v.LiteralSchema<"
|
|
840
|
+
type RequestPermissions = MethodParamsAndResult<v.InferOutput<typeof requestPermissionsParamsSchema>, v.InferOutput<typeof requestPermissionsResultSchema>>;
|
|
841
|
+
declare const renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
842
|
+
declare const renouncePermissionsParamsSchema: v.UndefinedSchema<undefined>;
|
|
843
|
+
declare const renouncePermissionsResultSchema: v.LiteralSchema<true, undefined>;
|
|
844
|
+
declare const renouncePermissionsRequestMessageSchema: v.ObjectSchema<{
|
|
845
|
+
readonly method: v.LiteralSchema<"wallet_renouncePermissions", undefined>;
|
|
803
846
|
readonly params: v.UndefinedSchema<undefined>;
|
|
804
847
|
readonly id: v.StringSchema<undefined>;
|
|
805
848
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
806
849
|
}, undefined>;
|
|
807
|
-
type
|
|
850
|
+
type RenouncePermissions = MethodParamsAndResult<v.InferOutput<typeof renouncePermissionsParamsSchema>, v.InferOutput<typeof renouncePermissionsResultSchema>>;
|
|
808
851
|
|
|
809
852
|
interface StxRequests {
|
|
810
853
|
stx_callContract: StxCallContract;
|
|
@@ -839,8 +882,8 @@ interface RunesRequests {
|
|
|
839
882
|
}
|
|
840
883
|
type RunesRequestMethod = keyof RunesRequests;
|
|
841
884
|
interface WalletMethods {
|
|
842
|
-
|
|
843
|
-
|
|
885
|
+
wallet_requestPermissions: RequestPermissions;
|
|
886
|
+
wallet_renouncePermissions: RenouncePermissions;
|
|
844
887
|
}
|
|
845
888
|
type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods;
|
|
846
889
|
type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
|
|
@@ -870,4 +913,4 @@ declare class BaseAdapter extends SatsConnectAdapter {
|
|
|
870
913
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
871
914
|
declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
|
|
872
915
|
|
|
873
|
-
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
|
|
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 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 GetOrder, type GetRunesBalance, type InputToSign, type MethodParamsAndResult, type MintRunes, type MintRunesParams, type MintRunesResult, 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, 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
|
@@ -1,11 +1,12 @@
|
|
|
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__ */ ((BitcoinNetworkType3) => {
|
|
4
|
+
BitcoinNetworkType3["Mainnet"] = "Mainnet";
|
|
5
|
+
BitcoinNetworkType3["Testnet"] = "Testnet";
|
|
6
|
+
BitcoinNetworkType3["Signet"] = "Signet";
|
|
7
|
+
return BitcoinNetworkType3;
|
|
8
8
|
})(BitcoinNetworkType || {});
|
|
9
|
+
var RpcIdSchema = v.optional(v.union([v.string(), v.number(), v.null()]));
|
|
9
10
|
var rpcRequestMessageSchema = v.object({
|
|
10
11
|
jsonrpc: v.literal("2.0"),
|
|
11
12
|
method: v.string(),
|
|
@@ -20,7 +21,7 @@ var rpcRequestMessageSchema = v.object({
|
|
|
20
21
|
v.null()
|
|
21
22
|
])
|
|
22
23
|
),
|
|
23
|
-
id:
|
|
24
|
+
id: RpcIdSchema
|
|
24
25
|
});
|
|
25
26
|
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
26
27
|
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
@@ -33,6 +34,20 @@ var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
|
33
34
|
RpcErrorCode2[RpcErrorCode2["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
|
|
34
35
|
return RpcErrorCode2;
|
|
35
36
|
})(RpcErrorCode || {});
|
|
37
|
+
var rpcSuccessResponseMessageSchema = v.object({
|
|
38
|
+
jsonrpc: v.literal("2.0"),
|
|
39
|
+
result: v.nonOptional(v.unknown()),
|
|
40
|
+
id: RpcIdSchema
|
|
41
|
+
});
|
|
42
|
+
var rpcErrorResponseMessageSchema = v.object({
|
|
43
|
+
jsonrpc: v.literal("2.0"),
|
|
44
|
+
error: v.nonOptional(v.unknown()),
|
|
45
|
+
id: RpcIdSchema
|
|
46
|
+
});
|
|
47
|
+
var rpcResponseMessageSchema = v.union([
|
|
48
|
+
rpcSuccessResponseMessageSchema,
|
|
49
|
+
rpcErrorResponseMessageSchema
|
|
50
|
+
]);
|
|
36
51
|
|
|
37
52
|
// src/runes/api.ts
|
|
38
53
|
import axios from "axios";
|
|
@@ -510,6 +525,9 @@ function getSupportedWallets() {
|
|
|
510
525
|
return wallets;
|
|
511
526
|
}
|
|
512
527
|
|
|
528
|
+
// src/request/index.ts
|
|
529
|
+
import * as v6 from "valibot";
|
|
530
|
+
|
|
513
531
|
// src/addresses/index.ts
|
|
514
532
|
import { createUnsecuredToken } from "jsontokens";
|
|
515
533
|
|
|
@@ -654,12 +672,25 @@ var getBalanceMethodName = "getBalance";
|
|
|
654
672
|
var getBalanceParamsSchema = v3.undefined();
|
|
655
673
|
var getBalanceResultSchema = v3.object({
|
|
656
674
|
/**
|
|
657
|
-
* The balance of the wallet in sats.
|
|
675
|
+
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
676
|
+
* messages not supporting bigint
|
|
677
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
658
678
|
*/
|
|
659
|
-
|
|
660
|
-
|
|
679
|
+
confirmed: v3.string(),
|
|
680
|
+
/**
|
|
681
|
+
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
682
|
+
* messages not supporting bigint
|
|
683
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
684
|
+
*/
|
|
685
|
+
unconfirmed: v3.string(),
|
|
686
|
+
/**
|
|
687
|
+
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
688
|
+
* sats. Using a string due to chrome messages not supporting bigint
|
|
689
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
690
|
+
*/
|
|
691
|
+
total: v3.string()
|
|
661
692
|
});
|
|
662
|
-
var
|
|
693
|
+
var getBalanceRequestMessageSchema = v3.object({
|
|
663
694
|
...rpcRequestMessageSchema.entries,
|
|
664
695
|
...v3.object({
|
|
665
696
|
method: v3.literal(getBalanceMethodName),
|
|
@@ -669,29 +700,53 @@ var getBalanceSchema = v3.object({
|
|
|
669
700
|
|
|
670
701
|
// src/request/types/walletMethods.ts
|
|
671
702
|
import * as v4 from "valibot";
|
|
672
|
-
var
|
|
673
|
-
var
|
|
674
|
-
var
|
|
675
|
-
var
|
|
703
|
+
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
704
|
+
var requestPermissionsParamsSchema = v4.undefined();
|
|
705
|
+
var requestPermissionsResultSchema = v4.literal(true);
|
|
706
|
+
var requestPermissionsRequestMessageSchema = v4.object({
|
|
676
707
|
...rpcRequestMessageSchema.entries,
|
|
677
708
|
...v4.object({
|
|
678
|
-
method: v4.literal(
|
|
679
|
-
params:
|
|
709
|
+
method: v4.literal(requestPermissionsMethodName),
|
|
710
|
+
params: requestPermissionsParamsSchema,
|
|
680
711
|
id: v4.string()
|
|
681
712
|
}).entries
|
|
682
713
|
});
|
|
683
|
-
var
|
|
684
|
-
var
|
|
685
|
-
var
|
|
686
|
-
var
|
|
714
|
+
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
715
|
+
var renouncePermissionsParamsSchema = v4.undefined();
|
|
716
|
+
var renouncePermissionsResultSchema = v4.literal(true);
|
|
717
|
+
var renouncePermissionsRequestMessageSchema = v4.object({
|
|
687
718
|
...rpcRequestMessageSchema.entries,
|
|
688
719
|
...v4.object({
|
|
689
|
-
method: v4.literal(
|
|
690
|
-
params:
|
|
720
|
+
method: v4.literal(renouncePermissionsMethodName),
|
|
721
|
+
params: renouncePermissionsParamsSchema,
|
|
691
722
|
id: v4.string()
|
|
692
723
|
}).entries
|
|
693
724
|
});
|
|
694
725
|
|
|
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
|
+
|
|
695
750
|
// src/request/index.ts
|
|
696
751
|
var request = async (method, params, providerId) => {
|
|
697
752
|
let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
|
|
@@ -705,7 +760,13 @@ var request = async (method, params, providerId) => {
|
|
|
705
760
|
throw new Error("A wallet method is required");
|
|
706
761
|
}
|
|
707
762
|
const response = await provider.request(method, params);
|
|
708
|
-
if (
|
|
763
|
+
if (v6.is(rpcErrorResponseMessageSchema, response)) {
|
|
764
|
+
return {
|
|
765
|
+
status: "error",
|
|
766
|
+
error: response.error
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
if (v6.is(rpcSuccessResponseMessageSchema, response)) {
|
|
709
770
|
return {
|
|
710
771
|
status: "success",
|
|
711
772
|
result: response.result
|
|
@@ -713,12 +774,13 @@ var request = async (method, params, providerId) => {
|
|
|
713
774
|
}
|
|
714
775
|
return {
|
|
715
776
|
status: "error",
|
|
716
|
-
error:
|
|
777
|
+
error: {
|
|
778
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
779
|
+
message: "Received unknown response from provider.",
|
|
780
|
+
data: response
|
|
781
|
+
}
|
|
717
782
|
};
|
|
718
783
|
};
|
|
719
|
-
var isRpcSuccessResponse = (response) => {
|
|
720
|
-
return Object.hasOwn(response, "result") && !!response.result;
|
|
721
|
-
};
|
|
722
784
|
|
|
723
785
|
// src/adapters/xverse.ts
|
|
724
786
|
var XverseAdapter = class extends SatsConnectAdapter {
|
|
@@ -1134,19 +1196,12 @@ export {
|
|
|
1134
1196
|
BitcoinNetworkType,
|
|
1135
1197
|
DefaultAdaptersInfo,
|
|
1136
1198
|
RpcErrorCode,
|
|
1199
|
+
RpcIdSchema,
|
|
1137
1200
|
SatsConnectAdapter,
|
|
1138
1201
|
addressSchema,
|
|
1139
|
-
connectMethodName,
|
|
1140
|
-
connectParamsSchema,
|
|
1141
|
-
connectResultSchema,
|
|
1142
|
-
connectSchema,
|
|
1143
1202
|
createInscription,
|
|
1144
1203
|
createRepeatInscriptions,
|
|
1145
1204
|
defaultAdapters,
|
|
1146
|
-
disconnectMethodName,
|
|
1147
|
-
disconnectParamsSchema,
|
|
1148
|
-
disconnectResultSchema,
|
|
1149
|
-
disconnectSchema,
|
|
1150
1205
|
getAccountsMethodName,
|
|
1151
1206
|
getAccountsParamsSchema,
|
|
1152
1207
|
getAccountsRequestMessageSchema,
|
|
@@ -1158,8 +1213,8 @@ export {
|
|
|
1158
1213
|
getAddressesResultSchema,
|
|
1159
1214
|
getBalanceMethodName,
|
|
1160
1215
|
getBalanceParamsSchema,
|
|
1216
|
+
getBalanceRequestMessageSchema,
|
|
1161
1217
|
getBalanceResultSchema,
|
|
1162
|
-
getBalanceSchema,
|
|
1163
1218
|
getCapabilities,
|
|
1164
1219
|
getDefaultProvider,
|
|
1165
1220
|
getInfoMethodName,
|
|
@@ -1169,11 +1224,26 @@ export {
|
|
|
1169
1224
|
getProviderById,
|
|
1170
1225
|
getProviderOrThrow,
|
|
1171
1226
|
getProviders,
|
|
1227
|
+
getRunesBalanceMethodName,
|
|
1228
|
+
getRunesBalanceParamsSchema,
|
|
1229
|
+
getRunesBalanceRequestMessageSchema,
|
|
1230
|
+
getRunesBalanceResultSchema,
|
|
1172
1231
|
getSupportedWallets,
|
|
1173
1232
|
isProviderInstalled,
|
|
1174
1233
|
removeDefaultProvider,
|
|
1234
|
+
renouncePermissionsMethodName,
|
|
1235
|
+
renouncePermissionsParamsSchema,
|
|
1236
|
+
renouncePermissionsRequestMessageSchema,
|
|
1237
|
+
renouncePermissionsResultSchema,
|
|
1175
1238
|
request,
|
|
1239
|
+
requestPermissionsMethodName,
|
|
1240
|
+
requestPermissionsParamsSchema,
|
|
1241
|
+
requestPermissionsRequestMessageSchema,
|
|
1242
|
+
requestPermissionsResultSchema,
|
|
1243
|
+
rpcErrorResponseMessageSchema,
|
|
1176
1244
|
rpcRequestMessageSchema,
|
|
1245
|
+
rpcResponseMessageSchema,
|
|
1246
|
+
rpcSuccessResponseMessageSchema,
|
|
1177
1247
|
sendBtcTransaction,
|
|
1178
1248
|
setDefaultProvider,
|
|
1179
1249
|
signMessage,
|