Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@burstjs/core

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@burstjs/core

Burst-related functions and models for building Burstcoin applications.

  • 0.1.0-rc.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-30.77%
Maintainers
2
Weekly downloads
 
Created
Source

@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

Classes

BurstService

Generic BRS Web Service class. Extend and specific services here

Functions

generateSendTransactionQRCode(receiverId, amountNQT, feeSuggestionType)Promise.<ArrayBufferLike>

Get QR Code image for a given BURST address

generateSendTransactionQRCodeAddress(receiverId, amountNQT, feeSuggestionType)Promise.<string>

Generate the URL for a QR Code for a given BURST address. Useful for IMG tags in HTML.

getAccountBalance()

Submits a getBalance query given an accountId

getAccountTransactions(accountId, firstIndex, lastIndex, numberOfConfirmations)Promise.<TransactionList>

Get transactions of given account

getAliases(accountId)Promise.<AliasList>

Gets the aliases of an account

getUnconfirmedAccountTransactions(accountId)Promise.<UnconfirmedTransactionList>

Get unconfirmed transactions of given account

getBlockByHeight(height, includeTransactions)

Get a block by given height

getBlockById(id, includeTransactions)

Get a block by given id

getBlockByTimestamp()

Original work Copyright (c) 2019 Burst Apps Team

getBlockId(height)Promise.<BlockId>

Get a block id by given height

constructAttachment(transactions, params)

Constructs an Attachment

sendTextMessage(message, recipientId, senderPublicKey, senderPrivateKey, fee)

Broadcasts a text message to the network/blockchain

The message will be broadcasted in two steps.

  1. Send the message with public key to the network
  2. Take the returned unsigned message and sign it, i.e. the private key won't be transmitted.
getBlockchainStatus()

Get the blockchain status.

getServerStatus()

Get the state of the server node and network

suggestFee()Promise.<SuggestedFees>

Get the current suggested fees

broadcastTransaction(signedTransactionPayload)

Broadcasts a transaction to the network/blockchain

getTransaction(transactionId)

Get a transaction from the network/blockchain

sendMoney(transaction, senderPublicKey, senderPrivateKey, recipientAddress)

Sends burst to the blockchain

The message will be broadcasted in two steps.

  1. Send the sendMoney call with public key to the network
  2. Take the returned unsigned message and sign it, i.e. the private key won't be transmitted.

BurstService

Generic BRS Web Service class. Extend and specific services here

Kind: global class

new BurstService(baseUrl, relativePath, httpClient)

Creates Service instance

ParamTypeDescription
baseUrl

The host url of web service

relativePath

The relative path will be prepended before each url created with toBRSEndpoint()

httpClientHttp

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

ParamDescription
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:

  • HttpError in case of failure

ParamDescription
method

The BRS method according https://burstwiki.org/wiki/The_Burst_API

args

A JSON object which will be mapped to url params

burstService.send(method, args, body) ⇒

Send data to BRS

Kind: instance method of BurstService
Returns:

The response data of success


Throws:

  • HttpError in case of failure

ParamDescription
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

body

An object with key value pairs to submit as post body

generateSendTransactionQRCode(receiverId, amountNQT, feeSuggestionType) ⇒ Promise.<ArrayBufferLike>

Get QR Code image for a given BURST address

Kind: global function

ParamTypeDescription
receiverIdstring

The recipient burst

amountNQTstring

The amount (in NQT) to request

feeSuggestionTypestring

The fee suggestion type string

generateSendTransactionQRCodeAddress(receiverId, amountNQT, feeSuggestionType) ⇒ Promise.<string>

Generate the URL for a QR Code for a given BURST address. Useful for IMG tags in HTML.

Kind: global function

ParamTypeDescription
receiverIdstring

The recipient burst address

amountNQTstring

The amount (in NQT) to request

feeSuggestionTypestring

The fee suggestion type string

getAccountBalance()

Submits a getBalance query given an accountId

Kind: global function

getAccountTransactions(accountId, firstIndex, lastIndex, numberOfConfirmations) ⇒ Promise.<TransactionList>

Get transactions of given account

Kind: global function

ParamTypeDescription
accountIdstring

The numeric accountId

firstIndexnumber

The first index of the transaction list, beginning at 0

lastIndexnumber

The last index of the transaction list

numberOfConfirmationsnumber

The minimum required number of confirmations per transaction

getAliases(accountId) ⇒ Promise.<AliasList>

Gets the aliases of an account

Kind: global function

ParamType
accountIdstring

getUnconfirmedAccountTransactions(accountId) ⇒ Promise.<UnconfirmedTransactionList>

Get unconfirmed transactions of given account

Kind: global function

ParamTypeDescription
accountIdstring

The numeric accountId

getBlockByHeight(height, includeTransactions) ⇒

Get a block by given height

Kind: global function
Returns:

The Block

ParamDescription
height

The block height

includeTransactions

true, if transactions shall be included

getBlockById(id, includeTransactions) ⇒

Get a block by given id

Kind: global function
Returns:

The Block

ParamDescription
id

The block id

includeTransactions

true, if transactions shall be included

getBlockByTimestamp()

Original work Copyright (c) 2019 Burst Apps Team

Kind: global function

getBlockId(height) ⇒ Promise.<BlockId>

Get a block id by given height

Kind: global function
Returns: Promise.<BlockId> -

The Block Id

ParamTypeDescription
heightnumber

The block height

constructAttachment(transactions, params) ⇒

Constructs an Attachment

Kind: global function
Returns:

HttpParams

ParamDescription
transactions

The transaction with the attachment

params

Some HttpParams

sendTextMessage(message, recipientId, senderPublicKey, senderPrivateKey, fee) ⇒

Broadcasts a text message to the network/blockchain

The message will be broadcasted in two steps.

  1. Send the message with public key to the network
  2. Take the returned unsigned message and sign it, i.e. the private key won't be transmitted.

Kind: global function
Returns:

The Transaction Id

ParamDescription
message

The text message to be sent

recipientId

The recipients Id, not RS Address

senderPublicKey

The senders public key for sending an unsigned message

senderPrivateKey

The senders private key to sign the message

fee

The optional fee (expressed in Burst) for the message, default is 0.1 Burst.

getBlockchainStatus() ⇒

Get the blockchain status.

Kind: global function
Returns:

The Blockchain Status


getServerStatus() ⇒

Get the state of the server node and network

Kind: global function
Returns:

The server Status


suggestFee() ⇒ Promise.<SuggestedFees>

Get the current suggested fees

Kind: global function
Returns: Promise.<SuggestedFees> -

The Suggested Fees


broadcastTransaction(signedTransactionPayload) ⇒

Broadcasts a transaction to the network/blockchain

Kind: global function
Returns:

The Transaction Id

ParamDescription
signedTransactionPayload

The signed transaction payload encoded in base64

getTransaction(transactionId) ⇒

Get a transaction from the network/blockchain

Kind: global function
Returns:

The Transaction

ParamDescription
transactionId

The transaction Id

sendMoney(transaction, senderPublicKey, senderPrivateKey, recipientAddress) ⇒

Sends burst to the blockchain

The message will be broadcasted in two steps.

  1. Send the sendMoney call with public key to the network
  2. Take the returned unsigned message and sign it, i.e. the private key won't be transmitted.

Kind: global function
Returns:

The Transaction

ParamDescription
transaction

The unsigned transaction

senderPublicKey

The senders public key for sending an unsigned message

senderPrivateKey

The senders private key to sign the message

recipientAddress

The recipients RS Address

FAQs

Package last updated on 04 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc