Options
All
  • Public
  • Public/Protected
  • All
Menu
description

This class defines the exact fields that are stored in the corresponding MongoDB documents. It should be used whenever database documents are being handled or read for the transactions collection.

Note that this class uses the generic Transferable trait to enable a toDTO() method on the model.

since

v0.2.0

Hierarchy

Index

Constructors

Properties

collectionName: string = "transactions"

This field contains the mongo collection name for entries that are stored using TransactionDocument or the model TransactionModel.

Note that this field is not part of document properties and used only internally to perform queries that refer to an individual collection name, e.g. $unionWith.

access

public

var

{string}

createdAt?: Date

The document's creation timestamp. This field does not reflect the date of update of a transaction but rather the date of creation of the cached database entry.

This field is added for consistency with the other database schema.

This field is required and indexed.

access

public

readonly
var

{Date}

creationBlock: number

The document's creation block number. This field does reflect the time of creation of a transaction. You can use the dHealth Network API to find out exact timestamp by block height.

This field is required and not indexed.

todo

Note this is not protected for number overflows (but there is a long way until block numbers do overflow..)

access

public

readonly
var

{number}

discoveredAt: number

The document's discovery timestamp. This field does not reflect the date of creation of a transaction but rather the date of creation of the cached database entry.

This field is required and indexed.

access

public

readonly
var

{number}

encodedBody: string

This is the transaction body as defined by the dApps Framework. This field contains only a subset of the binary payload that represents this transaction.

Notably, following transaction header applies on dHealth Network:

size | r1 | sig | pub | r2 | ver | net | type
4b | 4b | 64b | 32b | 4b | 1b | 1b | 2b



This field does not contain the above transaction header as it is always the same network-wide, depending on the transaction type. It permits to save 112 bytes of data, that is easily reproduced using the other fields of this document.

This field is required and not indexed.

access

public

readonly
var

{string}

recipientAddress: string

This is the recipient address. The recipient corresponds to the destination of said transaction.

This field is required and indexed.

access

public

readonly
var

{string}

signature: string

This is the transaction signature as defined by dHealth Network. It contains an immutable sha3-512 hash created from some of the data stored in the transaction body.

Due to the usage of sha3-512, this hash is always a 64 bytes transaction hash (128 characters in hexadecimal notation).

This field is required and not indexed.

access

public

readonly
var

{string}

signerAddress: string

This is the signer's address. The signer corresponds to the issuer of said transaction ("owner"). It is not to be confused with the discovery source address.

This field is required and indexed.

access

public

readonly
var

{string}

signerPublicKey: string

This is the signer's public key. The signer corresponds to the issuer of said transaction ("owner").

This field is required and indexed.

access

public

readonly
var

{string}

sourceAddress: string

This is the discovery source's address, not to be confused with the signer address. A discovery source is an address owned by the dApp itself and from/to which transactions are issued.

This field is required and indexed.

access

public

readonly
var

{string}

transactionAssets?: ObjectLiteral[]

This is the transaction mosaics as defined by dHealth Network. It contains an array of ObjectLiteral objects that consist of both a mosaicId and amount field.

This field is optional and not indexed.

example

[{ "mosaicId": "39E0C49FA322A459", amount: 1 }]

access

public

readonly
var

{string}

transactionHash: string

This is the transaction hash as defined by dHealth Network. It contains an immutable sha3-256 hash created from the transaction body.

Due to the usage of sha3-256, this hash is always a 32 bytes transaction hash (64 characters in hexadecimal notation).

This field is required, indexed and values are expected to be unique.

access

public

readonly
var

{string}

transactionMessage?: string

This is the transaction message as defined by dHealth Network. It contains a plain text or encrypted message that in turn may be processed as an operation, or ignored.

Due to some end-users preferring to encrypt their messages, the content of this field may be highly variable, reaching from plain text content over to hexadecimal payloads of encrypted text.

This field is optional and not indexed.

access

public

readonly
var

{string}

transactionMode: string

This is the transaction mode and may contain one of the following values:

  • "incoming": This transaction is an incoming transaction of the sourceAddress discovery source account. i.e. this transaction was sent to the discovery source account.
  • "outgoing": This transaction is an outgoing transaction of the sourceAddress discovery source account. i.e. this transaction was sent from the discovery source account.

    This field is required and indexed.
access

public

readonly
var

{string}

transactionType: string

This is the transaction type as defined in dApps. Typically, this field will contain "transfer", as for now dApps always use transfer transactions to perform operations.

This field is required and indexed.

access

public

readonly
var

{string}

updatedAt?: Date

The document's update timestamp. This field does not reflect the date of update of a transaction but rather the date of update of the cached database entry.

This field is optional and not indexed.

access

public

readonly
var

{Date}

Accessors

  • get toQuery(): Record<string, any>
  • This method implements a specialized query format to query items individually, as documents, in the collection: transactions.

    access

    public

    Returns Record<string, any>

    The individual document data that is used in a query.

Methods

  • toSDK(): Transaction

Generated using TypeDoc