@artblocks/abx-sdk 0.1.0-alpha.1 → 0.1.0-alpha.3

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/dist/chains.d.ts CHANGED
@@ -21,6 +21,11 @@ export declare function chainById(chainId: number): Chain | undefined;
21
21
  * to an explorer where the contract does not exist.
22
22
  */
23
23
  export declare function explorerUrl(chainId: number): string;
24
+ /** Env-name suffix for a user-facing key: uppercased, any run of non-alphanumerics collapsed to
25
+ * one `_` (`base-sepolia` → `BASE_SEPOLIA`, `my.provider` → `MY_PROVIDER`). Shared by every
26
+ * `ABX_<FAMILY>_<NAME>_*` convention (`ABX_RPC_URLS_<CHAIN>`, `ABX_REMOTE_<NAME>_URL/_TOKEN`) so
27
+ * the conventions can't drift. Lossy — the normalized form is the canonical name. */
28
+ export declare function envSuffix(name: string): string;
24
29
  /** The env var holding RPC endpoints for a chain: per-chain `ABX_RPC_URLS_<CHAIN>` (e.g.
25
30
  * `ABX_RPC_URLS_SEPOLIA`) when set, else the bare `ABX_RPC_URLS` (the active `ABX_CHAIN`). */
26
31
  export declare function rpcEnvVar(chainKey: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,MAAM,CAAC;AAGhC;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAGxC,CAAC;AAEF,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAShD,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAA0B,GAAG,KAAK,CAInE;AAED;wFACwF;AACxF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAE5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;+FAC+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,12 +40,17 @@ export function chainById(chainId) {
40
40
  export function explorerUrl(chainId) {
41
41
  return chainById(chainId)?.blockExplorers?.default?.url ?? 'https://sepolia.etherscan.io';
42
42
  }
43
+ /** Env-name suffix for a user-facing key: uppercased, any run of non-alphanumerics collapsed to
44
+ * one `_` (`base-sepolia` → `BASE_SEPOLIA`, `my.provider` → `MY_PROVIDER`). Shared by every
45
+ * `ABX_<FAMILY>_<NAME>_*` convention (`ABX_RPC_URLS_<CHAIN>`, `ABX_REMOTE_<NAME>_URL/_TOKEN`) so
46
+ * the conventions can't drift. Lossy — the normalized form is the canonical name. */
47
+ export function envSuffix(name) {
48
+ return name.toUpperCase().replace(/[^A-Z0-9]+/g, '_');
49
+ }
43
50
  /** The env var holding RPC endpoints for a chain: per-chain `ABX_RPC_URLS_<CHAIN>` (e.g.
44
51
  * `ABX_RPC_URLS_SEPOLIA`) when set, else the bare `ABX_RPC_URLS` (the active `ABX_CHAIN`). */
45
52
  export function rpcEnvVar(chainKey) {
46
- // Env var names can't contain hyphens, so a key like `base-sepolia` becomes
47
- // `ABX_RPC_URLS_BASE_SEPOLIA` (any non-alphanumeric collapses to `_`).
48
- return `ABX_RPC_URLS_${chainKey.toUpperCase().replace(/[^A-Z0-9]+/g, '_')}`;
53
+ return `ABX_RPC_URLS_${envSuffix(chainKey)}`;
49
54
  }
50
55
  /**
51
56
  * The ordered, de-duplicated RPC endpoints for `chainKey`. **Network-scoped**: a
@@ -1 +1 @@
1
- {"version":3,"file":"chains.js","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAA0B;IAC3C,cAAc,EAAE,WAAW;IAC3B,OAAO;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;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AAC;AAC3C,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACxD,CAAC;AACH,CAAC"}
package/dist/env.d.ts CHANGED
@@ -1,2 +1,13 @@
1
1
  export declare function loadDotEnv(startDir?: string): void;
2
+ /**
3
+ * Parse `.env` text into ordered entries plus any keys the file sets MORE THAN ONCE (pure — the
4
+ * testable half of {@link loadDotEnv}). First occurrence wins, matching the loader; duplicates are
5
+ * returned rather than swallowed, because a stale duplicate (two `ABX_RPC_URLS_SEPOLIA` lines, one
6
+ * pointing at a different network) leaves every downstream check passing while the tool talks to
7
+ * somewhere unintended — and the symptom surfaces far away as "no contract at that address".
8
+ */
9
+ export declare function parseEnvContent(content: string): {
10
+ entries: Array<[string, string]>;
11
+ duplicates: string[];
12
+ };
2
13
  //# sourceMappingURL=env.d.ts.map
package/dist/env.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAWA,wBAAgB,UAAU,CAAC,QAAQ,GAAE,MAAsB,GAAG,IAAI,CAcjE"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAWA,wBAAgB,UAAU,CAAC,QAAQ,GAAE,MAAsB,GAAG,IAAI,CAcjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG;IAAC,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAC,CA6BzG"}
package/dist/env.js CHANGED
@@ -24,7 +24,17 @@ export function loadDotEnv(startDir = process.cwd()) {
24
24
  dir = parent;
25
25
  }
26
26
  }
