From d4173336fff581b10ba146756936a4d8a9b83ef9 Mon Sep 17 00:00:00 2001 From: lubej Date: Thu, 20 Nov 2025 15:27:46 +0100 Subject: [PATCH 01/34] Add ROFL-8004 constants --- src/constants/rofl-8004.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/constants/rofl-8004.ts diff --git a/src/constants/rofl-8004.ts b/src/constants/rofl-8004.ts new file mode 100644 index 00000000..0d7cc6f9 --- /dev/null +++ b/src/constants/rofl-8004.ts @@ -0,0 +1,14 @@ +import { sepolia } from 'viem/chains' +import { createPublicClient, http } from 'viem' + +export const ROFL_8004_SERVICE_NAME = 'rofl-8004' +export const ROFL_8004_SERVICE_ENV_PREFIX = 'ERC_8004' +export const ROFL_8004_SERVICE_RPC_URL_BASE = 'https://sepolia.infura.io/v3/' + +export const ROFL_8004_CHAIN = sepolia +export const ROFL_8004_PUBLIC_CLIENT = createPublicClient({ + chain: ROFL_8004_CHAIN, + transport: http(), +}) +export const ROFL_8004_AGENT_IDENTITY_CONTRACT = '0x8004a6090cd10a7288092483047b097295fb8847' +export const ROFL_8004_METADATA_KEY = 'net.oasis.app.erc8004_agent_id' // "{chainId}:{agentId}" From 5859ae2ec1f9d9f23f155dac31922443a5682681 Mon Sep 17 00:00:00 2001 From: lubej Date: Thu, 20 Nov 2025 15:28:06 +0100 Subject: [PATCH 02/34] Add ROFL-8004 utils --- src/utils/rofl-8004.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/utils/rofl-8004.ts diff --git a/src/utils/rofl-8004.ts b/src/utils/rofl-8004.ts new file mode 100644 index 00000000..81518fb3 --- /dev/null +++ b/src/utils/rofl-8004.ts @@ -0,0 +1,30 @@ +import { + ROFL_8004_CHAIN, + ROFL_8004_METADATA_KEY, + ROFL_8004_SERVICE_RPC_URL_BASE, +} from '../constants/rofl-8004.ts' +import { RoflInstance } from '../nexus/generated/api.ts' + +export const stripROFL8004RpcPrefix = (url: string | undefined): string => { + if (!url) return '' + return url.startsWith(ROFL_8004_SERVICE_RPC_URL_BASE) + ? url.slice(ROFL_8004_SERVICE_RPC_URL_BASE.length) + : url +} +export const addROFL8004RpcPrefix = (apiToken: string): string => { + if (!apiToken) return '' + return `${ROFL_8004_SERVICE_RPC_URL_BASE}${apiToken}` +} + +export const fromMetadataToAgentId = (metadata: RoflInstance['metadata']) => { + const agentId = metadata?.[ROFL_8004_METADATA_KEY] as string + const splitAgentId = agentId?.split(':') + const chainId = Number(splitAgentId[0]) + + if (chainId !== ROFL_8004_CHAIN.id) + throw new Error(`Invalid chainId: ${chainId}. Expected: ${ROFL_8004_CHAIN.id}`) + + return BigInt(splitAgentId[1]) +} + +export const tokenURIToLink = (tokenURI: string) => tokenURI.replace('ipfs://', 'https://ipfs.io/ipfs/') From c1a370a336220b8e396d540da7c840eeaad6a6a6 Mon Sep 17 00:00:00 2001 From: lubej Date: Thu, 20 Nov 2025 15:28:49 +0100 Subject: [PATCH 03/34] Add disabled prop to InputFormField textarea --- src/components/InputFormField/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/InputFormField/index.tsx b/src/components/InputFormField/index.tsx index a0485534..698c5966 100644 --- a/src/components/InputFormField/index.tsx +++ b/src/components/InputFormField/index.tsx @@ -78,7 +78,13 @@ export const InputFormField = ({ )} ) : ( -