From b5224b3cc5d3f05fe1a084d479f6653bb816f9b0 Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Wed, 5 Jul 2023 06:33:48 -0300 Subject: [PATCH] chore: rename and reorder types --- node/status_node_services.go | 8 +-- services/ext/service.go | 8 +-- services/wallet/api.go | 6 +-- services/wallet/collectibles/collectibles.go | 38 +++++++------- services/wallet/service.go | 2 +- services/wallet/thirdparty/alchemy/client.go | 22 ++++----- .../wallet/thirdparty/collectible_types.go | 49 +++++++++++++++++++ services/wallet/thirdparty/infura/client.go | 26 +++++----- services/wallet/thirdparty/opensea/client.go | 2 +- services/wallet/thirdparty/types.go | 48 ------------------ 10 files changed, 105 insertions(+), 104 deletions(-) create mode 100644 services/wallet/thirdparty/collectible_types.go diff --git a/node/status_node_services.go b/node/status_node_services.go index 92402b63b..5cf57c73f 100644 --- a/node/status_node_services.go +++ b/node/status_node_services.go @@ -118,7 +118,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server services = append(services, wakuext) - b.SetWalletNFTMetadataProvider(wakuext) + b.SetWalletCollectibleMetadataProvider(wakuext) } if config.WakuV2Config.Enabled { @@ -145,7 +145,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server services = append(services, wakuext) - b.SetWalletNFTMetadataProvider(wakuext) + b.SetWalletCollectibleMetadataProvider(wakuext) } // We ignore for now local notifications flag as users who are upgrading have no mean to enable it @@ -487,9 +487,9 @@ func (b *StatusNode) WalletService() *wallet.Service { return b.walletSrvc } -func (b *StatusNode) SetWalletNFTMetadataProvider(provider thirdparty.NFTMetadataProvider) { +func (b *StatusNode) SetWalletCollectibleMetadataProvider(provider thirdparty.CollectibleMetadataProvider) { if b.walletSrvc != nil { - b.walletSrvc.SetNFTMetadataProvider(provider) + b.walletSrvc.SetCollectibleMetadataProvider(provider) } } diff --git a/services/ext/service.go b/services/ext/service.go index aab84325c..274b65d5d 100644 --- a/services/ext/service.go +++ b/services/ext/service.go @@ -62,7 +62,7 @@ type EnvelopeEventsHandler interface { // Service is a service that provides some additional API to whisper-based protocols like Whisper or Waku. type Service struct { - thirdparty.NFTMetadataProvider + thirdparty.CollectibleMetadataProvider messenger *protocol.Messenger identity *ecdsa.PrivateKey cancelMessenger chan struct{} @@ -545,12 +545,12 @@ func tokenURIToCommunityID(tokenURI string) string { return communityID } -func (s *Service) CanProvideNFTMetadata(chainID uint64, id thirdparty.NFTUniqueID, tokenURI string) (bool, error) { +func (s *Service) CanProvideCollectibleMetadata(chainID uint64, id thirdparty.CollectibleUniqueID, tokenURI string) (bool, error) { ret := tokenURI != "" && tokenURIToCommunityID(tokenURI) != "" return ret, nil } -func (s *Service) FetchNFTMetadata(chainID uint64, id thirdparty.NFTUniqueID, tokenURI string) (*thirdparty.NFTMetadata, error) { +func (s *Service) FetchCollectibleMetadata(chainID uint64, id thirdparty.CollectibleUniqueID, tokenURI string) (*thirdparty.CollectibleMetadata, error) { if s.messenger == nil { return nil, fmt.Errorf("messenger not ready") } @@ -574,7 +574,7 @@ func (s *Service) FetchNFTMetadata(chainID uint64, id thirdparty.NFTUniqueID, to for _, tokenMetadata := range tokensMetadata { contractAddresses := tokenMetadata.GetContractAddresses() if contractAddresses[chainID] == id.ContractAddress.Hex() { - return &thirdparty.NFTMetadata{ + return &thirdparty.CollectibleMetadata{ Name: tokenMetadata.GetName(), Description: tokenMetadata.GetDescription(), CollectionImageURL: tokenMetadata.GetImage(), diff --git a/services/wallet/api.go b/services/wallet/api.go index e1ff1e9dc..502be978f 100644 --- a/services/wallet/api.go +++ b/services/wallet/api.go @@ -328,14 +328,14 @@ func (api *API) GetOpenseaAssetsByOwnerAndContractAddressWithCursor(ctx context. return api.s.collectiblesManager.FetchAllAssetsByOwnerAndContractAddress(chainID, owner, contractAddresses, cursor, limit) } -func (api *API) GetOpenseaAssetsByNFTUniqueID(ctx context.Context, chainID uint64, uniqueIDs []thirdparty.NFTUniqueID, limit int) (*opensea.AssetContainer, error) { +func (api *API) GetOpenseaAssetsByNFTUniqueID(ctx context.Context, chainID uint64, uniqueIDs []thirdparty.CollectibleUniqueID, limit int) (*opensea.AssetContainer, error) { log.Debug("call to GetOpenseaAssetsByNFTUniqueID") return api.s.collectiblesManager.FetchAssetsByNFTUniqueID(chainID, uniqueIDs, limit) } -func (api *API) GetCollectibleOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.NFTContractOwnership, error) { +func (api *API) GetCollectibleOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.CollectibleContractOwnership, error) { log.Debug("call to GetCollectibleOwnersByContractAddress") - return api.s.collectiblesManager.FetchNFTOwnersByContractAddress(chainID, contractAddress) + return api.s.collectiblesManager.FetchCollectibleOwnersByContractAddress(chainID, contractAddress) } func (api *API) FetchBalancesByOwnerAndContractAddress(chainID uint64, ownerAddress common.Address, contractAddresses []common.Address) (thirdparty.TokenBalancesPerContractAddress, error) { diff --git a/services/wallet/collectibles/collectibles.go b/services/wallet/collectibles/collectibles.go index 8c0e03808..a10cc9455 100644 --- a/services/wallet/collectibles/collectibles.go +++ b/services/wallet/collectibles/collectibles.go @@ -35,16 +35,16 @@ var noTokenURIErrorPrefixes = []string{ type Manager struct { rpcClient *rpc.Client - mainContractOwnershipProvider thirdparty.NFTContractOwnershipProvider - fallbackContractOwnershipProvider thirdparty.NFTContractOwnershipProvider - metadataProvider thirdparty.NFTMetadataProvider + mainContractOwnershipProvider thirdparty.CollectibleContractOwnershipProvider + fallbackContractOwnershipProvider thirdparty.CollectibleContractOwnershipProvider + metadataProvider thirdparty.CollectibleMetadataProvider openseaAPIKey string nftCache map[uint64]map[string]opensea.Asset nftCacheLock sync.RWMutex walletFeed *event.Feed } -func NewManager(rpcClient *rpc.Client, mainContractOwnershipProvider thirdparty.NFTContractOwnershipProvider, fallbackContractOwnershipProvider thirdparty.NFTContractOwnershipProvider, openseaAPIKey string, walletFeed *event.Feed) *Manager { +func NewManager(rpcClient *rpc.Client, mainContractOwnershipProvider thirdparty.CollectibleContractOwnershipProvider, fallbackContractOwnershipProvider thirdparty.CollectibleContractOwnershipProvider, openseaAPIKey string, walletFeed *event.Feed) *Manager { hystrix.ConfigureCommand(hystrixContractOwnershipClientName, hystrix.CommandConfig{ Timeout: 10000, MaxConcurrentRequests: 100, @@ -92,7 +92,7 @@ func makeContractOwnershipCall(main func() (any, error), fallback func() (any, e } // Used to break circular dependency, call once as soon as possible after initialization -func (o *Manager) SetMetadataProvider(metadataProvider thirdparty.NFTMetadataProvider) { +func (o *Manager) SetMetadataProvider(metadataProvider thirdparty.CollectibleMetadataProvider) { o.metadataProvider = metadataProvider } @@ -136,7 +136,7 @@ func (o *Manager) FetchBalancesByOwnerAndContractAddress(chainID uint64, ownerAd if err == opensea.ErrChainIDNotSupported { // Use contract ownership providers for _, contractAddress := range contractAddresses { - ownership, err := o.FetchNFTOwnersByContractAddress(chainID, contractAddress) + ownership, err := o.FetchCollectibleOwnersByContractAddress(chainID, contractAddress) if err != nil { return nil, err } @@ -203,7 +203,7 @@ func (o *Manager) FetchAllAssetsByOwner(chainID uint64, owner common.Address, cu return assetContainer, nil } -func (o *Manager) FetchAssetsByNFTUniqueID(chainID uint64, uniqueIDs []thirdparty.NFTUniqueID, limit int) (*opensea.AssetContainer, error) { +func (o *Manager) FetchAssetsByNFTUniqueID(chainID uint64, uniqueIDs []thirdparty.CollectibleUniqueID, limit int) (*opensea.AssetContainer, error) { assetContainer := new(opensea.AssetContainer) idsToFetch := o.getIDsNotInCache(chainID, uniqueIDs) @@ -232,14 +232,14 @@ func (o *Manager) FetchAssetsByNFTUniqueID(chainID uint64, uniqueIDs []thirdpart return assetContainer, nil } -func (o *Manager) FetchNFTOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.NFTContractOwnership, error) { +func (o *Manager) FetchCollectibleOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.CollectibleContractOwnership, error) { mainFunc := func() (any, error) { - return o.mainContractOwnershipProvider.FetchNFTOwnersByContractAddress(chainID, contractAddress) + return o.mainContractOwnershipProvider.FetchCollectibleOwnersByContractAddress(chainID, contractAddress) } var fallbackFunc func() (any, error) = nil if o.fallbackContractOwnershipProvider != nil && o.fallbackContractOwnershipProvider.IsChainSupported(chainID) { fallbackFunc = func() (any, error) { - return o.fallbackContractOwnershipProvider.FetchNFTOwnersByContractAddress(chainID, contractAddress) + return o.fallbackContractOwnershipProvider.FetchCollectibleOwnersByContractAddress(chainID, contractAddress) } } owners, err := makeContractOwnershipCall(mainFunc, fallbackFunc) @@ -247,7 +247,7 @@ func (o *Manager) FetchNFTOwnersByContractAddress(chainID uint64, contractAddres return nil, err } - return owners.(*thirdparty.NFTContractOwnership), nil + return owners.(*thirdparty.CollectibleContractOwnership), nil } func isMetadataEmpty(asset opensea.Asset) bool { @@ -257,7 +257,7 @@ func isMetadataEmpty(asset opensea.Asset) bool { asset.TokenURI == "" } -func (o *Manager) fetchTokenURI(chainID uint64, id thirdparty.NFTUniqueID) (string, error) { +func (o *Manager) fetchTokenURI(chainID uint64, id thirdparty.CollectibleUniqueID) (string, error) { backend, err := o.rpcClient.EthClient(chainID) if err != nil { return "", err @@ -297,14 +297,14 @@ func (o *Manager) processAssets(chainID uint64, assets []opensea.Asset) error { } for idx, asset := range assets { - id := thirdparty.NFTUniqueID{ + id := thirdparty.CollectibleUniqueID{ ContractAddress: common.HexToAddress(asset.Contract.Address), TokenID: asset.TokenID, } if isMetadataEmpty(asset) { if o.metadataProvider == nil { - return fmt.Errorf("NFTMetadataProvider not available") + return fmt.Errorf("CollectibleMetadataProvider not available") } tokenURI, err := o.fetchTokenURI(chainID, id) @@ -314,14 +314,14 @@ func (o *Manager) processAssets(chainID uint64, assets []opensea.Asset) error { assets[idx].TokenURI = tokenURI - canProvide, err := o.metadataProvider.CanProvideNFTMetadata(chainID, id, tokenURI) + canProvide, err := o.metadataProvider.CanProvideCollectibleMetadata(chainID, id, tokenURI) if err != nil { return err } if canProvide { - metadata, err := o.metadataProvider.FetchNFTMetadata(chainID, id, tokenURI) + metadata, err := o.metadataProvider.FetchCollectibleMetadata(chainID, id, tokenURI) if err != nil { return err } @@ -347,11 +347,11 @@ func (o *Manager) processAssets(chainID uint64, assets []opensea.Asset) error { return nil } -func (o *Manager) getIDsNotInCache(chainID uint64, uniqueIDs []thirdparty.NFTUniqueID) []thirdparty.NFTUniqueID { +func (o *Manager) getIDsNotInCache(chainID uint64, uniqueIDs []thirdparty.CollectibleUniqueID) []thirdparty.CollectibleUniqueID { o.nftCacheLock.RLock() defer o.nftCacheLock.RUnlock() - idsToFetch := make([]thirdparty.NFTUniqueID, 0, len(uniqueIDs)) + idsToFetch := make([]thirdparty.CollectibleUniqueID, 0, len(uniqueIDs)) if _, ok := o.nftCache[chainID]; !ok { idsToFetch = uniqueIDs } else { @@ -364,7 +364,7 @@ func (o *Manager) getIDsNotInCache(chainID uint64, uniqueIDs []thirdparty.NFTUni return idsToFetch } -func (o *Manager) getCachedAssets(chainID uint64, uniqueIDs []thirdparty.NFTUniqueID) []opensea.Asset { +func (o *Manager) getCachedAssets(chainID uint64, uniqueIDs []thirdparty.CollectibleUniqueID) []opensea.Asset { o.nftCacheLock.RLock() defer o.nftCacheLock.RUnlock() diff --git a/services/wallet/service.go b/services/wallet/service.go index 17d863fba..01e322619 100644 --- a/services/wallet/service.go +++ b/services/wallet/service.go @@ -181,7 +181,7 @@ func (s *Service) GetFeed() *event.Feed { } // Set external Collectibles metadata provider -func (s *Service) SetNFTMetadataProvider(provider thirdparty.NFTMetadataProvider) { +func (s *Service) SetCollectibleMetadataProvider(provider thirdparty.CollectibleMetadataProvider) { s.collectiblesManager.SetMetadataProvider(provider) } diff --git a/services/wallet/thirdparty/alchemy/client.go b/services/wallet/thirdparty/alchemy/client.go index f2f3ec6b0..83884d276 100644 --- a/services/wallet/thirdparty/alchemy/client.go +++ b/services/wallet/thirdparty/alchemy/client.go @@ -58,18 +58,18 @@ type TokenBalance struct { Balance *bigint.BigInt `json:"balance"` } -type NFTOwner struct { +type CollectibleOwner struct { OwnerAddress common.Address `json:"ownerAddress"` TokenBalances []TokenBalance `json:"tokenBalances"` } -type NFTContractOwnership struct { - Owners []NFTOwner `json:"ownerAddresses"` - PageKey string `json:"pageKey"` +type CollectibleContractOwnership struct { + Owners []CollectibleOwner `json:"ownerAddresses"` + PageKey string `json:"pageKey"` } type Client struct { - thirdparty.NFTContractOwnershipProvider + thirdparty.CollectibleContractOwnershipProvider client *http.Client apiKeys map[uint64]string IsConnected bool @@ -98,8 +98,8 @@ func (o *Client) IsChainSupported(chainID uint64) bool { return err == nil } -func alchemyOwnershipToCommon(contractAddress common.Address, alchemyOwnership NFTContractOwnership) (*thirdparty.NFTContractOwnership, error) { - owners := make([]thirdparty.NFTOwner, 0, len(alchemyOwnership.Owners)) +func alchemyOwnershipToCommon(contractAddress common.Address, alchemyOwnership CollectibleContractOwnership) (*thirdparty.CollectibleContractOwnership, error) { + owners := make([]thirdparty.CollectibleOwner, 0, len(alchemyOwnership.Owners)) for _, alchemyOwner := range alchemyOwnership.Owners { balances := make([]thirdparty.TokenBalance, 0, len(alchemyOwner.TokenBalances)) @@ -109,7 +109,7 @@ func alchemyOwnershipToCommon(contractAddress common.Address, alchemyOwnership N Balance: alchemyBalance.Balance, }) } - owner := thirdparty.NFTOwner{ + owner := thirdparty.CollectibleOwner{ OwnerAddress: alchemyOwner.OwnerAddress, TokenBalances: balances, } @@ -117,7 +117,7 @@ func alchemyOwnershipToCommon(contractAddress common.Address, alchemyOwnership N owners = append(owners, owner) } - ownership := thirdparty.NFTContractOwnership{ + ownership := thirdparty.CollectibleContractOwnership{ ContractAddress: contractAddress, Owners: owners, } @@ -125,7 +125,7 @@ func alchemyOwnershipToCommon(contractAddress common.Address, alchemyOwnership N return &ownership, nil } -func (o *Client) FetchNFTOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.NFTContractOwnership, error) { +func (o *Client) FetchCollectibleOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.CollectibleContractOwnership, error) { queryParams := url.Values{ "contractAddress": {contractAddress.String()}, "withTokenBalances": {"true"}, @@ -152,7 +152,7 @@ func (o *Client) FetchNFTOwnersByContractAddress(chainID uint64, contractAddress return nil, err } - var alchemyOwnership NFTContractOwnership + var alchemyOwnership CollectibleContractOwnership err = json.Unmarshal(body, &alchemyOwnership) if err != nil { return nil, err diff --git a/services/wallet/thirdparty/collectible_types.go b/services/wallet/thirdparty/collectible_types.go new file mode 100644 index 000000000..edcb6dc51 --- /dev/null +++ b/services/wallet/thirdparty/collectible_types.go @@ -0,0 +1,49 @@ +package thirdparty + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/status-im/status-go/services/wallet/bigint" +) + +type CollectibleUniqueID struct { + ContractAddress common.Address `json:"contractAddress"` + TokenID *bigint.BigInt `json:"tokenID"` +} + +func (k *CollectibleUniqueID) HashKey() string { + return k.ContractAddress.String() + "+" + k.TokenID.String() +} + +type CollectibleMetadata struct { + Name string `json:"name"` + Description string `json:"description"` + CollectionImageURL string `json:"collection_image"` + ImageURL string `json:"image"` +} + +type CollectibleMetadataProvider interface { + CanProvideCollectibleMetadata(chainID uint64, id CollectibleUniqueID, tokenURI string) (bool, error) + FetchCollectibleMetadata(chainID uint64, id CollectibleUniqueID, tokenURI string) (*CollectibleMetadata, error) +} + +type TokenBalance struct { + TokenID *bigint.BigInt `json:"tokenId"` + Balance *bigint.BigInt `json:"balance"` +} + +type TokenBalancesPerContractAddress = map[common.Address][]TokenBalance + +type CollectibleOwner struct { + OwnerAddress common.Address `json:"ownerAddress"` + TokenBalances []TokenBalance `json:"tokenBalances"` +} + +type CollectibleContractOwnership struct { + ContractAddress common.Address `json:"contractAddress"` + Owners []CollectibleOwner `json:"owners"` +} + +type CollectibleContractOwnershipProvider interface { + FetchCollectibleOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*CollectibleContractOwnership, error) + IsChainSupported(chainID uint64) bool +} diff --git a/services/wallet/thirdparty/infura/client.go b/services/wallet/thirdparty/infura/client.go index c536514cf..f19fbeac3 100644 --- a/services/wallet/thirdparty/infura/client.go +++ b/services/wallet/thirdparty/infura/client.go @@ -16,21 +16,21 @@ import ( const baseURL = "https://nft.api.infura.io" -type NFTOwner struct { +type CollectibleOwner struct { ContractAddress common.Address `json:"tokenAddress"` TokenID *bigint.BigInt `json:"tokenId"` Amount *bigint.BigInt `json:"amount"` OwnerAddress common.Address `json:"ownerOf"` } -type NFTContractOwnership struct { - Owners []NFTOwner `json:"owners"` - Network string `json:"network"` - Cursor string `json:"cursor"` +type CollectibleContractOwnership struct { + Owners []CollectibleOwner `json:"owners"` + Network string `json:"network"` + Cursor string `json:"cursor"` } type Client struct { - thirdparty.NFTContractOwnershipProvider + thirdparty.CollectibleContractOwnershipProvider client *http.Client apiKey string apiKeySecret string @@ -71,8 +71,8 @@ func (o *Client) IsChainSupported(chainID uint64) bool { return false } -func infuraOwnershipToCommon(contractAddress common.Address, ownersMap map[common.Address][]NFTOwner) (*thirdparty.NFTContractOwnership, error) { - owners := make([]thirdparty.NFTOwner, 0, len(ownersMap)) +func infuraOwnershipToCommon(contractAddress common.Address, ownersMap map[common.Address][]CollectibleOwner) (*thirdparty.CollectibleContractOwnership, error) { + owners := make([]thirdparty.CollectibleOwner, 0, len(ownersMap)) for ownerAddress, ownerTokens := range ownersMap { tokenBalances := make([]thirdparty.TokenBalance, 0, len(ownerTokens)) @@ -84,13 +84,13 @@ func infuraOwnershipToCommon(contractAddress common.Address, ownersMap map[commo }) } - owners = append(owners, thirdparty.NFTOwner{ + owners = append(owners, thirdparty.CollectibleOwner{ OwnerAddress: ownerAddress, TokenBalances: tokenBalances, }) } - ownership := thirdparty.NFTContractOwnership{ + ownership := thirdparty.CollectibleContractOwnership{ ContractAddress: contractAddress, Owners: owners, } @@ -98,9 +98,9 @@ func infuraOwnershipToCommon(contractAddress common.Address, ownersMap map[commo return &ownership, nil } -func (o *Client) FetchNFTOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.NFTContractOwnership, error) { +func (o *Client) FetchCollectibleOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*thirdparty.CollectibleContractOwnership, error) { cursor := "" - ownersMap := make(map[common.Address][]NFTOwner) + ownersMap := make(map[common.Address][]CollectibleOwner) for { url := fmt.Sprintf("%s/networks/%d/nfts/%s/owners", baseURL, chainID, contractAddress.String()) @@ -121,7 +121,7 @@ func (o *Client) FetchNFTOwnersByContractAddress(chainID uint64, contractAddress return nil, err } - var infuraOwnership NFTContractOwnership + var infuraOwnership CollectibleContractOwnership err = json.Unmarshal(body, &infuraOwnership) if err != nil { return nil, err diff --git a/services/wallet/thirdparty/opensea/client.go b/services/wallet/thirdparty/opensea/client.go index 8ff432bdb..3da91fb74 100644 --- a/services/wallet/thirdparty/opensea/client.go +++ b/services/wallet/thirdparty/opensea/client.go @@ -381,7 +381,7 @@ func (o *Client) FetchAllAssetsByOwner(owner common.Address, cursor string, limi return o.fetchAssets(queryParams, limit) } -func (o *Client) FetchAssetsByNFTUniqueID(uniqueIDs []thirdparty.NFTUniqueID, limit int) (*AssetContainer, error) { +func (o *Client) FetchAssetsByNFTUniqueID(uniqueIDs []thirdparty.CollectibleUniqueID, limit int) (*AssetContainer, error) { queryParams := url.Values{} for _, uniqueID := range uniqueIDs { diff --git a/services/wallet/thirdparty/types.go b/services/wallet/thirdparty/types.go index ae687ee99..a72855117 100644 --- a/services/wallet/thirdparty/types.go +++ b/services/wallet/thirdparty/types.go @@ -1,10 +1,5 @@ package thirdparty -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/status-im/status-go/services/wallet/bigint" -) - type HistoricalPrice struct { Timestamp int64 `json:"time"` Value float64 `json:"close"` @@ -41,49 +36,6 @@ type MarketDataProvider interface { FetchTokenDetails(symbols []string) (map[string]TokenDetails, error) } -type NFTUniqueID struct { - ContractAddress common.Address `json:"contractAddress"` - TokenID *bigint.BigInt `json:"tokenID"` -} - -func (k *NFTUniqueID) HashKey() string { - return k.ContractAddress.String() + "+" + k.TokenID.String() -} - -type NFTMetadata struct { - Name string `json:"name"` - Description string `json:"description"` - CollectionImageURL string `json:"collection_image"` - ImageURL string `json:"image"` -} - -type NFTMetadataProvider interface { - CanProvideNFTMetadata(chainID uint64, id NFTUniqueID, tokenURI string) (bool, error) - FetchNFTMetadata(chainID uint64, id NFTUniqueID, tokenURI string) (*NFTMetadata, error) -} - -type TokenBalance struct { - TokenID *bigint.BigInt `json:"tokenId"` - Balance *bigint.BigInt `json:"balance"` -} - -type TokenBalancesPerContractAddress = map[common.Address][]TokenBalance - -type NFTOwner struct { - OwnerAddress common.Address `json:"ownerAddress"` - TokenBalances []TokenBalance `json:"tokenBalances"` -} - -type NFTContractOwnership struct { - ContractAddress common.Address `json:"contractAddress"` - Owners []NFTOwner `json:"owners"` -} - -type NFTContractOwnershipProvider interface { - FetchNFTOwnersByContractAddress(chainID uint64, contractAddress common.Address) (*NFTContractOwnership, error) - IsChainSupported(chainID uint64) bool -} - type DataParsed struct { Name string `json:"name"` ID string `json:"id"`