randomness-js
Version:
A library for consuming, verifying and using randomness from the dcipher network
275 lines (274 loc) • 14.4 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 interface ChainlinkVRFV2PlusWrapperAdapterInterface extends Interface {
getFunction(nameOrSignature: "acceptOwnership" | "calculateRequestPriceNative" | "estimateRequestPriceNative" | "getConfig" | "lastRequestId" | "owner" | "randomnessSender" | "receiveRandomness" | "requestRandomWordsInNative" | "s_callbacks" | "setWrapperGasOverhead" | "transferOwnership" | "typeAndVersion"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "OwnershipTransferRequested" | "OwnershipTransferred" | "WrapperFulfillmentFailed" | "WrapperGasOverheadUpdated"): EventFragment;
encodeFunctionData(functionFragment: "acceptOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "calculateRequestPriceNative", values: [BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "estimateRequestPriceNative", values: [BigNumberish, BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "getConfig", values?: undefined): string;
encodeFunctionData(functionFragment: "lastRequestId", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "randomnessSender", values?: undefined): string;
encodeFunctionData(functionFragment: "receiveRandomness", values: [BigNumberish, BytesLike]): string;
encodeFunctionData(functionFragment: "requestRandomWordsInNative", values: [BigNumberish, BigNumberish, BigNumberish, BytesLike]): string;
encodeFunctionData(functionFragment: "s_callbacks", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "setWrapperGasOverhead", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "typeAndVersion", values?: undefined): string;
decodeFunctionResult(functionFragment: "acceptOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "calculateRequestPriceNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "estimateRequestPriceNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getConfig", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "lastRequestId", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "randomnessSender", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "receiveRandomness", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "requestRandomWordsInNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "s_callbacks", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setWrapperGasOverhead", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "typeAndVersion", 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 ChainlinkVRFV2PlusWrapperAdapter extends BaseContract {
connect(runner?: ContractRunner | null): ChainlinkVRFV2PlusWrapperAdapter;
waitForDeployment(): Promise<this>;
interface: ChainlinkVRFV2PlusWrapperAdapterInterface;
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>;
acceptOwnership: TypedContractMethod<[], [void], "nonpayable">;
calculateRequestPriceNative: TypedContractMethod<[
_callbackGasLimit: BigNumberish,
arg1: BigNumberish
], [
bigint
], "view">;
estimateRequestPriceNative: TypedContractMethod<[
_callbackGasLimit: BigNumberish,
arg1: BigNumberish,
_requestGasPriceWei: BigNumberish
], [
bigint
], "view">;
getConfig: TypedContractMethod<[
], [
[
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
string,
bigint
] & {
fallbackWeiPerUnitLink: bigint;
stalenessSeconds: bigint;
fulfillmentFlatFeeNativePPM: bigint;
fulfillmentFlatFeeLinkDiscountPPM: bigint;
wrapperGasOverhead: bigint;
coordinatorGasOverheadNative: bigint;
coordinatorGasOverheadLink: bigint;
coordinatorGasOverheadPerWord: bigint;
wrapperNativePremiumPercentage: bigint;
wrapperLinkPremiumPercentage: bigint;
keyHash: string;
maxNumWords: bigint;
}
], "view">;
lastRequestId: TypedContractMethod<[], [bigint], "view">;
owner: TypedContractMethod<[], [string], "view">;
randomnessSender: TypedContractMethod<[], [string], "view">;
receiveRandomness: TypedContractMethod<[
requestID: BigNumberish,
randomness: BytesLike
], [
void
], "nonpayable">;
requestRandomWordsInNative: TypedContractMethod<[
_callbackGasLimit: BigNumberish,
arg1: BigNumberish,
arg2: BigNumberish,
arg3: BytesLike
], [
bigint
], "payable">;
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">;
typeAndVersion: TypedContractMethod<[], [string], "view">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "acceptOwnership"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "calculateRequestPriceNative"): TypedContractMethod<[
_callbackGasLimit: BigNumberish,
arg1: BigNumberish
], [
bigint
], "view">;
getFunction(nameOrSignature: "estimateRequestPriceNative"): TypedContractMethod<[
_callbackGasLimit: BigNumberish,
arg1: BigNumberish,
_requestGasPriceWei: BigNumberish
], [
bigint
], "view">;
getFunction(nameOrSignature: "getConfig"): TypedContractMethod<[
], [
[
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
string,
bigint
] & {
fallbackWeiPerUnitLink: bigint;
stalenessSeconds: bigint;
fulfillmentFlatFeeNativePPM: bigint;
fulfillmentFlatFeeLinkDiscountPPM: bigint;
wrapperGasOverhead: bigint;
coordinatorGasOverheadNative: bigint;
coordinatorGasOverheadLink: bigint;
coordinatorGasOverheadPerWord: bigint;
wrapperNativePremiumPercentage: bigint;
wrapperLinkPremiumPercentage: bigint;
keyHash: string;
maxNumWords: bigint;
}
], "view">;
getFunction(nameOrSignature: "lastRequestId"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "randomnessSender"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "receiveRandomness"): TypedContractMethod<[
requestID: BigNumberish,
randomness: BytesLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "requestRandomWordsInNative"): TypedContractMethod<[
_callbackGasLimit: BigNumberish,
arg1: BigNumberish,
arg2: BigNumberish,
arg3: BytesLike
], [
bigint
], "payable">;
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">;
getFunction(nameOrSignature: "typeAndVersion"): TypedContractMethod<[], [string], "view">;
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>;
};
}