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 operations collection.

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

todo

The Operation model does not need fields to be public.

todo

Timestamp fields should be numbers to avoid timezone issues.

since

v0.3.0

Hierarchy

Index

Constructors

Properties

collectionName: string = "operations"

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

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}

contractPayload: ObjectLiteral

This is the contract payload as presented inside a dHealth Transfer Transaction. Typically, the contract payload is made of the contract and version fields, adding to it the body of the contract instance, i.e. the Auth contract would here also include a challenge field.

This field is required and not indexed.

example

{ contract: "elevate:auth", version: 1, challenge: "abcdef12" }

access

public

readonly
var

{string}

contractSignature: string

This is the contract signature as presented inside a dHealth Transfer Transaction.

This field is required and indexed.

example

"elevate:auth"

access

public

readonly
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 an operation. You can use the dHealth Network API to find out exact timestamp by block height.

This field is required and 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}

processedAt: number

The document's processing timestamp. This field does not reflect the date of creation of an operation but rather the date of creation of the cached database entry.

This field is required and indexed.

access

public

readonly
var

{number}

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}

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}

userAddress: string

This is the user's address. The user corresponds to the issuer of said operation ("owner"). Note that this may correspond to different fields inside a transaction, depending on the operation type, i.e. for the auth contract, this field shall contain the signer address; whereas for the earn contract, this field shall contain the recipient address.

This field is required and indexed.

access

public

readonly
var

{string}

Accessors

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

    access

    public

    Returns Record<string, any>

    The individual document data that is used in a query.

Methods

Generated using TypeDoc