Skip to content

Commit d217107

Browse files
committed
fix: fixed resetting swap states,
fix: disabled input for from token in swap
1 parent f449a81 commit d217107

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/wallet-widget/src/components/SequenceWalletProvider/ProviderComponents/SwapProvider.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ export const SwapProvider = ({ children }: { children: ReactNode }) => {
3737
const indexerClient = useIndexerClient(connectedChainId)
3838

3939
const resetSwapStates = () => {
40-
setFromCoin(undefined)
41-
setToCoin(undefined)
42-
setAmount(0, 'from')
40+
_setFromCoin(undefined)
41+
_setToCoin(undefined)
42+
_setAmount(0)
4343
setNonRecentAmount(0)
44+
setRecentInput('from')
4445
setIsSwapReady(false)
4546
setSwapQuoteData(undefined)
4647
setIsSwapQuotePending(false)

packages/wallet-widget/src/views/Swap/Swap.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export const Swap = () => {
7777
<div className="flex gap-1 flex-col w-full">
7878
<Card className="flex flex-col rounded-b-none rounded-t-xl relative pb-6" style={{ overflow: 'visible' }}>
7979
<CoinSelect disabled={isTxnPending} coinList={coinBalancesWithPrices || []} selectType="from" />
80-
{fromCoin && <CoinInput disabled={isTxnPending} type="from" />}
80+
{fromCoin && <CoinInput disabled={true} type="from" />}
81+
{/* TODO: change out disabled to isTxnPending after new swap api is implemented */}
8182
{isErrorSwapQuote &&
8283
(hasInsufficientFunds ? (
8384
<Text className="mt-2" variant="normal" color="negative">

0 commit comments

Comments
 (0)