How to use the @0xcert/ethereum-utils.hexToBytes function in @0xcert/ethereum-utils

To help you get started, we’ve selected a few @0xcert/ethereum-utils 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 0xcert / framework / packages / 0xcert-ethereum-gateway / src / lib / actions-order.ts View on Github external
export function createOrderHash(gateway: Gateway, order: ActionsOrder) {
  let actionsHash = '0x0000000000000000000000000000000000000000000000000000000000000000';
  for (const action of order.actions) {
    actionsHash = keccak256(
      hexToBytes([
        '0x',
        actionsHash.substr(2),
        `0000000${getActionProxy(gateway, action)}`,
        action.ledgerId.substr(2),
        getActionParams(action, order.signers).substr(2),
      ].join('')),
    );
  }

  return keccak256(
    hexToBytes([
      '0x',
      gateway.config.actionsOrderId.substr(2),
      parseAddresses(order.signers),
      actionsHash.substr(2),
      leftPad(toInteger(order.seed), 64, '0', false),
      leftPad(toSeconds(order.expiration), 64, '0', false),
    ].join('')),
  );
}

@0xcert/ethereum-utils

General Ethereum utility module with helper functions for the Ethereum blockchain.

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis