@vue-solana/nuxt 0.5.1 → 0.6.1

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 CHANGED
@@ -2,7 +2,7 @@
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.
5
+ Use this package in Nuxt apps that need the Vue Solana plugin installed automatically plus auto-imported composables for RPC, wallet state, message signing, and transactions.
6
6
 
7
7
  New to Solana? Start with the official docs and the project concepts guide:
8
8
 
@@ -72,6 +72,7 @@ The module auto-imports these composables from direct `@vue-solana/vue/*` subpat
72
72
  - `useSolanaProgramAccounts()`
73
73
  - `useSolanaTransactionConfirmation()`
74
74
  - `useSolanaSignatureStatus()`
75
+ - `useSolanaSignMessage()`
75
76
  - `useSolanaSignAndSendTransaction()`
76
77
 
77
78
  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.
@@ -138,7 +139,7 @@ Use `useSolanaProgramAccounts()` carefully on public RPC nodes. Prefer narrow fi
138
139
  ```vue
139
140
  <script setup lang="ts">
140
141
  const { wallets, selectedWallet, selectWallet, refreshWallets } = useSolanaWallets();
141
- const { publicKey, connected, connect, disconnect } = useSolanaWallet();
142
+ const { publicKey, connected, canSignMessage, connect, disconnect } = useSolanaWallet();
142
143
  </script>
143
144
 
144
145
  <template>
@@ -155,6 +156,7 @@ const { publicKey, connected, connect, disconnect } = useSolanaWallet();
155
156
  <p>Selected: {{ selectedWallet?.name ?? "None" }}</p>
156
157
  <p>Connected: {{ connected }}</p>
157
158
  <p>Public key: {{ publicKey?.toBase58() }}</p>
159
+ <p>Can sign messages: {{ canSignMessage }}</p>
158
160
  <button type="button" :disabled="!selectedWallet || connected" @click="connect">Connect</button>
159
161
  <button type="button" :disabled="!connected" @click="disconnect">Disconnect</button>
160
162
  </section>
@@ -165,6 +167,33 @@ Browser extension wallets are discovered through the Solana Wallet Standard. And
165
167
 
166
168
  Selected discovered wallets are persisted under `localStorage["vue-solana:selected-wallet"]` as non-sensitive identity metadata: `name`, and `platform`/`source` when available. On reload, Vue Solana restores the selected wallet if the same wallet is discovered again. Set `solana.autoConnect: true` to opt into calling `connect()` for that restored wallet; arbitrary installed wallets are never auto-connected. Calling `selectWallet(null)` or `setWallet(customWallet)` clears the stored selection.
167
169
 
170
+ ## Message Signing
171
+
172
+ ```vue
173
+ <script setup lang="ts">
174
+ const { connected, canSignMessage } = useSolanaWallet();
175
+ const { signature, status, error, execute } = useSolanaSignMessage();
176
+
177
+ async function signIn() {
178
+ const message = new TextEncoder().encode("Sign in to My Nuxt Solana App");
179
+ await execute(message);
180
+ }
181
+ </script>
182
+
183
+ <template>
184
+ <section>
185
+ <button type="button" :disabled="!connected || !canSignMessage" @click="signIn">
186
+ Sign message
187
+ </button>
188
+ <p>Status: {{ status }}</p>
189
+ <p v-if="signature">Signature bytes: {{ signature.length }}</p>
190
+ <pre v-if="error">{{ error.message }}</pre>
191
+ </section>
192
+ </template>
193
+ ```
194
+
195
+ 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.
196
+
168
197
  ## Example App
169
198
 
170
199
  This README includes small snippets for quick reference. For a complete runnable Nuxt flow, see the example app:
@@ -220,4 +249,4 @@ Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern tha
220
249
 
221
250
  ## Status
222
251
 
223
- This package is early-stage. RPC, balance, browser extension wallet, Android mobile wallet, and transaction composables are usable in Nuxt apps.
252
+ This package is early-stage. RPC, balance, browser extension wallet, Android mobile wallet, iOS browser wallet, message signing, and transaction composables are usable in Nuxt apps.
package/dist/module.cjs CHANGED
@@ -3,6 +3,26 @@
3
3
  const kit = require('@nuxt/kit');
4
4
 
5
5
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
6
+ const SOLANA_COMPOSABLE_IMPORTS = [
7
+ ["useAccountInfo", "useSolanaAccountInfo"],
8
+ ["useBalance", "useSolanaBalance"],
9
+ ["useConnection", "useSolanaConnection"],
10
+ ["useProgramAccounts", "useSolanaProgramAccounts"],
11
+ ["useRpc", "useSolanaRpc"],
12
+ ["useSignMessage", "useSolanaSignMessage"],
13
+ ["useSignAndSendTransaction", "useSolanaSignAndSendTransaction"],
14
+ ["useSignatureStatus", "useSolanaSignatureStatus"],
15
+ ["useSolana", "useSolana"],
16
+ ["useTransactionConfirmation", "useSolanaTransactionConfirmation"],
17
+ ["useWallet", "useSolanaWallet"],
18
+ ["useWallets", "useSolanaWallets"]
19
+ ];
20
+ const SOLANA_IMPORTS = SOLANA_COMPOSABLE_IMPORTS.map(([name, as]) => ({
21
+ name,
22
+ as,
23
+ from: `@vue-solana/vue/${name}`
24
+ }));
25
+
6
26
  const VITE_OPTIMIZE_DEPS = [
7
27
  "@solana/web3-compat",
8
28
  "@solana/web3.js",
@@ -50,39 +70,7 @@ const module$1 = kit.defineNuxtModule({
50
70
  src: resolver.resolve("./runtime/plugin"),
51
71
  mode: "client"
52
72
  });
53
- kit.addImports([
54
- {
55
- name: "useAccountInfo",
56
- as: "useSolanaAccountInfo",
57
- from: "@vue-solana/vue/useAccountInfo"
58
- },
59
- { name: "useBalance", as: "useSolanaBalance", from: "@vue-solana/vue/useBalance" },
60
- { name: "useConnection", as: "useSolanaConnection", from: "@vue-solana/vue/useConnection" },
61
- {
62
- name: "useProgramAccounts",
63
- as: "useSolanaProgramAccounts",
64
- from: "@vue-solana/vue/useProgramAccounts"
65
- },
66
- { name: "useRpc", as: "useSolanaRpc", from: "@vue-solana/vue/useRpc" },
67
- {
68
- name: "useSignAndSendTransaction",
69
- as: "useSolanaSignAndSendTransaction",
70
- from: "@vue-solana/vue/useSignAndSendTransaction"
71
- },
72
- {
73
- name: "useSignatureStatus",
74
- as: "useSolanaSignatureStatus",
75
- from: "@vue-solana/vue/useSignatureStatus"
76
- },
77
- { name: "useSolana", as: "useSolana", from: "@vue-solana/vue/useSolana" },
78
- {
79
- name: "useTransactionConfirmation",
80
- as: "useSolanaTransactionConfirmation",
81
- from: "@vue-solana/vue/useTransactionConfirmation"
82
- },
83
- { name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue/useWallet" },
84
- { name: "useWallets", as: "useSolanaWallets", from: "@vue-solana/vue/useWallets" }
85
- ]);
73
+ kit.addImports(SOLANA_IMPORTS);
86
74
  }
87
75
  });
88
76
  function toPublicSolanaConfig(options) {
package/dist/module.mjs CHANGED
@@ -1,5 +1,25 @@
1
1
  import { defineNuxtModule, createResolver, addPlugin, addImports } from '@nuxt/kit';
2
2
 
3
+ const SOLANA_COMPOSABLE_IMPORTS = [
4
+ ["useAccountInfo", "useSolanaAccountInfo"],
5
+ ["useBalance", "useSolanaBalance"],
6
+ ["useConnection", "useSolanaConnection"],
7
+ ["useProgramAccounts", "useSolanaProgramAccounts"],
8
+ ["useRpc", "useSolanaRpc"],
9
+ ["useSignMessage", "useSolanaSignMessage"],
10
+ ["useSignAndSendTransaction", "useSolanaSignAndSendTransaction"],
11
+ ["useSignatureStatus", "useSolanaSignatureStatus"],
12
+ ["useSolana", "useSolana"],
13
+ ["useTransactionConfirmation", "useSolanaTransactionConfirmation"],
14
+ ["useWallet", "useSolanaWallet"],
15
+ ["useWallets", "useSolanaWallets"]
16
+ ];
17
+ const SOLANA_IMPORTS = SOLANA_COMPOSABLE_IMPORTS.map(([name, as]) => ({
18
+ name,
19
+ as,
20
+ from: `@vue-solana/vue/${name}`
21
+ }));
22
+
3
23
  const VITE_OPTIMIZE_DEPS = [
4
24
  "@solana/web3-compat",
5
25
  "@solana/web3.js",
@@ -47,39 +67,7 @@ const module$1 = defineNuxtModule({
47
67
  src: resolver.resolve("./runtime/plugin"),
48
68
  mode: "client"
49
69
  });
50
- addImports([
51
- {
52
- name: "useAccountInfo",
53
- as: "useSolanaAccountInfo",
54
- from: "@vue-solana/vue/useAccountInfo"
55
- },
56
- { name: "useBalance", as: "useSolanaBalance", from: "@vue-solana/vue/useBalance" },
57
- { name: "useConnection", as: "useSolanaConnection", from: "@vue-solana/vue/useConnection" },
58
- {
59
- name: "useProgramAccounts",
60
- as: "useSolanaProgramAccounts",
61
- from: "@vue-solana/vue/useProgramAccounts"
62
- },
63
- { name: "useRpc", as: "useSolanaRpc", from: "@vue-solana/vue/useRpc" },
64
- {
65
- name: "useSignAndSendTransaction",
66
- as: "useSolanaSignAndSendTransaction",
67
- from: "@vue-solana/vue/useSignAndSendTransaction"
68
- },
69
- {
70
- name: "useSignatureStatus",
71
- as: "useSolanaSignatureStatus",
72
- from: "@vue-solana/vue/useSignatureStatus"
73
- },
74
- { name: "useSolana", as: "useSolana", from: "@vue-solana/vue/useSolana" },
75
- {
76
- name: "useTransactionConfirmation",
77
- as: "useSolanaTransactionConfirmation",
78
- from: "@vue-solana/vue/useTransactionConfirmation"
79
- },
80
- { name: "useWallet", as: "useSolanaWallet", from: "@vue-solana/vue/useWallet" },
81
- { name: "useWallets", as: "useSolanaWallets", from: "@vue-solana/vue/useWallets" }
82
- ]);
70
+ addImports(SOLANA_IMPORTS);
83
71
  }
84
72
  });
85
73
  function toPublicSolanaConfig(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/nuxt",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Nuxt module for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -38,8 +38,8 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@vue-solana/core": "0.5.1",
42
- "@vue-solana/vue": "0.6.1"
41
+ "@vue-solana/core": "0.7.0",
42
+ "@vue-solana/vue": "0.8.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@solana/web3-compat": "^0.0.21",