Updated API Documentation (markdown)

Iuri Matias 2019-12-24 14:15:23 -05:00
parent 9e389cf7c7
commit 76304f83e3
1 changed files with 243 additions and 0 deletions

@ -341,5 +341,248 @@ name: `deployment:contract:shouldDeploy`
params: {contract: <Contract>, shouldDeploy: boolean}
description: actions to run before deploying a contract, can change the `shouldDeploy` flag
### embark-embarkjs
type: stack component
**requests**
request: `embarkjs:plugin:register`
params:
* stackName - e.g "blockchain", "messages", "storage"
* pluginName - e.g "web3", "whisper"
* packageName - e.g "embarkjs-whisper"
* moduleObj - e.g require('embarkjs-whisper')
registers an embarkjs plugin
request: `embarkjs:console:register`
params:
* stackName - e.g "blockchain", "messages", "storage"
* pluginName - e.g "web3", "whisper"
* packageName - e.g "embarkjs-whisper"
request to register embarkjs plugin the embarkjs instance running on the console/vm.
request: `embarkjs:console:setProvider`
params:
* stackName - e.g "blockchain", "messages", "storage"
* pluginName - e.g "web3", "whisper"
* config - config object necessary for the connection
request to connect a provider for the embarkjs instance running on the console/vm
request: `embarkjs:contract:generate`
params:
* contract - contract object
* doneCb - called when done
request to add contract artifact using embarkjs to the pipeline
request: `embarkjs:contract:runInVm`
params:
* contract - contract object
* doneCb - called when done
requests to run contract using embarkjs in the console/vm
**actions used**
* `pipeline:generateAll:before` - to generate embarkjs artifact according to registered plugins
### namesystem
module type: stack component
#### API
##### requests
name: `namesystem:node:register`
arguments:
* `clientName` - {string} - name of node that starts ENS
* `startCb` - {function} function to start the node
registers a node and the function that starts it
name: `namesystem:node:start`
arguments:
* namesystemConfig {object} - namesystem config (taken from dapp config/namesystem.js)
* doneCb {function} - function that is fired once the namesystem node has started
starts a namesystem node according to the config given. will start one of the nodes previously registered with `namesystem:node:register`
**actions used**
`pipeline:generateAll:before` - to generate the namesystem.json artifact
### ens
module type: plugin component
#### Description
* deploys & configures the ENS contracts, or uses existing one if connected to a supported chain
* registers any domains or subdomains as configured in the namesystem config
* registers the embarkjs-ens plugin & configures it
* registers console commands to interact with ENS
* registers api endpoints
* whitelists eth-ens-namehash package in the vm
**actions used**
* `deployment:deployContracts:beforeAll` - to deploy & configure ENS contracts
* `deployment:deployContracts:afterAll` - to associate contract addresses to ens domain
* `deployment:contract:beforeDeploy` - to replace contract arguments if they have ens domains with the associated adddress
### graph
module type: plugin
#### Requests
**name**: `graph:create`
**description**: Creates a diagram of Smart Contracts architecture.
**params**:
* options - `Object` - Options to configure graph task
* `skipFunctions` - Skip functions in graph generation
* `skipEvents` - Skip events in graph generation
* `skipUndeployed` - Skip undeployed contracts
* `output` - The path to write the diagram to
### library-manager
module type: stack
#### Endpoints
**endpoint**: `/embark-api/versions`
**type**: `GET`
**params**: -
**response**: `Array<{value: string, name: string}>` - List of available versions for packages.
### Requests
**name**: `versions:get:[NAME]`
**description**: Returns version of a given package, given `NAME`.
**params**:
* name - `String` - Library name (e.g. `ipfs`, `solc` etc)
---
**name**: `version:getPackageLocation`
**description**: Returns package location, given a name and version number.
**params**:
* name - `String` - Library name (e.g. `ipfs`, `solc` etc)
* version - String - version of library
---
**name**: `version:downloadIfNeeded`
**description**: Downloads a library, given its name.
**params**:
- name - `String` - Library name (e.g. `ipfs`, `solc` etc)
---
**name**: `version:getPackagePath`
**description**: Returns a path to a package given its name and version
**params**:
* name - `String` - Library name (e.g. `ipfs`, `solc` etc)
* version - `String` - Library version
### embark-pipeline
module type: stack component
#### API
##### requests
name: `pipeline:generateAll`
Generates files registered with the pipeline
name: `pipeline:register`
arguments:
* Object
* `path` (array<string>) - directory to write the file
* `file` <string> - filename
* `format` <string> - file format
* `content` <string> - file content
registers a file with the pipeline to be generated.
if a path+file has already been registered before, it will override it.
##### actions
name: `pipeline:generateAll:before`
description: actions to run before the pipeline generates all the files
name: `pipeline:generateAll:after`
description: actiosn to run after the pipeline generates all the files
### basic-pipeline
module type: plugin
#### Description
* runs webpack after pipeline generates files that were registered
**actions used**
* `pipeline:generateAll:after` - to run webpack after pipeline has generated files
**events used**
* `config:load:pipeline` - to get new pipeline config when it changes
### embark-communication
module type: stack component
#### API
##### requests
name: `communication:node:register`
arguments:
* clientName {string} - name of the client (e.g 'ipfs')
* startCb {function} - function that starts the node
registers a node and the function that starts it
name: `communication:node:start`
arguments:
* communicationConfig {object} - communication config (taken from dapp config/communication.js)
* doneCb {function} - function that is fired once the blockchain node has started
starts a communication node according to the config given. will start one of the nodes previously registered with `communication:node:register`
**actions used**
* `pipeline:generateAll:before` - to generate communication.json config artifact
**events emited*
* `communication:started` - emitted when communication node starts
### embark-whisper
module type: plugin
#### Description
* whitelists embarkjs & embarkjs-whisper packages in the vm
* generates whisper artifacts
* makes whisper work in the console
* registers api endpoints
**actions used**
* `pipeline:generateAll:after` - to register whisper artifact
**events used**
* `blockchain:started` - to connect embarkjs whisper to node in the console