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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +169 -154
  2. package/dist/{auth/permissions.d.ts → auth-permissions.d.ts} +2 -1
  3. package/dist/auth-permissions.d.ts.map +1 -0
  4. package/dist/{auth/wallet-plugins.d.ts → auth-wallet-plugins.d.ts} +5 -69
  5. package/dist/auth-wallet-plugins.d.ts.map +1 -0
  6. package/dist/auth.d.ts +115 -22
  7. package/dist/auth.d.ts.map +1 -0
  8. package/dist/bundler.d.ts +207 -14
  9. package/dist/bundler.d.ts.map +1 -0
  10. package/dist/chunk-xm8h1dzh.js +33 -0
  11. package/dist/client.d.ts +19 -0
  12. package/dist/client.d.ts.map +1 -0
  13. package/dist/contract-errors.d.ts +4156 -0
  14. package/dist/contract-errors.d.ts.map +1 -0
  15. package/dist/contract.d.ts +17 -0
  16. package/dist/contract.d.ts.map +1 -0
  17. package/dist/cookie-store.d.ts +10 -0
  18. package/dist/cookie-store.d.ts.map +1 -0
  19. package/dist/dapi-errors.d.ts +650 -0
  20. package/dist/dapi-errors.d.ts.map +1 -0
  21. package/dist/errors.d.ts +633 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/index.d.ts +40 -28
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +96109 -131
  26. package/dist/platform.d.ts +41 -0
  27. package/dist/platform.d.ts.map +1 -0
  28. package/dist/plugins/index.d.ts +13 -0
  29. package/dist/plugins/index.d.ts.map +1 -0
  30. package/dist/plugins/index.js +10 -0
  31. package/dist/sdk-error.d.ts +74 -0
  32. package/dist/sdk-error.d.ts.map +1 -0
  33. package/dist/serializers.d.ts +41 -0
  34. package/dist/serializers.d.ts.map +1 -0
  35. package/dist/types.d.ts +102 -65
  36. package/dist/types.d.ts.map +1 -0
  37. package/dist/url.d.ts +1 -0
  38. package/dist/url.d.ts.map +1 -0
  39. package/dist/verify-webhook.d.ts +28 -17
  40. package/dist/verify-webhook.d.ts.map +1 -0
  41. package/dist/version.d.ts +1 -0
  42. package/dist/version.d.ts.map +1 -0
  43. package/dist/wait-for-transaction.d.ts +81 -54
  44. package/dist/wait-for-transaction.d.ts.map +1 -0
  45. package/dist/webhook-events.d.ts +27 -44
  46. package/dist/webhook-events.d.ts.map +1 -0
  47. package/package.json +30 -103
  48. package/dist/auth/client.d.ts +0 -113
  49. package/dist/auth/live.d.ts +0 -4366
  50. package/dist/auth.js +0 -329
  51. package/dist/bundler.js +0 -99
  52. package/dist/chunk-9k284df4.js +0 -4
  53. package/dist/chunk-def7rqy6.js +0 -946
  54. package/dist/chunk-f4t1bm86.js +0 -67
  55. package/dist/chunk-fjnq61hj.js +0 -11
  56. package/dist/chunk-h12fatty.js +0 -63
  57. package/dist/chunk-qp5ty384.js +0 -260
  58. package/dist/chunk-r0vsftj4.js +0 -102
  59. package/dist/chunk-tmk1f2yb.js +0 -33
  60. package/dist/chunk-y0d2c7kp.js +0 -54
  61. package/dist/client/conditional-request.d.ts +0 -30
  62. package/dist/client/factory.d.ts +0 -14
  63. package/dist/client/query-serializer.d.ts +0 -2
  64. package/dist/client/request-compression.d.ts +0 -47
  65. package/dist/client/ssr-fetch.d.ts +0 -12
  66. package/dist/effect.d.ts +0 -69
  67. package/dist/effect.js +0 -82
  68. package/dist/errors/api-error.d.ts +0 -29
  69. package/dist/errors/find-current-error.d.ts +0 -8
  70. package/dist/errors/sdk-error.d.ts +0 -52
  71. package/dist/errors/sdk-error.js +0 -8
  72. package/dist/generated/api-types.d.ts +0 -41271
  73. package/dist/generated/response-scalars.d.ts +0 -9
  74. package/dist/generated/routes.d.ts +0 -12
  75. package/dist/proxy/builder.d.ts +0 -47
  76. package/dist/proxy/client.d.ts +0 -32
  77. package/dist/proxy/fetch-executor.d.ts +0 -28
  78. package/dist/proxy/flat-args.d.ts +0 -51
  79. package/dist/proxy/settlement.d.ts +0 -67
  80. package/dist/proxy/sse.d.ts +0 -54
  81. package/dist/proxy/tanstack.d.ts +0 -27
  82. package/dist/proxy/transport.d.ts +0 -73
  83. package/dist/react-query.d.ts +0 -16
  84. package/dist/react-query.js +0 -13
  85. package/dist/readonly-deep.d.ts +0 -12
  86. package/dist/reads-as-funding-paused.d.ts +0 -20
  87. package/dist/routes/index.d.ts +0 -20
  88. package/dist/routes/index.js +0 -10
  89. package/dist/routes/types.d.ts +0 -51
  90. package/dist/runtime-exports.d.ts +0 -20
  91. package/dist/runtime-exports.js +0 -16
  92. package/dist/scalars/big-decimal.d.ts +0 -16
  93. package/dist/scalars/ethereum-address.d.ts +0 -20
  94. package/dist/scalars/exchange-rates.d.ts +0 -27
  95. package/dist/scalars/index.d.ts +0 -18
  96. package/dist/scalars/index.js +0 -86
  97. package/dist/scalars/organization-id.d.ts +0 -20
  98. package/dist/secret.d.ts +0 -14
  99. package/dist/sign-webhook-receipt.d.ts +0 -76
  100. package/dist/sign-webhook-receipt.js +0 -26
  101. package/dist/transport/cookie-store.d.ts +0 -9
  102. package/dist/transport/sse-lifecycle.d.ts +0 -44
  103. package/dist/verify-webhook.js +0 -8
  104. package/dist/wait-for-transaction.js +0 -120
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Combined DALP platform client factory.
3
+ *
4
+ * Related: kit/sdk/src/client.ts, kit/sdk/src/auth.ts
5
+ *
6
+ * @module
7
+ */
8
+ import { type DalpAuthClient } from "./auth.js";
9
+ import { DalpCookieStore } from "./cookie-store.js";
10
+ import type { DalpClient, DalpClientConfig } from "./types.js";
11
+ export interface DalpPlatformClientConfig {
12
+ /** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
13
+ url: string;
14
+ /** API key used by the DAPI client and, by default, the auth client. */
15
+ apiKey?: string;
16
+ /** Organization ID sent to both DAPI and auth operations when provided. */
17
+ organizationId?: string;
18
+ /** Headers merged into DAPI requests. */
19
+ headers?: DalpClientConfig["headers"];
20
+ /** Headers merged into Better Auth requests. */
21
+ authHeaders?: Record<string, string>;
22
+ /** Better Auth session token sent as an Authorization bearer token. */
23
+ sessionToken?: string;
24
+ /** Initial cookie header for Better Auth session handoff. */
25
+ cookie?: string;
26
+ /** Existing cookie store to reuse across platform clients. */
27
+ cookieStore?: DalpCookieStore;
28
+ /** Validate outgoing DAPI requests against the contract before sending. */
29
+ requestValidation?: boolean;
30
+ /** Validate incoming DAPI responses against the contract. */
31
+ responseValidation?: boolean;
32
+ /** Custom `fetch` implementation for both DAPI and Better Auth clients. */
33
+ fetch?: typeof globalThis.fetch;
34
+ }
35
+ export interface DalpPlatformClient {
36
+ dapi: DalpClient;
37
+ auth: DalpAuthClient;
38
+ cookieStore: DalpCookieStore;
39
+ }
40
+ export declare function createDalpPlatformClient(config: DalpPlatformClientConfig): DalpPlatformClient;
41
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAA0B,MAAM,YAAY,CAAC;AAEvF,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;IAEZ,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,yCAAyC;IACzC,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAEtC,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,EAAE,eAAe,CAAC;CAC9B;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,wBAAwB,GAAG,kBAAkB,CAyB7F"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Optional oRPC link plugins for advanced SDK usage.
3
+ *
4
+ * These are thin re-exports with JSDoc guidance. Import from
5
+ * `@settlemint/dalp-sdk/plugins` to keep the main entry point lean.
6
+ *
7
+ * Related: kit/sdk/src/client.ts
8
+ *
9
+ * @module
10
+ */
11
+ export { RequestValidationPlugin, ResponseValidationPlugin } from "@orpc/contract/plugins";
12
+ export { BatchLinkPlugin } from "@orpc/client/plugins";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import"../chunk-xm8h1dzh.js";
2
+
3
+ // src/plugins/index.ts
4
+ import { RequestValidationPlugin, ResponseValidationPlugin } from "@orpc/contract/plugins";
5
+ import { BatchLinkPlugin } from "@orpc/client/plugins";
6
+ export {
7
+ ResponseValidationPlugin,
8
+ RequestValidationPlugin,
9
+ BatchLinkPlugin
10
+ };
@@ -0,0 +1,74 @@
1
+ import { ORPCError } from "@orpc/client";
2
+ import type { DapiErrorId, DapiPublicError } from "./dapi-errors.js";
3
+ interface DalpOrpcErrorJson {
4
+ readonly defined: true;
5
+ readonly code: string;
6
+ readonly status: number;
7
+ readonly message: string;
8
+ readonly data: {
9
+ readonly id: string;
10
+ readonly category: string;
11
+ readonly retryable: boolean;
12
+ readonly why: string;
13
+ readonly fix: string;
14
+ readonly requestId?: string;
15
+ readonly retryAfterSeconds?: unknown;
16
+ readonly [key: string]: unknown;
17
+ };
18
+ }
19
+ export interface DalpSdkErrorOptions {
20
+ code?: string;
21
+ id?: DapiErrorId;
22
+ category: string;
23
+ status?: number;
24
+ retryable: boolean;
25
+ message: string;
26
+ why: string;
27
+ fix: string;
28
+ details?: Record<string, unknown>;
29
+ dapiError?: DapiPublicError;
30
+ /** Full ORPC `data` from the wire, including typed route/contract fields. */
31
+ orpcData?: Record<string, unknown>;
32
+ /**
33
+ * Seconds the server asks the client to wait before retrying, decoded from a
34
+ * `Retry-After`-bearing error (e.g. `INDEXER_REINDEXING`). Present only when
35
+ * the error carried the value; never a default.
36
+ */
37
+ retryAfterSeconds?: number;
38
+ cause?: unknown;
39
+ }
40
+ export interface DalpSdkConfigurationErrorInput {
41
+ message: string;
42
+ why: string;
43
+ fix: string;
44
+ cause?: unknown;
45
+ }
46
+ export type DalpSdkErrorJson = ReturnType<ORPCError<string, DapiPublicError | undefined>["toJSON"]> & {
47
+ id?: DapiErrorId;
48
+ category: string;
49
+ retryable: boolean;
50
+ why: string;
51
+ fix: string;
52
+ details?: Record<string, unknown>;
53
+ retryAfterSeconds?: number;
54
+ };
55
+ export declare class DalpSdkError extends ORPCError<string, DapiPublicError | undefined> {
56
+ readonly id?: DapiErrorId;
57
+ readonly category: string;
58
+ readonly retryable: boolean;
59
+ readonly why: string;
60
+ readonly fix: string;
61
+ readonly details?: Record<string, unknown>;
62
+ readonly dapiError?: DapiPublicError;
63
+ readonly retryAfterSeconds?: number;
64
+ constructor(options: DalpSdkErrorOptions);
65
+ toJSON(): DalpSdkErrorJson;
66
+ }
67
+ export declare function createDalpSdkConfigurationError(input: DalpSdkConfigurationErrorInput): DalpSdkError;
68
+ export declare function createDalpSdkErrorFromOrpcJson(parsed: DalpOrpcErrorJson, cause?: unknown, retryAfterSeconds?: number): DalpSdkError;
69
+ export declare function createDalpSdkErrorFromDapiPublicError(error: DapiPublicError, cause?: unknown, retryAfterSeconds?: number): DalpSdkError;
70
+ export declare function decodeDapiErrorResponseBody(body: unknown): DalpSdkError | null;
71
+ export declare function getDapiPublicErrorFromResponseBody(body: unknown): DapiPublicError | undefined;
72
+ export declare function isDapiPublicError(value: unknown): value is DapiPublicError;
73
+ export {};
74
+ //# sourceMappingURL=sdk-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-error.d.ts","sourceRoot":"","sources":["../src/sdk-error.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Custom JSON serializers for oRPC wire format.
3
+ *
4
+ * Vendored from @core/validation to avoid pulling in heavy transitive
5
+ * dependencies (viem, date-fns, iso-3166). Only the serializer objects
6
+ * are included — not the Zod schemas or helper functions.
7
+ *
8
+ * Related: packages/core/validation/src/bigdecimal.ts,
9
+ * packages/core/validation/src/bigint.ts,
10
+ * packages/core/validation/src/timestamp.ts
11
+ *
12
+ * @module
13
+ */
14
+ import type { StandardRPCCustomJsonSerializer } from "@orpc/client/standard";
15
+ /**
16
+ * Serializer for arbitrary-precision decimal values (dnum).
17
+ *
18
+ * Encodes `Dnum` values as locale-independent decimal strings on the wire
19
+ * and decodes them back into `Dnum` tuples on the receiving side.
20
+ */
21
+ export declare const bigDecimalSerializer: StandardRPCCustomJsonSerializer;
22
+ /**
23
+ * Serializer for native `bigint` values.
24
+ *
25
+ * Encodes bigints as decimal strings on the wire since JSON does not
26
+ * support the `bigint` primitive natively.
27
+ */
28
+ export declare const bigIntSerializer: StandardRPCCustomJsonSerializer;
29
+ /**
30
+ * Serializer for `Date` objects.
31
+ *
32
+ * Encodes dates as ISO-8601 strings on the wire and reconstructs
33
+ * `Date` instances on deserialization.
34
+ */
35
+ export declare const timestampSerializer: StandardRPCCustomJsonSerializer;
36
+ /**
37
+ * All DALP custom JSON serializers, pre-configured for use with
38
+ * `RPCLink` or `RPCHandler` `customJsonSerializers` option.
39
+ */
40
+ export declare const dalpSerializers: readonly StandardRPCCustomJsonSerializer[];
41
+ //# sourceMappingURL=serializers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../src/serializers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAqD7E;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,+BA6BlC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,+BAK9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,+BAKjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,+BAA+B,EAIrE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,73 +1,110 @@
1
1
  /**
2
- * Generated request, response, and model types for the v2 surface.
2
+ * Type-only exports for the DALP SDK.
3
3
  *
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.
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
7
8
  *
8
9
  * @module
9
10
  */
