From ce45a7b1e8bf01f3b6376ae5e37c3d33c9627251 Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Wed, 28 Jun 2023 07:48:33 -0300 Subject: [PATCH] fix: properly initialize NFTMetadataProvider in wallet service --- node/status_node_services.go | 12 +++++++----- services/wallet/collectibles/collectibles.go | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/node/status_node_services.go b/node/status_node_services.go index b5d7411e0..0c77e402c 100644 --- a/node/status_node_services.go +++ b/node/status_node_services.go @@ -105,11 +105,6 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server services = append(services, wakuext) } - if config.WalletConfig.Enabled { - walletService := b.walletService(accDB, accountsFeed) - services = append(services, walletService) - } - if config.WakuV2Config.Enabled { telemetryServerURL := "" if accDB.DB() != nil { @@ -135,6 +130,13 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server services = append(services, wakuext) } + // Wallet Service makes use of wakuExtSrvc/wakuV2ExtSrvc + // Keep this initialization below the other two + if config.WalletConfig.Enabled { + walletService := b.walletService(accDB, accountsFeed) + services = append(services, walletService) + } + // We ignore for now local notifications flag as users who are upgrading have no mean to enable it lns, err := b.localNotificationsService(config.NetworkID) if err != nil { diff --git a/services/wallet/collectibles/collectibles.go b/services/wallet/collectibles/collectibles.go index 8c9db867b..61f89e752 100644 --- a/services/wallet/collectibles/collectibles.go +++ b/services/wallet/collectibles/collectibles.go @@ -2,6 +2,7 @@ package collectibles import ( "context" + "fmt" "strings" "sync" "time" @@ -254,6 +255,9 @@ func (o *Manager) processAssets(chainID uint64, assets []opensea.Asset) error { } if isMetadataEmpty(asset) { + if o.metadataProvider == nil { + return fmt.Errorf("NFTMetadataProvider not available") + } tokenURI, err := o.fetchTokenURI(chainID, id) if err != nil {