Compare commits
5 Commits
v1.4.4-rc.
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b908dc1881 | |||
| 523f680276 | |||
| b337c9260b | |||
| c380915100 | |||
| 7d8fd065f0 |
@ -344,8 +344,6 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_swap_transaction)
|
|
||||||
|
|
||||||
// Resolve active pool address
|
// Resolve active pool address
|
||||||
activePoolAddress, err := h.resolveActivePoolAddress(ctx, sessionId)
|
activePoolAddress, err := h.resolveActivePoolAddress(ctx, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -380,8 +378,11 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
|
|||||||
// retrieve the max credit send amounts
|
// retrieve the max credit send amounts
|
||||||
maxSAT, maxRAT, err := h.calculateSendCreditLimits(ctx, activePoolAddress, activeAddress, recipientActiveAddress, publicKey, activeDecimal, recipientActiveDecimal)
|
maxSAT, maxRAT, err := h.calculateSendCreditLimits(ctx, activePoolAddress, activeAddress, recipientActiveAddress, publicKey, activeDecimal, recipientActiveDecimal)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.FlagSet = append(res.FlagSet, flag_api_call_error)
|
// if an error (such as Swap rates not found for the speficied pool and tokens), fall back to a normal transaction
|
||||||
logg.ErrorCtxf(ctx, "failed on calculateSendCreditLimits", "error", err)
|
logg.ErrorCtxf(ctx, "failed on calculateSendCreditLimits", "error", err)
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_swap_transaction)
|
||||||
|
res.Content = l.Get("Maximum amount: %s %s\nEnter amount:", formattedBalance, string(activeSym))
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,6 +414,9 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only set the flag once all checks pass
|
||||||
|
res.FlagSet = append(res.FlagSet, flag_swap_transaction)
|
||||||
|
|
||||||
res.Content = l.Get(
|
res.Content = l.Get(
|
||||||
"Credit Available: %s %s\n(You can swap up to %s %s -> %s %s).\nEnter %s amount:",
|
"Credit Available: %s %s\n(You can swap up to %s %s -> %s %s).\nEnter %s amount:",
|
||||||
maxRAT,
|
maxRAT,
|
||||||
|
|||||||
@ -11,7 +11,6 @@ RELOAD clear_trans_type_flag
|
|||||||
CATCH transaction_swap flag_swap_transaction 1
|
CATCH transaction_swap flag_swap_transaction 1
|
||||||
LOAD validate_amount 64
|
LOAD validate_amount 64
|
||||||
RELOAD validate_amount
|
RELOAD validate_amount
|
||||||
CATCH api_failure flag_api_call_error 1
|
|
||||||
CATCH invalid_amount flag_invalid_amount 1
|
CATCH invalid_amount flag_invalid_amount 1
|
||||||
INCMP _ 0
|
INCMP _ 0
|
||||||
LOAD get_recipient 0
|
LOAD get_recipient 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user