@curvefi/api 2.69.15 → 2.69.17

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.
@@ -43,6 +43,7 @@ export const COINS_ETHEREUM = lowerCaseValues({
43
43
  ust: "0xa47c8bf37f92abed4a126bda807a7b7498661acd", // UST
44
44
  usdn: "0x674C6Ad92Fd080e4004b2312b45f796a192D27a0", // USDN
45
45
  dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI
46
+ sdai: "0x83F20F44975D03b1b09e64809B757c47f942BEeA", // sDAI
46
47
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
47
48
  syrupusdc: "0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b", // syrupUSDC
48
49
  usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * TwoCrypto pool implementation configurations https://docs.curve.finance/deployments/implementations/#cryptoswap-ng
3
3
  */
4
+ import { IDict } from "../interfaces.js";
4
5
  export type TwoCryptoImplementationIndex = number | string;
5
6
  /**
6
7
  * TwoCrypto implementation indices
@@ -17,9 +18,9 @@ export declare enum TwoCryptoImplementation {
17
18
  */
18
19
  export interface TwoCryptoImplementationInfo {
19
20
  index: TwoCryptoImplementationIndex;
20
- address: string;
21
+ addresses: IDict<string>;
21
22
  description: string;
22
23
  availableInUI: boolean;
23
24
  }
24
25
  export declare const TWOCRYPTO_IMPLEMENTATIONS: TwoCryptoImplementationInfo[];
25
- export declare function getTwoCryptoImplementations(uiOnly?: boolean): TwoCryptoImplementationInfo[];
26
+ export declare function getTwoCryptoImplementations(chainId?: number, uiOnly?: boolean): TwoCryptoImplementationInfo[];
@@ -15,35 +15,51 @@ export var TwoCryptoImplementation;
15
15
  export const TWOCRYPTO_IMPLEMENTATIONS = [
16
16
  {
17
17
  index: TwoCryptoImplementation.DEFAULT,
18
- address: "0x934791f7F391727db92BFF94cd789c4623d14c52",
18
+ addresses: {
19
+ 1: "0x934791f7F391727db92BFF94cd789c4623d14c52",
20
+ },
19
21
  description: "",
20
22
  availableInUI: true,
21
23
  },
22
24
  {
23
25
  index: TwoCryptoImplementation.YB_POOLS_0_PERCENT,
24
- address: "0x82c251317ede0514302EEE1aD48f838a7A6EcE2F",
26
+ addresses: {
27
+ 1: "0x82c251317ede0514302EEE1aD48f838a7A6EcE2F",
28
+ },
25
29
  description: "TwoCrypto (0% DAO fee) — for yb pools",
26
30
  availableInUI: false,
27
31
  },
28
32
  {
29
33
  index: TwoCryptoImplementation.FX_25_PERCENT,
30
- address: "0x3B0df55A2c64Ac7A3ada784eEA0898F0FD3cF17e",
34
+ addresses: {
35
+ 1: "0x3B0df55A2c64Ac7A3ada784eEA0898F0FD3cF17e",
36
+ },
31
37
  description: "TwoCrypto (25% DAO fee) — for FX where the asset issuer will be the main source of LP and donations",
32
38
  availableInUI: false,
33
39
  },
34
40
  {
35
41
  index: TwoCryptoImplementation.FX_REGULAR_50_PERCENT,
36
- address: "0xD1FAeCA80d6FDd1DF4CBcCe4b2551b6Ee63Ae3D6",
42
+ addresses: {
43
+ 1: "0xD1FAeCA80d6FDd1DF4CBcCe4b2551b6Ee63Ae3D6",
44
+ 42161: "0x8c8CD70277b02E24aa9afE3dbAD1Ee10443eff2D",
45
+ },
37
46
  description: "TwoCrypto (50% DAO fee) — for FX / regular pairs (where donations may stream from within Curve protocol)",
38
47
  availableInUI: true,
39
48
  },
40
49
  {
41
50
  index: TwoCryptoImplementation.SETTABLE_ADMIN_FEE,
42
- address: "0xeC1045809e383811Cc74B3D25219e1607A5f32dC",
51
+ addresses: {
52
+ 1: "0xeC1045809e383811Cc74B3D25219e1607A5f32dC",
53
+ },
43
54
  description: "Alternative implementation with settable admin fee for two/tricrypto (default admin fee remains at 50%)",
44
55
  availableInUI: false,
45
56
  },
46
57
  ];
47
- export function getTwoCryptoImplementations(uiOnly = false) {
48
- return uiOnly ? TWOCRYPTO_IMPLEMENTATIONS.filter((impl) => impl.availableInUI) : TWOCRYPTO_IMPLEMENTATIONS;
58
+ export function getTwoCryptoImplementations(chainId, uiOnly = false) {
59
+ let implementations = TWOCRYPTO_IMPLEMENTATIONS;
60
+ if (uiOnly)
61
+ implementations = implementations.filter((impl) => impl.availableInUI);
62
+ if (chainId)
63
+ implementations = implementations.filter((impl) => chainId in impl.addresses);
64
+ return implementations;
49
65
  }
package/lib/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import { ethers } from "ethers";
2
2
  import { PoolTemplate } from "./pools/index.js";
3
3
  import { getSupportedNetworks } from "./bridge.js";
4
4
  import { deployCryptoPoolEstimateGas, deployTwocryptoPoolEstimateGas } from './factory/deploy.js';
5
- import { getTwoCryptoImplementations } from './constants/twoCryptoImplementations.js';
6
5
  export declare const createCurve: () => {
7
6
  init: (this: ReturnType<typeof createCurve>, providerType: "JsonRpc" | "Web3" | "Infura" | "Alchemy" | "NoRPC", providerSettings: "NoRPC" | {
8
7
  url?: string;
@@ -157,7 +156,7 @@ export declare const createCurve: () => {
157
156
  getDeployedGaugeMirrorAddressByTx: (tx: ethers.ContractTransactionResponse) => Promise<string>;
158
157
  fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
159
158
  gaugeImplementation: () => string;
160
- getImplementations: typeof getTwoCryptoImplementations;
159
+ getImplementations: (uiOnly?: boolean) => import("./constants/twoCryptoImplementations.js").TwoCryptoImplementationInfo[];
161
160
  estimateGas: {
162
161
  deployPool: typeof deployTwocryptoPoolEstimateGas;
163
162
  deployGauge: (poolAddress: string) => Promise<number>;
@@ -491,7 +490,7 @@ declare const _default: {
491
490
  getDeployedGaugeMirrorAddressByTx: (tx: ethers.ContractTransactionResponse) => Promise<string>;
492
491
  fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
493
492
  gaugeImplementation: () => string;
494
- getImplementations: typeof getTwoCryptoImplementations;
493
+ getImplementations: (uiOnly?: boolean) => import("./constants/twoCryptoImplementations.js").TwoCryptoImplementationInfo[];
495
494
  estimateGas: {
496
495
  deployPool: typeof deployTwocryptoPoolEstimateGas;
497
496
  deployGauge: (poolAddress: string) => Promise<number>;
package/lib/index.js CHANGED
@@ -148,7 +148,7 @@ export const createCurve = () => {
148
148
  getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
149
149
  fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTwocryptoFactoryPool.bind(_curve),
150
150
  gaugeImplementation: () => _curve.getGaugeImplementation("factory-twocrypto"),
151
- getImplementations: getTwoCryptoImplementations,
151
+ getImplementations: (uiOnly) => getTwoCryptoImplementations(_curve.chainId, uiOnly),
152
152
  estimateGas: {
153
153
  deployPool: deployTwocryptoPoolEstimateGas, //
154
154
  deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas.call(_curve, poolAddress, _curve.constants.ALIASES.twocrypto_factory); }),
@@ -185,6 +185,37 @@ export function routeGraphWorker() {
185
185
  tvl: Infinity,
186
186
  }];
187
187
  }
188
+ // sDAI <-> DAI (Ethereum only)
189
+ if (chainId === 1) {
190
+ routerGraph[constants.COINS.dai] = {};
191
+ routerGraph[constants.COINS.dai][constants.COINS.sdai] = [{
192
+ poolId: "sDAI wrapper",
193
+ swapAddress: constants.COINS.sdai,
194
+ inputCoinAddress: constants.COINS.dai,
195
+ outputCoinAddress: constants.COINS.sdai,
196
+ swapParams: [0, 1, 9, 0, 0],
197
+ poolAddress: constants.ZERO_ADDRESS,
198
+ basePool: constants.ZERO_ADDRESS,
199
+ baseToken: constants.ZERO_ADDRESS,
200
+ secondBasePool: constants.ZERO_ADDRESS,
201
+ secondBaseToken: constants.ZERO_ADDRESS,
202
+ tvl: Infinity,
203
+ }];
204
+ routerGraph[constants.COINS.sdai] = {};
205
+ routerGraph[constants.COINS.sdai][constants.COINS.dai] = [{
206
+ poolId: "sDAI wrapper",
207
+ swapAddress: constants.COINS.sdai,
208
+ inputCoinAddress: constants.COINS.sdai,
209
+ outputCoinAddress: constants.COINS.dai,
210
+ swapParams: [1, 0, 9, 0, 0],
211
+ poolAddress: constants.ZERO_ADDRESS,
212
+ basePool: constants.ZERO_ADDRESS,
213
+ baseToken: constants.ZERO_ADDRESS,
214
+ secondBasePool: constants.ZERO_ADDRESS,
215
+ secondBaseToken: constants.ZERO_ADDRESS,
216
+ tvl: Infinity,
217
+ }];
218
+ }
188
219
  // sreUSD <-> reUSD (Ethereum only)
189
220
  if (chainId === 1) {
190
221
  routerGraph[constants.COINS.reusd] = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.69.15",
3
+ "version": "2.69.17",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",