商城下单购买,品类接口,钱包依赖
This commit is contained in:
29
wallet/_test.js
Normal file
29
wallet/_test.js
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
Reference in New Issue
Block a user