UNPKG

blocklock-js

Version:

A library for encrypting and decrypting data for the future

315 lines (314 loc) 14 kB
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 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; }; type BlocklockRequestStruct = { subId: BigNumberish; directFundingFeePaid: BigNumberish; callbackGasLimit: BigNumberish; decryptionRequestID: BigNumberish; condition: BytesLike; ciphertext: TypesLib.CiphertextStruct; signature: BytesLike; decryptionKey: BytesLike; callback: AddressLike; }; type BlocklockRequestStructOutput = [ subId: bigint, directFundingFeePaid: bigint, callbackGasLimit: bigint, decryptionRequestID: bigint, condition: string, ciphertext: TypesLib.CiphertextStructOutput, signature: string, decryptionKey: string, callback: string ] & { subId: bigint; directFundingFeePaid: bigint; callbackGasLimit: bigint; decryptionRequestID: bigint; condition: string; ciphertext: TypesLib.CiphertextStructOutput; signature: string; decryptionKey: string; callback: string; }; } export interface IBlocklockSenderInterface extends Interface { getFunction(nameOrSignature: "acceptSubscriptionOwnerTransfer" | "addConsumer" | "calculateRequestPriceNative" | "cancelSubscription" | "createSubscription" | "decrypt" | "estimateRequestPriceNative" | "fundSubscriptionWithNative" | "getActiveSubscriptionIds" | "getChainId" | "getRequest" | "getSubscription" | "pendingRequestExists" | "removeConsumer" | "requestBlocklock" | "requestBlocklockWithSubscription" | "requestSubscriptionOwnerTransfer" | "setDecryptionSender" | "version"): 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: "decrypt", values: [TypesLib.CiphertextStruct, BytesLike]): string; encodeFunctionData(functionFragment: "estimateRequestPriceNative", values: [BigNumberish, BigNumberish]): string; encodeFunctionData(functionFragment: "fundSubscriptionWithNative", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "getActiveSubscriptionIds", values: [BigNumberish, BigNumberish]): string; encodeFunctionData(functionFragment: "getChainId", values?: undefined): string; encodeFunctionData(functionFragment: "getRequest", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "getSubscription", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "pendingRequestExists", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "removeConsumer", values: [BigNumberish, AddressLike]): string; encodeFunctionData(functionFragment: "requestBlocklock", values: [BigNumberish, BytesLike, TypesLib.CiphertextStruct]): string; encodeFunctionData(functionFragment: "requestBlocklockWithSubscription", values: [BigNumberish, BigNumberish, BytesLike, TypesLib.CiphertextStruct]): string; encodeFunctionData(functionFragment: "requestSubscriptionOwnerTransfer", values: [BigNumberish, AddressLike]): string; encodeFunctionData(functionFragment: "setDecryptionSender", values: [AddressLike]): string; encodeFunctionData(functionFragment: "version", values?: undefined): 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: "decrypt", data: BytesLike): Result; decodeFunctionResult(functionFragment: "estimateRequestPriceNative", data: BytesLike): Result; decodeFunctionResult(functionFragment: "fundSubscriptionWithNative", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getActiveSubscriptionIds", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getChainId", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getRequest", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getSubscription", data: BytesLike): Result; decodeFunctionResult(functionFragment: "pendingRequestExists", data: BytesLike): Result; decodeFunctionResult(functionFragment: "removeConsumer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "requestBlocklock", data: BytesLike): Result; decodeFunctionResult(functionFragment: "requestBlocklockWithSubscription", data: BytesLike): Result; decodeFunctionResult(functionFragment: "requestSubscriptionOwnerTransfer", data: BytesLike): Result; decodeFunctionResult(functionFragment: "setDecryptionSender", data: BytesLike): Result; decodeFunctionResult(functionFragment: "version", data: BytesLike): Result; } export interface IBlocklockSender extends BaseContract { connect(runner?: ContractRunner | null): IBlocklockSender; waitForDeployment(): Promise<this>; interface: IBlocklockSenderInterface; 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">; decrypt: TypedContractMethod<[ ciphertext: TypesLib.CiphertextStruct, decryptionKey: BytesLike ], [ string ], "view">; estimateRequestPriceNative: TypedContractMethod<[ _callbackGasLimit: BigNumberish, _requestGasPriceWei: BigNumberish ], [ bigint ], "view">; fundSubscriptionWithNative: TypedContractMethod<[ subId: BigNumberish ], [ void ], "payable">; getActiveSubscriptionIds: TypedContractMethod<[ startIndex: BigNumberish, maxCount: BigNumberish ], [ bigint[] ], "view">; getChainId: TypedContractMethod<[], [bigint], "view">; getRequest: TypedContractMethod<[ requestId: BigNumberish ], [ TypesLib.BlocklockRequestStructOutput ], "view">; getSubscription: TypedContractMethod<[ subId: BigNumberish ], [ [ bigint, bigint, string, string[] ] & { nativeBalance: bigint; reqCount: bigint; owner: string; consumers: string[]; } ], "view">; pendingRequestExists: TypedContractMethod<[ subId: BigNumberish ], [ boolean ], "view">; removeConsumer: TypedContractMethod<[ subId: BigNumberish, consumer: AddressLike ], [ void ], "nonpayable">; requestBlocklock: TypedContractMethod<[ callbackGasLimit: BigNumberish, condition: BytesLike, ciphertext: TypesLib.CiphertextStruct ], [ bigint ], "payable">; requestBlocklockWithSubscription: TypedContractMethod<[ callbackGasLimit: BigNumberish, subId: BigNumberish, condition: BytesLike, ciphertext: TypesLib.CiphertextStruct ], [ bigint ], "payable">; requestSubscriptionOwnerTransfer: TypedContractMethod<[ subId: BigNumberish, newOwner: AddressLike ], [ void ], "nonpayable">; setDecryptionSender: TypedContractMethod<[ newDecryptionSender: AddressLike ], [ void ], "nonpayable">; version: TypedContractMethod<[], [string], "view">; 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: "decrypt"): TypedContractMethod<[ ciphertext: TypesLib.CiphertextStruct, decryptionKey: BytesLike ], [ string ], "view">; 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: "getChainId"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "getRequest"): TypedContractMethod<[ requestId: BigNumberish ], [ TypesLib.BlocklockRequestStructOutput ], "view">; getFunction(nameOrSignature: "getSubscription"): TypedContractMethod<[ subId: BigNumberish ], [ [ bigint, bigint, string, string[] ] & { nativeBalance: bigint; reqCount: bigint; owner: string; consumers: string[]; } ], "view">; getFunction(nameOrSignature: "pendingRequestExists"): TypedContractMethod<[subId: BigNumberish], [boolean], "view">; getFunction(nameOrSignature: "removeConsumer"): TypedContractMethod<[ subId: BigNumberish, consumer: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "requestBlocklock"): TypedContractMethod<[ callbackGasLimit: BigNumberish, condition: BytesLike, ciphertext: TypesLib.CiphertextStruct ], [ bigint ], "payable">; getFunction(nameOrSignature: "requestBlocklockWithSubscription"): TypedContractMethod<[ callbackGasLimit: BigNumberish, subId: BigNumberish, condition: BytesLike, ciphertext: TypesLib.CiphertextStruct ], [ bigint ], "payable">; getFunction(nameOrSignature: "requestSubscriptionOwnerTransfer"): TypedContractMethod<[ subId: BigNumberish, newOwner: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "setDecryptionSender"): TypedContractMethod<[ newDecryptionSender: AddressLike ], [ void ], "nonpayable">; getFunction(nameOrSignature: "version"): TypedContractMethod<[], [string], "view">; filters: {}; }