@settlemint/dalp-sdk 3.1.10 → 3.1.11-main.33538712635
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 +111 -177
- package/dist/auth/client.d.ts +115 -0
- package/dist/auth/live.d.ts +4366 -0
- package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +1 -2
- package/dist/{auth-wallet-plugins.d.ts → auth/wallet-plugins.d.ts} +69 -5
- package/dist/auth.d.ts +22 -115
- package/dist/auth.js +248 -0
- package/dist/bundler.d.ts +17 -207
- package/dist/bundler.js +111 -0
- package/dist/chunk-63xjs3xe.js +45725 -0
- package/dist/chunk-cy9b59s6.js +503 -0
- package/dist/chunk-h12fatty.js +63 -0
- package/dist/chunk-nac758dt.js +14542 -0
- package/dist/chunk-p009n1rm.js +255 -0
- package/dist/chunk-r0vsftj4.js +102 -0
- package/dist/chunk-w21k7p99.js +843 -0
- package/dist/chunk-y0d2c7kp.js +54 -0
- package/dist/client/conditional-request.d.ts +16 -0
- package/dist/client/factory.d.ts +39 -0
- package/dist/client/query-serializer.d.ts +2 -0
- package/dist/client/request-compression.d.ts +47 -0
- package/dist/client/ssr-fetch.d.ts +12 -0
- package/dist/errors/api-error.d.ts +29 -0
- package/dist/errors/find-current-error.d.ts +8 -0
- package/dist/errors/sdk-error.d.ts +52 -0
- package/dist/errors/sdk-error.js +8 -0
- package/dist/generated/@tanstack/react-query.gen.d.ts +17380 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +10 -0
- package/dist/generated/client/types.gen.d.ts +120 -0
- package/dist/generated/client/utils.gen.d.ts +37 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +25 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +83 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/sdk.gen.d.ts +5214 -0
- package/dist/generated/types.gen.d.ts +137282 -0
- package/dist/generated/zod.gen.d.ts +181286 -0
- package/dist/index.d.ts +23 -40
- package/dist/index.js +208 -96098
- package/dist/operations.d.ts +12 -0
- package/dist/operations.js +1747 -0
- package/dist/react-query.d.ts +11 -0
- package/dist/react-query.js +16485 -0
- package/dist/readonly-deep.d.ts +12 -0
- package/dist/runtime-exports.d.ts +20 -0
- package/dist/runtime-exports.js +16 -0
- package/dist/scalars/big-decimal.d.ts +16 -0
- package/dist/scalars/ethereum-address.d.ts +8 -0
- package/dist/scalars/exchange-rates.d.ts +36 -0
- package/dist/scalars/index.d.ts +15 -0
- package/dist/scalars/index.js +39 -0
- package/dist/scalars/organization-id.d.ts +8 -0
- package/dist/schemas.d.ts +10 -0
- package/dist/schemas.js +12040 -0
- package/dist/secret.d.ts +14 -0
- package/dist/sign-webhook-receipt.d.ts +76 -0
- package/dist/sign-webhook-receipt.js +26 -0
- package/dist/transport/cookie-store.d.ts +9 -0
- package/dist/transport/sse-lifecycle.d.ts +44 -0
- package/dist/types.d.ts +67 -102
- package/dist/url.d.ts +0 -1
- package/dist/verify-webhook.d.ts +17 -28
- package/dist/verify-webhook.js +8 -0
- package/dist/version.d.ts +0 -1
- package/dist/wait-for-transaction.d.ts +40 -86
- package/dist/wait-for-transaction.js +112 -0
- package/dist/webhook-events.d.ts +44 -27
- package/package.json +98 -30
- package/dist/auth-permissions.d.ts.map +0 -1
- package/dist/auth-wallet-plugins.d.ts.map +0 -1
- package/dist/auth.d.ts.map +0 -1
- package/dist/bundler.d.ts.map +0 -1
- package/dist/chunk-xm8h1dzh.js +0 -33
- package/dist/client.d.ts +0 -19
- package/dist/client.d.ts.map +0 -1
- package/dist/contract-errors.d.ts +0 -4156
- package/dist/contract-errors.d.ts.map +0 -1
- package/dist/contract.d.ts +0 -17
- package/dist/contract.d.ts.map +0 -1
- package/dist/cookie-store.d.ts +0 -10
- package/dist/cookie-store.d.ts.map +0 -1
- package/dist/dapi-errors.d.ts +0 -650
- package/dist/dapi-errors.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -633
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/platform.d.ts +0 -41
- package/dist/platform.d.ts.map +0 -1
- package/dist/plugins/index.d.ts +0 -13
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -10
- package/dist/sdk-error.d.ts +0 -74
- package/dist/sdk-error.d.ts.map +0 -1
- package/dist/serializers.d.ts +0 -41
- package/dist/serializers.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/url.d.ts.map +0 -1
- package/dist/verify-webhook.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/wait-for-transaction.d.ts.map +0 -1
- package/dist/webhook-events.d.ts.map +0 -1
package/dist/secret.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const SECRET_REDACTION_MARKER = "[REDACTED]";
|
|
2
|
+
declare const inspectSymbol: unique symbol;
|
|
3
|
+
/** Opaque secret value which cannot leak through common serialization paths. */
|
|
4
|
+
export declare class Secret {
|
|
5
|
+
private constructor();
|
|
6
|
+
static from(value: string): Secret;
|
|
7
|
+
toString(): string;
|
|
8
|
+
toJSON(): string;
|
|
9
|
+
[inspectSymbol](): string;
|
|
10
|
+
}
|
|
11
|
+
export declare const secret: (value: string) => Secret;
|
|
12
|
+
/** Reveal a secret only at the transport header-injection boundary. */
|
|
13
|
+
export declare const unwrapSecret: (value: Secret) => string;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counter-sign a DALP webhook delivery receipt.
|
|
3
|
+
*
|
|
4
|
+
* The inbound half of webhook signing (`verifyWebhook`) proves a delivery
|
|
5
|
+
* DALP sent is authentic. This is the return half: after a consumer verifies
|
|
6
|
+
* and accepts a delivery, it counter-signs a receipt so the platform has
|
|
7
|
+
* non-repudiation proof the consumer received and acknowledged that specific
|
|
8
|
+
* delivery. Submit the result to `POST /api/v2/webhook-receipts`.
|
|
9
|
+
*
|
|
10
|
+
* The canonical signing string and HMAC mirror the server-side implementation,
|
|
11
|
+
* which a published package cannot import. A shared golden test vector pins the
|
|
12
|
+
* output of both so the two copies cannot drift.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Scheme tag prefixed to the counter-signed receipt signing string. It
|
|
18
|
+
* domain-separates receipt signatures from inbound delivery signatures and
|
|
19
|
+
* reserves room for a future scheme revision.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RECEIPT_SIGNING_SCHEME = "dalp.whr.v1";
|
|
22
|
+
/** The delivery tuple a receipt signature binds. */
|
|
23
|
+
export interface ReceiptSigningTuple {
|
|
24
|
+
/** The delivery being acknowledged. A retry allocates a fresh `deliveryId`. */
|
|
25
|
+
deliveryId: string;
|
|
26
|
+
/** The endpoint that received the delivery. */
|
|
27
|
+
endpointId: string;
|
|
28
|
+
/** The event identifier carried by the delivery (`evt_*`). */
|
|
29
|
+
evtId: string;
|
|
30
|
+
/** The hash of the delivered event body (`sha256:<hex>`). */
|
|
31
|
+
innerEventHash: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SignWebhookReceiptInput extends ReceiptSigningTuple {
|
|
34
|
+
/** The endpoint signing secret (`dalp_whsk_...`); the prefix is stripped for you. */
|
|
35
|
+
secret: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build the canonical string a consumer HMACs to counter-sign a receipt.
|
|
39
|
+
*
|
|
40
|
+
* Binding the signature to the full delivery tuple, not just the event body
|
|
41
|
+
* hash, is what closes the receipt-replay window: a retry allocates a fresh
|
|
42
|
+
* `deliveryId` for the same event, so a signature minted for one attempt
|
|
43
|
+
* produces a different signing string than another attempt and no longer
|
|
44
|
+
* verifies against it.
|
|
45
|
+
*
|
|
46
|
+
* Newline-joined is unambiguous because every field carries no newline:
|
|
47
|
+
* `deliveryId`/`endpointId` are UUIDs, `evtId` is the server-issued `evt_*`
|
|
48
|
+
* identifier, and `innerEventHash` is `sha256:<hex>`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildReceiptSigningString(tuple: Readonly<ReceiptSigningTuple>): string;
|
|
51
|
+
/**
|
|
52
|
+
* Counter-sign a webhook delivery receipt.
|
|
53
|
+
*
|
|
54
|
+
* Returns the lowercase hex `HMAC-SHA256(key, signingString)` to submit as the
|
|
55
|
+
* receipt's `consumerSignature`. The key is the base64-decoded prefix-stripped
|
|
56
|
+
* secret, the same derivation the Standard Webhooks library uses for inbound
|
|
57
|
+
* delivery verification (`verifyWebhook`) and that the dispatcher signs with —
|
|
58
|
+
* so the receipt and the delivery share key material.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const consumerSignature = signWebhookReceipt({
|
|
63
|
+
* deliveryId,
|
|
64
|
+
* endpointId,
|
|
65
|
+
* evtId,
|
|
66
|
+
* innerEventHash,
|
|
67
|
+
* secret, // the endpoint's dalp_whsk_... signing secret
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function signWebhookReceipt({ secret, ...tuple }: Readonly<SignWebhookReceiptInput>): string;
|
|
72
|
+
export interface VerifyWebhookReceiptInput extends SignWebhookReceiptInput {
|
|
73
|
+
readonly signature: string;
|
|
74
|
+
}
|
|
75
|
+
/** Verify a counter-signed receipt without leaking signature timing. */
|
|
76
|
+
export declare function verifyWebhookReceipt({ signature, ...input }: Readonly<VerifyWebhookReceiptInput>): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toStandardWebhookSecret
|
|
3
|
+
} from "./chunk-r0vsftj4.js";
|
|
4
|
+
|
|
5
|
+
// src/sign-webhook-receipt.ts
|
|
6
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
7
|
+
var RECEIPT_SIGNING_SCHEME = "dalp.whr.v1";
|
|
8
|
+
function buildReceiptSigningString(tuple) {
|
|
9
|
+
return [RECEIPT_SIGNING_SCHEME, tuple.deliveryId, tuple.endpointId, tuple.evtId, tuple.innerEventHash].join(`
|
|
10
|
+
`);
|
|
11
|
+
}
|
|
12
|
+
function signWebhookReceipt({ secret, ...tuple }) {
|
|
13
|
+
const key = Buffer.from(toStandardWebhookSecret(secret), "base64");
|
|
14
|
+
return createHmac("sha256", key).update(buildReceiptSigningString(tuple), "utf8").digest("hex");
|
|
15
|
+
}
|
|
16
|
+
function verifyWebhookReceipt({ signature, ...input }) {
|
|
17
|
+
const expected = Buffer.from(signWebhookReceipt(input), "hex");
|
|
18
|
+
const received = Buffer.from(signature, "hex");
|
|
19
|
+
return expected.length === received.length && timingSafeEqual(expected, received);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
RECEIPT_SIGNING_SCHEME,
|
|
23
|
+
buildReceiptSigningString,
|
|
24
|
+
signWebhookReceipt,
|
|
25
|
+
verifyWebhookReceipt
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CookieStoreFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
export interface CookieStoreShape {
|
|
3
|
+
readonly header: () => string;
|
|
4
|
+
readonly isEmpty: () => boolean;
|
|
5
|
+
readonly setCookieHeader: (header: string) => void;
|
|
6
|
+
readonly storeSetCookieHeaders: (headers: ReadonlyArray<string>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function makeCookieStore(initialHeader?: string): CookieStoreShape;
|
|
9
|
+
export declare function createCookieStoreFetch(cookieStore: CookieStoreShape, fetchImpl?: CookieStoreFetch): CookieStoreFetch;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type SseEventDisposition = "continue" | "success" | "failure";
|
|
2
|
+
export interface SseStreamResult<T> {
|
|
3
|
+
readonly stream: AsyncIterable<T>;
|
|
4
|
+
}
|
|
5
|
+
export interface SseLifecycleOptions<T> {
|
|
6
|
+
readonly connect: (signal: AbortSignal) => Promise<SseStreamResult<T>>;
|
|
7
|
+
readonly classify: (event: T) => SseEventDisposition;
|
|
8
|
+
readonly signal?: AbortSignal;
|
|
9
|
+
readonly onEvent?: (event: T) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Opt into a bounded attempt count instead of the wall-clock window. Only
|
|
12
|
+
* for callers that genuinely want "n tries and stop" — a count is a poor
|
|
13
|
+
* budget when every failure is instant, because a single multi-second
|
|
14
|
+
* backend stall spends it all in a few hundred milliseconds.
|
|
15
|
+
*/
|
|
16
|
+
readonly maxReconnects?: number;
|
|
17
|
+
/**
|
|
18
|
+
* How long to keep reconnecting through an unbroken run of failures, in
|
|
19
|
+
* wall-clock milliseconds. The window is anchored at the first failure of a
|
|
20
|
+
* streak and restarts only after a connection stays up for
|
|
21
|
+
* `healthyConnectionMs`, so a long-lived stream that dies late still gets a
|
|
22
|
+
* full window.
|
|
23
|
+
*/
|
|
24
|
+
readonly reconnectWindowMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* How long a connection must stay up to count as recovered and clear the
|
|
27
|
+
* failure streak. Receiving events is deliberately *not* the test: a stream
|
|
28
|
+
* that replays its opening frame on every subscription would clear the
|
|
29
|
+
* streak on each attempt and reconnect forever.
|
|
30
|
+
*/
|
|
31
|
+
readonly healthyConnectionMs?: number;
|
|
32
|
+
readonly initialBackoffMs?: number;
|
|
33
|
+
readonly maxBackoffMs?: number;
|
|
34
|
+
readonly sleep?: (milliseconds: number) => Promise<void>;
|
|
35
|
+
readonly now?: () => number;
|
|
36
|
+
}
|
|
37
|
+
export type SseLifecycleFailureReason = "aborted" | "terminal-failure" | "transport-failure";
|
|
38
|
+
export declare class SseLifecycleError<T = unknown> extends Error {
|
|
39
|
+
readonly reason: SseLifecycleFailureReason;
|
|
40
|
+
readonly lastEvent?: T;
|
|
41
|
+
constructor(reason: SseLifecycleFailureReason, lastEvent?: T, options?: ErrorOptions);
|
|
42
|
+
}
|
|
43
|
+
/** Add terminal-state semantics to a generated Hey API SSE stream. */
|
|
44
|
+
export declare function consumeSseUntilTerminal<T>(options: SseLifecycleOptions<T>): Promise<T>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,110 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Generated request, response, and model types for the v2 surface.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Related: kit/sdk/src/client.ts
|
|
4
|
+
* Type-only by construction — the emitted JavaScript is empty, so a consumer
|
|
5
|
+
* that imports only types pays nothing at runtime. The dist completeness
|
|
6
|
+
* graph accepts that empty file when `dist/types.d.ts` is present.
|
|
8
7
|
*
|
|
9
8
|
* @module
|
|
10
9
|
*/
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* Provides auto-completed access to all v2 API namespaces:
|
|
22
|
-
* `account`, `actions`, `addons`, `admin`, `contacts`, `exchangeRates`,
|
|
23
|
-
* `externalToken`, `identityRecovery`, `monitoring`, `search`,
|
|
24
|
-
* `settings`, `system`, `token`, `transaction`, `user`.
|
|
25
|
-
*/
|
|
26
|
-
export type DalpClient = JsonifiedClient<ContractRouterClient<typeof rpcContract, DalpClientCallContext>>;
|
|
27
|
-
/**
|
|
28
|
-
* Per-call client context threaded into individual SDK operations as the second
|
|
29
|
-
* argument, e.g. `client.token.create(input, { context: { idempotencyKey } })`.
|
|
30
|
-
* Every field is optional and scoped to the single call, unlike the client-level
|
|
31
|
-
* {@link BaseDalpClientConfig.idempotencyKey} which applies to every request.
|
|
32
|
-
*/
|
|
33
|
-
export interface DalpClientCallContext {
|
|
34
|
-
/**
|
|
35
|
-
* Idempotency key sent as the `Idempotency-Key` header for this call only,
|
|
36
|
-
* overriding any client-level key. Use a fresh value per genuine retry of a
|
|
37
|
-
* failed mutation: dapi burns the key of a failed transaction, so re-sending
|
|
38
|
-
* under the same key is rejected ("previously failed. Use a new idempotency
|
|
39
|
-
* key to retry"). A stable value within one logical attempt keeps network-level
|
|
40
|
-
* fetch retries deduplicated.
|
|
41
|
-
*/
|
|
42
|
-
idempotencyKey?: string;
|
|
43
|
-
/**
|
|
44
|
-
* oRPC error codes the caller treats as expected for this call and does not
|
|
45
|
-
* want surfaced by its own error logging (e.g. an existence probe that accepts
|
|
46
|
-
* `NOT_FOUND`). A client-side hint scoped to the single call; it is not sent to
|
|
47
|
-
* the server.
|
|
48
|
-
*/
|
|
49
|
-
skipLoggingFor?: readonly string[];
|
|
50
|
-
}
|
|
51
|
-
interface BaseDalpClientConfig {
|
|
52
|
-
/** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
|
|
53
|
-
url: string;
|
|
54
|
-
/**
|
|
55
|
-
* Organization ID for multi-tenant setups.
|
|
56
|
-
* Required when the API key is scoped to multiple organizations.
|
|
57
|
-
*/
|
|
58
|
-
organizationId?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Additional headers merged into every request.
|
|
61
|
-
* Accepts a static object or a (possibly async) function for dynamic headers.
|
|
62
|
-
* Can override defaults like `User-Agent` but cannot override security headers (`x-api-key`, `x-organization-id`).
|
|
63
|
-
*/
|
|
64
|
-
headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
65
|
-
/**
|
|
66
|
-
* Validate outgoing requests against the contract before sending.
|
|
67
|
-
* Catches schema violations client-side for faster feedback.
|
|
68
|
-
* @defaultValue false
|
|
69
|
-
*/
|
|
70
|
-
requestValidation?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Validate incoming responses against the contract.
|
|
73
|
-
* Useful during development to catch API drift.
|
|
74
|
-
* @defaultValue false
|
|
75
|
-
*/
|
|
76
|
-
responseValidation?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Custom `fetch` implementation.
|
|
79
|
-
* Use this to inject logging, proxy configuration, or test doubles.
|
|
80
|
-
*/
|
|
81
|
-
fetch?: typeof globalThis.fetch;
|
|
82
|
-
/**
|
|
83
|
-
* Idempotency key sent as the `Idempotency-Key` header on every request.
|
|
84
|
-
*
|
|
85
|
-
* **Warning:** This value is sent on _every_ request made by the client.
|
|
86
|
-
* If you reuse the same client instance for multiple mutations, the server
|
|
87
|
-
* will deduplicate all but the first — subsequent mutations silently return
|
|
88
|
-
* the first response. Only set this when the client is used for a single
|
|
89
|
-
* mutation (e.g., a one-shot script). For multi-mutation workflows, set the
|
|
90
|
-
* header per-request via the `headers` callback instead.
|
|
91
|
-
*
|
|
92
|
-
* When omitted, no idempotency key header is sent.
|
|
93
|
-
*/
|
|
94
|
-
idempotencyKey?: string;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Configuration for creating an authenticated DALP API client.
|
|
98
|
-
*/
|
|
99
|
-
export interface DalpClientConfig extends BaseDalpClientConfig {
|
|
100
|
-
/** API key for authenticated routes (issued via the DALP dashboard or CLI). */
|
|
101
|
-
apiKey: string;
|
|
10
|
+
import type { AssumableParticipant, CollectionFacetEntry, 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, V2ParticipantsMultisigDraftsCreateInviteResponse, V2TokenCreateData, V2SystemFeedsIssuerSignedCreateData, V2TokenTopicSchemesCreateData, V2TokenTrustedIssuersCreateData } from "./generated/types.gen.ts";
|
|
11
|
+
/** Participant kinds returned by the participant search surface. */
|
|
12
|
+
export type ParticipantKind = "person" | "company" | "fund" | "spv" | "department" | "joint_account" | "asset" | "organisation" | "claim_issuer" | "addon";
|
|
13
|
+
/** Address projection requested from participant search. */
|
|
14
|
+
export type ParticipantAddressPurpose = "transfer" | "identity" | "participant";
|
|
15
|
+
/** Token eligibility filter accepted by participant search. */
|
|
16
|
+
export interface EligibleForTokenFilter {
|
|
17
|
+
readonly tokenAddress: EvmAddress;
|
|
18
|
+
readonly action: "mint" | "transfer" | "burn";
|
|
19
|
+
readonly reveal?: boolean;
|
|
102
20
|
}
|
|
21
|
+
/** 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"];
|
|
103
25
|
/**
|
|
104
|
-
*
|
|
26
|
+
* One row of the authenticated user's event feed, on whichever ledger produced it.
|
|
27
|
+
*
|
|
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.
|
|
105
31
|
*/
|
|
106
|
-
export
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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 = V2TokenTopicSchemesCreateData["body"];
|
|
45
|
+
/** Body accepted when a token-level trusted issuer is created. */
|
|
46
|
+
export type TokenTrustedIssuerCreateInput = V2TokenTrustedIssuersCreateData["body"];
|
|
47
|
+
/** Successful token returned when a multisig invite is created. */
|
|
48
|
+
export type MultisigDraftCreateInviteOutput = V2ParticipantsMultisigDraftsCreateInviteResponse;
|
|
49
|
+
/** Body accepted when an issuer-signed scalar feed is created. */
|
|
50
|
+
export type IssuerSignedCreateInput = V2SystemFeedsIssuerSignedCreateData["body"];
|
|
51
|
+
/** Image slot accepted by the theme logo upload endpoints. */
|
|
52
|
+
export type ThemeLogoMode = ThemeLogoUpload["mode"];
|
|
53
|
+
/** Facet counts keyed by collection field id. */
|
|
54
|
+
export type CollectionFacets = Record<string, Array<CollectionFacetEntry>>;
|
|
55
|
+
/** Config carried by an attached historical-balances feature. */
|
|
56
|
+
export type TokenFeatureHistoricalBalancesConfig = NonNullable<TokenFeatureHistoricalBalancesWire>;
|
|
57
|
+
/** Config carried by an attached maturity-redemption feature. */
|
|
58
|
+
export type TokenFeatureMaturityRedemptionConfig = NonNullable<TokenFeatureMaturityRedemptionWire>;
|
|
59
|
+
/** Config carried by an attached fixed-treasury-yield feature. */
|
|
60
|
+
export type TokenFeatureFixedTreasuryYieldConfig = NonNullable<TokenFeatureFixedTreasuryYieldWire>;
|
|
61
|
+
/** Config carried by an attached dividend-yield feature. */
|
|
62
|
+
export type TokenFeatureDividendYieldConfig = NonNullable<TokenFeatureDividendYieldWire>;
|
|
63
|
+
/** Config carried by an attached interest-yield feature. */
|
|
64
|
+
export type TokenFeatureInterestYieldConfig = NonNullable<TokenFeatureInterestYieldWire>;
|
|
65
|
+
/** Config carried by an attached transaction-fee feature. */
|
|
66
|
+
export type TokenFeatureTransactionFeeConfig = NonNullable<TokenFeatureTransactionFeeWire>;
|
|
67
|
+
/** Config carried by an attached transaction-fee-accounting feature. */
|
|
68
|
+
export type TokenFeatureTransactionFeeAccountingConfig = NonNullable<TokenFeatureTransactionFeeAccountingWire>;
|
|
69
|
+
/** Config carried by an attached external-transaction-fee feature. */
|
|
70
|
+
export type TokenFeatureExternalTransactionFeeConfig = NonNullable<TokenFeatureExternalTransactionFeeWire>;
|
|
71
|
+
/** MIME type accepted by token-document upload endpoints. */
|
|
72
|
+
export type TokenDocumentMimeType = TokenDocumentGetUploadUrlBody["mimeType"];
|
|
73
|
+
/** Body accepted by the token-create endpoint. */
|
|
74
|
+
export type TokenCreateInput = V2TokenCreateData["body"];
|
|
75
|
+
export type * from "./generated/types.gen.ts";
|
package/dist/url.d.ts
CHANGED
package/dist/verify-webhook.d.ts
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
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.ts";
|
|
2
|
+
export type WebhookVerificationFailure = "TIMESTAMP_SKEW" | "SECRET_MISMATCH" | "BODY_HASH_MISMATCH" | "REPLAYED_EVENT" | "MALFORMED_BODY" | "REPLAY_STORE_FAILURE";
|
|
3
3
|
export type WebhookVerificationResult = {
|
|
4
|
-
ok: true;
|
|
5
|
-
event: Webhook.Event;
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly event: Webhook.Event;
|
|
6
6
|
} | {
|
|
7
|
-
ok: false;
|
|
8
|
-
code: WebhookVerificationFailure;
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly code: WebhookVerificationFailure;
|
|
9
9
|
};
|
|
10
|
+
export interface WebhookReplayStore {
|
|
11
|
+
readonly has: (eventId: string) => boolean | Promise<boolean>;
|
|
12
|
+
readonly add: (eventId: string) => void | Promise<void>;
|
|
13
|
+
}
|
|
10
14
|
export interface VerifyWebhookInput {
|
|
11
|
-
rawBody: string | Uint8Array;
|
|
12
|
-
headers: Headers | Record<string, string | string
|
|
13
|
-
secret: string |
|
|
15
|
+
readonly rawBody: string | Uint8Array;
|
|
16
|
+
readonly headers: Headers | Record<string, string | ReadonlyArray<string> | undefined>;
|
|
17
|
+
readonly secret: string | ReadonlyArray<string>;
|
|
18
|
+
readonly replayStore?: WebhookReplayStore;
|
|
19
|
+
readonly now?: number | Date;
|
|
20
|
+
readonly timestampToleranceSeconds?: number;
|
|
14
21
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Strip the `dalp_whsk_` family prefix from a DALP signing secret.
|
|
17
|
-
*
|
|
18
|
-
* The Standard Webhooks library expects the bare secret material; DALP
|
|
19
|
-
* adds the prefix for parity with the `sm_dalp_` API-key family. Both
|
|
20
|
-
* the dispatcher (DALP-side) and any verifier (DALP or consumer) must
|
|
21
|
-
* call this before constructing a `new Webhook(...)` instance, otherwise
|
|
22
|
-
* the HMAC inputs differ on the two ends and every signature mismatches.
|
|
23
|
-
*/
|
|
24
22
|
export declare function toStandardWebhookSecret(secret: string): string;
|
|
25
|
-
|
|
26
|
-
* Verifies a DALP webhook signature and returns the typed event union.
|
|
27
|
-
*
|
|
28
|
-
* Use the returned lifecycle state and `supersedes` accessor to reconcile
|
|
29
|
-
* cached DAPI mutation responses with later on-chain outcomes.
|
|
30
|
-
*
|
|
31
|
-
* @see ../../kit/docs/content/events/idempotency-and-on-chain-outcome.mdx
|
|
32
|
-
*/
|
|
33
|
-
export declare function verifyWebhook({ rawBody, headers, secret }: VerifyWebhookInput): WebhookVerificationResult;
|
|
34
|
-
//# sourceMappingURL=verify-webhook.d.ts.map
|
|
23
|
+
export declare function verifyWebhook(input: VerifyWebhookInput): Promise<WebhookVerificationResult>;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,94 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 { Client } from "./generated/client/types.gen.ts";
|
|
2
|
+
import type { EvmTransactionStatusOutput } from "./generated/types.gen.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
|
-
|
|
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
|
+
}
|
|
19
|
+
/** Kind-scoped terminal result from the generated transaction status contract. */
|
|
20
|
+
export type WaitForTransactionResult = NonNullable<EvmTransactionStatusOutput["result"]>;
|
|
21
|
+
export interface WaitForTransactionSuccess extends WaitForTransactionStatus {
|
|
22
|
+
readonly status: "COMPLETED";
|
|
32
23
|
}
|
|
33
24
|
export interface WaitForTransactionOptions {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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;
|
|
25
|
+
readonly timeoutMs?: number;
|
|
26
|
+
readonly pollIntervalMs?: number;
|
|
27
|
+
readonly signal?: AbortSignal;
|
|
28
|
+
readonly onStatus?: (status: WaitForTransactionStatus) => void;
|
|
29
|
+
readonly now?: () => number;
|
|
30
|
+
readonly sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
31
|
+
readonly readStatus?: (transactionId: string, signal?: AbortSignal) => Promise<WaitForTransactionStatus>;
|
|
51
32
|
}
|
|
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
|
-
*/
|
|
33
|
+
export type TransactionWaitFailureReason = "terminal-failure" | "timeout" | "aborted";
|
|
58
34
|
export declare class DalpTransactionWaitError extends Error {
|
|
35
|
+
readonly code = "sdk.transaction.WAIT_FAILED";
|
|
36
|
+
readonly category: "operational";
|
|
59
37
|
readonly transactionId: string;
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
status: string;
|
|
68
|
-
subStatus: string | null;
|
|
69
|
-
reason: "terminal-failure" | "timeout" | "aborted";
|
|
70
|
-
lastStatus?: WaitForTransactionStatus;
|
|
71
|
-
cause?: unknown;
|
|
72
|
-
});
|
|
38
|
+
readonly reason: TransactionWaitFailureReason;
|
|
39
|
+
readonly lastStatus?: WaitForTransactionStatus;
|
|
40
|
+
readonly elapsedMs?: number;
|
|
41
|
+
constructor(transactionId: string, reason: TransactionWaitFailureReason, lastStatus?: WaitForTransactionStatus, elapsedMs?: number);
|
|
42
|
+
get status(): string;
|
|
43
|
+
get subStatus(): string | null;
|
|
44
|
+
get retryable(): boolean;
|
|
73
45
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
|
46
|
+
export declare const isDalpTransactionWaitError: (error: unknown) => error is DalpTransactionWaitError;
|
|
47
|
+
/** Poll transaction status until a terminal verdict, timeout, or abort. */
|
|
48
|
+
export declare function waitForTransaction(client: Client, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionSuccess>;
|