@provablehq/aleo-wallet-adaptor-puzzle 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 +4 -4
- package/src/PuzzleWalletAdapter.ts +11 -7
package/dist/index.js
CHANGED
|
@@ -79,24 +79,28 @@ var PuzzleWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleo
|
|
|
79
79
|
this._appName = config?.appName || "Aleo App";
|
|
80
80
|
this._appIconUrl = config?.appIconUrl;
|
|
81
81
|
this._appDescription = config?.appDescription;
|
|
82
|
-
this.
|
|
82
|
+
if (this._readyState !== import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED) {
|
|
83
|
+
(0, import_aleo_wallet_adaptor_core.scopePollingDetectionStrategy)(() => this._checkAvailability());
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
/**
|
|
85
87
|
* Check if Puzzle wallet is available
|
|
86
88
|
*/
|
|
87
89
|
_checkAvailability() {
|
|
88
|
-
|
|
89
|
-
this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
90
|
+
console.debug("Checking Puzzle Wallet availability");
|
|
92
91
|
this._window = window;
|
|
93
92
|
if (this._window.puzzle) {
|
|
94
93
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
|
|
94
|
+
console.debug("Puzzle Wallet is installed");
|
|
95
|
+
return true;
|
|
95
96
|
} else {
|
|
96
97
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
97
98
|
if (isMobile) {
|
|
98
99
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
|
|
100
|
+
return true;
|
|
99
101
|
}
|
|
102
|
+
console.debug("Puzzle Wallet is not available");
|
|
103
|
+
return false;
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
BaseAleoWalletAdapter,
|
|
12
12
|
DecryptPermission,
|
|
13
13
|
MethodNotImplementedError,
|
|
14
|
+
scopePollingDetectionStrategy,
|
|
14
15
|
WalletConnectionError,
|
|
15
16
|
WalletDecryptionError,
|
|
16
17
|
WalletDecryptionNotAllowedError,
|
|
@@ -79,24 +80,28 @@ var PuzzleWalletAdapter = class extends BaseAleoWalletAdapter {
|
|
|
79
80
|
this._appName = config?.appName || "Aleo App";
|
|
80
81
|
this._appIconUrl = config?.appIconUrl;
|
|
81
82
|
this._appDescription = config?.appDescription;
|
|
82
|
-
this.
|
|
83
|
+
if (this._readyState !== WalletReadyState.UNSUPPORTED) {
|
|
84
|
+
scopePollingDetectionStrategy(() => this._checkAvailability());
|
|
85
|
+
}
|
|
83
86
|
}
|
|
84
87
|
/**
|
|
85
88
|
* Check if Puzzle wallet is available
|
|
86
89
|
*/
|
|
87
90
|
_checkAvailability() {
|
|
88
|
-
|
|
89
|
-
this.readyState = WalletReadyState.UNSUPPORTED;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
91
|
+
console.debug("Checking Puzzle Wallet availability");
|
|
92
92
|
this._window = window;
|
|
93
93
|
if (this._window.puzzle) {
|
|
94
94
|
this.readyState = WalletReadyState.INSTALLED;
|
|
95
|
+
console.debug("Puzzle Wallet is installed");
|
|
96
|
+
return true;
|
|
95
97
|
} else {
|
|
96
98
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
97
99
|
if (isMobile) {
|
|
98
100
|
this.readyState = WalletReadyState.LOADABLE;
|
|
101
|
+
return true;
|
|
99
102
|
}
|
|
103
|
+
console.debug("Puzzle Wallet is not available");
|
|
104
|
+
return false;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@provablehq/aleo-wallet-adaptor-puzzle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.0",
|
|
4
4
|
"description": "Puzzle wallet adapter for Aleo",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@puzzlehq/sdk-core": "^1.0.3",
|
|
15
|
-
"@provablehq/aleo-wallet-
|
|
16
|
-
"@provablehq/aleo-
|
|
17
|
-
"@provablehq/aleo-
|
|
15
|
+
"@provablehq/aleo-wallet-standard": "0.3.0-alpha.0",
|
|
16
|
+
"@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.0",
|
|
17
|
+
"@provablehq/aleo-types": "0.3.0-alpha.0"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
BaseAleoWalletAdapter,
|
|
16
16
|
DecryptPermission,
|
|
17
17
|
MethodNotImplementedError,
|
|
18
|
+
scopePollingDetectionStrategy,
|
|
18
19
|
WalletConnectionError,
|
|
19
20
|
WalletDecryptionError,
|
|
20
21
|
WalletDecryptionNotAllowedError,
|
|
@@ -104,28 +105,31 @@ export class PuzzleWalletAdapter extends BaseAleoWalletAdapter {
|
|
|
104
105
|
this._appName = config?.appName || 'Aleo App';
|
|
105
106
|
this._appIconUrl = config?.appIconUrl;
|
|
106
107
|
this._appDescription = config?.appDescription;
|
|
107
|
-
this.
|
|
108
|
+
if (this._readyState !== WalletReadyState.UNSUPPORTED) {
|
|
109
|
+
scopePollingDetectionStrategy(() => this._checkAvailability());
|
|
110
|
+
}
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
/**
|
|
111
114
|
* Check if Puzzle wallet is available
|
|
112
115
|
*/
|
|
113
|
-
private _checkAvailability():
|
|
114
|
-
|
|
115
|
-
this.readyState = WalletReadyState.UNSUPPORTED;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
116
|
+
private _checkAvailability(): boolean {
|
|
117
|
+
console.debug('Checking Puzzle Wallet availability');
|
|
119
118
|
this._window = window as PuzzleWindow;
|
|
120
119
|
|
|
121
120
|
if (this._window.puzzle) {
|
|
122
121
|
this.readyState = WalletReadyState.INSTALLED;
|
|
122
|
+
console.debug('Puzzle Wallet is installed');
|
|
123
|
+
return true;
|
|
123
124
|
} else {
|
|
124
125
|
// Check if user is on a mobile device
|
|
125
126
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
126
127
|
if (isMobile) {
|
|
127
128
|
this.readyState = WalletReadyState.LOADABLE;
|
|
129
|
+
return true;
|
|
128
130
|
}
|
|
131
|
+
console.debug('Puzzle Wallet is not available');
|
|
132
|
+
return false;
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
|