You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
923 B
31 lines
923 B
const { Harmony } = require('@harmony/core');
|
|
|
|
const harmony = new Harmony('https://localhost:9128');
|
|
|
|
async function createAndEncrypt(words, index, password) {
|
|
for (let i = 0; i < index; i++) {
|
|
const newAcc = harmony.wallet.addByMnemonic(words, i);
|
|
await harmony.wallet.encryptAccount(newAcc.address, password);
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
// const mne = harmony.wallet.generateMnemonic();
|
|
const mne =
|
|
'food response winner warfare indicate visual hundred toilet jealous okay relief tornado';
|
|
const password = '1234567890123';
|
|
console.log('---hint: please write these down');
|
|
console.log(`${mne}`);
|
|
|
|
console.log('---hint: we use simple password to encrypt your wallet');
|
|
console.log(`${password}`);
|
|
|
|
await createAndEncrypt(mne, 10, password);
|
|
console.log('---hint:we added 10 accounts for you');
|
|
|
|
console.log(harmony.wallet.accounts);
|
|
|
|
console.log(harmony.wallet.signer);
|
|
}
|
|
|
|
main();
|
|
|