How to use the @ethersproject/rlp.decode function in @ethersproject/rlp

To help you get started, we’ve selected a few @ethersproject/rlp 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 ethers-io / ethers.js / packages / transactions / lib.esm / index.js View on Github external
export function parse(rawTransaction) {
    const transaction = RLP.decode(rawTransaction);
    if (transaction.length !== 9 && transaction.length !== 6) {
        logger.throwArgumentError("invalid raw transaction", "rawTransactin", rawTransaction);
    }
    const tx = {
        nonce: handleNumber(transaction[0]).toNumber(),
        gasPrice: handleNumber(transaction[1]),
        gasLimit: handleNumber(transaction[2]),
        to: handleAddress(transaction[3]),
        value: handleNumber(transaction[4]),
        data: transaction[5],
        chainId: 0
    };
    // Legacy unsigned transaction
    if (transaction.length === 6) {
        return tx;
    }

@ethersproject/rlp

Recursive-Length Prefix (RLP) coder.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular @ethersproject/rlp functions