10
- import type { AssumableParticipant, 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;
20
- }
21
- /** Current ability to act as an assumable participant. */
22
- export type ActAvailability = AssumableParticipant["actAvailability"];
23
- /** Stable onboarding flags returned with the current user. */
24
- export type OnboardingState = UserMe["onboardingState"];
11
+ import type { ContractRouterClient } from "@orpc/contract";
12
+ import type { JsonifiedClient } from "@orpc/openapi-client";
13
+ import type { rpcContract } from "./contract.js";
25
14
  /**
26
- * One row of the authenticated user's event feed, on whichever ledger produced it.
15
+ * Fully typed DALP API client.
27
16
  *
28
- * Discriminated on `family`. Narrow before reading anything else: `blockNumber`,
29
- * `transactionHash`, `gasUsed` and `gasPrice` exist only on the `evm` arm, and
30
- * `ledgerOffset`, `updateId` and `nodeId` only on the `canton` one.
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`.
31
25
  */
32
- export type UserEvent = UserEventV2Item;
33
- /** The `evm` arm of {@link UserEvent}: one indexed contract event. */
34
- export type EvmUserEvent = EvmUserEventV2Item;
35
- /** One page of the authenticated user's event feed, across both chain families. */
36
- export type UserEventCollectionResponse = UserEventV2ItemCollectionResponse;
37
- /** One decoded name/value entry attached to a user activity event. */
38
- export type UserEventValue = NonNullable<EvmUserEvent["values"]>[number];
39
- /** Registry tier from which a topic scheme was inherited. */
40
- export type TokenTopicSchemeInheritanceLevel = TokenTopicScheme["inheritanceLevel"];
41
- /** Registry tier from which a trusted issuer was inherited. */
42
- export type TokenTrustedIssuerInheritanceLevel = TokenTrustedIssuer["inheritanceLevel"];
43
- /** Body accepted when a token-level topic scheme is created. */
44
- export type TokenTopicSchemeCreateInput = tokenTopicSchemes_create_Request;
45
- /** Body accepted when a token-level trusted issuer is created. */
46
- export type TokenTrustedIssuerCreateInput = tokenTrustedIssuers_create_Request;
47
- /** Successful token returned when a multisig invite is created. */
48
- export type MultisigDraftCreateInviteOutput = participantsMultisigDrafts_createInvite_Response;
49
- /** Body accepted when an issuer-signed scalar feed is created. */
50
- export type IssuerSignedCreateInput = system_feeds_issuerSigned_create_Request;
51
- /** Image slot accepted by the theme logo upload endpoints. */
52
- export type ThemeLogoMode = ThemeLogoUpload["mode"];
53
- /** Config carried by an attached historical-balances feature. */
54
- export type TokenFeatureHistoricalBalancesConfig = NonNullable<TokenFeatureHistoricalBalancesWire>;
55
- /** Config carried by an attached maturity-redemption feature. */
56
- export type TokenFeatureMaturityRedemptionConfig = NonNullable<TokenFeatureMaturityRedemptionWire>;
57
- /** Config carried by an attached fixed-treasury-yield feature. */
58
- export type TokenFeatureFixedTreasuryYieldConfig = NonNullable<TokenFeatureFixedTreasuryYieldWire>;
59
- /** Config carried by an attached dividend-yield feature. */
60
- export type TokenFeatureDividendYieldConfig = NonNullable<TokenFeatureDividendYieldWire>;
61
- /** Config carried by an attached interest-yield feature. */
62
- export type TokenFeatureInterestYieldConfig = NonNullable<TokenFeatureInterestYieldWire>;
63
- /** Config carried by an attached transaction-fee feature. */
64
- export type TokenFeatureTransactionFeeConfig = NonNullable<TokenFeatureTransactionFeeWire>;
65
- /** Config carried by an attached transaction-fee-accounting feature. */
66
- export type TokenFeatureTransactionFeeAccountingConfig = NonNullable<TokenFeatureTransactionFeeAccountingWire>;
67
- /** Config carried by an attached external-transaction-fee feature. */
68
- export type TokenFeatureExternalTransactionFeeConfig = NonNullable<TokenFeatureExternalTransactionFeeWire>;
69
- /** MIME type accepted by token-document upload endpoints. */
70
- export type TokenDocumentMimeType = TokenDocumentGetUploadUrlBody["mimeType"];
71
- /** Body accepted by the token-create endpoint. */
72
- export type TokenCreateInput = token_create_Request;
73
- export type * from "./generated/api-types.d.ts";
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;
102
+ }
103
+ /**
104
+ * Configuration for creating a public DALP API client.
105
+ */
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,CAAC,oBAAoB,CAAC,OAAO,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAE1G;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,UAAU,oBAAoB;IAC5B,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpG;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAEhC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/url.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare function normalizeDalpBaseUrl(url: string): string;
2
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsBxD"}
@@ -1,23 +1,34 @@
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";
1
+ import type { Webhook } from "./webhook-events.js";
2
+ export type WebhookVerificationFailure = "TIMESTAMP_SKEW" | "SECRET_MISMATCH" | "BODY_HASH_MISMATCH";
3
3
  export type WebhookVerificationResult = {
4
- readonly ok: true;
5
- readonly event: Webhook.Event;
4
+ ok: true;
5
+ event: Webhook.Event;
6
6
  } | {
7
- readonly ok: false;
8
- readonly code: WebhookVerificationFailure;
7
+ ok: false;
8
+ 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
- }
14
10
  export interface VerifyWebhookInput {
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;
11
+ rawBody: string | Uint8Array;
12
+ headers: Headers | Record<string, string | string[] | undefined>;
13
+ secret: string | readonly string[];
21
14
  }
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
+ */
22
24
  export declare function toStandardWebhookSecret(secret: string): string;
