blocklock-js
Version:
A library for encrypting and decrypting data for the future
304 lines (303 loc) • 17.5 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 declare namespace BLS {
type PointG2Struct = {
x: [BigNumberish, BigNumberish];
y: [BigNumberish, BigNumberish];
};
type PointG2StructOutput = [
x: [bigint, bigint],
y: [bigint, bigint]
] & {
x: [bigint, bigint];
y: [bigint, bigint];
};
}
export declare namespace TypesLib {
type CiphertextStruct = {
u: BLS.PointG2Struct;
v: BytesLike;
w: BytesLike;
};
type CiphertextStructOutput = [
u: BLS.PointG2StructOutput,
v: string,
w: string
] & {
u: BLS.PointG2StructOutput;
v: string;
w: string;
};
}
export interface MockBlocklockReceiverInterface extends Interface {
getFunction(nameOrSignature: "acceptOwnership" | "blocklock" | "cancelSubscription" | "createSubscriptionAndFundNative" | "createTimelockRequestWithDirectFunding" | "createTimelockRequestWithSubscription" | "encryptedValue" | "fundContractNative" | "getBalance" | "owner" | "plainTextValue" | "receiveBlocklock" | "requestId" | "setBlocklock" | "setSubId" | "subscriptionId" | "topUpSubscriptionNative" | "transferOwnership" | "updateSubscription" | "withdrawNative"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "Funded" | "NewSubscriptionId" | "OwnershipTransferRequested" | "OwnershipTransferred" | "Received" | "Withdrawn"): EventFragment;
encodeFunctionData(functionFragment: "acceptOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "blocklock", values?: undefined): string;
encodeFunctionData(functionFragment: "cancelSubscription", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "createSubscriptionAndFundNative", values?: undefined): string;
encodeFunctionData(functionFragment: "createTimelockRequestWithDirectFunding", values: [BigNumberish, BytesLike, TypesLib.CiphertextStruct]): string;
encodeFunctionData(functionFragment: "createTimelockRequestWithSubscription", values: [BigNumberish, BytesLike, TypesLib.CiphertextStruct]): string;
encodeFunctionData(functionFragment: "encryptedValue", values?: undefined): string;
encodeFunctionData(functionFragment: "fundContractNative", values?: undefined): string;
encodeFunctionData(functionFragment: "getBalance", values?: undefined): string;
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
encodeFunctionData(functionFragment: "plainTextValue", values?: undefined): string;
encodeFunctionData(functionFragment: "receiveBlocklock", values: [BigNumberish, BytesLike]): string;
encodeFunctionData(functionFragment: "requestId", values?: undefined): string;
encodeFunctionData(functionFragment: "setBlocklock", 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;
encodeFunctionData(functionFragment: "withdrawNative", values: [BigNumberish, AddressLike]): string;
decodeFunctionResult(functionFragment: "acceptOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "blocklock", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "cancelSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "createSubscriptionAndFundNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "createTimelockRequestWithDirectFunding", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "createTimelockRequestWithSubscription", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "encryptedValue", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "fundContractNative", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getBalance", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "plainTextValue", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "receiveBlocklock", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "requestId", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setBlocklock", 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;
decodeFunctionResult(functionFragment: "withdrawNative", 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 MockBlocklockReceiver extends BaseContract {
connect(runner?: ContractRunner | null): MockBlocklockReceiver;
waitForDeployment(): Promise<this>;
interface: MockBlocklockReceiverInterface;
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">;
blocklock: TypedContractMethod<[], [string], "view">;
cancelSubscription: TypedContractMethod<[
to: AddressLike
], [
void
], "nonpayable">;
createSubscriptionAndFundNative: TypedContractMethod<[], [void], "payable">;
createTimelockRequestWithDirectFunding: TypedContractMethod<[
callbackGasLimit: BigNumberish,
condition: BytesLike,
encryptedData: TypesLib.CiphertextStruct
], [
[bigint, bigint]
], "nonpayable">;
createTimelockRequestWithSubscription: TypedContractMethod<[
callbackGasLimit: BigNumberish,
condition: BytesLike,
encryptedData: TypesLib.CiphertextStruct
], [
bigint
], "payable">;
encryptedValue: TypedContractMethod<[
], [
[
BLS.PointG2StructOutput,
string,
string
] & {
u: BLS.PointG2StructOutput;
v: string;
w: string;
}
], "view">;
fundContractNative: TypedContractMethod<[], [void], "payable">;
getBalance: TypedContractMethod<[], [bigint], "view">;
owner: TypedContractMethod<[], [string], "view">;
plainTextValue: TypedContractMethod<[], [bigint], "view">;
receiveBlocklock: TypedContractMethod<[
requestID: BigNumberish,
decryptionKey: BytesLike
], [
void
], "nonpayable">;
requestId: TypedContractMethod<[], [bigint], "view">;
setBlocklock: TypedContractMethod<[
_blocklock: 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">;
withdrawNative: TypedContractMethod<[
amount: BigNumberish,
recipient: AddressLike
], [
void
], "nonpayable">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "acceptOwnership"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "blocklock"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "cancelSubscription"): TypedContractMethod<[to: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "createSubscriptionAndFundNative"): TypedContractMethod<[], [void], "payable">;
getFunction(nameOrSignature: "createTimelockRequestWithDirectFunding"): TypedContractMethod<[
callbackGasLimit: BigNumberish,
condition: BytesLike,
encryptedData: TypesLib.CiphertextStruct
], [
[bigint, bigint]
], "nonpayable">;
getFunction(nameOrSignature: "createTimelockRequestWithSubscription"): TypedContractMethod<[
callbackGasLimit: BigNumberish,
condition: BytesLike,
encryptedData: TypesLib.CiphertextStruct
], [
bigint
], "payable">;
getFunction(nameOrSignature: "encryptedValue"): TypedContractMethod<[
], [
[
BLS.PointG2StructOutput,
string,
string
] & {
u: BLS.PointG2StructOutput;
v: string;
w: string;
}
], "view">;
getFunction(nameOrSignature: "fundContractNative"): TypedContractMethod<[], [void], "payable">;
getFunction(nameOrSignature: "getBalance"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "owner"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "plainTextValue"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "receiveBlocklock"): TypedContractMethod<[
requestID: BigNumberish,
decryptionKey: BytesLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "requestId"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "setBlocklock"): TypedContractMethod<[_blocklock: 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">;
getFunction(nameOrSignature: "withdrawNative"): TypedContractMethod<[
amount: BigNumberish,
recipient: 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>;
};
}