@recta/client 0.1.6 → 0.1.7

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.
@@ -7,9 +7,9 @@
7
7
  */
8
8
  export declare const RECTA_ORIGIN = "https://api.recta.build";
9
9
  /** This package's version (equal to package.json, checked in CI). */
10
- export declare const CLIENT_VERSION = "0.1.6";
10
+ export declare const CLIENT_VERSION = "0.1.7";
11
11
  /** Sent on every request so Recta can count real use of this package apart from other clients (no address, no key). */
12
- export declare const USER_AGENT = "recta-client/0.1.6";
12
+ export declare const USER_AGENT = "recta-client/0.1.7";
13
13
  /** The fee: x402 `upto` on Base, a Permit2 `permitWitnessTransferFrom`. All lowercase. */
14
14
  export declare const FEE_CHAIN_ID = 8453;
15
15
  export declare const PERMIT2 = "0x000000000022d473030f116ddee9f6b43ac78ba3";
package/dist/constants.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export const RECTA_ORIGIN = "https://api.recta.build";
9
9
  /** This package's version (equal to package.json, checked in CI). */
10
- export const CLIENT_VERSION = "0.1.6";
10
+ export const CLIENT_VERSION = "0.1.7";
11
11
  /** Sent on every request so Recta can count real use of this package apart from other clients (no address, no key). */
12
12
  export const USER_AGENT = `recta-client/${CLIENT_VERSION}`;
13
13
  /** The fee: x402 `upto` on Base, a Permit2 `permitWitnessTransferFrom`. All lowercase. */
package/dist/errors.js CHANGED
@@ -15,7 +15,12 @@ export class RectaHttpError extends Error {
15
15
  reasonCode;
16
16
  constructor(status, body) {
17
17
  const reason = typeof body === "object" && body !== null && typeof body["reason_code"] === "string" ? body["reason_code"] : undefined;
18
- super(`Recta answered HTTP ${status}${reason === undefined ? "" : ` (${reason})`}`);
18
+ // The reason, Recta's own message and whether a retry may succeed, so an agent reading only the error knows why
19
+ // it failed and what to do (before 0.1.7 it read only "Recta answered HTTP 503 (CAPTURE_FAILED_CLOSED)").
20
+ const record = typeof body === "object" && body !== null ? body : {};
21
+ const message = typeof record["message"] === "string" ? record["message"].replace(/\s+/g, " ").slice(0, 500) : undefined;
22
+ const retryable = typeof record["retryable"] === "boolean" ? (record["retryable"] ? " (retryable)" : " (not retryable)") : "";
23
+ super(`Recta answered HTTP ${status}${reason === undefined ? "" : ` ${reason}`}${message === undefined ? "" : `: ${message}`}${retryable}`);
19
24
  this.status = status;
20
25
  this.body = body;
21
26
  this.reasonCode = reason;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recta/client",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Client for Recta (api.recta.build): evaluate a cross-chain stablecoin transfer, authorize Recta's 5 %-of-verified-saving fee, execute the committed route and report it, with local checks before every signature.",
5
5
  "license": "MIT",
6
6
  "author": "Recta (https://recta.build)",