Hey everyone, I was beginning to develop a new project when I tried to import a node module into my project. I tried to import wlsjs and use the module in my app, but I received this error in the chrome web console:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'prototype' of undefined
TypeError: Cannot read property 'prototype' of undefined
at inherits (inherits_browser.js:5)
at Object../node_modules/hash-base/index.js (index.js:23)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/md5.js/index.js (index.js:3)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/create-hash/browser.js (browser.js:3)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/@whaleshares/wlsjs/lib/auth/ecc/src/hash.js (hash.js:3)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/@whaleshares/wlsjs/lib/auth/ecc/src/address.js (address.js:9)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/@whaleshares/wlsjs/lib/auth/ecc/index.js (index.js:4)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/@whaleshares/wlsjs/lib/api/index.js (index.js:29)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/@whaleshares/wlsjs/lib/index.js (index.js:3)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
at zone.js:892
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17289)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
I attempted to fix the issue with the developers of wlsjs, but they were unsure as of how to solve the problem. I came across the error when I used this code:
import { Component } from '@angular/core';
import * as wlsjs from "@whaleshares/wlsjs";
@Component({
selector: 'app-tab1',
templateUrl: 'tab1.page.html',
styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
constructor() {}
doRefresh(event) {
console.log('Begin async operation');
wlsjs.api.getAccounts(['tate'], function(err, response){
console.log(err, response);
});
setTimeout(() => {
console.log('Async operation has ended');
event.target.complete();
}, 2000);
}
}
Specifically, this line causes the issue:
wlsjs.api.getAccounts(['tate'], function(err, response){
console.log(err, response);
});
I would greatly appreciate it if I was able to find a solution in order to continue using this amazing framework!
Thanks,
Tate