@curvefi/api 1.13.0 → 1.16.0

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 (53) hide show
  1. package/README.md +98 -1
  2. package/lib/constants/abis/abis-ethereum.js +216 -16
  3. package/lib/constants/abis/abis-polygon.js +17 -1
  4. package/lib/constants/abis/json/aave/rewards.json +107 -0
  5. package/lib/constants/abis/json/atricrypto3/swap.json +63 -63
  6. package/lib/constants/abis/json/atricrypto3/zap.json +8 -8
  7. package/lib/constants/abis/json/busd/deposit.json +5 -10
  8. package/lib/constants/abis/json/busd/swap.json +18 -36
  9. package/lib/constants/abis/json/compound/deposit.json +5 -10
  10. package/lib/constants/abis/json/compound/migration.json +1 -2
  11. package/lib/constants/abis/json/compound/oldSwap.json +16 -32
  12. package/lib/constants/abis/json/compound/swap.json +18 -36
  13. package/lib/constants/abis/json/crveth/swap.json +61 -61
  14. package/lib/constants/abis/json/eurt/swap.json +29 -29
  15. package/lib/constants/abis/json/eurtusd/deposit.json +13 -13
  16. package/lib/constants/abis/json/eurtusd/swap.json +59 -59
  17. package/lib/constants/abis/json/gauge.json +1 -1
  18. package/lib/constants/abis/json/gauge_factory.json +879 -0
  19. package/lib/constants/abis/json/gauge_rewards_only.json +649 -0
  20. package/lib/constants/abis/json/gauge_synthetix.json +590 -0
  21. package/lib/constants/abis/json/gauge_v2.json +942 -0
  22. package/lib/constants/abis/json/gauge_v3.json +954 -0
  23. package/lib/constants/abis/json/gauge_v4.json +913 -0
  24. package/lib/constants/abis/json/iearn/deposit.json +5 -10
  25. package/lib/constants/abis/json/iearn/swap.json +18 -36
  26. package/lib/constants/abis/json/minter.json +165 -0
  27. package/lib/constants/abis/json/pax/deposit.json +5 -10
  28. package/lib/constants/abis/json/pax/swap.json +19 -38
  29. package/lib/constants/abis/json/ren/swap.json +19 -38
  30. package/lib/constants/abis/json/ren-polygon/swap.json +46 -46
  31. package/lib/constants/abis/json/reth/swap.json +38 -38
  32. package/lib/constants/abis/json/sbtc/swap.json +19 -38
  33. package/lib/constants/abis/json/streamer.json +257 -0
  34. package/lib/constants/abis/json/susdv2/deposit.json +5 -10
  35. package/lib/constants/abis/json/susdv2/swap.json +16 -32
  36. package/lib/constants/abis/json/tricrypto2/deposit.json +3 -3
  37. package/lib/constants/abis/json/tricrypto2/swap.json +60 -60
  38. package/lib/constants/abis/json/usdt/deposit.json +5 -10
  39. package/lib/constants/abis/json/usdt/swap.json +19 -37
  40. package/lib/constants/aliases.d.ts +2 -0
  41. package/lib/constants/aliases.js +3 -1
  42. package/lib/constants/coins-ethereum.js +7 -3
  43. package/lib/constants/coins-polygon.js +3 -2
  44. package/lib/curve.d.ts +1 -0
  45. package/lib/curve.js +47 -16
  46. package/lib/index.d.ts +1 -0
  47. package/lib/index.js +1 -0
  48. package/lib/interfaces.d.ts +8 -0
  49. package/lib/pools.d.ts +41 -5
  50. package/lib/pools.js +357 -69
  51. package/lib/utils.d.ts +2 -1
  52. package/lib/utils.js +42 -29
  53. package/package.json +1 -1
