@curvefi/api 2.69.5 → 2.69.6

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.
@@ -0,0 +1,4 @@
1
+ export declare const CELO_CHAIN_ID = 42220;
2
+ export declare const ARC_CHAIN_ID = 5042;
3
+ export declare const POLYGON_CHAIN_ID = 137;
4
+ export declare const STABLE_CHAIN_ID = 988;
@@ -0,0 +1,4 @@
1
+ export const CELO_CHAIN_ID = 42220;
2
+ export const ARC_CHAIN_ID = 5042;
3
+ export const POLYGON_CHAIN_ID = 137;
4
+ export const STABLE_CHAIN_ID = 988;
@@ -1,5 +1,7 @@
1
1
  export function routeGraphWorker() {
2
2
  const GRAPH_MAX_EDGES = 3;
3
+ const CELO_CHAIN_ID = 42220;
4
+ const ARC_CHAIN_ID = 5042; // native USDC is the same asset as its ERC-20 interface
3
5
  // Pools excluded from router
4
6
  const EXCLUDED_POOLS_FROM_ROUTER = {
5
7
  1: ['usdt'], // Ethereum mainnet
@@ -9,8 +11,8 @@ export function routeGraphWorker() {
9
11
  const routerGraph = {};
10
12
  // Pool addresses we don't want to index when building routes
11
13
  const blacklistedPools = new Set((blacklist !== null && blacklist !== void 0 ? blacklist : []).map((a) => a.toLowerCase()));
12
- // ETH <-> WETH (exclude Celo)
13
- if (chainId !== 42220) {
14
+ // ETH <-> WETH (exclude Celo, Arc — native USDC = ERC-20 USDC)
15
+ if (chainId !== CELO_CHAIN_ID && chainId !== ARC_CHAIN_ID) {
14
16
  const wrapperAddress = constants.NATIVE_TOKEN.wrapperAddress || constants.NATIVE_TOKEN.wrappedAddress;
15
17
  routerGraph[constants.NATIVE_TOKEN.address] = {};
16
18
  routerGraph[constants.NATIVE_TOKEN.address][constants.NATIVE_TOKEN.wrappedAddress] = [{
package/lib/utils.js CHANGED
@@ -19,6 +19,7 @@ import { getPool } from "./pools/index.js";
19
19
  import { NETWORK_CONSTANTS } from "./constants/network_constants.js";
20
20
  import { formatUnits } from "./constants/utils.js";
21
21
  import { FEE_HISTORY_BLOCK_COUNT, GAS_STRATEGIES, MAINNET_CHAIN_ID, } from "./constants/gas.js";
22
+ import { ARC_CHAIN_ID, POLYGON_CHAIN_ID, STABLE_CHAIN_ID } from "./constants/chainIds.js";
22
23
  export const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
23
24
  // export const MAX_ALLOWANCE = curve.parseUnits(new BigNumber(2).pow(256).minus(1).toFixed(), 0);
24
25
  export const MAX_ALLOWANCE = BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"); // 2**256 - 1
@@ -342,7 +343,10 @@ export function _getUsdRate(assetId) {
342
343
  const pricesFromApi = yield _getUsdPricesFromApi(this.constants.NETWORK_NAME, this.isLiteChain);
343
344
  if (assetId.toLowerCase() in pricesFromApi)
344
345
  return pricesFromApi[assetId.toLowerCase()];
345
- if (assetId === 'USD' || (this.chainId === 137 && (assetId.toLowerCase() === this.constants.COINS.am3crv.toLowerCase())))
346
+ if (assetId === 'USD' || (this.chainId === POLYGON_CHAIN_ID && (assetId.toLowerCase() === this.constants.COINS.am3crv.toLowerCase())))
347
+ return 1;
348
+ if (this.chainId === ARC_CHAIN_ID && (this.isEth(assetId) ||
349
+ assetId.toLowerCase() === this.constants.NATIVE_TOKEN.wrappedAddress.toLowerCase()))
346
350
  return 1;
347
351
  let chainName = this.isLiteChain ? yield this.constants.NETWORK_NAME : {
348
352
  1: 'ethereum',
@@ -404,8 +408,8 @@ export function _getUsdRate(assetId) {
404
408
  'ETH': 'ethereum',
405
409
  'LINK': 'link',
406
410
  }[assetId.toUpperCase()] || assetId;
407
- // Special case for chainId 988 native and wrapped tokens are USDT
408
- if (this.chainId === 988) {
411
+ // Special case for chainId STABLE_CHAIN_ID native and wrapped tokens are USDT
412
+ if (this.chainId === STABLE_CHAIN_ID) {
409
413
  if (this.isEth(assetId) || assetId.toLowerCase() === this.constants.NATIVE_TOKEN.wrappedAddress.toLowerCase()) {
410
414
  assetId = 'tether';
411
415
  }
@@ -414,7 +418,7 @@ export function _getUsdRate(assetId) {
414
418
  assetId = this.isEth(assetId) ? nativeTokenName : assetId.toLowerCase();
415
419
  }
416
420
  // No EURT on Coingecko Polygon
417
- if (this.chainId === 137 && assetId.toLowerCase() === this.constants.COINS.eurt) {
421
+ if (this.chainId === POLYGON_CHAIN_ID && assetId.toLowerCase() === this.constants.COINS.eurt) {
418
422
  chainName = 'ethereum';
419
423
  assetId = '0xC581b735A1688071A1746c968e0798D642EDE491'.toLowerCase(); // EURT Ethereum
420
424
  }
@@ -423,8 +427,8 @@ export function _getUsdRate(assetId) {
423
427
  assetId = 'curve-dao-token';
424
428
  }
425
429
  if (this.isLiteChain && assetId.toLowerCase() === ((_f = this.constants.API_CONSTANTS) === null || _f === void 0 ? void 0 : _f.wrappedNativeTokenAddress.toLowerCase())) {
426
- // For chainId 988, already handled above (tether)
427
- if (this.chainId !== 988) {
430
+ // For chainId STABLE_CHAIN_ID, already handled above (tether)
431
+ if (this.chainId !== STABLE_CHAIN_ID) {
428
432
  assetId = nativeTokenName;
429
433
  }
430
434
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.69.5",
3
+ "version": "2.69.6",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",