Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing transaction from getTxByHash #267

Closed
chainwhisper opened this issue Jun 30, 2020 · 2 comments · Fixed by #286
Closed

Error parsing transaction from getTxByHash #267

chainwhisper opened this issue Jun 30, 2020 · 2 comments · Fixed by #286

Comments

@chainwhisper
Copy link

对于交易hash FC3F58350903DD80632F3E6F88EC28FEEC248636E6E666AC6DEDF92F31FC4E06

需求:需要使用rpc接口来获取tx,能解析出from,to,交易币种,数量,手续费和memo

如使用加速节点api

https://testnet-dex.binance.org/api/v1/tx/FC3F58350903DD80632F3E6F88EC28FEEC248636E6E666AC6DEDF92F31FC4E06?format=json

而使用nodejs sdk的 getTxByHash 结果是这样的

`

{
"hash": "FC3F58350903DD80632F3E6F88EC28FEEC248636E6E666AC6DEDF92F31FC4E06",
"height": "90563483",
"index": 0,
"tx_result": {
"log": "Msg 0: ",
"events": [
{
"attributes": [
{
"key": "sender",
"value": "tbnb1hdl6vs547xyhlmly04egml4c6lepm57w0c6gel"
},
{
"key": "recipient",
"value": "tbnb1q62eesqznkmsh48cgljhh7cvqs0p2nemxthera"
},
{
"key": "action",
"value": "send"
}
]
}
]
},
"tx": {
"msg": [
{
"inputs": [
{
"address": {
"type": "Buffer",
"data": [
187,
127,
166,
66,
149,
241,
137,
127,
239,
228,
125,
114,
141,
254,
184,
215,
242,
29,
211,
206
]
},
"coins": [
{
"denom": "BNB",
"amount": 2948140
},
{
"denom": "\u0006���\u0002��\u000b��G�{�\f\u0004\u001e\u0015O;",
"amount": 0
}
]
}
],
"outpus": [
{
"address": null,
"coins": [
{
"denom": "",
"amount": 0
}
]
}
],
"aminoPrefix": "2A2C87FA"
}
],
"signatures": [
{
"pub_key": null,
"signature": null,
"account_number": 0,
"sequence": 0
}
],
"memo": "",
"source": 0,
"data": "",
"aminoPrefix": "F0625DEE"
}
}

`

@woyoutlz
Copy link

相同的问题,解析出 {
"denom": "\u0006���\u0002��\u000b��G�{�\f\u0004\u001e\u0015O;",
"amount": 0
}

@woyoutlz
Copy link

乱码部分不知道是什么

@xzjcool xzjcool linked a pull request Aug 26, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants