0

I am trying to create an ethereum wallet app using Ionic. I have tried to import bip39 node module directly in the angular project but it gives me error. Please help

import { Injectable } from '@angular/core';
import * as bip39 from 'bip39';

@Injectable({
  providedIn: 'root'
})
export class EthereumService {
  mnemonic = 'hello world';
  constructor() {
    this.mnemonic = bip39.generateMnemonic();
  }
}

Error:

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/bip39/src/index.js (index.js:3)
    at __webpack_require__ (bootstrap:83)
    at Module../src/app/ethereum.service.ts (signup.page.ts:15)
    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:17290)
    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)
1
import Bip39 from 'bip39';

https://github.com/mottolini/ionic-ethereum/blob/master/src/providers/ethereum/ethereum.ts

Verify you code!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.