UNPKG

cache-typescript-sdk

Version:
98 lines (97 loc) 3.31 kB
import { TransactionDTO } from "../../infrastructure/transaction/TransactionDTO"; import { Address } from "../account/Address"; import { Mosaic } from "../mosaic/Mosaic"; import { MosaicId } from "../mosaic/MosaicId"; import { MosaicTransferable } from "../mosaic/MosaicTransferable"; import { XEM } from "../mosaic/XEM"; import { EncryptedMessage } from "./EncryptedMessage"; import { PlainMessage } from "./PlainMessage"; import { Transaction } from "./Transaction"; export declare enum ExpirationType { oneHour = 1, twoHour = 2, sixHour = 6, twelveHour = 12, } /** * Transfer transactions contain data about transfers of XEM or mosaics to another account. */ export declare class TransferTransaction extends Transaction { /** * The fee for the transaction. The higher the fee, the higher the priority of the transaction. Transactions with high priority get included in a block before transactions with lower priority. */ readonly fee: number; /** * The address of the recipient. */ readonly recipient: Address; /** * The xem of XEM that is transferred from sender to recipient. */ private readonly _xem; /** * Optionally a transaction can contain a message. In this case the transaction contains a message substructure. If not the field is null. */ readonly message: PlainMessage | EncryptedMessage; /** * The array of Mosaic objects. */ private readonly _mosaics?; /** * in case that the transfer transaction contains mosaics, it throws an error * @returns {XEM} */ xem(): XEM; /** * in case that the transfer transaction does not contain mosaics, it throws an error * @returns {Mosaic[]} */ mosaics(): Mosaic[]; /** * * @returns {boolean} */ containsMosaics(): boolean; /** * all the Mosaic Identifiers of the attached mosaics * @returns {MosaicId[]} */ mosaicIds(): MosaicId[]; /** * returns mosaic array of received mosaics * @returns {MosaicTransferable[]} */ mosaicDetails: () => Promise<MosaicTransferable[]>; /** * Create a CacheTransferTransaction object * @param recipient * @param mosaic * @param message * @param expiration? - 2 hours default, can't exceed 23 hours * @returns {TransferTransaction} */ static create: (recipient: Address, mosaic: MosaicTransferable, message: PlainMessage | EncryptedMessage, expiration?: ExpirationType | undefined) => TransferTransaction; /** * Create DTO of TransferTransaction * @returns {TransferTransactionDTO} */ toDTO(): TransactionDTO; /** * Create a TransferTransaction object * @param recipient * @param xem * @param message * @param expiration? * @returns {TransferTransaction} */ private static createWithXem(recipient, xem, message, expiration?); /** * Create a TransferTransaction object * @param recipient * @param mosaics * @param message * @param expiration? * @returns {TransferTransaction} */ static createWithMosaics(recipient: Address, mosaics: MosaicTransferable[], message: PlainMessage | EncryptedMessage, expiration?: ExpirationType): TransferTransaction; }