@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,86 @@
1
+ import {
2
+ DalpSdkError2
3
+ } from "../chunk-j4sxrfzz.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/ethereum-address.ts
23
+ import { getAddress, isAddress } from "viem";
24
+ function decodeEthereumAddress(wire) {
25
+ if (!isAddress(wire, { strict: false })) {
26
+ throw new DalpSdkError2({
27
+ code: "sdk.scalar.EVM_ADDRESS_INVALID",
28
+ category: "sdk.configuration",
29
+ retryable: false,
30
+ message: `\`${wire}\` is not an EVM address.`,
31
+ why: "An EVM address is 42 characters starting with 0x.",
32
+ fix: "Pass the address exactly as the API returned it."
33
+ });
34
+ }
35
+ return getAddress(wire);
36
+ }
37
+ function tryDecodeEthereumAddress(wire) {
38
+ if (typeof wire !== "string" || !isAddress(wire, { strict: false })) {
39
+ return;
40
+ }
41
+ return getAddress(wire);
42
+ }
43
+ // src/scalars/organization-id.ts
44
+ function decodeOrganizationId(wire) {
45
+ if (wire.length === 0) {
46
+ throw new DalpSdkError2({
47
+ code: "sdk.scalar.ORGANIZATION_ID_INVALID",
48
+ category: "sdk.configuration",
49
+ retryable: false,
50
+ message: "An organization id cannot be empty.",
51
+ why: "The organization id scopes every tenant-owned request.",
52
+ fix: "Pass the id the platform returned for the active organization."
53
+ });
54
+ }
55
+ return wire;
56
+ }
57
+ function tryDecodeOrganizationId(wire) {
58
+ return typeof wire === "string" && wire.length > 0 ? wire : undefined;
59
+ }
60
+ // src/scalars/exchange-rates.ts
61
+ function decodeRow(row) {
62
+ const source = row !== null && typeof row === "object" ? row : { rate: null, feedAddress: null };
63
+ const rate = Reflect.get(source, "rate");
64
+ const feedAddress = Reflect.get(source, "feedAddress");
65
+ return {
66
+ ...source,
67
+ rate: typeof rate === "string" ? decodeBigDecimal(rate) : null,
68
+ feedAddress: typeof feedAddress === "string" ? decodeEthereumAddress(feedAddress) : null
69
+ };
70
+ }
71
+ function decodeExchangeRatesListResponse(payload) {
72
+ const source = payload !== null && typeof payload === "object" ? payload : { data: [] };
73
+ const rows = Reflect.get(source, "data");
74
+ return { ...source, data: Array.isArray(rows) ? rows.map(decodeRow) : [] };
75
+ }
76
+ var exchangeRatesListTransformer = async (data) => decodeExchangeRatesListResponse(data);
77
+ export {
78
+ decodeBigDecimal,
79
+ decodeEthereumAddress,
80
+ decodeExchangeRatesListResponse,
81
+ decodeOrganizationId,
82
+ encodeBigDecimal,
83
+ exchangeRatesListTransformer,
84
+ tryDecodeEthereumAddress,
85
+ tryDecodeOrganizationId
86
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Branded organization id: the only entity id branded end to end across the
3
+ * platform. Runtime validation is minimal; the brand is the type-level
4
+ * contract.
5
+ *
6
+ * @module
7
+ */
8
+ export type OrganizationIdValue = string & {
9
+ readonly __brand: "OrganizationId";
10
+ };
11
+ /** Brand a non-empty organization id. */
12
+ export declare function decodeOrganizationId(wire: string): OrganizationIdValue;
13
+ /**
14
+ * Brand an organization id, or return nothing when it is not one.
15
+ *
16
+ * The mirror of {@link decodeOrganizationId} for callers that need a verdict
17
+ * rather than an exception, which is what the previous schema's `safeParse`
18
+ * gave them.
19
+ */
20
+ export declare function tryDecodeOrganizationId(wire: unknown): OrganizationIdValue | undefined;
@@ -0,0 +1,14 @@
1
+ export declare const SECRET_REDACTION_MARKER = "[REDACTED]";
2
+ declare const inspectSymbol: unique symbol;
3
+ /** Opaque secret value which cannot leak through common serialization paths. */
4
+ export declare class Secret {
5
+ private constructor();
6
+ static from(value: string): Secret;
7
+ toString(): string;
8
+ toJSON(): string;
9
+ [inspectSymbol](): string;
10
+ }
11
+ export declare const secret: (value: string) => Secret;
12
+ /** Reveal a secret only at the transport header-injection boundary. */
13
+ export declare const unwrapSecret: (value: Secret) => string;
14
+ export {};
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Counter-sign a DALP webhook delivery receipt.
3
+ *
4
+ * The inbound half of webhook signing (`verifyWebhook`) proves a delivery
5
+ * DALP sent is authentic. This is the return half: after a consumer verifies
6
+ * and accepts a delivery, it counter-signs a receipt so the platform has
7
+ * non-repudiation proof the consumer received and acknowledged that specific
8
+ * delivery. Submit the result to `POST /api/v2/webhook-receipts`.
9
+ *
10
+ * The canonical signing string and HMAC mirror the server-side implementation,
11
+ * which a published package cannot import. A shared golden test vector pins the
12
+ * output of both so the two copies cannot drift.
13
+ *
14
+ * @module
15
+ */
16
+ /**
17
+ * Scheme tag prefixed to the counter-signed receipt signing string. It
18
+ * domain-separates receipt signatures from inbound delivery signatures and
19
+ * reserves room for a future scheme revision.
20
+ */
21
+ export declare const RECEIPT_SIGNING_SCHEME = "dalp.whr.v1";
22
+ /** The delivery tuple a receipt signature binds. */
23
+ export interface ReceiptSigningTuple {
24
+ /** The delivery being acknowledged. A retry allocates a fresh `deliveryId`. */
25
+ deliveryId: string;
26
+ /** The endpoint that received the delivery. */
27
+ endpointId: string;
28
+ /** The event identifier carried by the delivery (`evt_*`). */
29
+ evtId: string;
30
+ /** The hash of the delivered event body (`sha256:<hex>`). */
31
+ innerEventHash: string;
32
+ }
33
+ export interface SignWebhookReceiptInput extends ReceiptSigningTuple {
34
+ /** The endpoint signing secret (`dalp_whsk_...`); the prefix is stripped for you. */
35
+ secret: string;
36
+ }
37
+ /**
38
+ * Build the canonical string a consumer HMACs to counter-sign a receipt.
39
+ *
40
+ * Binding the signature to the full delivery tuple, not just the event body
41
+ * hash, is what closes the receipt-replay window: a retry allocates a fresh
42
+ * `deliveryId` for the same event, so a signature minted for one attempt
43
+ * produces a different signing string than another attempt and no longer
44
+ * verifies against it.
45
+ *
46
+ * Newline-joined is unambiguous because every field carries no newline:
47
+ * `deliveryId`/`endpointId` are UUIDs, `evtId` is the server-issued `evt_*`
48
+ * identifier, and `innerEventHash` is `sha256:<hex>`.
49
+ */
50
+ export declare function buildReceiptSigningString(tuple: Readonly<ReceiptSigningTuple>): string;
51
+ /**
52
+ * Counter-sign a webhook delivery receipt.
53
+ *
54
+ * Returns the lowercase hex `HMAC-SHA256(key, signingString)` to submit as the
55
+ * receipt's `consumerSignature`. The key is the base64-decoded prefix-stripped
56
+ * secret, the same derivation the Standard Webhooks library uses for inbound
57
+ * delivery verification (`verifyWebhook`) and that the dispatcher signs with —
58
+ * so the receipt and the delivery share key material.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const consumerSignature = signWebhookReceipt({
63
+ * deliveryId,
64
+ * endpointId,
65
+ * evtId,
66
+ * innerEventHash,
67
+ * secret, // the endpoint's dalp_whsk_... signing secret
68
+ * });
69
+ * ```
70
+ */
71
+ export declare function signWebhookReceipt({ secret, ...tuple }: Readonly<SignWebhookReceiptInput>): string;
72
+ export interface VerifyWebhookReceiptInput extends SignWebhookReceiptInput {
73
+ readonly signature: string;
74
+ }
75
+ /** Verify a counter-signed receipt without leaking signature timing. */
76
+ 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,44 @@
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
+ /**
11
+ * Opt into a bounded attempt count instead of the wall-clock window. Only
12
+ * for callers that genuinely want "n tries and stop" — a count is a poor
13
+ * budget when every failure is instant, because a single multi-second
14
+ * backend stall spends it all in a few hundred milliseconds.
15
+ */
16
+ readonly maxReconnects?: number;
17
+ /**
18
+ * How long to keep reconnecting through an unbroken run of failures, in
19
+ * wall-clock milliseconds. The window is anchored at the first failure of a
20
+ * streak and restarts only after a connection stays up for
21
+ * `healthyConnectionMs`, so a long-lived stream that dies late still gets a
22
+ * full window.
23
+ */
24
+ readonly reconnectWindowMs?: number;
25
+ /**
26
+ * How long a connection must stay up to count as recovered and clear the
27
+ * failure streak. Receiving events is deliberately *not* the test: a stream
28
+ * that replays its opening frame on every subscription would clear the
29
+ * streak on each attempt and reconnect forever.
30
+ */
31
+ readonly healthyConnectionMs?: number;
32
+ readonly initialBackoffMs?: number;
33
+ readonly maxBackoffMs?: number;
34
+ readonly sleep?: (milliseconds: number) => Promise<void>;
35
+ readonly now?: () => number;
36
+ }
37
+ export type SseLifecycleFailureReason = "aborted" | "terminal-failure" | "transport-failure";
38
+ export declare class SseLifecycleError<T = unknown> extends Error {
39
+ readonly reason: SseLifecycleFailureReason;
40
+ readonly lastEvent?: T;
41
+ constructor(reason: SseLifecycleFailureReason, lastEvent?: T, options?: ErrorOptions);
42
+ }
43
+ /** Add terminal-state semantics to a generated Hey API SSE stream. */
44
+ export declare function consumeSseUntilTerminal<T>(options: SseLifecycleOptions<T>): Promise<T>;
package/dist/types.d.ts CHANGED
@@ -1,110 +1,77 @@
1
1
  /**
2
- * Type-only exports for the DALP SDK.
2
+ * Generated request, response, and model types for the v2 surface.
3
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
4
+ * Type-only by construction — the emitted JavaScript is empty, so a consumer
5
+ * that imports only types pays nothing at runtime. The dist completeness
6
+ * graph accepts that empty file when `dist/types.d.ts` is present.
8
7
  *
9
8
  * @module
10
9
  */
