diff --git a/packages/desktop/components/popups/TokenInformationPopup.svelte b/packages/desktop/components/popups/TokenInformationPopup.svelte index 6ff017bdba..460dd57b95 100644 --- a/packages/desktop/components/popups/TokenInformationPopup.svelte +++ b/packages/desktop/components/popups/TokenInformationPopup.svelte @@ -44,8 +44,8 @@ const sendFlowType = token.id === BASE_TOKEN_ID ? SendFlowType.BaseCoinTransfer : SendFlowType.TokenTransfer setSendFlowParameters({ type: sendFlowType, - [sendFlowType === SendFlowType.BaseCoinTransfer ? 'baseCoinTransfer' : 'tokenTransfer']: { - token: token, + [sendFlowType]: { + token, }, }) diff --git a/packages/desktop/views/dashboard/send-flow/views/InputTokenAmountView.svelte b/packages/desktop/views/dashboard/send-flow/views/InputTokenAmountView.svelte index 402a6f1e25..e6fbe98fa0 100644 --- a/packages/desktop/views/dashboard/send-flow/views/InputTokenAmountView.svelte +++ b/packages/desktop/views/dashboard/send-flow/views/InputTokenAmountView.svelte @@ -11,15 +11,11 @@ let rawAmount: string let amount: string let unit: string - const tokenKey = $sendFlowParameters.type === SendFlowType.TokenTransfer ? 'tokenTransfer' : 'baseCoinTransfer' - - if ( - $sendFlowParameters.type === SendFlowType.BaseCoinTransfer || - $sendFlowParameters.type === SendFlowType.TokenTransfer - ) { - token = $sendFlowParameters[tokenKey].token - rawAmount = $sendFlowParameters[tokenKey].rawAmount - unit = $sendFlowParameters[tokenKey].unit || getUnitFromTokenMetadata(token?.metadata) + const sendFlowType = $sendFlowParameters.type + if (sendFlowType === SendFlowType.BaseCoinTransfer || sendFlowType === SendFlowType.TokenTransfer) { + token = $sendFlowParameters[sendFlowType].token + rawAmount = $sendFlowParameters[sendFlowType].rawAmount + unit = $sendFlowParameters[sendFlowType].unit || getUnitFromTokenMetadata(token?.metadata) } $: availableBalance = token?.balance?.available @@ -38,7 +34,7 @@ updateSendFlowParameters({ type: $sendFlowParameters.type, - [tokenKey]: { + [sendFlowType]: { token, rawAmount, unit, @@ -53,7 +49,7 @@ function onBackClick(): void { updateSendFlowParameters({ type: $sendFlowParameters.type, - [tokenKey]: { + [sendFlowType]: { token, rawAmount: undefined, unit, diff --git a/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte b/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte index 86cb63b507..f146293e2e 100644 --- a/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte +++ b/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte @@ -105,7 +105,7 @@ setSendFlowParameters({ ...previousSharedParameters, type: sendFlowType, - [sendFlowType === SendFlowType.BaseCoinTransfer ? 'baseCoinTransfer' : 'tokenTransfer']: { + [sendFlowType]: { token: selectedToken, }, })