uvd-x402-sdk 2.72.0 → 2.74.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.
@@ -2909,6 +2909,9 @@ var Erc8004Client = class {
2909
2909
  * - wallet: `personal_sign` over `signingPayload`. `personal_sign` adds the
2910
2910
  * envelope itself, so signing `digest` with it wraps the value TWICE and
2911
2911
  * recovers a stranger — the only symptom is `relay_bad_signature`.
2912
+ * - **unless `typedData` came back** — that chain runs a v4 delegate. Then
2913
+ * sign THAT with `eth_signTypedData_v4` and ignore the other two: it is
2914
+ * the only form the rater can read, and it has no envelope ambiguity.
2912
2915
  * 2. If `delegated` is `false`, also produce an EIP-7702 authorization over
2913
2916
  * `(chainId, delegate, accountNonce)`.
2914
2917
  * 3. Hand both to {@link submitRelayedFeedback} with the SAME feedback
@@ -3114,11 +3117,82 @@ var Erc8004Client = class {
3114
3117
  throw error;
3115
3118
  }
3116
3119
  }
3120
+ /**
3121
+ * Ask what the RESPONDER must sign to author a response on-chain.
3122
+ *
3123
+ * The mirror of {@link prepareRelayedFeedback}, for the other write the
3124
+ * registry accepts from anybody. `appendResponse` is not agent-only — the
3125
+ * registry takes it from any address — so on the plain {@link appendResponse}
3126
+ * route the `responder` recorded on-chain is the FACILITATOR. That does not
3127
+ * destroy anyone's reputation the way a revoke would; it ties the
3128
+ * facilitator's on-chain identity to a third party's content, which is its own
3129
+ * kind of wrong.
3130
+ *
3131
+ * **v4 delegates only.** The v3 delegate accepts exactly two selectors and
3132
+ * `appendResponse` is not one of them, so a v3 network answers 400
3133
+ * `relay_response_needs_v4` rather than silently falling back to the route
3134
+ * this replaces.
3135
+ *
3136
+ * `clientAddress` and `feedbackIndex` are inside the signed struct: without
3137
+ * them one signature would answer any client's rating, or any rating at that
3138
+ * index.
3139
+ */
3140
+ async prepareRelayedResponse(request) {
3141
+ return this.postRelay("/feedback/response/evm/prepare", request, {
3142
+ success: false,
3143
+ delegated: false,
3144
+ chainId: 0,
3145
+ network: request.network
3146
+ });
3147
+ }
3148
+ /**
3149
+ * Relay a responder-authored response; the facilitator pays the gas.
3150
+ *
3151
+ * Pass back the same parameters, `deadline` and `nonce` that
3152
+ * {@link prepareRelayedResponse} returned: the facilitator rebuilds the struct
3153
+ * from them and refuses to relay anything the signature does not cover.
3154
+ */
3155
+ async submitRelayedResponse(request) {
3156
+ return this.postRelay("/feedback/response/evm/submit", request, {
3157
+ success: false,
3158
+ network: request.network
3159
+ });
3160
+ }
3161
+ /** Shared POST for the relay routes: a refusal is data, never a throw. */
3162
+ async postRelay(path, request, onError) {
3163
+ const controller = new AbortController();
3164
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
3165
+ try {
3166
+ const response = await fetch(`${this.baseUrl}${path}`, {
3167
+ method: "POST",
3168
+ headers: { "Content-Type": "application/json", "Accept": "application/json" },
3169
+ body: JSON.stringify({ ...request, network: wireNetwork(request.network) }),
3170
+ signal: controller.signal
3171
+ });
3172
+ clearTimeout(timeoutId);
3173
+ if (!response.ok) {
3174
+ const errorText = await response.text();
3175
+ return { ...onError, error: `Facilitator error: ${response.status} - ${errorText}` };
3176
+ }
3177
+ return await response.json();
3178
+ } catch (error) {
3179
+ clearTimeout(timeoutId);
3180
+ return { ...onError, error: error instanceof Error ? error.message : "Unknown error" };
3181
+ }
3182
+ }
3117
3183
  /**
3118
3184
  * Append a response to existing feedback
3119
3185
  *
3120
- * Allows agents to respond to feedback they received.
3121
- * Only the agent (identity owner) can append responses.
3186
+ * @deprecated On this route the facilitator is the AUTHOR: the registry
3187
+ * records `msg.sender` as the `responder`, and that is the facilitator's
3188
+ * wallet. Where the delegate is **v4**, use {@link prepareRelayedResponse} +
3189
+ * {@link submitRelayedResponse} instead. This route still works and is the
3190
+ * only one available where the delegate is still v3.
3191
+ *
3192
+ * **This is NOT agent-only**, despite what this comment claimed until
3193
+ * 2026-08-25. Verified on-chain on 2026-08-18: the registry accepts
3194
+ * `appendResponse` from ANY address. There is no identity-owner check, here or
3195
+ * in the contract.
3122
3196
  *
3123
3197
  * @param network - Network where feedback was submitted
3124
3198
  * @param agentId - Agent ID