(Fix) Support CryptoKitties NFTs#1574
Conversation
NFT-related helper functions into it `generateERC721TransferTxData` will decide whether the method to transfer an NFT will be `transfer` or `safeTransferFrom`, based on preset conditions where CryptoKitties tokens is taken as an exception. Also, `transfer` was used instead of `transferFrom` because `transferFrom` is not implemented in the rinkeby version, and was the method used as a fallback before. - moved `SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH` const - moved `isSendERC721Transaction` function - moved `getERC721Symbol` function - moved `isERC721Contract` function - created `getTransferMethodByContractAddress` along with `CK_ADDRESS` const - created `generateERC721TransferTxData` function - refactored `ReviewCollectible` component to use `generateERC721TransferTxData` - updated tests
|
CLA Assistant Lite All Contributors have signed the CLA. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
|
Travis automatic deployment: |
|
Travis automatic deployment: |
1 similar comment
|
Travis automatic deployment: |
|
Travis automatic deployment: |
| * @param {string} contractAddress | ||
| * @returns string | ||
| */ | ||
| export const getTransferMethodByContractAddress = (contractAddress: string): string => { |
There was a problem hiding this comment.
Could you add two tests cases? one for contractAddress = Criptokitties and other for a random collectible address
There was a problem hiding this comment.
done, thanks for the helping hand! 6e96f9d (#1574)
|
Travis automatic deployment: |
|
Travis automatic deployment: |
|
Travis automatic deployment: |
|
Travis automatic deployment: |
# Conflicts: # src/logic/safe/store/actions/transactions/utils/transactionHelpers.ts # src/logic/tokens/utils/tokenHelpers.ts
|
Travis automatic deployment: |
|
Travis automatic deployment: |
|
Travis automatic deployment: |
|
Travis automatic deployment: |
|
Tried just for the rinkeby version (since the CK token is only there). Safes: https://pr1574--safereact.review.gnosisdev.com/rinkeby/app/#/safes/0xFB1fA6c1b4244191bf4Ab96d9DE74b3D8E6d6c5A/transactions Send the CK between safes back and forth several times. I didn't had any issues Looks good to me |
This PR closes #1550, by creating
logic/collectibles/utilsfile and move all the NFT-related helper functions into it.generateERC721TransferTxDatawill decide whether the method to transfer an NFT will betransferorsafeTransferFrom, based on preset conditions where CryptoKitties tokens is taken as an exception.transferwas used instead oftransferFrombecausetransferFromis not implemented in the rinkeby version of CK, and was the method used as a fallback before.Things done:
SAFE_TRANSFER_FROM_WITHOUT_DATA_HASHconstisSendERC721TransactionfunctiongetERC721SymbolfunctionisERC721ContractfunctiongetTransferMethodByContractAddressalong withCK_ADDRESSconstgenerateERC721TransferTxDatafunctionReviewCollectiblecomponent to usegenerateERC721TransferTxDataThis PR will conflict with PR #1567. My suggestion is to merge that PR before, but resolution can be done any way.