From 31a0b5d37d0b1a4834e458c2a26f8114af56d7fe Mon Sep 17 00:00:00 2001 From: Maxime <52084503+Max-3-7@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:29:33 +0200 Subject: [PATCH] fix vite --- packages/core/package.json | 1 + packages/core/src/entities/currency.ts | 20 ++++++++++---------- packages/core/src/utils.ts | 4 ++-- packages/v1/package.json | 2 +- packages/v1/src/entities/trade.ts | 16 ++++++++-------- packages/v2/src/v2entities/trade.ts | 6 +++--- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 998b9bf..000d332 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,6 +4,7 @@ "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts", + "module": "dist/index.js", "files": [ "dist" ], diff --git a/packages/core/src/entities/currency.ts b/packages/core/src/entities/currency.ts index ab537b4..f0c93a3 100644 --- a/packages/core/src/entities/currency.ts +++ b/packages/core/src/entities/currency.ts @@ -47,19 +47,19 @@ export class CNATIVE extends NativeCurrency { const symbol = [43113, 43114].includes(chainId) ? 'AVAX' : 56 === chainId - ? 'BNB' - : 97 === chainId - ? 'tBNB' - : 5000 === chainId - ? 'MNT' - : 'ETH' + ? 'BNB' + : 97 === chainId + ? 'tBNB' + : 5000 === chainId + ? 'MNT' + : 'ETH' const name = [43113, 43114].includes(chainId) ? 'Avalanche' : [56, 97].includes(chainId) - ? 'BNB' - : 5000 === chainId - ? 'Mantle' - : 'Ethereum' + ? 'BNB' + : 5000 === chainId + ? 'Mantle' + : 'Ethereum' super(chainId, 18, symbol, name) } public equals(other: NativeCurrency): boolean { diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 20277e7..f407a66 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -42,8 +42,8 @@ export function parseBigintIsh(bigintIsh: BigintIsh): JSBI { return bigintIsh instanceof JSBI ? bigintIsh : typeof bigintIsh === 'bigint' - ? JSBI.BigInt(bigintIsh.toString()) - : JSBI.BigInt(bigintIsh) + ? JSBI.BigInt(bigintIsh.toString()) + : JSBI.BigInt(bigintIsh) } // mock the on-chain sqrt function diff --git a/packages/v1/package.json b/packages/v1/package.json index a50af0f..1635972 100644 --- a/packages/v1/package.json +++ b/packages/v1/package.json @@ -13,7 +13,7 @@ "traderjoe-xyz", "avalanche" ], - "module": "dist/sdk.esm.js", + "module": "dist/index.js", "scripts": { "test": "vitest --config ./vitest.config.ts", "lint": "eslint \"src/**/*.ts*\" \"test/**/*.ts*\"", diff --git a/packages/v1/src/entities/trade.ts b/packages/v1/src/entities/trade.ts index c1d0f60..916ecb5 100644 --- a/packages/v1/src/entities/trade.ts +++ b/packages/v1/src/entities/trade.ts @@ -223,14 +223,14 @@ export class Trade { tradeType === TradeType.EXACT_INPUT ? amount : route.input.isNative - ? CurrencyAmount.ether(chainId, amounts[0].raw) - : amounts[0] + ? CurrencyAmount.ether(chainId, amounts[0].raw) + : amounts[0] this.outputAmount = tradeType === TradeType.EXACT_OUTPUT ? amount : route.output.isNative - ? CurrencyAmount.ether(chainId, amounts[amounts.length - 1].raw) - : amounts[amounts.length - 1] + ? CurrencyAmount.ether(chainId, amounts[amounts.length - 1].raw) + : amounts[amounts.length - 1] this.executionPrice = new Price( this.inputAmount.currency, this.outputAmount.currency, @@ -317,8 +317,8 @@ export class Trade { currencyAmountIn instanceof TokenAmount ? currencyAmountIn.token.chainId : currencyOut instanceof Token - ? currencyOut.chainId - : undefined + ? currencyOut.chainId + : undefined invariant(chainId !== undefined, 'CHAIN_ID') const amountIn = wrappedAmount(currencyAmountIn, chainId) @@ -419,8 +419,8 @@ export class Trade { currencyAmountOut instanceof TokenAmount ? currencyAmountOut.token.chainId : currencyIn instanceof Token - ? currencyIn.chainId - : undefined + ? currencyIn.chainId + : undefined invariant(chainId !== undefined, 'CHAIN_ID') const amountOut = wrappedAmount(currencyAmountOut, chainId) diff --git a/packages/v2/src/v2entities/trade.ts b/packages/v2/src/v2entities/trade.ts index 36e910a..83143ef 100644 --- a/packages/v2/src/v2entities/trade.ts +++ b/packages/v2/src/v2entities/trade.ts @@ -590,9 +590,9 @@ export class TradeV2 { ? currentTrade : previousTrade : currentTrade.trade.inputAmount.greaterThan('0') && - currentTrade.swapOutcome.lessThan(previousTrade.swapOutcome) - ? currentTrade - : previousTrade + currentTrade.swapOutcome.lessThan(previousTrade.swapOutcome) + ? currentTrade + : previousTrade ) return { bestTrade: bestTrade.trade, estimatedGas: bestTrade.estimatedGas }