-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] NFT integration poc #1652
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Work 🔥 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
We should keep in mind that this implementation needs quite few integration/unit tests. Maybe fill an issue or add TODO to codebase? @laruh |
I added todo plan to the issue. |
How much data is needed for dummy address?
What is the blocker for it? Why it can't pass in one test? If multiple operations are executed in mm2 for performing it, it will be more suitable as an integration test(like swap tests). |
If we are talking about just checking nft list and tx history, we need one test address that does not send or receive NFT but simply stores 1 NFT. With this test we check that moralis didt change a response structure. For withdrawing, we need two more test addresses that send 1 NFT to each other.
After withdrawing, moralis can still show transferred NFT in list and also not show new transfer in history just in time. After some more seconds moralis starts updating and you have to wait the response. It can be a situation that we dont get the response right now and wait timeout check and it fails, just bcz moralis needed some more time. |
A loop with with an interval and timeout can be applied just like in swap tests. |
Oh, I see. So lets add tests after gui-auth adding, to avoid using api key in mm config. |
# Conflicts: # mm2src/coins/eth/v2_activation.rs
10ce258
@ozkanonur @shamardy @sergei-boiko I fixed merge conflicts, could you re-approve please? |
related to #900
The current implementation provides support for the following functionality:
get_nft_list
This function returns list of NFTs on ETH or/and BSC chains owned by user. Mocks
get_nft_list req example
get_nft_list res example
get_nft_metadata
This function returns info of one specific NFT. Current implementation sends request to Moralis.
One moment, that NFT json from moralis for Get NFT metadata has one additional param like "transfer_index": [11362111, 125, 160, 0]. You can see it in Moralis mocks for Get NFT metadata. In response for Get NFT list by wallet NFTs dont have this field. I omitted this parameter and used the same NFT structure in result that I use for get_nft_list. I did it, to be able to first try to fetch data from the list cache before sending new request to moralis.
get_nft_metadata req example
get_nft_metadata res example
get_nft_transfers
This function returns a transfer history of NFTs on ETH or/and BSC chains owned by user. Mocks
get_nft_transfers req example
get_nft_transfers res example
get_my_address
This function returns wallet address for necessary coin without its activation. Currently supports only coins with
ETH
protocol type.get_my_address req example
get_my_address res example
Current
withdraw_nft
implementation(dont forget to enable native coin of chain)
withdraw_nft req example
withdraw_nft res example
Use
send_raw_transaction
to check thatwithdraw_nft
works correctly (for erc721)send_raw_transaction req
send_raw_transaction res
result on bscscan
Notes:
Current implementation uses api-key which is set in parameters in MM config as "api_key".
Withdrawing erc1155 support will be implemented later. Aslo adding caching is in plans.
Feature
enable-nft-integration
was added. To compile binary please use commandcargo build --bin mm2 --features enable-nft-integration