@curvefi/api 2.66.29 → 2.66.31

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 (81) hide show
  1. package/lib/boosting.d.ts +33 -32
  2. package/lib/boosting.js +320 -252
  3. package/lib/cached.d.ts +4 -3
  4. package/lib/cached.js +63 -19
  5. package/lib/constants/utils.d.ts +14 -1
  6. package/lib/constants/utils.js +21 -6
  7. package/lib/curve.d.ts +5 -5
  8. package/lib/curve.js +21 -38
  9. package/lib/dao.d.ts +32 -31
  10. package/lib/dao.js +420 -350
  11. package/lib/external-api.d.ts +1 -1
  12. package/lib/external-api.js +2 -2
  13. package/lib/factory/common.d.ts +2 -1
  14. package/lib/factory/common.js +1 -1
  15. package/lib/factory/deploy.d.ts +46 -45
  16. package/lib/factory/deploy.js +630 -551
  17. package/lib/factory/factory-api.d.ts +3 -2
  18. package/lib/factory/factory-api.js +22 -23
  19. package/lib/factory/factory-crypto.d.ts +1 -1
  20. package/lib/factory/factory-crypto.js +12 -15
  21. package/lib/factory/factory-tricrypto.d.ts +1 -1
  22. package/lib/factory/factory-tricrypto.js +14 -15
  23. package/lib/factory/factory-twocrypto.d.ts +1 -1
  24. package/lib/factory/factory-twocrypto.js +12 -13
  25. package/lib/factory/factory.d.ts +4 -3
  26. package/lib/factory/factory.js +21 -24
  27. package/lib/index.d.ts +413 -104
  28. package/lib/index.js +253 -257
  29. package/lib/interfaces.d.ts +2 -0
  30. package/lib/pools/PoolTemplate.d.ts +13 -12
  31. package/lib/pools/PoolTemplate.js +279 -285
  32. package/lib/pools/mixins/common.js +2 -2
  33. package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +12 -4
  34. package/lib/pools/mixins/depositBalancedAmountsMixins.js +1 -15
  35. package/lib/pools/mixins/depositMixins.d.ts +25 -5
  36. package/lib/pools/mixins/depositMixins.js +38 -76
  37. package/lib/pools/mixins/depositWrappedMixins.d.ts +10 -2
  38. package/lib/pools/mixins/depositWrappedMixins.js +17 -33
  39. package/lib/pools/mixins/poolBalancesMixin.d.ts +6 -2
  40. package/lib/pools/mixins/poolBalancesMixin.js +3 -5
  41. package/lib/pools/mixins/swapMixins.d.ts +20 -4
  42. package/lib/pools/mixins/swapMixins.js +36 -70
  43. package/lib/pools/mixins/swapWrappedMixins.d.ts +19 -4
  44. package/lib/pools/mixins/swapWrappedMixins.js +32 -60
  45. package/lib/pools/mixins/withdrawExpectedMixins.d.ts +12 -4
  46. package/lib/pools/mixins/withdrawExpectedMixins.js +6 -11
  47. package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +20 -4
  48. package/lib/pools/mixins/withdrawImbalanceMixins.js +26 -53
  49. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +10 -2
  50. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +12 -27
  51. package/lib/pools/mixins/withdrawMixins.d.ts +25 -5
  52. package/lib/pools/mixins/withdrawMixins.js +33 -67
  53. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +12 -4
  54. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +8 -13
  55. package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +25 -5
  56. package/lib/pools/mixins/withdrawOneCoinMixins.js +32 -66
  57. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +6 -2
  58. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +4 -7
  59. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +10 -2
  60. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +13 -29
  61. package/lib/pools/mixins/withdrawWrappedMixins.d.ts +10 -2
  62. package/lib/pools/mixins/withdrawWrappedMixins.js +14 -28
  63. package/lib/pools/poolConstructor.d.ts +2 -1
  64. package/lib/pools/poolConstructor.js +27 -28
  65. package/lib/pools/subClasses/corePool.d.ts +4 -1
  66. package/lib/pools/subClasses/corePool.js +5 -7
  67. package/lib/pools/subClasses/gaugePool.d.ts +5 -3
  68. package/lib/pools/subClasses/gaugePool.js +19 -18
  69. package/lib/pools/subClasses/statsPool.d.ts +2 -0
  70. package/lib/pools/subClasses/statsPool.js +22 -10
  71. package/lib/pools/subClasses/walletPool.d.ts +2 -1
  72. package/lib/pools/subClasses/walletPool.js +6 -6
  73. package/lib/pools/utils.d.ts +7 -6
  74. package/lib/pools/utils.js +316 -297
  75. package/lib/route-graph.worker.d.ts +2 -2
  76. package/lib/route-graph.worker.js +4 -6
  77. package/lib/router.d.ts +12 -11
  78. package/lib/router.js +331 -295
  79. package/lib/utils.d.ts +34 -33
  80. package/lib/utils.js +481 -435
  81. package/package.json +1 -1
