@settlemint/dalp-sdk 3.1.18-main.33808370488 → 3.1.18

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 +169 -154
  2. package/dist/{auth/permissions.d.ts → auth-permissions.d.ts} +2 -1
  3. package/dist/auth-permissions.d.ts.map +1 -0
  4. package/dist/{auth/wallet-plugins.d.ts → auth-wallet-plugins.d.ts} +5 -69
  5. package/dist/auth-wallet-plugins.d.ts.map +1 -0
  6. package/dist/auth.d.ts +115 -22
  7. package/dist/auth.d.ts.map +1 -0
  8. package/dist/bundler.d.ts +207 -14
  9. package/dist/bundler.d.ts.map +1 -0
  10. package/dist/chunk-xm8h1dzh.js +33 -0
  11. package/dist/client.d.ts +19 -0
  12. package/dist/client.d.ts.map +1 -0
  13. package/dist/contract-errors.d.ts +4156 -0
  14. package/dist/contract-errors.d.ts.map +1 -0
  15. package/dist/contract.d.ts +17 -0
  16. package/dist/contract.d.ts.map +1 -0
  17. package/dist/cookie-store.d.ts +10 -0
  18. package/dist/cookie-store.d.ts.map +1 -0
  19. package/dist/dapi-errors.d.ts +650 -0
  20. package/dist/dapi-errors.d.ts.map +1 -0
  21. package/dist/errors.d.ts +633 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/index.d.ts +40 -28
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +96109 -131
  26. package/dist/platform.d.ts +41 -0
  27. package/dist/platform.d.ts.map +1 -0
  28. package/dist/plugins/index.d.ts +13 -0
  29. package/dist/plugins/index.d.ts.map +1 -0
  30. package/dist/plugins/index.js +10 -0
  31. package/dist/sdk-error.d.ts +74 -0
  32. package/dist/sdk-error.d.ts.map +1 -0
  33. package/dist/serializers.d.ts +41 -0
  34. package/dist/serializers.d.ts.map +1 -0
  35. package/dist/types.d.ts +102 -65
  36. package/dist/types.d.ts.map +1 -0
  37. package/dist/url.d.ts +1 -0
  38. package/dist/url.d.ts.map +1 -0
  39. package/dist/verify-webhook.d.ts +28 -17
  40. package/dist/verify-webhook.d.ts.map +1 -0
  41. package/dist/version.d.ts +1 -0
  42. package/dist/version.d.ts.map +1 -0
  43. package/dist/wait-for-transaction.d.ts +81 -54
  44. package/dist/wait-for-transaction.d.ts.map +1 -0
  45. package/dist/webhook-events.d.ts +27 -44
  46. package/dist/webhook-events.d.ts.map +1 -0
  47. package/package.json +30 -103
  48. package/dist/auth/client.d.ts +0 -113
  49. package/dist/auth/live.d.ts +0 -4366
  50. package/dist/auth.js +0 -329
  51. package/dist/bundler.js +0 -99
  52. package/dist/chunk-9k284df4.js +0 -4
  53. package/dist/chunk-def7rqy6.js +0 -946
  54. package/dist/chunk-f4t1bm86.js +0 -67
  55. package/dist/chunk-fjnq61hj.js +0 -11
  56. package/dist/chunk-h12fatty.js +0 -63
  57. package/dist/chunk-qp5ty384.js +0 -260
  58. package/dist/chunk-r0vsftj4.js +0 -102
  59. package/dist/chunk-tmk1f2yb.js +0 -33
  60. package/dist/chunk-y0d2c7kp.js +0 -54
  61. package/dist/client/conditional-request.d.ts +0 -30
  62. package/dist/client/factory.d.ts +0 -14
  63. package/dist/client/query-serializer.d.ts +0 -2
  64. package/dist/client/request-compression.d.ts +0 -47
  65. package/dist/client/ssr-fetch.d.ts +0 -12
  66. package/dist/effect.d.ts +0 -69
  67. package/dist/effect.js +0 -82
  68. package/dist/errors/api-error.d.ts +0 -29
  69. package/dist/errors/find-current-error.d.ts +0 -8
  70. package/dist/errors/sdk-error.d.ts +0 -52
  71. package/dist/errors/sdk-error.js +0 -8
  72. package/dist/generated/api-types.d.ts +0 -41271
  73. package/dist/generated/response-scalars.d.ts +0 -9
  74. package/dist/generated/routes.d.ts +0 -12
  75. package/dist/proxy/builder.d.ts +0 -47
  76. package/dist/proxy/client.d.ts +0 -32
  77. package/dist/proxy/fetch-executor.d.ts +0 -28
  78. package/dist/proxy/flat-args.d.ts +0 -51
  79. package/dist/proxy/settlement.d.ts +0 -67
  80. package/dist/proxy/sse.d.ts +0 -54
  81. package/dist/proxy/tanstack.d.ts +0 -27
  82. package/dist/proxy/transport.d.ts +0 -73
  83. package/dist/react-query.d.ts +0 -16
  84. package/dist/react-query.js +0 -13
  85. package/dist/readonly-deep.d.ts +0 -12
  86. package/dist/reads-as-funding-paused.d.ts +0 -20
  87. package/dist/routes/index.d.ts +0 -20
  88. package/dist/routes/index.js +0 -10
  89. package/dist/routes/types.d.ts +0 -51
  90. package/dist/runtime-exports.d.ts +0 -20
  91. package/dist/runtime-exports.js +0 -16
  92. package/dist/scalars/big-decimal.d.ts +0 -16
  93. package/dist/scalars/ethereum-address.d.ts +0 -20
  94. package/dist/scalars/exchange-rates.d.ts +0 -27
  95. package/dist/scalars/index.d.ts +0 -18
  96. package/dist/scalars/index.js +0 -86
  97. package/dist/scalars/organization-id.d.ts +0 -20
  98. package/dist/secret.d.ts +0 -14
  99. package/dist/sign-webhook-receipt.d.ts +0 -76
  100. package/dist/sign-webhook-receipt.js +0 -26
  101. package/dist/transport/cookie-store.d.ts +0 -9
  102. package/dist/transport/sse-lifecycle.d.ts +0 -44
  103. package/dist/verify-webhook.js +0 -8
  104. package/dist/wait-for-transaction.js +0 -120
