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

@burstjs/contracts

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@burstjs/contracts

Smart Contracts package for BURST

  • 0.6.0-beta.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

@burstjs/contracts

Generic HTTP client that is used as a network provider for @burst/core.

Installation

@burstjs/contracts can be used with NodeJS or Web. Two formats are available

Using with NodeJS and/or modern web frameworks

Install using npm:

npm install @burstjs/contracts

or using yarn:

yarn add @burstjs/contracts
Example
// TO DO

Using in classic <script>

Each package is available as bundled standalone library using IIFE. This way burstJS can be used also within <script>-Tags. This might be useful for Wordpress and/or other PHP applications.

Just import the package using the HTML <script> tag.

<script src='https://cdn.jsdelivr.net/npm/@burstjs/http/dist/burstjs.http.min.js'></script>

Example
// TO DO

See more here:

@burstjs/contracts Online Documentation


API Reference

Modules

contracts

Helper class for contracts

A contract owns additional data, which is split in 8 byte blocks. The content is encoded in hexadecimal representation and big endianness. This class facilitates access to these data

contracts

Calculates the minimum creation fee of the contract

contracts
contracts

Counts the code pages for given machine code

contracts

Generates a method call message of a contracts public method. The message can be sent using for example [[MessageApi.sendMessage]] with messageIsText = false or [[ContractApi.callContractMethod]]]

contracts

Extracts a variables value as hexadecimal string from a contract's machine data

This is a generic function to extract arbitrary data from a contract. It's recommended to use the [[ContractDataView]] class instead

Functions

convertArgument(value)

contracts

Helper class for contracts

A contract owns additional data, which is split in 8 byte blocks. The content is encoded in hexadecimal representation and big endianness. This class facilitates access to these data

contracts~ContractDataView

Kind: inner class of contracts

new ContractDataView()

The length of a contracts variable (considering Hex notation)

contractDataView.getContract() ⇒

Kind: instance method of ContractDataView
Returns:

Get the contract


contractDataView.countCodePages() ⇒

Kind: instance method of ContractDataView
Returns:

The number of code pages


contractDataView.getVariableAsString(index) ⇒

Get a variable as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getDataBlocksAsString(index, count) ⇒

Get multiple data blocks as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

count

Number of blocks

contractDataView.getVariableAsDecimal(index) ⇒

Get a variable as decimal (string)

Kind: instance method of ContractDataView
Returns:

The data as a decimal string sequence

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getVariable(index) ⇒

Get a variable at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getHexDataAt(index, length) ⇒

Get a hexadecimal data block of arbitrary length at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

length

The length of the data block (must be a multiple of 2)

contracts ⇒

Calculates the minimum creation fee of the contract

Returns:

The minimum fee

ParamDescription
hexCode

The contracts code in hex form

isCIP20active

If is true, the fee calculation for active CIP20 is applied (lowered fees), otherwise the legacy calculation (BRS <V2.5) is applied

contracts~ContractDataView

Kind: inner class of contracts

new ContractDataView()

The length of a contracts variable (considering Hex notation)

contractDataView.getContract() ⇒

Kind: instance method of ContractDataView
Returns:

Get the contract


contractDataView.countCodePages() ⇒

Kind: instance method of ContractDataView
Returns:

The number of code pages


contractDataView.getVariableAsString(index) ⇒

Get a variable as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getDataBlocksAsString(index, count) ⇒

Get multiple data blocks as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

count

Number of blocks

contractDataView.getVariableAsDecimal(index) ⇒

Get a variable as decimal (string)

Kind: instance method of ContractDataView
Returns:

The data as a decimal string sequence

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getVariable(index) ⇒

Get a variable at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getHexDataAt(index, length) ⇒

Get a hexadecimal data block of arbitrary length at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

length

The length of the data block (must be a multiple of 2)

contracts

Internal: Size of Code Pages in bytes

contracts~ContractDataView

Kind: inner class of contracts

new ContractDataView()

The length of a contracts variable (considering Hex notation)

contractDataView.getContract() ⇒

Kind: instance method of ContractDataView
Returns:

Get the contract


contractDataView.countCodePages() ⇒

Kind: instance method of ContractDataView
Returns:

The number of code pages


contractDataView.getVariableAsString(index) ⇒

Get a variable as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getDataBlocksAsString(index, count) ⇒

