navio-blsct
Version:
TypeScript bindings for the `libblsct` library used by the [Navio](https://nav.io/) blockchain to construct confidential transactions based on the BLS12-381 curve.
42 lines (41 loc) • 1.48 kB
TypeScript
import { DoublePublicKey } from './keys/doublePublicKey';
/**
* Represents the available address encoding formats.
*/
export declare enum AddressEncoding {
/** Bech32 encoding as defined in BIP-173. */
Bech32 = 0,
/** Bech32m encoding as defined in BIP-350. */
Bech32M = 1
}
/**
* Provides static utility methods for encoding and decoding addresses.
*
* This class is intended to be used as a static container and should not be instantiated.
*
* Examples:
* ```ts
* const { Address, DoublePublicKey, AddressEncoding } = require('navio-blsct')
* const dpk = DoublePublicKey.random()
* const addr = Address.encode(dpk, AddressEncoding.Bech32M)
* addr
* const decDpk = Address.decode(addr)
* decDpk.serialize() === dpk.serialize() // true
* ```
*/
export declare class Address {
/** Encode a `DoublePublicKey` to an address string using the specified encoding
*
* @param addrDpk - The `DoublePublicKey` to encode.
* @param encoding - The desired address encoding format (`Bech32` or `Bech32M`).
* @return The encoded address as a string.
*/
static encode(addrDpk: DoublePublicKey, encoding: AddressEncoding): string;
/** Decode an address string to a `DoublePublicKey`.
*
* @param addrStr - The address string to decode.
* @return A `DoublePublicKey` instance representing the decoded address.
* @throws Error if the decoding fails.
*/
static decode(addrStr: string): DoublePublicKey;
}