How to use the ethereumjs-abi.rawEncode 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 hyperledger / burrow / js / lib / contracts / function.js View on Github external
var encodeF = function (abi, args, bytecode) {
  if (abi) {
    var abiInputs = types(abi.inputs)
    args = convert.burrowToAbi(abiInputs, args) // If abi is passed, convert values accordingly
  }

  // If bytecode provided then this is a creation call, bytecode goes first
  if (bytecode) {
    var data = bytecode
    if (abi) data += convert.bytesTB(coder.rawEncode(abiInputs, args))
    return data
  } else {
    return functionSig(abi) + convert.bytesTB(coder.rawEncode(abiInputs, args))
  }
}
github PolymathNetwork / polymath-core / test / helpers / encodeCall.js View on Github external
export function encodeProxyCall(parametersType, values) {
    const methodId = abi.methodID("initialize", parametersType).toString("hex");
    const params = abi.rawEncode(parametersType, values).toString("hex");
    return "0x" + methodId + params;
}
github centrehq / centre-tokens / test / TokenTestUtils.js View on Github external
function encodeCall(name, arguments, values) {
    const methodId = abi.methodID(name, arguments).toString('hex');
    const params = abi.rawEncode(arguments, values).toString('hex');
    return '0x' + methodId + params;
}
github unstoppabledomains / browseth / src / abi.ts View on Github external
encode(...params: any[]) {
            return (
              '0x' + signature + Abi.rawEncode(iTypes, params).toString('hex')
            );
          },
          decode(raw: string) {
github AudiusProject / audius-protocol / eth-contracts / migrations / 4_staking.js View on Github external
function encodeCall (name, args, values) {
  const methodId = abi.methodID(name, args).toString('hex')
  const params = abi.rawEncode(args, values).toString('hex')
  return '0x' + methodId + params
}
github AugurProject / augur / packages / augur-utils / src / abi-encode-data.ts View on Github external
export function abiEncodeData(payload, format = "") {
  let abiEncodedData = ethereumjsAbi.rawEncode(payload.signature || [], payload.params);
  if (format === "hex") return "0x" + abiEncodedData.toString("hex");
  return abiEncodedData;
}
github smartcontractkit / chainlink / evm / app / deployer.js View on Github external
function encodeArgs(unencoded, abi) {
    if (unencoded.length === 0) {
      return ''
    }
    const buf = ABI.rawEncode(constructorInputTypes(abi), unencoded)
    return buf.toString('hex')
  }
github gnosis / dx-contracts / src / truffle / get-abi-encoded-params.js View on Github external
function _getAbiEncodedParams (parameterTypes, parameterValues) {
  var encoded = abi.rawEncode(parameterTypes, parameterValues)

  return encoded.toString('hex')
}
github cryptofinlabs / canoe-solidity / index.js View on Github external
function encodeConstructorArgs(inputs) {
  const inputTypes = _.pluck(inputs, 'type')
  const args = _.pluck(inputs, 'data')
  const encoded = abi.rawEncode(inputTypes, args);
  const bytecode = encoded.toString('hex');
  return bytecode;
}
github sirin-labs / crowdsale-smart-contract / scripts / crowdsale_deployer.js View on Github external
function getCtorParams() {
    let parameterTypes = ["uint256", "uint256", "address", "address", "address", "address", "address"];
    let parameterValues = [startTime + "", endTime + "", wallet, walletFounder, walletOEM, walletBounties, walletReserve];
    let ctorParamsEncoded = ABI.rawEncode(parameterTypes, parameterValues);
    return ctorParamsEncoded;
}

ethereumjs-abi

Decoder and encoder for the Ethereum ABI

MIT
Latest version published 5 years ago

Package Health Score

58 / 100
Full package analysis