UNPKG

@signumjs/core

Version:

Principal package with functions and models for building Signum Network applications.

67 lines (66 loc) 2.56 kB
/** * A Value Object to facilitate Address conversions. * * */ export declare class Address { private _publicKey; private _numericId; private _rs; private constructor(); /** * Tries to create the address from whatever input is given * @param anyValidAddress Any valid address, may it be Reed Solomon address, numeric ID, or public key * @param prefix An optional prefix, which can be used to substitute the default {@link AddressPrefix.MainNet} * @return The new address, if the input was valid * @throws when no valid format */ static create(anyValidAddress: string, prefix?: string): Address; static fromNumericId(numericId: string, prefix?: string): Address; /** * Creates an Account Address object from public key * @param publicKey The public key of that address (in hex format) * @param prefix The Reed-Solomon Address prefix */ static fromPublicKey(publicKey: string, prefix?: string): Address; /** * Creates an Account Address object from extended Reed-Solomon address * @param address The Reed-Solomon address in simple or extended format (with base36 suffix) * @throws Error if the passed address is invalid */ static fromReedSolomonAddress(address: string): Address; /** * @return Gets public key */ getPublicKey(): string; /** * @return Gets numeric Account Id */ getNumericId(): string; /** * Gets as Reed Solomon representation * @param withPrefix If false, the address without prefix will be returned. Default: true * @return Reed Solomon Address Format * @see {@link Address.getReedSolomonAddressExtended} */ getReedSolomonAddress(withPrefix?: boolean): string; /** * Gets as extended Reed Solomon representation carrying the public key as suffix in base36 encoding * * This method requires that the address was created from a public key or extended address. * * @param withPrefix If false, the address without prefix will be returned. Default: true * @return Extended Reed Solomon Address Format * @throws if no public key is available * @see {@link Address.getReedSolomonAddress} */ getReedSolomonAddressExtended(withPrefix?: boolean): string; /** * Checks for equality * @param address The other address to be compared * @return true if equal, otherwise false */ equals(address: Address): boolean; private constructFromPublicKey; private constructFromAddress; }