@@ -1,47 +0,0 @@
1
- import type { DalpFetch } from "./ssr-fetch.ts";
2
- /**
3
- * Request-body compression for DALP server/CLI clients.
4
- *
5
- * Bun 1.4 added a `compress` fetch option: it compresses a buffered body
6
- * before sending and sets `Content-Encoding` on the wire. This wrapper opts
7
- * eligible outgoing bodies into gzip so big JSON payloads shrink in transit;
8
- * the receiving DAPI host decodes them at its boundary
9
- * (`@dapi/server/request-body-decoding`), so callers need no per-route work.
10
- *
11
- * Eligibility mirrors what the transport can actually do:
12
- *
13
- * - Only body-bearing methods (`GET`/`HEAD` never).
14
- * - Bodies already carrying `Content-Encoding`, or an explicit caller
15
- * `compress`, pass through untouched.
16
- * - With `(url, init)` the body must be one of Bun's buffered types
17
- * (string, ArrayBuffer, TypedArray/DataView, Blob) and fall inside the
18
- * size window — gzip framing dominates tiny payloads, and huge explicitly
19
- * sized bodies stay uncompressed (the DAPI decode cap mirrors this bound).
20
- * - Streams, `FormData`, and `URLSearchParams` pass through: the transport
21
- * forwards streaming bodies unchanged.
22
- * - A `Request` instance is measured through a bounded clone before compression.
23
- */
24
- /** Bodies smaller than this stay uncompressed; gzip framing dominates tiny JSON. */
25
- export declare const DALP_SDK_REQUEST_COMPRESSION_MIN_BODY_BYTES = 1024;
26
- /** Explicitly-sized bodies larger than this are sent uncompressed. */
27
- export declare const DALP_SDK_REQUEST_COMPRESSION_MAX_BODY_BYTES = 16777216;
28
- /**
29
- * Bun's `compress` fetch option. bun-types 1.4.0 still types `RequestInit`
30
- * from lib.dom without it, so the field is declared here and set through one
31
- * narrow cast at the transport seam.
32
- */
33
- export type FetchRequestCompression = true | "gzip" | "deflate" | "br" | "zstd";
34
- export interface CompressionRequestInit extends RequestInit {
35
- readonly compress?: FetchRequestCompression;
36
- }
37
- export interface RequestBodyCompressionOptions {
38
- /** Test seam overriding DALP_SDK_REQUEST_COMPRESSION_MIN_BODY_BYTES. */
39
- readonly minBodyBytes?: number;
40
- /** Test seam overriding DALP_SDK_REQUEST_COMPRESSION_MAX_BODY_BYTES. */
41
- readonly maxBodyBytes?: number;
42
- }
43
- /**
44
- * Wrap a fetch seam so eligible request bodies travel gzip-compressed.
45
- * Ineligible calls forward the original arguments untouched.
46
- */
47
- export declare function withRequestBodyCompression(fetchImpl: DalpFetch, options?: RequestBodyCompressionOptions): DalpFetch;
@@ -1,12 +0,0 @@
1
- /** Minimal fetch shape — Bun's `typeof fetch` also requires `preconnect`. */
2
- export type DalpFetch = ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) & {
3
- readonly preconnect?: typeof fetch.preconnect;
4
- };
5
- export interface CreateSsrFetchOptions {
6
- readonly allowedOrigins?: ReadonlyArray<string | URL>;
7
- readonly baseUrl: string | URL;
8
- readonly fetch: DalpFetch;
9
- readonly requestHeaders: HeadersInit;
10
- }
11
- /** Direct destinations must be approved; unapproved redirects lose all caller credentials and context. */
12
- export declare function createSsrFetch(options: CreateSsrFetchOptions): DalpFetch;
package/dist/effect.d.ts DELETED
@@ -1,69 +0,0 @@
1
- /**
2
- * The Effect call surface.
3
- *
4
- * The same namespaced tree as the root entry, returning `Effect` values instead
5
- * of promises. It exists because the CLI and other code under our control want
6
- * Effect, and hiding it behind promises there would mean unwrapping and
7
- * rewrapping at every boundary.
8
- *
9
- * This entry is deliberately absent from `PUBLISHED_ENTRIES` in
10
- * `scripts/check-zero-effect.ts`. That gate walks the import graph from every
11
- * listed entry and fails on any reachable `effect` module, and Bun's transpiler
12
- * reports a type-only import exactly like a value one. Keeping this entry off
13
- * the list is what lets the root stay provably Effect-free while this one uses
14
- * Effect freely.
15
- *
16
- * Errors are tagged from the wire envelope rather than decoded from per-route
17
- * schemas. The envelope is identical across every route (`code`, `status`,
18
- * `message`, and a `data` carrying the stable DALP id), so one reader covers
19
- * 759 routes, and no runtime schema ships.
20
- *
21
- * @module
22
- */
23
- import * as Effect from "effect/Effect";
24
- import type { DalpApi, DalpRouteId, DalpRouteTypes } from "./generated/api-types.d.ts";
25
- import { type CallOptions } from "./proxy/builder.ts";
26
- import { type CreateDalpClientOptions } from "./proxy/transport.ts";
27
- /** The failure channel every route call carries. */
28
- export declare class DalpRequestError extends Error {
29
- readonly _tag = "DalpRequestError";
30
- /** Stable DALP error id when the platform supplied one, else the SDK code. */
31
- readonly id: string;
32
- readonly status: number | undefined;
33
- readonly retryable: boolean;
34
- readonly routeId: string;
35
- constructor(routeId: string, cause: unknown);
36
- }
37
- /** The Effect-shaped mirror of `DalpApi`. */
38
- export type DalpEffectApi = DalpEffectApiNode<DalpApi>;
39
- /**
40
- * A stream leaf answers with its frame sequence rather than one body, so it is
41
- * matched before the promise leaf: its call signature returns an `AsyncIterable`
42
- * and would otherwise fall through to the recursive branch, which maps a call
43
- * signature to an object with no keys and leaves the route uncallable.
44
- */
45
- type DalpEffectApiNode<T> = {
46
- readonly [K in keyof T]: T[K] extends (...args: infer Args) => AsyncIterable<infer Frame> ? (...args: Args) => Effect.Effect<AsyncIterable<Frame>, DalpRequestError> : T[K] extends (...args: infer Args) => Promise<infer A> ? (...args: Args) => Effect.Effect<A, DalpRequestError> : DalpEffectApiNode<T[K]>;
47
- };
48
- /** The routes that answer with `text/event-stream`, named by the route table. */
49
- export type DalpStreamingRouteId = {
50
- [Id in DalpRouteId]: DalpRouteTypes[Id]["streaming"] extends true ? Id : never;
51
- }[DalpRouteId];
52
- export interface DalpEffectClient {
53
- readonly api: DalpEffectApi;
54
- /**
55
- * Two signatures rather than one conditional return type. A caller generic over
56
- * the streaming routes has to resolve the frame sequence from its own
57
- * constraint, and a conditional keyed on `Id` stays unresolved until `Id` is a
58
- * single route, which is what pushed every such caller into an assertion.
59
- */
60
- readonly execute: {
61
- <Id extends DalpStreamingRouteId>(routeId: Id, input?: DalpRouteTypes[Id]["request"], options?: CallOptions): Effect.Effect<AsyncIterable<DalpRouteTypes[Id]["response"]>, DalpRequestError>;
62
- <Id extends DalpRouteId>(routeId: Id, input?: DalpRouteTypes[Id]["request"], options?: CallOptions): Effect.Effect<DalpRouteTypes[Id]["response"], DalpRequestError>;
63
- };
64
- }
65
- /** Create the Effect client. Same routes, same transport, different channel. */
66
- export declare function createDalpEffectClient(options: CreateDalpClientOptions): DalpEffectClient;
67
- export type { CallOptions } from "./proxy/builder.ts";
68
- export type { CreateDalpClientOptions } from "./proxy/transport.ts";
69
- export type { DalpRouteId, DalpRouteTypes } from "./generated/api-types.d.ts";
package/dist/effect.js DELETED
@@ -1,82 +0,0 @@
1
- import {
2
- buildProxy,
3
- findRoute
4
- } from "./chunk-f4t1bm86.js";
5
- import {
6
- DalpApiError,
7
- createTransport,
8
- queryKeyFor,
9
- sendRequest,
10
- streamRequest
11
- } from "./chunk-def7rqy6.js";
12
- import"./chunk-fjnq61hj.js";
13
- import {
14
- data
15
- } from "./chunk-9k284df4.js";
16
- import"./chunk-h12fatty.js";
17
- import"./chunk-y0d2c7kp.js";
18
-
19
- // src/effect.ts
20
- import * as Effect from "effect/Effect";
21
- class DalpRequestError extends Error {
22
- _tag = "DalpRequestError";
23
- id;
24
- status;
25
- retryable;
26
- routeId;
27
- constructor(routeId, cause) {
28
- const api = cause instanceof DalpApiError ? cause : undefined;
29
- super(api?.message ?? `DALP request failed for ${routeId}`, { cause });
30
- this.name = "DalpRequestError";
31
- this._tag = "DalpRequestError";
32
- this.routeId = routeId;
33
- this.id = api?.code ?? "sdk.transport.REQUEST_FAILED";
34
- this.status = api?.status;
35
- this.retryable = api?.retryable ?? true;
36
- }
37
- }
38
- function runRoute(transport, route, id, input, options) {
39
- return Effect.callback((resume) => {
40
- const controller = new AbortController;
41
- const signal = options?.signal ?? controller.signal;
42
- const run = async () => {
43
- try {
44
- resume(Effect.succeed(route.serializer === "sse" ? streamRequest(transport, route, input, { ...options, signal }) : await sendRequest(transport, route, input, { ...options, signal })));
45
- } catch (error) {
46
- resume(Effect.fail(new DalpRequestError(id, error)));
47
- }
48
- };
49
- run();
50
- return Effect.sync(() => {
51
- controller.abort();
52
- });
53
- });
54
- }
55
- function createDalpEffectClient(options) {
56
- const transport = createTransport(options);
57
- const executor = (route, id, input, callOptions) => runRoute(transport, route, id, input, callOptions);
58
- const factories = {
59
- queryOptions: (route, id, input, callOptions) => ({
60
- queryKey: queryKeyFor(id, input),
61
- queryFn: () => runRoute(transport, route, id, input, callOptions)
62
- }),
63
- mutationOptions: (route, id, callOptions) => ({
64
- mutationKey: ["dalp", id],
65
- mutationFn: (input) => runRoute(transport, route, id, input, callOptions)
66
- })
67
- };
68
- return {
69
- api: buildProxy(data, executor, factories),
70
- execute: (routeId, input, callOptions) => {
71
- const route = findRoute(data, routeId);
72
- if (route === undefined) {
73
- return Effect.fail(new DalpRequestError(routeId, new TypeError(`Unknown DALP route \`${routeId}\``)));
74
- }
75
- return runRoute(transport, route, routeId, input, callOptions);
76
- }
77
- };
78
- }
79
- export {
80
- DalpRequestError,
81
- createDalpEffectClient
82
- };
@@ -1,29 +0,0 @@
1
- import { findCurrentError } from "./find-current-error.ts";
2
- export type DalpApiErrorCategory = "client" | "auth" | "permission" | "domain" | "contract" | "dependency" | "operational" | "config" | "unknown";
3
- export interface DalpApiErrorOptions {
4
- readonly message: string;
5
- readonly cause?: unknown;
6
- readonly id?: string;
7
- readonly code: string;
8
- readonly category: DalpApiErrorCategory;
9
- readonly status?: number;
10
- readonly retryable: boolean;
11
- readonly why: string;
12
- readonly fix: string;
13
- readonly retryAfterSeconds?: number;
14
- }
15
- export declare class DalpApiError extends Error {
16
- readonly id?: string;
17
- readonly code: string;
18
- readonly category: DalpApiErrorCategory;
19
- readonly status?: number;
20
- readonly retryable: boolean;
21
- readonly why: string;
22
- readonly fix: string;
23
- readonly retryAfterSeconds?: number;
24
- constructor(options: DalpApiErrorOptions);
25
- static make(options: DalpApiErrorOptions): DalpApiError;
26
- }
27
- export declare const isDalpApiError: (error: unknown) => error is DalpApiError;
28
- export declare const findDalpSdkError: typeof findCurrentError;
29
- export declare const makeDalpApiError: (error: unknown) => DalpApiError;
@@ -1,8 +0,0 @@
1
- import { DalpSdkError } from "./sdk-error.ts";
2
- /**
3
- * Walk a nested SDK error graph and return the first DalpSdkError.
4
- *
5
- * Follows `cause` and `reasons[].error` / `reasons[].defect`. Stops after
6
- * `maxNodes` so a cyclic wrapper cannot loop forever.
7
- */
8
- export declare const findCurrentError: (error: unknown, maxNodes?: number) => DalpSdkError | undefined;
@@ -1,52 +0,0 @@
1
- export interface DalpSdkErrorOptions {
2
- readonly code?: string;
3
- readonly category: string;
4
- readonly status?: number;
5
- readonly retryable: boolean;
6
- readonly message: string;
7
- readonly why: string;
8
- readonly fix: string;
9
- readonly details?: DalpSdkErrorDetails;
10
- readonly retryAfterSeconds?: number;
11
- readonly cause?: unknown;
12
- }
13
- /** JSON-compatible value attached to a serialized SDK error. */
14
- export type DalpSdkJsonValue = null | boolean | number | string | ReadonlyArray<DalpSdkJsonValue> | DalpSdkJsonObject;
15
- /** JSON object attached to a serialized SDK error. */
16
- export interface DalpSdkJsonObject {
17
- readonly [key: string]: DalpSdkJsonValue;
18
- }
19
- export type DalpSdkErrorDetails = DalpSdkJsonObject;
20
- export interface DalpSdkConfigurationErrorInput {
21
- readonly message: string;
22
- readonly why: string;
23
- readonly fix: string;
24
- readonly cause?: unknown;
25
- }
26
- export interface DalpSdkErrorJson {
27
- readonly name: "DalpSdkError";
28
- readonly code: string;
29
- readonly category: string;
30
- readonly status?: number;
31
- readonly retryable: boolean;
32
- readonly message: string;
33
- readonly why: string;
34
- readonly fix: string;
35
- readonly details?: DalpSdkErrorDetails;
36
- readonly retryAfterSeconds?: number;
37
- }
38
- /** SDK-owned configuration or auxiliary-adapter failure. API calls expose route errors directly. */
39
- export declare class DalpSdkError extends Error {
40
- readonly code: string;
41
- readonly category: string;
42
- readonly status?: number;
43
- readonly retryable: boolean;
44
- readonly why: string;
45
- readonly fix: string;
46
- readonly details?: DalpSdkErrorDetails;
47
- readonly retryAfterSeconds?: number;
48
- constructor(options: Readonly<DalpSdkErrorOptions>);
49
- toJSON(): DalpSdkErrorJson;
50
- }
51
- /** Build the one SDK-owned error used for invalid client construction. */
52
- export declare function createDalpSdkConfigurationError(input: Readonly<DalpSdkConfigurationErrorInput>): DalpSdkError;
@@ -1,8 +0,0 @@
1
- import {
2
- DalpSdkError,
3
- createDalpSdkConfigurationError
4
- } from "../chunk-y0d2c7kp.js";
5
- export {
6
- DalpSdkError,
7
- createDalpSdkConfigurationError
8
- };