version bump / pending balance tweaks
This commit is contained in:
parent
c33dd75711
commit
8683c93613
@ -4,8 +4,8 @@
|
|||||||
"name": "GNU Taler Wallet (git)",
|
"name": "GNU Taler Wallet (git)",
|
||||||
"description": "Privacy preserving and transparent payments",
|
"description": "Privacy preserving and transparent payments",
|
||||||
"author": "GNU Taler Developers",
|
"author": "GNU Taler Developers",
|
||||||
"version": "0.6.70",
|
"version": "0.6.71",
|
||||||
"version_name": "0.6.0pre3",
|
"version_name": "0.6.0pre4",
|
||||||
|
|
||||||
"minimum_chrome_version": "51",
|
"minimum_chrome_version": "51",
|
||||||
"minimum_opera_version": "36",
|
"minimum_opera_version": "36",
|
||||||
|
@ -44,7 +44,7 @@ import { Timestamp, OperationError } from "./walletTypes";
|
|||||||
* In the future we might consider adding migration functions for
|
* In the future we might consider adding migration functions for
|
||||||
* each version increment.
|
* each version increment.
|
||||||
*/
|
*/
|
||||||
export const WALLET_DB_VERSION = 27;
|
export const WALLET_DB_VERSION = 28;
|
||||||
|
|
||||||
export enum ReserveRecordStatus {
|
export enum ReserveRecordStatus {
|
||||||
/**
|
/**
|
||||||
@ -1045,11 +1045,12 @@ export interface WithdrawalSessionRecord {
|
|||||||
*/
|
*/
|
||||||
finishTimestamp?: Timestamp;
|
finishTimestamp?: Timestamp;
|
||||||
|
|
||||||
|
totalCoinValue: AmountJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount that is being withdrawn with this operation.
|
* Amount including fees.
|
||||||
* This does not include fees.
|
|
||||||
*/
|
*/
|
||||||
withdrawalAmount: string;
|
rawWithdrawalAmount: AmountJson;
|
||||||
|
|
||||||
denoms: string[];
|
denoms: string[];
|
||||||
|
|
||||||
|
@ -17,10 +17,7 @@
|
|||||||
/**
|
/**
|
||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import {
|
import { WalletBalance, WalletBalanceEntry } from "../walletTypes";
|
||||||
WalletBalance,
|
|
||||||
WalletBalanceEntry,
|
|
||||||
} from "../walletTypes";
|
|
||||||
import { runWithReadTransaction } from "../util/query";
|
import { runWithReadTransaction } from "../util/query";
|
||||||
import { InternalWalletState } from "./state";
|
import { InternalWalletState } from "./state";
|
||||||
import { Stores, TipRecord, CoinStatus } from "../dbTypes";
|
import { Stores, TipRecord, CoinStatus } from "../dbTypes";
|
||||||
@ -77,7 +74,7 @@ export async function getBalances(
|
|||||||
|
|
||||||
await runWithReadTransaction(
|
await runWithReadTransaction(
|
||||||
ws.db,
|
ws.db,
|
||||||
[Stores.coins, Stores.refresh, Stores.reserves, Stores.purchases],
|
[Stores.coins, Stores.refresh, Stores.reserves, Stores.purchases, Stores.withdrawalSession],
|
||||||
async tx => {
|
async tx => {
|
||||||
await tx.iter(Stores.coins).forEach(c => {
|
await tx.iter(Stores.coins).forEach(c => {
|
||||||
if (c.suspended) {
|
if (c.suspended) {
|
||||||
@ -121,6 +118,24 @@ export async function getBalances(
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await tx.iter(Stores.withdrawalSession).forEach(wds => {
|
||||||
|
let w = wds.totalCoinValue;
|
||||||
|
for (let i = 0; i < wds.planchets.length; i++) {
|
||||||
|
if (wds.withdrawn[i]) {
|
||||||
|
const p = wds.planchets[i];
|
||||||
|
if (p) {
|
||||||
|
w = Amounts.sub(w, p.coinValue).amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addTo(
|
||||||
|
balanceStore,
|
||||||
|
"pendingIncoming",
|
||||||
|
w,
|
||||||
|
wds.exchangeBaseUrl,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
await tx.iter(Stores.purchases).forEach(t => {
|
await tx.iter(Stores.purchases).forEach(t => {
|
||||||
if (t.finished) {
|
if (t.finished) {
|
||||||
return;
|
return;
|
||||||
|
@ -61,7 +61,7 @@ export async function getHistory(
|
|||||||
for (const w of withdrawals) {
|
for (const w of withdrawals) {
|
||||||
history.push({
|
history.push({
|
||||||
detail: {
|
detail: {
|
||||||
withdrawalAmount: w.withdrawalAmount,
|
withdrawalAmount: w.rawWithdrawalAmount,
|
||||||
},
|
},
|
||||||
timestamp: w.startTimestamp,
|
timestamp: w.startTimestamp,
|
||||||
type: "withdraw",
|
type: "withdraw",
|
||||||
|
@ -502,6 +502,8 @@ async function depleteReserve(
|
|||||||
|
|
||||||
const withdrawalSessionId = encodeCrock(randomBytes(32));
|
const withdrawalSessionId = encodeCrock(randomBytes(32));
|
||||||
|
|
||||||
|
const totalCoinValue = Amounts.sum(denomsForWithdraw.map(x => x.value)).amount;
|
||||||
|
|
||||||
const withdrawalRecord: WithdrawalSessionRecord = {
|
const withdrawalRecord: WithdrawalSessionRecord = {
|
||||||
withdrawSessionId: withdrawalSessionId,
|
withdrawSessionId: withdrawalSessionId,
|
||||||
exchangeBaseUrl: reserve.exchangeBaseUrl,
|
exchangeBaseUrl: reserve.exchangeBaseUrl,
|
||||||
@ -509,15 +511,14 @@ async function depleteReserve(
|
|||||||
type: "reserve",
|
type: "reserve",
|
||||||
reservePub: reserve.reservePub,
|
reservePub: reserve.reservePub,
|
||||||
},
|
},
|
||||||
withdrawalAmount: Amounts.toString(withdrawAmount),
|
rawWithdrawalAmount: withdrawAmount,
|
||||||
startTimestamp: getTimestampNow(),
|
startTimestamp: getTimestampNow(),
|
||||||
denoms: denomsForWithdraw.map(x => x.denomPub),
|
denoms: denomsForWithdraw.map(x => x.denomPub),
|
||||||
withdrawn: denomsForWithdraw.map(x => false),
|
withdrawn: denomsForWithdraw.map(x => false),
|
||||||
planchets: denomsForWithdraw.map(x => undefined),
|
planchets: denomsForWithdraw.map(x => undefined),
|
||||||
|
totalCoinValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
const totalCoinValue = Amounts.sum(denomsForWithdraw.map(x => x.value))
|
|
||||||
.amount;
|
|
||||||
const totalCoinWithdrawFee = Amounts.sum(
|
const totalCoinWithdrawFee = Amounts.sum(
|
||||||
denomsForWithdraw.map(x => x.feeWithdraw),
|
denomsForWithdraw.map(x => x.feeWithdraw),
|
||||||
).amount;
|
).amount;
|
||||||
|
@ -202,8 +202,9 @@ export async function processTip(
|
|||||||
},
|
},
|
||||||
startTimestamp: getTimestampNow(),
|
startTimestamp: getTimestampNow(),
|
||||||
withdrawSessionId: withdrawalSessionId,
|
withdrawSessionId: withdrawalSessionId,
|
||||||
withdrawalAmount: Amounts.toString(tipRecord.amount),
|
rawWithdrawalAmount: tipRecord.amount,
|
||||||
withdrawn: planchets.map((x) => false),
|
withdrawn: planchets.map((x) => false),
|
||||||
|
totalCoinValue: Amounts.sum(planchets.map((p) => p.coinValue)).amount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,9 +143,12 @@ export async function acceptWithdrawal(
|
|||||||
senderWire: withdrawInfo.senderWire,
|
senderWire: withdrawInfo.senderWire,
|
||||||
exchangeWire: exchangeWire,
|
exchangeWire: exchangeWire,
|
||||||
});
|
});
|
||||||
|
ws.badge.showNotification();
|
||||||
|
ws.notifier.notify();
|
||||||
// We do this here, as the reserve should be registered before we return,
|
// We do this here, as the reserve should be registered before we return,
|
||||||
// so that we can redirect the user to the bank's status page.
|
// so that we can redirect the user to the bank's status page.
|
||||||
await processReserveBankStatus(ws, reserve.reservePub);
|
await processReserveBankStatus(ws, reserve.reservePub);
|
||||||
|
ws.notifier.notify();
|
||||||
console.log("acceptWithdrawal: returning");
|
console.log("acceptWithdrawal: returning");
|
||||||
return {
|
return {
|
||||||
reservePub: reserve.reservePub,
|
reservePub: reserve.reservePub,
|
||||||
|
@ -120,7 +120,7 @@ import { AsyncCondition } from "./util/promiseUtils";
|
|||||||
*/
|
*/
|
||||||
export const WALLET_PROTOCOL_VERSION = "3:0:0";
|
export const WALLET_PROTOCOL_VERSION = "3:0:0";
|
||||||
|
|
||||||
export const WALLET_CACHE_BREAKER_CLIENT_VERSION = "2";
|
export const WALLET_CACHE_BREAKER_CLIENT_VERSION = "3";
|
||||||
|
|
||||||
const builtinCurrencies: CurrencyRecord[] = [
|
const builtinCurrencies: CurrencyRecord[] = [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user