UNPKG

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.

73 lines (72 loc) 2.91 kB
import { TxOutputType } from './blsct'; import { ManagedObj } from './managedObj'; import { SubAddr } from './subAddr'; import { TokenId } from './tokenId'; /** Represents a transaction output used to construct a CTxOut in a confidential transaction. * * Examples: * ```ts * const { SubAddr, DoublePublicKey, TxOut, TokenId, TxOutputType } = require('navio-blsct') * const dpk = new DoublePublicKey() * const subAddr = SubAddr.fromDoublePublicKey(dpk) * const amount = 789 * const memo = "apple" * const txOut = TxOut.generate(subAddr, amount, memo) * txOut.getDestination() * txOut.getAmount() // 789 * txOut.getMemo() // "apple" * txOut.getTokenId() * txOut.getMinStake() // 0 * const ser = txOut.serialize() * const deser = TxOut.deserialize(ser) * ser === deser.serialize() // true * ``` */ export declare class TxOut extends ManagedObj { constructor(obj: any); /** Constructs a new `TxOut` instance. * @param subAddr - The destination SubAddr of the output. * @param amount - The amount of the output. * @param memo - The memo of the output. * @param tokenId - The token ID associated with the output (optional). * @param outputType - The type of the output (default is `TxOutputType.Normal`). * @param minStake - The minimum stake for the output (default is 0). * @returns A new `TxOut` instance. */ static generate(subAddr: SubAddr, amount: number, memo: string, tokenId?: TokenId, outputType?: TxOutputType, minStake?: number): TxOut; value(): any; /** Returns the destination SubAddr of the transaction output. * @returns The destination SubAddr of the transaction output. */ getDestination(): SubAddr; /** Returns the amount of the transaction output. * @returns The amount of the transaction output. */ getAmount(): number; /** Returns the memo of the transaction output. * @returns The memo of the transaction output. */ getMemo(): string; /** Returns the token ID associated with the transaction output. * @returns The token ID associated with the transaction output. */ getTokenId(): TokenId; /** Returns the type of the transaction output. * @returns The type of the transaction output. */ getOutputType(): TxOutputType; /** Returns the minimum stake required for the transaction output. * @returns The minimum stake required for the transaction output. */ getMinStake(): number; /** Returns a deep copy of the instance. * @returns A new `TxOut` instance that is a deep copy of this instance. */ clone(): TxOut; serialize(): string; /** Deserializes a `TxOut` from its hexadecimal representation. * @param hex - The hexadecimal string to deserialize. * @returns A new `TxOut` instance. */ static deserialize(this: new (obj: any) => TxOut, hex: string): TxOut; }