-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: move hashPlutusData to Data.hashData #143
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
Conversation
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.
Pull request overview
This PR refactors the PlutusData hashing functionality by moving it from utils/Hash.hashPlutusData() to Data.hashData() for better organization and discoverability. The change is a breaking change as it removes the old function entirely.
Changes:
- Added
Data.hashData()function to compute blake2b-256 hash of PlutusData - Removed
hashPlutusDatafromutils/Hashmodule - Updated test to use the new
Data.hashData()function - Updated documentation to mark the old function as deprecated and document the new function
- Updated Address module documentation versions from v1.0.0 to v2.0.0
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/evolution/src/Data.ts | Adds the new hashData function with proper documentation and examples |
| packages/evolution/src/utils/Hash.ts | Removes the old hashPlutusData function and its import of DatumHash |
| packages/evolution/test/UtilsHash.CML.test.ts | Updates test to use Data.hashData instead of UtilsHash.hashPlutusData |
| packages/evolution/docs/modules/Data.ts.md | Documents the new Data.hashData function with signature and examples |
| packages/evolution/docs/modules/utils/Hash.ts.md | Marks hashPlutusData as deprecated with strikethrough |
| docs/content/docs/modules/Data.mdx | Documents the new Data.hashData function (MDX version) |
| docs/content/docs/modules/utils/Hash.mdx | Marks hashPlutusData as deprecated (MDX version) |
| packages/evolution/docs/modules/Address.ts.md | Updates version annotations from v1.0.0 to v2.0.0 |
| docs/content/docs/modules/Address.mdx | Updates version annotations from v1.0.0 to v2.0.0 |
| .changeset/sour-lands-greet.md | Documents the breaking change and provides migration examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```ts | ||
| export declare const hashPlutusData: (pd: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash | ||
| export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash |
Copilot
AI
Jan 27, 2026
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.
The return type in the deprecated function signature is incomplete. It shows => DatumHash but should be => DatumHash.DatumHash to be consistent with other function signatures in the documentation and to correctly reference the fully qualified type.
| export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash | |
| export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash |
| ```ts | ||
| export declare const hashPlutusData: (pd: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash | ||
| export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash |
Copilot
AI
Jan 27, 2026
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.
The return type in the deprecated function signature is incomplete. It shows => DatumHash but should be => DatumHash.DatumHash to be consistent with other function signatures in the documentation and to correctly reference the fully qualified type.
| export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash | |
| export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash |
| ## Address overview | ||
|
|
||
| Added in v1.0.0 | ||
| Added in v2.0.0 |
Copilot
AI
Jan 27, 2026
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.
The Address documentation version changes from v1.0.0 to v2.0.0 appear to be unrelated to the hashPlutusData refactoring described in the PR. While these changes may be correct (as the Address.ts source code uses @SInCE 2.0.0), they are not mentioned in the PR description. Consider whether these changes should be in a separate PR or if the PR description should be updated to mention them.
Move PlutusData hashing from `utils/Hash.hashPlutusData()` to `Data.hashData()` for better organization and discoverability.
Changes:
Breaking Change: `hashPlutusData` removed from `utils/Hash`. Use `Data.hashData()` instead.