Add Account class
This commit is contained in:
21
web3.js/src/account.js
Normal file
21
web3.js/src/account.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import nacl from 'tweetnacl';
|
||||
import bs58 from 'bs58';
|
||||
|
||||
export class Account {
|
||||
constructor(secretKey: ?Buffer = null) {
|
||||
if (secretKey) {
|
||||
this._keypair = nacl.sign.keyPair.fromSecretKey(secretKey);
|
||||
} else {
|
||||
this._keypair = nacl.sign.keyPair();
|
||||
}
|
||||
}
|
||||
|
||||
get publicKey(): string {
|
||||
return bs58.encode(this._keypair.publicKey);
|
||||
}
|
||||
|
||||
get secretKey(): string {
|
||||
return this._keypair.secretKey;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
|
||||
export default (a: number, b: number): number => (a + b);
|
@@ -1,13 +0,0 @@
|
||||
|
||||
export default () => (
|
||||
'\n' +
|
||||
' \x1b[42m\x1b[30m \n\x1b[0m' +
|
||||
' \x1b[42m\x1b[30m Thank you for using this boilerplate! \n\x1b[0m' +
|
||||
' \x1b[42m\x1b[30m \n\x1b[0m' +
|
||||
'\n' +
|
||||
' Getting started\n\n' +
|
||||
' 1. Clone the repo from github (https://github.com/eunikitin/modern-package-boilerplate.git)\n' +
|
||||
' 2. Inside the repo directory run npm install && rm -r .git && git init\n' +
|
||||
' 3. Update package.json with your information' +
|
||||
'\n'
|
||||
);
|
@@ -1,5 +1 @@
|
||||
import thankYou from 'examples/modern';
|
||||
|
||||
export const modern = thankYou;
|
||||
|
||||
console.log(thankYou());
|
||||
export {Account} from './account';
|
||||
|
Reference in New Issue
Block a user