@curvefi/api 2.30.1 → 2.31.1

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 (100) hide show
  1. package/lib/boosting.js +137 -402
  2. package/lib/constants/abis/avaxcrypto/swap.json +1195 -0
  3. package/lib/constants/abis/avaxcrypto/zap.json +250 -0
  4. package/lib/constants/aliases.d.ts +11 -11
  5. package/lib/constants/aliases.js +12 -15
  6. package/lib/constants/coins/arbitrum.js +6 -9
  7. package/lib/constants/coins/aurora.js +6 -9
  8. package/lib/constants/coins/avalanche.js +12 -10
  9. package/lib/constants/coins/celo.js +6 -9
  10. package/lib/constants/coins/ethereum.js +10 -13
  11. package/lib/constants/coins/fantom.js +8 -11
  12. package/lib/constants/coins/kava.js +6 -9
  13. package/lib/constants/coins/moonbeam.js +6 -9
  14. package/lib/constants/coins/optimism.js +6 -9
  15. package/lib/constants/coins/polygon.js +7 -10
  16. package/lib/constants/coins/xdai.js +6 -9
  17. package/lib/constants/pools/arbitrum.d.ts +2 -4
  18. package/lib/constants/pools/arbitrum.js +22 -28
  19. package/lib/constants/pools/aurora.d.ts +2 -4
  20. package/lib/constants/pools/aurora.js +6 -12
  21. package/lib/constants/pools/avalanche.d.ts +2 -4
  22. package/lib/constants/pools/avalanche.js +51 -22
  23. package/lib/constants/pools/celo.d.ts +2 -4
  24. package/lib/constants/pools/celo.js +2 -5
  25. package/lib/constants/pools/ethereum.js +247 -253
  26. package/lib/constants/pools/fantom.d.ts +2 -4
  27. package/lib/constants/pools/fantom.js +28 -34
  28. package/lib/constants/pools/index.d.ts +11 -11
  29. package/lib/constants/pools/index.js +12 -25
  30. package/lib/constants/pools/kava.d.ts +2 -4
  31. package/lib/constants/pools/kava.js +2 -5
  32. package/lib/constants/pools/moonbeam.d.ts +2 -4
  33. package/lib/constants/pools/moonbeam.js +6 -12
  34. package/lib/constants/pools/optimism.d.ts +2 -4
  35. package/lib/constants/pools/optimism.js +9 -15
  36. package/lib/constants/pools/polygon.d.ts +2 -4
  37. package/lib/constants/pools/polygon.js +23 -28
  38. package/lib/constants/pools/xdai.d.ts +2 -4
  39. package/lib/constants/pools/xdai.js +25 -30
  40. package/lib/constants/utils.js +20 -29
  41. package/lib/curve.d.ts +9 -7
  42. package/lib/curve.js +397 -615
  43. package/lib/external-api.d.ts +1 -1
  44. package/lib/external-api.js +47 -140
  45. package/lib/factory/common.js +6 -10
  46. package/lib/factory/constants-crypto.js +48 -54
  47. package/lib/factory/constants.js +274 -280
  48. package/lib/factory/deploy.d.ts +8 -8
  49. package/lib/factory/deploy.js +177 -347
  50. package/lib/factory/factory-api.js +195 -278
  51. package/lib/factory/factory-crypto.js +170 -323
  52. package/lib/factory/factory.js +195 -350
  53. package/lib/index.d.ts +24 -25
  54. package/lib/index.js +87 -143
  55. package/lib/interfaces.d.ts +6 -5
  56. package/lib/interfaces.js +1 -2
  57. package/lib/pools/PoolTemplate.d.ts +1 -0
  58. package/lib/pools/PoolTemplate.js +1516 -2928
  59. package/lib/pools/index.d.ts +2 -2
  60. package/lib/pools/index.js +3 -7
  61. package/lib/pools/mixins/common.d.ts +3 -4
  62. package/lib/pools/mixins/common.js +23 -102
  63. package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +1 -1
  64. package/lib/pools/mixins/depositBalancedAmountsMixins.js +50 -139
  65. package/lib/pools/mixins/depositMixins.d.ts +1 -1
  66. package/lib/pools/mixins/depositMixins.js +145 -405
  67. package/lib/pools/mixins/depositWrappedMixins.d.ts +1 -1
  68. package/lib/pools/mixins/depositWrappedMixins.js +72 -227
  69. package/lib/pools/mixins/poolBalancesMixin.d.ts +1 -2
  70. package/lib/pools/mixins/poolBalancesMixin.js +25 -131
  71. package/lib/pools/mixins/swapMixins.d.ts +1 -1
  72. package/lib/pools/mixins/swapMixins.js +127 -353
  73. package/lib/pools/mixins/swapWrappedMixins.d.ts +1 -1
  74. package/lib/pools/mixins/swapWrappedMixins.js +90 -276
  75. package/lib/pools/mixins/withdrawExpectedMixins.d.ts +1 -2
  76. package/lib/pools/mixins/withdrawExpectedMixins.js +26 -154
  77. package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +1 -1
  78. package/lib/pools/mixins/withdrawImbalanceMixins.js +99 -321
  79. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +1 -1
  80. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +53 -192
  81. package/lib/pools/mixins/withdrawMixins.d.ts +1 -1
  82. package/lib/pools/mixins/withdrawMixins.js +124 -378
  83. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +1 -1
  84. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +17 -92
  85. package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +1 -1
  86. package/lib/pools/mixins/withdrawOneCoinMixins.js +125 -378
  87. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +1 -1
  88. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +9 -66
  89. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +1 -1
  90. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +55 -190
  91. package/lib/pools/mixins/withdrawWrappedMixins.d.ts +1 -1
  92. package/lib/pools/mixins/withdrawWrappedMixins.js +52 -191
  93. package/lib/pools/poolConstructor.d.ts +1 -1
  94. package/lib/pools/poolConstructor.js +79 -109
  95. package/lib/pools/utils.js +298 -500
  96. package/lib/router.d.ts +2 -2
  97. package/lib/router.js +406 -650
  98. package/lib/utils.d.ts +9 -9
  99. package/lib/utils.js +377 -731
  100. package/package.json +8 -8
