uvd-x402-sdk 2.18.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1037,7 +1037,7 @@ declare function escrowTimeRemaining(escrow: EscrowPayment): number;
1037
1037
  */
1038
1038
  declare const ERC8004_EXTENSION_ID = "8004-reputation";
1039
1039
  /**
1040
- * ERC-8004 contract addresses per network
1040
+ * ERC-8004 contract addresses per network (12 networks)
1041
1041
  */
1042
1042
  declare const ERC8004_CONTRACTS: Record<string, {
1043
1043
  identityRegistry?: string;
@@ -1047,7 +1047,10 @@ declare const ERC8004_CONTRACTS: Record<string, {
1047
1047
  /**
1048
1048
  * Network type for ERC-8004 operations
1049
1049
  */
1050
- type Erc8004Network = 'ethereum' | 'ethereum-sepolia' | 'base-mainnet';
1050
+ /**
1051
+ * Network type for ERC-8004 operations (12 networks)
1052
+ */
1053
+ type Erc8004Network = 'ethereum' | 'base-mainnet' | 'polygon' | 'arbitrum' | 'celo' | 'bsc' | 'monad' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'celo-sepolia';
1051
1054
  /**
1052
1055
  * Proof of payment returned when settling with ERC-8004 extension
1053
1056
  */
@@ -1223,6 +1226,73 @@ interface ReputationResponse {
1223
1226
  feedback?: FeedbackEntry[];
1224
1227
  network: Erc8004Network;
1225
1228
  }
1229
+ /**
1230
+ * Key-value metadata entry for agent registration
1231
+ */
1232
+ interface MetadataEntryParam {
1233
+ /** Metadata key */
1234
+ key: string;
1235
+ /** Metadata value (hex-encoded bytes or UTF-8 string) */
1236
+ value: string;
1237
+ }
1238
+ /**
1239
+ * Request body for POST /register
1240
+ */
1241
+ interface RegisterAgentRequest {
1242
+ /** x402 protocol version */
1243
+ x402Version: 1 | 2;
1244
+ /** Network where agent will be registered */
1245
+ network: Erc8004Network;
1246
+ /** URI pointing to agent registration file (IPFS, HTTPS) */
1247
+ agentUri: string;
1248
+ /** Optional metadata key-value pairs */
1249
+ metadata?: MetadataEntryParam[];
1250
+ /** Optional recipient address - NFT is transferred to this address after minting */
1251
+ recipient?: string;
1252
+ }
1253
+ /**
1254
+ * Response from POST /register
1255
+ */
1256
+ interface RegisterAgentResponse {
1257
+ /** Whether registration succeeded */
1258
+ success: boolean;
1259
+ /** The newly assigned agent ID (ERC-721 tokenId) */
1260
+ agentId?: number;
1261
+ /** Registration transaction hash */
1262
+ transaction?: string;
1263
+ /** Transfer transaction hash (if recipient was specified) */
1264
+ transferTransaction?: string;
1265
+ /** Owner address of the agent NFT */
1266
+ owner?: string;
1267
+ /** Error message if failed */
1268
+ error?: string;
1269
+ /** Network where agent was registered */
1270
+ network: string;
1271
+ }
1272
+ /**
1273
+ * Response from GET /identity/{network}/{agent_id}/metadata/{key}
1274
+ */
1275
+ interface IdentityMetadataResponse {
1276
+ /** Agent ID */
1277
+ agentId: number;
1278
+ /** Metadata key */
1279
+ key: string;
1280
+ /** Raw hex-encoded value */
1281
+ valueHex: string;
1282
+ /** UTF-8 decoded value (if decodable) */
1283
+ valueUtf8?: string;
1284
+ /** Network */
1285
+ network: string;
1286
+ }
1287
+ /**
1288
+ * Response from GET /identity/{network}/total-supply
1289
+ */
1290
+ interface IdentityTotalSupplyResponse {
1291
+ /** Total number of registered agents */
1292
+ totalSupply: number;
1293
+ /** Network */
1294
+ network: string;
1295
+ }
1226
1296
  /**
1227
1297
  * Options for the ERC8004Client
1228
1298
  */
@@ -1236,7 +1306,9 @@ interface Erc8004ClientOptions {
1236
1306
  * Client for ERC-8004 Trustless Agents API
1237
1307
  *
1238
1308
  * Provides methods for:
1239
- * - Querying agent identity
1309
+ * - Registering new agents (gasless, facilitator pays gas)
1310
+ * - Registering agents on behalf of users (gasless delegation)
1311
+ * - Querying agent identity, metadata, and total supply
1240
1312
  * - Querying agent reputation
1241
1313
  * - Submitting reputation feedback
1242
1314
  * - Revoking feedback
@@ -1391,6 +1463,58 @@ declare class Erc8004Client {
1391
1463
  * ```
1392
1464
  */
1393
1465
  appendResponse(network: Erc8004Network, agentId: number, feedbackIndex: number, response: string, responseUri?: string): Promise<FeedbackResponse>;
1466
+ /**
1467
+ * Register a new agent on the Identity Registry
1468
+ *
1469
+ * The facilitator pays gas fees. Optionally transfer the NFT to a
1470
+ * recipient address (gasless delegation).
1471
+ *
1472
+ * @param request - Registration request
1473
+ * @returns Registration response with agent ID and transaction hash
1474
+ *
1475
+ * @example
1476
+ * ```ts
1477
+ * // Register agent owned by facilitator
1478
+ * const result = await client.registerAgent({
1479
+ * x402Version: 1,
1480
+ * network: 'ethereum',
1481
+ * agentUri: 'ipfs://QmYourAgentFile',
1482
+ * });
1483
+ * console.log(`Agent #${result.agentId} registered`);
1484
+ *
1485
+ * // Register agent and transfer to user
1486
+ * const result = await client.registerAgent({
1487
+ * x402Version: 1,
1488
+ * network: 'ethereum',
1489
+ * agentUri: 'ipfs://QmYourAgentFile',
1490
+ * recipient: '0xUserAddress...',
1491
+ * });
1492
+ * console.log(`Agent #${result.agentId} transferred to user`);
1493
+ * ```
1494
+ */
1495
+ registerAgent(request: RegisterAgentRequest): Promise<RegisterAgentResponse>;
1496
+ /**
1497
+ * Get registration endpoint metadata
1498
+ *
1499
+ * @returns Endpoint information for POST /register
1500
+ */
1501
+ getRegisterInfo(): Promise<Record<string, unknown>>;
1502
+ /**
1503
+ * Get a specific metadata entry for an agent
1504
+ *
1505
+ * @param network - Network where agent is registered
1506
+ * @param agentId - Agent's tokenId
1507
+ * @param key - Metadata key to retrieve
1508
+ * @returns Metadata value (hex-encoded and UTF-8 decoded if possible)
1509
+ */
1510
+ getIdentityMetadata(network: Erc8004Network, agentId: number, key: string): Promise<IdentityMetadataResponse>;
1511
+ /**
1512
+ * Get total number of registered agents on a network
1513
+ *
1514
+ * @param network - Network to query
1515
+ * @returns Total supply count
1516
+ */
1517
+ getIdentityTotalSupply(network: Erc8004Network): Promise<IdentityTotalSupplyResponse>;
1394
1518
  }
1395
1519
  /**
1396
1520
  * Build payment requirements with ERC-8004 extension
@@ -1636,4 +1760,4 @@ declare class AdvancedEscrowClient {
1636
1760
  refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
1637
1761
  }
1638
1762
 
1639
- export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, OPERATOR_ABI, PAYMENT_INFO_TYPEHASH, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, isEscrowExpired, parsePaymentHeader };
1763
+ export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, PAYMENT_INFO_TYPEHASH, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, isEscrowExpired, parsePaymentHeader };
@@ -1037,7 +1037,7 @@ declare function escrowTimeRemaining(escrow: EscrowPayment): number;
1037
1037
  */
1038
1038
  declare const ERC8004_EXTENSION_ID = "8004-reputation";
1039
1039
  /**
1040
- * ERC-8004 contract addresses per network
1040
+ * ERC-8004 contract addresses per network (12 networks)
1041
1041
  */
1042
1042
  declare const ERC8004_CONTRACTS: Record<string, {
1043
1043
  identityRegistry?: string;
@@ -1047,7 +1047,10 @@ declare const ERC8004_CONTRACTS: Record<string, {
1047
1047
  /**
1048
1048
  * Network type for ERC-8004 operations
1049
1049
  */
1050
- type Erc8004Network = 'ethereum' | 'ethereum-sepolia' | 'base-mainnet';
1050
+ /**
1051
+ * Network type for ERC-8004 operations (12 networks)
1052
+ */
1053
+ type Erc8004Network = 'ethereum' | 'base-mainnet' | 'polygon' | 'arbitrum' | 'celo' | 'bsc' | 'monad' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'celo-sepolia';
1051
1054
  /**
1052
1055
  * Proof of payment returned when settling with ERC-8004 extension
1053
1056
  */
@@ -1223,6 +1226,73 @@ interface ReputationResponse {
1223
1226
  feedback?: FeedbackEntry[];
1224
1227
  network: Erc8004Network;
1225
1228
  }
1229
+ /**
1230
+ * Key-value metadata entry for agent registration
1231
+ */
1232
+ interface MetadataEntryParam {
1233
+ /** Metadata key */
1234
+ key: string;
1235
+ /** Metadata value (hex-encoded bytes or UTF-8 string) */
1236
+ value: string;
1237
+ }
1238
+ /**
1239
+ * Request body for POST /register
1240
+ */
1241
+ interface RegisterAgentRequest {
1242
+ /** x402 protocol version */
1243
+ x402Version: 1 | 2;
1244
+ /** Network where agent will be registered */
1245
+ network: Erc8004Network;
1246
+ /** URI pointing to agent registration file (IPFS, HTTPS) */
1247
+ agentUri: string;
1248
+ /** Optional metadata key-value pairs */
1249
+ metadata?: MetadataEntryParam[];
1250
+ /** Optional recipient address - NFT is transferred to this address after minting */
1251
+ recipient?: string;
1252
+ }
1253
+ /**
1254
+ * Response from POST /register
1255
+ */
1256
+ interface RegisterAgentResponse {
1257
+ /** Whether registration succeeded */
1258
+ success: boolean;
1259
+ /** The newly assigned agent ID (ERC-721 tokenId) */
1260
+ agentId?: number;
1261
+ /** Registration transaction hash */
1262
+ transaction?: string;
1263
+ /** Transfer transaction hash (if recipient was specified) */
1264
+ transferTransaction?: string;
1265
+ /** Owner address of the agent NFT */
1266
+ owner?: string;
1267
+ /** Error message if failed */
1268
+ error?: string;
1269
+ /** Network where agent was registered */
1270
+ network: string;
1271
+ }
1272
+ /**
1273
+ * Response from GET /identity/{network}/{agent_id}/metadata/{key}
1274
+ */
1275
+ interface IdentityMetadataResponse {
1276
+ /** Agent ID */
1277
+ agentId: number;
1278
+ /** Metadata key */
1279
+ key: string;
1280
+ /** Raw hex-encoded value */
1281
+ valueHex: string;
1282
+ /** UTF-8 decoded value (if decodable) */
1283
+ valueUtf8?: string;
1284
+ /** Network */
1285
+ network: string;
1286
+ }
1287
+ /**
1288
+ * Response from GET /identity/{network}/total-supply
1289
+ */
1290
+ interface IdentityTotalSupplyResponse {
1291
+ /** Total number of registered agents */
1292
+ totalSupply: number;
1293
+ /** Network */
1294
+ network: string;
1295
+ }
1226
1296
  /**
1227
1297
  * Options for the ERC8004Client
1228
1298
  */
@@ -1236,7 +1306,9 @@ interface Erc8004ClientOptions {
1236
1306
  * Client for ERC-8004 Trustless Agents API
1237
1307
  *
1238
1308
  * Provides methods for:
1239
- * - Querying agent identity
1309
+ * - Registering new agents (gasless, facilitator pays gas)
1310
+ * - Registering agents on behalf of users (gasless delegation)
1311
+ * - Querying agent identity, metadata, and total supply
1240
1312
  * - Querying agent reputation
1241
1313
  * - Submitting reputation feedback
1242
1314
  * - Revoking feedback
@@ -1391,6 +1463,58 @@ declare class Erc8004Client {
1391
1463
  * ```
1392
1464
  */
1393
1465
  appendResponse(network: Erc8004Network, agentId: number, feedbackIndex: number, response: string, responseUri?: string): Promise<FeedbackResponse>;
1466
+ /**
1467
+ * Register a new agent on the Identity Registry
1468
+ *
1469
+ * The facilitator pays gas fees. Optionally transfer the NFT to a
1470
+ * recipient address (gasless delegation).
1471
+ *
1472
+ * @param request - Registration request
1473
+ * @returns Registration response with agent ID and transaction hash
1474
+ *
1475
+ * @example
1476
+ * ```ts
1477
+ * // Register agent owned by facilitator
1478
+ * const result = await client.registerAgent({
1479
+ * x402Version: 1,
1480
+ * network: 'ethereum',
1481
+ * agentUri: 'ipfs://QmYourAgentFile',
1482
+ * });
1483
+ * console.log(`Agent #${result.agentId} registered`);
1484
+ *
1485
+ * // Register agent and transfer to user
1486
+ * const result = await client.registerAgent({
1487
+ * x402Version: 1,
1488
+ * network: 'ethereum',
1489
+ * agentUri: 'ipfs://QmYourAgentFile',
1490
+ * recipient: '0xUserAddress...',
1491
+ * });
1492
+ * console.log(`Agent #${result.agentId} transferred to user`);
1493
+ * ```
1494
+ */
1495
+ registerAgent(request: RegisterAgentRequest): Promise<RegisterAgentResponse>;
1496
+ /**
1497
+ * Get registration endpoint metadata
1498
+ *
1499
+ * @returns Endpoint information for POST /register
1500
+ */
1501
+ getRegisterInfo(): Promise<Record<string, unknown>>;
1502
+ /**
1503
+ * Get a specific metadata entry for an agent
1504
+ *
1505
+ * @param network - Network where agent is registered
1506
+ * @param agentId - Agent's tokenId
1507
+ * @param key - Metadata key to retrieve
1508
+ * @returns Metadata value (hex-encoded and UTF-8 decoded if possible)
1509
+ */
1510
+ getIdentityMetadata(network: Erc8004Network, agentId: number, key: string): Promise<IdentityMetadataResponse>;
1511
+ /**
1512
+ * Get total number of registered agents on a network
1513
+ *
1514
+ * @param network - Network to query
1515
+ * @returns Total supply count
1516
+ */
1517
+ getIdentityTotalSupply(network: Erc8004Network): Promise<IdentityTotalSupplyResponse>;
1394
1518
  }
1395
1519
  /**
1396
1520
  * Build payment requirements with ERC-8004 extension
@@ -1636,4 +1760,4 @@ declare class AdvancedEscrowClient {
1636
1760
  refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
1637
1761
  }
1638
1762
 
1639
- export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, OPERATOR_ABI, PAYMENT_INFO_TYPEHASH, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, isEscrowExpired, parsePaymentHeader };
1763
+ export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, BASE_MAINNET_CONTRACTS, type BazaarCategory, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarNetwork, type BazaarRegisterOptions, type BazaarResource, type BazaarToken, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, PAYMENT_INFO_TYPEHASH, type PaymentRequirements, type PaymentRequirementsOptions, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type SettleRequest, type SettleResponse, type SettleResponseWithProof, TIER_TIMINGS, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, isEscrowExpired, parsePaymentHeader };
@@ -1908,20 +1908,66 @@ function escrowTimeRemaining(escrow) {
1908
1908
  return new Date(escrow.expiresAt).getTime() - Date.now();
1909
1909
  }
1910
1910
  var ERC8004_EXTENSION_ID = "8004-reputation";
1911
+ var MAINNET_IDENTITY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
1912
+ var MAINNET_REPUTATION = "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
1913
+ var TESTNET_IDENTITY = "0x8004A818BFB912233c491871b3d84c89A494BD9e";
1914
+ var TESTNET_REPUTATION = "0x8004B663056A597Dffe9eCcC1965A193B7388713";
1915
+ var TESTNET_VALIDATION = "0x8004Cb1BF31DAf7788923b405b754f57acEB4272";
1911
1916
  var ERC8004_CONTRACTS = {
1917
+ // Mainnets (7)
1912
1918
  ethereum: {
1913
- identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
1914
- reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63"
1919
+ identityRegistry: MAINNET_IDENTITY,
1920
+ reputationRegistry: MAINNET_REPUTATION
1915
1921
  },
1922
+ "base-mainnet": {
1923
+ identityRegistry: MAINNET_IDENTITY,
1924
+ reputationRegistry: MAINNET_REPUTATION
1925
+ },
1926
+ polygon: {
1927
+ identityRegistry: MAINNET_IDENTITY,
1928
+ reputationRegistry: MAINNET_REPUTATION
1929
+ },
1930
+ arbitrum: {
1931
+ identityRegistry: MAINNET_IDENTITY,
1932
+ reputationRegistry: MAINNET_REPUTATION
1933
+ },
1934
+ celo: {
1935
+ identityRegistry: MAINNET_IDENTITY,
1936
+ reputationRegistry: MAINNET_REPUTATION
1937
+ },
1938
+ bsc: {
1939
+ identityRegistry: MAINNET_IDENTITY,
1940
+ reputationRegistry: MAINNET_REPUTATION
1941
+ },
1942
+ monad: {
1943
+ identityRegistry: MAINNET_IDENTITY,
1944
+ reputationRegistry: MAINNET_REPUTATION
1945
+ },
1946
+ // Testnets (5)
1916
1947
  "ethereum-sepolia": {
1917
- identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e",
1918
- reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713",
1919
- validationRegistry: "0x8004Cb1BF31DAf7788923b405b754f57acEB4272"
1948
+ identityRegistry: TESTNET_IDENTITY,
1949
+ reputationRegistry: TESTNET_REPUTATION,
1950
+ validationRegistry: TESTNET_VALIDATION
1920
1951
  },
1921
- // Base Mainnet - Same addresses as Ethereum (CREATE2 deterministic deployment)
1922
- "base-mainnet": {
1923
- identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
1924
- reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63"
1952
+ "base-sepolia": {
1953
+ identityRegistry: TESTNET_IDENTITY,
1954
+ reputationRegistry: TESTNET_REPUTATION,
1955
+ validationRegistry: TESTNET_VALIDATION
1956
+ },
1957
+ "polygon-amoy": {
1958
+ identityRegistry: TESTNET_IDENTITY,
1959
+ reputationRegistry: TESTNET_REPUTATION,
1960
+ validationRegistry: TESTNET_VALIDATION
1961
+ },
1962
+ "arbitrum-sepolia": {
1963
+ identityRegistry: TESTNET_IDENTITY,
1964
+ reputationRegistry: TESTNET_REPUTATION,
1965
+ validationRegistry: TESTNET_VALIDATION
1966
+ },
1967
+ "celo-sepolia": {
1968
+ identityRegistry: TESTNET_IDENTITY,
1969
+ reputationRegistry: TESTNET_REPUTATION,
1970
+ validationRegistry: TESTNET_VALIDATION
1925
1971
  }
1926
1972
  };
1927
1973
  var Erc8004Client = class {
@@ -2241,6 +2287,150 @@ var Erc8004Client = class {
2241
2287
  };
2242
2288
  }
2243
2289
  }
2290
+ /**
2291
+ * Register a new agent on the Identity Registry
2292
+ *
2293
+ * The facilitator pays gas fees. Optionally transfer the NFT to a
2294
+ * recipient address (gasless delegation).
2295
+ *
2296
+ * @param request - Registration request
2297
+ * @returns Registration response with agent ID and transaction hash
2298
+ *
2299
+ * @example
2300
+ * ```ts
2301
+ * // Register agent owned by facilitator
2302
+ * const result = await client.registerAgent({
2303
+ * x402Version: 1,
2304
+ * network: 'ethereum',
2305
+ * agentUri: 'ipfs://QmYourAgentFile',
2306
+ * });
2307
+ * console.log(`Agent #${result.agentId} registered`);
2308
+ *
2309
+ * // Register agent and transfer to user
2310
+ * const result = await client.registerAgent({
2311
+ * x402Version: 1,
2312
+ * network: 'ethereum',
2313
+ * agentUri: 'ipfs://QmYourAgentFile',
2314
+ * recipient: '0xUserAddress...',
2315
+ * });
2316
+ * console.log(`Agent #${result.agentId} transferred to user`);
2317
+ * ```
2318
+ */
2319
+ async registerAgent(request) {
2320
+ const url = `${this.baseUrl}/register`;
2321
+ const controller = new AbortController();
2322
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
2323
+ try {
2324
+ const response = await fetch(url, {
2325
+ method: "POST",
2326
+ headers: {
2327
+ "Content-Type": "application/json",
2328
+ "Accept": "application/json"
2329
+ },
2330
+ body: JSON.stringify(request),
2331
+ signal: controller.signal
2332
+ });
2333
+ clearTimeout(timeoutId);
2334
+ if (!response.ok) {
2335
+ const errorText = await response.text();
2336
+ return {
2337
+ success: false,
2338
+ error: `Facilitator error: ${response.status} - ${errorText}`,
2339
+ network: request.network
2340
+ };
2341
+ }
2342
+ return await response.json();
2343
+ } catch (error) {
2344
+ clearTimeout(timeoutId);
2345
+ return {
2346
+ success: false,
2347
+ error: error instanceof Error ? error.message : "Unknown error",
2348
+ network: request.network
2349
+ };
2350
+ }
2351
+ }
2352
+ /**
2353
+ * Get registration endpoint metadata
2354
+ *
2355
+ * @returns Endpoint information for POST /register
2356
+ */
2357
+ async getRegisterInfo() {
2358
+ const url = `${this.baseUrl}/register`;
2359
+ const controller = new AbortController();
2360
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
2361
+ try {
2362
+ const response = await fetch(url, {
2363
+ method: "GET",
2364
+ headers: { "Accept": "application/json" },
2365
+ signal: controller.signal
2366
+ });
2367
+ clearTimeout(timeoutId);
2368
+ if (!response.ok) {
2369
+ const errorText = await response.text();
2370
+ throw new Error(`ERC-8004 API error: ${response.status} - ${errorText}`);
2371
+ }
2372
+ return await response.json();
2373
+ } catch (error) {
2374
+ clearTimeout(timeoutId);
2375
+ throw error;
2376
+ }
2377
+ }
2378
+ /**
2379
+ * Get a specific metadata entry for an agent
2380
+ *
2381
+ * @param network - Network where agent is registered
2382
+ * @param agentId - Agent's tokenId
2383
+ * @param key - Metadata key to retrieve
2384
+ * @returns Metadata value (hex-encoded and UTF-8 decoded if possible)
2385
+ */
2386
+ async getIdentityMetadata(network, agentId, key) {
2387
+ const url = `${this.baseUrl}/identity/${network}/${agentId}/metadata/${encodeURIComponent(key)}`;
2388
+ const controller = new AbortController();
2389
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
2390
+ try {
2391
+ const response = await fetch(url, {
2392
+ method: "GET",
2393
+ headers: { "Accept": "application/json" },
2394
+ signal: controller.signal
2395
+ });
2396
+ clearTimeout(timeoutId);
2397
+ if (!response.ok) {
2398
+ const errorText = await response.text();
2399
+ throw new Error(`ERC-8004 API error: ${response.status} - ${errorText}`);
2400
+ }
2401
+ return await response.json();
2402
+ } catch (error) {
2403
+ clearTimeout(timeoutId);
2404
+ throw error;
2405
+ }
2406
+ }
2407
+ /**
2408
+ * Get total number of registered agents on a network
2409
+ *
2410
+ * @param network - Network to query
2411
+ * @returns Total supply count
2412
+ */
2413
+ async getIdentityTotalSupply(network) {
2414
+ const url = `${this.baseUrl}/identity/${network}/total-supply`;
2415
+ const controller = new AbortController();
2416
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
2417
+ try {
2418
+ const response = await fetch(url, {
2419
+ method: "GET",
2420
+ headers: { "Accept": "application/json" },
2421
+ signal: controller.signal
2422
+ });
2423
+ clearTimeout(timeoutId);
2424
+ if (!response.ok) {
2425
+ const errorText = await response.text();
2426
+ throw new Error(`ERC-8004 API error: ${response.status} - ${errorText}`);
2427
+ }
2428
+ return await response.json();
2429
+ } catch (error) {
2430
+ clearTimeout(timeoutId);
2431
+ throw error;
2432
+ }
2433
+ }
2244
2434
  };
2245
2435
  function buildErc8004PaymentRequirements(options) {
2246
2436
  const base = buildPaymentRequirements(options);