import { InstantRefundRelay } from "@any-sender/contracts"; import { PlainObject } from "./objects"; import { SenderTx } from "./senderTx"; export declare type RelayInterface = InstantRefundRelay["interface"]; export declare enum RelayTransactionType { DIRECT = "direct", CLASSIC = "classic" } export declare enum RelayFeeSchedule { FAST = "fast", SLOW = "slow" } /** * A subset of the properties of a relay transaction that are not related to the relayer */ export interface RelayParams extends PlainObject { /** * Target contract to execute */ readonly to: string; /** * Gas allocated for the transaction */ readonly gasLimit: number; /** * The data to supply when sending the transaction */ readonly data: string; readonly chainId: number; readonly type: RelayTransactionType; readonly schedule?: RelayFeeSchedule; } export declare class UnsignedRelayTransactionWrapper { readonly transaction: RelayParams; constructor(transaction: RelayParams); protected mId: string; /** * Order the properties of the transaction prior to encoding as a tuple */ private orderForEncoding; /** * Fills in the schedule automatically if it is not defined (defaults to FAST). */ get schedule(): RelayFeeSchedule; /** * Id for this transaction, deterministic hash of the relay tx fields. */ get id(): string; static from(transaction: UnsignedRelayTransaction): UnsignedRelayTransactionWrapper; } export declare abstract class RelayTransactionWrapper { readonly transaction: RelayTransaction; constructor(transaction: RelayTransaction); /** * The amount of gas this transaction should be sent to the network with * @param relayOverhead The gas overhead of the execute funtion in Relay.sol */ abstract getSendGas(relayOverhead: number): number; /** * Fills in the schedule automatically if it is not defined (defaults to FAST). */ get schedule(): RelayFeeSchedule; /** * Order the properties of the transaction prior to encoding as a tuple */ abstract toSenderTx(startBlock: number, chainId: number, relayGasOverhead: number): SenderTx; /** * Id for this transaction, deterministic hash of the relay tx fields. */ get id(): string; /** * It is expensive to compute the signer's address (verify signature). We keep a cache * of the signer's address. */ protected mSigner: string; get signer(): string; static from(transaction: RelayTransaction): ClassicTransactionWrapper | DirectTransactionWrapper; } export interface UnsignedDirectTransaction extends RelayParams { type: RelayTransactionType.DIRECT; } export interface DirectTransaction extends UnsignedDirectTransaction { /** * Gas tank owner's signature for this relay transaction */ readonly signature: string; } export declare class DirectTransactionWrapper extends RelayTransactionWrapper { readonly transaction: DirectTransaction; constructor(transaction: DirectTransaction); toSenderTx(startBlock: number, chainId: number, relayGasOverhead: number): SenderTx; getSendGas(relayOverhead: number): number; static isDirectTx(transaction: RelayTransaction): transaction is DirectTransaction; } export interface UnsignedClassicTransaction extends RelayParams { type: RelayTransactionType.CLASSIC; } /** * A complete, signed, relay transaction ready to be sent to any.sender for relaying. */ export interface ClassicTransaction extends UnsignedClassicTransaction { /** * The user's signature for this relay request */ readonly signature: string; } export declare class ClassicTransactionWrapper extends RelayTransactionWrapper { readonly transaction: ClassicTransaction; toSenderTx(startBlock: number, chainId: number, relayGasOverhead: number): SenderTx; constructor(transaction: ClassicTransaction); /** * Encode this appointment as a function call to relay */ encodeForRelay(): string; private getContractOverhead; /** * The amount of gas this transaction should be sent to the network with * @param relayOverhead The gas overhead of the execute funtion in Relay.sol */ getSendGas(relayOverhead: number): number; static isClassicTx(transaction: UnsignedRelayTransaction): transaction is ClassicTransaction; } export declare type UnsignedRelayTransaction = UnsignedClassicTransaction | UnsignedDirectTransaction; export declare type RelayTransaction = ClassicTransaction | DirectTransaction; /** * A RelayTransaction and a corresponding signature. */ export interface RelayTransactionReceipt { readonly relayTransaction: RelayTransaction; readonly receiptSignature: string; readonly id: string; } //# sourceMappingURL=relayTransaction.d.ts.map