@dynamic-labs/aleo 4.91.3 → 4.91.4
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/CHANGELOG.md +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/connectors/AleoWalletAdapterConnector/AleoWalletAdapterConnector.cjs +7 -7
- package/src/connectors/AleoWalletAdapterConnector/AleoWalletAdapterConnector.js +7 -7
- package/src/connectors/AleoWalletConnector/AleoWalletConnector.cjs +12 -12
- package/src/connectors/AleoWalletConnector/AleoWalletConnector.js +12 -12
- package/src/connectors/DynamicWaasAleoConnector/DynamicWaasAleoConnector.cjs +27 -27
- package/src/connectors/DynamicWaasAleoConnector/DynamicWaasAleoConnector.d.ts +17 -1
- package/src/connectors/DynamicWaasAleoConnector/DynamicWaasAleoConnector.js +27 -27
- package/src/wallet/AleoWallet/AleoWallet.cjs +2 -2
- package/src/wallet/AleoWallet/AleoWallet.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.91.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.3...v4.91.4) (2026-07-01)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* conditionally use /op/ route for AA transactions based on block explorer support ([#11628](https://github.com/dynamic-labs/dynamic-auth/issues/11628)) ([95822dc](https://github.com/dynamic-labs/dynamic-auth/commit/95822dc0edbcd739afe870f0b3881555fdb17eb6))
|
|
8
|
+
* require error codes in all SDK error classes ([#11761](https://github.com/dynamic-labs/dynamic-auth/issues/11761)) ([5744811](https://github.com/dynamic-labs/dynamic-auth/commit/5744811efdd1e415aaf51eec5b3300b323ec1347))
|
|
9
|
+
|
|
2
10
|
### [4.91.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.2...v4.91.3) (2026-06-30)
|
|
3
11
|
|
|
4
12
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/aleo",
|
|
3
|
-
"version": "4.91.
|
|
3
|
+
"version": "4.91.4",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/assert-package-version": "4.91.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "4.91.4",
|
|
22
22
|
"@dynamic-labs-sdk/client": "1.12.1",
|
|
23
23
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
24
24
|
"@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.3",
|
|
25
25
|
"@provablehq/aleo-wallet-adaptor-shield": "0.3.0-alpha.3",
|
|
26
26
|
"@provablehq/aleo-wallet-standard": "0.3.0-alpha.3",
|
|
27
27
|
"@provablehq/aleo-types": "0.3.0-alpha.3",
|
|
28
|
-
"@dynamic-labs/logger": "4.91.
|
|
29
|
-
"@dynamic-labs/types": "4.91.
|
|
30
|
-
"@dynamic-labs/utils": "4.91.
|
|
31
|
-
"@dynamic-labs/waas": "4.91.
|
|
32
|
-
"@dynamic-labs/wallet-book": "4.91.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "4.91.
|
|
28
|
+
"@dynamic-labs/logger": "4.91.4",
|
|
29
|
+
"@dynamic-labs/types": "4.91.4",
|
|
30
|
+
"@dynamic-labs/utils": "4.91.4",
|
|
31
|
+
"@dynamic-labs/waas": "4.91.4",
|
|
32
|
+
"@dynamic-labs/wallet-book": "4.91.4",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "4.91.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {}
|
|
36
36
|
}
|
|
@@ -169,7 +169,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
169
169
|
yield this.adapter.connect(this.selectedNetwork, aleoWalletStandard.WalletDecryptPermission.UponRequest);
|
|
170
170
|
}
|
|
171
171
|
catch (error) {
|
|
172
|
-
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
172
|
+
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
}
|
|
@@ -180,7 +180,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
180
180
|
this.adapter = this.createAdapter();
|
|
181
181
|
}
|
|
182
182
|
if (!this.adapter) {
|
|
183
|
-
throw new utils.DynamicError('No adapter found');
|
|
183
|
+
throw new utils.DynamicError('No adapter found', 'no_adapter_found');
|
|
184
184
|
}
|
|
185
185
|
const { account } = this.adapter;
|
|
186
186
|
if (account === null || account === void 0 ? void 0 : account.address) {
|
|
@@ -211,7 +211,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
211
211
|
return _super.signMessage.call(this, messageToSign);
|
|
212
212
|
}
|
|
213
213
|
if (!this.adapter.connected) {
|
|
214
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
214
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
215
215
|
}
|
|
216
216
|
try {
|
|
217
217
|
const messageBytes = new TextEncoder().encode(messageToSign);
|
|
@@ -220,7 +220,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
220
220
|
}
|
|
221
221
|
catch (error) {
|
|
222
222
|
walletConnectorCore.logger.error(`[${this.name}] Sign message failed:`, error);
|
|
223
|
-
throw new utils.DynamicError(`Failed to sign message: ${error}
|
|
223
|
+
throw new utils.DynamicError(`Failed to sign message: ${error}`, 'sign_message');
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
}
|
|
@@ -267,7 +267,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
267
267
|
}
|
|
268
268
|
const [transition] = transaction.transitions;
|
|
269
269
|
if (!transition) {
|
|
270
|
-
throw new utils.DynamicError('Transaction must have at least one transition');
|
|
270
|
+
throw new utils.DynamicError('Transaction must have at least one transition', 'transaction_must_have_at_least_one');
|
|
271
271
|
}
|
|
272
272
|
const options = {
|
|
273
273
|
fee: transaction.fee,
|
|
@@ -289,7 +289,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
289
289
|
return _super.decrypt.call(this, ciphertext, options);
|
|
290
290
|
}
|
|
291
291
|
if (!this.adapter.connected) {
|
|
292
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
292
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
293
293
|
}
|
|
294
294
|
return this.adapter.decrypt(ciphertext, options === null || options === void 0 ? void 0 : options.tpk, options === null || options === void 0 ? void 0 : options.programId, options === null || options === void 0 ? void 0 : options.functionName, options === null || options === void 0 ? void 0 : options.index);
|
|
295
295
|
});
|
|
@@ -304,7 +304,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
|
|
|
304
304
|
return _super.requestRecords.call(this, program, options);
|
|
305
305
|
}
|
|
306
306
|
if (!this.adapter.connected) {
|
|
307
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
307
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
308
308
|
}
|
|
309
309
|
return this.adapter.requestRecords(program, (_a = options === null || options === void 0 ? void 0 : options.plaintext) !== null && _a !== void 0 ? _a : false);
|
|
310
310
|
});
|
|
@@ -165,7 +165,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
165
165
|
yield this.adapter.connect(this.selectedNetwork, WalletDecryptPermission.UponRequest);
|
|
166
166
|
}
|
|
167
167
|
catch (error) {
|
|
168
|
-
throw new DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
168
|
+
throw new DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
@@ -176,7 +176,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
176
176
|
this.adapter = this.createAdapter();
|
|
177
177
|
}
|
|
178
178
|
if (!this.adapter) {
|
|
179
|
-
throw new DynamicError('No adapter found');
|
|
179
|
+
throw new DynamicError('No adapter found', 'no_adapter_found');
|
|
180
180
|
}
|
|
181
181
|
const { account } = this.adapter;
|
|
182
182
|
if (account === null || account === void 0 ? void 0 : account.address) {
|
|
@@ -207,7 +207,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
207
207
|
return _super.signMessage.call(this, messageToSign);
|
|
208
208
|
}
|
|
209
209
|
if (!this.adapter.connected) {
|
|
210
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
210
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
211
211
|
}
|
|
212
212
|
try {
|
|
213
213
|
const messageBytes = new TextEncoder().encode(messageToSign);
|
|
@@ -216,7 +216,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
216
216
|
}
|
|
217
217
|
catch (error) {
|
|
218
218
|
logger.error(`[${this.name}] Sign message failed:`, error);
|
|
219
|
-
throw new DynamicError(`Failed to sign message: ${error}
|
|
219
|
+
throw new DynamicError(`Failed to sign message: ${error}`, 'sign_message');
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
}
|
|
@@ -263,7 +263,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
263
263
|
}
|
|
264
264
|
const [transition] = transaction.transitions;
|
|
265
265
|
if (!transition) {
|
|
266
|
-
throw new DynamicError('Transaction must have at least one transition');
|
|
266
|
+
throw new DynamicError('Transaction must have at least one transition', 'transaction_must_have_at_least_one');
|
|
267
267
|
}
|
|
268
268
|
const options = {
|
|
269
269
|
fee: transaction.fee,
|
|
@@ -285,7 +285,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
285
285
|
return _super.decrypt.call(this, ciphertext, options);
|
|
286
286
|
}
|
|
287
287
|
if (!this.adapter.connected) {
|
|
288
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
288
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
289
289
|
}
|
|
290
290
|
return this.adapter.decrypt(ciphertext, options === null || options === void 0 ? void 0 : options.tpk, options === null || options === void 0 ? void 0 : options.programId, options === null || options === void 0 ? void 0 : options.functionName, options === null || options === void 0 ? void 0 : options.index);
|
|
291
291
|
});
|
|
@@ -300,7 +300,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
|
|
|
300
300
|
return _super.requestRecords.call(this, program, options);
|
|
301
301
|
}
|
|
302
302
|
if (!this.adapter.connected) {
|
|
303
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
303
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
304
304
|
}
|
|
305
305
|
return this.adapter.requestRecords(program, (_a = options === null || options === void 0 ? void 0 : options.plaintext) !== null && _a !== void 0 ? _a : false);
|
|
306
306
|
});
|
|
@@ -61,11 +61,11 @@ class AleoWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
61
61
|
var _a, _b;
|
|
62
62
|
const wallet = this.getStandardWallet();
|
|
63
63
|
if (!wallet) {
|
|
64
|
-
throw new utils.DynamicError(`${this.name} is not installed
|
|
64
|
+
throw new utils.DynamicError(`${this.name} is not installed`, 'is_not_installed');
|
|
65
65
|
}
|
|
66
66
|
const connectFeature = wallet.features[aleoWalletStandard.WalletFeatureName.CONNECT];
|
|
67
67
|
if (!(connectFeature === null || connectFeature === void 0 ? void 0 : connectFeature.available)) {
|
|
68
|
-
throw new utils.DynamicError(`${this.name} does not support connect
|
|
68
|
+
throw new utils.DynamicError(`${this.name} does not support connect`, 'does_not_support_connect');
|
|
69
69
|
}
|
|
70
70
|
const networkId = (_a = this.aleoNetworks[0]) === null || _a === void 0 ? void 0 : _a.networkId;
|
|
71
71
|
const chain = (_b = NetworkIdToAleoChain[String(networkId)]) !== null && _b !== void 0 ? _b : aleoWalletStandard.ALEO_CHAINS.MAINNET;
|
|
@@ -73,7 +73,7 @@ class AleoWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
73
73
|
yield connectFeature.connect(aleoWalletStandard.WalletDecryptPermission.UponRequest, chain);
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
76
|
-
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
76
|
+
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
77
77
|
}
|
|
78
78
|
const accountsFeature = wallet.features[aleoWalletStandard.WalletFeatureName.ACCOUNTS];
|
|
79
79
|
if (accountsFeature === null || accountsFeature === void 0 ? void 0 : accountsFeature.available) {
|
|
@@ -137,18 +137,18 @@ class AleoWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
137
137
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
138
138
|
const wallet = this.getStandardWallet();
|
|
139
139
|
if (!wallet) {
|
|
140
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
140
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
141
141
|
}
|
|
142
142
|
const signFeature = wallet.features[aleoWalletStandard.WalletFeatureName.SIGN];
|
|
143
143
|
if (!(signFeature === null || signFeature === void 0 ? void 0 : signFeature.available)) {
|
|
144
|
-
throw new utils.DynamicError(`${this.name} does not support message signing
|
|
144
|
+
throw new utils.DynamicError(`${this.name} does not support message signing`, 'does_not_support_message_signing');
|
|
145
145
|
}
|
|
146
146
|
try {
|
|
147
147
|
return yield signFeature.signMessage(messageToSign);
|
|
148
148
|
}
|
|
149
149
|
catch (error) {
|
|
150
150
|
walletConnectorCore.logger.error(`[${this.name}] Sign message failed:`, error);
|
|
151
|
-
throw new utils.DynamicError(`Failed to sign message: ${error}
|
|
151
|
+
throw new utils.DynamicError(`Failed to sign message: ${error}`, 'sign_message');
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
}
|
|
@@ -156,11 +156,11 @@ class AleoWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
156
156
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
157
157
|
const wallet = this.getStandardWallet();
|
|
158
158
|
if (!wallet) {
|
|
159
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
159
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
160
160
|
}
|
|
161
161
|
const executeFeature = wallet.features[aleoWalletStandard.WalletFeatureName.EXECUTE];
|
|
162
162
|
if (!(executeFeature === null || executeFeature === void 0 ? void 0 : executeFeature.available)) {
|
|
163
|
-
throw new utils.DynamicError(`${this.name} does not support transaction execution
|
|
163
|
+
throw new utils.DynamicError(`${this.name} does not support transaction execution`, 'does_not_support_transaction_execution');
|
|
164
164
|
}
|
|
165
165
|
return executeFeature.requestTransaction(transaction);
|
|
166
166
|
});
|
|
@@ -169,11 +169,11 @@ class AleoWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
169
169
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
170
170
|
const wallet = this.getStandardWallet();
|
|
171
171
|
if (!wallet) {
|
|
172
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
172
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
173
173
|
}
|
|
174
174
|
const decryptFeature = wallet.features[aleoWalletStandard.WalletFeatureName.DECRYPT];
|
|
175
175
|
if (!(decryptFeature === null || decryptFeature === void 0 ? void 0 : decryptFeature.available)) {
|
|
176
|
-
throw new utils.DynamicError(`${this.name} does not support decryption
|
|
176
|
+
throw new utils.DynamicError(`${this.name} does not support decryption`, 'does_not_support_decryption');
|
|
177
177
|
}
|
|
178
178
|
return decryptFeature.decrypt(ciphertext, options);
|
|
179
179
|
});
|
|
@@ -182,11 +182,11 @@ class AleoWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
182
182
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
183
183
|
const wallet = this.getStandardWallet();
|
|
184
184
|
if (!wallet) {
|
|
185
|
-
throw new utils.DynamicError(WALLET_NOT_CONNECTED);
|
|
185
|
+
throw new utils.DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
186
186
|
}
|
|
187
187
|
const recordsFeature = wallet.features[aleoWalletStandard.WalletFeatureName.REQUEST_RECORDS];
|
|
188
188
|
if (!(recordsFeature === null || recordsFeature === void 0 ? void 0 : recordsFeature.available)) {
|
|
189
|
-
throw new utils.DynamicError(`${this.name} does not support record requests
|
|
189
|
+
throw new utils.DynamicError(`${this.name} does not support record requests`, 'does_not_support_record_requests');
|
|
190
190
|
}
|
|
191
191
|
return recordsFeature.requestRecords(program, options);
|
|
192
192
|
});
|
|
@@ -57,11 +57,11 @@ class AleoWalletConnector extends WalletConnectorBase {
|
|
|
57
57
|
var _a, _b;
|
|
58
58
|
const wallet = this.getStandardWallet();
|
|
59
59
|
if (!wallet) {
|
|
60
|
-
throw new DynamicError(`${this.name} is not installed
|
|
60
|
+
throw new DynamicError(`${this.name} is not installed`, 'is_not_installed');
|
|
61
61
|
}
|
|
62
62
|
const connectFeature = wallet.features[WalletFeatureName.CONNECT];
|
|
63
63
|
if (!(connectFeature === null || connectFeature === void 0 ? void 0 : connectFeature.available)) {
|
|
64
|
-
throw new DynamicError(`${this.name} does not support connect
|
|
64
|
+
throw new DynamicError(`${this.name} does not support connect`, 'does_not_support_connect');
|
|
65
65
|
}
|
|
66
66
|
const networkId = (_a = this.aleoNetworks[0]) === null || _a === void 0 ? void 0 : _a.networkId;
|
|
67
67
|
const chain = (_b = NetworkIdToAleoChain[String(networkId)]) !== null && _b !== void 0 ? _b : ALEO_CHAINS.MAINNET;
|
|
@@ -69,7 +69,7 @@ class AleoWalletConnector extends WalletConnectorBase {
|
|
|
69
69
|
yield connectFeature.connect(WalletDecryptPermission.UponRequest, chain);
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
|
-
throw new DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
72
|
+
throw new DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
73
73
|
}
|
|
74
74
|
const accountsFeature = wallet.features[WalletFeatureName.ACCOUNTS];
|
|
75
75
|
if (accountsFeature === null || accountsFeature === void 0 ? void 0 : accountsFeature.available) {
|
|
@@ -133,18 +133,18 @@ class AleoWalletConnector extends WalletConnectorBase {
|
|
|
133
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
134
|
const wallet = this.getStandardWallet();
|
|
135
135
|
if (!wallet) {
|
|
136
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
136
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
137
137
|
}
|
|
138
138
|
const signFeature = wallet.features[WalletFeatureName.SIGN];
|
|
139
139
|
if (!(signFeature === null || signFeature === void 0 ? void 0 : signFeature.available)) {
|
|
140
|
-
throw new DynamicError(`${this.name} does not support message signing
|
|
140
|
+
throw new DynamicError(`${this.name} does not support message signing`, 'does_not_support_message_signing');
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
143
|
return yield signFeature.signMessage(messageToSign);
|
|
144
144
|
}
|
|
145
145
|
catch (error) {
|
|
146
146
|
logger.error(`[${this.name}] Sign message failed:`, error);
|
|
147
|
-
throw new DynamicError(`Failed to sign message: ${error}
|
|
147
|
+
throw new DynamicError(`Failed to sign message: ${error}`, 'sign_message');
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
}
|
|
@@ -152,11 +152,11 @@ class AleoWalletConnector extends WalletConnectorBase {
|
|
|
152
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
153
|
const wallet = this.getStandardWallet();
|
|
154
154
|
if (!wallet) {
|
|
155
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
155
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
156
156
|
}
|
|
157
157
|
const executeFeature = wallet.features[WalletFeatureName.EXECUTE];
|
|
158
158
|
if (!(executeFeature === null || executeFeature === void 0 ? void 0 : executeFeature.available)) {
|
|
159
|
-
throw new DynamicError(`${this.name} does not support transaction execution
|
|
159
|
+
throw new DynamicError(`${this.name} does not support transaction execution`, 'does_not_support_transaction_execution');
|
|
160
160
|
}
|
|
161
161
|
return executeFeature.requestTransaction(transaction);
|
|
162
162
|
});
|
|
@@ -165,11 +165,11 @@ class AleoWalletConnector extends WalletConnectorBase {
|
|
|
165
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
166
|
const wallet = this.getStandardWallet();
|
|
167
167
|
if (!wallet) {
|
|
168
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
168
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
169
169
|
}
|
|
170
170
|
const decryptFeature = wallet.features[WalletFeatureName.DECRYPT];
|
|
171
171
|
if (!(decryptFeature === null || decryptFeature === void 0 ? void 0 : decryptFeature.available)) {
|
|
172
|
-
throw new DynamicError(`${this.name} does not support decryption
|
|
172
|
+
throw new DynamicError(`${this.name} does not support decryption`, 'does_not_support_decryption');
|
|
173
173
|
}
|
|
174
174
|
return decryptFeature.decrypt(ciphertext, options);
|
|
175
175
|
});
|
|
@@ -178,11 +178,11 @@ class AleoWalletConnector extends WalletConnectorBase {
|
|
|
178
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
179
|
const wallet = this.getStandardWallet();
|
|
180
180
|
if (!wallet) {
|
|
181
|
-
throw new DynamicError(WALLET_NOT_CONNECTED);
|
|
181
|
+
throw new DynamicError(WALLET_NOT_CONNECTED, 'wallet_not_connected');
|
|
182
182
|
}
|
|
183
183
|
const recordsFeature = wallet.features[WalletFeatureName.REQUEST_RECORDS];
|
|
184
184
|
if (!(recordsFeature === null || recordsFeature === void 0 ? void 0 : recordsFeature.available)) {
|
|
185
|
-
throw new DynamicError(`${this.name} does not support record requests
|
|
185
|
+
throw new DynamicError(`${this.name} does not support record requests`, 'does_not_support_record_requests');
|
|
186
186
|
}
|
|
187
187
|
return recordsFeature.requestRecords(program, options);
|
|
188
188
|
});
|
|
@@ -144,7 +144,7 @@ const buildPublicTransferInputs = (args) => {
|
|
|
144
144
|
}
|
|
145
145
|
// arc21 — token_registry.aleo/transfer_public(token_id, recipient, amount).
|
|
146
146
|
if (!token.tokenId) {
|
|
147
|
-
throw new utils.DynamicError(`transfer_public: ARC-21 token ${token.contractAddress} is missing tokenId in registry
|
|
147
|
+
throw new utils.DynamicError(`transfer_public: ARC-21 token ${token.contractAddress} is missing tokenId in registry.`, 'transferpublic_arc21_token_is_missing_tokenid');
|
|
148
148
|
}
|
|
149
149
|
return {
|
|
150
150
|
functionName,
|
|
@@ -188,7 +188,7 @@ const buildShieldInputs = (args) => {
|
|
|
188
188
|
}
|
|
189
189
|
// arc21
|
|
190
190
|
if (!token.tokenId) {
|
|
191
|
-
throw new utils.DynamicError(`shieldToken: ARC-21 token ${token.contractAddress} is missing tokenId in registry
|
|
191
|
+
throw new utils.DynamicError(`shieldToken: ARC-21 token ${token.contractAddress} is missing tokenId in registry.`, 'shieldtoken_arc21_token_is_missing_tokenid');
|
|
192
192
|
}
|
|
193
193
|
const externalAuth = token.externalAuthRequired ? 'true' : 'false';
|
|
194
194
|
return {
|
|
@@ -205,7 +205,7 @@ const buildShieldInputs = (args) => {
|
|
|
205
205
|
const joinShapeForProgram = (programId) => {
|
|
206
206
|
const shape = JOIN_PROGRAM_SHAPES[programId];
|
|
207
207
|
if (!shape) {
|
|
208
|
-
throw new utils.DynamicError(`joinRecords: program ${programId} has no registered join-record shape
|
|
208
|
+
throw new utils.DynamicError(`joinRecords: program ${programId} has no registered join-record shape.`, 'joinrecords_program_has_no_registered_joinrecord');
|
|
209
209
|
}
|
|
210
210
|
return shape;
|
|
211
211
|
};
|
|
@@ -285,7 +285,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
285
285
|
var _a;
|
|
286
286
|
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
287
287
|
if (!signedSessionId) {
|
|
288
|
-
throw new utils.DynamicError('Signed session ID is required');
|
|
288
|
+
throw new utils.DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
289
289
|
}
|
|
290
290
|
return signedSessionId;
|
|
291
291
|
});
|
|
@@ -301,7 +301,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
301
301
|
signedSessionId,
|
|
302
302
|
});
|
|
303
303
|
if (!targetWallet) {
|
|
304
|
-
throw new utils.DynamicError('Account not found');
|
|
304
|
+
throw new utils.DynamicError('Account not found', 'account_not_found');
|
|
305
305
|
}
|
|
306
306
|
const isWalletActive = walletConnectorCore.isSameAddress(targetWallet.accountAddress, this.activeAccountAddress || '', this.connectedChain);
|
|
307
307
|
if (!isWalletActive) {
|
|
@@ -339,19 +339,19 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
339
339
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
340
340
|
signMessage(message) {
|
|
341
341
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
342
|
-
throw new utils.DynamicError('Aleo signMessage is not supported yet — pending EdBls12377.sign(bytes) from Sodot');
|
|
342
|
+
throw new utils.DynamicError('Aleo signMessage is not supported yet — pending EdBls12377.sign(bytes) from Sodot', 'aleo_signmessage_is_not_supported_yet');
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
346
346
|
signMessageWithContext({ message, context, }) {
|
|
347
347
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
348
|
-
throw new utils.DynamicError('Method not implemented.');
|
|
348
|
+
throw new utils.DynamicError('Method not implemented.', 'method_not_implemented');
|
|
349
349
|
}
|
|
350
350
|
// Phase 1: signTransaction not supported (signAleoRequest ceremony not wired up)
|
|
351
351
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
352
352
|
signTransaction(_transaction) {
|
|
353
353
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
354
|
-
throw new utils.DynamicError('Aleo signTransaction is not supported yet — coming in Phase 2');
|
|
354
|
+
throw new utils.DynamicError('Aleo signTransaction is not supported yet — coming in Phase 2', 'aleo_signtransaction_is_not_supported_yet');
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
/**
|
|
@@ -363,7 +363,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
363
363
|
var _a, _b;
|
|
364
364
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
365
365
|
if (!this.activeAccountAddress) {
|
|
366
|
-
throw new utils.DynamicError('Active account address is required');
|
|
366
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
367
367
|
}
|
|
368
368
|
const walletClient = yield this.getWaasWalletClient();
|
|
369
369
|
const signedSessionId = yield this.requireSignedSessionId();
|
|
@@ -405,10 +405,10 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
405
405
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
406
406
|
var _a;
|
|
407
407
|
if (!((_a = transaction.transitions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
408
|
-
throw new utils.DynamicError('AleoTransaction must have at least one transition');
|
|
408
|
+
throw new utils.DynamicError('AleoTransaction must have at least one transition', 'aleotransaction_must_have_at_least_one');
|
|
409
409
|
}
|
|
410
410
|
if (transaction.transitions.length > 1) {
|
|
411
|
-
throw new utils.DynamicError('requestTransaction supports a single transition; use proveTransaction for multi-transition flows');
|
|
411
|
+
throw new utils.DynamicError('requestTransaction supports a single transition; use proveTransaction for multi-transition flows', 'requesttransaction_supports_a_single_transition_use');
|
|
412
412
|
}
|
|
413
413
|
const [{ program, functionName, inputs }] = transaction.transitions;
|
|
414
414
|
const stringInputs = inputs.map(String);
|
|
@@ -420,7 +420,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
420
420
|
programId: program,
|
|
421
421
|
});
|
|
422
422
|
if (!txId) {
|
|
423
|
-
throw new utils.DynamicError('Transaction broadcast did not return a transaction id.');
|
|
423
|
+
throw new utils.DynamicError('Transaction broadcast did not return a transaction id.', 'transaction_broadcast_did_not_return_a');
|
|
424
424
|
}
|
|
425
425
|
return txId;
|
|
426
426
|
});
|
|
@@ -444,7 +444,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
444
444
|
var _a, _b;
|
|
445
445
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
446
446
|
if (!this.activeAccountAddress) {
|
|
447
|
-
throw new utils.DynamicError('Active account address is required');
|
|
447
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
448
448
|
}
|
|
449
449
|
const walletClient = yield this.getWaasWalletClient();
|
|
450
450
|
const signedSessionId = yield this.requireSignedSessionId();
|
|
@@ -499,7 +499,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
499
499
|
var _a;
|
|
500
500
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
501
501
|
if (!this.activeAccountAddress) {
|
|
502
|
-
throw new utils.DynamicError('Active account address is required');
|
|
502
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
503
503
|
}
|
|
504
504
|
const byProgram = yield this.fetchAndGroupOwnedRecords(opts === null || opts === void 0 ? void 0 : opts.filterRecord);
|
|
505
505
|
// Caller-supplied list takes precedence; default merges every program
|
|
@@ -671,7 +671,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
671
671
|
(_b = (_a = this.logger).debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[joinRecords:${expectedProgramName}] polling: fresh=${fresh.length}/${expectedNewCount}`);
|
|
672
672
|
yield new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
673
673
|
}
|
|
674
|
-
throw new utils.DynamicError(`joinRecords timed out waiting for ${expectedProgramName} joined outputs from RecordScanner. The transactions may have broadcast successfully — try calling joinRecords again after the network settles
|
|
674
|
+
throw new utils.DynamicError(`joinRecords timed out waiting for ${expectedProgramName} joined outputs from RecordScanner. The transactions may have broadcast successfully — try calling joinRecords again after the network settles.`, 'joinrecords_timed_out_waiting_for_joined');
|
|
675
675
|
});
|
|
676
676
|
}
|
|
677
677
|
/**
|
|
@@ -780,7 +780,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
780
780
|
programId: token.programId,
|
|
781
781
|
});
|
|
782
782
|
if (!result.txId) {
|
|
783
|
-
throw new utils.DynamicError('Aleo transfer broadcast did not return a transaction id.');
|
|
783
|
+
throw new utils.DynamicError('Aleo transfer broadcast did not return a transaction id.', 'aleo_transfer_broadcast_did_not_return');
|
|
784
784
|
}
|
|
785
785
|
return result.txId;
|
|
786
786
|
}),
|
|
@@ -891,17 +891,17 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
891
891
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
892
892
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
893
893
|
if (!this.activeAccountAddress) {
|
|
894
|
-
throw new utils.DynamicError('Active account address is required');
|
|
894
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
895
895
|
}
|
|
896
896
|
if (args.amount <= BigInt(0)) {
|
|
897
|
-
throw new utils.DynamicError('Shield amount must be > 0.');
|
|
897
|
+
throw new utils.DynamicError('Shield amount must be > 0.', 'shield_amount_must_be_0');
|
|
898
898
|
}
|
|
899
899
|
const token = this.resolveShieldableToken({
|
|
900
900
|
address: args.tokenAddress,
|
|
901
901
|
isNative: args.isNative,
|
|
902
902
|
});
|
|
903
903
|
if (!token) {
|
|
904
|
-
throw new utils.DynamicError(`shieldToken: ${args.tokenAddress} is not a registered shieldable Aleo token on the current network
|
|
904
|
+
throw new utils.DynamicError(`shieldToken: ${args.tokenAddress} is not a registered shieldable Aleo token on the current network.`, 'shieldtoken_is_not_a_registered_shieldable');
|
|
905
905
|
}
|
|
906
906
|
// Dedup by `(activeAccountAddress, programId)`. We deliberately ignore
|
|
907
907
|
// `args.amount` in the key — if two call sites race, they're reading
|
|
@@ -945,7 +945,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
945
945
|
programId: token.programId,
|
|
946
946
|
});
|
|
947
947
|
if (!result.txId) {
|
|
948
|
-
throw new utils.DynamicError('Aleo shield broadcast did not return a transaction id.');
|
|
948
|
+
throw new utils.DynamicError('Aleo shield broadcast did not return a transaction id.', 'aleo_shield_broadcast_did_not_return');
|
|
949
949
|
}
|
|
950
950
|
return result.txId;
|
|
951
951
|
});
|
|
@@ -968,7 +968,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
968
968
|
const tokens = aleoSendableTokens.getAleoSendableTokensForNetwork(networkId);
|
|
969
969
|
const token = tokens.find((t) => t.programId === programId);
|
|
970
970
|
if (!token) {
|
|
971
|
-
throw new utils.DynamicError(`sendBalance: Aleo token '${programId}' is not supported on this network. Use proveTransaction for custom programs
|
|
971
|
+
throw new utils.DynamicError(`sendBalance: Aleo token '${programId}' is not supported on this network. Use proveTransaction for custom programs.`, 'sendbalance_aleo_token_is_not_supported');
|
|
972
972
|
}
|
|
973
973
|
const value = BigInt(Math.round(parseFloat(amount) * Math.pow(10, token.decimals)));
|
|
974
974
|
const { records: rawRecords } = yield this.listOwnedRecords();
|
|
@@ -988,12 +988,12 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
988
988
|
return 0;
|
|
989
989
|
});
|
|
990
990
|
if (fitting.length === 0) {
|
|
991
|
-
throw new utils.DynamicError('No single private record covers this amount. Merge records first via wallet.joinRecords().');
|
|
991
|
+
throw new utils.DynamicError('No single private record covers this amount. Merge records first via wallet.joinRecords().', 'no_single_private_record_covers_this');
|
|
992
992
|
}
|
|
993
993
|
const recordPlaintext = fitting[0].plaintext;
|
|
994
994
|
if (mode === 'exchange') {
|
|
995
995
|
if (!this.activeAccountAddress) {
|
|
996
|
-
throw new utils.DynamicError('Active account address is required');
|
|
996
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
997
997
|
}
|
|
998
998
|
return this.submitExchangeTransfer({
|
|
999
999
|
from: this.activeAccountAddress,
|
|
@@ -1018,7 +1018,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
1018
1018
|
programId: token.programId,
|
|
1019
1019
|
});
|
|
1020
1020
|
if (!result.txId) {
|
|
1021
|
-
throw new utils.DynamicError('Aleo transfer_private did not return a transaction id.');
|
|
1021
|
+
throw new utils.DynamicError('Aleo transfer_private did not return a transaction id.', 'aleo_transferprivate_did_not_return_a');
|
|
1022
1022
|
}
|
|
1023
1023
|
return result.txId;
|
|
1024
1024
|
});
|
|
@@ -1069,7 +1069,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
1069
1069
|
programId: token.programId,
|
|
1070
1070
|
});
|
|
1071
1071
|
if (!step1Result.txId) {
|
|
1072
|
-
throw new utils.DynamicError('Aleo Exchange step 1 (unshield) did not return a transaction id.');
|
|
1072
|
+
throw new utils.DynamicError('Aleo Exchange step 1 (unshield) did not return a transaction id.', 'aleo_exchange_step_1_unshield_did');
|
|
1073
1073
|
}
|
|
1074
1074
|
(_b = (_a = this.logger).debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[exchangeTransfer:${token.programId}] step 1 (unshield) tx: ${step1Result.txId}`);
|
|
1075
1075
|
// Wait for step 1 to finalize and surface in public balance before
|
|
@@ -1088,7 +1088,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
1088
1088
|
programId: token.programId,
|
|
1089
1089
|
});
|
|
1090
1090
|
if (!step2Result.txId) {
|
|
1091
|
-
throw new utils.DynamicError('Aleo Exchange step 2 (public transfer) did not return a transaction id.');
|
|
1091
|
+
throw new utils.DynamicError('Aleo Exchange step 2 (public transfer) did not return a transaction id.', 'aleo_exchange_step_2_public_transfer');
|
|
1092
1092
|
}
|
|
1093
1093
|
(_d = (_c = this.logger).debug) === null || _d === void 0 ? void 0 : _d.call(_c, `[exchangeTransfer:${token.programId}] step 2 (public transfer) tx: ${step2Result.txId}`);
|
|
1094
1094
|
return step2Result.txId;
|
|
@@ -1101,7 +1101,7 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
throw new utils.DynamicError(`Aleo Exchange step 2 (public transfer) failed after ${EXCHANGE_STEP2_MAX_RETRIES + 1} attempts. Step 1 unshield (tx ${step1Result.txId}) succeeded — your funds are now in your public balance and can be sent to the exchange via a manual public transfer. Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}
|
|
1104
|
+
throw new utils.DynamicError(`Aleo Exchange step 2 (public transfer) failed after ${EXCHANGE_STEP2_MAX_RETRIES + 1} attempts. Step 1 unshield (tx ${step1Result.txId}) succeeded — your funds are now in your public balance and can be sent to the exchange via a manual public transfer. Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`, 'aleo_exchange_step_2_public_transfer');
|
|
1105
1105
|
}
|
|
1106
1106
|
finally {
|
|
1107
1107
|
this.tokensPendingExchange.delete(token.programId);
|
|
@@ -167,7 +167,23 @@ declare const DynamicWaasAleoConnector_base: (abstract new (...args: any[]) => {
|
|
|
167
167
|
}): Promise<import("@dynamic-labs-wallet/browser-wallet-client").WalletRecoveryState>;
|
|
168
168
|
endSession(reason?: LogoutReason | undefined): Promise<void>;
|
|
169
169
|
getActiveAccountAddress(): Promise<string | undefined>;
|
|
170
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
170
|
+
getConnectedAccounts(): Promise<string[]>; /**
|
|
171
|
+
* Builds the `(functionName, inputs, inputTypes)` triple for a
|
|
172
|
+
* `<program>/transfer_public_to_private` shield call to self. Mirrors
|
|
173
|
+
* `buildTransferInputs` shape — three program kinds, three signatures:
|
|
174
|
+
*
|
|
175
|
+
* - `credits` u64 amounts. inputs `[recipient, amount]`.
|
|
176
|
+
* - `stablecoin` u128 amounts. inputs `[recipient, amount]`. Sealance
|
|
177
|
+
* proof is NOT appended for `transfer_public_to_private`
|
|
178
|
+
* (verified against the iframe's
|
|
179
|
+
* `SEALANCE_FUNCTIONS_REQUIRING_PROOF` set, which only
|
|
180
|
+
* covers `transfer_private` / `transfer_private_to_public`).
|
|
181
|
+
* - `arc21` u128 amounts. inputs `[token_id, recipient, amount,
|
|
182
|
+
* external_auth_required]`. Token_id from the registry;
|
|
183
|
+
* external_auth from the per-token registry entry
|
|
184
|
+
* (defaults to `false` when unset). Verified against
|
|
185
|
+
* `token_registry.aleo` source via the Provable explorer.
|
|
186
|
+
*/
|
|
171
187
|
generateTraceId(): string;
|
|
172
188
|
buildErrorInstrumentContext(error: unknown): {
|
|
173
189
|
errorCode: string | import("@dynamic-labs/utils").ErrorCode;
|
|
@@ -140,7 +140,7 @@ const buildPublicTransferInputs = (args) => {
|
|
|
140
140
|
}
|
|
141
141
|
// arc21 — token_registry.aleo/transfer_public(token_id, recipient, amount).
|
|
142
142
|
if (!token.tokenId) {
|
|
143
|
-
throw new DynamicError(`transfer_public: ARC-21 token ${token.contractAddress} is missing tokenId in registry
|
|
143
|
+
throw new DynamicError(`transfer_public: ARC-21 token ${token.contractAddress} is missing tokenId in registry.`, 'transferpublic_arc21_token_is_missing_tokenid');
|
|
144
144
|
}
|
|
145
145
|
return {
|
|
146
146
|
functionName,
|
|
@@ -184,7 +184,7 @@ const buildShieldInputs = (args) => {
|
|
|
184
184
|
}
|
|
185
185
|
// arc21
|
|
186
186
|
if (!token.tokenId) {
|
|
187
|
-
throw new DynamicError(`shieldToken: ARC-21 token ${token.contractAddress} is missing tokenId in registry
|
|
187
|
+
throw new DynamicError(`shieldToken: ARC-21 token ${token.contractAddress} is missing tokenId in registry.`, 'shieldtoken_arc21_token_is_missing_tokenid');
|
|
188
188
|
}
|
|
189
189
|
const externalAuth = token.externalAuthRequired ? 'true' : 'false';
|
|
190
190
|
return {
|
|
@@ -201,7 +201,7 @@ const buildShieldInputs = (args) => {
|
|
|
201
201
|
const joinShapeForProgram = (programId) => {
|
|
202
202
|
const shape = JOIN_PROGRAM_SHAPES[programId];
|
|
203
203
|
if (!shape) {
|
|
204
|
-
throw new DynamicError(`joinRecords: program ${programId} has no registered join-record shape
|
|
204
|
+
throw new DynamicError(`joinRecords: program ${programId} has no registered join-record shape.`, 'joinrecords_program_has_no_registered_joinrecord');
|
|
205
205
|
}
|
|
206
206
|
return shape;
|
|
207
207
|
};
|
|
@@ -281,7 +281,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
281
281
|
var _a;
|
|
282
282
|
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
283
283
|
if (!signedSessionId) {
|
|
284
|
-
throw new DynamicError('Signed session ID is required');
|
|
284
|
+
throw new DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
285
285
|
}
|
|
286
286
|
return signedSessionId;
|
|
287
287
|
});
|
|
@@ -297,7 +297,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
297
297
|
signedSessionId,
|
|
298
298
|
});
|
|
299
299
|
if (!targetWallet) {
|
|
300
|
-
throw new DynamicError('Account not found');
|
|
300
|
+
throw new DynamicError('Account not found', 'account_not_found');
|
|
301
301
|
}
|
|
302
302
|
const isWalletActive = isSameAddress(targetWallet.accountAddress, this.activeAccountAddress || '', this.connectedChain);
|
|
303
303
|
if (!isWalletActive) {
|
|
@@ -335,19 +335,19 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
335
335
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
336
336
|
signMessage(message) {
|
|
337
337
|
return __awaiter(this, void 0, void 0, function* () {
|
|
338
|
-
throw new DynamicError('Aleo signMessage is not supported yet — pending EdBls12377.sign(bytes) from Sodot');
|
|
338
|
+
throw new DynamicError('Aleo signMessage is not supported yet — pending EdBls12377.sign(bytes) from Sodot', 'aleo_signmessage_is_not_supported_yet');
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
342
342
|
signMessageWithContext({ message, context, }) {
|
|
343
343
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
344
|
-
throw new DynamicError('Method not implemented.');
|
|
344
|
+
throw new DynamicError('Method not implemented.', 'method_not_implemented');
|
|
345
345
|
}
|
|
346
346
|
// Phase 1: signTransaction not supported (signAleoRequest ceremony not wired up)
|
|
347
347
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
348
348
|
signTransaction(_transaction) {
|
|
349
349
|
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
-
throw new DynamicError('Aleo signTransaction is not supported yet — coming in Phase 2');
|
|
350
|
+
throw new DynamicError('Aleo signTransaction is not supported yet — coming in Phase 2', 'aleo_signtransaction_is_not_supported_yet');
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
/**
|
|
@@ -359,7 +359,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
359
359
|
var _a, _b;
|
|
360
360
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
361
361
|
if (!this.activeAccountAddress) {
|
|
362
|
-
throw new DynamicError('Active account address is required');
|
|
362
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
363
363
|
}
|
|
364
364
|
const walletClient = yield this.getWaasWalletClient();
|
|
365
365
|
const signedSessionId = yield this.requireSignedSessionId();
|
|
@@ -401,10 +401,10 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
401
401
|
return __awaiter(this, void 0, void 0, function* () {
|
|
402
402
|
var _a;
|
|
403
403
|
if (!((_a = transaction.transitions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
404
|
-
throw new DynamicError('AleoTransaction must have at least one transition');
|
|
404
|
+
throw new DynamicError('AleoTransaction must have at least one transition', 'aleotransaction_must_have_at_least_one');
|
|
405
405
|
}
|
|
406
406
|
if (transaction.transitions.length > 1) {
|
|
407
|
-
throw new DynamicError('requestTransaction supports a single transition; use proveTransaction for multi-transition flows');
|
|
407
|
+
throw new DynamicError('requestTransaction supports a single transition; use proveTransaction for multi-transition flows', 'requesttransaction_supports_a_single_transition_use');
|
|
408
408
|
}
|
|
409
409
|
const [{ program, functionName, inputs }] = transaction.transitions;
|
|
410
410
|
const stringInputs = inputs.map(String);
|
|
@@ -416,7 +416,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
416
416
|
programId: program,
|
|
417
417
|
});
|
|
418
418
|
if (!txId) {
|
|
419
|
-
throw new DynamicError('Transaction broadcast did not return a transaction id.');
|
|
419
|
+
throw new DynamicError('Transaction broadcast did not return a transaction id.', 'transaction_broadcast_did_not_return_a');
|
|
420
420
|
}
|
|
421
421
|
return txId;
|
|
422
422
|
});
|
|
@@ -440,7 +440,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
440
440
|
var _a, _b;
|
|
441
441
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
442
442
|
if (!this.activeAccountAddress) {
|
|
443
|
-
throw new DynamicError('Active account address is required');
|
|
443
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
444
444
|
}
|
|
445
445
|
const walletClient = yield this.getWaasWalletClient();
|
|
446
446
|
const signedSessionId = yield this.requireSignedSessionId();
|
|
@@ -495,7 +495,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
495
495
|
var _a;
|
|
496
496
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
497
497
|
if (!this.activeAccountAddress) {
|
|
498
|
-
throw new DynamicError('Active account address is required');
|
|
498
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
499
499
|
}
|
|
500
500
|
const byProgram = yield this.fetchAndGroupOwnedRecords(opts === null || opts === void 0 ? void 0 : opts.filterRecord);
|
|
501
501
|
// Caller-supplied list takes precedence; default merges every program
|
|
@@ -667,7 +667,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
667
667
|
(_b = (_a = this.logger).debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[joinRecords:${expectedProgramName}] polling: fresh=${fresh.length}/${expectedNewCount}`);
|
|
668
668
|
yield new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
669
669
|
}
|
|
670
|
-
throw new DynamicError(`joinRecords timed out waiting for ${expectedProgramName} joined outputs from RecordScanner. The transactions may have broadcast successfully — try calling joinRecords again after the network settles
|
|
670
|
+
throw new DynamicError(`joinRecords timed out waiting for ${expectedProgramName} joined outputs from RecordScanner. The transactions may have broadcast successfully — try calling joinRecords again after the network settles.`, 'joinrecords_timed_out_waiting_for_joined');
|
|
671
671
|
});
|
|
672
672
|
}
|
|
673
673
|
/**
|
|
@@ -776,7 +776,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
776
776
|
programId: token.programId,
|
|
777
777
|
});
|
|
778
778
|
if (!result.txId) {
|
|
779
|
-
throw new DynamicError('Aleo transfer broadcast did not return a transaction id.');
|
|
779
|
+
throw new DynamicError('Aleo transfer broadcast did not return a transaction id.', 'aleo_transfer_broadcast_did_not_return');
|
|
780
780
|
}
|
|
781
781
|
return result.txId;
|
|
782
782
|
}),
|
|
@@ -887,17 +887,17 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
887
887
|
return __awaiter(this, void 0, void 0, function* () {
|
|
888
888
|
this.ensureActiveAccountFromVerifiedCredentials();
|
|
889
889
|
if (!this.activeAccountAddress) {
|
|
890
|
-
throw new DynamicError('Active account address is required');
|
|
890
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
891
891
|
}
|
|
892
892
|
if (args.amount <= BigInt(0)) {
|
|
893
|
-
throw new DynamicError('Shield amount must be > 0.');
|
|
893
|
+
throw new DynamicError('Shield amount must be > 0.', 'shield_amount_must_be_0');
|
|
894
894
|
}
|
|
895
895
|
const token = this.resolveShieldableToken({
|
|
896
896
|
address: args.tokenAddress,
|
|
897
897
|
isNative: args.isNative,
|
|
898
898
|
});
|
|
899
899
|
if (!token) {
|
|
900
|
-
throw new DynamicError(`shieldToken: ${args.tokenAddress} is not a registered shieldable Aleo token on the current network
|
|
900
|
+
throw new DynamicError(`shieldToken: ${args.tokenAddress} is not a registered shieldable Aleo token on the current network.`, 'shieldtoken_is_not_a_registered_shieldable');
|
|
901
901
|
}
|
|
902
902
|
// Dedup by `(activeAccountAddress, programId)`. We deliberately ignore
|
|
903
903
|
// `args.amount` in the key — if two call sites race, they're reading
|
|
@@ -941,7 +941,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
941
941
|
programId: token.programId,
|
|
942
942
|
});
|
|
943
943
|
if (!result.txId) {
|
|
944
|
-
throw new DynamicError('Aleo shield broadcast did not return a transaction id.');
|
|
944
|
+
throw new DynamicError('Aleo shield broadcast did not return a transaction id.', 'aleo_shield_broadcast_did_not_return');
|
|
945
945
|
}
|
|
946
946
|
return result.txId;
|
|
947
947
|
});
|
|
@@ -964,7 +964,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
964
964
|
const tokens = getAleoSendableTokensForNetwork(networkId);
|
|
965
965
|
const token = tokens.find((t) => t.programId === programId);
|
|
966
966
|
if (!token) {
|
|
967
|
-
throw new DynamicError(`sendBalance: Aleo token '${programId}' is not supported on this network. Use proveTransaction for custom programs
|
|
967
|
+
throw new DynamicError(`sendBalance: Aleo token '${programId}' is not supported on this network. Use proveTransaction for custom programs.`, 'sendbalance_aleo_token_is_not_supported');
|
|
968
968
|
}
|
|
969
969
|
const value = BigInt(Math.round(parseFloat(amount) * Math.pow(10, token.decimals)));
|
|
970
970
|
const { records: rawRecords } = yield this.listOwnedRecords();
|
|
@@ -984,12 +984,12 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
984
984
|
return 0;
|
|
985
985
|
});
|
|
986
986
|
if (fitting.length === 0) {
|
|
987
|
-
throw new DynamicError('No single private record covers this amount. Merge records first via wallet.joinRecords().');
|
|
987
|
+
throw new DynamicError('No single private record covers this amount. Merge records first via wallet.joinRecords().', 'no_single_private_record_covers_this');
|
|
988
988
|
}
|
|
989
989
|
const recordPlaintext = fitting[0].plaintext;
|
|
990
990
|
if (mode === 'exchange') {
|
|
991
991
|
if (!this.activeAccountAddress) {
|
|
992
|
-
throw new DynamicError('Active account address is required');
|
|
992
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
993
993
|
}
|
|
994
994
|
return this.submitExchangeTransfer({
|
|
995
995
|
from: this.activeAccountAddress,
|
|
@@ -1014,7 +1014,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
1014
1014
|
programId: token.programId,
|
|
1015
1015
|
});
|
|
1016
1016
|
if (!result.txId) {
|
|
1017
|
-
throw new DynamicError('Aleo transfer_private did not return a transaction id.');
|
|
1017
|
+
throw new DynamicError('Aleo transfer_private did not return a transaction id.', 'aleo_transferprivate_did_not_return_a');
|
|
1018
1018
|
}
|
|
1019
1019
|
return result.txId;
|
|
1020
1020
|
});
|
|
@@ -1065,7 +1065,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
1065
1065
|
programId: token.programId,
|
|
1066
1066
|
});
|
|
1067
1067
|
if (!step1Result.txId) {
|
|
1068
|
-
throw new DynamicError('Aleo Exchange step 1 (unshield) did not return a transaction id.');
|
|
1068
|
+
throw new DynamicError('Aleo Exchange step 1 (unshield) did not return a transaction id.', 'aleo_exchange_step_1_unshield_did');
|
|
1069
1069
|
}
|
|
1070
1070
|
(_b = (_a = this.logger).debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[exchangeTransfer:${token.programId}] step 1 (unshield) tx: ${step1Result.txId}`);
|
|
1071
1071
|
// Wait for step 1 to finalize and surface in public balance before
|
|
@@ -1084,7 +1084,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
1084
1084
|
programId: token.programId,
|
|
1085
1085
|
});
|
|
1086
1086
|
if (!step2Result.txId) {
|
|
1087
|
-
throw new DynamicError('Aleo Exchange step 2 (public transfer) did not return a transaction id.');
|
|
1087
|
+
throw new DynamicError('Aleo Exchange step 2 (public transfer) did not return a transaction id.', 'aleo_exchange_step_2_public_transfer');
|
|
1088
1088
|
}
|
|
1089
1089
|
(_d = (_c = this.logger).debug) === null || _d === void 0 ? void 0 : _d.call(_c, `[exchangeTransfer:${token.programId}] step 2 (public transfer) tx: ${step2Result.txId}`);
|
|
1090
1090
|
return step2Result.txId;
|
|
@@ -1097,7 +1097,7 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
|
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
|
-
throw new DynamicError(`Aleo Exchange step 2 (public transfer) failed after ${EXCHANGE_STEP2_MAX_RETRIES + 1} attempts. Step 1 unshield (tx ${step1Result.txId}) succeeded — your funds are now in your public balance and can be sent to the exchange via a manual public transfer. Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}
|
|
1100
|
+
throw new DynamicError(`Aleo Exchange step 2 (public transfer) failed after ${EXCHANGE_STEP2_MAX_RETRIES + 1} attempts. Step 1 unshield (tx ${step1Result.txId}) succeeded — your funds are now in your public balance and can be sent to the exchange via a manual public transfer. Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`, 'aleo_exchange_step_2_public_transfer');
|
|
1101
1101
|
}
|
|
1102
1102
|
finally {
|
|
1103
1103
|
this.tokensPendingExchange.delete(token.programId);
|
|
@@ -66,7 +66,7 @@ class AleoWallet extends walletConnectorCore.Wallet {
|
|
|
66
66
|
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
67
67
|
const signature = yield this._connector.signMessage(messageString);
|
|
68
68
|
if (!signature) {
|
|
69
|
-
throw new utils.DynamicError('Failed to sign message');
|
|
69
|
+
throw new utils.DynamicError('Failed to sign message', 'sign_message_failed');
|
|
70
70
|
}
|
|
71
71
|
return signature;
|
|
72
72
|
});
|
|
@@ -131,7 +131,7 @@ class AleoWallet extends walletConnectorCore.Wallet {
|
|
|
131
131
|
getWaasConnectorOrThrow(methodName) {
|
|
132
132
|
const c = this._connector;
|
|
133
133
|
if (typeof c.proveTransaction !== 'function') {
|
|
134
|
-
throw new utils.DynamicError(`AleoWallet.${methodName}() is only available on embedded Aleo wallets (Dynamic WaaS). For Wallet Adapter Aleo wallets use \`requestTransaction\` / \`requestRecords\` instead
|
|
134
|
+
throw new utils.DynamicError(`AleoWallet.${methodName}() is only available on embedded Aleo wallets (Dynamic WaaS). For Wallet Adapter Aleo wallets use \`requestTransaction\` / \`requestRecords\` instead.`, 'aleowallet_is_only_available_on_embedded');
|
|
135
135
|
}
|
|
136
136
|
c.activeAccountAddress = this.address;
|
|
137
137
|
return c;
|
|
@@ -62,7 +62,7 @@ class AleoWallet extends Wallet {
|
|
|
62
62
|
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
63
63
|
const signature = yield this._connector.signMessage(messageString);
|
|
64
64
|
if (!signature) {
|
|
65
|
-
throw new DynamicError('Failed to sign message');
|
|
65
|
+
throw new DynamicError('Failed to sign message', 'sign_message_failed');
|
|
66
66
|
}
|
|
67
67
|
return signature;
|
|
68
68
|
});
|
|
@@ -127,7 +127,7 @@ class AleoWallet extends Wallet {
|
|
|
127
127
|
getWaasConnectorOrThrow(methodName) {
|
|
128
128
|
const c = this._connector;
|
|
129
129
|
if (typeof c.proveTransaction !== 'function') {
|
|
130
|
-
throw new DynamicError(`AleoWallet.${methodName}() is only available on embedded Aleo wallets (Dynamic WaaS). For Wallet Adapter Aleo wallets use \`requestTransaction\` / \`requestRecords\` instead
|
|
130
|
+
throw new DynamicError(`AleoWallet.${methodName}() is only available on embedded Aleo wallets (Dynamic WaaS). For Wallet Adapter Aleo wallets use \`requestTransaction\` / \`requestRecords\` instead.`, 'aleowallet_is_only_available_on_embedded');
|
|
131
131
|
}
|
|
132
132
|
c.activeAccountAddress = this.address;
|
|
133
133
|
return c;
|