11
- import type { ContractRouterClient } from "@orpc/contract";
12
- import type { JsonifiedClient } from "@orpc/openapi-client";
13
- import type { rpcContract } from "./contract.js";
14
- /**
15
- * Fully typed DALP API client.
16
- *
17
- * Uses `JsonifiedClient` because the SDK communicates via the OpenAPI/REST
18
- * endpoint where values are serialized as standard JSON (e.g., Date → string,
19
- * BigInt → string).
20
- *
21
- * Provides auto-completed access to all v2 API namespaces:
22
- * `account`, `actions`, `addons`, `admin`, `contacts`, `exchangeRates`,
23
- * `externalToken`, `identityRecovery`, `monitoring`, `search`,
24
- * `settings`, `system`, `token`, `transaction`, `user`.
25
- */
26
- export type DalpClient = JsonifiedClient<ContractRouterClient<typeof rpcContract, DalpClientCallContext>>;
27
- /**
28
- * Per-call client context threaded into individual SDK operations as the second
29
- * argument, e.g. `client.token.create(input, { context: { idempotencyKey } })`.
30
- * Every field is optional and scoped to the single call, unlike the client-level
31
- * {@link BaseDalpClientConfig.idempotencyKey} which applies to every request.
32
- */
33
- export interface DalpClientCallContext {
34
- /**
35
- * Idempotency key sent as the `Idempotency-Key` header for this call only,
36
- * overriding any client-level key. Use a fresh value per genuine retry of a
37
- * failed mutation: dapi burns the key of a failed transaction, so re-sending
38
- * under the same key is rejected ("previously failed. Use a new idempotency
39
- * key to retry"). A stable value within one logical attempt keeps network-level
40
- * fetch retries deduplicated.
41
- */
42
- idempotencyKey?: string;
43
- /**
44
- * oRPC error codes the caller treats as expected for this call and does not
45
- * want surfaced by its own error logging (e.g. an existence probe that accepts
46
- * `NOT_FOUND`). A client-side hint scoped to the single call; it is not sent to
47
- * the server.
48
- */
49
- skipLoggingFor?: readonly string[];
50
- }
51
- interface BaseDalpClientConfig {
52
- /** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
53
- url: string;
54
- /**
55
- * Organization ID for multi-tenant setups.
56
- * Required when the API key is scoped to multiple organizations.
57
- */
58
- organizationId?: string;
59
- /**
60
- * Additional headers merged into every request.
61
- * Accepts a static object or a (possibly async) function for dynamic headers.
62
- * Can override defaults like `User-Agent` but cannot override security headers (`x-api-key`, `x-organization-id`).
63
- */
64
- headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
65
- /**
66
- * Validate outgoing requests against the contract before sending.
67
- * Catches schema violations client-side for faster feedback.
68
- * @defaultValue false
69
- */
70
- requestValidation?: boolean;
71
- /**
72
- * Validate incoming responses against the contract.
73
- * Useful during development to catch API drift.
74
- * @defaultValue false
75
- */
76
- responseValidation?: boolean;
77
- /**
78
- * Custom `fetch` implementation.
79
- * Use this to inject logging, proxy configuration, or test doubles.
80
- */
81
- fetch?: typeof globalThis.fetch;
82
- /**
83
- * Idempotency key sent as the `Idempotency-Key` header on every request.
84
- *
85
- * **Warning:** This value is sent on _every_ request made by the client.
86
- * If you reuse the same client instance for multiple mutations, the server
87
- * will deduplicate all but the first — subsequent mutations silently return
88
- * the first response. Only set this when the client is used for a single
89
- * mutation (e.g., a one-shot script). For multi-mutation workflows, set the
90
- * header per-request via the `headers` callback instead.
91
- *
92
- * When omitted, no idempotency key header is sent.
93
- */
94
- idempotencyKey?: string;
95
- }
96
- /**
97
- * Configuration for creating an authenticated DALP API client.
98
- */
99
- export interface DalpClientConfig extends BaseDalpClientConfig {
100
- /** API key for authenticated routes (issued via the DALP dashboard or CLI). */
101
- apiKey: string;
10
+ import type { AssumableParticipant, JoinableParticipant, JoinableProvider, EvmAddress, TokenFeatureDividendYield as TokenFeatureDividendYieldWire, TokenFeatureExternalTransactionFee as TokenFeatureExternalTransactionFeeWire, TokenFeatureFixedTreasuryYield as TokenFeatureFixedTreasuryYieldWire, TokenFeatureHistoricalBalances as TokenFeatureHistoricalBalancesWire, TokenFeatureInterestYield as TokenFeatureInterestYieldWire, TokenFeatureMaturityRedemption as TokenFeatureMaturityRedemptionWire, TokenFeatureTransactionFee as TokenFeatureTransactionFeeWire, TokenFeatureTransactionFeeAccounting as TokenFeatureTransactionFeeAccountingWire, TokenDocumentGetUploadUrlBody, TokenTopicScheme, TokenTrustedIssuer, ThemeLogoUpload, EvmUserEventV2Item, UserEventV2Item, UserEventV2ItemCollectionResponse, UserMe, participantsMultisigDrafts_createInvite_Response, token_create_Request, system_feeds_issuerSigned_create_Request, tokenTopicSchemes_create_Request, tokenTrustedIssuers_create_Request } from "./generated/api-types.d.ts";
11
+ /** Participant kinds returned by the participant search surface. */
12
+ export type ParticipantKind = "person" | "company" | "fund" | "spv" | "department" | "joint_account" | "asset" | "organisation" | "claim_issuer" | "addon";
13
+ /** Address projection requested from participant search. */
14
+ export type ParticipantAddressPurpose = "transfer" | "identity" | "participant";
15
+ /** Token eligibility filter accepted by participant search. */
16
+ export interface EligibleForTokenFilter {
17
+ readonly tokenAddress: EvmAddress;
18
+ readonly action: "mint" | "transfer" | "burn";
19
+ readonly reveal?: boolean;
102
20
  }
21
+ /** One personal participant a person may act as in a given organization. */
22
+ export type JoinableParticipantOption = JoinableParticipant;
23
+ /** One provider a new personal participant may be created on in that organization. */
24
+ export type JoinableProviderOption = JoinableProvider;
25
+ /** Current ability to act as an assumable participant. */
26
+ export type ActAvailability = AssumableParticipant["actAvailability"];
27
+ /** Stable onboarding flags returned with the current user. */
28
+ export type OnboardingState = UserMe["onboardingState"];
103
29
  /**
104
- * Configuration for creating a public DALP API client.
30
+ * One row of the authenticated user's event feed, on whichever ledger produced it.
31
+ *
32
+ * Discriminated on `family`. Narrow before reading anything else: `blockNumber`,
33
+ * `transactionHash`, `gasUsed` and `gasPrice` exist only on the `evm` arm, and
34
+ * `ledgerOffset`, `updateId` and `nodeId` only on the `canton` one.
105
35
  */
106
- export interface PublicDalpClientConfig extends BaseDalpClientConfig {
107
- apiKey?: undefined;
108
- }
109
- export type { WalletAuthEndpointPath } from "./auth-wallet-plugins.js";
110
- //# sourceMappingURL=types.d.ts.map
36
+ export type UserEvent = UserEventV2Item;
37
+ /** The `evm` arm of {@link UserEvent}: one indexed contract event. */
38
+ export type EvmUserEvent = EvmUserEventV2Item;
39
+ /** One page of the authenticated user's event feed, across both chain families. */
40
+ export type UserEventCollectionResponse = UserEventV2ItemCollectionResponse;
41
+ /** One decoded name/value entry attached to a user activity event. */
42
+ export type UserEventValue = NonNullable<EvmUserEvent["values"]>[number];
43
+ /** Registry tier from which a topic scheme was inherited. */
44
+ export type TokenTopicSchemeInheritanceLevel = TokenTopicScheme["inheritanceLevel"];
45
+ /** Registry tier from which a trusted issuer was inherited. */
46
+ export type TokenTrustedIssuerInheritanceLevel = TokenTrustedIssuer["inheritanceLevel"];
47
+ /** Body accepted when a token-level topic scheme is created. */
48
+ export type TokenTopicSchemeCreateInput = tokenTopicSchemes_create_Request;
49
+ /** Body accepted when a token-level trusted issuer is created. */
50
+ export type TokenTrustedIssuerCreateInput = tokenTrustedIssuers_create_Request;
51
+ /** Successful token returned when a multisig invite is created. */
52
+ export type MultisigDraftCreateInviteOutput = participantsMultisigDrafts_createInvite_Response;
53
+ /** Body accepted when an issuer-signed scalar feed is created. */
54
+ export type IssuerSignedCreateInput = system_feeds_issuerSigned_create_Request;
55
+ /** Image slot accepted by the theme logo upload endpoints. */
56
+ export type ThemeLogoMode = ThemeLogoUpload["mode"];
57
+ /** Config carried by an attached historical-balances feature. */
58
+ export type TokenFeatureHistoricalBalancesConfig = NonNullable<TokenFeatureHistoricalBalancesWire>;
59
+ /** Config carried by an attached maturity-redemption feature. */
60
+ export type TokenFeatureMaturityRedemptionConfig = NonNullable<TokenFeatureMaturityRedemptionWire>;
61
+ /** Config carried by an attached fixed-treasury-yield feature. */
62
+ export type TokenFeatureFixedTreasuryYieldConfig = NonNullable<TokenFeatureFixedTreasuryYieldWire>;
63
+ /** Config carried by an attached dividend-yield feature. */
64
+ export type TokenFeatureDividendYieldConfig = NonNullable<TokenFeatureDividendYieldWire>;
65
+ /** Config carried by an attached interest-yield feature. */
66
+ export type TokenFeatureInterestYieldConfig = NonNullable<TokenFeatureInterestYieldWire>;
67
+ /** Config carried by an attached transaction-fee feature. */
68
+ export type TokenFeatureTransactionFeeConfig = NonNullable<TokenFeatureTransactionFeeWire>;
69
+ /** Config carried by an attached transaction-fee-accounting feature. */
70
+ export type TokenFeatureTransactionFeeAccountingConfig = NonNullable<TokenFeatureTransactionFeeAccountingWire>;
71
+ /** Config carried by an attached external-transaction-fee feature. */
72
+ export type TokenFeatureExternalTransactionFeeConfig = NonNullable<TokenFeatureExternalTransactionFeeWire>;
73
+ /** MIME type accepted by token-document upload endpoints. */
74
+ export type TokenDocumentMimeType = TokenDocumentGetUploadUrlBody["mimeType"];
75
+ /** Body accepted by the token-create endpoint. */
76
+ export type TokenCreateInput = token_create_Request;
77
+ 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
@@ -2,4 +2,3 @@
2
2
  export declare const SDK_VERSION: string;
3
3
  /** Default User-Agent header sent with every SDK request. */
4
4
  export declare const SDK_USER_AGENT: string;
5
- //# sourceMappingURL=version.d.ts.map