@provablehq/aleo-wallet-adaptor-soter 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,26 +63,27 @@ var SoterWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleoW
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("SoterWalletAdapter 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._soterWallet = this._window?.soter || this._window?.soterWallet;
68
70
  }
69
71
  /**
70
72
  * Check if Soter wallet is available
71
73
  */
72
74
  _checkAvailability() {
73
- if (typeof window === "undefined" || typeof document === "undefined") {
74
- this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
75
- return;
76
- }
77
75
  this._window = window;
78
76
  if (this._window.soter || this._window.soterWallet) {
79
77
  this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
80
78
  this._soterWallet = this._window?.soter || this._window?.soterWallet;
79
+ return true;
81
80
  } else {
82
81
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
83
82
  if (isMobile) {
84
83
  this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
84
+ return true;
85
85
  }
86
+ return false;
86
87
  }
87
88
  }
88
89
  /**
package/dist/index.mjs CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  } from "@provablehq/aleo-wallet-standard";
9
9
  import {
10
10
  BaseAleoWalletAdapter,
11
+ scopePollingDetectionStrategy,
11
12
  MethodNotImplementedError,
12
13
  WalletConnectionError,
13
14
  WalletDecryptionError,
@@ -55,26 +56,27 @@ var SoterWalletAdapter = class extends BaseAleoWalletAdapter {
55
56
  this._readyState = typeof window === "undefined" || typeof document === "undefined" ? WalletReadyState.UNSUPPORTED : WalletReadyState.NOT_DETECTED;
56
57
  console.debug("SoterWalletAdapter 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._soterWallet = this._window?.soter || this._window?.soterWallet;
60
63
  }
61
64
  /**
62
65
  * Check if Soter wallet is available
63
66
  */
64
67
  _checkAvailability() {
65
- if (typeof window === "undefined" || typeof document === "undefined") {
66
- this.readyState = WalletReadyState.UNSUPPORTED;
67
- return;
68
- }
69
68
  this._window = window;
70
69
  if (this._window.soter || this._window.soterWallet) {
71
70
  this.readyState = WalletReadyState.INSTALLED;
72
71
  this._soterWallet = this._window?.soter || this._window?.soterWallet;
72
+ return true;
73
73
  } else {
74
74
  const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
75
75
  if (isMobile) {
76
76
  this.readyState = WalletReadyState.LOADABLE;
77
+ return true;
77
78
  }
79
+ return false;
78
80
  }
79
81
  }
80
82
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provablehq/aleo-wallet-adaptor-soter",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.3.0-alpha.1",
4
4
  "description": "Soter 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-leo": "0.1.1-alpha.0",
16
- "@provablehq/aleo-wallet-standard": "0.1.1-alpha.0",
17
- "@provablehq/aleo-wallet-adaptor-core": "0.1.1-alpha.0"
14
+ "@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.1",
15
+ "@provablehq/aleo-wallet-adaptor-leo": "0.3.0-alpha.1",
16
+ "@provablehq/aleo-wallet-standard": "0.3.0-alpha.1",
17
+ "@provablehq/aleo-types": "0.3.0-alpha.1"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -11,6 +11,7 @@ import {
11
11
  } from '@provablehq/aleo-wallet-standard';
12
12
  import {
13
13
  BaseAleoWalletAdapter,
14
+ scopePollingDetectionStrategy,
14
15
  MethodNotImplementedError,
15
16
  WalletConnectionError,
16
17
  WalletDecryptionError,
@@ -91,30 +92,30 @@ export class SoterWalletAdapter extends BaseAleoWalletAdapter {
91
92
  super();
92
93
  console.debug('SoterWalletAdapter constructor', config);
93
94
  this.network = Network.MAINNET;
94
- this._checkAvailability();
95
+ if (this._readyState !== WalletReadyState.UNSUPPORTED) {
96
+ scopePollingDetectionStrategy(() => this._checkAvailability());
97
+ }
95
98
  this._soterWallet = this._window?.soter || this._window?.soterWallet;
96
99
  }
97
100
 
98
101
  /**
99
102
  * Check if Soter wallet is available
100
103
  */
101
- private _checkAvailability(): void {
102
- if (typeof window === 'undefined' || typeof document === 'undefined') {
103
- this.readyState = WalletReadyState.UNSUPPORTED;
104
- return;
105
- }
106
-
104
+ private _checkAvailability(): boolean {
107
105
  this._window = window as SoterWindow;
108
106
 
109
107
  if (this._window.soter || this._window.soterWallet) {
110
108
  this.readyState = WalletReadyState.INSTALLED;
111
109
  this._soterWallet = this._window?.soter || this._window?.soterWallet;
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