Page MenuHomePhabricator

[Cashtab] Create and Send NFTs
AbandonedPublic

Authored by emack on Nov 4 2021, 14:04.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary
  • The updated Cashtab backend is structured around the concept of the Group vs subgroup NFTs
  • new NFT components created for Group NFTs in the form of CreateGroupNftForm.js, SendNFT.js, GroupNFTList.js
  • new NFT components created for Child NFTs in the form of CreateChildNftForm.js, SendChildNFT.js, ChildNFTList.js
  • new routes added to App.js to enable the navigation to the new Send NFT pages by clicking on the Group or Child NFTs
  • updated Tokens.js and TokenList.js with NFT processing logic
  • new createGroupNFT() and createChildNFT() functions created in useBCH.js to take in the config object containing the NFT attributes and calls on SLP.NFT1.newNFTGroupOpReturn and SLP.NFT1.generateNFTChildGenesisOpReturn via bch-js to create the group/child NFTs
  • new sendGroupNFT() and sendChildNFT() functions created in useBCH.js which calls on SLP.NFT1.generateNFTGroupSendOpReturn and SLP.NFT1.generateNFTChildSendOpReturn via bch-js and transfers it accordingly.
  • updated the getSlpBalancesAndUtxos() function in useBCH.js to look for the '129' Group NFT and '65' Child NFT tokenType and flags the isGroupNFT or isChildNFT booleans in the returned token object. These booleans are also used for front end delination between eTokens, Group NFT and Child NFTs
  • UI will need some further work to ensure it's not cluttering the front end
  • will create snapshots for the new screens once we're closer to finalising this diff
  • minting functions can be left for a subsequent diff once this is working in prod

Question for @bytesofman

  1. How do you want to handle image storage and displays? I've left this aspect untouched for now subject to your input. Upload to IPFS via Cashtab or store some sort of hash of the image onchain to be retrieved in subsequent calls. Don't think the existing token icon reference is workable for NFT as you wouldn't want dead links showing up on what is supposed to be a non-fungible object.
  2. Default token type field for Group NFTs is 0x81, and subgroup NFT is 0x41. We'll need to decide if we want different standards for eCash NFTs. Similarly the decimal precision is set to 0 for the NFT group as per existing SLP NFT1 specs
  3. The concept of creating vs minting will be a learning curve for the average user so will need to agree on how much of the NFT attributes do we expose to the UI and how many do we hardcode with a nominal value to streamline the UX.

T1793

Test Plan
  • npm start
  • navigate to the eTokens & NFTs section
  • expand the 'Create Group NFT' section, fill in attributes and click Create Group NFT
  • verify the newly created Group NFT only appears under the NFT section and not the eTokens section
  • expand the 'Create Child NFT' section, fill in attributes and click Create Child NFT
  • verify the Group NFT has been burnt in the process of creating the Child NFT
  • verify the newly created Child NFT only appears under the NFT section and not the eTokens or Group NFT section
  • verify cross browser compatibility in firefox
  • npm run extension
  • verify functions in web extension mode

Diff Detail

Repository
rABC Bitcoin ABC
Branch
nftmint
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17189
Build 34209: Build Diffcashtab-tests
Build 34208: arc lint + arc unit