Skip to content

Commit 28e17fc

Browse files
committed
refactor(tck): clone account balance maps
Signed-off-by: colinaumaty <colinaumaty@outlook.com>
1 parent d0376a9 commit 28e17fc

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

tck/methods/account.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package methods
55
import (
66
"context"
77
"errors"
8+
"maps"
89
"strconv"
910
"time"
1011

@@ -516,15 +517,8 @@ func (a *AccountService) GetAccountBalance(_ context.Context, params param.GetAc
516517
return nil, err
517518
}
518519

519-
tokenBalances := make(map[string]uint64)
520-
for tokenID, amount := range balance.Tokens.GetAll() {
521-
tokenBalances[tokenID] = amount
522-
}
523-
524-
tokenDecimals := make(map[string]uint64)
525-
for tokenID, decimals := range balance.TokenDecimals.GetAll() {
526-
tokenDecimals[tokenID] = decimals
527-
}
520+
tokenBalances := maps.Clone(balance.Tokens.GetAll())
521+
tokenDecimals := maps.Clone(balance.TokenDecimals.GetAll())
528522

529523
return &response.AccountBalanceResponse{
530524
Hbar: strconv.Itoa(int(balance.Hbars.AsTinybar())),

0 commit comments

Comments
 (0)