如何解码函数调用参数?
How can I decode function call argument?
由于在 near-api-js
中调用 txStatus
,我得到了下面的函数调用。如何将函数调用参数解码为与 NEAR 资源管理器中相同的 JSON?
{
FunctionCall: {
method_name: 'withdraw_reward',
args: 'eyJ0b2tlbl9pZCI6InNuYWlsY29pbi5zbmFpbHNfZmkudGVzdG5ldCIsImFtb3VudCI6IjY2ODM2OTk4NDcxMiIsInVucmVnaXN0ZXIiOmZhbHNlfQ==',
gas: 100000000000000,
deposit: '1'
}
}
见 explorer:
{
"token_id": "snailcoin.snails_fi.testnet",
"amount": "668369984712",
"unregister": false
}
谢谢,
是 base64
使用 https://www.base64decode.org 我明白了
{"token_id":"snailcoin.snails_fi.testnet","amount":"668369984712","unregister":false}
你肯定会使用图书馆或其他东西来做这件事,也许这个
https://www.npmjs.com/package/js-base64
由于在 near-api-js
中调用 txStatus
,我得到了下面的函数调用。如何将函数调用参数解码为与 NEAR 资源管理器中相同的 JSON?
{
FunctionCall: {
method_name: 'withdraw_reward',
args: 'eyJ0b2tlbl9pZCI6InNuYWlsY29pbi5zbmFpbHNfZmkudGVzdG5ldCIsImFtb3VudCI6IjY2ODM2OTk4NDcxMiIsInVucmVnaXN0ZXIiOmZhbHNlfQ==',
gas: 100000000000000,
deposit: '1'
}
}
见 explorer:
{
"token_id": "snailcoin.snails_fi.testnet",
"amount": "668369984712",
"unregister": false
}
谢谢,
是 base64
使用 https://www.base64decode.org 我明白了
{"token_id":"snailcoin.snails_fi.testnet","amount":"668369984712","unregister":false}
你肯定会使用图书馆或其他东西来做这件事,也许这个 https://www.npmjs.com/package/js-base64