@provablehq/aleo-wallet-adaptor-puzzle 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 +6 -5
- package/dist/index.mjs +7 -5
- package/package.json +4 -4
- package/src/PuzzleWalletAdapter.ts +8 -7
package/dist/index.js
CHANGED
|
@@ -79,24 +79,25 @@ 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
|
-
if (typeof window === "undefined") {
|
|
89
|
-
this.readyState = import_aleo_wallet_standard.WalletReadyState.UNSUPPORTED;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
90
|
this._window = window;
|
|
93
91
|
if (this._window.puzzle) {
|
|
94
92
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
|
|
93
|
+
return true;
|
|
95
94
|
} else {
|
|
96
95
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
97
96
|
if (isMobile) {
|
|
98
97
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
|
|
98
|
+
return true;
|
|
99
99
|
}
|
|
100
|
+
return false;
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
/**
|
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,25 @@ 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
|
-
if (typeof window === "undefined") {
|
|
89
|
-
this.readyState = WalletReadyState.UNSUPPORTED;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
91
|
this._window = window;
|
|
93
92
|
if (this._window.puzzle) {
|
|
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
|
/**
|
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.1",
|
|
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-adaptor-core": "0.
|
|
16
|
-
"@provablehq/aleo-types": "0.
|
|
17
|
-
"@provablehq/aleo-wallet-standard": "0.
|
|
15
|
+
"@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.1",
|
|
16
|
+
"@provablehq/aleo-types": "0.3.0-alpha.1",
|
|
17
|
+
"@provablehq/aleo-wallet-standard": "0.3.0-alpha.1"
|
|
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,28 @@ 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
|
-
if (typeof window === 'undefined') {
|
|
115
|
-
this.readyState = WalletReadyState.UNSUPPORTED;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
116
|
+
private _checkAvailability(): boolean {
|
|
119
117
|
this._window = window as PuzzleWindow;
|
|
120
118
|
|
|
121
119
|
if (this._window.puzzle) {
|
|
122
120
|
this.readyState = WalletReadyState.INSTALLED;
|
|
121
|
+
return true;
|
|
123
122
|
} else {
|
|
124
123
|
// Check if user is on a mobile device
|
|
125
124
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
126
125
|
if (isMobile) {
|
|
127
126
|
this.readyState = WalletReadyState.LOADABLE;
|
|
127
|
+
return true;
|
|
128
128
|
}
|
|
129
|
+
return false;
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
|