How to use the @colony/purser-core/helpers.transactionObjectValidator function in @colony/purser-core

To help you get started, we’ve selected a few @colony/purser-core 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 JoinColony / purser / modules / node_modules / @colony / purser-trezor / staticMethods.js View on Github external
export const signTransaction = async ({
  derivationPath,
  ...transactionObject
}: Object = {}): Promise => {
  const {
    gasPrice,
    gasLimit,
    chainId,
    nonce,
    to,
    value,
    inputData,
  } = transactionObjectValidator(transactionObject);
  derivationPathValidator(derivationPath);
  /*
   * @TODO Reduce code repetition
   *
   * Between the unsigned EthereumTx signature object values and the values
   * sent to the Trezor server
   */
  const unsignedTransaction = new EthereumTx(
    {
      /*
       * We could really do with some BN.js flow types declarations :(
       */
      gasPrice: hexSequenceNormalizer(
        /*
         * @TODO Add `bigNumber` `toHexString` wrapper method
         *
github JoinColony / purser / modules / node_modules / @colony / purser-metamask / staticMethods.js View on Github external
export const signTransaction = async ({
  from,
  nonce: manualNonce,
  ...transactionObject
}: Object = {}): Promise => {
  const {
    chainId,
    gasPrice,
    gasLimit,
    to,
    value,
    inputData,
  } = transactionObjectValidator(transactionObject);
  addressValidator(from);
  /*
   * Metamask auto-sets the nonce based on the next one available. You can manually
   * override it, but it's best to omit it.
   *
   * So we only validate if there is one, otherwise we just pass undefined
   * to the transaction object.
   *
   * We also notify (in dev mode) the user about not setting the nonce.
   */
  if (manualNonce) {
    safeIntegerValidator(manualNonce);
    warning(messages.dontSetNonce);
  }
  /*
   * We must check for the Metamask injected in-page proxy every time we
github JoinColony / purser / modules / node_modules / @colony / purser-software / staticMethods.js View on Github external
export const signTransaction = async ({
  callback,
  ...transactionObject
}: Object = {}): Promise => {
  const {
    gasPrice,
    gasLimit,
    chainId,
    nonce,
    to,
    value,
    inputData,
  } = transactionObjectValidator(transactionObject);
  try {
    const signedTransaction: string = await callback(
      Object.assign(
        {},
        {
          /*
           * Ethers needs it's own "proprietary" version of bignumber to work.
           */
          gasPrice: bigNumberify(gasPrice.toString()),
          /*
           * Ethers needs it's own "proprietary" version of bignumber to work.
           */
          gasLimit: bigNumberify(gasLimit.toString()),
          chainId,
          nonce,
          /*
github JoinColony / purser / modules / node_modules / @colony / purser-ledger / staticMethods.js View on Github external
export const signTransaction = async ({
  derivationPath,
  ...transactionObject
}: Object = {}): Promise => {
  const {
    gasPrice,
    gasLimit,
    chainId,
    nonce,
    to,
    value,
    inputData,
  } = transactionObjectValidator(transactionObject);
  try {
    const ledger: LedgerInstanceType = await ledgerConnection();
    derivationPathValidator(derivationPath);
    /*
     * Ledger needs the unsigned "raw" transaction hex, which it will sign and
     * return the (R) and (S) signature components alog with the reco(V)ery param.
     *
     *
     * See fundamentals of Elliptic Curve Digital Signature Algorithm (ECDSA) to
     * get an general idea of where the three components come from:
     * https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm
     *
     * Also, see EIP-155 for the 27 and 28 magic numbers expected in the recovery
     * parameter:
     * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
     */