git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: aa7f348ee71a97e479efcc2d058b302bcf683a0d

Files: aa7f348ee71a97e479efcc2d058b302bcf683a0d / utils.js

438 bytesRaw
1const ethUtils = require('ethereumjs-util')
2const Address = require('./address.js')
3
4var Utils = {}
5
6Utils.isWASMCode = function (code) {
7 return code.slice(0, 4).toString() === new Uint8Array([0, 0x61, 0x73, 0x6d]).toString()
8}
9
10Utils.newAccountAddress = function (sender, data) {
11 return new Address('0x' + ethUtils.sha3(Buffer.concat([ sender.toBuffer(), Buffer.from(data) ])).slice(0, 20).toString('hex'))
12}
13
14module.exports = Utils
15

Built with git-ssb-web