diff --git a/package.json b/package.json index 33ccd9c76..4aa5e4e84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "2.28.8", + "version": "2.28.9", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", diff --git a/src/dex/algebra/algebra.ts b/src/dex/algebra/algebra.ts index a1b0f0deb..8814861a5 100644 --- a/src/dex/algebra/algebra.ts +++ b/src/dex/algebra/algebra.ts @@ -446,6 +446,18 @@ export class Algebra extends SimpleExchange implements IDex { if (!pool) return null; + if (this.config.forceRPC) { + const rpcPrice = await this.getPricingFromRpc( + _srcToken, + _destToken, + amounts, + side, + pool, + ); + + return rpcPrice; + } + let state = pool.getState(blockNumber); if (state === null) { @@ -773,6 +785,7 @@ export class Algebra extends SimpleExchange implements IDex { initHash: this.config.initHash, subgraphURL: this.config.subgraphURL, version: this.config.version, + forceRPC: this.config.forceRPC, }; return newConfig; } diff --git a/src/dex/algebra/config.ts b/src/dex/algebra/config.ts index 9b6147a17..f8f942067 100644 --- a/src/dex/algebra/config.ts +++ b/src/dex/algebra/config.ts @@ -82,6 +82,7 @@ export const AlgebraConfig: DexConfigMap = { uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984', deployer: '0x6dd3fb9653b10e806650f107c3b5a0a6ff974f65', version: 'v1.9', + forceRPC: true, }, }, }; diff --git a/src/dex/algebra/types.ts b/src/dex/algebra/types.ts index c017fed05..98a8c1d33 100644 --- a/src/dex/algebra/types.ts +++ b/src/dex/algebra/types.ts @@ -71,6 +71,7 @@ export type DexParams = { subgraphURL: string; initHash: string; version: 'v1.1' | 'v1.9'; + forceRPC?: boolean; }; export type IAlgebraPoolState = PoolStateV1_1 | PoolState_v1_9;