@settlemint/dalp-sdk 3.1.17 → 3.1.18-main.33796544973

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 +154 -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 +14 -207
  9. package/dist/bundler.js +99 -0
  10. package/dist/chunk-18qmk0m7.js +4 -0
  11. package/dist/chunk-def7rqy6.js +946 -0
  12. package/dist/chunk-f4t1bm86.js +67 -0
  13. package/dist/chunk-fjnq61hj.js +11 -0
  14. package/dist/chunk-h12fatty.js +63 -0
  15. package/dist/chunk-r0vsftj4.js +102 -0
  16. package/dist/chunk-rzmr29dq.js +260 -0
  17. package/dist/chunk-x0z79vz6.js +33 -0
  18. package/dist/chunk-y0d2c7kp.js +54 -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 +69 -0
  25. package/dist/effect.js +82 -0
  26. package/dist/errors/api-error.d.ts +29 -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 +41271 -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 +131 -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 +28 -0
  38. package/dist/proxy/flat-args.d.ts +51 -0
  39. package/dist/proxy/settlement.d.ts +67 -0
  40. package/dist/proxy/sse.d.ts +54 -0
  41. package/dist/proxy/tanstack.d.ts +27 -0
  42. package/dist/proxy/transport.d.ts +73 -0
  43. package/dist/react-query.d.ts +16 -0
  44. package/dist/react-query.js +13 -0
  45. package/dist/readonly-deep.d.ts +12 -0
  46. package/dist/reads-as-funding-paused.d.ts +20 -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 +51 -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 +65 -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 +54 -81
  69. package/dist/wait-for-transaction.js +120 -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
