@curvefi/api 2.68.8 → 2.68.10

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.
@@ -1,5 +1,5 @@
1
1
  export const volumeNetworks = {
2
- getVolumes: [1, 10, 100, 137, 250, 252, 999, 8453, 42161, 146],
2
+ getVolumes: [1, 10, 56, 100, 137, 250, 252, 999, 8453, 42161, 146],
3
3
  getSubgraphData: [43114],
4
- getFactoryAPYs: [56, 196, 324, 1284, 2222, 5000, 42220, 1313161554],
4
+ getFactoryAPYs: [196, 324, 1284, 2222, 5000, 42220, 1313161554],
5
5
  };
@@ -1,2 +1,3 @@
1
1
  export declare const YB_POOLS: string[];
2
+ export declare const YB_ASSETS: string[];
2
3
  export declare const isYBPool: (poolAddress: string) => boolean;
@@ -3,6 +3,11 @@ export const YB_POOLS = [
3
3
  "0xd9ff8396554a0d18b2cfbec53e1979b7ecce8373",
4
4
  "0x83f24023d15d835a213df24fd309c47dab5beb32",
5
5
  ].map((pool) => pool.toLowerCase());
6
+ export const YB_ASSETS = [
7
+ "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC
8
+ "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf", // cbBTC
9
+ "0x18084fbA666a33d37592fA2633fD49a74DD93a88", // tBTC
10
+ ].map((asset) => asset.toLowerCase());
6
11
  export const isYBPool = (poolAddress) => {
7
12
  return YB_POOLS.includes(poolAddress.toLowerCase());
8
13
  };
@@ -4,6 +4,7 @@ export type IRouterWorkerInput = {
4
4
  outputCoinAddress: string;
5
5
  routerGraph: IDict<IDict<IRouteStep[]>>;
6
6
  poolData: IDict<IRoutePoolData>;
7
+ ybAssets: string[];
7
8
  };
8
- export declare function routeFinderWorker(): (({ inputCoinAddress, outputCoinAddress, routerGraph, poolData }: IRouterWorkerInput) => IRouteStep[][]) | undefined;
9
+ export declare function routeFinderWorker(): (({ inputCoinAddress, outputCoinAddress, routerGraph, poolData, ybAssets }: IRouterWorkerInput) => IRouteStep[][]) | undefined;
9
10
  export declare const routeFinderWorkerCode: string;
@@ -1,5 +1,4 @@
1
1
  export function routeFinderWorker() {
2
- const MAX_ROUTES_FOR_ONE_COIN = 5;
3
2
  const MAX_DEPTH = 4;
4
3
  const _removeDuplications = (routesA, routesB) => {
5
4
  const routeToStr = (r) => r.route.map((s) => s.poolId).toString();
@@ -47,9 +46,11 @@ export function routeFinderWorker() {
47
46
  }
48
47
  const _isVisitedCoin = (coinAddress, route) => route.route.find((r) => r.inputCoinAddress === coinAddress) !== undefined;
49
48
  const _findPool = (route, poolId) => route.route.find((r) => r.poolId === poolId);
50
- const findRoutes = ({ inputCoinAddress, outputCoinAddress, routerGraph, poolData }) => {
49
+ const findRoutes = ({ inputCoinAddress, outputCoinAddress, routerGraph, poolData, ybAssets }) => {
51
50
  inputCoinAddress = inputCoinAddress.toLowerCase();
52
51
  outputCoinAddress = outputCoinAddress.toLowerCase();
52
+ const isYBAsset = ybAssets.includes(inputCoinAddress) || ybAssets.includes(outputCoinAddress);
53
+ const MAX_ROUTES_FOR_ONE_COIN = isYBAsset ? 10 : 5;
53
54
  const routes = [{ route: [], minTvl: Infinity, totalTvl: 0 }];
54
55
  const targetRoutesByTvl = [];
55
56
  const targetRoutesByLength = [];
package/lib/router.js CHANGED
@@ -16,6 +16,7 @@ import { L2Networks } from "./constants/L2Networks.js";
16
16
  import { routeFinderWorker, routeFinderWorkerCode } from "./route-finder.worker.js";
17
17
  import { routeGraphWorker, routeGraphWorkerCode } from "./route-graph.worker.js";
18
18
  import { memoizeMethod } from "./constants/utils.js";
19
+ import { YB_ASSETS } from "./constants/ybPools.js";
19
20
  const MAX_STEPS = 5;
20
21
  const ROUTE_LENGTH = (MAX_STEPS * 2) + 1;
21
22
  function _getTVL(poolId) {
@@ -49,7 +50,7 @@ function _findRoutes(inputCoinAddress, outputCoinAddress) {
49
50
  const routerGraph = yield _buildRouteGraph.call(this, this.chainId, this.isLiteChain); // It's important to pass chainId to not use cache from another network
50
51
  // extract only the fields we need for the worker
51
52
  const poolData = mapDict(this.getPoolsData(), (_, { is_lending, wrapped_coin_addresses, underlying_coin_addresses, token_address }) => ({ is_lending, wrapped_coin_addresses, underlying_coin_addresses, token_address }));
52
- const input = { inputCoinAddress, outputCoinAddress, routerGraph, poolData };
53
+ const input = { inputCoinAddress, outputCoinAddress, routerGraph, poolData, ybAssets: YB_ASSETS };
53
54
  return runWorker(routeFinderWorkerCode, routeFinderWorker, Object.assign({ type: 'findRoutes' }, input));
54
55
  });
55
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.68.8",
3
+ "version": "2.68.10",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",