@mento-protocol/mento-sdk 1.11.0 → 1.13.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.
Files changed (36) hide show
  1. package/README.md +6 -13
  2. package/dist/cjs/constants/index.d.ts +1 -0
  3. package/dist/cjs/constants/index.js +1 -0
  4. package/dist/cjs/constants/tokens.11142220.d.ts +2 -0
  5. package/dist/cjs/constants/tokens.11142220.js +127 -0
  6. package/dist/cjs/constants/tokens.42220.d.ts +2 -0
  7. package/dist/cjs/constants/tokens.42220.js +127 -0
  8. package/dist/cjs/constants/tokens.44787.d.ts +2 -0
  9. package/dist/cjs/constants/tokens.44787.js +127 -0
  10. package/dist/cjs/constants/tokens.d.ts +67 -0
  11. package/dist/cjs/constants/tokens.js +207 -0
  12. package/dist/cjs/constants/tradablePairs.js +2 -0
  13. package/dist/cjs/enums/chainId.d.ts +1 -2
  14. package/dist/cjs/enums/chainId.js +0 -1
  15. package/dist/cjs/mento.d.ts +28 -0
  16. package/dist/cjs/mento.js +64 -1
  17. package/dist/cjs/utils.d.ts +15 -1
  18. package/dist/cjs/utils.js +31 -3
  19. package/dist/esm/constants/index.d.ts +1 -0
  20. package/dist/esm/constants/index.js +1 -0
  21. package/dist/esm/constants/tokens.11142220.d.ts +2 -0
  22. package/dist/esm/constants/tokens.11142220.js +124 -0
  23. package/dist/esm/constants/tokens.42220.d.ts +2 -0
  24. package/dist/esm/constants/tokens.42220.js +124 -0
  25. package/dist/esm/constants/tokens.44787.d.ts +2 -0
  26. package/dist/esm/constants/tokens.44787.js +124 -0
  27. package/dist/esm/constants/tokens.d.ts +67 -0
  28. package/dist/esm/constants/tokens.js +177 -0
  29. package/dist/esm/constants/tradablePairs.js +2 -0
  30. package/dist/esm/enums/chainId.d.ts +1 -2
  31. package/dist/esm/enums/chainId.js +0 -1
  32. package/dist/esm/mento.d.ts +28 -0
  33. package/dist/esm/mento.js +65 -2
  34. package/dist/esm/utils.d.ts +15 -1
  35. package/dist/esm/utils.js +27 -1
  36. package/package.json +4 -2
@@ -0,0 +1,124 @@
1
+ // This file is auto-generated. Do not edit manually.
2
+ // Generated on 2025-10-02T13:54:27.948Z
3
+ export const tokens42220 = [
4
+ {
5
+ "address": "0x061cc5a2C863E0C1Cb404006D559dB18A34C762d",
6
+ "symbol": "axlEUROC",
7
+ "name": "Axelar Wrapped EUROC",
8
+ "decimals": 6
9
+ },
10
+ {
11
+ "address": "0xEB466342C4d449BC9f53A865D5Cb90586f405215",
12
+ "symbol": "axlUSDC",
13
+ "name": "Axelar Wrapped USDC",
14
+ "decimals": 6
15
+ },
16
+ {
17
+ "address": "0x7175504C455076F15c04A2F90a8e352281F492F9",
18
+ "symbol": "cAUD",
19
+ "name": "Celo Australian Dollar",
20
+ "decimals": 18
21
+ },
22
+ {
23
+ "address": "0xff4Ab19391af240c311c54200a492233052B6325",
24
+ "symbol": "cCAD",
25
+ "name": "Celo Canadian Dollar",
26
+ "decimals": 18
27
+ },
28
+ {
29
+ "address": "0xb55a79F398E759E43C95b979163f30eC87Ee131D",
30
+ "symbol": "cCHF",
31
+ "name": "Celo Swiss Franc",
32
+ "decimals": 18
33
+ },
34
+ {
35
+ "address": "0x8A567e2aE79CA692Bd748aB832081C45de4041eA",
36
+ "symbol": "cCOP",
37
+ "name": "Celo Colombian Peso",
38
+ "decimals": 18
39
+ },
40
+ {
41
+ "address": "0x471EcE3750Da237f93B8E339c536989b8978a438",
42
+ "symbol": "CELO",
43
+ "name": "Celo native asset",
44
+ "decimals": 18
45
+ },
46
+ {
47
+ "address": "0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73",
48
+ "symbol": "cEUR",
49
+ "name": "Celo Euro",
50
+ "decimals": 18
51
+ },
52
+ {
53
+ "address": "0xCCF663b1fF11028f0b19058d0f7B674004a40746",
54
+ "symbol": "cGBP",
55
+ "name": "Celo British Pound",
56
+ "decimals": 18
57
+ },
58
+ {
59
+ "address": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
60
+ "symbol": "cGHS",
61
+ "name": "Celo Ghanaian Cedi",
62
+ "decimals": 18
63
+ },
64
+ {
65
+ "address": "0xc45eCF20f3CD864B32D9794d6f76814aE8892e20",
66
+ "symbol": "cJPY",
67
+ "name": "Celo Japanese Yen",
68
+ "decimals": 18
69
+ },
70
+ {
71
+ "address": "0x456a3D042C0DbD3db53D5489e98dFb038553B0d0",
72
+ "symbol": "cKES",
73
+ "name": "Celo Kenyan Shilling",
74
+ "decimals": 18
75
+ },
76
+ {
77
+ "address": "0xE2702Bd97ee33c88c8f6f92DA3B733608aa76F71",
78
+ "symbol": "cNGN",
79
+ "name": "Celo Nigerian Naira",
80
+ "decimals": 18
81
+ },
82
+ {
83
+ "address": "0xe8537a3d056DA446677B9E9d6c5dB704EaAb4787",
84
+ "symbol": "cREAL",
85
+ "name": "Celo Brazilian Real",
86
+ "decimals": 18
87
+ },
88
+ {
89
+ "address": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
90
+ "symbol": "cUSD",
91
+ "name": "Celo Dollar",
92
+ "decimals": 18
93
+ },
94
+ {
95
+ "address": "0x4c35853A3B4e647fD266f4de678dCc8fEC410BF6",
96
+ "symbol": "cZAR",
97
+ "name": "Celo South African Rand",
98
+ "decimals": 18
99
+ },
100
+ {
101
+ "address": "0x73F93dcc49cB8A239e2032663e9475dd5ef29A08",
102
+ "symbol": "eXOF",
103
+ "name": "ECO CFA",
104
+ "decimals": 18
105
+ },
106
+ {
107
+ "address": "0x105d4A9306D2E55a71d2Eb95B81553AE1dC20d7B",
108
+ "symbol": "PUSO",
109
+ "name": "PUSO",
110
+ "decimals": 18
111
+ },
112
+ {
113
+ "address": "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",
114
+ "symbol": "USD₮",
115
+ "name": "Tether USD",
116
+ "decimals": 6
117
+ },
118
+ {
119
+ "address": "0xcebA9300f2b948710d2653dD7B07f33A8B32118C",
120
+ "symbol": "USDC",
121
+ "name": "USDC",
122
+ "decimals": 6
123
+ }
124
+ ];
@@ -0,0 +1,2 @@
1
+ import { Token } from '../mento';
2
+ export declare const tokens44787: readonly Token[];
@@ -0,0 +1,124 @@
1
+ // This file is auto-generated. Do not edit manually.
2
+ // Generated on 2025-10-02T13:54:36.998Z
3
+ export const tokens44787 = [
4
+ {
5
+ "address": "0x6e673502c5b55F3169657C004e5797fFE5be6653",
6
+ "symbol": "BridgedEUROC",
7
+ "name": "mockBridgedEUROC",
8
+ "decimals": 6
9
+ },
10
+ {
11
+ "address": "0x87D61dA3d668797786D73BC674F053f87111570d",
12
+ "symbol": "BridgedUSDC",
13
+ "name": "mockBridgedUSDC",
14
+ "decimals": 6
15
+ },
16
+ {
17
+ "address": "0x84CBD49F5aE07632B6B88094E81Cce8236125Fe0",
18
+ "symbol": "cAUD",
19
+ "name": "Celo Australian Dollar",
20
+ "decimals": 18
21
+ },
22
+ {
23
+ "address": "0x02EC9E0D2Fd73e89168C1709e542a48f58d7B133",
24
+ "symbol": "cCAD",
25
+ "name": "Celo Canadian Dollar",
26
+ "decimals": 18
27
+ },
28
+ {
29
+ "address": "0xADC57C2C34aD021Df4421230a6532F4e2E1dCE4F",
30
+ "symbol": "cCHF",
31
+ "name": "Celo Swiss Franc",
32
+ "decimals": 18
33
+ },
34
+ {
35
+ "address": "0xe6A57340f0df6E020c1c0a80bC6E13048601f0d4",
36
+ "symbol": "cCOP",
37
+ "name": "Celo Colombian Peso",
38
+ "decimals": 18
39
+ },
40
+ {
41
+ "address": "0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9",
42
+ "symbol": "CELO",
43
+ "name": "Celo native asset",
44
+ "decimals": 18
45
+ },
46
+ {
47
+ "address": "0x10c892A6EC43a53E45D0B916B4b7D383B1b78C0F",
48
+ "symbol": "cEUR",
49
+ "name": "Celo Euro",
50
+ "decimals": 18
51
+ },
52
+ {
53
+ "address": "0x47f2Fb88105155a18c390641C8a73f1402B2BB12",
54
+ "symbol": "cGBP",
55
+ "name": "Celo British Pound",
56
+ "decimals": 18
57
+ },
58
+ {
59
+ "address": "0x295B66bE7714458Af45E6A6Ea142A5358A6cA375",
60
+ "symbol": "cGHS",
61
+ "name": "cGHS",
62
+ "decimals": 18
63
+ },
64
+ {
65
+ "address": "0x2E51F41238cA36a421C9B8b3e189e8Cc7653FE67",
66
+ "symbol": "cJPY",
67
+ "name": "Celo Japanese Yen",
68
+ "decimals": 18
69
+ },
70
+ {
71
+ "address": "0x1E0433C1769271ECcF4CFF9FDdD515eefE6CdF92",
72
+ "symbol": "cKES",
73
+ "name": "Celo Kenyan Shilling",
74
+ "decimals": 18
75
+ },
76
+ {
77
+ "address": "0x4a5b03B8b16122D330306c65e4CA4BC5Dd6511d0",
78
+ "symbol": "cNGN",
79
+ "name": "Celo Nigerian Naira",
80
+ "decimals": 18
81
+ },
82
+ {
83
+ "address": "0xE4D517785D091D3c54818832dB6094bcc2744545",
84
+ "symbol": "cREAL",
85
+ "name": "Celo Brazilian Real",
86
+ "decimals": 18
87
+ },
88
+ {
89
+ "address": "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1",
90
+ "symbol": "cUSD",
91
+ "name": "Celo Dollar",
92
+ "decimals": 18
93
+ },
94
+ {
95
+ "address": "0x1e5b44015Ff90610b54000DAad31C89b3284df4d",
96
+ "symbol": "cZAR",
97
+ "name": "Celo South African Rand",
98
+ "decimals": 18
99
+ },
100
+ {
101
+ "address": "0xB0FA15e002516d0301884059c0aaC0F0C72b019D",
102
+ "symbol": "eXOF",
103
+ "name": "ECO CFA",
104
+ "decimals": 18
105
+ },
106
+ {
107
+ "address": "0x5E0E3c9419C42a1B04e2525991FB1A2C467AB8bF",
108
+ "symbol": "PUSO",
109
+ "name": "PUSO",
110
+ "decimals": 18
111
+ },
112
+ {
113
+ "address": "0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B",
114
+ "symbol": "USDC",
115
+ "name": "USDC",
116
+ "decimals": 6
117
+ },
118
+ {
119
+ "address": "0xBba91F588d031469ABCCA566FE80fB1Ad8Ee3287",
120
+ "symbol": "USDT",
121
+ "name": "mockNativeUSDT",
122
+ "decimals": 6
123
+ }
124
+ ];
@@ -0,0 +1,67 @@
1
+ import { Token } from '../mento';
2
+ /**
3
+ * Gets cached tokens for a specific chain ID
4
+ * @param chainId - The chain ID to get cached tokens for
5
+ * @returns Promise resolving to the cached tokens or undefined if not available
6
+ */
7
+ export declare function getCachedTokens(chainId: number): Promise<readonly Token[] | undefined>;
8
+ /**
9
+ * Synchronously gets cached tokens for a specific chain ID
10
+ * Note: This function throws if no cached tokens are available.
11
+ * Use getCachedTokens() for async loading or when you want to handle missing cache gracefully.
12
+ *
13
+ * @param chainId - The chain ID to get cached tokens for
14
+ * @returns The cached tokens
15
+ * @throws Error if no cached tokens are available for the chain
16
+ */
17
+ export declare function getCachedTokensSync(chainId: number): readonly Token[];
18
+ /**
19
+ * Type-safe token symbols available across all chains
20
+ * Note: Not all tokens are available on all chains - check TOKEN_ADDRESSES_BY_CHAIN
21
+ */
22
+ export declare enum TokenSymbol {
23
+ BridgedEUROC = "BridgedEUROC",
24
+ BridgedUSDC = "BridgedUSDC",
25
+ CELO = "CELO",
26
+ PUSO = "PUSO",
27
+ USDC = "USDC",
28
+ USDT = "USDT",
29
+ USD_ = "USD\u20AE",
30
+ axlEUROC = "axlEUROC",
31
+ axlUSDC = "axlUSDC",
32
+ cAUD = "cAUD",
33
+ cCAD = "cCAD",
34
+ cCHF = "cCHF",
35
+ cCOP = "cCOP",
36
+ cEUR = "cEUR",
37
+ cGBP = "cGBP",
38
+ cGHS = "cGHS",
39
+ cJPY = "cJPY",
40
+ cKES = "cKES",
41
+ cNGN = "cNGN",
42
+ cREAL = "cREAL",
43
+ cUSD = "cUSD",
44
+ cZAR = "cZAR",
45
+ eXOF = "eXOF"
46
+ }
47
+ /**
48
+ * Token addresses mapped by chain ID and symbol
49
+ * Use this for type-safe token address lookups
50
+ */
51
+ export declare const TOKEN_ADDRESSES_BY_CHAIN: {
52
+ [chainId: number]: Partial<Record<TokenSymbol, string>>;
53
+ };
54
+ /**
55
+ * Helper function to get token address by symbol for a specific chain
56
+ * @param chainId - The chain ID
57
+ * @param symbol - The token symbol
58
+ * @returns The token address or undefined if not found
59
+ */
60
+ export declare function getTokenAddress(chainId: number, symbol: TokenSymbol): string | undefined;
61
+ /**
62
+ * Helper function to find a token by symbol in the cached tokens
63
+ * @param chainId - The chain ID
64
+ * @param symbol - The token symbol to search for
65
+ * @returns The token object or undefined if not found
66
+ */
67
+ export declare function findTokenBySymbol(chainId: number, symbol: string): Token | undefined;
@@ -0,0 +1,177 @@
1
+ // This file is auto-generated. Do not edit manually.
2
+ // Generated on 2025-10-02T13:52:20.430Z
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ /**
13
+ * Gets cached tokens for a specific chain ID
14
+ * @param chainId - The chain ID to get cached tokens for
15
+ * @returns Promise resolving to the cached tokens or undefined if not available
16
+ */
17
+ export function getCachedTokens(chainId) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ switch (chainId) {
20
+ case 42220:
21
+ return yield import('./tokens.42220').then((module) => module.tokens42220);
22
+ case 44787:
23
+ return yield import('./tokens.44787').then((module) => module.tokens44787);
24
+ case 11142220:
25
+ return yield import('./tokens.11142220').then((module) => module.tokens11142220);
26
+ default:
27
+ return undefined;
28
+ }
29
+ });
30
+ }
31
+ /**
32
+ * Synchronously gets cached tokens for a specific chain ID
33
+ * Note: This function throws if no cached tokens are available.
34
+ * Use getCachedTokens() for async loading or when you want to handle missing cache gracefully.
35
+ *
36
+ * @param chainId - The chain ID to get cached tokens for
37
+ * @returns The cached tokens
38
+ * @throws Error if no cached tokens are available for the chain
39
+ */
40
+ export function getCachedTokensSync(chainId) {
41
+ switch (chainId) {
42
+ case 42220:
43
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
44
+ return require('./tokens.42220').tokens42220;
45
+ case 44787:
46
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
47
+ return require('./tokens.44787').tokens44787;
48
+ case 11142220:
49
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
50
+ return require('./tokens.11142220').tokens11142220;
51
+ default:
52
+ throw new Error(`No cached tokens available for chain ID ${chainId}. ` +
53
+ `Supported chains: 42220 (Celo), 44787 (Alfajores), 11142220 (Celo Sepolia)`);
54
+ }
55
+ }
56
+ /**
57
+ * Type-safe token symbols available across all chains
58
+ * Note: Not all tokens are available on all chains - check TOKEN_ADDRESSES_BY_CHAIN
59
+ */
60
+ export var TokenSymbol;
61
+ (function (TokenSymbol) {
62
+ TokenSymbol["BridgedEUROC"] = "BridgedEUROC";
63
+ TokenSymbol["BridgedUSDC"] = "BridgedUSDC";
64
+ TokenSymbol["CELO"] = "CELO";
65
+ TokenSymbol["PUSO"] = "PUSO";
66
+ TokenSymbol["USDC"] = "USDC";
67
+ TokenSymbol["USDT"] = "USDT";
68
+ TokenSymbol["USD_"] = "USD\u20AE";
69
+ TokenSymbol["axlEUROC"] = "axlEUROC";
70
+ TokenSymbol["axlUSDC"] = "axlUSDC";
71
+ TokenSymbol["cAUD"] = "cAUD";
72
+ TokenSymbol["cCAD"] = "cCAD";
73
+ TokenSymbol["cCHF"] = "cCHF";
74
+ TokenSymbol["cCOP"] = "cCOP";
75
+ TokenSymbol["cEUR"] = "cEUR";
76
+ TokenSymbol["cGBP"] = "cGBP";
77
+ TokenSymbol["cGHS"] = "cGHS";
78
+ TokenSymbol["cJPY"] = "cJPY";
79
+ TokenSymbol["cKES"] = "cKES";
80
+ TokenSymbol["cNGN"] = "cNGN";
81
+ TokenSymbol["cREAL"] = "cREAL";
82
+ TokenSymbol["cUSD"] = "cUSD";
83
+ TokenSymbol["cZAR"] = "cZAR";
84
+ TokenSymbol["eXOF"] = "eXOF";
85
+ })(TokenSymbol || (TokenSymbol = {}));
86
+ /**
87
+ * Token addresses mapped by chain ID and symbol
88
+ * Use this for type-safe token address lookups
89
+ */
90
+ export const TOKEN_ADDRESSES_BY_CHAIN = {
91
+ 42220: {
92
+ [TokenSymbol.axlEUROC]: '0x061cc5a2C863E0C1Cb404006D559dB18A34C762d',
93
+ [TokenSymbol.axlUSDC]: '0xEB466342C4d449BC9f53A865D5Cb90586f405215',
94
+ [TokenSymbol.cAUD]: '0x7175504C455076F15c04A2F90a8e352281F492F9',
95
+ [TokenSymbol.cCAD]: '0xff4Ab19391af240c311c54200a492233052B6325',
96
+ [TokenSymbol.cCHF]: '0xb55a79F398E759E43C95b979163f30eC87Ee131D',
97
+ [TokenSymbol.cCOP]: '0x8A567e2aE79CA692Bd748aB832081C45de4041eA',
98
+ [TokenSymbol.CELO]: '0x471EcE3750Da237f93B8E339c536989b8978a438',
99
+ [TokenSymbol.cEUR]: '0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73',
100
+ [TokenSymbol.cGBP]: '0xCCF663b1fF11028f0b19058d0f7B674004a40746',
101
+ [TokenSymbol.cGHS]: '0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313',
102
+ [TokenSymbol.cJPY]: '0xc45eCF20f3CD864B32D9794d6f76814aE8892e20',
103
+ [TokenSymbol.cKES]: '0x456a3D042C0DbD3db53D5489e98dFb038553B0d0',
104
+ [TokenSymbol.cNGN]: '0xE2702Bd97ee33c88c8f6f92DA3B733608aa76F71',
105
+ [TokenSymbol.cREAL]: '0xe8537a3d056DA446677B9E9d6c5dB704EaAb4787',
106
+ [TokenSymbol.cUSD]: '0x765DE816845861e75A25fCA122bb6898B8B1282a',
107
+ [TokenSymbol.cZAR]: '0x4c35853A3B4e647fD266f4de678dCc8fEC410BF6',
108
+ [TokenSymbol.eXOF]: '0x73F93dcc49cB8A239e2032663e9475dd5ef29A08',
109
+ [TokenSymbol.PUSO]: '0x105d4A9306D2E55a71d2Eb95B81553AE1dC20d7B',
110
+ [TokenSymbol.USD_]: '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
111
+ [TokenSymbol.USDC]: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
112
+ },
113
+ 44787: {
114
+ [TokenSymbol.BridgedEUROC]: '0x6e673502c5b55F3169657C004e5797fFE5be6653',
115
+ [TokenSymbol.BridgedUSDC]: '0x87D61dA3d668797786D73BC674F053f87111570d',
116
+ [TokenSymbol.cAUD]: '0x84CBD49F5aE07632B6B88094E81Cce8236125Fe0',
117
+ [TokenSymbol.cCAD]: '0x02EC9E0D2Fd73e89168C1709e542a48f58d7B133',
118
+ [TokenSymbol.cCHF]: '0xADC57C2C34aD021Df4421230a6532F4e2E1dCE4F',
119
+ [TokenSymbol.cCOP]: '0xe6A57340f0df6E020c1c0a80bC6E13048601f0d4',
120
+ [TokenSymbol.CELO]: '0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9',
121
+ [TokenSymbol.cEUR]: '0x10c892A6EC43a53E45D0B916B4b7D383B1b78C0F',
122
+ [TokenSymbol.cGBP]: '0x47f2Fb88105155a18c390641C8a73f1402B2BB12',
123
+ [TokenSymbol.cGHS]: '0x295B66bE7714458Af45E6A6Ea142A5358A6cA375',
124
+ [TokenSymbol.cJPY]: '0x2E51F41238cA36a421C9B8b3e189e8Cc7653FE67',
125
+ [TokenSymbol.cKES]: '0x1E0433C1769271ECcF4CFF9FDdD515eefE6CdF92',
126
+ [TokenSymbol.cNGN]: '0x4a5b03B8b16122D330306c65e4CA4BC5Dd6511d0',
127
+ [TokenSymbol.cREAL]: '0xE4D517785D091D3c54818832dB6094bcc2744545',
128
+ [TokenSymbol.cUSD]: '0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1',
129
+ [TokenSymbol.cZAR]: '0x1e5b44015Ff90610b54000DAad31C89b3284df4d',
130
+ [TokenSymbol.eXOF]: '0xB0FA15e002516d0301884059c0aaC0F0C72b019D',
131
+ [TokenSymbol.PUSO]: '0x5E0E3c9419C42a1B04e2525991FB1A2C467AB8bF',
132
+ [TokenSymbol.USDC]: '0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B',
133
+ [TokenSymbol.USDT]: '0xBba91F588d031469ABCCA566FE80fB1Ad8Ee3287',
134
+ },
135
+ 11142220: {
136
+ [TokenSymbol.axlEUROC]: '0x9883d788d40F1C7595a780ed881Ea833C7743B4B',
137
+ [TokenSymbol.axlUSDC]: '0x6285De9DA7C1d329C0451628638908915002d9d1',
138
+ [TokenSymbol.cAUD]: '0x5873Faeb42F3563dcD77F0fbbdA818E6d6DA3139',
139
+ [TokenSymbol.cCAD]: '0xF151c9a13b78C84f93f50B8b3bC689fedc134F60',
140
+ [TokenSymbol.cCHF]: '0x284E9b7B623eAE866914b7FA0eB720C2Bb3C2980',
141
+ [TokenSymbol.cCOP]: '0x5F8d55c3627d2dc0a2B4afa798f877242F382F67',
142
+ [TokenSymbol.CELO]: '0x471EcE3750Da237f93B8E339c536989b8978a438',
143
+ [TokenSymbol.cEUR]: '0xA99dC247d6b7B2E3ab48a1fEE101b83cD6aCd82a',
144
+ [TokenSymbol.cGBP]: '0x85F5181Abdbf0e1814Fc4358582Ae07b8eBA3aF3',
145
+ [TokenSymbol.cGHS]: '0x5e94B8C872bD47BC4255E60ECBF44D5E66e7401C',
146
+ [TokenSymbol.cJPY]: '0x85Bee67D435A39f7467a8a9DE34a5B73D25Df426',
147
+ [TokenSymbol.cKES]: '0xC7e4635651E3e3Af82b61d3E23c159438daE3BbF',
148
+ [TokenSymbol.cNGN]: '0x3d5ae86F34E2a82771496D140daFAEf3789dF888',
149
+ [TokenSymbol.cREAL]: '0x2294298942fdc79417DE9E0D740A4957E0e7783a',
150
+ [TokenSymbol.cUSD]: '0xdE9e4C3ce781b4bA68120d6261cbad65ce0aB00b',
151
+ [TokenSymbol.cZAR]: '0x10CCfB235b0E1Ed394bACE4560C3ed016697687e',
152
+ [TokenSymbol.eXOF]: '0x5505b70207aE3B826c1A7607F19F3Bf73444A082',
153
+ [TokenSymbol.PUSO]: '0x0352976d940a2C3FBa0C3623198947Ee1d17869E',
154
+ [TokenSymbol.USDC]: '0xBD63e46Be8eF8D89dFde3054E7b9ECAEb8Ad83e9',
155
+ [TokenSymbol.USDT]: '0xCA53d9b72646B254d29EBeEb4c5cde7BB4bb59e0',
156
+ },
157
+ };
158
+ /**
159
+ * Helper function to get token address by symbol for a specific chain
160
+ * @param chainId - The chain ID
161
+ * @param symbol - The token symbol
162
+ * @returns The token address or undefined if not found
163
+ */
164
+ export function getTokenAddress(chainId, symbol) {
165
+ var _a;
166
+ return (_a = TOKEN_ADDRESSES_BY_CHAIN[chainId]) === null || _a === void 0 ? void 0 : _a[symbol];
167
+ }
168
+ /**
169
+ * Helper function to find a token by symbol in the cached tokens
170
+ * @param chainId - The chain ID
171
+ * @param symbol - The token symbol to search for
172
+ * @returns The token object or undefined if not found
173
+ */
174
+ export function findTokenBySymbol(chainId, symbol) {
175
+ const tokens = getCachedTokensSync(chainId);
176
+ return tokens.find((token) => token.symbol === symbol);
177
+ }
@@ -19,6 +19,8 @@ export function getCachedTradablePairs(chainId) {
19
19
  return yield import('./tradablePairs.42220').then((module) => module.tradablePairs42220);
20
20
  case 44787:
21
21
  return yield import('./tradablePairs.44787').then((module) => module.tradablePairs44787);
22
+ case 11142220:
23
+ return yield import('./tradablePairs.11142220').then((module) => module.tradablePairs11142220);
22
24
  default:
23
25
  return undefined;
24
26
  }
