user 6 years ago
parent
commit
fdc63ce132
4 changed files with 10 additions and 4 deletions
  1. 1 1
      lib/index.d.ts
  2. 6 1
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 2 1
      src/index.ts

+ 1 - 1
lib/index.d.ts

@@ -7,7 +7,7 @@ export declare class BankClient {
     private privateKey;
     private privateKey;
     private bootstrapPromise;
     private bootstrapPromise;
     private bootstrapResult;
     private bootstrapResult;
-    constructor(urlBase: string, storage: Storage, webClient: IWebClient);
+    constructor(urlBase: string, storage?: Storage, webClient?: IWebClient);
     getPub(): Promise<string>;
     getPub(): Promise<string>;
     bootstrap(): any;
     bootstrap(): any;
     getNonce(): Promise<number>;
     getNonce(): Promise<number>;

+ 6 - 1
lib/index.js

@@ -7,13 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
         step((generator = generator.apply(thisArg, _arguments || [])).next());
         step((generator = generator.apply(thisArg, _arguments || [])).next());
     });
     });
 };
 };
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
 Object.defineProperty(exports, "__esModule", { value: true });
 Object.defineProperty(exports, "__esModule", { value: true });
 const crypto = require("libp2p-crypto");
 const crypto = require("libp2p-crypto");
 const util = require("util");
 const util = require("util");
+const storage_1 = require("./storage");
 const TextEncoder = util.TextEncoder;
 const TextEncoder = util.TextEncoder;
 const util_1 = require("./util");
 const util_1 = require("./util");
+const webclient_node_1 = __importDefault(require("./webclient-node"));
 class BankClient {
 class BankClient {
-    constructor(urlBase, storage, webClient) {
+    constructor(urlBase, storage = new storage_1.Storage('bankClient'), webClient = new webclient_node_1.default()) {
         this.urlBase = urlBase;
         this.urlBase = urlBase;
         this.storage = storage;
         this.storage = storage;
         this.webClient = webClient;
         this.webClient = webClient;

File diff suppressed because it is too large
+ 1 - 1
lib/index.js.map


+ 2 - 1
src/index.ts

@@ -6,6 +6,7 @@ import { IWebClient } from './webclient';
 const TextEncoder = util.TextEncoder;
 const TextEncoder = util.TextEncoder;
 
 
 import { encodeHex } from './util';
 import { encodeHex } from './util';
+import WebClientNode from './webclient-node';
 
 
 export class BankClient {
 export class BankClient {
 
 
@@ -13,7 +14,7 @@ export class BankClient {
     private bootstrapPromise: any;
     private bootstrapPromise: any;
     private bootstrapResult: any;
     private bootstrapResult: any;
 
 
-    constructor(private urlBase: string, private storage: Storage, private webClient: IWebClient) {
+    constructor(private urlBase: string, private storage: Storage = new Storage('bankClient'), private webClient: IWebClient = new WebClientNode()) {
 
 
     }
     }