Home Reference Source Repository
public class | source

GatewayUpdater

GatewayUpdater updates Gateways contained inside Fincontract instance (see Fincontract.rootDescription). The actual traversal and update is done by GatewayVisitor.

Example:

import Fetcher from './fincontract-fetcher';
import GatewayUpdater from './fincontract-gateway-updater';
try {
  const fctID = '<32-byte address of blockchain deployed Fincontract>'
  const gu = new GatewayUpdater(web3, gateway);
  const fetcher = new Fetcher(marketplace);
  const f = await fetcher.pullFincontract(fctID);
  await gu.updateAllGateways(f.rootDescription);
} catch (err) {
  console.log(err);
}

Constructor Summary

Public Constructor
public

constructor(web3: Web3, gateway: Gateway)

Constructs the GatewayUpdater 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

Public Constructors

public constructor(web3: Web3, gateway: Gateway) source

Constructs the GatewayUpdater object with a web3 instance connected to an Ethereum node and a Gateway smart contract instance not connected to any address

Params:

NameTypeAttributeDescription
web3 Web3

a web3 instance connected to an Ethereum node

gateway Gateway

a gateway instance not connected to any address

Public Methods

public updateAllGateways(node: FincNode): Promise<null, Error> source

Params:

NameTypeAttributeDescription
node FincNode

FincNode description tree

Return:

Promise<null, Error>

promise that resolves to nothing if all Gateways were correctly updated or rejects with an Error