aboutsummaryrefslogtreecommitdiff
path: root/src/headless/helpers.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-06 02:52:16 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-06 02:52:16 +0100
commit4159367d8c04b96a05da8a5ded043f8296a83174 (patch)
tree5587538fb13aead06d639a03e96cc09adcd99dd7 /src/headless/helpers.ts
parentd8170c815913b4395febc4ce3402fe45ba0d2e87 (diff)
downloadwallet-core-4159367d8c04b96a05da8a5ded043f8296a83174.tar.xz
pending ops / history / notification tweaks
Diffstat (limited to 'src/headless/helpers.ts')
-rw-r--r--src/headless/helpers.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts
index cfc7e3695..c4c84d44b 100644
--- a/src/headless/helpers.ts
+++ b/src/headless/helpers.ts
@@ -32,7 +32,8 @@ import { Bank } from "./bank";
import fs = require("fs");
import { Logger } from "../util/logging";
import { NodeThreadCryptoWorkerFactory } from "../crypto/workers/nodeThreadWorker";
-import { NotificationType } from "../walletTypes";
+import { NotificationType, WalletNotification } from "../walletTypes";
+import { SynchronousCryptoWorkerFactory } from "../crypto/workers/synchronousWorker";
const logger = new Logger("helpers.ts");
@@ -87,7 +88,7 @@ export interface DefaultNodeWalletArgs {
/**
* Handler for asynchronous notifications from the wallet.
*/
- notifyHandler?: (reason: string) => void;
+ notifyHandler?: (n: WalletNotification) => void;
/**
* If specified, use this as HTTP request library instead
@@ -163,11 +164,15 @@ export async function getDefaultNodeWallet(
const worker = new NodeThreadCryptoWorkerFactory();
- return new Wallet(
+ const w = new Wallet(
myDb,
myHttpLib,
worker,
);
+ if (args.notifyHandler) {
+ w.addNotificationListener(args.notifyHandler);
+ }
+ return w;
}
export async function withdrawTestBalance(