How to use the @ethersproject/transactions.serialize function in @ethersproject/transactions

To help you get started, we’ve selected a few @ethersproject/transactions 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 ethereum-optimism / optimism / packages / data-transport-layer / src / services / l2-ingestion / handlers / transaction.ts View on Github external
s: padHexString(transaction.s, 32),
        },
        value: transaction.value,
        gasLimit: BigNumber.from(transaction.gas).toString(),
        gasPrice: BigNumber.from(transaction.gasPrice).toNumber(), // ?
        nonce: BigNumber.from(transaction.nonce).toNumber(),
        target: transaction.to,
        data: transaction.input,
      }

      transactionEntry = {
        ...transactionEntry,
        gasLimit: `${SEQUENCER_GAS_LIMIT}`, // ?
        target: SEQUENCER_ENTRYPOINT_ADDRESS,
        origin: null,
        data: serialize(
          {
            value: transaction.value,
            gasLimit: transaction.gas,
            gasPrice: transaction.gasPrice,
            nonce: transaction.nonce,
            to: transaction.to,
            data: transaction.input,
            chainId,
          },
          {
            v: BigNumber.from(transaction.v).toNumber(),
            r: padHexString(transaction.r, 32),
            s: padHexString(transaction.s, 32),
          }
        ),
        decoded: decodedTransaction,
github ethers-io / ethers.js / packages / wallet / index.js View on Github external
return properties_1.resolveProperties(transaction).then(function (tx) {
            if (tx.from != null) {
                if (address_1.getAddress(tx.from) !== _this.address) {
                    throw new Error("transaction from address mismatch");
                }
                delete tx.from;
            }
            var signature = _this._signingKey().signDigest(keccak256_1.keccak256(transactions_1.serialize(tx)));
            return transactions_1.serialize(tx, signature);
        });
    };
github ethers-io / ethers.js / packages / wallet / src.ts / index.ts View on Github external
return resolveProperties(transaction).then((tx) => {
            if (tx.from != null) {
                if (getAddress(tx.from) !== this.address) {
                    throw new Error("transaction from address mismatch");
                }
                delete tx.from;
            }

            const signature = this._signingKey().signDigest(keccak256(serialize(tx)));
            return serialize(tx, signature);
        });
    }
github ethers-io / ethers.js / packages / wallet / lib.esm / index.js View on Github external
return resolveProperties(transaction).then((tx) => {
            if (tx.from != null) {
                if (getAddress(tx.from) !== this.address) {
                    throw new Error("transaction from address mismatch");
                }
                delete tx.from;
            }
            const signature = this._signingKey().signDigest(keccak256(serialize(tx)));
            return serialize(tx, signature);
        });
    }
github ethers-io / ethers.js / packages / wallet / src.ts / index.ts View on Github external
return resolveProperties(transaction).then((tx) => {
            if (tx.from != null) {
                if (getAddress(tx.from) !== this.address) {
                    throw new Error("transaction from address mismatch");
                }
                delete tx.from;
            }

            const signature = this._signingKey().signDigest(keccak256(serialize(tx)));
            return serialize(tx, signature);
        });
    }
github ethers-io / ethers.js / packages / wallet / index.js View on Github external
return properties_1.resolveProperties(transaction).then(function (tx) {
            if (tx.from != null) {
                if (address_1.getAddress(tx.from) !== _this.address) {
                    throw new Error("transaction from address mismatch");
                }
                delete tx.from;
            }
            var signature = _this._signingKey().signDigest(keccak256_1.keccak256(transactions_1.serialize(tx)));
            return transactions_1.serialize(tx, signature);
        });
    };
github ethers-io / ethers.js / packages / wallet / lib.esm / index.js View on Github external
return resolveProperties(transaction).then((tx) => {
            if (tx.from != null) {
                if (getAddress(tx.from) !== this.address) {
                    throw new Error("transaction from address mismatch");
                }
                delete tx.from;
            }
            const signature = this._signingKey().signDigest(keccak256(serialize(tx)));
            return serialize(tx, signature);
        });
    }

@ethersproject/transactions

Utilities for decoding and encoding Ethereum transaction for ethers.

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis