@provablehq/aleo-wallet-adaptor-soter 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 +9 -5
- package/dist/index.mjs +10 -5
- package/package.json +5 -5
- package/src/SoterWalletAdapter.ts +11 -7
package/dist/index.js
CHANGED
|
@@ -63,26 +63,30 @@ 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.
|
|
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
|
-
|
|
74
|
-
this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
75
|
+
console.debug("Checking Soter Wallet availability");
|
|
77
76
|
this._window = window;
|
|
78
77
|
if (this._window.soter || this._window.soterWallet) {
|
|
79
78
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
|
|
80
79
|
this._soterWallet = this._window?.soter || this._window?.soterWallet;
|
|
80
|
+
console.debug("Soter Wallet is installed");
|
|
81
|
+
return true;
|
|
81
82
|
} else {
|
|
82
83
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
83
84
|
if (isMobile) {
|
|
84
85
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
|
|
86
|
+
return true;
|
|
85
87
|
}
|
|
88
|
+
console.debug("Soter Wallet is not available");
|
|
89
|
+
return false;
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
/**
|
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,30 @@ 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.
|
|
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
|
-
|
|
66
|
-
this.readyState = WalletReadyState.UNSUPPORTED;
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
68
|
+
console.debug("Checking Soter Wallet availability");
|
|
69
69
|
this._window = window;
|
|
70
70
|
if (this._window.soter || this._window.soterWallet) {
|
|
71
71
|
this.readyState = WalletReadyState.INSTALLED;
|
|
72
72
|
this._soterWallet = this._window?.soter || this._window?.soterWallet;
|
|
73
|
+
console.debug("Soter Wallet is installed");
|
|
74
|
+
return true;
|
|
73
75
|
} else {
|
|
74
76
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
75
77
|
if (isMobile) {
|
|
76
78
|
this.readyState = WalletReadyState.LOADABLE;
|
|
79
|
+
return true;
|
|
77
80
|
}
|
|
81
|
+
console.debug("Soter Wallet is not available");
|
|
82
|
+
return false;
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@provablehq/aleo-wallet-adaptor-soter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.0",
|
|
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.
|
|
15
|
-
"@provablehq/aleo-wallet-adaptor-leo": "0.
|
|
16
|
-
"@provablehq/aleo-wallet-
|
|
17
|
-
"@provablehq/aleo-wallet-
|
|
14
|
+
"@provablehq/aleo-types": "0.3.0-alpha.0",
|
|
15
|
+
"@provablehq/aleo-wallet-adaptor-leo": "0.3.0-alpha.0",
|
|
16
|
+
"@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.0",
|
|
17
|
+
"@provablehq/aleo-wallet-standard": "0.3.0-alpha.0"
|
|
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,33 @@ export class SoterWalletAdapter extends BaseAleoWalletAdapter {
|
|
|
91
92
|
super();
|
|
92
93
|
console.debug('SoterWalletAdapter constructor', config);
|
|
93
94
|
this.network = Network.MAINNET;
|
|
94
|
-
this.
|
|
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():
|
|
102
|
-
|
|
103
|
-
this.readyState = WalletReadyState.UNSUPPORTED;
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
104
|
+
private _checkAvailability(): boolean {
|
|
105
|
+
console.debug('Checking Soter Wallet availability');
|
|
107
106
|
this._window = window as SoterWindow;
|
|
108
107
|
|
|
109
108
|
if (this._window.soter || this._window.soterWallet) {
|
|
110
109
|
this.readyState = WalletReadyState.INSTALLED;
|
|
111
110
|
this._soterWallet = this._window?.soter || this._window?.soterWallet;
|
|
111
|
+
console.debug('Soter Wallet is installed');
|
|
112
|
+
return true;
|
|
112
113
|
} else {
|
|
113
114
|
// Check if user is on a mobile device
|
|
114
115
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
115
116
|
if (isMobile) {
|
|
116
117
|
this.readyState = WalletReadyState.LOADABLE;
|
|
118
|
+
return true;
|
|
117
119
|
}
|
|
120
|
+
console.debug('Soter Wallet is not available');
|
|
121
|
+
return false;
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
|