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
535 stars 109 forks source link

How to get transactions by accountBlock? #239

Closed fishTsai20 closed 2 months ago

fishTsai20 commented 2 months ago

By your example. slcTx := txKV.Value var rawTx tlb.Transaction if err = tlb.LoadFromCell(&rawTx, slcTx.MustLoadRef()); err != nil { return fmt.Errorf("faled to parse transaction: %w", err) } But as ton's doc said, transaction's type is as below: acc_trans#5 account_addr:bits256 transactions:(HashmapAug 64 ^Transaction CurrencyCollection) state_update:^(HASH_UPDATE Account) = AccountBlock; slcTx's type isn't CurrencyCollection?? why CurrencyCollection has a ref? why the code as below not work? err := tlb.LoadFromCell(&txb, txKV.Key.MustLoadRef())

Do you have any doc that explain how to load cell?

xssnick commented 2 months ago

HashmapAug is compatible with Hashmap for parsing, augmented element concatenated with value, so first you should parse CurrencyCollection from slice and then load tlb.Transaction, then should work

fishTsai20 commented 2 months ago

got it!