uvd-x402-sdk 2.68.0 → 2.70.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.
package/README.md CHANGED
@@ -927,6 +927,76 @@ const result = await erc8004.submitFeedback({
927
927
  await erc8004.appendResponse('ethereum', 42, 1, 'Thank you for your feedback!');
928
928
  ```
929
929
 
930
+ ### Ratings the chain attributes to the rater
931
+
932
+ `submitFeedback()` above works, but the registry records `msg.sender` as the
933
+ author -- and on that route `msg.sender` is the **facilitator**. It is why 87,2%
934
+ of the reputation on Base (1.384 of 1.587 feedbacks) is attributed to one
935
+ wallet, which can also revoke it.
936
+
937
+ EIP-7702 fixes it without touching the registry: the rater delegates their own
938
+ EOA to a `FeedbackDelegate`, and the transaction is sent **to the rater's
939
+ address**, so the registry sees the rater while the facilitator still pays the
940
+ gas.
941
+
942
+ ```typescript
943
+ import { Erc8004Client, supportsRelayedFeedback } from 'uvd-x402-sdk/backend';
944
+
945
+ const erc8004 = new Erc8004Client();
946
+
947
+ if (!supportsRelayedFeedback('base')) {
948
+ // fall back to submitFeedback(); the facilitator is the author there
949
+ }
950
+
951
+ const prep = await erc8004.prepareRelayedFeedback({
952
+ x402Version: 1,
953
+ network: 'base',
954
+ feedback: {
955
+ agentId: 18896,
956
+ value: 95,
957
+ tag1: 'quality',
958
+ rater: raterAddress, // who the chain will record as the author
959
+ },
960
+ });
961
+
962
+ // 1. Sign the digest with the RATER's key (EIP-191 personal-sign).
963
+ const signature = await signMessage(prep.digest!);
964
+
965
+ // 2. Only the first time this rater rates: point their EOA at the delegate.
966
+ const authorization = prep.delegated
967
+ ? undefined
968
+ : {
969
+ chainId: prep.chainId, // 0 is EIP-7702's wildcard: valid on every chain
970
+ address: prep.delegate!,
971
+ nonce: prep.accountNonce!,
972
+ ...(await signAuthorization(prep.chainId, prep.delegate!, prep.accountNonce!)),
973
+ };
974
+
975
+ const result = await erc8004.submitRelayedFeedback({
976
+ x402Version: 1,
977
+ network: 'base',
978
+ feedback: { agentId: 18896, value: 95, tag1: 'quality', rater: raterAddress },
979
+ deadline: prep.deadline!, // short by design; past it, refused
980
+ nonce: prep.nonce!,
981
+ signature,
982
+ authorization,
983
+ });
984
+ ```
985
+
986
+ Pass the **same** feedback parameters, `deadline` and `nonce` back to
987
+ `submitRelayedFeedback()`. They are not redundant: the facilitator rebuilds the
988
+ registry calldata from them and refuses to relay anything the rater's signature
989
+ does not cover.
990
+
991
+ Available on the nine networks in `RELAYED_FEEDBACK_NETWORKS` -- the eight
992
+ mainnets with a deployed `FeedbackDelegate` (base, ethereum, polygon, arbitrum,
993
+ optimism, celo, bsc, monad) plus base-sepolia. **Avalanche is not one of them
994
+ and is not waiting to become one**: its C-Chain rejects the transaction type
995
+ itself (`-32000 transaction type not supported`), so anchor the rating on a
996
+ chain that supports EIP-7702 -- the payment stays where it was made.
997
+
998
+ Requires facilitator v1.93.0+ for the mainnets; base-sepolia since v1.74.0.
999
+
930
1000
  ## `/accepts` Negotiation
931
1001
 
932
1002
  Discover what the facilitator can settle before constructing payment authorizations. Used by Faremeter middleware and clients.
@@ -1385,6 +1385,127 @@ declare function wireNetwork(network: string): string;
1385
1385
  * reaches the wire. Use 'base'.
1386
1386
  */
1387
1387
  type Erc8004Network = 'ethereum' | 'base' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'scroll' | 'skale-base' | 'base-mainnet' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'skale-base-sepolia' | 'solana' | 'solana-devnet';
1388
+ /**
1389
+ * Networks where the facilitator serves the RELAYED feedback rail, i.e. where
1390
+ * Execution Market has deployed a `FeedbackDelegate` and the facilitator
1391
+ * verified it on-chain (code present, and its `REPUTATION_REGISTRY()` reads
1392
+ * back that network's registry).
1393
+ *
1394
+ * Anywhere else `POST /feedback/evm/prepare` answers 400 — and it should. An
1395
+ * invented delegate address would send a type-4 transaction to an account with
1396
+ * no code behind it, and in the EVM a `.call()` to an address with no code
1397
+ * RETURNS SUCCESS. The failure would look exactly like a rating that rated
1398
+ * nobody.
1399
+ *
1400
+ * `avalanche` is absent and is not waiting to join: the C-Chain rejects the
1401
+ * transaction type itself (`-32000 transaction type not supported`), so there
1402
+ * is nothing to deploy against. Anchor the rating on a chain that supports
1403
+ * EIP-7702; the payment stays where it was made.
1404
+ */
1405
+ declare const RELAYED_FEEDBACK_NETWORKS: readonly Erc8004Network[];
1406
+ /**
1407
+ * Whether `network` serves the rater-authored feedback rail.
1408
+ *
1409
+ * Lets a caller route without paying a round trip for a 400. The facilitator
1410
+ * re-checks the delegate on-chain on every request regardless — this list is a
1411
+ * routing hint, never the authority.
1412
+ */
1413
+ declare function supportsRelayedFeedback(network: string): boolean;
1414
+ /**
1415
+ * An EIP-7702 authorization, as a wallet produces it.
1416
+ *
1417
+ * Needed only the first time a rater rates: it points their EOA at the
1418
+ * `FeedbackDelegate`. Once delegated, `prepare` answers `delegated: true` and
1419
+ * the submission carries no authorization at all.
1420
+ */
1421
+ interface RelayAuthorizationParams {
1422
+ /**
1423
+ * Chain the authorization is for.
1424
+ *
1425
+ * `0` is EIP-7702's wildcard and is valid on EVERY chain — a far broader
1426
+ * grant than pinning this one. Send the chain id `prepare` returned.
1427
+ */
1428
+ chainId: number;
1429
+ /**
1430
+ * The delegate the account is pointed at. Must be the address `prepare`
1431
+ * offered; the facilitator refuses anything else before it pays for a
1432
+ * transaction.
1433
+ */
1434
+ address: string;
1435
+ /** The rater account's nonce at the moment the authorization executes */
1436
+ nonce: number;
1437
+ yParity: number;
1438
+ r: string;
1439
+ s: string;
1440
+ }
1441
+ /**
1442
+ * Request body for `POST /feedback/evm/prepare`.
1443
+ *
1444
+ * `rater` is the address that will appear on-chain as the author, which is the
1445
+ * whole point of this rail.
1446
+ */
1447
+ interface PrepareRelayFeedbackRequest {
1448
+ x402Version: 1 | 2;
1449
+ network: Erc8004Network;
1450
+ feedback: FeedbackParams & {
1451
+ rater: string;
1452
+ };
1453
+ }
1454
+ /**
1455
+ * Response from `POST /feedback/evm/prepare`.
1456
+ *
1457
+ * Everything the rater has to sign so the CHAIN records them as the author
1458
+ * while the facilitator pays the gas.
1459
+ */
1460
+ interface PrepareRelayFeedbackResponse {
1461
+ success: boolean;
1462
+ /** The `FeedbackDelegate` the rater's EOA must be delegated to */
1463
+ delegate?: string;
1464
+ /** Registry calldata the rater is authorising, hex-encoded */
1465
+ data?: string;
1466
+ /** EIP-191 digest to sign with the rater's key */
1467
+ digest?: string;
1468
+ /**
1469
+ * Unix seconds after which the authorisation is void. Short on purpose:
1470
+ * relaying is permissionless, so a signed authorisation is live in the wild
1471
+ * until it expires.
1472
+ */
1473
+ deadline?: number;
1474
+ /** Single-use value binding this authorisation. Echo it back on submit */
1475
+ nonce?: string;
1476
+ /**
1477
+ * Whether the account is already delegated. When `false` the submission MUST
1478
+ * carry an `authorization`.
1479
+ */
1480
+ delegated: boolean;
1481
+ /** The account nonce to put in the EIP-7702 authorization, when needed */
1482
+ accountNonce?: number;
1483
+ chainId: number;
1484
+ error?: string;
1485
+ network: Erc8004Network;
1486
+ }
1487
+ /**
1488
+ * Request body for `POST /feedback/evm/submit`.
1489
+ *
1490
+ * The feedback parameters are not redundant with `prepare`: the facilitator
1491
+ * rebuilds the registry calldata from them and requires the rater's signature
1492
+ * to cover exactly that. It does not relay calldata it was handed.
1493
+ */
1494
+ interface SubmitRelayFeedbackRequest {
1495
+ x402Version: 1 | 2;
1496
+ network: Erc8004Network;
1497
+ feedback: FeedbackParams & {
1498
+ rater: string;
1499
+ };
1500
+ /** The deadline `prepare` returned */
1501
+ deadline: number;
1502
+ /** The single-use nonce `prepare` returned */
1503
+ nonce: string;
1504
+ /** The rater's EIP-191 signature over `digest` */
1505
+ signature: string;
1506
+ /** Required only when `prepare` answered `delegated: false` */
1507
+ authorization?: RelayAuthorizationParams;
1508
+ }
1388
1509
  /**
1389
1510
  * Proof of payment returned when settling with ERC-8004 extension
1390
1511
  */
@@ -1871,6 +1992,14 @@ declare class Erc8004Client {
1871
1992
  *
1872
1993
  * Requires proof of payment for authorized feedback submission.
1873
1994
  *
1995
+ * @deprecated On this route the facilitator is the AUTHOR: the registry
1996
+ * records `msg.sender`, and that is the facilitator's wallet — which can also
1997
+ * revoke what it wrote. On the networks in {@link RELAYED_FEEDBACK_NETWORKS}
1998
+ * use {@link Erc8004Client.prepareRelayedFeedback} +
1999
+ * {@link Erc8004Client.submitRelayedFeedback} instead, which record the RATER
2000
+ * as author. This route still works and is not going away without notice: it
2001
+ * is the only one available where no `FeedbackDelegate` is deployed.
2002
+ *
1874
2003
  * @param request - Feedback request with agent ID, value, and proof
1875
2004
  * @returns Feedback response with transaction hash
1876
2005
  *
@@ -1898,6 +2027,64 @@ declare class Erc8004Client {
1898
2027
  * ```
1899
2028
  */
1900
2029
  submitFeedback(request: FeedbackRequest): Promise<FeedbackResponse>;
2030
+ /**
2031
+ * Ask the facilitator what the rater must sign to author a rating.
2032
+ *
2033
+ * Step 1 of the rater-authored rail. Writes nothing on-chain and costs
2034
+ * nothing: it reads the delegate, the rater's delegation state and their
2035
+ * account nonce, then hands back a digest, a deadline and a single-use nonce.
2036
+ *
2037
+ * Why this exists: the ERC-8004 Reputation Registry records `msg.sender` as
2038
+ * the author, and the deployed implementation has no delegation path — no
2039
+ * `giveFeedbackWithSignature`, no ERC-2771 forwarder. So a rating the
2040
+ * facilitator relays the ordinary way is a rating attributed to the
2041
+ * FACILITATOR. EIP-7702 fixes it without touching the registry: the rater
2042
+ * delegates their own EOA to the `FeedbackDelegate` and the transaction is
2043
+ * sent TO THE RATER'S ADDRESS, so the registry sees the rater while the
2044
+ * facilitator pays.
2045
+ *
2046
+ * What to do with the answer:
2047
+ * 1. Sign `digest` with the rater's key (EIP-191 personal-sign).
2048
+ * 2. If `delegated` is `false`, also produce an EIP-7702 authorization over
2049
+ * `(chainId, delegate, accountNonce)`.
2050
+ * 3. Hand both to {@link submitRelayedFeedback} with the SAME feedback
2051
+ * parameters, `deadline` and `nonce`.
2052
+ *
2053
+ * @param request - Network, rater address and feedback parameters
2054
+ * @returns Everything needed to sign, including whether an EIP-7702
2055
+ * authorization is still required
2056
+ *
2057
+ * @example
2058
+ * ```ts
2059
+ * const prep = await erc8004.prepareRelayedFeedback({
2060
+ * x402Version: 1,
2061
+ * network: 'base',
2062
+ * feedback: { agentId: 18896, value: 95, tag1: 'quality', rater: raterAddress },
2063
+ * });
2064
+ * // prep.delegated === false -> an EIP-7702 authorization is required
2065
+ * ```
2066
+ */
2067
+ prepareRelayedFeedback(request: PrepareRelayFeedbackRequest): Promise<PrepareRelayFeedbackResponse>;
2068
+ /**
2069
+ * Relay a rater-authored rating; the facilitator pays the gas.
2070
+ *
2071
+ * Step 2 of the rater-authored rail. The on-chain record that comes out of it
2072
+ * has the RATER as `msg.sender`, so `getClients(agentId)` shows the rater
2073
+ * rather than the facilitator.
2074
+ *
2075
+ * Pass back the same feedback parameters, `deadline` and `nonce` that
2076
+ * {@link prepareRelayedFeedback} returned. They are not redundant: the
2077
+ * facilitator rebuilds the registry calldata from them and requires the
2078
+ * rater's signature to cover exactly that.
2079
+ *
2080
+ * `authorization` is required only when `prepare` answered
2081
+ * `delegated: false`. One that names a different delegate than the one
2082
+ * `prepare` offered is refused before any gas is spent.
2083
+ *
2084
+ * @param request - Feedback parameters plus the rater's signature
2085
+ * @returns Feedback response with the transaction hash
2086
+ */
2087
+ submitRelayedFeedback(request: SubmitRelayFeedbackRequest): Promise<FeedbackResponse>;
1901
2088
  /**
1902
2089
  * Revoke previously submitted feedback
1903
2090
  *
@@ -2528,4 +2715,4 @@ declare class AdvancedEscrowClient {
2528
2715
  private sendViaAdapter;
2529
2716
  }
2530
2717
 
2531
- export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader, wireNetwork };
2718
+ export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type PrepareRelayFeedbackRequest, type PrepareRelayFeedbackResponse, type ProofOfPayment, RELAYED_FEEDBACK_NETWORKS, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type RelayAuthorizationParams, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, type SubmitRelayFeedbackRequest, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader, supportsRelayedFeedback, wireNetwork };
@@ -1385,6 +1385,127 @@ declare function wireNetwork(network: string): string;
1385
1385
  * reaches the wire. Use 'base'.
1386
1386
  */
1387
1387
  type Erc8004Network = 'ethereum' | 'base' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'scroll' | 'skale-base' | 'base-mainnet' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'skale-base-sepolia' | 'solana' | 'solana-devnet';
1388
+ /**
1389
+ * Networks where the facilitator serves the RELAYED feedback rail, i.e. where
1390
+ * Execution Market has deployed a `FeedbackDelegate` and the facilitator
1391
+ * verified it on-chain (code present, and its `REPUTATION_REGISTRY()` reads
1392
+ * back that network's registry).
1393
+ *
1394
+ * Anywhere else `POST /feedback/evm/prepare` answers 400 — and it should. An
1395
+ * invented delegate address would send a type-4 transaction to an account with
1396
+ * no code behind it, and in the EVM a `.call()` to an address with no code
1397
+ * RETURNS SUCCESS. The failure would look exactly like a rating that rated
1398
+ * nobody.
1399
+ *
1400
+ * `avalanche` is absent and is not waiting to join: the C-Chain rejects the
1401
+ * transaction type itself (`-32000 transaction type not supported`), so there
1402
+ * is nothing to deploy against. Anchor the rating on a chain that supports
1403
+ * EIP-7702; the payment stays where it was made.
1404
+ */
1405
+ declare const RELAYED_FEEDBACK_NETWORKS: readonly Erc8004Network[];
1406
+ /**
1407
+ * Whether `network` serves the rater-authored feedback rail.
1408
+ *
1409
+ * Lets a caller route without paying a round trip for a 400. The facilitator
1410
+ * re-checks the delegate on-chain on every request regardless — this list is a
1411
+ * routing hint, never the authority.
1412
+ */
1413
+ declare function supportsRelayedFeedback(network: string): boolean;
1414
+ /**
1415
+ * An EIP-7702 authorization, as a wallet produces it.
1416
+ *
1417
+ * Needed only the first time a rater rates: it points their EOA at the
1418
+ * `FeedbackDelegate`. Once delegated, `prepare` answers `delegated: true` and
1419
+ * the submission carries no authorization at all.
1420
+ */
1421
+ interface RelayAuthorizationParams {
1422
+ /**
1423
+ * Chain the authorization is for.
1424
+ *
1425
+ * `0` is EIP-7702's wildcard and is valid on EVERY chain — a far broader
1426
+ * grant than pinning this one. Send the chain id `prepare` returned.
1427
+ */
1428
+ chainId: number;
1429
+ /**
1430
+ * The delegate the account is pointed at. Must be the address `prepare`
1431
+ * offered; the facilitator refuses anything else before it pays for a
1432
+ * transaction.
1433
+ */
1434
+ address: string;
1435
+ /** The rater account's nonce at the moment the authorization executes */
1436
+ nonce: number;
1437
+ yParity: number;
1438
+ r: string;
1439
+ s: string;
1440
+ }
1441
+ /**
1442
+ * Request body for `POST /feedback/evm/prepare`.
1443
+ *
1444
+ * `rater` is the address that will appear on-chain as the author, which is the
1445
+ * whole point of this rail.
1446
+ */
1447
+ interface PrepareRelayFeedbackRequest {
1448
+ x402Version: 1 | 2;
1449
+ network: Erc8004Network;
1450
+ feedback: FeedbackParams & {
1451
+ rater: string;
1452
+ };
1453
+ }
1454
+ /**
1455
+ * Response from `POST /feedback/evm/prepare`.
1456
+ *
1457
+ * Everything the rater has to sign so the CHAIN records them as the author
1458
+ * while the facilitator pays the gas.
1459
+ */
1460
+ interface PrepareRelayFeedbackResponse {
1461
+ success: boolean;
1462
+ /** The `FeedbackDelegate` the rater's EOA must be delegated to */
1463
+ delegate?: string;
1464
+ /** Registry calldata the rater is authorising, hex-encoded */
1465
+ data?: string;
1466
+ /** EIP-191 digest to sign with the rater's key */
1467
+ digest?: string;
1468
+ /**
1469
+ * Unix seconds after which the authorisation is void. Short on purpose:
1470
+ * relaying is permissionless, so a signed authorisation is live in the wild
1471
+ * until it expires.
1472
+ */
1473
+ deadline?: number;
1474
+ /** Single-use value binding this authorisation. Echo it back on submit */
1475
+ nonce?: string;
1476
+ /**
1477
+ * Whether the account is already delegated. When `false` the submission MUST
1478
+ * carry an `authorization`.
1479
+ */
1480
+ delegated: boolean;
1481
+ /** The account nonce to put in the EIP-7702 authorization, when needed */
1482
+ accountNonce?: number;
1483
+ chainId: number;
1484
+ error?: string;
1485
+ network: Erc8004Network;
1486
+ }
1487
+ /**
1488
+ * Request body for `POST /feedback/evm/submit`.
1489
+ *
1490
+ * The feedback parameters are not redundant with `prepare`: the facilitator
1491
+ * rebuilds the registry calldata from them and requires the rater's signature
1492
+ * to cover exactly that. It does not relay calldata it was handed.
1493
+ */
1494
+ interface SubmitRelayFeedbackRequest {
1495
+ x402Version: 1 | 2;
1496
+ network: Erc8004Network;
1497
+ feedback: FeedbackParams & {
1498
+ rater: string;
1499
+ };
1500
+ /** The deadline `prepare` returned */
1501
+ deadline: number;
1502
+ /** The single-use nonce `prepare` returned */
1503
+ nonce: string;
1504
+ /** The rater's EIP-191 signature over `digest` */
1505
+ signature: string;
1506
+ /** Required only when `prepare` answered `delegated: false` */
1507
+ authorization?: RelayAuthorizationParams;
1508
+ }
1388
1509
  /**
1389
1510
  * Proof of payment returned when settling with ERC-8004 extension
1390
1511
  */
@@ -1871,6 +1992,14 @@ declare class Erc8004Client {
1871
1992
  *
1872
1993
  * Requires proof of payment for authorized feedback submission.
1873
1994
  *
1995
+ * @deprecated On this route the facilitator is the AUTHOR: the registry
1996
+ * records `msg.sender`, and that is the facilitator's wallet — which can also
1997
+ * revoke what it wrote. On the networks in {@link RELAYED_FEEDBACK_NETWORKS}
1998
+ * use {@link Erc8004Client.prepareRelayedFeedback} +
1999
+ * {@link Erc8004Client.submitRelayedFeedback} instead, which record the RATER
2000
+ * as author. This route still works and is not going away without notice: it
2001
+ * is the only one available where no `FeedbackDelegate` is deployed.
2002
+ *
1874
2003
  * @param request - Feedback request with agent ID, value, and proof
1875
2004
  * @returns Feedback response with transaction hash
1876
2005
  *
@@ -1898,6 +2027,64 @@ declare class Erc8004Client {
1898
2027
  * ```
1899
2028
  */
1900
2029
  submitFeedback(request: FeedbackRequest): Promise<FeedbackResponse>;
2030
+ /**
2031
+ * Ask the facilitator what the rater must sign to author a rating.
2032
+ *
2033
+ * Step 1 of the rater-authored rail. Writes nothing on-chain and costs
2034
+ * nothing: it reads the delegate, the rater's delegation state and their
2035
+ * account nonce, then hands back a digest, a deadline and a single-use nonce.
2036
+ *
2037
+ * Why this exists: the ERC-8004 Reputation Registry records `msg.sender` as
2038
+ * the author, and the deployed implementation has no delegation path — no
2039
+ * `giveFeedbackWithSignature`, no ERC-2771 forwarder. So a rating the
2040
+ * facilitator relays the ordinary way is a rating attributed to the
2041
+ * FACILITATOR. EIP-7702 fixes it without touching the registry: the rater
2042
+ * delegates their own EOA to the `FeedbackDelegate` and the transaction is
2043
+ * sent TO THE RATER'S ADDRESS, so the registry sees the rater while the
2044
+ * facilitator pays.
2045
+ *
2046
+ * What to do with the answer:
2047
+ * 1. Sign `digest` with the rater's key (EIP-191 personal-sign).
2048
+ * 2. If `delegated` is `false`, also produce an EIP-7702 authorization over
2049
+ * `(chainId, delegate, accountNonce)`.
2050
+ * 3. Hand both to {@link submitRelayedFeedback} with the SAME feedback
2051
+ * parameters, `deadline` and `nonce`.
2052
+ *
2053
+ * @param request - Network, rater address and feedback parameters
2054
+ * @returns Everything needed to sign, including whether an EIP-7702
2055
+ * authorization is still required
2056
+ *
2057
+ * @example
2058
+ * ```ts
2059
+ * const prep = await erc8004.prepareRelayedFeedback({
2060
+ * x402Version: 1,
2061
+ * network: 'base',
2062
+ * feedback: { agentId: 18896, value: 95, tag1: 'quality', rater: raterAddress },
2063
+ * });
2064
+ * // prep.delegated === false -> an EIP-7702 authorization is required
2065
+ * ```
2066
+ */
2067
+ prepareRelayedFeedback(request: PrepareRelayFeedbackRequest): Promise<PrepareRelayFeedbackResponse>;
2068
+ /**
2069
+ * Relay a rater-authored rating; the facilitator pays the gas.
2070
+ *
2071
+ * Step 2 of the rater-authored rail. The on-chain record that comes out of it
2072
+ * has the RATER as `msg.sender`, so `getClients(agentId)` shows the rater
2073
+ * rather than the facilitator.
2074
+ *
2075
+ * Pass back the same feedback parameters, `deadline` and `nonce` that
2076
+ * {@link prepareRelayedFeedback} returned. They are not redundant: the
2077
+ * facilitator rebuilds the registry calldata from them and requires the
2078
+ * rater's signature to cover exactly that.
2079
+ *
2080
+ * `authorization` is required only when `prepare` answered
2081
+ * `delegated: false`. One that names a different delegate than the one
2082
+ * `prepare` offered is refused before any gas is spent.
2083
+ *
2084
+ * @param request - Feedback parameters plus the rater's signature
2085
+ * @returns Feedback response with the transaction hash
2086
+ */
2087
+ submitRelayedFeedback(request: SubmitRelayFeedbackRequest): Promise<FeedbackResponse>;
1901
2088
  /**
1902
2089
  * Revoke previously submitted feedback
1903
2090
  *
@@ -2528,4 +2715,4 @@ declare class AdvancedEscrowClient {
2528
2715
  private sendViaAdapter;
2529
2716
  }
2530
2717
 
2531
- export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader, wireNetwork };
2718
+ export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type PrepareRelayFeedbackRequest, type PrepareRelayFeedbackResponse, type ProofOfPayment, RELAYED_FEEDBACK_NETWORKS, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type RelayAuthorizationParams, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, type SubmitRelayFeedbackRequest, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader, supportsRelayedFeedback, wireNetwork };