eosio-wasm-js
A utility tool that serialises EOSIO based blockchain types to a WASM hex string.
This tool may be useful for those wanting to serialise actions in JS environments for EOSIO based blockchain actions.
Setup
$ npm i eosio-wasm-js
Support
Consider a BigInt polyfill library for safari 13.
API
function asset
Serialises EOSIO asset type to WASM hex string.
Parameter | Type | Description |
---|
asset_string | string | string to be serilaised. |
Returns: string — Serialised hex string.
function block_time_stamp
Convert date in ISO format to block_timestamp_type
(half-seconds since a different epoch)
Parameter | Type | Description |
---|
time_String | string | ISO date format. |
Returns: string — hex string.
function bool
Serialise Boolean.
Parameter | Type | Description |
---|
boolean | string | boolean | number | true or false. |
Returns: string — Hexstring
function bytes
Serilaises byte string to WASM bytes.
Parameter | Type | Description |
---|
byte_string | string | The byte string. |
Returns: string — The byte string.
function checksum
Creates a checksum WASM hex string.
Parameter | Type | Description |
---|
byte_string | string | Hexadecimal string. |
bytes | 20 | 32 | 64 | For checksum160, checksum256 and checksum512 respectively. |
Returns: string — Checksum hex string.
function extended_asset
Serialises an extended asset to WASM hex string.
Parameter | Type | Description |
---|
ea_string | string | Extended asset string. |
Returns: string — Wasm hex string.
function float128
Validates a little endian float 128 hex string.
Parameter | Type | Description |
---|
f128 | string | Hexacecimal representation of the float128. |
Returns: string — Hexstring.
function float32
Serialises a float32 to a WASM hex string.
Parameter | Type | Description |
---|
f32 | number | string | Float32 to be serialised. |
Returns: string — Hex string.
function float64
Serialises a float64 to a WASM hex string.
Parameter | Type | Description |
---|
f64 | number | string | float64 to be serialised. |
Returns: string — Hex string.
function int
Serializes any signed integer (uint) to hexadecimal code.
Parameter | Type | Description |
---|
number | number | string | bigint | A signed integer. |
bytes | number | number of bytes to place the int into |
Returns: string — Hexstring
function name
Serialises a EOS name into a WASM hex string.
Parameter | Type | Description |
---|
name_string | string | EOS name string. |
Returns: string — hex string.
function string
serialises string into a WASM hex string.
Parameter | Type | Description |
---|
str | string | String |
Returns: string — hex string.
function symbol
Serilaises a symbol string to a WASM hex string.
Parameter | Type | Description |
---|
symbol_string | string | To be serialised. |
Returns: string — Hex string.
function symbol_code
Serilaises a symbol code to a WASM hex string.
Parameter | Type | Description |
---|
symbol_code_string | string | To be serialised. |
Returns: string — Hex string.
function time_point
Serialises time point into WASM hex string.
Parameter | Type | Description |
---|
time_string | string | ISO date. |
Returns: string — hex string of the time.
function time_point_sec
Convert date in ISO format to time_point_sec
(seconds since epoch) WASM string.
Parameter | Type | Description |
---|
time_string | string | ISO date. |
Returns: string — seconds since epoch.
function uint
Serializes any unsigned integer (uint) to hexadecimal string.
Parameter | Type | Description |
---|
number | number | string | bigint | the uint thta will be serialized |
bytes | number | Number of bytes to place the uint into. |
Returns: string — Hex string.
function varint32
varint32
Parameter | Type | Description |
---|
number | number | variable unsigend integer to sign. |
Returns: string — varint32 hex string.
function varuint32
Serialises a varuint32 number to a WASM hex string.
Parameter | Type | Description |
---|
number | number | Unsigned variable-length integer, 32 bits. |
buffer | Array? | Recursion transformation for the LEB128 type. |
Returns: string — Varuint32 hexadecimal string.