Withdraw ERC1155 and EVM based chains support added for NFT PoC#1704
Withdraw ERC1155 and EVM based chains support added for NFT PoC#1704
Conversation
Oh, it is from previous nft list / history struct versions, when there were different nft lists grouped by chain. |
shamardy
left a comment
There was a problem hiding this comment.
Thanks you for the fixes! Next iteration
| } | ||
|
|
||
| #[cfg(feature = "enable-nft-integration")] | ||
| fn get_valid_eth_withdraw_addresses( |
There was a problem hiding this comment.
get_valid_eth_withdraw_addresses is used only for NFT so the name should probably be more indicative of this. I actually think there should be a common implementation for both withdraw NFT functions that gets used in both withdraw_erc721, withdraw_erc1155 since there is a lot of common code between them, this will make this function not needed and the code below will be included in only the common withdraw NFT impl.
Please consider this refactor in the next PRs.
There was a problem hiding this comment.
changed to get_valid_nft_add_to_withdraw.
Yeah, there is a need for refactoring, noted it
…aw-erc1155 # Conflicts: # mm2src/coins/eth.rs
shamardy
left a comment
There was a problem hiding this comment.
Great Work 🔥
Only a non-blocker below and this #1704 (comment)
|
@ozkanonur Hi, its ready for next review iteration. |
onur-ozkan
left a comment
There was a problem hiding this comment.
LGTM, only a few 'not so important' suggestions
related to #900
withdraw_erc1155methodAvalanche,Fantom,Polygonchains was added. Use uppercase for chain names.If there is no amount param for
withdraw_nft, amount = 1 by default.withdraw_nft req for ERC1155 token without amount param
{ "userpass": "'$USERPASS'", "method": "withdraw_nft", "mmrpc": "2.0", "params": { "type": "WithdrawErc1155", "withdraw_data": { "chain": "POLYGON", "from": "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2", "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", "token_id": "5" } } }withdraw_nft res for ERC1155 token without amount param
{ "mmrpc": "2.0", "result": { "tx_hex": "f9014c808526f52f5416830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a0f8b50c8a98ac1b550aad13532e999ad128343f10d4269a64de242fb4c338c42aa022fbdb9a7570ef8513ab7654e49beb71a20372aec4c61e3d85ec7a81403f6f3a", "tx_hash": "fe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9", "from": [ "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" ], "to": [ "0x6FAD0eC6bb76914b2a2a800686acc22970645820" ], "contract_type": "ERC1155", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", "token_id": "5", "amount": "1", "fee_details": { "type": "Eth", "coin": "MATIC", "gas": 68020, "gas_price": "0.000000167322276886", "total_fee": "0.01138126127378572" }, "coin": "MATIC", "block_height": 0, "timestamp": 1678269896, "internal_id": 0, "transaction_type": "NftTransfer" }, "id": null }send_raw_transaction req
{ "method": "send_raw_transaction", "coin": "MATIC", "tx_hex": "f9014c808526f52f5416830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a0f8b50c8a98ac1b550aad13532e999ad128343f10d4269a64de242fb4c338c42aa022fbdb9a7570ef8513ab7654e49beb71a20372aec4c61e3d85ec7a81403f6f3a", "userpass": "'$USERPASS'" }send_raw_transaction res
{"tx_hash":"fe8d5fc480c534625d7e6fc81eadff8b8f6c986cd46f00d5993b6e21d6bd28c9"}polygonscan result
Another
withdraw_nftrequest example with max param.withdraw_nft req for ERC1155 with max:true
{ "userpass": "'$USERPASS'", "method": "withdraw_nft", "mmrpc": "2.0", "params": { "type": "WithdrawErc1155", "withdraw_data": { "chain": "POLYGON", "from": "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2", "to": "0x6FAD0eC6bb76914b2a2a800686acc22970645820", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", "token_id": "5", "max": true } } }withdraw_nft res for ERC1155 with max:true
{ "mmrpc": "2.0", "result": { "tx_hex": "f9014c01852c61bc8e85830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a0af066015590d840579baf398c4bd5e46b2dd71daaa3eae5fbb9909e30834edeea02ba9754f643571920eec1cab076f5f74e1cb5e2879d6fdaea7f90d8e43505655", "tx_hash": "9c32db57fdcfd0ccdae193c895cf709aaac5aef1582da825579ddbb831c1f700", "from": [ "0xf622a6C52C94b500542E2AE6bcAD24C53Bc5b6a2" ], "to": [ "0x6FAD0eC6bb76914b2a2a800686acc22970645820" ], "contract_type": "ERC1155", "token_address": "0x48c75fbf0452fa8ff2928ddf46b0fe7629cca2ff", "token_id": "5", "amount": "2", "fee_details": { "type": "Eth", "coin": "MATIC", "gas": 68020, "gas_price": "0.000000190618308229", "total_fee": "0.01296585732573658" }, "coin": "MATIC", "block_height": 0, "timestamp": 1678351719, "internal_id": 0, "transaction_type": "NftTransfer" }, "id": null }send_raw_transaction req
{ "method": "send_raw_transaction", "coin": "MATIC", "tx_hex": "f9014c01852c61bc8e85830109b49448c75fbf0452fa8ff2928ddf46b0fe7629cca2ff80b8e4f242432a000000000000000000000000f622a6c52c94b500542e2ae6bcad24c53bc5b6a20000000000000000000000006fad0ec6bb76914b2a2a800686acc229706458200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000023078000000000000000000000000000000000000000000000000000000000000820136a0af066015590d840579baf398c4bd5e46b2dd71daaa3eae5fbb9909e30834edeea02ba9754f643571920eec1cab076f5f74e1cb5e2879d6fdaea7f90d8e43505655", "userpass": "'$USERPASS'" }send_raw_transaction res
{"tx_hash":"9c32db57fdcfd0ccdae193c895cf709aaac5aef1582da825579ddbb831c1f700"}polygonscan result