[chore] update README.md

@types
neeboo 6 years ago
parent 9f69631b57
commit 2ab5f5af5c
  1. 39
      README.md
  2. 1
      scripts/bundle.ts

@ -10,3 +10,42 @@ It's a mono-repo library, not yet published to npm.
2. [harmony-crypto](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-crypto)
3. [harmony-network](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-network)
4. [harmony-utils](https://github.com/FireStack-Lab/Harmony-sdk-core/tree/master/packages/harmony-utils)
# Example
** This package is not published to npm **
```js
const { Account, Wallet } = require('@harmony/account');
const { isAddress, isPrivateKey, numberToHex } = require('@harmony/utils');
async function createAndEncrypt() {
const wallet = new Wallet();
const mne = wallet.generateMnemonic();
console.log('---hint: please write these down');
console.log(`${mne}`);
const newAcc = wallet.addByMnemonic(mne);
const password = '123456';
console.log('---hint: we use this dump password to encrypt, lol');
console.log(`${password}`);
await wallet.encryptAccount(newAcc.address, password);
console.log('---hint: Encrypting...');
console.log('---hint: Done!');
console.log('---hint: Your account address is:');
const encrypted = wallet.getAccount(newAcc.address);
console.log(`${encrypted.address}`);
console.log('---hint: here is your keyStore file:');
console.log(`${encrypted.privateKey}`);
}
createAndEncrypt();
```

@ -106,7 +106,6 @@ async function bundles() {
} else {
g[packages] = packages;
}
// g[pkg.scopedName] = pkg.globalName;
return g;
}, {}),
tslib: 'tslib',

Loading…
Cancel
Save