Skip to content

refactor(pkg): add EncodeToUpperHex utility and use across packages#198

Open
kpitapeersyst wants to merge 2 commits intoXRPLF:mainfrom
kpitapeersyst:pkg/xrpl/refactor/encoding-utils
Open

refactor(pkg): add EncodeToUpperHex utility and use across packages#198
kpitapeersyst wants to merge 2 commits intoXRPLF:mainfrom
kpitapeersyst:pkg/xrpl/refactor/encoding-utils

Conversation

@kpitapeersyst
Copy link

refactor(pkg): add EncodeToUpperHex utility and use across packages

Description

This PR centralizes the scattered hex.EncodeToString + strings.ToUpper pattern across the codebase into a single EncodeToUpperHex utility.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Changes

pkg

  • Added EncodeToUpperHex utility in pkg/hexutil and replaced all scattered hex.EncodeToString + strings.ToUpper calls across the codebase

xrpl

  • Used existing EncodeToHashString helper in tx hash computation

Notes

fmt.Sprintf("%X", b) is more concise but as it uses reflection, it's slower, so we keep strings.ToUpper(hex.EncodeToString(b)).

@kpitapeersyst kpitapeersyst changed the title refactor(xrpl): use EncodeToHashString in tx hash computation refactor(pkg): add EncodeToUpperHex utility and use across packages Feb 25, 2026
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.

1 participant