+ /** Bounds a queue-backed wait. 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,28 @@
1
+ /**
2
+ * The promise interpreter's executor.
3
+ *
4
+ * Sends the prepared request and resolves the decoded body. A queue-backed
5
+ * route resolves settled or fails: no 202 handle reaches a caller, because a
6
+ * handle is a transport detail the SDK can follow itself and every caller
7
+ * would otherwise re-implement the same poll.
8
+ *
9
+ * No response validation. The emitted declarations describe the response and
10
+ * the platform validated it on the way out, so re-checking it here would ship
11
+ * a second copy of every schema to every consumer for no added guarantee.
12
+ *
13
+ * @module
14
+ */
15
+ import type { CallOptions, Executor } from "./builder.ts";
16
+ import { type Transport } from "./transport.ts";
17
+ import type { RouteRow } from "../routes/types.ts";
18
+ /** Send one prepared request. */
19
+ export declare function sendRequest(transport: Transport, route: RouteRow, input: unknown, options: CallOptions | undefined): Promise<unknown>;
20
+ /**
21
+ * Build the executor the proxy calls for every leaf.
22
+ *
23
+ * An SSE route returns its async iterable directly rather than a promise of
24
+ * one, so `for await (const frame of dalp.transaction.statusStream(input))`
25
+ * reads without an intervening await. Awaiting it first is also valid, because
26
+ * awaiting a non-promise is a no-op.
27
+ */
28
+ export declare function createFetchExecutor(transport: Transport): Executor;
@@ -0,0 +1,51 @@
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. The remaining keys form
44
+ * the JSON body when the declaration carries a payload and the query string
45
+ * when it does not. The method is not the signal: a DELETE that declares a
46
+ * payload reads it from the body exactly as a POST does, and a GET never
47
+ * declares one.
48
+ */
49
+ export declare function splitFlatArgs(route: RouteRow, input: unknown): SplitArgs;
50
+ /** Substitute path parameters into the route's template. */
51
+ export declare function buildPath(route: RouteRow, path: FlatCallInput): string;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Turn a 202 settlement handle into the settled result.
3
+ *
4
+ * A queue-backed route answers one of two ways: a settled 200 when the work
5
+ * finishes inside the `Prefer: wait` window, or a 202 carrying
6
+ * `transactionId`, `status` and `statusUrl` when the wait elapses. Both are the
7
+ * platform's contract, and the handle is the durable one. What every caller
8
+ * would otherwise write is the same poll loop, so the SDK owns it and a
9
+ * mutation resolves settled or fails.
10
+ *
11
+ * The one thing a caller must not lose is the handle. A wait that runs out is
12
+ * not a failed mutation, and reporting it as one would tell a caller their
13
+ * write was rejected when it is still queued. `SettlementTimeoutError` carries
14
+ * `transactionId` and `statusUrl` so the caller can resume the wait through
15
+ * `../wait-for-transaction` or read the status route directly.
16
+ *
17
+ * The bound measures the platform's progress, not the calendar. A write the
18
+ * funding gate has parked on an operator payment is stopped, not slow: the
19
+ * status row reports the open ask as `activeRequirement` on every read, and no
20
+ * progress is expected until the ask is paid. Every read that reports one
21
+ * restarts the bound, so a parked write is never reported as a timeout and a
22
+ * resumed write gets its whole budget back. What ends a pause is the payment
23
+ * arriving or the platform failing the request when the ask lapses, and both
24
+ * reach this loop as status. A caller that cannot wait that long ends the
25
+ * wait through its `signal`. While the write is parked the reads slow down,
26
+ * because the gate resumes it at its own cadence and the status route pays
27
+ * for every read.
28
+ *
29
+ * @module
30
+ */
31
+ import { DalpSdkError } from "../errors/sdk-error.ts";
32
+ import type { CallOptions } from "./builder.ts";
33
+ import { type Transport } from "./transport.ts";
34
+ /**
35
+ * Default bound on how long the SDK follows a handle while the platform is
36
+ * making progress. Time the write spends parked on a funding ask does not
37
+ * count against it.
38
+ */
39
+ export declare const DEFAULT_SETTLEMENT_TIMEOUT_MS = 120000;
40
+ /** Raised when the wait runs out while the work is still queued. */
41
+ export declare class SettlementTimeoutError extends DalpSdkError {
42
+ readonly transactionId: string;
43
+ readonly statusUrl: string;
44
+ constructor(transactionId: string, statusUrl: string, timeoutMs: number);
45
+ }
46
+ /** Raised when the queued work reached a terminal failure. */
47
+ export declare class SettlementFailedError extends DalpSdkError {
48
+ readonly transactionId: string;
49
+ constructor(transactionId: string, state: string, reason: string | undefined);
50
+ }
51
+ /** The 202 body, when the payload is one. */
52
+ export interface SettlementHandle {
53
+ readonly transactionId: string;
54
+ readonly status: string;
55
+ readonly statusUrl: string;
56
+ }
57
+ export declare function readHandle(payload: unknown): SettlementHandle | undefined;
58
+ /**
59
+ * Follow a settlement handle to a terminal state.
60
+ *
61
+ * Returns the settled payload the status route reports. Raises
62
+ * {@link SettlementFailedError} on a terminal failure and
63
+ * {@link SettlementTimeoutError} when the bound elapses first. The bound
64
+ * restarts on every status read that reports an open funding ask, so it never
65
+ * elapses while the write is parked on a payment.
66
+ */
67
+ export declare function resolveSettlement(transport: Transport, payload: unknown, options: CallOptions | undefined, now?: () => number, sleep?: (ms: number) => Promise<void>): Promise<unknown>;
@@ -0,0 +1,54 @@
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
+ * @yields Each frame the route emits, in order.
53
+ */
54
+ 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,73 @@
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
+ /** Default bound on a queue-backed wait. 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
+ readonly settlementTimeoutMs: number | undefined;
56
+ /** Held ETag bodies. Clear on sign-out and organization switch. */
57
+ readonly conditionalRequests: ConditionalRequestStore;
58
+ }
59
+ /** Default wait a caller asks the platform to hold before it answers 202. */
60
+ export declare const DEFAULT_PREFER_WAIT_SECONDS = 15;
61
+ export declare function createTransport(options: CreateDalpClientOptions): Transport;
62
+ /**
63
+ * The headers every request of one call carries: the JSON accept, the API key,
64
+ * the acting-context headers, and the caller's own headers on top. The
65
+ * settlement poll that follows a 202 sends the same set, because the status
66
+ * route authenticates exactly like the write that produced the handle; a poll
67
+ * that dropped the caller's session or API key answered 401 mid-settlement.
68
+ */
69
+ export declare function callHeaders(transport: Transport, options: CallOptions | undefined): Headers;
70
+ /** Turn a flat call into the request the route describes. */
71
+ export declare function prepareRequest(transport: Transport, route: RouteRow, input: unknown, options: CallOptions | undefined): PreparedRequest;
72
+ /** Read a response, raising `DalpApiError` on a non-2xx. */
73
+ 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,13 @@
1
+ import {
2
+ UI_SETTLEMENT_TIMEOUT_MS,
3
+ canonicalize,
4
+ queryKeyFor
5
+ } from "./chunk-def7rqy6.js";
6
+ import"./chunk-fjnq61hj.js";
7
+ import"./chunk-h12fatty.js";
8
+ import"./chunk-y0d2c7kp.js";
9
+ export {
10
+ UI_SETTLEMENT_TIMEOUT_MS,
11
+ canonicalize,
12
+ queryKeyFor
13
+ };
@@ -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,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-18qmk0m7.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,51 @@
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
+ /** Request-side scalars, keyed by dotted field path. */
41
+ readonly scalars: Readonly<Record<string, string | undefined>>;
42
+ }
43
+ export interface RouteTable {
44
+ readonly version: 1;
45
+ readonly routes: Readonly<Record<string, RouteRow | undefined>>;
46
+ readonly settlementDisagreements: ReadonlyArray<string>;
47
+ }
48
+ export interface ResponseScalarTable {
49
+ readonly version: 1;
50
+ readonly routes: Readonly<Record<string, Readonly<Record<string, string>> | undefined>>;
51
+ }
@@ -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; that empty file is valid ESM, so ensure-dist accepts size 0 here.
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>;