Skip to content

fix: fixes swap transactions showing up as bridge #30656

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

Merged
merged 6 commits into from
Mar 4, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
const modifiedTransactions = nonEvmTransactions.transactions.map((tx) => {
// The signature is in the id field for non-EVM transactions
const txSignature = tx.id;

Check failure on line 70 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Delete `····`
// If the transaction type is explicitly 'swap', never mark it as a bridge
if (tx.type === 'swap') {
return {
...tx,
// Explicitly set to false to ensure it's never marked as a bridge
isBridgeTx: false

Check failure on line 76 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Insert `,`
};
}

// Check if this transaction signature matches a bridge transaction
if (
Expand All @@ -76,21 +85,28 @@
) {
// @ts-expect-error WIP: Need to add index signature to bridgeTxSignatures
const matchingBridgeTx = bridgeTxSignatures[txSignature];

Check failure on line 88 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Delete `······`
// Get source and destination chain IDs
const srcChainId = matchingBridgeTx.quote?.srcChainId;
const destChainId = matchingBridgeTx.quote?.destChainId;

Check failure on line 92 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Delete `······`
// Only consider it a bridge if source and destination chains are different
const isBridgeTx = srcChainId && destChainId && srcChainId !== destChainId;

Check failure on line 94 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Insert `⏎·······`

// Return an enhanced version of the transaction with bridge info
return {
...tx,
// Change the type to bridge
type: 'bridge',
// Add bridge-specific flags
isBridgeTx: true,
// Change the type to bridge only if it's truly a bridge transaction
type: isBridgeTx ? 'bridge' : tx.type,
// Add bridge-specific flag based on chain comparison
isBridgeTx,
// Include destination chain details
bridgeInfo: {
bridgeInfo: isBridgeTx ? {

Check failure on line 104 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Insert `⏎·········`
destChainId: matchingBridgeTx.quote?.destChainId,

Check failure on line 105 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Insert `····`
destChainName: getNetworkName(matchingBridgeTx.quote?.destChainId),

Check failure on line 106 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Replace `destChainName:·getNetworkName(matchingBridgeTx.quote?.destChainId` with `····destChainName:·getNetworkName(⏎················matchingBridgeTx.quote?.destChainId,⏎··············`
destAsset: matchingBridgeTx.quote?.destAsset,

Check failure on line 107 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Insert `····`
destTokenAmount: matchingBridgeTx.quote?.destTokenAmount,

Check failure on line 108 in ui/hooks/bridge/useSolanaBridgeTransactionMapping.ts

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Insert `····`
},
} : undefined,
};
}

Expand Down
Loading