首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在角度上使用bip39模块?

如何在角度上使用bip39模块?
EN

Ethereum用户
提问于 2019-06-13 16:28:32
回答 1查看 581关注 0票数 0

我正在尝试创建一个使用Ionic的电子钱包应用程序。我已经尝试导入bip39节点模块直接在角度项目,但它给了我错误。请帮帮忙

代码语言:javascript
复制
import { Injectable } from '@angular/core';
import * as bip39 from 'bip39';

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

错误:

代码语言:javascript
复制
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)
EN

回答 1

Ethereum用户

发布于 2019-08-03 04:14:38

代码语言:javascript
复制
import Bip39 from 'bip39';

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

确认你的密码!

票数 1
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/71812

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档