package/lib/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { ethers } from "ethers";
2
- import { Networkish } from "@ethersproject/networks";
3
- import { PoolTemplate } from "./pools";
1
+ import { ethers, Networkish } from "ethers";
2
+ import { PoolTemplate } from "./pools/index.js";
4
3
  declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy', providerSettings: {
5
4
  url?: string;
6
5
  privateKey?: string;
7
6
  } | {
8
- externalProvider: ethers.providers.ExternalProvider;
7
+ externalProvider: ethers.Eip1193Provider;
9
8
  } | {
10
9
  network?: Networkish;
11
10
  apiKey?: string;
@@ -39,8 +38,8 @@ declare const curve: {
39
38
  PoolTemplate: typeof PoolTemplate;
40
39
  getPool: (poolId: string) => PoolTemplate;
41
40
  getUsdRate: (coin: string) => Promise<number>;
42
- getTVL: (network?: import("./interfaces").INetworkName | import("./interfaces").IChainId) => Promise<number>;
43
- getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<string[] | import("./interfaces").IDict<string[]>>;
41
+ getTVL: (network?: import("./interfaces.js").INetworkName | import("./interfaces.js").IChainId) => Promise<number>;
42
+ getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<string[] | import("./interfaces.js").IDict<string[]>>;
44
43
  getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
45
44
  hasAllowance: (coins: string[], amounts: (string | number)[], address: string, spender: string) => Promise<boolean>;
46
45
  ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean) => Promise<string[]>;
@@ -49,7 +48,7 @@ declare const curve: {
49
48
  symbol: string;
50
49
  decimals: number;
51
50
  }[]>;
52
- getVolume: (network?: import("./interfaces").INetworkName | import("./interfaces").IChainId) => Promise<{
51
+ getVolume: (network?: import("./interfaces.js").INetworkName | import("./interfaces.js").IChainId) => Promise<{
53
52
  totalVolume: number;
54
53
  cryptoVolume: number;
55
54
  cryptoShare: number;
@@ -58,12 +57,12 @@ declare const curve: {
58
57
  fetchPools: (useApi?: boolean) => Promise<void>;
59
58
  fetchNewPools: () => Promise<string[]>;
60
59
  getPoolList: () => string[];
61
- deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransaction>;
62
- deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<ethers.ContractTransaction>;
63
- deployGauge: (poolAddress: string) => Promise<ethers.ContractTransaction>;
64
- getDeployedPlainPoolAddress: (tx: ethers.ContractTransaction) => Promise<string>;
65
- getDeployedMetaPoolAddress: (tx: ethers.ContractTransaction) => Promise<string>;
66
- getDeployedGaugeAddress: (tx: ethers.ContractTransaction) => Promise<string>;
60
+ deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransactionResponse>;
61
+ deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
62
+ deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
63
+ getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
64
+ getDeployedMetaPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
65
+ getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
67
66
  fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
68
67
  estimateGas: {
69
68
  deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<number>;
@@ -75,11 +74,11 @@ declare const curve: {
75
74
  fetchPools: (useApi?: boolean) => Promise<void>;
76
75
  fetchNewPools: () => Promise<string[]>;
77
76
  getPoolList: () => string[];
78
- deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: string | number, initialPrice: string | number) => Promise<ethers.ContractTransaction>;
79
- deployGauge: (poolAddress: string) => Promise<ethers.ContractTransaction>;
80
- getDeployed: (tx: ethers.ContractTransaction) => Promise<string>;
81
- getDeployedPoolAddress: (tx: ethers.ContractTransaction) => Promise<string>;
82
- getDeployedGaugeAddress: (tx: ethers.ContractTransaction) => Promise<string>;
77
+ deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: string | number, initialPrice: string | number) => Promise<ethers.ContractTransactionResponse>;
78
+ deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
79
+ getDeployed: (tx: ethers.ContractTransactionResponse) => Promise<string>;
80
+ getDeployedPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
81
+ getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
83
82
  fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
84
83
  estimateGas: {
85
84
  deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: string | number, initialPrice: string | number) => Promise<number>;
@@ -90,16 +89,16 @@ declare const curve: {
90
89
  ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean) => Promise<number>;
91
90
  };
92
91
  boosting: {
93
- getCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").IDict<string>>;
94
- getLockedAmountAndUnlockTime: (...addresses: string[] | string[][]) => Promise<import("./interfaces").IDict<{
92
+ getCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces.js").IDict<string>>;
93
+ getLockedAmountAndUnlockTime: (...addresses: string[] | string[][]) => Promise<import("./interfaces.js").IDict<{
95
94
  lockedAmount: string;
96
95
  unlockTime: number;
97
96
  }> | {
98
97
  lockedAmount: string;
99
98
  unlockTime: number;
100
99
  }>;
101
- getVeCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").IDict<string>>;
102
- getVeCrvPct: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").IDict<string>>;
100
+ getVeCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces.js").IDict<string>>;
101
+ getVeCrvPct: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces.js").IDict<string>>;
103
102
  calcUnlockTime: (days: number, start?: number) => number;
104
103
  isApproved: (amount: string | number) => Promise<boolean>;
105
104
  approve: (amount: string | number) => Promise<string[]>;
@@ -120,15 +119,15 @@ declare const curve: {
120
119
  };
121
120
  router: {
122
121
  getBestRouteAndOutput: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<{
123
- route: import("./interfaces").IRoute;
122
+ route: import("./interfaces.js").IRoute;
124
123
  output: string;
125
124
  }>;
126
125
  expected: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<string>;
127
126
  priceImpact: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<number>;
128
127
  isApproved: (inputCoin: string, amount: string | number) => Promise<boolean>;
129
128
  approve: (inputCoin: string, amount: string | number) => Promise<string[]>;
130
- swap: (inputCoin: string, outputCoin: string, amount: string | number, slippage?: number) => Promise<ethers.ContractTransaction>;
131
- getSwappedAmount: (tx: ethers.ContractTransaction, outputCoin: string) => Promise<string>;
129
+ swap: (inputCoin: string, outputCoin: string, amount: string | number, slippage?: number) => Promise<ethers.ContractTransactionResponse>;
130
+ getSwappedAmount: (tx: ethers.ContractTransactionResponse, outputCoin: string) => Promise<string>;
132
131
  estimateGas: {
133
132
  approve: (inputCoin: string, amount: string | number) => Promise<number>;
134
133
  swap: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<number>;
package/lib/index.js CHANGED
@@ -1,167 +1,111 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var pools_1 = require("./pools");
40
- var utils_1 = require("./pools/utils");
41
- var router_1 = require("./router");
42
- var curve_1 = require("./curve");
43
- var boosting_1 = require("./boosting");
44
- var utils_2 = require("./utils");
45
- var deploy_1 = require("./factory/deploy");
46
- function init(providerType, providerSettings, options) {
47
- if (options === void 0) { options = {}; }
48
- return __awaiter(this, void 0, void 0, function () {
49
- return __generator(this, function (_a) {
50
- switch (_a.label) {
51
- case 0: return [4 /*yield*/, curve_1.curve.init(providerType, providerSettings, options)];
52
- case 1:
53
- _a.sent();
54
- // @ts-ignore
55
- this.signerAddress = curve_1.curve.signerAddress;
56
- // @ts-ignore
57
- this.chainId = curve_1.curve.chainId;
58
- return [2 /*return*/];
59
- }
60
- });
61
- });
1
+ import { PoolTemplate, getPool } from "./pools/index.js";
2
+ import { getUserPoolListByLiquidity, getUserPoolListByClaimable, getUserPoolList, getUserLiquidityUSD, getUserClaimable, } from "./pools/utils.js";
3
+ import { getBestRouteAndOutput, swapExpected, swapPriceImpact, swapIsApproved, swapApproveEstimateGas, swapApprove, swapEstimateGas, swap, getSwappedAmount, } from "./router.js";
4
+ import { curve as _curve } from "./curve.js";
5
+ import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, } from "./boosting.js";
6
+ import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getTVL, getCoinsData, getVolume, } from "./utils.js";
7
+ import { deployStablePlainPool, deployStablePlainPoolEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, deployCryptoPool, deployCryptoPoolEstimateGas, deployGauge, deployGaugeEstimateGas, getDeployedStablePlainPoolAddress, getDeployedStableMetaPoolAddress, getDeployedCryptoPoolAddress, getDeployedGaugeAddress, } from './factory/deploy.js';
8
+ async function init(providerType, providerSettings, options = {}) {
9
+ await _curve.init(providerType, providerSettings, options);
10
+ // @ts-ignore
11
+ this.signerAddress = _curve.signerAddress;
12
+ // @ts-ignore
13
+ this.chainId = _curve.chainId;
62
14
  }
63
15
  function setCustomFeeData(customFeeData) {
64
- curve_1.curve.setCustomFeeData(customFeeData);
16
+ _curve.setCustomFeeData(customFeeData);
65
17
  }
66
- var curve = {
67
- init: init,
18
+ const curve = {
19
+ init,
68
20
  chainId: 0,
69
21
  signerAddress: '',
70
- setCustomFeeData: setCustomFeeData,
71
- getPoolList: curve_1.curve.getPoolList,
72
- getUserPoolListByLiquidity: utils_1.getUserPoolListByLiquidity,
73
- getUserPoolListByClaimable: utils_1.getUserPoolListByClaimable,
74
- getUserPoolList: utils_1.getUserPoolList,
75
- getUserLiquidityUSD: utils_1.getUserLiquidityUSD,
76
- getUserClaimable: utils_1.getUserClaimable,
77
- PoolTemplate: pools_1.PoolTemplate,
78
- getPool: pools_1.getPool,
79
- getUsdRate: utils_2.getUsdRate,
80
- getTVL: utils_2.getTVL,
81
- getBalances: utils_2.getBalances,
82
- getAllowance: utils_2.getAllowance,
83
- hasAllowance: utils_2.hasAllowance,
84
- ensureAllowance: utils_2.ensureAllowance,
85
- getCoinsData: utils_2.getCoinsData,
86
- getVolume: utils_2.getVolume,
22
+ setCustomFeeData,
23
+ getPoolList: _curve.getPoolList,
24
+ getUserPoolListByLiquidity,
25
+ getUserPoolListByClaimable,
26
+ getUserPoolList,
27
+ getUserLiquidityUSD,
28
+ getUserClaimable,
29
+ PoolTemplate,
30
+ getPool,
31
+ getUsdRate,
32
+ getTVL,
33
+ getBalances,
34
+ getAllowance,
35
+ hasAllowance,
36
+ ensureAllowance,
37
+ getCoinsData,
38
+ getVolume,
87
39
  factory: {
88
- fetchPools: curve_1.curve.fetchFactoryPools,
89
- fetchNewPools: curve_1.curve.fetchNewFactoryPools,
90
- getPoolList: curve_1.curve.getFactoryPoolList,
91
- deployPlainPool: deploy_1.deployStablePlainPool,
92
- deployMetaPool: deploy_1.deployStableMetaPool,
93
- deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
94
- return [2 /*return*/, (0, deploy_1.deployGauge)(poolAddress, false)];
95
- }); }); },
96
- getDeployedPlainPoolAddress: deploy_1.getDeployedStablePlainPoolAddress,
97
- getDeployedMetaPoolAddress: deploy_1.getDeployedStableMetaPoolAddress,
98
- getDeployedGaugeAddress: deploy_1.getDeployedGaugeAddress,
99
- fetchRecentlyDeployedPool: curve_1.curve.fetchRecentlyDeployedFactoryPool,
40
+ fetchPools: _curve.fetchFactoryPools,
41
+ fetchNewPools: _curve.fetchNewFactoryPools,
42
+ getPoolList: _curve.getFactoryPoolList,
43
+ deployPlainPool: deployStablePlainPool,
44
+ deployMetaPool: deployStableMetaPool,
45
+ deployGauge: async (poolAddress) => deployGauge(poolAddress, false),
46
+ getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
47
+ getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
48
+ getDeployedGaugeAddress: getDeployedGaugeAddress,
49
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedFactoryPool,
100
50
  estimateGas: {
101
- deployPlainPool: deploy_1.deployStablePlainPoolEstimateGas,
102
- deployMetaPool: deploy_1.deployStableMetaPoolEstimateGas,
103
- deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
104
- return [2 /*return*/, (0, deploy_1.deployGaugeEstimateGas)(poolAddress, false)];
105
- }); }); },
51
+ deployPlainPool: deployStablePlainPoolEstimateGas,
52
+ deployMetaPool: deployStableMetaPoolEstimateGas,
53
+ deployGauge: async (poolAddress) => deployGaugeEstimateGas(poolAddress, false),
106
54
  },
