How to use the @colony/purser-core/helpers.getChainDefinition 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
),
      s: hexSequenceNormalizer(
        multipleOfTwoHexValueNormalizer(String(SIGNATURE.S)),
      ),
      v: hexSequenceNormalizer(
        /*
         * @TODO Add `bigNumber` `toHexString` wrapper method
         *
         * Flow confuses bigNumber's `toString` with the String object
         * prototype `toString` method
         */
        /* $FlowFixMe */
        multipleOfTwoHexValueNormalizer(chainId.toString(16)),
      ),
    },
    getChainDefinition(chainId),
  );
  /*
   * Modify the default payload to set the transaction details
   */
  const modifiedPayloadObject: Object = Object.assign(
    {},
    PAYLOAD_SIGNTX,
    {
      /*
       * Path needs to be sent in as an derivation path array
       */
      address_n: fromString(
        derivationPathNormalizer(derivationPath),
        true,
      ).toPathArray(),
      /*
github JoinColony / purser / modules / node_modules / @colony / purser-ledger / staticMethods.js View on Github external
multipleOfTwoHexValueNormalizer(String(SIGNATURE.S)),
          ),
          v: hexSequenceNormalizer(
            /*
             * @TODO Add `bigNumber` `toHexString` wrapper method
             *
             * Flow confuses bigNumber's `toString` with the String object
             * prototype `toString` method
             */
            /* $FlowFixMe */
            multipleOfTwoHexValueNormalizer(chainId.toString(16)),
          ),
        },
        to ? { to: addressNormalizer(to) } : {},
      ),
      getChainDefinition(chainId),
    );
    /*
     * Sign the transaction object via your Ledger Wallet
     *
     * We also warn the user here, since the device will need confirmation, but only in dev mode.
     */
    warning(messages.userSignInteractionWarning);
    const {
      r: rSignatureComponent,
      s: sSignatureComponent,
      v: recoveryParameter,
    } = await ledger.signTransaction(
      derivationPathNormalizer(derivationPath),
      unsignedTransaction.serialize().toString(HEX_HASH_TYPE),
    );
    /*
github JoinColony / purser / modules / node_modules / @colony / purser-metamask / staticMethods.js View on Github external
* RLP encode (to hex string) with ethereumjs-tx, prefix with
       * `0x` and return. Convert to BN all the numbers-as-strings.
       */
      const signedTransaction = new EthereumTx(
        {
          data: signedData,
          gasLimit: new BigNumber(gas),
          gasPrice: new BigNumber(signedGasPrice),
          nonce: new BigNumber(nonce),
          r,
          s,
          to: signedTo,
          v,
          value: new BigNumber(signedValue),
        },
        getChainDefinition(chainId),
      );
      const serializedSignedTransaction = signedTransaction
        .serialize()
        .toString(HEX_HASH_TYPE);
      const normalizedSignedTransaction = hexSequenceNormalizer(
        serializedSignedTransaction,
      );
      return resolve(normalizedSignedTransaction);
    } catch (caughtError) {
      return reject(caughtError);
    }
  };