uvd-x402-sdk 2.33.0 → 2.34.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.
@@ -1480,6 +1480,21 @@ interface RegisterAgentResponse {
1480
1480
  /** Network where agent was registered */
1481
1481
  network: string;
1482
1482
  }
1483
+ /**
1484
+ * Response from GET /identity/{network}/owner/{address}
1485
+ */
1486
+ interface IdentityByOwnerResponse {
1487
+ /** First (lowest) token ID owned by this address */
1488
+ agentId: AgentId;
1489
+ /** The queried address (checksummed) */
1490
+ owner: string;
1491
+ /** Agent's registration URI (may be empty) */
1492
+ agentUri: string;
1493
+ /** Network name */
1494
+ network: string;
1495
+ /** Total number of agent NFTs owned (as string) */
1496
+ balance: string;
1497
+ }
1483
1498
  /**
1484
1499
  * Response from GET /identity/{network}/{agent_id}/metadata/{key}
1485
1500
  */
@@ -1562,6 +1577,22 @@ declare class Erc8004Client {
1562
1577
  * @returns Agent identity information
1563
1578
  */
1564
1579
  getIdentity(network: Erc8004Network, agentId: AgentId): Promise<AgentIdentity>;
1580
+ /**
1581
+ * Get agent identity by owner address
1582
+ *
1583
+ * Resolves the first ERC-8004 agent ID owned by a wallet address on a given network.
1584
+ *
1585
+ * @param network - Network to query
1586
+ * @param address - Owner wallet address
1587
+ * @returns Agent identity information including balance
1588
+ *
1589
+ * @example
1590
+ * ```ts
1591
+ * const identity = await client.getIdentityByOwner('base-mainnet', '0x52E0...');
1592
+ * console.log(`Agent #${identity.agentId}, balance: ${identity.balance}`);
1593
+ * ```
1594
+ */
1595
+ getIdentityByOwner(network: Erc8004Network, address: string): Promise<IdentityByOwnerResponse>;
1565
1596
  /**
1566
1597
  * Resolve agent registration file from agentURI
1567
1598
  *
@@ -1683,10 +1714,11 @@ declare class Erc8004Client {
1683
1714
  sealHash?: string;
1684
1715
  }): Promise<FeedbackResponse>;
1685
1716
  /**
1686
- * Register a new agent on the Identity Registry
1717
+ * Register an agent on the Identity Registry (idempotent)
1687
1718
  *
1688
- * The facilitator pays gas fees. Optionally transfer the NFT to a
1689
- * recipient address (gasless delegation).
1719
+ * If the recipient already owns an agent on the target network, returns the
1720
+ * existing one instead of minting a duplicate. The facilitator pays gas fees.
1721
+ * Optionally transfer the NFT to a recipient address (gasless delegation).
1690
1722
  *
1691
1723
  * @param request - Registration request
1692
1724
  * @returns Registration response with agent ID and transaction hash
@@ -2138,4 +2170,4 @@ declare class AdvancedEscrowClient {
2138
2170
  refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
2139
2171
  }
2140
2172
 
2141
- export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, 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, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, 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, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
2173
+ export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, 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, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, 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, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
@@ -1480,6 +1480,21 @@ interface RegisterAgentResponse {
1480
1480
  /** Network where agent was registered */
1481
1481
  network: string;
1482
1482
  }
1483
+ /**
1484
+ * Response from GET /identity/{network}/owner/{address}
1485
+ */
1486
+ interface IdentityByOwnerResponse {
1487
+ /** First (lowest) token ID owned by this address */
1488
+ agentId: AgentId;
1489
+ /** The queried address (checksummed) */
1490
+ owner: string;
1491
+ /** Agent's registration URI (may be empty) */
1492
+ agentUri: string;
1493
+ /** Network name */
1494
+ network: string;
1495
+ /** Total number of agent NFTs owned (as string) */
1496
+ balance: string;
1497
+ }
1483
1498
  /**
1484
1499
  * Response from GET /identity/{network}/{agent_id}/metadata/{key}
1485
1500
  */
