55 useGetRuntimeRoflAppsIdTransactions ,
66 useGetRuntimeRoflmarketInstances ,
77 type RoflAppPolicy ,
8+ RoflInstance ,
89} from '../../../nexus/api'
910import { useNetwork } from '../../../hooks/useNetwork'
1011import { isUrlSafe } from '../../../utils/url'
@@ -25,6 +26,8 @@ import { cn } from '@oasisprotocol/ui-library/src/lib/utils'
2526import { useAccount } from 'wagmi'
2627import { getEvmBech32Address } from '../../../utils/helpers'
2728import { useRoflAppDomains } from '../../../backend/useRoflAppDomains'
29+ import { fromMetadataToAgentMetadata } from '../../../utils/rofl-8004.ts'
30+ import { get8004ScanUrl } from '../../../constants/rofl-8004.ts'
2831
2932type AppMetadataProps = {
3033 id : string
@@ -33,6 +36,7 @@ type AppMetadataProps = {
3336 policy : RoflAppPolicy
3437 setViewMetadataState : ( state : ViewMetadataState ) => void
3538 editEnabled ?: boolean
39+ instancesWithERC8004Token : RoflInstance [ ]
3640}
3741
3842export const AppMetadata : FC < AppMetadataProps > = ( {
@@ -42,6 +46,7 @@ export const AppMetadata: FC<AppMetadataProps> = ({
4246 policy,
4347 setViewMetadataState,
4448 editEnabled,
49+ instancesWithERC8004Token,
4550} ) => {
4651 const network = useNetwork ( )
4752 const { data } = useGetRuntimeRoflAppsIdTransactions ( network , 'sapphire' , id , {
@@ -64,6 +69,11 @@ export const AppMetadata: FC<AppMetadataProps> = ({
6469
6570 const appDomains = useRoflAppDomains ( network , id )
6671
72+ const [ instance ] = instancesWithERC8004Token
73+ const agentMetadata = fromMetadataToAgentMetadata ( instance . metadata )
74+ const agentChainName = agentMetadata ?. chainName
75+ const agentTokenId = agentMetadata ?. agentId
76+
6777 return (
6878 < div className = "space-y-4" >
6979 { isMachineLoading && < Skeleton className = "w-full h-60px]" /> }
@@ -188,6 +198,18 @@ export const AppMetadata: FC<AppMetadataProps> = ({
188198 ) ) }
189199 </ div >
190200 </ DetailsSectionRow >
201+ { agentChainName && agentTokenId && (
202+ < DetailsSectionRow label = "ERC-8004 agent registration" >
203+ < a
204+ href = { get8004ScanUrl ( agentChainName , agentTokenId . toString ( ) ) }
205+ target = "_blank"
206+ rel = "noopener noreferrer"
207+ className = "text-primary"
208+ >
209+ { get8004ScanUrl ( agentChainName , agentTokenId . toString ( ) ) }
210+ </ a >
211+ </ DetailsSectionRow >
212+ ) }
191213 < div className = "text-xl font-bold" > Policy</ div >
192214 < DetailsSectionRow label = "Who can run this app" >
193215 < Endorsements endorsements = { policy . endorsements } />
0 commit comments