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

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-j4sxrfzz.js +54 -0
  13. package/dist/chunk-qvtjb3dz.js +102 -0
  14. package/dist/chunk-rb8k4w3q.js +67 -0
  15. package/dist/chunk-shp8v4ws.js +913 -0
  16. package/dist/chunk-sk9nc2q3.js +10 -0
  17. package/dist/chunk-xp3fx2yt.js +63 -0
  18. package/dist/chunk-ybqqdgrd.js +260 -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
@@ -1,94 +1,81 @@
1
- /**
2
- * Bounded wait-until-terminal barrier for queued DALP mutations.
3
- *
4
- * A v2 mutation may return a `202`-style async-accepted envelope when its
5
- * synchronous wait window elapses while the execution workflow is still
6
- * confirming. `waitForTransaction` turns that into a deterministic outcome:
7
- * poll the transaction status route at a FIXED interval bounded by a wall-clock
8
- * deadline, resolve on a terminal success, throw a typed error on a terminal
9
- * failure, and throw a loud timeout error if the deadline elapses first.
10
- *
11
- * This is a determinism barrier, not a masking retry — total wait is bounded by
12
- * `timeoutMs` (never exponential), and a never-terminating transaction fails
13
- * loud and bounded instead of hanging.
14
- *
15
- * Related: kit/sdk/src/types.ts
16
- * Related: packages/dalp/api-contract/src/routes/transaction/routes/transaction.status.schema.ts
17
- *
18
- * @module
19
- */
20
- import type { DalpClient } from "./types.js";
21
- /** Outcome shape returned by the transaction status route, narrowed to the fields this helper reads. */
22
- export interface WaitForTransactionResult {
23
- readonly tokenAddress?: unknown;
1
+ import type { DalpClient } from "./proxy/client.ts";
2
+ import type { EvmTransactionStatusOutput } from "./generated/api-types.d.ts";
3
+ export interface WaitForTransactionContractError {
4
+ readonly id: string;
5
+ readonly args: Readonly<Record<string, string>>;
6
+ readonly why: string;
7
+ readonly message: string;
8
+ readonly fix?: string;
24
9
  }
25
10
  export interface WaitForTransactionStatus {
26
- transactionId: string;
27
- status: string;
28
- subStatus: string | null;
29
- transactionHash: string | null;
30
- errorMessage: string | null;
31
- result?: WaitForTransactionResult;
11
+ readonly transactionId: string;
12
+ readonly status: string;
13
+ readonly subStatus: string | null;
14
+ readonly transactionHash: string | null;
15
+ readonly errorMessage: string | null;
16
+ readonly contractError?: WaitForTransactionContractError | null;
17
+ readonly result?: WaitForTransactionResult;
18
+ /** The open funding ask a write parked by the funding gate is waiting on. */
19
+ readonly activeRequirement?: EvmTransactionStatusOutput["activeRequirement"];
20
+ /** The chain and block an index rebuild must reach before this write reads back. */
21
+ readonly indexerRebuild?: EvmTransactionStatusOutput["indexerRebuild"];
22
+ }
23
+ /** Kind-scoped terminal result from the generated transaction status contract. */
24
+ export type WaitForTransactionResult = NonNullable<EvmTransactionStatusOutput["result"]>;
25
+ export interface WaitForTransactionSuccess extends WaitForTransactionStatus {
26
+ readonly status: "COMPLETED";
32
27
  }
33
28
  export interface WaitForTransactionOptions {
34
- /** Wall-clock ceiling for the whole wait, in milliseconds. Default 120_000. */
35
- timeoutMs?: number;
36
- /** Fixed delay between status polls, in milliseconds. Default 2_000. */
37
- intervalMs?: number;
29
+ readonly timeoutMs?: number;
30
+ readonly pollIntervalMs?: number;
31
+ readonly signal?: AbortSignal;
32
+ readonly onStatus?: (status: WaitForTransactionStatus) => void;
38
33
  /**
39
- * Resolve (instead of continuing to poll) when the transaction reaches
40
- * `PENDING_APPROVAL` — an external approval gate (DFNS / Fireblocks) that is
41
- * not a stall and may legitimately outlast the deadline. Default `true`.
34
+ * Whether the wait outlasts a funding pause. True, the default, restarts the
35
+ * timeout on every status that reports an open funding ask, so the wait ends
36
+ * only when the ask is paid or the platform fails the request. False ends
37
+ * the wait on the first such status with reason `funding-paused`, for a
38
+ * caller that shows the write as pending and lets the payment land on its
39
+ * own time.
42
40
  */
43
- resolveOnPendingApproval?: boolean;
41
+ readonly holdWhilePaused?: boolean;
44
42
  /**
45
- * Cancels the wait when the owning context (React component, request handler,
46
- * workflow step) is torn down. An aborted signal stops the loop on the next
47
- * iteration, cancels the in-flight status request, and surfaces as a
48
- * {@link DalpTransactionWaitError} with `reason: "aborted"`.
43
+ * Whether the wait outlasts an index rebuild. True, the default, restarts the
44
+ * timeout on every status that reports a rebuild, so the wait ends only when
45
+ * the replay reaches the write's block or the platform fails the request.
46
+ * False ends the wait on the first such status with reason `indexer-rebuild`,
47
+ * for a caller that would rather come back later than hold a connection open
48
+ * for the hours a replay takes.
49
49
  */
50
- signal?: AbortSignal;
50
+ readonly holdWhileRebuilding?: boolean;
51
+ readonly now?: () => number;
52
+ readonly sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
53
+ readonly readStatus?: (transactionId: string, signal?: AbortSignal) => Promise<WaitForTransactionStatus>;
51
54
  }
52
- /**
53
- * Thrown when a transaction reaches a terminal failure state
54
- * (`FAILED` / `DEAD_LETTER` / `CANCELLED`), does not reach any terminal state
55
- * within the deadline (`reason: "timeout"`), or the caller's `AbortSignal`
56
- * fires (`reason: "aborted"`).
57
- */
55
+ export type TransactionWaitFailureReason = "terminal-failure" | "timeout" | "aborted" | "funding-paused" | "indexer-rebuild";
58
56
  export declare class DalpTransactionWaitError extends Error {
57
+ readonly code = "sdk.transaction.WAIT_FAILED";
58
+ readonly category: "operational";
59
59
  readonly transactionId: string;
60
- readonly status: string;
61
- readonly subStatus: string | null;
62
- readonly reason: "terminal-failure" | "timeout" | "aborted";
63
- readonly lastStatus: WaitForTransactionStatus | undefined;
64
- constructor(options: {
65
- message: string;
66
- transactionId: string;
67
- status: string;
68
- subStatus: string | null;
69
- reason: "terminal-failure" | "timeout" | "aborted";
70
- lastStatus?: WaitForTransactionStatus;
71
- cause?: unknown;
72
- });
60
+ readonly reason: TransactionWaitFailureReason;
61
+ readonly lastStatus?: WaitForTransactionStatus;
62
+ readonly elapsedMs?: number;
63
+ constructor(transactionId: string, reason: TransactionWaitFailureReason, lastStatus?: WaitForTransactionStatus, elapsedMs?: number);
64
+ get status(): string;
65
+ get subStatus(): string | null;
66
+ get retryable(): boolean;
73
67
  }
68
+ export declare const isDalpTransactionWaitError: (error: unknown) => error is DalpTransactionWaitError;
74
69
  /**
75
- * Poll the transaction status route until the transaction reaches a terminal
76
- * state or the deadline elapses.
77
- *
78
- * - `COMPLETED` → resolves with the final status (the handler already waited for
79
- * the indexer drain, so this is a true read-after-write guarantee).
80
- * - `FAILED` / `DEAD_LETTER` / `CANCELLED` → throws {@link DalpTransactionWaitError}
81
- * (`reason: "terminal-failure"`) carrying `status`, `subStatus`, and
82
- * `errorMessage` — fail fast, do not keep polling.
83
- * - `PENDING_APPROVAL` → resolves as pending (when `resolveOnPendingApproval`,
84
- * the default) so an external approval gate is never treated as a stall.
85
- * - deadline elapsed → throws {@link DalpTransactionWaitError} (`reason: "timeout"`)
86
- * carrying the last observed status — a loud, bounded failure, never an
87
- * indefinite hang.
70
+ * Poll transaction status until a terminal verdict, timeout, or abort.
88
71
  *
89
- * @param client A DALP API client.
90
- * @param transactionId The queue transaction identifier (UUIDv7) returned in the
91
- * async-accepted envelope.
72
+ * The timeout measures the platform's progress. A status that reports an
73
+ * open funding ask restarts it, so a write parked on an operator payment is
74
+ * never reported as a timeout and a resumed write gets its whole budget back.
75
+ * A status that reports an index rebuild restarts it for the same reason: the
76
+ * write is already on chain and the platform is replaying that chain's history
77
+ * before it can be read back. `holdWhilePaused: false` and
78
+ * `holdWhileRebuilding: false` end the wait on those statuses instead. The
79
+ * `elapsedMs` a timeout carries is the whole wait, pauses included.
92
80
  */
93
- export declare function waitForTransaction(client: DalpClient, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionStatus>;
94
- //# sourceMappingURL=wait-for-transaction.d.ts.map
81
+ export declare function waitForTransaction(client: DalpClient, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionSuccess>;
@@ -0,0 +1,142 @@
1
+ import {
2
+ readsAsIndexerRebuild2
3
+ } from "./chunk-sk9nc2q3.js";
4
+
5
+ // src/reads-as-funding-paused.ts
6
+ function readsAsFundingPaused(status) {
7
+ if (status === null || typeof status !== "object") {
8
+ return false;
9
+ }
10
+ const requirement = Reflect.get(status, "activeRequirement");
11
+ return requirement !== undefined && requirement !== null;
12
+ }
13
+ var PAUSED_POLL_INTERVAL_MAX_MS = 30000;
14
+
15
+ // src/wait-for-transaction.ts
16
+ var failedStates = new Set(["FAILED", "DEAD_LETTER", "CANCELLED"]);
17
+ var isWaitForTransactionSuccess = (status) => status.status === "COMPLETED";
18
+
19
+ class DalpTransactionWaitError extends Error {
20
+ code = "sdk.transaction.WAIT_FAILED";
21
+ category = "operational";
22
+ transactionId;
23
+ reason;
24
+ lastStatus;
25
+ elapsedMs;
26
+ constructor(transactionId, reason, lastStatus, elapsedMs) {
27
+ let message;
28
+ if (reason === "terminal-failure") {
29
+ message = `Transaction ${transactionId} reached terminal state ${lastStatus?.status ?? "UNKNOWN"}`;
30
+ } else if (reason === "timeout") {
31
+ message = `Transaction ${transactionId} did not reach a terminal state within ${elapsedMs ?? 0}ms`;
32
+ } else if (reason === "funding-paused") {
33
+ message = `Transaction ${transactionId} is paused waiting for a gas funding payment`;
34
+ } else if (reason === "indexer-rebuild") {
35
+ const chainId = lastStatus?.indexerRebuild?.chainId;
36
+ message = `Transaction ${transactionId} is on chain, and the platform is still rebuilding its index of chain ${chainId ?? "unknown"} before the write can be read back`;
37
+ } else {
38
+ message = `Transaction status observation was aborted for transaction ${transactionId}`;
39
+ }
40
+ super(message);
41
+ this.name = "DalpTransactionWaitError";
42
+ this.transactionId = transactionId;
43
+ this.reason = reason;
44
+ this.lastStatus = lastStatus;
45
+ this.elapsedMs = elapsedMs;
46
+ }
47
+ get status() {
48
+ return this.lastStatus?.status ?? "UNKNOWN";
49
+ }
50
+ get subStatus() {
51
+ return this.lastStatus?.subStatus ?? null;
52
+ }
53
+ get retryable() {
54
+ return this.reason === "timeout" || this.reason === "funding-paused" || this.reason === "indexer-rebuild";
55
+ }
56
+ }
57
+ var isDalpTransactionWaitError = (error) => error instanceof DalpTransactionWaitError;
58
+ var defaultSleep = (milliseconds, signal) => new Promise((resolve, reject) => {
59
+ if (signal?.aborted === true) {
60
+ reject(signal.reason);
61
+ return;
62
+ }
63
+ const onAbort = () => {
64
+ clearTimeout(timeout);
65
+ reject(signal?.reason);
66
+ };
67
+ const timeout = setTimeout(() => {
68
+ signal?.removeEventListener("abort", onAbort);
69
+ resolve();
70
+ }, milliseconds);
71
+ signal?.addEventListener("abort", onAbort, { once: true });
72
+ });
73
+ var routeStatusReader = (client) => async (transactionId, signal) => {
74
+ const result = await client.execute("transaction/status", { transactionId }, signal === undefined ? undefined : { signal });
75
+ const body = result !== null && typeof result === "object" ? Reflect.get(result, "data") ?? result : result;
76
+ return body;
77
+ };
78
+ async function waitForTransaction(client, transactionId, options = {}) {
79
+ const timeoutMs = options.timeoutMs ?? 120000;
80
+ const pollIntervalMs = options.pollIntervalMs ?? 1000;
81
+ const now = options.now ?? Date.now;
82
+ const sleep = options.sleep ?? defaultSleep;
83
+ const readStatus = options.readStatus ?? routeStatusReader(client);
84
+ const holdWhilePaused = options.holdWhilePaused ?? true;
85
+ const holdWhileRebuilding = options.holdWhileRebuilding ?? true;
86
+ const waitStartedAt = now();
87
+ let budgetStartedAt = waitStartedAt;
88
+ let pollDelayMs = pollIntervalMs;
89
+ let lastStatus;
90
+ const isAborted = () => options.signal?.aborted === true;
91
+ while (true) {
92
+ if (isAborted()) {
93
+ throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
94
+ }
95
+ if (now() - budgetStartedAt >= timeoutMs) {
96
+ throw new DalpTransactionWaitError(transactionId, "timeout", lastStatus, now() - waitStartedAt);
97
+ }
98
+ try {
99
+ lastStatus = await readStatus(transactionId, options.signal);
100
+ } catch (error) {
101
+ if (isAborted()) {
102
+ throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
103
+ }
104
+ throw error;
105
+ }
106
+ options.onStatus?.(lastStatus);
107
+ if (failedStates.has(lastStatus.status)) {
108
+ throw new DalpTransactionWaitError(transactionId, "terminal-failure", lastStatus);
109
+ }
110
+ if (isWaitForTransactionSuccess(lastStatus)) {
111
+ return lastStatus;
112
+ }
113
+ let parkedBy;
114
+ let holdsThroughIt = false;
115
+ if (readsAsFundingPaused(lastStatus)) {
116
+ parkedBy = "funding-paused";
117
+ holdsThroughIt = holdWhilePaused;
118
+ } else if (readsAsIndexerRebuild2(lastStatus)) {
119
+ parkedBy = "indexer-rebuild";
120
+ holdsThroughIt = holdWhileRebuilding;
121
+ }
122
+ if (parkedBy === undefined) {
123
+ pollDelayMs = pollIntervalMs;
124
+ } else {
125
+ if (!holdsThroughIt) {
126
+ throw new DalpTransactionWaitError(transactionId, parkedBy, lastStatus, now() - waitStartedAt);
127
+ }
128
+ budgetStartedAt = now();
129
+ pollDelayMs = Math.min(pollDelayMs * 2, Math.max(pollIntervalMs, PAUSED_POLL_INTERVAL_MAX_MS));
130
+ }
131
+ try {
132
+ await sleep(Math.min(pollDelayMs, Math.max(0, timeoutMs - (now() - budgetStartedAt))), options.signal);
133
+ } catch {
134
+ throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
135
+ }
136
+ }
137
+ }
138
+ export {
139
+ DalpTransactionWaitError,
140
+ isDalpTransactionWaitError,
141
+ waitForTransaction
142
+ };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Generated webhook event types.
3
3
  *
4
- * Do not edit by hand. Run `bun run tools/scripts/generate-webhook-events-sdk.ts`.
4
+ * Do not edit by hand. Run `bun run --cwd kit/sdk codegen:webhook-events-sdk`.
5
5
  *
6
6
  * @module
7
7
  */
@@ -13,7 +13,7 @@ export declare namespace Webhook {
13
13
  * Adds `supersedes` only to lifecycle states that can authoritatively replace
14
14
  * an earlier event.
15
15
  *
16
- * @see ../../kit/docs/content/events/idempotency-and-on-chain-outcome.mdx
16
+ * @see ../../../kit/docs/content/events/idempotency-and-on-chain-outcome.mdx
17
17
  */
18
18
  type SupersedesAccessor<TState extends LifecycleState> = TState extends SupersedingLifecycleState ? {
19
19
  readonly supersedes: string;
@@ -34,44 +34,44 @@ export declare namespace Webhook {
34
34
  } & SupersedesAccessor<TState>;
35
35
  type AccessControlRoleGrantedProvisionalV1 = EventEnvelope<"access-control.role-granted.provisional", 1, "provisional", {
36
36
  readonly accessManagerAddress: string;
37
- readonly accountAddress: string;
37
+ readonly accountAddress?: string;
38
38
  readonly blockNumber: string;
39
39
  readonly chainId: number;
40
40
  readonly roleId: string;
41
- readonly sender: string;
41
+ readonly sender?: string;
42
42
  readonly systemAddress: string;
43
43
  readonly transactionHash: string;
44
44
  }>;
45
45
  type AccessControlRoleGrantedRetractedV1 = EventEnvelope<"access-control.role-granted.retracted", 1, "retracted", {
46
46
  readonly accessManagerAddress: string;
47
- readonly accountAddress: string;
47
+ readonly accountAddress?: string;
48
48
  readonly blockNumber: string;
49
49
  readonly chainId: number;
50
50
  readonly reorgBlockNumber: number;
51
51
  readonly roleId: string;
52
- readonly sender: string;
52
+ readonly sender?: string;
53
53
  readonly supersedes: string;
54
54
  readonly systemAddress: string;
55
55
  readonly transactionHash: string;
56
56
  }>;
57
57
  type AccessControlRoleRevokedProvisionalV1 = EventEnvelope<"access-control.role-revoked.provisional", 1, "provisional", {
58
58
  readonly accessManagerAddress: string;
59
- readonly accountAddress: string;
59
+ readonly accountAddress?: string;
60
60
  readonly blockNumber: string;
61
61
  readonly chainId: number;
62
62
  readonly roleId: string;
63
- readonly sender: string;
63
+ readonly sender?: string;
64
64
  readonly systemAddress: string;
65
65
  readonly transactionHash: string;
66
66
  }>;
67
67
  type AccessControlRoleRevokedRetractedV1 = EventEnvelope<"access-control.role-revoked.retracted", 1, "retracted", {
68
68
  readonly accessManagerAddress: string;
69
- readonly accountAddress: string;
69
+ readonly accountAddress?: string;
70
70
  readonly blockNumber: string;
71
71
  readonly chainId: number;
72
72
  readonly reorgBlockNumber: number;
73
73
  readonly roleId: string;
74
- readonly sender: string;
74
+ readonly sender?: string;
75
75
  readonly supersedes: string;
76
76
  readonly systemAddress: string;
77
77
  readonly transactionHash: string;
@@ -79,33 +79,42 @@ export declare namespace Webhook {
79
79
  type AssetIssuanceProvisionalV1 = EventEnvelope<"asset.issuance.provisional", 1, "provisional", {
80
80
  readonly assetAddress: string;
81
81
  readonly chainId: number;
82
- readonly issuer: string;
82
+ readonly issuer?: string;
83
83
  readonly quantity: string;
84
84
  readonly transactionHash: string;
85
85
  }>;
86
+ type AssetIssuanceRetractedV1 = EventEnvelope<"asset.issuance.retracted", 1, "retracted", {
87
+ readonly assetAddress: string;
88
+ readonly chainId: number;
89
+ readonly issuer?: string;
90
+ readonly quantity: string;
91
+ readonly reorgBlockNumber: number;
92
+ readonly supersedes: string;
93
+ readonly transactionHash: string;
94
+ }>;
86
95
  type ComplianceFreezeRecalledV1 = EventEnvelope<"compliance.freeze.recalled", 1, "recalled", {
87
96
  readonly chainId: number;
88
- readonly reasonCode: string;
97
+ readonly reasonCode?: string;
89
98
  readonly recalledBy: string;
90
- readonly subjectAddress: string;
99
+ readonly subjectAddress?: string;
91
100
  readonly supersedes: string;
92
101
  readonly tokenAddress: string;
93
102
  }>;
94
103
  type IdentityRegistrationProvisionalV1 = EventEnvelope<"identity.registration.provisional", 1, "provisional", {
95
- readonly accountAddress: string;
104
+ readonly accountAddress?: string;
96
105
  readonly blockNumber: string;
97
106
  readonly chainId: number;
98
- readonly country: number;
107
+ readonly country?: number;
99
108
  readonly identityAddress: string;
100
109
  readonly registryAddress: string;
101
110
  readonly status: string;
102
111
  readonly transactionHash: string;
103
112
  }>;
104
113
  type IdentityRegistrationRetractedV1 = EventEnvelope<"identity.registration.retracted", 1, "retracted", {
105
- readonly accountAddress: string;
114
+ readonly accountAddress?: string;
106
115
  readonly blockNumber: string;
107
116
  readonly chainId: number;
108
- readonly country: number;
117
+ readonly country?: number;
109
118
  readonly identityAddress: string;
110
119
  readonly registryAddress: string;
111
120
  readonly reorgBlockNumber: number;
@@ -124,33 +133,42 @@ export declare namespace Webhook {
124
133
  readonly amount: string;
125
134
  readonly blockNumber: number;
126
135
  readonly chainId: number;
127
- readonly from: string;
136
+ readonly from?: string;
128
137
  readonly logIndex: number;
129
- readonly to: string;
138
+ readonly to?: string;
130
139
  readonly tokenAddress: string;
131
140
  readonly transactionHash: string;
132
141
  }>;
133
142
  type TokenTransferPendingV1 = EventEnvelope<"token.transfer.pending", 1, "pending", {
134
143
  readonly amount: string;
135
144
  readonly chainId: number;
136
- readonly from: string;
137
- readonly to: string;
145
+ readonly from?: string;
146
+ readonly to?: string;
138
147
  readonly tokenAddress: string;
139
148
  readonly transactionHash: string;
140
149
  }>;
141
150
  type TokenTransferRetractedV1 = EventEnvelope<"token.transfer.retracted", 1, "retracted", {
142
151
  readonly amount: string;
143
- readonly blockNumber?: number;
152
+ readonly blockNumber: number;
153
+ readonly chainId: number;
154
+ readonly from?: string;
155
+ readonly logIndex: number;
156
+ readonly reorgBlockNumber: number;
157
+ readonly supersedes: string;
158
+ readonly to?: string;
159
+ readonly tokenAddress: string;
160
+ readonly transactionHash: string;
161
+ } | {
162
+ readonly amount: string;
144
163
  readonly chainId: number;
145
- readonly from: string;
146
- readonly logIndex?: number;
164
+ readonly from?: string;
147
165
  readonly reorgBlockNumber: number;
148
166
  readonly supersedes: string;
149
- readonly to: string;
167
+ readonly to?: string;
150
168
  readonly tokenAddress: string;
151
169
  readonly transactionHash: string;
152
170
  }>;
153
- type AnyEvent = AccessControlRoleGrantedProvisionalV1 | AccessControlRoleGrantedRetractedV1 | AccessControlRoleRevokedProvisionalV1 | AccessControlRoleRevokedRetractedV1 | AssetIssuanceProvisionalV1 | ComplianceFreezeRecalledV1 | IdentityRegistrationProvisionalV1 | IdentityRegistrationRetractedV1 | SettlementTransferRetractedV1 | TokenTransferFinalV1 | TokenTransferPendingV1 | TokenTransferRetractedV1;
171
+ type AnyEvent = AccessControlRoleGrantedProvisionalV1 | AccessControlRoleGrantedRetractedV1 | AccessControlRoleRevokedProvisionalV1 | AccessControlRoleRevokedRetractedV1 | AssetIssuanceProvisionalV1 | AssetIssuanceRetractedV1 | ComplianceFreezeRecalledV1 | IdentityRegistrationProvisionalV1 | IdentityRegistrationRetractedV1 | SettlementTransferRetractedV1 | TokenTransferFinalV1 | TokenTransferPendingV1 | TokenTransferRetractedV1;
154
172
  type EventType = AnyEvent["type"];
155
173
  type Event<TType extends EventType = EventType> = Extract<AnyEvent, {
156
174
  readonly type: TType;
@@ -164,4 +182,3 @@ export declare namespace Webhook {
164
182
  * without breaking older SDK versions.
165
183
  */
166
184
  export declare const WEBHOOK_MANIFEST_VERSION = "2026-08-14";
167
- //# sourceMappingURL=webhook-events.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlemint/dalp-sdk",
3
- "version": "3.1.18",
3
+ "version": "3.1.19-main.34482536277",
4
4
  "private": false,
5
5
  "description": "Fully typed SDK for the DALP tokenization platform API",
6
6
  "homepage": "https://settlemint.com",
@@ -19,8 +19,16 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "type": "module",
22
+ "sideEffects": [
23
+ "./src/**"
24
+ ],
22
25
  "exports": {
23
26
  "./package.json": "./package.json",
27
+ "./runtime-exports": {
28
+ "types": "./dist/runtime-exports.d.ts",
29
+ "import": "./dist/runtime-exports.js",
30
+ "default": "./dist/runtime-exports.js"
31
+ },
24
32
  ".": {
25
33
  "types": "./dist/index.d.ts",
26
34
  "import": "./dist/index.js",
@@ -31,47 +39,112 @@
31
39
  "import": "./dist/types.js",
32
40
  "default": "./dist/types.js"
33
41
  },
34
- "./plugins": {
35
- "types": "./dist/plugins/index.d.ts",
36
- "import": "./dist/plugins/index.js",
37
- "default": "./dist/plugins/index.js"
42
+ "./scalars": {
43
+ "types": "./dist/scalars/index.d.ts",
44
+ "import": "./dist/scalars/index.js",
45
+ "default": "./dist/scalars/index.js"
46
+ },
47
+ "./react-query": {
48
+ "types": "./dist/react-query.d.ts",
49
+ "import": "./dist/react-query.js",
50
+ "default": "./dist/react-query.js"
51
+ },
52
+ "./auth": {
53
+ "types": "./dist/auth.d.ts",
54
+ "import": "./dist/auth.js",
55
+ "default": "./dist/auth.js"
56
+ },
57
+ "./bundler": {
58
+ "types": "./dist/bundler.d.ts",
59
+ "import": "./dist/bundler.js",
60
+ "default": "./dist/bundler.js"
61
+ },
62
+ "./verify-webhook": {
63
+ "types": "./dist/verify-webhook.d.ts",
64
+ "import": "./dist/verify-webhook.js",
65
+ "default": "./dist/verify-webhook.js"
66
+ },
67
+ "./wait-for-transaction": {
68
+ "types": "./dist/wait-for-transaction.d.ts",
69
+ "import": "./dist/wait-for-transaction.js",
70
+ "default": "./dist/wait-for-transaction.js"
71
+ },
72
+ "./sdk-error": {
73
+ "types": "./dist/errors/sdk-error.d.ts",
74
+ "import": "./dist/errors/sdk-error.js",
75
+ "default": "./dist/errors/sdk-error.js"
76
+ },
77
+ "./sign-webhook-receipt": {
78
+ "types": "./dist/sign-webhook-receipt.d.ts",
79
+ "import": "./dist/sign-webhook-receipt.js",
80
+ "default": "./dist/sign-webhook-receipt.js"
81
+ },
82
+ "./effect": {
83
+ "types": "./dist/effect.d.ts",
84
+ "import": "./dist/effect.js",
85
+ "default": "./dist/effect.js"
86
+ },
87
+ "./routes": {
88
+ "types": "./dist/routes/index.d.ts",
89
+ "import": "./dist/routes/index.js",
90
+ "default": "./dist/routes/index.js"
38
91
  }
39
92
  },
40
93
  "publishConfig": {
41
94
  "access": "public"
42
95
  },
43
96
  "scripts": {
44
- "build": "rm -rf dist && bun scripts/build.js && tsgo -p tsconfig.build.json && bun scripts/fix-dts-extensions.js",
45
- "publint": "publint run --strict --pack npm",
46
- "attw": "attw --pack . --profile esm-only",
47
- "publish": "cp ../../LICENSE . && npm publish --ignore-scripts --tag ${TAG:-latest} --access public",
97
+ "build": "bun scripts/build.ts && bun scripts/check-dts-portability.ts",
98
+ "codegen": "bun scripts/codegen.ts",
99
+ "publint": "publint run --strict --pack bun",
100
+ "attw": "archive=$(bun pm pack --destination \"$PWD\" --quiet | tail -n 1) && attw \"$archive\" --profile esm-only; code=$?; rm -f \"$archive\"; exit $code",
101
+ "publish": "cp ../../LICENSE . && bun run --cwd ../.. publish-if-absent \"$PWD\"",
48
102
  "prepack": "cp ../../LICENSE .",
49
- "test": "bun test --parallel=2 tests",
50
- "typecheck": "tsgo"
103
+ "test": "bun --bun vitest run --config node_modules/@tools/vitest-config/vitest.config.mjs --configLoader native --project unit --project browser --testTimeout 30000 tests/unit",
104
+ "test:coverage": "bun --bun vitest run --config node_modules/@tools/vitest-config/vitest.config.mjs --configLoader native --project unit --project browser --testTimeout 30000 tests/unit --coverage",
105
+ "lint": "oxlint --deny-warnings .",
106
+ "typecheck": "tsc -p . && tsc --noEmit -p scripts/tsconfig.json",
107
+ "check:dts-portability": "bun scripts/check-dts-portability.ts",
108
+ "check:auth-coverage": "bun scripts/check-auth-coverage.ts",
109
+ "codegen:webhook-events-sdk": "bun scripts/generate-webhook-events-sdk.ts"
51
110
  },
52
111
  "dependencies": {
53
- "@better-auth/api-key": "1.6.19",
54
- "@better-auth/passkey": "1.6.19",
55
- "@orpc/client": "1.14.6",
56
- "@orpc/contract": "1.14.6",
57
- "@orpc/openapi-client": "1.14.6",
58
- "better-auth": "1.6.19",
59
- "currency-codes": "2.2.0",
60
- "date-fns": "4.4.0",
112
+ "@better-auth/api-key": "1.7.2",
113
+ "@better-auth/passkey": "1.7.2",
114
+ "better-auth": "1.7.2",
115
+ "better-call": "1.4.0",
61
116
  "dnum": "2.17.0",
62
- "iso-3166": "4.4.0",
63
- "standardwebhooks": "1.0.0",
64
- "viem": "2.52.2",
65
- "zod": "4.4.3"
117
+ "standardwebhooks": "1.1.1",
118
+ "viem": "2.56.3"
66
119
  },
67
120
  "devDependencies": {
68
- "@arethetypeswrong/cli": "0.18.3",
69
- "@dalp/api-contract": "workspace:*",
70
- "@dalp/errors": "workspace:*",
71
- "@tools/typescript-config": "workspace:*",
72
- "@types/bun": "1.3.14",
73
- "publint": "0.3.21",
74
- "typescript": "6.0.3"
121
+ "@arethetypeswrong/cli": "0.18.5",
122
+ "@core/schema": "3.1.11",
123
+ "@tanstack/react-query": "5.102.8",
124
+ "@tools/typescript-config": "3.1.11",
125
+ "@tools/vitest-config": "3.1.11",
126
+ "@types/bun": "1.4.0",
127
+ "effect": "4.0.0-rc.112",
128
+ "publint": "0.3.24",
129
+ "typescript": "7.0.2",
130
+ "vitest": "5.0.0",
131
+ "zod": "4.5.4"
132
+ },
133
+ "peerDependencies": {
134
+ "@tanstack/react-query": "^5.101.4",
135
+ "effect": "^4.0.0-rc.112",
136
+ "zod": "^4.5.4"
137
+ },
138
+ "peerDependenciesMeta": {
139
+ "@tanstack/react-query": {
140
+ "optional": true
141
+ },
142
+ "effect": {
143
+ "optional": true
144
+ },
145
+ "zod": {
146
+ "optional": true
147
+ }
75
148
  },
76
149
  "engines": {
77
150
  "node": ">=20"
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-permissions.d.ts","sourceRoot":"","sources":["../src/auth-permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,IAAI,EAAuB,MAAM,4BAA4B,CAAC;AAuBhG,eAAO,MAAM,aAAa,EAAE,aAI1B,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,IAOtB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,IAMtB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,IAKvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-wallet-plugins.d.ts","sourceRoot":"","sources":["../src/auth-wallet-plugins.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBK,CAAC;AAEtC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CAoBG,CAAC;AAEtC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;CAmBC,CAAC;AAEtC,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,EAAE,GAAG,IAAI,GAAG,KAAK,CAAC;AAErF,KAAK,0BAA0B,GAC3B,MAAM,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,aAAa,CAAC,GAC3D,MAAM,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,aAAa,CAAC,GAC7D,MAAM,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,aAAa,CAAC,CAAC;AAEpE,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,0BAA0B,GAAG,MAAM,CAAC,CAAC"}