@provablehq/aleo-wallet-adaptor-puzzle 0.3.0-alpha.0 → 0.3.0-alpha.2
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 +1 -1
- package/dist/index.js +2 -6
- package/dist/index.mjs +2 -6
- package/package.json +4 -4
- package/src/PuzzleWalletAdapter.ts +1 -5
- package/src/types.ts +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Adapter that exposes the Puzzle wallet through the Aleo wallet adaptor interface
|
|
|
5
5
|
## When to use it
|
|
6
6
|
|
|
7
7
|
- Offer Puzzle wallet users a seamless connect experience in your Aleo dApp.
|
|
8
|
-
- Combine Puzzle with other wallets (Leo,
|
|
8
|
+
- Combine Puzzle with other wallets (Leo, Shield, Fox, Puzzle) in a single provider instance.
|
|
9
9
|
- Prototype wallet flows that rely on Puzzle’s capabilities without forking adaptor logic.
|
|
10
10
|
|
|
11
11
|
## Installation
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var import_aleo_types = require("@provablehq/aleo-types");
|
|
|
36
36
|
var import_sdk_core = require("@puzzlehq/sdk-core");
|
|
37
37
|
var PUZZLE_NETWORK_MAP = {
|
|
38
38
|
[import_aleo_types.Network.MAINNET]: import_sdk_core.Network.AleoMainnet,
|
|
39
|
-
[import_aleo_types.Network.
|
|
39
|
+
[import_aleo_types.Network.TESTNET]: import_sdk_core.Network.AleoTestnet,
|
|
40
40
|
[import_aleo_types.Network.CANARY]: import_sdk_core.Network.AleoTestnet
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -66,7 +66,7 @@ var PuzzleWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleo
|
|
|
66
66
|
/**
|
|
67
67
|
* Current network
|
|
68
68
|
*/
|
|
69
|
-
this.network = import_aleo_types2.Network.
|
|
69
|
+
this.network = import_aleo_types2.Network.TESTNET;
|
|
70
70
|
/**
|
|
71
71
|
* The wallet's decrypt permission
|
|
72
72
|
*/
|
|
@@ -87,11 +87,9 @@ var PuzzleWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleo
|
|
|
87
87
|
* Check if Puzzle wallet is available
|
|
88
88
|
*/
|
|
89
89
|
_checkAvailability() {
|
|
90
|
-
console.debug("Checking Puzzle Wallet availability");
|
|
91
90
|
this._window = window;
|
|
92
91
|
if (this._window.puzzle) {
|
|
93
92
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.INSTALLED;
|
|
94
|
-
console.debug("Puzzle Wallet is installed");
|
|
95
93
|
return true;
|
|
96
94
|
} else {
|
|
97
95
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
@@ -99,7 +97,6 @@ var PuzzleWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleo
|
|
|
99
97
|
this.readyState = import_aleo_wallet_standard.WalletReadyState.LOADABLE;
|
|
100
98
|
return true;
|
|
101
99
|
}
|
|
102
|
-
console.debug("Puzzle Wallet is not available");
|
|
103
100
|
return false;
|
|
104
101
|
}
|
|
105
102
|
}
|
|
@@ -142,7 +139,6 @@ var PuzzleWalletAdapter = class extends import_aleo_wallet_adaptor_core.BaseAleo
|
|
|
142
139
|
this.emit("connect", account);
|
|
143
140
|
return account;
|
|
144
141
|
} catch (err) {
|
|
145
|
-
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
146
142
|
throw new import_aleo_wallet_adaptor_core.WalletConnectionError(err instanceof Error ? err.message : "Connection failed");
|
|
147
143
|
}
|
|
148
144
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -37,7 +37,7 @@ import { Network } from "@provablehq/aleo-types";
|
|
|
37
37
|
import { Network as PuzzleNetwork } from "@puzzlehq/sdk-core";
|
|
38
38
|
var PUZZLE_NETWORK_MAP = {
|
|
39
39
|
[Network.MAINNET]: PuzzleNetwork.AleoMainnet,
|
|
40
|
-
[Network.
|
|
40
|
+
[Network.TESTNET]: PuzzleNetwork.AleoTestnet,
|
|
41
41
|
[Network.CANARY]: PuzzleNetwork.AleoTestnet
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -67,7 +67,7 @@ var PuzzleWalletAdapter = class extends BaseAleoWalletAdapter {
|
|
|
67
67
|
/**
|
|
68
68
|
* Current network
|
|
69
69
|
*/
|
|
70
|
-
this.network = Network2.
|
|
70
|
+
this.network = Network2.TESTNET;
|
|
71
71
|
/**
|
|
72
72
|
* The wallet's decrypt permission
|
|
73
73
|
*/
|
|
@@ -88,11 +88,9 @@ var PuzzleWalletAdapter = class extends BaseAleoWalletAdapter {
|
|
|
88
88
|
* Check if Puzzle wallet is available
|
|
89
89
|
*/
|
|
90
90
|
_checkAvailability() {
|
|
91
|
-
console.debug("Checking Puzzle Wallet availability");
|
|
92
91
|
this._window = window;
|
|
93
92
|
if (this._window.puzzle) {
|
|
94
93
|
this.readyState = WalletReadyState.INSTALLED;
|
|
95
|
-
console.debug("Puzzle Wallet is installed");
|
|
96
94
|
return true;
|
|
97
95
|
} else {
|
|
98
96
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
@@ -100,7 +98,6 @@ var PuzzleWalletAdapter = class extends BaseAleoWalletAdapter {
|
|
|
100
98
|
this.readyState = WalletReadyState.LOADABLE;
|
|
101
99
|
return true;
|
|
102
100
|
}
|
|
103
|
-
console.debug("Puzzle Wallet is not available");
|
|
104
101
|
return false;
|
|
105
102
|
}
|
|
106
103
|
}
|
|
@@ -143,7 +140,6 @@ var PuzzleWalletAdapter = class extends BaseAleoWalletAdapter {
|
|
|
143
140
|
this.emit("connect", account);
|
|
144
141
|
return account;
|
|
145
142
|
} catch (err) {
|
|
146
|
-
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
147
143
|
throw new WalletConnectionError(err instanceof Error ? err.message : "Connection failed");
|
|
148
144
|
}
|
|
149
145
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@provablehq/aleo-wallet-adaptor-puzzle",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.2",
|
|
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-
|
|
16
|
-
"@provablehq/aleo-wallet-
|
|
17
|
-
"@provablehq/aleo-
|
|
15
|
+
"@provablehq/aleo-types": "0.3.0-alpha.2",
|
|
16
|
+
"@provablehq/aleo-wallet-standard": "0.3.0-alpha.2",
|
|
17
|
+
"@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.2"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -79,7 +79,7 @@ export class PuzzleWalletAdapter extends BaseAleoWalletAdapter {
|
|
|
79
79
|
/**
|
|
80
80
|
* Current network
|
|
81
81
|
*/
|
|
82
|
-
network: Network = Network.
|
|
82
|
+
network: Network = Network.TESTNET;
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* The wallet's decrypt permission
|
|
@@ -114,12 +114,10 @@ export class PuzzleWalletAdapter extends BaseAleoWalletAdapter {
|
|
|
114
114
|
* Check if Puzzle wallet is available
|
|
115
115
|
*/
|
|
116
116
|
private _checkAvailability(): boolean {
|
|
117
|
-
console.debug('Checking Puzzle Wallet availability');
|
|
118
117
|
this._window = window as PuzzleWindow;
|
|
119
118
|
|
|
120
119
|
if (this._window.puzzle) {
|
|
121
120
|
this.readyState = WalletReadyState.INSTALLED;
|
|
122
|
-
console.debug('Puzzle Wallet is installed');
|
|
123
121
|
return true;
|
|
124
122
|
} else {
|
|
125
123
|
// Check if user is on a mobile device
|
|
@@ -128,7 +126,6 @@ export class PuzzleWalletAdapter extends BaseAleoWalletAdapter {
|
|
|
128
126
|
this.readyState = WalletReadyState.LOADABLE;
|
|
129
127
|
return true;
|
|
130
128
|
}
|
|
131
|
-
console.debug('Puzzle Wallet is not available');
|
|
132
129
|
return false;
|
|
133
130
|
}
|
|
134
131
|
}
|
|
@@ -186,7 +183,6 @@ export class PuzzleWalletAdapter extends BaseAleoWalletAdapter {
|
|
|
186
183
|
|
|
187
184
|
return account;
|
|
188
185
|
} catch (err: Error | unknown) {
|
|
189
|
-
this.emit('error', err instanceof Error ? err : new Error(String(err)));
|
|
190
186
|
throw new WalletConnectionError(err instanceof Error ? err.message : 'Connection failed');
|
|
191
187
|
}
|
|
192
188
|
}
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,6 @@ export interface PuzzleWalletAdapterConfig {
|
|
|
39
39
|
|
|
40
40
|
export const PUZZLE_NETWORK_MAP: Record<Network, PuzzleNetwork> = {
|
|
41
41
|
[Network.MAINNET]: PuzzleNetwork.AleoMainnet,
|
|
42
|
-
[Network.
|
|
42
|
+
[Network.TESTNET]: PuzzleNetwork.AleoTestnet,
|
|
43
43
|
[Network.CANARY]: PuzzleNetwork.AleoTestnet,
|
|
44
44
|
};
|