@vue-solana/nuxt 3.0.0 → 4.0.0-rc.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 +11 -2
- package/dist/module.d.ts +7 -3
- package/dist/module.mjs +44 -21
- package/dist/runtime/plugin.d.ts +7 -1
- package/dist/runtime/plugin.mjs +9 -12
- package/package.json +9 -6
- package/dist/module.d.mts +0 -18
- package/dist/runtime/buffer-polyfill.d.mts +0 -2
- package/dist/runtime/kit.d.mts +0 -1
- package/dist/runtime/plugin.d.mts +0 -3
package/README.md
CHANGED
|
@@ -121,10 +121,14 @@ The module auto-imports these composables from direct `@vue-solana/vue/*` subpat
|
|
|
121
121
|
- `useSolanaSignAndSendTransactions()`
|
|
122
122
|
- `useSolanaTransactionConfirmation()`
|
|
123
123
|
- `useSolanaSignatureStatus()`
|
|
124
|
+
- `useSolanaTransaction()`
|
|
124
125
|
- `useSolanaAction()`
|
|
125
126
|
- `useSolanaRequest()`
|
|
126
127
|
- `useSolanaSubscription()`
|
|
127
128
|
- `useSolanaTrackedData()`
|
|
129
|
+
- `useSolanaRequestSwr()`
|
|
130
|
+
- `useSolanaSubscriptionSwr()`
|
|
131
|
+
- `useSolanaTrackedDataSwr()`
|
|
128
132
|
- `useSolanaSelectedWalletAccount()`
|
|
129
133
|
- `useSolanaPayer()`
|
|
130
134
|
- `useSolanaIdentity()`
|
|
@@ -154,10 +158,14 @@ The module auto-imports these composables from direct `@vue-solana/vue/*` subpat
|
|
|
154
158
|
| `useSolanaSignAndSendTransactions()` | Batch sign-and-send returning one signature per transaction. |
|
|
155
159
|
| `useSolanaTransactionConfirmation()` | Confirmation state for an already submitted signature. |
|
|
156
160
|
| `useSolanaSignatureStatus()` | Signature status reads with optional polling or websocket subscription. |
|
|
161
|
+
| `useSolanaTransaction()` | Generic async transaction state helper with optional timeout settings. |
|
|
157
162
|
| `useSolanaAction()` | Generic async action state machine; each dispatch aborts the prior attempt. |
|
|
158
163
|
| `useSolanaRequest()` | One-shot Kit request with stale-while-revalidate as its source changes. |
|
|
159
164
|
| `useSolanaSubscription()` | Live data over a Kit reactive stream store (e.g. RPC subscriptions). |
|
|
160
165
|
| `useSolanaTrackedData()` | Slot-deduplicated fetch plus subscription over Kit's slot-tracking store. |
|
|
166
|
+
| `useSolanaRequestSwr()` | Cache-keyed SWR adapter for one-shot Kit requests. |
|
|
167
|
+
| `useSolanaSubscriptionSwr()` | Cache-keyed SWR adapter for Kit reactive stream stores. |
|
|
168
|
+
| `useSolanaTrackedDataSwr()` | Cache-keyed SWR adapter for slot-tracked data. |
|
|
161
169
|
| `useSolanaSelectedWalletAccount()` | App-wide selected wallet account context provided by the runtime plugin. |
|
|
162
170
|
| `useSolanaPayer()` | Reactive Kit client `payer` signer ref. Nuxt config intentionally does not provide one; use a client-only plugin with `clientPlugin: false`. |
|
|
163
171
|
| `useSolanaIdentity()` | Reactive Kit client `identity` signer ref. |
|
|
@@ -166,7 +174,7 @@ The module auto-imports these composables from direct `@vue-solana/vue/*` subpat
|
|
|
166
174
|
| `useSolanaSendTransaction()` | Plans, signs, submits, and confirms one transaction through the client. |
|
|
167
175
|
| `useSolanaSendTransactions()` | Sends a batch of transactions (parallel or sequential) through the client. |
|
|
168
176
|
|
|
169
|
-
The default client built by the module composes the
|
|
177
|
+
The default client built by the module composes `solanaRpc()` followed by `rpcAirdrop()` when no `commitment` is configured (a configured `commitment` builds the same stack explicitly so it reaches the RPC layer); `solanaRpc()` installs `rpcTransactionPlanner()`, `rpcTransactionPlanSigningExecutor()`, and `rpcTransactionPlanSendingExecutor()` itself. The old custom fallback sender is not used. `useSolanaSendTransaction()` and `useSolanaSendTransactions()` therefore use the official client-sending capability, but the module does not configure a payer because `payer` and `payerSecretKey` are omitted from `ModuleOptions`. Their `sent` status is reached after the official executor completes its send-and-confirm operation at `confirmed` commitment.
|
|
170
178
|
|
|
171
179
|
The runtime plugin is client-only. Auto-imported composables can be called during SSR and return inert state until hydration provides the real client context. Trigger RPC and wallet work from client lifecycle hooks or user actions.
|
|
172
180
|
|
|
@@ -292,7 +300,7 @@ async function signIn() {
|
|
|
292
300
|
</template>
|
|
293
301
|
```
|
|
294
302
|
|
|
295
|
-
Message signing is for wallet ownership or authentication challenges. It is separate from transaction signing and does not authorize on-chain activity. For auth flows, use a server-issued nonce and verify the returned signature server-side.
|
|
303
|
+
Message signing is for wallet ownership or authentication challenges. It is separate from transaction signing and does not authorize on-chain activity. For auth flows, use a server-issued nonce and verify the returned signature server-side. The adapter also checks the signature against the account's public key before resolving, where Ed25519 (WebCrypto) is available — a best-effort client-side guard that rejects with `INVALID_SIGNATURE`, not a replacement for server-side verification.
|
|
296
304
|
|
|
297
305
|
## Client-Sent Transactions
|
|
298
306
|
|
|
@@ -325,6 +333,7 @@ Docs: [Vue Solana Agent Skill](https://vue-solana-docs.vercel.app/agent-skill)
|
|
|
325
333
|
## Caveats
|
|
326
334
|
|
|
327
335
|
- The runtime plugin is client-only. Auto-imported composables are SSR-safe, but real RPC and wallet work should run after hydration or in user actions.
|
|
336
|
+
- The SWR cache (`useSolanaRequestSwr()`, `useSolanaSubscriptionSwr()`, `useSolanaTrackedDataSwr()`) is module-level and shared across SSR requests. Namespace cache keys per request or call `clearSwrCache()` (auto-imported) at the start of each server request to avoid leaking cached data between requests.
|
|
328
337
|
- Nuxt module options are stored in public runtime config, so they must be JSON-serializable.
|
|
329
338
|
- Public Solana RPC endpoints are useful for development, but production apps should use dedicated RPC infrastructure.
|
|
330
339
|
- Broad `useSolanaProgramAccounts()` scans can be expensive or blocked on public RPC nodes. Prefer narrow filters and `dataSlice`.
|
package/dist/module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NuxtModule } from '@nuxt/schema';
|
|
2
2
|
import { VueSolanaPluginOptions } from '@vue-solana/vue';
|
|
3
3
|
export * from '@vue-solana/vue';
|
|
4
4
|
|
|
@@ -10,9 +10,13 @@ type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSec
|
|
|
10
10
|
*/
|
|
11
11
|
clientPlugin?: boolean;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
declare module "nuxt/schema" {
|
|
14
|
+
interface PublicRuntimeConfig {
|
|
15
|
+
solana?: ModuleOptions;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
14
18
|
|
|
15
|
-
declare const module$1:
|
|
19
|
+
declare const module$1: NuxtModule<ModuleOptions>;
|
|
16
20
|
|
|
17
21
|
export { module$1 as default };
|
|
18
22
|
export type { ModuleOptions };
|
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addPlugin, addImports } from '@nuxt/kit';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
|
-
import {
|
|
3
|
+
import { posix, dirname, join } from 'node:path';
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
|
|
6
6
|
const SOLANA_COMPOSABLE_IMPORTS = [
|
|
@@ -8,6 +8,7 @@ const SOLANA_COMPOSABLE_IMPORTS = [
|
|
|
8
8
|
["useAction", "useSolanaAction"],
|
|
9
9
|
["useAirdrop", "useSolanaAirdrop"],
|
|
10
10
|
["useBalance", "useSolanaBalance"],
|
|
11
|
+
["useClientCapability", "useSolanaClientCapability"],
|
|
11
12
|
["useConnection", "useSolanaConnection"],
|
|
12
13
|
["useIdentity", "useSolanaIdentity"],
|
|
13
14
|
["usePlanTransaction", "useSolanaPlanTransaction"],
|
|
@@ -54,28 +55,32 @@ function solanaAutoImports(vueDist) {
|
|
|
54
55
|
as,
|
|
55
56
|
from: vueSource(vueDist, name)
|
|
56
57
|
})),
|
|
57
|
-
...SOLANA_SWR_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist, "swr") }))
|
|
58
|
+
...SOLANA_SWR_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist, "swr") })),
|
|
59
|
+
{ name: "tryUseSolana", as: "tryUseSolana", from: vueSource(vueDist, "useSolana") },
|
|
60
|
+
{ name: "clearSwrCache", as: "clearSwrCache", from: vueSource(vueDist, "swr") },
|
|
61
|
+
{ name: "deleteSwrKey", as: "deleteSwrKey", from: vueSource(vueDist, "swr") }
|
|
58
62
|
];
|
|
59
63
|
}
|
|
60
64
|
function solanaSetupAutoImports(vueDist) {
|
|
61
65
|
return SOLANA_SETUP_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist) }));
|
|
62
66
|
}
|
|
63
67
|
function vueSource(vueDist, subpath = "index") {
|
|
64
|
-
|
|
68
|
+
if (!vueDist) {
|
|
69
|
+
return `@vue-solana/vue/${subpath}`;
|
|
70
|
+
}
|
|
71
|
+
return posix.join(vueDist.replace(/\\/g, "/"), `${subpath}.mjs`);
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
const VITE_OPTIMIZE_DEPS = [
|
|
68
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > @solana-mobile/wallet-standard-mobile",
|
|
69
75
|
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > buffer",
|
|
70
76
|
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > buffer/",
|
|
71
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core >
|
|
72
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl",
|
|
73
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl/nacl-fast.js"
|
|
74
|
-
];
|
|
75
|
-
const VITE_NEEDS_INTEROP = [
|
|
76
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl",
|
|
77
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl/nacl-fast.js"
|
|
77
|
+
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl"
|
|
78
78
|
];
|
|
79
|
+
const VITE_NEEDS_INTEROP = ["@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl"];
|
|
80
|
+
const MODULE_DEFAULTS = {
|
|
81
|
+
cluster: "devnet",
|
|
82
|
+
autoConnect: false
|
|
83
|
+
};
|
|
79
84
|
const module$1 = defineNuxtModule({
|
|
80
85
|
meta: {
|
|
81
86
|
name: "@vue-solana/nuxt",
|
|
@@ -84,18 +89,17 @@ const module$1 = defineNuxtModule({
|
|
|
84
89
|
nuxt: "^3.0.0 || ^4.0.0"
|
|
85
90
|
}
|
|
86
91
|
},
|
|
87
|
-
defaults:
|
|
88
|
-
cluster: "devnet",
|
|
89
|
-
autoConnect: false
|
|
90
|
-
},
|
|
92
|
+
defaults: MODULE_DEFAULTS,
|
|
91
93
|
setup(options, nuxt) {
|
|
92
94
|
const resolver = createResolver(import.meta.url);
|
|
93
95
|
const publicConfig = nuxt.options.runtimeConfig.public;
|
|
94
|
-
publicConfig.solana = toPublicSolanaConfig(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
publicConfig.solana = toPublicSolanaConfig(
|
|
97
|
+
mergeSolanaSources({
|
|
98
|
+
publicSolana: isPlainObject(publicConfig.solana) ? publicConfig.solana : {},
|
|
99
|
+
options,
|
|
100
|
+
configuredSolana: isPlainObject(nuxt.options.solana) ? nuxt.options.solana ?? {} : {}
|
|
101
|
+
})
|
|
102
|
+
);
|
|
99
103
|
const vueDist = resolveVueDist();
|
|
100
104
|
nuxt.hook("vite:extendConfig", (config, { isClient }) => {
|
|
101
105
|
if (!isClient) {
|
|
@@ -109,7 +113,8 @@ const module$1 = defineNuxtModule({
|
|
|
109
113
|
if (options.clientPlugin !== false) {
|
|
110
114
|
addPlugin({
|
|
111
115
|
src: resolver.resolve("./runtime/plugin"),
|
|
112
|
-
mode: "client"
|
|
116
|
+
mode: "client",
|
|
117
|
+
order: -10
|
|
113
118
|
});
|
|
114
119
|
addImports(solanaAutoImports(vueDist));
|
|
115
120
|
return;
|
|
@@ -117,6 +122,24 @@ const module$1 = defineNuxtModule({
|
|
|
117
122
|
addImports([...solanaAutoImports(vueDist), ...solanaSetupAutoImports(vueDist)]);
|
|
118
123
|
}
|
|
119
124
|
});
|
|
125
|
+
function mergeSolanaSources({
|
|
126
|
+
publicSolana,
|
|
127
|
+
options,
|
|
128
|
+
configuredSolana
|
|
129
|
+
}) {
|
|
130
|
+
const merged = { ...publicSolana };
|
|
131
|
+
for (const [key, value] of Object.entries(options)) {
|
|
132
|
+
const untouchedDefault = key in MODULE_DEFAULTS && Object.is(value, MODULE_DEFAULTS[key]) && !Object.hasOwn(configuredSolana, key);
|
|
133
|
+
if (untouchedDefault && Object.hasOwn(publicSolana, key)) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
merged[key] = value;
|
|
137
|
+
}
|
|
138
|
+
return merged;
|
|
139
|
+
}
|
|
140
|
+
function isPlainObject(value) {
|
|
141
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
142
|
+
}
|
|
120
143
|
function toPublicSolanaConfig(options) {
|
|
121
144
|
const runtimeOptions = { ...options };
|
|
122
145
|
delete runtimeOptions.wallet;
|
package/dist/runtime/plugin.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _app from '#app';
|
|
2
|
+
|
|
3
|
+
declare const _default: (nuxtApp: _app.NuxtApp) => void | {
|
|
4
|
+
provide?: Record<string, unknown> | undefined;
|
|
5
|
+
} | Promise<void | {
|
|
6
|
+
provide?: Record<string, unknown> | undefined;
|
|
7
|
+
}>;
|
|
2
8
|
|
|
3
9
|
export { _default as default };
|
package/dist/runtime/plugin.mjs
CHANGED
|
@@ -2,20 +2,17 @@ import { createSolanaPlugin, createSelectedWalletAccountContext, selectedWalletA
|
|
|
2
2
|
import { defineNuxtPlugin, useRuntimeConfig } from '#app';
|
|
3
3
|
|
|
4
4
|
const plugin = defineNuxtPlugin((nuxtApp) => {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
mobileWallet: config.mobileWallet,
|
|
13
|
-
iosWallet: config.iosWallet
|
|
14
|
-
});
|
|
5
|
+
const rawConfig = useRuntimeConfig().public.solana ?? {};
|
|
6
|
+
const pluginOptions = { ...rawConfig };
|
|
7
|
+
delete pluginOptions.wallet;
|
|
8
|
+
delete pluginOptions.payer;
|
|
9
|
+
delete pluginOptions.payerSecretKey;
|
|
10
|
+
delete pluginOptions.clientPlugin;
|
|
11
|
+
const solanaPlugin = createSolanaPlugin(pluginOptions);
|
|
15
12
|
nuxtApp.vueApp.use(solanaPlugin);
|
|
16
|
-
|
|
13
|
+
nuxtApp.vueApp.onUnmount(() => solanaPlugin.dispose());
|
|
17
14
|
const context = createSelectedWalletAccountContext({}, solanaPlugin.context);
|
|
18
|
-
vueApp.provide(selectedWalletAccountInjectionKey, context);
|
|
15
|
+
nuxtApp.vueApp.provide(selectedWalletAccountInjectionKey, context);
|
|
19
16
|
});
|
|
20
17
|
|
|
21
18
|
export { plugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-solana/nuxt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.0",
|
|
4
4
|
"description": "Nuxt module for Solana applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"module": "./dist/module.mjs",
|
|
25
|
-
"types": "./dist/module.d.
|
|
25
|
+
"types": "./dist/module.d.ts",
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"types": "./dist/module.d.
|
|
28
|
+
"types": "./dist/module.d.ts",
|
|
29
29
|
"import": "./dist/module.mjs"
|
|
30
30
|
},
|
|
31
31
|
"./buffer-polyfill": {
|
|
@@ -38,19 +38,21 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
|
-
"dist"
|
|
41
|
+
"dist",
|
|
42
|
+
"!dist/**/*.d.mts"
|
|
42
43
|
],
|
|
43
44
|
"publishConfig": {
|
|
44
45
|
"access": "public"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@vue-solana/vue": "
|
|
48
|
+
"@vue-solana/vue": "4.0.0-rc.0"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"nuxt": "^3.0.0 || ^4.0.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@nuxt/kit": "^4.4.6",
|
|
55
|
+
"@nuxt/schema": "^4.4.6",
|
|
54
56
|
"nuxt": "^4.4.6",
|
|
55
57
|
"typescript": "^5.8.3",
|
|
56
58
|
"unbuild": "^3.5.0",
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"build": "unbuild",
|
|
61
63
|
"dev": "unbuild --stub",
|
|
62
64
|
"typecheck": "tsc --noEmit",
|
|
63
|
-
"clean": "rm -rf dist"
|
|
65
|
+
"clean": "rm -rf dist",
|
|
66
|
+
"check:esm-map": "node ../../scripts/check-exports-map.mjs"
|
|
64
67
|
}
|
|
65
68
|
}
|
package/dist/module.d.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
|
-
import { VueSolanaPluginOptions } from '@vue-solana/vue';
|
|
3
|
-
export * from '@vue-solana/vue';
|
|
4
|
-
|
|
5
|
-
type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSecretKey"> & {
|
|
6
|
-
/**
|
|
7
|
-
* Set to `false` to auto-import the composables without installing the Solana
|
|
8
|
-
* runtime plugin. Use it when the app installs `createSolanaPlugin` itself,
|
|
9
|
-
* e.g. to attach a client-only `payer` that module options cannot carry.
|
|
10
|
-
*/
|
|
11
|
-
clientPlugin?: boolean;
|
|
12
|
-
};
|
|
13
|
-
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
14
|
-
|
|
15
|
-
declare const module$1: DefinedNuxtModule;
|
|
16
|
-
|
|
17
|
-
export { module$1 as default };
|
|
18
|
-
export type { ModuleOptions };
|
package/dist/runtime/kit.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@vue-solana/vue/kit';
|