107
55
  },
108
56
  cryptoFactory: {
109
- fetchPools: curve_1.curve.fetchCryptoFactoryPools,
110
- fetchNewPools: curve_1.curve.fetchNewCryptoFactoryPools,
111
- getPoolList: curve_1.curve.getCryptoFactoryPoolList,
112
- deployPool: deploy_1.deployCryptoPool,
113
- deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
114
- return [2 /*return*/, (0, deploy_1.deployGauge)(poolAddress, true)];
115
- }); }); },
116
- getDeployed: deploy_1.getDeployedStablePlainPoolAddress,
117
- getDeployedPoolAddress: deploy_1.getDeployedCryptoPoolAddress,
118
- getDeployedGaugeAddress: deploy_1.getDeployedGaugeAddress,
119
- fetchRecentlyDeployedPool: curve_1.curve.fetchRecentlyDeployedCryptoFactoryPool,
57
+ fetchPools: _curve.fetchCryptoFactoryPools,
58
+ fetchNewPools: _curve.fetchNewCryptoFactoryPools,
59
+ getPoolList: _curve.getCryptoFactoryPoolList,
60
+ deployPool: deployCryptoPool,
61
+ deployGauge: async (poolAddress) => deployGauge(poolAddress, true),
62
+ getDeployed: getDeployedStablePlainPoolAddress,
63
+ getDeployedPoolAddress: getDeployedCryptoPoolAddress,
64
+ getDeployedGaugeAddress: getDeployedGaugeAddress,
65
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedCryptoFactoryPool,
120
66
  estimateGas: {
121
- deployPool: deploy_1.deployCryptoPoolEstimateGas,
122
- deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
123
- return [2 /*return*/, (0, deploy_1.deployGaugeEstimateGas)(poolAddress, true)];
124
- }); }); },
67
+ deployPool: deployCryptoPoolEstimateGas,
68
+ deployGauge: async (poolAddress) => deployGaugeEstimateGas(poolAddress, true),
125
69
  },
