Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PreparePayouts<TDocument, TModel> Abstract

description

The implementation for the payout preparation scheduler. Contains source code for the execution logic of a command with name: processor:PreparePayouts.

Notably, this command fetches activities that have not been the subject of payouts yet and then creates transactions and signs transactions.

since

v0.4.0

Type Parameters

  • TDocument extends Subjectable

  • TModel extends Model<TDocument, {}, {}, {}> = Model<TDocument>

Hierarchy

Index

Constructors

Properties

argv: string[] = []

The arguments passed to the command. Typically, this holds required parameters of commands.

access

protected

var

{string[]}

baseAsset: AssetParameters

Memory store for the fees asset configuration object. This object defines which assets are discoverable on dHealth Network and used to pay for transaction fees.

This asset configuration is referred to as the base asset used in a specific dApp. The reason for this is that transactions on the underlying dHealth Network are always paid with one and the same asset.

access

protected

var

{DiscoverableAssetsMap}

configService: ConfigService<Record<string, unknown>, false>
dappConfig: DappConfig

The internal dApp configuration object. This object is used to configure key functionalities such as the name of a dApp and the enabled scopes of the backend runtime.

access

protected

var

{DappConfig}

dappIdentifier: string

Contains the dApp Identifier as attached to contracts on-chain. Typically, the dApp identifier is created using a slug-format of the dappName configuration inside config/dapp.ts.

access

protected

var

{string}

earnAsset: AssetParameters

Memory store for the earn asset configuration object. This object defines which assets are discoverable on dHealth Network and used to tokenize a particular operation.

This asset configuration is referred to as the earn asset used in a specific dApp. The reason for this is that individual dApps may want their end-users to earn a custom asset, or not.

access

protected

var

{DiscoverableAssetsMap}

logService: LogService
logger: LogService
networkConfig: NetworkConfig

The internal dApp network configuration object. This object is used to configure the access to the underlying blockchain network.

access

protected

var

{NetworkConfig}

payoutsService: PayoutsService
queryService: QueryService<TDocument, TModel>
scope: string = "payout"

The command scope. This is the scope that must be enabled through the configuration files for this command to be available.

This property is required through the extension of BaseCommand.

access

protected

var

{Scope}

signerService: SignerService

Requires state information of the module. This object is typically populated upon first execution and updated any time later.

see

StateService

access

protected

var

{StateDocument}

stateService: StateService
totalNumberPrepared: number

Memory store for the total number of prepared payouts. This is used in getStateData to update the latest execution state.

access

private

var

{number}

Accessors

  • get collection(): string
  • get command(): string
  • This method must return a command name. Note that it should use only characters of: A-Za-z0-9:-_.

    e.g. "scope:name"

    This property is required through the extension of BaseCommand but is intentionally forwarded to further child classes such that each command defines its own command name.

    abstract
    access

    protected

    Returns string

  • get shouldSetSubjectPayoutState(): boolean
  • This method determines whether the payoutState and activityAssets fields must be set on the payout subject document, or not.

    abstract
    access

    protected

    Returns boolean

  • get signature(): string
  • This method must return a command signature that contains hints on the command name and its required and optional arguments.

    e.g. "command [--option value]"

    This property is required through the extension of BaseCommand but is intentionally forwarded to further child classes such that each command defines its own command signature.

    abstract
    access

    protected

    Returns string

  • get stateIdentifier(): string
  • Getter for the discovery state identifier, e.g. "discovery.accounts", "discovery.transactions", "payout.outputs" etc.

    This method is an implementation necessary because of the extensions of StatefulModule.

    see

    StatefulModule

    access

    public

    var

    {string}

    Returns string

Methods

  • debugLog(message: string): void
  • errorLog(message: string, stack?: string): void
  • fetchSubjects(): Promise<TDocument[]>
  • This method must return an array of subjects. Note that subjects will be the subject of a payout execution.

    abstract
    access

    protected

    Returns Promise<TDocument[]>

  • getAssetAmount(subject: TDocument, multiplier: number): number
  • This method must return an asset amount which will be attached to a transfer transaction.

    abstract
    access

    protected

    Parameters

    • subject: TDocument
    • multiplier: number

    Returns number

  • getAssetIdentifier(): string
  • getMultiplier(subjectAddress: string): Promise<number>
  • This method must return a multiplier that is applied to payout amounts. This is used internally to add boosters when users have referred a specific number of accounts.

    abstract
    access

    protected

    Parameters

    • subjectAddress: string

    Returns Promise<number>

  • infoLog(message: string): void
  • This method is the entry point of any command line executed command. nest-commander implements a flow where this method is called with parameters that are respectively the raw arguments and the parsed arguments to this command call.

    This method uses the stateService to fetch the current execution and also uses it to update the state.

    Note that the runWithOptions method is called inside a try-catch block to force the error handling process.

    access

    public

    Parameters

    Returns Promise<void>

  • updatePayoutSubject(subject: TDocument, updateData: Record<string, any>): Promise<TDocument>
  • This method must update a payout subject document. Note that subjects are the subject of a payout execution.

    Parameters

    • subject: TDocument

      The document being updated.

    • updateData: Record<string, any>

      The columns and their respective value.

    Returns Promise<TDocument>

    The updated document.

  • usage(): string
  • This method prints usage information to the command line and is used by nest-commander to print a correctly formatted help message.

    Note that usage methods can be overwritten but must always print a standard command line signature.

    access

    public

    Returns string

Generated using TypeDoc