How to use the ethereumjs-abi.soliditySHA3 function in ethereumjs-abi

To help you get started, we’ve selected a few ethereumjs-abi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OffchainLabs / arbitrum / test / arb / vm-machine.js View on Github external
hash() {
		return '0x' + abi.soliditySHA3(
			['bytes32', 'bytes32', 'bytes32', 'bytes32', 'bytes32'],
			[
				this.instructionStack.hash(),
				this.dataStack.hash(),
				this.callStack.hash(),
				this.registerVal.hash(),
				this.staticVal.hash()
			]).toString('hex');
	}
}
github AdChain / AdChainRegistryDapp / src / services / redditActions.js View on Github external
export async function createComment (id, comment, address) {
  let res
  let userHash = `0x${soliditySHA3(['string'], [address]).toString('hex')}`
  let user = address === 'anonymous' ? address : userHash.substr(2, 7)

  try {
    res = await axios.post(`${utilityApiURL}/create/comment`, {
      id: id,
      comment: comment,
      address: user
    })
    return res
  } catch (error) {
    console.error(error)
  }
}
github OriginTrail / ot-node / modules / Encryption.js View on Github external
static generateHash(dataArgs) {
        const types = [];
        const args = [];

        for (const value of dataArgs) {
            types.push('uint256');
            args.push(new BN(value, 16));
        }
        return Utilities.normalizeHex(abi.soliditySHA3(types, args).toString('hex').padStart(64, '0'));
    }
github unstoppabledomains / browseth / src / common / crypto.ts View on Github external
export function tightlyPackedKeccak256(
  inputTypes: string[],
  ...messages: any[]
) {
  return '0x' + soliditySHA3(inputTypes, messages).toString('hex');
}
github singnet / snet-betav1-dapp / src / components / JobDetails.js View on Github external
composeSHA3Message(types,values) {
      var ethereumjsabi = require('ethereumjs-abi');
      var sha3Message = ethereumjsabi.soliditySHA3(types, values);
      var msg = "0x" + sha3Message.toString("hex");
      return msg;
    }
github wibsonorg / BatchPayments / lib / Batpay.js View on Github external
function hashCollect (instance, delegate, toId, fromPayIndex, toPayIndex, amount, fee, addr) {
  let hash = abi.soliditySHA3(
    ['address', 'uint32', 'uint32', 'uint32', 'uint32', 'uint64', 'uint64', 'address'],
    [instance, delegate, toId, fromPayIndex, toPayIndex, amount, fee, addr]).toString('hex')

  return '0x' + hash
}
github machinomy / machinomy / packages / machinomy / src / ChannelEthContract.ts View on Github external
async paymentDigest (channelId: string, value: BigNumber): Promise {
    const deployed = await this.contract
    const digest = abi.soliditySHA3(['address', 'bytes32', 'uint256'],
      [deployed.address, channelId, value.toString()])
    return '0x' + digest.toString('hex')
  }
github machinomy / machinomy / packages / machinomy / src / ChannelTokenContract.ts View on Github external
async paymentDigest (channelId: string, value: BigNumber, tokenContract: string): Promise {
    const deployed = await this.contract
    const digest = abi.soliditySHA3(['address', 'bytes32', 'uint256', 'address'],
      [deployed.address, channelId, value.toString(), tokenContract])
    return '0x' + digest.toString('hex')
  }

ethereumjs-abi

Decoder and encoder for the Ethereum ABI

MIT
Latest version published 5 years ago

Package Health Score

62 / 100
Full package analysis