Functions
- encodeName(name, [littleEndian]) ⇒
string.<uint64>
Encode a name (a base32 string) to a number.
For performance reasons, the blockchain uses the numerical encoding of strings for very common types like account names.
- decodeName(value, [littleEndian]) ⇒
string
- DecimalString() ⇒
string
Normalize and validate decimal string (potentially large values). Should avoid internationalization issues if possible but will be safe and throw an error for an invalid number.
Normalization removes extra zeros or decimal.
- DecimalPad(num, [precision]) ⇒
string
Ensure a fixed number of decimal places. Safe for large numbers.
- DecimalImply()
Ensures proper trailing zeros then removes decimal place.
- DecimalUnimply(value, precision) ⇒
number
Put the decimal place back in its position and return the normalized number string (with any unnecessary zeros or an unnecessary decimal removed).
- parseAsset() ⇒
object
Attempts to parse all forms of the asset strings (symbol, asset, or extended versions). If the provided string contains any additional or appears to have invalid information an error is thrown.
Testnet()Localnet()- safeConfig()
Set each property as read-only, read-write, no-access. This is shallow in that it applies only to the root object and does not limit access to properties under a given object.
- mergeWriteFunctions(EosApi) ⇒
object
Merge in write functions (operations). Tested against existing methods for name conflicts.
- defaultSignProvider()
The default sign provider is designed to interact with the available public keys (maybe just one), the transaction, and the blockchain to figure out the minimum set of signing keys.
If only one key is available, the blockchain API calls are skipped and that key is used to sign the transaction.
- Name()
Name eos::types native.hpp
- variant(...variantArray)
A variant is like having a version of an object. A varint comes first and identifies which type of object this is.
- Symbol()
Internal: precision, symbol External: symbol
- SymbolCode()
Symbol type without the precision
- ExtendedSymbol()
Internal: precision, symbol, contract External: symbol, contract
- Asset()
Internal: amount, precision, symbol, contract
- ExtendedAsset()
- authority.fromObject()
shorthand
EOS6MRyAj..
- actionDataOverride()
Nested serialized structure. Nested struct may be in HEX or object format.
- schemaFields()
Collapse inheritance (via "base") putting all the fields in one object.
encodeName(name, [littleEndian]) ⇒ string.<uint64>
Encode a name (a base32 string) to a number.
For performance reasons, the blockchain uses the numerical encoding of strings for very common types like account names.
Kind: global function
Returns: string.<uint64>
- - compressed string (from name arg). A string is
always used because a number could exceed JavaScript's 52 bit limit.
See: types.hpp string_to_name
Param | Type | Default | Description |
---|---|---|---|
name | string |
A string to encode, up to 12 characters long. | |
[littleEndian] | string |
true |
Little or Bigendian encoding |
decodeName(value, [littleEndian]) ⇒ string
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
value | Long | String | number |
uint64 | |
[littleEndian] | string |
true |
Little or Bigendian encoding |
DecimalString() ⇒ string
Normalize and validate decimal string (potentially large values). Should avoid internationalization issues if possible but will be safe and throw an error for an invalid number.
Normalization removes extra zeros or decimal.
Kind: global function
Returns: string
- value
DecimalPad(num, [precision]) ⇒ string
Ensure a fixed number of decimal places. Safe for large numbers.
Kind: global function
Returns: string
- decimal part is added and zero padded to match precision
See: ./format.test.js
Param | Type | Default | Description |
---|---|---|---|
num | number | string | object.toString |
||
[precision] | number |
|
number of decimal places. Null skips padding suffix but still applies number format normalization. |
Example
DecimalPad(10.2, 3) === '10.200'
DecimalImply()
Ensures proper trailing zeros then removes decimal place.
DecimalUnimply(value, precision) ⇒ number
Put the decimal place back in its position and return the normalized number string (with any unnecessary zeros or an unnecessary decimal removed).
Kind: global function
Returns: number
- 1.0000
Param | Type | Description |
---|---|---|
value | string | number | value.toString |
10000 |
precision | number |
4 |
parseAsset() ⇒ object
Attempts to parse all forms of the asset strings (symbol, asset, or extended versions). If the provided string contains any additional or appears to have invalid information an error is thrown.
Kind: global function
Returns: object
- {amount, precision, symbol, contract}
Throws:
- AssertionError
Testnet()
Deprecated
Localnet()
Deprecated
safeConfig()
Set each property as read-only, read-write, no-access. This is shallow in that it applies only to the root object and does not limit access to properties under a given object.
mergeWriteFunctions(EosApi) ⇒ object
Merge in write functions (operations). Tested against existing methods for name conflicts.
Kind: global function
Returns: object
- - read and write method calls (create and sign transactions)
Throw: TypeError
if a funciton name conflicts
Param | Type | Description |
---|---|---|
config.network | object |
read-only api calls |
EosApi | object |
api[EosApi] read-only api calls |
defaultSignProvider()
The default sign provider is designed to interact with the available public keys (maybe just one), the transaction, and the blockchain to figure out the minimum set of signing keys.
If only one key is available, the blockchain API calls are skipped and that key is used to sign the transaction.
Name()
Name eos::types native.hpp
variant(...variantArray)
A variant is like having a version of an object. A varint comes first and identifies which type of object this is.
Kind: global function
Param | Type | Description |
---|---|---|
...variantArray | Array |
array of types |
Symbol()
Internal: precision, symbol External: symbol
Kind: global function Example
'SYS'
SymbolCode()
Symbol type without the precision
ExtendedSymbol()
Internal: precision, symbol, contract External: symbol, contract
Kind: global function Example
'SYS@contract'
Asset()
Internal: amount, precision, symbol, contract
Kind: global function Example
'1.0000 SYS'
ExtendedAsset()
Kind: global function Example
'1.0000 SYS@contract'
authority.fromObject()
shorthand EOS6MRyAj..
actionDataOverride()
Nested serialized structure. Nested struct may be in HEX or object format.
schemaFields()
Collapse inheritance (via "base") putting all the fields in one object.
Kind: global function