Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix: erase zeros should not clean the input (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
luizstacio committed Sep 21, 2022
1 parent 9425e4b commit 3dcabfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/app/src/systems/Swap/machines/swapMachine.ts
Expand Up @@ -95,7 +95,7 @@ const INVALID_STATES = {
},
FROM_AMOUNT_TOO_LOW: {
cond: 'toAmountIsZero',
actions: 'cleanPreviewInfo',
actions: ['cleanPreviewInfo', 'cleanToAmount'],
target: '#(machine).invalid.fromAmountTooLow',
},
};
Expand Down Expand Up @@ -319,7 +319,6 @@ export const swapMachine =
],
INPUT_CHANGE: [
{
actions: 'clearContext',
cond: 'inputIsEmpty',
target: '.invalid.withoutAmount',
},
Expand Down Expand Up @@ -371,6 +370,10 @@ export const swapMachine =
...ctx,
previewInfo: null,
})),
cleanToAmount: assign((ctx) => ({
...ctx,
toAmount: undefined,
})),
setTxCost: assign({
txCost: (_, ev) => ev.data,
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/Swap/utils/helpers.ts
Expand Up @@ -35,7 +35,7 @@ export function createAmount(value: Maybe<string | BN>): CoinAmount {
if (typeof value === 'string') {
const raw = parseUnits(value);
return {
value: formatUnits(raw),
value,
raw,
};
}
Expand Down

0 comments on commit 3dcabfa

Please sign in to comment.