@vue-solana/nuxt 0.1.2 → 0.2.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 +36 -35
- package/dist/module.cjs +7 -2
- package/dist/module.d.cts +2 -3
- package/dist/module.d.mts +2 -3
- package/dist/module.d.ts +2 -3
- package/dist/module.mjs +7 -2
- package/dist/runtime/plugin.cjs +9 -7
- package/dist/runtime/plugin.mjs +9 -7
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ New to Solana? Start with the official docs and the project concepts guide:
|
|
|
9
9
|
- [Solana Documentation](https://solana.com/docs)
|
|
10
10
|
- [Solana RPC Methods](https://solana.com/docs/rpc)
|
|
11
11
|
- [Solana Clusters](https://solana.com/docs/references/clusters)
|
|
12
|
-
- [Vue Solana Concepts Guide](https://
|
|
13
|
-
- [`@vue-solana/nuxt` docs](https://
|
|
12
|
+
- [Vue Solana Concepts Guide](https://vue-solana-docs.vercel.app/concepts/solana-for-vue-developers)
|
|
13
|
+
- [`@vue-solana/nuxt` docs](https://vue-solana-docs.vercel.app/packages/nuxt)
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -26,24 +26,24 @@ npm install @vue-solana/nuxt @vue-solana/vue @vue-solana/core @solana/web3-compa
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
export default defineNuxtConfig({
|
|
29
|
-
modules: [
|
|
29
|
+
modules: ["@vue-solana/nuxt"],
|
|
30
30
|
solana: {
|
|
31
|
-
cluster:
|
|
32
|
-
}
|
|
33
|
-
})
|
|
31
|
+
cluster: "devnet",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
You can also configure a custom RPC endpoint:
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
39
|
export default defineNuxtConfig({
|
|
40
|
-
modules: [
|
|
40
|
+
modules: ["@vue-solana/nuxt"],
|
|
41
41
|
solana: {
|
|
42
|
-
cluster:
|
|
43
|
-
endpoint:
|
|
44
|
-
commitment:
|
|
45
|
-
}
|
|
46
|
-
})
|
|
42
|
+
cluster: "mainnet-beta",
|
|
43
|
+
endpoint: "https://your-rpc.example.com",
|
|
44
|
+
commitment: "confirmed",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Supported clusters are `mainnet-beta`, `devnet`, `testnet`, and `localnet`. Use `mainnet-beta` for Solana mainnet; this is Solana's official cluster name.
|
|
@@ -69,13 +69,7 @@ The module auto-imports these composables from `@vue-solana/vue`:
|
|
|
69
69
|
|
|
70
70
|
```vue
|
|
71
71
|
<script setup lang="ts">
|
|
72
|
-
const {
|
|
73
|
-
cluster,
|
|
74
|
-
endpoint,
|
|
75
|
-
status,
|
|
76
|
-
latestBlockhash,
|
|
77
|
-
checkConnection
|
|
78
|
-
} = useSolanaRpc()
|
|
72
|
+
const { cluster, endpoint, status, latestBlockhash, checkConnection } = useSolanaRpc();
|
|
79
73
|
</script>
|
|
80
74
|
|
|
81
75
|
<template>
|
|
@@ -93,8 +87,8 @@ const {
|
|
|
93
87
|
|
|
94
88
|
```vue
|
|
95
89
|
<script setup lang="ts">
|
|
96
|
-
const address = ref(
|
|
97
|
-
const { balance, loading, error, refresh } = useSolanaBalance(address)
|
|
90
|
+
const address = ref("PASTE_A_SOLANA_ADDRESS");
|
|
91
|
+
const { balance, loading, error, refresh } = useSolanaBalance(address);
|
|
98
92
|
</script>
|
|
99
93
|
|
|
100
94
|
<template>
|
|
@@ -111,20 +105,31 @@ const { balance, loading, error, refresh } = useSolanaBalance(address)
|
|
|
111
105
|
|
|
112
106
|
```vue
|
|
113
107
|
<script setup lang="ts">
|
|
114
|
-
const {
|
|
108
|
+
const { wallets, selectedWallet, selectWallet, refreshWallets } = useSolanaWallets();
|
|
109
|
+
const { publicKey, connected, connect, disconnect } = useSolanaWallet();
|
|
115
110
|
</script>
|
|
116
111
|
|
|
117
112
|
<template>
|
|
118
113
|
<section>
|
|
114
|
+
<button type="button" @click="refreshWallets">Refresh Wallets</button>
|
|
115
|
+
<button
|
|
116
|
+
v-for="wallet in wallets"
|
|
117
|
+
:key="wallet.name"
|
|
118
|
+
type="button"
|
|
119
|
+
@click="selectWallet(wallet)"
|
|
120
|
+
>
|
|
121
|
+
{{ wallet.name }}
|
|
122
|
+
</button>
|
|
123
|
+
<p>Selected: {{ selectedWallet?.name ?? "None" }}</p>
|
|
119
124
|
<p>Connected: {{ connected }}</p>
|
|
120
125
|
<p>Public key: {{ publicKey?.toBase58() }}</p>
|
|
121
|
-
<button type="button" @click="connect">Connect</button>
|
|
122
|
-
<button type="button" @click="disconnect">Disconnect</button>
|
|
126
|
+
<button type="button" :disabled="!selectedWallet || connected" @click="connect">Connect</button>
|
|
127
|
+
<button type="button" :disabled="!connected" @click="disconnect">Disconnect</button>
|
|
123
128
|
</section>
|
|
124
129
|
</template>
|
|
125
130
|
```
|
|
126
131
|
|
|
127
|
-
Browser
|
|
132
|
+
Browser wallets are discovered through the Solana Wallet Standard. Wallet actions work after selecting a discovered wallet or configuring a custom `SolanaWallet`.
|
|
128
133
|
|
|
129
134
|
## Example App
|
|
130
135
|
|
|
@@ -134,7 +139,7 @@ This README includes small snippets for quick reference. For a complete runnable
|
|
|
134
139
|
pnpm dev:nuxt
|
|
135
140
|
```
|
|
136
141
|
|
|
137
|
-
|
|
142
|
+
Docs: [`examples/nuxt`](https://vue-solana-docs.vercel.app/examples/nuxt)
|
|
138
143
|
|
|
139
144
|
## Known TypeScript Issue
|
|
140
145
|
|
|
@@ -143,12 +148,8 @@ Source: [`examples/nuxt`](https://github.com/vue-solana/vue-solana/tree/main/exa
|
|
|
143
148
|
If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts` to your app:
|
|
144
149
|
|
|
145
150
|
```ts
|
|
146
|
-
declare module
|
|
147
|
-
export type {
|
|
148
|
-
Commitment,
|
|
149
|
-
SendOptions,
|
|
150
|
-
TransactionSignature
|
|
151
|
-
} from '@solana/web3.js'
|
|
151
|
+
declare module "@solana/web3-compat" {
|
|
152
|
+
export type { Commitment, SendOptions, TransactionSignature } from "@solana/web3.js";
|
|
152
153
|
export {
|
|
153
154
|
Connection,
|
|
154
155
|
Keypair,
|
|
@@ -156,8 +157,8 @@ declare module '@solana/web3-compat' {
|
|
|
156
157
|
SystemProgram,
|
|
157
158
|
Transaction,
|
|
158
159
|
TransactionInstruction,
|
|
159
|
-
VersionedTransaction
|
|
160
|
-
} from
|
|
160
|
+
VersionedTransaction,
|
|
161
|
+
} from "@solana/web3.js";
|
|
161
162
|
}
|
|
162
163
|
```
|
|
163
164
|
|
|
@@ -165,4 +166,4 @@ Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern tha
|
|
|
165
166
|
|
|
166
167
|
## Status
|
|
167
168
|
|
|
168
|
-
This package is early-stage. RPC and
|
|
169
|
+
This package is early-stage. RPC, balance, wallet, and transaction composables are usable in Nuxt apps.
|
package/dist/module.cjs
CHANGED
|
@@ -24,9 +24,14 @@ 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
|
-
{ name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue" }
|
|
33
|
+
{ name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue" },
|
|
34
|
+
{ name: "useWallets", as: "useSolanaWallets", from: "@vue-solana/vue" }
|
|
30
35
|
]);
|
|
31
36
|
}
|
|
32
37
|
});
|
package/dist/module.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>['with']>;
|
|
4
|
+
type ModuleOptions = SolanaConfig;
|
|
5
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
7
6
|
declare const module$1: DefinedNuxtModule;
|
|
8
7
|
|
|
9
8
|
export = module$1;
|
package/dist/module.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>['with']>;
|
|
4
|
+
type ModuleOptions = SolanaConfig;
|
|
5
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
7
6
|
declare const module$1: DefinedNuxtModule;
|
|
8
7
|
|
|
9
8
|
export { module$1 as default };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { SolanaConfig } from '@vue-solana/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>['with']>;
|
|
4
|
+
type ModuleOptions = SolanaConfig;
|
|
5
|
+
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
7
6
|
declare const module$1: DefinedNuxtModule;
|
|
8
7
|
|
|
9
8
|
export = module$1;
|
package/dist/module.mjs
CHANGED
|
@@ -21,9 +21,14 @@ 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
|
-
{ name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue" }
|
|
30
|
+
{ name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue" },
|
|
31
|
+
{ name: "useWallets", as: "useSolanaWallets", from: "@vue-solana/vue" }
|
|
27
32
|
]);
|
|
28
33
|
}
|
|
29
34
|
});
|
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.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Nuxt module for Solana applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vue-solana/
|
|
42
|
-
"@vue-solana/
|
|
41
|
+
"@vue-solana/vue": "0.2.0",
|
|
42
|
+
"@vue-solana/core": "0.2.0"
|
|
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"
|