/// import type { Common } from "@ethereumjs/common"; import { LegacyTransaction } from "./legacy-transaction"; import { EIP2930AccessListTransaction } from "./eip2930-access-list-transaction"; import { Transaction } from "./rpc-transaction"; import { GanacheRawExtraTx, TypedRawTransaction, TypedDatabaseTransaction } from "./raw"; import { TypedTransaction } from "./transaction-types"; import { EIP1559FeeMarketTransaction } from "./eip1559-fee-market-transaction"; export declare enum TransactionType { Legacy = 0, EIP2930AccessList = 1, EIP1559AccessList = 2 } export declare class TransactionFactory { tx: TypedTransaction; constructor(raw: Buffer, common: Common); /** * Validates the txType against active hardforks and EIPs. May * coerce transactions to a transaction type that differs from the specified * txType. For example, if the txType is EIP2930AccessList but the hardfork * is before EIP-2930 is activated, the txType will be coerced to Legacy. * * @param txData * @param txType * @param common * @param extra * @returns */ private static _fromUnsafeUserData; /** * Create a transaction from a `txData` object * * @param txData - The rpc transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) * @param common - Options to pass on to the constructor of the transaction */ static fromRpc(txData: Transaction, common: Common, extra?: GanacheRawExtraTx): EIP2930AccessListTransaction | LegacyTransaction | EIP1559FeeMarketTransaction; /** * Create a transaction from a `txData` object * * @param txData - The raw transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) * @param common - Options to pass on to the constructor of the transaction */ static fromDatabaseTx(txData: TypedDatabaseTransaction, common: Common, extra?: GanacheRawExtraTx): EIP2930AccessListTransaction | LegacyTransaction | EIP1559FeeMarketTransaction; /** * Create a transaction from a `txData` object without the type field in the first position (for type 1 and 2 txs) * * This method should only be used with "safe" data that doesn't need to be validated against the active hardforks or * EIPs. In other words: it should come from a fork, or from the database. * * @tparam txTYpe - The type of txData. Throws if the the type is not supported. * @param txData - The raw transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) * @param common - Options to pass on to the constructor of the transaction * @param extra */ static fromSafeTypeAndTxData(txType: TransactionType, txData: TypedRawTransaction, common: Common, extra?: GanacheRawExtraTx): EIP2930AccessListTransaction | LegacyTransaction | EIP1559FeeMarketTransaction; /** * Create a transaction from a `txData` object * * When transaction types are activated (EIP 2718) the txData will be checked * for a transaction envelope (first byte < 192) before determining the * decoding strategy, otherwise it will be decoded as a Legacy Transaction. If * the transaction contains a transaction envelop, but EIP 2718 is not active * decoding will fail and an exception will be thrown. * * @param txData - The raw hex string transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) * @param common - Options to pass on to the constructor of the transaction */ static fromString(txData: string, common: Common): TypedTransaction; private static typeOf; /** * Pulls the type out of the raw transaction data, which is the first byte of * the raw data, unless the data is a legacy transaction (raw.length === 9), * in which case the type is `0`. * * This does not validate the type, it just returns it. * * @param raw * @returns */ private static typeOfRaw; private static typeOfRPC; } //# sourceMappingURL=transaction-factory.d.ts.map