@provablehq/aleo-wallet-adaptor-fox 0.1.1-alpha.0 → 0.3.0-alpha.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.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}`;
@@ -74,17 +76,21 @@ var FoxWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
74
76
  */
75
77
  _checkAvailability() {
76
78
  if (typeof window === "undefined" || typeof document === "undefined") {
79
+ console.debug("Fox Wallet is not supported");
77
80
  this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
78
- return;
81
+ return false;
79
82
  }
80
83
  this._window = window;
81
84
  if (this._window.foxwallet?.aleo) {
82
85
  this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
86
+ return true;
83
87
  } else {
84
88
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
85
89
  if (isMobile) {
86
90
  this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
91
+ return true;
87
92
  }
93
+ return false;
88
94
  }
89
95
  }
90
96
  /**
@@ -297,8 +303,8 @@ var FoxWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
297
303
  address: this._publicKey,
298
304
  chainId: import_aleo_wallet_adaptor_leo.LEO_NETWORK_MAP[this.network],
299
305
  program: deployment.program,
300
- fee: deployment.fee,
301
- feePrivate: deployment.feePrivate
306
+ fee: deployment.priorityFee,
307
+ feePrivate: deployment.privateFee
302
308
  });
303
309
  if (!result?.transactionId) {
304
310
  throw new import_aleo_wallet_adaptor_core.WalletTransactionError("Could not create deployment");
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}`;
@@ -66,17 +69,21 @@ var FoxWalletAdapter = class extends BaseAleoWalletAdapter {
66
69
  */
67
70
  _checkAvailability() {
68
71
  if (typeof window === "undefined" || typeof document === "undefined") {
72
+ console.debug("Fox Wallet is not supported");
69
73
  this.readyState = WalletReadyState.UNSUPPORTED;
70
- return;
74
+ return false;
71
75
  }
72
76
  this._window = window;
73
77
  if (this._window.foxwallet?.aleo) {
74
78
  this.readyState = WalletReadyState.INSTALLED;
79
+ return true;
75
80
  } else {
76
81
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
77
82
  if (isMobile) {
78
83
  this.readyState = WalletReadyState.LOADABLE;
84
+ return true;
79
85
  }
86
+ return false;
80
87
  }
81
88
  }
82
89
  /**
@@ -289,8 +296,8 @@ var FoxWalletAdapter = class extends BaseAleoWalletAdapter {
289
296
  address: this._publicKey,
290
297
  chainId: LEO_NETWORK_MAP[this.network],
291
298
  program: deployment.program,
292
- fee: deployment.fee,
293
- feePrivate: deployment.feePrivate
299
+ fee: deployment.priorityFee,
300
+ feePrivate: deployment.privateFee
294
301
  });
295
302
  if (!result?.transactionId) {
296
303
  throw new WalletTransactionError("Could not create deployment");
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.1",
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.1",
15
+ "@provablehq/aleo-types": "0.3.0-alpha.1",
16
+ "@provablehq/aleo-wallet-standard": "0.3.0-alpha.1",
17
+ "@provablehq/aleo-wallet-adaptor-leo": "0.3.0-alpha.1"
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,26 @@ 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 {
104
107
  if (typeof window === 'undefined' || typeof document === 'undefined') {
108
+ console.debug('Fox Wallet is not supported');
105
109
  this.readyState = WalletReadyState.UNSUPPORTED;
106
- return;
110
+ return false;
107
111
  }
108
112
 
109
113
  this._window = window as FoxWindow;
110
114
 
111
115
  if (this._window.foxwallet?.aleo) {
112
116
  this.readyState = WalletReadyState.INSTALLED;
117
+ return true;
113
118
  } else {
114
119
  // Check if user is on a mobile device
115
120
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
116
121
  if (isMobile) {
117
122
  this.readyState = WalletReadyState.LOADABLE;
123
+ return true;
118
124
  }
125
+ return false;
119
126
  }
120
127
  }
121
128
 
@@ -376,8 +383,8 @@ export class FoxWalletAdapter extends BaseAleoWalletAdapter {
376
383
  address: this._publicKey,
377
384
  chainId: LEO_NETWORK_MAP[this.network],
378
385
  program: deployment.program,
379
- fee: deployment.fee,
380
- feePrivate: deployment.feePrivate,
386
+ fee: deployment.priorityFee,
387
+ feePrivate: deployment.privateFee,
381
388
  });
382
389
  if (!result?.transactionId) {
383
390
  throw new WalletTransactionError('Could not create deployment');