@vue-solana/vue 0.2.3 → 0.3.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
@@ -16,11 +16,11 @@ New to Solana? Start with the official docs and the project concepts guide:
16
16
  ## Install
17
17
 
18
18
  ```sh
19
- pnpm add @vue-solana/vue @vue-solana/core @solana/web3-compat
19
+ pnpm add @vue-solana/vue @vue-solana/core @solana/web3-compat buffer
20
20
  ```
21
21
 
22
22
  ```sh
23
- npm install @vue-solana/vue @vue-solana/core @solana/web3-compat
23
+ npm install @vue-solana/vue @vue-solana/core @solana/web3-compat buffer
24
24
  ```
25
25
 
26
26
  ## Plugin Setup
@@ -34,11 +34,20 @@ createApp(App)
34
34
  .use(
35
35
  createSolanaPlugin({
36
36
  cluster: "devnet",
37
+ mobileWallet: {
38
+ appIdentity: {
39
+ name: "My Vue Solana App",
40
+ uri: "https://example.com",
41
+ icon: "favicon.ico",
42
+ },
43
+ },
37
44
  }),
38
45
  )
39
46
  .mount("#app");
40
47
  ```
41
48
 
49
+ Android Mobile Wallet Adapter registration is enabled by default on supported Android Chrome clients. Pass `mobileWallet` options to customize the MWA app identity, or pass `mobileWallet: false` to disable Android mobile wallet registration.
50
+
42
51
  You can also pass a custom RPC endpoint:
43
52
 
44
53
  ```ts
@@ -142,7 +151,9 @@ const { publicKey, connected, connecting, connect, disconnect } = useWallet();
142
151
  </template>