23
- export declare function verifyWebhook(input: VerifyWebhookInput): Promise<WebhookVerificationResult>;
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-webhook.d.ts","sourceRoot":"","sources":["../src/verify-webhook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAErG,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAA;CAAE,GAClC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,0BAA0B,CAAA;CAAE,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACjE,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CACpC;AAID;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAG,yBAAyB,CAkBzG"}
package/dist/version.d.ts CHANGED
@@ -2,3 +2,4 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAYA,mDAAmD;AACnD,eAAO,MAAM,WAAW,EAAE,MAA4B,CAAC;AAEvD,6DAA6D;AAC7D,eAAO,MAAM,cAAc,QAA6B,CAAC"}
@@ -1,67 +1,94 @@
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;
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;
9
24
  }
10
25
  export interface WaitForTransactionStatus {
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
- }
21
- /** Kind-scoped terminal result from the generated transaction status contract. */
22
- export type WaitForTransactionResult = NonNullable<EvmTransactionStatusOutput["result"]>;
23
- export interface WaitForTransactionSuccess extends WaitForTransactionStatus {
24
- readonly status: "COMPLETED";
26
+ transactionId: string;
27
+ status: string;
28
+ subStatus: string | null;
29
+ transactionHash: string | null;
30
+ errorMessage: string | null;
31
+ result?: WaitForTransactionResult;
25
32
  }
