@hyperlane-xyz/utils
Version:
General utilities and types for the Hyperlane network
132 lines • 3.65 kB
TypeScript
import type { SignatureLike } from '@ethersproject/bytes';
import type { BigNumber, ethers } from 'ethers';
export declare enum ProtocolType {
Ethereum = "ethereum",
Sealevel = "sealevel",
Cosmos = "cosmos",
CosmosNative = "cosmosnative",
Starknet = "starknet",
Radix = "radix",
Aleo = "aleo",
Tron = "tron",
Unknown = "unknown"
}
export type ProtocolTypeValue = `${ProtocolType}`;
export type KnownProtocolType = Exclude<ProtocolType, ProtocolType.Unknown>;
export declare function isEVMLike(protocol: ProtocolType): boolean;
export declare const ProtocolSmallestUnit: {
ethereum: string;
sealevel: string;
cosmos: string;
cosmosnative: string;
starknet: string;
radix: string;
aleo: string;
tron: string;
unknown: string;
};
/********* BASIC TYPES *********/
export type Domain = number;
export type EvmChainId = number;
export type ChainId = string | number;
export type Address = string;
export type AddressBytes32 = string;
export type ChainCaip2Id = `${string}:${string}`;
export type TokenCaip19Id = `${string}:${string}/${string}:${string}`;
export type HexString = string;
export type Numberish = number | string | bigint;
export type WithAddress<T> = T & {
address: Address;
};
export type MerkleProof = {
branch: ethers.utils.BytesLike[];
leaf: ethers.utils.BytesLike;
index: number;
};
/********* HYPERLANE CORE *********/
export type Announcement = {
mailbox_domain: Domain;
mailbox_address: Address;
validator: Address;
storage_location: string;
};
export type Checkpoint = {
root: string;
index: number;
mailbox_domain: Domain;
merkle_tree_hook_address: Address;
};
export type CheckpointWithId = {
checkpoint: Checkpoint;
message_id: HexString;
};
export { SignatureLike };
/**
* Shape of a checkpoint in S3 as published by the agent.
*/
export type S3CheckpointWithId = {
value: CheckpointWithId;
signature: SignatureLike;
};
export type S3Announcement = {
value: Announcement;
signature: SignatureLike;
};
export type S3Checkpoint = {
value: Checkpoint;
signature: SignatureLike;
};
export type CallData = {
to: Address;
data: string;
value?: BigNumber;
};
export declare enum MessageStatus {
NONE = 0,
PROCESSED = 1
}
export type ParsedMessage = {
version: number;
nonce: number;
origin: number;
originChain?: string;
sender: string;
destination: number;
destinationChain?: string;
recipient: string;
body: string;
};
export type ParsedWarpRouteMessage = {
recipient: string;
amount: bigint;
};
export type ParsedLegacyMultisigIsmMetadata = {
checkpointRoot: string;
checkpointIndex: number;
originMailbox: string;
proof: ethers.utils.BytesLike[];
signatures: ethers.utils.BytesLike[];
validators: ethers.utils.BytesLike[];
};
export type Annotated<T> = T & {
annotation?: string;
};
export type ValidatorMetadata = {
git_sha: string;
rpcs?: string[];
allows_public_rpcs?: boolean;
};
export type ReorgEvent = {
/** the merkle root built from this agent's indexed events */
localMerkleRoot: string;
/** the onchain merkle root */
canonicalMerkleRoot: string;
/** the index of the checkpoint when the reorg was detected
* (due to a mismatch between local and canonical merkle roots) */
checkpointIndex: number;
/** the timestamp when the reorg was detected, in seconds since the Unix epoch */
unixTimestamp: number;
/** the reorg period configured for the agent */
reorgPeriod: string;
};
//# sourceMappingURL=types.d.ts.map