@provablehq/aleo-wallet-adaptor-leo 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/README.md CHANGED
@@ -26,6 +26,6 @@ const wallets = [new LeoWalletAdapter()];
26
26
 
27
27
  - `@provablehq/aleo-wallet-adaptor-core` – shared adapter base implementation.
28
28
  - `@provablehq/aleo-wallet-adaptor-react` – provider that surface Leo in React apps.
29
- - Other wallet adapters (`-prove-alpha`, `-puzzle`, `-fox`, etc.) that can coexist with Leo.
29
+ - Other wallet adapters (`-shield`, `-puzzle`, `-fox`, etc.) that can coexist with Leo.
30
30
 
31
31
  Live demo: https://aleo-dev-toolkit-react-app.vercel.app/
package/dist/index.js CHANGED
@@ -87,7 +87,9 @@ var LeoWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
87
87
  this._readyState = typeof window === "undefined" || typeof document === "undefined" ? import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED : import_aleo_wallet_standard.WalletReadyState.NOT_DETECTED;
88
88
  console.debug("LeoWalletAdapter constructor", config);
89
89
  this.network = import_aleo_types2.Network.TESTNET3;
90
- this._checkAvailability();
90
+ if (this._readyState !== import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED) {
91
+ (0, import_aleo_wallet_adaptor_core.scopePollingDetectionStrategy)(() => this._checkAvailability());
92
+ }
91
93
  this._leoWallet = this._window?.leoWallet || this._window?.leo;
