@settlemint/dalp-sdk 3.1.25 → 3.1.26-main.37116470199

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 (123) hide show
  1. package/README.md +239 -172
  2. package/dist/auth/client.d.ts +103 -0
  3. package/dist/auth/invite-step-up.d.ts +2 -0
  4. package/dist/auth/live.d.ts +47 -0
  5. package/dist/auth/native-passkey.d.ts +9 -0
  6. package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +0 -8
  7. package/dist/{auth-wallet-plugins.d.ts → auth/wallet-plugins.d.ts} +68 -6
  8. package/dist/auth-surface.d.ts +2 -0
  9. package/dist/auth.d.ts +8 -115
  10. package/dist/auth.js +525 -0
  11. package/dist/chunk-4f4kjtt0.js +149 -0
  12. package/dist/chunk-b03ycwb7.js +68 -0
  13. package/dist/chunk-ghgcmyhk.js +5 -0
  14. package/dist/chunk-h241xecg.js +1625 -0
  15. package/dist/chunk-hqz56e6q.js +4 -0
  16. package/dist/chunk-k3ntysxx.js +57 -0
  17. package/dist/chunk-pjjrxre1.js +36 -0
  18. package/dist/chunk-qvtjb3dz.js +102 -0
  19. package/dist/chunk-v54k7mgr.js +271 -0
  20. package/dist/chunk-w361dpdk.js +5 -0
  21. package/dist/client/conditional-request.d.ts +8 -0
  22. package/dist/client/factory.d.ts +4 -0
  23. package/dist/client/query-serializer.d.ts +1 -0
  24. package/dist/client/request-compression.d.ts +12 -0
  25. package/dist/client/ssr-fetch.d.ts +10 -0
  26. package/dist/client/step-up-challenge.d.ts +10 -0
  27. package/dist/effect.d.ts +38 -0
  28. package/dist/effect.js +87 -0
  29. package/dist/errors/api-error.d.ts +35 -0
  30. package/dist/errors/error-codes.d.ts +21 -0
  31. package/dist/errors/find-current-error.d.ts +2 -0
  32. package/dist/errors/sdk-error.d.ts +52 -0
  33. package/dist/errors/sdk-error.js +8 -0
  34. package/dist/generated/api-types.d.ts +69961 -0
  35. package/dist/generated/console-routes.d.ts +12 -0
  36. package/dist/generated/error-catalog.d.ts +9 -0
  37. package/dist/generated/error-codes.d.ts +9 -0
  38. package/dist/generated/response-scalars.d.ts +9 -0
  39. package/dist/generated/response-schemas.d.ts +9 -0
  40. package/dist/generated/route-error-codes.d.ts +9 -0
  41. package/dist/generated/routes.d.ts +12 -0
  42. package/dist/index.d.ts +28 -45
  43. package/dist/index.js +150 -96216
  44. package/dist/proxy/builder.d.ts +17 -0
  45. package/dist/proxy/client-core.d.ts +28 -0
  46. package/dist/proxy/client.d.ts +5 -0
  47. package/dist/proxy/fetch-executor.d.ts +6 -0
  48. package/dist/proxy/flat-args.d.ts +24 -0
  49. package/dist/proxy/response-decode.d.ts +37 -0
  50. package/dist/proxy/sse.d.ts +11 -0
  51. package/dist/proxy/step-up-challenge.d.ts +4 -0
  52. package/dist/proxy/tanstack.d.ts +6 -0
  53. package/dist/proxy/transport.d.ts +63 -0
  54. package/dist/react-query.d.ts +2 -0
  55. package/dist/react-query.js +12 -0
  56. package/dist/readonly-deep.d.ts +3 -0
  57. package/dist/routes/console.d.ts +14 -0
  58. package/dist/routes/console.js +25 -0
  59. package/dist/routes/index.d.ts +4 -0
  60. package/dist/routes/index.js +10 -0
  61. package/dist/routes/types.d.ts +72 -0
  62. package/dist/runtime-exports.d.ts +4 -0
  63. package/dist/runtime-exports.js +16 -0
  64. package/dist/runtime.d.ts +11 -0
  65. package/dist/scalars/big-decimal.d.ts +4 -0
  66. package/dist/scalars/ethereum-address.d.ts +5 -0
  67. package/dist/scalars/exchange-rates.d.ts +13 -0
  68. package/dist/scalars/index.d.ts +10 -0
  69. package/dist/scalars/index.js +102 -0
  70. package/dist/scalars/organization-id.d.ts +5 -0
  71. package/dist/scalars/token-decimals.d.ts +4 -0
  72. package/dist/secret.d.ts +12 -0
  73. package/dist/sign-webhook-receipt.d.ts +16 -0
  74. package/dist/sign-webhook-receipt.js +26 -0
  75. package/dist/transport/cookie-store.d.ts +9 -0
  76. package/dist/transport/sse-lifecycle.d.ts +24 -0
  77. package/dist/types.d.ts +37 -114
  78. package/dist/url.d.ts +0 -1
  79. package/dist/verify-webhook.d.ts +17 -28
  80. package/dist/verify-webhook.js +8 -0
  81. package/dist/version.d.ts +0 -3
  82. package/dist/wait-for-transaction.d.ts +44 -86
  83. package/dist/wait-for-transaction.js +151 -0
  84. package/dist/webhook-events.d.ts +543 -33
  85. package/package.json +110 -34
  86. package/dist/api-types.generated.d.ts +0 -14160
  87. package/dist/api-types.generated.d.ts.map +0 -1
  88. package/dist/auth-permissions.d.ts.map +0 -1
  89. package/dist/auth-wallet-plugins.d.ts.map +0 -1
  90. package/dist/auth.d.ts.map +0 -1
  91. package/dist/bundler.d.ts +0 -217
  92. package/dist/bundler.d.ts.map +0 -1
  93. package/dist/chunk-xm8h1dzh.js +0 -33
  94. package/dist/client.d.ts +0 -19
  95. package/dist/client.d.ts.map +0 -1
  96. package/dist/contract-errors.d.ts +0 -4156
  97. package/dist/contract-errors.d.ts.map +0 -1
  98. package/dist/contract.d.ts +0 -22
  99. package/dist/contract.d.ts.map +0 -1
  100. package/dist/cookie-store.d.ts +0 -10
  101. package/dist/cookie-store.d.ts.map +0 -1
  102. package/dist/dapi-errors.d.ts +0 -654
  103. package/dist/dapi-errors.d.ts.map +0 -1
  104. package/dist/errors.d.ts +0 -637
  105. package/dist/errors.d.ts.map +0 -1
  106. package/dist/index.d.ts.map +0 -1
  107. package/dist/platform.d.ts +0 -41
  108. package/dist/platform.d.ts.map +0 -1
  109. package/dist/plugins/index.d.ts +0 -13
  110. package/dist/plugins/index.d.ts.map +0 -1
  111. package/dist/plugins/index.js +0 -10
  112. package/dist/sdk-error.d.ts +0 -74
  113. package/dist/sdk-error.d.ts.map +0 -1
  114. package/dist/serializers.d.ts +0 -41
  115. package/dist/serializers.d.ts.map +0 -1
  116. package/dist/types.d.ts.map +0 -1
  117. package/dist/url.d.ts.map +0 -1
  118. package/dist/verify-webhook.d.ts.map +0 -1
  119. package/dist/version.d.ts.map +0 -1
  120. package/dist/version.generated.d.ts +0 -8
  121. package/dist/version.generated.d.ts.map +0 -1
  122. package/dist/wait-for-transaction.d.ts.map +0 -1
  123. package/dist/webhook-events.d.ts.map +0 -1