143
152
  ```
144
153
 
145
- Browser wallets are discovered through the Solana Wallet Standard. `connect()` works after selecting a discovered wallet or configuring a custom `SolanaWallet`.
154
+ Browser extension wallets are discovered through the Solana Wallet Standard. Android Mobile Wallet Adapter wallets are registered through `@solana-mobile/wallet-standard-mobile` and exposed through the same `useWallets()` list on supported Android Chrome clients. `connect()` works after selecting a discovered wallet or configuring a custom `SolanaWallet`.
155
+
156
+ iOS browser wallet adapters and desktop native app wallet adapters are planned but not implemented yet.
146
157
 
147
158
  Composables return inert SSR-safe state when no plugin context is available. Real RPC and wallet operations still require the plugin-provided client context.
148
159
 
@@ -180,6 +191,7 @@ Live demo: [vue-solana-docs.vercel.app/demo](https://vue-solana-docs.vercel.app/
180
191
  - `useRpc()`: returns cluster, endpoint, connection status, latest blockhash, and `checkConnection()`.
181
192
  - `useConnection()`: returns the Solana `Connection`.
182
193
  - `useWallet()`: returns wallet refs, computed connection state, and wallet actions.
194
+ - `useWallets()`: returns discovered browser extension wallets, Android Mobile Wallet Adapter wallets, and wallet selection actions.
183
195
  - `useBalance(address, commitment?)`: loads lamport balance for a `PublicKey` or address string.
184
196
  - `useTransaction(handler)`: generic async transaction state helper.
185
197
  - `useSignAndSendTransaction()`: signs and sends a transaction through the configured wallet.
@@ -220,4 +232,4 @@ Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern tha
220
232
 
221
233
  ## Status
222
234
 
223
- This package is early-stage. RPC, balance, wallet, and transaction composables are usable.
235
+ This package is early-stage. RPC, balance, browser extension wallet, Android mobile wallet, and transaction composables are usable.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const useBalance = require('./shared/vue.CjKm-Cw1.cjs');
3
+ const useBalance = require('./shared/vue.CNkyBND6.cjs');
4
4
  const useConnection = require('./shared/vue.CwhEmATP.cjs');
5
5
  const useRpc = require('./shared/vue.COyyrsQU.cjs');
6
6
  const useSignAndSendTransaction = require('./shared/vue.CTM6XQ47.cjs');
@@ -9,6 +9,7 @@ const useTransaction = require('./shared/vue.BSVxQ9Yi.cjs');
9
9
  const useWallet = require('./shared/vue.CwPjPFN6.cjs');
10
10
  const useWallets = require('./shared/vue.P9tgeC5S.cjs');
11
11
  const walletStandard = require('@vue-solana/core/wallet-standard');
12
+ const mobileWallet = require('@vue-solana/core/mobile-wallet');
12
13
  const rpc = require('@vue-solana/core/rpc');
13
14
  const vue = require('vue');
14
15
  require('@vue-solana/core/transaction');
@@ -63,6 +64,12 @@ function createSolanaPlugin(options = {}) {
63
64
  }
64
65
  }
65
66
  function refreshWallets() {
67
+ if (options.mobileWallet !== false) {
68
+ mobileWallet.registerSolanaMobileWallet({
69
+ chains: [walletStandard.getSolanaChain(context.cluster)],
70
+ ...options.mobileWallet || {}
71
+ });
72
+ }
66
73
  unsubscribeWallets ??= walletStandard.subscribeSolanaWallets(refreshWallets);
67
74
  wallets.value = walletStandard.getRegisteredSolanaWallets();
68
75
  if (selectedWallet.value) {
@@ -148,7 +155,9 @@ function createSolanaPlugin(options = {}) {
148
155
  };
149
156
  app.provide(useSolana.solanaInjectionKey, vueContext);
150
157
  if (typeof window !== "undefined") {
151
- void checkConnection();
158
+ window.setTimeout(() => {
159
+ void checkConnection();
160
+ }, 0);
152
161
  }
153
162
  }
154
163
  };
package/dist/index.d.cts CHANGED
@@ -7,12 +7,14 @@ export { useTransaction } from './useTransaction.cjs';
7
7
  export { useWallet } from './useWallet.cjs';
8
8
  export { useWallets } from './useWallets.cjs';
9
9
  export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DGhodYJh.cjs';
10
+ import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
10
11
  import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
11
12
  import { App } from 'vue';
12
13
  import '@solana/web3-compat';
13
14
 
14
15
  interface VueSolanaPluginOptions extends SolanaConfig {
15
16
  wallet?: SolanaWallet | null;
17
+ mobileWallet?: false | RegisterSolanaMobileWalletOptions;
16
18
  }
17
19
  declare function createSolanaPlugin(options?: VueSolanaPluginOptions): {
18
20
  install(app: App): void;
package/dist/index.d.mts CHANGED
@@ -7,12 +7,14 @@ export { useTransaction } from './useTransaction.mjs';
7
7
  export { useWallet } from './useWallet.mjs';
8
8
  export { useWallets } from './useWallets.mjs';
9
9
  export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DGhodYJh.mjs';
10
+ import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
10
11
  import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
11
12
  import { App } from 'vue';
12
13
  import '@solana/web3-compat';
13
14
 
14
15
  interface VueSolanaPluginOptions extends SolanaConfig {
15
16
  wallet?: SolanaWallet | null;
17
+ mobileWallet?: false | RegisterSolanaMobileWalletOptions;
16
18
  }
17
19
  declare function createSolanaPlugin(options?: VueSolanaPluginOptions): {
18
20
  install(app: App): void;
package/dist/index.d.ts CHANGED
@@ -7,12 +7,14 @@ export { useTransaction } from './useTransaction.js';
7
7
  export { useWallet } from './useWallet.js';
8
8
  export { useWallets } from './useWallets.js';
9
9
  export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DGhodYJh.js';
10
+ import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
10
11
  import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
11
12
  import { App } from 'vue';
12
13
  import '@solana/web3-compat';
13
14
 
14
15
  interface VueSolanaPluginOptions extends SolanaConfig {
15
16
  wallet?: SolanaWallet | null;
17
+ mobileWallet?: false | RegisterSolanaMobileWalletOptions;
16
18
  }
17
19
  declare function createSolanaPlugin(options?: VueSolanaPluginOptions): {
18
20
  install(app: App): void;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { u as useBalance } from './shared/vue.D81obqiN.mjs';
1
+ export { u as useBalance } from './shared/vue.CgR3nGpz.mjs';
2
2
  export { u as useConnection } from './shared/vue.DlEAL2G8.mjs';
3
3
  export { u as useRpc } from './shared/vue.BqDzSepb.mjs';
4
4
  export { u as useSignAndSendTransaction } from './shared/vue.PoQ8Vpmy.mjs';
@@ -7,7 +7,8 @@ export { t as tryUseSolana, u as useSolana } from './shared/vue.1M_c5FWA.mjs';
7
7
  export { u as useTransaction } from './shared/vue.BMUEDN2t.mjs';
8
8
  export { u as useWallet } from './shared/vue.DYf_CRDv.mjs';
9
9
  export { u as useWallets } from './shared/vue.h-uS8MXN.mjs';
10
- import { subscribeSolanaWallets, getRegisteredSolanaWallets, adaptSolanaStandardWallet, getSolanaChain } from '@vue-solana/core/wallet-standard';
10
+ import { getSolanaChain, subscribeSolanaWallets, getRegisteredSolanaWallets, adaptSolanaStandardWallet } from '@vue-solana/core/wallet-standard';
11
+ import { registerSolanaMobileWallet } from '@vue-solana/core/mobile-wallet';
11
12
  import { createSolanaContext } from '@vue-solana/core/rpc';
12
13
  import { shallowRef, ref, triggerRef } from 'vue';
13
14
  import '@vue-solana/core/transaction';
@@ -62,6 +63,12 @@ function createSolanaPlugin(options = {}) {
62
63
  }
63
64
  }
64
65
  function refreshWallets() {
66
+ if (options.mobileWallet !== false) {
67
+ registerSolanaMobileWallet({
68
+ chains: [getSolanaChain(context.cluster)],
69
+ ...options.mobileWallet || {}
70
+ });
71
+ }
65
72
  unsubscribeWallets ??= subscribeSolanaWallets(refreshWallets);
66
73
  wallets.value = getRegisteredSolanaWallets();
67
74
  if (selectedWallet.value) {
@@ -147,7 +154,9 @@ function createSolanaPlugin(options = {}) {
147
154
  };
148
155
  app.provide(solanaInjectionKey, vueContext);
149
156
  if (typeof window !== "undefined") {
150
- void checkConnection();
157
+ window.setTimeout(() => {
158
+ void checkConnection();
159
+ }, 0);
151
160
  }
152
161
  }
153
162
  };
@@ -29,12 +29,14 @@ function useBalance(address, commitment) {
29
29
  loading.value = false;
30
30
  }
31
31
  }
32
+ vue.onMounted(() => {
33
+ void refresh().catch(() => void 0);
34
+ });
32
35
  vue.watch(
33
36
  () => vue.toValue(address),
34
37
  () => {
35
38
  void refresh().catch(() => void 0);
36
- },
37
- { immediate: true }
39
+ }
38
40
  );
39
41
  return {
40
42
  balance,
@@ -1,4 +1,4 @@
1
- import { ref, watch, toValue } from 'vue';
1
+ import { ref, onMounted, watch, toValue } from 'vue';
2
2
  import { u as useConnection } from './vue.DlEAL2G8.mjs';
3
3
  import { t as tryUseSolana } from './vue.1M_c5FWA.mjs';
4
4
 
@@ -27,12 +27,14 @@ function useBalance(address, commitment) {
27
27
  loading.value = false;
28
28
  }
29
29
  }
30
+ onMounted(() => {
31
+ void refresh().catch(() => void 0);
32
+ });
30
33
  watch(
31
34
  () => toValue(address),
32
35
  () => {
33
36
  void refresh().catch(() => void 0);
34
- },
35
- { immediate: true }
37
+ }
36
38
  );
37
39
  return {
38
40
  balance,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const useBalance = require('./shared/vue.CjKm-Cw1.cjs');
3
+ const useBalance = require('./shared/vue.CNkyBND6.cjs');
4
4
  require('vue');
5
5
  require('./shared/vue.CwhEmATP.cjs');
6
6
  require('./shared/vue.COyyrsQU.cjs');
@@ -1,4 +1,4 @@
1
- export { u as useBalance } from './shared/vue.D81obqiN.mjs';
1
+ export { u as useBalance } from './shared/vue.CgR3nGpz.mjs';
2
2
  import 'vue';
3
3
  import './shared/vue.DlEAL2G8.mjs';
4
4
  import './shared/vue.BqDzSepb.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Vue plugin and composables for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -78,7 +78,7 @@
78
78
  "access": "public"
79
79
  },
80
80
  "dependencies": {
81
- "@vue-solana/core": "0.2.1"
81
+ "@vue-solana/core": "0.3.0"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@solana/web3-compat": "^0.0.21",