Fetcher
Fetcher class is used for fetching blockchain deployed Fincontracts, by
calling appropriate functions (see getFincontractInfo
and
getDescriptionInfo
from FincontractMarketplace). It recursively
traverses the deployed Fincontract and constructs it's copy for further
processing in memory.
Constructor Summary
Public Constructor | ||
public |
constructor(marketplace: FincontractMarketplace) Constructs the Fetcher object with Fincontracts smart contract instance |
Method Summary
Public Methods | ||
public |
constructNode(descInfo: Array, childrenIds: Array): FincNode Constructs a current FincNode given it's description, which uniquely specifies the type of node to be constructed as well as its already constructed sub-nodes (childrenIds) and returns the currentNode. Due to lack of direct support for Timebound and Scale nodes by FincontractMarketplace, they are inferred from the description.
|
|
public |
getDescriptionInfo(descID: String): Promise<String, Error> Fetches the blockchain deployed Fincontract description given its 32-byte address. |
|
public |
getFincontractInfo(fctID: String): Promise<String, Error> Fetches the blockchain deployed Fincontract info given its 32-byte address. |
|
public |
async pullDescription(descID: String): FincNode Performs a recursive description fetch, given a root 32-byte address of the blockchain deployed Fincontract description |
|
public |
async pullFincontract(fctID: String): Fincontract Fetches Fincontract from blockchain given its 32-byte address, by recursively fetching nodes and it's children and constructing the FincNode description tree (see Fetcher#pullDescription) |
Public Constructors
public constructor(marketplace: FincontractMarketplace) source
Constructs the Fetcher object with Fincontracts smart contract instance
Params:
Name | Type | Attribute | Description |
marketplace | FincontractMarketplace | a Fincontracts smart contract instance |
Public Methods
public constructNode(descInfo: Array, childrenIds: Array): FincNode source
Constructs a current FincNode given it's description, which uniquely specifies the type of node to be constructed as well as its already constructed sub-nodes (childrenIds) and returns the currentNode. Due to lack of direct support for Timebound and Scale nodes by FincontractMarketplace, they are inferred from the description.
- FincScaleNode - Scale node is constructed if description contains scale factor not equal to 1
- FincTimeboundNode - Timebound node is constructed if description contains lower bound not equal to 0
Params:
Name | Type | Attribute | Description |
descInfo | Array | array containing description, as defined by
|
|
childrenIds | Array | array containing FincNode children of the current node |
public getDescriptionInfo(descID: String): Promise<String, Error> source
Fetches the blockchain deployed Fincontract description given
its 32-byte address. Returns a promise, that resolves to the Fincontract
description as defined by getDescriptionInfo
function
in FincontractMarketplace or rejects with an Error if the whole
description was empty.
Params:
Name | Type | Attribute | Description |
descID | String | 32-byte address of the blockchain deployed Fincontract description |
public getFincontractInfo(fctID: String): Promise<String, Error> source
Fetches the blockchain deployed Fincontract info given its 32-byte address.
Returns a promise, that resolves to the Fincontract info as defined
by getFincontractInfo
function in FincontractMarketplace or
rejects with an Error if the Fincontract was not found.
Params:
Name | Type | Attribute | Description |
fctID | String | 32-byte address of the blockchain deployed Fincontract |
public async pullDescription(descID: String): FincNode source
Performs a recursive description fetch, given a root 32-byte address of the blockchain deployed Fincontract description
Params:
Name | Type | Attribute | Description |
descID | String | 32-byte address of a blockchain deployed Fincontract's description |
public async pullFincontract(fctID: String): Fincontract source
Fetches Fincontract from blockchain given its 32-byte address, by recursively fetching nodes and it's children and constructing the FincNode description tree (see Fetcher#pullDescription)
Params:
Name | Type | Attribute | Description |
fctID | String | 32-byte address of a blockchain deployed Fincontract |