Skip to content

fix: update hextou8a and u8atohex and basebytes#244

Merged
carlhong merged 2 commits into
masterfrom
feat/carl/api
Mar 3, 2026
Merged

fix: update hextou8a and u8atohex and basebytes#244
carlhong merged 2 commits into
masterfrom
feat/carl/api

Conversation

@carlhong
Copy link
Copy Markdown
Collaborator

@carlhong carlhong commented Feb 24, 2026

before
image

after
image

@perrornet
Copy link
Copy Markdown
Contributor

preview environment is ready at https://244-a08bb5e.multisig-preview.subscan.io

@perrornet
Copy link
Copy Markdown
Contributor

preview environment is ready at https://244-3a68014.multisig-preview.subscan.io

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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 hexToU8aFixed and u8aToHexFixed helpers and switch call sites away from @polkadot/util’s hexToU8a/u8aToHex.
  • Update BaseBytes input parsing/validity handling and add support for labelExtra.
  • 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.

Comment thread src/utils/helper/hexToU8a.ts
Comment thread src/packages/react-params/src/Param/BaseBytes.tsx
Comment thread src/packages/react-params/src/Param/BaseBytes.tsx
Comment thread src/packages/react-params/src/Param/BaseBytes.tsx
Comment thread src/packages/react-params/src/Param/BaseBytes.tsx
@carlhong carlhong merged commit cda269a into master Mar 3, 2026
6 checks passed
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.

4 participants