You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(sdk-coin-polyx): add HexTransferBuilder for NEW Polymesh memo encoding (CECHO-1370)
Add HexTransferBuilder that produces the NEW Polymesh memo encoding: UTF-8 bytes
right-padded with 0x00 to 32 bytes, passed as a 0x-prefixed hex string, instead of
the OLD ASCII left-pad format used by TransferBuilder.
Changes:
- src/lib/hexTransferBuilder.ts: new class extending TransferBuilder, overrides memo()
with NEW encoding; round-trip safe (already-encoded 0x strings stored as-is)
- src/lib/utils.ts: add encodeMemoNew() and isNewMemoEncoding() helpers
- src/lib/index.ts: export HexTransferBuilder
- src/lib/transactionBuilderFactory.ts: add getHexTransferBuilder(); factory.from()
auto-detects NEW memo encoding (any 0x00 byte) and returns HexTransferBuilder
- src/polyx.ts: add hexTransfer() convenience method alongside stakingBatch()/bondExtra()
- test/unit/transactionBuilder/hexTransferBuilder.ts: 31 unit tests covering memo
encoding for all memo values, factory.from() routing, full round-trip (build →
serialize → from() → build produces identical hex), and OLD vs NEW regression checks
Verified on-chain: broadcast transferWithMemo with NEW memo "56594" on Polymesh testnet
Tx: 0x41c453458385d1373343cb8b4fdc872acd73209881fd95f844ce060caab74d95
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments