Skip to content

fix(sdk-coin-trx): accept hex-form TRON addresses in tx builders - #9649

Merged
ArunBala-Bitgo merged 1 commit into
masterfrom
fix/coins-1575-trx-hex-address
Sep 4, 2026
Merged

fix(sdk-coin-trx): accept hex-form TRON addresses in tx builders#9649
ArunBala-Bitgo merged 1 commit into
masterfrom
fix/coins-1575-trx-hex-address

Conversation

@prajwalu142

Copy link
Copy Markdown
Contributor

Problem

TRC-20 withdrawals to hex-form TRON destinations (0x... / 41...) failed at POST /api/v2/trx:usdt/.../tx/build with an HTTP 500 ... is not a valid base58 address (COINS-1575). The addresses are valid — hex and base58 are alternative encodings of the same 21-byte TRON address — but the builders only accepted base58 form and surfaced the client-input error as a 500.

Goal

Accept every valid representation of a TRON address in all transaction builders while still rejecting genuinely invalid addresses with the same error.

Fix

  • validateAddress accepts base58 or hex form (tronweb's isAddressValid only recognizes base58)
  • getHexAddressFromBase58Address canonicalizes hex-form input to base58 before decoding, so every consumption path (token transfer, account create, contract call, resource management, vote) handles both forms
  • error message unchanged

Testing

Unit tests: hex-form (0x and 41) recipients produce byte-identical transaction data to the base58 form of the same address; genuinely invalid addresses still throw the same error. Tests that asserted hex-form rejection were updated to the new contract.

Ticket: COINS-1575
🤖 Generated with Claude Code

## Problem

TRC-20 withdrawals to hex-form TRON destinations (0x... / 41...) failed at
POST /api/v2/trx:usdt/.../tx/build with an HTTP 500 "... is not a valid
base58 address" (COINS-1575). The addresses are valid — hex and base58 are
alternative encodings of the same 21-byte TRON address — but the builders
only accepted base58 form and surfaced the client-input error as a 500.

## Goal

Accept every valid representation of a TRON address in all transaction
builders while still rejecting genuinely invalid addresses with the
same error.

## Fix

- validateAddress accepts base58 or hex form (tronweb's isAddressValid
  only recognizes base58)
- getHexAddressFromBase58Address canonicalizes hex-form input to base58
  before decoding, so every consumption path (token transfer, account
  create, contract call, resource management, vote) handles both forms
- error message unchanged

## Testing

Unit tests: hex-form (0x and 41) recipients produce byte-identical
transaction data to the base58 form of the same address; genuinely
invalid addresses still throw the same error. Tests that asserted
hex-form rejection were updated to the new contract.

Ticket: COINS-1575
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

COINS-1575

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@prajwalu142
prajwalu142 marked this pull request as ready for review September 4, 2026 03:32
@prajwalu142
prajwalu142 requested a review from a team as a code owner September 4, 2026 03:32
@ArunBala-Bitgo
ArunBala-Bitgo merged commit 86e5814 into master Sep 4, 2026
25 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.

3 participants