Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,19 @@ edb
*.spec.js
*.spec.mjs
*.spec.mts
*.bench.ts
*.bench.tsx
*.bench.js
*.bench.mjs
*.bench.mts
/tmp
video/out
.superpowers
/docs
@docs
@docs

# Local scratch, tool caches, and nested repos (not part of the app source)
tasks/
.codegraph/
.vercel/
starknet-sim/
87 changes: 42 additions & 45 deletions src/components/ExecutionStackTrace.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import "../styles/ExecutionStackTrace.css";
import "../styles/asset-rows.css";
import TokenMovementsPanel from "./TokenMovementsPanel";
import { CopyButton } from "./ui/copy-button";
import { Button } from "./ui/button";
Expand All @@ -11,7 +12,10 @@ import {
AccordionItem,
AccordionTrigger,
} from "./ui/accordion";
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from "./ui/table";
import { formatDisplayAmount } from "./simulation-results/formatters";
// Anchored asset-change rows share the .tm-* classes defined in TokenMovementsPanel.css
// (always bundled — this module imports TokenMovementsPanel below).
Comment on lines +16 to +17
import { ArrowCircleUpRight, ArrowCircleDownLeft } from "@phosphor-icons/react";
import { extractTokenMovements } from "../utils/tokenMovements";

// Re-export types for backward compatibility
Expand Down Expand Up @@ -218,51 +222,44 @@ const ExecutionStackTrace: React.FC<StackTraceProps> = (props) => {
<span className="exec-accordion-count">{orderedAssetChanges.rows.length}</span>
</AccordionTrigger>
<AccordionContent>
<Table className="sim-balance-changes__table">
<TableHeader>
<TableRow>
<TableHead>Address</TableHead>
<TableHead>Asset</TableHead>
<TableHead className="text-right">Delta Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{orderedAssetChanges.rows.map((change: any, idx: number) => {
const direction = normalizeAssetDirection(change);
const isPositive = direction === "in";
const isNegative = direction === "out";
const amountClass = isPositive
? "sim-amount--positive"
: isNegative
? "sim-amount--negative"
: "";
const showIncomingDivider =
idx === orderedAssetChanges.outgoingCount &&
orderedAssetChanges.outgoingCount > 0 &&
orderedAssetChanges.incomingCount > 0;
return (
<React.Fragment key={idx}>
{showIncomingDivider && (
<TableRow className="sim-balance-changes__group-divider" aria-hidden="true">
<TableCell colSpan={3} />
</TableRow>
)}
<TableRow>
<TableCell className="sim-address">
<div className="tm-list" role="list" aria-label="Native token balance changes">
{orderedAssetChanges.rows.map((change: any, idx: number) => {
const direction = normalizeAssetDirection(change);
const isPositive = direction === "in";
const isNegative = direction === "out";
const dirClass = isNegative ? "tm-out" : isPositive ? "tm-in" : "tm-neutral";
const showIncomingDivider =
idx === orderedAssetChanges.outgoingCount &&
orderedAssetChanges.outgoingCount > 0 &&
orderedAssetChanges.incomingCount > 0;
const f = formatDisplayAmount(change.amount || change.rawAmount);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the sign for raw native amounts

When a server-provided asset change has direction: "out" plus only an unsigned rawAmount/value and no formatted amount (a shape normalized by utils/edbTraceConverter.ts), this passes the unsigned raw value directly to formatDisplayAmount. That formatter treats unsigned input as positive, so the outgoing native-token row renders with a red/outgoing indicator but a +... amount; prefix the raw fallback based on direction or format it before calling the display formatter.

Useful? React with 👍 / 👎.

return (
<React.Fragment key={idx}>
{showIncomingDivider && <div className="tm-divider" aria-hidden="true" />}
<div className={`tm-row ${dirClass}`} role="listitem">
<div className="tm-left">
<span className="sr-only">{isNegative ? "Outgoing" : isPositive ? "Incoming" : "Change"}</span>
{isNegative ? (
<ArrowCircleUpRight weight="fill" size={22} className="tm-dir" aria-hidden="true" />
) : isPositive ? (
<ArrowCircleDownLeft weight="fill" size={22} className="tm-dir" aria-hidden="true" />
) : null}
<span className="tm-addr">
{change.address ? `${change.address.slice(0, 10)}\u2026${change.address.slice(-8)}` : "\u2014"}
</TableCell>
<TableCell>
{change.symbol || "Unknown"}
</TableCell>
<TableCell className={`text-right ${amountClass}`}>
{change.amount || change.rawAmount || "0"}
</TableCell>
</TableRow>
</React.Fragment>
);
})}
</TableBody>
</Table>
</span>
<span className="tm-asset">
<span className="tm-asset-logo tm-asset-logo--fallback" aria-hidden="true">\u25cf</span>
<span className="token-symbol">{change.symbol || "Unknown"}</span>
</span>
</div>
<div className="tm-right">
<span className="tm-delta" title={f.full || undefined}>{f.display}</span>
</div>
</div>
</React.Fragment>
);
})}
</div>
</AccordionContent>
</AccordionItem>
)}
Expand Down
Loading