UNPKG

viem

Version:

TypeScript Interface for Ethereum

91 lines 4.87 kB
import type { Address } from 'abitype'; import type { Client } from '../../clients/createClient.js'; import type { Transport } from '../../clients/transports/createTransport.js'; import type { InvalidHexBooleanError } from '../../errors/encoding.js'; import type { ErrorType } from '../../errors/utils.js'; import type { Chain } from '../../types/chain.js'; import type { ByteArray, Hex, Signature } from '../../types/misc.js'; import type { OneOf } from '../../types/utils.js'; import { type EncodeDeployDataErrorType } from '../../utils/abi/encodeDeployData.js'; import { type EncodeFunctionDataErrorType } from '../../utils/abi/encodeFunctionData.js'; import { type GetAddressErrorType } from '../../utils/address/getAddress.js'; import { type IsAddressEqualErrorType } from '../../utils/address/isAddressEqual.js'; import { type ConcatHexErrorType } from '../../utils/data/concat.js'; import { type IsHexErrorType } from '../../utils/data/isHex.js'; import { type BytesToHexErrorType, type NumberToHexErrorType } from '../../utils/encoding/toHex.js'; import { type RecoverAddressErrorType } from '../../utils/signature/recoverAddress.js'; import { type SerializeSignatureErrorType } from '../../utils/signature/serializeSignature.js'; import { type CallErrorType, type CallParameters } from './call.js'; import { type GetCodeErrorType } from './getCode.js'; import { type ReadContractErrorType } from './readContract.js'; export type VerifyHashParameters = Pick<CallParameters, 'blockNumber' | 'blockTag'> & { /** The address that signed the original message. */ address: Address; /** The chain to use. */ chain?: Chain | null | undefined; /** The address of the ERC-6492 signature verifier contract. */ erc6492VerifierAddress?: Address | undefined; /** The hash to be verified. */ hash: Hex; /** Multicall3 address for ERC-8010 verification. */ multicallAddress?: Address | undefined; /** The signature that was generated by signing the message with the address's private key. */ signature: Hex | ByteArray | Signature; /** @deprecated use `erc6492VerifierAddress` instead. */ universalSignatureVerifierAddress?: Address | undefined; } & OneOf<{ factory: Address; factoryData: Hex; } | {}>; export type VerifyHashReturnType = boolean; export type VerifyHashErrorType = BytesToHexErrorType | CallErrorType | ConcatHexErrorType | EncodeDeployDataErrorType | EncodeFunctionDataErrorType | ErrorType | GetAddressErrorType | GetCodeErrorType | InvalidHexBooleanError | IsAddressEqualErrorType | IsHexErrorType | NumberToHexErrorType | ReadContractErrorType | RecoverAddressErrorType | SerializeSignatureErrorType; /** * Verifies a message hash onchain using ERC-6492. * * @param client - Client to use. * @param parameters - {@link VerifyHashParameters} * @returns Whether or not the signature is valid. {@link VerifyHashReturnType} */ export declare function verifyHash<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: VerifyHashParameters): Promise<VerifyHashReturnType>; /** @internal */ export declare function verifyErc8010(client: Client, parameters: verifyErc8010.Parameters): Promise<boolean>; export declare namespace verifyErc8010 { type Parameters = Pick<CallParameters, 'blockNumber' | 'blockTag'> & { /** The address that signed the original message. */ address: Address; /** The hash to be verified. */ hash: Hex; /** Multicall3 address for ERC-8010 verification. */ multicallAddress?: Address | undefined; /** The signature that was generated by signing the message with the address's private key. */ signature: Hex; }; } export declare namespace verifyErc6492 { type Parameters = Pick<CallParameters, 'blockNumber' | 'blockTag'> & { /** The address that signed the original message. */ address: Address; /** The hash to be verified. */ hash: Hex; /** The signature that was generated by signing the message with the address's private key. */ signature: Hex; /** The address of the ERC-6492 signature verifier contract. */ verifierAddress?: Address | undefined; } & OneOf<{ factory: Address; factoryData: Hex; } | {}>; } /** @internal */ export declare function verifyErc1271(client: Client, parameters: verifyErc1271.Parameters): Promise<boolean>; export declare namespace verifyErc1271 { type Parameters = Pick<CallParameters, 'blockNumber' | 'blockTag'> & { /** The address that signed the original message. */ address: Address; /** The hash to be verified. */ hash: Hex; /** The signature that was generated by signing the message with the address's private key. */ signature: Hex; }; } //# sourceMappingURL=verifyHash.d.ts.map