Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: CIP67 and CIP68 Support #297

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

theeldermillenial
Copy link
Contributor

@theeldermillenial theeldermillenial commented Jan 11, 2024

This PR is a first pass implementation at handling classes for CIP67 and CIP68. These classes will streamline handling and parsing tokens utilizing these standards. This approach attempts to extend AssetName by providing additional validation to ensure CIP68 compliance for token names, as well as associated cbor classes for parsing associated metadata.

Feedback on implementation details and additional functionality is welcomed.

Todo:

  • Unit Tests
  • More rigorous validation of CIP68 fields (e.g. the uri fields)
  • Documentation

@codecov-commenter
Copy link

Codecov Report

Attention: 25 lines in your changes are missing coverage. Please review.

Comparison is base (3d27786) 84.51% compared to head (2df945e) 84.11%.

Files Patch % Lines
pycardano/cip/cip68.py 76.27% 14 Missing ⚠️
pycardano/cip/cip67.py 45.00% 11 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #297      +/-   ##
==========================================
- Coverage   84.51%   84.11%   -0.41%     
==========================================
  Files          27       29       +2     
  Lines        3093     3172      +79     
  Branches      758      768      +10     
==========================================
+ Hits         2614     2668      +54     
- Misses        358      383      +25     
  Partials      121      121              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nielstron
Copy link
Contributor

This is great. I was actually thinking that PlutusData in pycardano could try to support TypedDict as type annotation for field.

Also I found that deserialization of CIP68 compliant datums fails - have not checked lately if this has been fixed but likely requires a similar fix as #293

@theeldermillenial
Copy link
Contributor Author

theeldermillenial commented Jan 12, 2024

This is great. I was actually thinking that PlutusData in pycardano could try to support TypedDict as type annotation for field.

So we just need some kind of extension of this?

class DictCBORSerializable(CBORSerializable):

Also I found that deserialization of CIP68 compliant datums fails - have not checked lately if this has been fixed but likely requires a similar fix as #293

Have any examples? I just did a query of all cip68 reference tokens and found that 99.99% of them are nfts. I'm trying to figure out a good set of test cases for it. I could use the example in the CIP68 docs, but those are extremely sparse. Ideally I could get a range of different examples.

@nielstron
Copy link
Contributor

I would rather extend the support of type annotations for fields of PlutusData here:

Also for the CIP68 datum I meant the deserialization happening when submitting a transaction with a CIP68 Datum attached - you can try this yourself easily. But don't have any examples at hand right now except for https://preprod.cardanoscan.io/transaction/36f79154eff88d73c21caaf9c5e1bedfc1ff641e39f7f80381dbdba0c104bc50

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.

None yet

3 participants