randomness-js
Version:
A library for consuming, verifying and using randomness from the dcipher network
199 lines (198 loc) • 13.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 RandomnessReceiverBaseInterface extends Interface {
getFunction(nameOrSignature: "acceptOwnership" | "createSubscriptionAndFundNative" | "getBalance" | "isInFlight" | "owner" | "pendingRequestExists" | "randomnessSender" | "receiveRandomness" | "setRandomnessSender" | "setSubId" | "subscriptionId" | "topUpSubscriptionNative" | "transferOwnership" | "updateSubscription"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "Funded" | "NewSubscriptionId" | "OwnershipTransferRequested" | "OwnershipTransferred" | "Received" | "Withdrawn"): EventFragment;
encodeFunctionData(functionFragment: "acceptOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "createSubscriptionAndFundNative", values?: undefined): string;
encodeFunctionData(functionFragment: "getBalance", values?: undefined): string;
encodeFunctionData(functionFragment: "isInFlight", values: [BigNumberish]): 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: "setRandomnessSender", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "setSubId", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "subscriptionId", values?: undefined): string;
encodeFunctionData(functionFragment: "topUpSubscriptionNative", values?: undefined): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "updateSubscription", values: [AddressLike[]]): string;
decodeFunctionResult(functionFragment: "acceptOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "createSubscriptionAndFundNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getBalance", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isInFlight", 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: "setRandomnessSender", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setSubId", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "subscriptionId", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "topUpSubscriptionNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updateSubscription", data: BytesLike): Result;
}
export declare namespace FundedEvent {
type InputTuple = [sender: AddressLike, amount: BigNumberish];
type OutputTuple = [sender: string, amount: bigint];
interface OutputObject {
sender: string;
amount: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace NewSubscriptionIdEvent {
type InputTuple = [subscriptionId: BigNumberish];
type OutputTuple = [subscriptionId: bigint];
interface OutputObject {
subscriptionId: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
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 ReceivedEvent {
type InputTuple = [arg0: AddressLike, arg1: BigNumberish];
type OutputTuple = [arg0: string, arg1: bigint];
interface OutputObject {
arg0: string;
arg1: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace WithdrawnEvent {
type InputTuple = [recipient: AddressLike, amount: BigNumberish];
type OutputTuple = [recipient: string, amount: bigint];
interface OutputObject {
recipient: string;
amount: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export interface RandomnessReceiverBase extends BaseContract {
connect(runner?: ContractRunner | null): RandomnessReceiverBase;
waitForDeployment(): Promise<this>;
interface: RandomnessReceiverBaseInterface;
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">;
createSubscriptionAndFundNative: TypedContractMethod<[], [void], "payable">;
getBalance: TypedContractMethod<[], [bigint], "view">;
isInFlight: TypedContractMethod<[requestId: BigNumberish], [boolean], "view">;
owner: TypedContractMethod<[], [string], "view">;
pendingRequestExists: TypedContractMethod<[
subId: BigNumberish
], [
boolean
], "view">;
randomnessSender: TypedContractMethod<[], [string], "view">;
receiveRandomness: TypedContractMethod<[
requestID: BigNumberish,
randomness: BytesLike
], [
void
], "nonpayable">;
setRandomnessSender: TypedContractMethod<[
_randomnessSender: AddressLike
], [
void
], "nonpayable">;
setSubId: TypedContractMethod<[subId: BigNumberish], [void], "nonpayable">;
subscriptionId: TypedContractMethod<[], [bigint], "view">;
topUpSubscriptionNative: TypedContractMethod<[], [void], "payable">;
transferOwnership: TypedContractMethod<[
to: AddressLike
], [
void
], "nonpayable">;
updateSubscription: TypedContractMethod<[
consumers: AddressLike[]
], [
void
], "nonpayable">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "acceptOwnership"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "createSubscriptionAndFundNative"): TypedContractMethod<[], [void], "payable">;
getFunction(nameOrSignature: "getBalance"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "isInFlight"): TypedContractMethod<[requestId: BigNumberish], [boolean], "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: "setRandomnessSender"): TypedContractMethod<[
_randomnessSender: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "setSubId"): TypedContractMethod<[subId: BigNumberish], [void], "nonpayable">;
getFunction(nameOrSignature: "subscriptionId"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "topUpSubscriptionNative"): TypedContractMethod<[], [void], "payable">;
getFunction(nameOrSignature: "transferOwnership"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "updateSubscription"): TypedContractMethod<[consumers: AddressLike[]], [void], "nonpayable">;
getEvent(key: "Funded"): TypedContractEvent<FundedEvent.InputTuple, FundedEvent.OutputTuple, FundedEvent.OutputObject>;
getEvent(key: "NewSubscriptionId"): TypedContractEvent<NewSubscriptionIdEvent.InputTuple, NewSubscriptionIdEvent.OutputTuple, NewSubscriptionIdEvent.OutputObject>;
getEvent(key: "OwnershipTransferRequested"): TypedContractEvent<OwnershipTransferRequestedEvent.InputTuple, OwnershipTransferRequestedEvent.OutputTuple, OwnershipTransferRequestedEvent.OutputObject>;
getEvent(key: "OwnershipTransferred"): TypedContractEvent<OwnershipTransferredEvent.InputTuple, OwnershipTransferredEvent.OutputTuple, OwnershipTransferredEvent.OutputObject>;
getEvent(key: "Received"): TypedContractEvent<ReceivedEvent.InputTuple, ReceivedEvent.OutputTuple, ReceivedEvent.OutputObject>;
getEvent(key: "Withdrawn"): TypedContractEvent<WithdrawnEvent.InputTuple, WithdrawnEvent.OutputTuple, WithdrawnEvent.OutputObject>;
filters: {
"Funded(address,uint256)": TypedContractEvent<FundedEvent.InputTuple, FundedEvent.OutputTuple, FundedEvent.OutputObject>;
Funded: TypedContractEvent<FundedEvent.InputTuple, FundedEvent.OutputTuple, FundedEvent.OutputObject>;
"NewSubscriptionId(uint256)": TypedContractEvent<NewSubscriptionIdEvent.InputTuple, NewSubscriptionIdEvent.OutputTuple, NewSubscriptionIdEvent.OutputObject>;
NewSubscriptionId: TypedContractEvent<NewSubscriptionIdEvent.InputTuple, NewSubscriptionIdEvent.OutputTuple, NewSubscriptionIdEvent.OutputObject>;
"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>;
"Received(address,uint256)": TypedContractEvent<ReceivedEvent.InputTuple, ReceivedEvent.OutputTuple, ReceivedEvent.OutputObject>;
Received: TypedContractEvent<ReceivedEvent.InputTuple, ReceivedEvent.OutputTuple, ReceivedEvent.OutputObject>;
"Withdrawn(address,uint256)": TypedContractEvent<WithdrawnEvent.InputTuple, WithdrawnEvent.OutputTuple, WithdrawnEvent.OutputObject>;
Withdrawn: TypedContractEvent<WithdrawnEvent.InputTuple, WithdrawnEvent.OutputTuple, WithdrawnEvent.OutputObject>;
};
}