From f32f93dff24c35e0e83de26cc4224a8f63a936b2 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Wed, 18 Feb 2026 13:15:41 +0300 Subject: [PATCH] retain the original amount and use it for the transfer once the swap is performed --- handlers/application/send.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/handlers/application/send.go b/handlers/application/send.go index f460974..756915f 100644 --- a/handlers/application/send.go +++ b/handlers/application/send.go @@ -767,10 +767,10 @@ func (h *MenuHandlers) TransactionSwapPreview(ctx context.Context, sym string, i amountInt.Mul(amountInt, big.NewInt(1015)) amountInt.Div(amountInt, big.NewInt(1000)) - finalAmountStr = amountInt.String() + scaledFinalAmountStr := amountInt.String() // call the credit send API to get the reverse quote - r, err := h.accountService.GetCreditSendReverseQuote(ctx, swapData.ActivePoolAddress, swapData.ActiveSwapFromAddress, swapData.ActiveSwapToAddress, finalAmountStr) + r, err := h.accountService.GetCreditSendReverseQuote(ctx, swapData.ActivePoolAddress, swapData.ActiveSwapFromAddress, swapData.ActiveSwapToAddress, scaledFinalAmountStr) if err != nil { flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error") res.FlagSet = append(res.FlagSet, flag_api_call_error) @@ -782,8 +782,8 @@ func (h *MenuHandlers) TransactionSwapPreview(ctx context.Context, sym string, i sendInputAmount := r.InputAmount // amount of SAT that should be swapped sendOutputAmount := r.OutputAmount // amount of RAT that will be received - // store the sendOutputAmount as the final amount (that will be sent) - err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_AMOUNT, []byte(sendOutputAmount)) + // store the finalAmountStr as the final amount (that will be sent after the swap) + err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_AMOUNT, []byte(finalAmountStr)) if err != nil { logg.ErrorCtxf(ctx, "failed to write output amount value entry with", "key", storedb.DATA_AMOUNT, "value", sendOutputAmount, "error", err) return res, err