package/README.md CHANGED
@@ -122,12 +122,36 @@ const WalletProvider: FunctionComponent = ({ children }) => {
122
122
  ...
123
123
  ```
124
124
 
125
+ ## Available pools
126
+ ```ts
127
+ import curve from "@curvefi/api";
128
+
129
+ (async () => {
130
+ await curve.init('JsonRpc', {}, {gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0});
131
+
132
+ console.log(curve.getPoolList());
133
+ // [
134
+ // 'compound', 'usdt', 'y', 'busd',
135
+ // 'susd', 'pax', 'ren', 'sbtc',
136
+ // 'hbtc', '3pool', 'gusd', 'husd',
137
+ // 'usdk', 'usdn', 'musd', 'rsv',
138
+ // 'tbtc', 'dusd', 'pbtc', 'bbtc',
139
+ // 'obtc', 'seth', 'eurs', 'ust',
140
+ // 'aave', 'steth', 'saave', 'ankreth',
141
+ // 'usdp', 'ib', 'link', 'tusd',
142
+ // 'frax', 'lusd', 'busdv2', 'reth',
143
+ // 'alusd', 'mim', 'tricrypto2', 'eurt',
144
+ // 'eurtusd', 'crveth', 'cvxeth'
145
+ // ]
146
+ })()
147
+ ````
148
+
125
149
  ## Balances
126
150
  ```ts
127
151
  import curve from "@curvefi/api";
128
152
 
129
153
  (async () => {
130
- await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0, chainId: 1 });
154
+ await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
131
155
 
132
156
  console.log(await curve.getBalances(['DAI', 'sUSD']));
133
157
  // OR console.log(await curve.getBalances(['0x6B175474E89094C44Da98b954EedeAC495271d0F', '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51']));
@@ -211,6 +235,58 @@ import curve from "@curvefi/api";
211
235
  })()
212
236
  ```
213
237
 
238
+ ## Stats
239
+ ```ts
240
+ import curve from "@curvefi/api";
241
+
242
+ (async () => {
243
+ await curve.init('JsonRpc', {}, {gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0});
244
+
245
+ const aave = new curve.Pool('aave');
246
+
247
+ console.log(await aave.stats.getParameters());
248
+ // {
249
+ // virtualPrice: '1.082056814810440924',
250
+ // fee: '0.04',
251
+ // adminFee: '0.02',
252
+ // A: '2000',
253
+ // future_A: '2000',
254
+ // initial_A: '200',
255
+ // future_A_time: 1628525830000,
256
+ // initial_A_time: 1627923611000,
257
+ // gamma: undefined
258
+ // }
259
+
260
+
261
+ console.log(await aave.stats.getPoolBalances());
262
+ // [ '19619514.600802512613372364', '18740372.790339', '16065974.167437' ]
263
+
264
+ console.log(await aave.stats.getPoolWrappedBalances());
265
+ // [ '19619514.600802512613372364', '18740372.790339', '16065974.167437' ]
266
+
267
+ console.log(await aave.stats.getTotalLiquidity());
268
+ // 54425861.55857851
269
+
270
+ console.log(await aave.stats.getVolume());
271
+ // 175647.68180084194
272
+
273
+ console.log(await aave.stats.getBaseApy());
274
+ // { day: '3.2015', week: '3.1185', month: '3.1318', total: '7.7286' }
275
+
276
+ console.log(await aave.stats.getTokenApy());
277
+ // [ '0.4093', '1.0233' ]
278
+
279
+ console.log(await aave.stats.getRewardsApy());
280
+ // [
281
+ // {
282
+ // token: '0x4da27a545c0c5B758a6BA100e3a049001de870f5',
283
+ // symbol: 'stkAAVE',
284
+ // apy: '0.4978306501849664'
285
+ // }
286
+ // ]
287
+ })()
288
+ ````
289
+
214
290
  ## Add/remove liquidity
215
291
 
216
292
  ```ts
@@ -620,3 +696,24 @@ await curve.estimateGas.crossAssetExchange('DAI', "WBTC", "1000", 0.01)
620
696
 
621
697
  await curve.boosting.estimateGas.createLock('1000', 365)
622
698
  ```
699
+
700
+ ## Rewards
701
+ ```ts
702
+ const pool = new curve.Pool('susd');
703
+
704
+ // CRV
705
+ console.log(await pool.gaugeClaimableTokens());
706
+ // 0.006296257916265276
707
+ await pool.gaugeClaimTokens();
708
+
709
+ // Additional rewards
710
+ console.log(await pool.gaugeClaimableRewards());
711
+ // [
712
+ // {
713
+ // token: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F',
714
+ // symbol: 'SNX',
715
+ // amount: '0.000596325465987726'
716
+ // }
717
+ // ]
718
+ await pool.gaugeClaimRewards();
719
+ ```