minauth-erc721-timelock-plugin
Version:
This package contains an implementation of a MinAuth plugin that combines zero-knowledge Merkle "membership" proofs with the ability to register into to a Merkle tree with locking an Ethereum NFT.
178 lines (177 loc) • 8 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 ERC721TimeLock {
type LockedTokenStruct = {
tokenAddress: AddressLike;
tokenId: BigNumberish;
unlockTime: BigNumberish;
hash: BytesLike;
};
type LockedTokenStructOutput = [
tokenAddress: string,
tokenId: bigint,
unlockTime: bigint,
hash: string
] & {
tokenAddress: string;
tokenId: bigint;
unlockTime: bigint;
hash: string;
};
}
export interface ERC721TimeLockInterface extends Interface {
getFunction(nameOrSignature: "HASH_BIT_SIZE" | "getLockedTokens" | "lockPeriod" | "lockToken" | "lockedTokens" | "unlockToken"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "TokenLocked" | "TokenUnlocked"): EventFragment;
encodeFunctionData(functionFragment: "HASH_BIT_SIZE", values?: undefined): string;
encodeFunctionData(functionFragment: "getLockedTokens", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "lockPeriod", values?: undefined): string;
encodeFunctionData(functionFragment: "lockToken", values: [AddressLike, BigNumberish, BytesLike]): string;
encodeFunctionData(functionFragment: "lockedTokens", values: [AddressLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "unlockToken", values: [BigNumberish]): string;
decodeFunctionResult(functionFragment: "HASH_BIT_SIZE", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getLockedTokens", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "lockPeriod", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "lockToken", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "lockedTokens", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "unlockToken", data: BytesLike): Result;
}
export declare namespace TokenLockedEvent {
type InputTuple = [
user: AddressLike,
tokenAddress: AddressLike,
tokenId: BigNumberish,
unlockTime: BigNumberish,
hash: BytesLike
];
type OutputTuple = [
user: string,
tokenAddress: string,
tokenId: bigint,
unlockTime: bigint,
hash: string
];
interface OutputObject {
user: string;
tokenAddress: string;
tokenId: bigint;
unlockTime: bigint;
hash: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace TokenUnlockedEvent {
type InputTuple = [
user: AddressLike,
tokenAddress: AddressLike,
tokenId: BigNumberish,
hash: BytesLike
];
type OutputTuple = [
user: string,
tokenAddress: string,
tokenId: bigint,
hash: string
];
interface OutputObject {
user: string;
tokenAddress: string;
tokenId: bigint;
hash: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export interface ERC721TimeLock extends BaseContract {
connect(runner?: ContractRunner | null): ERC721TimeLock;
waitForDeployment(): Promise<this>;
interface: ERC721TimeLockInterface;
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>;
HASH_BIT_SIZE: TypedContractMethod<[], [bigint], "view">;
getLockedTokens: TypedContractMethod<[
_user: AddressLike
], [
ERC721TimeLock.LockedTokenStructOutput[]
], "view">;
lockPeriod: TypedContractMethod<[], [bigint], "view">;
lockToken: TypedContractMethod<[
_tokenAddress: AddressLike,
_tokenId: BigNumberish,
_hash: BytesLike
], [
void
], "nonpayable">;
lockedTokens: TypedContractMethod<[
arg0: AddressLike,
arg1: BigNumberish
], [
[
string,
bigint,
bigint,
string
] & {
tokenAddress: string;
tokenId: bigint;
unlockTime: bigint;
hash: string;
}
], "view">;
unlockToken: TypedContractMethod<[
_index: BigNumberish
], [
void
], "nonpayable">;
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
getFunction(nameOrSignature: "HASH_BIT_SIZE"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "getLockedTokens"): TypedContractMethod<[
_user: AddressLike
], [
ERC721TimeLock.LockedTokenStructOutput[]
], "view">;
getFunction(nameOrSignature: "lockPeriod"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "lockToken"): TypedContractMethod<[
_tokenAddress: AddressLike,
_tokenId: BigNumberish,
_hash: BytesLike
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "lockedTokens"): TypedContractMethod<[
arg0: AddressLike,
arg1: BigNumberish
], [
[
string,
bigint,
bigint,
string
] & {
tokenAddress: string;
tokenId: bigint;
unlockTime: bigint;
hash: string;
}
], "view">;
getFunction(nameOrSignature: "unlockToken"): TypedContractMethod<[_index: BigNumberish], [void], "nonpayable">;
getEvent(key: "TokenLocked"): TypedContractEvent<TokenLockedEvent.InputTuple, TokenLockedEvent.OutputTuple, TokenLockedEvent.OutputObject>;
getEvent(key: "TokenUnlocked"): TypedContractEvent<TokenUnlockedEvent.InputTuple, TokenUnlockedEvent.OutputTuple, TokenUnlockedEvent.OutputObject>;
filters: {
"TokenLocked(address,address,uint256,uint256,bytes32)": TypedContractEvent<TokenLockedEvent.InputTuple, TokenLockedEvent.OutputTuple, TokenLockedEvent.OutputObject>;
TokenLocked: TypedContractEvent<TokenLockedEvent.InputTuple, TokenLockedEvent.OutputTuple, TokenLockedEvent.OutputObject>;
"TokenUnlocked(address,address,uint256,bytes32)": TypedContractEvent<TokenUnlockedEvent.InputTuple, TokenUnlockedEvent.OutputTuple, TokenUnlockedEvent.OutputObject>;
TokenUnlocked: TypedContractEvent<TokenUnlockedEvent.InputTuple, TokenUnlockedEvent.OutputTuple, TokenUnlockedEvent.OutputObject>;
};
}