@settlemint/dalp-sdk 3.1.26-main.37116470199 → 3.1.26
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.
- package/README.md +172 -239
- package/dist/api-types.generated.d.ts +14160 -0
- package/dist/api-types.generated.d.ts.map +1 -0
- package/dist/{auth/permissions.d.ts → auth-permissions.d.ts} +8 -0
- package/dist/auth-permissions.d.ts.map +1 -0
- package/dist/{auth/wallet-plugins.d.ts → auth-wallet-plugins.d.ts} +6 -68
- package/dist/auth-wallet-plugins.d.ts.map +1 -0
- package/dist/auth.d.ts +115 -8
- package/dist/auth.d.ts.map +1 -0
- package/dist/bundler.d.ts +217 -0
- package/dist/bundler.d.ts.map +1 -0
- package/dist/chunk-xm8h1dzh.js +33 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/contract-errors.d.ts +4156 -0
- package/dist/contract-errors.d.ts.map +1 -0
- package/dist/contract.d.ts +22 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/cookie-store.d.ts +10 -0
- package/dist/cookie-store.d.ts.map +1 -0
- package/dist/dapi-errors.d.ts +654 -0
- package/dist/dapi-errors.d.ts.map +1 -0
- package/dist/errors.d.ts +637 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +45 -28
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96216 -150
- package/dist/platform.d.ts +41 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +13 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +10 -0
- package/dist/sdk-error.d.ts +74 -0
- package/dist/sdk-error.d.ts.map +1 -0
- package/dist/serializers.d.ts +41 -0
- package/dist/serializers.d.ts.map +1 -0
- package/dist/types.d.ts +114 -37
- package/dist/types.d.ts.map +1 -0
- package/dist/url.d.ts +1 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/verify-webhook.d.ts +28 -17
- package/dist/verify-webhook.d.ts.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.generated.d.ts +8 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/wait-for-transaction.d.ts +86 -44
- package/dist/wait-for-transaction.d.ts.map +1 -0
- package/dist/webhook-events.d.ts +33 -543
- package/dist/webhook-events.d.ts.map +1 -0
- package/package.json +34 -110
- package/dist/auth/client.d.ts +0 -103
- package/dist/auth/invite-step-up.d.ts +0 -2
- package/dist/auth/live.d.ts +0 -47
- package/dist/auth/native-passkey.d.ts +0 -9
- package/dist/auth-surface.d.ts +0 -2
- package/dist/auth.js +0 -525
- package/dist/chunk-4f4kjtt0.js +0 -149
- package/dist/chunk-b03ycwb7.js +0 -68
- package/dist/chunk-ghgcmyhk.js +0 -5
- package/dist/chunk-h241xecg.js +0 -1625
- package/dist/chunk-hqz56e6q.js +0 -4
- package/dist/chunk-k3ntysxx.js +0 -57
- package/dist/chunk-pjjrxre1.js +0 -36
- package/dist/chunk-qvtjb3dz.js +0 -102
- package/dist/chunk-v54k7mgr.js +0 -271
- package/dist/chunk-w361dpdk.js +0 -5
- package/dist/client/conditional-request.d.ts +0 -8
- package/dist/client/factory.d.ts +0 -4
- package/dist/client/query-serializer.d.ts +0 -1
- package/dist/client/request-compression.d.ts +0 -12
- package/dist/client/ssr-fetch.d.ts +0 -10
- package/dist/client/step-up-challenge.d.ts +0 -10
- package/dist/effect.d.ts +0 -38
- package/dist/effect.js +0 -87
- package/dist/errors/api-error.d.ts +0 -35
- package/dist/errors/error-codes.d.ts +0 -21
- package/dist/errors/find-current-error.d.ts +0 -2
- package/dist/errors/sdk-error.d.ts +0 -52
- package/dist/errors/sdk-error.js +0 -8
- package/dist/generated/api-types.d.ts +0 -69961
- package/dist/generated/console-routes.d.ts +0 -12
- package/dist/generated/error-catalog.d.ts +0 -9
- package/dist/generated/error-codes.d.ts +0 -9
- package/dist/generated/response-scalars.d.ts +0 -9
- package/dist/generated/response-schemas.d.ts +0 -9
- package/dist/generated/route-error-codes.d.ts +0 -9
- package/dist/generated/routes.d.ts +0 -12
- package/dist/proxy/builder.d.ts +0 -17
- package/dist/proxy/client-core.d.ts +0 -28
- package/dist/proxy/client.d.ts +0 -5
- package/dist/proxy/fetch-executor.d.ts +0 -6
- package/dist/proxy/flat-args.d.ts +0 -24
- package/dist/proxy/response-decode.d.ts +0 -37
- package/dist/proxy/sse.d.ts +0 -11
- package/dist/proxy/step-up-challenge.d.ts +0 -4
- package/dist/proxy/tanstack.d.ts +0 -6
- package/dist/proxy/transport.d.ts +0 -63
- package/dist/react-query.d.ts +0 -2
- package/dist/react-query.js +0 -12
- package/dist/readonly-deep.d.ts +0 -3
- package/dist/routes/console.d.ts +0 -14
- package/dist/routes/console.js +0 -25
- package/dist/routes/index.d.ts +0 -4
- package/dist/routes/index.js +0 -10
- package/dist/routes/types.d.ts +0 -72
- package/dist/runtime-exports.d.ts +0 -4
- package/dist/runtime-exports.js +0 -16
- package/dist/runtime.d.ts +0 -11
- package/dist/scalars/big-decimal.d.ts +0 -4
- package/dist/scalars/ethereum-address.d.ts +0 -5
- package/dist/scalars/exchange-rates.d.ts +0 -13
- package/dist/scalars/index.d.ts +0 -10
- package/dist/scalars/index.js +0 -102
- package/dist/scalars/organization-id.d.ts +0 -5
- package/dist/scalars/token-decimals.d.ts +0 -4
- package/dist/secret.d.ts +0 -12
- package/dist/sign-webhook-receipt.d.ts +0 -16
- package/dist/sign-webhook-receipt.js +0 -26
- package/dist/transport/cookie-store.d.ts +0 -9
- package/dist/transport/sse-lifecycle.d.ts +0 -24
- package/dist/verify-webhook.js +0 -8
- package/dist/wait-for-transaction.js +0 -151
|
@@ -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":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE,UAAU,iBAAiB;IACzB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,G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,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,38 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type-only exports for the DALP SDK.
|
|
3
|
+
*
|
|
4
|
+
* Import from `@settlemint/dalp-sdk/types` when you only need types
|
|
5
|
+
* (e.g., for function signatures) without pulling in runtime code.
|
|
6
|
+
*
|
|
7
|
+
* Related: kit/sdk/src/client.ts
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import type { DalpApi } from "./api-types.generated.js";
|
|
12
|
+
/**
|
|
13
|
+
* Fully typed DALP API client.
|
|
14
|
+
*
|
|
15
|
+
* The shapes come from `./api-types.generated.ts` rather than from the contract
|
|
16
|
+
* router's inferred type. A declaration that names the contract cannot be
|
|
17
|
+
* published: `@dalp/api-contract` is private, and the inferred type does not
|
|
18
|
+
* survive declaration emit at all (`TS7056` on the larger route files). See
|
|
19
|
+
* `./contract.ts`.
|
|
20
|
+
*
|
|
21
|
+
* Response values carry the wire representation, so a `bigint` field reads as a
|
|
22
|
+
* decimal string and a timestamp as an ISO string. The client serializes on the
|
|
23
|
+
* way out but does not decode on the way back, so a request may pass either the
|
|
24
|
+
* native value or its string form.
|
|
25
|
+
*
|
|
26
|
+
* Provides auto-completed access to all v2 API namespaces:
|
|
27
|
+
* `account`, `actions`, `addons`, `admin`, `contacts`, `exchangeRates`,
|
|
28
|
+
* `externalToken`, `identityRecovery`, `monitoring`, `search`,
|
|
29
|
+
* `settings`, `system`, `token`, `transaction`, `user`.
|
|
30
|
+
*/
|
|
31
|
+
export type DalpClient = DalpApi;
|
|
32
|
+
/**
|
|
33
|
+
* Per-call client context threaded into individual SDK operations as the second
|
|
34
|
+
* argument, e.g. `client.token.create(input, { context: { idempotencyKey } })`.
|
|
35
|
+
* Every field is optional and scoped to the single call, unlike the client-level
|
|
36
|
+
* {@link BaseDalpClientConfig.idempotencyKey} which applies to every request.
|
|
37
|
+
*/
|
|
38
|
+
export interface DalpClientCallContext {
|
|
39
|
+
/**
|
|
40
|
+
* Idempotency key sent as the `Idempotency-Key` header for this call only,
|
|
41
|
+
* overriding any client-level key. Use a fresh value per genuine retry of a
|
|
42
|
+
* failed mutation: dapi burns the key of a failed transaction, so re-sending
|
|
43
|
+
* under the same key is rejected ("previously failed. Use a new idempotency
|
|
44
|
+
* key to retry"). A stable value within one logical attempt keeps network-level
|
|
45
|
+
* fetch retries deduplicated.
|
|
46
|
+
*/
|
|
47
|
+
idempotencyKey?: string;
|
|
48
|
+
/**
|
|
49
|
+
* oRPC error codes the caller treats as expected for this call and does not
|
|
50
|
+
* want surfaced by its own error logging (e.g. an existence probe that accepts
|
|
51
|
+
* `NOT_FOUND`). A client-side hint scoped to the single call; it is not sent to
|
|
52
|
+
* the server.
|
|
53
|
+
*/
|
|
54
|
+
skipLoggingFor?: readonly string[];
|
|
8
55
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
interface BaseDalpClientConfig {
|
|
57
|
+
/** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
|
|
58
|
+
url: string;
|
|
59
|
+
/**
|
|
60
|
+
* Organization ID for multi-tenant setups.
|
|
61
|
+
* Required when the API key is scoped to multiple organizations.
|
|
62
|
+
*/
|
|
63
|
+
organizationId?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Additional headers merged into every request.
|
|
66
|
+
* Accepts a static object or a (possibly async) function for dynamic headers.
|
|
67
|
+
* Can override defaults like `User-Agent` but cannot override security headers (`x-api-key`, `x-organization-id`).
|
|
68
|
+
*/
|
|
69
|
+
headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
70
|
+
/**
|
|
71
|
+
* Validate outgoing requests against the contract before sending.
|
|
72
|
+
* Catches schema violations client-side for faster feedback.
|
|
73
|
+
* @defaultValue false
|
|
74
|
+
*/
|
|
75
|
+
requestValidation?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Validate incoming responses against the contract.
|
|
78
|
+
* Useful during development to catch API drift.
|
|
79
|
+
* @defaultValue false
|
|
80
|
+
*/
|
|
81
|
+
responseValidation?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Custom `fetch` implementation.
|
|
84
|
+
* Use this to inject logging, proxy configuration, or test doubles.
|
|
85
|
+
*/
|
|
86
|
+
fetch?: typeof globalThis.fetch;
|
|
87
|
+
/**
|
|
88
|
+
* Idempotency key sent as the `Idempotency-Key` header on every request.
|
|
89
|
+
*
|
|
90
|
+
* **Warning:** This value is sent on _every_ request made by the client.
|
|
91
|
+
* If you reuse the same client instance for multiple mutations, the server
|
|
92
|
+
* will deduplicate all but the first — subsequent mutations silently return
|
|
93
|
+
* the first response. Only set this when the client is used for a single
|
|
94
|
+
* mutation (e.g., a one-shot script). For multi-mutation workflows, set the
|
|
95
|
+
* header per-request via the `headers` callback instead.
|
|
96
|
+
*
|
|
97
|
+
* When omitted, no idempotency key header is sent.
|
|
98
|
+
*/
|
|
99
|
+
idempotencyKey?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Configuration for creating an authenticated DALP API client.
|
|
103
|
+
*/
|
|
104
|
+
export interface DalpClientConfig extends BaseDalpClientConfig {
|
|
105
|
+
/** API key for authenticated routes (issued via the DALP dashboard or CLI). */
|
|
106
|
+
apiKey: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Configuration for creating a public DALP API client.
|
|
110
|
+
*/
|
|
111
|
+
export interface PublicDalpClientConfig extends BaseDalpClientConfig {
|
|
112
|
+
apiKey?: undefined;
|
|
113
|
+
}
|
|
114
|
+
export type { WalletAuthEndpointPath } from "./auth-wallet-plugins.js";
|
|
115
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AAEjC;;;;;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
|
@@ -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"}
|
package/dist/verify-webhook.d.ts
CHANGED
|
@@ -1,23 +1,34 @@
|
|
|
1
|
-
import type { Webhook } from "./webhook-events.
|
|
2
|
-
export type WebhookVerificationFailure = "TIMESTAMP_SKEW" | "SECRET_MISMATCH" | "BODY_HASH_MISMATCH"
|
|
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
|
-
|
|
5
|
-
|
|
4
|
+
ok: true;
|
|
5
|
+
event: Webhook.Event;
|
|
6
6
|
} | {
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAcA,mDAAmD;AACnD,eAAO,MAAM,WAAW,EAAE,MAA4B,CAAC;AAEvD,6DAA6D;AAC7D,eAAO,MAAM,cAAc,QAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.generated.d.ts","sourceRoot":"","sources":["../src/version.generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
|
|
@@ -1,52 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly result?: WaitForTransactionResult;
|
|
18
|
-
readonly activeRequirement?: EvmTransactionStatusOutput["activeRequirement"];
|
|
19
|
-
readonly activeRequirementUnavailable?: EvmTransactionStatusOutput["activeRequirementUnavailable"];
|
|
20
|
-
readonly indexerRebuild?: EvmTransactionStatusOutput["indexerRebuild"];
|
|
21
|
-
readonly indexerRebuildUnavailable?: EvmTransactionStatusOutput["indexerRebuildUnavailable"];
|
|
22
|
-
}
|
|
23
|
-
export type WaitForTransactionResult = NonNullable<EvmTransactionStatusOutput["result"]>;
|
|
24
|
-
export interface WaitForTransactionSuccess extends WaitForTransactionStatus {
|
|
25
|
-
readonly status: "COMPLETED";
|
|
26
|
+
transactionId: string;
|
|
27
|
+
status: string;
|
|
28
|
+
subStatus: string | null;
|
|
29
|
+
transactionHash: string | null;
|
|
30
|
+
errorMessage: string | null;
|
|
31
|
+
result?: WaitForTransactionResult;
|
|
26
32
|
}
|
|
27
33
|
export interface WaitForTransactionOptions {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
44
|
+
/**
|
|
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"`.
|
|
49
|
+
*/
|
|
50
|
+
signal?: AbortSignal;
|
|
37
51
|
}
|
|
38
|
-
|
|
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
|
+
*/
|
|
39
58
|
export declare class DalpTransactionWaitError extends Error {
|
|
40
|
-
readonly code = "sdk.transaction.WAIT_FAILED";
|
|
41
|
-
readonly category: "operational";
|
|
42
59
|
readonly transactionId: string;
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
});
|
|
50
73
|
}
|
|
51
|
-
|
|
52
|
-
|
|
74
|
+
/**
|
|
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.
|
|
88
|
+
*
|
|
89
|
+
* @param client A DALP API client.
|
|
90
|
+
* @param transactionId The queue transaction identifier (UUIDv7) returned in the
|
|
91
|
+
* async-accepted envelope.
|
|
92
|
+
*/
|
|
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,SA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