The constructor of this class. Params will be automatically injected upon called.
The arguments passed to the command. Typically, this holds required parameters of commands.
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.
The discovery source. In most cases this will be the host dapp's main account public key.
Memory store for the last page number being read. This is used in getStateData to update the latest execution state.
Memory store for the last account being read. This is used in getStateData to update the latest execution state.
The internal dApp network configuration object. This object is used to configure the access to the underlying blockchain network.
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.
Requires state information of the module. This object is typically populated upon first execution and updated any time later.
Memory store for the total number of transactions. This is used in getStateData to update the latest execution state.
Memory store for all transactions processed in one run of this command. Note that it contains only transfer transactions as those are the only relevant to this discovery command.
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
DiscoveryCommand.
This method must return a command signature that
contains hints on the command name and its required
and optional arguments.
e.g. "command
This property is required through the extension of
DiscoveryCommand.
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.
This method uses the logger to print debug messages.
This method implements the discovery logic for this command
that will find relevant subjects. Subjects in this command
are transactions that are either incoming or outgoing in
relation to the dApp's main account.
This method uses the logger to print error messages.
Optionally, a stack
can be passed to print a stack trace.
Helper method to extract the assets attached in a Transaction
instance.
Helper method to extract the recipient address of a Transaction
instance.
Helper method to extract the signer address of a Transaction
instance.
Helper method to extract the signer public key of a Transaction
instance.
Helper method to extract the confirmation block number of a
Transaction
instance. This is necessary to track the time
at which a transaction was first included in a block, and
thereby confirmed on the dHealth Network.
Helper method to extract the body of a Transaction
instance. Note
that the binary payload of the transaction is reduced in that the
transaction header (56 bytes) is dropped.
The transaction header can always be re-created using the other fields
present in the Transaction document.
Helper method to extract the transaction hash of a Transaction
instance. This is necessary because aggregate transactions store
their hash in a separate field.
Helper method to extract the message payload of a Transaction
instance.
Helper method to extract the signature of a Transaction
instance.
Helper method to extract the transaction type as defined by the
dApps Framework.
Note that in the first draft of the framework, the only transaction
type that is effectively used is "transfer"
because all operations
are executed using transfer transactions.
This method will find the next relevant discovery source
by iterating through the passed sources and checking
individual synchronization state.
Accounts that are fully synchronized require less requests
for recent transactions. Note that a per-source state is
persisted as well, to keep track of the last page number as
well as to keep track of when the runtime reads the latest
available page of transactions for said discovery source.
The discovery sources public keys and/or addresses.
The discovery source address.
Creates a state query for this discovery service. Each discovery service shall set its own stateIdentifier which is considered the identifier of the discovery module's state document.
This method creates one or more transaction page queries
that are executed using the @dhealth/sdk
transactions
repository.
Note that the unconfirmed- and partial- transaction pools
do not use multiple pages and thereby always return recent
transactions.
An array of promises for transaction pages.
This method returns a transactions query that is compatible with dHealth Network Node's REST gateway. It uses the runtime arguments to determine a query mode of: "incoming", "outgoing" or "both".
The page number to be fetched (defaults to 1
). (optional)
The transaction types that must be included (defaults to any type). (optional)
Whether embedded transactions must be unfold or not (default to true
). (optional)
The page size (defaults to 100
). (optional)
The ordering strategy that is used for the query (defaults to Order.Asc
). (optional)
This method uses the logger to print info messages.
This helper method serves as a parser for the -p
or --include-partial
option of this command.
The partialOption as passed in the terminal.
A boolean value that determines if unconfirmed transactions are included or not.
This helper method serves as a parser for the -s
or --source
option of this command.
The discovery source can contain either of a public
key or an address, that will be parsed into discoverySource.
The sourceArgument as passed in the terminal.
A parsed dHealth Account Address.
This helper method serves as a parser for the -t
or --include-types
option of this command.
The transactionTypes as passed in the terminal.
An array of transaction types or undefined.
This helper method serves as a parser for the -u
or --include-unconfirmed
option of this command.
The unconfirmedOption as passed in the terminal.
A boolean value that determines if unconfirmed transactions are included or not.
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.
This method is the entry point of this scheduler. Due to
the usage of the Cron
decorator, and the implementation
the nest backend runtime is able to discover this when the
discovery
scope is enabled.
This method is necessary to make sure this command is run
with the correct --source
option.
This scheduler is registered to run every 1 minute.
This method implements the execution logic for
discovery commands that extend this class. Child
classes must implement a discover method
that is called.
Note that this method is called by BaseCommand.
The parsed runtime arguments passed to the command.
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.
Generated using TypeDoc
The implementation for the transaction discovery scheduler. Contains source code for the execution logic of a command with name:
discovery:DiscoverTransactions
.v0.2.0