27
- function parseInto(content) {
27
+ /**
28
+ * Parse `.env` text into ordered entries plus any keys the file sets MORE THAN ONCE (pure — the
29
+ * testable half of {@link loadDotEnv}). First occurrence wins, matching the loader; duplicates are
30
+ * returned rather than swallowed, because a stale duplicate (two `ABX_RPC_URLS_SEPOLIA` lines, one
31
+ * pointing at a different network) leaves every downstream check passing while the tool talks to
32
+ * somewhere unintended — and the symptom surfaces far away as "no contract at that address".
33
+ */
34
+ export function parseEnvContent(content) {
35
+ const entries = [];
36
+ const seen = new Map();
37
+ const duplicates = [];
28
38
  for (const rawLine of content.split('\n')) {
29
39
  const line = rawLine.trim();
30
40
  if (!line || line.startsWith('#'))
@@ -38,8 +48,30 @@ function parseInto(content) {
38
48
  (value.startsWith("'") && value.endsWith("'"))) {
39
49
  value = value.slice(1, -1);
40
50
  }
41
- if (key && process.env[key] === undefined)
51
+ if (!key)
52
+ continue;
53
+ if (seen.has(key)) {
54
+ // Only a duplicate with a DIFFERENT value is worth reporting. A repeated identical line is
55
+ // harmless, and warning on it turns a real signal into per-invocation noise (every `abx`
56
+ // command is its own process, so there is nowhere to throttle a genuine warning to "once").
57
+ if (seen.get(key) !== value && !duplicates.includes(key))
58
+ duplicates.push(key);
59
+ continue;
60
+ }
61
+ seen.set(key, value);
62
+ entries.push([key, value]);
63
+ }
64
+ return { entries, duplicates };
65
+ }
66
+ function parseInto(content) {
67
+ const { entries, duplicates } = parseEnvContent(content);
68
+ for (const [key, value] of entries) {
69
+ if (process.env[key] === undefined)
42
70
  process.env[key] = value;
43
71
  }
72
+ if (duplicates.length) {
73
+ console.error(`⚠ .env sets ${duplicates.length === 1 ? 'this key' : 'these keys'} to CONFLICTING values: ${duplicates.join(', ')}. ` +
74
+ `The FIRST value wins and the later one is ignored — delete the stale line, or you may be pointed somewhere you didn't intend.`);
75
+ }
44
76
  }
45
77
  //# sourceMappingURL=env.js.map
package/dist/env.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AACjD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAE3C;;;;;GAKG;AACH,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,UAAU,CAAC,WAAmB,OAAO,CAAC,GAAG,EAAE;IACzD,IAAI,MAAM;QAAE,OAAO;IACnB,MAAM,GAAG,IAAI,CAAC;IACd,IAAI,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvC,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QACD,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CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC/D,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,KAAK,CACX,eAAe,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,2BAA2B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACpH,+HAA+H,CAClI,CAAC;IACJ,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from './create2.js';
26
26
  export * from './deployments.js';
27
27
  export * from './deps.js';
28
28
  export * from './generator.js';
29
- export { loadDotEnv } from './env.js';
29
+ export * from './service.js';
30
+ export { loadDotEnv, parseEnvContent } from './env.js';
30
31
  export { oneOfOneImageAbi, oneOfOneImageFactoryAbi, seriesImageAbi, seriesImageFactoryAbi, seriesCodeAbi, seriesCodeFactoryAbi, abxSeedSourceAbi, abxMetadataRendererAbi, abxChunkStoreAbi, abxFixedPriceMinterAbi, spineEventAbi, } from './abi/index.js';
31
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAE5E,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY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ACb,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACd,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export * from './create2.js';
15
15
  export * from './deployments.js';
16
16
  export * from './deps.js';
17
17
  export * from './generator.js';
18
- export { loadDotEnv } from './env.js';
18
+ export * from './service.js';
19
+ export { loadDotEnv, parseEnvContent } from './env.js';
19
20
  export { oneOfOneImageAbi, oneOfOneImageFactoryAbi, seriesImageAbi, seriesImageFactoryAbi, seriesCodeAbi, seriesCodeFactoryAbi, abxSeedSourceAbi, abxMetadataRendererAbi, abxChunkStoreAbi, abxFixedPriceMinterAbi, spineEventAbi, } from './abi/index.js';
20
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACd,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACd,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,328 @@
1
+ /**
2
+ * The remote-service client — the SDK's one HTTP surface, speaking the provider-neutral
3
+ * control plane pinned by specs/self-host-toolkit/remote-services.md. A client is bound to an
4
+ * endpoint + an injected bearer token, never to a brand: the reference CLI, the effects runner,
5
+ * and any hosted agent drive a self-hosted node and a managed provider through this same class.
6
+ *
7
+ * The token authorizes index/metadata control only — never on-chain signing. No env reads here;
8
+ * credential resolution is the caller's concern (the CLI's named-remote convention lives in
9
+ * packages/cli/src/remote.ts).
10
+ */
11
+ import type { Hex } from 'viem';
12
+ import type { OpenSeaAttribute } from './traits.js';
13
+ export declare const WELL_KNOWN_SERVICE_PATH = "/.well-known/abx-service";
14
+ /** Versioned interface ids a service declares in its descriptor. Versions ride these ids
15
+ * (they track the `/v1` path prefix); the descriptor has no separate format version. */
16
+ export declare const TOKEN_API_INTERFACE = "abx-token-api/v1";
17
+ export declare const CONTROL_PLANE_INTERFACE = "abx-control-plane/v1";
18
+ export declare const EFFECTS_PUBLISH_INTERFACE = "abx-effects-publish/v1";
19
+ /**
20
+ * The indexing lifecycle a registration moves through, closed and provider-neutral
21
+ * (specs/self-host-toolkit/remote-services.md → The indexing lifecycle). One vocabulary for a
22
+ * managed provider and for your own node — the reference resolver stamps these too.
23
+ *
24
+ * queued registered + accepted; catch-up hasn't started
25
+ * backfilling actively catching up (initial sync or a forced replay); may already serve partial state
26
+ * live caught up to head; tracking head incrementally
27
+ * stale was live, now lagging (watcher behind, or transient RPC trouble) — still serving
28
+ * failed catch-up errored; carries `error`; will be retried
29
+ *
30
+ * Observability, never a source of truth: token resolution never consults it, and a project
31
+ * reconstructs from chain regardless.
32
+ */
33
+ export type IndexStatus = 'queued' | 'backfilling' | 'live' | 'stale' | 'failed';
34
+ /** Statuses a caller can stop waiting on — see {@link AbxServiceClient.awaitIndexed}. */
35
+ export declare const TERMINAL_INDEX_STATUSES: readonly IndexStatus[];
36
+ /**
37
+ * Why catch-up failed, as a closed machine class — never free-form prose the client must parse.
38
+ * Deliberately NOT extended with a reorg class: the protocol defines no reorg detection (the repair
39
+ * is the deterministic full replay), so no implementation could emit one honestly.
40
+ */
41
+ export type IndexErrorClass =
42
+ /** The RPC didn't answer (down, timing out, network). Retryable — nothing is wrong with the add. */
43
+ 'rpc_unavailable'
44
+ /** The RPC answered "too many requests". Retryable, slower — the usual cause of a long backfill. */
45
+ | 'rpc_rate_limited'
46
+ /** The address doesn't look like an ABX contract on this chain. NOT emitted by the reference
47
+ * (it indexes what its operator tells it); a provider that validates clone-ness SHOULD refuse
48
+ * synchronously at register instead of accepting and failing here. */
49
+ | 'not_abx_contract'
50
+ /** Anything else. Carries no detail — the service logs the cause. */
51
+ | 'internal';
52
+ /** A catch-up failure as it crosses the wire: a machine class plus a short, CREDENTIAL-FREE hint.
53
+ * Messages come from a closed set (see {@link classifyIndexError}) rather than from a scrubber, so
54
+ * "no RPC URL can leak through here" is checkable by reading the code. */
55
+ export interface IndexError {
56
+ class: IndexErrorClass;
57
+ message?: string;
58
+ }
59
+ /** Map a catch-up failure to its wire form. Sniffs the underlying error's shape only to CHOOSE a
60
+ * class — nothing from it reaches the returned message. */
61
+ export declare function classifyIndexError(err: unknown): IndexError;
62
+ /** Machine error codes every conforming service uses — clients key off these, never off prose. */
63
+ export type ServiceErrorCode = 'invalid_request' | 'unsupported_chain' | 'unauthorized' | 'forbidden' | 'not_registered' | 'disabled'
64
+ /** 500 — an unexpected server-side failure. Never carries internal detail (it could embed the
65
+ * operator's own credentials); the node logs the cause. Retryable. */
66
+ | 'internal_error';
67
+ /** `GET /.well-known/abx-service` — what a service supports, agent-readably. */
68
+ export interface ServiceDescriptor {
69
+ /** Display name + implementation version, for humans and directories — never dispatch. */
70
+ service?: {
71
+ name?: string;
72
+ version?: string;
73
+ };
74
+ /** The load-bearing declaration: which interface families this endpoint serves. */
75
+ interfaces: string[];
76
+ /** EIP-155 chain ids served; the control plane rejects others with `unsupported_chain`. */
77
+ chains: number[];
78
+ /** Present iff the control plane is enabled. `signupUrl`/`docsUrl` are for humans —
79
+ * where a customer gets a key. */
80
+ auth?: {
81
+ scheme: 'bearer';
82
+ signupUrl?: string;
83
+ docsUrl?: string;
84
+ };
85
+ /** Present when rendering runs behind this service (the resolver fronts its runner).
86
+ * `effects: null` = attached but unverified (the health probe didn't answer). */
87
+ render?: {
88
+ attached: boolean;
89
+ effects: Array<{
90
+ key: string;
91
+ outputs: Array<{
92
+ key: string;
93
+ mimeType: string;
94
+ }>;
95
+ }> | null;
96
+ };
97
+ /** The public base this node believes it serves — a sanity echo for misconfig detection. */
98
+ baseUrl?: string;
99
+ }
100
+ /** `POST /v1/projects` — the off-chain bridge: everything the host can't derive from chain. */
101
+ export interface RegisterProjectBody {
102
+ chainId: number;
103
+ address: string;
104
+ /** Scan floor — the deploy block. Omit on a re-POST (the nudge) to keep the stored floor + reindex incrementally. */
105
+ fromBlock?: string;
106
+ factory?: string;
107
+ label?: string;
108
+ description?: string;
109
+ externalUrl?: string;
110
+ /** Off-chain operator traits (OpenSea attribute array) — stitched UNDER any on-chain `attributes`. */
111
+ attributes?: OpenSeaAttribute[];
112
+ /** Off-chain PER-TOKEN operator traits, `{ "<tokenId>": OpenSeaAttribute[] }` — a Series' editable
113
+ * traits (a token's entry wins over the collection-scope `attributes`; on-chain wins over both). */
114
+ tokenAttributes?: Record<string, OpenSeaAttribute[]>;
115
+ /** Durable locators keyed by on-chain hash, `{ "0x<keccak>": "ipfs://<cid>" }` — lets the resolver
116
+ * point `image` at IPFS/Arweave without holding the bytes. Merged over any already stored. */
117
+ contentLocators?: Record<string, string>;
118
+ /** Force a full replay even on a re-POST. */
119
+ full?: boolean;
120
+ }
121
+ /** `200` — catch-up finished inside the request; the counts are facts. */
122
+ export interface RegisterProjectSummary {
123
+ ok: boolean;
124
+ /** Discriminator. Normalized from the HTTP status by {@link AbxServiceClient.registerProject}. */
125
+ accepted: false;
126
+ mode: 'full' | 'incremental';
127
+ elapsedMs: number;
128
+ project: {
129
+ address: string;
130
+ name: string | null;
131
+ eventCount: number;
132
+ tokenCount: number;
133
+ mintedCount: number;
134
+ status?: IndexStatus;
135
+ };
136
+ }
137
+ /** `202` — the registration is durable and catch-up is deferred; there are no counts yet. Poll
138
+ * {@link AbxServiceClient.projectStatus} (or {@link AbxServiceClient.awaitIndexed}) for progress. */
139
+ export interface RegisterProjectAccepted {
140
+ ok: boolean;
141
+ accepted: true;
142
+ project: {
143
+ address: string;
144
+ name?: string | null;
145
+ status: IndexStatus;
146
+ };
147
+ }
148
+ /**
149
+ * `POST /v1/projects` answers in one of two shapes and **the HTTP status code is the discriminator**
150
+ * (200 = done, 202 = accepted). Both are conformant; a client MUST handle both, which is why this is
151
+ * a union rather than a shape with everything optional. Narrow with {@link isAccepted}.
152
+ */
153
+ export type RegisterProjectResult = RegisterProjectSummary | RegisterProjectAccepted;
154
+ /** Narrow a register response to the deferred-catch-up branch. */
155
+ export declare function isAccepted(r: RegisterProjectResult): r is RegisterProjectAccepted;
156
+ /** One row of `GET /v1/projects` — the projects visible to this token. */
157
+ export interface RemoteProjectSummary {
158
+ chainId: number;
159
+ address: string;
160
+ label?: string | null;
161
+ name?: string | null;
162
+ eventCount?: number;
163
+ tokenCount?: number;
164
+ mintedCount?: number;
165
+ reconstructedAt?: string | null;
166
+ /** Where this project is in the indexing lifecycle — so a list renders "3 live, 1 backfilling,
167
+ * 1 failed" with no per-project round trip. */
168
+ status?: IndexStatus;
169
+ /** Present on `stale`/`failed` — the class only; the full hint lives on the status route. */
170
+ error?: {
171
+ class: IndexErrorClass;
172
+ };
173
+ }
174
+ /** `GET /v1/projects/{chainId}/{address}/status` — indexing freshness + lifecycle. */
175
+ export interface RemoteProjectStatus {
176
+ chainId: number;
177
+ address: string;
178
+ /** Where this project is in the lifecycle. */
179
+ status: IndexStatus;
180
+ fromBlock: string;
181
+ toBlock: string | null;
182
+ /** Chain head as the service last saw it — so a client computes lag / % complete without knowing
183
+ * anything about the service's watcher. `null` when the service can't say. */
184
+ headBlock?: string | null;
185
+ eventCount: number;
186
+ tokenCount: number;
187
+ mintedCount: number;
188
+ reconstructedAt: string | null;
189
+ /** Present on `stale`/`failed`. Credential-free by contract. */
190
+ error?: IndexError;
191
+ /** Catch-up attempts since the last success. */
192
+ attempts?: number;
193
+ watcher?: {
194
+ watching: boolean;
195
+ pollAt: string | null;
196
+ head: string | null;
197
+ intervalMs?: number;
198
+ };
199
+ }
200
+ /**
201
+ * How far along a BACKFILL is, from a status read — `null` when there is no meaningful ratio.
202
+ *
203
+ * Deliberately `null` for anything but `backfilling`, because `toBlock` measures two different things
204
+ * depending on the state. During an initial sync it advances monotonically, so `toBlock` vs head IS
205
+ * progress. Once a project is `live` it only moves when that project has *events* — so a perfectly
206
+ * current project on a busy chain sits at a tiny fraction of head, and rendering that as "3%" reads
207
+ * as broken when nothing is wrong. Same reason the reference measures staleness against its watcher's
208
+ * watermark rather than a project's `toBlock`.
209
+ */
210
+ export declare function indexProgress(s: RemoteProjectStatus): {
211
+ done: bigint;
212
+ total: bigint;
213
+ percent: number;
214
+ } | null;
215
+ /** `POST /v1/effect-artifacts` — a render producer publishes one output (locator or bytes). */
216
+ export interface PublishEffectArtifactBody {
217
+ chainId: number;
218
+ address: string;
219
+ tokenId: string;
220
+ /** The hash of the inputs this render depicts — the service never re-addresses to current state. */
221
+ inputsHash: Hex;
222
+ output?: string;
223
+ effectKey?: string;
224
+ contentType?: string;
225
+ /** A durable `ipfs://` / `ar://` / `https://` pointer — the service stores it and redirects. */
226
+ locator?: string;
227
+ /** The raw output, stored in the service's own byte custody (what traits use). */
228
+ bytes_base64?: string;
229
+ }
230
+ /** `POST /v1/effect-status` — a producer reports one run's transient state. */
231
+ export interface ReportEffectStatusBody {
232
+ chainId: number;
233
+ key: Hex;
234
+ address: string;
235
+ tokenId: string;
236
+ effectKey: string;
237
+ status: 'rendering' | 'failed' | 'done';
238
+ error?: string;
239
+ attempts?: number;
240
+ }
241
+ /** A non-2xx control-plane response (or an unreachable service, after retries). `code` is the
242
+ * spec's machine code when the service sent one — key behavior off it, never off `message`. */
243
+ export declare class AbxServiceError extends Error {
244
+ readonly status: number;
245
+ readonly code?: ServiceErrorCode;
246
+ readonly url: string;
247
+ /** The failure CLASS when the service volunteered one (a credential-free hint about *why* — an
248
+ * exhausted RPC reads very differently from a broken service). Optional on the wire. */
249
+ readonly class?: IndexErrorClass;
250
+ constructor(message: string, opts: {
251
+ status: number;
252
+ code?: ServiceErrorCode;
253
+ url: string;
254
+ class?: IndexErrorClass;
255
+ });
256
+ }
257
+ /** Waiting for a project to reach a terminal status ran out of time. The registration is durable —
258
+ * this is "still working", never "the add failed". */
259
+ export declare class AbxIndexTimeoutError extends Error {
260
+ readonly last?: RemoteProjectStatus;
261
+ constructor(message: string, last?: RemoteProjectStatus);
262
+ }
263
+ export interface AwaitIndexedOptions {
264
+ /** Give up after this long (default 5 min). The registration stays durable regardless. */
265
+ timeoutMs?: number;
266
+ /** Poll cadence (default 3s). */
267
+ intervalMs?: number;
268
+ /** Called on every poll — drive a progress line from it. */
269
+ onProgress?: (status: RemoteProjectStatus) => void;
270
+ }
271
+ export interface ServiceClientOptions {
272
+ baseUrl: string;
273
+ /** Bearer token for the control plane. Omit for descriptor-only use. */
274
+ token?: string;
275
+ /** Per-attempt timeout. A hung provider must not hang the caller. */
276
+ timeoutMs?: number;
277
+ /** Backoff unit between retries (`delay = retryDelayMs × attempt`). Tests shrink it. */
278
+ retryDelayMs?: number;
279
+ }
280
+ export declare class AbxServiceClient {
281
+ readonly baseUrl: string;
282
+ private readonly token?;
283
+ private readonly timeoutMs;
284
+ private readonly retryDelayMs;
285
+ constructor(opts: ServiceClientOptions);
286
+ /** The public service descriptor — no auth, safe to fetch before trusting a provider. */
287
+ descriptor(): Promise<ServiceDescriptor>;
288
+ /**
289
+ * Register + index a project (the HTTP form of `abx add`; a re-POST is the nudge). Returns the
290
+ * completed summary (HTTP 200) or the accepted-and-still-working shape (HTTP 202) — narrow with
291
+ * {@link isAccepted}, and follow a 202 with {@link awaitIndexed}.
292
+ *
293
+ * A timed-out register is NOT retried blind. A conforming service persists the registration before
294
+ * it starts catching up, so a timeout usually means "it's in there, still working" — and re-POSTing
295
+ * would kick off a *second* full reconstruct against the RPC that was already too slow to answer.
296
+ * So we ask the status route whether it landed, and if it did we return the async shape instead.
297
+ */
298
+ registerProject(body: RegisterProjectBody): Promise<RegisterProjectResult>;
299
+ /**
300
+ * Poll a project's status until it reaches a terminal lifecycle state (`live` or `failed`) — the
301
+ * one implementation of the wait loop, so the CLI, the effects runner, and any hosted agent all
302
+ * behave identically against any provider. `stale` keeps polling: it means lagging, not caught up.
303
+ */
304
+ awaitIndexed(chainId: number, address: string, opts?: AwaitIndexedOptions): Promise<RemoteProjectStatus>;
305
+ /** The projects this token may see. */
306
+ listProjects(): Promise<RemoteProjectSummary[]>;
307
+ /** Deregister (remote `abx forget`). `not_registered` means "already gone" — reported, not
308
+ * thrown — but `disabled` still throws: a node that can't accept removals hasn't removed it. */
309
+ removeProject(chainId: number, address: string): Promise<{
310
+ removed: boolean;
311
+ }>;
312
+ /** Nudge a re-index. Answers in the same two shapes as {@link registerProject} — a full replay is
313
+ * the *most* likely call to outlive one HTTP request. */
314
+ reindexProject(chainId: number, address: string): Promise<RegisterProjectResult>;
315
+ /** Indexing freshness for one project. */
316
+ projectStatus(chainId: number, address: string): Promise<RemoteProjectStatus>;
317
+ /** Publish a render output so a resolver that doesn't share the producer's disk can serve it. */
318
+ publishEffectArtifact(body: PublishEffectArtifactBody): Promise<{
319
+ ok: boolean;
320
+ mode: 'locator' | 'bytes';
321
+ key: Hex;
322
+ }>;
323
+ /** Report a run's transient state for the artifact key it is producing. */
324
+ reportEffectStatus(body: ReportEffectStatusBody): Promise<void>;
325
+ private request;
326
+ private requestWithStatus;
327
+ }
328
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;yFACyF;AACzF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AACtD,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEjF,yFAAyF;AACzF,eAAO,MAAM,uBAA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;OASG;IACG,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUhF;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmBlH,uCAAuC;IACjC,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAKrD;qGACiG;IAC3F,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAC,CAAC;IAUlF;8DAC0D;IACpD,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUtF,0CAA0C;IACpC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAInF,iGAAiG;IAC3F,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,GAAG,EAAE,GAAG,CAAA;KAAC,CAAC;IAIzH,2EAA2E;IACrE,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;YAIvD,OAAO;YAIP,iBAAiB;CAsEhC"}
@@ -0,0 +1,319 @@
1
+ /**
2
+ * The remote-service client — the SDK's one HTTP surface, speaking the provider-neutral
3
+ * control plane pinned by specs/self-host-toolkit/remote-services.md. A client is bound to an
4
+ * endpoint + an injected bearer token, never to a brand: the reference CLI, the effects runner,
5
+ * and any hosted agent drive a self-hosted node and a managed provider through this same class.
6
+ *
7
+ * The token authorizes index/metadata control only — never on-chain signing. No env reads here;
8
+ * credential resolution is the caller's concern (the CLI's named-remote convention lives in
9
+ * packages/cli/src/remote.ts).
10
+ */
11
+ export const WELL_KNOWN_SERVICE_PATH = '/.well-known/abx-service';
12
+ /** Versioned interface ids a service declares in its descriptor. Versions ride these ids
13
+ * (they track the `/v1` path prefix); the descriptor has no separate format version. */
14
+ export const TOKEN_API_INTERFACE = 'abx-token-api/v1';
15
+ export const CONTROL_PLANE_INTERFACE = 'abx-control-plane/v1';
16
+ export const EFFECTS_PUBLISH_INTERFACE = 'abx-effects-publish/v1';
17
+ /** Statuses a caller can stop waiting on — see {@link AbxServiceClient.awaitIndexed}. */
18
+ export const TERMINAL_INDEX_STATUSES = ['live', 'failed'];
19
+ /** The one message per class. Fixed strings — an upstream error is never interpolated, because a
20
+ * keyed RPC URL *is* a credential and upstream messages routinely embed one. */
21
+ const INDEX_ERROR_MESSAGES = {
22
+ rpc_unavailable: 'upstream RPC unavailable; will retry',
23
+ rpc_rate_limited: 'upstream RPC rate-limited; will retry',
24
+ not_abx_contract: 'address emits no ABX event spine on this chain',
25
+ internal: 'indexing failed; see the service operator’s logs',
26
+ };
27
+ /** Map a catch-up failure to its wire form. Sniffs the underlying error's shape only to CHOOSE a
28
+ * class — nothing from it reaches the returned message. */
29
+ export function classifyIndexError(err) {
30
+ const raw = err instanceof Error ? `${err.name} ${err.message}` : String(err);
31
+ const text = raw.toLowerCase();
32
+ let cls = 'internal';
33
+ if (/rate.?limit|too many requests|\b429\b|quota|exceeded .*(?:compute|cu)|throttl/.test(text)) {
34
+ cls = 'rpc_rate_limited';
35
+ }
36
+ else if (/timeout|timed out|econnrefused|econnreset|enotfound|eai_again|socket hang up|fetch failed|network|502|503|504|http request failed/.test(text)) {
37
+ cls = 'rpc_unavailable';
38
+ }
39
+ return { class: cls, message: INDEX_ERROR_MESSAGES[cls] };
40
+ }
41
+ /** Narrow a register response to the deferred-catch-up branch. */
42
+ export function isAccepted(r) {
43
+ return r.accepted === true;
44
+ }
45
+ /**
46
+ * How far along a BACKFILL is, from a status read — `null` when there is no meaningful ratio.
47
+ *
48
+ * Deliberately `null` for anything but `backfilling`, because `toBlock` measures two different things
49
+ * depending on the state. During an initial sync it advances monotonically, so `toBlock` vs head IS
50
+ * progress. Once a project is `live` it only moves when that project has *events* — so a perfectly
51
+ * current project on a busy chain sits at a tiny fraction of head, and rendering that as "3%" reads
52
+ * as broken when nothing is wrong. Same reason the reference measures staleness against its watcher's
53
+ * watermark rather than a project's `toBlock`.
54
+ */
55
+ export function indexProgress(s) {
56
+ if (s.status !== 'backfilling')
57
+ return null;
58
+ if (!s.headBlock || !s.toBlock)
59
+ return null;
60
+ try {
61
+ const from = BigInt(s.fromBlock);
62
+ const to = BigInt(s.toBlock);
63
+ const head = BigInt(s.headBlock);
64
+ if (head <= from || to < from)
65
+ return null;
66
+ const total = head - from;
67
+ const done = (to > head ? head : to) - from;
68
+ return { done, total, percent: Number((done * 100n) / total) };
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ }
74
+ /** A non-2xx control-plane response (or an unreachable service, after retries). `code` is the
75
+ * spec's machine code when the service sent one — key behavior off it, never off `message`. */
76
+ export class AbxServiceError extends Error {
77
+ status;
78
+ code;
79
+ url;
80
+ /** The failure CLASS when the service volunteered one (a credential-free hint about *why* — an
81
+ * exhausted RPC reads very differently from a broken service). Optional on the wire. */
82
+ class;
83
+ constructor(message, opts) {
84
+ super(message);
85
+ this.name = 'AbxServiceError';
86
+ this.status = opts.status;
87
+ this.code = opts.code;
88
+ this.url = opts.url;
89
+ this.class = opts.class;
90
+ }
91
+ }
92
+ /** Waiting for a project to reach a terminal status ran out of time. The registration is durable —
93
+ * this is "still working", never "the add failed". */
94
+ export class AbxIndexTimeoutError extends Error {
95
+ last;
96
+ constructor(message, last) {
97
+ super(message);
98
+ this.name = 'AbxIndexTimeoutError';
99
+ this.last = last;
100
+ }
101
+ }
102
+ /**
103
+ * Retry discipline (shared with the effects runner's read lane): a hosted node can cold-start or
104
+ * briefly 502, so network errors / 5xx / 429 get 4 attempts with linear backoff — but a genuine
105
+ * 4xx is an answer, not weather, and throws immediately with the parsed `{error, code}` body.
106
+ */
107
+ const ATTEMPTS = 4;
108
+ /** The descriptor is a cheap PUBLIC read used to decide whether a URL is even a service — usually
109
+ * interactively, often against a typo. Grinding the full ladder there just makes a wrong URL take
110
+ * five seconds to say so, so it gets one retry for a blip and no more. */
111
+ const DESCRIPTOR_ATTEMPTS = 2;
112
+ export class AbxServiceClient {
113
+ baseUrl;
114
+ token;
115
+ timeoutMs;
116
+ retryDelayMs;
117
+ constructor(opts) {
118
+ this.baseUrl = opts.baseUrl.replace(/\/+$/, '');
119
+ this.token = opts.token;
120
+ this.timeoutMs = opts.timeoutMs ?? 30_000;
121
+ this.retryDelayMs = opts.retryDelayMs ?? 750;
122
+ }
123
+ /** The public service descriptor — no auth, safe to fetch before trusting a provider. */
124
+ async descriptor() {
125
+ return (await this.request('GET', WELL_KNOWN_SERVICE_PATH, undefined, { attempts: DESCRIPTOR_ATTEMPTS }));
126
+ }
127
+ /**
128
+ * Register + index a project (the HTTP form of `abx add`; a re-POST is the nudge). Returns the
129
+ * completed summary (HTTP 200) or the accepted-and-still-working shape (HTTP 202) — narrow with
130
+ * {@link isAccepted}, and follow a 202 with {@link awaitIndexed}.
131
+ *
132
+ * A timed-out register is NOT retried blind. A conforming service persists the registration before
133
+ * it starts catching up, so a timeout usually means "it's in there, still working" — and re-POSTing
134
+ * would kick off a *second* full reconstruct against the RPC that was already too slow to answer.
135
+ * So we ask the status route whether it landed, and if it did we return the async shape instead.
136
+ */
137
+ async registerProject(body) {
138
+ const landed = async () => {
139
+ const st = await this.projectStatus(body.chainId, body.address).catch(() => null);
140
+ if (!st)
141
+ return undefined; // not there (or the service is truly unreachable) — keep retrying
142
+ return { ok: true, accepted: true, project: { address: body.address, status: st.status } };
143
+ };
144
+ const { status, body: out } = await this.requestWithStatus('POST', '/v1/projects', body, { onTimeout: landed });
145
+ return normalizeRegisterResult(status, out, body.address);
146
+ }
147
+ /**
148
+ * Poll a project's status until it reaches a terminal lifecycle state (`live` or `failed`) — the
149
+ * one implementation of the wait loop, so the CLI, the effects runner, and any hosted agent all
150
+ * behave identically against any provider. `stale` keeps polling: it means lagging, not caught up.
151
+ */
152
+ async awaitIndexed(chainId, address, opts = {}) {
153
+ const timeoutMs = opts.timeoutMs ?? 300_000;
154
+ const intervalMs = opts.intervalMs ?? 3_000;
155
+ const deadline = Date.now() + timeoutMs;
156
+ let last;
157
+ for (;;) {
158
+ last = await this.projectStatus(chainId, address);
159
+ opts.onProgress?.(last);
160
+ if (TERMINAL_INDEX_STATUSES.includes(last.status))
161
+ return last;
162
+ if (Date.now() + intervalMs > deadline) {
163
+ throw new AbxIndexTimeoutError(`${address} was still '${last.status}' after ${Math.round(timeoutMs / 1000)}s — the registration is durable and the service keeps working; check back with \`abx status ${address} --remote\``, last);
164
+ }
165
+ await sleep(intervalMs);
166
+ }
167
+ }
168
+ /** The projects this token may see. */
169
+ async listProjects() {
170
+ const out = (await this.request('GET', '/v1/projects'));
171
+ return out.projects ?? [];
172
+ }
173
+ /** Deregister (remote `abx forget`). `not_registered` means "already gone" — reported, not
174
+ * thrown — but `disabled` still throws: a node that can't accept removals hasn't removed it. */
175
+ async removeProject(chainId, address) {
176
+ try {
177
+ await this.request('DELETE', `/v1/projects/${chainId}/${address}`);
178
+ return { removed: true };
179
+ }
180
+ catch (err) {
181
+ if (err instanceof AbxServiceError && err.code === 'not_registered')
182
+ return { removed: false };
183
+ throw err;
184
+ }
185
+ }
186
+ /** Nudge a re-index. Answers in the same two shapes as {@link registerProject} — a full replay is
187
+ * the *most* likely call to outlive one HTTP request. */
188
+ async reindexProject(chainId, address) {
189
+ const { status, body } = await this.requestWithStatus('POST', `/v1/projects/${chainId}/${address}/reindex`, undefined, {
190
+ onTimeout: async () => {
191
+ const st = await this.projectStatus(chainId, address).catch(() => null);
192
+ return st ? { ok: true, accepted: true, project: { address, status: st.status } } : undefined;
193
+ },
194
+ });
195
+ return normalizeRegisterResult(status, body, address);
196
+ }
197
+ /** Indexing freshness for one project. */
198
+ async projectStatus(chainId, address) {
199
+ return (await this.request('GET', `/v1/projects/${chainId}/${address}/status`));
200
+ }
201
+ /** Publish a render output so a resolver that doesn't share the producer's disk can serve it. */
202
+ async publishEffectArtifact(body) {
203
+ return (await this.request('POST', '/v1/effect-artifacts', body));
204
+ }
205
+ /** Report a run's transient state for the artifact key it is producing. */
206
+ async reportEffectStatus(body) {
207
+ await this.request('POST', '/v1/effect-status', body);
208
+ }
209
+ async request(method, path, body, opts) {
210
+ return (await this.requestWithStatus(method, path, body, opts)).body;
211
+ }
212
+ async requestWithStatus(method, path, body, opts) {
213
+ const attempts = opts?.attempts ?? ATTEMPTS;
214
+ const url = this.baseUrl + path;
215
+ const headers = {};
216
+ if (this.token)
217
+ headers['authorization'] = `Bearer ${this.token}`;
218
+ if (body !== undefined)
219
+ headers['content-type'] = 'application/json';
220
+ let lastFailure = '';
221
+ let lastStatus = 0;
222
+ let lastCode;
223
+ let lastClass;
224
+ for (let attempt = 1; attempt <= attempts; attempt++) {
225
+ let resp;
226
+ try {
227
+ resp = await fetch(url, {
228
+ method,
229
+ headers,
230
+ body: body !== undefined ? JSON.stringify(body) : undefined,
231
+ signal: AbortSignal.timeout(this.timeoutMs),
232
+ });
233
+ }
234
+ catch (err) {
235
+ lastFailure = err.message;
236
+ lastStatus = 0;
237
+ // "We waited the full timeout" and "nothing is listening" are different failures, and for a
238
+ // mutating POST the difference decides whether retrying is safe: the request may still be
239
+ // running on the service. Let the caller check before we hammer it again.
240
+ if (opts?.onTimeout && err.name === 'TimeoutError') {
241
+ const resolved = await opts.onTimeout();
242
+ if (resolved !== undefined)
243
+ return { status: 202, body: resolved };
244
+ }
245
+ if (attempt < attempts)
246
+ await sleep(this.retryDelayMs * attempt);
247
+ continue;
248
+ }
249
+ if (resp.ok) {
250
+ const text = await resp.text();
251
+ return { status: resp.status, body: text ? JSON.parse(text) : {} };
252
+ }
253
+ if (resp.status >= 500 || resp.status === 429) {
254
+ // Retryable — but KEEP the service's own words. A 5xx body carries the actual cause (an
255
+ // exhausted RPC, a misconfigured node); discarding it left the caller with a bare status and
256
+ // nothing to act on, which is the worst kind of error.
257
+ const said = await bodyMessage(resp);
258
+ lastStatus = resp.status;
259
+ lastCode = said.code;
260
+ lastClass = said.class;
261
+ lastFailure = said.error ? `${resp.status} ${said.error}` : `${resp.status} ${resp.statusText}`;
262
+ if (attempt < attempts)
263
+ await sleep(this.retryDelayMs * attempt);
264
+ continue;
265
+ }
266
+ // A genuine 4xx is an answer, not weather — surface the service's own words + code.
267
+ const detail = await bodyMessage(resp);
268
+ throw new AbxServiceError(`${method} ${url}: ${resp.status} ${detail.error ?? resp.statusText}`, {
269
+ status: resp.status,
270
+ code: detail.code,
271
+ class: detail.class,
272
+ url,
273
+ });
274
+ }
275
+ // Retries exhausted. Distinguish "nothing answered" from "it answered, badly" — a 500 is not
276
+ // unreachable, and saying so sends the caller looking for a network problem that isn't there.
277
+ const summary = lastStatus
278
+ ? `service failed after ${attempts} attempt(s) — last response ${lastFailure}`
279
+ : `nothing responded after ${attempts} attempt(s) (${lastFailure})`;
280
+ throw new AbxServiceError(`${method} ${url}: ${summary}`, { status: lastStatus, code: lastCode, class: lastClass, url });
281
+ }
282
+ }
283
+ /** Normalize a register/reindex response: the HTTP status is the authoritative discriminator, and
284
+ * the `accepted` flag is derived from it so callers switch on one field even against a service that
285
+ * doesn't send it. */
286
+ function normalizeRegisterResult(status, out, fallbackAddress) {
287
+ if (status === 202) {
288
+ const r = out;
289
+ return {
290
+ ok: r.ok ?? true,
291
+ accepted: true,
292
+ project: {
293
+ address: r.project?.address ?? fallbackAddress,
294
+ name: r.project?.name ?? null,
295
+ status: r.project?.status ?? 'backfilling',
296
+ },
297
+ };
298
+ }
299
+ return { ...out, accepted: false };
300
+ }
301
+ /** The service's own `{error, code, class?}` from a non-2xx body (never throws — a body may be
302
+ * empty/HTML). `class` is the optional credential-free failure hint. */
303
+ async function bodyMessage(resp) {
304
+ try {
305
+ const parsed = (await resp.json());
306
+ return {
307
+ error: parsed.error,
308
+ code: parsed.code,
309
+ class: parsed.class,
310
+ };
311
+ }
312
+ catch {
313
+ return {};
314
+ }
315
+ }
316
+ function sleep(ms) {
317
+ return new Promise((resolve) => setTimeout(resolve, ms));
318
+ }
319
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,CAAC,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAElE;yFACyF;AACzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAkBlE,yFAAyF;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAA2B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AA2BlF;iFACiF;AACjF,MAAM,oBAAoB,GAAoC;IAC5D,eAAe,EAAE,sCAAsC;IACvD,gBAAgB,EAAE,uCAAuC;IACzD,gBAAgB,EAAE,gDAAgD;IAClE,QAAQ,EAAE,kDAAkD;CAC7D,CAAC;AAEF;4DAC4D;AAC5D,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9E,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAC/B,IAAI,GAAG,GAAoB,UAAU,CAAC;IACtC,IAAI,+EAA+E,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/F,GAAG,GAAG,kBAAkB,CAAC;IAC3B,CAAC;SAAM,IACL,mIAAmI,CAAC,I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,MAAM,IAAI,aAAa;aAC3C;SACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAC,GAAI,GAA8B,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC;AAC/D,CAAC;AASD;yEACyE;AACzE,KAAK,UAAU,WAAW,CAAC,IAAc;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAoD,CAAC;QACtF,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI,EAAE,MAAM,CAAC,IAAoC;YACjD,KAAK,EAAE,MAAM,CAAC,KAAoC;SACnD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artblocks/abx-sdk",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ABX SDK (Layer 2) — the neutral, low-level library that turns protocol operations into typed function calls. No provider, no chain, no UX baked in.",
6
6
  "type": "module",