Wallet api got functions to get or fetch prices and token balances

This commit is contained in:
Volodymyr Kozieiev 2024-11-14 12:21:42 +00:00
parent 132ea05fc8
commit 4f54989f9f
No known key found for this signature in database
GPG Key ID: 82B04968DF4C0535
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import (
wcommon "github.com/status-im/status-go/services/wallet/common" 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/currency"
"github.com/status-im/status-go/services/wallet/history" "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/onramp"
"github.com/status-im/status-go/services/wallet/requests" "github.com/status-im/status-go/services/wallet/requests"
"github.com/status-im/status-go/services/wallet/responses" "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() 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 // @deprecated
func (api *API) FetchPrices(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]float64, error) { func (api *API) FetchPrices(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]float64, error) {
log.Debug("call to FetchPrices") log.Debug("call to FetchPrices")