Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
p6te committed Sep 18, 2024
1 parent f0a944b commit 9f82f52
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const Swap: React.FC<ISwap> = ({
const isInsufficientLiquidityError = useMemo(
() =>
simulateResult.poolKey === null &&
(isError(SwapError.InsufficientLiquidity) || isError(SwapError.MaxTicksCrossed)),
(isError(SwapError.InsufficientLiquidity) || isError(SwapError.MaxSwapStepsReached)),
[simulateResult]
)

Expand Down Expand Up @@ -333,7 +333,7 @@ export const Swap: React.FC<ISwap> = ({

if (
convertBalanceToBigint(amountFrom, Number(tokens[tokenFrom]?.decimals) ?? 0n) >
tokens[tokenFrom]?.balance ??
tokens[tokenFrom]?.balance ||
0n
) {
return 'Insufficient balance'
Expand Down
2 changes: 1 addition & 1 deletion src/containers/WrappedSwap/WrappedSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const WrappedSwap = ({ initialTokenFrom, initialTokenTo }: Props) => {
const addTokenHandler = async (address: string) => {
const psp22 = SingletonPSP22.getInstance()

if (psp22 && api !== null && ![address]) {
if (psp22 && api !== null && !tokensList[address]) {
getNewTokenOrThrow(address, psp22, walletAddress)
.then(data => {
dispatch(poolsActions.addTokens(data))
Expand Down
1 change: 1 addition & 0 deletions src/store/consts/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ export const EMPTY_POSITION: Position = {
lastBlockNumber: 0n,
tokensOwedX: 0n,
tokensOwedY: 0n,
secondsPerLiquidityInside: 0n,
createdAt: 0n
}

Expand Down
6 changes: 3 additions & 3 deletions src/store/sagas/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export enum SwapError {
InsufficientLiquidity,
AmountIsZero,
NoRouteFound,
MaxTicksCrossed,
MaxSwapStepsReached,
StateOutdated,
Unknown
}
Expand Down Expand Up @@ -310,8 +310,8 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
continue
}

if (result.maxTicksCrossed) {
errors.push(SwapError.MaxTicksCrossed)
if (result.maxSwapStepsReached) {
errors.push(SwapError.MaxSwapStepsReached)
continue
}

Expand Down

0 comments on commit 9f82f52

Please sign in to comment.