Constructs an instance of this Factory
class.
Note that you should not use this method directly,
please refer to the static API methods instead.
(Optional) A configuration object that is used to overwrite the default network parameters.
This method parses the contract signature and creates a new instance
of a child class of Contract, attaching the version, the
inputs and network parameters to it, i.e. this method may return
instances from classes that include, but are not limited to: Auth,
Earn, Referral or Welcome.
Given an invalid {@link contract} signature, this method will trigger
the UnknownContractError to be thrown.
This method is used internally to create a matching contract's child
class instance using the correct inputs, version and parameters.
A contract signature that consists of the dApp identifier and the contract identifier.
A contract version that consists of a number set to identify the version of the contract implementation.
A set of inputs that are/were passed to the contract during runtime and that are attached to its JSON payload.
The network parameters ("connection details") as present in the factory.
This method parses a contract's JSON payload to create an
object of type ObjectLiteral. This is necessary to
further secure the processes that manipulate this created
object.
Invalid JSON errors will trigger the InvalidContractError
exception to be thrown.
This method is used internally to transform a string
JSON
payload into an ObjectLiteral by making sure that the
JSON payload uses valid JSON formatting rules.
A string
or ObjectLiteral object that contains the full JSON payload of the contract.
A parsed contract consists of an object
of type ObjectLiteral.
This method parses a contract's JSON payload to create an
object of type ObjectLiteral. This is necessary to
further secure the processes that manipulate this created
object. Note that we use the Contract.fromTransaction method
to parse JSON payloads from transaction objects as presented
on dHealth Network.
Invalid JSON errors will trigger the InvalidContractError
exception to be thrown.
This method is used internally to transform a Transaction
object into an ObjectLiteral by making sure that the
JSON payload uses valid JSON formatting rules and lives
inside either of: the transfer transaction message or the
aggregate bundle's first transfer transaction's message.
A transaction object that contains the full definition of the executed contract.
A parsed contract consists of an object
of type ObjectLiteral.
This static factory method creates a contract instance
using its' JSON payload as present on dHealth Network in
transfer transaction messages.
Note that JSON payloads must contain a contract
field,
as well as a version
field. Additionally, for some contracts
it is possible that other fields are required, as defined by
their Contract.body implementation.
As for the dApp identifier, that is attached in the contract
field, we authorize the use of uppercase characters just to
prevent unnecessary errors from happening due toinconsistent
end-user inputs, i.e. on-chain it is OK to use `"ELEvATE:auTH",
but we of course recommend not to do that and to rather
prefer using this library for creating contract, instead.
A string
or ObjectLiteral object that contains the full JSON payload of the contract.
(Optional) A configuration object that is used to overwrite the default network parameters.
This static factory method creates a contract instance
using a dHealth Transaction, as present on dHealth Network
in transfer transaction messages OR in the first transfer
transaction of an aggregate bundle.
Refer to the Factory.createFromJSON factory for more details
about how this library parses the JSON payloads.
A transaction object that contains the full definition of the executed contract.
(Optional) A configuration object that is used to overwrite the default network parameters.
Generated using TypeDoc
This factory class can used to re-build contracts from their JSON payloads or directly from the transactions that included them.
Use this factory whenever you would like to create a contract instance from its' JSON payload or transaction content.
Using the
Factory
classOther links
Contract | Auth | Earn | Referral | Welcome
v0.3.0