Skip to content

Commit 039d7d4

Browse files
committed
ui fixes
1 parent 97438a0 commit 039d7d4

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

packages/backend/src/services/jupiter-swap-builder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ export async function buildSwapTransaction(
136136
// Default slippage: 50 bps (0.5%)
137137
const slippageBps = params.slippageBps || 50;
138138

139-
console.log('Getting Jupiter Ultra order...', {
139+
console.log('[JUPITER-SWAP] Getting Jupiter Ultra order...', {
140140
inputMint: params.inputMint,
141141
outputMint: params.outputMint,
142142
amount: params.amount,
143+
amountType: typeof params.amount,
143144
taker: params.sourceWallet,
144145
slippageBps,
145146
});

packages/backend/src/services/swap-transaction-queue-processor.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ export class SwapQueueProcessor {
257257
const txBuffer = Buffer.from(signedTransactionBase64, 'base64');
258258

259259
console.log('[SWAP-QUEUE] Submitting swap transaction to Solana...');
260+
console.log('[SWAP-QUEUE] Transaction buffer length:', txBuffer.length);
261+
console.log('[SWAP-QUEUE] First 32 bytes of buffer:', txBuffer.slice(0, 32).toString('hex'));
262+
263+
// Deserialize to inspect transaction
264+
try {
265+
const tx = VersionedTransaction.deserialize(txBuffer);
266+
console.log('[SWAP-QUEUE] Transaction signatures count:', tx.signatures.length);
267+
console.log('[SWAP-QUEUE] First signature:', tx.signatures[0] ? Buffer.from(tx.signatures[0]).toString('base64') : 'none');
268+
} catch (deserializeError) {
269+
console.error('[SWAP-QUEUE] Failed to deserialize transaction for inspection:', deserializeError);
270+
}
260271

261272
// Send with retry and skipPreflight
262273
const signature = await this.connection.sendRawTransaction(txBuffer, {
@@ -266,11 +277,20 @@ export class SwapQueueProcessor {
266277
});
267278

268279
console.log('[SWAP-QUEUE] ✅ Swap transaction submitted with signature:', signature);
280+
console.log('[SWAP-QUEUE] Signature type:', typeof signature);
281+
console.log('[SWAP-QUEUE] Signature length:', signature.length);
282+
283+
// Validate signature is not a dummy/placeholder
284+
if (signature === '1111111111111111111111111111111111111111111111111111111111111111' ||
285+
signature.length < 64) {
286+
console.error('[SWAP-QUEUE] ❌ Invalid signature received:', signature);
287+
throw new Error('Invalid transaction signature received from Solana');
288+
}
269289

270290
return signature;
271291
} catch (error) {
272292
console.error('[SWAP-QUEUE] Error submitting swap transaction:', error);
273-
return null;
293+
throw error; // Re-throw to trigger retry logic
274294
}
275295
}
276296

packages/frontend/src/components/BridgeUINew.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,13 @@ export function BridgeUINew() {
206206
}
207207
}
208208

209-
// Check if user has enough balance to cover receive amount + fee
210-
if (feeInfo.totalNeeded > userBalance) {
209+
// Check if user has enough balance to cover amount + fee
210+
// Convert balance to USDC value for comparison
211+
const userBalanceInUsdc = sourceToken.symbol !== 'USDC' && sourcePriceInUsdc
212+
? userBalance * sourcePriceInUsdc
213+
: userBalance;
214+
215+
if (feeInfo.totalNeeded > userBalanceInUsdc) {
211216
return {
212217
isValid: false,
213218
error: `You must have $${feeInfo.fee.toFixed(2)} spare USDC to pay for the rail ticket fee.`
@@ -690,6 +695,7 @@ export function BridgeUINew() {
690695
selectedToken={destToken}
691696
onTokenChange={setDestToken}
692697
sourceAmount={sourceAmount}
698+
sourceTokenSymbol={sourceToken.symbol}
693699
/>
694700
)}
695701
</div>

packages/frontend/src/components/ToTokenSelector.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ interface ToTokenSelectorProps {
2929
selectedToken: ToTokenOption;
3030
onTokenChange: (token: ToTokenOption) => void;
3131
sourceAmount?: string;
32+
sourceTokenSymbol?: string;
3233
}
3334

3435
export function ToTokenSelector({
3536
chain,
3637
selectedToken,
3738
onTokenChange,
3839
sourceAmount,
40+
sourceTokenSymbol = 'USDC',
3941
}: ToTokenSelectorProps) {
4042
const tokens = chain === 'solana' ? SOLANA_TOKENS : EVM_TOKENS;
4143

@@ -56,8 +58,8 @@ export function ToTokenSelector({
5658
{/* Spacer */}
5759
<div className="flex-1" />
5860

59-
{/* "USDC worth of:" text aligned to right */}
60-
<span className="text-sm text-slate-400 whitespace-nowrap">USDC worth of</span>
61+
{/* Dynamic "X worth of:" text aligned to right */}
62+
<span className="text-sm text-slate-400 whitespace-nowrap">{sourceTokenSymbol} worth of</span>
6163

6264
{/* Token Selector with Icon */}
6365
<Popover.Root>

0 commit comments

Comments
 (0)