Skip to content

Commit 56e7ee2

Browse files
committed
Removed @provablehq/sdk import due to ESM compatibility issues, using custom validation instead
1 parent c3583f7 commit 56e7ee2

File tree

3 files changed

+42
-319
lines changed

3 files changed

+42
-319
lines changed

packages/currency/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@
4343
},
4444
"dependencies": {
4545
"@metamask/contract-metadata": "1.31.0",
46-
"@provablehq/sdk": "^0.9.5",
4746
"@requestnetwork/types": "0.54.0",
4847
"@requestnetwork/utils": "0.54.0",
49-
"@ton/core": "^0.61.0",
50-
"@ton/crypto": "^3.3.0",
48+
"@ton/core": "0.61.0",
49+
"@ton/crypto": "3.3.0",
5150
"multicoin-address-validator": "0.5.15",
5251
"node-dijkstra": "2.5.0",
53-
"starknet": "^7.6.4",
52+
"starknet": "7.6.4",
5453
"tslib": "2.8.1"
5554
},
5655
"devDependencies": {

packages/currency/src/currencyManager.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { CurrencyTypes, RequestLogicTypes } from '@requestnetwork/types';
22
import { utils } from 'ethers';
33
import { Address } from '@ton/core';
44
import { validateAndParseAddress } from 'starknet';
5-
import { Address as AleoAddress } from '@provablehq/sdk';
65
import addressValidator from 'multicoin-address-validator';
76
import { getSupportedERC20Tokens } from './erc20';
87
import { getSupportedERC777Tokens } from './erc777';
@@ -326,13 +325,20 @@ export class CurrencyManager<TMeta = unknown> implements CurrencyTypes.ICurrency
326325
}
327326

328327
/**
329-
* Validate an Aleo address. See https://developer.aleo.org/guides/sdk/wasm/nodejs/#addressfrom_stringaddress--address for more details.
328+
* Validate an Aleo address using the official format specification.
329+
* Note we do not use the @provablehq/sdk package because it is ESM-only
330+
* For regex validation, see https://namespaces.chainagnostic.org/aleo/caip10 for more details.
330331
* @param address - The address to validate
331332
* @returns True if the address is valid, false otherwise
332333
*/
333334
validateAleoAddress(address: string): boolean {
334335
try {
335-
return !!AleoAddress.from_string(address);
336+
if (!address || typeof address !== 'string') {
337+
return false;
338+
}
339+
340+
const aleoAddressRegex = /^aleo1[a-z0-9]{58}$/;
341+
return aleoAddressRegex.test(address);
336342
} catch {
337343
return false;
338344
}

0 commit comments

Comments
 (0)