import * as AccessList from './AccessList.js';
import * as Address from './Address.js';
import type * as Errors from './Errors.js';
import * as Hash from './Hash.js';
import * as Hex from './Hex.js';
import type { Assign, Compute, PartialBy, UnionPartialBy } from './internal/types.js';
import * as Rlp from './Rlp.js';
import * as Signature from './Signature.js';
import * as TransactionEnvelope from './TxEnvelope.js';
export type TxEnvelopeEip2930<signed extends boolean = boolean, bigintType = bigint, numberType = number, type extends string = Type> = Compute<TransactionEnvelope.Base<type, signed, bigintType, numberType> & {
    /** EIP-2930 Access List. */
    accessList?: AccessList.AccessList | undefined;
    /** Base fee per gas. */
    gasPrice?: bigintType | undefined;
}>;
export type Rpc<signed extends boolean = boolean> = TxEnvelopeEip2930<signed, Hex.Hex, Hex.Hex, '0x1'>;
export type Serialized = `${SerializedType}${string}`;
export declare const serializedType: "0x01";
export type SerializedType = typeof serializedType;
export type Signed = TxEnvelopeEip2930<true>;
export declare const type: "eip2930";
export type Type = typeof type;
/**
 * Asserts a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930} is valid.
 *
 * @example
 * ```ts twoslash
 * import { TxEnvelopeEip2930, Value } from 'ox'
 *
 * TxEnvelopeEip2930.assert({
 *   gasPrice: 2n ** 256n - 1n + 1n,
 *   chainId: 1,
 *   to: '0x0000000000000000000000000000000000000000',
 *   value: Value.fromEther('1')
 * })
 * // @error: GasPriceTooHighError:
 * // @error: The gas price (`gasPrice` = 115792089237316195423570985008687907853269984665640564039457584007913 gwei) cannot be
 * // @error: higher than the maximum allowed value (2^256-1).
 * ```
 *
 * @param envelope - The transaction envelope to assert.
 */
export declare function assert(envelope: PartialBy<TxEnvelopeEip2930, 'type'>): void;
export declare namespace assert {
    type ErrorType = Address.assert.ErrorType | TransactionEnvelope.InvalidChainIdError | TransactionEnvelope.GasPriceTooHighError | Errors.GlobalErrorType;
}
/**
 * Deserializes a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930} from its serialized form.
 *
 * @example
 * ```ts twoslash
 * import { TxEnvelopeEip2930 } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.deserialize(
 *   '0x01ef0182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c0'
 * )
 * // @log: {
 * // @log:   type: 'eip2930',
 * // @log:   nonce: 785n,
 * // @log:   gasPrice: 2000000000n,
 * // @log:   gas: 1000000n,
 * // @log:   to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
 * // @log:   value: 1000000000000000000n,
 * // @log: }
 * ```
 *
 * @param serialized - The serialized transaction.
 * @returns Deserialized Transaction Envelope.
 */
export declare function deserialize(serialized: Serialized): TxEnvelopeEip2930;
export declare namespace deserialize {
    type ErrorType = Errors.GlobalErrorType;
}
/**
 * Converts an arbitrary transaction object into an EIP-2930 Transaction Envelope.
 *
 * @example
 * ```ts twoslash
 * // @noErrors
 * import { TxEnvelopeEip2930, Value } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   accessList: [...],
 *   gasPrice: Value.fromGwei('10'),
 *   to: '0x0000000000000000000000000000000000000000',
 *   value: Value.fromEther('1'),
 * })
 * ```
 *
 * @example
 * ### Attaching Signatures
 *
 * It is possible to attach a `signature` to the transaction envelope.
 *
 * ```ts twoslash
 * import { Secp256k1, TxEnvelopeEip2930, Value } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   gasPrice: Value.fromGwei('10'),
 *   to: '0x0000000000000000000000000000000000000000',
 *   value: Value.fromEther('1')
 * })
 *
 * const signature = Secp256k1.sign({
 *   payload: TxEnvelopeEip2930.getSignPayload(envelope),
 *   privateKey: '0x...'
 * })
 *
 * const envelope_signed = TxEnvelopeEip2930.from(envelope, {
 *   // [!code focus]
 *   signature // [!code focus]
 * }) // [!code focus]
 * // @log: {
 * // @log:   chainId: 1,
 * // @log:   gasPrice: 10000000000n,
 * // @log:   to: '0x0000000000000000000000000000000000000000',
 * // @log:   type: 'eip2930',
 * // @log:   value: 1000000000000000000n,
 * // @log:   r: 125...n,
 * // @log:   s: 642...n,
 * // @log:   yParity: 0,
 * // @log: }
 * ```
 *
 * @example
 * ### From Serialized
 *
 * It is possible to instantiate an EIP-2930 Transaction Envelope from a {@link ox#TxEnvelopeEip2930.Serialized} value.
 *
 * ```ts twoslash
 * import { TxEnvelopeEip2930 } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from(
 *   '0x01f858018203118502540be4008504a817c800809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c08477359400e1a001627c687261b0e7f8638af1112efa8a77e23656f6e7945275b19e9deed80261'
 * )
 * // @log: {
 * // @log:   chainId: 1,
 * // @log:   gasPrice: 10000000000n,
 * // @log:   to: '0x0000000000000000000000000000000000000000',
 * // @log:   type: 'eip2930',
 * // @log:   value: 1000000000000000000n,
 * // @log: }
 * ```
 *
 * @param envelope - The transaction object to convert.
 * @param options - Options.
 * @returns A {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}
 */
export declare function from<const envelope extends UnionPartialBy<TxEnvelopeEip2930, 'type'> | Serialized, const signature extends Signature.Signature | undefined = undefined>(envelope: envelope | UnionPartialBy<TxEnvelopeEip2930, 'type'> | Serialized, options?: from.Options<signature>): from.ReturnType<envelope, signature>;
export declare namespace from {
    type Options<signature extends Signature.Signature | undefined = undefined> = {
        signature?: signature | Signature.Signature | undefined;
    };
    type ReturnType<envelope extends UnionPartialBy<TxEnvelopeEip2930, 'type'> | Hex.Hex = TxEnvelopeEip2930 | Hex.Hex, signature extends Signature.Signature | undefined = undefined> = Compute<envelope extends Hex.Hex ? TxEnvelopeEip2930 : Assign<envelope, (signature extends Signature.Signature ? Readonly<signature> : {}) & {
        readonly type: 'eip2930';
    }>>;
    type ErrorType = deserialize.ErrorType | assert.ErrorType | Errors.GlobalErrorType;
}
/**
 * Returns the payload to sign for a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}.
 *
 * @example
 * The example below demonstrates how to compute the sign payload which can be used
 * with ECDSA signing utilities like {@link ox#Secp256k1.(sign:function)}.
 *
 * ```ts twoslash
 * import { Secp256k1, TxEnvelopeEip2930 } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   nonce: 0n,
 *   gasPrice: 1000000000n,
 *   gas: 21000n,
 *   to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
 *   value: 1000000000000000000n
 * })
 *
 * const payload = TxEnvelopeEip2930.getSignPayload(envelope) // [!code focus]
 * // @log: '0x...'
 *
 * const signature = Secp256k1.sign({
 *   payload,
 *   privateKey: '0x...'
 * })
 * ```
 *
 * @param envelope - The transaction envelope to get the sign payload for.
 * @returns The sign payload.
 */
export declare function getSignPayload(envelope: TxEnvelopeEip2930): getSignPayload.ReturnType;
export declare namespace getSignPayload {
    type ReturnType = Hex.Hex;
    type ErrorType = hash.ErrorType | Errors.GlobalErrorType;
}
/**
 * Hashes a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}. This is the "transaction hash".
 *
 * @example
 * ```ts twoslash
 * import { Secp256k1, TxEnvelopeEip2930 } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   nonce: 0n,
 *   gasPrice: 1000000000n,
 *   gas: 21000n,
 *   to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
 *   value: 1000000000000000000n
 * })
 *
 * const signature = Secp256k1.sign({
 *   payload: TxEnvelopeEip2930.getSignPayload(envelope),
 *   privateKey: '0x...'
 * })
 *
 * const envelope_signed = TxEnvelopeEip2930.from(envelope, {
 *   signature
 * })
 *
 * const hash = TxEnvelopeEip2930.hash(envelope_signed) // [!code focus]
 * ```
 *
 * @param envelope - The EIP-2930 Transaction Envelope to hash.
 * @param options - Options.
 * @returns The hash of the transaction envelope.
 */
