UNPKG

intents-framework

Version:

A reference ERC7683 implementation with TypeScript support

456 lines 21.6 kB
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common"; export type OnchainCrossChainOrderStruct = { fillDeadline: BigNumberish; orderDataType: BytesLike; orderData: BytesLike; }; export type OnchainCrossChainOrderStructOutput = [ fillDeadline: bigint, orderDataType: string, orderData: string ] & { fillDeadline: bigint; orderDataType: string; orderData: string; }; export type GaslessCrossChainOrderStruct = { originSettler: AddressLike; user: AddressLike; nonce: BigNumberish; originChainId: BigNumberish; openDeadline: BigNumberish; fillDeadline: BigNumberish; orderDataType: BytesLike; orderData: BytesLike; }; export type GaslessCrossChainOrderStructOutput = [ originSettler: string, user: string, nonce: bigint, originChainId: bigint, openDeadline: bigint, fillDeadline: bigint, orderDataType: string, orderData: string ] & { originSettler: string; user: string; nonce: bigint; originChainId: bigint; openDeadline: bigint; fillDeadline: bigint; orderDataType: string; orderData: string; }; export type OutputStruct = { token: BytesLike; amount: BigNumberish; recipient: BytesLike; chainId: BigNumberish; }; export type OutputStructOutput = [ token: string, amount: bigint, recipient: string, chainId: bigint ] & { token: string; amount: bigint; recipient: string; chainId: bigint; }; export type FillInstructionStruct = { destinationChainId: BigNumberish; destinationSettler: BytesLike; originData: BytesLike; }; export type FillInstructionStructOutput = [ destinationChainId: bigint, destinationSettler: string, originData: string ] & { destinationChainId: bigint; destinationSettler: string; originData: string; }; export type ResolvedCrossChainOrderStruct = { user: AddressLike; originChainId: BigNumberish; openDeadline: BigNumberish; fillDeadline: BigNumberish; orderId: BytesLike; maxSpent: OutputStruct[]; minReceived: OutputStruct[]; fillInstructions: FillInstructionStruct[]; }; export type ResolvedCrossChainOrderStructOutput = [ user: string, originChainId: bigint, openDeadline: bigint, fillDeadline: bigint, orderId: string, maxSpent: OutputStructOutput[], minReceived: OutputStructOutput[], fillInstructions: FillInstructionStructOutput[] ] & { user: string; originChainId: bigint; openDeadline: bigint; fillDeadline: bigint; orderId: string; maxSpent: OutputStructOutput[]; minReceived: OutputStructOutput[]; fillInstructions: FillInstructionStructOutput[]; }; export interface BasicSwap7683Interface extends Interface { getFunction(nameOrSignature: "FILLED" | "OPENED" | "PERMIT2" | "REFUNDED" | "RESOLVED_CROSS_CHAIN_ORDER_TYPEHASH" | "SETTLED" | "UNKNOWN" | "fill" | "filledOrders" | "invalidateNonces" | "isValidNonce" | "open" | "openFor" | "openOrders" | "orderStatus" | "refund((uint32,bytes32,bytes)[])" | "refund((address,address,uint256,uint256,uint32,uint32,bytes32,bytes)[])" | "resolve" | "resolveFor" | "settle" | "usedNonces" | "witnessHash" | "witnessTypeString"): FunctionFragment; getEvent(nameOrSignatureOrTopic: "Filled" | "NonceInvalidation" | "Open" | "Refund" | "Refunded" | "Settle" | "Settled"): EventFragment; encodeFunctionData(functionFragment: "FILLED", values?: undefined): string; encodeFunctionData(functionFragment: "OPENED", values?: undefined): string; encodeFunctionData(functionFragment: "PERMIT2", values?: undefined): string; encodeFunctionData(functionFragment: "REFUNDED", values?: undefined): string; encodeFunctionData(functionFragment: "RESOLVED_CROSS_CHAIN_ORDER_TYPEHASH", values?: undefined): string; encodeFunctionData(functionFragment: "SETTLED", values?: undefined): string; encodeFunctionData(functionFragment: "UNKNOWN", values?: undefined): string; encodeFunctionData(functionFragment: "fill", values: [BytesLike, BytesLike, BytesLike]): string; encodeFunctionData(functionFragment: "filledOrders", values: [BytesLike]): string; encodeFunctionData(functionFragment: "invalidateNonces", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "isValidNonce", values: [AddressLike, BigNumberish]): string; encodeFunctionData(functionFragment: "open", values: [OnchainCrossChainOrderStruct]): string; encodeFunctionData(functionFragment: "openFor", values: [GaslessCrossChainOrderStruct, BytesLike, BytesLike]): string; encodeFunctionData(functionFragment: "openOrders", values: [BytesLike]): string; encodeFunctionData(functionFragment: "orderStatus", values: [BytesLike]): string; encodeFunctionData(functionFragment: "refund((uint32,bytes32,bytes)[])", values: [OnchainCrossChainOrderStruct[]]): string; encodeFunctionData(functionFragment: "refund((address,address,uint256,uint256,uint32,uint32,bytes32,bytes)[])", values: [GaslessCrossChainOrderStruct[]]): string; encodeFunctionData(functionFragment: "resolve", values: [OnchainCrossChainOrderStruct]): string; encodeFunctionData(functionFragment: "resolveFor", values: [GaslessCrossChainOrderStruct, BytesLike]): string; encodeFunctionData(functionFragment: "settle", values: [BytesLike[]]): string; encodeFunctionData(functionFragment: "usedNonces", values: [AddressLike, BigNumberish]): string; encodeFunctionData(functionFragment: "witnessHash", values: [ResolvedCrossChainOrderStruct]): string; encodeFunctionData(functionFragment: "witnessTypeString", values?: undefined): string; decodeFunctionResult(functionFragment: "FILLED", data: BytesLike): Result; decodeFunctionResult(functionFragment: "OPENED", data: BytesLike): Result; decodeFunctionResult(functionFragment: "PERMIT2", data: BytesLike): Result; decodeFunctionResult(functionFragment: "REFUNDED", data: BytesLike): Result; decodeFunctionResult(functionFragment: "RESOLVED_CROSS_CHAIN_ORDER_TYPEHASH", data: BytesLike): Result; decodeFunctionResult(functionFragment: "SETTLED", data: BytesLike): Result; decodeFunctionResult(functionFragment: "UNKNOWN", data: BytesLike): Result; decodeFunctionResult(functionFragment: "fill", data: BytesLike): Result; decodeFunctionResult(functionFragment: "filledOrders", data: BytesLike): Result; decodeFunctionResult(functionFragment: "invalidateNonces", data: BytesLike): Result; decodeFunctionResult(functionFragment: "isValidNonce", data: BytesLike): Result; decodeFunctionResult(functionFragment: "open", data: BytesLike): Result; decodeFunctionResult(functionFragment: "openFor", data: BytesLike): Result; decodeFunctionResult(functionFragment: "openOrders", data: BytesLike): Result; decodeFunctionResult(functionFragment: "orderStatus", data: BytesLike): Result; decodeFunctionResult(functionFragment: "refund((uint32,bytes32,bytes)[])", data: BytesLike): Result; decodeFunctionResult(functionFragment: "refund((address,address,uint256,uint256,uint32,uint32,bytes32,bytes)[])", data: BytesLike): Result; decodeFunctionResult(functionFragment: "resolve", data: BytesLike): Result; decodeFunctionResult(functionFragment: "resolveFor", data: BytesLike): Result; decodeFunctionResult(functionFragment: "settle", data: BytesLike): Result; decodeFunctionResult(functionFragment: "usedNonces", data: BytesLike): Result; decodeFunctionResult(functionFragment: "witnessHash", data: BytesLike): Result; decodeFunctionResult(functionFragment: "witnessTypeString", data: BytesLike): Result; } export declare namespace FilledEvent { type InputTuple = [ orderId: BytesLike, originData: BytesLike, fillerData: BytesLike ]; type OutputTuple = [ orderId: string, originData: string, fillerData: string ]; interface OutputObject { orderId: string; originData: string; fillerData: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace NonceInvalidationEvent { type InputTuple = [owner: AddressLike, nonce: BigNumberish]; type OutputTuple = [owner: string, nonce: bigint]; interface OutputObject { owner: string; nonce: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace OpenEvent { type InputTuple = [ orderId: BytesLike, resolvedOrder: ResolvedCrossChainOrderStruct ]; type OutputTuple = [ orderId: string, resolvedOrder: ResolvedCrossChainOrderStructOutput ]; interface OutputObject { orderId: string; resolvedOrder: ResolvedCrossChainOrderStructOutput; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace RefundEvent { type InputTuple = [orderIds: BytesLike[]]; type OutputTuple = [orderIds: string[]]; interface OutputObject { orderIds: string[]; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace RefundedEvent { type InputTuple = [orderId: BytesLike, receiver: AddressLike]; type OutputTuple = [orderId: string, receiver: string]; interface OutputObject { orderId: string; receiver: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace SettleEvent { type InputTuple = [ orderIds: BytesLike[], ordersFillerData: BytesLike[] ]; type OutputTuple = [orderIds: string[], ordersFillerData: string[]]; interface OutputObject { orderIds: string[]; ordersFillerData: string[]; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace SettledEvent { type InputTuple = [orderId: BytesLike, receiver: AddressLike]; type OutputTuple = [orderId: string, receiver: string]; interface OutputObject { orderId: string; receiver: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export interface BasicSwap7683 extends BaseContract { connect(runner?: ContractRunner | null): BasicSwap7683; waitForDeployment(): Promise<this>; interface: BasicSwap7683Interface; queryFilter<TCEvent extends TypedContractEvent>(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>; queryFilter<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>; on<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>; on<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>; once<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>; once<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>; listeners<TCEvent extends TypedContractEvent>(event: TCEvent): Promise<Array<TypedListener<TCEvent>>>; listeners(eventName?: string): Promise<Array<Listener>>; removeAllListeners<TCEvent extends TypedContractEvent>(event?: TCEvent): Promise<this>; FILLED: TypedContractMethod<[], [string], "view">; OPENED: TypedContractMethod<[], [string], "view">; PERMIT2: TypedContractMethod<[], [string], "view">; REFUNDED: TypedContractMethod<[], [string], "view">; RESOLVED_CROSS_CHAIN_ORDER_TYPEHASH: TypedContractMethod<[ ], [ string ], "view">; SETTLED: TypedContractMethod<[], [string], "view">; UNKNOWN: TypedContractMethod<[], [string], "view">; fill: TypedContractMethod<[ _orderId: BytesLike, _originData: BytesLike, _fillerData: BytesLike ], [ void ], "payable">; filledOrders: TypedContractMethod<[ orderId: BytesLike ], [ [string, string] & { originData: string; fillerData: string; } ], "view">; invalidateNonces: TypedContractMethod<[ _nonce: BigNumberish ], [ void ], "nonpayable">; isValidNonce: TypedContractMethod<[ _from: AddressLike, _nonce: BigNumberish ], [ boolean ], "view">; open: TypedContractMethod<[ _order: OnchainCrossChainOrderStruct ], [ void ], "payable">; openFor: TypedContractMethod<[ _order: GaslessCrossChainOrderStruct, _signature: BytesLike, _originFillerData: BytesLike ], [ void ], "nonpayable">; openOrders: TypedContractMethod<[orderId: BytesLike], [string], "view">; orderStatus: TypedContractMethod<[orderId: BytesLike], [string], "view">; "refund((uint32,bytes32,bytes)[])": TypedContractMethod<[ _orders: OnchainCrossChainOrderStruct[] ], [ void ], "payable">; "refund((address,address,uint256,uint256,uint32,uint32,bytes32,bytes)[])": TypedContractMethod<[ _orders: GaslessCrossChainOrderStruct[] ], [ void ], "payable">; resolve: TypedContractMethod<[ _order: OnchainCrossChainOrderStruct ], [ ResolvedCrossChainOrderStructOutput ], "view">; resolveFor: TypedContractMethod<[ _order: GaslessCrossChainOrderStruct, _originFillerData: BytesLike ], [ ResolvedCrossChainOrderStructOutput ], "view">; settle: TypedContractMethod<[_orderIds: BytesLike[]], [void], "payable">; usedNonces: TypedContractMethod<[ arg0: AddressLike, arg1: BigNumberish ], [ boolean ], "view">; witnessHash: TypedContractMethod<[ _resolvedOrder: ResolvedCrossChainOrderStruct ], [ string ], "view">; witnessTypeString: TypedContractMethod<[], [string], "view">; getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; getFunction(nameOrSignature: "FILLED"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "OPENED"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "PERMIT2"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "REFUNDED"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "RESOLVED_CROSS_CHAIN_ORDER_TYPEHASH"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "SETTLED"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "UNKNOWN"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "fill"): TypedContractMethod<[ _orderId: BytesLike, _originData: BytesLike, _fillerData: BytesLike ], [ void ], "payable">; getFunction(nameOrSignature: "filledOrders"): TypedContractMethod<[ orderId: BytesLike ], [ [string, string] & { originData: string; fillerData: string; } ], "view">; getFunction(nameOrSignature: "invalidateNonces"): TypedContractMethod<[_nonce: BigNumberish], [void], "nonpayable">; getFunction(nameOrSignature: "isValidNonce"): TypedContractMethod<[ _from: AddressLike, _nonce: BigNumberish ], [ boolean ], "view">; getFunction(nameOrSignature: "open"): TypedContractMethod<[ _order: OnchainCrossChainOrderStruct ], [ void ], "payable">; getFunction(nameOrSignature: "openFor"): TypedContractMethod<[ _order: GaslessCrossChainOrderStruct, _signature: BytesLike, _originFillerData: BytesLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "openOrders"): TypedContractMethod<[orderId: BytesLike], [string], "view">; getFunction(nameOrSignature: "orderStatus"): TypedContractMethod<[orderId: BytesLike], [string], "view">; getFunction(nameOrSignature: "refund((uint32,bytes32,bytes)[])"): TypedContractMethod<[ _orders: OnchainCrossChainOrderStruct[] ], [ void ], "payable">; getFunction(nameOrSignature: "refund((address,address,uint256,uint256,uint32,uint32,bytes32,bytes)[])"): TypedContractMethod<[ _orders: GaslessCrossChainOrderStruct[] ], [ void ], "payable">; getFunction(nameOrSignature: "resolve"): TypedContractMethod<[ _order: OnchainCrossChainOrderStruct ], [ ResolvedCrossChainOrderStructOutput ], "view">; getFunction(nameOrSignature: "resolveFor"): TypedContractMethod<[ _order: GaslessCrossChainOrderStruct, _originFillerData: BytesLike ], [ ResolvedCrossChainOrderStructOutput ], "view">; getFunction(nameOrSignature: "settle"): TypedContractMethod<[_orderIds: BytesLike[]], [void], "payable">; getFunction(nameOrSignature: "usedNonces"): TypedContractMethod<[ arg0: AddressLike, arg1: BigNumberish ], [ boolean ], "view">; getFunction(nameOrSignature: "witnessHash"): TypedContractMethod<[ _resolvedOrder: ResolvedCrossChainOrderStruct ], [ string ], "view">; getFunction(nameOrSignature: "witnessTypeString"): TypedContractMethod<[], [string], "view">; getEvent(key: "Filled"): TypedContractEvent<FilledEvent.InputTuple, FilledEvent.OutputTuple, FilledEvent.OutputObject>; getEvent(key: "NonceInvalidation"): TypedContractEvent<NonceInvalidationEvent.InputTuple, NonceInvalidationEvent.OutputTuple, NonceInvalidationEvent.OutputObject>; getEvent(key: "Open"): TypedContractEvent<OpenEvent.InputTuple, OpenEvent.OutputTuple, OpenEvent.OutputObject>; getEvent(key: "Refund"): TypedContractEvent<RefundEvent.InputTuple, RefundEvent.OutputTuple, RefundEvent.OutputObject>; getEvent(key: "Refunded"): TypedContractEvent<RefundedEvent.InputTuple, RefundedEvent.OutputTuple, RefundedEvent.OutputObject>; getEvent(key: "Settle"): TypedContractEvent<SettleEvent.InputTuple, SettleEvent.OutputTuple, SettleEvent.OutputObject>; getEvent(key: "Settled"): TypedContractEvent<SettledEvent.InputTuple, SettledEvent.OutputTuple, SettledEvent.OutputObject>; filters: { "Filled(bytes32,bytes,bytes)": TypedContractEvent<FilledEvent.InputTuple, FilledEvent.OutputTuple, FilledEvent.OutputObject>; Filled: TypedContractEvent<FilledEvent.InputTuple, FilledEvent.OutputTuple, FilledEvent.OutputObject>; "NonceInvalidation(address,uint256)": TypedContractEvent<NonceInvalidationEvent.InputTuple, NonceInvalidationEvent.OutputTuple, NonceInvalidationEvent.OutputObject>; NonceInvalidation: TypedContractEvent<NonceInvalidationEvent.InputTuple, NonceInvalidationEvent.OutputTuple, NonceInvalidationEvent.OutputObject>; "Open(bytes32,tuple)": TypedContractEvent<OpenEvent.InputTuple, OpenEvent.OutputTuple, OpenEvent.OutputObject>; Open: TypedContractEvent<OpenEvent.InputTuple, OpenEvent.OutputTuple, OpenEvent.OutputObject>; "Refund(bytes32[])": TypedContractEvent<RefundEvent.InputTuple, RefundEvent.OutputTuple, RefundEvent.OutputObject>; Refund: TypedContractEvent<RefundEvent.InputTuple, RefundEvent.OutputTuple, RefundEvent.OutputObject>; "Refunded(bytes32,address)": TypedContractEvent<RefundedEvent.InputTuple, RefundedEvent.OutputTuple, RefundedEvent.OutputObject>; Refunded: TypedContractEvent<RefundedEvent.InputTuple, RefundedEvent.OutputTuple, RefundedEvent.OutputObject>; "Settle(bytes32[],bytes[])": TypedContractEvent<SettleEvent.InputTuple, SettleEvent.OutputTuple, SettleEvent.OutputObject>; Settle: TypedContractEvent<SettleEvent.InputTuple, SettleEvent.OutputTuple, SettleEvent.OutputObject>; "Settled(bytes32,address)": TypedContractEvent<SettledEvent.InputTuple, SettledEvent.OutputTuple, SettledEvent.OutputObject>; Settled: TypedContractEvent<SettledEvent.InputTuple, SettledEvent.OutputTuple, SettledEvent.OutputObject>; }; } //# sourceMappingURL=BasicSwap7683.d.ts.map