@@ -0,0 +1,4 @@
1
+ import { data as routeTable } from "../generated/routes.ts";
2
+ export declare const routeIds: ReadonlyArray<keyof typeof routeTable.routes>;
3
+ export { routeTable };
4
+ export type { ResponseScalarTable, RouteRow, RouteTable } from "./types.ts";
@@ -0,0 +1,10 @@
1
+ import {
2
+ data2
3
+ } from "../chunk-hqz56e6q.js";
4
+
5
+ // src/routes/index.ts
6
+ var routeIds = Object.keys(data2.routes).sort();
7
+ export {
8
+ routeIds,
9
+ data2 as routeTable
10
+ };
@@ -0,0 +1,72 @@
1
+ export interface RouteRow {
2
+ readonly method: string;
3
+ readonly path: string;
4
+ readonly params: ReadonlyArray<string>;
5
+ readonly successStatuses: ReadonlyArray<number>;
6
+ readonly errorStatuses: ReadonlyArray<number>;
7
+ readonly queueBacked: boolean;
8
+ readonly settlementTrait: string;
9
+ readonly serializer: string;
10
+ readonly auth: string;
11
+ readonly access: string;
12
+ readonly idempotency: boolean;
13
+ readonly hasPayload: boolean;
14
+ readonly bodyParams: ReadonlyArray<string>;
15
+ readonly queryParams: ReadonlyArray<string>;
16
+ readonly scalars: Readonly<Record<string, string | undefined>>;
17
+ }
18
+ export interface RouteTable {
19
+ readonly version: 1;
20
+ readonly routes: Readonly<Record<string, RouteRow | undefined>>;
21
+ readonly settlementDisagreements: ReadonlyArray<string>;
22
+ }
23
+ export interface ErrorCodeTable {
24
+ readonly version: 1;
25
+ readonly codes: ReadonlyArray<string>;
26
+ }
27
+ export interface ErrorCatalogEntry {
28
+ readonly id: string;
29
+ readonly status: number;
30
+ }
31
+ export interface ErrorCatalogTable {
32
+ readonly version: 1;
33
+ readonly entries: Readonly<Record<string, ErrorCatalogEntry>>;
34
+ }
35
+ export interface RouteErrorCodeTable {
36
+ readonly version: 1;
37
+ readonly routes: Readonly<Record<string, ReadonlyArray<number> | undefined>>;
38
+ }
39
+ export interface JsonSchemaNode {
40
+ readonly $ref?: string;
41
+ readonly type?: string | ReadonlyArray<string>;
42
+ readonly properties?: Readonly<Record<string, JsonSchemaNode>>;
43
+ readonly required?: ReadonlyArray<string>;
44
+ readonly additionalProperties?: boolean | JsonSchemaNode;
45
+ readonly propertyNames?: JsonSchemaNode;
46
+ readonly items?: JsonSchemaNode;
47
+ readonly prefixItems?: ReadonlyArray<JsonSchemaNode>;
48
+ readonly anyOf?: ReadonlyArray<JsonSchemaNode>;
49
+ readonly oneOf?: ReadonlyArray<JsonSchemaNode>;
50
+ readonly allOf?: ReadonlyArray<JsonSchemaNode>;
51
+ readonly enum?: ReadonlyArray<unknown>;
52
+ readonly const?: unknown;
53
+ readonly pattern?: string;
54
+ readonly minLength?: number;
55
+ readonly maxLength?: number;
56
+ readonly minimum?: number;
57
+ readonly maximum?: number;
58
+ readonly exclusiveMinimum?: number;
59
+ readonly exclusiveMaximum?: number;
60
+ readonly multipleOf?: number;
61
+ readonly minItems?: number;
62
+ readonly maxItems?: number;
63
+ }
64
+ export interface ResponseSchemaTable {
65
+ readonly version: 1;
66
+ readonly definitions: Readonly<Record<string, JsonSchemaNode>>;
67
+ readonly routes: Readonly<Record<string, Readonly<Record<string, JsonSchemaNode | null>> | undefined>>;
68
+ }
69
+ export interface ResponseScalarTable {
70
+ readonly version: 1;
71
+ readonly routes: Readonly<Record<string, Readonly<Record<string, string>> | undefined>>;
72
+ }
@@ -0,0 +1,4 @@
1
+ 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"];
2
+ export declare const SDK_TYPE_ONLY_EXPORT_RELATIVE_PATHS: readonly ["dist/types.js"];
3
+ export type SdkRuntimeExportRelativePath = (typeof SDK_RUNTIME_EXPORT_RELATIVE_PATHS)[number];
4
+ 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,11 @@
1
+ export type DalpRuntime = "browser" | "server" | "react-native";
2
+ /** @internal */
3
+ export declare function detectDalpRuntime(): DalpRuntime;
4
+ /** @internal */
5
+ export declare function runtimeCredentials(runtime: DalpRuntime): RequestCredentials;
6
+ /** @internal */
7
+ export declare function isBufferingFetch(fetchImpl: unknown): boolean;
8
+ /** @internal */
9
+ export declare function keepBufferingMarker<Wrapper extends object>(wrapped: unknown, wrapper: Wrapper): Wrapper;
10
+ /** @internal */
11
+ export declare function refuseBundledApiKey(runtime: DalpRuntime): void;
@@ -0,0 +1,4 @@
1
+ import type { Dnum } from "dnum";
2
+ export type BigDecimalValue = Dnum;
3
+ export declare function decodeBigDecimal(wire: string): BigDecimalValue;
4
+ export declare const encodeBigDecimal: (value: Dnum) => string;
@@ -0,0 +1,5 @@
1
+ export type EthereumAddressValue = string & {
2
+ readonly __brand: "EthereumAddress";
3
+ };
4
+ export declare function decodeEthereumAddress(wire: string): EthereumAddressValue;
5
+ export declare function tryDecodeEthereumAddress(wire: unknown): EthereumAddressValue | undefined;
@@ -0,0 +1,13 @@
1
+ import { type BigDecimalValue } from "./big-decimal.ts";
2
+ import { type EthereumAddressValue } from "./ethereum-address.ts";
3
+ export interface ExchangeRateRow {
4
+ readonly rate: BigDecimalValue | null;
5
+ readonly feedAddress: EthereumAddressValue | null;
6
+ readonly [key: string]: unknown;
7
+ }
8
+ export interface ExchangeRatesListResponse {
9
+ readonly data: ReadonlyArray<ExchangeRateRow>;
10
+ readonly [key: string]: unknown;
11
+ }
12
+ export declare function decodeExchangeRatesListResponse(payload: unknown): ExchangeRatesListResponse;
13
+ export declare const exchangeRatesListTransformer: (data: unknown) => Promise<ExchangeRatesListResponse>;
@@ -0,0 +1,10 @@
1
+ export { decodeBigDecimal, encodeBigDecimal } from "./big-decimal.ts";
2
+ export type { BigDecimalValue } from "./big-decimal.ts";
3
+ export { decodeTokenDecimals } from "./token-decimals.ts";
4
+ export type { TokenDecimals } from "./token-decimals.ts";
5
+ export { decodeEthereumAddress, tryDecodeEthereumAddress } from "./ethereum-address.ts";
6
+ export type { EthereumAddressValue } from "./ethereum-address.ts";
7
+ export { decodeOrganizationId, tryDecodeOrganizationId } from "./organization-id.ts";
8
+ export type { OrganizationIdValue } from "./organization-id.ts";
9
+ export { decodeExchangeRatesListResponse, exchangeRatesListTransformer } from "./exchange-rates.ts";
10
+ export type { ExchangeRateRow, ExchangeRatesListResponse } from "./exchange-rates.ts";
@@ -0,0 +1,102 @@
1
+ import {
2
+ DalpSdkError2
3
+ } from "../chunk-k3ntysxx.js";
4
+
5
+ // src/scalars/big-decimal.ts
6
+ import * as dn from "dnum";
7
+ var DECIMAL_WIRE = /^-?\d+(?:\.\d+)?$/u;
8
+ function decodeBigDecimal(wire) {
9
+ if (!DECIMAL_WIRE.test(wire)) {
10
+ throw new DalpSdkError2({
11
+ code: "sdk.scalar.BIG_DECIMAL_INVALID",
12
+ category: "sdk.configuration",
13
+ retryable: false,
14
+ message: `\`${wire}\` is not a plain decimal string.`,
15
+ why: "A BigDecimal field carries an unscaled decimal, with no exponent and no separators.",
16
+ fix: "Pass the value exactly as the API returned it."
17
+ });
18
+ }
19
+ return dn.from(wire);
20
+ }
21
+ var encodeBigDecimal = (value) => dn.toString(value);
22
+ // src/scalars/token-decimals.ts
23
+ function decodeTokenDecimals(wire) {
24
+ const value = typeof wire === "string" && /^\d+$/u.test(wire) ? Number(wire) : wire;
25
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > 18) {
26
+ throw new DalpSdkError2({
27
+ code: "sdk.scalar.TOKEN_DECIMALS_INVALID",
28
+ category: "sdk.configuration",
29
+ retryable: false,
30
+ message: "Token decimals are missing or outside the range 0–18.",
31
+ why: "An ERC-20 token scale is a whole number from 0 through 18.",
32
+ fix: "Pass the decimals field exactly as the API returned it."
33
+ });
34
+ }
35
+ return value;
36
+ }
37
+ // src/scalars/ethereum-address.ts
38
+ import { getAddress, isAddress } from "viem/utils";
39
+ function decodeEthereumAddress(wire) {
40
+ if (!isAddress(wire, { strict: false })) {
41
+ throw new DalpSdkError2({
42
+ code: "sdk.scalar.EVM_ADDRESS_INVALID",
43
+ category: "sdk.configuration",
44
+ retryable: false,
45
+ message: `\`${wire}\` is not an EVM address.`,
46
+ why: "An EVM address is 42 characters starting with 0x.",
47
+ fix: "Pass the address exactly as the API returned it."
48
+ });
49
+ }
50
+ return getAddress(wire);
51
+ }
52
+ function tryDecodeEthereumAddress(wire) {
53
+ if (typeof wire !== "string" || !isAddress(wire, { strict: false })) {
54
+ return;
55
+ }
56
+ return getAddress(wire);
57
+ }
58
+ // src/scalars/organization-id.ts
59
+ function decodeOrganizationId(wire) {
60
+ if (wire.length === 0) {
61
+ throw new DalpSdkError2({
62
+ code: "sdk.scalar.ORGANIZATION_ID_INVALID",
63
+ category: "sdk.configuration",
64
+ retryable: false,
65
+ message: "An organization id cannot be empty.",
66
+ why: "The organization id scopes every tenant-owned request.",
67
+ fix: "Pass the id the platform returned for the active organization."
68
+ });
69
+ }
70
+ return wire;
71
+ }
72
+ function tryDecodeOrganizationId(wire) {
73
+ return typeof wire === "string" && wire.length > 0 ? wire : undefined;
74
+ }
75
+ // src/scalars/exchange-rates.ts
76
+ function decodeRow(row) {
77
+ const source = row !== null && typeof row === "object" ? row : { rate: null, feedAddress: null };
78
+ const rate = Reflect.get(source, "rate");
79
+ const feedAddress = Reflect.get(source, "feedAddress");
80
+ return {
81
+ ...source,
82
+ rate: typeof rate === "string" ? decodeBigDecimal(rate) : null,
83
+ feedAddress: typeof feedAddress === "string" ? decodeEthereumAddress(feedAddress) : null
84
+ };
85
+ }
86
+ function decodeExchangeRatesListResponse(payload) {
87
+ const source = payload !== null && typeof payload === "object" ? payload : { data: [] };
88
+ const rows = Reflect.get(source, "data");
89
+ return { ...source, data: Array.isArray(rows) ? rows.map(decodeRow) : [] };
90
+ }
91
+ var exchangeRatesListTransformer = async (data) => decodeExchangeRatesListResponse(data);
92
+ export {
93
+ decodeBigDecimal,
94
+ decodeEthereumAddress,
95
+ decodeExchangeRatesListResponse,
96
+ decodeOrganizationId,
97
+ decodeTokenDecimals,
98
+ encodeBigDecimal,
99
+ exchangeRatesListTransformer,
100
+ tryDecodeEthereumAddress,
101
+ tryDecodeOrganizationId
102
+ };
@@ -0,0 +1,5 @@
1
+ export type OrganizationIdValue = string & {
2
+ readonly __brand: "OrganizationId";
3
+ };
4
+ export declare function decodeOrganizationId(wire: string): OrganizationIdValue;
5
+ export declare function tryDecodeOrganizationId(wire: unknown): OrganizationIdValue | undefined;
@@ -0,0 +1,4 @@
1
+ export type TokenDecimals = number & {
2
+ readonly __brand: "TokenDecimals";
3
+ };
4
+ export declare function decodeTokenDecimals(wire: string | number | undefined): TokenDecimals;
@@ -0,0 +1,12 @@
1
+ export declare const SECRET_REDACTION_MARKER = "[REDACTED]";
2
+ declare const inspectSymbol: unique symbol;
3
+ export declare class Secret {
4
+ private constructor();
5
+ static from(value: string): Secret;
6
+ toString(): string;
7
+ toJSON(): string;
8
+ [inspectSymbol](): string;
9
+ }
10
+ export declare const secret: (value: string) => Secret;
11
+ export declare const unwrapSecret: (value: Secret) => string;
12
+ export {};
@@ -0,0 +1,16 @@
1
+ export declare const RECEIPT_SIGNING_SCHEME = "dalp.whr.v1";
2
+ export interface ReceiptSigningTuple {
3
+ deliveryId: string;
4
+ endpointId: string;
5
+ evtId: string;
6
+ innerEventHash: string;
7
+ }
8
+ export interface SignWebhookReceiptInput extends ReceiptSigningTuple {
9
+ secret: string;
10
+ }
11
+ export declare function buildReceiptSigningString(tuple: Readonly<ReceiptSigningTuple>): string;
12
+ export declare function signWebhookReceipt({ secret, ...tuple }: Readonly<SignWebhookReceiptInput>): string;
13
+ export interface VerifyWebhookReceiptInput extends SignWebhookReceiptInput {
14
+ readonly signature: string;
15
+ }
16
+ export declare function verifyWebhookReceipt({ signature, ...input }: Readonly<VerifyWebhookReceiptInput>): boolean;
@@ -0,0 +1,26 @@
1
+ import {
2
+ toStandardWebhookSecret2
3
+ } from "./chunk-qvtjb3dz.js";
4
+
5
+ // src/sign-webhook-receipt.ts
6
+ import { createHmac, timingSafeEqual } from "node:crypto";
7
+ var RECEIPT_SIGNING_SCHEME = "dalp.whr.v1";
8
+ function buildReceiptSigningString(tuple) {
9
+ return [RECEIPT_SIGNING_SCHEME, tuple.deliveryId, tuple.endpointId, tuple.evtId, tuple.innerEventHash].join(`
10
+ `);
11
+ }
12
+ function signWebhookReceipt({ secret, ...tuple }) {
13
+ const key = Buffer.from(toStandardWebhookSecret2(secret), "base64");
14
+ return createHmac("sha256", key).update(buildReceiptSigningString(tuple), "utf8").digest("hex");
15
+ }
16
+ function verifyWebhookReceipt({ signature, ...input }) {
17
+ const expected = Buffer.from(signWebhookReceipt(input), "hex");
18
+ const received = Buffer.from(signature, "hex");
19
+ return expected.length === received.length && timingSafeEqual(expected, received);
20
+ }
21
+ export {
22
+ RECEIPT_SIGNING_SCHEME,
23
+ buildReceiptSigningString,
24
+ signWebhookReceipt,
25
+ verifyWebhookReceipt
26
+ };
@@ -0,0 +1,9 @@
1
+ export type CookieStoreFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
2
+ export interface CookieStoreShape {
3
+ readonly header: () => string;
4
+ readonly isEmpty: () => boolean;
5
+ readonly setCookieHeader: (header: string) => void;
6
+ readonly storeSetCookieHeaders: (headers: ReadonlyArray<string>) => void;
7
+ }
8
+ export declare function makeCookieStore(initialHeader?: string): CookieStoreShape;
9
+ export declare function createCookieStoreFetch(cookieStore: CookieStoreShape, fetchImpl?: CookieStoreFetch): CookieStoreFetch;
@@ -0,0 +1,24 @@
1
+ export type SseEventDisposition = "continue" | "success" | "failure";
2
+ export interface SseStreamResult<T> {
3
+ readonly stream: AsyncIterable<T>;
4
+ }
5
+ export interface SseLifecycleOptions<T> {
6
+ readonly connect: (signal: AbortSignal) => Promise<SseStreamResult<T>>;
7
+ readonly classify: (event: T) => SseEventDisposition;
8
+ readonly signal?: AbortSignal;
9
+ readonly onEvent?: (event: T) => void;
10
+ readonly maxReconnects?: number;
11
+ readonly reconnectWindowMs?: number;
12
+ readonly healthyConnectionMs?: number;
13
+ readonly initialBackoffMs?: number;
14
+ readonly maxBackoffMs?: number;
15
+ readonly sleep?: (milliseconds: number) => Promise<void>;
16
+ readonly now?: () => number;
17
+ }
18
+ export type SseLifecycleFailureReason = "aborted" | "terminal-failure" | "transport-failure";
19
+ export declare class SseLifecycleError<T = unknown> extends Error {
20
+ readonly reason: SseLifecycleFailureReason;
21
+ readonly lastEvent?: T;
22
+ constructor(reason: SseLifecycleFailureReason, lastEvent?: T, options?: ErrorOptions);
23
+ }
24
+ export declare function consumeSseUntilTerminal<T>(options: SseLifecycleOptions<T>): Promise<T>;
package/dist/types.d.ts CHANGED
@@ -1,115 +1,38 @@
1
- /**
2
- * Type-only exports for the DALP SDK.
3
- *
4
- * Import from `@settlemint/dalp-sdk/types` when you only need types
5
- * (e.g., for function signatures) without pulling in runtime code.
6
- *
7
- * Related: kit/sdk/src/client.ts
8
- *
9
- * @module
10
- */
11
- import type { DalpApi } from "./api-types.generated.js";
12
- /**
13
- * Fully typed DALP API client.
14
- *
15
- * The shapes come from `./api-types.generated.ts` rather than from the contract
16
- * router's inferred type. A declaration that names the contract cannot be
17
- * published: `@dalp/api-contract` is private, and the inferred type does not
18
- * survive declaration emit at all (`TS7056` on the larger route files). See
19
- * `./contract.ts`.
20
- *
21
- * Response values carry the wire representation, so a `bigint` field reads as a
22
- * decimal string and a timestamp as an ISO string. The client serializes on the
23
- * way out but does not decode on the way back, so a request may pass either the
24
- * native value or its string form.
25
- *
26
- * Provides auto-completed access to all v2 API namespaces:
27
- * `account`, `actions`, `addons`, `admin`, `contacts`, `exchangeRates`,
28
- * `externalToken`, `identityRecovery`, `monitoring`, `search`,
29
- * `settings`, `system`, `token`, `transaction`, `user`.
30
- */
31
- export type DalpClient = DalpApi;
32
- /**
33
- * Per-call client context threaded into individual SDK operations as the second
34
- * argument, e.g. `client.token.create(input, { context: { idempotencyKey } })`.
35
- * Every field is optional and scoped to the single call, unlike the client-level
36
- * {@link BaseDalpClientConfig.idempotencyKey} which applies to every request.
37
- */
38
- export interface DalpClientCallContext {
39
- /**
40
- * Idempotency key sent as the `Idempotency-Key` header for this call only,
41
- * overriding any client-level key. Use a fresh value per genuine retry of a
42
- * failed mutation: dapi burns the key of a failed transaction, so re-sending
43
- * under the same key is rejected ("previously failed. Use a new idempotency
44
- * key to retry"). A stable value within one logical attempt keeps network-level
45
- * fetch retries deduplicated.
46
- */
47
- idempotencyKey?: string;
48
- /**
49
- * oRPC error codes the caller treats as expected for this call and does not
50
- * want surfaced by its own error logging (e.g. an existence probe that accepts
51
- * `NOT_FOUND`). A client-side hint scoped to the single call; it is not sent to
52
- * the server.
53
- */
54
- skipLoggingFor?: readonly string[];
1
+ import type { AssumableParticipant, JoinableParticipant, JoinableProvider, EvmAddress, TokenTopicScheme, TokenTrustedIssuer, EvmUserEventV2Item, UserEventV2Item, UserMe, party_multisigDrafts_issueInvite_Response, party_topicSchemes_addForToken_Request, party_trustedIssuers_addForToken_Request, party_users_events_Response, platform_settings_settingsThemeUploadLogo_Request, token_create_Request, token_documents_getUploadUrl_Request, token_features_list_Response, system_feeds_issuerSigned_create_Request } from "./generated/api-types.d.ts";
2
+ export type ParticipantKind = "person" | "company" | "fund" | "spv" | "department" | "joint_account" | "asset" | "organisation" | "claim_issuer" | "addon";
3
+ export type ParticipantAddressPurpose = "transfer" | "identity" | "participant";
4
+ export interface EligibleForTokenFilter {
5
+ readonly tokenAddress: EvmAddress;
6
+ readonly action: "mint" | "transfer" | "burn";
7
+ readonly reveal?: boolean;
55
8
  }
56
- interface BaseDalpClientConfig {
57
- /** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
58
- url: string;
59
- /**
60
- * Organization ID for multi-tenant setups.
61
- * Required when the API key is scoped to multiple organizations.
62
- */
63
- organizationId?: string;
64
- /**
65
- * Additional headers merged into every request.
66
- * Accepts a static object or a (possibly async) function for dynamic headers.
67
- * Can override defaults like `User-Agent` but cannot override security headers (`x-api-key`, `x-organization-id`).
68
- */
69
- headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
70
- /**
71
- * Validate outgoing requests against the contract before sending.
72
- * Catches schema violations client-side for faster feedback.
73
- * @defaultValue false
74
- */
75
- requestValidation?: boolean;
76
- /**
77
- * Validate incoming responses against the contract.
78
- * Useful during development to catch API drift.
79
- * @defaultValue false
80
- */
81
- responseValidation?: boolean;
82
- /**
83
- * Custom `fetch` implementation.
84
- * Use this to inject logging, proxy configuration, or test doubles.
85
- */
86
- fetch?: typeof globalThis.fetch;
87
- /**
88
- * Idempotency key sent as the `Idempotency-Key` header on every request.
89
- *
90
- * **Warning:** This value is sent on _every_ request made by the client.
91
- * If you reuse the same client instance for multiple mutations, the server
92
- * will deduplicate all but the first — subsequent mutations silently return
93
- * the first response. Only set this when the client is used for a single
94
- * mutation (e.g., a one-shot script). For multi-mutation workflows, set the
95
- * header per-request via the `headers` callback instead.
96
- *
97
- * When omitted, no idempotency key header is sent.
98
- */
99
- idempotencyKey?: string;
100
- }
101
- /**
102
- * Configuration for creating an authenticated DALP API client.
103
- */
104
- export interface DalpClientConfig extends BaseDalpClientConfig {
105
- /** API key for authenticated routes (issued via the DALP dashboard or CLI). */
106
- apiKey: string;
107
- }
108
- /**
109
- * Configuration for creating a public DALP API client.
110
- */
111
- export interface PublicDalpClientConfig extends BaseDalpClientConfig {
112
- apiKey?: undefined;
113
- }
114
- export type { WalletAuthEndpointPath } from "./auth-wallet-plugins.js";
115
- //# sourceMappingURL=types.d.ts.map
9
+ export type JoinableParticipantOption = JoinableParticipant;
10
+ export type JoinableProviderOption = JoinableProvider;
11
+ export type ActAvailability = AssumableParticipant["actAvailability"];
12
+ export type OnboardingState = UserMe["onboardingState"];
13
+ export type UserEvent = UserEventV2Item;
14
+ export type EvmUserEvent = EvmUserEventV2Item;
15
+ export type UserEventCollectionResponse = party_users_events_Response;
16
+ export type UserEventValue = NonNullable<EvmUserEvent["values"]>[number];
17
+ export type TokenTopicSchemeInheritanceLevel = TokenTopicScheme["inheritanceLevel"];
18
+ export type TokenTrustedIssuerInheritanceLevel = TokenTrustedIssuer["inheritanceLevel"];
19
+ export type TokenTopicSchemeCreateInput = party_topicSchemes_addForToken_Request;
20
+ export type TokenTrustedIssuerCreateInput = party_trustedIssuers_addForToken_Request;
21
+ export type MultisigDraftCreateInviteOutput = party_multisigDrafts_issueInvite_Response;
22
+ export type IssuerSignedCreateInput = system_feeds_issuerSigned_create_Request;
23
+ export type ThemeLogoMode = platform_settings_settingsThemeUploadLogo_Request["mode"];
24
+ type AttachedTokenFeature = token_features_list_Response["data"][number];
25
+ type AttachedTokenFeatureConfig<Name extends AttachedTokenFeature["name"]> = NonNullable<Extract<AttachedTokenFeature, {
26
+ readonly name: Name;
27
+ }>["config"]>;
28
+ export type TokenFeatureHistoricalBalancesConfig = AttachedTokenFeatureConfig<"historical-balances">;
29
+ export type TokenFeatureMaturityRedemptionConfig = AttachedTokenFeatureConfig<"maturity-redemption">;
30
+ export type TokenFeatureFixedTreasuryYieldConfig = AttachedTokenFeatureConfig<"fixed-treasury-yield">;
31
+ export type TokenFeatureDividendYieldConfig = AttachedTokenFeatureConfig<"dividend-yield">;
32
+ export type TokenFeatureInterestYieldConfig = AttachedTokenFeatureConfig<"interest-yield">;
33
+ export type TokenFeatureTransactionFeeConfig = AttachedTokenFeatureConfig<"transaction-fee">;
34
+ export type TokenFeatureTransactionFeeAccountingConfig = AttachedTokenFeatureConfig<"transaction-fee-accounting">;
35
+ export type TokenFeatureExternalTransactionFeeConfig = AttachedTokenFeatureConfig<"external-transaction-fee">;
36
+ export type TokenDocumentMimeType = token_documents_getUploadUrl_Request["mimeType"];
37
+ export type TokenCreateInput = token_create_Request;
38
+ export type * from "./generated/api-types.d.ts";
package/dist/url.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export declare function normalizeDalpBaseUrl(url: string): string;
2
- //# sourceMappingURL=url.d.ts.map
@@ -1,34 +1,23 @@
1
- import type { Webhook } from "./webhook-events.js";
2
- export type WebhookVerificationFailure = "TIMESTAMP_SKEW" | "SECRET_MISMATCH" | "BODY_HASH_MISMATCH";
1
+ import type { Webhook } from "./webhook-events.ts";
2
+ export type WebhookVerificationFailure = "TIMESTAMP_SKEW" | "SECRET_MISMATCH" | "BODY_HASH_MISMATCH" | "REPLAYED_EVENT" | "MALFORMED_BODY" | "REPLAY_STORE_FAILURE";
3
3
  export type WebhookVerificationResult = {
4
- ok: true;
5
- event: Webhook.Event;
4
+ readonly ok: true;
5
+ readonly event: Webhook.Event;
6
6
  } | {
7
- ok: false;
8
- code: WebhookVerificationFailure;
7
+ readonly ok: false;
8
+ readonly code: WebhookVerificationFailure;
9
9
  };
10
+ export interface WebhookReplayStore {
11
+ readonly has: (eventId: string) => boolean | Promise<boolean>;
12
+ readonly add: (eventId: string) => void | Promise<void>;
13
+ }
10
14
  export interface VerifyWebhookInput {
11
- rawBody: string | Uint8Array;
12
- headers: Headers | Record<string, string | string[] | undefined>;
13
- secret: string | readonly string[];
15
+ readonly rawBody: string | Uint8Array;
16
+ readonly headers: Headers | Record<string, string | ReadonlyArray<string> | undefined>;
17
+ readonly secret: string | ReadonlyArray<string>;
18
+ readonly replayStore?: WebhookReplayStore;
19
+ readonly now?: number | Date;
20
+ readonly timestampToleranceSeconds?: number;
14
21
  }
15
- /**
16
- * Strip the `dalp_whsk_` family prefix from a DALP signing secret.
17
- *
18
- * The Standard Webhooks library expects the bare secret material; DALP
19
- * adds the prefix for parity with the `sm_dalp_` API-key family. Both
20
- * the dispatcher (DALP-side) and any verifier (DALP or consumer) must
21
- * call this before constructing a `new Webhook(...)` instance, otherwise
22
- * the HMAC inputs differ on the two ends and every signature mismatches.
23
- */
24
22
  export declare function toStandardWebhookSecret(secret: string): string;
25
- /**
26
- * Verifies a DALP webhook signature and returns the typed event union.
27
- *
28
- * Use the returned lifecycle state and `supersedes` accessor to reconcile
29
- * cached DAPI mutation responses with later on-chain outcomes.
30
- *
31
- * @see ../../kit/docs/content/events/idempotency-and-on-chain-outcome.mdx
32
- */
33
- export declare function verifyWebhook({ rawBody, headers, secret }: VerifyWebhookInput): WebhookVerificationResult;
34
- //# sourceMappingURL=verify-webhook.d.ts.map
23
+ export declare function verifyWebhook(input: VerifyWebhookInput): Promise<WebhookVerificationResult>;
@@ -0,0 +1,8 @@
1
+ import {
2
+ toStandardWebhookSecret2,
3
+ verifyWebhook2
4
+ } from "./chunk-qvtjb3dz.js";
5
+ export {
6
+ toStandardWebhookSecret2 as toStandardWebhookSecret,
7
+ verifyWebhook2 as verifyWebhook
8
+ };
package/dist/version.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- /** Semver version of the published SDK package. */
2
1
  export declare const SDK_VERSION: string;
3
- /** Default User-Agent header sent with every SDK request. */
4
2
  export declare const SDK_USER_AGENT: string;
5
- //# sourceMappingURL=version.d.ts.map