# Util
Supported protocols:
JSON-RPC 2.0 | Websocket | IPC | Publish–subscribe |
---|---|---|---|
✓ | ✓ | ✓ | TBD |
# util_decrypt
Decrypt the cryptograph string by passphrase
Parameters:
string
: cryptograph, encoded by base64string
: passphrase
Returns:
string
: raw data
Example:
{
"jsonrpc": "2.0",
"id": 1,
"method": "util_decrypt",
"params": [
"eyJjcnlwdG8iOnsiY2lwaGVydGV4dCI6ImI3OTkwNmRlOGE0NzYzOTZjZmE2OTM4ZjFmZjMxMTdjMjVlZWVhNDMzNTJiNmM1MTA2MDA2ZGJiODFkN2FhNGY5NWIxMjEzYmE3ZDIzM2MyNTU0NGIyYzg1MDYwNGRjMyIsIm5vbmNlIjoiYzNkMzk1NDdhZGFhMWZlZWZmODBmMWI4Iiwic2NyeXB0cGFyYW1zIjp7Im4iOjI2MjE0NCwiciI6OCwicCI6MSwia2V5bGVuIjozMiwic2FsdCI6ImE0NGJiMmU0MTMxMDYyNTc1NWEyOWVkYzg3NGFmMzFkNTk1M2QzNzQyODMwNDk2YTUyZjdkMjY2ZWYxMzMzMTAifX0sInRpbWVzdGFtcCI6MTU1MzU4ODc5N30=",
"98qUb5Ud"
]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": "a7bcc2785e93226699618087528c4fbc8990fc247f12743e2a9caea8590756a0"
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "util_decrypt",
"params": [
"eyJjcnlwdG8iOnsiY2lwaGVydGV4dCI6ImI3OTkwNmRlOGE0NzYzOTZjZmE2OTM4ZjFmZjMxMTdjMjVlZWVhNDMzNTJiNmM1MTA2MDA2ZGJiODFkN2FhNGY5NWIxMjEzYmE3ZDIzM2MyNTU0NGIyYzg1MDYwNGRjMyIsIm5vbmNlIjoiYzNkMzk1NDdhZGFhMWZlZWZmODBmMWI4Iiwic2NyeXB0cGFyYW1zIjp7Im4iOjI2MjE0NCwiciI6OCwicCI6MSwia2V5bGVuIjozMiwic2FsdCI6ImE0NGJiMmU0MTMxMDYyNTc1NWEyOWVkYzg3NGFmMzFkNTk1M2QzNzQyODMwNDk2YTUyZjdkMjY2ZWYxMzMzMTAifX0sInRpbWVzdGFtcCI6MTU1MzU4ODc5N30=",
"98qUb5Ud"
]
}
# util_encrypt
Encrypt encrypt raw data by passphrase
Parameters:
string
: raw data, need a hex stringstring
: passphrase
Returns:
string
: cryptograph , encoded by base64
Example:
{
"jsonrpc": "2.0",
"id":2,
"method":"util_encrypt",
"params": ["a7bcc2785e93226699618087528c4fbc8990fc247f12743e2a9caea8590756a0","98qUb5Ud"]
}
{
"jsonrpc": "2.0",
"id": 2,
"result": "eyJjcnlwdG8iOnsiY2lwaGVydGV4dCI6ImI3OTkwNmRlOGE0NzYzOTZjZmE2OTM4ZjFmZjMxMTdjMjVlZWVhNDMzNTJiNmM1MTA2MDA2ZGJiODFkN2FhNGY5NWIxMjEzYmE3ZDIzM2MyNTU0NGIyYzg1MDYwNGRjMyIsIm5vbmNlIjoiYzNkMzk1NDdhZGFhMWZlZWZmODBmMWI4Iiwic2NyeXB0cGFyYW1zIjp7Im4iOjI2MjE0NCwiciI6OCwicCI6MSwia2V5bGVuIjozMiwic2FsdCI6ImE0NGJiMmU0MTMxMDYyNTc1NWEyOWVkYzg3NGFmMzFkNTk1M2QzNzQyODMwNDk2YTUyZjdkMjY2ZWYxMzMzMTAifX0sInRpbWVzdGFtcCI6MTU1MzU4ODc5N30="
}
{
"jsonrpc": "2.0",
"id":2,
"method":"util_encrypt",
"params": ["a7bcc2785e93226699618087528c4fbc8990fc247f12743e2a9caea8590756a0","98qUb5Ud"]
}
# util_rawToBalance
Return balance by specific unit for raw value
Parameters:
string
: raw valuestring
: unit, if token is QLC ,need setqlc
,Kqlc
,QLC
orMQLC
, others should set empty string""
string
:optional
, token name , if not set , default is QLC
Returns:
string
: balance for the unit
Example:
{
"jsonrpc": "2.0",
"id":1,
"method":"util_rawToBalance",
"params": ["200000000","QLC"]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": "2"
}
{
"jsonrpc": "2.0",
"id":1,
"method":"util_rawToBalance",
"params": ["200000000","QLC"]
}
# util_balanceToRaw
Return raw value for the balance by specific unit
Parameters:
string
: balancestring
: unit, if token is QLC ,need setqlc
,Kqlc
,QLC
orMQLC
, others should set empty string""
string
:optional
, token name, if not set , default is QLC
Returns:
string
: raw value
Example:
{
"jsonrpc": "2.0",
"id":1,
"method":"util_balanceToRaw",
"params": ["2","QLC"]
}
{
"jsonrpc": "2.0",
"id": 1,
"result": "200000000"
}
{
"jsonrpc": "2.0",
"id":1,
"method":"util_balanceToRaw",
"params": ["2","QLC"]
}