26
33
  export interface WaitForTransactionOptions {
27
- readonly timeoutMs?: number;
28
- readonly pollIntervalMs?: number;
29
- readonly signal?: AbortSignal;
30
- readonly onStatus?: (status: WaitForTransactionStatus) => void;
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;
38
+ /**
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`.
42
+ */
43
+ resolveOnPendingApproval?: boolean;
31
44
  /**
32
- * Whether the wait outlasts a funding pause. True, the default, restarts the
33
- * timeout on every status that reports an open funding ask, so the wait ends
34
- * only when the ask is paid or the platform fails the request. False ends
35
- * the wait on the first such status with reason `funding-paused`, for a
36
- * caller that shows the write as pending and lets the payment land on its
37
- * own time.
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"`.
38
49
  */
39
- readonly holdWhilePaused?: boolean;
40
- readonly now?: () => number;
41
- readonly sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
42
- readonly readStatus?: (transactionId: string, signal?: AbortSignal) => Promise<WaitForTransactionStatus>;
50
+ signal?: AbortSignal;
43
51
  }
44
- export type TransactionWaitFailureReason = "terminal-failure" | "timeout" | "aborted" | "funding-paused";
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
+ */
45
58
  export declare class DalpTransactionWaitError extends Error {
46
- readonly code = "sdk.transaction.WAIT_FAILED";
47
- readonly category: "operational";
48
59
  readonly transactionId: string;
49
- readonly reason: TransactionWaitFailureReason;
50
- readonly lastStatus?: WaitForTransactionStatus;
51
- readonly elapsedMs?: number;
52
- constructor(transactionId: string, reason: TransactionWaitFailureReason, lastStatus?: WaitForTransactionStatus, elapsedMs?: number);
53
- get status(): string;
54
- get subStatus(): string | null;
55
- get retryable(): boolean;
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
+ });
56
73
  }
