Conversation
onur-ozkan
left a comment
There was a problem hiding this comment.
thank you for taking the previous notes serious, I have a few notes regarding to changes
|
|
||
| #[derive(Clone, Deserialize)] | ||
| pub struct WithdrawNftReq { | ||
| pub(crate) url: String, |
There was a problem hiding this comment.
In what scenarios we would need this field?
There was a problem hiding this comment.
It is needed to withdraw erc1155 token type in current implementation.
As amount of erc1155 NFT could be > 1, we need to check that owner has enough "NFT" balance. So I created find_wallet_amount function to access info about all nfts owned by the user.
ps: I cant use get_nft_metadata function, bcz it returns info about the latest owner. ERC1155 can have more than 1 owners, it is fine to call this finction to get the info about name, token_uri, metadata etc since they are common to erc1155 tokens with identical token_id, but owner in response could be different, so amount could be different.
There was a problem hiding this comment.
I mean why it's not hardcoded in the mm2 side? We don't really need to change the url as far as I know. I don't know how this field can be useful ever. If we migrate to gui-auth, all we need to do update the DNS for current proxy address.
There was a problem hiding this comment.
I just thought that hard coding is a bad practice and providing url in request enable people to use their own proxy if they want. But if you ok with hard coded endpoint as it was I can return it.
There was a problem hiding this comment.
Yeah, this seems reasonable. But as far as I see this is send for each withdraw request, unlike other urls
There was a problem hiding this comment.
btw I don't have hard feeling on this - we can ship this with it. It just didn't look quite right to me(sending url with each request)
There was a problem hiding this comment.
It just didn't look quite right to me(sending url with each request)
No worry when db support will be added only update_nft and refresh_metadata API methods will use url, bcz only these methods will be sending requests to moralis to get new info.
GUI told that its fine for them to change requests a little bit I will just need to ping them and provide up to date info about req and res forms.
There was a problem hiding this comment.
But as far as I see this is send for each withdraw request, unlike other urls
Well yeah I ask url for all erc types in withdraw method, but use it only for "type":"withdraw_erc1155", I just didnt want to add new param in withdraw_erc1155 structure. Once db will be added I just remove url, other fields will be the same.
There was a problem hiding this comment.
Usually RPC urls should be included in the enable calls and saved in the coin's fields as part of a client struct, but NFT is a special case since we don't have an enable call for them and defining a coin configuration to an NFT or NFTs in general makes no sense. I still think defining an enable call for NFTs, and some kind of context/coin or client to save the url/s on enable and maybe other important configs in the future if needed is the optimal solution to this url problem. This enable call can be even part of enable_eth_with_tokens if needed.
@laruh please consider this in future PRs if you think it will make things easier.
There was a problem hiding this comment.
@shamardy nice hint, thanks.
personally I dont see using urls in couple future NFT methods as a problem, as NFT is a special case right now.
But yeah I think we cant avoid making some nft configs or adding some enable actions in NFT swaps implementation (related to this thread in previous pr).
I will safe this hint for swaps implementation.
There was a problem hiding this comment.
thank you for the fixes, have some non-blocker small notes
@shamardy please take a look on this PR as well
| use coins::eth::EthCoin; | ||
| use coins::my_tx_history_v2::my_tx_history_v2_rpc; | ||
| #[cfg(feature = "enable-nft-integration")] use coins::nft; | ||
| use coins::nft; |
There was a problem hiding this comment.
future note: we will need to create it's own crate for nft
There was a problem hiding this comment.
will need to create it's own crate for nft
should think about it, in the future there are swaps with nfts. wouldn't it be strange that nfts are not a part of the coins in this case?
There was a problem hiding this comment.
It can inherit from coins, but it's not really a coin. Majority part of the coins modules needs to be seperated to different/their own crates. e.g eth module has amazingly much than what it should have. Which takes development/maintanince/compilation costs to much higher levels.
| } | ||
|
|
||
| #[cfg(target_arch = "wasm32")] | ||
| async fn send_moralis_request(uri: &str, api_key: &str) -> MmResult<Json, GetNftInfoError> { |
There was a problem hiding this comment.
We should allow API users to use their own API key if they want in the future, this is not a priority now though.
#900
possible_spamfield was added inNftandNftTransferHistorystructuresrequest examples
get_nft_list
get_nft_transfers
get_nft_metadata
withdraw erc721
withdraw erc1155
Note: after adding db support "url" param will be removed from requests above and will be added into new
update_nftandrefresh_metadata