aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/idb-bridge/.prettierrc6
-rw-r--r--packages/idb-bridge/package.json3
-rw-r--r--packages/idb-bridge/src/BridgeIDBTransaction.ts6
-rw-r--r--packages/idb-bridge/src/idbtypes.ts2
-rw-r--r--packages/idb-bridge/src/index.ts9
-rw-r--r--packages/idb-bridge/src/util/FakeEvent.ts6
-rw-r--r--packages/idb-bridge/src/util/FakeEventTarget.ts7
-rw-r--r--packages/taler-integrationtests/package.json4
-rw-r--r--packages/taler-integrationtests/src/faultInjection.ts2
-rw-r--r--packages/taler-integrationtests/src/harness.ts52
-rw-r--r--packages/taler-integrationtests/src/helpers.ts21
-rw-r--r--packages/taler-integrationtests/src/merchantApiTypes.ts98
-rw-r--r--packages/taler-integrationtests/src/scenario-prompt-payment.ts2
-rw-r--r--packages/taler-integrationtests/src/test-payment-fault.ts15
-rw-r--r--packages/taler-integrationtests/src/test-payment-multiple.ts19
-rw-r--r--packages/taler-integrationtests/src/test-payment.ts2
-rw-r--r--packages/taler-integrationtests/src/test-refund-incremental.ts2
-rw-r--r--packages/taler-integrationtests/src/test-refund.ts2
-rw-r--r--packages/taler-integrationtests/src/test-withdrawal-bank-integrated.ts7
-rw-r--r--packages/taler-integrationtests/src/test-withdrawal-manual.ts14
-rw-r--r--packages/taler-wallet-android/package.json3
-rw-r--r--packages/taler-wallet-android/src/index.ts76
-rw-r--r--packages/taler-wallet-cli/package.json3
-rw-r--r--packages/taler-wallet-cli/src/index.ts52
-rw-r--r--packages/taler-wallet-core/package.json2
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts1
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts2
-rw-r--r--packages/taler-wallet-core/src/index.ts39
-rw-r--r--packages/taler-wallet-core/src/operations/refund.ts3
-rw-r--r--packages/taler-wallet-core/src/types/walletTypes.ts9
-rw-r--r--packages/taler-wallet-core/src/util/talerconfig-test.ts2
-rw-r--r--packages/taler-wallet-core/src/util/talerconfig.ts10
-rw-r--r--packages/taler-wallet-core/src/util/timer.ts6
-rw-r--r--packages/taler-wallet-webextension/src/browserHttpLib.ts47
-rw-r--r--packages/taler-wallet-webextension/src/i18n.tsx2
-rw-r--r--packages/taler-wallet-webextension/src/pages/pay.tsx12
-rw-r--r--packages/taler-wallet-webextension/src/pages/popup.tsx25
-rw-r--r--packages/taler-wallet-webextension/src/pages/refund.tsx5
-rw-r--r--packages/taler-wallet-webextension/src/pages/tip.tsx7
-rw-r--r--packages/taler-wallet-webextension/src/pages/welcome.tsx4
-rw-r--r--packages/taler-wallet-webextension/src/renderHtml.tsx14
-rw-r--r--packages/taler-wallet-webextension/src/wxApi.ts18
-rw-r--r--packages/taler-wallet-webextension/src/wxBackend.ts26
43 files changed, 351 insertions, 296 deletions
diff --git a/packages/idb-bridge/.prettierrc b/packages/idb-bridge/.prettierrc
deleted file mode 100644
index 50063da90..000000000
--- a/packages/idb-bridge/.prettierrc
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "trailingComma": "all",
- "tabWidth": 2,
- "semi": true,
- "singleQuote": false
-} \ No newline at end of file
diff --git a/packages/idb-bridge/package.json b/packages/idb-bridge/package.json
index cf9ce409c..379599421 100644
--- a/packages/idb-bridge/package.json
+++ b/packages/idb-bridge/package.json
@@ -12,13 +12,14 @@
"test": "tsc && ava",
"compile": "tsc && rollup -c && api-extractor run",
"clean": "rimraf dist lib tsconfig.tsbuildinfo",
- "pretty": "prettier --config ../../.prettierrc --write src"
+ "pretty": "prettier --write src"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.9.3",
"@rollup/plugin-typescript": "^5.0.2",
"ava": "^3.10.1",
"esm": "^3.2.25",
+ "prettier": "^2.0.5",
"rimraf": "^3.0.2",
"rollup": "^2.23.0",
"typescript": "^3.7.0"
diff --git a/packages/idb-bridge/src/BridgeIDBTransaction.ts b/packages/idb-bridge/src/BridgeIDBTransaction.ts
index d49ae515f..b064d069e 100644
--- a/packages/idb-bridge/src/BridgeIDBTransaction.ts
+++ b/packages/idb-bridge/src/BridgeIDBTransaction.ts
@@ -10,11 +10,7 @@ import {
import fakeDOMStringList from "./util/fakeDOMStringList";
import FakeEvent from "./util/FakeEvent";
import FakeEventTarget from "./util/FakeEventTarget";
-import {
- FakeDOMStringList,
- RequestObj,
- TransactionMode,
-} from "./util/types";
+import { FakeDOMStringList, RequestObj, TransactionMode } from "./util/types";
import queueTask from "./util/queueTask";
import openPromise from "./util/openPromise";
import { DatabaseTransaction, Backend } from "./backend-interface";
diff --git a/packages/idb-bridge/src/idbtypes.ts b/packages/idb-bridge/src/idbtypes.ts
index 4ab2b6f3b..7bd0eaaaa 100644
--- a/packages/idb-bridge/src/idbtypes.ts
+++ b/packages/idb-bridge/src/idbtypes.ts
@@ -866,7 +866,7 @@ export interface IDBTransaction extends EventTarget {
* This IndexedDB API interface indicates that the version of the database has
* changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler
* function.
- *
+ *
* @public
*/
export interface IDBVersionChangeEvent extends Event {
diff --git a/packages/idb-bridge/src/index.ts b/packages/idb-bridge/src/index.ts
index a07803763..4c29be968 100644
--- a/packages/idb-bridge/src/index.ts
+++ b/packages/idb-bridge/src/index.ts
@@ -36,7 +36,14 @@ import {
IndexProperties,
} from "./backend-interface";
import FakeEventTarget, { Listener } from "./util/FakeEventTarget";
-import { DatabaseDump, ObjectStoreDump, IndexDump, IndexRecord, ObjectStoreRecord, MemoryBackendDump } from "./MemoryBackend";
+import {
+ DatabaseDump,
+ ObjectStoreDump,
+ IndexDump,
+ IndexRecord,
+ ObjectStoreRecord,
+ MemoryBackendDump,
+} from "./MemoryBackend";
import { Event } from "./idbtypes";
export {
diff --git a/packages/idb-bridge/src/util/FakeEvent.ts b/packages/idb-bridge/src/util/FakeEvent.ts
index 207607886..1c558d8a0 100644
--- a/packages/idb-bridge/src/util/FakeEvent.ts
+++ b/packages/idb-bridge/src/util/FakeEvent.ts
@@ -67,7 +67,11 @@ export class FakeEvent implements Event {
composedPath(): EventTarget[] {
throw new Error("Method not implemented.");
}
- initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void {
+ initEvent(
+ type: string,
+ bubbles?: boolean | undefined,
+ cancelable?: boolean | undefined,
+ ): void {
throw new Error("Method not implemented.");
}
diff --git a/packages/idb-bridge/src/util/FakeEventTarget.ts b/packages/idb-bridge/src/util/FakeEventTarget.ts
index da5a5466a..77df768f2 100644
--- a/packages/idb-bridge/src/util/FakeEventTarget.ts
+++ b/packages/idb-bridge/src/util/FakeEventTarget.ts
@@ -17,7 +17,12 @@
import { InvalidStateError } from "./errors";
import FakeEvent from "./FakeEvent";
import { EventType } from "./types";
-import { EventTarget, Event, EventListenerOrEventListenerObject, EventListener } from "../idbtypes";
+import {
+ EventTarget,
+ Event,
+ EventListenerOrEventListenerObject,
+ EventListener,
+} from "../idbtypes";
type EventTypeProp =
| "onabort"
diff --git a/packages/taler-integrationtests/package.json b/packages/taler-integrationtests/package.json
index ba2f112ef..215738943 100644
--- a/packages/taler-integrationtests/package.json
+++ b/packages/taler-integrationtests/package.json
@@ -4,12 +4,14 @@
"description": "Integration tests and fault injection for GNU Taler components",
"main": "index.js",
"scripts": {
- "compile": "tsc -b"
+ "compile": "tsc -b",
+ "pretty": "prettier --write src"
},
"author": "Florian Dold <dold@taler.net>",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"esm": "^3.2.25",
+ "prettier": "^2.0.5",
"source-map-support": "^0.5.19",
"ts-node": "^8.10.2",
"typescript": "^3.9.7"
diff --git a/packages/taler-integrationtests/src/faultInjection.ts b/packages/taler-integrationtests/src/faultInjection.ts
index a9c249fd0..26bfeee53 100644
--- a/packages/taler-integrationtests/src/faultInjection.ts
+++ b/packages/taler-integrationtests/src/faultInjection.ts
@@ -144,7 +144,7 @@ export class FaultProxy {
statusCode: proxyResp.statusCode!!,
};
for (const faultSpec of this.currentFaultSpecs) {
- const modResponse = faultSpec.modifyResponse;
+ const modResponse = faultSpec.modifyResponse;
if (modResponse) {
modResponse(faultRespContext);
}
diff --git a/packages/taler-integrationtests/src/harness.ts b/packages/taler-integrationtests/src/harness.ts
index 2507d12f7..80cd1d906 100644
--- a/packages/taler-integrationtests/src/harness.ts
+++ b/packages/taler-integrationtests/src/harness.ts
@@ -32,21 +32,29 @@ import * as http from "http";
import { ChildProcess, spawn } from "child_process";
import {
Configuration,
- walletCoreApi,
- codec,
AmountJson,
Amounts,
+ Codec,
+ makeCodecForObject,
+ codecForString,
+ Duration,
+ CoreApiResponse,
} from "taler-wallet-core";
import { URL } from "url";
import axios from "axios";
-import { talerCrypto, time } from "taler-wallet-core";
import {
codecForMerchantOrderPrivateStatusResponse,
codecForPostOrderResponse,
PostOrderRequest,
PostOrderResponse,
} from "./merchantApiTypes";
-import { EddsaKeyPair } from "taler-wallet-core/lib/crypto/talerCrypto";
+import {
+ EddsaKeyPair,
+ getRandomBytes,
+ encodeCrock,
+ eddsaGetPublic,
+ createEddsaKeyPair,
+} from "taler-wallet-core/lib/crypto/talerCrypto";
const exec = util.promisify(require("child_process").exec);
@@ -540,11 +548,10 @@ export class BankService {
}
async createRandomBankUser(): Promise<BankUser> {
- const username =
- "user-" + talerCrypto.encodeCrock(talerCrypto.getRandomBytes(10));
+ const username = "user-" + encodeCrock(getRandomBytes(10));
const bankUser: BankUser = {
username,
- password: "pw-" + talerCrypto.encodeCrock(talerCrypto.getRandomBytes(10)),
+ password: "pw-" + encodeCrock(getRandomBytes(10)),
accountPaytoUri: `payto://x-taler-bank/localhost/${username}`,
};
await this.createAccount(bankUser.username, bankUser.password);
@@ -617,13 +624,10 @@ export interface WithdrawalOperationInfo {
taler_withdraw_uri: string;
}
-const codecForWithdrawalOperationInfo = (): codec.Codec<
- WithdrawalOperationInfo
-> =>
- codec
- .makeCodecForObject<WithdrawalOperationInfo>()
- .property("withdrawal_id", codec.codecForString)
- .property("taler_withdraw_uri", codec.codecForString)
+const codecForWithdrawalOperationInfo = (): Codec<WithdrawalOperationInfo> =>
+ makeCodecForObject<WithdrawalOperationInfo>()
+ .property("withdrawal_id", codecForString)
+ .property("taler_withdraw_uri", codecForString)
.build("WithdrawalOperationInfo");
export const defaultCoinConfig = [
@@ -666,7 +670,7 @@ export class ExchangeService implements ExchangeServiceInterface {
const eddsaPriv = fs.readFileSync(privFile);
const keyPair: EddsaKeyPair = {
eddsaPriv,
- eddsaPub: talerCrypto.eddsaGetPublic(eddsaPriv),
+ eddsaPub: eddsaGetPublic(eddsaPriv),
};
return new ExchangeService(gc, ec, cfgFilename, keyPair);
}
@@ -728,12 +732,12 @@ export class ExchangeService implements ExchangeServiceInterface {
config.setString("exchangedb-postgres", "config", e.database);
- const exchangeMasterKey = talerCrypto.createEddsaKeyPair();
+ const exchangeMasterKey = createEddsaKeyPair();
config.setString(
"exchange",
"master_public_key",
- talerCrypto.encodeCrock(exchangeMasterKey.eddsaPub),
+ encodeCrock(exchangeMasterKey.eddsaPub),
);
const masterPrivFile = config
@@ -758,7 +762,7 @@ export class ExchangeService implements ExchangeServiceInterface {
}
get masterPub() {
- return talerCrypto.encodeCrock(this.keyPair.eddsaPub);
+ return encodeCrock(this.keyPair.eddsaPub);
}
get port() {
@@ -812,7 +816,7 @@ export class ExchangeService implements ExchangeServiceInterface {
private globalState: GlobalTestState,
private exchangeConfig: ExchangeConfig,
private configFilename: string,
- private keyPair: talerCrypto.EddsaKeyPair,
+ private keyPair: EddsaKeyPair,
) {}
get name() {
@@ -983,7 +987,7 @@ export class MerchantService {
});
return {
talerRefundUri: resp.data.taler_refund_uri,
- }
+ };
}
async createOrder(
@@ -1015,8 +1019,8 @@ export interface MerchantInstanceConfig {
defaultMaxWireFee?: string;
defaultMaxDepositFee?: string;
defaultWireFeeAmortization?: number;
- defaultWireTransferDelay?: time.Duration;
- defaultPayDelay?: time.Duration;
+ defaultWireTransferDelay?: Duration;
+ defaultPayDelay?: Duration;
}
/**
@@ -1106,7 +1110,7 @@ export class WalletCli {
async apiRequest(
request: string,
payload: Record<string, unknown>,
- ): Promise<walletCoreApi.CoreApiResponse> {
+ ): Promise<CoreApiResponse> {
const wdb = this.globalTestState.testDir + "/walletdb.json";
const resp = await sh(
this.globalTestState,
@@ -1116,7 +1120,7 @@ export class WalletCli {
)}`,
);
console.log(resp);
- return JSON.parse(resp) as walletCoreApi.CoreApiResponse;
+ return JSON.parse(resp) as CoreApiResponse;
}
async runUntilDone(): Promise<void> {
diff --git a/packages/taler-integrationtests/src/helpers.ts b/packages/taler-integrationtests/src/helpers.ts
index 41cd39d77..b37b6b96c 100644
--- a/packages/taler-integrationtests/src/helpers.ts
+++ b/packages/taler-integrationtests/src/helpers.ts
@@ -75,7 +75,10 @@ export async function createSimpleTestkudosEnvironment(
database: db.connStr,
});
- const exchangeBankAccount = await bank.createExchangeAccount("MyExchange", "x");
+ const exchangeBankAccount = await bank.createExchangeAccount(
+ "MyExchange",
+ "x",
+ );
exchange.addBankAccount("1", exchangeBankAccount);
bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri);
@@ -123,13 +126,15 @@ export async function createSimpleTestkudosEnvironment(
/**
* Withdraw balance.
*/
-export async function withdrawViaBank(t: GlobalTestState, p: {
- wallet: WalletCli;
- bank: BankService;
- exchange: ExchangeService;
- amount: AmountString;
-}): Promise<void> {
-
+export async function withdrawViaBank(
+ t: GlobalTestState,
+ p: {
+ wallet: WalletCli;
+ bank: BankService;
+ exchange: ExchangeService;
+ amount: AmountString;
+ },
+): Promise<void> {
const { wallet, bank, exchange, amount } = p;
const user = await bank.createRandomBankUser();
diff --git a/packages/taler-integrationtests/src/merchantApiTypes.ts b/packages/taler-integrationtests/src/merchantApiTypes.ts
index fe70c356c..3c0965813 100644
--- a/packages/taler-integrationtests/src/merchantApiTypes.ts
+++ b/packages/taler-integrationtests/src/merchantApiTypes.ts
@@ -22,23 +22,34 @@
*/
/**
- * Imports
+ * Imports.
*/
import {
- codec,
- talerTypes,
- time,
+ ContractTerms,
+ Duration,
+ Codec,
+ makeCodecForObject,
+ codecForString,
+ makeCodecOptional,
+ makeCodecForConstString,
+ codecForBoolean,
+ codecForNumber,
+ codecForContractTerms,
+ codecForAny,
+ makeCodecForUnion,
+ AmountString,
+ Timestamp,
+ CoinPublicKeyString,
} from "taler-wallet-core";
-
export interface PostOrderRequest {
// The order must at least contain the minimal
// order detail, but can override all
- order: Partial<talerTypes.ContractTerms>;
+ order: Partial<ContractTerms>;
// if set, the backend will then set the refund deadline to the current
// time plus the specified delay.
- refund_delay?: time.Duration;
+ refund_delay?: Duration;
// specifies the payment target preferred by the client. Can be used
// to select among the various (active) wire methods supported by the instance.
@@ -60,51 +71,44 @@ export interface PostOrderResponse {
token?: ClaimToken;
}
-export const codecForPostOrderResponse = (): codec.Codec<PostOrderResponse> =>
- codec
- .makeCodecForObject<PostOrderResponse>()
- .property("order_id", codec.codecForString)
- .property("token", codec.makeCodecOptional(codec.codecForString))
+export const codecForPostOrderResponse = (): Codec<PostOrderResponse> =>
+ makeCodecForObject<PostOrderResponse>()
+ .property("order_id", codecForString)
+ .property("token", makeCodecOptional(codecForString))
.build("PostOrderResponse");
-export const codecForCheckPaymentPaidResponse = (): codec.Codec<
+export const codecForCheckPaymentPaidResponse = (): Codec<
CheckPaymentPaidResponse
> =>
- codec
- .makeCodecForObject<CheckPaymentPaidResponse>()
- .property("order_status", codec.makeCodecForConstString("paid"))
- .property("refunded", codec.codecForBoolean)
- .property("wired", codec.codecForBoolean)
- .property("deposit_total", codec.codecForString)
- .property("exchange_ec", codec.codecForNumber)
- .property("exchange_hc", codec.codecForNumber)
- .property("refund_amount", codec.codecForString)
- .property("contract_terms", talerTypes.codecForContractTerms())
+ makeCodecForObject<CheckPaymentPaidResponse>()
+ .property("order_status", makeCodecForConstString("paid"))
+ .property("refunded", codecForBoolean)
+ .property("wired", codecForBoolean)
+ .property("deposit_total", codecForString)
+ .property("exchange_ec", codecForNumber)
+ .property("exchange_hc", codecForNumber)
+ .property("refund_amount", codecForString)
+ .property("contract_terms", codecForContractTerms())
// FIXME: specify
- .property("wire_details", codec.codecForAny)
- .property("wire_reports", codec.codecForAny)
- .property("refund_details", codec.codecForAny)
+ .property("wire_details", codecForAny)
+ .property("wire_reports", codecForAny)
+ .property("refund_details", codecForAny)
.build("CheckPaymentPaidResponse");
-export const codecForCheckPaymentUnpaidResponse = (): codec.Codec<
+export const codecForCheckPaymentUnpaidResponse = (): Codec<
CheckPaymentUnpaidResponse
> =>
- codec
- .makeCodecForObject<CheckPaymentUnpaidResponse>()
- .property("order_status", codec.makeCodecForConstString("unpaid"))
- .property("taler_pay_uri", codec.codecForString)
- .property("order_status_url", codec.codecForString)
- .property(
- "already_paid_order_id",
- codec.makeCodecOptional(codec.codecForString),
- )
+ makeCodecForObject<CheckPaymentUnpaidResponse>()
+ .property("order_status", makeCodecForConstString("unpaid"))
+ .property("taler_pay_uri", codecForString)
+ .property("order_status_url", codecForString)
+ .property("already_paid_order_id", makeCodecOptional(codecForString))
.build("CheckPaymentPaidResponse");
-export const codecForMerchantOrderPrivateStatusResponse = (): codec.Codec<
+export const codecForMerchantOrderPrivateStatusResponse = (): Codec<
MerchantOrderPrivateStatusResponse
> =>
- codec
- .makeCodecForUnion<MerchantOrderPrivateStatusResponse>()
+ makeCodecForUnion<MerchantOrderPrivateStatusResponse>()
.discriminateOn("order_status")
.alternative("paid", codecForCheckPaymentPaidResponse())
.alternative("unpaid", codecForCheckPaymentUnpaidResponse())
@@ -126,7 +130,7 @@ export interface CheckPaymentPaidResponse {
// Total amount the exchange deposited into our bank account
// for this contract, excluding fees.
- deposit_total: talerTypes.AmountString;
+ deposit_total: AmountString;
// Numeric error code indicating errors the exchange
// encountered tracking the wire transfer for this purchase (before
@@ -140,10 +144,10 @@ export interface CheckPaymentPaidResponse {
exchange_hc: number;
// Total amount that was refunded, 0 if refunded is false.
- refund_amount: talerTypes.AmountString;
+ refund_amount: AmountString;
// Contract terms
- contract_terms: talerTypes.ContractTerms;
+ contract_terms: ContractTerms;
// Ihe wire transfer status from the exchange for this order if available, otherwise empty array
wire_details: TransactionWireTransfer[];
@@ -177,10 +181,10 @@ export interface RefundDetails {
reason: string;
// when was the refund approved
- timestamp: time.Timestamp;
+ timestamp: Timestamp;
// Total amount that was refunded (minus a refund fee).
- amount: talerTypes.AmountString;
+ amount: AmountString;
}
export interface TransactionWireTransfer {
@@ -191,11 +195,11 @@ export interface TransactionWireTransfer {
wtid: string;
// execution time of the wire transfer
- execution_time: time.Timestamp;
+ execution_time: Timestamp;
// Total amount that has been wire transfered
// to the merchant
- amount: talerTypes.AmountString;
+ amount: AmountString;
// Was this transfer confirmed by the merchant via the
// POST /transfers API, or is it merely claimed by the exchange?
@@ -216,5 +220,5 @@ export interface TransactionWireReport {
exchange_hc: number;
// Public key of the coin for which we got the exchange error.
- coin_pub: talerTypes.CoinPublicKeyString;
+ coin_pub: CoinPublicKeyString;
}
diff --git a/packages/taler-integrationtests/src/scenario-prompt-payment.ts b/packages/taler-integrationtests/src/scenario-prompt-payment.ts
index 615ed5778..f60c6704d 100644
--- a/packages/taler-integrationtests/src/scenario-prompt-payment.ts
+++ b/packages/taler-integrationtests/src/scenario-prompt-payment.ts
@@ -52,7 +52,7 @@ runTest(async (t: GlobalTestState) => {
orderResp.order_id,
);
- t.assertTrue(orderStatus.order_status === "unpaid")
+ t.assertTrue(orderStatus.order_status === "unpaid");
console.log(orderStatus);
diff --git a/packages/taler-integrationtests/src/test-payment-fault.ts b/packages/taler-integrationtests/src/test-payment-fault.ts
index 0db6770bf..2ee5c7055 100644
--- a/packages/taler-integrationtests/src/test-payment-fault.ts
+++ b/packages/taler-integrationtests/src/test-payment-fault.ts
@@ -31,7 +31,11 @@ import {
WalletCli,
defaultCoinConfig,
} from "./harness";
-import { FaultInjectedExchangeService, FaultInjectionRequestContext, FaultInjectionResponseContext } from "./faultInjection";
+import {
+ FaultInjectedExchangeService,
+ FaultInjectionRequestContext,
+ FaultInjectionResponseContext,
+} from "./faultInjection";
import { CoreApiResponse } from "taler-wallet-core/lib/walletCoreApiHandler";
/**
@@ -56,7 +60,10 @@ runTest(async (t: GlobalTestState) => {
database: db.connStr,
});
- const exchangeBankAccount = await bank.createExchangeAccount("MyExchange", "x");
+ const exchangeBankAccount = await bank.createExchangeAccount(
+ "MyExchange",
+ "x",
+ );
bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri);
@@ -79,7 +86,7 @@ runTest(async (t: GlobalTestState) => {
},
modifyResponse(ctx: FaultInjectionResponseContext) {
console.log("got response", ctx);
- }
+ },
});
const merchant = await MerchantService.create(t, {
@@ -174,7 +181,7 @@ runTest(async (t: GlobalTestState) => {
faultCount++;
ctx.dropResponse = true;
}
- }
+ },
});
// confirmPay won't work, as the exchange is unreachable
diff --git a/packages/taler-integrationtests/src/test-payment-multiple.ts b/packages/taler-integrationtests/src/test-payment-multiple.ts
index 5bbeecbd9..80092a9a3 100644
--- a/packages/taler-integrationtests/src/test-payment-multiple.ts
+++ b/packages/taler-integrationtests/src/test-payment-multiple.ts
@@ -30,10 +30,12 @@ import {
} from "./harness";
import { withdrawViaBank } from "./helpers";
-async function setupTest(t: GlobalTestState): Promise<{
- merchant: MerchantService,
- exchange: ExchangeService,
- bank: BankService,
+async function setupTest(
+ t: GlobalTestState,
+): Promise<{
+ merchant: MerchantService;
+ exchange: ExchangeService;
+ bank: BankService;
}> {
const db = await setupDb(t);
@@ -51,7 +53,10 @@ async function setupTest(t: GlobalTestState): Promise<{
database: db.connStr,
});
- const exchangeBankAccount = await bank.createExchangeAccount("MyExchange", "x");
+ const exchangeBankAccount = await bank.createExchangeAccount(
+ "MyExchange",
+ "x",
+ );
exchange.addOfferedCoins([coin_ct10, coin_u1]);
@@ -96,12 +101,12 @@ async function setupTest(t: GlobalTestState): Promise<{
merchant,
bank,
exchange,
- }
+ };
}
/**
* Run test.
- *
+ *
* This test uses a very sub-optimal denomination structure.
*/
runTest(async (t: GlobalTestState) => {
diff --git a/packages/taler-integrationtests/src/test-payment.ts b/packages/taler-integrationtests/src/test-payment.ts
index cfe65a6f8..3fd879580 100644
--- a/packages/taler-integrationtests/src/test-payment.ts
+++ b/packages/taler-integrationtests/src/test-payment.ts
@@ -52,7 +52,7 @@ runTest(async (t: GlobalTestState) => {
orderResp.order_id,
);
- t.assertTrue(orderStatus.order_status === "unpaid")
+ t.assertTrue(orderStatus.order_status === "unpaid");
// Make wallet pay for the order
diff --git a/packages/taler-integrationtests/src/test-refund-incremental.ts b/packages/taler-integrationtests/src/test-refund-incremental.ts
index 29685dd3e..0667b10d8 100644
--- a/packages/taler-integrationtests/src/test-refund-incremental.ts
+++ b/packages/taler-integrationtests/src/test-refund-incremental.ts
@@ -52,7 +52,7 @@ runTest(async (t: GlobalTestState) => {
orderResp.order_id,
);
- t.assertTrue(orderStatus.order_status === "unpaid")
+ t.assertTrue(orderStatus.order_status === "unpaid");
// Make wallet pay for the order
diff --git a/packages/taler-integrationtests/src/test-refund.ts b/packages/taler-integrationtests/src/test-refund.ts
index c2f152f53..e1fdbfc50 100644
--- a/packages/taler-integrationtests/src/test-refund.ts
+++ b/packages/taler-integrationtests/src/test-refund.ts
@@ -52,7 +52,7 @@ runTest(async (t: GlobalTestState) => {
orderResp.order_id,
);
- t.assertTrue(orderStatus.order_status === "unpaid")
+ t.assertTrue(orderStatus.order_status === "unpaid");
// Make wallet pay for the order
diff --git a/packages/taler-integrationtests/src/test-withdrawal-bank-integrated.ts b/packages/taler-integrationtests/src/test-withdrawal-bank-integrated.ts
index a856560dc..46ccdaaed 100644
--- a/packages/taler-integrationtests/src/test-withdrawal-bank-integrated.ts
+++ b/packages/taler-integrationtests/src/test-withdrawal-bank-integrated.ts
@@ -19,13 +19,12 @@
*/
import { runTest, GlobalTestState } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
-import { walletTypes } from "taler-wallet-core";
+import { codecForBalancesResponse } from "taler-wallet-core";
/**
* Run test for basic, bank-integrated withdrawal.
*/
runTest(async (t: GlobalTestState) => {
-
// Set up test environment
const { wallet, bank, exchange } = await createSimpleTestkudosEnvironment(t);
@@ -61,8 +60,8 @@ runTest(async (t: GlobalTestState) => {
const balApiResp = await wallet.apiRequest("getBalances", {});
t.assertTrue(balApiResp.type === "response");
- const balResp = walletTypes.codecForBalancesResponse().decode(balApiResp.result);
- t.assertAmountEquals("TESTKUDOS:9.72", balResp.balances[0].available)
+ const balResp = codecForBalancesResponse().decode(balApiResp.result);
+ t.assertAmountEquals("TESTKUDOS:9.72", balResp.balances[0].available);
await t.shutdown();
});
diff --git a/packages/taler-integrationtests/src/test-withdrawal-manual.ts b/packages/taler-integrationtests/src/test-withdrawal-manual.ts
index afaf41e63..0d09c3e5c 100644
--- a/packages/taler-integrationtests/src/test-withdrawal-manual.ts
+++ b/packages/taler-integrationtests/src/test-withdrawal-manual.ts
@@ -19,17 +19,21 @@
*/
import { runTest, GlobalTestState } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
-import { walletTypes } from "taler-wallet-core";
import { CoreApiResponse } from "taler-wallet-core/lib/walletCoreApiHandler";
+import { codecForBalancesResponse } from "taler-wallet-core";
/**
* Run test for basic, bank-integrated withdrawal.
*/
runTest(async (t: GlobalTestState) => {
-
// Set up test environment
- const { wallet, bank, exchange, exchangeBankAccount } = await createSimpleTestkudosEnvironment(t);
+ const {
+ wallet,
+ bank,
+ exchange,
+ exchangeBankAccount,
+ } = await createSimpleTestkudosEnvironment(t);
// Create a withdrawal operation
@@ -67,8 +71,8 @@ runTest(async (t: GlobalTestState) => {
const balApiResp = await wallet.apiRequest("getBalances", {});
t.assertTrue(balApiResp.type === "response");
- const balResp = walletTypes.codecForBalancesResponse().decode(balApiResp.result);
- t.assertAmountEquals("TESTKUDOS:9.72", balResp.balances[0].available)
+ const balResp = codecForBalancesResponse().decode(balApiResp.result);
+ t.assertAmountEquals("TESTKUDOS:9.72", balResp.balances[0].available);
await t.shutdown();
});
diff --git a/packages/taler-wallet-android/package.json b/packages/taler-wallet-android/package.json
index 52d45fe3f..7fdafa251 100644
--- a/packages/taler-wallet-android/package.json
+++ b/packages/taler-wallet-android/package.json
@@ -14,7 +14,7 @@
"license": "GPL-3.0",
"scripts": {
"compile": "tsc && rollup -c",
- "pretty": "prettier --config ../../.prettierrc --write src",
+ "pretty": "prettier --write src",
"test": "tsc && ava",
"coverage": "tsc && nyc ava",
"clean": "rimraf lib dist"
@@ -33,6 +33,7 @@
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-replace": "^2.3.3",
"@types/node": "^14.0.27",
+ "prettier": "^2.0.5",
"rimraf": "^3.0.2",
"rollup": "^2.23.0",
"rollup-plugin-sourcemaps": "^0.6.2",
diff --git a/packages/taler-wallet-android/src/index.ts b/packages/taler-wallet-android/src/index.ts
index c949a4773..4430848c3 100644
--- a/packages/taler-wallet-android/src/index.ts
+++ b/packages/taler-wallet-android/src/index.ts
@@ -21,42 +21,47 @@ import {
Wallet,
getDefaultNodeWallet,
DefaultNodeWalletArgs,
- versions,
- httpLib,
- nodeThreadWorker,
- promiseUtil,
NodeHttpLib,
- walletCoreApi,
- walletNotifications,
TalerErrorCode,
makeErrorDetails,
+ handleWorkerError,
+ handleWorkerMessage,
+ HttpRequestLibrary,
+ OpenedPromise,
+ HttpResponse,
+ HttpRequestOptions,
+ openPromise,
+ Headers,
+ CoreApiEnvelope,
+ CoreApiResponse,
+ CoreApiResponseSuccess,
+ WalletNotification,
+ WALLET_EXCHANGE_PROTOCOL_VERSION,
+ WALLET_MERCHANT_PROTOCOL_VERSION,
+ handleCoreApiRequest,
} from "taler-wallet-core";
import fs from "fs";
-export const handleWorkerError = nodeThreadWorker.handleWorkerError;
-export const handleWorkerMessage = nodeThreadWorker.handleWorkerMessage;
+export { handleWorkerError, handleWorkerMessage };
-export class AndroidHttpLib implements httpLib.HttpRequestLibrary {
+export class AndroidHttpLib implements HttpRequestLibrary {
useNfcTunnel = false;
- private nodeHttpLib: httpLib.HttpRequestLibrary = new NodeHttpLib();
+ private nodeHttpLib: HttpRequestLibrary = new NodeHttpLib();
private requestId = 1;
private requestMap: {
- [id: number]: promiseUtil.OpenedPromise<httpLib.HttpResponse>;
+ [id: number]: OpenedPromise<HttpResponse>;
} = {};
constructor(private sendMessage: (m: string) => void) {}
- get(
- url: string,
- opt?: httpLib.HttpRequestOptions,
- ): Promise<httpLib.HttpResponse> {
+ get(url: string, opt?: HttpRequestOptions): Promise<HttpResponse> {
if (this.useNfcTunnel) {
const myId = this.requestId++;
- const p = promiseUtil.openPromise<httpLib.HttpResponse>();
+ const p = openPromise<HttpResponse>();
this.requestMap[myId] = p;
const request = {
method: "get",
@@ -78,11 +83,11 @@ export class AndroidHttpLib implements httpLib.HttpRequestLibrary {
postJson(
url: string,
body: any,
- opt?: httpLib.HttpRequestOptions,
- ): Promise<httpLib.HttpResponse> {
+ opt?: HttpRequestOptions,
+ ): Promise<HttpResponse> {
if (this.useNfcTunnel) {
const myId = this.requestId++;
- const p = promiseUtil.openPromise<httpLib.HttpResponse>();
+ const p = openPromise<HttpResponse>();
this.requestMap[myId] = p;
const request = {
method: "postJson",
@@ -106,9 +111,9 @@ export class AndroidHttpLib implements httpLib.HttpRequestLibrary {
`no matching request for tunneled HTTP response, id=${myId}`,
);
}
- const headers = new httpLib.Headers();
+ const headers = new Headers();
if (msg.status != 0) {
- const resp: httpLib.HttpResponse = {
+ const resp: HttpResponse = {
// FIXME: pass through this URL
requestUrl: "",
headers,
@@ -125,7 +130,7 @@ export class AndroidHttpLib implements httpLib.HttpRequestLibrary {
}
}
-function sendAkonoMessage(ev: walletCoreApi.CoreApiEnvelope): void {
+function sendAkonoMessage(ev: CoreApiEnvelope): void {
// @ts-ignore
const sendMessage = globalThis.__akono_sendMessage;
if (typeof sendMessage !== "function") {
@@ -142,7 +147,7 @@ function sendAkonoMessage(ev: walletCoreApi.CoreApiEnvelope): void {
class AndroidWalletMessageHandler {
walletArgs: DefaultNodeWalletArgs | undefined;
maybeWallet: Wallet | undefined;
- wp = promiseUtil.openPromise<Wallet>();
+ wp = openPromise<Wallet>();
httpLib = new NodeHttpLib();
/**
@@ -152,10 +157,8 @@ class AndroidWalletMessageHandler {
operation: string,
id: string,
args: any,
- ): Promise<walletCoreApi.CoreApiResponse> {
- const wrapResponse = (
- result: unknown,
- ): walletCoreApi.CoreApiResponseSuccess => {
+ ): Promise<CoreApiResponse> {
+ const wrapResponse = (result: unknown): CoreApiResponseSuccess => {
return {
type: "response",
id,
@@ -166,9 +169,7 @@ class AndroidWalletMessageHandler {
switch (operation) {
case "init": {
this.walletArgs = {
- notifyHandler: async (
- notification: walletNotifications.WalletNotification,
- ) => {
+ notifyHandler: async (notification: WalletNotification) => {
sendAkonoMessage({ type: "notification", payload: notification });
},
persistentStoragePath: args.persistentStoragePath,
@@ -182,8 +183,8 @@ class AndroidWalletMessageHandler {
this.wp.resolve(w);
return wrapResponse({
supported_protocol_versions: {
- exchange: versions.WALLET_EXCHANGE_PROTOCOL_VERSION,
- merchant: versions.WALLET_MERCHANT_PROTOCOL_VERSION,
+ exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
+ merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
},
});
}
@@ -216,7 +217,7 @@ class AndroidWalletMessageHandler {
}
const wallet = await this.wp.promise;
wallet.stop();
- this.wp = promiseUtil.openPromise<Wallet>();
+ this.wp = openPromise<Wallet>();
this.maybeWallet = undefined;
const w = await getDefaultNodeWallet(this.walletArgs);
this.maybeWallet = w;
@@ -228,12 +229,7 @@ class AndroidWalletMessageHandler {
}
default: {
const wallet = await this.wp.promise;
- return await walletCoreApi.handleCoreApiRequest(
- wallet,
- operation,
- id,
- args,
- );
+ return await handleCoreApiRequest(wallet, operation, id, args);
}
}
}
@@ -264,7 +260,7 @@ export function installAndroidWalletListener(): void {
);
sendAkonoMessage(respMsg);
} catch (e) {
- const respMsg: walletCoreApi.CoreApiResponse = {
+ const respMsg: CoreApiResponse = {
type: "error",
id,
operation,
diff --git a/packages/taler-wallet-cli/package.json b/packages/taler-wallet-cli/package.json
index efe38f7c1..1870aa296 100644
--- a/packages/taler-wallet-cli/package.json
+++ b/packages/taler-wallet-cli/package.json
@@ -18,7 +18,7 @@
"scripts": {
"compile": "tsc && rollup -c",
"clean": "rimraf lib dist",
- "pretty": "prettier --config ../../.prettierrc --write src"
+ "pretty": "prettier --write src"
},
"files": [
"AUTHORS",
@@ -34,6 +34,7 @@
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-replace": "^2.3.3",
"@types/node": "^14.0.27",
+ "prettier": "^2.0.5",
"rimraf": "^3.0.2",
"rollup": "^2.23.0",
"rollup-plugin-sourcemaps": "^0.6.2",
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 77b7da1d5..16897b7aa 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -23,15 +23,17 @@ import {
Wallet,
OperationFailedAndReportedError,
OperationFailedError,
- time,
- taleruri,
- walletTypes,
- talerCrypto,
- payto,
- codec,
- testvectors,
- walletCoreApi,
NodeHttpLib,
+ PreparePayResultType,
+ setDangerousTimetravel,
+ handleCoreApiRequest,
+ classifyTalerUri,
+ TalerUriType,
+ decodeCrock,
+ addPaytoQueryParams,
+ makeCodecForList,
+ codecForString,
+ printTestVectors,
} from "taler-wallet-core";
import * as clk from "./clk";
import { NodeThreadCryptoWorkerFactory } from "taler-wallet-core/lib/crypto/workers/nodeThreadWorker";
@@ -39,7 +41,7 @@ import { CryptoApi } from "taler-wallet-core/lib/crypto/workers/cryptoApi";
// This module also serves as the entry point for the crypto
// thread worker, and thus must expose these two handlers.
-export { handleWorkerError, handleWorkerMessage } from "taler-wallet-core";
+export { handleWorkerError, handleWorkerMessage } from "taler-wallet-core";
const logger = new Logger("taler-wallet-cli.ts");
@@ -55,13 +57,13 @@ async function doPay(
options: { alwaysYes: boolean } = { alwaysYes: true },
): Promise<void> {
const result = await wallet.preparePayForUri(payUrl);
- if (result.status === walletTypes.PreparePayResultType.InsufficientBalance) {
+ if (result.status === PreparePayResultType.InsufficientBalance) {
console.log("contract", result.contractTerms);
console.error("insufficient balance");
process.exit(1);
return;
}
- if (result.status === walletTypes.PreparePayResultType.AlreadyConfirmed) {
+ if (result.status === PreparePayResultType.AlreadyConfirmed) {
if (result.paid) {
console.log("already paid!");
} else {
@@ -127,7 +129,7 @@ export const walletCli = clk
onPresentHandler: (x) => {
// Convert microseconds to milliseconds and do timetravel
logger.info(`timetravelling ${x} microseconds`);
- time.setDangerousTimetravel(x / 1000);
+ setDangerousTimetravel(x / 1000);
},
})
.maybeOption("inhibit", ["--inhibit"], clk.STRING, {
@@ -208,7 +210,7 @@ walletCli
console.error("Invalid JSON");
process.exit(1);
}
- const resp = await walletCoreApi.handleCoreApiRequest(
+ const resp = await handleCoreApiRequest(
wallet,
args.api.operation,
"reqid-1",
@@ -277,22 +279,22 @@ walletCli
.action(async (args) => {
await withWallet(args, async (wallet) => {
const uri: string = args.handleUri.uri;
- const uriType = taleruri.classifyTalerUri(uri);
+ const uriType = classifyTalerUri(uri);
switch (uriType) {
- case taleruri.TalerUriType.TalerPay:
+ case TalerUriType.TalerPay:
await doPay(wallet, uri, { alwaysYes: args.handleUri.autoYes });
break;
- case taleruri.TalerUriType.TalerTip:
+ case TalerUriType.TalerTip:
{
const res = await wallet.getTipStatus(uri);
console.log("tip status", res);
await wallet.acceptTip(res.tipId);
}
break;
- case taleruri.TalerUriType.TalerRefund:
+ case TalerUriType.TalerRefund:
await wallet.applyRefund(uri);
break;
- case taleruri.TalerUriType.TalerWithdraw:
+ case TalerUriType.TalerWithdraw:
{
const withdrawInfo = await wallet.getWithdrawalDetailsForUri(uri);
const selectedExchange = withdrawInfo.defaultExchangeBaseUrl;
@@ -419,7 +421,7 @@ advancedCli
})
.action((args) => {
const enc = fs.readFileSync(0, "utf8");
- fs.writeFileSync(1, talerCrypto.decodeCrock(enc.trim()));
+ fs.writeFileSync(1, decodeCrock(enc.trim()));
});
advancedCli
@@ -446,7 +448,7 @@ advancedCli
exchange.baseUrl,
Amounts.parseOrThrow(args.withdrawManually.amount),
);
- const completePaytoUri = payto.addPaytoQueryParams(acct.payto_uri, {
+ const completePaytoUri = addPaytoQueryParams(acct.payto_uri, {
amount: args.withdrawManually.amount,
message: `Taler top-up ${reserve.reservePub}`,
});
@@ -490,17 +492,17 @@ advancedCli
await withWallet(args, async (wallet) => {
const res = await wallet.preparePayForUri(args.payPrepare.url);
switch (res.status) {
- case walletTypes.PreparePayResultType.InsufficientBalance:
+ case PreparePayResultType.InsufficientBalance:
console.log("insufficient balance");
break;
- case walletTypes.PreparePayResultType.AlreadyConfirmed:
+ case PreparePayResultType.AlreadyConfirmed:
if (res.paid) {
console.log("already paid!");
} else {
console.log("payment in progress");
}
break;
- case walletTypes.PreparePayResultType.PaymentPossible:
+ case PreparePayResultType.PaymentPossible:
console.log("payment possible");
break;
default:
@@ -546,7 +548,7 @@ advancedCli
});
});
-const coinPubListCodec = codec.makeCodecForList(codec.codecForString);
+const coinPubListCodec = makeCodecForList(codecForString);
advancedCli
.subcommand("suspendCoins", "suspend-coins", {
@@ -640,7 +642,7 @@ const testCli = walletCli.subcommand("testingArgs", "testing", {
});
testCli.subcommand("vectors", "vectors").action(async (args) => {
- testvectors.printTestVectors();
+ printTestVectors();
});
testCli.subcommand("cryptoworker", "cryptoworker").action(async (args) => {
diff --git a/packages/taler-wallet-core/package.json b/packages/taler-wallet-core/package.json
index 981504e4c..73bb530bc 100644
--- a/packages/taler-wallet-core/package.json
+++ b/packages/taler-wallet-core/package.json
@@ -13,7 +13,7 @@
"license": "GPL-3.0",
"scripts": {
"compile": "tsc && rollup -c",
- "pretty": "prettier --config ../../.prettierrc --write src",
+ "pretty": "prettier --write src",
"test": "tsc && ava",
"coverage": "tsc && nyc ava",
"clean": "rimraf dist lib"
diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
index 20d13a3f2..802a153ff 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
@@ -46,7 +46,6 @@ import {
import * as timer from "../../util/timer";
import { Logger } from "../../util/logging";
-import { walletCoreApi } from "../..";
const logger = new Logger("cryptoApi.ts");
diff --git a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
index d4d858330..48efdbce6 100644
--- a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts
@@ -149,7 +149,7 @@ class NodeThreadCryptoWorker implements CryptoWorker {
const worker_threads = require("worker_threads");
logger.trace("starting node crypto worker");
-
+
this.nodeWorker = new worker_threads.Worker(workerCode, { eval: true });
this.nodeWorker.on("error", (err: Error) => {
console.error("error in node worker:", err);
diff --git a/packages/taler-wallet-core/src/index.ts b/packages/taler-wallet-core/src/index.ts
index 5c4961bd7..954798e46 100644
--- a/packages/taler-wallet-core/src/index.ts
+++ b/packages/taler-wallet-core/src/index.ts
@@ -26,57 +26,52 @@ export {
export { Amounts, AmountJson } from "./util/amounts";
export { Logger } from "./util/logging";
-export * as talerCrypto from "./crypto/talerCrypto";
+export * from "./crypto/talerCrypto";
export {
OperationFailedAndReportedError,
OperationFailedError,
makeErrorDetails,
} from "./operations/errors";
-export * as walletTypes from "./types/walletTypes";
+export * from "./types/walletTypes";
-export * as talerTypes from "./types/talerTypes";
+export * from "./types/talerTypes";
-export * as walletCoreApi from "./walletCoreApiHandler";
+export * from "./walletCoreApiHandler";
-export * as taleruri from "./util/taleruri";
+export * from "./util/taleruri";
-export * as time from "./util/time";
+export * from "./util/time";
-export * as codec from "./util/codec";
+export * from "./util/codec";
export { NodeHttpLib } from "./headless/NodeHttpLib";
-export * as payto from "./util/payto";
+export * from "./util/payto";
-export * as testvectors from "./util/testvectors";
+export * from "./util/testvectors";
-export * as versions from "./operations/versions";
+export * from "./operations/versions";
export type { CryptoWorker } from "./crypto/workers/cryptoWorker";
export type { CryptoWorkerFactory } from "./crypto/workers/cryptoApi";
-export * as httpLib from "./util/http";
+export * from "./util/http";
export { TalerErrorCode } from "./TalerErrorCode";
-export * as queryLib from "./util/query";
+export * from "./util/query";
export { CryptoImplementation } from "./crypto/workers/cryptoImplementation";
-export * as db from "./db";
+export * from "./db";
-export * as promiseUtil from "./util/promiseUtils";
+export * from "./util/promiseUtils";
-export * as i18n from "./i18n";
+export * from "./i18n";
-export * as nodeThreadWorker from "./crypto/workers/nodeThreadWorker";
+export * from "./crypto/workers/nodeThreadWorker";
-export * as walletNotifications from "./types/notifications";
+export * from "./types/notifications";
export { Configuration } from "./util/talerconfig";
-
-export {
- handleWorkerMessage,
- handleWorkerError,
-} from "./crypto/workers/nodeThreadWorker";
diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts
index d7aaf7272..1462600f4 100644
--- a/packages/taler-wallet-core/src/operations/refund.ts
+++ b/packages/taler-wallet-core/src/operations/refund.ts
@@ -413,7 +413,8 @@ export async function applyRefund(
).amount,
).amount;
} else {
- amountRefundGone = Amounts.add(amountRefundGone, refund.refundAmount).amount;
+ amountRefundGone = Amounts.add(amountRefundGone, refund.refundAmount)
+ .amount;
}
});
diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts
index 26d7e8e0c..8faace033 100644
--- a/packages/taler-wallet-core/src/types/walletTypes.ts
+++ b/packages/taler-wallet-core/src/types/walletTypes.ts
@@ -44,7 +44,6 @@ import {
codecForBoolean,
} from "../util/codec";
import { AmountString } from "./talerTypes";
-import { codec } from "..";
import { TransactionError } from "./transactions";
/**
@@ -202,20 +201,18 @@ export const enum ConfirmPayResultType {
* Result for confirmPay
*/
export interface ConfirmPayResultDone {
- type: ConfirmPayResultType.Done,
+ type: ConfirmPayResultType.Done;
nextUrl: string;
}
export interface ConfirmPayResultPending {
- type: ConfirmPayResultType.Pending,
+ type: ConfirmPayResultType.Pending;
lastError: TransactionError;
}
-export type ConfirmPayResult =
- | ConfirmPayResultDone
- | ConfirmPayResultPending
+export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending;
/**
* Information about all sender wire details known to the wallet,
diff --git a/packages/taler-wallet-core/src/util/talerconfig-test.ts b/packages/taler-wallet-core/src/util/talerconfig-test.ts
index 71359fd38..2f920fccf 100644
--- a/packages/taler-wallet-core/src/util/talerconfig-test.ts
+++ b/packages/taler-wallet-core/src/util/talerconfig-test.ts
@@ -29,7 +29,7 @@ test("pathsub", (t) => {
w: "world",
f: "foo",
"1foo": "x",
- "foo_bar": "quux",
+ foo_bar: "quux",
};
t.is(
diff --git a/packages/taler-wallet-core/src/util/talerconfig.ts b/packages/taler-wallet-core/src/util/talerconfig.ts
index e9a67287c..d121601c5 100644
--- a/packages/taler-wallet-core/src/util/talerconfig.ts
+++ b/packages/taler-wallet-core/src/util/talerconfig.ts
@@ -79,7 +79,7 @@ export class ConfigValue<T> {
/**
* Shell-style path substitution.
- *
+ *
* Supported patterns:
* "$x" (look up "x")
* "${x}" (look up "x")
@@ -240,7 +240,9 @@ export class Configuration {
} else if (x === "no") {
return false;
}
- throw Error(`invalid config value for [${secNorm}]/${optNorm}, expected yes/no`);
+ throw Error(
+ `invalid config value for [${secNorm}]/${optNorm}, expected yes/no`,
+ );
};
return new ConfigValue(secNorm, optNorm, val, convert);
}
@@ -253,7 +255,9 @@ export class Configuration {
try {
return Number.parseInt(x, 10);
} catch (e) {
- throw Error(`invalid config value for [${secNorm}]/${optNorm}, expected number`);
+ throw Error(
+ `invalid config value for [${secNorm}]/${optNorm}, expected number`,
+ );
}
};
return new ConfigValue(secNorm, optNorm, val, convert);
diff --git a/packages/taler-wallet-core/src/util/timer.ts b/packages/taler-wallet-core/src/util/timer.ts
index d652fdcda..75fb5c9c0 100644
--- a/packages/taler-wallet-core/src/util/timer.ts
+++ b/packages/taler-wallet-core/src/util/timer.ts
@@ -121,7 +121,7 @@ const nullTimerHandle = {
unref() {
// do nothing
return;
- }
+ },
};
/**
@@ -173,7 +173,7 @@ export class TimerGroup {
},
unref() {
h.unref();
- }
+ },
};
}
@@ -195,7 +195,7 @@ export class TimerGroup {
},
unref() {
h.unref();
- }
+ },
};
}
}
diff --git a/packages/taler-wallet-webextension/src/browserHttpLib.ts b/packages/taler-wallet-webextension/src/browserHttpLib.ts
index 42c0c4f00..c568862d9 100644
--- a/packages/taler-wallet-webextension/src/browserHttpLib.ts
+++ b/packages/taler-wallet-webextension/src/browserHttpLib.ts
@@ -1,5 +1,30 @@
+/*
+ This file is part of GNU Taler
+ (C) 2020 Taler Systems S.A.
-import { httpLib, OperationFailedError, Logger } from "taler-wallet-core";
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Imports.
+ */
+import {
+ OperationFailedError,
+ Logger,
+ HttpRequestLibrary,
+ HttpRequestOptions,
+ HttpResponse,
+ Headers,
+} from "taler-wallet-core";
import { TalerErrorCode } from "taler-wallet-core/lib/TalerErrorCode";
const logger = new Logger("browserHttpLib");
@@ -8,14 +33,14 @@ const logger = new Logger("browserHttpLib");
* An implementation of the [[HttpRequestLibrary]] using the
* browser's XMLHttpRequest.
*/
-export class BrowserHttpLib implements httpLib.HttpRequestLibrary {
+export class BrowserHttpLib implements HttpRequestLibrary {
private req(
method: string,
url: string,
requestBody?: any,
- options?: httpLib.HttpRequestOptions,
- ): Promise<httpLib.HttpResponse> {
- return new Promise<httpLib.HttpResponse>((resolve, reject) => {
+ options?: HttpRequestOptions,
+ ): Promise<HttpResponse> {
+ return new Promise<HttpResponse>((resolve, reject) => {
const myRequest = new XMLHttpRequest();
myRequest.open(method, url);
if (options?.headers) {
@@ -87,7 +112,7 @@ export class BrowserHttpLib implements httpLib.HttpRequestLibrary {
const arr = headers.trim().split(/[\r\n]+/);
// Create a map of header names to values
- const headerMap: httpLib.Headers = new httpLib.Headers();
+ const headerMap: Headers = new Headers();
arr.forEach(function (line) {
const parts = line.split(": ");
const headerName = parts.shift();
@@ -98,7 +123,7 @@ export class BrowserHttpLib implements httpLib.HttpRequestLibrary {
const value = parts.join(": ");
headerMap.set(headerName, value);
});
- const resp: httpLib.HttpResponse = {
+ const resp: HttpResponse = {
requestUrl: url,
status: myRequest.status,
headers: headerMap,
@@ -112,19 +137,19 @@ export class BrowserHttpLib implements httpLib.HttpRequestLibrary {
});
}
- get(url: string, opt?: httpLib.HttpRequestOptions): Promise<httpLib.HttpResponse> {
+ get(url: string, opt?: HttpRequestOptions): Promise<HttpResponse> {
return this.req("GET", url, undefined, opt);
}
postJson(
url: string,
body: unknown,
- opt?: httpLib.HttpRequestOptions,
- ): Promise<httpLib.HttpResponse> {
+ opt?: HttpRequestOptions,
+ ): Promise<HttpResponse> {
return this.req("POST", url, JSON.stringify(body), opt);
}
stop(): void {
// Nothing to do
}
-} \ No newline at end of file
+}
diff --git a/packages/taler-wallet-webextension/src/i18n.tsx b/packages/taler-wallet-webextension/src/i18n.tsx
index afbb0e278..bd74316f6 100644
--- a/packages/taler-wallet-webextension/src/i18n.tsx
+++ b/packages/taler-wallet-webextension/src/i18n.tsx
@@ -23,7 +23,7 @@
*/
import React from "react";
-import { i18n as i18nCore } from "taler-wallet-core";
+import * as i18nCore from "taler-wallet-core";
/**
* Convert template strings to a msgid
*/
diff --git a/packages/taler-wallet-webextension/src/pages/pay.tsx b/packages/taler-wallet-webextension/src/pages/pay.tsx
index b876a9c58..1e1f91caf 100644
--- a/packages/taler-wallet-webextension/src/pages/pay.tsx
+++ b/packages/taler-wallet-webextension/src/pages/pay.tsx
@@ -30,10 +30,10 @@ import * as wxApi from "../wxApi";
import React, { useState, useEffect } from "react";
-import { Amounts, AmountJson, walletTypes, talerTypes } from "taler-wallet-core";
+import { Amounts, AmountJson, PreparePayResult, PreparePayResultType, ContractTerms, codecForContractTerms, ConfirmPayResultType } from "taler-wallet-core";
function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
- const [payStatus, setPayStatus] = useState<walletTypes.PreparePayResult | undefined>();
+ const [payStatus, setPayStatus] = useState<PreparePayResult | undefined>();
const [payErrMsg, setPayErrMsg] = useState<string | undefined>("");
const [numTries, setNumTries] = useState(0);
const [loading, setLoading] = useState(false);
@@ -60,7 +60,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
amountEffective = Amounts.parseOrThrow(payStatus.amountEffective);
}
- if (payStatus.status === walletTypes.PreparePayResultType.AlreadyConfirmed && numTries === 0) {
+ if (payStatus.status === PreparePayResultType.AlreadyConfirmed && numTries === 0) {
return (
<span>
You have already paid for this article. Click{" "}
@@ -69,10 +69,10 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
);
}
- let contractTerms: talerTypes.ContractTerms;
+ let contractTerms: ContractTerms;
try {
- contractTerms = talerTypes.codecForContractTerms().decode(payStatus.contractTerms);
+ contractTerms = codecForContractTerms().decode(payStatus.contractTerms);
} catch (e) {
// This should never happen, as the wallet is supposed to check the contract terms
// before storing them.
@@ -109,7 +109,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
try {
setLoading(true);
const res = await wxApi.confirmPay(proposalId, undefined);
- if (res.type !== walletTypes.ConfirmPayResultType.Done) {
+ if (res.type !== ConfirmPayResultType.Done) {
throw Error("payment pending");
}
document.location.href = res.nextUrl;
diff --git a/packages/taler-wallet-webextension/src/pages/popup.tsx b/packages/taler-wallet-webextension/src/pages/popup.tsx
index 72c9f4bcb..61edcfe50 100644
--- a/packages/taler-wallet-webextension/src/pages/popup.tsx
+++ b/packages/taler-wallet-webextension/src/pages/popup.tsx
@@ -29,9 +29,10 @@ import * as i18n from "../i18n";
import {
AmountJson,
Amounts,
- time,
- taleruri,
- walletTypes,
+ BalancesResponse,
+ Balance,
+ classifyTalerUri,
+ TalerUriType,
} from "taler-wallet-core";
@@ -174,7 +175,7 @@ function EmptyBalanceView(): JSX.Element {
}
class WalletBalanceView extends React.Component<any, any> {
- private balance?: walletTypes.BalancesResponse;
+ private balance?: BalancesResponse;
private gotError = false;
private canceler: (() => void) | undefined = undefined;
private unmount = false;
@@ -198,7 +199,7 @@ class WalletBalanceView extends React.Component<any, any> {
return;
}
this.updateBalanceRunning = true;
- let balance: walletTypes.BalancesResponse;
+ let balance: BalancesResponse;
try {
balance = await wxApi.getBalance();
} catch (e) {
@@ -221,7 +222,7 @@ class WalletBalanceView extends React.Component<any, any> {
this.setState({});
}
- formatPending(entry: walletTypes.Balance): JSX.Element {
+ formatPending(entry: Balance): JSX.Element {
let incoming: JSX.Element | undefined;
let payment: JSX.Element | undefined;
@@ -393,25 +394,25 @@ function makeExtensionUrlWithParams(
}
function actionForTalerUri(talerUri: string): string | undefined {
- const uriType = taleruri.classifyTalerUri(talerUri);
+ const uriType = classifyTalerUri(talerUri);
switch (uriType) {
- case taleruri.TalerUriType.TalerWithdraw:
+ case TalerUriType.TalerWithdraw:
return makeExtensionUrlWithParams("withdraw.html", {
talerWithdrawUri: talerUri,
});
- case taleruri.TalerUriType.TalerPay:
+ case TalerUriType.TalerPay:
return makeExtensionUrlWithParams("pay.html", {
talerPayUri: talerUri,
});
- case taleruri.TalerUriType.TalerTip:
+ case TalerUriType.TalerTip:
return makeExtensionUrlWithParams("tip.html", {
talerTipUri: talerUri,
});
- case taleruri.TalerUriType.TalerRefund:
+ case TalerUriType.TalerRefund:
return makeExtensionUrlWithParams("refund.html", {
talerRefundUri: talerUri,
});
- case taleruri.TalerUriType.TalerNotifyReserve:
+ case TalerUriType.TalerNotifyReserve:
// FIXME: implement
break;
default:
diff --git a/packages/taler-wallet-webextension/src/pages/refund.tsx b/packages/taler-wallet-webextension/src/pages/refund.tsx
index 7326dfc88..b34b98f63 100644
--- a/packages/taler-wallet-webextension/src/pages/refund.tsx
+++ b/packages/taler-wallet-webextension/src/pages/refund.tsx
@@ -21,15 +21,14 @@
*/
import React, { useEffect, useState } from "react";
-
import * as wxApi from "../wxApi";
import { AmountView } from "../renderHtml";
-import { walletTypes } from "taler-wallet-core";
+import { PurchaseDetails } from "taler-wallet-core";
function RefundStatusView(props: { talerRefundUri: string }): JSX.Element {
const [applied, setApplied] = useState(false);
const [purchaseDetails, setPurchaseDetails] = useState<
- walletTypes.PurchaseDetails | undefined
+ PurchaseDetails | undefined
>(undefined);
const [errMsg, setErrMsg] = useState<string | undefined>(undefined);
diff --git a/packages/taler-wallet-webextension/src/pages/tip.tsx b/packages/taler-wallet-webextension/src/pages/tip.tsx
index 6cf4e1875..1f164ad1b 100644
--- a/packages/taler-wallet-webextension/src/pages/tip.tsx
+++ b/packages/taler-wallet-webextension/src/pages/tip.tsx
@@ -22,16 +22,13 @@
*/
import * as React from "react";
-
import { acceptTip, getTipStatus } from "../wxApi";
-
import { renderAmount, ProgressButton } from "../renderHtml";
-
import { useState, useEffect } from "react";
-import { walletTypes } from "taler-wallet-core";
+import { TipStatus } from "taler-wallet-core";
function TipDisplay(props: { talerTipUri: string }): JSX.Element {
- const [tipStatus, setTipStatus] = useState<walletTypes.TipStatus | undefined>(undefined);
+ const [tipStatus, setTipStatus] = useState<TipStatus | undefined>(undefined);
const [discarded, setDiscarded] = useState(false);
const [loading, setLoading] = useState(false);
const [finished, setFinished] = useState(false);
diff --git a/packages/taler-wallet-webextension/src/pages/welcome.tsx b/packages/taler-wallet-webextension/src/pages/welcome.tsx
index ff5de572c..00d8ae6c7 100644
--- a/packages/taler-wallet-webextension/src/pages/welcome.tsx
+++ b/packages/taler-wallet-webextension/src/pages/welcome.tsx
@@ -26,11 +26,11 @@ import { PageLink } from "../renderHtml";
import * as wxApi from "../wxApi";
import { getPermissionsApi } from "../compat";
import { extendedPermissions } from "../permissions";
-import { walletTypes } from "taler-wallet-core";
+import { WalletDiagnostics } from "taler-wallet-core";
function Diagnostics(): JSX.Element | null {
const [timedOut, setTimedOut] = useState(false);
- const [diagnostics, setDiagnostics] = useState<walletTypes.WalletDiagnostics | undefined>(
+ const [diagnostics, setDiagnostics] = useState<WalletDiagnostics | undefined>(
undefined,
);
diff --git a/packages/taler-wallet-webextension/src/renderHtml.tsx b/packages/taler-wallet-webextension/src/renderHtml.tsx
index 89f6c12e8..fcf64b6d5 100644
--- a/packages/taler-wallet-webextension/src/renderHtml.tsx
+++ b/packages/taler-wallet-webextension/src/renderHtml.tsx
@@ -23,7 +23,7 @@
/**
* Imports.
*/
-import { AmountJson, Amounts, time, walletTypes } from "taler-wallet-core";
+import { AmountJson, Amounts, stringifyTimestamp, ExchangeWithdrawDetails } from "taler-wallet-core";
import * as i18n from "./i18n";
import React from "react";
@@ -127,7 +127,7 @@ export class Collapsible extends React.Component<
function WireFee(props: {
s: string;
- rci: walletTypes.ExchangeWithdrawDetails;
+ rci: ExchangeWithdrawDetails;
}): JSX.Element {
return (
<>
@@ -144,7 +144,7 @@ function WireFee(props: {
<tbody>
{props.rci.wireFees.feesForType[props.s].map((f) => (
<tr key={f.sig}>
- <td>{time.stringifyTimestamp(f.endStamp)}</td>
+ <td>{stringifyTimestamp(f.endStamp)}</td>
<td>{renderAmount(f.wireFee)}</td>
<td>{renderAmount(f.closingFee)}</td>
</tr>
@@ -155,7 +155,7 @@ function WireFee(props: {
}
function AuditorDetailsView(props: {
- rci: walletTypes.ExchangeWithdrawDetails | null;
+ rci: ExchangeWithdrawDetails | null;
}): JSX.Element {
const rci = props.rci;
console.log("rci", rci);
@@ -192,7 +192,7 @@ function AuditorDetailsView(props: {
}
function FeeDetailsView(props: {
- rci: walletTypes.ExchangeWithdrawDetails | null;
+ rci: ExchangeWithdrawDetails | null;
}): JSX.Element {
const rci = props.rci;
if (!rci) {
@@ -222,7 +222,7 @@ function FeeDetailsView(props: {
<p>
{i18n.str`Rounding loss:`} {overhead}
</p>
- <p>{i18n.str`Earliest expiration (for deposit): ${time.stringifyTimestamp(
+ <p>{i18n.str`Earliest expiration (for deposit): ${stringifyTimestamp(
rci.earliestDepositExpiration,
)}`}</p>
<h3>Coin Fees</h3>
@@ -268,7 +268,7 @@ function FeeDetailsView(props: {
* Shows details about a withdraw request.
*/
export function WithdrawDetailView(props: {
- rci: walletTypes.ExchangeWithdrawDetails | null;
+ rci: ExchangeWithdrawDetails | null;
}): JSX.Element {
const rci = props.rci;
return (
diff --git a/packages/taler-wallet-webextension/src/wxApi.ts b/packages/taler-wallet-webextension/src/wxApi.ts
index ee86d90e5..1bcee1285 100644
--- a/packages/taler-wallet-webextension/src/wxApi.ts
+++ b/packages/taler-wallet-webextension/src/wxApi.ts
@@ -21,7 +21,7 @@
/**
* Imports.
*/
-import { AmountJson, walletTypes } from "taler-wallet-core";
+import { AmountJson, ConfirmPayResult, BalancesResponse, PurchaseDetails, TipStatus, BenchmarkResult, PreparePayResult, AcceptWithdrawalResponse, WalletDiagnostics } from "taler-wallet-core";
export interface ExtendedPermissionsResponse {
@@ -101,7 +101,7 @@ export function refresh(coinPub: string): Promise<void> {
export function confirmPay(
proposalId: string,
sessionId: string | undefined,
-): Promise<walletTypes.ConfirmPayResult> {
+): Promise<ConfirmPayResult> {
return callBackend("confirm-pay", { proposalId, sessionId });
}
@@ -122,7 +122,7 @@ export function resetDb(): Promise<void> {
/**
* Get balances for all currencies/exchanges.
*/
-export function getBalance(): Promise<walletTypes.BalancesResponse> {
+export function getBalance(): Promise<BalancesResponse> {
return callBackend("balances", {});
}
@@ -143,14 +143,14 @@ export function returnCoins(args: {
*/
export function getPurchaseDetails(
proposalId: string,
-): Promise<walletTypes.PurchaseDetails> {
+): Promise<PurchaseDetails> {
return callBackend("get-purchase-details", { proposalId });
}
/**
* Get the status of processing a tip.
*/
-export function getTipStatus(talerTipUri: string): Promise<walletTypes.TipStatus> {
+export function getTipStatus(talerTipUri: string): Promise<TipStatus> {
return callBackend("get-tip-status", { talerTipUri });
}
@@ -180,14 +180,14 @@ export function abortFailedPayment(contractTermsHash: string): Promise<void> {
/**
* Abort a failed payment and try to get a refund.
*/
-export function benchmarkCrypto(repetitions: number): Promise<walletTypes.BenchmarkResult> {
+export function benchmarkCrypto(repetitions: number): Promise<BenchmarkResult> {
return callBackend("benchmark-crypto", { repetitions });
}
/**
* Get details about a pay operation.
*/
-export function preparePay(talerPayUri: string): Promise<walletTypes.PreparePayResult> {
+export function preparePay(talerPayUri: string): Promise<PreparePayResult> {
return callBackend("prepare-pay", { talerPayUri });
}
@@ -197,7 +197,7 @@ export function preparePay(talerPayUri: string): Promise<walletTypes.PreparePayR
export function acceptWithdrawal(
talerWithdrawUri: string,
selectedExchange: string,
-): Promise<walletTypes.AcceptWithdrawalResponse> {
+): Promise<AcceptWithdrawalResponse> {
return callBackend("accept-withdrawal", {
talerWithdrawUri,
selectedExchange,
@@ -207,7 +207,7 @@ export function acceptWithdrawal(
/**
* Get diagnostics information
*/
-export function getDiagnostics(): Promise<walletTypes.WalletDiagnostics> {
+export function getDiagnostics(): Promise<WalletDiagnostics> {
return callBackend("get-diagnostics", {});
}
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts b/packages/taler-wallet-webextension/src/wxBackend.ts
index 8575c150a..ce024e096 100644
--- a/packages/taler-wallet-webextension/src/wxBackend.ts
+++ b/packages/taler-wallet-webextension/src/wxBackend.ts
@@ -28,7 +28,7 @@ import * as wxApi from "./wxApi";
import MessageSender = chrome.runtime.MessageSender;
import { extendedPermissions } from "./permissions";
-import { Wallet, promiseUtil, db, walletTypes, taleruri, queryLib } from "taler-wallet-core";
+import { Wallet, OpenedPromise, openPromise, deleteTalerDatabase, WALLET_DB_MINOR_VERSION, WalletDiagnostics, openTalerDatabase, Database, classifyTalerUri, TalerUriType } from "taler-wallet-core";
import { BrowserHttpLib } from "./browserHttpLib";
import { BrowserCryptoWorkerFactory } from "./browserCryptoWorkerFactory";
@@ -47,7 +47,7 @@ let currentDatabase: IDBDatabase | undefined;
*/
let outdatedDbVersion: number | undefined;
-const walletInit: promiseUtil.OpenedPromise<void> = promiseUtil.openPromise<void>();
+const walletInit: OpenedPromise<void> = openPromise<void>();
const notificationPorts: chrome.runtime.Port[] = [];
@@ -78,7 +78,7 @@ async function handleMessage(
return Promise.resolve();
}
case "reset-db": {
- db.deleteTalerDatabase(indexedDB);
+ deleteTalerDatabase(indexedDB);
setBadgeText({ text: "" });
console.log("reset done");
if (!currentWallet) {
@@ -148,7 +148,7 @@ async function handleMessage(
dbResetRequired = true;
}
const resp: wxApi.UpgradeResponse = {
- currentDbVersion: db.WALLET_DB_MINOR_VERSION.toString(),
+ currentDbVersion: WALLET_DB_MINOR_VERSION.toString(),
dbResetRequired,
oldDbVersion: (outdatedDbVersion || "unknown").toString(),
};
@@ -217,7 +217,7 @@ async function handleMessage(
errors.push(`Outdated DB version: ${outdatedDbVersion}`);
dbOutdated = true;
}
- const diagnostics: walletTypes.WalletDiagnostics = {
+ const diagnostics: WalletDiagnostics = {
walletManifestDisplayVersion:
manifestData.version_name || "(undefined)",
walletManifestVersion: manifestData.version,
@@ -368,7 +368,7 @@ async function reinitWallet(): Promise<void> {
currentDatabase = undefined;
setBadgeText({ text: "" });
try {
- currentDatabase = await db.openTalerDatabase(indexedDB, reinitWallet);
+ currentDatabase = await openTalerDatabase(indexedDB, reinitWallet);
} catch (e) {
console.error("could not open database", e);
walletInit.reject(e);
@@ -377,7 +377,7 @@ async function reinitWallet(): Promise<void> {
const http = new BrowserHttpLib();
console.log("setting wallet");
const wallet = new Wallet(
- new queryLib.Database(currentDatabase),
+ new Database(currentDatabase),
http,
new BrowserCryptoWorkerFactory(),
);
@@ -432,9 +432,9 @@ function headerListener(
for (const header of details.responseHeaders || []) {
if (header.name.toLowerCase() === "taler") {
const talerUri = header.value || "";
- const uriType = taleruri.classifyTalerUri(talerUri);
+ const uriType = classifyTalerUri(talerUri);
switch (uriType) {
- case taleruri.TalerUriType.TalerWithdraw:
+ case TalerUriType.TalerWithdraw:
return makeSyncWalletRedirect(
"withdraw.html",
details.tabId,
@@ -443,7 +443,7 @@ function headerListener(
talerWithdrawUri: talerUri,
},
);
- case taleruri.TalerUriType.TalerPay:
+ case TalerUriType.TalerPay:
return makeSyncWalletRedirect(
"pay.html",
details.tabId,
@@ -452,7 +452,7 @@ function headerListener(
talerPayUri: talerUri,
},
);
- case taleruri.TalerUriType.TalerTip:
+ case TalerUriType.TalerTip:
return makeSyncWalletRedirect(
"tip.html",
details.tabId,
@@ -461,7 +461,7 @@ function headerListener(
talerTipUri: talerUri,
},
);
- case taleruri.TalerUriType.TalerRefund:
+ case TalerUriType.TalerRefund:
return makeSyncWalletRedirect(
"refund.html",
details.tabId,
@@ -470,7 +470,7 @@ function headerListener(
talerRefundUri: talerUri,
},
);
- case taleruri.TalerUriType.TalerNotifyReserve:
+ case TalerUriType.TalerNotifyReserve:
Promise.resolve().then(() => {
const w = currentWallet;
if (!w) {