@provablehq/aleo-wallet-adaptor-fox 0.1.1-alpha.0 → 0.3.0-alpha.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/dist/index.js CHANGED
@@ -63,7 +63,9 @@ var FoxWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
63
63
  this._readyState = typeof window === "undefined" || typeof document === "undefined" ? import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED : import_aleo_wallet_standard.WalletReadyState.NOT_DETECTED;
64
64
  console.debug("FoxWalletAdapter constructor", config);
65
65
  this.network = import_aleo_types.Network.MAINNET;
66
- this._checkAvailability();
66
+ if (this._readyState !== import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED) {
67
+ (0, import_aleo_wallet_adaptor_core.scopePollingDetectionStrategy)(() => this._checkAvailability());
68
+ }
67
69
  this._foxWallet = this._window?.foxwallet?.aleo;
68
70
  if (config?.isMobile) {
69
71
  this.url = `https://app.leo.app/browser?url=${config.mobileWebviewUrl}`;
@@ -73,18 +75,25 @@ var FoxWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
73
75
  * Check if Fox wallet is available
74
76
  */
75
77
  _checkAvailability() {
78
+ console.debug("Checking Fox Wallet availability");
76
79
  if (typeof window === "undefined" || typeof document === "undefined") {
80
+ console.debug("Fox Wallet is not supported");
77
81
  this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
78
- return;
82
+ return false;
79
83
  }
80
84
  this._window = window;
81
85
  if (this._window.foxwallet?.aleo) {
82
86
  this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
87
+ console.debug("Fox Wallet is installed");
88
+ return true;
83
89
  } else {
84
90
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
85
91
  if (isMobile) {
86
92
  this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
93
+ return true;
87
94
  }
95
+ console.debug("Fox Wallet is not available");
96
+ return false;
88
97
  }
89
98
  }
90
99
  /**
package/dist/index.mjs CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  import {
10
10
  BaseAleoWalletAdapter,
11
11
  MethodNotImplementedError,
12
+ scopePollingDetectionStrategy,
12
13
  WalletConnectionError,
13
14
  WalletDecryptionError,
14
15
  WalletDecryptionNotAllowedError,
@@ -55,7 +56,9 @@ var FoxWalletAdapter = class extends BaseAleoWalletAdapter {
55
56
  this._readyState = typeof window === "undefined" || typeof document === "undefined" ? WalletReadyState.UNSUPPORTED : WalletReadyState.NOT_DETECTED;
56
57
  console.debug("FoxWalletAdapter constructor", config);
57
58
  this.network = Network.MAINNET;
58
- this._checkAvailability();
59
+ if (this._readyState !== WalletReadyState.UNSUPPORTED) {
60
+ scopePollingDetectionStrategy(() => this._checkAvailability());
61
+ }
59
62
  this._foxWallet = this._window?.foxwallet?.aleo;
60
63
  if (config?.isMobile) {
61
64
  this.url = `https://app.leo.app/browser?url=${config.mobileWebviewUrl}`;
@@ -65,18 +68,25 @@ var FoxWalletAdapter = class extends BaseAleoWalletAdapter {
65
68
  * Check if Fox wallet is available
66
69
  */
67
70
  _checkAvailability() {
71
+ console.debug("Checking Fox Wallet availability");
68
72
  if (typeof window === "undefined" || typeof document === "undefined") {
73
+ console.debug("Fox Wallet is not supported");
69
74
  this.readyState = WalletReadyState.UNSUPPORTED;
70
- return;
75
+ return false;
71
76
  }
72
77
  this._window = window;
73
78
  if (this._window.foxwallet?.aleo) {
74
79
  this.readyState = WalletReadyState.INSTALLED;
80
+ console.debug("Fox Wallet is installed");
81
+ return true;
75
82
  } else {
76
83
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
77
84
  if (isMobile) {
78
85
  this.readyState = WalletReadyState.LOADABLE;
86
+ return true;
79
87
  }
88
+ console.debug("Fox Wallet is not available");
89
+ return false;
80
90
  }
81
91
  }
82
92
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provablehq/aleo-wallet-adaptor-fox",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.3.0-alpha.0",
4
4
  "description": "Fox wallet adapter for Aleo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -11,10 +11,10 @@
11
11
  "src"
12
12
  ],
13
13
  "dependencies": {
14
- "@provablehq/aleo-types": "0.1.1-alpha.0",
15
- "@provablehq/aleo-wallet-adaptor-core": "0.1.1-alpha.0",
16
- "@provablehq/aleo-wallet-adaptor-leo": "0.1.1-alpha.0",
17
- "@provablehq/aleo-wallet-standard": "0.1.1-alpha.0"
14
+ "@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.0",
15
+ "@provablehq/aleo-types": "0.3.0-alpha.0",
16
+ "@provablehq/aleo-wallet-standard": "0.3.0-alpha.0",
17
+ "@provablehq/aleo-wallet-adaptor-leo": "0.3.0-alpha.0"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -13,6 +13,7 @@ import {
13
13
  import {
14
14
  BaseAleoWalletAdapter,
15
15
  MethodNotImplementedError,
16
+ scopePollingDetectionStrategy,
16
17
  WalletConnectionError,
17
18
  WalletDecryptionError,
18
19
  WalletDecryptionNotAllowedError,
@@ -90,7 +91,9 @@ export class FoxWalletAdapter extends BaseAleoWalletAdapter {
90
91
  super();
91
92
  console.debug('FoxWalletAdapter constructor', config);
92
93
  this.network = Network.MAINNET;
93
- this._checkAvailability();
94
+ if (this._readyState !== WalletReadyState.UNSUPPORTED) {
95
+ scopePollingDetectionStrategy(() => this._checkAvailability());
96
+ }
94
97
  this._foxWallet = this._window?.foxwallet?.aleo;
95
98
  if (config?.isMobile) {
96
99
  this.url = `https://app.leo.app/browser?url=${config.mobileWebviewUrl}`;
@@ -100,22 +103,29 @@ export class FoxWalletAdapter extends BaseAleoWalletAdapter {
100
103
  /**
101
104
  * Check if Fox wallet is available
102
105
  */
103
- private _checkAvailability(): void {
106
+ private _checkAvailability(): boolean {
107
+ console.debug('Checking Fox Wallet availability');
104
108
  if (typeof window === 'undefined' || typeof document === 'undefined') {
109
+ console.debug('Fox Wallet is not supported');
105
110
  this.readyState = WalletReadyState.UNSUPPORTED;
106
- return;
111
+ return false;
107
112
  }
108
113
 
109
114
  this._window = window as FoxWindow;
110
115
 
111
116
  if (this._window.foxwallet?.aleo) {
112
117
  this.readyState = WalletReadyState.INSTALLED;
118
+ console.debug('Fox Wallet is installed');
119
+ return true;
113
120
  } else {
114
121
  // Check if user is on a mobile device
115
122
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
116
123
  if (isMobile) {
117
124
  this.readyState = WalletReadyState.LOADABLE;
125
+ return true;
118
126
  }
127
+ console.debug('Fox Wallet is not available');
128
+ return false;
119
129
  }
120
130
  }
121
131