@settlemint/dalp-sdk 3.1.18 → 3.1.19-main.34482915963

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.
Files changed (104) hide show
  1. package/README.md +156 -169
  2. package/dist/auth/client.d.ts +113 -0
  3. package/dist/auth/live.d.ts +4366 -0
  4. package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +1 -2
  5. package/dist/{auth-wallet-plugins.d.ts → auth/wallet-plugins.d.ts} +69 -5
  6. package/dist/auth.d.ts +22 -115
  7. package/dist/auth.js +329 -0
  8. package/dist/bundler.d.ts +21 -205
  9. package/dist/bundler.js +97 -0
  10. package/dist/chunk-09prmw53.js +4 -0
  11. package/dist/chunk-d0295j58.js +33 -0
  12. package/dist/chunk-eyrzsz8p.js +260 -0
  13. package/dist/chunk-j4sxrfzz.js +54 -0
  14. package/dist/chunk-qvtjb3dz.js +102 -0
  15. package/dist/chunk-rb8k4w3q.js +67 -0
  16. package/dist/chunk-shp8v4ws.js +913 -0
  17. package/dist/chunk-sk9nc2q3.js +10 -0
  18. package/dist/chunk-xp3fx2yt.js +63 -0
  19. package/dist/client/conditional-request.d.ts +30 -0
  20. package/dist/client/factory.d.ts +14 -0
  21. package/dist/client/query-serializer.d.ts +2 -0
  22. package/dist/client/request-compression.d.ts +47 -0
  23. package/dist/client/ssr-fetch.d.ts +12 -0
  24. package/dist/effect.d.ts +78 -0
  25. package/dist/effect.js +87 -0
  26. package/dist/errors/api-error.d.ts +33 -0
  27. package/dist/errors/find-current-error.d.ts +8 -0
  28. package/dist/errors/sdk-error.d.ts +52 -0
  29. package/dist/errors/sdk-error.js +8 -0
  30. package/dist/generated/api-types.d.ts +56950 -0
  31. package/dist/generated/response-scalars.d.ts +9 -0
  32. package/dist/generated/routes.d.ts +12 -0
  33. package/dist/index.d.ts +28 -40
  34. package/dist/index.js +127 -96109
  35. package/dist/proxy/builder.d.ts +47 -0
  36. package/dist/proxy/client.d.ts +32 -0
  37. package/dist/proxy/fetch-executor.d.ts +30 -0
  38. package/dist/proxy/flat-args.d.ts +52 -0
  39. package/dist/proxy/sse.d.ts +75 -0
  40. package/dist/proxy/tanstack.d.ts +27 -0
  41. package/dist/proxy/transport.d.ts +74 -0
  42. package/dist/react-query.d.ts +16 -0
  43. package/dist/react-query.js +12 -0
  44. package/dist/readonly-deep.d.ts +12 -0
  45. package/dist/reads-as-funding-paused.d.ts +20 -0
  46. package/dist/reads-as-indexer-rebuild.d.ts +14 -0
  47. package/dist/routes/index.d.ts +20 -0
  48. package/dist/routes/index.js +10 -0
  49. package/dist/routes/types.d.ts +57 -0
  50. package/dist/runtime-exports.d.ts +20 -0
  51. package/dist/runtime-exports.js +16 -0
  52. package/dist/scalars/big-decimal.d.ts +16 -0
  53. package/dist/scalars/ethereum-address.d.ts +20 -0
  54. package/dist/scalars/exchange-rates.d.ts +27 -0
  55. package/dist/scalars/index.d.ts +18 -0
  56. package/dist/scalars/index.js +86 -0
  57. package/dist/scalars/organization-id.d.ts +20 -0
  58. package/dist/secret.d.ts +14 -0
  59. package/dist/sign-webhook-receipt.d.ts +76 -0
  60. package/dist/sign-webhook-receipt.js +26 -0
  61. package/dist/transport/cookie-store.d.ts +9 -0
  62. package/dist/transport/sse-lifecycle.d.ts +44 -0
  63. package/dist/types.d.ts +69 -102
  64. package/dist/url.d.ts +0 -1
  65. package/dist/verify-webhook.d.ts +17 -28
  66. package/dist/verify-webhook.js +8 -0
  67. package/dist/version.d.ts +0 -1
  68. package/dist/wait-for-transaction.d.ts +66 -79
  69. package/dist/wait-for-transaction.js +142 -0
  70. package/dist/webhook-events.d.ts +44 -27
  71. package/package.json +103 -30
  72. package/dist/auth-permissions.d.ts.map +0 -1
  73. package/dist/auth-wallet-plugins.d.ts.map +0 -1
  74. package/dist/auth.d.ts.map +0 -1
  75. package/dist/bundler.d.ts.map +0 -1
  76. package/dist/chunk-xm8h1dzh.js +0 -33
  77. package/dist/client.d.ts +0 -19
  78. package/dist/client.d.ts.map +0 -1
  79. package/dist/contract-errors.d.ts +0 -4156
  80. package/dist/contract-errors.d.ts.map +0 -1
  81. package/dist/contract.d.ts +0 -17
  82. package/dist/contract.d.ts.map +0 -1
  83. package/dist/cookie-store.d.ts +0 -10
  84. package/dist/cookie-store.d.ts.map +0 -1
  85. package/dist/dapi-errors.d.ts +0 -650
  86. package/dist/dapi-errors.d.ts.map +0 -1
  87. package/dist/errors.d.ts +0 -633
  88. package/dist/errors.d.ts.map +0 -1
  89. package/dist/index.d.ts.map +0 -1
  90. package/dist/platform.d.ts +0 -41
  91. package/dist/platform.d.ts.map +0 -1
  92. package/dist/plugins/index.d.ts +0 -13
  93. package/dist/plugins/index.d.ts.map +0 -1
  94. package/dist/plugins/index.js +0 -10
  95. package/dist/sdk-error.d.ts +0 -74
  96. package/dist/sdk-error.d.ts.map +0 -1
  97. package/dist/serializers.d.ts +0 -41
  98. package/dist/serializers.d.ts.map +0 -1
  99. package/dist/types.d.ts.map +0 -1
  100. package/dist/url.d.ts.map +0 -1
  101. package/dist/verify-webhook.d.ts.map +0 -1
  102. package/dist/version.d.ts.map +0 -1
  103. package/dist/wait-for-transaction.d.ts.map +0 -1
  104. package/dist/webhook-events.d.ts.map +0 -1
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Build the namespaced call surface from the route table.
3
+ *
4
+ * The tree is not emitted as 759 functions. It is a `Proxy` that resolves a
5
+ * node on first access and caches it, so the runtime cost is one closure per
6
+ * route a caller actually touches, and the module stays a few hundred lines
7
+ * regardless of how many routes the platform grows.
8
+ *
9
+ * This module is executor-agnostic on purpose: it imports neither `fetch` nor
10
+ * `effect`. The promise entry and the Effect entry pass their own executor and
11
+ * get the same tree, which is what keeps route behavior from diverging between
12
+ * the two surfaces.
13
+ *
14
+ * @module
15
+ */
16
+ import type { RouteRow, RouteTable } from "../routes/types.ts";
17
+ /** Per-call overrides a caller may pass alongside the request. */
18
+ export interface CallOptions {
19
+ readonly signal?: AbortSignal;
20
+ /** How long the platform holds this write before it answers 202. Ignored on an immediate route. */
21
+ readonly settlementTimeoutMs?: number;
22
+ /**
23
+ * Extra headers for this call. A function is evaluated per request, which is
24
+ * what a retryable write needs: `Idempotency-Key` must be fresh per attempt,
25
+ * and a TanStack mutation binds its options once but fires many times.
26
+ */
27
+ readonly headers?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);
28
+ }
29
+ /** What an interpreter supplies: how to turn a resolved route call into a result. */
30
+ export type Executor = (route: RouteRow, id: string, input: unknown, options: CallOptions | undefined) => unknown;
31
+ /**
32
+ * Members attached to every leaf beside the call itself. A route segment may
33
+ * never take one of these names; the emitter refuses such a declaration.
34
+ */
35
+ export interface LeafExtras {
36
+ readonly queryOptions: (input?: unknown, options?: CallOptions) => unknown;
37
+ readonly mutationOptions: (options?: CallOptions) => unknown;
38
+ }
39
+ /** How an interpreter builds the TanStack factories for one route. */
40
+ export interface LeafFactories {
41
+ readonly queryOptions: (route: RouteRow, id: string, input: unknown, options: CallOptions | undefined) => unknown;
42
+ readonly mutationOptions: (route: RouteRow, id: string, options: CallOptions | undefined) => unknown;
43
+ }
44
+ /** Build the call surface for one executor. */
45
+ export declare function buildProxy(table: RouteTable, executor: Executor, factories: LeafFactories): unknown;
46
+ /** Look one route up by id, for a caller that builds its own command surface. */
47
+ export declare function findRoute(table: RouteTable, id: string): RouteRow | undefined;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The promise call surface.
3
+ *
4
+ * @module
5
+ */
6
+ import type { DalpApi, DalpRouteId, DalpRouteTypes } from "../generated/api-types.d.ts";
7
+ import { type CallOptions } from "./builder.ts";
8
+ import { type CreateDalpClientOptions } from "./transport.ts";
9
+ /** Execute a route by its id, for a caller that builds its own command surface. */
10
+ export interface DalpClient {
11
+ readonly api: DalpApi;
12
+ /** Held conditional-GET bodies. Clear on sign-out and organization switch. */
13
+ readonly conditionalRequests: {
14
+ readonly clear: () => void;
15
+ };
16
+ /**
17
+ * Dispatch by route id. Resolves the decoded body, or, for a
18
+ * `text/event-stream` route, the frame sequence the proxy leaf also returns.
19
+ *
20
+ * Typed against the id, so a command surface built from route ids keeps the
21
+ * request and response types the namespaced tree gives a call site.
22
+ */
23
+ readonly execute: <Id extends DalpRouteId>(routeId: Id, input?: DalpRouteTypes[Id]["request"], options?: CallOptions) => Promise<DalpRouteTypes[Id]["response"]>;
24
+ }
25
+ /**
26
+ * Create the namespaced client.
27
+ *
28
+ * `api` is the proxy tree. `execute` is the same dispatch reached by route id,
29
+ * which is what `kit/cli` uses: its command tree is kubectl-shaped, derived
30
+ * from URL segments, so it never wants the JavaScript namespace tree.
31
+ */
32
+ export declare function createDalpClient(options: CreateDalpClientOptions): DalpClient;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The promise interpreter's executor.
3
+ *
4
+ * Sends the prepared request and resolves the decoded body. A 202 handle is
5
+ * the declared response, so it is handed back rather than followed: its status
6
+ * URL reports lifecycle state, not the route-specific 200 resource, and a
7
+ * caller that swaps one for the other has lost the durable identifier its
8
+ * write is addressed by. How long the platform holds the response before it
9
+ * answers 202 is the caller's to set, through `settlementTimeoutMs`.
10
+ *
11
+ * No response validation. The emitted declarations describe the response and
12
+ * the platform validated it on the way out, so re-checking it here would ship
13
+ * a second copy of every schema to every consumer for no added guarantee.
14
+ *
15
+ * @module
16
+ */
17
+ import type { CallOptions, Executor } from "./builder.ts";
18
+ import { type Transport } from "./transport.ts";
19
+ import type { RouteRow } from "../routes/types.ts";
20
+ /** Send one prepared request. */
21
+ export declare function sendRequest(transport: Transport, route: RouteRow, input: unknown, options: CallOptions | undefined): Promise<unknown>;
22
+ /**
23
+ * Build the executor the proxy calls for every leaf.
24
+ *
25
+ * An SSE route returns its async iterable directly rather than a promise of
26
+ * one, so `for await (const frame of dalp.transaction.statusStream(input))`
27
+ * reads without an intervening await. Awaiting it first is also valid, because
28
+ * awaiting a non-promise is a no-op.
29
+ */
30
+ export declare function createFetchExecutor(transport: Transport): Executor;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Split one flat argument object into the parts an HTTP request needs.
3
+ *
4
+ * The call site names what it means and nothing else:
5
+ *
6
+ * dalp.api.token.transfer({ tokenAddress, transfers })
7
+ *
8
+ * rather than restating the transport at every site as
9
+ * `{ client, path: { tokenAddress }, body: { to, amount } }`. The route table
10
+ * carries the path template's parameter names, so the split is a lookup, and
11
+ * the build refuses any route whose path parameter would collide with a body or
12
+ * query key, which is what makes merging them safe.
13
+ *
14
+ * @module
15
+ */
16
+ import type { RouteRow } from "../routes/types.ts";
17
+ /**
18
+ * One flat call argument, before the route table says which key goes where.
19
+ * Named rather than `Record<string, unknown>` so the unstructured boundary is
20
+ * explicit: this is caller input, not a decoded domain shape.
21
+ */
22
+ /** A JSON value a caller may pass in a flat call argument. */
23
+ export type FlatCallValue = null | boolean | number | string | ReadonlyArray<FlatCallValue> | FlatCallObject;
24
+ /** A nested object inside a flat call argument. */
25
+ export interface FlatCallObject {
26
+ readonly [key: string]: FlatCallValue;
27
+ }
28
+ /**
29
+ * One flat call argument, before the route table says which key goes where.
30
+ * Named rather than left as a bare record so the unstructured boundary is
31
+ * explicit: this is caller input, not a decoded domain shape.
32
+ */
33
+ export type FlatCallInput = FlatCallObject;
34
+ /** The request parts, ready for a URL and a body. */
35
+ export interface SplitArgs {
36
+ readonly path: FlatCallInput;
37
+ readonly query: FlatCallInput;
38
+ readonly body: FlatCallInput | undefined;
39
+ }
40
+ /**
41
+ * Divide `input` into path, query and body according to `route`.
42
+ *
43
+ * A key named in the path template goes to the path. When the declaration
44
+ * carries a payload, a key the route declares as a query parameter goes to the
45
+ * query string and the remaining keys form the JSON body; without a payload
46
+ * every remaining key is a query parameter. The method is not the signal: a
47
+ * DELETE that declares a payload reads it from the body exactly as a POST does,
48
+ * and a GET never declares one.
49
+ */
50
+ export declare function splitFlatArgs(route: RouteRow, input: unknown): SplitArgs;
51
+ /** Substitute path parameters into the route's template. */
52
+ export declare function buildPath(route: RouteRow, path: FlatCallInput): string;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Read a `text/event-stream` route as an async iterable of decoded frames.
3
+ *
4
+ * Ten v2 routes answer with SSE rather than a body, and the route table names
5
+ * them with `serializer: "sse"`. They are the same declaration, the same path
6
+ * builder and the same auth as every other route, so they resolve through the
7
+ * same proxy leaf; only what comes back differs. A caller writes
8
+ * `for await (const frame of dalp.transaction.statusStream({ transactionId }))`.
9
+ *
10
+ * The parser is the wire format and nothing more: `data:` lines accumulate,
11
+ * a blank line dispatches the event, and a comment keeps the connection warm.
12
+ * Retry, backoff and reconnection are deliberately absent. A stream that ends
13
+ * before its terminal frame is a fact the caller has to see, and a reconnect
14
+ * hidden here would replace that fact with a silent gap in the sequence.
15
+ *
16
+ * One event name is not a frame. When a route's stream fails, the server ends
17
+ * it with a block whose `event:` line is the reserved failure name, and whose
18
+ * `data:` line is a serialized description of the failure. The reader raises it
19
+ * as a `DalpApiError`, so a caller sees the failure rather than a frame that
20
+ * looks like a payload and is not one.
21
+ *
22
+ * @module
23
+ */
24
+ import type { CallOptions } from "./builder.ts";
25
+ import type { RouteRow } from "../routes/types.ts";
26
+ import { type Transport } from "./transport.ts";
27
+ /**
28
+ * The event name the Effect HTTP API server writes when a route's stream fails.
29
+ *
30
+ * `HttpApiBuilder` owns the name and keeps it private, so the value is repeated
31
+ * here rather than imported. `tests/unit/effect-client.test.ts` pins it against
32
+ * the literal Effect publishes on its OpenAPI stream metadata.
33
+ */
34
+ export declare const RESERVED_STREAM_FAILURE_EVENT = "effect/httpapi/stream/failure";
35
+ /**
36
+ * The stable code raised when a route ends its stream with the reserved event.
37
+ *
38
+ * Consumers classify on this code, so it lives beside the throw rather than
39
+ * being copied into every reader of the error.
40
+ */
41
+ export declare const STREAM_FAILED_ERROR_CODE = "sdk.stream.FAILED";
42
+ /**
43
+ * Decode a byte stream into dispatched SSE events.
44
+ *
45
+ * @yields Each dispatched event, parsed as JSON when it is JSON.
46
+ * @throws A `DalpApiError` when the route ends the stream with its reserved failure event.
47
+ */
48
+ export declare function decodeEventStream(body: ReadableStream<Uint8Array>): AsyncGenerator<unknown>;
49
+ /**
50
+ * Open one SSE route and yield its frames.
51
+ *
52
+ * The frames come from a generator this function wraps rather than from this
53
+ * function itself, because closing an async generator does not reach its body
54
+ * while a read is in flight. A `return()` on a generator suspended inside
55
+ * `await reader.read()` is QUEUED behind that read, and a route that holds its
56
+ * stream open with nothing left to say never settles it. The close then waits
57
+ * for a frame the route has no reason to send, and it waits forever.
58
+ *
59
+ * That is not a corner case. A consumer stops reading exactly when it has seen
60
+ * what it came for, which is usually before the run it is watching finishes:
61
+ * a screen the operator navigates away from, and a caller that stops at a
62
+ * funding ask it cannot pay. Measured on the gas drill (`aa-subjects` AE5): the
63
+ * lane stopped at the smart-account ask, which by design leaves the token
64
+ * create parked on that ask, and every assertion passed. The scope holding the
65
+ * stream then called `return()`, the parked stream never sent another frame,
66
+ * and the lane failed on its 600 s timeout with the work already done.
67
+ *
68
+ * So the request carries an abort signal this function owns, and the wrapper
69
+ * fires it BEFORE forwarding the close. The read in flight then ends, the
70
+ * generator body runs its own cleanup, and the close resolves. The caller's own
71
+ * signal still aborts the request; it is forwarded into the same controller.
72
+ *
73
+ * @returns The route's frame sequence, in order, closable at any frame.
74
+ */
75
+ export declare function streamRequest(transport: Transport, route: RouteRow, input: unknown, options: CallOptions | undefined): AsyncGenerator<unknown>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * TanStack option factories, on the same proxy nodes as the calls.
3
+ *
4
+ * `dalp.api.token.list.queryOptions({ limit: 25 })` rather than a parallel module of
5
+ * `v2TokenListOptions` functions. The key carries route identity plus
6
+ * canonicalized input, so two callers passing equivalent input in different key
7
+ * order produce the same key and share a cache entry.
8
+ *
9
+ * This module imports no React and no TanStack: it returns plain objects
10
+ * matching the shapes `queryOptions` and `mutationOptions` expect, which keeps
11
+ * `@tanstack/react-query` an optional peer that a non-React consumer never
12
+ * resolves.
13
+ *
14
+ * @module
15
+ */
16
+ import type { LeafFactories } from "./builder.ts";
17
+ import type { Transport } from "./transport.ts";
18
+ /** Sort object keys recursively so equivalent input hashes to one key. */
19
+ export declare function canonicalize(value: unknown): unknown;
20
+ /** The cache key for one call: route identity, then canonical input. */
21
+ export declare function queryKeyFor(id: string, input: unknown): ReadonlyArray<unknown>;
22
+ /**
23
+ * A UI wait shorter than the batch default: a mutation hook holds a spinner for
24
+ * the whole settlement, and two minutes of spinner is not a UI.
25
+ */
26
+ export declare const UI_SETTLEMENT_TIMEOUT_MS = 30000;
27
+ export declare function createTanstackFactories(transport: Transport): LeafFactories;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The request path shared by both interpreters.
3
+ *
4
+ * Everything here already existed as hand-written transport policy around the
5
+ * generated client: body compression, SSR cookie forwarding, the query
6
+ * serializer, the acting-context headers, and the API-key rule. Only the
7
+ * dispatch changed, from 759 emitted functions to one route lookup, so this
8
+ * module composes the same pieces rather than reimplementing them.
9
+ *
10
+ * @module
11
+ */
12
+ import { Secret } from "../secret.ts";
13
+ import { type DalpFetch } from "../client/ssr-fetch.ts";
14
+ import { type ConditionalRequestStore } from "../client/conditional-request.ts";
15
+ import type { RouteRow } from "../routes/types.ts";
16
+ import type { CallOptions } from "./builder.ts";
17
+ export interface DalpClientContext {
18
+ readonly organizationId?: string;
19
+ readonly participant?: string;
20
+ readonly executor?: "eoa" | "smart-wallet";
21
+ readonly chainId?: number | string;
22
+ readonly selectedSigners?: ReadonlyArray<string>;
23
+ readonly idempotencyKey?: string;
24
+ }
25
+ export interface DalpSsrOptions {
26
+ readonly requestHeaders: HeadersInit;
27
+ readonly allowedOrigins?: ReadonlyArray<string | URL>;
28
+ }
29
+ export interface CreateDalpClientOptions {
30
+ readonly baseUrl: string | URL;
31
+ readonly apiKey?: string | Secret;
32
+ readonly context?: DalpClientContext;
33
+ readonly fetch?: DalpFetch;
34
+ readonly runtime?: "browser" | "server";
35
+ readonly ssr?: DalpSsrOptions;
36
+ /** How long the platform holds a queue-backed write before it answers 202. A call may override it. */
37
+ readonly settlementTimeoutMs?: number;
38
+ }
39
+ /** Build per-operation headers which override an instance's default acting context. */
40
+ export declare function createDalpContextHeaders(context: DalpClientContext): Headers;
41
+ /** A prepared request, before it is sent. Both interpreters build the same one. */
42
+ export interface PreparedRequest {
43
+ readonly url: string;
44
+ readonly method: string;
45
+ readonly headers: Headers;
46
+ readonly body: string | undefined;
47
+ }
48
+ /** Everything a request needs that does not come from the call itself. */
49
+ export interface Transport {
50
+ readonly baseUrl: string;
51
+ readonly fetch: DalpFetch;
52
+ readonly credentials: RequestCredentials;
53
+ readonly apiKey: Secret | undefined;
54
+ readonly contextHeaders: Headers;
55
+ /** The wait a queue-backed write asks the platform for, in milliseconds. */
56
+ readonly settlementTimeoutMs: number | undefined;
57
+ /** Held ETag bodies. Clear on sign-out and organization switch. */
58
+ readonly conditionalRequests: ConditionalRequestStore;
59
+ }
60
+ /** Default wait a caller asks the platform to hold before it answers 202. */
61
+ export declare const DEFAULT_PREFER_WAIT_SECONDS = 15;
62
+ export declare function createTransport(options: CreateDalpClientOptions): Transport;
63
+ /**
64
+ * The headers every request of one call carries: the JSON accept, the API key,
65
+ * the acting-context headers, and the caller's own headers on top. The
66
+ * settlement poll that follows a 202 sends the same set, because the status
67
+ * route authenticates exactly like the write that produced the handle; a poll
68
+ * that dropped the caller's session or API key answered 401 mid-settlement.
69
+ */
70
+ export declare function callHeaders(transport: Transport, options: CallOptions | undefined): Headers;
71
+ /** Turn a flat call into the request the route describes. */
72
+ export declare function prepareRequest(transport: Transport, route: RouteRow, input: unknown, options: CallOptions | undefined): PreparedRequest;
73
+ /** Read a response, raising `DalpApiError` on a non-2xx. */
74
+ export declare function readResponse(response: Response): Promise<unknown>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * TanStack Query helpers.
3
+ *
4
+ * The option factories live on the proxy nodes themselves
5
+ * (`dalp.api.token.list.queryOptions({ limit: 25 })`), so this subpath no longer
6
+ * re-exports a parallel module of generated `*Options` functions. What remains
7
+ * is the key derivation, which a consumer needs to invalidate by hand.
8
+ *
9
+ * Nothing here imports `@tanstack/react-query`: the factories return plain
10
+ * objects matching the shapes it expects, which keeps that peer dependency
11
+ * optional for a non-React consumer.
12
+ *
13
+ * @module
14
+ */
15
+ export { canonicalize, queryKeyFor, UI_SETTLEMENT_TIMEOUT_MS } from "./proxy/tanstack.ts";
16
+ export type { CallOptions } from "./proxy/builder.ts";
@@ -0,0 +1,12 @@
1
+ import"./chunk-j4sxrfzz.js";
2
+ import {
3
+ canonicalize2,
4
+ queryKeyFor2,
5
+ UI_SETTLEMENT_TIMEOUT_MS2
6
+ } from "./chunk-shp8v4ws.js";
7
+ import"./chunk-xp3fx2yt.js";
8
+ export {
9
+ UI_SETTLEMENT_TIMEOUT_MS2 as UI_SETTLEMENT_TIMEOUT_MS,
10
+ canonicalize2 as canonicalize,
11
+ queryKeyFor2 as queryKeyFor
12
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A local deep-readonly, exported as a module rather than declared ambiently.
3
+ *
4
+ * An ambient `.d.ts` global compiles inside this workspace but never reaches the
5
+ * tarball, so every emitted declaration that named it referenced a type the
6
+ * consumer could not resolve. Exporting it makes the published declarations
7
+ * self-contained. The repository copy at `@core/schema/deep-readonly` is a
8
+ * private workspace package and must not be imported here.
9
+ */
10
+ export type ReadonlyDeep<T> = T extends string | number | bigint | boolean | symbol | null | undefined | Date | RegExp | Map<unknown, unknown> | Set<unknown> | Promise<unknown> ? T : T extends CallableFunction ? T : T extends object ? {
11
+ readonly [Key in keyof T]: ReadonlyDeep<T[Key]>;
12
+ } : T;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Whether a transaction status row says the write is parked on an operator's
3
+ * gas funding payment.
4
+ *
5
+ * The funding gate holds the queue state of a write it pauses, so `status`
6
+ * does not move while the operator is being asked for money. The open ask,
7
+ * published as `activeRequirement` on the status route and its stream, is the
8
+ * only field that says the write is waiting on a payment rather than on the
9
+ * chain. The wire declares it absent or null when there is no ask.
10
+ */
11
+ export declare function readsAsFundingPaused(status: unknown): boolean;
12
+ /**
13
+ * Longest gap between two status reads of a parked write.
14
+ *
15
+ * A write waiting on a payment moves at the funding gate's own cadence, which
16
+ * grows to minutes, so reading it faster than this learns nothing and costs
17
+ * the status route a request for every parked write on every second of a pause
18
+ * that can last a day.
19
+ */
20
+ export declare const PAUSED_POLL_INTERVAL_MAX_MS = 30000;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Whether a transaction status row says the platform is rebuilding its index
3
+ * of the chain the write landed on.
4
+ *
5
+ * A rebuild replays a chain's whole history, so a write that is already mined
6
+ * cannot be read back until the replay reaches its block. The queue state does
7
+ * not move while that runs, so `indexerRebuild`, published on the status route
8
+ * and its stream, is the only field that says the wait is on the replay rather
9
+ * than on the chain. The wire declares it absent or null when no rebuild runs.
10
+ *
11
+ * A rebuild takes hours, against minutes for a funding pause, so a caller that
12
+ * reads this must widen its own patience rather than report a timeout.
13
+ */
14
+ export declare function readsAsIndexerRebuild(status: unknown): boolean;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The declaration-derived route table, as data.
3
+ *
4
+ * Published beside its types so a consumer that builds its own command surface
5
+ * can resolve a route id without reaching for an interpreter. `kit/cli` walks
6
+ * it to build commands; the dapp facade uses it to prove a facade path names a
7
+ * real route at construction time rather than at the first call.
8
+ *
9
+ * @module
10
+ */
11
+ import { data as routeTable } from "../generated/routes.ts";
12
+ /**
13
+ * Every declared route id, in a stable order.
14
+ *
15
+ * The generated table is keyed by route id, so `keyof` is already the union and
16
+ * no literal assertion is invented here.
17
+ */
18
+ export declare const routeIds: ReadonlyArray<keyof typeof routeTable.routes>;
19
+ export { routeTable };
20
+ export type { ResponseScalarTable, RouteRow, RouteTable } from "./types.ts";
@@ -0,0 +1,10 @@
1
+ import {
2
+ data
3
+ } from "../chunk-09prmw53.js";
4
+
5
+ // src/routes/index.ts
6
+ var routeIds = Object.keys(data.routes).sort();
7
+ export {
8
+ routeIds,
9
+ data as routeTable
10
+ };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The shape of the declaration-derived route table.
3
+ *
4
+ * Mirrors what `packages/dapi/server/tools/route-table.ts` emits. It is
5
+ * restated here rather than imported because the SDK is published and
6
+ * `check-dts-portability` proves the packed declarations reference no private
7
+ * workspace package.
8
+ *
9
+ * @module
10
+ */
11
+ /** One route, as the declaration describes it. */
12
+ export interface RouteRow {
13
+ readonly method: string;
14
+ /** Path template with `:param` segments, unprefixed by the API mount. */
15
+ readonly path: string;
16
+ readonly params: ReadonlyArray<string>;
17
+ readonly successStatuses: ReadonlyArray<number>;
18
+ readonly errorStatuses: ReadonlyArray<number>;
19
+ /**
20
+ * Whether the route can answer with a settlement handle, derived from the
21
+ * declared success statuses rather than from the `settlement` trait.
22
+ */
23
+ readonly queueBacked: boolean;
24
+ readonly settlementTrait: string;
25
+ readonly serializer: string;
26
+ readonly auth: string;
27
+ readonly access: string;
28
+ readonly idempotency: boolean;
29
+ /**
30
+ * Whether the declaration carries a request payload. Non-path keys of a flat
31
+ * call become the JSON body when it does and query parameters when it does
32
+ * not, whatever the method: a DELETE with a payload reads a body.
33
+ */
34
+ readonly hasPayload: boolean;
35
+ /**
36
+ * Path parameters the payload declares again. The flat call names the field
37
+ * once; the split puts it in the path and repeats it in the body.
38
+ */
39
+ readonly bodyParams: ReadonlyArray<string>;
40
+ /**
41
+ * Top-level query parameter names the declaration carries. On a route with a
42
+ * payload the split lifts these keys into the query string before the rest
43
+ * becomes the body; without them every non-path key would be sent as body.
44
+ */
45
+ readonly queryParams: ReadonlyArray<string>;
46
+ /** Request-side scalars, keyed by dotted field path. */
47
+ readonly scalars: Readonly<Record<string, string | undefined>>;
48
+ }
49
+ export interface RouteTable {
50
+ readonly version: 1;
51
+ readonly routes: Readonly<Record<string, RouteRow | undefined>>;
52
+ readonly settlementDisagreements: ReadonlyArray<string>;
53
+ }
54
+ export interface ResponseScalarTable {
55
+ readonly version: 1;
56
+ readonly routes: Readonly<Record<string, Readonly<Record<string, string>> | undefined>>;
57
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Runtime dist files probed by Console `/readyz`.
3
+ *
4
+ * Completeness of the published package is the export graph walked by
5
+ * `kit/sdk/scripts/sdk-dist-artifact-graph.ts`. This list is the smaller boot
6
+ * probe subset. Keep in sync with `kit/dapp/server/sdk-runtime-export-paths.ts`
7
+ * (probe boot must not resolve this package at module evaluation).
8
+ *
9
+ * @module
10
+ */
11
+ /** Relative paths under the `@settlemint/dalp-sdk` package root. */
12
+ export declare const SDK_RUNTIME_EXPORT_RELATIVE_PATHS: readonly ["dist/index.js", "dist/operations.js", "dist/types.js", "dist/index.d.ts", "dist/runtime-exports.js", "dist/runtime-exports.d.ts"];
13
+ /**
14
+ * Type-only published entries. Bun emits a 0-byte JS file for `export type *`
15
+ * modules; the artifact graph accepts it beside a non-empty declaration file.
16
+ */
17
+ export declare const SDK_TYPE_ONLY_EXPORT_RELATIVE_PATHS: readonly ["dist/types.js"];
18
+ export type SdkRuntimeExportRelativePath = (typeof SDK_RUNTIME_EXPORT_RELATIVE_PATHS)[number];
19
+ /** First runtime export — historical single-sentinel alias. */
20
+ export declare const SDK_BUILD_SENTINEL_RELATIVE_PATH: "dist/index.js";
@@ -0,0 +1,16 @@
1
+ // src/runtime-exports.ts
2
+ var SDK_RUNTIME_EXPORT_RELATIVE_PATHS = [
3
+ "dist/index.js",
4
+ "dist/operations.js",
5
+ "dist/types.js",
6
+ "dist/index.d.ts",
7
+ "dist/runtime-exports.js",
8
+ "dist/runtime-exports.d.ts"
9
+ ];
10
+ var SDK_TYPE_ONLY_EXPORT_RELATIVE_PATHS = ["dist/types.js"];
11
+ var [SDK_BUILD_SENTINEL_RELATIVE_PATH] = SDK_RUNTIME_EXPORT_RELATIVE_PATHS;
12
+ export {
13
+ SDK_BUILD_SENTINEL_RELATIVE_PATH,
14
+ SDK_RUNTIME_EXPORT_RELATIVE_PATHS,
15
+ SDK_TYPE_ONLY_EXPORT_RELATIVE_PATHS
16
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * BigDecimal wire scalar: the API encodes arbitrary-precision decimals as plain
3
+ * decimal strings; consumers work with `dnum` values.
4
+ *
5
+ * Both directions live here. Encoding normalizes: `dnum` does not preserve
6
+ * trailing fractional zeros, so `"1.100"` decodes to the same value as `"1.1"`
7
+ * and re-encodes as `"1.1"`.
8
+ *
9
+ * @module
10
+ */
11
+ import type { Dnum } from "dnum";
12
+ export type BigDecimalValue = Dnum;
13
+ /** Read a wire decimal string into a `dnum` value. */
14
+ export declare function decodeBigDecimal(wire: string): BigDecimalValue;
15
+ /** Write a `dnum` value back to its wire form. */
16
+ export declare const encodeBigDecimal: (value: Dnum) => string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * EVM address scalar: accepts checksummed or lowercase wire forms and
3
+ * normalizes to the EIP-55 checksum. The branded type keeps a plain string from
4
+ * passing as a validated address.
5
+ *
6
+ * @module
7
+ */
8
+ export type EthereumAddressValue = string & {
9
+ readonly __brand: "EthereumAddress";
10
+ };
11
+ /** Normalize a wire address to its EIP-55 checksum. */
12
+ export declare function decodeEthereumAddress(wire: string): EthereumAddressValue;
13
+ /**
14
+ * Normalize a wire address, or return nothing when it is not one.
15
+ *
16
+ * UI code frequently reads an address out of unvalidated state and needs a
17
+ * verdict rather than an exception, which is what zod's `safeParse` gave the
18
+ * previous schema-shaped surface.
19
+ */
20
+ export declare function tryDecodeEthereumAddress(wire: unknown): EthereumAddressValue | undefined;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Rich-scalar decoding for the exchange-rates list response.
3
+ *
4
+ * The wire carries a contract-faithful decimal string and a lowercase address.
5
+ * This turns them into a `dnum` amount and a checksummed address. It reads the
6
+ * shape structurally rather than through a schema library: the SDK ships no
7
+ * runtime validator, because the platform validated the body on the way out and
8
+ * a second copy of every schema would reach every consumer for no added
9
+ * guarantee.
10
+ *
11
+ * @module
12
+ */
13
+ import { type BigDecimalValue } from "./big-decimal.ts";
14
+ import { type EthereumAddressValue } from "./ethereum-address.ts";
15
+ export interface ExchangeRateRow {
16
+ readonly rate: BigDecimalValue | null;
17
+ readonly feedAddress: EthereumAddressValue | null;
18
+ readonly [key: string]: unknown;
19
+ }
20
+ export interface ExchangeRatesListResponse {
21
+ readonly data: ReadonlyArray<ExchangeRateRow>;
22
+ readonly [key: string]: unknown;
23
+ }
24
+ /** Decode a list response, converting its scalar columns. */
25
+ export declare function decodeExchangeRatesListResponse(payload: unknown): ExchangeRatesListResponse;
26
+ /** Kept for callers that spread this as a response transformer. */
27
+ export declare const exchangeRatesListTransformer: (data: unknown) => Promise<ExchangeRatesListResponse>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Rich-scalar decoders.
3
+ *
4
+ * The route table names which fields carry a scalar, keyed by dotted path, so a
5
+ * caller applies these where the declaration says a scalar lives rather than
6
+ * guessing from a field name. They are plain functions: the SDK ships no
7
+ * runtime schema library, because the platform validates on the way out.
8
+ *
9
+ * @module
10
+ */
11
+ export { decodeBigDecimal, encodeBigDecimal } from "./big-decimal.ts";
12
+ export type { BigDecimalValue } from "./big-decimal.ts";
13
+ export { decodeEthereumAddress, tryDecodeEthereumAddress } from "./ethereum-address.ts";
14
+ export type { EthereumAddressValue } from "./ethereum-address.ts";
15
+ export { decodeOrganizationId, tryDecodeOrganizationId } from "./organization-id.ts";
16
+ export type { OrganizationIdValue } from "./organization-id.ts";
17
+ export { decodeExchangeRatesListResponse, exchangeRatesListTransformer } from "./exchange-rates.ts";
18
+ export type { ExchangeRateRow, ExchangeRatesListResponse } from "./exchange-rates.ts";