package/lib/utils.d.ts CHANGED
@@ -2,12 +2,13 @@ import { Contract } from 'ethers';
2
2
  import { Contract as MulticallContract } from "@curvefi/ethcall";
3
3
  import BigNumber from 'bignumber.js';
4
4
  import { Abi, AbiFunction, IBasePoolShortItem, IChainId, ICurveLiteNetwork, IDict, INetworkName, IRewardFromApi, IVolumeAndAPYs, REFERENCE_ASSET } from './interfaces';
5
+ import { Curve } from "./curve.js";
5
6
  export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
6
7
  export declare const MAX_ALLOWANCE: bigint;
7
8
  export declare const _cutZeros: (strn: string) => string;
8
9
  export declare const checkNumber: (n: number | string) => number | string;
9
10
  export declare const formatNumber: (n: number | string, decimals?: number) => string;
10
- export declare const parseUnits: (n: number | string, decimals?: number) => bigint;
11
+ export declare function parseUnits(n: number | string, decimals?: number): bigint;
11
12
  export declare const BN: (val: number | string) => BigNumber;
12
13
  export declare const toBN: (n: bigint, decimals?: number) => BigNumber;
13
14
  export declare const toStringFromBN: (bn: BigNumber, decimals?: number) => string;
@@ -19,60 +20,60 @@ export declare const smartNumber: (abstractNumber: bigint | bigint[]) => number
19
20
  export declare const DIGas: (gas: bigint | Array<bigint>) => bigint;
20
21
  export declare const getGasFromArray: (gas: number[]) => number | number[];
21
22
  export declare const gasSum: (gas: number[], currentGas: number | number[]) => number[];
22
- export declare const _getCoinAddressesNoCheck: (...coins: string[] | string[][]) => string[];
23
- export declare const _getCoinAddresses: (...coins: string[] | string[][]) => string[];
24
- export declare const _getCoinDecimals: (...coinAddresses: string[] | string[][]) => number[];
25
- export declare const _getBalances: (coins: string[], addresses: string[]) => Promise<IDict<string[]>>;
26
- export declare const _prepareAddresses: (addresses: string[] | string[][]) => string[];
27
- export declare const _getAddress: (address: string) => string;
28
- export declare const getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<IDict<string[]> | string[]>;
29
- export declare const _getAllowance: (coins: string[], address: string, spender: string) => Promise<bigint[]>;
30
- export declare const getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
31
- export declare const hasAllowance: (coins: string[], amounts: (number | string)[], address: string, spender: string) => Promise<boolean>;
32
- export declare const _ensureAllowance: (coins: string[], amounts: bigint[], spender: string, isMax?: boolean) => Promise<string[]>;
33
- export declare const ensureAllowanceEstimateGas: (coins: string[], amounts: (number | string)[], spender: string, isMax?: boolean) => Promise<number | number[]>;
34
- export declare const ensureAllowance: (coins: string[], amounts: (number | string)[], spender: string, isMax?: boolean) => Promise<string[]>;
35
- export declare const getPoolIdBySwapAddress: (swapAddress: string) => string;
36
- export declare const _getRewardsFromApi: () => Promise<IDict<IRewardFromApi[]>>;
37
- export declare const _getUsdRate: (assetId: string) => Promise<number>;
38
- export declare const getUsdRate: (coin: string) => Promise<number>;
39
- export declare const getBaseFeeByLastBlock: () => Promise<number>;
40
- export declare const getGasPrice: () => Promise<number>;
41
- export declare const getGasPriceFromL1: () => Promise<number>;
42
- export declare const getGasPriceFromL2: () => Promise<number>;
43
- export declare const getGasInfoForL2: () => Promise<Record<string, number | null>>;
23
+ export declare function _getCoinAddressesNoCheck(this: Curve, ...coins: string[] | string[][]): string[];
24
+ export declare function _getCoinAddresses(this: Curve, ...coins: string[] | string[][]): string[];
25
+ export declare function _getCoinDecimals(this: Curve, ...coinAddresses: string[] | string[][]): number[];
26
+ export declare function _getBalances(this: Curve, coins: string[], addresses: string[]): Promise<IDict<string[]>>;
27
+ export declare function _prepareAddresses(this: Curve, addresses: string[] | string[][]): string[];
28
+ export declare function _getAddress(this: Curve, address: string): string;
29
+ export declare function getBalances(this: Curve, coins: string[], ...addresses: string[] | string[][]): Promise<IDict<string[]> | string[]>;
30
+ export declare function _getAllowance(this: Curve, coins: string[], address: string, spender: string): Promise<bigint[]>;
31
+ export declare function getAllowance(this: Curve, coins: string[], address: string, spender: string): Promise<string[]>;
32
+ export declare function hasAllowance(this: Curve, coins: string[], amounts: (number | string)[], address: string, spender: string): Promise<boolean>;
33
+ export declare function _ensureAllowance(this: Curve, coins: string[], amounts: bigint[], spender: string, isMax?: boolean): Promise<string[]>;
34
+ export declare function ensureAllowanceEstimateGas(this: Curve, coins: string[], amounts: (number | string)[], spender: string, isMax?: boolean): Promise<number | number[]>;
35
+ export declare function ensureAllowance(this: Curve, coins: string[], amounts: (number | string)[], spender: string, isMax?: boolean): Promise<string[]>;
36
+ export declare function getPoolIdBySwapAddress(this: Curve, swapAddress: string): string;
37
+ export declare function _getRewardsFromApi(this: Curve): Promise<IDict<IRewardFromApi[]>>;
38
+ export declare function _getUsdRate(this: Curve, assetId: string): Promise<number>;
39
+ export declare function getUsdRate(this: Curve, coin: string): Promise<number>;
40
+ export declare function getBaseFeeByLastBlock(this: Curve): Promise<number>;
41
+ export declare function getGasPrice(this: Curve): Promise<number>;
42
+ export declare function getGasPriceFromL1(this: Curve): Promise<number>;
43
+ export declare function getGasPriceFromL2(this: Curve): Promise<number>;
44
+ export declare function getGasInfoForL2(this: Curve): Promise<Record<string, number | null>>;
44
45
  export declare const getTxCostsUsd: (ethUsdRate: number, gasPrice: number, gas: number | number[], gasPriceL1?: number) => number;
