30 lines
910 B
JavaScript
30 lines
910 B
JavaScript
import {
|
|
Wallet
|
|
} from "./Wallet.js"
|
|
|
|
const code = Wallet.generateMnemonic(this.defaultLanguage)
|
|
this.mnemonicCode = code
|
|
const hdPrivateKey = Wallet.toHDPrivateKey(this.mnemonicCode)
|
|
// const derived = hdPrivateKey.derive("m/44'/61'/0'/0/0");
|
|
// const publicKey = derived.hdPublicKey.publicKey.toBuffer()
|
|
// const ethPublicKey = secp256k1.publicKeyConvert(publicKey, false)
|
|
// .slice(1)
|
|
|
|
// const ethAddr = Address.fromPublicKey(toBuffer(ethPublicKey)).toString();
|
|
|
|
// console.log(toChecksumAddress(ethAddr));
|
|
|
|
// console.log(Address.fromPrivateKey(hdPrivateKey.hdPublicKey.publicKey.toBuffer()));
|
|
|
|
var addr = []
|
|
for (var i in this.coinType) {
|
|
let whk = Wallet.HDPrivateKeyToAddress(hdPrivateKey, i)
|
|
let parmas = {
|
|
name: this.coinType[i],
|
|
address: whk.address,
|
|
private_key: whk.private_key,
|
|
}
|
|
addr.push(parmas)
|
|
}
|
|
this.address = addr
|