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
549 stars 114 forks source link

jetton.GetJettonDataAtBlock doest works for jetton contracts #233

Open livingroot opened 3 months ago

livingroot commented 3 months ago

If you need to access Jetton contract data, such as the name, symbol, or decimals, you'll encounter an issue because the GetJettonDataAtBlock method currently only refers to the NFT package and parses NFT data.

https://github.com/xssnick/tonutils-go/blob/9db1a1391b6c8007f5d2e6ee812aeb55764c50c8/ton/jetton/jetton.go#L137-L140

So ContentOnchain in a ContentFromCell for jetton method must look like that:

ContentOnchain: &ContentOnchain{
    Address:     string(getOnchainVal(dict, "address")),
    Name:        string(getOnchainVal(dict, "name")),
    Symbol:      string(getOnchainVal(dict, "symbol")),
    Decimals:    string(getOnchainVal(dict, "decimals")),
    Image:       string(getOnchainVal(dict, "image")),
    Description: string(getOnchainVal(dict, "description")),
    attributes:  dict,
},

I plan to create a pull request later unless someone else addresses this first.

xssnick commented 2 months ago

Hi, you can use GetAttribute("address") and etc to get any param