-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(eventindexer): Index nfts #14418
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com>
Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com>
cyberhorsey
requested review from
dantaik,
davidtaikocha,
RogerLamTd,
dionysuzx and
KorbinianK
August 9, 2023 06:49
davidtaikocha
approved these changes
Aug 9, 2023
Codecov Report
@@ Coverage Diff @@
## main #14418 +/- ##
===========================================
- Coverage 77.34% 65.41% -11.93%
===========================================
Files 56 90 +34
Lines 1452 3155 +1703
Branches 112 112
===========================================
+ Hits 1123 2064 +941
- Misses 297 965 +668
- Partials 32 126 +94
*This pull request uses carry forward flags. Click here to find out more.
... and 22 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
RogerLamTd
approved these changes
Aug 9, 2023
Merged
2manslkh
pushed a commit
that referenced
this pull request
Aug 11, 2023
Co-authored-by: David <david@taiko.xyz> Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds ERC721 / ERC1155 event indexing and balance calculations for our NFT Bridge, and exposes them via the HTTP API for consuming. It adds a new flag --index-nfts to the eventindexer command, to determine whether to index or not.
The route can be paginated like other queryable routes by adding &page={pageNum} to the request URL.
Route:
http://localhost:4100/nftsByAddress?address=0x02e725b7e99091bd4ccbf15228384e160ecdf78f&chainID=167006
Response:
{
"items": [
{
"id": 14,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 2,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1134,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 455,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1147,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 520,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1151,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 512,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1153,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 14,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1155,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 45,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1157,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 501,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1158,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 495,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1169,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 487,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1172,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 727,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1187,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 776,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1189,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 792,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1201,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 804,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1280,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 469,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
},
{
"id": 1288,
"chainID": 167006,
"address": "0x02e725b7e99091bd4ccbf15228384e160ecdf78f",
"amount": 1,
"tokenID": 1,
"contractAddress": "0xf030B643D6Bc433A5905d18d3f20CCfc446b8CC6",
"contractType": "ERC721"
}
],
"page": 0,
"size": 100,
"max_page": 1,
"total_pages": 1,
"total": 15,
"last": false,
"first": true,
"visible": 15
}
Etherscan account to verify the correct balance (15) of the relevant NFTs after 27 transfers in, 12 transfers out:
https://explorer.l3test.taiko.xyz/address/0x02E725B7e99091Bd4cCBf15228384e160eCdf78f
Using this information, the contractAddress and tokenID, the bridge (or other apps) can look up their current NFT balance, then call the Bridge to see if the token is canonical or bridged, and then look up the tokenURI and retreive the Metadata to display.