@@ -1562,6 +1577,22 @@ declare class Erc8004Client {
1562
1577
  * @returns Agent identity information
1563
1578
  */
1564
1579
  getIdentity(network: Erc8004Network, agentId: AgentId): Promise<AgentIdentity>;
1580
+ /**
1581
+ * Get agent identity by owner address
1582
+ *
1583
+ * Resolves the first ERC-8004 agent ID owned by a wallet address on a given network.
1584
+ *
1585
+ * @param network - Network to query
1586
+ * @param address - Owner wallet address
1587
+ * @returns Agent identity information including balance
1588
+ *
1589
+ * @example
1590
+ * ```ts
1591
+ * const identity = await client.getIdentityByOwner('base-mainnet', '0x52E0...');
1592
+ * console.log(`Agent #${identity.agentId}, balance: ${identity.balance}`);
1593
+ * ```
1594
+ */
1595
+ getIdentityByOwner(network: Erc8004Network, address: string): Promise<IdentityByOwnerResponse>;
1565
1596
  /**
1566
1597
  * Resolve agent registration file from agentURI
1567
1598
  *
@@ -1683,10 +1714,11 @@ declare class Erc8004Client {
1683
1714
  sealHash?: string;
1684
1715
  }): Promise<FeedbackResponse>;
1685
1716
  /**
1686
- * Register a new agent on the Identity Registry
1717
+ * Register an agent on the Identity Registry (idempotent)
1687
1718
  *
1688
- * The facilitator pays gas fees. Optionally transfer the NFT to a
1689
- * recipient address (gasless delegation).
1719
+ * If the recipient already owns an agent on the target network, returns the
1720
+ * existing one instead of minting a duplicate. The facilitator pays gas fees.
1721
+ * Optionally transfer the NFT to a recipient address (gasless delegation).
1690
1722
  *
1691
1723
  * @param request - Registration request
1692
1724
  * @returns Registration response with agent ID and transaction hash
@@ -2138,4 +2170,4 @@ declare class AdvancedEscrowClient {
2138
2170
  refundPostEscrow(paymentInfo: AdvancedPaymentInfo, amount?: string, tokenCollector?: string, collectorData?: string): Promise<AdvancedTransactionResult>;
2139
2171
  }
2140
2172
 
2141
- export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, 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, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, 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, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
2173
+ export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, 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, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentRequirementResolver, 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, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildVerifyRequest, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isEscrowExpired, isEscrowSupportedOnChain, parsePaymentHeader };
@@ -2521,6 +2521,42 @@ var Erc8004Client = class {
2521
2521
  throw error;
2522
2522
  }
2523
2523
  }
2524
+ /**
2525
+ * Get agent identity by owner address
2526
+ *
2527
+ * Resolves the first ERC-8004 agent ID owned by a wallet address on a given network.
2528
+ *
2529
+ * @param network - Network to query
2530
+ * @param address - Owner wallet address
2531
+ * @returns Agent identity information including balance
2532
+ *
2533
+ * @example
2534
+ * ```ts
2535
+ * const identity = await client.getIdentityByOwner('base-mainnet', '0x52E0...');
2536
+ * console.log(`Agent #${identity.agentId}, balance: ${identity.balance}`);
2537
+ * ```
2538
+ */
2539
+ async getIdentityByOwner(network, address) {
2540
+ const url = `${this.baseUrl}/identity/${network}/owner/${address}`;
2541
+ const controller = new AbortController();
2542
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
2543
+ try {
2544
+ const response = await fetch(url, {
2545
+ method: "GET",
2546
+ headers: { "Accept": "application/json" },
2547
+ signal: controller.signal
2548
+ });
2549
+ clearTimeout(timeoutId);
2550
+ if (!response.ok) {
2551
+ const errorText = await response.text();
2552
+ throw new Error(`ERC-8004 API error: ${response.status} - ${errorText}`);
2553
+ }
2554
+ return await response.json();
2555
+ } catch (error) {
2556
+ clearTimeout(timeoutId);
2557
+ throw error;
2558
+ }
2559
+ }
2524
2560
  /**
2525
2561
  * Resolve agent registration file from agentURI
2526
2562
  *
@@ -2817,10 +2853,11 @@ var Erc8004Client = class {
2817
2853
  }
2818
2854
  }
2819
2855
  /**
2820
- * Register a new agent on the Identity Registry
2856
+ * Register an agent on the Identity Registry (idempotent)
2821
2857
  *
2822
- * The facilitator pays gas fees. Optionally transfer the NFT to a
2823
- * recipient address (gasless delegation).
2858
+ * If the recipient already owns an agent on the target network, returns the
2859
+ * existing one instead of minting a duplicate. The facilitator pays gas fees.
2860
+ * Optionally transfer the NFT to a recipient address (gasless delegation).
2824
2861
  *
2825
2862
  * @param request - Registration request
2826
2863
  * @returns Registration response with agent ID and transaction hash