@vue-solana/vue 3.0.1 → 4.0.0-rc.1
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 +10 -4
- package/dist/index.d.ts +12 -0
- package/dist/index.mjs +176 -86
- package/dist/shared/{vue.hG_FieA3.mjs → vue.BHBifdbc.mjs} +2 -2
- package/dist/shared/{vue.CjSw0Hh1.mjs → vue.BTD4usyi.mjs} +4 -4
- package/dist/shared/{vue.CsFY1mfz.mjs → vue.BXNjyJ2c.mjs} +1 -1
- package/dist/shared/{vue.D218Ow7t.mjs → vue.Bc_Kbwr5.mjs} +11 -10
- package/dist/shared/{vue.DlihC5GG.mjs → vue.BiKE9Xuv.mjs} +6 -4
- package/dist/shared/{vue.CXB4NEMA.mjs → vue.Bu2cQ690.mjs} +47 -17
- package/dist/shared/{vue.C1JbUTpJ.mjs → vue.C-7v1l8q.mjs} +2 -2
- package/dist/shared/{vue.CpkwC8Th.mjs → vue.C6OkOK2W.mjs} +1 -1
- package/dist/shared/{vue.B9uRpSDJ.mjs → vue.CAltY57B.mjs} +6 -3
- package/dist/shared/{vue.DDQxNX5q.mjs → vue.CELGI7de.mjs} +9 -9
- package/dist/shared/{vue.BxtOHzY_.mjs → vue.CLAqNcLp.mjs} +1 -1
- package/dist/shared/{vue.Mxc8w6Qk.mjs → vue.CZApWQAY.mjs} +1 -1
- package/dist/shared/vue.CbmzveKF.mjs +44 -0
- package/dist/shared/{vue.CQh3AUE8.mjs → vue.CcOZ9858.mjs} +3 -5
- package/dist/shared/{vue.B-xtuLtD.mjs → vue.D2J7_NpQ.mjs} +2 -2
- package/dist/shared/{vue.BsGwt78R.mjs → vue.D8zNWw2t.mjs} +1 -1
- package/dist/shared/{vue.CaAgH2Xt.mjs → vue.DPwdqRO_.mjs} +3 -3
- package/dist/shared/{vue.DNKD6jqM.mjs → vue.DTpvqDyY.mjs} +3 -3
- package/dist/shared/vue.DZVdVfy1.mjs +7 -0
- package/dist/shared/{vue.CvenSbZZ.mjs → vue.DZhPXLZz.mjs} +4 -4
- package/dist/shared/{vue.BFSboXMB.mjs → vue.DbJKnSrl.mjs} +3 -3
- package/dist/shared/{vue.1Qwco2kv.mjs → vue.DcZ_R_RH.mjs} +4 -4
- package/dist/shared/{vue.o98pAmDg.mjs → vue.Ddf_Cdjx.mjs} +2 -2
- package/dist/shared/{vue.C_4qJDiF.mjs → vue.DyLgoSbX.mjs} +1 -1
- package/dist/shared/{vue.XlfH_nkc.mjs → vue.FehFeE3w.mjs} +3 -3
- package/dist/shared/{vue.C9OOmvkD.mjs → vue.SeuJipQ8.mjs} +2 -2
- package/dist/swr.d.ts +7 -1
- package/dist/swr.mjs +16 -1
- package/dist/useAccountInfo.mjs +1 -1
- package/dist/useAirdrop.mjs +1 -1
- package/dist/useBalance.mjs +1 -1
- package/dist/useClientCapability.d.ts +6 -1
- package/dist/useClientCapability.mjs +1 -1
- package/dist/useConnection.d.ts +14 -7
- package/dist/useConnection.mjs +1 -1
- package/dist/useIdentity.mjs +1 -1
- package/dist/usePayer.mjs +1 -1
- package/dist/usePlanTransaction.mjs +1 -1
- package/dist/usePlanTransactions.mjs +1 -1
- package/dist/useProgramAccounts.mjs +1 -1
- package/dist/useRpc.d.ts +12 -6
- package/dist/useRpc.mjs +1 -1
- package/dist/useSelectedWalletAccount.d.ts +3 -0
- package/dist/useSendTransaction.mjs +1 -1
- package/dist/useSendTransactions.mjs +1 -1
- package/dist/useSignAndSendTransaction.mjs +1 -1
- package/dist/useSignAndSendTransactions.mjs +1 -1
- package/dist/useSignIn.mjs +1 -1
- package/dist/useSignMessage.mjs +1 -1
- package/dist/useSignTransactions.mjs +1 -1
- package/dist/useSignatureStatus.d.ts +0 -1
- package/dist/useSignatureStatus.mjs +1 -1
- package/dist/useSolana.mjs +1 -1
- package/dist/useSolanaClient.d.ts +12 -6
- package/dist/useSolanaClient.mjs +1 -1
- package/dist/useTokenAccounts.mjs +1 -1
- package/dist/useTokenBalance.mjs +1 -1
- package/dist/useTransactionConfirmation.mjs +1 -1
- package/dist/useWallet.mjs +1 -1
- package/dist/useWallets.mjs +1 -1
- package/package.json +8 -5
- package/dist/buffer-polyfill.d.mts +0 -2
- package/dist/index.d.mts +0 -64
- package/dist/kit.d.mts +0 -1
- package/dist/shared/vue.BGGixph-.d.mts +0 -5
- package/dist/shared/vue.Bfu1dCKe.mjs +0 -10
- package/dist/shared/vue.CGv0ip3w.mjs +0 -52
- package/dist/shared/vue.DL3z5PxP.d.mts +0 -21
- package/dist/swr.d.mts +0 -41
- package/dist/useAccountInfo.d.mts +0 -24
- package/dist/useAction.d.mts +0 -45
- package/dist/useAirdrop.d.mts +0 -27
- package/dist/useBalance.d.mts +0 -15
- package/dist/useClientCapability.d.mts +0 -39
- package/dist/useConnection.d.mts +0 -46
- package/dist/useIdentity.d.mts +0 -3
- package/dist/usePayer.d.mts +0 -18
- package/dist/usePlanTransaction.d.mts +0 -44
- package/dist/usePlanTransactions.d.mts +0 -5
- package/dist/useProgramAccounts.d.mts +0 -45
- package/dist/useRequest.d.mts +0 -73
- package/dist/useRpc.d.mts +0 -55
- package/dist/useSelectedWalletAccount.d.mts +0 -117
- package/dist/useSendTransaction.d.mts +0 -50
- package/dist/useSendTransactions.d.mts +0 -5
- package/dist/useSignAndSendTransaction.d.mts +0 -40
- package/dist/useSignAndSendTransactions.d.mts +0 -35
- package/dist/useSignIn.d.mts +0 -23
- package/dist/useSignMessage.d.mts +0 -236
- package/dist/useSignTransactions.d.mts +0 -24
- package/dist/useSignatureStatus.d.mts +0 -26
- package/dist/useSolana.d.mts +0 -9
- package/dist/useSolanaClient.d.mts +0 -45
- package/dist/useSubscription.d.mts +0 -70
- package/dist/useTokenAccounts.d.mts +0 -19
- package/dist/useTokenBalance.d.mts +0 -17
- package/dist/useTrackedData.d.mts +0 -98
- package/dist/useTransaction.d.mts +0 -27
- package/dist/useTransactionConfirmation.d.mts +0 -38
- package/dist/useWallet.d.mts +0 -31
- package/dist/useWallets.d.mts +0 -11
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { shallowRef, onMounted,
|
|
4
|
-
import { u as
|
|
5
|
-
import { t as tryUseSolana } from './vue.
|
|
1
|
+
import { getBase58Encoder } from '@vue-solana/core/kit';
|
|
2
|
+
import { createSolanaError, normalizeSolanaError } from '@vue-solana/core/errors';
|
|
3
|
+
import { shallowRef, onMounted, onScopeDispose, watch, toValue } from 'vue';
|
|
4
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
5
|
+
import { t as tryUseSolana } from './vue.CcOZ9858.mjs';
|
|
6
6
|
|
|
7
7
|
function useSignatureStatus(signature, options = {}) {
|
|
8
8
|
const solana = tryUseSolana();
|
|
9
|
-
const client = solana?.client ??
|
|
9
|
+
const client = solana?.client ?? useSolanaClient().client;
|
|
10
10
|
const status = shallowRef(null);
|
|
11
11
|
const loading = shallowRef(false);
|
|
12
12
|
const error = shallowRef(null);
|
|
13
13
|
let refreshId = 0;
|
|
14
|
-
let
|
|
14
|
+
let pollTimer = null;
|
|
15
15
|
let manuallyStoppedPolling = false;
|
|
16
|
+
let refreshInFlight = null;
|
|
16
17
|
async function refresh() {
|
|
18
|
+
const value = toValue(signature);
|
|
19
|
+
const inFlight = refreshInFlight;
|
|
20
|
+
if (inFlight && inFlight.value === value) {
|
|
21
|
+
return inFlight.promise;
|
|
22
|
+
}
|
|
23
|
+
const promise = runRefresh();
|
|
24
|
+
refreshInFlight = { value, promise };
|
|
25
|
+
try {
|
|
26
|
+
return await promise;
|
|
27
|
+
} finally {
|
|
28
|
+
if (refreshInFlight?.promise === promise) {
|
|
29
|
+
refreshInFlight = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function runRefresh() {
|
|
17
34
|
const requestId = ++refreshId;
|
|
18
35
|
const value = toValue(signature);
|
|
19
36
|
if (!value || !solana) {
|
|
@@ -53,16 +70,22 @@ function useSignatureStatus(signature, options = {}) {
|
|
|
53
70
|
stopCurrentPolling();
|
|
54
71
|
}
|
|
55
72
|
function stopCurrentPolling() {
|
|
56
|
-
if (
|
|
73
|
+
if (pollTimer === null) {
|
|
57
74
|
return;
|
|
58
75
|
}
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
clearTimeout(pollTimer);
|
|
77
|
+
pollTimer = null;
|
|
61
78
|
}
|
|
62
|
-
function
|
|
79
|
+
function schedulePoll() {
|
|
63
80
|
stopCurrentPolling();
|
|
81
|
+
if (!options.pollIntervalMs || !solana) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (manuallyStoppedPolling) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
64
87
|
const value = toValue(signature);
|
|
65
|
-
if (
|
|
88
|
+
if (!value) {
|
|
66
89
|
return;
|
|
67
90
|
}
|
|
68
91
|
if (options.pollIntervalMs <= 0) {
|
|
@@ -75,15 +98,22 @@ function useSignatureStatus(signature, options = {}) {
|
|
|
75
98
|
error.value = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
76
99
|
return;
|
|
77
100
|
}
|
|
78
|
-
|
|
79
|
-
|
|
101
|
+
pollTimer = setTimeout(() => {
|
|
102
|
+
pollTimer = null;
|
|
103
|
+
void refresh().catch(() => void 0).finally(() => {
|
|
104
|
+
schedulePoll();
|
|
105
|
+
});
|
|
80
106
|
}, options.pollIntervalMs);
|
|
81
107
|
}
|
|
108
|
+
function startPolling() {
|
|
109
|
+
manuallyStoppedPolling = false;
|
|
110
|
+
schedulePoll();
|
|
111
|
+
}
|
|
82
112
|
onMounted(() => {
|
|
83
113
|
void refresh().catch(() => void 0);
|
|
84
|
-
|
|
114
|
+
schedulePoll();
|
|
85
115
|
});
|
|
86
|
-
|
|
116
|
+
onScopeDispose(() => {
|
|
87
117
|
refreshId += 1;
|
|
88
118
|
stopPolling();
|
|
89
119
|
});
|
|
@@ -105,7 +135,7 @@ function useSignatureStatus(signature, options = {}) {
|
|
|
105
135
|
function parseTransactionSignature(signature) {
|
|
106
136
|
let decodedSignature;
|
|
107
137
|
try {
|
|
108
|
-
decodedSignature =
|
|
138
|
+
decodedSignature = getBase58Encoder().encode(signature);
|
|
109
139
|
} catch (cause) {
|
|
110
140
|
throw new TypeError("Invalid Solana transaction signature", { cause });
|
|
111
141
|
}
|
|
@@ -2,8 +2,8 @@ import { SolanaError, normalizeSolanaError } from '@vue-solana/core/errors';
|
|
|
2
2
|
import { withSolanaTimeout } from '@vue-solana/core/timeout';
|
|
3
3
|
import { createNoWalletSelectedError, assertWalletCanSignAndSendTransactions } from '@vue-solana/core/wallet';
|
|
4
4
|
import { shallowRef } from 'vue';
|
|
5
|
-
import { u as useExecution } from './vue.
|
|
6
|
-
import { u as useWallet } from './vue.
|
|
5
|
+
import { u as useExecution } from './vue.BiKE9Xuv.mjs';
|
|
6
|
+
import { u as useWallet } from './vue.Bc_Kbwr5.mjs';
|
|
7
7
|
|
|
8
8
|
const SIGN_AND_SEND_TIMEOUT_MS = 12e4;
|
|
9
9
|
class PartialSignAndSendError extends SolanaError {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
2
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
2
3
|
|
|
3
|
-
class MissingClientCapabilityError extends
|
|
4
|
+
class MissingClientCapabilityError extends SolanaError {
|
|
4
5
|
/** Name of the hook that requested the capability, e.g. `usePayer`. */
|
|
5
6
|
hookName;
|
|
6
7
|
/** Human guidance for installing the capability on the client. */
|
|
@@ -9,7 +10,9 @@ class MissingClientCapabilityError extends Error {
|
|
|
9
10
|
capabilities;
|
|
10
11
|
constructor(hookName, capabilities, providerHint) {
|
|
11
12
|
super(
|
|
12
|
-
|
|
13
|
+
"MISSING_CLIENT_CAPABILITY",
|
|
14
|
+
`${hookName} requires the ${capabilities.map((capability) => `\`${capability}\``).join(" and ")} capabilit${capabilities.length === 1 ? "y" : "ies"} on the Solana client, but none ${capabilities.length === 1 ? "was" : "were"} found. ` + providerHint,
|
|
15
|
+
{}
|
|
13
16
|
);
|
|
14
17
|
this.name = "MissingClientCapabilityError";
|
|
15
18
|
this.hookName = hookName;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { createSolanaError } from '@vue-solana/core/errors';
|
|
1
2
|
import { u as useAction } from './vue.DYk0Xfr3.mjs';
|
|
2
|
-
import { u as useClientCapability } from './vue.
|
|
3
|
-
import { u as useSolanaClient } from './vue.
|
|
3
|
+
import { u as useClientCapability, M as MissingClientCapabilityError } from './vue.CAltY57B.mjs';
|
|
4
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
4
5
|
|
|
5
6
|
function toReadableAirdropError(error) {
|
|
6
7
|
if (error instanceof Error) {
|
|
@@ -9,23 +10,22 @@ function toReadableAirdropError(error) {
|
|
|
9
10
|
if (!isThrottled) {
|
|
10
11
|
throw error;
|
|
11
12
|
}
|
|
12
|
-
throw
|
|
13
|
+
throw createSolanaError(
|
|
14
|
+
"RPC_FAILURE",
|
|
13
15
|
`${error.message} This likely means the network's airdrop faucet is rate-limited or out of test SOL. Retry later, use https://faucet.solana.com, or point the client at a local validator.`,
|
|
14
16
|
{ cause: error }
|
|
15
17
|
);
|
|
16
18
|
}
|
|
17
|
-
throw
|
|
19
|
+
throw createSolanaError("RPC_FAILURE", `Airdrop failed: ${String(error)}`, { cause: error });
|
|
18
20
|
}
|
|
19
21
|
function useAirdrop() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
providerHint: "Install it by adding the airdrop capability with `createClient().use(solanaRpc({ ... })).use(rpcAirdrop())` from `@solana/kit-plugin-rpc`, on a client that has a `payer` signer to sign the request."
|
|
23
|
-
});
|
|
22
|
+
const providerHint = "Install it by adding the airdrop capability with `createClient().use(solanaRpc({ ... })).use(rpcAirdrop())` from `@solana/kit-plugin-rpc`, on a client that has a `payer` signer to sign the request.";
|
|
23
|
+
useClientCapability("airdrop", { hookName: "useAirdrop", providerHint });
|
|
24
24
|
const { client } = useSolanaClient();
|
|
25
25
|
return useAction((abortSignal, address, amount) => {
|
|
26
26
|
const airdrop = client.airdrop;
|
|
27
27
|
if (!airdrop) {
|
|
28
|
-
throw new
|
|
28
|
+
throw new MissingClientCapabilityError("useAirdrop", ["airdrop"], providerHint);
|
|
29
29
|
}
|
|
30
30
|
return airdrop(address, amount, abortSignal).catch(toReadableAirdropError);
|
|
31
31
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as useClientAction } from './vue.
|
|
1
|
+
import { u as useClientAction } from './vue.CbmzveKF.mjs';
|
|
2
2
|
|
|
3
3
|
const SENDING_PROVIDER_HINT = "Use a client created by `createSolanaClient({ payer })` \u2014 or any client with a `payer` signer. Kit reads `client.payer` when it plans a transaction from an instruction plan.";
|
|
4
4
|
const SEND_STATUSES = {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { shallowRef, onScopeDispose } from 'vue';
|
|
2
|
+
import { u as useExecution } from './vue.BiKE9Xuv.mjs';
|
|
3
|
+
import { u as useClientCapability, M as MissingClientCapabilityError } from './vue.CAltY57B.mjs';
|
|
4
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
5
|
+
|
|
6
|
+
function useClientAction(config) {
|
|
7
|
+
const { capability, hookName, providerHint, statuses } = config;
|
|
8
|
+
useClientCapability([capability, "payer"], { hookName, providerHint });
|
|
9
|
+
const { client } = useSolanaClient();
|
|
10
|
+
const data = shallowRef(null);
|
|
11
|
+
let abortController;
|
|
12
|
+
onScopeDispose(() => abortController?.abort());
|
|
13
|
+
const execution = useExecution(statuses.working, {
|
|
14
|
+
error: statuses.error,
|
|
15
|
+
idle: statuses.idle
|
|
16
|
+
});
|
|
17
|
+
async function execute(input, options = {}) {
|
|
18
|
+
const method = client?.[capability];
|
|
19
|
+
if (typeof method !== "function") {
|
|
20
|
+
throw new MissingClientCapabilityError(hookName, [capability], providerHint);
|
|
21
|
+
}
|
|
22
|
+
abortController?.abort();
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
abortController = controller;
|
|
25
|
+
data.value = null;
|
|
26
|
+
const abortSignal = options.abortSignal ? AbortSignal.any([controller.signal, options.abortSignal]) : controller.signal;
|
|
27
|
+
return execution.execute(
|
|
28
|
+
() => method(input, { abortSignal }),
|
|
29
|
+
(result) => {
|
|
30
|
+
data.value = result;
|
|
31
|
+
return statuses.success;
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
data,
|
|
37
|
+
status: execution.status,
|
|
38
|
+
loading: execution.loading,
|
|
39
|
+
error: execution.error,
|
|
40
|
+
execute
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { useClientAction as u };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { inject, shallowRef, ref } from 'vue';
|
|
2
2
|
import { s as solanaInjectionKey } from './vue.D_P5SqqD.mjs';
|
|
3
3
|
|
|
4
|
-
let ssrContext;
|
|
5
4
|
function tryUseSolana() {
|
|
6
5
|
return inject(solanaInjectionKey, null);
|
|
7
6
|
}
|
|
8
7
|
function useSolana() {
|
|
9
|
-
return tryUseSolana() ??
|
|
8
|
+
return tryUseSolana() ?? createSsrContext();
|
|
10
9
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
10
|
+
function createSsrContext() {
|
|
11
|
+
return {
|
|
13
12
|
cluster: "devnet",
|
|
14
13
|
endpoint: "",
|
|
15
14
|
wsEndpoint: "",
|
|
@@ -29,7 +28,6 @@ function getSsrContext() {
|
|
|
29
28
|
selectWallet() {
|
|
30
29
|
}
|
|
31
30
|
};
|
|
32
|
-
return ssrContext;
|
|
33
31
|
}
|
|
34
32
|
function createUnavailableProxy() {
|
|
35
33
|
return new Proxy(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallowRef, onScopeDispose } from 'vue';
|
|
2
|
-
import { u as useClientCapability } from './vue.
|
|
3
|
-
import { u as useSolanaClient } from './vue.
|
|
2
|
+
import { u as useClientCapability } from './vue.CAltY57B.mjs';
|
|
3
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
4
4
|
|
|
5
5
|
function useIdentity() {
|
|
6
6
|
useClientCapability(["identity"], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { confirmTransactionSignature } from '@vue-solana/core/transaction';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
|
-
import { u as useExecution } from './vue.
|
|
4
|
-
import { u as
|
|
3
|
+
import { u as useExecution } from './vue.BiKE9Xuv.mjs';
|
|
4
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
5
5
|
|
|
6
6
|
function getConfirmedTransactionStatus(confirmation) {
|
|
7
7
|
if (confirmation.commitment === "finalized") {
|
|
@@ -10,7 +10,7 @@ function getConfirmedTransactionStatus(confirmation) {
|
|
|
10
10
|
return confirmation.commitment === "processed" ? "processed" : "confirmed";
|
|
11
11
|
}
|
|
12
12
|
function useTransactionConfirmation(defaultOptions = {}) {
|
|
13
|
-
const client =
|
|
13
|
+
const client = useSolanaClient().client;
|
|
14
14
|
const signature = ref(null);
|
|
15
15
|
const confirmation = ref(null);
|
|
16
16
|
const {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getTokenAccountsByOwner } from '@vue-solana/core/token-accounts';
|
|
2
|
-
import { u as
|
|
2
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
3
3
|
import { u as useAddressRead } from './vue.BwBqla_n.mjs';
|
|
4
|
-
import { t as tryUseSolana } from './vue.
|
|
4
|
+
import { t as tryUseSolana } from './vue.CcOZ9858.mjs';
|
|
5
5
|
|
|
6
6
|
function useTokenAccounts(owner, options) {
|
|
7
7
|
const empty = [];
|
|
8
8
|
const solana = tryUseSolana();
|
|
9
|
-
const client = solana?.client ??
|
|
9
|
+
const client = solana?.client ?? useSolanaClient().client;
|
|
10
10
|
const { data: tokenAccounts, ...rest } = useAddressRead(
|
|
11
11
|
[owner],
|
|
12
12
|
(key) => getTokenAccountsByOwner(client, key, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { u as
|
|
1
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
2
2
|
import { u as useAddressRead } from './vue.BwBqla_n.mjs';
|
|
3
|
-
import { t as tryUseSolana } from './vue.
|
|
4
|
-
import { d as decodeBase64 } from './vue.
|
|
3
|
+
import { t as tryUseSolana } from './vue.CcOZ9858.mjs';
|
|
4
|
+
import { d as decodeBase64 } from './vue.DZVdVfy1.mjs';
|
|
5
5
|
|
|
6
6
|
function useAccountInfo(address, options = {}) {
|
|
7
7
|
const solana = tryUseSolana();
|
|
8
|
-
const client = solana?.client ??
|
|
8
|
+
const client = solana?.client ?? useSolanaClient().client;
|
|
9
9
|
const { data: accountInfo, ...rest } = useAddressRead(
|
|
10
10
|
[address],
|
|
11
11
|
async (key) => (await client.rpc.getAccountInfo(key, { encoding: "base64", commitment: options.commitment }).send()).value,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { u as
|
|
1
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
2
2
|
import { u as useAddressRead } from './vue.BwBqla_n.mjs';
|
|
3
|
-
import { t as tryUseSolana } from './vue.
|
|
3
|
+
import { t as tryUseSolana } from './vue.CcOZ9858.mjs';
|
|
4
4
|
|
|
5
5
|
function useBalance(address, commitment) {
|
|
6
6
|
const solana = tryUseSolana();
|
|
7
|
-
const client = solana?.client ??
|
|
7
|
+
const client = solana?.client ?? useSolanaClient().client;
|
|
8
8
|
const { data: balance, ...rest } = useAddressRead(
|
|
9
9
|
[address],
|
|
10
10
|
async (key) => (await client.rpc.getBalance(key, commitment ? { commitment } : void 0).send()).value,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { u as
|
|
1
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
2
2
|
import { u as useAddressRead } from './vue.BwBqla_n.mjs';
|
|
3
|
-
import { t as tryUseSolana } from './vue.
|
|
4
|
-
import { d as decodeBase64 } from './vue.
|
|
3
|
+
import { t as tryUseSolana } from './vue.CcOZ9858.mjs';
|
|
4
|
+
import { d as decodeBase64 } from './vue.DZVdVfy1.mjs';
|
|
5
5
|
|
|
6
6
|
function useProgramAccounts(programId, options = {}) {
|
|
7
7
|
const empty = [];
|
|
8
8
|
const solana = tryUseSolana();
|
|
9
|
-
const client = solana?.client ??
|
|
9
|
+
const client = solana?.client ?? useSolanaClient().client;
|
|
10
10
|
const { data: accounts, ...rest } = useAddressRead(
|
|
11
11
|
[programId],
|
|
12
12
|
async (key) => (await client.rpc.getProgramAccounts(key, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createNoWalletSelectedError, assertWalletCanSignMessage } from '@vue-solana/core/wallet';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
|
-
import { u as useExecution } from './vue.
|
|
4
|
-
import { u as useWallet } from './vue.
|
|
3
|
+
import { u as useExecution } from './vue.BiKE9Xuv.mjs';
|
|
4
|
+
import { u as useWallet } from './vue.Bc_Kbwr5.mjs';
|
|
5
5
|
|
|
6
6
|
function useSignMessage() {
|
|
7
7
|
const { wallet } = useWallet();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getTokenBalance } from '@vue-solana/core/token-accounts';
|
|
2
2
|
import { computed } from 'vue';
|
|
3
|
-
import { u as
|
|
3
|
+
import { u as useSolanaClient } from './vue.CZApWQAY.mjs';
|
|
4
4
|
import { u as useAddressRead } from './vue.BwBqla_n.mjs';
|
|
5
|
-
import { t as tryUseSolana } from './vue.
|
|
5
|
+
import { t as tryUseSolana } from './vue.CcOZ9858.mjs';
|
|
6
6
|
|
|
7
7
|
function useTokenBalance(mint, owner, commitment) {
|
|
8
8
|
const empty = {
|
|
@@ -10,7 +10,7 @@ function useTokenBalance(mint, owner, commitment) {
|
|
|
10
10
|
decimals: null
|
|
11
11
|
};
|
|
12
12
|
const solana = tryUseSolana();
|
|
13
|
-
const client = solana?.client ??
|
|
13
|
+
const client = solana?.client ?? useSolanaClient().client;
|
|
14
14
|
const read = useAddressRead(
|
|
15
15
|
[mint, owner],
|
|
16
16
|
(mintKey, ownerKey) => getTokenBalance(client, mintKey, ownerKey, commitment),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createNoWalletSelectedError, assertWalletCanSignIn } from '@vue-solana/core/wallet';
|
|
2
2
|
import { shallowRef } from 'vue';
|
|
3
|
-
import { u as useExecution } from './vue.
|
|
4
|
-
import { u as useWallet } from './vue.
|
|
3
|
+
import { u as useExecution } from './vue.BiKE9Xuv.mjs';
|
|
4
|
+
import { u as useWallet } from './vue.Bc_Kbwr5.mjs';
|
|
5
5
|
|
|
6
6
|
function useSignIn() {
|
|
7
7
|
const { wallet } = useWallet();
|
package/dist/swr.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ import '@vue-solana/core/kit';
|
|
|
10
10
|
* and to reset server-side caches per request.
|
|
11
11
|
*/
|
|
12
12
|
declare function clearSwrCache(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Remove a single cached SWR entry by its full cache key (including the
|
|
15
|
+
* adapter prefix, e.g. `request:balance`). Prefer this over
|
|
16
|
+
* {@link clearSwrCache} when only one key's stale value needs to be discarded.
|
|
17
|
+
*/
|
|
18
|
+
declare function deleteSwrKey(key: string): void;
|
|
13
19
|
/**
|
|
14
20
|
* `useRequest` with cache keying. A component mounting with a key that
|
|
15
21
|
* already holds data shows it immediately (stale) while its own request
|
|
@@ -38,4 +44,4 @@ declare function useSubscriptionSwr<TResult>(key: string, source: UseSubscriptio
|
|
|
38
44
|
*/
|
|
39
45
|
declare function useTrackedDataSwr<TInitialValue, TStreamValue, TItem>(key: string, source: UseTrackedDataSource<TInitialValue, TStreamValue, TItem>, options?: UseTrackedDataOptions): UseTrackedDataReturn<TItem>;
|
|
40
46
|
|
|
41
|
-
export { clearSwrCache, useRequestSwr, useSubscriptionSwr, useTrackedDataSwr };
|
|
47
|
+
export { clearSwrCache, deleteSwrKey, useRequestSwr, useSubscriptionSwr, useTrackedDataSwr };
|
package/dist/swr.mjs
CHANGED
|
@@ -6,10 +6,23 @@ import { u as useTrackedData } from './shared/vue.BNJTXSnQ.mjs';
|
|
|
6
6
|
const PREFIX_REQUEST = "request:";
|
|
7
7
|
const PREFIX_SUBSCRIPTION = "subscription:";
|
|
8
8
|
const PREFIX_TRACKED = "tracked:";
|
|
9
|
+
const SWR_CACHE_MAX_ENTRIES = 1024;
|
|
9
10
|
const swrCache = /* @__PURE__ */ new Map();
|
|
10
11
|
function clearSwrCache() {
|
|
11
12
|
swrCache.clear();
|
|
12
13
|
}
|
|
14
|
+
function deleteSwrKey(key) {
|
|
15
|
+
swrCache.delete(key);
|
|
16
|
+
}
|
|
17
|
+
function evictSwrCacheIfNeeded() {
|
|
18
|
+
while (swrCache.size > SWR_CACHE_MAX_ENTRIES) {
|
|
19
|
+
const oldestKey = swrCache.keys().next().value;
|
|
20
|
+
if (oldestKey === void 0) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
swrCache.delete(oldestKey);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
13
26
|
function isPendingStatus(status) {
|
|
14
27
|
return status === "fetching" || status === "loading";
|
|
15
28
|
}
|
|
@@ -19,11 +32,13 @@ function writeSwrResult(key, data, error, status) {
|
|
|
19
32
|
return;
|
|
20
33
|
}
|
|
21
34
|
const previous = swrCache.get(key);
|
|
35
|
+
swrCache.delete(key);
|
|
22
36
|
swrCache.set(key, {
|
|
23
37
|
data: data !== void 0 ? data : previous?.data,
|
|
24
38
|
error,
|
|
25
39
|
status
|
|
26
40
|
});
|
|
41
|
+
evictSwrCacheIfNeeded();
|
|
27
42
|
}
|
|
28
43
|
function swrError(error, status, seed) {
|
|
29
44
|
if (status === "disabled") {
|
|
@@ -71,4 +86,4 @@ function useTrackedDataSwr(key, source, options = {}) {
|
|
|
71
86
|
return { ...swr, refresh: result.refresh, status: result.status };
|
|
72
87
|
}
|
|
73
88
|
|
|
74
|
-
export { clearSwrCache, useRequestSwr, useSubscriptionSwr, useTrackedDataSwr };
|
|
89
|
+
export { clearSwrCache, deleteSwrKey, useRequestSwr, useSubscriptionSwr, useTrackedDataSwr };
|
package/dist/useAccountInfo.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useAccountInfo } from './shared/vue.
|
|
1
|
+
export { u as useAccountInfo } from './shared/vue.DZhPXLZz.mjs';
|
package/dist/useAirdrop.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useAirdrop } from './shared/vue.
|
|
1
|
+
export { u as useAirdrop } from './shared/vue.CELGI7de.mjs';
|
package/dist/useBalance.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useBalance } from './shared/vue.
|
|
1
|
+
export { u as useBalance } from './shared/vue.DbJKnSrl.mjs';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Thrown by {@link useClientCapability} when the installed Solana client does
|
|
3
5
|
* not expose a requested capability.
|
|
6
|
+
*
|
|
7
|
+
* Subclasses core's {@link SolanaError} (code `MISSING_CLIENT_CAPABILITY`) so
|
|
8
|
+
* capability failures answer `isSolanaError()` the same way runtime failures do.
|
|
4
9
|
*/
|
|
5
|
-
declare class MissingClientCapabilityError extends
|
|
10
|
+
declare class MissingClientCapabilityError extends SolanaError {
|
|
6
11
|
/** Name of the hook that requested the capability, e.g. `usePayer`. */
|
|
7
12
|
readonly hookName: string;
|
|
8
13
|
/** Human guidance for installing the capability on the client. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { M as MissingClientCapabilityError, u as useClientCapability } from './shared/vue.
|
|
1
|
+
export { M as MissingClientCapabilityError, u as useClientCapability } from './shared/vue.CAltY57B.mjs';
|
package/dist/useConnection.d.ts
CHANGED
|
@@ -3,29 +3,34 @@ import * as _solana_kit from '@solana/kit';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use `useSolanaClient()` which returns the Kit client instead of
|
|
6
|
-
* the legacy web3-compat Connection.
|
|
6
|
+
* the legacy web3-compat Connection. Kept through 4.x; scheduled for removal
|
|
7
|
+
* in 5.0.0.
|
|
7
8
|
*/
|
|
8
9
|
declare function useConnection(): Omit<_solana_kit.Client<{
|
|
9
|
-
planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
|
|
10
|
-
abortSignal?: AbortSignal;
|
|
11
|
-
}) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
|
|
12
|
-
planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
|
|
13
|
-
abortSignal?: AbortSignal;
|
|
14
|
-
}) => Promise<_solana_kit.TransactionPlan>;
|
|
15
10
|
signTransactions: (input: _solana_kit.InstructionPlanInput | _solana_kit.TransactionPlanInput, config?: {
|
|
16
11
|
abortSignal?: AbortSignal;
|
|
12
|
+
maxInstructionsPerTransaction?: number;
|
|
17
13
|
}) => Promise<_solana_kit.TransactionPlanResult<_solana_kit_plugin_rpc.RpcSignContext>>;
|
|
18
14
|
payer: _solana_kit.TransactionSigner;
|
|
19
15
|
rpc: _solana_kit.Rpc<_solana_kit.RequestAirdropApi & _solana_kit.GetAccountInfoApi & _solana_kit.GetAgGenesisCertApi & _solana_kit.GetBalanceApi & _solana_kit.GetBlockApi & _solana_kit.GetBlockCommitmentApi & _solana_kit.GetBlockHeightApi & _solana_kit.GetBlockProductionApi & _solana_kit.GetBlocksApi & _solana_kit.GetBlocksWithLimitApi & _solana_kit.GetBlockTimeApi & _solana_kit.GetClusterNodesApi & _solana_kit.GetEpochInfoApi & _solana_kit.GetEpochScheduleApi & _solana_kit.GetFeeForMessageApi & _solana_kit.GetFirstAvailableBlockApi & _solana_kit.GetGenesisHashApi & _solana_kit.GetHealthApi & _solana_kit.GetHighestSnapshotSlotApi & _solana_kit.GetIdentityApi & _solana_kit.GetInflationGovernorApi & _solana_kit.GetInflationRateApi & _solana_kit.GetInflationRewardApi & _solana_kit.GetLargestAccountsApi & _solana_kit.GetLatestBlockhashApi & _solana_kit.GetLeaderScheduleApi & _solana_kit.GetMaxRetransmitSlotApi & _solana_kit.GetMaxShredInsertSlotApi & _solana_kit.GetMinimumBalanceForRentExemptionApi & _solana_kit.GetMultipleAccountsApi & _solana_kit.GetProgramAccountsApi & _solana_kit.GetRecentPerformanceSamplesApi & _solana_kit.GetRecentPrioritizationFeesApi & _solana_kit.GetSignaturesForAddressApi & _solana_kit.GetSignatureStatusesApi & _solana_kit.GetSlotApi & _solana_kit.GetSlotLeaderApi & _solana_kit.GetSlotLeadersApi & _solana_kit.GetStakeMinimumDelegationApi & _solana_kit.GetSupplyApi & _solana_kit.GetTokenAccountBalanceApi & _solana_kit.GetTokenAccountsByDelegateApi & _solana_kit.GetTokenAccountsByOwnerApi & _solana_kit.GetTokenLargestAccountsApi & _solana_kit.GetTokenSupplyApi & _solana_kit.GetTransactionApi & _solana_kit.GetTransactionCountApi & _solana_kit.GetTransactionsForAddressApi & _solana_kit.GetVersionApi & _solana_kit.GetVoteAccountsApi & _solana_kit.IsBlockhashValidApi & _solana_kit.MinimumLedgerSlotApi & _solana_kit.SendTransactionApi & _solana_kit.SimulateTransactionApi>;
|
|
20
16
|
rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
|
|
21
17
|
getMinimumBalance: (space: number, config?: _solana_kit.GetMinimumBalanceConfig) => Promise<_solana_kit.Lamports>;
|
|
22
18
|
transactionPlanner: _solana_kit.TransactionPlanner;
|
|
19
|
+
planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
|
|
20
|
+
abortSignal?: AbortSignal;
|
|
21
|
+
maxInstructionsPerTransaction?: number;
|
|
22
|
+
}) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
|
|
23
|
+
planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
|
|
24
|
+
abortSignal?: AbortSignal;
|
|
25
|
+
maxInstructionsPerTransaction?: number;
|
|
26
|
+
}) => Promise<_solana_kit.TransactionPlan>;
|
|
23
27
|
signTransaction: (input: _solana_kit.InstructionPlanInput | (_solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>) | Readonly<{
|
|
24
28
|
kind: "single";
|
|
25
29
|
message: _solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>;
|
|
26
30
|
planType: "transactionPlan";
|
|
27
31
|
}>, config?: {
|
|
28
32
|
abortSignal?: AbortSignal;
|
|
33
|
+
maxInstructionsPerTransaction?: number;
|
|
29
34
|
}) => Promise<_solana_kit.SuccessfulSingleTransactionPlanResult<_solana_kit_plugin_rpc.RpcSignContext>>;
|
|
30
35
|
transactionPlanExecutor: _solana_kit.TransactionPlanExecutor<_solana_kit_plugin_rpc.RpcSendContext>;
|
|
31
36
|
sendTransaction: (input: _solana_kit.InstructionPlanInput | (_solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>) | Readonly<{
|
|
@@ -34,9 +39,11 @@ declare function useConnection(): Omit<_solana_kit.Client<{
|
|
|
34
39
|
planType: "transactionPlan";
|
|
35
40
|
}>, config?: {
|
|
36
41
|
abortSignal?: AbortSignal;
|
|
42
|
+
maxInstructionsPerTransaction?: number;
|
|
37
43
|
}) => Promise<_solana_kit.SuccessfulSingleTransactionPlanResult<_solana_kit_plugin_rpc.RpcSendContext>>;
|
|
38
44
|
sendTransactions: (input: _solana_kit.InstructionPlanInput | _solana_kit.TransactionPlanInput, config?: {
|
|
39
45
|
abortSignal?: AbortSignal;
|
|
46
|
+
maxInstructionsPerTransaction?: number;
|
|
40
47
|
}) => Promise<_solana_kit.TransactionPlanResult<_solana_kit_plugin_rpc.RpcSendContext>>;
|
|
41
48
|
airdrop: (address: _solana_kit.Address, amount: _solana_kit.Lamports, abortSignal?: AbortSignal) => Promise<_solana_kit.Signature | undefined>;
|
|
42
49
|
}>, "payer"> & {
|
package/dist/useConnection.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useConnection } from './shared/vue.
|
|
1
|
+
export { u as useConnection } from './shared/vue.C6OkOK2W.mjs';
|
package/dist/useIdentity.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useIdentity } from './shared/vue.
|
|
1
|
+
export { u as useIdentity } from './shared/vue.D2J7_NpQ.mjs';
|
package/dist/usePayer.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useIdentity, a as usePayer } from './shared/vue.
|
|
1
|
+
export { u as useIdentity, a as usePayer } from './shared/vue.D2J7_NpQ.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as usePlanTransaction, a as usePlanTransactions } from './shared/vue.
|
|
1
|
+
export { u as usePlanTransaction, a as usePlanTransactions } from './shared/vue.BXNjyJ2c.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as usePlanTransactions } from './shared/vue.
|
|
1
|
+
export { a as usePlanTransactions } from './shared/vue.BXNjyJ2c.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as useProgramAccounts } from './shared/vue.
|
|
1
|
+
export { u as useProgramAccounts } from './shared/vue.DcZ_R_RH.mjs';
|