wip-account-creation #4

Merged
lash merged 143 commits from wip-account-creation into master 2024-08-30 14:37:58 +02:00
4 changed files with 21 additions and 5 deletions
Showing only changes of commit 768535b540 - Show all commits

View File

@ -706,9 +706,30 @@ func (h *Handlers) QuitWithBalance(ctx context.Context, sym string, input []byte
func (h *Handlers) InitiateTransaction(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{}
accountData, err := h.accountFileHandler.ReadAccountData()
if err != nil {
return res, err
}
// TODO
// Use the amount, recipient and sender to call the API and initialize the transaction
switch codeFromCtx(ctx) {
case "swa":
res.Content = fmt.Sprintf("Ombi lako limetumwa. %s atapokea %s kutoka kwa %s.", accountData["Recipient"], accountData["Amount"], accountData["PublicKey"])
default:
res.Content = fmt.Sprintf("Your request has been sent. %s will receive %s from %s.", accountData["Recipient"], accountData["Amount"], accountData["PublicKey"])
}
// reset the transaction
accountData["Recipient"] = ""
accountData["Amount"] = ""
err = h.accountFileHandler.WriteAccountData(accountData)
if err != nil {
return res, err
}
res.FlagReset = append(res.FlagReset, models.USERFLAG_ACCOUNT_UNLOCKED)
return res, nil
}

View File

@ -1 +0,0 @@
Your request has been sent. {{.get_recipient}} will receive {{.get_amount}} from {{.get_sender}}.

View File

@ -6,7 +6,4 @@ MAP get_recipient
RELOAD get_sender
MAP get_sender
LOAD initiate_transaction 0
RELOAD transaction_reset
MOUT quit 9
HALT
INCMP quit 9

View File

@ -1 +0,0 @@
Ombi lako limetumwa. {{.get_recipient}} atapokea {{.get_amount}} kutoka kwa {{.get_sender}}.