feat(tron): add data type for sign message#215
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Tron UR registry sign-request payload to include a dataType field so callers can distinguish between signing a transaction vs. signing a personal message.
Changes:
- Adds a
DataTypeenum and adataTypefield toTronSignRequestserialization/deserialization. - Updates the public exports to expose
DataTypefrom the package entrypoint. - Updates Jest tests to include
dataTypeand to match the new UR encoding output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/ur-registry-tron/src/index.ts | Re-exports DataType alongside TronSignRequest. |
| packages/ur-registry-tron/src/TronSignRequest.ts | Introduces DataType and serializes/deserializes it in the CBOR map; updates constructor and factory signature. |
| packages/ur-registry-tron/test/TronSignRequest.test.ts | Adjusts tests to set dataType and updates expected UR strings. |
Comments suppressed due to low confidence (1)
packages/ur-registry-tron/src/TronSignRequest.ts:133
constructTronRequestnow requires a new positionaldataTypeargument, which is a breaking change for downstream callers. If backward compatibility is desired, consider makingdataTypeoptional with a default (e.g.,DataType.transaction) and/or providing an overload that preserves the previous parameter order.
public static constructTronRequest(
signData: Buffer,
dataType: DataType,
derivationHDPath: string,
xfp: string,
uuidString?: string,
address?: Buffer,
origin?: string
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
16
to
20
| signData, | ||
| dataType, | ||
| derivationPath, | ||
| address, | ||
| origin, |
Comment on lines
98
to
+101
| return new TronSignRequest({ | ||
| requestId, | ||
| signData: map[Keys.signData], | ||
| dataType: map[Keys.dataType], |
Comment on lines
+23
to
+26
| export enum DataType { | ||
| transaction = 1, | ||
| personalMessage = 2, | ||
| } |
soralit
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.