11import { ChevronDownIcon , ChevronUpIcon } from "lucide-react" ;
2- import { formatEther } from "viem" ;
2+ import { formatEther , stringify } from "viem" ;
33import { Row , flexRender } from "@tanstack/react-table" ;
4+ import { CopyButton } from "../../../../../../components/CopyButton" ;
45import { Separator } from "../../../../../../components/ui/Separator" ;
56import { Skeleton } from "../../../../../../components/ui/Skeleton" ;
67import { TableCell , TableRow } from "../../../../../../components/ui/Table" ;
@@ -85,22 +86,20 @@ export function TransactionTableRow({ row }: { row: Row<ObservedTransaction> })
8586 < div className = "flex items-start gap-x-4" >
8687 < h3 className = "w-[45px] flex-shrink-0 text-2xs font-bold uppercase" > Inputs</ h3 >
8788
88- < div className = "flex w-full flex-col gap-y-4" >
89+ < div className = "relative flex w-full flex-col gap-y-4" >
8990 { calls . map ( ( call , idx ) => {
9091 if ( ! call . args || call . args . length === 0 ) {
9192 return null ;
9293 }
9394
9495 return (
95- < div key = { idx } className = "min-w-0 flex-grow border border-white/20 p-2 pt-1" >
96+ < div key = { idx } className = "min-w-0 flex-grow rounded border border-white/20 p-2 pt-1" >
9697 < span className = "text-xs" > { call . functionName } :</ span >
9798 { call . args ?. map ( ( arg , argIdx ) => (
9899 < div key = { argIdx } className = "flex" >
99100 < span className = "flex-shrink-0 text-xs text-white/60" > arg { argIdx + 1 } :</ span >
100101 < span className = "ml-2 break-all text-xs" >
101- { typeof arg === "object" && arg !== null
102- ? JSON . stringify ( arg , null , 2 )
103- : String ( arg ) }
102+ { typeof arg === "object" && arg !== null ? stringify ( arg , null , 2 ) : String ( arg ) }
104103 </ span >
105104 </ div >
106105 ) ) }
@@ -111,6 +110,8 @@ export function TransactionTableRow({ row }: { row: Row<ObservedTransaction> })
111110 </ div >
112111 ) ;
113112 } ) }
113+
114+ < CopyButton value = { stringify ( data . calls , null , 2 ) } className = "absolute right-1.5 top-1.5" />
114115 </ div >
115116 </ div >
116117 </ >
@@ -121,7 +122,7 @@ export function TransactionTableRow({ row }: { row: Row<ObservedTransaction> })
121122 < Separator className = "my-5" />
122123 < div className = "flex items-start gap-x-4" >
123124 < h3 className = "w-[45px] flex-shrink-0 text-2xs font-bold uppercase" > Error</ h3 >
124- < div className = "flex-grow whitespace-pre-wrap border border-red-500 p-2 font-mono text-xs" >
125+ < div className = "flex-grow whitespace-pre-wrap rounded border border-red-500 p-2 font-mono text-xs" >
125126 { data . error . message }
126127 </ div >
127128 </ div >
@@ -134,7 +135,7 @@ export function TransactionTableRow({ row }: { row: Row<ObservedTransaction> })
134135 < div className = "flex items-start gap-x-4" >
135136 < h3 className = "inline-block w-[45px] flex-shrink-0 text-2xs font-bold uppercase" > Logs</ h3 >
136137 { Array . isArray ( logs ) && logs . length > 0 ? (
137- < div className = "flex-grow break-all border border-white/20 p-2 pb-3" >
138+ < div className = "relative flex-grow break-all rounded border border-white/20 p-2 pb-3" >
138139 < ul >
139140 { logs . map ( ( log , idx ) => {
140141 const eventName = "eventName" in log ? log . eventName : null ;
@@ -157,6 +158,8 @@ export function TransactionTableRow({ row }: { row: Row<ObservedTransaction> })
157158 ) ;
158159 } ) }
159160 </ ul >
161+
162+ < CopyButton value = { stringify ( logs , null , 2 ) } className = "absolute right-1.5 top-1.5" />
160163 </ div >
161164 ) : status === "pending" ? (
162165 < Skeleton className = "h-4 w-full" />
0 commit comments