mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 06:12:55 +00:00
bd816f1e29
chore(wallet)_: split getWalletTokenBalances into multiple functions Removed some unused balances methods from wallet API chore(wallet)_: refactored FetchOrGetWalletTokenBalances - getWalletTokenBalances only returns cached ones - update of balances is done in a separate method chore(wallet)_: fix isVisible in getWalletTokenBalances is overwritten It is overwritten and in some cases its value is desrespected chore(wallet)_: simplify getWalletTokenBalance even further chore(wallet)_: remove accountsDB from wallet.Reader Call GetTestNetworkEnabled from NetworkManager instead chore(wallet)_: remove rpc.Client from wallet.Reader. Added GetActiveNetworks() method for NetworkManager Removed adding native tokens from networks, as this is done already in NetworkManager chore(wallet)_: moved Persistence to token package As it works with token_balances table, moved Persistence to token package. Fixed TokenManager's Mark/Get previously owned tokens to use persistence storage instead of direct SQL calls. Introduced StorageToken that aggregates Token type, because when Persistence moved to token package, names clash test(wallet)_: tests for wallet.Reader.FetchorGetCachedBalances
27 lines
491 B
Go
27 lines
491 B
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/status-im/status-go/params"
|
|
)
|
|
|
|
// ShouldCancel returns true if the context has been cancelled and task should be aborted
|
|
func ShouldCancel(ctx context.Context) bool {
|
|
select {
|
|
case <-ctx.Done():
|
|
return true
|
|
default:
|
|
}
|
|
return false
|
|
}
|
|
|
|
func NetworksToChainIDs(networks []*params.Network) []uint64 {
|
|
chainIDs := make([]uint64, 0)
|
|
for _, network := range networks {
|
|
chainIDs = append(chainIDs, network.ChainID)
|
|
}
|
|
|
|
return chainIDs
|
|
}
|