@vue-solana/vue 0.1.3 → 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 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://github.com/vue-solana/vue-solana/tree/main/apps/docs/content/concepts/solana-for-vue-developers.md)
13
- - [`@vue-solana/vue` docs](https://github.com/vue-solana/vue-solana/tree/main/apps/docs/content/packages/vue.md)
12
+ - [Vue Solana Concepts Guide](https://vue-solana-docs.vercel.app/concepts/solana-for-vue-developers)
13
+ - [`@vue-solana/vue` docs](https://vue-solana-docs.vercel.app/packages/vue)
14
14
 
15
15
  ## Install
16
16
 
@@ -104,23 +104,36 @@ const { balance, loading, error, refresh } = useBalance(address);
104
104
 
105
105
  ```vue
106
106
  <script setup lang="ts">
107
- import { useWallet } from "@vue-solana/vue";
107
+ import { useWallet, useWallets } from "@vue-solana/vue";
108
108
 
109
+ const { wallets, selectedWallet, selectWallet, refreshWallets } = useWallets();
109
110
  const { publicKey, connected, connecting, connect, disconnect } = useWallet();
110
111
  </script>
111
112
 
112
113
  <template>
113
114
  <section>
115
+ <button type="button" @click="refreshWallets">Refresh Wallets</button>
116
+ <button
117
+ v-for="wallet in wallets"
118
+ :key="wallet.name"
119
+ type="button"
120
+ @click="selectWallet(wallet)"
121
+ >
122
+ {{ wallet.name }}
123
+ </button>
124
+ <p>Selected: {{ selectedWallet?.name ?? "None" }}</p>
114
125
  <p>Connected: {{ connected }}</p>
115
126
  <p>Public key: {{ publicKey?.toBase58() }}</p>
116
127
  <p v-if="connecting">Connecting...</p>
117
- <button type="button" @click="connect">Connect</button>
118
- <button type="button" @click="disconnect">Disconnect</button>
128
+ <button type="button" :disabled="!selectedWallet || connected || connecting" @click="connect">
129
+ Connect
130
+ </button>
131
+ <button type="button" :disabled="!connected" @click="disconnect">Disconnect</button>
119
132
  </section>
120
133
  </template>
121
134
  ```
122
135
 
123
- Browser wallet discovery is not included yet. `connect()` works only after you configure a wallet object that implements `SolanaWallet`.
136
+ Browser wallets are discovered through the Solana Wallet Standard. `connect()` works after selecting a discovered wallet or configuring a custom `SolanaWallet`.
124
137
 
125
138
  ## Transaction State
126
139
 
@@ -144,7 +157,7 @@ This README includes small snippets for quick reference. For a complete runnable
144
157
  pnpm dev:vue
145
158
  ```
146
159
 
147
- Source: [`examples/vue-vite`](https://github.com/vue-solana/vue-solana/tree/main/examples/vue-vite)
160
+ Docs: [`examples/vue-vite`](https://vue-solana-docs.vercel.app/examples/vue-vite)
148
161
 
149
162
  ## API
150
163
 
@@ -183,4 +196,4 @@ Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern tha
183
196
 
184
197
  ## Status
185
198
 
186
- This package is early-stage. RPC and balance reads are usable; first-class browser wallet adapter support is planned.
199
+ This package is early-stage. RPC, balance, wallet, and transaction composables are usable.
package/dist/index.cjs CHANGED
@@ -74,14 +74,63 @@ function useBalance(address, commitment) {
74
74
  function useWallet() {
75
75
  const solana = useSolana();
76
76
  const wallet = solana.wallet;
77
+ const connecting = vue.ref(false);
78
+ const disconnecting = vue.ref(false);
79
+ async function connect() {
80
+ const activeWallet = wallet.value;
81
+ if (!activeWallet) {
82
+ throw new Error("No Solana wallet is configured");
83
+ }
84
+ connecting.value = true;
85
+ try {
86
+ const connection = activeWallet.connect();
87
+ vue.triggerRef(wallet);
88
+ await connection;
89
+ vue.triggerRef(wallet);
90
+ console.info("[Vue Solana] Wallet connected", {
91
+ publicKey: activeWallet.publicKey?.toBase58() ?? null
92
+ });
93
+ } catch (error) {
94
+ vue.triggerRef(wallet);
95
+ console.error("[Vue Solana] Wallet connection failed", error);
96
+ throw error;
97
+ } finally {
98
+ connecting.value = false;
99
+ }
100
+ }
101
+ async function disconnect() {
102
+ const activeWallet = wallet.value;
103
+ if (!activeWallet) {
104
+ return;
105
+ }
106
+ const publicKey = activeWallet.publicKey?.toBase58() ?? null;
107
+ disconnecting.value = true;
108
+ try {
109
+ await activeWallet.disconnect();
110
+ vue.triggerRef(wallet);
111
+ console.info("[Vue Solana] Wallet disconnected", { publicKey });
112
+ } catch (error) {
113
+ vue.triggerRef(wallet);
114
+ console.error("[Vue Solana] Wallet disconnection failed", error);
115
+ throw error;
116
+ } finally {
117
+ disconnecting.value = false;
118
+ }
119
+ }
120
+ const isConnecting = vue.computed(() => Boolean(connecting.value || wallet.value?.connecting));
121
+ const isDisconnecting = vue.computed(
122
+ () => Boolean(disconnecting.value || wallet.value?.disconnecting)
123
+ );
77
124
  return {
78
125
  wallet,
79
126
  publicKey: vue.computed(() => wallet.value?.publicKey ?? null),
80
127
  connected: vue.computed(() => Boolean(wallet.value?.connected && wallet.value.publicKey)),
81
- connecting: vue.computed(() => Boolean(wallet.value?.connecting)),
128
+ connecting: isConnecting,
129
+ disconnecting: isDisconnecting,
130
+ loading: vue.computed(() => isConnecting.value || isDisconnecting.value),
82
131
  setWallet: solana.setWallet,
83
- connect: () => wallet.value?.connect() ?? Promise.reject(new Error("No Solana wallet is configured")),
84
- disconnect: () => wallet.value?.disconnect() ?? Promise.resolve()
132
+ connect,
133
+ disconnect
85
134
  };
86
135
  }
87
136
 
@@ -121,14 +170,27 @@ function useSignAndSendTransaction() {
121
170
  });
122
171
  }
123
172
 
173
+ function useWallets() {
174
+ const solana = useSolana();
175
+ return {
176
+ wallets: solana.wallets,
177
+ selectedWallet: solana.selectedWallet,
178
+ refreshWallets: solana.refreshWallets,
179
+ selectWallet: solana.selectWallet
180
+ };
181
+ }
182
+
124
183
  function createSolanaPlugin(options = {}) {
125
184
  return {
126
185
  install(app) {
127
186
  const context = core.createSolanaContext(options);
128
187
  const wallet = vue.shallowRef(options.wallet ?? null);
188
+ const wallets = vue.shallowRef([]);
189
+ const selectedWallet = vue.shallowRef(null);
129
190
  const status = vue.ref("idle");
130
191
  const error = vue.ref(null);
131
192
  const latestBlockhash = vue.ref(null);
193
+ let unsubscribeWallets = null;
132
194
  async function checkConnection() {
133
195
  status.value = "checking";
134
196
  error.value = null;
@@ -153,14 +215,36 @@ function createSolanaPlugin(options = {}) {
153
215
  console.error("[Vue Solana] Connection failed", cause);
154
216
  }
155
217
  }
218
+ function refreshWallets() {
219
+ unsubscribeWallets ??= core.subscribeSolanaWallets(refreshWallets);
220
+ wallets.value = core.getRegisteredSolanaWallets();
221
+ if (selectedWallet.value) {
222
+ selectedWallet.value = wallets.value.find((nextWallet) => nextWallet.name === selectedWallet.value?.name) ?? null;
223
+ if (!selectedWallet.value) {
224
+ wallet.value = options.wallet ?? null;
225
+ }
226
+ }
227
+ }
228
+ function selectWallet(nextWallet) {
229
+ selectedWallet.value = nextWallet;
230
+ wallet.value = nextWallet ? core.adaptSolanaStandardWallet(nextWallet, {
231
+ chain: core.getSolanaChain(context.cluster),
232
+ onChange: () => vue.triggerRef(wallet)
233
+ }) : options.wallet ?? null;
234
+ }
156
235
  const vueContext = {
157
236
  ...context,
158
237
  wallet,
159
238
  status,
160
239
  error,
161
240
  latestBlockhash,
241
+ wallets,
242
+ selectedWallet,
162
243
  checkConnection,
244
+ refreshWallets,
245
+ selectWallet,
163
246
  setWallet(nextWallet) {
247
+ selectedWallet.value = null;
164
248
  wallet.value = nextWallet;
165
249
  }
166
250
  };
@@ -181,3 +265,4 @@ exports.useSignAndSendTransaction = useSignAndSendTransaction;
181
265
  exports.useSolana = useSolana;
182
266
  exports.useTransaction = useTransaction;
183
267
  exports.useWallet = useWallet;
268
+ exports.useWallets = useWallets;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import * as vue from 'vue';
2
2
  import { MaybeRefOrGetter, Ref, InjectionKey, App } from 'vue';
3
3
  import { PublicKey, Commitment, TransactionSignature } from '@solana/web3-compat';
4
4
  import * as _vue_solana_core from '@vue-solana/core';
5
- import { SendTransactionOptions, SolanaContext, SolanaWallet, SolanaConfig } from '@vue-solana/core';
5
+ import { SendTransactionOptions, SolanaContext, SolanaWallet, SolanaWalletInfo, SolanaConfig } from '@vue-solana/core';
6
6
 
7
7
  declare function useBalance(address: MaybeRefOrGetter<PublicKey | string | null | undefined>, commitment?: Commitment): {
8
8
  balance: vue.Ref<number | null, number | null>;
@@ -45,19 +45,32 @@ declare function useWallet(): {
45
45
  publicKey: vue.ComputedRef<any>;
46
46
  connected: vue.ComputedRef<boolean>;
47
47
  connecting: vue.ComputedRef<boolean>;
48
+ disconnecting: vue.ComputedRef<boolean>;
49
+ loading: vue.ComputedRef<boolean>;
48
50
  setWallet: (wallet: _vue_solana_core.SolanaWallet | null) => void;
49
51
  connect: () => Promise<void>;
50
52
  disconnect: () => Promise<void>;
51
53
  };
52
54
 
55
+ declare function useWallets(): {
56
+ wallets: vue.Ref<_vue_solana_core.SolanaWalletInfo[], _vue_solana_core.SolanaWalletInfo[]>;
57
+ selectedWallet: vue.Ref<_vue_solana_core.SolanaWalletInfo | null, _vue_solana_core.SolanaWalletInfo | null>;
58
+ refreshWallets: () => void;
59
+ selectWallet: (wallet: _vue_solana_core.SolanaWalletInfo | null) => void;
60
+ };
61
+
53
62
  type SolanaConnectionStatus = "idle" | "checking" | "connected" | "error";
54
63
  interface VueSolanaContext extends SolanaContext {
55
64
  wallet: Ref<SolanaWallet | null>;
56
65
  status: Ref<SolanaConnectionStatus>;
57
66
  error: Ref<string | null>;
58
67
  latestBlockhash: Ref<string | null>;
68
+ wallets: Ref<SolanaWalletInfo[]>;
69
+ selectedWallet: Ref<SolanaWalletInfo | null>;
59
70
  checkConnection: () => Promise<void>;
60
71
  setWallet: (wallet: SolanaWallet | null) => void;
72
+ refreshWallets: () => void;
73
+ selectWallet: (wallet: SolanaWalletInfo | null) => void;
61
74
  }
62
75
  declare const solanaInjectionKey: InjectionKey<VueSolanaContext>;
63
76
 
@@ -69,5 +82,5 @@ declare function createSolanaPlugin(options?: VueSolanaPluginOptions): {
69
82
  };
70
83
  declare const VueSolana: typeof createSolanaPlugin;
71
84
 
72
- export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet };
85
+ export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet, useWallets };
73
86
  export type { SolanaConnectionStatus, VueSolanaContext, VueSolanaPluginOptions };
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import * as vue from 'vue';
2
2
  import { MaybeRefOrGetter, Ref, InjectionKey, App } from 'vue';
3
3
  import { PublicKey, Commitment, TransactionSignature } from '@solana/web3-compat';
4
4
  import * as _vue_solana_core from '@vue-solana/core';
5
- import { SendTransactionOptions, SolanaContext, SolanaWallet, SolanaConfig } from '@vue-solana/core';
5
+ import { SendTransactionOptions, SolanaContext, SolanaWallet, SolanaWalletInfo, SolanaConfig } from '@vue-solana/core';
6
6
 
7
7
  declare function useBalance(address: MaybeRefOrGetter<PublicKey | string | null | undefined>, commitment?: Commitment): {
8
8
  balance: vue.Ref<number | null, number | null>;
@@ -45,19 +45,32 @@ declare function useWallet(): {
45
45
  publicKey: vue.ComputedRef<any>;
46
46
  connected: vue.ComputedRef<boolean>;
47
47
  connecting: vue.ComputedRef<boolean>;
48
+ disconnecting: vue.ComputedRef<boolean>;
49
+ loading: vue.ComputedRef<boolean>;
48
50
  setWallet: (wallet: _vue_solana_core.SolanaWallet | null) => void;
49
51
  connect: () => Promise<void>;
50
52
  disconnect: () => Promise<void>;
51
53
  };
52
54
 
55
+ declare function useWallets(): {
56
+ wallets: vue.Ref<_vue_solana_core.SolanaWalletInfo[], _vue_solana_core.SolanaWalletInfo[]>;
57
+ selectedWallet: vue.Ref<_vue_solana_core.SolanaWalletInfo | null, _vue_solana_core.SolanaWalletInfo | null>;
58
+ refreshWallets: () => void;
59
+ selectWallet: (wallet: _vue_solana_core.SolanaWalletInfo | null) => void;
60
+ };
61
+
53
62
  type SolanaConnectionStatus = "idle" | "checking" | "connected" | "error";
54
63
  interface VueSolanaContext extends SolanaContext {
55
64
  wallet: Ref<SolanaWallet | null>;
56
65
  status: Ref<SolanaConnectionStatus>;
57
66
  error: Ref<string | null>;
58
67
  latestBlockhash: Ref<string | null>;
68
+ wallets: Ref<SolanaWalletInfo[]>;
69
+ selectedWallet: Ref<SolanaWalletInfo | null>;
59
70
  checkConnection: () => Promise<void>;
60
71
  setWallet: (wallet: SolanaWallet | null) => void;
72
+ refreshWallets: () => void;
73
+ selectWallet: (wallet: SolanaWalletInfo | null) => void;
61
74
  }
62
75
  declare const solanaInjectionKey: InjectionKey<VueSolanaContext>;
63
76
 
@@ -69,5 +82,5 @@ declare function createSolanaPlugin(options?: VueSolanaPluginOptions): {
69
82
  };
70
83
  declare const VueSolana: typeof createSolanaPlugin;
71
84
 
72
- export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet };
85
+ export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet, useWallets };
73
86
  export type { SolanaConnectionStatus, VueSolanaContext, VueSolanaPluginOptions };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as vue from 'vue';
2
2
  import { MaybeRefOrGetter, Ref, InjectionKey, App } from 'vue';
3
3
  import { PublicKey, Commitment, TransactionSignature } from '@solana/web3-compat';
4
4
  import * as _vue_solana_core from '@vue-solana/core';
5
- import { SendTransactionOptions, SolanaContext, SolanaWallet, SolanaConfig } from '@vue-solana/core';
5
+ import { SendTransactionOptions, SolanaContext, SolanaWallet, SolanaWalletInfo, SolanaConfig } from '@vue-solana/core';
6
6
 
7
7
  declare function useBalance(address: MaybeRefOrGetter<PublicKey | string | null | undefined>, commitment?: Commitment): {
8
8
  balance: vue.Ref<number | null, number | null>;
@@ -45,19 +45,32 @@ declare function useWallet(): {
45
45
  publicKey: vue.ComputedRef<any>;
46
46
  connected: vue.ComputedRef<boolean>;
47
47
  connecting: vue.ComputedRef<boolean>;
48
+ disconnecting: vue.ComputedRef<boolean>;
49
+ loading: vue.ComputedRef<boolean>;
48
50
  setWallet: (wallet: _vue_solana_core.SolanaWallet | null) => void;
49
51
  connect: () => Promise<void>;
50
52
  disconnect: () => Promise<void>;
51
53
  };
52
54
 
55
+ declare function useWallets(): {
56
+ wallets: vue.Ref<_vue_solana_core.SolanaWalletInfo[], _vue_solana_core.SolanaWalletInfo[]>;
57
+ selectedWallet: vue.Ref<_vue_solana_core.SolanaWalletInfo | null, _vue_solana_core.SolanaWalletInfo | null>;
58
+ refreshWallets: () => void;
59
+ selectWallet: (wallet: _vue_solana_core.SolanaWalletInfo | null) => void;
60
+ };
61
+
53
62
  type SolanaConnectionStatus = "idle" | "checking" | "connected" | "error";
54
63
  interface VueSolanaContext extends SolanaContext {
55
64
  wallet: Ref<SolanaWallet | null>;
56
65
  status: Ref<SolanaConnectionStatus>;
57
66
  error: Ref<string | null>;
58
67
  latestBlockhash: Ref<string | null>;
68
+ wallets: Ref<SolanaWalletInfo[]>;
69
+ selectedWallet: Ref<SolanaWalletInfo | null>;
59
70
  checkConnection: () => Promise<void>;
60
71
  setWallet: (wallet: SolanaWallet | null) => void;
72
+ refreshWallets: () => void;
73
+ selectWallet: (wallet: SolanaWalletInfo | null) => void;
61
74
  }
62
75
  declare const solanaInjectionKey: InjectionKey<VueSolanaContext>;
63
76
 
@@ -69,5 +82,5 @@ declare function createSolanaPlugin(options?: VueSolanaPluginOptions): {
69
82
  };
70
83
  declare const VueSolana: typeof createSolanaPlugin;
71
84
 
72
- export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet };
85
+ export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet, useWallets };
73
86
  export type { SolanaConnectionStatus, VueSolanaContext, VueSolanaPluginOptions };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PublicKey } from '@solana/web3-compat';
2
- import { inject, computed, ref, watch, toValue, shallowRef } from 'vue';
3
- import { signAndSendTransaction, createSolanaContext } from '@vue-solana/core';
2
+ import { inject, computed, ref, watch, toValue, triggerRef, shallowRef } from 'vue';
3
+ import { signAndSendTransaction, createSolanaContext, adaptSolanaStandardWallet, getSolanaChain, subscribeSolanaWallets, getRegisteredSolanaWallets } from '@vue-solana/core';
4
4
 
5
5
  const solanaInjectionKey = Symbol("VueSolana");
6
6
 
@@ -72,14 +72,63 @@ function useBalance(address, commitment) {
72
72
  function useWallet() {
73
73
  const solana = useSolana();
74
74
  const wallet = solana.wallet;
75
+ const connecting = ref(false);
76
+ const disconnecting = ref(false);
77
+ async function connect() {
78
+ const activeWallet = wallet.value;
79
+ if (!activeWallet) {
80
+ throw new Error("No Solana wallet is configured");
81
+ }
82
+ connecting.value = true;
83
+ try {
84
+ const connection = activeWallet.connect();
85
+ triggerRef(wallet);
86
+ await connection;
87
+ triggerRef(wallet);
88
+ console.info("[Vue Solana] Wallet connected", {
89
+ publicKey: activeWallet.publicKey?.toBase58() ?? null
90
+ });
91
+ } catch (error) {
92
+ triggerRef(wallet);
93
+ console.error("[Vue Solana] Wallet connection failed", error);
94
+ throw error;
95
+ } finally {
96
+ connecting.value = false;
97
+ }
98
+ }
99
+ async function disconnect() {
100
+ const activeWallet = wallet.value;
101
+ if (!activeWallet) {
102
+ return;
103
+ }
104
+ const publicKey = activeWallet.publicKey?.toBase58() ?? null;
105
+ disconnecting.value = true;
106
+ try {
107
+ await activeWallet.disconnect();
108
+ triggerRef(wallet);
109
+ console.info("[Vue Solana] Wallet disconnected", { publicKey });
110
+ } catch (error) {
111
+ triggerRef(wallet);
112
+ console.error("[Vue Solana] Wallet disconnection failed", error);
113
+ throw error;
114
+ } finally {
115
+ disconnecting.value = false;
116
+ }
117
+ }
118
+ const isConnecting = computed(() => Boolean(connecting.value || wallet.value?.connecting));
119
+ const isDisconnecting = computed(
120
+ () => Boolean(disconnecting.value || wallet.value?.disconnecting)
121
+ );
75
122
  return {
76
123
  wallet,
77
124
  publicKey: computed(() => wallet.value?.publicKey ?? null),
78
125
  connected: computed(() => Boolean(wallet.value?.connected && wallet.value.publicKey)),
79
- connecting: computed(() => Boolean(wallet.value?.connecting)),
126
+ connecting: isConnecting,
127
+ disconnecting: isDisconnecting,
128
+ loading: computed(() => isConnecting.value || isDisconnecting.value),
80
129
  setWallet: solana.setWallet,
81
- connect: () => wallet.value?.connect() ?? Promise.reject(new Error("No Solana wallet is configured")),
82
- disconnect: () => wallet.value?.disconnect() ?? Promise.resolve()
130
+ connect,
131
+ disconnect
83
132
  };
84
133
  }
85
134
 
@@ -119,14 +168,27 @@ function useSignAndSendTransaction() {
119
168
  });
120
169
  }
121
170
 
171
+ function useWallets() {
172
+ const solana = useSolana();
173
+ return {
174
+ wallets: solana.wallets,
175
+ selectedWallet: solana.selectedWallet,
176
+ refreshWallets: solana.refreshWallets,
177
+ selectWallet: solana.selectWallet
178
+ };
179
+ }
180
+
122
181
  function createSolanaPlugin(options = {}) {
123
182
  return {
124
183
  install(app) {
125
184
  const context = createSolanaContext(options);
126
185
  const wallet = shallowRef(options.wallet ?? null);
186
+ const wallets = shallowRef([]);
187
+ const selectedWallet = shallowRef(null);
127
188
  const status = ref("idle");
128
189
  const error = ref(null);
129
190
  const latestBlockhash = ref(null);
191
+ let unsubscribeWallets = null;
130
192
  async function checkConnection() {
131
193
  status.value = "checking";
132
194
  error.value = null;
@@ -151,14 +213,36 @@ function createSolanaPlugin(options = {}) {
151
213
  console.error("[Vue Solana] Connection failed", cause);
152
214
  }
153
215
  }
216
+ function refreshWallets() {
217
+ unsubscribeWallets ??= subscribeSolanaWallets(refreshWallets);
218
+ wallets.value = getRegisteredSolanaWallets();
219
+ if (selectedWallet.value) {
220
+ selectedWallet.value = wallets.value.find((nextWallet) => nextWallet.name === selectedWallet.value?.name) ?? null;
221
+ if (!selectedWallet.value) {
222
+ wallet.value = options.wallet ?? null;
223
+ }
224
+ }
225
+ }
226
+ function selectWallet(nextWallet) {
227
+ selectedWallet.value = nextWallet;
228
+ wallet.value = nextWallet ? adaptSolanaStandardWallet(nextWallet, {
229
+ chain: getSolanaChain(context.cluster),
230
+ onChange: () => triggerRef(wallet)
231
+ }) : options.wallet ?? null;
232
+ }
154
233
  const vueContext = {
155
234
  ...context,
156
235
  wallet,
157
236
  status,
158
237
  error,
159
238
  latestBlockhash,
239
+ wallets,
240
+ selectedWallet,
160
241
  checkConnection,
242
+ refreshWallets,
243
+ selectWallet,
161
244
  setWallet(nextWallet) {
245
+ selectedWallet.value = null;
162
246
  wallet.value = nextWallet;
163
247
  }
164
248
  };
@@ -169,4 +253,4 @@ function createSolanaPlugin(options = {}) {
169
253
  }
170
254
  const VueSolana = createSolanaPlugin;
171
255
 
172
- export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet };
256
+ export { VueSolana, createSolanaPlugin, solanaInjectionKey, useBalance, useConnection, useRpc, useSignAndSendTransaction, useSolana, useTransaction, useWallet, useWallets };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Vue plugin and composables for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@vue-solana/core": "0.1.2"
41
+ "@vue-solana/core": "0.2.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@solana/web3-compat": "^0.0.21",