Skip to content

Commit

Permalink
Merge pull request paraswap#98 from paraswap/fix/abnormal-keys
Browse files Browse the repository at this point in the history
Handle getDexKeySpecial for getAdapters
  • Loading branch information
shresthagrawal authored Apr 22, 2022
2 parents 1e5e746 + c2d82eb commit 23e6cb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paraswap/dex-lib",
"version": "2.0.21",
"version": "2.0.22",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
6 changes: 3 additions & 3 deletions src/dex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ export class DexAdapterService {
return side === SwapSide.SELL ? this.sellAdapters : this.buyAdapters;
}

getDexKeySpecial(dexKey: string) {
getDexKeySpecial(dexKey: string, isAdapters: boolean = false) {
dexKey = dexKey.toLowerCase();
if (/^paraswappool(.*)/i.test(dexKey)) return 'zerox';
if (!isAdapters && /^paraswappool(.*)/i.test(dexKey)) return 'zerox';
else if ('uniswapforkoptimized' === dexKey) {
if (!this.uniswapV2Alias)
throw new Error(
Expand All @@ -252,7 +252,7 @@ export class DexAdapterService {
}

getAdapter(dexKey: string, side: SwapSide) {
const specialDexKey = this.getDexKeySpecial(dexKey);
const specialDexKey = this.getDexKeySpecial(dexKey, true);
return side === SwapSide.SELL
? this.sellAdapters[specialDexKey]
: this.buyAdapters[specialDexKey];
Expand Down

0 comments on commit 23e6cb6

Please sign in to comment.