xssnick / tonutils-go

TON SDK Library in pure Golang for interacting with The Open Network ecosystem using native protocols, such as ADNL, RLDP and etc.
Apache License 2.0
464 stars 95 forks source link

how to parse jetton transaction to get jetton token amount and comment? #186

Closed gilfoyle2021asc closed 4 months ago

gilfoyle2021asc commented 4 months ago

when transfer jetton, i noticed the jetton amount and comment has been included in transferPayload then included into message body, my purpose is to parse tx from ListTransactions, this sdk is not supported to get jetton amount and comment, so i try to parse message body to find out ,i can get the message body by 'body:=tx.IO.In.AsInternal().Body', but how to parse the body to readable text?

SC-One commented 4 months ago

I think you can take Amount and Body.Dump() for amount and the stringify of the payload check this line:

https://github.com/xssnick/tonutils-go/blob/db2bc987f06429b8e1de29bcba5636d7cba1be35/tlb/message.go#L192

gilfoyle2021asc commented 4 months ago

thank you very much for your replay, but the m.Amount is amount for TON , i want jetton token amount and comment , which been included here : example/jetton-transfer/main.go:62

gilfoyle2021asc commented 4 months ago

i am transfer jetton token like this:example/jetton-transfer/main.go:62

gilfoyle2021asc commented 4 months ago

which language you are using? how do you get jetton amount and comment from transaction in your language lib?

gilfoyle2021asc commented 4 months ago

thanks help, problem solved ,there is a decode func existing in source code

estw272 commented 4 months ago

@gilfoyle2021asc hi, can you share how you solved it?