@wardenswap/bestrate-sdk-beta 2.11.0 → 2.12.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.
package/dist/index.d.ts CHANGED
@@ -293,46 +293,71 @@ interface Multicall2 extends BaseContract {
293
293
  };
294
294
  }
295
295
 
296
+ type Params = {
297
+ alpha: bigint;
298
+ beta: bigint;
299
+ c: bigint;
300
+ s: bigint;
301
+ lambda: bigint;
302
+ };
303
+ type DerivedParams = {
304
+ tauAlpha: Vector2;
305
+ tauBeta: Vector2;
306
+ u: bigint;
307
+ v: bigint;
308
+ w: bigint;
309
+ z: bigint;
310
+ dSq: bigint;
311
+ };
312
+ type Vector2 = {
313
+ x: bigint;
314
+ y: bigint;
315
+ };
316
+
296
317
  declare enum DexModel {
297
318
  UniswapV2 = 0,
298
319
  UniswapV3 = 1,
299
320
  PancakeV3 = 2,
300
321
  VelodromeSS = 3,
301
322
  AlgebraV1CL = 4,
302
- DMM = 5,
303
- CurvePlain = 6,
304
- CurveMeta = 7,
305
- CurvePlainSol = 8,
306
- Iron = 9,
307
- Synapse = 10,
308
- CurveMetaSol = 11,
309
- CurveCrypto = 12,
310
- CurveTriCryptoNG = 13,
311
- CurveStableNG = 14,
312
- CurveLendingA = 15,
313
- CurveLendingCryptoZap = 16,
314
- CurveLendingCryptoTwoZap = 17,
315
- CurveLido = 18,
316
- PolyDex = 19,
317
- FireBirdWeighted = 20,
318
- BalancerWeighted = 21,
319
- BalancerStable = 22,
320
- BalancerMetaStable = 23,
321
- BalancerBoostedStable = 24,
322
- BalancerLinear = 25,
323
- BalancerLiquidityBootstrapping = 26,
324
- Biswap = 27,
325
- DodoV1 = 28,
326
- DodoV2 = 29,
327
- Mdex = 30,
328
- Mars = 31,
329
- Smoothy = 32,
330
- Shibaswap = 33,
331
- GmxDex = 34,
332
- Solidly = 35,
333
- VelodromeV2 = 36,
334
- Synthetix = 37,
335
- Unknown = 38
323
+ SolidlyV3 = 5,
324
+ DMM = 6,
325
+ CurvePlain = 7,
326
+ CurveMeta = 8,
327
+ CurvePlainSol = 9,
328
+ Iron = 10,
329
+ Synapse = 11,
330
+ CurveMetaSol = 12,
331
+ CurveCrypto = 13,
332
+ CurveTriCryptoNG = 14,
333
+ CurveStableNG = 15,
334
+ CurveLendingA = 16,
335
+ CurveLendingCryptoZap = 17,
336
+ CurveLendingCryptoTwoZap = 18,
337
+ CurveLido = 19,
338
+ PolyDex = 20,
339
+ FireBirdWeighted = 21,
340
+ BalancerWeighted = 22,
341
+ BalancerStable = 23,
342
+ BalancerComposableStableV6 = 24,
343
+ BalancerWeightedV4 = 25,
344
+ BalancerGyroECLP = 26,
345
+ BalancerMetaStable = 27,
346
+ BalancerBoostedStable = 28,
347
+ BalancerLinear = 29,
348
+ BalancerLiquidityBootstrapping = 30,
349
+ Biswap = 31,
350
+ DodoV1 = 32,
351
+ DodoV2 = 33,
352
+ Mdex = 34,
353
+ Mars = 35,
354
+ Smoothy = 36,
355
+ Shibaswap = 37,
356
+ GmxDex = 38,
357
+ Solidly = 39,
358
+ VelodromeV2 = 40,
359
+ Synthetix = 41,
360
+ Unknown = 42
336
361
  }
337
362
  interface UniswapV2BasedModelInfo {
338
363
  model: DexModel.UniswapV2 | DexModel.Mdex | DexModel.Biswap | DexModel.Mars | DexModel.Shibaswap;
@@ -349,6 +374,10 @@ interface UniswapV3ModelInfo extends Omit<UniswapV2BasedModelInfo, 'model' | 'fe
349
374
  gasPerInitializedTick: bigint;
350
375
  gasPerTick: bigint;
351
376
  }
377
+ interface SolidlyV3ModelInfo extends Omit<UniswapV3ModelInfo, 'model' | 'fee'> {
378
+ model: DexModel.SolidlyV3;
379
+ tickSpacing: bigint;
380
+ }
352
381
  interface AlgebraV1CLModelInfo extends Omit<UniswapV3ModelInfo, 'model' | 'fee' | 'feePrecision' | 'factory'> {
353
382
  model: DexModel.AlgebraV1CL;
354
383
  poolDeployer: string;
@@ -457,8 +486,14 @@ interface BalancerWeightedModelInfo extends Omit<BalancerStableModelInfo, 'model
457
486
  interface BalancerStableModelInfo {
458
487
  model: DexModel.BalancerStable;
459
488
  tokens: string[];
489
+ /**
490
+ * Calculated from 1e18 * 10^(18-decimals)
491
+ */
460
492
  scalingFactors: bigint[];
461
493
  vaultContract: string;
494
+ /**
495
+ * Get from getPoolId() of pool contract
496
+ */
462
497
  poolId: string;
463
498
  aPrecision: bigint;
464
499
  depositAddress: string;
@@ -485,6 +520,43 @@ interface BalancerMetaStableModelInfo extends Omit<BalancerStableModelInfo, 'mod
485
520
  rateProviders: string[];
486
521
  multicall: string;
487
522
  }
523
+ interface BalancerComposableStableModelInfo extends Omit<BalancerStableModelInfo, 'model' | 'aPrecision'> {
524
+ model: DexModel.BalancerComposableStableV6;
525
+ /**
526
+ * BPT token index
527
+ * Get from getBptIndex() at pool contract
528
+ */
529
+ bptIndex: number;
530
+ /**
531
+ * Rate providers, zero means no providers
532
+ * Get from getRateProviders() at pool contract
533
+ */
534
+ rateProviders: string[];
535
+ multicall: string;
536
+ /**
537
+ * A flag whether exempt from yield protocol fee
538
+ * Get from isExemptFromYieldProtocolFee() at pool contract
539
+ */
540
+ isExemptFromYieldProtocolFee: boolean;
541
+ /**
542
+ * A flag whether protocol swap fee delegation
543
+ * Get from getProtocolSwapFeeDelegation() at pool contract
544
+ */
545
+ isProtocolSwapFeeDelegation: boolean;
546
+ /**
547
+ * Maximum protocol's swap fee percentage
548
+ * Get from _MAX_PROTOCOL_SWAP_FEE_PERCENTAGE at ComposableStablePoolFactory.getProtocolFeePercenragesProvider
549
+ */
550
+ maxProtocolSwapFeePercentage: bigint;
551
+ }
552
+ interface BalancerWeightedV4ModelInfo extends Omit<BalancerWeightedModelInfo, 'model'> {
553
+ model: DexModel.BalancerWeightedV4;
554
+ }
555
+ interface BalancerGyroECLPModelInfo extends Omit<BalancerWeightedModelInfo, 'model'> {
556
+ model: DexModel.BalancerGyroECLP;
557
+ params: Params;
558
+ derivedParams: DerivedParams;
559
+ }
488
560
  interface DodoV2ModelInfo {
489
561
  model: DexModel.DodoV2 | DexModel.DodoV1;
490
562
  factoryContract: string;
@@ -537,7 +609,7 @@ interface RouteInfo {
537
609
  type RouteInfoModel = RouteInfo & {
538
610
  gas: bigint;
539
611
  isTradingAllowed: boolean;
540
- } & (UniswapV2BasedModelInfo | UniswapV3ModelInfo | PancakeV3ModelInfo | VelodromeSSModelInfo | AlgebraV1CLModelInfo | CurvePlainModelInfo | CurvePlainNGModelInfo | CurveMetaModelInfo | CurveCryptoModelInfo | CurveCryptoNGModelInfo | CurveCryptoZapModelInfo | CurveCryptoTwoZapModelInfo | CurveLendingModelInfo | CurveLidoModelInfo | DodoV2ModelInfo | SmoothyModelInfo | DMMModelInfo | BalancerWeightedModelInfo | BalancerStableModelInfo | BalancerMetaStableModelInfo | BalancerBoostedStableModelInfo | BalancerLinearModelInfo | PolyDexModelInfo | GmxDexModelInfo | SolidlyModelInfo | VelodromeV2ModelInfo | SynthetixModelInfo | {
612
+ } & (UniswapV2BasedModelInfo | UniswapV3ModelInfo | PancakeV3ModelInfo | VelodromeSSModelInfo | AlgebraV1CLModelInfo | SolidlyV3ModelInfo | CurvePlainModelInfo | CurvePlainNGModelInfo | CurveMetaModelInfo | CurveCryptoModelInfo | CurveCryptoNGModelInfo | CurveCryptoZapModelInfo | CurveCryptoTwoZapModelInfo | CurveLendingModelInfo | CurveLidoModelInfo | DodoV2ModelInfo | SmoothyModelInfo | DMMModelInfo | BalancerWeightedModelInfo | BalancerStableModelInfo | BalancerMetaStableModelInfo | BalancerBoostedStableModelInfo | BalancerLinearModelInfo | BalancerComposableStableModelInfo | BalancerWeightedV4ModelInfo | BalancerGyroECLPModelInfo | PolyDexModelInfo | GmxDexModelInfo | SolidlyModelInfo | VelodromeV2ModelInfo | SynthetixModelInfo | {
541
613
  model: DexModel.Unknown;
542
614
  });
543
615
 
@@ -293,46 +293,71 @@ interface Multicall2 extends BaseContract {
293
293
  };
294
294
  }
295
295
 
296
+ type Params = {
297
+ alpha: bigint;
298
+ beta: bigint;
299
+ c: bigint;
300
+ s: bigint;
301
+ lambda: bigint;
302
+ };
303
+ type DerivedParams = {
304
+ tauAlpha: Vector2;
305
+ tauBeta: Vector2;
306
+ u: bigint;
307
+ v: bigint;
308
+ w: bigint;
309
+ z: bigint;
310
+ dSq: bigint;
311
+ };
312
+ type Vector2 = {
313
+ x: bigint;
314
+ y: bigint;
315
+ };
316
+
296
317
  declare enum DexModel {
297
318
  UniswapV2 = 0,
298
319
  UniswapV3 = 1,
299
320
  PancakeV3 = 2,
300
321
  VelodromeSS = 3,
301
322
  AlgebraV1CL = 4,
302
- DMM = 5,
303
- CurvePlain = 6,
304
- CurveMeta = 7,
305
- CurvePlainSol = 8,
306
- Iron = 9,
307
- Synapse = 10,
308
- CurveMetaSol = 11,
309
- CurveCrypto = 12,
310
- CurveTriCryptoNG = 13,
311
- CurveStableNG = 14,
312
- CurveLendingA = 15,
313
- CurveLendingCryptoZap = 16,
314
- CurveLendingCryptoTwoZap = 17,
315
- CurveLido = 18,
316
- PolyDex = 19,
317
- FireBirdWeighted = 20,
318
- BalancerWeighted = 21,
319
- BalancerStable = 22,
320
- BalancerMetaStable = 23,
321
- BalancerBoostedStable = 24,
322
- BalancerLinear = 25,
323
- BalancerLiquidityBootstrapping = 26,
324
- Biswap = 27,
325
- DodoV1 = 28,
326
- DodoV2 = 29,
327
- Mdex = 30,
328
- Mars = 31,
329
- Smoothy = 32,
330
- Shibaswap = 33,
331
- GmxDex = 34,
332
- Solidly = 35,
333
- VelodromeV2 = 36,
334
- Synthetix = 37,
335
- Unknown = 38
323
+ SolidlyV3 = 5,
324
+ DMM = 6,
325
+ CurvePlain = 7,
326
+ CurveMeta = 8,
327
+ CurvePlainSol = 9,
328
+ Iron = 10,
329
+ Synapse = 11,
330
+ CurveMetaSol = 12,
331
+ CurveCrypto = 13,
332
+ CurveTriCryptoNG = 14,
333
+ CurveStableNG = 15,
334
+ CurveLendingA = 16,
335
+ CurveLendingCryptoZap = 17,
336
+ CurveLendingCryptoTwoZap = 18,
337
+ CurveLido = 19,
338
+ PolyDex = 20,
339
+ FireBirdWeighted = 21,
340
+ BalancerWeighted = 22,
341
+ BalancerStable = 23,
342
+ BalancerComposableStableV6 = 24,
343
+ BalancerWeightedV4 = 25,
344
+ BalancerGyroECLP = 26,
345
+ BalancerMetaStable = 27,
346
+ BalancerBoostedStable = 28,
347
+ BalancerLinear = 29,
348
+ BalancerLiquidityBootstrapping = 30,
349
+ Biswap = 31,
350
+ DodoV1 = 32,
351
+ DodoV2 = 33,
352
+ Mdex = 34,
353
+ Mars = 35,
354
+ Smoothy = 36,
355
+ Shibaswap = 37,
356
+ GmxDex = 38,
357
+ Solidly = 39,
358
+ VelodromeV2 = 40,
359
+ Synthetix = 41,
360
+ Unknown = 42
336
361
  }
337
362
  interface UniswapV2BasedModelInfo {
338
363
  model: DexModel.UniswapV2 | DexModel.Mdex | DexModel.Biswap | DexModel.Mars | DexModel.Shibaswap;
@@ -349,6 +374,10 @@ interface UniswapV3ModelInfo extends Omit<UniswapV2BasedModelInfo, 'model' | 'fe
349
374
  gasPerInitializedTick: bigint;
350
375
  gasPerTick: bigint;
351
376
  }
377
+ interface SolidlyV3ModelInfo extends Omit<UniswapV3ModelInfo, 'model' | 'fee'> {
378
+ model: DexModel.SolidlyV3;
379
+ tickSpacing: bigint;
380
+ }
352
381
  interface AlgebraV1CLModelInfo extends Omit<UniswapV3ModelInfo, 'model' | 'fee' | 'feePrecision' | 'factory'> {
353
382
  model: DexModel.AlgebraV1CL;
354
383
  poolDeployer: string;
@@ -457,8 +486,14 @@ interface BalancerWeightedModelInfo extends Omit<BalancerStableModelInfo, 'model
457
486
  interface BalancerStableModelInfo {
458
487
  model: DexModel.BalancerStable;
459
488
  tokens: string[];
489
+ /**
490
+ * Calculated from 1e18 * 10^(18-decimals)
491
+ */
460
492
  scalingFactors: bigint[];
461
493
  vaultContract: string;
494
+ /**
495
+ * Get from getPoolId() of pool contract
496
+ */
462
497
  poolId: string;
463
498
  aPrecision: bigint;
464
499
  depositAddress: string;
@@ -485,6 +520,43 @@ interface BalancerMetaStableModelInfo extends Omit<BalancerStableModelInfo, 'mod
485
520
  rateProviders: string[];
486
521
  multicall: string;
487
522
  }
523
+ interface BalancerComposableStableModelInfo extends Omit<BalancerStableModelInfo, 'model' | 'aPrecision'> {
524
+ model: DexModel.BalancerComposableStableV6;
525
+ /**
526
+ * BPT token index
527
+ * Get from getBptIndex() at pool contract
528
+ */
529
+ bptIndex: number;
530
+ /**
531
+ * Rate providers, zero means no providers
532
+ * Get from getRateProviders() at pool contract
533
+ */
534
+ rateProviders: string[];
535
+ multicall: string;
536
+ /**
537
+ * A flag whether exempt from yield protocol fee
538
+ * Get from isExemptFromYieldProtocolFee() at pool contract
539
+ */
540
+ isExemptFromYieldProtocolFee: boolean;
541
+ /**
542
+ * A flag whether protocol swap fee delegation
543
+ * Get from getProtocolSwapFeeDelegation() at pool contract
544
+ */
545
+ isProtocolSwapFeeDelegation: boolean;
546
+ /**
547
+ * Maximum protocol's swap fee percentage
548
+ * Get from _MAX_PROTOCOL_SWAP_FEE_PERCENTAGE at ComposableStablePoolFactory.getProtocolFeePercenragesProvider
549
+ */
550
+ maxProtocolSwapFeePercentage: bigint;
551
+ }
552
+ interface BalancerWeightedV4ModelInfo extends Omit<BalancerWeightedModelInfo, 'model'> {
553
+ model: DexModel.BalancerWeightedV4;
554
+ }
555
+ interface BalancerGyroECLPModelInfo extends Omit<BalancerWeightedModelInfo, 'model'> {
556
+ model: DexModel.BalancerGyroECLP;
557
+ params: Params;
558
+ derivedParams: DerivedParams;
559
+ }
488
560
  interface DodoV2ModelInfo {
489
561
  model: DexModel.DodoV2 | DexModel.DodoV1;
490
562
  factoryContract: string;
@@ -537,7 +609,7 @@ interface RouteInfo {
537
609
  type RouteInfoModel = RouteInfo & {
538
610
  gas: bigint;
539
611
  isTradingAllowed: boolean;
540
- } & (UniswapV2BasedModelInfo | UniswapV3ModelInfo | PancakeV3ModelInfo | VelodromeSSModelInfo | AlgebraV1CLModelInfo | CurvePlainModelInfo | CurvePlainNGModelInfo | CurveMetaModelInfo | CurveCryptoModelInfo | CurveCryptoNGModelInfo | CurveCryptoZapModelInfo | CurveCryptoTwoZapModelInfo | CurveLendingModelInfo | CurveLidoModelInfo | DodoV2ModelInfo | SmoothyModelInfo | DMMModelInfo | BalancerWeightedModelInfo | BalancerStableModelInfo | BalancerMetaStableModelInfo | BalancerBoostedStableModelInfo | BalancerLinearModelInfo | PolyDexModelInfo | GmxDexModelInfo | SolidlyModelInfo | VelodromeV2ModelInfo | SynthetixModelInfo | {
612
+ } & (UniswapV2BasedModelInfo | UniswapV3ModelInfo | PancakeV3ModelInfo | VelodromeSSModelInfo | AlgebraV1CLModelInfo | SolidlyV3ModelInfo | CurvePlainModelInfo | CurvePlainNGModelInfo | CurveMetaModelInfo | CurveCryptoModelInfo | CurveCryptoNGModelInfo | CurveCryptoZapModelInfo | CurveCryptoTwoZapModelInfo | CurveLendingModelInfo | CurveLidoModelInfo | DodoV2ModelInfo | SmoothyModelInfo | DMMModelInfo | BalancerWeightedModelInfo | BalancerStableModelInfo | BalancerMetaStableModelInfo | BalancerBoostedStableModelInfo | BalancerLinearModelInfo | BalancerComposableStableModelInfo | BalancerWeightedV4ModelInfo | BalancerGyroECLPModelInfo | PolyDexModelInfo | GmxDexModelInfo | SolidlyModelInfo | VelodromeV2ModelInfo | SynthetixModelInfo | {
541
613
  model: DexModel.Unknown;
542
614
  });
543
615