randomness-js
Version:
A library for consuming, verifying and using randomness from the dcipher network
351 lines (350 loc) • 19.2 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 SubscriptionAPIInterface extends Interface {
getFunction(nameOrSignature: "MAX_CONSUMERS" | "acceptSubscriptionOwnerTransfer" | "addConsumer" | "cancelSubscription" | "createSubscription" | "fundSubscriptionWithNative" | "getActiveSubscriptionIds" | "getSubscription" | "pendingRequestExists" | "removeConsumer" | "requestSubscriptionOwnerTransfer" | "s_config" | "s_currentSubNonce" | "s_totalNativeBalance" | "s_withdrawableDirectFundingFeeNative" | "s_withdrawableSubscriptionFeeNative"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "SubscriptionCanceled" | "SubscriptionConsumerAdded" | "SubscriptionConsumerRemoved" | "SubscriptionCreated" | "SubscriptionFundedWithNative" | "SubscriptionOwnerTransferRequested" | "SubscriptionOwnerTransferred"): EventFragment;
encodeFunctionData(functionFragment: "MAX_CONSUMERS", values?: undefined): string;
encodeFunctionData(functionFragment: "acceptSubscriptionOwnerTransfer", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "addConsumer", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "cancelSubscription", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "createSubscription", values?: undefined): string;
encodeFunctionData(functionFragment: "fundSubscriptionWithNative", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "getActiveSubscriptionIds", values: [BigNumberish, BigNumberish]): string;
encodeFunctionData(functionFragment: "getSubscription", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "pendingRequestExists", values: [BigNumberish]): string;
encodeFunctionData(functionFragment: "removeConsumer", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "requestSubscriptionOwnerTransfer", values: [BigNumberish, AddressLike]): string;
encodeFunctionData(functionFragment: "s_config", values?: undefined): string;
encodeFunctionData(functionFragment: "s_currentSubNonce", values?: undefined): string;
encodeFunctionData(functionFragment: "s_totalNativeBalance", values?: undefined): string;
encodeFunctionData(functionFragment: "s_withdrawableDirectFundingFeeNative", values?: undefined): string;
encodeFunctionData(functionFragment: "s_withdrawableSubscriptionFeeNative", values?: undefined): string;
decodeFunctionResult(functionFragment: "MAX_CONSUMERS", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "acceptSubscriptionOwnerTransfer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "addConsumer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "cancelSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "createSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "fundSubscriptionWithNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getActiveSubscriptionIds", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "pendingRequestExists", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "removeConsumer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "requestSubscriptionOwnerTransfer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "s_config", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "s_currentSubNonce", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "s_totalNativeBalance", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "s_withdrawableDirectFundingFeeNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "s_withdrawableSubscriptionFeeNative", data: BytesLike): Result;
}
export declare namespace SubscriptionCanceledEvent {
type InputTuple = [
subId: BigNumberish,
to: AddressLike,
amountNative: BigNumberish
];
type OutputTuple = [subId: bigint, to: string, amountNative: bigint];
interface OutputObject {
subId: bigint;
to: string;
amountNative: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SubscriptionConsumerAddedEvent {
type InputTuple = [subId: BigNumberish, consumer: AddressLike];
type OutputTuple = [subId: bigint, consumer: string];
interface OutputObject {
subId: bigint;
consumer: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SubscriptionConsumerRemovedEvent {
type InputTuple = [subId: BigNumberish, consumer: AddressLike];
type OutputTuple = [subId: bigint, consumer: string];
interface OutputObject {
subId: bigint;
consumer: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SubscriptionCreatedEvent {
type InputTuple = [subId: BigNumberish, owner: AddressLike];
type OutputTuple = [subId: bigint, owner: string];
interface OutputObject {
subId: bigint;
owner: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SubscriptionFundedWithNativeEvent {
type InputTuple = [
subId: BigNumberish,
oldNativeBalance: BigNumberish,
newNativeBalance: BigNumberish
];
type OutputTuple = [
subId: bigint,
oldNativeBalance: bigint,
newNativeBalance: bigint
];
interface OutputObject {
subId: bigint;
oldNativeBalance: bigint;
newNativeBalance: bigint;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace SubscriptionOwnerTransferRequestedEvent {
type InputTuple = [
subId: BigNumberish,
from: AddressLike,
to: AddressLike
];
type OutputTuple = [subId: bigint, from: string, to: string];
interface OutputObject {
subId: bigint;
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 SubscriptionOwnerTransferredEvent {
type InputTuple = [
subId: BigNumberish,
from: AddressLike,
to: AddressLike
];
type OutputTuple = [subId: bigint, from: string, to: string];
interface OutputObject {
subId: bigint;
from: string;
to: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export interface SubscriptionAPI extends BaseContract {
connect(runner?: ContractRunner | null): SubscriptionAPI;
waitForDeployment(): Promise<this>;
interface: SubscriptionAPIInterface;
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_CONSUMERS: TypedContractMethod<[], [bigint], "view">;
acceptSubscriptionOwnerTransfer: TypedContractMethod<[
subId: BigNumberish
], [
void
], "nonpayable">;
addConsumer: TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
cancelSubscription: TypedContractMethod<[
subId: BigNumberish,
to: AddressLike
], [
void
], "nonpayable">;
createSubscription: TypedContractMethod<[], [bigint], "nonpayable">;
fundSubscriptionWithNative: TypedContractMethod<[
subId: BigNumberish
], [
void
], "payable">;
getActiveSubscriptionIds: TypedContractMethod<[
startIndex: BigNumberish,
maxCount: BigNumberish
], [
bigint[]
], "view">;
getSubscription: TypedContractMethod<[
subId: BigNumberish
], [
[
bigint,
bigint,
string,
string[]
] & {
nativeBalance: bigint;
reqCount: bigint;
subOwner: string;
consumers: string[];
}
], "view">;
pendingRequestExists: TypedContractMethod<[
subId: BigNumberish
], [
boolean
], "view">;
removeConsumer: TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
requestSubscriptionOwnerTransfer: TypedContractMethod<[
subId: BigNumberish,
newOwner: AddressLike
], [
void
], "nonpayable">;
s_config: TypedContractMethod<[
], [
[
bigint,
bigint,
bigint,
bigint,
bigint,
bigint,
bigint
] & {
maxGasLimit: bigint;
gasAfterPaymentCalculation: bigint;
fulfillmentFlatFeeNativePPM: bigint;
weiPerUnitGas: bigint;
blsPairingCheckOverhead: bigint;
nativePremiumPercentage: bigint;
gasForCallExactCheck: bigint;
}
], "view">;
s_currentSubNonce: TypedContractMethod<[], [bigint], "view">;
s_totalNativeBalance: TypedContractMethod<[], [bigint], "view">;
s_withdrawableDirectFundingFeeNative: TypedContractMethod<[
], [
bigint
], "view">;
s_withdrawableSubscriptionFeeNative: TypedContractMethod<[
], [
bigint
], "view">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "MAX_CONSUMERS"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "acceptSubscriptionOwnerTransfer"): TypedContractMethod<[subId: BigNumberish], [void], "nonpayable">;
getFunction(nameOrSignature: "addConsumer"): TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "cancelSubscription"): TypedContractMethod<[
subId: BigNumberish,
to: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "createSubscription"): TypedContractMethod<[], [bigint], "nonpayable">;
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,
string,
string[]
] & {
nativeBalance: bigint;
reqCount: bigint;
subOwner: string;
consumers: string[];
}
], "view">;
getFunction(nameOrSignature: "pendingRequestExists"): TypedContractMethod<[subId: BigNumberish], [boolean], "view">;
getFunction(nameOrSignature: "removeConsumer"): TypedContractMethod<[
subId: BigNumberish,
consumer: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "requestSubscriptionOwnerTransfer"): TypedContractMethod<[
subId: BigNumberish,
newOwner: AddressLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "s_config"): 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: "s_currentSubNonce"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "s_totalNativeBalance"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "s_withdrawableDirectFundingFeeNative"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "s_withdrawableSubscriptionFeeNative"): TypedContractMethod<[], [bigint], "view">;
getEvent(key: "SubscriptionCanceled"): TypedContractEvent<SubscriptionCanceledEvent.InputTuple, SubscriptionCanceledEvent.OutputTuple, SubscriptionCanceledEvent.OutputObject>;
getEvent(key: "SubscriptionConsumerAdded"): TypedContractEvent<SubscriptionConsumerAddedEvent.InputTuple, SubscriptionConsumerAddedEvent.OutputTuple, SubscriptionConsumerAddedEvent.OutputObject>;
getEvent(key: "SubscriptionConsumerRemoved"): TypedContractEvent<SubscriptionConsumerRemovedEvent.InputTuple, SubscriptionConsumerRemovedEvent.OutputTuple, SubscriptionConsumerRemovedEvent.OutputObject>;
getEvent(key: "SubscriptionCreated"): TypedContractEvent<SubscriptionCreatedEvent.InputTuple, SubscriptionCreatedEvent.OutputTuple, SubscriptionCreatedEvent.OutputObject>;
getEvent(key: "SubscriptionFundedWithNative"): TypedContractEvent<SubscriptionFundedWithNativeEvent.InputTuple, SubscriptionFundedWithNativeEvent.OutputTuple, SubscriptionFundedWithNativeEvent.OutputObject>;
getEvent(key: "SubscriptionOwnerTransferRequested"): TypedContractEvent<SubscriptionOwnerTransferRequestedEvent.InputTuple, SubscriptionOwnerTransferRequestedEvent.OutputTuple, SubscriptionOwnerTransferRequestedEvent.OutputObject>;
getEvent(key: "SubscriptionOwnerTransferred"): TypedContractEvent<SubscriptionOwnerTransferredEvent.InputTuple, SubscriptionOwnerTransferredEvent.OutputTuple, SubscriptionOwnerTransferredEvent.OutputObject>;
filters: {
"SubscriptionCanceled(uint256,address,uint256)": TypedContractEvent<SubscriptionCanceledEvent.InputTuple, SubscriptionCanceledEvent.OutputTuple, SubscriptionCanceledEvent.OutputObject>;
SubscriptionCanceled: TypedContractEvent<SubscriptionCanceledEvent.InputTuple, SubscriptionCanceledEvent.OutputTuple, SubscriptionCanceledEvent.OutputObject>;
"SubscriptionConsumerAdded(uint256,address)": TypedContractEvent<SubscriptionConsumerAddedEvent.InputTuple, SubscriptionConsumerAddedEvent.OutputTuple, SubscriptionConsumerAddedEvent.OutputObject>;
SubscriptionConsumerAdded: TypedContractEvent<SubscriptionConsumerAddedEvent.InputTuple, SubscriptionConsumerAddedEvent.OutputTuple, SubscriptionConsumerAddedEvent.OutputObject>;
"SubscriptionConsumerRemoved(uint256,address)": TypedContractEvent<SubscriptionConsumerRemovedEvent.InputTuple, SubscriptionConsumerRemovedEvent.OutputTuple, SubscriptionConsumerRemovedEvent.OutputObject>;
SubscriptionConsumerRemoved: TypedContractEvent<SubscriptionConsumerRemovedEvent.InputTuple, SubscriptionConsumerRemovedEvent.OutputTuple, SubscriptionConsumerRemovedEvent.OutputObject>;
"SubscriptionCreated(uint256,address)": TypedContractEvent<SubscriptionCreatedEvent.InputTuple, SubscriptionCreatedEvent.OutputTuple, SubscriptionCreatedEvent.OutputObject>;
SubscriptionCreated: TypedContractEvent<SubscriptionCreatedEvent.InputTuple, SubscriptionCreatedEvent.OutputTuple, SubscriptionCreatedEvent.OutputObject>;
"SubscriptionFundedWithNative(uint256,uint256,uint256)": TypedContractEvent<SubscriptionFundedWithNativeEvent.InputTuple, SubscriptionFundedWithNativeEvent.OutputTuple, SubscriptionFundedWithNativeEvent.OutputObject>;
SubscriptionFundedWithNative: TypedContractEvent<SubscriptionFundedWithNativeEvent.InputTuple, SubscriptionFundedWithNativeEvent.OutputTuple, SubscriptionFundedWithNativeEvent.OutputObject>;
"SubscriptionOwnerTransferRequested(uint256,address,address)": TypedContractEvent<SubscriptionOwnerTransferRequestedEvent.InputTuple, SubscriptionOwnerTransferRequestedEvent.OutputTuple, SubscriptionOwnerTransferRequestedEvent.OutputObject>;
SubscriptionOwnerTransferRequested: TypedContractEvent<SubscriptionOwnerTransferRequestedEvent.InputTuple, SubscriptionOwnerTransferRequestedEvent.OutputTuple, SubscriptionOwnerTransferRequestedEvent.OutputObject>;
"SubscriptionOwnerTransferred(uint256,address,address)": TypedContractEvent<SubscriptionOwnerTransferredEvent.InputTuple, SubscriptionOwnerTransferredEvent.OutputTuple, SubscriptionOwnerTransferredEvent.OutputObject>;
SubscriptionOwnerTransferred: TypedContractEvent<SubscriptionOwnerTransferredEvent.InputTuple, SubscriptionOwnerTransferredEvent.OutputTuple, SubscriptionOwnerTransferredEvent.OutputObject>;
};
}