Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
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.
 
 
eth-crypto/dist/lib/calculate-contract-address.js

13 lines
582 B

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.calculateContractAddress = calculateContractAddress;
var _ethereumjsUtil = require("ethereumjs-util");
var _util = require("./util");
function calculateContractAddress(creatorAddress, nonce) {
var addressBuffer = (0, _ethereumjsUtil.generateAddress)((0, _ethereumjsUtil.toBuffer)((0, _util.addLeading0x)(creatorAddress)), (0, _ethereumjsUtil.toBuffer)(nonce));
var address = addressBuffer.toString('hex');
return (0, _ethereumjsUtil.toChecksumAddress)((0, _util.addLeading0x)(address));
}