mx-api-service icon indicating copy to clipboard operation
mx-api-service copied to clipboard

Unified Tokens & MetaESDTs

Open tanghel opened this issue 3 years ago • 3 comments

Reasoning

  • Although structurally similar, an NFT of type MetaESDT has much more similarity to a payable token, rather than an NFT
  • what is actually different between a fungible token and a MetaESDT is that every instance of it can carry certain metadata in the form of attributes
  • this is how e.g. LKMEX unlock schedule is encoded or how farming reward positions are stored

Proposed Changes

  • in all token-related endpoints, offer the possibility to load both tokens of type FungibleESDT and MetaESDT
  • in all nft-related endpoints, offer the possibility to not load tokens of type MetaESDT

How to test (mainnet)

  • /tokens?includeMetaESDT=true should return both tokens of type FungibleESDT and MetaESDT
  • /tokens?includeMetaESDT=true&type=MetaESDT should return only tokens of type MetaESDT
  • /tokens/:token should return token details even if type = MetaESDT
  • /tokens/:token/accounts should also return data for token collections of type MetaESDT and will return token identifier & attributes extra compared to a fungible token
  • /tokens/:token/supply should return supply information also for tokens of type MetaESDT. For now, all values are 0 but in the future, when the node saves collection supply, that information will be provided
  • /accounts/:account/tokens?includeMetaESDT=true should return both tokens of type FungibleESDT and MetaESDT from the specified account
    • it should also contain the attributes field in case of MetaESDT
  • /accounts/:account/tokens?includeMetaESDT=true&type=MetaESDT should return only tokens of type MetaESDT from the specified account
  • /accounts/:account/tokens/:token should return account token details also if its type is MetaESDT
  • /collections?excludeMetaESDT=true should return only collections of type NonFungibleESDT and SemiFungibleESDT (without the ones of type MetaESDT)
  • /accounts/:account/roles/collections?excludeMetaESDT=true should return only collections of type NonFungibleESDT and SemiFungibleESDT (without the ones of type MetaESDT) from the specified account
  • /accounts/:account/collections?excludeMetaESDT=true should return only collections of type NonFungibleESDT and SemiFungibleESDT (without the ones of type MetaESDT) from the specified account
  • /accounts/:account/roles/tokens?includeMetaESDT=true should return both tokens of type FungibleESDT and MetaESDT from the specified account
  • /accounts/:account/nfts?excludeMetaESDT=true should return only NFTs of type NonFungibleESDT and SemiFungibleESDT (without the ones of type MetaESDT) from the specified account

tanghel avatar Nov 22 '22 11:11 tanghel

Codecov Report

Base: 27.84% // Head: 26.93% // Decreases project coverage by -0.90% :warning:

Coverage data is based on head (b58299f) compared to base (818b63e). Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #897      +/-   ##
===============================================
- Coverage        27.84%   26.93%   -0.91%     
===============================================
  Files                7        7              
  Lines              237      245       +8     
  Branches             8        8              
===============================================
  Hits                66       66              
- Misses             163      171       +8     
  Partials             8        8              
Flag Coverage Δ
unittests 26.93% <0.00%> (-0.91%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/utils/api.checker.ts 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Nov 22 '22 11:11 codecov-commenter

/tokens?withMetaESDT=true&type=MetaESDT should return only tokens of type FungibleESDT - shouldn't it only return MetaESDT tokens?

gabrielmatei avatar Nov 23 '22 12:11 gabrielmatei

/tokens?withMetaESDT=true&type=MetaESDT should return only tokens of type FungibleESDT - shouldn't it only return MetaESDT tokens?

Indeed, there was a problem in the PR description. Should be good now

tanghel avatar Nov 23 '22 12:11 tanghel