126
70
  },
127
71
  estimateGas: {
128
- ensureAllowance: utils_2.ensureAllowanceEstimateGas,
72
+ ensureAllowance: ensureAllowanceEstimateGas,
129
73
  },
130
74
  boosting: {
131
- getCrv: boosting_1.getCrv,
132
- getLockedAmountAndUnlockTime: boosting_1.getLockedAmountAndUnlockTime,
133
- getVeCrv: boosting_1.getVeCrv,
134
- getVeCrvPct: boosting_1.getVeCrvPct,
135
- calcUnlockTime: boosting_1.calcUnlockTime,
136
- isApproved: boosting_1.isApproved,
137
- approve: boosting_1.approve,
138
- createLock: boosting_1.createLock,
139
- increaseAmount: boosting_1.increaseAmount,
140
- increaseUnlockTime: boosting_1.increaseUnlockTime,
141
- withdrawLockedCrv: boosting_1.withdrawLockedCrv,
142
- claimableFees: boosting_1.claimableFees,
143
- claimFees: boosting_1.claimFees,
75
+ getCrv,
76
+ getLockedAmountAndUnlockTime,
77
+ getVeCrv,
78
+ getVeCrvPct,
79
+ calcUnlockTime,
80
+ isApproved,
81
+ approve,
82
+ createLock,
83
+ increaseAmount,
84
+ increaseUnlockTime,
85
+ withdrawLockedCrv,
86
+ claimableFees,
87
+ claimFees,
144
88
  estimateGas: {
145
- approve: boosting_1.approveEstimateGas,
146
- createLock: boosting_1.createLockEstimateGas,
147
- increaseAmount: boosting_1.increaseAmountEstimateGas,
148
- increaseUnlockTime: boosting_1.increaseUnlockTimeEstimateGas,
149
- withdrawLockedCrv: boosting_1.withdrawLockedCrvEstimateGas,
150
- claimFees: boosting_1.claimFeesEstimateGas,
89
+ approve: approveEstimateGas,
90
+ createLock: createLockEstimateGas,
91
+ increaseAmount: increaseAmountEstimateGas,
92
+ increaseUnlockTime: increaseUnlockTimeEstimateGas,
93
+ withdrawLockedCrv: withdrawLockedCrvEstimateGas,
94
+ claimFees: claimFeesEstimateGas,
151
95
  },
152
96
  },
