Withdraw NFTs
To withdraw NFTs, you must activate the coin which holds the NFTs first.
The withdraw_nft method will return signed raw transaction hex which must be broadcast using the send_raw_transaction method to complete the withdrawal.
| Parameter | Type | Description |
|---|---|---|
| type | string | The contract type of the NFT to withdraw. Either withdraw_erc721 or withdraw_erc1155 |
| withdraw_data | object | A standard WithdrawNftData object. |
| Parameter | Type | Description |
|---|---|---|
| amount | string | Amount of tokens to withdraw. |
| tx_hex | string | Raw hex of signed transaction. Use this with the send_raw_transaction RPC to broadcast the transaction. |
| tx_hash | string | Transaction ID of the withdrawl. |
| from | array | List of source addresses. |
| to | array | List of destination addresses. |
| contract_type | string | Contract type. ERC721 or ERC1155. |
| token_address | string | Token address. |
| token_id | string | Token ID. |
| fee_details | object | A standard WithdrawFee object. |
| coin | string | Coin name. One of AVALANCHE, BSC, ETH, FANTOM, or POLYGON. |
| block_height | integer | Block height of the transaction. If the value is 0, the transaction is unconfirmed. |
| timestamp | integer | Timestamp of the block containing the withdrawl transaction in unix epoch format. |
| internal_id | integer | Used for internal transaction identification, for some coins it may be equal to transaction hash. |
| transaction_type | string | This will always be NftTransfer. |
Withdraw NFTs
POST
withdraw_nft{
"userpass": "RPC_UserP@SSW0RD",
"method": "withdraw_nft",
"mmrpc": "2.0",
"params": {
"type": "withdraw_erc721",
"withdraw_data": {
"chain": "POLYGON",
"to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498",
"token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078",
"token_id": "1"
}
}
}
If you are sending 2 or more NFTs, you must use the withdraw_erc1155 withdraw type.
Withdraw NFTs
POST
withdraw_nft{
"userpass": "RPC_UserP@SSW0RD",
"method": "withdraw_nft",
"mmrpc": "2.0",
"params": {
"type": "withdraw_erc1155",
"withdraw_data": {
"chain": "POLYGON",
"to": "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498",
"token_address": "0x73a5299824cd955af6377b56f5762dc3ca4cc078",
"token_id": "1"
}
}
}
If you would like to withdraw all NFTs from a token_address, you must use the withdraw_erc1155 withdraw type and set max to true.
Withdraw NFTs
POST
withdraw_nft{
"userpass": "RPC_UserP@SSW0RD",
"method": "withdraw_nft",
"mmrpc": "2.0",
"params": {
"type": "withdraw_erc1155",
"withdraw_data": {
"chain": "POLYGON",
"to": "0x27Ad1F808c1ef82626277Ae38998AfA539565660",
"token_address": "0x2953399124f0cbb46d2cbacd8a89cf0599974963",
"token_id": "110473361632261669912565539602449606788298723469812631769659886404530570536720",
"max": true
}
}
}
View the source code at: https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/nft.rs