Skip to content

BlockApps-Rest

BlockApps-Rest is an extremely lightweight Node SDK for building front-end applications around the strato-api, bloc-server, and cirrus services, which enables rapid development of front end applications.

Installation

To install, use npm install to either directly install, or include a reference to ba-rest in your app's package.json file. Because the module is not actively maintained (but the github repo is), please specify the release version you would like using a reference to the release version listed on github. For example:

Directly install:

npm install --save "git://github.com/blockapps/blockapps-rest.git#v7.4"

Adding manually on package.json:

"dependencies": {
  "blockapps-rest": "git://github.com/blockapps/blockapps-rest.git#v7.4",
}

Configuration

To get started with BlockApps-rest, we must include our configuration file, config.yaml, which we store in the root directory of strato-getting-started.

apiDebug: true
password: '1234'
timeout: 600000
contractsPath: ./contracts
dataFilename: ./config/demo-data.yaml
deployFilename: ./config/<YOUR NODE NAME>.deploy.yaml

# WARNING - extra strict syntax 
# DO NOT change the nodes order 
# node 0 is the default url for all single node api calls 
nodes:
  - id: 0
    explorerUrl: <YOUR EXPLORER INSTANCE>
    stratoUrl: <YOUR STRATO INSTANCE>
    blocUrl: <YOUR BLOCK INSTANCE>
    searchUrl: <YOUR CIRRUS INSTANCE>

apiDebug: flag to log detailed debugging information

password: the password used to create contracts that are used in deployment

timeout: timeout to fail tests

contractsPath: the path from root directory to folder storing solidity files (.sol)

dataFilename: initialization data to be used in deploying

deployFilename: deploy file, contains information such as contract addresses required to interact with contracts created in the deployment

Async/Await Functions

BlockApps-Rest uses async/wait expressions to invoke the API synchronous calls. This syntax removes the need for chaining promises.

The full list of BlockApps-Rest methods are available here.