@curvefi/api 2.68.28 → 2.68.30

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.
@@ -170,6 +170,7 @@ export declare class PoolTemplate extends CorePool {
170
170
  }>;
171
171
  _swapExpected(i: number, j: number, _amount: bigint): Promise<bigint>;
172
172
  swapExpected(inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
173
+ swapExpectedBigInt(inputCoin: string | number, outputCoin: string | number, amount: bigint): Promise<bigint>;
173
174
  _swapRequired(i: number, j: number, _amount: bigint, isUnderlying: boolean): Promise<any>;
174
175
  swapRequired(inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
175
176
  swapWrappedRequired(inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
@@ -1681,6 +1681,14 @@ export class PoolTemplate extends CorePool {
1681
1681
  return this.curve.formatUnits(_expected, this.underlyingDecimals[j]);
1682
1682
  });
1683
1683
  }
1684
+ swapExpectedBigInt(inputCoin, outputCoin, amount) {
1685
+ return __awaiter(this, void 0, void 0, function* () {
1686
+ const i = this._getCoinIdx(inputCoin);
1687
+ const j = this._getCoinIdx(outputCoin);
1688
+ const _expected = yield this._swapExpected(i, j, amount);
1689
+ return _expected;
1690
+ });
1691
+ }
1684
1692
  _swapRequired(i, j, _amount, isUnderlying) {
1685
1693
  return __awaiter(this, void 0, void 0, function* () {
1686
1694
  if (this.isCrypto) {
@@ -14,6 +14,7 @@ export declare const swapWrappedMixin: {
14
14
  };
15
15
  export declare const swapWrappedExpectedAndApproveMixin: {
16
16
  swapWrappedExpected(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
17
+ swapWrappedExpectedBigInt(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: bigint): Promise<bigint>;
17
18
  swapWrappedIsApproved(this: PoolTemplate, inputCoin: string | number, amount: number | string): Promise<boolean>;
18
19
  swapWrappedApproveEstimateGas(this: PoolTemplate, inputCoin: string | number, amount: number | string): Promise<number | number[]>;
19
20
  swapWrappedApprove(this: PoolTemplate, inputCoin: string | number, amount: number | string): Promise<string[]>;
@@ -123,6 +123,14 @@ export const swapWrappedExpectedAndApproveMixin = {
123
123
  return this.curve.formatUnits(_expected, this.wrappedDecimals[j]);
124
124
  });
125
125
  },
126
+ swapWrappedExpectedBigInt(inputCoin, outputCoin, amount) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const i = this._getCoinIdx(inputCoin, false);
129
+ const j = this._getCoinIdx(outputCoin, false);
130
+ const _expected = yield this._swapWrappedExpected.call(this, i, j, amount);
131
+ return _expected;
132
+ });
133
+ },
126
134
  swapWrappedIsApproved(inputCoin, amount) {
127
135
  return __awaiter(this, void 0, void 0, function* () {
128
136
  const i = this._getCoinIdx.call(this, inputCoin, false);
@@ -17,22 +17,15 @@ import { swapWrappedExpectedAndApproveMixin, swapWrappedMixin, swapWrappedRequir
17
17
  import { findAbiSignature, getCountArgsOfMethodByAbi, getPoolIdBySwapAddress } from "../utils.js";
18
18
  import { StatsPool } from "./subClasses/statsPool.js";
19
19
  export function getPool(poolIdOrAddress) {
20
- let poolId;
21
- const _poolIdOrAddress = poolIdOrAddress.toLowerCase();
22
- if (_poolIdOrAddress.startsWith('0x')) {
23
- poolId = getPoolIdBySwapAddress.call(this, _poolIdOrAddress);
24
- if (!poolId || !this.getPoolsData()[poolId]) {
25
- throw new Error(`Pool with address ${_poolIdOrAddress} not found`);
26
- }
20
+ const poolId = poolIdOrAddress.toLowerCase().startsWith('0x') ? getPoolIdBySwapAddress.call(this, poolIdOrAddress.toLowerCase()) : poolIdOrAddress;
21
+ if (!poolId) {
22
+ throw new Error(`Pool with address ${poolIdOrAddress} not found`);
27
23
  }
28
- else {
29
- poolId = _poolIdOrAddress;
30
- const poolsData = this.getPoolsData();
31
- if (!poolsData[poolId]) {
32
- throw new Error(`Pool with id ${_poolIdOrAddress} not found`);
33
- }
24
+ const poolData = (this.getPoolsData())[poolId];
25
+ if (!poolData) {
26
+ throw new Error(`Pool with id ${poolIdOrAddress} not found`);
34
27
  }
35
- const poolDummy = new PoolTemplate(poolId, this);
28
+ const poolDummy = new PoolTemplate(poolId, this, poolData);
36
29
  class Pool extends PoolTemplate {
37
30
  constructor(poolId, curve) {
38
31
  super(poolId, curve);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.68.28",
3
+ "version": "2.68.30",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",