import {GatewayVisitor} from 'fincontracts-lib/src/fincontract-gateway-updater.js'
GatewayVisitor
Extends:
GatewayVisitor performs the actual Gateway update by traversing the FincNode description tree. It extends CollectingVisitor, in order to receive a list of Promises that resolve when Gateways are updated.
Constructor Summary
Public Constructor | ||
public |
constructor(web3: Web3, gateway: Gateway) Constructs the GatewayVisitor object with a web3 instance connected to an Ethereum node and a Gateway smart contract instance not connected to any address |
Method Summary
Public Methods | ||
public |
Called during preorder traversal when processing FincIfNode. |
|
public |
processScaleObsNode(node: FincNode, child: Array<Promise>): Array Called during preorder traversal when processing FincScaleObsNode. |
|
public |
Updates a single Gateway. |
Inherited Summary
From class Visitor | ||
public abstract |
Called when processing FincAndNode. |
|
public abstract |
Called when processing FincGiveNode. |
|
public abstract |
Called when processing FincIfNode. |
|
public abstract |
Called when processing FincOneNode. |
|
public abstract |
Called when processing FincOrNode. |
|
public abstract |
Called when processing FincScaleNode. |
|
public abstract |
Called when processing FincScaleObsNode. |
|
public abstract |
Called when processing FincTimeboundNode. |
|
public abstract |
Called when processing FincZeroNode. |
|
public |
Visits current node. |
From class CollectingVisitor | ||
public |
processAndNode(node: FincNode, left: Object, right: Object): Array Called during preorder traversal when processing FincAndNode. |
|
public |
processGiveNode(node: FincNode, child: Object): Object Called during preorder traversal when processing FincGiveNode. |
|
public |
processIfNode(node: FincNode, left: Object, right: Object): Array Called during preorder traversal when processing FincIfNode. |
|
public |
Called during preorder traversal when processing FincOneNode. |
|
public |
processOrNode(node: FincNode, left: Object, right: Object): Array Called during preorder traversal when processing FincOrNode. |
|
public |
processScaleNode(node: FincNode, child: Object): Object Called during preorder traversal when processing FincScaleNode. |
|
public |
processScaleObsNode(node: FincNode, child: Object): Object Called during preorder traversal when processing FincScaleObsNode. |
|
public |
processTimeboundNode(node: FincNode, child: Object): Object Called during preorder traversal when processing FincTimeboundNode. |
|
public |
Called during preorder traversal when processing FincZeroNode. |
Public Constructors
public constructor(web3: Web3, gateway: Gateway) source
Constructs the GatewayVisitor object with a web3 instance connected to an Ethereum node and a Gateway smart contract instance not connected to any address
Public Methods
public processIfNode(node: FincNode, left: Array<Promise>, right: Array<Promise>): Array source
Called during preorder traversal when processing FincIfNode. Updates the current node's Gateway and returns a Promise list to the parent node.
Override:
CollectingVisitor#processIfNodeParams:
Name | Type | Attribute | Description |
node | FincNode | node currently being processed |
|
left | Array<Promise> | an Array of Promises containing Gateway updates from processing left child (first subtree) of the current node |
|
right | Array<Promise> | an Array of Promises containing Gateway updates from processing right child (second subtree) of the current node |
Return:
Array | an Array of Promises containing the Promise that updates Gateway of the current node concatenated with the Promise lists of its children |
public processScaleObsNode(node: FincNode, child: Array<Promise>): Array source
Called during preorder traversal when processing FincScaleObsNode. Updates the current node's Gateway and returns a Promise list to the parent node.
Return:
Array | an Array of Promises containing the Promise that updates Gateway of the current node concatenated with the Promise list of its child |
public updateGateway(address: String, type: String): Promise<null, Error> source
Updates a single Gateway. Gateway must conform to Gateway interface defined in FincontractMarketplace
Return:
Promise<null, Error> | promise which resolve to nothing if
the Gateway was correctly update or rejects with an Error if the address
was |
Throw:
If address is |