UNPKG

@stable-io/cctp-sdk-definitions

Version:

Definitions for the CCTP SDK

40 lines 2.04 kB
import type { Size } from "@stable-io/utils"; import type { PlatformRegistry, RegisteredPlatform, LoadedDomain } from "./registry.js"; import type { Platform, PlatformOf } from "./constants/chains/index.js"; export interface AddressSubclass<T extends Address> { readonly zeroAddress: T; readonly byteSize: Size; } export interface Address { unwrap(): unknown; toString(): string; toUint8Array(): Uint8Array; toUniversalAddress(): UniversalAddress; } export type PlatformAddress<P extends RegisteredPlatform> = PlatformRegistry[P]["Address"]; type ToPlatform<T extends LoadedDomain | RegisteredPlatform> = T extends LoadedDomain ? PlatformOf<T> : T; export declare class UniversalAddress implements Address { static readonly byteSize: Size; static readonly zeroAddress: UniversalAddress; private static decodeFunc; private readonly address; constructor(address: string, platform?: Platform); constructor(address: Uint8Array | UniversalAddress); toPlatformAddress<const T extends LoadedDomain | RegisteredPlatform>(chainOrPlatform: T): PlatformAddress<ToPlatform<T>>; unwrap(): Uint8Array; toString(): `0x${string}`; toUint8Array(): Uint8Array; toUniversalAddress(): this; toJSON(): string; equals(other: UniversalAddress): boolean; } export type UniversalOrNative<T extends LoadedDomain | RegisteredPlatform> = UniversalAddress | PlatformAddress<ToPlatform<T>>; export type DomainAddress<D extends LoadedDomain, A extends UniversalOrNative<PlatformOf<D>>> = { readonly domain: D; readonly address: A; }; export type PlatformAddressCtr = new (ua: UniversalAddress | string | Uint8Array) => Address; export declare function registerPlatformAddress<const P extends Platform>(platform: P, ctr: PlatformAddressCtr): void; export declare function platformAddress<const T extends LoadedDomain | RegisteredPlatform>(domainOrPlatform: T, address: string | Uint8Array | UniversalAddress): PlatformAddress<ToPlatform<T>>; export {}; //# sourceMappingURL=address.d.ts.map