-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: add support for multiple data script outputs when creating a token #596
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #596 +/- ##
==========================================
+ Coverage 78.76% 78.77% +0.01%
==========================================
Files 68 68
Lines 5383 5386 +3
Branches 1144 1145 +1
==========================================
+ Hits 4240 4243 +3
Misses 1126 1126
Partials 17 17 ☔ View full report in Codecov by Sentry. |
src/utils/tokens.ts
Outdated
@@ -481,7 +483,8 @@ const tokens = { | |||
* @param {string} [options.mintAuthorityAddress] the address to send the mint authority created | |||
* @param {boolean} [options.createMelt=true] Whether to create a melt output | |||
* @param {string} [options.meltAuthorityAddress] the address to send the melt authority created | |||
* @param {string|null} [options.nftData=null] NFT data to create an NFT token | |||
* @param {string[]|null} [options.data=null] list of data strings to add each as a data script output |
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.
question(if-minor): Do you think we should have the string be encoded?
For NFTs we used utf8 encoding since the data would be a string anyway, but now that we are allowing other types of data output should we have a different encoding, for instance base64 since its safe for utf8 strings and binary data.
Even if we keep using utf8 I think we should add the expected encoding on the docstrings, to make sure the caller knows how to pass the data.
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.
getNFTCreationFee(): number { | ||
getDataScriptOutputFee(): number { |
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.
issue(if-minor): This may be used by the other wallets.
If it is being used we should remember to bump the lib and make this change on the wallets after this is released
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.
I thought we would be using it in the wallets but we actually don't. We have method in the wallet utils but we should change to use the lib.
https://github.com/HathorNetwork/hathor-wallet/blob/master/src/utils/tokens.js#L111
Motivation
A use case needs to create tokens with data script outputs (more than one in the same create token transaction, if possible). This is similar to the Create NFT transaction, however we would be marking this token as an NFT in our metadata bucket, which is bad for the use case.
Because of that, we decided to add support to data script outputs in the lib methods adding them in the last positions of outputs, because the NFT standard expects the data output to be in the first output.
This is a short term solution and a new project will be created to define better how to better identify an NFT token, without fixing where the data output must be.
Acceptance Criteria
getNFTCreationFee
method name togetDataScriptOutputFee
.Security Checklist