45
- export declare const getCurveLiteNetworks: () => Promise<ICurveLiteNetwork[]>;
46
+ export declare function getCurveLiteNetworks(this: Curve): Promise<ICurveLiteNetwork[]>;
46
47
  export declare const getNetworkNameByChainId: (chainId: number, networks: ICurveLiteNetwork[]) => string;
47
- export declare const getNetworkConstants: (chainId: IChainId | number) => Promise<IDict<any>>;
48
- export declare const getTVL: (chainId?: number) => Promise<number>;
49
- export declare const getVolumeApiController: (network: INetworkName) => Promise<IVolumeAndAPYs>;
50
- export declare const getVolume: (chainId?: number) => Promise<{
48
+ export declare function getNetworkConstants(this: Curve, chainId: IChainId | number): Promise<IDict<any>>;
49
+ export declare function getTVL(this: Curve, chainId?: number): Promise<number>;
50
+ export declare function getVolumeApiController(this: Curve, network: INetworkName): Promise<IVolumeAndAPYs>;
51
+ export declare function getVolume(this: Curve, chainId?: number): Promise<{
51
52
  totalVolume: number;
52
53
  cryptoVolume: number;
53
54
  cryptoShare: number;
54
55
  }>;
55
- export declare const _setContracts: (address: string, abi: any) => {
56
+ export declare function _setContracts(this: Curve, address: string, abi: any): {
56
57
  abi: any;
57
58
  contract: Contract;
58
59
  multicallContract: MulticallContract;
59
60
  };
60
61
  export declare const _get_small_x: (_x: bigint, _y: bigint, x_decimals: number, y_decimals: number) => BigNumber;
61
62
  export declare const _get_price_impact: (_x: bigint, _y: bigint, _small_x: bigint, _small_y: bigint, x_decimals: number, y_decimals: number) => BigNumber;
62
- export declare const getCoinsData: (...coins: string[] | string[][]) => Promise<{
63
+ export declare function getCoinsData(this: Curve, ...coins: string[] | string[][]): Promise<{
63
64
  name: string;
64
65
  symbol: string;
65
66
  decimals: number;
66
67
  }[]>;
67
- export declare const hasDepositAndStake: () => boolean;
68
- export declare const hasRouter: () => boolean;
68
+ export declare function hasDepositAndStake(this: Curve): boolean;
69
+ export declare function hasRouter(this: Curve): boolean;
69
70
  export declare const findAbiFunction: (abi: Abi, methodName: string) => AbiFunction[];
70
71
  export declare const getCountArgsOfMethodByAbi: (abi: Abi, methodName: string) => number;
71
72
  export declare const findAbiSignature: (abi: Abi, methodName: string, signature: string) => AbiFunction | undefined;
72
73
  export declare const getPoolName: (name: string) => string;
73
74
  export declare const isStableNgPool: (name: string) => boolean;
74
75
  export declare const assetTypeNameHandler: (assetTypeName: string) => REFERENCE_ASSET;
75
- export declare const getBasePools: () => Promise<IBasePoolShortItem[]>;
76
+ export declare function getBasePools(this: Curve): Promise<IBasePoolShortItem[]>;
76
77
  export declare function log(fnName: string, ...args: unknown[]): void;
77
78
  export declare function runWorker<In extends {
78
79
  type: string;