randomness-js
Version:
A library for consuming, verifying and using randomness from the dcipher network
333 lines (332 loc) • 14.6 kB
TypeScript
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "./common";
export declare namespace TypesLib {
type RandomnessRequestStruct = {
subId: BigNumberish;
directFundingFeePaid: BigNumberish;
callbackGasLimit: BigNumberish;
requestId: BigNumberish;
message: BytesLike;
condition: BytesLike;
signature: BytesLike;
nonce: BigNumberish;
callback: AddressLike;
};
type RandomnessRequestStructOutput = [
subId: bigint,
directFundingFeePaid: bigint,
callbackGasLimit: bigint,
requestId: bigint,
message: string,
condition: string,
signature: string,
nonce: bigint,
callback: string
] & {
subId: bigint;
directFundingFeePaid: bigint;
callbackGasLimit: bigint;
requestId: bigint;
message: string;
condition: string;
signature: string;
nonce: bigint;
callback: string;
};
type RandomnessRequestCreationParamsStruct = {
nonce: BigNumberish;
callback: AddressLike;
};
type RandomnessRequestCreationParamsStructOutput = [
nonce: bigint,
callback: string
] & {
nonce: bigint;
callback: string;
};
}
export interface IRandomnessSenderInterface extends Interface {
getFunction(nameOrSignature: "acceptSubscriptionOwnerTransfer" | "addConsumer" | "calculateRequestPriceNative" | "cancelSubscription" | "createSubscription" | "estimateRequestPriceNative" | "fundSubscriptionWithNative" | "getActiveSubscriptionIds" | "getAllRequests" | "getConfig" | "getRequest" | "getSubscription" | "isInFlight" | "messageFrom" | "pendingRequestExists" | "removeConsumer" | "requestRandomness" | "requestRandomnessWithSubscription" | "requestSubscriptionOwnerTransfer" | "setSignatureSender"): FunctionFragment;
encodeFunctionData(functionFragment: "acceptSubscriptionOwnerTransfer", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "addConsumer", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "calculateRequestPriceNative", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "cancelSubscription", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "createSubscription", values?: undefined): string;
encodeFunctionData(functionFragment: "estimateRequestPriceNative", values: [BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "fundSubscriptionWithNative", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "getActiveSubscriptionIds", values: [BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "getAllRequests", values?: undefined): string;
encodeFunctionData(functionFragment: "getConfig", values?: undefined): string;
encodeFunctionData(functionFragment: "getRequest", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "getSubscription", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "isInFlight", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "messageFrom", values: [TypesLib.RandomnessRequestCreationParamsStruct]): string;
encodeFunctionData(functionFragment: "pendingRequestExists", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "removeConsumer", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "requestRandomness", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "requestRandomnessWithSubscription", values: [BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "requestSubscriptionOwnerTransfer", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "setSignatureSender", values: [AddressLike]): string;
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: "getAllRequests", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getConfig", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getRequest", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isInFlight", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "messageFrom", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "pendingRequestExists", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "removeConsumer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "requestRandomness", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "requestRandomnessWithSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "requestSubscriptionOwnerTransfer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setSignatureSender", data: BytesLike): Result;
}
export interface IRandomnessSender extends BaseContract {
connect(runner?: ContractRunner | null): IRandomnessSender;
waitForDeployment(): Promise<this>;
interface: IRandomnessSenderInterface;
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>;
acceptSubscriptionOwnerTransfer: TypedContractMethod<[
subId: BigNumberish
], [
void
], "nonpayable">;
addConsumer: TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
calculateRequestPriceNative: TypedContractMethod<[
_callbackGasLimit: BigNumberish
], [
bigint
], "view">;
cancelSubscription: TypedContractMethod<[
subId: BigNumberish,
to: AddressLike
], [
void
], "nonpayable">;
createSubscription: TypedContractMethod<[], [bigint], "nonpayable">;
estimateRequestPriceNative: TypedContractMethod<[
_callbackGasLimit: BigNumberish,
_requestGasPriceWei: BigNumberish
], [
bigint
], "view">;
fundSubscriptionWithNative: TypedContractMethod<[
subId: BigNumberish
], [
void
], "payable">;
getActiveSubscriptionIds: TypedContractMethod<[
startIndex: BigNumberish,
maxCount: BigNumberish
], [
bigint[]
], "view">;
getAllRequests: TypedContractMethod<[
], [
TypesLib.RandomnessRequestStructOutput[]
], "view">;
getConfig: TypedContractMethod<[
], [
[
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint
] & {
maxGasLimit: bigint;
gasAfterPaymentCalculation: bigint;
fulfillmentFlatFeeNativePPM: bigint;
weiPerUnitGas: bigint;
blsPairingCheckOverhead: bigint;
nativePremiumPercentage: bigint;
gasForCallExactCheck: bigint;
}
], "view">;
getRequest: TypedContractMethod<[
requestId: BigNumberish
], [
TypesLib.RandomnessRequestStructOutput
], "view">;
getSubscription: TypedContractMethod<[
subId: BigNumberish
], [
[
bigint,
bigint,
string,
string[]
] & {
nativeBalance: bigint;
reqCount: bigint;
owner: string;
consumers: string[];
}
], "view">;
isInFlight: TypedContractMethod<[requestId: BigNumberish], [boolean], "view">;
messageFrom: TypedContractMethod<[
r: TypesLib.RandomnessRequestCreationParamsStruct
], [
string
], "view">;
pendingRequestExists: TypedContractMethod<[
subId: BigNumberish
], [
boolean
], "view">;
removeConsumer: TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
requestRandomness: TypedContractMethod<[
callbackGasLimit: BigNumberish
], [
bigint
], "payable">;
requestRandomnessWithSubscription: TypedContractMethod<[
callbackGasLimit: BigNumberish,
subId: BigNumberish
], [
bigint
], "payable">;
requestSubscriptionOwnerTransfer: TypedContractMethod<[
subId: BigNumberish,
newOwner: AddressLike
], [
void
], "nonpayable">;
setSignatureSender: TypedContractMethod<[
newSignatureSender: AddressLike
], [
void
], "nonpayable">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "acceptSubscriptionOwnerTransfer"): TypedContractMethod<[subId: BigNumberish], [void], "nonpayable">;
getFunction(nameOrSignature: "addConsumer"): TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "calculateRequestPriceNative"): TypedContractMethod<[_callbackGasLimit: 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,
_requestGasPriceWei: BigNumberish
], [
bigint
], "view">;
getFunction(nameOrSignature: "fundSubscriptionWithNative"): TypedContractMethod<[subId: BigNumberish], [void], "payable">;
getFunction(nameOrSignature: "getActiveSubscriptionIds"): TypedContractMethod<[
startIndex: BigNumberish,
maxCount: BigNumberish
], [
bigint[]
], "view">;
getFunction(nameOrSignature: "getAllRequests"): TypedContractMethod<[
], [
TypesLib.RandomnessRequestStructOutput[]
], "view">;
getFunction(nameOrSignature: "getConfig"): TypedContractMethod<[
], [
[
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint
] & {
maxGasLimit: bigint;
gasAfterPaymentCalculation: bigint;
fulfillmentFlatFeeNativePPM: bigint;
weiPerUnitGas: bigint;
blsPairingCheckOverhead: bigint;
nativePremiumPercentage: bigint;
gasForCallExactCheck: bigint;
}
], "view">;
getFunction(nameOrSignature: "getRequest"): TypedContractMethod<[
requestId: BigNumberish
], [
TypesLib.RandomnessRequestStructOutput
], "view">;
getFunction(nameOrSignature: "getSubscription"): TypedContractMethod<[
subId: BigNumberish
], [
[
bigint,
bigint,
string,
string[]
] & {
nativeBalance: bigint;
reqCount: bigint;
owner: string;
consumers: string[];
}
], "view">;
getFunction(nameOrSignature: "isInFlight"): TypedContractMethod<[requestId: BigNumberish], [boolean], "view">;
getFunction(nameOrSignature: "messageFrom"): TypedContractMethod<[
r: TypesLib.RandomnessRequestCreationParamsStruct
], [
string
], "view">;
getFunction(nameOrSignature: "pendingRequestExists"): TypedContractMethod<[subId: BigNumberish], [boolean], "view">;
getFunction(nameOrSignature: "removeConsumer"): TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "requestRandomness"): TypedContractMethod<[callbackGasLimit: BigNumberish], [bigint], "payable">;
getFunction(nameOrSignature: "requestRandomnessWithSubscription"): TypedContractMethod<[
callbackGasLimit: BigNumberish,
subId: BigNumberish
], [
bigint
], "payable">;
getFunction(nameOrSignature: "requestSubscriptionOwnerTransfer"): TypedContractMethod<[
subId: BigNumberish,
newOwner: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "setSignatureSender"): TypedContractMethod<[
newSignatureSender: AddressLike
], [
void
], "nonpayable">;
filters: {};
}