@vue-solana/vue 1.2.0 → 2.1.0
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/README.md +162 -23
- package/dist/buffer-polyfill.d.cts +0 -1
- package/dist/buffer-polyfill.d.mts +0 -1
- package/dist/buffer-polyfill.d.ts +0 -1
- package/dist/index.cjs +62 -22
- package/dist/index.d.cts +29 -13
- package/dist/index.d.mts +29 -13
- package/dist/index.d.ts +29 -13
- package/dist/index.mjs +41 -21
- package/dist/kit.d.cts +1 -1
- package/dist/kit.d.mts +1 -1
- package/dist/kit.d.ts +1 -1
- package/dist/shared/vue.5euWd6-V.mjs +59 -0
- package/dist/shared/vue.9TPxZPMf.cjs +59 -0
- package/dist/shared/vue.B4-LEdSE.cjs +102 -0
- package/dist/shared/{vue.C0uCLjJ6.cjs → vue.B6ainw2G.cjs} +1 -1
- package/dist/shared/vue.B8LptjZP.mjs +32 -0
- package/dist/shared/vue.B8pLQ8P4.cjs +105 -0
- package/dist/shared/vue.B8ub540p.mjs +109 -0
- package/dist/shared/{vue.D0ycWj82.mjs → vue.BD6Gm1nl.mjs} +9 -9
- package/dist/shared/{vue.BEesxsrA.cjs → vue.BGxz4dru.cjs} +7 -3
- package/dist/shared/{vue.DDxhSi72.mjs → vue.BINkrA8h.mjs} +9 -9
- package/dist/shared/{vue.COPnX5fq.cjs → vue.BIxphCAq.cjs} +1 -1
- package/dist/shared/{vue.CKTUFwSI.mjs → vue.BOpgWr43.mjs} +9 -10
- package/dist/shared/vue.BQRpjwKl.mjs +80 -0
- package/dist/shared/vue.BVaMoz9y.cjs +9 -0
- package/dist/shared/vue.BVj9lWBK.cjs +111 -0
- package/dist/shared/vue.BY0qpgYr.cjs +35 -0
- package/dist/shared/vue.Bfu1dCKe.mjs +10 -0
- package/dist/shared/vue.Bk5xjlUx.cjs +61 -0
- package/dist/shared/{vue.BtUKvuQw.mjs → vue.BsGwt78R.mjs} +2 -2
- package/dist/shared/{vue.BbX3ePDY.cjs → vue.Bwd1sGAM.cjs} +9 -10
- package/dist/shared/vue.ByxbBC3y.mjs +57 -0
- package/dist/shared/{vue.CPjEwHSg.mjs → vue.C13umiQi.mjs} +20 -8
- package/dist/shared/vue.C5FVoEZT.mjs +99 -0
- package/dist/shared/vue.CATOh_9G.mjs +42 -0
- package/dist/shared/{vue.Bhdhmz8d.cjs → vue.CIs8QhCw.cjs} +18 -74
- package/dist/shared/vue.CMohL_Cz.mjs +58 -0
- package/dist/shared/{vue.CYKT65tB.mjs → vue.CQh3AUE8.mjs} +2 -6
- package/dist/shared/{vue.DzKfcfpX.cjs → vue.CWZSMVnB.cjs} +6 -6
- package/dist/shared/{vue.B12Pt1PQ.mjs → vue.CXB4NEMA.mjs} +18 -74
- package/dist/shared/{vue.DFbay4mm.mjs → vue.C_4qJDiF.mjs} +1 -1
- package/dist/shared/vue.CoaIWGPT.cjs +38 -0
- package/dist/shared/vue.CogzzQXM.mjs +171 -0
- package/dist/shared/vue.CpkwC8Th.mjs +7 -0
- package/dist/shared/vue.CrkK_T15.cjs +86 -0
- package/dist/shared/vue.D-qi8PSL.cjs +82 -0
- package/dist/shared/{vue.B2AQR2bE.mjs → vue.D218Ow7t.mjs} +8 -4
- package/dist/shared/{vue.QHAHFnw8.mjs → vue.D3Y0PWbF.mjs} +3 -3
- package/dist/shared/vue.D5U1yLG3.mjs +83 -0
- package/dist/shared/{vue.j1vB3h1n.cjs → vue.DAg5wC1G.cjs} +9 -9
- package/dist/shared/vue.DDbVk0Zh.cjs +180 -0
- package/dist/shared/{vue.BE4KHksm.cjs → vue.DE3emjSF.cjs} +2 -7
- package/dist/shared/vue.DEHxNvUX.cjs +7 -0
- package/dist/shared/vue.DFaMJLAQ.cjs +60 -0
- package/dist/shared/vue.DImwKTwJ.mjs +103 -0
- package/dist/shared/{vue.G9t8pE0J.cjs → vue.DKyQ7J67.cjs} +1 -1
- package/dist/shared/vue.DNxOpDXz.cjs +12 -0
- package/dist/shared/vue.DXQVIRZA.mjs +174 -0
- package/dist/shared/vue.DYk0Xfr3.mjs +36 -0
- package/dist/shared/vue.D_P5SqqD.mjs +5 -0
- package/dist/shared/{vue.B14U1xmP.cjs → vue.Di7yjJ-R.cjs} +20 -8
- package/dist/shared/vue.DtCbCcPd.cjs +173 -0
- package/dist/shared/{vue.CM_uqVc0.mjs → vue.Dyi1OCI1.mjs} +6 -6
- package/dist/shared/{vue.BsD6AAmO.cjs → vue.E_npPFoV.cjs} +8 -8
- package/dist/shared/{vue.LNhX07HB.cjs → vue.FiMmnMHr.cjs} +2 -2
- package/dist/shared/{vue.CSzg70vB.mjs → vue.JUWqu6kD.mjs} +1 -1
- package/dist/shared/{vue.By1CUlOU.mjs → vue.Mxc8w6Qk.mjs} +1 -1
- package/dist/shared/{vue.ByUemLSf.cjs → vue.Sbbm9JSu.cjs} +3 -3
- package/dist/shared/vue.g8fnm_ca.cjs +45 -0
- package/dist/swr.cjs +136 -0
- package/dist/swr.d.cts +41 -0
- package/dist/swr.d.mts +41 -0
- package/dist/swr.d.ts +41 -0
- package/dist/swr.mjs +131 -0
- package/dist/useAccountInfo.cjs +7 -5
- package/dist/useAccountInfo.d.cts +12 -8
- package/dist/useAccountInfo.d.mts +12 -8
- package/dist/useAccountInfo.d.ts +12 -8
- package/dist/useAccountInfo.mjs +7 -5
- package/dist/useAction.cjs +9 -0
- package/dist/useAction.d.cts +45 -0
- package/dist/useAction.d.mts +45 -0
- package/dist/useAction.d.ts +45 -0
- package/dist/useAction.mjs +3 -0
- package/dist/useBalance.cjs +5 -4
- package/dist/useBalance.d.cts +4 -2
- package/dist/useBalance.d.mts +4 -2
- package/dist/useBalance.d.ts +4 -2
- package/dist/useBalance.mjs +5 -4
- package/dist/useClientCapability.cjs +12 -0
- package/dist/useClientCapability.d.cts +39 -0
- package/dist/useClientCapability.d.mts +39 -0
- package/dist/useClientCapability.d.ts +39 -0
- package/dist/useClientCapability.mjs +5 -0
- package/dist/useConnection.cjs +4 -3
- package/dist/useConnection.d.cts +9 -2
- package/dist/useConnection.d.mts +9 -2
- package/dist/useConnection.d.ts +9 -2
- package/dist/useConnection.mjs +4 -3
- package/dist/useIdentity.cjs +12 -0
- package/dist/useIdentity.d.cts +3 -0
- package/dist/useIdentity.d.mts +3 -0
- package/dist/useIdentity.d.ts +3 -0
- package/dist/useIdentity.mjs +6 -0
- package/dist/usePayer.cjs +13 -0
- package/dist/usePayer.d.cts +18 -0
- package/dist/usePayer.d.mts +18 -0
- package/dist/usePayer.d.ts +18 -0
- package/dist/usePayer.mjs +6 -0
- package/dist/usePlanTransaction.cjs +14 -0
- package/dist/usePlanTransaction.d.cts +37 -0
- package/dist/usePlanTransaction.d.mts +37 -0
- package/dist/usePlanTransaction.d.ts +37 -0
- package/dist/usePlanTransaction.mjs +7 -0
- package/dist/usePlanTransactions.cjs +13 -0
- package/dist/usePlanTransactions.d.cts +4 -0
- package/dist/usePlanTransactions.d.mts +4 -0
- package/dist/usePlanTransactions.d.ts +4 -0
- package/dist/usePlanTransactions.mjs +7 -0
- package/dist/useProgramAccounts.cjs +7 -5
- package/dist/useProgramAccounts.d.cts +24 -9
- package/dist/useProgramAccounts.d.mts +24 -9
- package/dist/useProgramAccounts.d.ts +24 -9
- package/dist/useProgramAccounts.mjs +7 -5
- package/dist/useRequest.cjs +11 -0
- package/dist/useRequest.d.cts +57 -0
- package/dist/useRequest.d.mts +57 -0
- package/dist/useRequest.d.ts +57 -0
- package/dist/useRequest.mjs +5 -0
- package/dist/useRpc.cjs +3 -2
- package/dist/useRpc.d.cts +5 -2
- package/dist/useRpc.d.mts +5 -2
- package/dist/useRpc.d.ts +5 -2
- package/dist/useRpc.mjs +3 -2
- package/dist/useSelectedWalletAccount.cjs +13 -0
- package/dist/useSelectedWalletAccount.d.cts +117 -0
- package/dist/useSelectedWalletAccount.d.mts +117 -0
- package/dist/useSelectedWalletAccount.d.ts +117 -0
- package/dist/useSelectedWalletAccount.mjs +3 -0
- package/dist/useSignAndSendTransaction.cjs +7 -6
- package/dist/useSignAndSendTransaction.d.cts +18 -24
- package/dist/useSignAndSendTransaction.d.mts +18 -24
- package/dist/useSignAndSendTransaction.d.ts +18 -24
- package/dist/useSignAndSendTransaction.mjs +7 -6
- package/dist/useSignAndSendTransactions.cjs +15 -0
- package/dist/useSignAndSendTransactions.d.cts +35 -0
- package/dist/useSignAndSendTransactions.d.mts +35 -0
- package/dist/useSignAndSendTransactions.d.ts +35 -0
- package/dist/useSignAndSendTransactions.mjs +8 -0
- package/dist/useSignIn.cjs +13 -0
- package/dist/useSignIn.d.cts +23 -0
- package/dist/useSignIn.d.mts +23 -0
- package/dist/useSignIn.d.ts +23 -0
- package/dist/useSignIn.mjs +7 -0
- package/dist/useSignMessage.cjs +4 -3
- package/dist/useSignMessage.mjs +4 -3
- package/dist/useSignTransactions.cjs +13 -0
- package/dist/useSignTransactions.d.cts +24 -0
- package/dist/useSignTransactions.d.mts +24 -0
- package/dist/useSignTransactions.d.ts +24 -0
- package/dist/useSignTransactions.mjs +7 -0
- package/dist/useSignatureStatus.cjs +5 -4
- package/dist/useSignatureStatus.d.cts +9 -5
- package/dist/useSignatureStatus.d.mts +9 -5
- package/dist/useSignatureStatus.d.ts +9 -5
- package/dist/useSignatureStatus.mjs +5 -4
- package/dist/useSolana.cjs +2 -1
- package/dist/useSolana.mjs +2 -1
- package/dist/useSolanaClient.cjs +3 -2
- package/dist/useSolanaClient.mjs +3 -2
- package/dist/useSubscription.cjs +9 -0
- package/dist/useSubscription.d.cts +58 -0
- package/dist/useSubscription.d.mts +58 -0
- package/dist/useSubscription.d.ts +58 -0
- package/dist/useSubscription.mjs +3 -0
- package/dist/useTokenAccounts.cjs +7 -6
- package/dist/useTokenAccounts.d.cts +6 -6
- package/dist/useTokenAccounts.d.mts +6 -6
- package/dist/useTokenAccounts.d.ts +6 -6
- package/dist/useTokenAccounts.mjs +7 -6
- package/dist/useTokenBalance.cjs +7 -6
- package/dist/useTokenBalance.d.cts +2 -2
- package/dist/useTokenBalance.d.mts +2 -2
- package/dist/useTokenBalance.d.ts +2 -2
- package/dist/useTokenBalance.mjs +7 -6
- package/dist/useTrackedData.cjs +10 -0
- package/dist/useTrackedData.d.cts +86 -0
- package/dist/useTrackedData.d.mts +86 -0
- package/dist/useTrackedData.d.ts +86 -0
- package/dist/useTrackedData.mjs +4 -0
- package/dist/useTransaction.cjs +2 -1
- package/dist/useTransaction.d.cts +13 -3
- package/dist/useTransaction.d.mts +13 -3
- package/dist/useTransaction.d.ts +13 -3
- package/dist/useTransaction.mjs +2 -1
- package/dist/useTransactionConfirmation.cjs +5 -4
- package/dist/useTransactionConfirmation.d.cts +18 -24
- package/dist/useTransactionConfirmation.d.mts +18 -24
- package/dist/useTransactionConfirmation.d.ts +18 -24
- package/dist/useTransactionConfirmation.mjs +5 -4
- package/dist/useWallet.cjs +3 -2
- package/dist/useWallet.d.cts +2 -2
- package/dist/useWallet.d.mts +2 -2
- package/dist/useWallet.d.ts +2 -2
- package/dist/useWallet.mjs +3 -2
- package/dist/useWallets.cjs +3 -2
- package/dist/useWallets.mjs +3 -2
- package/package.json +73 -9
- package/dist/shared/vue.C4d2JA8U.mjs +0 -44
- package/dist/shared/vue.CE5i8KZZ.cjs +0 -46
- package/dist/shared/vue.CfrVAzEf.mjs +0 -129
- package/dist/shared/vue.DCgByzxg.cjs +0 -9
- package/dist/shared/vue.DiNn3XHm.mjs +0 -7
- package/dist/shared/vue._CAClzAz.cjs +0 -131
- package/dist/web3.cjs +0 -13
- package/dist/web3.d.cts +0 -1
- package/dist/web3.d.mts +0 -1
- package/dist/web3.d.ts +0 -1
- package/dist/web3.mjs +0 -1
package/dist/swr.mjs
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { watch, computed } from 'vue';
|
|
2
|
+
import { u as useRequest } from './shared/vue.DImwKTwJ.mjs';
|
|
3
|
+
import { u as useSubscription } from './shared/vue.B8ub540p.mjs';
|
|
4
|
+
import { u as useTrackedData } from './shared/vue.CogzzQXM.mjs';
|
|
5
|
+
import '@vue-solana/core/action';
|
|
6
|
+
import '@vue-solana/core/kit';
|
|
7
|
+
import '@vue-solana/core/errors';
|
|
8
|
+
|
|
9
|
+
const PREFIX_REQUEST = "request:";
|
|
10
|
+
const PREFIX_SUBSCRIPTION = "subscription:";
|
|
11
|
+
const PREFIX_TRACKED = "tracked:";
|
|
12
|
+
const swrCache = /* @__PURE__ */ new Map();
|
|
13
|
+
function clearSwrCache() {
|
|
14
|
+
swrCache.clear();
|
|
15
|
+
}
|
|
16
|
+
function readSwrCache(key) {
|
|
17
|
+
return swrCache.get(key);
|
|
18
|
+
}
|
|
19
|
+
function writeSwrCache(key, entry) {
|
|
20
|
+
swrCache.set(key, entry);
|
|
21
|
+
}
|
|
22
|
+
function deleteSwrCache(key) {
|
|
23
|
+
swrCache.delete(key);
|
|
24
|
+
}
|
|
25
|
+
function isPendingStatus(status) {
|
|
26
|
+
return status === "fetching" || status === "loading";
|
|
27
|
+
}
|
|
28
|
+
function writeSwrResult(key, data, error, status) {
|
|
29
|
+
if (status === "disabled") {
|
|
30
|
+
deleteSwrCache(key);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const previous = readSwrCache(key);
|
|
34
|
+
writeSwrCache(key, {
|
|
35
|
+
data: data !== void 0 ? data : previous?.data,
|
|
36
|
+
error,
|
|
37
|
+
status
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function swrError(error, status, seed) {
|
|
41
|
+
if (status === "disabled") {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return error ?? (isPendingStatus(status) ? seed?.error ?? null : null);
|
|
45
|
+
}
|
|
46
|
+
function useRequestSwr(key, source, options = {}) {
|
|
47
|
+
const cacheKey = `${PREFIX_REQUEST}${key}`;
|
|
48
|
+
const seed = readSwrCache(cacheKey);
|
|
49
|
+
const result = useRequest(source, options);
|
|
50
|
+
if (result.status.value === "disabled") {
|
|
51
|
+
deleteSwrCache(cacheKey);
|
|
52
|
+
}
|
|
53
|
+
watch(
|
|
54
|
+
[result.data, result.error, result.status],
|
|
55
|
+
([data2, error2, status]) => writeSwrResult(cacheKey, data2, error2, status),
|
|
56
|
+
{ flush: "sync" }
|
|
57
|
+
);
|
|
58
|
+
const data = computed(() => {
|
|
59
|
+
if (result.status.value === "disabled") {
|
|
60
|
+
return void 0;
|
|
61
|
+
}
|
|
62
|
+
return result.data.value !== void 0 ? result.data.value : seed?.data;
|
|
63
|
+
});
|
|
64
|
+
const error = computed(
|
|
65
|
+
() => swrError(result.error.value, result.status.value, seed)
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
data,
|
|
69
|
+
error,
|
|
70
|
+
refresh: result.refresh,
|
|
71
|
+
status: result.status
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function useSubscriptionSwr(key, source, options = {}) {
|
|
75
|
+
const cacheKey = `${PREFIX_SUBSCRIPTION}${key}`;
|
|
76
|
+
const seed = readSwrCache(cacheKey);
|
|
77
|
+
const result = useSubscription(source, options);
|
|
78
|
+
if (result.status.value === "disabled") {
|
|
79
|
+
deleteSwrCache(cacheKey);
|
|
80
|
+
}
|
|
81
|
+
watch(
|
|
82
|
+
[result.data, result.error, result.status],
|
|
83
|
+
([data2, error2, status]) => writeSwrResult(cacheKey, data2, error2, status),
|
|
84
|
+
{ flush: "sync" }
|
|
85
|
+
);
|
|
86
|
+
const data = computed(() => {
|
|
87
|
+
if (result.status.value === "disabled") {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
return result.data.value !== void 0 ? result.data.value : seed?.data;
|
|
91
|
+
});
|
|
92
|
+
const error = computed(
|
|
93
|
+
() => swrError(result.error.value, result.status.value, seed)
|
|
94
|
+
);
|
|
95
|
+
return {
|
|
96
|
+
data,
|
|
97
|
+
error,
|
|
98
|
+
reconnect: result.reconnect,
|
|
99
|
+
status: result.status
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function useTrackedDataSwr(key, source, options = {}) {
|
|
103
|
+
const cacheKey = `${PREFIX_TRACKED}${key}`;
|
|
104
|
+
const seed = readSwrCache(cacheKey);
|
|
105
|
+
const result = useTrackedData(source, options);
|
|
106
|
+
if (result.status.value === "disabled") {
|
|
107
|
+
deleteSwrCache(cacheKey);
|
|
108
|
+
}
|
|
109
|
+
watch(
|
|
110
|
+
[result.data, result.error, result.status],
|
|
111
|
+
([data2, error2, status]) => writeSwrResult(cacheKey, data2, error2, status),
|
|
112
|
+
{ flush: "sync" }
|
|
113
|
+
);
|
|
114
|
+
const data = computed(() => {
|
|
115
|
+
if (result.status.value === "disabled") {
|
|
116
|
+
return void 0;
|
|
117
|
+
}
|
|
118
|
+
return result.data.value ?? seed?.data;
|
|
119
|
+
});
|
|
120
|
+
const error = computed(
|
|
121
|
+
() => swrError(result.error.value, result.status.value, seed)
|
|
122
|
+
);
|
|
123
|
+
return {
|
|
124
|
+
data,
|
|
125
|
+
error,
|
|
126
|
+
refresh: result.refresh,
|
|
127
|
+
status: result.status
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { clearSwrCache, useRequestSwr, useSubscriptionSwr, useTrackedDataSwr };
|
package/dist/useAccountInfo.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useAccountInfo = require('./shared/vue.
|
|
4
|
-
require('@vue-solana/core/address');
|
|
3
|
+
const useAccountInfo = require('./shared/vue.D-qi8PSL.cjs');
|
|
5
4
|
require('@vue-solana/core/errors');
|
|
6
5
|
require('vue');
|
|
7
|
-
require('
|
|
8
|
-
require('./shared/vue.
|
|
9
|
-
require('./shared/vue.
|
|
6
|
+
require('@vue-solana/core/address');
|
|
7
|
+
require('./shared/vue.BVaMoz9y.cjs');
|
|
8
|
+
require('./shared/vue.BIxphCAq.cjs');
|
|
9
|
+
require('./shared/vue.DE3emjSF.cjs');
|
|
10
|
+
require('./shared/vue.DEHxNvUX.cjs');
|
|
11
|
+
require('./shared/vue.DNxOpDXz.cjs');
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { Commitment } from '@vue-solana/core/kit';
|
|
4
4
|
import { SolanaError } from '@vue-solana/core/errors';
|
|
5
|
-
import { Commitment, AccountInfo } from '@vue-solana/core/web3';
|
|
6
5
|
|
|
7
6
|
interface UseAccountInfoOptions {
|
|
8
7
|
commitment?: Commitment;
|
|
9
|
-
watch?: boolean;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
interface AccountInfo {
|
|
10
|
+
executable: boolean;
|
|
11
|
+
lamports: number;
|
|
12
|
+
owner: string;
|
|
13
|
+
space: number;
|
|
14
|
+
data: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
declare function useAccountInfo(address: MaybeRefOrGetter<string | null | undefined>, options?: UseAccountInfoOptions): {
|
|
17
|
+
accountInfo: vue.ShallowRef<AccountInfo | null, AccountInfo | null>;
|
|
13
18
|
loading: vue.ShallowRef<boolean, boolean>;
|
|
14
19
|
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
15
|
-
refresh: () => Promise<AccountInfo
|
|
16
|
-
stopWatching: () => Promise<void>;
|
|
20
|
+
refresh: () => Promise<AccountInfo | null>;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
export { useAccountInfo };
|
|
20
|
-
export type { UseAccountInfoOptions };
|
|
24
|
+
export type { AccountInfo, UseAccountInfoOptions };
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { Commitment } from '@vue-solana/core/kit';
|
|
4
4
|
import { SolanaError } from '@vue-solana/core/errors';
|
|
5
|
-
import { Commitment, AccountInfo } from '@vue-solana/core/web3';
|
|
6
5
|
|
|
7
6
|
interface UseAccountInfoOptions {
|
|
8
7
|
commitment?: Commitment;
|
|
9
|
-
watch?: boolean;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
interface AccountInfo {
|
|
10
|
+
executable: boolean;
|
|
11
|
+
lamports: number;
|
|
12
|
+
owner: string;
|
|
13
|
+
space: number;
|
|
14
|
+
data: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
declare function useAccountInfo(address: MaybeRefOrGetter<string | null | undefined>, options?: UseAccountInfoOptions): {
|
|
17
|
+
accountInfo: vue.ShallowRef<AccountInfo | null, AccountInfo | null>;
|
|
13
18
|
loading: vue.ShallowRef<boolean, boolean>;
|
|
14
19
|
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
15
|
-
refresh: () => Promise<AccountInfo
|
|
16
|
-
stopWatching: () => Promise<void>;
|
|
20
|
+
refresh: () => Promise<AccountInfo | null>;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
export { useAccountInfo };
|
|
20
|
-
export type { UseAccountInfoOptions };
|
|
24
|
+
export type { AccountInfo, UseAccountInfoOptions };
|
package/dist/useAccountInfo.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { Commitment } from '@vue-solana/core/kit';
|
|
4
4
|
import { SolanaError } from '@vue-solana/core/errors';
|
|
5
|
-
import { Commitment, AccountInfo } from '@vue-solana/core/web3';
|
|
6
5
|
|
|
7
6
|
interface UseAccountInfoOptions {
|
|
8
7
|
commitment?: Commitment;
|
|
9
|
-
watch?: boolean;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
interface AccountInfo {
|
|
10
|
+
executable: boolean;
|
|
11
|
+
lamports: number;
|
|
12
|
+
owner: string;
|
|
13
|
+
space: number;
|
|
14
|
+
data: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
declare function useAccountInfo(address: MaybeRefOrGetter<string | null | undefined>, options?: UseAccountInfoOptions): {
|
|
17
|
+
accountInfo: vue.ShallowRef<AccountInfo | null, AccountInfo | null>;
|
|
13
18
|
loading: vue.ShallowRef<boolean, boolean>;
|
|
14
19
|
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
15
|
-
refresh: () => Promise<AccountInfo
|
|
16
|
-
stopWatching: () => Promise<void>;
|
|
20
|
+
refresh: () => Promise<AccountInfo | null>;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
export { useAccountInfo };
|
|
20
|
-
export type { UseAccountInfoOptions };
|
|
24
|
+
export type { AccountInfo, UseAccountInfoOptions };
|
package/dist/useAccountInfo.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { u as useAccountInfo } from './shared/vue.
|
|
2
|
-
import '@vue-solana/core/address';
|
|
1
|
+
export { u as useAccountInfo } from './shared/vue.BQRpjwKl.mjs';
|
|
3
2
|
import '@vue-solana/core/errors';
|
|
4
3
|
import 'vue';
|
|
5
|
-
import '
|
|
6
|
-
import './shared/vue.
|
|
7
|
-
import './shared/vue.
|
|
4
|
+
import '@vue-solana/core/address';
|
|
5
|
+
import './shared/vue.CpkwC8Th.mjs';
|
|
6
|
+
import './shared/vue.Mxc8w6Qk.mjs';
|
|
7
|
+
import './shared/vue.CQh3AUE8.mjs';
|
|
8
|
+
import './shared/vue.D_P5SqqD.mjs';
|
|
9
|
+
import './shared/vue.Bfu1dCKe.mjs';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
type UseActionStatus = "idle" | "running" | "success" | "error";
|
|
4
|
+
interface UseActionOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Called after a dispatch settles successfully.
|
|
7
|
+
*/
|
|
8
|
+
onSuccess?: (data: unknown) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Called after a dispatch fails for a reason other than supersession.
|
|
11
|
+
*/
|
|
12
|
+
onError?: (error: unknown) => void;
|
|
13
|
+
}
|
|
14
|
+
interface UseActionReturn<TArgs extends readonly unknown[], TResult> {
|
|
15
|
+
data: ComputedRef<TResult | undefined>;
|
|
16
|
+
dispatch: (...args: TArgs) => Promise<TResult>;
|
|
17
|
+
error: ComputedRef<unknown>;
|
|
18
|
+
isRunning: ComputedRef<boolean>;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
status: ComputedRef<UseActionStatus>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generic async action state machine.
|
|
24
|
+
*
|
|
25
|
+
* Accepts any async function that receives a fresh `AbortSignal` per call and
|
|
26
|
+
* tracks `{ data, dispatch, error, isRunning, reset, status }` through Vue
|
|
27
|
+
* reactive state.
|
|
28
|
+
*
|
|
29
|
+
* - There is no dependencies array: pass the handler directly or as a ref;
|
|
30
|
+
* `dispatch` always invokes the latest closure, so handlers reading
|
|
31
|
+
* reactive state never see stale values. `dispatch` keeps a stable identity
|
|
32
|
+
* across the component lifetime.
|
|
33
|
+
* - Calling `dispatch` again while a call is in flight aborts the previous
|
|
34
|
+
* call. Superseded calls reject with an abort reason so callers can detect
|
|
35
|
+
* them; they never corrupt state.
|
|
36
|
+
* - Failures surface on `error` while the previous `data` is preserved for
|
|
37
|
+
* stale-while-revalidate rendering.
|
|
38
|
+
*
|
|
39
|
+
* The underlying state machine is `createSolanaActionStore` from
|
|
40
|
+
* `@vue-solana/core/action`, shared with non-Vue consumers.
|
|
41
|
+
*/
|
|
42
|
+
declare function useAction<TArgs extends readonly unknown[], TResult>(action: ((signal: AbortSignal, ...args: TArgs) => Promise<TResult>) | Ref<(signal: AbortSignal, ...args: TArgs) => Promise<TResult>>, options?: UseActionOptions): UseActionReturn<TArgs, TResult>;
|
|
43
|
+
|
|
44
|
+
export { useAction };
|
|
45
|
+
export type { UseActionOptions, UseActionReturn, UseActionStatus };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
type UseActionStatus = "idle" | "running" | "success" | "error";
|
|
4
|
+
interface UseActionOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Called after a dispatch settles successfully.
|
|
7
|
+
*/
|
|
8
|
+
onSuccess?: (data: unknown) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Called after a dispatch fails for a reason other than supersession.
|
|
11
|
+
*/
|
|
12
|
+
onError?: (error: unknown) => void;
|
|
13
|
+
}
|
|
14
|
+
interface UseActionReturn<TArgs extends readonly unknown[], TResult> {
|
|
15
|
+
data: ComputedRef<TResult | undefined>;
|
|
16
|
+
dispatch: (...args: TArgs) => Promise<TResult>;
|
|
17
|
+
error: ComputedRef<unknown>;
|
|
18
|
+
isRunning: ComputedRef<boolean>;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
status: ComputedRef<UseActionStatus>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generic async action state machine.
|
|
24
|
+
*
|
|
25
|
+
* Accepts any async function that receives a fresh `AbortSignal` per call and
|
|
26
|
+
* tracks `{ data, dispatch, error, isRunning, reset, status }` through Vue
|
|
27
|
+
* reactive state.
|
|
28
|
+
*
|
|
29
|
+
* - There is no dependencies array: pass the handler directly or as a ref;
|
|
30
|
+
* `dispatch` always invokes the latest closure, so handlers reading
|
|
31
|
+
* reactive state never see stale values. `dispatch` keeps a stable identity
|
|
32
|
+
* across the component lifetime.
|
|
33
|
+
* - Calling `dispatch` again while a call is in flight aborts the previous
|
|
34
|
+
* call. Superseded calls reject with an abort reason so callers can detect
|
|
35
|
+
* them; they never corrupt state.
|
|
36
|
+
* - Failures surface on `error` while the previous `data` is preserved for
|
|
37
|
+
* stale-while-revalidate rendering.
|
|
38
|
+
*
|
|
39
|
+
* The underlying state machine is `createSolanaActionStore` from
|
|
40
|
+
* `@vue-solana/core/action`, shared with non-Vue consumers.
|
|
41
|
+
*/
|
|
42
|
+
declare function useAction<TArgs extends readonly unknown[], TResult>(action: ((signal: AbortSignal, ...args: TArgs) => Promise<TResult>) | Ref<(signal: AbortSignal, ...args: TArgs) => Promise<TResult>>, options?: UseActionOptions): UseActionReturn<TArgs, TResult>;
|
|
43
|
+
|
|
44
|
+
export { useAction };
|
|
45
|
+
export type { UseActionOptions, UseActionReturn, UseActionStatus };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
type UseActionStatus = "idle" | "running" | "success" | "error";
|
|
4
|
+
interface UseActionOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Called after a dispatch settles successfully.
|
|
7
|
+
*/
|
|
8
|
+
onSuccess?: (data: unknown) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Called after a dispatch fails for a reason other than supersession.
|
|
11
|
+
*/
|
|
12
|
+
onError?: (error: unknown) => void;
|
|
13
|
+
}
|
|
14
|
+
interface UseActionReturn<TArgs extends readonly unknown[], TResult> {
|
|
15
|
+
data: ComputedRef<TResult | undefined>;
|
|
16
|
+
dispatch: (...args: TArgs) => Promise<TResult>;
|
|
17
|
+
error: ComputedRef<unknown>;
|
|
18
|
+
isRunning: ComputedRef<boolean>;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
status: ComputedRef<UseActionStatus>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generic async action state machine.
|
|
24
|
+
*
|
|
25
|
+
* Accepts any async function that receives a fresh `AbortSignal` per call and
|
|
26
|
+
* tracks `{ data, dispatch, error, isRunning, reset, status }` through Vue
|
|
27
|
+
* reactive state.
|
|
28
|
+
*
|
|
29
|
+
* - There is no dependencies array: pass the handler directly or as a ref;
|
|
30
|
+
* `dispatch` always invokes the latest closure, so handlers reading
|
|
31
|
+
* reactive state never see stale values. `dispatch` keeps a stable identity
|
|
32
|
+
* across the component lifetime.
|
|
33
|
+
* - Calling `dispatch` again while a call is in flight aborts the previous
|
|
34
|
+
* call. Superseded calls reject with an abort reason so callers can detect
|
|
35
|
+
* them; they never corrupt state.
|
|
36
|
+
* - Failures surface on `error` while the previous `data` is preserved for
|
|
37
|
+
* stale-while-revalidate rendering.
|
|
38
|
+
*
|
|
39
|
+
* The underlying state machine is `createSolanaActionStore` from
|
|
40
|
+
* `@vue-solana/core/action`, shared with non-Vue consumers.
|
|
41
|
+
*/
|
|
42
|
+
declare function useAction<TArgs extends readonly unknown[], TResult>(action: ((signal: AbortSignal, ...args: TArgs) => Promise<TResult>) | Ref<(signal: AbortSignal, ...args: TArgs) => Promise<TResult>>, options?: UseActionOptions): UseActionReturn<TArgs, TResult>;
|
|
43
|
+
|
|
44
|
+
export { useAction };
|
|
45
|
+
export type { UseActionOptions, UseActionReturn, UseActionStatus };
|
package/dist/useBalance.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useBalance = require('./shared/vue.
|
|
3
|
+
const useBalance = require('./shared/vue.E_npPFoV.cjs');
|
|
4
4
|
require('@vue-solana/core/address');
|
|
5
5
|
require('@vue-solana/core/errors');
|
|
6
6
|
require('vue');
|
|
7
|
-
require('./shared/vue.
|
|
8
|
-
require('./shared/vue.
|
|
9
|
-
require('./shared/vue.
|
|
7
|
+
require('./shared/vue.BVaMoz9y.cjs');
|
|
8
|
+
require('./shared/vue.BIxphCAq.cjs');
|
|
9
|
+
require('./shared/vue.DE3emjSF.cjs');
|
|
10
|
+
require('./shared/vue.DEHxNvUX.cjs');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
package/dist/useBalance.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { Commitment } from '@vue-solana/core/kit';
|
|
4
4
|
import { SolanaError } from '@vue-solana/core/errors';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type BalanceInput = string | null | undefined;
|
|
7
|
+
declare function useBalance(address: MaybeRefOrGetter<BalanceInput>, commitment?: Commitment): {
|
|
7
8
|
balance: vue.ShallowRef<number | null, number | null>;
|
|
8
9
|
loading: vue.ShallowRef<boolean, boolean>;
|
|
9
10
|
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
@@ -11,3 +12,4 @@ declare function useBalance(address: MaybeRefOrGetter<PublicKey | string | null
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export { useBalance };
|
|
15
|
+
export type { BalanceInput };
|
package/dist/useBalance.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { Commitment } from '@vue-solana/core/kit';
|
|
4
4
|
import { SolanaError } from '@vue-solana/core/errors';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type BalanceInput = string | null | undefined;
|
|
7
|
+
declare function useBalance(address: MaybeRefOrGetter<BalanceInput>, commitment?: Commitment): {
|
|
7
8
|
balance: vue.ShallowRef<number | null, number | null>;
|
|
8
9
|
loading: vue.ShallowRef<boolean, boolean>;
|
|
9
10
|
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
@@ -11,3 +12,4 @@ declare function useBalance(address: MaybeRefOrGetter<PublicKey | string | null
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export { useBalance };
|
|
15
|
+
export type { BalanceInput };
|
package/dist/useBalance.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { Commitment } from '@vue-solana/core/kit';
|
|
4
4
|
import { SolanaError } from '@vue-solana/core/errors';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type BalanceInput = string | null | undefined;
|
|
7
|
+
declare function useBalance(address: MaybeRefOrGetter<BalanceInput>, commitment?: Commitment): {
|
|
7
8
|
balance: vue.ShallowRef<number | null, number | null>;
|
|
8
9
|
loading: vue.ShallowRef<boolean, boolean>;
|
|
9
10
|
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
@@ -11,3 +12,4 @@ declare function useBalance(address: MaybeRefOrGetter<PublicKey | string | null
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export { useBalance };
|
|
15
|
+
export type { BalanceInput };
|
package/dist/useBalance.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { u as useBalance } from './shared/vue.
|
|
1
|
+
export { u as useBalance } from './shared/vue.BINkrA8h.mjs';
|
|
2
2
|
import '@vue-solana/core/address';
|
|
3
3
|
import '@vue-solana/core/errors';
|
|
4
4
|
import 'vue';
|
|
5
|
-
import './shared/vue.
|
|
6
|
-
import './shared/vue.
|
|
7
|
-
import './shared/vue.
|
|
5
|
+
import './shared/vue.CpkwC8Th.mjs';
|
|
6
|
+
import './shared/vue.Mxc8w6Qk.mjs';
|
|
7
|
+
import './shared/vue.CQh3AUE8.mjs';
|
|
8
|
+
import './shared/vue.D_P5SqqD.mjs';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const useClientCapability = require('./shared/vue.BY0qpgYr.cjs');
|
|
4
|
+
require('./shared/vue.BIxphCAq.cjs');
|
|
5
|
+
require('./shared/vue.DE3emjSF.cjs');
|
|
6
|
+
require('vue');
|
|
7
|
+
require('./shared/vue.DEHxNvUX.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.MissingClientCapabilityError = useClientCapability.MissingClientCapabilityError;
|
|
12
|
+
exports.useClientCapability = useClientCapability.useClientCapability;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by {@link useClientCapability} when the installed Solana client does
|
|
3
|
+
* not expose a requested capability.
|
|
4
|
+
*/
|
|
5
|
+
declare class MissingClientCapabilityError extends Error {
|
|
6
|
+
/** Name of the hook that requested the capability, e.g. `usePayer`. */
|
|
7
|
+
readonly hookName: string;
|
|
8
|
+
/** Human guidance for installing the capability on the client. */
|
|
9
|
+
readonly providerHint: string;
|
|
10
|
+
/** The missing capability name(s). */
|
|
11
|
+
readonly capabilities: readonly string[];
|
|
12
|
+
constructor(hookName: string, capabilities: readonly string[], providerHint: string);
|
|
13
|
+
}
|
|
14
|
+
interface UseClientCapabilityOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Name of the calling hook for error messages (defaults to
|
|
17
|
+
* `useClientCapability`).
|
|
18
|
+
*/
|
|
19
|
+
hookName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Guidance appended to the error when a capability is missing, e.g. which
|
|
22
|
+
* `@solana/kit` plugin to `.use()`.
|
|
23
|
+
*/
|
|
24
|
+
providerHint?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Runtime assertion that a capability is installed on the (loosely-typed)
|
|
28
|
+
* Solana client. Throws a {@link MissingClientCapabilityError} — naming the
|
|
29
|
+
* calling hook and how to install the capability — if any requested
|
|
30
|
+
* capability is missing. Accepts one capability name or an array.
|
|
31
|
+
*
|
|
32
|
+
* The assertion runs synchronously during setup (the first step of mount),
|
|
33
|
+
* so a misconfigured client fails fast with a clear error instead of a
|
|
34
|
+
* cryptic `undefined is not a function` later on.
|
|
35
|
+
*/
|
|
36
|
+
declare function useClientCapability(capability: string | readonly string[], options?: UseClientCapabilityOptions): void;
|
|
37
|
+
|
|
38
|
+
export { MissingClientCapabilityError, useClientCapability };
|
|
39
|
+
export type { UseClientCapabilityOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by {@link useClientCapability} when the installed Solana client does
|
|
3
|
+
* not expose a requested capability.
|
|
4
|
+
*/
|
|
5
|
+
declare class MissingClientCapabilityError extends Error {
|
|
6
|
+
/** Name of the hook that requested the capability, e.g. `usePayer`. */
|
|
7
|
+
readonly hookName: string;
|
|
8
|
+
/** Human guidance for installing the capability on the client. */
|
|
9
|
+
readonly providerHint: string;
|
|
10
|
+
/** The missing capability name(s). */
|
|
11
|
+
readonly capabilities: readonly string[];
|
|
12
|
+
constructor(hookName: string, capabilities: readonly string[], providerHint: string);
|
|
13
|
+
}
|
|
14
|
+
interface UseClientCapabilityOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Name of the calling hook for error messages (defaults to
|
|
17
|
+
* `useClientCapability`).
|
|
18
|
+
*/
|
|
19
|
+
hookName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Guidance appended to the error when a capability is missing, e.g. which
|
|
22
|
+
* `@solana/kit` plugin to `.use()`.
|
|
23
|
+
*/
|
|
24
|
+
providerHint?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Runtime assertion that a capability is installed on the (loosely-typed)
|
|
28
|
+
* Solana client. Throws a {@link MissingClientCapabilityError} — naming the
|
|
29
|
+
* calling hook and how to install the capability — if any requested
|
|
30
|
+
* capability is missing. Accepts one capability name or an array.
|
|
31
|
+
*
|
|
32
|
+
* The assertion runs synchronously during setup (the first step of mount),
|
|
33
|
+
* so a misconfigured client fails fast with a clear error instead of a
|
|
34
|
+
* cryptic `undefined is not a function` later on.
|
|
35
|
+
*/
|
|
36
|
+
declare function useClientCapability(capability: string | readonly string[], options?: UseClientCapabilityOptions): void;
|
|
37
|
+
|
|
38
|
+
export { MissingClientCapabilityError, useClientCapability };
|
|
39
|
+
export type { UseClientCapabilityOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by {@link useClientCapability} when the installed Solana client does
|
|
3
|
+
* not expose a requested capability.
|
|
4
|
+
*/
|
|
5
|
+
declare class MissingClientCapabilityError extends Error {
|
|
6
|
+
/** Name of the hook that requested the capability, e.g. `usePayer`. */
|
|
7
|
+
readonly hookName: string;
|
|
8
|
+
/** Human guidance for installing the capability on the client. */
|
|
9
|
+
readonly providerHint: string;
|
|
10
|
+
/** The missing capability name(s). */
|
|
11
|
+
readonly capabilities: readonly string[];
|
|
12
|
+
constructor(hookName: string, capabilities: readonly string[], providerHint: string);
|
|
13
|
+
}
|
|
14
|
+
interface UseClientCapabilityOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Name of the calling hook for error messages (defaults to
|
|
17
|
+
* `useClientCapability`).
|
|
18
|
+
*/
|
|
19
|
+
hookName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Guidance appended to the error when a capability is missing, e.g. which
|
|
22
|
+
* `@solana/kit` plugin to `.use()`.
|
|
23
|
+
*/
|
|
24
|
+
providerHint?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Runtime assertion that a capability is installed on the (loosely-typed)
|
|
28
|
+
* Solana client. Throws a {@link MissingClientCapabilityError} — naming the
|
|
29
|
+
* calling hook and how to install the capability — if any requested
|
|
30
|
+
* capability is missing. Accepts one capability name or an array.
|
|
31
|
+
*
|
|
32
|
+
* The assertion runs synchronously during setup (the first step of mount),
|
|
33
|
+
* so a misconfigured client fails fast with a clear error instead of a
|
|
34
|
+
* cryptic `undefined is not a function` later on.
|
|
35
|
+
*/
|
|
36
|
+
declare function useClientCapability(capability: string | readonly string[], options?: UseClientCapabilityOptions): void;
|
|
37
|
+
|
|
38
|
+
export { MissingClientCapabilityError, useClientCapability };
|
|
39
|
+
export type { UseClientCapabilityOptions };
|