@burstjs/core
Burst-related functions and models for building Burstcoin applications.
Installation
Install using npm:
npm install @burstjs/core
or using yarn:
yarn add @burstjs/core
API Reference
BurstService
Generic BRS Web Service class.
Extend and specific services here
Kind: global class
new BurstService(baseUrl, relativePath, httpClient)
Creates Service instance
Param | Type | Description |
---|
baseUrl | | The host url of web service |
relativePath | | The relative path will be prepended before each url created with toBRSEndpoint() |
httpClient | Http | If passed an client instance, it will be used instead of default HttpImpl. Good for testing. |
burstService.http ⇒
Kind: instance property of BurstService
Returns:
The internal Http client
burstService.toBRSEndpoint(method, data) ⇒
Mounts a BRS conform API endpoint of format <host>?requestType=getBlock&height=123
Kind: instance method of BurstService
Returns:
The mounted url (without host)
See:
https://burstwiki.org/wiki/The_Burst_API
Param | Description |
---|
method | The method name for requestType |
data | A JSON object which will be mapped to url params |
burstService.query(method, args) ⇒
Requests a query to BRS
Kind: instance method of BurstService
Returns:
The response data of success
Throws:
burstService.send(method, args) ⇒
Send data to BRS
Kind: instance method of BurstService
Returns:
The response data of success
Throws:
Param | Description |
---|
method | The BRS method accordinghttps://burstwiki.org/wiki/The_Burst_API#Create_Transaction. Note that there are only a few POST methods |
args | A JSON object which will be mapped to url params |