save the entire voucher data when setting the default voucher
This commit is contained in:
parent
9d2d01e3e2
commit
f3e3badff6
@ -1447,6 +1447,8 @@ func (h *Handlers) SetDefaultVoucher(ctx context.Context, sym string, input []by
|
|||||||
firstVoucher := vouchersResp[0]
|
firstVoucher := vouchersResp[0]
|
||||||
defaultSym := firstVoucher.TokenSymbol
|
defaultSym := firstVoucher.TokenSymbol
|
||||||
defaultBal := firstVoucher.Balance
|
defaultBal := firstVoucher.Balance
|
||||||
|
defaultDec := firstVoucher.TokenDecimals
|
||||||
|
defaultAddr := firstVoucher.ContractAddress
|
||||||
|
|
||||||
// set the active symbol
|
// set the active symbol
|
||||||
err = store.WriteEntry(ctx, sessionId, common.DATA_ACTIVE_SYM, []byte(defaultSym))
|
err = store.WriteEntry(ctx, sessionId, common.DATA_ACTIVE_SYM, []byte(defaultSym))
|
||||||
@ -1460,6 +1462,18 @@ func (h *Handlers) SetDefaultVoucher(ctx context.Context, sym string, input []by
|
|||||||
logg.ErrorCtxf(ctx, "failed to write defaultBal entry with", "key", common.DATA_ACTIVE_BAL, "value", defaultBal, "error", err)
|
logg.ErrorCtxf(ctx, "failed to write defaultBal entry with", "key", common.DATA_ACTIVE_BAL, "value", defaultBal, "error", err)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
// set the active decimals
|
||||||
|
err = store.WriteEntry(ctx, sessionId, common.DATA_ACTIVE_DECIMAL, []byte(defaultDec))
|
||||||
|
if err != nil {
|
||||||
|
logg.ErrorCtxf(ctx, "failed to write defaultDec entry with", "key", common.DATA_ACTIVE_DECIMAL, "value", defaultDec, "error", err)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
// set the active contract address
|
||||||
|
err = store.WriteEntry(ctx, sessionId, common.DATA_ACTIVE_ADDRESS, []byte(defaultAddr))
|
||||||
|
if err != nil {
|
||||||
|
logg.ErrorCtxf(ctx, "failed to write defaultAddr entry with", "key", common.DATA_ACTIVE_ADDRESS, "value", defaultAddr, "error", err)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user