153
97
  router: {
154
- getBestRouteAndOutput: router_1.getBestRouteAndOutput,
155
- expected: router_1.swapExpected,
156
- priceImpact: router_1.swapPriceImpact,
157
- isApproved: router_1.swapIsApproved,
158
- approve: router_1.swapApprove,
159
- swap: router_1.swap,
160
- getSwappedAmount: router_1.getSwappedAmount,
98
+ getBestRouteAndOutput,
99
+ expected: swapExpected,
100
+ priceImpact: swapPriceImpact,
101
+ isApproved: swapIsApproved,
102
+ approve: swapApprove,
103
+ swap,
104
+ getSwappedAmount,
161
105
  estimateGas: {
162
- approve: router_1.swapApproveEstimateGas,
163
- swap: router_1.swapEstimateGas,
106
+ approve: swapApproveEstimateGas,
107
+ swap: swapEstimateGas,
164
108
  },
165
109
  },
166
110
  };
167
- exports.default = curve;
111
+ export default curve;
@@ -25,6 +25,7 @@ export interface IPoolData {
25
25
  is_fake?: boolean;
26
26
  is_factory?: boolean;
27
27
  base_pool?: string;
28
+ meta_coin_idx?: number;
28
29
  underlying_coins: string[];
29
30
  wrapped_coins: string[];
30
31
  underlying_coin_addresses: string[];
@@ -39,7 +40,7 @@ export interface IPoolData {
39
40
  in_api?: boolean;
40
41
  }
41
42
  export interface ICurve {
42
- provider: ethers.providers.Web3Provider | ethers.providers.JsonRpcProvider;
43
+ provider: ethers.BrowserProvider | ethers.JsonRpcProvider;
43
44
  multicallProvider: MulticallProvider;
44
45
  signer: ethers.Signer | null;
45
46
  signerAddress: string;
@@ -59,9 +60,9 @@ export interface ICurve {
59
60
  gasLimit: number;
60
61
  };
61
62
  options: {
62
- gasPrice?: number | ethers.BigNumber;
63
- maxFeePerGas?: number | ethers.BigNumber;
64
- maxPriorityFeePerGas?: number | ethers.BigNumber;
63
+ gasPrice?: number | bigint;
64
+ maxFeePerGas?: number | bigint;
65
+ maxPriorityFeePerGas?: number | bigint;
65
66
  };
66
67
  constants: {
67
68
  NATIVE_TOKEN: {
@@ -148,7 +149,7 @@ export interface IRouteTvl {
148
149
  }
149
150
  export interface IRouteOutputAndCost {
150
151
  route: IRoute;
151
- _output: ethers.BigNumber;
152
+ _output: bigint;
152
153
  outputUsd: number;
153
154
  txCostUsd: number;
154
155
  }
package/lib/interfaces.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -20,6 +20,7 @@ export declare class PoolTemplate {
20
20
  isFactory: boolean;
21
21
  isMetaFactory: boolean;
22
22
  basePool: string;
23
+ metaCoinIdx: number;
23
24
  underlyingCoins: string[];
24
25
  wrappedCoins: string[];
25
26
  underlyingCoinAddresses: string[];