@d8x/perpetuals-sdk
Version:
Node TypeScript SDK for D8X Perpetual Futures
420 lines (419 loc) • 21.9 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 PythStructs {
type PriceStruct = {
price: BigNumberish;
conf: BigNumberish;
expo: BigNumberish;
publishTime: BigNumberish;
};
type PriceStructOutput = [
price: bigint,
conf: bigint,
expo: bigint,
publishTime: bigint
] & {
price: bigint;
conf: bigint;
expo: bigint;
publishTime: bigint;
};
type PriceFeedStruct = {
id: BytesLike;
price: PythStructs.PriceStruct;
emaPrice: PythStructs.PriceStruct;
};
type PriceFeedStructOutput = [
id: string,
price: PythStructs.PriceStructOutput,
emaPrice: PythStructs.PriceStructOutput
] & {
id: string;
price: PythStructs.PriceStructOutput;
emaPrice: PythStructs.PriceStructOutput;
};
}
export interface OnDemandOracleUpgradeableInterface extends Interface {
getFunction(nameOrSignature: "addSigner" | "getEmaPrice" | "getEmaPriceNoOlderThan" | "getEmaPriceUnsafe" | "getPrice" | "getPriceNoOlderThan" | "getPriceUnsafe" | "getUpdateFee" | "getValidTimePeriod" | "initialize" | "owner" | "parsePriceFeedUpdates" | "priceFeedExists" | "proxiableUUID" | "queryPriceFeed" | "removeSigner" | "renounceOwnership" | "transferOwnership" | "updatePriceFeeds" | "updatePriceFeedsIfNecessary" | "updateSingleUpdateFeeInWei" | "updateValidTimePeriodSeconds" | "upgradeTo" | "upgradeToAndCall"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "AdminChanged" | "BatchPriceFeedUpdate" | "BeaconUpgraded" | "OwnershipTransferred" | "PriceFeedUpdate" | "SignerAdded" | "SignerRemoved" | "Upgraded"): EventFragment;
encodeFunctionData(functionFragment: "addSigner", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "getEmaPrice", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "getEmaPriceNoOlderThan", values: [BytesLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "getEmaPriceUnsafe", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "getPrice", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "getPriceNoOlderThan", values: [BytesLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "getPriceUnsafe", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "getUpdateFee", values: [BytesLike[]]): string;
encodeFunctionData(functionFragment: "getValidTimePeriod", values?: undefined): string;
encodeFunctionData(functionFragment: "initialize", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "parsePriceFeedUpdates", values: [BytesLike[], BytesLike[], BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "priceFeedExists", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "proxiableUUID", values?: undefined): string;
encodeFunctionData(functionFragment: "queryPriceFeed", values: [BytesLike]): string;
encodeFunctionData(functionFragment: "removeSigner", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "updatePriceFeeds", values: [BytesLike[]]): string;
encodeFunctionData(functionFragment: "updatePriceFeedsIfNecessary", values: [BytesLike[], BytesLike[], BigNumberish[]]): string;
encodeFunctionData(functionFragment: "updateSingleUpdateFeeInWei", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "updateValidTimePeriodSeconds", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "upgradeTo", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "upgradeToAndCall", values: [AddressLike, BytesLike]): string;
decodeFunctionResult(functionFragment: "addSigner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getEmaPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getEmaPriceNoOlderThan", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getEmaPriceUnsafe", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getPriceNoOlderThan", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getPriceUnsafe", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getUpdateFee", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getValidTimePeriod", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "parsePriceFeedUpdates", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "priceFeedExists", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "proxiableUUID", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "queryPriceFeed", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "removeSigner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updatePriceFeeds", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updatePriceFeedsIfNecessary", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updateSingleUpdateFeeInWei", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updateValidTimePeriodSeconds", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "upgradeTo", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "upgradeToAndCall", data: BytesLike): Result;
}
export declare namespace AdminChangedEvent {
type InputTuple = [previousAdmin: AddressLike, newAdmin: AddressLike];
type OutputTuple = [previousAdmin: string, newAdmin: string];
interface OutputObject {
previousAdmin: string;
newAdmin: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace BatchPriceFeedUpdateEvent {
type InputTuple = [
chainId: BigNumberish,
sequenceNumber: BigNumberish
];
type OutputTuple = [chainId: bigint, sequenceNumber: bigint];
interface OutputObject {
chainId: bigint;
sequenceNumber: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace BeaconUpgradedEvent {
type InputTuple = [beacon: AddressLike];
type OutputTuple = [beacon: string];
interface OutputObject {
beacon: 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 PriceFeedUpdateEvent {
type InputTuple = [
id: BytesLike,
publishTime: BigNumberish,
price: BigNumberish,
conf: BigNumberish
];
type OutputTuple = [
id: string,
publishTime: bigint,
price: bigint,
conf: bigint
];
interface OutputObject {
id: string;
publishTime: bigint;
price: bigint;
conf: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SignerAddedEvent {
type InputTuple = [newSigner: AddressLike];
type OutputTuple = [newSigner: string];
interface OutputObject {
newSigner: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SignerRemovedEvent {
type InputTuple = [signer: AddressLike];
type OutputTuple = [signer: string];
interface OutputObject {
signer: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace UpgradedEvent {
type InputTuple = [implementation: AddressLike];
type OutputTuple = [implementation: string];
interface OutputObject {
implementation: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export interface OnDemandOracleUpgradeable extends BaseContract {
connect(runner?: ContractRunner | null): OnDemandOracleUpgradeable;
waitForDeployment(): Promise<this>;
interface: OnDemandOracleUpgradeableInterface;
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>;
addSigner: TypedContractMethod<[
_newSigner: AddressLike
], [
void
], "nonpayable">;
getEmaPrice: TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getEmaPriceNoOlderThan: TypedContractMethod<[
id: BytesLike,
age: BigNumberish
], [
PythStructs.PriceStructOutput
], "view">;
getEmaPriceUnsafe: TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getPrice: TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getPriceNoOlderThan: TypedContractMethod<[
id: BytesLike,
age: BigNumberish
], [
PythStructs.PriceStructOutput
], "view">;
getPriceUnsafe: TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getUpdateFee: TypedContractMethod<[
updateData: BytesLike[]
], [
bigint
], "view">;
getValidTimePeriod: TypedContractMethod<[], [bigint], "view">;
initialize: TypedContractMethod<[], [void], "nonpayable">;
owner: TypedContractMethod<[], [string], "view">;
parsePriceFeedUpdates: TypedContractMethod<[
arg0: BytesLike[],
arg1: BytesLike[],
arg2: BigNumberish,
arg3: BigNumberish
], [
PythStructs.PriceFeedStructOutput[]
], "payable">;
priceFeedExists: TypedContractMethod<[id: BytesLike], [boolean], "view">;
proxiableUUID: TypedContractMethod<[], [string], "view">;
queryPriceFeed: TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceFeedStructOutput
], "view">;
removeSigner: TypedContractMethod<[
_signer: AddressLike
], [
void
], "nonpayable">;
renounceOwnership: TypedContractMethod<[], [void], "nonpayable">;
transferOwnership: TypedContractMethod<[
newOwner: AddressLike
], [
void
], "nonpayable">;
updatePriceFeeds: TypedContractMethod<[
updateData: BytesLike[]
], [
void
], "payable">;
updatePriceFeedsIfNecessary: TypedContractMethod<[
updateData: BytesLike[],
priceIds: BytesLike[],
publishTimes: BigNumberish[]
], [
void
], "payable">;
updateSingleUpdateFeeInWei: TypedContractMethod<[
newFee: BigNumberish
], [
void
], "nonpayable">;
updateValidTimePeriodSeconds: TypedContractMethod<[
newValidTimePeriodSeconds: BigNumberish
], [
void
], "nonpayable">;
upgradeTo: TypedContractMethod<[
newImplementation: AddressLike
], [
void
], "nonpayable">;
upgradeToAndCall: TypedContractMethod<[
newImplementation: AddressLike,
data: BytesLike
], [
void
], "payable">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "addSigner"): TypedContractMethod<[_newSigner: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "getEmaPrice"): TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getFunction(nameOrSignature: "getEmaPriceNoOlderThan"): TypedContractMethod<[
id: BytesLike,
age: BigNumberish
], [
PythStructs.PriceStructOutput
], "view">;
getFunction(nameOrSignature: "getEmaPriceUnsafe"): TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getFunction(nameOrSignature: "getPrice"): TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getFunction(nameOrSignature: "getPriceNoOlderThan"): TypedContractMethod<[
id: BytesLike,
age: BigNumberish
], [
PythStructs.PriceStructOutput
], "view">;
getFunction(nameOrSignature: "getPriceUnsafe"): TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceStructOutput
], "view">;
getFunction(nameOrSignature: "getUpdateFee"): TypedContractMethod<[updateData: BytesLike[]], [bigint], "view">;
getFunction(nameOrSignature: "getValidTimePeriod"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "initialize"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "parsePriceFeedUpdates"): TypedContractMethod<[
arg0: BytesLike[],
arg1: BytesLike[],
arg2: BigNumberish,
arg3: BigNumberish
], [
PythStructs.PriceFeedStructOutput[]
], "payable">;
getFunction(nameOrSignature: "priceFeedExists"): TypedContractMethod<[id: BytesLike], [boolean], "view">;
getFunction(nameOrSignature: "proxiableUUID"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "queryPriceFeed"): TypedContractMethod<[
id: BytesLike
], [
PythStructs.PriceFeedStructOutput
], "view">;
getFunction(nameOrSignature: "removeSigner"): TypedContractMethod<[_signer: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "renounceOwnership"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "updatePriceFeeds"): TypedContractMethod<[updateData: BytesLike[]], [void], "payable">;
getFunction(nameOrSignature: "updatePriceFeedsIfNecessary"): TypedContractMethod<[
updateData: BytesLike[],
priceIds: BytesLike[],
publishTimes: BigNumberish[]
], [
void
], "payable">;
getFunction(nameOrSignature: "updateSingleUpdateFeeInWei"): TypedContractMethod<[newFee: BigNumberish], [void], "nonpayable">;
getFunction(nameOrSignature: "updateValidTimePeriodSeconds"): TypedContractMethod<[
newValidTimePeriodSeconds: BigNumberish
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "upgradeTo"): TypedContractMethod<[
newImplementation: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "upgradeToAndCall"): TypedContractMethod<[
newImplementation: AddressLike,
data: BytesLike
], [
void
], "payable">;
getEvent(key: "AdminChanged"): TypedContractEvent<AdminChangedEvent.InputTuple, AdminChangedEvent.OutputTuple, AdminChangedEvent.OutputObject>;
getEvent(key: "BatchPriceFeedUpdate"): TypedContractEvent<BatchPriceFeedUpdateEvent.InputTuple, BatchPriceFeedUpdateEvent.OutputTuple, BatchPriceFeedUpdateEvent.OutputObject>;
getEvent(key: "BeaconUpgraded"): TypedContractEvent<BeaconUpgradedEvent.InputTuple, BeaconUpgradedEvent.OutputTuple, BeaconUpgradedEvent.OutputObject>;
getEvent(key: "OwnershipTransferred"): TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
getEvent(key: "PriceFeedUpdate"): TypedContractEvent<PriceFeedUpdateEvent.InputTuple, PriceFeedUpdateEvent.OutputTuple, PriceFeedUpdateEvent.OutputObject>;
getEvent(key: "SignerAdded"): TypedContractEvent<SignerAddedEvent.InputTuple, SignerAddedEvent.OutputTuple, SignerAddedEvent.OutputObject>;
getEvent(key: "SignerRemoved"): TypedContractEvent<SignerRemovedEvent.InputTuple, SignerRemovedEvent.OutputTuple, SignerRemovedEvent.OutputObject>;
getEvent(key: "Upgraded"): TypedContractEvent<UpgradedEvent.InputTuple, UpgradedEvent.OutputTuple, UpgradedEvent.OutputObject>;
filters: {
"AdminChanged(address,address)": TypedContractEvent<AdminChangedEvent.InputTuple, AdminChangedEvent.OutputTuple, AdminChangedEvent.OutputObject>;
AdminChanged: TypedContractEvent<AdminChangedEvent.InputTuple, AdminChangedEvent.OutputTuple, AdminChangedEvent.OutputObject>;
"BatchPriceFeedUpdate(uint16,uint64)": TypedContractEvent<BatchPriceFeedUpdateEvent.InputTuple, BatchPriceFeedUpdateEvent.OutputTuple, BatchPriceFeedUpdateEvent.OutputObject>;
BatchPriceFeedUpdate: TypedContractEvent<BatchPriceFeedUpdateEvent.InputTuple, BatchPriceFeedUpdateEvent.OutputTuple, BatchPriceFeedUpdateEvent.OutputObject>;
"BeaconUpgraded(address)": TypedContractEvent<BeaconUpgradedEvent.InputTuple, BeaconUpgradedEvent.OutputTuple, BeaconUpgradedEvent.OutputObject>;
BeaconUpgraded: TypedContractEvent<BeaconUpgradedEvent.InputTuple, BeaconUpgradedEvent.OutputTuple, BeaconUpgradedEvent.OutputObject>;
"OwnershipTransferred(address,address)": TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
OwnershipTransferred: TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
"PriceFeedUpdate(bytes32,uint64,int64,uint64)": TypedContractEvent<PriceFeedUpdateEvent.InputTuple, PriceFeedUpdateEvent.OutputTuple, PriceFeedUpdateEvent.OutputObject>;
PriceFeedUpdate: TypedContractEvent<PriceFeedUpdateEvent.InputTuple, PriceFeedUpdateEvent.OutputTuple, PriceFeedUpdateEvent.OutputObject>;
"SignerAdded(address)": TypedContractEvent<SignerAddedEvent.InputTuple, SignerAddedEvent.OutputTuple, SignerAddedEvent.OutputObject>;
SignerAdded: TypedContractEvent<SignerAddedEvent.InputTuple, SignerAddedEvent.OutputTuple, SignerAddedEvent.OutputObject>;
"SignerRemoved(address)": TypedContractEvent<SignerRemovedEvent.InputTuple, SignerRemovedEvent.OutputTuple, SignerRemovedEvent.OutputObject>;
SignerRemoved: TypedContractEvent<SignerRemovedEvent.InputTuple, SignerRemovedEvent.OutputTuple, SignerRemovedEvent.OutputObject>;
"Upgraded(address)": TypedContractEvent<UpgradedEvent.InputTuple, UpgradedEvent.OutputTuple, UpgradedEvent.OutputObject>;
Upgraded: TypedContractEvent<UpgradedEvent.InputTuple, UpgradedEvent.OutputTuple, UpgradedEvent.OutputObject>;
};
}