@vue-solana/vue 0.3.0 → 0.3.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/dist/index.cjs CHANGED
@@ -9,7 +9,6 @@ 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');
13
12
  const rpc = require('@vue-solana/core/rpc');
14
13
  const vue = require('vue');
15
14
  require('@vue-solana/core/transaction');
@@ -27,6 +26,7 @@ function createSolanaPlugin(options = {}) {
27
26
  const latestBlockhash = vue.ref(null);
28
27
  const adaptedWallets = /* @__PURE__ */ new WeakMap();
29
28
  let unsubscribeWallets = null;
29
+ let mobileWalletRegistrationPromise = null;
30
30
  let rpcCheckId = 0;
31
31
  async function checkConnection() {
32
32
  const checkId = ++rpcCheckId;
@@ -64,12 +64,6 @@ function createSolanaPlugin(options = {}) {
64
64
  }
65
65
  }
66
66
  function refreshWallets() {
67
- if (options.mobileWallet !== false) {
68
- mobileWallet.registerSolanaMobileWallet({
69
- chains: [walletStandard.getSolanaChain(context.cluster)],
70
- ...options.mobileWallet || {}
71
- });
72
- }
73
67
  unsubscribeWallets ??= walletStandard.subscribeSolanaWallets(refreshWallets);
74
68
  wallets.value = walletStandard.getRegisteredSolanaWallets();
75
69
  if (selectedWallet.value) {
@@ -78,6 +72,22 @@ function createSolanaPlugin(options = {}) {
78
72
  wallet.value = options.wallet ?? null;
79
73
  }
80
74
  }
75
+ if (options.mobileWallet !== false) {
76
+ registerMobileWallets();
77
+ }
78
+ }
79
+ function registerMobileWallets() {
80
+ mobileWalletRegistrationPromise ??= import('@vue-solana/core/mobile-wallet').then(({ registerSolanaMobileWallet }) => {
81
+ registerSolanaMobileWallet({
82
+ chains: [walletStandard.getSolanaChain(context.cluster)],
83
+ ...options.mobileWallet || {}
84
+ });
85
+ wallets.value = walletStandard.getRegisteredSolanaWallets();
86
+ }).catch((cause) => {
87
+ console.error("[Vue Solana] Mobile wallet registration failed", cause);
88
+ }).finally(() => {
89
+ mobileWalletRegistrationPromise = null;
90
+ });
81
91
  }
82
92
  function selectWallet(nextWallet) {
83
93
  selectedWallet.value = nextWallet;
package/dist/index.mjs CHANGED
@@ -7,8 +7,7 @@ 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 { getSolanaChain, subscribeSolanaWallets, getRegisteredSolanaWallets, adaptSolanaStandardWallet } from '@vue-solana/core/wallet-standard';
11
- import { registerSolanaMobileWallet } from '@vue-solana/core/mobile-wallet';
10
+ import { subscribeSolanaWallets, getRegisteredSolanaWallets, adaptSolanaStandardWallet, getSolanaChain } from '@vue-solana/core/wallet-standard';
12
11
  import { createSolanaContext } from '@vue-solana/core/rpc';
13
12
  import { shallowRef, ref, triggerRef } from 'vue';
14
13
  import '@vue-solana/core/transaction';
@@ -26,6 +25,7 @@ function createSolanaPlugin(options = {}) {
26
25
  const latestBlockhash = ref(null);
27
26
  const adaptedWallets = /* @__PURE__ */ new WeakMap();
28
27
  let unsubscribeWallets = null;
28
+ let mobileWalletRegistrationPromise = null;
29
29
  let rpcCheckId = 0;
30
30
  async function checkConnection() {
31
31
  const checkId = ++rpcCheckId;
@@ -63,12 +63,6 @@ function createSolanaPlugin(options = {}) {
63
63
  }
64
64
  }
65
65
  function refreshWallets() {
66
- if (options.mobileWallet !== false) {
67
- registerSolanaMobileWallet({
68
- chains: [getSolanaChain(context.cluster)],
69
- ...options.mobileWallet || {}
70
- });
71
- }
72
66
  unsubscribeWallets ??= subscribeSolanaWallets(refreshWallets);
73
67
  wallets.value = getRegisteredSolanaWallets();
74
68
  if (selectedWallet.value) {
@@ -77,6 +71,22 @@ function createSolanaPlugin(options = {}) {
77
71
  wallet.value = options.wallet ?? null;
78
72
  }
79
73
  }
74
+ if (options.mobileWallet !== false) {
75
+ registerMobileWallets();
76
+ }
77
+ }
78
+ function registerMobileWallets() {
79
+ mobileWalletRegistrationPromise ??= import('@vue-solana/core/mobile-wallet').then(({ registerSolanaMobileWallet }) => {
80
+ registerSolanaMobileWallet({
81
+ chains: [getSolanaChain(context.cluster)],
82
+ ...options.mobileWallet || {}
83
+ });
84
+ wallets.value = getRegisteredSolanaWallets();
85
+ }).catch((cause) => {
86
+ console.error("[Vue Solana] Mobile wallet registration failed", cause);
87
+ }).finally(() => {
88
+ mobileWalletRegistrationPromise = null;
89
+ });
80
90
  }
81
91
  function selectWallet(nextWallet) {
82
92
  selectedWallet.value = nextWallet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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.3.0"
81
+ "@vue-solana/core": "0.3.1"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@solana/web3-compat": "^0.0.21",