-
Notifications
You must be signed in to change notification settings - Fork 201
fix: fix Relay non-EVM transaction notification and Tron calldata handling #12015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -653,12 +653,13 @@ export async function getTrade<T extends 'quote' | 'rate'>({ | |
|
|
||
| if (isRelayQuoteTronItemData(selectedItem.data)) { | ||
| return { | ||
| allowanceContract: '', | ||
| allowanceContract: selectedItem.data?.parameter?.contract_address ?? '', | ||
| solanaTransactionMetadata: undefined, | ||
| relayTransactionMetadata: { | ||
| relayId: quote.steps[0].requestId, | ||
| orderId, | ||
| to: selectedItem.data?.parameter?.contract_address, | ||
| data: selectedItem.data?.parameter?.data, | ||
| }, | ||
|
Comment on lines
654
to
663
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fail fast if Relay Tron calldata or vault address is missing.
✅ Suggested validation if (isRelayQuoteTronItemData(selectedItem.data)) {
+ const contractAddress = selectedItem.data?.parameter?.contract_address
+ const calldata = selectedItem.data?.parameter?.data
+ if (!contractAddress) throw new Error('Relay Tron quote missing contract_address')
+ if (!calldata) throw new Error('Relay Tron quote missing calldata')
return {
- allowanceContract: selectedItem.data?.parameter?.contract_address ?? '',
+ allowanceContract: contractAddress,
solanaTransactionMetadata: undefined,
relayTransactionMetadata: {
relayId: quote.steps[0].requestId,
orderId,
- to: selectedItem.data?.parameter?.contract_address,
- data: selectedItem.data?.parameter?.data,
+ to: contractAddress,
+ data: calldata,
},
}
}🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,22 @@ export const getUnsignedTronTransaction = ({ | |
| }) | ||
| } | ||
|
|
||
| if (relayTransactionMetadata?.data) { | ||
| const to = relayTransactionMetadata.to | ||
| if (!to) throw new Error('Missing Relay transaction destination address') | ||
|
|
||
| const isNativeTron = sellAsset.assetId === tronAssetId | ||
| const value = isNativeTron ? step.sellAmountIncludingProtocolFeesCryptoBaseUnit : '0' | ||
|
|
||
| return adapter.buildCustomApiTx({ | ||
| from, | ||
| to, | ||
| accountNumber, | ||
| data: relayTransactionMetadata.data, | ||
| value, | ||
| }) | ||
| } | ||
|
Comment on lines
+49
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a custom error class for the new Relay guard. The new guard throws a generic As per coding guidelines: ALWAYS use custom error classes from 🤖 Prompt for AI Agents |
||
|
|
||
| const to = relayTransactionMetadata?.to ?? nearIntentsSpecific?.depositAddress | ||
| if (!to) throw new Error('Missing transaction destination address') | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the inline “DISABLED” comment block.
Repo guidelines disallow adding code comments unless explicitly requested. Please move this rationale to a ticket/PR description and keep the constants file comment-free.
🧹 Proposed cleanup
📝 Committable suggestion
🤖 Prompt for AI Agents