@@ -313,6 +313,7 @@ func ConvertMessage(message tlb.Message, txLT uint64, cd *abi.ContractDescriptio
313
313
if err != nil {
314
314
return Message {}, err
315
315
}
316
+
316
317
return Message {
317
318
MessageID : MessageID {
318
319
CreatedLt : info .CreatedLt ,
@@ -324,6 +325,7 @@ func ConvertMessage(message tlb.Message, txLT uint64, cd *abi.ContractDescriptio
324
325
Bounce : info .Bounce ,
325
326
Bounced : info .Bounced ,
326
327
Value : int64 (info .Value .Grams ),
328
+ ValueExtra : extractExtraCurrencies (info .Value .Other ),
327
329
FwdFee : int64 (info .FwdFee ),
328
330
IhrFee : int64 (info .IhrFee ),
329
331
ImportFee : 0 ,
@@ -434,15 +436,7 @@ func ConvertToAccount(accountId tongo.AccountID, shardAccount tlb.ShardAccount)
434
436
}
435
437
balance := acc .Account .Storage .Balance
436
438
res .TonBalance = int64 (balance .Grams )
437
- items := balance .Other .Dict .Items ()
438
- if len (items ) > 0 {
439
- otherBalances := make (map [uint32 ]decimal.Decimal , len (items ))
440
- for _ , item := range items {
441
- value := big .Int (item .Value )
442
- otherBalances [uint32 (item .Key )] = decimal .NewFromBigInt (& value , 0 )
443
- }
444
- res .ExtraBalances = otherBalances
445
- }
439
+ res .ExtraBalances = extractExtraCurrencies (balance .Other )
446
440
res .LastTransactionLt = shardAccount .LastTransLt
447
441
res .LastTransactionHash = tongo .Bits256 (shardAccount .LastTransHash )
448
442
if acc .Account .Storage .State .SumType == "AccountUninit" {
@@ -481,6 +475,19 @@ func ConvertToAccount(accountId tongo.AccountID, shardAccount tlb.ShardAccount)
481
475
return res , nil
482
476
}
483
477
478
+ func extractExtraCurrencies (extraCurrencyCollection tlb.ExtraCurrencyCollection ) ExtraCurrencies {
479
+ items := extraCurrencyCollection .Dict .Items ()
480
+ if len (items ) > 0 {
481
+ res := make (map [uint32 ]decimal.Decimal , len (items ))
482
+ for _ , item := range items {
483
+ value := big .Int (item .Value )
484
+ res [uint32 (item .Key )] = decimal .NewFromBigInt (& value , 0 )
485
+ }
486
+ return res
487
+ }
488
+ return nil // TODO: or return empty map
489
+ }
490
+
484
491
func ExtractTransactions (id tongo.BlockIDExt , block * tlb.Block ) ([]* Transaction , error ) {
485
492
rawTransactions := block .AllTransactions ()
486
493
transactions := make ([]* Transaction , 0 , len (rawTransactions ))
0 commit comments