@@ -54,7 +54,8 @@ public class Account: AeFinderEntity, IAeFinderEntity
5454 [Keyword ] public string Symbol { get ; set ; }
5555 public long Amount { get ; set ; }
5656 public string TokenName { get ; set ; }
57- public ExternalInfo ExternalInfo { get ; set ; }
57+ public string NftImageUri { get ; set ; }
58+ public string NftAttributes { get ; set ; }
5859}
5960```
6061
@@ -74,6 +75,17 @@ public class TransferRecord: AeFinderEntity, IAeFinderEntity
7475The NFTTransferredProcessor handles NFT transfer events and updates account balances:
7576
7677``` csharp title="NFTTransferredProcessor.cs"
78+ using System ;
79+ using System .Threading .Tasks ;
80+ using AElf .Sdk .Network .Events ;
81+ using AElf .Types ;
82+ using AElf .Contracts .Account .Dto ;
83+ using AElf .Contracts .Token ;
84+ using AElf .Contracts .Token .Dto ;
85+ using AElf .Contracts .Account ;
86+ using AElf .Contracts .Account .Entity ;
87+ using AElf .Sdk .Service ;
88+ using Microsoft .Extensions .Logging ;
7789using AElf .Contracts .MultiToken ;
7890using AeFinder .Sdk .Logging ;
7991using AeFinder .Sdk .Processor ;
@@ -113,14 +125,6 @@ public class NFTTransferredProcessor : LogEventProcessorBase<Issued>, ITransient
113125 {
114126 Symbol = logEvent .Symbol
115127 };
116- Logger .LogDebug (" Fetching TokenInfo: ChainId={0}, Address={1}, Symbol={2}" , context .ChainId , GetContractAddress (context .ChainId ), logEvent .Symbol );
117- var contractAddress = GetContractAddress (context .ChainId );
118- Logger .LogDebug (" Contract Address resolved to: {0}" , contractAddress );
119- var tokenInfo = await _blockChainService .ViewContractAsync <TokenInfo >(
120- context .ChainId , contractAddress ,
121- " GetTokenInfo" , tokenInfoParam );
122-
123- Logger .LogDebug (" TokenInfo response: {@TokenInfo}" , tokenInfo );
124128
125129 var nftTransfer = new TransferRecord
126130 {
@@ -145,6 +149,8 @@ public class NFTTransferredProcessor : LogEventProcessorBase<Issued>, ITransient
145149 chainId , contractAddress ,
146150 " GetTokenInfo" , tokenInfoParam );
147151
152+ Logger .LogDebug (" TokenInfo response: {@TokenInfo}" , tokenInfo );
153+
148154 if (account == null )
149155 {
150156 account = new Account
@@ -154,7 +160,8 @@ public class NFTTransferredProcessor : LogEventProcessorBase<Issued>, ITransient
154160 Amount = amount ,
155161 Address = address ,
156162 TokenName = tokenInfo .TokenName ,
157- ExternalInfo = tokenInfo .ExternalInfo
163+ NftImageUri = tokenInfo .ExternalInfo ? .Value [" __nft_image_uri" ] ?? tokenInfo .ExternalInfo ? .Value [" __nft_image_url" ],
164+ NftAttributes = tokenInfo .ExternalInfo ? .Value [" __nft_attributes" ]
158165 };
159166 }
160167 else
@@ -188,6 +195,9 @@ public class AccountDto : AeFinderEntityDto
188195 public string Address { get ; set ; }
189196 public string Symbol { get ; set ; }
190197 public long Amount { get ; set ; }
198+ public string TokenName { get ; set ; }
199+ public string NftImageUri { get ; set ; }
200+ public string NftAttributes { get ; set ; }
191201}
192202```
193203
@@ -379,19 +389,19 @@ dotnet build -c Release
379389Through the Playground page below the details page, you can use GraphQL syntax to query the indexed data information. Enter the query statement on the left, and the query results will be displayed on the right.
380390
381391``` GraphQL
382- query {
383- account (input : {
384- chainId : " tDVW" ,
385- address : " DStUjYn3fH1pbCtz614gQhTurrt4w2WgUY7w8ymzXCggedDHb"
386- }) {
387- symbol ,
388- amount ,
389- address ,
390- metadata {
391- chainId ,
392- block {
393- blockHeight
392+ query {
393+ account (input : { chainId : " tDVW" , address : " 2AaBGTi2cJLWtEXR7w96hzun4qVz2KnsGZ1XfqErhKTgDj9Q8x" }) {
394+ symbol ,
395+ amount ,
396+ address ,
397+ tokenName ,
398+ nftImageUri ,
399+ nftAttributes ,
400+ metadata {
401+ chainId ,
402+ block {
403+ blockHeight
404+ }
405+ }
394406 }
395- }
396- }
397407}
0 commit comments