diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-12 15:38:03 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-12 15:38:03 +0100 |
commit | 1bcc5022c27fff2c28c38b3db12ac353cc7d3481 (patch) | |
tree | 719c8f342a4cfd4c13fc3aec58a30cce6aac007c /src/wallet.ts | |
parent | b4484c8af37b0c5912adce2dcf3a40d9455c7200 (diff) | |
download | wallet-core-1bcc5022c27fff2c28c38b3db12ac353cc7d3481.tar.xz |
show tip in history
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index a597fd5bc..5b658de85 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -329,7 +329,7 @@ export const WALLET_PROTOCOL_VERSION = "2:0:0"; * In the future we might consider adding migration functions for * each version increment. */ -export const WALLET_DB_VERSION = 22; +export const WALLET_DB_VERSION = 23; const builtinCurrencies: CurrencyRecord[] = [ { @@ -2356,6 +2356,20 @@ export class Wallet { } } + const tips: TipRecord[] = await this.q().iter<TipRecord>(Stores.tips).toArray(); + for (const tip of tips) { + history.push({ + detail: { + merchantDomain: tip.merchantDomain, + amount: tip.amount, + reservePub: tip.accepted, + tipId: tip.tipId, + }, + timestamp: tip.timestamp, + type: "tip", + }); + } + history.sort((h1, h2) => Math.sign(h1.timestamp - h2.timestamp)); return {history}; @@ -2869,6 +2883,7 @@ export class Wallet { const denomsForWithdraw = await this.getVerifiedWithdrawDenomList(exchangeUrl, amount); const planchets = await Promise.all(denomsForWithdraw.map(d => this.cryptoApi.createTipPlanchet(d))); const coinPubs: string[] = planchets.map(x => x.coinPub); + const now = (new Date()).getTime(); tipRecord = { accepted: false, amount, @@ -2878,6 +2893,7 @@ export class Wallet { merchantDomain, nextUrl, planchets, + timestamp: now, tipId, }; await this.q().put(Stores.tips, tipRecord).finish(); |