fix: update hextou8a and u8atohex and basebytes#244
Merged
Conversation
Contributor
|
preview environment is ready at https://244-a08bb5e.multisig-preview.subscan.io |
Contributor
|
preview environment is ready at https://244-3a68014.multisig-preview.subscan.io |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces upstream @polkadot/util hex/bytes conversion helpers with local “fixed” implementations to address conversion issues, and updates multiple UI + helper call sites to use the new functions (notably affecting BaseBytes rendering/validation and various address/param formatting paths).
Changes:
- Introduce
hexToU8aFixedandu8aToHexFixedhelpers and switch call sites away from@polkadot/util’shexToU8a/u8aToHex. - Update
BaseBytesinput parsing/validity handling and add support forlabelExtra. - Improve a couple of UI display edge cases (e.g., optional
approvals, showing ASCII for hex args when decodable).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/helper/validate.ts | Switches SS58 validation to use local fixed hexToU8a. |
| src/utils/helper/u8aToHex.ts | Adds local u8aToHexFixed implementation. |
| src/utils/helper/hexToU8a.ts | Adds local hexToU8aFixed implementation. |
| src/utils/helper/multisig.ts | Uses local fixed u8aToHex. |
| src/utils/helper/address.ts | Uses local fixed hexToU8a/u8aToHex in address conversions. |
| src/packages/react-params/src/valueToText.tsx | Uses local fixed u8aToHex for display formatting. |
| src/packages/react-params/src/Param/KeyValueArray.tsx | Uses local fixed u8aToHex for KV formatting. |
| src/packages/react-params/src/Param/KeyValue.tsx | Uses local fixed hexToU8a for parsing. |
| src/packages/react-params/src/Param/Hash256.tsx | Uses local fixed u8aToHex for hash placeholder display. |
| src/packages/react-params/src/Param/BaseBytes.tsx | Updates parsing/validity + uses fixed hex/bytes conversions; adds labelExtra. |
| src/packages/react-hooks/src/useOwnStashInfos.ts | Uses local fixed u8aToHex for derived IDs. |
| src/packages/react-hooks/src/useAccounts.ts | Uses local fixed u8aToHex for account hex mapping. |
| src/packages/react-components/src/util/toAddress.ts | Uses local fixed hexToU8a for address decoding. |
| src/packages/react-components/src/InputFile.tsx | Uses local fixed hexToU8a when reading hex-prefixed file contents. |
| src/components/Entries.tsx | Guards approvals.includes with optional chaining. |
| src/components/Args.tsx | Tries to render ASCII when a hex arg decodes to ASCII bytes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
freehere107
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
before

after
