From 4f54989f9f6352641853b4f4380c9ca2f2588a5b Mon Sep 17 00:00:00 2001 From: Volodymyr Kozieiev Date: Thu, 14 Nov 2024 12:21:42 +0000 Subject: [PATCH] Wallet api got functions to get or fetch prices and token balances --- services/wallet/api.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/wallet/api.go b/services/wallet/api.go index 934023873..041d12153 100644 --- a/services/wallet/api.go +++ b/services/wallet/api.go @@ -29,6 +29,7 @@ import ( wcommon "github.com/status-im/status-go/services/wallet/common" "github.com/status-im/status-go/services/wallet/currency" "github.com/status-im/status-go/services/wallet/history" + "github.com/status-im/status-go/services/wallet/market" "github.com/status-im/status-go/services/wallet/onramp" "github.com/status-im/status-go/services/wallet/requests" "github.com/status-im/status-go/services/wallet/responses" @@ -445,6 +446,16 @@ func (api *API) GetEthereumChains(ctx context.Context) ([]*network.CombinedNetwo return api.s.rpcClient.NetworkManager.GetCombinedNetworks() } +func (api *API) GetOrFetchPrices(ctx context.Context, symbols []string, currencies []string) (market.DataPerTokenAndCurrency, error) { + log.Debug("call to GetOrFetchPrices") + return api.s.marketManager.GetOrFetchPrices(symbols, currencies, market.MaxAgeInSecondsForBalances) +} + +func (api *API) GetOrFetchTokenMarketValues(ctx context.Context, symbols []string, currency string) (map[string]thirdparty.TokenMarketValues, error) { + log.Debug("call to GetOrFetchTokenMarketValues") + return api.s.marketManager.GetOrFetchTokenMarketValues(symbols, currency, market.MaxAgeInSecondsForBalances) +} + // @deprecated func (api *API) FetchPrices(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]float64, error) { log.Debug("call to FetchPrices")