parent
91ce7f3352
commit
80e1861a4f
@ -1,14 +1,17 @@ |
||||
import ethUtil from 'ethereumjs-util'; |
||||
import { |
||||
generateAddress, |
||||
toChecksumAddress |
||||
} from 'ethereumjs-util'; |
||||
|
||||
|
||||
export default function calculateContractAddress( |
||||
creatorAddress, |
||||
nonce |
||||
) { |
||||
const addressBuffer = ethUtil.generateAddress( |
||||
const addressBuffer = generateAddress( |
||||
creatorAddress, |
||||
nonce |
||||
); |
||||
const address = addressBuffer.toString('hex'); |
||||
return ethUtil.toChecksumAddress(address); |
||||
return toChecksumAddress(address); |
||||
} |
||||
|
@ -1,13 +1,15 @@ |
||||
import publicKeyByPrivateKey from './public-key-by-private-key'; |
||||
|
||||
import Account from 'eth-lib/lib/account'; |
||||
import { |
||||
create as createAccount |
||||
} from 'eth-lib/lib/account'; |
||||
|
||||
/** |
||||
* creates a new object with |
||||
* private-, public-Key and address |
||||
*/ |
||||
export default function createIdentity() { |
||||
const identity = Account.create(); |
||||
const identity = createAccount(); |
||||
identity.publicKey = publicKeyByPrivateKey(identity.privateKey); |
||||
return identity; |
||||
} |
||||
|
Loading…
Reference in new issue