aboutsummaryrefslogtreecommitdiff
path: root/lib/wallet
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-09-14 15:55:10 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-09-14 15:55:10 +0200
commitebbdadb4b6bd59e57b0eec8e280c7c5c12453167 (patch)
tree8f9fdbd1cf0e2d1b79884dfe15828f3c98f28da6 /lib/wallet
parentfc6db1824e6974898f177ffb0ffd2eb138a653ce (diff)
downloadwallet-core-ebbdadb4b6bd59e57b0eec8e280c7c5c12453167.tar.xz
sort out libs / fix warnings
Diffstat (limited to 'lib/wallet')
-rw-r--r--lib/wallet/db.ts2
-rw-r--r--lib/wallet/emscriptif.ts7
-rw-r--r--lib/wallet/wallet.ts10
-rw-r--r--lib/wallet/wxMessaging.ts4
4 files changed, 11 insertions, 12 deletions
diff --git a/lib/wallet/db.ts b/lib/wallet/db.ts
index 7fe635b9e..5104f28fb 100644
--- a/lib/wallet/db.ts
+++ b/lib/wallet/db.ts
@@ -93,7 +93,7 @@ export function exportDb(db: IDBDatabase): Promise<any> {
return new Promise((resolve, reject) => {
- let tx = db.transaction(db.objectStoreNames);
+ let tx = db.transaction(Array.from(db.objectStoreNames));
tx.addEventListener("complete", () => {
resolve(dump);
});
diff --git a/lib/wallet/emscriptif.ts b/lib/wallet/emscriptif.ts
index a12128666..34ef4d377 100644
--- a/lib/wallet/emscriptif.ts
+++ b/lib/wallet/emscriptif.ts
@@ -164,7 +164,7 @@ enum RandomQuality {
abstract class ArenaObject {
- private _nativePtr: number | undefined = undefined;
+ protected _nativePtr: number | undefined = undefined;
arena: Arena;
abstract destroy(): void;
@@ -440,7 +440,8 @@ abstract class PackedArenaObject extends ArenaObject {
}
alloc() {
- if (!this.nativePtr) {
+ super.alloc(this.size());
+ if (!this._nativePtr) {
this.nativePtr = emscAlloc.malloc(this.size());
}
}
@@ -775,7 +776,7 @@ export class AbsoluteTimeNbo extends PackedArenaObject {
x.alloc();
let r = /Date\(([0-9]+)\)/;
let m = r.exec(s);
- if (m.length != 2) {
+ if (!m || m.length != 2) {
throw Error();
}
let n = parseInt(m[1]) * 1000000;
diff --git a/lib/wallet/wallet.ts b/lib/wallet/wallet.ts
index 209c7a253..367c9cbcd 100644
--- a/lib/wallet/wallet.ts
+++ b/lib/wallet/wallet.ts
@@ -373,18 +373,16 @@ export class Wallet {
exchange.baseUrl);
return;
}
- let cd = {
- coin: coin,
- denom: exchange.active_denoms.find((e) => e.denom_pub === coin.denomPub)
- };
- if (!cd.denom) {
+ let denom = exchange.active_denoms.find((e) => e.denom_pub === coin.denomPub);
+ if (!denom) {
console.warn("denom not found (database inconsistent)");
return;
}
- if (cd.denom.value.currency !== paymentAmount.currency) {
+ if (denom.value.currency !== paymentAmount.currency) {
console.warn("same pubkey for different currencies");
return;
}
+ let cd = {coin, denom};
let x = m[url];
if (!x) {
m[url] = [cd];
diff --git a/lib/wallet/wxMessaging.ts b/lib/wallet/wxMessaging.ts
index 401fefd56..9c08b20ca 100644
--- a/lib/wallet/wxMessaging.ts
+++ b/lib/wallet/wxMessaging.ts
@@ -64,7 +64,7 @@ function makeHandlers(db: IDBDatabase,
},
["reset"]: function(detail, sender) {
if (db) {
- let tx = db.transaction(db.objectStoreNames, 'readwrite');
+ let tx = db.transaction(Array.from(db.objectStoreNames), 'readwrite');
for (let i = 0; i < db.objectStoreNames.length; i++) {
tx.objectStore(db.objectStoreNames[i]).clear();
}
@@ -313,7 +313,7 @@ export function wxMain() {
console.error("could not open database");
console.error(e);
})
- .then((db) => {
+ .then((db: IDBDatabase) => {
let http = new BrowserHttpLib();
let badge = new ChromeBadge();
let notifier = new ChromeNotifier();