cleanup
This commit is contained in:
parent
26d961ad63
commit
6e2881fabf
@ -30,7 +30,7 @@ import { NotificationType } from "../types/notifications";
|
|||||||
|
|
||||||
const logger = new Logger("payback.ts");
|
const logger = new Logger("payback.ts");
|
||||||
|
|
||||||
export async function payback(
|
export async function recoup(
|
||||||
ws: InternalWalletState,
|
ws: InternalWalletState,
|
||||||
coinPub: string,
|
coinPub: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
@ -95,7 +95,7 @@ import { getHistory } from "./operations/history";
|
|||||||
import { getPendingOperations } from "./operations/pending";
|
import { getPendingOperations } from "./operations/pending";
|
||||||
import { getBalances } from "./operations/balance";
|
import { getBalances } from "./operations/balance";
|
||||||
import { acceptTip, getTipStatus, processTip } from "./operations/tip";
|
import { acceptTip, getTipStatus, processTip } from "./operations/tip";
|
||||||
import { payback } from "./operations/payback";
|
import { recoup } from "./operations/recoup";
|
||||||
import { TimerGroup } from "./util/timer";
|
import { TimerGroup } from "./util/timer";
|
||||||
import { AsyncCondition } from "./util/promiseUtils";
|
import { AsyncCondition } from "./util/promiseUtils";
|
||||||
import { AsyncOpMemoSingle } from "./util/asyncMemo";
|
import { AsyncOpMemoSingle } from "./util/asyncMemo";
|
||||||
@ -577,10 +577,6 @@ export class Wallet {
|
|||||||
return await this.db.iter(Stores.coins).toArray();
|
return await this.db.iter(Stores.coins).toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
async payback(coinPub: string): Promise<void> {
|
|
||||||
return payback(this.ws, coinPub);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPaybackReserves(): Promise<ReserveRecord[]> {
|
async getPaybackReserves(): Promise<ReserveRecord[]> {
|
||||||
return await this.db.iter(Stores.reserves).filter(r => r.hasPayback);
|
return await this.db.iter(Stores.reserves).filter(r => r.hasPayback);
|
||||||
}
|
}
|
||||||
|
@ -118,10 +118,6 @@ export interface MessageMap {
|
|||||||
request: { exchangeBaseUrl: string };
|
request: { exchangeBaseUrl: string };
|
||||||
response: dbTypes.DenominationRecord[];
|
response: dbTypes.DenominationRecord[];
|
||||||
};
|
};
|
||||||
"payback-coin": {
|
|
||||||
request: { coinPub: string };
|
|
||||||
response: void;
|
|
||||||
};
|
|
||||||
"check-upgrade": {
|
"check-upgrade": {
|
||||||
request: {};
|
request: {};
|
||||||
response: UpgradeResponse;
|
response: UpgradeResponse;
|
||||||
|
@ -193,13 +193,6 @@ export function refresh(coinPub: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Request payback for a coin. Only works for non-refreshed coins.
|
|
||||||
*/
|
|
||||||
export function payback(coinPub: string): Promise<void> {
|
|
||||||
return callBackend("payback-coin", { coinPub });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pay for a proposal.
|
* Pay for a proposal.
|
||||||
*/
|
*/
|
||||||
|
@ -24,9 +24,18 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { BrowserCryptoWorkerFactory } from "../crypto/workers/cryptoApi";
|
import { BrowserCryptoWorkerFactory } from "../crypto/workers/cryptoApi";
|
||||||
import { deleteTalerDatabase, openTalerDatabase, WALLET_DB_VERSION } from "../db";
|
import {
|
||||||
import { ConfirmReserveRequest, CreateReserveRequest, ReturnCoinsRequest, WalletDiagnostics, codecForCreateReserveRequest, codecForConfirmReserveRequest } from "../types/walletTypes";
|
deleteTalerDatabase,
|
||||||
import { AmountJson, codecForAmountJson } from "../util/amounts";
|
openTalerDatabase,
|
||||||
|
WALLET_DB_VERSION,
|
||||||
|
} from "../db";
|
||||||
|
import {
|
||||||
|
ReturnCoinsRequest,
|
||||||
|
WalletDiagnostics,
|
||||||
|
codecForCreateReserveRequest,
|
||||||
|
codecForConfirmReserveRequest,
|
||||||
|
} from "../types/walletTypes";
|
||||||
|
import { codecForAmountJson } from "../util/amounts";
|
||||||
import { BrowserHttpLib } from "../util/http";
|
import { BrowserHttpLib } from "../util/http";
|
||||||
import { OpenedPromise, openPromise } from "../util/promiseUtils";
|
import { OpenedPromise, openPromise } from "../util/promiseUtils";
|
||||||
import { classifyTalerUri, TalerUriType } from "../util/taleruri";
|
import { classifyTalerUri, TalerUriType } from "../util/taleruri";
|
||||||
@ -67,7 +76,7 @@ async function handleMessage(
|
|||||||
}
|
}
|
||||||
case "dump-db": {
|
case "dump-db": {
|
||||||
const db = needsWallet().db;
|
const db = needsWallet().db;
|
||||||
return db.exportDatabase()
|
return db.exportDatabase();
|
||||||
}
|
}
|
||||||
case "import-db": {
|
case "import-db": {
|
||||||
const db = needsWallet().db;
|
const db = needsWallet().db;
|
||||||
@ -166,12 +175,6 @@ async function handleMessage(
|
|||||||
}
|
}
|
||||||
return needsWallet().refresh(detail.coinPub);
|
return needsWallet().refresh(detail.coinPub);
|
||||||
}
|
}
|
||||||
case "payback-coin": {
|
|
||||||
if (typeof detail.coinPub !== "string") {
|
|
||||||
return Promise.reject(Error("coinPub missing"));
|
|
||||||
}
|
|
||||||
return needsWallet().payback(detail.coinPub);
|
|
||||||
}
|
|
||||||
case "get-sender-wire-infos": {
|
case "get-sender-wire-infos": {
|
||||||
return needsWallet().getSenderWireInfos();
|
return needsWallet().getSenderWireInfos();
|
||||||
}
|
}
|
||||||
@ -399,10 +402,7 @@ async function reinitWallet() {
|
|||||||
setBadgeText({ text: "" });
|
setBadgeText({ text: "" });
|
||||||
const badge = new ChromeBadge();
|
const badge = new ChromeBadge();
|
||||||
try {
|
try {
|
||||||
currentDatabase = await openTalerDatabase(
|
currentDatabase = await openTalerDatabase(indexedDB, reinitWallet);
|
||||||
indexedDB,
|
|
||||||
reinitWallet,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("could not open database", e);
|
console.error("could not open database", e);
|
||||||
walletInit.reject(e);
|
walletInit.reject(e);
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
"src/operations/exchanges.ts",
|
"src/operations/exchanges.ts",
|
||||||
"src/operations/history.ts",
|
"src/operations/history.ts",
|
||||||
"src/operations/pay.ts",
|
"src/operations/pay.ts",
|
||||||
"src/operations/payback.ts",
|
|
||||||
"src/operations/pending.ts",
|
"src/operations/pending.ts",
|
||||||
|
"src/operations/recoup.ts",
|
||||||
"src/operations/refresh.ts",
|
"src/operations/refresh.ts",
|
||||||
"src/operations/refund.ts",
|
"src/operations/refund.ts",
|
||||||
"src/operations/reserves.ts",
|
"src/operations/reserves.ts",
|
||||||
|
Loading…
Reference in New Issue
Block a user