@vue-solana/vue 0.1.2 → 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 CHANGED
@@ -25,25 +25,29 @@ npm install @vue-solana/vue @vue-solana/core @solana/web3-compat
25
25
  ## Plugin Setup
26
26
 
27
27
  ```ts
28
- import { createApp } from 'vue'
29
- import { createSolanaPlugin } from '@vue-solana/vue'
30
- import App from './App.vue'
28
+ import { createApp } from "vue";
29
+ import { createSolanaPlugin } from "@vue-solana/vue";
30
+ import App from "./App.vue";
31
31
 
32
32
  createApp(App)
33
- .use(createSolanaPlugin({
34
- cluster: 'devnet'
35
- }))
36
- .mount('#app')
33
+ .use(
34
+ createSolanaPlugin({
35
+ cluster: "devnet",
36
+ }),
37
+ )
38
+ .mount("#app");
37
39
  ```
38
40
 
39
41
  You can also pass a custom RPC endpoint:
40
42
 
41
43
  ```ts
42
- createApp(App).use(createSolanaPlugin({
43
- cluster: 'mainnet-beta',
44
- endpoint: 'https://your-rpc.example.com',
45
- commitment: 'confirmed'
46
- }))
44
+ createApp(App).use(
45
+ createSolanaPlugin({
46
+ cluster: "mainnet-beta",
47
+ endpoint: "https://your-rpc.example.com",
48
+ commitment: "confirmed",
49
+ }),
50
+ );
47
51
  ```
48
52
 
49
53
  Supported clusters are `mainnet-beta`, `devnet`, `testnet`, and `localnet`. Use `mainnet-beta` for Solana mainnet; this is Solana's official cluster name.
@@ -58,16 +62,9 @@ https://faucet.solana.com
58
62
 
59
63
  ```vue
60
64
  <script setup lang="ts">
61
- import { useRpc } from '@vue-solana/vue'
62
-
63
- const {
64
- cluster,
65
- endpoint,
66
- status,
67
- error,
68
- latestBlockhash,
69
- checkConnection
70
- } = useRpc()
65
+ import { useRpc } from "@vue-solana/vue";
66
+
67
+ const { cluster, endpoint, status, error, latestBlockhash, checkConnection } = useRpc();
71
68
  </script>
72
69
 
73
70
  <template>
@@ -86,11 +83,11 @@ const {
86
83
 
87
84
  ```vue
88
85
  <script setup lang="ts">
89
- import { ref } from 'vue'
90
- import { useBalance } from '@vue-solana/vue'
86
+ import { ref } from "vue";
87
+ import { useBalance } from "@vue-solana/vue";
91
88
 
92
- const address = ref('PASTE_A_SOLANA_ADDRESS')
93
- const { balance, loading, error, refresh } = useBalance(address)
89
+ const address = ref("PASTE_A_SOLANA_ADDRESS");
90
+ const { balance, loading, error, refresh } = useBalance(address);
94
91
  </script>
95
92
 
96
93
  <template>
@@ -107,9 +104,9 @@ const { balance, loading, error, refresh } = useBalance(address)
107
104
 
108
105
  ```vue
109
106
  <script setup lang="ts">
110
- import { useWallet } from '@vue-solana/vue'
107
+ import { useWallet } from "@vue-solana/vue";
111
108
 
112
- const { publicKey, connected, connecting, connect, disconnect } = useWallet()
109
+ const { publicKey, connected, connecting, connect, disconnect } = useWallet();
113
110
  </script>
114
111
 
115
112
  <template>
@@ -128,13 +125,13 @@ Browser wallet discovery is not included yet. `connect()` works only after you c
128
125
  ## Transaction State
129
126
 
130
127
  ```ts
131
- import { useSignAndSendTransaction } from '@vue-solana/vue'
128
+ import { useSignAndSendTransaction } from "@vue-solana/vue";
132
129
 
133
- const { signature, loading, error, execute } = useSignAndSendTransaction()
130
+ const { signature, loading, error, execute } = useSignAndSendTransaction();
134
131
 
135
132
  await execute(transaction, {
136
- skipPreflight: false
137
- })
133
+ skipPreflight: false,
134
+ });
138
135
  ```
139
136
 
140
137
  The current wallet must be connected and support either `signAndSendTransaction` or `signTransaction`.
@@ -168,12 +165,8 @@ Source: [`examples/vue-vite`](https://github.com/vue-solana/vue-solana/tree/main
168
165
  If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts` to your app:
169
166
 
170
167
  ```ts
171
- declare module '@solana/web3-compat' {
172
- export type {
173
- Commitment,
174
- SendOptions,
175
- TransactionSignature
176
- } from '@solana/web3.js'
168
+ declare module "@solana/web3-compat" {
169
+ export type { Commitment, SendOptions, TransactionSignature } from "@solana/web3.js";
177
170
  export {
178
171
  Connection,
179
172
  Keypair,
@@ -181,8 +174,8 @@ declare module '@solana/web3-compat' {
181
174
  SystemProgram,
182
175
  Transaction,
183
176
  TransactionInstruction,
184
- VersionedTransaction
185
- } from '@solana/web3.js'
177
+ VersionedTransaction,
178
+ } from "@solana/web3.js";
186
179
  }
187
180
  ```
188
181
 
package/dist/index.cjs CHANGED
@@ -56,9 +56,13 @@ function useBalance(address, commitment) {
56
56
  loading.value = false;
57
57
  }
58
58
  }
59
- vue.watch(() => vue.toValue(address), () => {
60
- void refresh();
61
- }, { immediate: true });
59
+ vue.watch(
60
+ () => vue.toValue(address),
61
+ () => {
62
+ void refresh().catch(() => void 0);
63
+ },
64
+ { immediate: true }
65
+ );
62
66
  return {
63
67
  balance,
64
68
  loading,
package/dist/index.d.cts CHANGED
@@ -50,7 +50,7 @@ declare function useWallet(): {
50
50
  disconnect: () => Promise<void>;
51
51
  };
52
52
 
53
- type SolanaConnectionStatus = 'idle' | 'checking' | 'connected' | 'error';
53
+ type SolanaConnectionStatus = "idle" | "checking" | "connected" | "error";
54
54
  interface VueSolanaContext extends SolanaContext {
55
55
  wallet: Ref<SolanaWallet | null>;
56
56
  status: Ref<SolanaConnectionStatus>;
package/dist/index.d.mts CHANGED
@@ -50,7 +50,7 @@ declare function useWallet(): {
50
50
  disconnect: () => Promise<void>;
51
51
  };
52
52
 
53
- type SolanaConnectionStatus = 'idle' | 'checking' | 'connected' | 'error';
53
+ type SolanaConnectionStatus = "idle" | "checking" | "connected" | "error";
54
54
  interface VueSolanaContext extends SolanaContext {
55
55
  wallet: Ref<SolanaWallet | null>;
56
56
  status: Ref<SolanaConnectionStatus>;
package/dist/index.d.ts CHANGED
@@ -50,7 +50,7 @@ declare function useWallet(): {
50
50
  disconnect: () => Promise<void>;
51
51
  };
52
52
 
53
- type SolanaConnectionStatus = 'idle' | 'checking' | 'connected' | 'error';
53
+ type SolanaConnectionStatus = "idle" | "checking" | "connected" | "error";
54
54
  interface VueSolanaContext extends SolanaContext {
55
55
  wallet: Ref<SolanaWallet | null>;
56
56
  status: Ref<SolanaConnectionStatus>;
package/dist/index.mjs CHANGED
@@ -54,9 +54,13 @@ function useBalance(address, commitment) {
54
54
  loading.value = false;
55
55
  }
56
56
  }
57
- watch(() => toValue(address), () => {
58
- void refresh();
59
- }, { immediate: true });
57
+ watch(
58
+ () => toValue(address),
59
+ () => {
60
+ void refresh().catch(() => void 0);
61
+ },
62
+ { immediate: true }
63
+ );
60
64
  return {
61
65
  balance,
62
66
  loading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Vue plugin and composables for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [