[bugfix] re-ordering of fund inputs (#380)
This commit is contained in:
parent
5ee2b17b4c
commit
179400fe08
@ -82,14 +82,16 @@ export default function FundAccount(props: Props) {
|
||||
|
||||
const updateFundingAssets = useCallback(
|
||||
(amount: BigNumber, denom: string) => {
|
||||
const assetToUpdate = fundingAssets.find(byDenom(denom))
|
||||
if (assetToUpdate) {
|
||||
assetToUpdate.amount = amount
|
||||
setFundingAssets([...fundingAssets.filter((a) => a.denom !== denom), assetToUpdate])
|
||||
}
|
||||
setChange({ deposits: fundingAssets })
|
||||
setFundingAssets((prevAssets) => {
|
||||
const assetToUpdateIdx = prevAssets.findIndex(byDenom(denom))
|
||||
if (assetToUpdateIdx > -1) {
|
||||
prevAssets[assetToUpdateIdx].amount = amount
|
||||
}
|
||||
setChange({ deposits: prevAssets })
|
||||
return prevAssets
|
||||
})
|
||||
},
|
||||
[fundingAssets, setChange],
|
||||
[setChange],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user