Get multiple data blocks as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

count

Number of blocks

contractDataView.getVariableAsDecimal(index) ⇒

Get a variable as decimal (string)

Kind: instance method of ContractDataView
Returns:

The data as a decimal string sequence

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getVariable(index) ⇒

Get a variable at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getHexDataAt(index, length) ⇒

Get a hexadecimal data block of arbitrary length at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

length

The length of the data block (must be a multiple of 2)

contracts ⇒

Counts the code pages for given machine code

Returns:

The number of code pages for the passed code

ParamDescription
hexCode

The contracts code in hex form

contracts~ContractDataView

Kind: inner class of contracts

new ContractDataView()

The length of a contracts variable (considering Hex notation)

contractDataView.getContract() ⇒

Kind: instance method of ContractDataView
Returns:

Get the contract


contractDataView.countCodePages() ⇒

Kind: instance method of ContractDataView
Returns:

The number of code pages


contractDataView.getVariableAsString(index) ⇒

Get a variable as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getDataBlocksAsString(index, count) ⇒

Get multiple data blocks as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

count

Number of blocks

contractDataView.getVariableAsDecimal(index) ⇒

Get a variable as decimal (string)

Kind: instance method of ContractDataView
Returns:

The data as a decimal string sequence

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getVariable(index) ⇒

Get a variable at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getHexDataAt(index, length) ⇒

Get a hexadecimal data block of arbitrary length at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

length

The length of the data block (must be a multiple of 2)

contracts ⇒

Generates a method call message of a contracts public method. The message can be sent using for example [[MessageApi.sendMessage]] with messageIsText = false or [[ContractApi.callContractMethod]]]

Returns:

A hex string that can be used as contracts transaction message

ParamDescription
args

The argument object

contracts~ContractDataView

Kind: inner class of contracts

new ContractDataView()

The length of a contracts variable (considering Hex notation)

contractDataView.getContract() ⇒

Kind: instance method of ContractDataView
Returns:

Get the contract


contractDataView.countCodePages() ⇒

Kind: instance method of ContractDataView
Returns:

The number of code pages


contractDataView.getVariableAsString(index) ⇒

Get a variable as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getDataBlocksAsString(index, count) ⇒

Get multiple data blocks as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

count

Number of blocks

contractDataView.getVariableAsDecimal(index) ⇒

Get a variable as decimal (string)

Kind: instance method of ContractDataView
Returns:

The data as a decimal string sequence

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getVariable(index) ⇒

Get a variable at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getHexDataAt(index, length) ⇒

Get a hexadecimal data block of arbitrary length at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

length

The length of the data block (must be a multiple of 2)

contracts ⇒

Extracts a variables value as hexadecimal string from a contract's machine data

This is a generic function to extract arbitrary data from a contract. It's recommended to use the [[ContractDataView]] class instead

Returns:

The value as hexadecimal string (already considering endianness)

ParamDescription
contract

The contract

position

The variables position

length

The length of data to be extracted

contracts~ContractDataView

Kind: inner class of contracts

new ContractDataView()

The length of a contracts variable (considering Hex notation)

contractDataView.getContract() ⇒

Kind: instance method of ContractDataView
Returns:

Get the contract


contractDataView.countCodePages() ⇒

Kind: instance method of ContractDataView
Returns:

The number of code pages


contractDataView.getVariableAsString(index) ⇒

Get a variable as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getDataBlocksAsString(index, count) ⇒

Get multiple data blocks as string

Kind: instance method of ContractDataView
Returns:

The data as string (Utf-8)

ParamDescription
index

The index of variable (starting at 0)

count

Number of blocks

contractDataView.getVariableAsDecimal(index) ⇒

Get a variable as decimal (string)

Kind: instance method of ContractDataView
Returns:

The data as a decimal string sequence

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getVariable(index) ⇒

Get a variable at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

contractDataView.getHexDataAt(index, length) ⇒

Get a hexadecimal data block of arbitrary length at given position/index

Kind: instance method of ContractDataView
Returns:

The data as hexadecimal string (in little endianness)

ParamDescription
index

The index of variable (starting at 0)

length

The length of the data block (must be a multiple of 2)

convertArgument(value)

Kind: global function
Internal:

Param
value

FAQs

Package last updated on 07 Apr 2021

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