UNPKG

randomness-js

Version:

A library for consuming, verifying and using randomness from the dcipher network

366 lines (365 loc) 18.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 declare namespace VRFV2PlusClient { type RandomWordsRequestStruct = { keyHash: BytesLike; subId: BigNumberish; requestConfirmations: BigNumberish; callbackGasLimit: BigNumberish; numWords: BigNumberish; extraArgs: BytesLike; }; type RandomWordsRequestStructOutput = [ keyHash: string, subId: bigint, requestConfirmations: bigint, callbackGasLimit: bigint, numWords: bigint, extraArgs: string ] & { keyHash: string; subId: bigint; requestConfirmations: bigint; callbackGasLimit: bigint; numWords: bigint; extraArgs: string; }; } export interface ChainlinkVRFCoordinatorV2_5AdapterInterface extends Interface { getFunction(nameOrSignature: "MAX_NUM_WORDS" | "acceptOwnership" | "acceptSubscriptionOwnerTransfer" | "addConsumer" | "calculateRequestPriceNative" | "cancelSubscription" | "createSubscription" | "estimateRequestPriceNative" | "fundSubscriptionWithNative" | "getActiveSubscriptionIds" | "getSubscription" | "lastRequestId" | "owner" | "pendingRequestExists" | "randomnessSender" | "receiveRandomness" | "removeConsumer" | "requestRandomWords" | "requestSubscriptionOwnerTransfer" | "s_callbacks" | "setWrapperGasOverhead" | "transferOwnership"): FunctionFragment; getEvent(nameOrSignatureOrTopic: "OwnershipTransferRequested" | "OwnershipTransferred" | "WrapperFulfillmentFailed" | "WrapperGasOverheadUpdated"): EventFragment; encodeFunctionData(functionFragment: "MAX_NUM_WORDS", values?: undefined): string; encodeFunctionData(functionFragment: "acceptOwnership", values?: undefined): string; encodeFunctionData(functionFragment: "acceptSubscriptionOwnerTransfer", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "addConsumer", values: [BigNumberish, AddressLike]): string; encodeFunctionData(functionFragment: "calculateRequestPriceNative", values: [BigNumberish, BigNumberish]): string; encodeFunctionData(functionFragment: "cancelSubscription", values: [BigNumberish, AddressLike]): string; encodeFunctionData(functionFragment: "createSubscription", values?: undefined): string; encodeFunctionData(functionFragment: "estimateRequestPriceNative", values: [BigNumberish, BigNumberish, BigNumberish]): string; encodeFunctionData(functionFragment: "fundSubscriptionWithNative", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "getActiveSubscriptionIds", values: [BigNumberish, BigNumberish]): string; encodeFunctionData(functionFragment: "getSubscription", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "lastRequestId", values?: undefined): string; encodeFunctionData(functionFragment: "owner", values?: undefined): string; encodeFunctionData(functionFragment: "pendingRequestExists", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "randomnessSender", values?: undefined): string; encodeFunctionData(functionFragment: "receiveRandomness", values: [BigNumberish, BytesLike]): string; encodeFunctionData(functionFragment: "removeConsumer", values: [BigNumberish, AddressLike]): string; encodeFunctionData(functionFragment: "requestRandomWords", values: [VRFV2PlusClient.RandomWordsRequestStruct]): string; encodeFunctionData(functionFragment: "requestSubscriptionOwnerTransfer", values: [BigNumberish, AddressLike]): string; encodeFunctionData(functionFragment: "s_callbacks", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "setWrapperGasOverhead", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string; decodeFunctionResult(functionFragment: "MAX_NUM_WORDS", data: BytesLike): Result; decodeFunctionResult(functionFragment: "acceptOwnership", data: BytesLike): Result; decodeFunctionResult(functionFragment: "acceptSubscriptionOwnerTransfer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "addConsumer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "calculateRequestPriceNative", data: BytesLike): Result; decodeFunctionResult(functionFragment: "cancelSubscription", data: BytesLike): Result; decodeFunctionResult(functionFragment: "createSubscription", data: BytesLike): Result; decodeFunctionResult(functionFragment: "estimateRequestPriceNative", data: BytesLike): Result; decodeFunctionResult(functionFragment: "fundSubscriptionWithNative", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getActiveSubscriptionIds", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getSubscription", data: BytesLike): Result; decodeFunctionResult(functionFragment: "lastRequestId", data: BytesLike): Result; decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; decodeFunctionResult(functionFragment: "pendingRequestExists", data: BytesLike): Result; decodeFunctionResult(functionFragment: "randomnessSender", data: BytesLike): Result; decodeFunctionResult(functionFragment: "receiveRandomness", data: BytesLike): Result; decodeFunctionResult(functionFragment: "removeConsumer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "requestRandomWords", data: BytesLike): Result; decodeFunctionResult(functionFragment: "requestSubscriptionOwnerTransfer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "s_callbacks", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setWrapperGasOverhead", data: BytesLike): Result; decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result; } export declare namespace OwnershipTransferRequestedEvent { type InputTuple = [from: AddressLike, to: AddressLike]; type OutputTuple = [from: string, to: string]; interface OutputObject { from: string; to: 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 = [from: AddressLike, to: AddressLike]; type OutputTuple = [from: string, to: string]; interface OutputObject { from: string; to: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace WrapperFulfillmentFailedEvent { type InputTuple = [requestId: BigNumberish, consumer: AddressLike]; type OutputTuple = [requestId: bigint, consumer: string]; interface OutputObject { requestId: bigint; consumer: string; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export declare namespace WrapperGasOverheadUpdatedEvent { type InputTuple = [newWrapperGasOverhead: BigNumberish]; type OutputTuple = [newWrapperGasOverhead: bigint]; interface OutputObject { newWrapperGasOverhead: bigint; } type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>; type Filter = TypedDeferredTopicFilter<Event>; type Log = TypedEventLog<Event>; type LogDescription = TypedLogDescription<Event>; } export interface ChainlinkVRFCoordinatorV2_5Adapter extends BaseContract { connect(runner?: ContractRunner | null): ChainlinkVRFCoordinatorV2_5Adapter; waitForDeployment(): Promise<this>; interface: ChainlinkVRFCoordinatorV2_5AdapterInterface; 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>; MAX_NUM_WORDS: TypedContractMethod<[], [bigint], "view">; acceptOwnership: TypedContractMethod<[], [void], "nonpayable">; acceptSubscriptionOwnerTransfer: TypedContractMethod<[ subId: BigNumberish ], [ void ], "nonpayable">; addConsumer: TypedContractMethod<[ subId: BigNumberish, consumer: AddressLike ], [ void ], "nonpayable">; calculateRequestPriceNative: TypedContractMethod<[ _callbackGasLimit: BigNumberish, arg1: BigNumberish ], [ bigint ], "view">; cancelSubscription: TypedContractMethod<[ subId: BigNumberish, to: AddressLike ], [ void ], "nonpayable">; createSubscription: TypedContractMethod<[], [bigint], "nonpayable">; estimateRequestPriceNative: TypedContractMethod<[ _callbackGasLimit: BigNumberish, arg1: BigNumberish, _requestGasPriceWei: BigNumberish ], [ bigint ], "view">; fundSubscriptionWithNative: TypedContractMethod<[ subId: BigNumberish ], [ void ], "payable">; getActiveSubscriptionIds: TypedContractMethod<[ startIndex: BigNumberish, maxCount: BigNumberish ], [ bigint[] ], "view">; getSubscription: TypedContractMethod<[ subId: BigNumberish ], [ [ bigint, bigint, bigint, string, string[] ] & { balance: bigint; nativeBalance: bigint; reqCount: bigint; owner: string; consumers: string[]; } ], "view">; lastRequestId: TypedContractMethod<[], [bigint], "view">; owner: TypedContractMethod<[], [string], "view">; pendingRequestExists: TypedContractMethod<[ subId: BigNumberish ], [ boolean ], "view">; randomnessSender: TypedContractMethod<[], [string], "view">; receiveRandomness: TypedContractMethod<[ requestID: BigNumberish, randomness: BytesLike ], [ void ], "nonpayable">; removeConsumer: TypedContractMethod<[ subId: BigNumberish, consumer: AddressLike ], [ void ], "nonpayable">; requestRandomWords: TypedContractMethod<[ req: VRFV2PlusClient.RandomWordsRequestStruct ], [ bigint ], "nonpayable">; requestSubscriptionOwnerTransfer: TypedContractMethod<[ subId: BigNumberish, newOwner: AddressLike ], [ void ], "nonpayable">; s_callbacks: TypedContractMethod<[ arg0: BigNumberish ], [ [ string, bigint, bigint ] & { callbackAddress: string; callbackGasLimit: bigint; requestGasPrice: bigint; } ], "view">; setWrapperGasOverhead: TypedContractMethod<[ _s_wrapperGasOverhead: BigNumberish ], [ void ], "nonpayable">; transferOwnership: TypedContractMethod<[ to: AddressLike ], [ void ], "nonpayable">; getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; getFunction(nameOrSignature: "MAX_NUM_WORDS"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "acceptOwnership"): TypedContractMethod<[], [void], "nonpayable">; getFunction(nameOrSignature: "acceptSubscriptionOwnerTransfer"): TypedContractMethod<[subId: BigNumberish], [void], "nonpayable">; getFunction(nameOrSignature: "addConsumer"): TypedContractMethod<[ subId: BigNumberish, consumer: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "calculateRequestPriceNative"): TypedContractMethod<[ _callbackGasLimit: BigNumberish, arg1: BigNumberish ], [ bigint ], "view">; getFunction(nameOrSignature: "cancelSubscription"): TypedContractMethod<[ subId: BigNumberish, to: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "createSubscription"): TypedContractMethod<[], [bigint], "nonpayable">; getFunction(nameOrSignature: "estimateRequestPriceNative"): TypedContractMethod<[ _callbackGasLimit: BigNumberish, arg1: BigNumberish, _requestGasPriceWei: BigNumberish ], [ bigint ], "view">; getFunction(nameOrSignature: "fundSubscriptionWithNative"): TypedContractMethod<[subId: BigNumberish], [void], "payable">; getFunction(nameOrSignature: "getActiveSubscriptionIds"): TypedContractMethod<[ startIndex: BigNumberish, maxCount: BigNumberish ], [ bigint[] ], "view">; getFunction(nameOrSignature: "getSubscription"): TypedContractMethod<[ subId: BigNumberish ], [ [ bigint, bigint, bigint, string, string[] ] & { balance: bigint; nativeBalance: bigint; reqCount: bigint; owner: string; consumers: string[]; } ], "view">; getFunction(nameOrSignature: "lastRequestId"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "pendingRequestExists"): TypedContractMethod<[subId: BigNumberish], [boolean], "view">; getFunction(nameOrSignature: "randomnessSender"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "receiveRandomness"): TypedContractMethod<[ requestID: BigNumberish, randomness: BytesLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "removeConsumer"): TypedContractMethod<[ subId: BigNumberish, consumer: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "requestRandomWords"): TypedContractMethod<[ req: VRFV2PlusClient.RandomWordsRequestStruct ], [ bigint ], "nonpayable">; getFunction(nameOrSignature: "requestSubscriptionOwnerTransfer"): TypedContractMethod<[ subId: BigNumberish, newOwner: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "s_callbacks"): TypedContractMethod<[ arg0: BigNumberish ], [ [ string, bigint, bigint ] & { callbackAddress: string; callbackGasLimit: bigint; requestGasPrice: bigint; } ], "view">; getFunction(nameOrSignature: "setWrapperGasOverhead"): TypedContractMethod<[ _s_wrapperGasOverhead: BigNumberish ], [ void ], "nonpayable">; getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">; getEvent(key: "OwnershipTransferRequested"): TypedContractEvent<OwnershipTransferRequestedEvent.InputTuple, OwnershipTransferRequestedEvent.OutputTuple, OwnershipTransferRequestedEvent.OutputObject>; getEvent(key: "OwnershipTransferred"): TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>; getEvent(key: "WrapperFulfillmentFailed"): TypedContractEvent<WrapperFulfillmentFailedEvent.InputTuple, WrapperFulfillmentFailedEvent.OutputTuple, WrapperFulfillmentFailedEvent.OutputObject>; getEvent(key: "WrapperGasOverheadUpdated"): TypedContractEvent<WrapperGasOverheadUpdatedEvent.InputTuple, WrapperGasOverheadUpdatedEvent.OutputTuple, WrapperGasOverheadUpdatedEvent.OutputObject>; filters: { "OwnershipTransferRequested(address,address)": TypedContractEvent<OwnershipTransferRequestedEvent.InputTuple, OwnershipTransferRequestedEvent.OutputTuple, OwnershipTransferRequestedEvent.OutputObject>; OwnershipTransferRequested: TypedContractEvent<OwnershipTransferRequestedEvent.InputTuple, OwnershipTransferRequestedEvent.OutputTuple, OwnershipTransferRequestedEvent.OutputObject>; "OwnershipTransferred(address,address)": TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>; OwnershipTransferred: TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>; "WrapperFulfillmentFailed(uint256,address)": TypedContractEvent<WrapperFulfillmentFailedEvent.InputTuple, WrapperFulfillmentFailedEvent.OutputTuple, WrapperFulfillmentFailedEvent.OutputObject>; WrapperFulfillmentFailed: TypedContractEvent<WrapperFulfillmentFailedEvent.InputTuple, WrapperFulfillmentFailedEvent.OutputTuple, WrapperFulfillmentFailedEvent.OutputObject>; "WrapperGasOverheadUpdated(uint32)": TypedContractEvent<WrapperGasOverheadUpdatedEvent.InputTuple, WrapperGasOverheadUpdatedEvent.OutputTuple, WrapperGasOverheadUpdatedEvent.OutputObject>; WrapperGasOverheadUpdated: TypedContractEvent<WrapperGasOverheadUpdatedEvent.InputTuple, WrapperGasOverheadUpdatedEvent.OutputTuple, WrapperGasOverheadUpdatedEvent.OutputObject>; }; }