92
94
  if (config?.isMobile) {
93
95
  this.url = `https://app.leo.app/browser?url=${config.mobileWebviewUrl}`;
@@ -97,18 +99,17 @@ var LeoWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
97
99
  * Check if Leo wallet is available
98
100
  */
99
101
  _checkAvailability() {
100
- if (typeof window === "undefined" || typeof document === "undefined") {
101
- this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
102
- return;
103
- }
104
102
  this._window = window;
105
103
  if (this._window.leoWallet || this._window.leo) {
106
104
  this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
105
+ return true;
107
106
  } else {
108
107
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
109
108
  if (isMobile) {
110
109
  this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
110
+ return true;
111
111
  }
112
+ return false;
112
113
  }
113
114
  }
114
115
  /**
@@ -322,8 +323,8 @@ var LeoWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoWal
322
323
  this._publicKey,
323
324
  LEO_NETWORK_MAP[this.network],
324
325
  deployment.program,
325
- deployment.fee,
326
- deployment.feePrivate
326
+ deployment.priorityFee,
327
+ deployment.privateFee
327
328
  );
328
329
  const result = await this._leoWallet?.requestDeploy(leoDeployment);
329
330
  if (!result?.transactionId) {
package/dist/index.mjs CHANGED
@@ -17,7 +17,8 @@ import {
17
17
  WalletError,
18
18
  WalletNotConnectedError,
19
19
  WalletSignMessageError,
20
- WalletTransactionError
20
+ WalletTransactionError,
21
+ scopePollingDetectionStrategy
21
22
  } from "@provablehq/aleo-wallet-adaptor-core";
22
23
 
23
24
  // src/types.ts
@@ -75,7 +76,9 @@ var LeoWalletAdapter = class extends BaseAleoWalletAdapter {
75
76
  this._readyState = typeof window === "undefined" || typeof document === "undefined" ? WalletReadyState.UNSUPPORTED : WalletReadyState.NOT_DETECTED;
76
77
  console.debug("LeoWalletAdapter constructor", config);
77
78
  this.network = Network2.TESTNET3;
78
- this._checkAvailability();
79
+ if (this._readyState !== WalletReadyState.UNSUPPORTED) {
80
+ scopePollingDetectionStrategy(() => this._checkAvailability());
81
+ }
79
82
  this._leoWallet = this._window?.leoWallet || this._window?.leo;
80
83
  if (config?.isMobile) {
81
84
  this.url = `https://app.leo.app/browser?url=${config.mobileWebviewUrl}`;
@@ -85,18 +88,17 @@ var LeoWalletAdapter = class extends BaseAleoWalletAdapter {
85
88
  * Check if Leo wallet is available
86
89
  */
87
90
  _checkAvailability() {
88
- if (typeof window === "undefined" || typeof document === "undefined") {
89
- this.readyState = WalletReadyState.UNSUPPORTED;
90
- return;
91
- }
92
91
  this._window = window;
93
92
  if (this._window.leoWallet || this._window.leo) {
94
93
  this.readyState = WalletReadyState.INSTALLED;
94
+ return true;
95
95
  } else {
96
96
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
97
97
  if (isMobile) {
98
98
  this.readyState = WalletReadyState.LOADABLE;
99
+ return true;
99
100
  }
101
+ return false;
100
102
  }
101
103
  }
102
104
  /**
@@ -310,8 +312,8 @@ var LeoWalletAdapter = class extends BaseAleoWalletAdapter {
310
312
  this._publicKey,
311
313
  LEO_NETWORK_MAP[this.network],
312
314
  deployment.program,
313
- deployment.fee,
314
- deployment.feePrivate
315
+ deployment.priorityFee,
316
+ deployment.privateFee
315
317
  );
316
318
  const result = await this._leoWallet?.requestDeploy(leoDeployment);
317
319
  if (!result?.transactionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provablehq/aleo-wallet-adaptor-leo",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.3.0-alpha.1",
4
4
  "description": "Leo wallet adapter for Aleo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -11,9 +11,9 @@
11
11
  "src"
12
12
  ],
13
13
  "dependencies": {
14
- "@provablehq/aleo-types": "0.1.1-alpha.0",
15
- "@provablehq/aleo-wallet-standard": "0.1.1-alpha.0",
16
- "@provablehq/aleo-wallet-adaptor-core": "0.1.1-alpha.0"
14
+ "@provablehq/aleo-types": "0.3.0-alpha.1",
15
+ "@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.1",
16
+ "@provablehq/aleo-wallet-standard": "0.3.0-alpha.1"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -22,6 +22,7 @@ import {
22
22
  WalletNotConnectedError,
23
23
  WalletSignMessageError,
24
24
  WalletTransactionError,
25
+ scopePollingDetectionStrategy,
25
26
  } from '@provablehq/aleo-wallet-adaptor-core';
26
27
  import {
27
28
  AleoTransaction,
@@ -89,7 +90,9 @@ export class LeoWalletAdapter extends BaseAleoWalletAdapter {
89
90
  super();
90
91
  console.debug('LeoWalletAdapter constructor', config);
91
92
  this.network = Network.TESTNET3;
92
- this._checkAvailability();
93
+ if (this._readyState !== WalletReadyState.UNSUPPORTED) {
94
+ scopePollingDetectionStrategy(() => this._checkAvailability());
95
+ }
93
96
  this._leoWallet = this._window?.leoWallet || this._window?.leo;
94
97
  if (config?.isMobile) {
95
98
  this.url = `https://app.leo.app/browser?url=${config.mobileWebviewUrl}`;
@@ -99,22 +102,20 @@ export class LeoWalletAdapter extends BaseAleoWalletAdapter {
99
102
  /**
100
103
  * Check if Leo wallet is available
101
104
  */
102
- private _checkAvailability(): void {
103
- if (typeof window === 'undefined' || typeof document === 'undefined') {
104
- this.readyState = WalletReadyState.UNSUPPORTED;
105
- return;
106
- }
107
-
105
+ private _checkAvailability(): boolean {
108
106
  this._window = window as LeoWindow;
109
107
 
110
108
  if (this._window.leoWallet || this._window.leo) {
111
109
  this.readyState = WalletReadyState.INSTALLED;
110
+ return true;
112
111
  } else {
113
112
  // Check if user is on a mobile device
114
113
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
115
114
  if (isMobile) {
116
115
  this.readyState = WalletReadyState.LOADABLE;
116
+ return true;
117
117
  }
118
+ return false;
118
119
  }
119
120
  }
120
121
 
@@ -382,8 +383,8 @@ export class LeoWalletAdapter extends BaseAleoWalletAdapter {
382
383
  this._publicKey,
383
384
  LEO_NETWORK_MAP[this.network],
384
385
  deployment.program,
385
- deployment.fee,
386
- deployment.feePrivate,
386
+ deployment.priorityFee,
387
+ deployment.privateFee,
387
388
  );
388
389
  const result = await this._leoWallet?.requestDeploy(leoDeployment);
389
390
  if (!result?.transactionId) {