Skip to content

feat(sdk-coin-polyx): add HexTokenTransferBuilder for POLYX security token NEW memo encoding (CECHO-1381)#9058

Merged
nvrakesh06 merged 1 commit into
masterfrom
nvrakeshreddy/cecho-1381-bitgojs-hex-token-transfer-builder
Jun 18, 2026
Merged

feat(sdk-coin-polyx): add HexTokenTransferBuilder for POLYX security token NEW memo encoding (CECHO-1381)#9058
nvrakesh06 merged 1 commit into
masterfrom
nvrakeshreddy/cecho-1381-bitgojs-hex-token-transfer-builder

Conversation

@nvrakesh06

Copy link
Copy Markdown
Contributor

Summary

  • Adds HexTokenTransferBuilder extending TokenTransferBuilder — overrides memo() to use NEW Polymesh encoding (UTF-8 hex, right-padded with 0x00) for the settlement.addAndAffirmWithMediators instructionMemo field
  • Registers getHexTokenTransferBuilder() on TransactionBuilderFactory
  • Wires isNewMemoEncoding detection into factory.from() for AddAndAffirmWithMediators so round-trips automatically route to the correct builder (mirrors existing pattern for TransferWithMemo)
  • 20 unit tests: memo encoding for all required values, OLD vs NEW encoding diff, build transactions, factory round-trips, OLD builder no-regression

Jira

CECHO-1381

Test plan

  • npm run unit-test passes (179 tests) in modules/sdk-coin-polyx
  • HexTokenTransferBuilder produces 0x-prefixed 66-char hex memo
  • TokenTransferBuilder still produces OLD left-padded encoding (no regression)
  • factory.from() returns HexTokenTransferBuilder for NEW-encoded token transfer txs
  • Round-trip: build → serialize → factory.from() → build → identical bytes

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

CECHO-1381

Copilot AI left a comment

Copy link
Copy Markdown

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 adds support for the NEW Polymesh memo encoding for settlement.addAndAffirmWithMediators token transfers by introducing a dedicated builder and updating factory routing so decoded transactions round-trip through the correct encoding behavior.

Changes:

  • Add HexTokenTransferBuilder (extends TokenTransferBuilder) that encodes memos as UTF-8 hex (0x-prefixed) right-padded with 0x00 to 32 bytes, while preserving already-encoded 32-byte hex memos.
  • Update TransactionBuilderFactory.from() to detect NEW memo encoding for AddAndAffirmWithMediators and return HexTokenTransferBuilder automatically.
  • Add comprehensive unit tests covering NEW vs OLD encoding differences, transaction build behavior, and factory.from() round-trips.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
modules/sdk-coin-polyx/test/unit/transactionBuilder/hexTokenTransferBuilder.ts Adds unit tests for NEW token-transfer memo encoding, build outputs, and factory round-trips.
modules/sdk-coin-polyx/src/lib/transactionBuilderFactory.ts Routes decoded AddAndAffirmWithMediators txs to HexTokenTransferBuilder when NEW memo encoding is detected.
modules/sdk-coin-polyx/src/lib/index.ts Exports HexTokenTransferBuilder from the module public surface.
modules/sdk-coin-polyx/src/lib/hexTokenTransferBuilder.ts Implements NEW Polymesh memo encoding behavior for token transfers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nvrakesh06 nvrakesh06 marked this pull request as ready for review June 18, 2026 09:41
@nvrakesh06 nvrakesh06 requested a review from a team as a code owner June 18, 2026 09:41
@nvrakesh06 nvrakesh06 changed the base branch from nvrakeshreddy/cecho-1370-bitgojs-add-hextransferbuilder-for-polyx-new-memo-encoding to master June 18, 2026 09:41
rohitsaw115
rohitsaw115 previously approved these changes Jun 18, 2026

@MohammedRyaan786 MohammedRyaan786 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

venkateshv1266
venkateshv1266 previously approved these changes Jun 18, 2026
@nvrakesh06 nvrakesh06 closed this Jun 18, 2026
@nvrakesh06 nvrakesh06 reopened this Jun 18, 2026
…encoding (CECHO-1381)

Adds HexTokenTransferBuilder extending TokenTransferBuilder to produce the
NEW Polymesh memo encoding (UTF-8 hex, right-padded with 0x00) for the
settlement.addAndAffirmWithMediators instructionMemo field. Registers
getHexTokenTransferBuilder() on TransactionBuilderFactory and wires auto-
detection into factory.from() so round-trips route to the correct builder.

Ticket: CECHO-1381
Co-authored-by: Cursor <cursoragent@cursor.com>
@nvrakesh06 nvrakesh06 force-pushed the nvrakeshreddy/cecho-1381-bitgojs-hex-token-transfer-builder branch from 7e254ff to a87e4ca Compare June 18, 2026 10:12
@nvrakesh06 nvrakesh06 merged commit 5145634 into master Jun 18, 2026
21 of 22 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.

5 participants