export declare function hash<presign extends boolean = false>(envelope: TxEnvelopeEip2930<presign extends true ? false : true>, options?: hash.Options<presign>): hash.ReturnType;
export declare namespace hash {
    type Options<presign extends boolean = false> = {
        /** Whether to hash this transaction for signing. @default false */
        presign?: presign | boolean | undefined;
    };
    type ReturnType = Hex.Hex;
    type ErrorType = Hash.keccak256.ErrorType | serialize.ErrorType | Errors.GlobalErrorType;
}
/**
 * Serializes a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}.
 *
 * @example
 * ```ts twoslash
 * import { TxEnvelopeEip2930, Value } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   gasPrice: Value.fromGwei('10'),
 *   to: '0x0000000000000000000000000000000000000000',
 *   value: Value.fromEther('1')
 * })
 *
 * const serialized = TxEnvelopeEip2930.serialize(envelope) // [!code focus]
 * ```
 *
 * @example
 * ### Attaching Signatures
 *
 * It is possible to attach a `signature` to the serialized Transaction Envelope.
 *
 * ```ts twoslash
 * import { Secp256k1, TxEnvelopeEip2930, Value } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   gasPrice: Value.fromGwei('10'),
 *   to: '0x0000000000000000000000000000000000000000',
 *   value: Value.fromEther('1')
 * })
 *
 * const signature = Secp256k1.sign({
 *   payload: TxEnvelopeEip2930.getSignPayload(envelope),
 *   privateKey: '0x...'
 * })
 *
 * const serialized = TxEnvelopeEip2930.serialize(envelope, {
 *   // [!code focus]
 *   signature // [!code focus]
 * }) // [!code focus]
 *
 * // ... send `serialized` transaction to JSON-RPC `eth_sendRawTransaction`
 * ```
 *
 * @param envelope - The Transaction Envelope to serialize.
 * @param options - Options.
 * @returns The serialized Transaction Envelope.
 */
export declare function serialize(envelope: PartialBy<TxEnvelopeEip2930, 'type'>, options?: serialize.Options): Serialized;
export declare namespace serialize {
    type Options = {
        /** Signature to append to the serialized Transaction Envelope. */
        signature?: Signature.Signature | undefined;
    };
    type ErrorType = assert.ErrorType | Hex.fromNumber.ErrorType | Signature.toTuple.ErrorType | Hex.concat.ErrorType | Rlp.fromHex.ErrorType | Errors.GlobalErrorType;
}
/**
 * Converts an {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930} to an {@link ox#TxEnvelopeEip2930.Rpc}.
 *
 * @example
 * ```ts twoslash
 * import { RpcRequest, TxEnvelopeEip2930, Value } from 'ox'
 *
 * const envelope = TxEnvelopeEip2930.from({
 *   chainId: 1,
 *   nonce: 0n,
 *   gas: 21000n,
 *   maxFeePerGas: Value.fromGwei('20'),
 *   to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
 *   value: Value.fromEther('1')
 * })
 *
 * const envelope_rpc = TxEnvelopeEip2930.toRpc(envelope) // [!code focus]
 *
 * const request = RpcRequest.from({
 *   id: 0,
 *   method: 'eth_sendTransaction',
 *   params: [envelope_rpc]
 * })
 * ```
 *
 * @param envelope - The EIP-2930 transaction envelope to convert.
 * @returns An RPC-formatted EIP-2930 transaction envelope.
 */
export declare function toRpc(envelope: toRpc.Input): Rpc;
export declare namespace toRpc {
    /** Numberish input accepted by {@link ox#TxEnvelopeEip2930.(toRpc:function)}. */
    type Input = Omit<TxEnvelopeEip2930<boolean, Hex.Hex | bigint | number, Hex.Hex | number>, 'type'>;
    type ErrorType = Signature.extract.ErrorType | Errors.GlobalErrorType;
}
/**
 * Validates a {@link ox#TxEnvelopeEip2930.TxEnvelopeEip2930}. Returns `true` if the envelope is valid, `false` otherwise.
 *
 * @example
 * ```ts twoslash
 * import { TxEnvelopeEip2930, Value } from 'ox'
 *
 * const valid = TxEnvelopeEip2930.assert({
 *   gasPrice: 2n ** 256n - 1n + 1n,
 *   chainId: 1,
 *   to: '0x0000000000000000000000000000000000000000',
 *   value: Value.fromEther('1')
 * })
 * // @log: false
 * ```
 *
 * @param envelope - The transaction envelope to validate.
 */
export declare function validate(envelope: PartialBy<TxEnvelopeEip2930, 'type'>): boolean;
export declare namespace validate {
    type ErrorType = Errors.GlobalErrorType;
}
//# sourceMappingURL=TxEnvelopeEip2930.d.ts.map