@vue-solana/nuxt 0.1.0 → 0.1.2
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 +144 -2
- package/dist/module.d.cts +4 -3
- package/dist/module.d.mts +4 -3
- package/dist/module.d.ts +4 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,13 +2,27 @@
|
|
|
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
|
|
12
26
|
|
|
13
27
|
```ts
|
|
14
28
|
export default defineNuxtConfig({
|
|
@@ -19,8 +33,136 @@ export default defineNuxtConfig({
|
|
|
19
33
|
})
|
|
20
34
|
```
|
|
21
35
|
|
|
36
|
+
You can also configure a custom RPC endpoint:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
export default defineNuxtConfig({
|
|
40
|
+
modules: ['@vue-solana/nuxt'],
|
|
41
|
+
solana: {
|
|
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 {
|
|
73
|
+
cluster,
|
|
74
|
+
endpoint,
|
|
75
|
+
status,
|
|
76
|
+
latestBlockhash,
|
|
77
|
+
checkConnection
|
|
78
|
+
} = useSolanaRpc()
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<template>
|
|
82
|
+
<section>
|
|
83
|
+
<p>Cluster: {{ cluster }}</p>
|
|
84
|
+
<p>Endpoint: {{ endpoint }}</p>
|
|
85
|
+
<p>Status: {{ status }}</p>
|
|
86
|
+
<p>Latest blockhash: {{ latestBlockhash }}</p>
|
|
87
|
+
<button type="button" @click="checkConnection">Check RPC</button>
|
|
88
|
+
</section>
|
|
89
|
+
</template>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Read Balance
|
|
93
|
+
|
|
94
|
+
```vue
|
|
95
|
+
<script setup lang="ts">
|
|
96
|
+
const address = ref('PASTE_A_SOLANA_ADDRESS')
|
|
97
|
+
const { balance, loading, error, refresh } = useSolanaBalance(address)
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<template>
|
|
101
|
+
<section>
|
|
102
|
+
<p>Lamports: {{ balance }}</p>
|
|
103
|
+
<p v-if="loading">Loading...</p>
|
|
104
|
+
<pre v-if="error">{{ error }}</pre>
|
|
105
|
+
<button type="button" @click="refresh">Refresh</button>
|
|
106
|
+
</section>
|
|
107
|
+
</template>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Wallet State
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
const { publicKey, connected, connect, disconnect } = useSolanaWallet()
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<template>
|
|
118
|
+
<section>
|
|
119
|
+
<p>Connected: {{ connected }}</p>
|
|
120
|
+
<p>Public key: {{ publicKey?.toBase58() }}</p>
|
|
121
|
+
<button type="button" @click="connect">Connect</button>
|
|
122
|
+
<button type="button" @click="disconnect">Disconnect</button>
|
|
123
|
+
</section>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Browser wallet discovery is not included yet. Wallet actions work only after you configure a wallet object that implements `SolanaWallet`.
|
|
128
|
+
|
|
129
|
+
## Example App
|
|
130
|
+
|
|
131
|
+
This README includes small snippets for quick reference. For a complete runnable Nuxt flow, see the example app:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
pnpm dev:nuxt
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Source: [`examples/nuxt`](https://github.com/vue-solana/vue-solana/tree/main/examples/nuxt)
|
|
138
|
+
|
|
22
139
|
## Known TypeScript Issue
|
|
23
140
|
|
|
24
141
|
`@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
142
|
|
|
26
|
-
|
|
143
|
+
If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts` to your app:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
declare module '@solana/web3-compat' {
|
|
147
|
+
export type {
|
|
148
|
+
Commitment,
|
|
149
|
+
SendOptions,
|
|
150
|
+
TransactionSignature
|
|
151
|
+
} from '@solana/web3.js'
|
|
152
|
+
export {
|
|
153
|
+
Connection,
|
|
154
|
+
Keypair,
|
|
155
|
+
PublicKey,
|
|
156
|
+
SystemProgram,
|
|
157
|
+
Transaction,
|
|
158
|
+
TransactionInstruction,
|
|
159
|
+
VersionedTransaction
|
|
160
|
+
} from '@solana/web3.js'
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern that includes the shim.
|
|
165
|
+
|
|
166
|
+
## Status
|
|
167
|
+
|
|
168
|
+
This package is early-stage. RPC and balance reads are usable; first-class browser wallet adapter support is planned.
|
package/dist/module.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
4
|
interface ModuleOptions extends SolanaConfig {
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>['with']>;
|
|
7
|
+
declare const module$1: DefinedNuxtModule;
|
|
7
8
|
|
|
8
|
-
export =
|
|
9
|
+
export = module$1;
|
|
9
10
|
export type { ModuleOptions };
|
package/dist/module.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
4
|
interface ModuleOptions extends SolanaConfig {
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>['with']>;
|
|
7
|
+
declare const module$1: DefinedNuxtModule;
|
|
7
8
|
|
|
8
|
-
export {
|
|
9
|
+
export { module$1 as default };
|
|
9
10
|
export type { ModuleOptions };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
4
|
interface ModuleOptions extends SolanaConfig {
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>['with']>;
|
|
7
|
+
declare const module$1: DefinedNuxtModule;
|
|
7
8
|
|
|
8
|
-
export =
|
|
9
|
+
export = module$1;
|
|
9
10
|
export type { ModuleOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-solana/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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,8 +38,8 @@
|
|
|
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.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@solana/web3-compat": "^0.0.21",
|