@d8x/perpetuals-sdk
Version:
Node TypeScript SDK for D8X Perpetual Futures
358 lines (357 loc) • 17 kB
TypeScript
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 declare namespace OracleFactory {
type OracleDataStruct = {
oracle: AddressLike;
isInverse: boolean;
};
type OracleDataStructOutput = [oracle: string, isInverse: boolean] & {
oracle: string;
isInverse: boolean;
};
}
export interface OracleFactoryInterface extends Interface {
getFunction(nameOrSignature: "addOracle" | "addRoute" | "createOracle" | "existsRoute" | "getEmaPrice" | "getRoute" | "getRouteIds" | "getSpotPrice" | "onDemandFeed" | "owner" | "pyth" | "renounceOwnership" | "setMarketClosed" | "transferOwnership" | "updatePriceFeeds"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "OracleAdded" | "OracleCreated" | "OwnershipTransferred" | "RouteAdded" | "SetMarketClosed" | "ShortRouteAdded"): EventFragment;
encodeFunctionData(functionFragment: "addOracle", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "addRoute", values: [BytesLike, BytesLike, AddressLike[], boolean[]]): string;
encodeFunctionData(functionFragment: "createOracle", values: [
BytesLike,
BytesLike,
BigNumberish,
AddressLike,
BytesLike,
BigNumberish
]): string;
encodeFunctionData(functionFragment: "existsRoute", values: [BytesLike, BytesLike]): string;
encodeFunctionData(functionFragment: "getEmaPrice", values: [BytesLike, BytesLike]): string;
encodeFunctionData(functionFragment: "getRoute", values: [BytesLike, BytesLike]): string;
encodeFunctionData(functionFragment: "getRouteIds", values: [[BytesLike, BytesLike]]): string;
encodeFunctionData(functionFragment: "getSpotPrice", values: [BytesLike, BytesLike]): string;
encodeFunctionData(functionFragment: "onDemandFeed", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "pyth", values?: undefined): string;
encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "setMarketClosed", values: [BytesLike, BytesLike, boolean]): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "updatePriceFeeds", values: [BytesLike[], BytesLike[], BigNumberish[], BigNumberish]): string;
decodeFunctionResult(functionFragment: "addOracle", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "addRoute", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "createOracle", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "existsRoute", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getEmaPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRoute", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRouteIds", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getSpotPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "onDemandFeed", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "pyth", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setMarketClosed", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updatePriceFeeds", data: BytesLike): Result;
}
export declare namespace OracleAddedEvent {
type InputTuple = [
baseCurrency: BytesLike,
quoteCurrency: BytesLike,
oracle: AddressLike
];
type OutputTuple = [
baseCurrency: string,
quoteCurrency: string,
oracle: string
];
interface OutputObject {
baseCurrency: string;
quoteCurrency: string;
oracle: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OracleCreatedEvent {
type InputTuple = [
baseCurrency: BytesLike,
quoteCurrency: BytesLike,
oracle: AddressLike
];
type OutputTuple = [
baseCurrency: string,
quoteCurrency: string,
oracle: string
];
interface OutputObject {
baseCurrency: string;
quoteCurrency: string;
oracle: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace OwnershipTransferredEvent {
type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike];
type OutputTuple = [previousOwner: string, newOwner: string];
interface OutputObject {
previousOwner: string;
newOwner: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace RouteAddedEvent {
type InputTuple = [
baseCurrency: BytesLike,
quoteCurrency: BytesLike,
oracle: AddressLike[],
isInverse: boolean[]
];
type OutputTuple = [
baseCurrency: string,
quoteCurrency: string,
oracle: string[],
isInverse: boolean[]
];
interface OutputObject {
baseCurrency: string;
quoteCurrency: string;
oracle: string[];
isInverse: boolean[];
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SetMarketClosedEvent {
type InputTuple = [
baseCurrency: BytesLike,
quoteCurrency: BytesLike,
oracle: AddressLike,
marketClosed: boolean
];
type OutputTuple = [
baseCurrency: string,
quoteCurrency: string,
oracle: string,
marketClosed: boolean
];
interface OutputObject {
baseCurrency: string;
quoteCurrency: string;
oracle: string;
marketClosed: boolean;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace ShortRouteAddedEvent {
type InputTuple = [
baseCurrency: BytesLike,
quoteCurrency: BytesLike,
oracle: AddressLike
];
type OutputTuple = [
baseCurrency: string,
quoteCurrency: string,
oracle: string
];
interface OutputObject {
baseCurrency: string;
quoteCurrency: string;
oracle: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export interface OracleFactory extends BaseContract {
connect(runner?: ContractRunner | null): OracleFactory;
waitForDeployment(): Promise<this>;
interface: OracleFactoryInterface;
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>;
addOracle: TypedContractMethod<[_oracle: AddressLike], [void], "nonpayable">;
addRoute: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike,
_oracles: AddressLike[],
_isInverse: boolean[]
], [
void
], "nonpayable">;
createOracle: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike,
_tradingBreakMins: BigNumberish,
_feedAddress: AddressLike,
_priceId: BytesLike,
_feedPeriod: BigNumberish
], [
string
], "nonpayable">;
existsRoute: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
boolean
], "view">;
getEmaPrice: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
[bigint, bigint, bigint]
], "view">;
getRoute: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
OracleFactory.OracleDataStructOutput[]
], "view">;
getRouteIds: TypedContractMethod<[
_baseQuote: [BytesLike, BytesLike]
], [
[string[], boolean[]] & {
id: string[];
isPyth: boolean[];
}
], "view">;
getSpotPrice: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
[bigint, bigint, bigint]
], "view">;
onDemandFeed: TypedContractMethod<[], [string], "view">;
owner: TypedContractMethod<[], [string], "view">;
pyth: TypedContractMethod<[], [string], "view">;
renounceOwnership: TypedContractMethod<[], [void], "nonpayable">;
setMarketClosed: TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike,
_marketClosed: boolean
], [
void
], "nonpayable">;
transferOwnership: TypedContractMethod<[
newOwner: AddressLike
], [
void
], "nonpayable">;
updatePriceFeeds: TypedContractMethod<[
_updateData: BytesLike[],
_priceIds: BytesLike[],
_publishTimes: BigNumberish[],
_maxAcceptableFeedAge: BigNumberish
], [
void
], "payable">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "addOracle"): TypedContractMethod<[_oracle: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "addRoute"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike,
_oracles: AddressLike[],
_isInverse: boolean[]
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "createOracle"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike,
_tradingBreakMins: BigNumberish,
_feedAddress: AddressLike,
_priceId: BytesLike,
_feedPeriod: BigNumberish
], [
string
], "nonpayable">;
getFunction(nameOrSignature: "existsRoute"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
boolean
], "view">;
getFunction(nameOrSignature: "getEmaPrice"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
[bigint, bigint, bigint]
], "view">;
getFunction(nameOrSignature: "getRoute"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
OracleFactory.OracleDataStructOutput[]
], "view">;
getFunction(nameOrSignature: "getRouteIds"): TypedContractMethod<[
_baseQuote: [BytesLike, BytesLike]
], [
[string[], boolean[]] & {
id: string[];
isPyth: boolean[];
}
], "view">;
getFunction(nameOrSignature: "getSpotPrice"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike
], [
[bigint, bigint, bigint]
], "view">;
getFunction(nameOrSignature: "onDemandFeed"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "pyth"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "renounceOwnership"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "setMarketClosed"): TypedContractMethod<[
_baseCurrency: BytesLike,
_quoteCurrency: BytesLike,
_marketClosed: boolean
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "updatePriceFeeds"): TypedContractMethod<[
_updateData: BytesLike[],
_priceIds: BytesLike[],
_publishTimes: BigNumberish[],
_maxAcceptableFeedAge: BigNumberish
], [
void
], "payable">;
getEvent(key: "OracleAdded"): TypedContractEvent<OracleAddedEvent.InputTuple, OracleAddedEvent.OutputTuple, OracleAddedEvent.OutputObject>;
getEvent(key: "OracleCreated"): TypedContractEvent<OracleCreatedEvent.InputTuple, OracleCreatedEvent.OutputTuple, OracleCreatedEvent.OutputObject>;
getEvent(key: "OwnershipTransferred"): TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
getEvent(key: "RouteAdded"): TypedContractEvent<RouteAddedEvent.InputTuple, RouteAddedEvent.OutputTuple, RouteAddedEvent.OutputObject>;
getEvent(key: "SetMarketClosed"): TypedContractEvent<SetMarketClosedEvent.InputTuple, SetMarketClosedEvent.OutputTuple, SetMarketClosedEvent.OutputObject>;
getEvent(key: "ShortRouteAdded"): TypedContractEvent<ShortRouteAddedEvent.InputTuple, ShortRouteAddedEvent.OutputTuple, ShortRouteAddedEvent.OutputObject>;
filters: {
"OracleAdded(bytes4,bytes4,address)": TypedContractEvent<OracleAddedEvent.InputTuple, OracleAddedEvent.OutputTuple, OracleAddedEvent.OutputObject>;
OracleAdded: TypedContractEvent<OracleAddedEvent.InputTuple, OracleAddedEvent.OutputTuple, OracleAddedEvent.OutputObject>;
"OracleCreated(bytes4,bytes4,address)": TypedContractEvent<OracleCreatedEvent.InputTuple, OracleCreatedEvent.OutputTuple, OracleCreatedEvent.OutputObject>;
OracleCreated: TypedContractEvent<OracleCreatedEvent.InputTuple, OracleCreatedEvent.OutputTuple, OracleCreatedEvent.OutputObject>;
"OwnershipTransferred(address,address)": TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
OwnershipTransferred: TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
"RouteAdded(bytes4,bytes4,address[],bool[])": TypedContractEvent<RouteAddedEvent.InputTuple, RouteAddedEvent.OutputTuple, RouteAddedEvent.OutputObject>;
RouteAdded: TypedContractEvent<RouteAddedEvent.InputTuple, RouteAddedEvent.OutputTuple, RouteAddedEvent.OutputObject>;
"SetMarketClosed(bytes4,bytes4,address,bool)": TypedContractEvent<SetMarketClosedEvent.InputTuple, SetMarketClosedEvent.OutputTuple, SetMarketClosedEvent.OutputObject>;
SetMarketClosed: TypedContractEvent<SetMarketClosedEvent.InputTuple, SetMarketClosedEvent.OutputTuple, SetMarketClosedEvent.OutputObject>;
"ShortRouteAdded(bytes4,bytes4,address)": TypedContractEvent<ShortRouteAddedEvent.InputTuple, ShortRouteAddedEvent.OutputTuple, ShortRouteAddedEvent.OutputObject>;
ShortRouteAdded: TypedContractEvent<ShortRouteAddedEvent.InputTuple, ShortRouteAddedEvent.OutputTuple, ShortRouteAddedEvent.OutputObject>;
};
}