remove more history remains
This commit is contained in:
parent
60891b502a
commit
80433b9399
@ -184,13 +184,6 @@ export async function runIntegrationTest(
|
|||||||
);
|
);
|
||||||
|
|
||||||
await myWallet.runUntilDone();
|
await myWallet.runUntilDone();
|
||||||
|
|
||||||
const history = await myWallet.getHistory({ extraDebug: true });
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
"history after integration test:",
|
|
||||||
JSON.stringify(history, undefined, 2),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runIntegrationTestBasic(
|
export async function runIntegrationTestBasic(
|
||||||
@ -327,8 +320,6 @@ export async function runIntegrationTestBasic(
|
|||||||
|
|
||||||
await myWallet.runUntilDone();
|
await myWallet.runUntilDone();
|
||||||
|
|
||||||
const history = await myWallet.getHistory({ extraDebug: true });
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"history after integration test:",
|
"history after integration test:",
|
||||||
JSON.stringify(history, undefined, 2),
|
JSON.stringify(history, undefined, 2),
|
||||||
|
@ -39,6 +39,7 @@ import { makeCodecForList, codecForString } from "../util/codec";
|
|||||||
import { NodeHttpLib } from "./NodeHttpLib";
|
import { NodeHttpLib } from "./NodeHttpLib";
|
||||||
import * as nacl from "../crypto/primitives/nacl-fast";
|
import * as nacl from "../crypto/primitives/nacl-fast";
|
||||||
import { addPaytoQueryParams } from "../util/payto";
|
import { addPaytoQueryParams } from "../util/payto";
|
||||||
|
import { handleCoreApiRequest } from "../walletCoreApiHandler";
|
||||||
|
|
||||||
const logger = new Logger("taler-wallet-cli.ts");
|
const logger = new Logger("taler-wallet-cli.ts");
|
||||||
|
|
||||||
@ -198,33 +199,26 @@ walletCli
|
|||||||
});
|
});
|
||||||
|
|
||||||
walletCli
|
walletCli
|
||||||
.subcommand("history", "history", { help: "Show wallet event history." })
|
.subcommand("api", "balance", { help: "Call the wallet-core API directly." })
|
||||||
.flag("json", ["--json"], {
|
.requiredArgument("operation", clk.STRING)
|
||||||
default: false,
|
.requiredArgument("request", clk.STRING)
|
||||||
})
|
|
||||||
.maybeOption("from", ["--from"], clk.STRING)
|
|
||||||
.maybeOption("to", ["--to"], clk.STRING)
|
|
||||||
.maybeOption("limit", ["--limit"], clk.STRING)
|
|
||||||
.maybeOption("contEvt", ["--continue-with"], clk.STRING)
|
|
||||||
.flag("extraDebug", ["--extra-debug"])
|
|
||||||
.action(async (args) => {
|
.action(async (args) => {
|
||||||
await withWallet(args, async (wallet) => {
|
await withWallet(args, async (wallet) => {
|
||||||
const history = await wallet.getHistory({
|
let requestJson;
|
||||||
extraDebug: args.history.extraDebug,
|
try {
|
||||||
});
|
requestJson = JSON.parse(args.api.operation);
|
||||||
if (args.history.json) {
|
} catch (e) {
|
||||||
console.log(JSON.stringify(history, undefined, 2));
|
console.error("malformed request");
|
||||||
} else {
|
process.exit(1);
|
||||||
for (const h of history.history) {
|
return;
|
||||||
console.log(
|
}
|
||||||
`event at ${new Date(h.timestamp.t_ms).toISOString()} with type ${
|
const resp = await handleCoreApiRequest(
|
||||||
h.type
|
wallet,
|
||||||
}:`,
|
args.api.operation,
|
||||||
|
1,
|
||||||
|
requestJson,
|
||||||
);
|
);
|
||||||
console.log(JSON.stringify(h, undefined, 2));
|
console.log(JSON.stringify(resp, undefined, 2));
|
||||||
console.log();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import {
|
|||||||
PendingOperationsResponse,
|
PendingOperationsResponse,
|
||||||
PendingOperationType,
|
PendingOperationType,
|
||||||
ExchangeUpdateOperationStage,
|
ExchangeUpdateOperationStage,
|
||||||
|
ReserveType,
|
||||||
} from "../types/pending";
|
} from "../types/pending";
|
||||||
import {
|
import {
|
||||||
Duration,
|
Duration,
|
||||||
@ -38,7 +39,6 @@ import {
|
|||||||
import { TransactionHandle } from "../util/query";
|
import { TransactionHandle } from "../util/query";
|
||||||
import { InternalWalletState } from "./state";
|
import { InternalWalletState } from "./state";
|
||||||
import { getBalancesInsideTransaction } from "./balance";
|
import { getBalancesInsideTransaction } from "./balance";
|
||||||
import { ReserveType } from "../types/history";
|
|
||||||
|
|
||||||
function updateRetryDelay(
|
function updateRetryDelay(
|
||||||
oldDelay: Duration,
|
oldDelay: Duration,
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
import { OperationErrorDetails, WalletBalance } from "./walletTypes";
|
import { OperationErrorDetails, WalletBalance } from "./walletTypes";
|
||||||
import { WithdrawalSource, RetryInfo, ReserveRecordStatus } from "./dbTypes";
|
import { WithdrawalSource, RetryInfo, ReserveRecordStatus } from "./dbTypes";
|
||||||
import { Timestamp, Duration } from "../util/time";
|
import { Timestamp, Duration } from "../util/time";
|
||||||
import { ReserveType } from "./history";
|
|
||||||
|
|
||||||
export const enum PendingOperationType {
|
export const enum PendingOperationType {
|
||||||
Bug = "bug",
|
Bug = "bug",
|
||||||
@ -91,6 +90,17 @@ export const enum ExchangeUpdateOperationStage {
|
|||||||
FinalizeUpdate = "finalize-update",
|
FinalizeUpdate = "finalize-update",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const enum ReserveType {
|
||||||
|
/**
|
||||||
|
* Manually created.
|
||||||
|
*/
|
||||||
|
Manual = "manual",
|
||||||
|
/**
|
||||||
|
* Withdrawn from a bank that has "tight" Taler integration
|
||||||
|
*/
|
||||||
|
TalerBankWithdraw = "taler-bank-withdraw",
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status of processing a reserve.
|
* Status of processing a reserve.
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,6 @@ import * as dbTypes from "../types/dbTypes";
|
|||||||
import * as walletTypes from "../types/walletTypes";
|
import * as walletTypes from "../types/walletTypes";
|
||||||
|
|
||||||
import { UpgradeResponse } from "./wxApi";
|
import { UpgradeResponse } from "./wxApi";
|
||||||
import { HistoryEvent } from "../types/history";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message type information.
|
* Message type information.
|
||||||
@ -61,10 +60,6 @@ export interface MessageMap {
|
|||||||
request: { baseUrl: string };
|
request: { baseUrl: string };
|
||||||
response: dbTypes.ExchangeRecord;
|
response: dbTypes.ExchangeRecord;
|
||||||
};
|
};
|
||||||
"get-history": {
|
|
||||||
request: {};
|
|
||||||
response: HistoryEvent[];
|
|
||||||
};
|
|
||||||
"get-coins": {
|
"get-coins": {
|
||||||
request: { exchangeBaseUrl: string };
|
request: { exchangeBaseUrl: string };
|
||||||
response: any;
|
response: any;
|
||||||
|
@ -35,7 +35,6 @@ import { abbrev, renderAmount, PageLink } from "../renderHtml";
|
|||||||
import * as wxApi from "../wxApi";
|
import * as wxApi from "../wxApi";
|
||||||
|
|
||||||
import React, { Fragment, useState, useEffect } from "react";
|
import React, { Fragment, useState, useEffect } from "react";
|
||||||
import { HistoryEvent } from "../../types/history";
|
|
||||||
|
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { Timestamp } from "../../util/time";
|
import { Timestamp } from "../../util/time";
|
||||||
@ -315,311 +314,9 @@ function formatAndCapitalize(text: string): string {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
type HistoryItemProps = {
|
|
||||||
title?: string | JSX.Element;
|
|
||||||
text?: string | JSX.Element;
|
|
||||||
small?: string | JSX.Element;
|
|
||||||
amount?: string | AmountJson;
|
|
||||||
fees?: string | AmountJson;
|
|
||||||
invalid?: string | AmountJson;
|
|
||||||
icon?: string;
|
|
||||||
timestamp: Timestamp;
|
|
||||||
negative?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
function HistoryItem({
|
|
||||||
title,
|
|
||||||
text,
|
|
||||||
small,
|
|
||||||
amount,
|
|
||||||
fees,
|
|
||||||
invalid,
|
|
||||||
timestamp,
|
|
||||||
icon,
|
|
||||||
negative = false,
|
|
||||||
}: HistoryItemProps): JSX.Element {
|
|
||||||
function formatDate(timestamp: number | "never"): string | null {
|
|
||||||
if (timestamp !== "never") {
|
|
||||||
const itemDate = moment(timestamp);
|
|
||||||
if (itemDate.isBetween(moment().subtract(2, "days"), moment())) {
|
|
||||||
return itemDate.fromNow();
|
|
||||||
}
|
|
||||||
return itemDate.format("lll");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let invalidElement, amountElement, feesElement;
|
|
||||||
|
|
||||||
if (amount) {
|
|
||||||
amountElement = renderAmount(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fees) {
|
|
||||||
fees = typeof fees === "string" ? Amounts.parse(fees) : fees;
|
|
||||||
if (fees && Amounts.isNonZero(fees)) {
|
|
||||||
feesElement = renderAmount(fees);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (invalid) {
|
|
||||||
invalid = typeof invalid === "string" ? Amounts.parse(invalid) : invalid;
|
|
||||||
if (invalid && Amounts.isNonZero(invalid)) {
|
|
||||||
invalidElement = renderAmount(invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="historyItem">
|
|
||||||
{icon ? <Icon l={icon} /> : null}
|
|
||||||
<div className="historyContent">
|
|
||||||
{title ? <div className={"historyTitle"}>{title}</div> : null}
|
|
||||||
{text ? <div className={"historyText"}>{text}</div> : null}
|
|
||||||
{small ? <div className={"historySmall"}>{small}</div> : null}
|
|
||||||
</div>
|
|
||||||
<div className={"historyLeft"}>
|
|
||||||
<div className={"historyAmount"}>
|
|
||||||
{amountElement ? (
|
|
||||||
<div className={`${negative ? "negative" : "positive"}`}>
|
|
||||||
{amountElement}
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{invalidElement ? (
|
|
||||||
<div className={"secondary"}>
|
|
||||||
{i18n.str`Invalid `}{" "}
|
|
||||||
<span className={"negative"}>{invalidElement}</span>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{feesElement ? (
|
|
||||||
<div className={"secondary"}>
|
|
||||||
{i18n.str`Fees `}{" "}
|
|
||||||
<span className={"negative"}>{feesElement}</span>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
<div className="historyDate">{formatDate(timestamp.t_ms)}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function amountDiff(
|
|
||||||
total: string | Amounts.AmountJson,
|
|
||||||
partial: string | Amounts.AmountJson,
|
|
||||||
): Amounts.AmountJson | string {
|
|
||||||
const a = typeof total === "string" ? Amounts.parse(total) : total;
|
|
||||||
const b = typeof partial === "string" ? Amounts.parse(partial) : partial;
|
|
||||||
if (a && b) {
|
|
||||||
return Amounts.sub(a, b).amount;
|
|
||||||
} else {
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseSummary(summary: string): { item: string; merchant: string } {
|
|
||||||
const parsed = summary.split(/: (.+)/);
|
|
||||||
return {
|
|
||||||
merchant: parsed[0],
|
|
||||||
item: parsed[1],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatHistoryItem(historyItem: HistoryEvent): JSX.Element {
|
|
||||||
switch (historyItem.type) {
|
|
||||||
case "refreshed": {
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
small={i18n.str`Refresh sessions has completed`}
|
|
||||||
fees={amountDiff(
|
|
||||||
historyItem.amountRefreshedRaw,
|
|
||||||
historyItem.amountRefreshedEffective,
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
case "order-refused": {
|
|
||||||
const { merchant, item } = parseSummary(
|
|
||||||
historyItem.orderShortInfo.summary,
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
icon={"X"}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
small={i18n.str`Order Refused`}
|
|
||||||
title={merchant}
|
|
||||||
text={abbrev(item, 30)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
case "order-redirected": {
|
|
||||||
const { merchant, item } = parseSummary(
|
|
||||||
historyItem.newOrderShortInfo.summary,
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
icon={"⟲"}
|
|
||||||
small={i18n.str`Order redirected`}
|
|
||||||
text={abbrev(item, 40)}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
title={merchant}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
case "payment-aborted": {
|
|
||||||
const { merchant, item } = parseSummary(
|
|
||||||
historyItem.orderShortInfo.summary,
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
amount={historyItem.orderShortInfo.amount}
|
|
||||||
fees={historyItem.amountLost}
|
|
||||||
icon={"P"}
|
|
||||||
small={i18n.str`Payment aborted`}
|
|
||||||
text={abbrev(item, 40)}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
title={merchant}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
case "payment-sent": {
|
|
||||||
const url = historyItem.orderShortInfo.fulfillmentUrl;
|
|
||||||
const { merchant, item } = parseSummary(
|
|
||||||
historyItem.orderShortInfo.summary,
|
|
||||||
);
|
|
||||||
const fees = amountDiff(
|
|
||||||
historyItem.amountPaidWithFees,
|
|
||||||
historyItem.orderShortInfo.amount,
|
|
||||||
);
|
|
||||||
const fulfillmentLinkElem = (
|
|
||||||
<Fragment>
|
|
||||||
<a href={url} onClick={openTab(url)}>
|
|
||||||
{item ? abbrev(item, 30) : null}
|
|
||||||
</a>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
amount={historyItem.orderShortInfo.amount}
|
|
||||||
fees={fees}
|
|
||||||
icon={"P"}
|
|
||||||
negative={true}
|
|
||||||
small={i18n.str`Payment Sent`}
|
|
||||||
text={fulfillmentLinkElem}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
title={merchant}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case "order-accepted": {
|
|
||||||
const url = historyItem.orderShortInfo.fulfillmentUrl;
|
|
||||||
const { merchant, item } = parseSummary(
|
|
||||||
historyItem.orderShortInfo.summary,
|
|
||||||
);
|
|
||||||
const fulfillmentLinkElem = (
|
|
||||||
<Fragment>
|
|
||||||
<a href={url} onClick={openTab(url)}>
|
|
||||||
{item ? abbrev(item, 40) : null}
|
|
||||||
</a>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
negative={true}
|
|
||||||
amount={historyItem.orderShortInfo.amount}
|
|
||||||
icon={"P"}
|
|
||||||
small={i18n.str`Order accepted`}
|
|
||||||
text={fulfillmentLinkElem}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
title={merchant}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case "reserve-balance-updated": {
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
small={i18n.str`Reserve balance updated`}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case "refund": {
|
|
||||||
const merchantElem = (
|
|
||||||
<em>{abbrev(historyItem.orderShortInfo.summary, 25)}</em>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
icon={"R"}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
small={i18n.str`Payment refund`}
|
|
||||||
text={merchantElem}
|
|
||||||
amount={historyItem.amountRefundedRaw}
|
|
||||||
invalid={historyItem.amountRefundedInvalid}
|
|
||||||
fees={amountDiff(
|
|
||||||
amountDiff(
|
|
||||||
historyItem.amountRefundedRaw,
|
|
||||||
historyItem.amountRefundedInvalid,
|
|
||||||
),
|
|
||||||
historyItem.amountRefundedEffective,
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case "withdrawn": {
|
|
||||||
const exchange = new URL(historyItem.exchangeBaseUrl).host;
|
|
||||||
const fees = amountDiff(
|
|
||||||
historyItem.amountWithdrawnRaw,
|
|
||||||
historyItem.amountWithdrawnEffective,
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
amount={historyItem.amountWithdrawnRaw}
|
|
||||||
fees={fees}
|
|
||||||
icon={"w"}
|
|
||||||
small={i18n.str`Withdrawn`}
|
|
||||||
title={exchange}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case "tip-accepted": {
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
icon={"T"}
|
|
||||||
negative={true}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
title={<i18n.Translate wrap={Fragment}>Tip Accepted</i18n.Translate>}
|
|
||||||
amount={historyItem.tipAmountRaw}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
case "tip-declined": {
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
icon={"T"}
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
title={<i18n.Translate wrap={Fragment}>Tip Declined</i18n.Translate>}
|
|
||||||
amount={historyItem.tipAmountRaw}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return (
|
|
||||||
<HistoryItem
|
|
||||||
timestamp={historyItem.timestamp}
|
|
||||||
small={i18n.str`${formatAndCapitalize(historyItem.type)}`}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const HistoryComponent = (props: any): JSX.Element => {
|
const HistoryComponent = (props: any): JSX.Element => {
|
||||||
const record = props.record;
|
return <span>TBD</span>;
|
||||||
return formatHistoryItem(record);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WalletSettings extends React.Component<any, any> {
|
class WalletSettings extends React.Component<any, any> {
|
||||||
@ -633,90 +330,6 @@ class WalletSettings extends React.Component<any, any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WalletHistory extends React.Component<any, any> {
|
|
||||||
private myHistory: any[];
|
|
||||||
private gotError = false;
|
|
||||||
private unmounted = false;
|
|
||||||
private hidenTypes: string[] = [
|
|
||||||
"order-accepted",
|
|
||||||
"order-redirected",
|
|
||||||
"refreshed",
|
|
||||||
"reserve-balance-updated",
|
|
||||||
"exchange-updated",
|
|
||||||
"exchange-added",
|
|
||||||
];
|
|
||||||
|
|
||||||
componentWillMount(): void {
|
|
||||||
this.update();
|
|
||||||
this.setState({ filter: true });
|
|
||||||
wxApi.onUpdateNotification(() => this.update());
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount(): void {
|
|
||||||
console.log("history component unmounted");
|
|
||||||
this.unmounted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
update(): void {
|
|
||||||
chrome.runtime.sendMessage({ type: "get-history" }, (resp) => {
|
|
||||||
if (this.unmounted) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log("got history response");
|
|
||||||
if (resp.error) {
|
|
||||||
this.gotError = true;
|
|
||||||
console.error("could not retrieve history", resp);
|
|
||||||
this.setState({});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.gotError = false;
|
|
||||||
console.log("got history", resp.history);
|
|
||||||
this.myHistory = resp.history;
|
|
||||||
this.setState({});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): JSX.Element {
|
|
||||||
console.log("rendering history");
|
|
||||||
const history: HistoryEvent[] = this.myHistory;
|
|
||||||
if (this.gotError) {
|
|
||||||
return <span>i18n.str`Error: could not retrieve event history`</span>;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!history) {
|
|
||||||
// We're not ready yet
|
|
||||||
return <span />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const listing: any[] = [];
|
|
||||||
const messages = history.reverse().filter((hEvent) => {
|
|
||||||
if (!this.state.filter) return true;
|
|
||||||
return this.hidenTypes.indexOf(hEvent.type) === -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const record of messages) {
|
|
||||||
const item = <HistoryComponent key={record.eventId} record={record} />;
|
|
||||||
listing.push(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listing.length > 0) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="container">{listing}</div>
|
|
||||||
<div className="option">
|
|
||||||
Filtered list{" "}
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={this.state.filter}
|
|
||||||
onChange={() => this.setState({ filter: !this.state.filter })}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return <p>{i18n.str`Your wallet has no events recorded.`}</p>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload(): void {
|
function reload(): void {
|
||||||
try {
|
try {
|
||||||
@ -884,7 +497,6 @@ function WalletPopup(): JSX.Element {
|
|||||||
<div style={{ margin: "1em" }}>
|
<div style={{ margin: "1em" }}>
|
||||||
<Router>
|
<Router>
|
||||||
<WalletBalanceView route="/balance" default />
|
<WalletBalanceView route="/balance" default />
|
||||||
<WalletHistory route="/history" />
|
|
||||||
<WalletSettings route="/settings" />
|
<WalletSettings route="/settings" />
|
||||||
<WalletDebug route="/debug" />
|
<WalletDebug route="/debug" />
|
||||||
</Router>
|
</Router>
|
||||||
|
@ -117,10 +117,6 @@ async function handleMessage(
|
|||||||
}
|
}
|
||||||
return needsWallet().updateExchangeFromUrl(detail.baseUrl);
|
return needsWallet().updateExchangeFromUrl(detail.baseUrl);
|
||||||
}
|
}
|
||||||
case "get-history": {
|
|
||||||
// TODO: limit history length
|
|
||||||
return needsWallet().getHistory();
|
|
||||||
}
|
|
||||||
case "get-exchanges": {
|
case "get-exchanges": {
|
||||||
return needsWallet().getExchangeRecords();
|
return needsWallet().getExchangeRecords();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user