11/** @format */
2- ' use client' ;
2+ " use client" ;
33
4- import { TransactionsAndPaymentsTable } from ' @/components/transactions-and-payments-table' ;
5- import { Button } from ' @/components/ui/button' ;
4+ import { TransactionsAndPaymentsTable } from " @/components/transactions-and-payments-table" ;
5+ import { Button } from " @/components/ui/button" ;
66import {
77 Card ,
88 CardHeader ,
99 CardTitle ,
1010 CardContent ,
1111 CardFooter ,
12- } from ' @/components/ui/card' ;
13- import { Skeleton } from ' @/components/ui/skeleton' ;
14- import { fetchRequest } from ' @/lib/queries/channel' ;
15- import { fetchRequestPayments } from ' @/lib/queries/request-payments' ;
12+ } from " @/components/ui/card" ;
13+ import { Skeleton } from " @/components/ui/skeleton" ;
14+ import { fetchRequest } from " @/lib/queries/channel" ;
15+ import { fetchRequestPayments } from " @/lib/queries/request-payments" ;
1616import {
1717 calculateLongPaymentReference ,
1818 calculateShortPaymentReference ,
@@ -25,31 +25,39 @@ import {
2525 getPaymentDataFromCreateTransaction ,
2626 getTransactionCreateParameters ,
2727 renderAddress ,
28- } from '@/lib/utils' ;
29- import { ActorInfo } from '@requestnetwork/data-format' ;
30- import { useQuery } from '@tanstack/react-query' ;
31- import { Copy , File , Loader2 } from 'lucide-react' ;
32- import Link from 'next/link' ;
33- import { redirect } from 'next/navigation' ;
34- import TimeAgo from 'timeago-react' ;
35- import { JsonEditor } from 'json-edit-react' ;
36- import useExportPDF from '@/lib/hooks/use-export-pdf' ;
37- import { useState } from 'react' ;
28+ } from "@/lib/utils" ;
29+ import { ActorInfo } from "@requestnetwork/data-format" ;
30+ import { useQuery } from "@tanstack/react-query" ;
31+ import { Copy , File , Loader2 } from "lucide-react" ;
32+ import Link from "next/link" ;
33+ import { redirect } from "next/navigation" ;
34+ import TimeAgo from "timeago-react" ;
35+ import { JsonEditor } from "json-edit-react" ;
36+ import useExportPDF from "@/lib/hooks/use-export-pdf" ;
37+ import { useState } from "react" ;
38+ import { Channel } from "@/lib/types" ;
3839
3940interface RequestPageProps {
4041 params : {
4142 id : string ;
4243 } ;
4344}
4445
46+ const getGateway = ( request : Channel | null ) => {
47+ if ( request ?. source === "storage_sepolia" ) {
48+ return "sepolia.gateway.request.network" ;
49+ }
50+ return "gnosis.gateway.request.network" ;
51+ } ;
52+
4553const ActorInfoSection = ( { actorInfo } : { actorInfo ?: ActorInfo } ) => {
4654 if (
4755 ! actorInfo ||
4856 Object . keys ( actorInfo ) . every (
49- ( k ) => ! Object . keys ( ( actorInfo as any ) [ k ] ) . length ,
57+ ( k ) => ! Object . keys ( ( actorInfo as any ) [ k ] ) . length
5058 )
5159 ) {
52- return ' N/A' ;
60+ return " N/A" ;
5361 }
5462
5563 return (
@@ -113,7 +121,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
113121 const [ isDownloading , setIsDownloading ] = useState ( false ) ;
114122
115123 const { data : request , isLoading : isLoadingRequest } = useQuery ( {
116- queryKey : [ ' request' , id ] ,
124+ queryKey : [ " request" , id ] ,
117125 queryFn : ( ) => fetchRequest ( { id } ) ,
118126 ...commonQueryOptions ,
119127 } ) ;
@@ -122,19 +130,19 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
122130 ? calculateShortPaymentReference (
123131 id ,
124132 request ?. transactions [ 0 ] . dataObject . data . parameters . extensionsData [ 0 ]
125- . parameters . salt || '' ,
133+ . parameters . salt || "" ,
126134 request ?. transactions [ 0 ] . dataObject . data . parameters . extensionsData [ 0 ]
127- . parameters . paymentAddress || '' ,
135+ . parameters . paymentAddress || ""
128136 )
129- : '' ;
137+ : "" ;
130138
131139 const longPaymentReference = shortPaymentReference
132140 ? calculateLongPaymentReference ( shortPaymentReference )
133- : '' ;
141+ : "" ;
134142
135143 const { data : requestPayments , isLoading : isLoadingRequestPayments } =
136144 useQuery ( {
137- queryKey : [ ' request-payments' , longPaymentReference ] ,
145+ queryKey : [ " request-payments" , longPaymentReference ] ,
138146 queryFn : ( ) => fetchRequestPayments ( { reference : longPaymentReference } ) ,
139147 ...commonQueryOptions ,
140148 } ) ;
@@ -144,7 +152,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
144152 }
145153
146154 if ( ! request ) {
147- redirect ( ' /not-found' ) ;
155+ redirect ( " /not-found" ) ;
148156 }
149157
150158 const firstTransaction = request ?. transactions [ 0 ] ;
@@ -160,14 +168,14 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
160168 const balanceCurrency =
161169 paymentData ?. acceptedTokens ?. length > 0
162170 ? paymentData . acceptedTokens [ 0 ]
163- : '' ;
171+ : "" ;
164172
165173 const buyerData = contentData ?. buyerInfo ;
166174 const sellerData = contentData ?. sellerInfo ;
167175
168176 const status =
169177 balance >= BigInt ( createParameters . expectedAmount )
170- ? ' Paid'
178+ ? " Paid"
171179 : lastTransaction ?. dataObject ?. data ?. name ;
172180
173181 const modifiedTimestamp =
@@ -190,7 +198,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
190198 paymentData,
191199 } ) ;
192200 } catch ( error ) {
193- console . error ( ' Error exporting PDF:' , error ) ;
201+ console . error ( " Error exporting PDF:" , error ) ;
194202 } finally {
195203 setIsDownloading ( false ) ;
196204 }
@@ -240,6 +248,10 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
240248 < td className = "text-muted-foreground" > Status:</ td >
241249 < td className = "pl-16" > { status } </ td >
242250 </ tr >
251+ < tr >
252+ < td className = "text-muted-foreground" > Gateway:</ td >
253+ < td className = "pl-16" > { getGateway ( request ) } </ td >
254+ </ tr >
243255 < tr >
244256 < td className = "text-muted-foreground" > Payee:</ td >
245257 < td className = "pl-16" >
@@ -277,7 +289,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
277289 < td className = "pl-16" >
278290 { getAmountWithCurrencySymbol (
279291 BigInt ( createParameters . expectedAmount ) ,
280- createParameters . currency . value ,
292+ createParameters . currency . value
281293 ) }
282294 </ td >
283295 </ tr >
@@ -286,7 +298,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
286298 < td className = "pl-16" >
287299 { getAmountWithCurrencySymbol (
288300 BigInt ( balance ) ,
289- balanceCurrency || '' ,
301+ balanceCurrency || ""
290302 ) }
291303 </ td >
292304 </ tr >
@@ -296,7 +308,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
296308 < TimeAgo
297309 datetime = { firstTransaction . blockTimestamp * 1000 }
298310 locale = "en_short"
299- /> { ' ' }
311+ /> { " " }
300312 ({ formatTimestamp ( firstTransaction . blockTimestamp ) } )
301313 </ td >
302314 </ tr >
@@ -306,7 +318,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
306318 < TimeAgo
307319 datetime = { modifiedTimestamp * 1000 }
308320 locale = "en_short"
309- /> { ' ' }
321+ /> { " " }
310322 ({ formatTimestamp ( modifiedTimestamp ) } )
311323 </ td >
312324 </ tr >
@@ -319,7 +331,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) {
319331 < td className = "pl-16" >
320332 { paymentData ?. network
321333 ? capitalize ( paymentData ?. network )
322- : '' }
334+ : "" }
323335 </ td >
324336 </ tr >
325337 < tr >
0 commit comments