-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add support for asset fingerprint (CIP14) #294
Conversation
…to bugfix/extended-cip8
Bugfix/bytestring
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #294 +/- ##
==========================================
- Coverage 84.63% 84.50% -0.13%
==========================================
Files 26 27 +1
Lines 3071 3092 +21
Branches 752 758 +6
==========================================
+ Hits 2599 2613 +14
- Misses 353 358 +5
- Partials 119 121 +2 ☔ View full report in Codecov by Sentry. |
pycardano/cip/cip14.py
Outdated
from pycardano.crypto.bech32 import encode | ||
|
||
|
||
def encode_asset(policy_id: Union[bytes, str], asset_name: Union[bytes, str]) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the ScriptHash and AssetName classes of pycardano here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... because... Hahaha
I actually had considered that. I decided to just go with raw types. I can switch that over.
Ill add in as an additional input type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think adding it to the Union would be great :)
Ah, I missed the import and docs. I'll remember that next time. Thanks for the cleanup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me!
Send it! |
This PR adds support for CIP14. I looked into a few different ways to integrate it into multi-assets, and I think there is a way to do it (as suggested in #289) but I figured I would open a PR for the minimal implementation first and see if anyone else thinks its a useful/necessary thing to add.
This also includes unit tests against all examples in the CIP.
For reference:
https://developers.cardano.org/docs/governance/cardano-improvement-proposals/cip-0014/
closes #289