@vue-solana/nuxt 0.1.0 → 0.1.3
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 +138 -6
- package/dist/module.cjs +5 -1
- package/dist/module.d.cts +5 -5
- package/dist/module.d.mts +5 -5
- package/dist/module.d.ts +5 -5
- package/dist/module.mjs +5 -1
- package/dist/runtime/plugin.cjs +9 -7
- package/dist/runtime/plugin.mjs +9 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -2,25 +2,157 @@
|
|
|
2
2
|
|
|
3
3
|
Nuxt module for Solana applications.
|
|
4
4
|
|
|
5
|
+
Use this package in Nuxt apps that need the Vue Solana plugin installed automatically plus auto-imported composables.
|
|
6
|
+
|
|
7
|
+
New to Solana? Start with the official docs and the project concepts guide:
|
|
8
|
+
|
|
9
|
+
- [Solana Documentation](https://solana.com/docs)
|
|
10
|
+
- [Solana RPC Methods](https://solana.com/docs/rpc)
|
|
11
|
+
- [Solana Clusters](https://solana.com/docs/references/clusters)
|
|
12
|
+
- [Vue Solana Concepts Guide](https://github.com/vue-solana/vue-solana/tree/main/apps/docs/content/concepts/solana-for-vue-developers.md)
|
|
13
|
+
- [`@vue-solana/nuxt` docs](https://github.com/vue-solana/vue-solana/tree/main/apps/docs/content/packages/nuxt.md)
|
|
14
|
+
|
|
5
15
|
## Install
|
|
6
16
|
|
|
7
17
|
```sh
|
|
8
18
|
pnpm add @vue-solana/nuxt @vue-solana/vue @vue-solana/core @solana/web3-compat
|
|
9
19
|
```
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
```sh
|
|
22
|
+
npm install @vue-solana/nuxt @vue-solana/vue @vue-solana/core @solana/web3-compat
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Module Setup
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
export default defineNuxtConfig({
|
|
29
|
+
modules: ["@vue-solana/nuxt"],
|
|
30
|
+
solana: {
|
|
31
|
+
cluster: "devnet",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can also configure a custom RPC endpoint:
|
|
12
37
|
|
|
13
38
|
```ts
|
|
14
39
|
export default defineNuxtConfig({
|
|
15
|
-
modules: [
|
|
40
|
+
modules: ["@vue-solana/nuxt"],
|
|
16
41
|
solana: {
|
|
17
|
-
cluster:
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
cluster: "mainnet-beta",
|
|
43
|
+
endpoint: "https://your-rpc.example.com",
|
|
44
|
+
commitment: "confirmed",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Supported clusters are `mainnet-beta`, `devnet`, `testnet`, and `localnet`. Use `mainnet-beta` for Solana mainnet; this is Solana's official cluster name.
|
|
50
|
+
|
|
51
|
+
For development, use `devnet` and request free test SOL from the official faucet:
|
|
52
|
+
|
|
53
|
+
```txt
|
|
54
|
+
https://faucet.solana.com
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Auto-Imported Composables
|
|
58
|
+
|
|
59
|
+
The module auto-imports these composables from `@vue-solana/vue`:
|
|
60
|
+
|
|
61
|
+
- `useSolana()`
|
|
62
|
+
- `useSolanaRpc()`
|
|
63
|
+
- `useSolanaConnection()`
|
|
64
|
+
- `useSolanaWallet()`
|
|
65
|
+
- `useSolanaBalance()`
|
|
66
|
+
- `useSolanaSignAndSendTransaction()`
|
|
67
|
+
|
|
68
|
+
## Read RPC State
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
const { cluster, endpoint, status, latestBlockhash, checkConnection } = useSolanaRpc();
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<section>
|
|
77
|
+
<p>Cluster: {{ cluster }}</p>
|
|
78
|
+
<p>Endpoint: {{ endpoint }}</p>
|
|
79
|
+
<p>Status: {{ status }}</p>
|
|
80
|
+
<p>Latest blockhash: {{ latestBlockhash }}</p>
|
|
81
|
+
<button type="button" @click="checkConnection">Check RPC</button>
|
|
82
|
+
</section>
|
|
83
|
+
</template>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Read Balance
|
|
87
|
+
|
|
88
|
+
```vue
|
|
89
|
+
<script setup lang="ts">
|
|
90
|
+
const address = ref("PASTE_A_SOLANA_ADDRESS");
|
|
91
|
+
const { balance, loading, error, refresh } = useSolanaBalance(address);
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<section>
|
|
96
|
+
<p>Lamports: {{ balance }}</p>
|
|
97
|
+
<p v-if="loading">Loading...</p>
|
|
98
|
+
<pre v-if="error">{{ error }}</pre>
|
|
99
|
+
<button type="button" @click="refresh">Refresh</button>
|
|
100
|
+
</section>
|
|
101
|
+
</template>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Wallet State
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
const { publicKey, connected, connect, disconnect } = useSolanaWallet();
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<template>
|
|
112
|
+
<section>
|
|
113
|
+
<p>Connected: {{ connected }}</p>
|
|
114
|
+
<p>Public key: {{ publicKey?.toBase58() }}</p>
|
|
115
|
+
<button type="button" @click="connect">Connect</button>
|
|
116
|
+
<button type="button" @click="disconnect">Disconnect</button>
|
|
117
|
+
</section>
|
|
118
|
+
</template>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Browser wallet discovery is not included yet. Wallet actions work only after you configure a wallet object that implements `SolanaWallet`.
|
|
122
|
+
|
|
123
|
+
## Example App
|
|
124
|
+
|
|
125
|
+
This README includes small snippets for quick reference. For a complete runnable Nuxt flow, see the example app:
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
pnpm dev:nuxt
|
|
20
129
|
```
|
|
21
130
|
|
|
131
|
+
Source: [`examples/nuxt`](https://github.com/vue-solana/vue-solana/tree/main/examples/nuxt)
|
|
132
|
+
|
|
22
133
|
## Known TypeScript Issue
|
|
23
134
|
|
|
24
135
|
`@solana/web3-compat@0.0.21` currently has broken TypeScript metadata. Runtime imports still use the real package, but TypeScript consumers may need a local declaration shim.
|
|
25
136
|
|
|
26
|
-
|
|
137
|
+
If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts` to your app:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
declare module "@solana/web3-compat" {
|
|
141
|
+
export type { Commitment, SendOptions, TransactionSignature } from "@solana/web3.js";
|
|
142
|
+
export {
|
|
143
|
+
Connection,
|
|
144
|
+
Keypair,
|
|
145
|
+
PublicKey,
|
|
146
|
+
SystemProgram,
|
|
147
|
+
Transaction,
|
|
148
|
+
TransactionInstruction,
|
|
149
|
+
VersionedTransaction,
|
|
150
|
+
} from "@solana/web3.js";
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern that includes the shim.
|
|
155
|
+
|
|
156
|
+
## Status
|
|
157
|
+
|
|
158
|
+
This package is early-stage. RPC and balance reads are usable; first-class browser wallet adapter support is planned.
|
package/dist/module.cjs
CHANGED
|
@@ -24,7 +24,11 @@ const module$1 = kit.defineNuxtModule({
|
|
|
24
24
|
{ name: "useBalance", as: "useSolanaBalance", from: "@vue-solana/vue" },
|
|
25
25
|
{ name: "useConnection", as: "useSolanaConnection", from: "@vue-solana/vue" },
|
|
26
26
|
{ name: "useRpc", as: "useSolanaRpc", from: "@vue-solana/vue" },
|
|
27
|
-
{
|
|
27
|
+
{
|
|
28
|
+
name: "useSignAndSendTransaction",
|
|
29
|
+
as: "useSolanaSignAndSendTransaction",
|
|
30
|
+
from: "@vue-solana/vue"
|
|
31
|
+
},
|
|
28
32
|
{ name: "useSolana", as: "useSolana", from: "@vue-solana/vue" },
|
|
29
33
|
{ name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue" }
|
|
30
34
|
]);
|
package/dist/module.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const
|
|
4
|
+
type ModuleOptions = SolanaConfig;
|
|
5
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
6
|
+
declare const module$1: DefinedNuxtModule;
|
|
7
7
|
|
|
8
|
-
export =
|
|
8
|
+
export = module$1;
|
|
9
9
|
export type { ModuleOptions };
|
package/dist/module.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const
|
|
4
|
+
type ModuleOptions = SolanaConfig;
|
|
5
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
6
|
+
declare const module$1: DefinedNuxtModule;
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { module$1 as default };
|
|
9
9
|
export type { ModuleOptions };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const
|
|
4
|
+
type ModuleOptions = SolanaConfig;
|
|
5
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
6
|
+
declare const module$1: DefinedNuxtModule;
|
|
7
7
|
|
|
8
|
-
export =
|
|
8
|
+
export = module$1;
|
|
9
9
|
export type { ModuleOptions };
|
package/dist/module.mjs
CHANGED
|
@@ -21,7 +21,11 @@ const module$1 = defineNuxtModule({
|
|
|
21
21
|
{ name: "useBalance", as: "useSolanaBalance", from: "@vue-solana/vue" },
|
|
22
22
|
{ name: "useConnection", as: "useSolanaConnection", from: "@vue-solana/vue" },
|
|
23
23
|
{ name: "useRpc", as: "useSolanaRpc", from: "@vue-solana/vue" },
|
|
24
|
-
{
|
|
24
|
+
{
|
|
25
|
+
name: "useSignAndSendTransaction",
|
|
26
|
+
as: "useSolanaSignAndSendTransaction",
|
|
27
|
+
from: "@vue-solana/vue"
|
|
28
|
+
},
|
|
25
29
|
{ name: "useSolana", as: "useSolana", from: "@vue-solana/vue" },
|
|
26
30
|
{ name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue" }
|
|
27
31
|
]);
|
package/dist/runtime/plugin.cjs
CHANGED
|
@@ -5,13 +5,15 @@ const _app = require('#app');
|
|
|
5
5
|
|
|
6
6
|
const plugin = _app.defineNuxtPlugin((nuxtApp) => {
|
|
7
7
|
const config = _app.useRuntimeConfig().public.solana;
|
|
8
|
-
nuxtApp.vueApp.use(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
nuxtApp.vueApp.use(
|
|
9
|
+
vue.createSolanaPlugin({
|
|
10
|
+
cluster: config.cluster,
|
|
11
|
+
endpoint: config.endpoint,
|
|
12
|
+
wsEndpoint: config.wsEndpoint,
|
|
13
|
+
commitment: config.commitment,
|
|
14
|
+
autoConnect: config.autoConnect
|
|
15
|
+
})
|
|
16
|
+
);
|
|
15
17
|
});
|
|
16
18
|
|
|
17
19
|
module.exports = plugin;
|
package/dist/runtime/plugin.mjs
CHANGED
|
@@ -3,13 +3,15 @@ import { defineNuxtPlugin, useRuntimeConfig } from '#app';
|
|
|
3
3
|
|
|
4
4
|
const plugin = defineNuxtPlugin((nuxtApp) => {
|
|
5
5
|
const config = useRuntimeConfig().public.solana;
|
|
6
|
-
nuxtApp.vueApp.use(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
nuxtApp.vueApp.use(
|
|
7
|
+
createSolanaPlugin({
|
|
8
|
+
cluster: config.cluster,
|
|
9
|
+
endpoint: config.endpoint,
|
|
10
|
+
wsEndpoint: config.wsEndpoint,
|
|
11
|
+
commitment: config.commitment,
|
|
12
|
+
autoConnect: config.autoConnect
|
|
13
|
+
})
|
|
14
|
+
);
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
export { plugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-solana/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Nuxt module for Solana applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"web3",
|
|
12
12
|
"wallet"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://
|
|
14
|
+
"homepage": "https://vue-solana-docs.vercel.app/packages/nuxt",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/vue-solana/vue-solana/issues"
|
|
17
17
|
},
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vue-solana/core": "0.1.
|
|
42
|
-
"@vue-solana/vue": "0.1.
|
|
41
|
+
"@vue-solana/core": "0.1.2",
|
|
42
|
+
"@vue-solana/vue": "0.1.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@solana/web3-compat": "^0.0.21",
|
|
46
46
|
"nuxt": "^3.0.0 || ^4.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@nuxt/kit": "^
|
|
49
|
+
"@nuxt/kit": "^4.4.6",
|
|
50
50
|
"@solana/web3-compat": "^0.0.21",
|
|
51
|
-
"nuxt": "^
|
|
51
|
+
"nuxt": "^4.4.6",
|
|
52
52
|
"typescript": "^5.8.3",
|
|
53
53
|
"unbuild": "^3.5.0",
|
|
54
54
|
"vue": "^3.5.16"
|