eth-crypto
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -1,7 +0,8 @@ | ||
import { generateAddress, toChecksumAddress } from 'ethereumjs-util'; | ||
import { generateAddress, toChecksumAddress, toBuffer } from 'ethereumjs-util'; | ||
import { addTrailing0x } from './util'; | ||
export default function calculateContractAddress(creatorAddress, nonce) { | ||
var addressBuffer = generateAddress(creatorAddress, nonce); | ||
var addressBuffer = generateAddress(toBuffer(addTrailing0x(creatorAddress)), toBuffer(nonce)); | ||
var address = addressBuffer.toString('hex'); | ||
return toChecksumAddress(address); | ||
return toChecksumAddress(addTrailing0x(address)); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { privateToPublic } from 'ethereumjs-util'; | ||
import { privateToPublic, toBuffer } from 'ethereumjs-util'; | ||
import { addTrailing0x } from './util'; | ||
@@ -12,4 +12,4 @@ | ||
privateKey = addTrailing0x(privateKey); | ||
var publicKeyBuffer = privateToPublic(privateKey); | ||
var publicKeyBuffer = privateToPublic(toBuffer(privateKey)); | ||
return publicKeyBuffer.toString('hex'); | ||
} |
import { publicKeyConvert } from 'secp256k1'; | ||
import { pubToAddress, toChecksumAddress } from 'ethereumjs-util'; | ||
import { hexToUnit8Array, uint8ArrayToHex } from './util'; | ||
import { pubToAddress, toChecksumAddress, toBuffer } from 'ethereumjs-util'; | ||
import { hexToUnit8Array, uint8ArrayToHex, addTrailing0x } from './util'; | ||
@@ -37,5 +37,5 @@ export function compress(startsWith04) { | ||
var addressBuffer = pubToAddress(Buffer.from(publicKey, 'hex')); | ||
var checkSumAdress = toChecksumAddress(addressBuffer.toString('hex')); | ||
var addressBuffer = pubToAddress(toBuffer(addTrailing0x(publicKey))); | ||
var checkSumAdress = toChecksumAddress(addTrailing0x(addressBuffer.toString('hex'))); | ||
return checkSumAdress; | ||
} |
@@ -10,6 +10,8 @@ 'use strict'; | ||
var _util = require('./util'); | ||
function calculateContractAddress(creatorAddress, nonce) { | ||
var addressBuffer = (0, _ethereumjsUtil.generateAddress)(creatorAddress, nonce); | ||
var addressBuffer = (0, _ethereumjsUtil.generateAddress)((0, _ethereumjsUtil.toBuffer)((0, _util.addTrailing0x)(creatorAddress)), (0, _ethereumjsUtil.toBuffer)(nonce)); | ||
var address = addressBuffer.toString('hex'); | ||
return (0, _ethereumjsUtil.toChecksumAddress)(address); | ||
return (0, _ethereumjsUtil.toChecksumAddress)((0, _util.addTrailing0x)(address)); | ||
} |
@@ -20,4 +20,4 @@ 'use strict'; | ||
privateKey = (0, _util.addTrailing0x)(privateKey); | ||
var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)(privateKey); | ||
var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)((0, _ethereumjsUtil.toBuffer)(privateKey)); | ||
return publicKeyBuffer.toString('hex'); | ||
} |
@@ -48,5 +48,5 @@ 'use strict'; | ||
var addressBuffer = (0, _ethereumjsUtil.pubToAddress)(Buffer.from(publicKey, 'hex')); | ||
var checkSumAdress = (0, _ethereumjsUtil.toChecksumAddress)(addressBuffer.toString('hex')); | ||
var addressBuffer = (0, _ethereumjsUtil.pubToAddress)((0, _ethereumjsUtil.toBuffer)((0, _util.addTrailing0x)(publicKey))); | ||
var checkSumAdress = (0, _ethereumjsUtil.toChecksumAddress)((0, _util.addTrailing0x)(addressBuffer.toString('hex'))); | ||
return checkSumAdress; | ||
} |
{ | ||
"name": "eth-crypto", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Cryptographic functions for ethereum and how to use them with web3 and solidity", | ||
@@ -80,8 +80,8 @@ "keywords": [ | ||
"disc": "1.3.3", | ||
"eslint": "7.7.0", | ||
"ganache-cli": "6.10.1", | ||
"eslint": "7.9.0", | ||
"ganache-cli": "6.10.2", | ||
"gzip-size-cli": "3.0.0", | ||
"is-node": "1.0.2", | ||
"js-sha3": "0.8.0", | ||
"karma": "5.1.1", | ||
"karma": "5.2.2", | ||
"karma-babel-preprocessor": "8.0.1", | ||
@@ -98,7 +98,7 @@ "karma-browserify": "7.0.0", | ||
"karma-safari-launcher": "1.0.0", | ||
"mocha": "8.1.2", | ||
"mocha": "8.1.3", | ||
"rimraf": "3.0.2", | ||
"solhint": "3.2.0", | ||
"solidity-cli": "1.0.3", | ||
"terser-webpack-plugin": "4.1.0", | ||
"terser-webpack-plugin": "4.2.1", | ||
"ts-node": "9.0.0", | ||
@@ -118,6 +118,6 @@ "typescript": "4.0.2", | ||
"ethereumjs-tx": "2.1.2", | ||
"ethereumjs-util": "6.2.0", | ||
"ethers": "5.0.9", | ||
"ethereumjs-util": "7.0.5", | ||
"ethers": "5.0.13", | ||
"secp256k1": "4.0.2" | ||
} | ||
} |
import { | ||
generateAddress, | ||
toChecksumAddress | ||
toChecksumAddress, | ||
toBuffer | ||
} from 'ethereumjs-util'; | ||
import { | ||
addTrailing0x | ||
} from './util'; | ||
@@ -12,7 +16,7 @@ | ||
const addressBuffer = generateAddress( | ||
creatorAddress, | ||
nonce | ||
toBuffer(addTrailing0x(creatorAddress)), | ||
toBuffer(nonce) | ||
); | ||
const address = addressBuffer.toString('hex'); | ||
return toChecksumAddress(address); | ||
return toChecksumAddress(addTrailing0x(address)); | ||
} |
import { | ||
privateToPublic | ||
privateToPublic, | ||
toBuffer | ||
} from 'ethereumjs-util'; | ||
@@ -16,4 +17,4 @@ import { | ||
privateKey = addTrailing0x(privateKey); | ||
const publicKeyBuffer = privateToPublic(privateKey); | ||
const publicKeyBuffer = privateToPublic(toBuffer(privateKey)); | ||
return publicKeyBuffer.toString('hex'); | ||
} |
@@ -6,7 +6,9 @@ import { | ||
pubToAddress, | ||
toChecksumAddress | ||
toChecksumAddress, | ||
toBuffer | ||
} from 'ethereumjs-util'; | ||
import { | ||
hexToUnit8Array, | ||
uint8ArrayToHex | ||
uint8ArrayToHex, | ||
addTrailing0x | ||
} from './util'; | ||
@@ -53,5 +55,5 @@ | ||
const addressBuffer = pubToAddress(Buffer.from(publicKey, 'hex')); | ||
const checkSumAdress = toChecksumAddress(addressBuffer.toString('hex')); | ||
const addressBuffer = pubToAddress(toBuffer(addTrailing0x(publicKey))); | ||
const checkSumAdress = toChecksumAddress(addTrailing0x(addressBuffer.toString('hex'))); | ||
return checkSumAdress; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70981
1350
+ Added@types/pbkdf2@3.1.2(transitive)
+ Added@types/secp256k1@4.0.6(transitive)
+ Addedbase-x@3.0.10(transitive)
+ Addedblakejs@1.2.1(transitive)
+ Addedbs58@4.0.1(transitive)
+ Addedbs58check@2.1.2(transitive)
+ Addedethereum-cryptography@0.1.3(transitive)
+ Addedethereumjs-util@6.2.17.0.5(transitive)
+ Addedethers@5.0.13(transitive)
+ Addedkeccak@3.0.4(transitive)
+ Addedpbkdf2@3.1.2(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedsetimmediate@1.0.5(transitive)
- Removedethereumjs-util@6.2.0(transitive)
- Removedethers@5.0.9(transitive)
- Removedkeccak@2.1.0(transitive)
- Removedsecp256k1@3.8.0(transitive)
Updatedethereumjs-util@7.0.5
Updatedethers@5.0.13