@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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
type UseRequestStatus = "fetching" | "success" | "error" | "disabled";
|
|
5
|
+
type SendFn<TResult> = (options?: {
|
|
6
|
+
abortSignal?: AbortSignal;
|
|
7
|
+
}) => Promise<TResult>;
|
|
8
|
+
type ResolvedSource<TResult> = ((signal: AbortSignal) => Promise<TResult> | {
|
|
9
|
+
send: SendFn<TResult>;
|
|
10
|
+
}) | {
|
|
11
|
+
send: SendFn<TResult>;
|
|
12
|
+
} | null | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* A request source accepted by `useRequest`:
|
|
15
|
+
*
|
|
16
|
+
* - a request function `(signal) => Promise<T>`, called with a fresh composed
|
|
17
|
+
* `AbortSignal` per attempt (it may return a Kit request object, which is
|
|
18
|
+
* sent with the signal automatically),
|
|
19
|
+
* - a Kit reactive store source such as `PendingRpcRequest` (for example
|
|
20
|
+
* `rpc.getBalance(address)`),
|
|
21
|
+
* - a `ref`/`computed` of any of the above, or of `null` to disable, or
|
|
22
|
+
* - `null` to disable outright.
|
|
23
|
+
*/
|
|
24
|
+
type UseRequestSource<TResult> = ResolvedSource<TResult> | Ref<ResolvedSource<TResult>>;
|
|
25
|
+
interface UseRequestOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Returns a caller-provided `AbortSignal` per attempt (for example
|
|
28
|
+
* `AbortSignal.timeout(5_000)`), composed with the internal per-attempt
|
|
29
|
+
* signal. Aborting it fails the attempt without touching other state.
|
|
30
|
+
*/
|
|
31
|
+
getAbortSignal?: (attempt: number) => AbortSignal | null | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface UseRequestReturn<TResult> {
|
|
34
|
+
data: ComputedRef<TResult | undefined>;
|
|
35
|
+
error: ComputedRef<SolanaError | null>;
|
|
36
|
+
refresh: () => Promise<TResult | undefined>;
|
|
37
|
+
status: ComputedRef<UseRequestStatus>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One-shot async request that re-fires when its source changes identity, with
|
|
41
|
+
* stale-while-revalidate: while a new attempt runs, the previous `data` and
|
|
42
|
+
* `error` stay populated so the UI keeps rendering.
|
|
43
|
+
*
|
|
44
|
+
* Status set: `fetching` | `success` | `error` | `disabled`.
|
|
45
|
+
*
|
|
46
|
+
* - The first attempt fires on mount inside a component (or immediately when
|
|
47
|
+
* called outside one).
|
|
48
|
+
* - Passing a ref/computed source re-fires whenever the source identity
|
|
49
|
+
* changes; a `null` source clears state and reports `disabled`.
|
|
50
|
+
* - `refresh()` re-fires manually and resolves with the attempt result.
|
|
51
|
+
* - `getAbortSignal` attaches per-attempt cancellation (timeouts, kill
|
|
52
|
+
* switches) on top of the internal per-attempt signal.
|
|
53
|
+
*/
|
|
54
|
+
declare function useRequest<TResult>(source: UseRequestSource<TResult>, options?: UseRequestOptions): UseRequestReturn<TResult>;
|
|
55
|
+
|
|
56
|
+
export { useRequest };
|
|
57
|
+
export type { UseRequestOptions, UseRequestReturn, UseRequestSource, UseRequestStatus };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
type UseRequestStatus = "fetching" | "success" | "error" | "disabled";
|
|
5
|
+
type SendFn<TResult> = (options?: {
|
|
6
|
+
abortSignal?: AbortSignal;
|
|
7
|
+
}) => Promise<TResult>;
|
|
8
|
+
type ResolvedSource<TResult> = ((signal: AbortSignal) => Promise<TResult> | {
|
|
9
|
+
send: SendFn<TResult>;
|
|
10
|
+
}) | {
|
|
11
|
+
send: SendFn<TResult>;
|
|
12
|
+
} | null | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* A request source accepted by `useRequest`:
|
|
15
|
+
*
|
|
16
|
+
* - a request function `(signal) => Promise<T>`, called with a fresh composed
|
|
17
|
+
* `AbortSignal` per attempt (it may return a Kit request object, which is
|
|
18
|
+
* sent with the signal automatically),
|
|
19
|
+
* - a Kit reactive store source such as `PendingRpcRequest` (for example
|
|
20
|
+
* `rpc.getBalance(address)`),
|
|
21
|
+
* - a `ref`/`computed` of any of the above, or of `null` to disable, or
|
|
22
|
+
* - `null` to disable outright.
|
|
23
|
+
*/
|
|
24
|
+
type UseRequestSource<TResult> = ResolvedSource<TResult> | Ref<ResolvedSource<TResult>>;
|
|
25
|
+
interface UseRequestOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Returns a caller-provided `AbortSignal` per attempt (for example
|
|
28
|
+
* `AbortSignal.timeout(5_000)`), composed with the internal per-attempt
|
|
29
|
+
* signal. Aborting it fails the attempt without touching other state.
|
|
30
|
+
*/
|
|
31
|
+
getAbortSignal?: (attempt: number) => AbortSignal | null | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface UseRequestReturn<TResult> {
|
|
34
|
+
data: ComputedRef<TResult | undefined>;
|
|
35
|
+
error: ComputedRef<SolanaError | null>;
|
|
36
|
+
refresh: () => Promise<TResult | undefined>;
|
|
37
|
+
status: ComputedRef<UseRequestStatus>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One-shot async request that re-fires when its source changes identity, with
|
|
41
|
+
* stale-while-revalidate: while a new attempt runs, the previous `data` and
|
|
42
|
+
* `error` stay populated so the UI keeps rendering.
|
|
43
|
+
*
|
|
44
|
+
* Status set: `fetching` | `success` | `error` | `disabled`.
|
|
45
|
+
*
|
|
46
|
+
* - The first attempt fires on mount inside a component (or immediately when
|
|
47
|
+
* called outside one).
|
|
48
|
+
* - Passing a ref/computed source re-fires whenever the source identity
|
|
49
|
+
* changes; a `null` source clears state and reports `disabled`.
|
|
50
|
+
* - `refresh()` re-fires manually and resolves with the attempt result.
|
|
51
|
+
* - `getAbortSignal` attaches per-attempt cancellation (timeouts, kill
|
|
52
|
+
* switches) on top of the internal per-attempt signal.
|
|
53
|
+
*/
|
|
54
|
+
declare function useRequest<TResult>(source: UseRequestSource<TResult>, options?: UseRequestOptions): UseRequestReturn<TResult>;
|
|
55
|
+
|
|
56
|
+
export { useRequest };
|
|
57
|
+
export type { UseRequestOptions, UseRequestReturn, UseRequestSource, UseRequestStatus };
|
package/dist/useRpc.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useRpc = require('./shared/vue.
|
|
3
|
+
const useRpc = require('./shared/vue.FiMmnMHr.cjs');
|
|
4
4
|
require('vue');
|
|
5
|
-
require('./shared/vue.
|
|
5
|
+
require('./shared/vue.DE3emjSF.cjs');
|
|
6
|
+
require('./shared/vue.DEHxNvUX.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
package/dist/useRpc.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _solana_kit from '@solana/kit';
|
|
2
2
|
import * as _vue_solana_core_errors from '@vue-solana/core/errors';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import * as _vue_solana_core_types from '@vue-solana/core/types';
|
|
@@ -12,7 +12,10 @@ declare function useRpc(): {
|
|
|
12
12
|
error: vue.Ref<_vue_solana_core_errors.SolanaError | null, _vue_solana_core_errors.SolanaError | null>;
|
|
13
13
|
latestBlockhash: vue.Ref<string | null, string | null>;
|
|
14
14
|
checkConnection: () => Promise<void>;
|
|
15
|
-
|
|
15
|
+
client: _solana_kit.Client<_solana_kit.ExtendedClient<object, {
|
|
16
|
+
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>;
|
|
17
|
+
rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
|
|
18
|
+
}>>;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export { useRpc };
|
package/dist/useRpc.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _solana_kit from '@solana/kit';
|
|
2
2
|
import * as _vue_solana_core_errors from '@vue-solana/core/errors';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import * as _vue_solana_core_types from '@vue-solana/core/types';
|
|
@@ -12,7 +12,10 @@ declare function useRpc(): {
|
|
|
12
12
|
error: vue.Ref<_vue_solana_core_errors.SolanaError | null, _vue_solana_core_errors.SolanaError | null>;
|
|
13
13
|
latestBlockhash: vue.Ref<string | null, string | null>;
|
|
14
14
|
checkConnection: () => Promise<void>;
|
|
15
|
-
|
|
15
|
+
client: _solana_kit.Client<_solana_kit.ExtendedClient<object, {
|
|
16
|
+
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>;
|
|
17
|
+
rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
|
|
18
|
+
}>>;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export { useRpc };
|
package/dist/useRpc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _solana_kit from '@solana/kit';
|
|
2
2
|
import * as _vue_solana_core_errors from '@vue-solana/core/errors';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import * as _vue_solana_core_types from '@vue-solana/core/types';
|
|
@@ -12,7 +12,10 @@ declare function useRpc(): {
|
|
|
12
12
|
error: vue.Ref<_vue_solana_core_errors.SolanaError | null, _vue_solana_core_errors.SolanaError | null>;
|
|
13
13
|
latestBlockhash: vue.Ref<string | null, string | null>;
|
|
14
14
|
checkConnection: () => Promise<void>;
|
|
15
|
-
|
|
15
|
+
client: _solana_kit.Client<_solana_kit.ExtendedClient<object, {
|
|
16
|
+
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>;
|
|
17
|
+
rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
|
|
18
|
+
}>>;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export { useRpc };
|
package/dist/useRpc.mjs
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SelectedWalletAccountProvider = require('./shared/vue.DDbVk0Zh.cjs');
|
|
4
|
+
require('vue');
|
|
5
|
+
require('./shared/vue.DEHxNvUX.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.SelectedWalletAccountProvider = SelectedWalletAccountProvider.SelectedWalletAccountProvider;
|
|
10
|
+
exports.createSelectedWalletAccountContext = SelectedWalletAccountProvider.createSelectedWalletAccountContext;
|
|
11
|
+
exports.provideSelectedWalletAccount = SelectedWalletAccountProvider.provideSelectedWalletAccount;
|
|
12
|
+
exports.selectedWalletAccountInjectionKey = SelectedWalletAccountProvider.selectedWalletAccountInjectionKey;
|
|
13
|
+
exports.useSelectedWalletAccount = SelectedWalletAccountProvider.useSelectedWalletAccount;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { SolanaWalletInfo } from '@vue-solana/core/types';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { Ref, ComputedRef, InjectionKey, PropType } from 'vue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Storage adapter used by `SelectedWalletAccountProvider`'s `stateSync`
|
|
7
|
+
* option. The persisted value is the selected wallet's
|
|
8
|
+
* `${walletName}:${accountAddress}` key.
|
|
9
|
+
*/
|
|
10
|
+
interface SelectedWalletAccountStorage {
|
|
11
|
+
storeSelectedWallet(key: string): void | Promise<void>;
|
|
12
|
+
getSelectedWallet(): string | null | Promise<string | null>;
|
|
13
|
+
deleteSelectedWallet(): void | Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type SelectedWalletAccount = SolanaWalletInfo["accounts"][number] & {
|
|
17
|
+
/** The wallet that owns this account. */
|
|
18
|
+
walletName: string;
|
|
19
|
+
};
|
|
20
|
+
type WalletAccountFilter = (walletName: string, account: SolanaWalletInfo["accounts"][number]) => boolean;
|
|
21
|
+
interface SelectedWalletAccountContext {
|
|
22
|
+
selectedWalletAccount: Ref<SelectedWalletAccount | null>;
|
|
23
|
+
setSelectedWalletAccount: (account: SelectedWalletAccount | null) => void;
|
|
24
|
+
filteredWallets: ComputedRef<SolanaWalletInfo[]>;
|
|
25
|
+
}
|
|
26
|
+
declare const selectedWalletAccountInjectionKey: InjectionKey<SelectedWalletAccountContext>;
|
|
27
|
+
interface SelectedWalletAccountOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Restricts the wallets exposed through `filteredWallets` and the accounts
|
|
30
|
+
* that can be selected. Receives the wallet name and each of its accounts;
|
|
31
|
+
* return `false` to hide the account (a wallet with no remaining accounts
|
|
32
|
+
* is hidden entirely).
|
|
33
|
+
*/
|
|
34
|
+
filterWallet?: WalletAccountFilter;
|
|
35
|
+
/**
|
|
36
|
+
* Persists the selection as `${walletName}:${accountAddress}`. Defaults to
|
|
37
|
+
* `localStorage`; pass `null` to disable persistence.
|
|
38
|
+
*/
|
|
39
|
+
stateSync?: SelectedWalletAccountStorage | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* App-wide selected wallet account state, mirroring `@solana/react`'s
|
|
43
|
+
* `SelectedWalletAccountContextProvider`.
|
|
44
|
+
*
|
|
45
|
+
* Call once near the root of your app, then read state anywhere with
|
|
46
|
+
* {@link useSelectedWalletAccount}. The selection persists as
|
|
47
|
+
* `${walletName}:${accountAddress}` through `stateSync` and is restored on
|
|
48
|
+
* the next mount when the wallet and account are available again.
|
|
49
|
+
*/
|
|
50
|
+
declare function provideSelectedWalletAccount(options?: SelectedWalletAccountOptions): SelectedWalletAccountContext;
|
|
51
|
+
/**
|
|
52
|
+
* Build the selected wallet account context without providing it. Used by
|
|
53
|
+
* the Nuxt runtime plugin, which installs the context app-wide via
|
|
54
|
+
* `app.provide` rather than inside a component setup.
|
|
55
|
+
*
|
|
56
|
+
* When called outside a component setup (as the Nuxt plugin does), `inject`
|
|
57
|
+
* cannot resolve the Solana context, so pass it explicitly through
|
|
58
|
+
* {@link solanaContextOverride}.
|
|
59
|
+
*/
|
|
60
|
+
declare function createSelectedWalletAccountContext(options?: SelectedWalletAccountOptions, solanaContextOverride?: SolanaContextLike | null): SelectedWalletAccountContext;
|
|
61
|
+
/**
|
|
62
|
+
* Read the app-wide selected wallet account provided by
|
|
63
|
+
* {@link provideSelectedWalletAccount}.
|
|
64
|
+
*
|
|
65
|
+
* Returns `[selectedAccount, setSelectedAccount, filteredWallets]`. The
|
|
66
|
+
* setter accepts `null` to clear the selection. Throws when called outside a
|
|
67
|
+
* provider — mount `SelectedWalletAccountProvider` (or call
|
|
68
|
+
* `provideSelectedWalletAccount`) first.
|
|
69
|
+
*/
|
|
70
|
+
declare function useSelectedWalletAccount(): [
|
|
71
|
+
Ref<SelectedWalletAccount | null>,
|
|
72
|
+
(account: SelectedWalletAccount | null) => void,
|
|
73
|
+
ComputedRef<SolanaWalletInfo[]>
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* The minimal Solana context surface this composable reads. Structural so the
|
|
77
|
+
* full `VueSolanaContext` (or the raw RPC context) satisfies it without an
|
|
78
|
+
* import cycle from the plugin to its composables.
|
|
79
|
+
*/
|
|
80
|
+
interface SolanaContextLike {
|
|
81
|
+
wallets: Ref<SolanaWalletInfo[]>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* App-wide selected wallet account provider, mirroring `@solana/react`'s
|
|
86
|
+
* `SelectedWalletAccountContextProvider`.
|
|
87
|
+
*
|
|
88
|
+
* Wraps `provideSelectedWalletAccount`; children read state via
|
|
89
|
+
* `useSelectedWalletAccount()`.
|
|
90
|
+
*/
|
|
91
|
+
declare const SelectedWalletAccountProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
92
|
+
filterWallet: {
|
|
93
|
+
type: PropType<SelectedWalletAccountOptions["filterWallet"]>;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
stateSync: {
|
|
97
|
+
type: PropType<SelectedWalletAccountOptions["stateSync"]>;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
101
|
+
[key: string]: any;
|
|
102
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
filterWallet: {
|
|
104
|
+
type: PropType<SelectedWalletAccountOptions["filterWallet"]>;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
stateSync: {
|
|
108
|
+
type: PropType<SelectedWalletAccountOptions["stateSync"]>;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
}>> & Readonly<{}>, {
|
|
112
|
+
filterWallet: WalletAccountFilter | undefined;
|
|
113
|
+
stateSync: SelectedWalletAccountStorage | null | undefined;
|
|
114
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
115
|
+
|
|
116
|
+
export { SelectedWalletAccountProvider, createSelectedWalletAccountContext, provideSelectedWalletAccount, selectedWalletAccountInjectionKey, useSelectedWalletAccount };
|
|
117
|
+
export type { SelectedWalletAccount, SelectedWalletAccountContext, SelectedWalletAccountOptions, WalletAccountFilter };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { SolanaWalletInfo } from '@vue-solana/core/types';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { Ref, ComputedRef, InjectionKey, PropType } from 'vue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Storage adapter used by `SelectedWalletAccountProvider`'s `stateSync`
|
|
7
|
+
* option. The persisted value is the selected wallet's
|
|
8
|
+
* `${walletName}:${accountAddress}` key.
|
|
9
|
+
*/
|
|
10
|
+
interface SelectedWalletAccountStorage {
|
|
11
|
+
storeSelectedWallet(key: string): void | Promise<void>;
|
|
12
|
+
getSelectedWallet(): string | null | Promise<string | null>;
|
|
13
|
+
deleteSelectedWallet(): void | Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type SelectedWalletAccount = SolanaWalletInfo["accounts"][number] & {
|
|
17
|
+
/** The wallet that owns this account. */
|
|
18
|
+
walletName: string;
|
|
19
|
+
};
|
|
20
|
+
type WalletAccountFilter = (walletName: string, account: SolanaWalletInfo["accounts"][number]) => boolean;
|
|
21
|
+
interface SelectedWalletAccountContext {
|
|
22
|
+
selectedWalletAccount: Ref<SelectedWalletAccount | null>;
|
|
23
|
+
setSelectedWalletAccount: (account: SelectedWalletAccount | null) => void;
|
|
24
|
+
filteredWallets: ComputedRef<SolanaWalletInfo[]>;
|
|
25
|
+
}
|
|
26
|
+
declare const selectedWalletAccountInjectionKey: InjectionKey<SelectedWalletAccountContext>;
|
|
27
|
+
interface SelectedWalletAccountOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Restricts the wallets exposed through `filteredWallets` and the accounts
|
|
30
|
+
* that can be selected. Receives the wallet name and each of its accounts;
|
|
31
|
+
* return `false` to hide the account (a wallet with no remaining accounts
|
|
32
|
+
* is hidden entirely).
|
|
33
|
+
*/
|
|
34
|
+
filterWallet?: WalletAccountFilter;
|
|
35
|
+
/**
|
|
36
|
+
* Persists the selection as `${walletName}:${accountAddress}`. Defaults to
|
|
37
|
+
* `localStorage`; pass `null` to disable persistence.
|
|
38
|
+
*/
|
|
39
|
+
stateSync?: SelectedWalletAccountStorage | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* App-wide selected wallet account state, mirroring `@solana/react`'s
|
|
43
|
+
* `SelectedWalletAccountContextProvider`.
|
|
44
|
+
*
|
|
45
|
+
* Call once near the root of your app, then read state anywhere with
|
|
46
|
+
* {@link useSelectedWalletAccount}. The selection persists as
|
|
47
|
+
* `${walletName}:${accountAddress}` through `stateSync` and is restored on
|
|
48
|
+
* the next mount when the wallet and account are available again.
|
|
49
|
+
*/
|
|
50
|
+
declare function provideSelectedWalletAccount(options?: SelectedWalletAccountOptions): SelectedWalletAccountContext;
|
|
51
|
+
/**
|
|
52
|
+
* Build the selected wallet account context without providing it. Used by
|
|
53
|
+
* the Nuxt runtime plugin, which installs the context app-wide via
|
|
54
|
+
* `app.provide` rather than inside a component setup.
|
|
55
|
+
*
|
|
56
|
+
* When called outside a component setup (as the Nuxt plugin does), `inject`
|
|
57
|
+
* cannot resolve the Solana context, so pass it explicitly through
|
|
58
|
+
* {@link solanaContextOverride}.
|
|
59
|
+
*/
|
|
60
|
+
declare function createSelectedWalletAccountContext(options?: SelectedWalletAccountOptions, solanaContextOverride?: SolanaContextLike | null): SelectedWalletAccountContext;
|
|
61
|
+
/**
|
|
62
|
+
* Read the app-wide selected wallet account provided by
|
|
63
|
+
* {@link provideSelectedWalletAccount}.
|
|
64
|
+
*
|
|
65
|
+
* Returns `[selectedAccount, setSelectedAccount, filteredWallets]`. The
|
|
66
|
+
* setter accepts `null` to clear the selection. Throws when called outside a
|
|
67
|
+
* provider — mount `SelectedWalletAccountProvider` (or call
|
|
68
|
+
* `provideSelectedWalletAccount`) first.
|
|
69
|
+
*/
|
|
70
|
+
declare function useSelectedWalletAccount(): [
|
|
71
|
+
Ref<SelectedWalletAccount | null>,
|
|
72
|
+
(account: SelectedWalletAccount | null) => void,
|
|
73
|
+
ComputedRef<SolanaWalletInfo[]>
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* The minimal Solana context surface this composable reads. Structural so the
|
|
77
|
+
* full `VueSolanaContext` (or the raw RPC context) satisfies it without an
|
|
78
|
+
* import cycle from the plugin to its composables.
|
|
79
|
+
*/
|
|
80
|
+
interface SolanaContextLike {
|
|
81
|
+
wallets: Ref<SolanaWalletInfo[]>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* App-wide selected wallet account provider, mirroring `@solana/react`'s
|
|
86
|
+
* `SelectedWalletAccountContextProvider`.
|
|
87
|
+
*
|
|
88
|
+
* Wraps `provideSelectedWalletAccount`; children read state via
|
|
89
|
+
* `useSelectedWalletAccount()`.
|
|
90
|
+
*/
|
|
91
|
+
declare const SelectedWalletAccountProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
92
|
+
filterWallet: {
|
|
93
|
+
type: PropType<SelectedWalletAccountOptions["filterWallet"]>;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
stateSync: {
|
|
97
|
+
type: PropType<SelectedWalletAccountOptions["stateSync"]>;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
101
|
+
[key: string]: any;
|
|
102
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
filterWallet: {
|
|
104
|
+
type: PropType<SelectedWalletAccountOptions["filterWallet"]>;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
stateSync: {
|
|
108
|
+
type: PropType<SelectedWalletAccountOptions["stateSync"]>;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
}>> & Readonly<{}>, {
|
|
112
|
+
filterWallet: WalletAccountFilter | undefined;
|
|
113
|
+
stateSync: SelectedWalletAccountStorage | null | undefined;
|
|
114
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
115
|
+
|
|
116
|
+
export { SelectedWalletAccountProvider, createSelectedWalletAccountContext, provideSelectedWalletAccount, selectedWalletAccountInjectionKey, useSelectedWalletAccount };
|
|
117
|
+
export type { SelectedWalletAccount, SelectedWalletAccountContext, SelectedWalletAccountOptions, WalletAccountFilter };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { SolanaWalletInfo } from '@vue-solana/core/types';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { Ref, ComputedRef, InjectionKey, PropType } from 'vue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Storage adapter used by `SelectedWalletAccountProvider`'s `stateSync`
|
|
7
|
+
* option. The persisted value is the selected wallet's
|
|
8
|
+
* `${walletName}:${accountAddress}` key.
|
|
9
|
+
*/
|
|
10
|
+
interface SelectedWalletAccountStorage {
|
|
11
|
+
storeSelectedWallet(key: string): void | Promise<void>;
|
|
12
|
+
getSelectedWallet(): string | null | Promise<string | null>;
|
|
13
|
+
deleteSelectedWallet(): void | Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type SelectedWalletAccount = SolanaWalletInfo["accounts"][number] & {
|
|
17
|
+
/** The wallet that owns this account. */
|
|
18
|
+
walletName: string;
|
|
19
|
+
};
|
|
20
|
+
type WalletAccountFilter = (walletName: string, account: SolanaWalletInfo["accounts"][number]) => boolean;
|
|
21
|
+
interface SelectedWalletAccountContext {
|
|
22
|
+
selectedWalletAccount: Ref<SelectedWalletAccount | null>;
|
|
23
|
+
setSelectedWalletAccount: (account: SelectedWalletAccount | null) => void;
|
|
24
|
+
filteredWallets: ComputedRef<SolanaWalletInfo[]>;
|
|
25
|
+
}
|
|
26
|
+
declare const selectedWalletAccountInjectionKey: InjectionKey<SelectedWalletAccountContext>;
|
|
27
|
+
interface SelectedWalletAccountOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Restricts the wallets exposed through `filteredWallets` and the accounts
|
|
30
|
+
* that can be selected. Receives the wallet name and each of its accounts;
|
|
31
|
+
* return `false` to hide the account (a wallet with no remaining accounts
|
|
32
|
+
* is hidden entirely).
|
|
33
|
+
*/
|
|
34
|
+
filterWallet?: WalletAccountFilter;
|
|
35
|
+
/**
|
|
36
|
+
* Persists the selection as `${walletName}:${accountAddress}`. Defaults to
|
|
37
|
+
* `localStorage`; pass `null` to disable persistence.
|
|
38
|
+
*/
|
|
39
|
+
stateSync?: SelectedWalletAccountStorage | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* App-wide selected wallet account state, mirroring `@solana/react`'s
|
|
43
|
+
* `SelectedWalletAccountContextProvider`.
|
|
44
|
+
*
|
|
45
|
+
* Call once near the root of your app, then read state anywhere with
|
|
46
|
+
* {@link useSelectedWalletAccount}. The selection persists as
|
|
47
|
+
* `${walletName}:${accountAddress}` through `stateSync` and is restored on
|
|
48
|
+
* the next mount when the wallet and account are available again.
|
|
49
|
+
*/
|
|
50
|
+
declare function provideSelectedWalletAccount(options?: SelectedWalletAccountOptions): SelectedWalletAccountContext;
|
|
51
|
+
/**
|
|
52
|
+
* Build the selected wallet account context without providing it. Used by
|
|
53
|
+
* the Nuxt runtime plugin, which installs the context app-wide via
|
|
54
|
+
* `app.provide` rather than inside a component setup.
|
|
55
|
+
*
|
|
56
|
+
* When called outside a component setup (as the Nuxt plugin does), `inject`
|
|
57
|
+
* cannot resolve the Solana context, so pass it explicitly through
|
|
58
|
+
* {@link solanaContextOverride}.
|
|
59
|
+
*/
|
|
60
|
+
declare function createSelectedWalletAccountContext(options?: SelectedWalletAccountOptions, solanaContextOverride?: SolanaContextLike | null): SelectedWalletAccountContext;
|
|
61
|
+
/**
|
|
62
|
+
* Read the app-wide selected wallet account provided by
|
|
63
|
+
* {@link provideSelectedWalletAccount}.
|
|
64
|
+
*
|
|
65
|
+
* Returns `[selectedAccount, setSelectedAccount, filteredWallets]`. The
|
|
66
|
+
* setter accepts `null` to clear the selection. Throws when called outside a
|
|
67
|
+
* provider — mount `SelectedWalletAccountProvider` (or call
|
|
68
|
+
* `provideSelectedWalletAccount`) first.
|
|
69
|
+
*/
|
|
70
|
+
declare function useSelectedWalletAccount(): [
|
|
71
|
+
Ref<SelectedWalletAccount | null>,
|
|
72
|
+
(account: SelectedWalletAccount | null) => void,
|
|
73
|
+
ComputedRef<SolanaWalletInfo[]>
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* The minimal Solana context surface this composable reads. Structural so the
|
|
77
|
+
* full `VueSolanaContext` (or the raw RPC context) satisfies it without an
|
|
78
|
+
* import cycle from the plugin to its composables.
|
|
79
|
+
*/
|
|
80
|
+
interface SolanaContextLike {
|
|
81
|
+
wallets: Ref<SolanaWalletInfo[]>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* App-wide selected wallet account provider, mirroring `@solana/react`'s
|
|
86
|
+
* `SelectedWalletAccountContextProvider`.
|
|
87
|
+
*
|
|
88
|
+
* Wraps `provideSelectedWalletAccount`; children read state via
|
|
89
|
+
* `useSelectedWalletAccount()`.
|
|
90
|
+
*/
|
|
91
|
+
declare const SelectedWalletAccountProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
92
|
+
filterWallet: {
|
|
93
|
+
type: PropType<SelectedWalletAccountOptions["filterWallet"]>;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
stateSync: {
|
|
97
|
+
type: PropType<SelectedWalletAccountOptions["stateSync"]>;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
101
|
+
[key: string]: any;
|
|
102
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
filterWallet: {
|
|
104
|
+
type: PropType<SelectedWalletAccountOptions["filterWallet"]>;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
stateSync: {
|
|
108
|
+
type: PropType<SelectedWalletAccountOptions["stateSync"]>;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
}>> & Readonly<{}>, {
|
|
112
|
+
filterWallet: WalletAccountFilter | undefined;
|
|
113
|
+
stateSync: SelectedWalletAccountStorage | null | undefined;
|
|
114
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
115
|
+
|
|
116
|
+
export { SelectedWalletAccountProvider, createSelectedWalletAccountContext, provideSelectedWalletAccount, selectedWalletAccountInjectionKey, useSelectedWalletAccount };
|
|
117
|
+
export type { SelectedWalletAccount, SelectedWalletAccountContext, SelectedWalletAccountOptions, WalletAccountFilter };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { S as SelectedWalletAccountProvider, c as createSelectedWalletAccountContext, p as provideSelectedWalletAccount, s as selectedWalletAccountInjectionKey, u as useSelectedWalletAccount } from './shared/vue.DXQVIRZA.mjs';
|
|
2
|
+
import 'vue';
|
|
3
|
+
import './shared/vue.D_P5SqqD.mjs';
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useSignAndSendTransaction = require('./shared/vue.
|
|
3
|
+
const useSignAndSendTransaction = require('./shared/vue.CWZSMVnB.cjs');
|
|
4
4
|
require('@vue-solana/core/errors');
|
|
5
5
|
require('@vue-solana/core/timeout');
|
|
6
6
|
require('@vue-solana/core/transaction');
|
|
7
7
|
require('@vue-solana/core/wallet');
|
|
8
8
|
require('vue');
|
|
9
|
-
require('./shared/vue.
|
|
10
|
-
require('./shared/vue.
|
|
11
|
-
require('./shared/vue.
|
|
12
|
-
require('./shared/vue.
|
|
13
|
-
require('./shared/vue.
|
|
9
|
+
require('./shared/vue.BVaMoz9y.cjs');
|
|
10
|
+
require('./shared/vue.BIxphCAq.cjs');
|
|
11
|
+
require('./shared/vue.DE3emjSF.cjs');
|
|
12
|
+
require('./shared/vue.DEHxNvUX.cjs');
|
|
13
|
+
require('./shared/vue.BGxz4dru.cjs');
|
|
14
|
+
require('./shared/vue.Sbbm9JSu.cjs');
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|