@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
50 lines (49 loc) • 1.92 kB
TypeScript
import type { AbstractAddress } from "../../common/address.js";
import { BlockchainLayer1Enum } from "../../union/enum/domain.js";
/**
* Represents normalized (64chars with 0-pad) address of resource
* in Aptos blockchain
*
* @example 0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b
* @see https://aptos.dev/concepts/accounts
*/
export type AptosAddress = AbstractAddress<BlockchainLayer1Enum.APTOS>;
export declare const aptosAddressRegExp: RegExp;
/**
* Checks Short AND Long formats of address with or without 0-pad
*
* @example 0x1
* @example 0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b
*/
export declare function isAptosAddress(address: string): address is AptosAddress;
export declare const aptosAddressLongRegExp: RegExp;
/**
* Checks Long formats of address with or without 0-pad
*
* @example 0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b
*/
export declare function isAptosLongAddress(address: string): address is AptosAddress;
/**
* Checks Long format of address with 0-pad
*/
export declare const aptosAddressValidator: import("../../common/common.js").ILayer1fulValidator<BlockchainLayer1Enum.APTOS, AptosAddress>;
/**
* Check and convert Aptos-compatible addresses
*
* @note it does normalization (0-pad and lowercase)
* @example 0x1
* @example 0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b
* @see https://aptos.dev/concepts/accounts
*/
export declare function toAptosAddress(address: string): AptosAddress;
export declare function toAptosAddressSafe(address: string): AptosAddress | undefined;
/**
* Removes 0-pad from address
*/
export declare function shortenAptosAddress(address: AptosAddress): AptosAddress;
/**
* Generates random Aptos address
*
* @example 0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b
*/
export declare function randomAptosAddress(): AptosAddress;