UNPKG

@d8x/perpetuals-sdk

Version:

Node TypeScript SDK for D8X Perpetual Futures

427 lines (426 loc) 22.7 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 interface CompositeTokenInterface extends Interface { getFunction(nameOrSignature: "CMP_DECIMALS" | "UPGRADE_INTERFACE_VERSION" | "addTokens" | "allowance" | "approve" | "balanceOf" | "controller" | "decimals" | "effectiveBalanceOf" | "getSupportedTokens" | "initialize" | "latestRoundData" | "name" | "owner" | "proxiableUUID" | "registerAccount" | "registeredToken" | "removeTokens" | "renounceOwnership" | "setController" | "supportedToken" | "symbol" | "totalInvested" | "totalSupply" | "totalValue" | "transfer" | "transferFrom" | "transferOwnership" | "upgradeToAndCall"): FunctionFragment; getEvent(nameOrSignatureOrTopic: "AccountRegistered" | "Approval" | "ControllerSet" | "Initialized" | "OwnershipTransferred" | "TokenSupported" | "Transfer" | "Upgraded"): EventFragment; encodeFunctionData(functionFragment: "CMP_DECIMALS", values?: undefined): string; encodeFunctionData(functionFragment: "UPGRADE_INTERFACE_VERSION", values?: undefined): string; encodeFunctionData(functionFragment: "addTokens", values: [AddressLike[], AddressLike[], BytesLike[]]): string; encodeFunctionData(functionFragment: "allowance", values: [AddressLike, AddressLike]): string; encodeFunctionData(functionFragment: "approve", values: [AddressLike, BigNumberish]): string; encodeFunctionData(functionFragment: "balanceOf", values: [AddressLike]): string; encodeFunctionData(functionFragment: "controller", values?: undefined): string; encodeFunctionData(functionFragment: "decimals", values?: undefined): string; encodeFunctionData(functionFragment: "effectiveBalanceOf", values: [AddressLike]): string; encodeFunctionData(functionFragment: "getSupportedTokens", values?: undefined): string; encodeFunctionData(functionFragment: "initialize", values: [AddressLike, AddressLike[], AddressLike[], BytesLike[]]): string; encodeFunctionData(functionFragment: "latestRoundData", values?: undefined): string; encodeFunctionData(functionFragment: "name", values?: undefined): string; encodeFunctionData(functionFragment: "owner", values?: undefined): string; encodeFunctionData(functionFragment: "proxiableUUID", values?: undefined): string; encodeFunctionData(functionFragment: "registerAccount", values: [AddressLike]): string; encodeFunctionData(functionFragment: "registeredToken", values: [AddressLike]): string; encodeFunctionData(functionFragment: "removeTokens", values: [AddressLike[]]): string; encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string; encodeFunctionData(functionFragment: "setController", values: [AddressLike]): string; encodeFunctionData(functionFragment: "supportedToken", values: [AddressLike]): string; encodeFunctionData(functionFragment: "symbol", values?: undefined): string; encodeFunctionData(functionFragment: "totalInvested", values: [AddressLike]): string; encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; encodeFunctionData(functionFragment: "totalValue", values?: undefined): string; encodeFunctionData(functionFragment: "transfer", values: [AddressLike, BigNumberish]): string; encodeFunctionData(functionFragment: "transferFrom", values: [AddressLike, AddressLike, BigNumberish]): string; encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string; encodeFunctionData(functionFragment: "upgradeToAndCall", values: [AddressLike, BytesLike]): string; decodeFunctionResult(functionFragment: "CMP_DECIMALS", data: BytesLike): Result; decodeFunctionResult(functionFragment: "UPGRADE_INTERFACE_VERSION", data: BytesLike): Result; decodeFunctionResult(functionFragment: "addTokens", data: BytesLike): Result; decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; decodeFunctionResult(functionFragment: "controller", data: BytesLike): Result; decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; decodeFunctionResult(functionFragment: "effectiveBalanceOf", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getSupportedTokens", data: BytesLike): Result; decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result; decodeFunctionResult(functionFragment: "latestRoundData", data: BytesLike): Result; decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; decodeFunctionResult(functionFragment: "proxiableUUID", data: BytesLike): Result; decodeFunctionResult(functionFragment: "registerAccount", data: BytesLike): Result; decodeFunctionResult(functionFragment: "registeredToken", data: BytesLike): Result; decodeFunctionResult(functionFragment: "removeTokens", data: BytesLike): Result; decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setController", data: BytesLike): Result; decodeFunctionResult(functionFragment: "supportedToken", data: BytesLike): Result; decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result; decodeFunctionResult(functionFragment: "totalInvested", data: BytesLike): Result; decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; decodeFunctionResult(functionFragment: "totalValue", data: BytesLike): Result; decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "transferFrom", data: BytesLike): Result; decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result; decodeFunctionResult(functionFragment: "upgradeToAndCall", data: BytesLike): Result; } export declare namespace AccountRegisteredEvent { type InputTuple = [token: AddressLike, account: AddressLike]; type OutputTuple = [token: string, account: string]; interface OutputObject { token: string; account: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ApprovalEvent { type InputTuple = [ owner: AddressLike, spender: AddressLike, value: BigNumberish ]; type OutputTuple = [owner: string, spender: string, value: bigint]; interface OutputObject { owner: string; spender: string; value: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace ControllerSetEvent { type InputTuple = [ oldController: AddressLike, newController: AddressLike ]; type OutputTuple = [oldController: string, newController: string]; interface OutputObject { oldController: string; newController: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace InitializedEvent { type InputTuple = [version: BigNumberish]; type OutputTuple = [version: bigint]; interface OutputObject { version: bigint; } 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 TokenSupportedEvent { type InputTuple = [token: AddressLike, supported: boolean]; type OutputTuple = [token: string, supported: boolean]; interface OutputObject { token: string; supported: boolean; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace TransferEvent { type InputTuple = [ from: AddressLike, to: AddressLike, value: BigNumberish ]; type OutputTuple = [from: string, to: string, value: bigint]; interface OutputObject { from: string; to: string; value: bigint; } 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 CompositeToken extends BaseContract { connect(runner?: ContractRunner | null): CompositeToken; waitForDeployment(): Promise<this>; interface: CompositeTokenInterface; 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>; CMP_DECIMALS: TypedContractMethod<[], [bigint], "view">; UPGRADE_INTERFACE_VERSION: TypedContractMethod<[], [string], "view">; addTokens: TypedContractMethod<[ _tokens: AddressLike[], _feeds: AddressLike[], _ids: BytesLike[] ], [ void ], "nonpayable">; allowance: TypedContractMethod<[ _owner: AddressLike, _spender: AddressLike ], [ bigint ], "view">; approve: TypedContractMethod<[ spender: AddressLike, value: BigNumberish ], [ boolean ], "nonpayable">; balanceOf: TypedContractMethod<[account: AddressLike], [bigint], "view">; controller: TypedContractMethod<[], [string], "view">; decimals: TypedContractMethod<[], [bigint], "view">; effectiveBalanceOf: TypedContractMethod<[ _account: AddressLike ], [ bigint ], "view">; getSupportedTokens: TypedContractMethod<[], [string[]], "view">; initialize: TypedContractMethod<[ _owner: AddressLike, _tokens: AddressLike[], _feeds: AddressLike[], _ids: BytesLike[] ], [ void ], "nonpayable">; latestRoundData: TypedContractMethod<[ ], [ [ bigint, bigint, bigint, bigint, bigint ] & { roundId: bigint; answer: bigint; startedAt: bigint; updatedAt: bigint; answeredInRound: bigint; } ], "view">; name: TypedContractMethod<[], [string], "view">; owner: TypedContractMethod<[], [string], "view">; proxiableUUID: TypedContractMethod<[], [string], "view">; registerAccount: TypedContractMethod<[ _token: AddressLike ], [ void ], "nonpayable">; registeredToken: TypedContractMethod<[arg0: AddressLike], [string], "view">; removeTokens: TypedContractMethod<[ _tokens: AddressLike[] ], [ void ], "nonpayable">; renounceOwnership: TypedContractMethod<[], [void], "nonpayable">; setController: TypedContractMethod<[ _newController: AddressLike ], [ void ], "nonpayable">; supportedToken: TypedContractMethod<[ arg0: AddressLike ], [ [ string, string, bigint, bigint ] & { id: string; feed: string; tokenDecimals: bigint; feedDecimals: bigint; } ], "view">; symbol: TypedContractMethod<[], [string], "view">; totalInvested: TypedContractMethod<[arg0: AddressLike], [bigint], "view">; totalSupply: TypedContractMethod<[], [bigint], "view">; totalValue: TypedContractMethod<[], [bigint], "view">; transfer: TypedContractMethod<[ to: AddressLike, value: BigNumberish ], [ boolean ], "nonpayable">; transferFrom: TypedContractMethod<[ from: AddressLike, to: AddressLike, value: BigNumberish ], [ boolean ], "nonpayable">; transferOwnership: TypedContractMethod<[ newOwner: AddressLike ], [ void ], "nonpayable">; upgradeToAndCall: TypedContractMethod<[ newImplementation: AddressLike, data: BytesLike ], [ void ], "payable">; getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; getFunction(nameOrSignature: "CMP_DECIMALS"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "UPGRADE_INTERFACE_VERSION"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "addTokens"): TypedContractMethod<[ _tokens: AddressLike[], _feeds: AddressLike[], _ids: BytesLike[] ], [ void ], "nonpayable">; getFunction(nameOrSignature: "allowance"): TypedContractMethod<[ _owner: AddressLike, _spender: AddressLike ], [ bigint ], "view">; getFunction(nameOrSignature: "approve"): TypedContractMethod<[ spender: AddressLike, value: BigNumberish ], [ boolean ], "nonpayable">; getFunction(nameOrSignature: "balanceOf"): TypedContractMethod<[account: AddressLike], [bigint], "view">; getFunction(nameOrSignature: "controller"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "decimals"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "effectiveBalanceOf"): TypedContractMethod<[_account: AddressLike], [bigint], "view">; getFunction(nameOrSignature: "getSupportedTokens"): TypedContractMethod<[], [string[]], "view">; getFunction(nameOrSignature: "initialize"): TypedContractMethod<[ _owner: AddressLike, _tokens: AddressLike[], _feeds: AddressLike[], _ids: BytesLike[] ], [ void ], "nonpayable">; getFunction(nameOrSignature: "latestRoundData"): TypedContractMethod<[ ], [ [ bigint, bigint, bigint, bigint, bigint ] & { roundId: bigint; answer: bigint; startedAt: bigint; updatedAt: bigint; answeredInRound: bigint; } ], "view">; getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "proxiableUUID"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "registerAccount"): TypedContractMethod<[_token: AddressLike], [void], "nonpayable">; getFunction(nameOrSignature: "registeredToken"): TypedContractMethod<[arg0: AddressLike], [string], "view">; getFunction(nameOrSignature: "removeTokens"): TypedContractMethod<[_tokens: AddressLike[]], [void], "nonpayable">; getFunction(nameOrSignature: "renounceOwnership"): TypedContractMethod<[], [void], "nonpayable">; getFunction(nameOrSignature: "setController"): TypedContractMethod<[_newController: AddressLike], [void], "nonpayable">; getFunction(nameOrSignature: "supportedToken"): TypedContractMethod<[ arg0: AddressLike ], [ [ string, string, bigint, bigint ] & { id: string; feed: string; tokenDecimals: bigint; feedDecimals: bigint; } ], "view">; getFunction(nameOrSignature: "symbol"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "totalInvested"): TypedContractMethod<[arg0: AddressLike], [bigint], "view">; getFunction(nameOrSignature: "totalSupply"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "totalValue"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "transfer"): TypedContractMethod<[ to: AddressLike, value: BigNumberish ], [ boolean ], "nonpayable">; getFunction(nameOrSignature: "transferFrom"): TypedContractMethod<[ from: AddressLike, to: AddressLike, value: BigNumberish ], [ boolean ], "nonpayable">; getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; getFunction(nameOrSignature: "upgradeToAndCall"): TypedContractMethod<[ newImplementation: AddressLike, data: BytesLike ], [ void ], "payable">; getEvent(key: "AccountRegistered"): TypedContractEvent<AccountRegisteredEvent.InputTuple, AccountRegisteredEvent.OutputTuple, AccountRegisteredEvent.OutputObject>; getEvent(key: "Approval"): TypedContractEvent<ApprovalEvent.InputTuple, ApprovalEvent.OutputTuple, ApprovalEvent.OutputObject>; getEvent(key: "ControllerSet"): TypedContractEvent<ControllerSetEvent.InputTuple, ControllerSetEvent.OutputTuple, ControllerSetEvent.OutputObject>; getEvent(key: "Initialized"): TypedContractEvent<InitializedEvent.InputTuple, InitializedEvent.OutputTuple, InitializedEvent.OutputObject>; getEvent(key: "OwnershipTransferred"): TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>; getEvent(key: "TokenSupported"): TypedContractEvent<TokenSupportedEvent.InputTuple, TokenSupportedEvent.OutputTuple, TokenSupportedEvent.OutputObject>; getEvent(key: "Transfer"): TypedContractEvent<TransferEvent.InputTuple, TransferEvent.OutputTuple, TransferEvent.OutputObject>; getEvent(key: "Upgraded"): TypedContractEvent<UpgradedEvent.InputTuple, UpgradedEvent.OutputTuple, UpgradedEvent.OutputObject>; filters: { "AccountRegistered(address,address)": TypedContractEvent<AccountRegisteredEvent.InputTuple, AccountRegisteredEvent.OutputTuple, AccountRegisteredEvent.OutputObject>; AccountRegistered: TypedContractEvent<AccountRegisteredEvent.InputTuple, AccountRegisteredEvent.OutputTuple, AccountRegisteredEvent.OutputObject>; "Approval(address,address,uint256)": TypedContractEvent<ApprovalEvent.InputTuple, ApprovalEvent.OutputTuple, ApprovalEvent.OutputObject>; Approval: TypedContractEvent<ApprovalEvent.InputTuple, ApprovalEvent.OutputTuple, ApprovalEvent.OutputObject>; "ControllerSet(address,address)": TypedContractEvent<ControllerSetEvent.InputTuple, ControllerSetEvent.OutputTuple, ControllerSetEvent.OutputObject>; ControllerSet: TypedContractEvent<ControllerSetEvent.InputTuple, ControllerSetEvent.OutputTuple, ControllerSetEvent.OutputObject>; "Initialized(uint64)": TypedContractEvent<InitializedEvent.InputTuple, InitializedEvent.OutputTuple, InitializedEvent.OutputObject>; Initialized: TypedContractEvent<InitializedEvent.InputTuple, InitializedEvent.OutputTuple, InitializedEvent.OutputObject>; "OwnershipTransferred(address,address)": TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>; OwnershipTransferred: TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>; "TokenSupported(address,bool)": TypedContractEvent<TokenSupportedEvent.InputTuple, TokenSupportedEvent.OutputTuple, TokenSupportedEvent.OutputObject>; TokenSupported: TypedContractEvent<TokenSupportedEvent.InputTuple, TokenSupportedEvent.OutputTuple, TokenSupportedEvent.OutputObject>; "Transfer(address,address,uint256)": TypedContractEvent<TransferEvent.InputTuple, TransferEvent.OutputTuple, TransferEvent.OutputObject>; Transfer: TypedContractEvent<TransferEvent.InputTuple, TransferEvent.OutputTuple, TransferEvent.OutputObject>; "Upgraded(address)": TypedContractEvent<UpgradedEvent.InputTuple, UpgradedEvent.OutputTuple, UpgradedEvent.OutputObject>; Upgraded: TypedContractEvent<UpgradedEvent.InputTuple, UpgradedEvent.OutputTuple, UpgradedEvent.OutputObject>; }; }