57
- export declare const isDalpTransactionWaitError: (error: unknown) => error is DalpTransactionWaitError;
58
74
  /**
59
- * Poll transaction status until a terminal verdict, timeout, or abort.
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.
60
88
  *
61
- * The timeout measures the platform's progress. A status that reports an
62
- * open funding ask restarts it, so a write parked on an operator payment is
63
- * never reported as a timeout and a resumed write gets its whole budget back.
64
- * `holdWhilePaused: false` ends the wait on that status instead. The
65
- * `elapsedMs` a timeout carries is the whole wait, pauses included.
89
+ * @param client A DALP API client.
90
+ * @param transactionId The queue transaction identifier (UUIDv7) returned in the
91
+ * async-accepted envelope.
66
92
  */
67
- export declare function waitForTransaction(client: DalpClient, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionSuccess>;
93
+ export declare function waitForTransaction(client: DalpClient, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionStatus>;
94
+ //# sourceMappingURL=wait-for-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-for-transaction.d.ts","sourceRoot":"","sources":["../src/wait-for-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiB7C,wGAAwG;AACxG,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5D,QAAQ,CAAC,UAAU,EAAE,wBAAwB,GAAG,SAAS,CAAC;IAE1D,YAAY,OAAO,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,MAAM,EAAE,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC;QACnD,UAAU,CAAC,EAAE,wBAAwB,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,EAQA;CACF;AA0BD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,wBAAwB,CAAC,CAsFnC"}