@@ -1,6 +1,5 @@
1
1
  export declare enum ChainId {
2
2
  CELO = 42220,
3
3
  CELO_SEPOLIA = 11142220,
4
- ALFAJORES = 44787,
5
- BASE = 8453
4
+ ALFAJORES = 44787
6
5
  }
@@ -3,5 +3,4 @@ export var ChainId;
3
3
  ChainId[ChainId["CELO"] = 42220] = "CELO";
4
4
  ChainId[ChainId["CELO_SEPOLIA"] = 11142220] = "CELO_SEPOLIA";
5
5
  ChainId[ChainId["ALFAJORES"] = 44787] = "ALFAJORES";
6
- ChainId[ChainId["BASE"] = 8453] = "BASE";
7
6
  })(ChainId || (ChainId = {}));
@@ -12,6 +12,12 @@ export interface Asset {
12
12
  address: Address;
13
13
  symbol: string;
14
14
  }
15
+ export interface Token {
16
+ address: Address;
17
+ symbol: string;
18
+ name: string;
19
+ decimals: number;
20
+ }
15
21
  export type TradablePairID = `${Address}-${Address}`;
16
22
  export interface TradablePair {
17
23
  id: TradablePairID;
@@ -91,6 +97,28 @@ export declare class Mento {
91
97
  * Attempts to get cached tradable pairs for the current chain
92
98
  */
93
99
  private getCachedTradablePairs;
100
+ /**
101
+ * Returns a list of all unique tokens available on the current chain.
102
+ * This method is synchronous and uses pre-cached token data.
103
+ * For runtime fetching from the blockchain, use getTokensAsync().
104
+ *
105
+ * @returns An array of unique Token objects from the static cache.
106
+ * @throws Error if no cached tokens are available for the current chain or if chainId is not yet initialized
107
+ */
108
+ getTokens(): Token[];
109
+ /**
110
+ * Fetches token metadata from the blockchain at runtime.
111
+ * This method is async and makes blockchain calls to get fresh token data.
112
+ * For synchronous access using cached data, use getTokens().
113
+ *
114
+ * @param options - Optional parameters
115
+ * @param options.cached - Whether to use cached data (default: true).
116
+ * If true, attempts to load from static cache first.
117
+ * @returns A Promise resolving to an array of unique Token objects.
118
+ */
119
+ getTokensAsync({ cached, }?: {
120
+ cached?: boolean;
121
+ }): Promise<Token[]>;
94
122
  /**
95
123
  * Returns the amount of tokenIn to be sold to buy amountOut of tokenOut.
96
124
  * If the provided tradablePair has a single (direct) pricing path, then direct pricing is used.
package/dist/esm/mento.js CHANGED
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { BiPoolManager__factory, Broker__factory, IBreakerBox__factory, IBroker__factory, IExchangeProvider__factory, } from '@mento-protocol/mento-core-ts';
11
11
  import { Signer } from 'ethers';
12
12
  import { getLimits, getLimitsConfig, getLimitsState } from './limits';
13
- import { getChainId, getSymbolFromTokenAddress, increaseAllowance, validateSigner, validateSignerOrProvider, } from './utils';
13
+ import { getChainId, getDecimalsFromTokenAddress, getNameFromTokenAddress, getSymbolFromTokenAddress, increaseAllowance, validateSigner, validateSignerOrProvider, } from './utils';
14
14
  import { strict as assert } from 'assert';
15
15
  import { IMentoRouter__factory } from 'mento-router-ts';
16
16
  import { getAddress } from './constants/addresses';
@@ -40,7 +40,10 @@ export class Mento {
40
40
  static create(signerOrProvider) {
41
41
  return __awaiter(this, void 0, void 0, function* () {
42
42
  validateSignerOrProvider(signerOrProvider);
43
- return new Mento(signerOrProvider, getAddress('Broker', yield getChainId(signerOrProvider)), getAddress('MentoRouter', yield getChainId(signerOrProvider)));
43
+ const chainId = yield getChainId(signerOrProvider);
44
+ const instance = new Mento(signerOrProvider, getAddress('Broker', chainId), getAddress('MentoRouter', chainId));
45
+ instance.cachedChainId = chainId;
46
+ return instance;
44
47
  });
45
48
  }
46
49
  /**
@@ -157,6 +160,66 @@ export class Mento {
157
160
  return yield getCachedTradablePairs(chainId);
158
161
  });
159
162
  }
163
+ /**
164
+ * Returns a list of all unique tokens available on the current chain.
165
+ * This method is synchronous and uses pre-cached token data.
166
+ * For runtime fetching from the blockchain, use getTokensAsync().
167
+ *
168
+ * @returns An array of unique Token objects from the static cache.
169
+ * @throws Error if no cached tokens are available for the current chain or if chainId is not yet initialized
170
+ */
171
+ getTokens() {
172
+ if (this.cachedChainId === null) {
173
+ throw new Error('Chain ID not yet initialized. Use Mento.create() to initialize the SDK, or use getTokensAsync() instead.');
174
+ }
175
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
176
+ const { getCachedTokensSync } = require('./constants/tokens');
177
+ return Array.from(getCachedTokensSync(this.cachedChainId));
178
+ }
179
+ /**
180
+ * Fetches token metadata from the blockchain at runtime.
181
+ * This method is async and makes blockchain calls to get fresh token data.
182
+ * For synchronous access using cached data, use getTokens().
183
+ *
184
+ * @param options - Optional parameters
185
+ * @param options.cached - Whether to use cached data (default: true).
186
+ * If true, attempts to load from static cache first.
187
+ * @returns A Promise resolving to an array of unique Token objects.
188
+ */
189
+ getTokensAsync({ cached = true, } = {}) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ // If cached is true, try to use the static cache first
192
+ if (cached) {
193
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
194
+ const { getCachedTokens } = require('./constants/tokens');
195
+ const chainId = yield this.chainId();
196
+ const cachedTokens = yield getCachedTokens(chainId);
197
+ if (cachedTokens) {
198
+ return Array.from(cachedTokens);
199
+ }
200
+ }
201
+ // Fall back to fetching from blockchain
202
+ const tradablePairs = yield this.getTradablePairsWithPath({ cached: false });
203
+ // Collect unique token addresses
204
+ const uniqueAddresses = new Set(tradablePairs.flatMap((pair) => pair.assets.map((asset) => asset.address)));
205
+ // Fetch token metadata for each unique address
206
+ const tokens = yield Promise.all(Array.from(uniqueAddresses).map((address) => __awaiter(this, void 0, void 0, function* () {
207
+ const [symbol, name, decimals] = yield Promise.all([
208
+ getSymbolFromTokenAddress(address, this.signerOrProvider),
209
+ getNameFromTokenAddress(address, this.signerOrProvider),
210
+ getDecimalsFromTokenAddress(address, this.signerOrProvider),
211
+ ]);
212
+ return {
213
+ address,
214
+ symbol,
215
+ name,
216
+ decimals,
217
+ };
218
+ })));
219
+ // Sort by symbol
220
+ return tokens.sort((a, b) => a.symbol.localeCompare(b.symbol));
221
+ });
222
+ }
160
223
  /**
161
224
  * Returns the amount of tokenIn to be sold to buy amountOut of tokenOut.
162
225
  * If the provided tradablePair has a single (direct) pricing path, then direct pricing is used.