Skip to content

feat: add erc-1155 nft transfer amount#1290

Merged
jaymengxy merged 1 commit intomasterfrom
feature/erc1155
Jul 10, 2025
Merged

feat: add erc-1155 nft transfer amount#1290
jaymengxy merged 1 commit intomasterfrom
feature/erc1155

Conversation

@jaymengxy
Copy link
Copy Markdown
Contributor

Related Issue

Closes #1241

Summary of Changes

Need Regression Testing

  • Yes
  • No

Risk Assessment

  • Low
  • Medium
  • High

Additional Notes

Screenshots (if applicable)

@jaymengxy jaymengxy requested a review from lmcmz July 10, 2025 03:51
@jaymengxy jaymengxy self-assigned this Jul 10, 2025
@jaymengxy jaymengxy requested a review from a team as a code owner July 10, 2025 03:51
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 10, 2025

PR Summary

Added support for ERC-1155 NFT transfers with amount selection functionality. Implemented amount controls in NFT detail and send confirmation screens, allowing users to specify transfer quantities for ERC-1155 tokens. Updated NFT models and UI components to handle and display token amounts.

Changes

File Summary
app/src/main/java/com/flowfoundation/wallet/manager/config/NftCollectionConfig.kt Added contractType field to NftCollection data class and helper method to determine NFT contract type (ERC721/ERC1155)
app/src/main/java/com/flowfoundation/wallet/network/model/NFTContractType.kt Added new enum class NFTContractType to distinguish between ERC721 and ERC1155 token standards
app/src/main/java/com/flowfoundation/wallet/network/model/NFTListResponse.kt Added contractType and amount fields to Nft data class with helper method isERC1155NFT()
app/src/main/java/com/flowfoundation/wallet/page/nft/nftdetail/presenter/NftDetailPresenter.kt Updated NFT detail view to show amount for ERC1155 tokens
app/src/main/java/com/flowfoundation/wallet/page/nft/nftlist/presenter/NFTListItemPresenter.kt Updated NFT list item to show amount for ERC1155 tokens
app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/NftSendConfirmViewModel.kt Implemented amount management and ERC1155 transfer logic in send confirmation view model
app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/presenter/NftSendConfirmPresenter.kt Implemented amount input controls and validation in send confirmation dialog
app/src/main/res/drawable/ic_amount_minus.xml New drawable for amount decrease button
app/src/main/res/drawable/ic_amount_plus.xml New drawable for amount increase button
app/src/main/res/layout/activity_nft_detail.xml Added amount display section in NFT detail screen
app/src/main/res/layout/dialog_send_confirm.xml Added amount input controls to NFT send confirmation dialog
app/src/main/res/layout/item_nft_list.xml Added amount display to NFT list item
app/src/main/res/values/strings.xml Added strings for transfer status and NFT amount display
gradle.properties Updated version code to 301 and version name to r2.8.8

autogenerated by presubmit.ai

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 9e2dc0b: feat: add erc-1155 nft transfer amount
Files Processed (14)
  • app/src/main/java/com/flowfoundation/wallet/manager/config/NftCollectionConfig.kt (3 hunks)
  • app/src/main/java/com/flowfoundation/wallet/network/model/NFTContractType.kt (1 hunk)
  • app/src/main/java/com/flowfoundation/wallet/network/model/NFTListResponse.kt (2 hunks)
  • app/src/main/java/com/flowfoundation/wallet/page/nft/nftdetail/presenter/NftDetailPresenter.kt (1 hunk)
  • app/src/main/java/com/flowfoundation/wallet/page/nft/nftlist/presenter/NFTListItemPresenter.kt (1 hunk)
  • app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/NftSendConfirmViewModel.kt (4 hunks)
  • app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/presenter/NftSendConfirmPresenter.kt (5 hunks)
  • app/src/main/res/drawable/ic_amount_minus.xml (1 hunk)
  • app/src/main/res/drawable/ic_amount_plus.xml (1 hunk)
  • app/src/main/res/layout/activity_nft_detail.xml (3 hunks)
  • app/src/main/res/layout/dialog_send_confirm.xml (1 hunk)
  • app/src/main/res/layout/item_nft_list.xml (1 hunk)
  • app/src/main/res/values/strings.xml (1 hunk)
  • gradle.properties (1 hunk)
Actionable Comments (2)
  • app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/NftSendConfirmViewModel.kt [54-54]

    possible bug: "Potential integer overflow when parsing amount"

  • app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/presenter/NftSendConfirmPresenter.kt [83-83]

    possible bug: "Potential crash when parsing empty amount input"

Skipped Comments (1)
  • app/src/main/java/com/flowfoundation/wallet/network/model/NFTContractType.kt [10-16]

    enhancement: "Improve enum handling with default value"

this.sendModel = nft
fun bindSendModel(model: NftSendModel) {
this.sendModel = model
maxAmount = model.nft.amount?.toInt()?: 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toInt() call on the nullable string amount could throw a NumberFormatException or cause integer overflow for large values. Consider adding proper error handling and validation of the input string value.

override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable?) {
val inputAmount = s.toString().toIntOrNull() ?: 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toIntOrNull() call could return null for empty or invalid input, which would then be used as 0. This could lead to invalid state. Consider adding input validation and proper error handling for invalid amount values.

@jaymengxy jaymengxy merged commit 8934df6 into master Jul 10, 2025
2 of 3 checks passed
@jaymengxy jaymengxy deleted the feature/erc1155 branch July 10, 2025 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants