From e0a3410f36d71a86d9e32c5e5d8e5ef10b32f7a6 Mon Sep 17 00:00:00 2001 From: lash Date: Sat, 2 Nov 2024 23:43:19 +0000 Subject: [PATCH] Set active / default voucher on first tx --- event/token.go | 17 +++++++---------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/event/token.go b/event/token.go index a096186..f4edc41 100644 --- a/event/token.go +++ b/event/token.go @@ -95,8 +95,14 @@ func updateTokenList(ctx context.Context, api remote.AccountServiceInterface, st // return nil //} // + func updateDefaultToken(ctx context.Context, store *common.UserDataStore, identity lookup.Identity, activeSym string) error { - return nil + pfxDb := common.StoreToPrefixDb(store, []byte("vouchers")) + tokenData, err := common.GetVoucherData(ctx, pfxDb, activeSym) + if err != nil { + return err + } + return common.UpdateVoucherData(ctx, store, identity.SessionId, tokenData) } func updateWait(ctx context.Context, api remote.AccountServiceInterface) error { @@ -124,15 +130,6 @@ func updateToken(ctx context.Context, store *common.UserDataStore, identity look return err } -// err = updateTokenBalance(ctx, &api, store, sessionId) -// if err != nil { -// return err -// } -// err = updateTokenTransferList(ctx, &api, store, sessionId) -// if err != nil { -// return err -// } -// return nil } diff --git a/go.mod b/go.mod index e9860b8..d50c987 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23.2 require ( git.defalsify.org/vise.git v0.2.1-0.20241031204035-b588301738ed - git.grassecon.net/urdt/ussd v0.0.0-20241102164250-3a8a5f40baa5 + git.grassecon.net/urdt/ussd v0.0.0-20241102234108-dae12ac4989e github.com/grassrootseconomics/eth-tracker v1.3.0-rc github.com/nats-io/nats.go v1.37.0 ) diff --git a/go.sum b/go.sum index df0a41d..01f3f75 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ git.defalsify.org/vise.git v0.2.1-0.20241031204035-b588301738ed h1:4TrsfbK7NKgsa7KjMPlnV/tjYTkAAXP5PWAZzUfzCdI= git.defalsify.org/vise.git v0.2.1-0.20241031204035-b588301738ed/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck= -git.grassecon.net/urdt/ussd v0.0.0-20241102164250-3a8a5f40baa5 h1:B+2YYPw8REXOuEL0PgS5Mzky253wrwWYL9mpD5CmGW4= -git.grassecon.net/urdt/ussd v0.0.0-20241102164250-3a8a5f40baa5/go.mod h1:ADB/wpwvI6umvYzGqpJGm/GYj8msxYGiczzWCCdXegs= +git.grassecon.net/urdt/ussd v0.0.0-20241102234108-dae12ac4989e h1:YOEAjTrlyDRm0E63fEq8HbMp7oUCyc3vbAPOIw0xNWA= +git.grassecon.net/urdt/ussd v0.0.0-20241102234108-dae12ac4989e/go.mod h1:ADB/wpwvI6umvYzGqpJGm/GYj8msxYGiczzWCCdXegs= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk=