UNPKG

@rarible/types

Version:

`@rarible/types` is a TypeScript library that provides type definitions and interfaces for the Rarible ecosystem. This package is designed to facilitate seamless integration with Rarible's APIs and services, ensuring type safety and improved developer exp

23 lines (22 loc) 1.18 kB
import { CustomError } from "@rarible/utils"; import type { AbstractAddress } from "../../common/address.js"; import type { BlockchainEnum, L1BlockchainByBlockchain, WithBlockchain } from "../enum/domain.js"; export type UnionAddress<Index extends BlockchainEnum = BlockchainEnum> = WithBlockchain<Index, AbstractAddress<L1BlockchainByBlockchain[Index]>> & { __IS_UNION_ADDRESS__: true; }; /** * Address format of union service * Will convert raw address to UnionAddress * @note that all blockchains will be converted to layer-1 blockchain * * @example * ETHEREUM:0xd07dc4262bcdbf85190c01c996b4c06a461d2430 -> ETHEREUM:0xd07dc4262bcdbf85190c01c996b4c06a461d2430 * POLYGON:0xd07dc4262bcdbf85190c01c996b4c06a461d2430 -> ETHEREUM:0xd07dc4262bcdbf85190c01c996b4c06a461d2430 * FLOW:0x01658d9b94068f3c -> FLOW:0x01658d9b94068f3c */ export declare function toUnionAddress(value: string): UnionAddress; export declare function toUnionAddressSafe(value: string): UnionAddress | undefined; export declare function isUnionAddress(value: string): value is UnionAddress; export declare class InvalidUnionAddressError extends CustomError { constructor(address: string); }