@settlemint/dalp-sdk 3.1.25 → 3.1.26-main.37113215468
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 +239 -172
- package/dist/auth/client.d.ts +103 -0
- package/dist/auth/invite-step-up.d.ts +2 -0
- package/dist/auth/live.d.ts +47 -0
- package/dist/auth/native-passkey.d.ts +9 -0
- package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +0 -8
- package/dist/{auth-wallet-plugins.d.ts → auth/wallet-plugins.d.ts} +68 -6
- package/dist/auth-surface.d.ts +2 -0
- package/dist/auth.d.ts +8 -115
- package/dist/auth.js +525 -0
- package/dist/chunk-16xvy8xj.js +271 -0
- package/dist/chunk-4f4kjtt0.js +149 -0
- package/dist/chunk-b03ycwb7.js +68 -0
- package/dist/chunk-ghgcmyhk.js +5 -0
- package/dist/chunk-h241xecg.js +1625 -0
- package/dist/chunk-hqz56e6q.js +4 -0
- package/dist/chunk-k3ntysxx.js +57 -0
- package/dist/chunk-pjjrxre1.js +36 -0
- package/dist/chunk-qvtjb3dz.js +102 -0
- package/dist/chunk-w361dpdk.js +5 -0
- package/dist/client/conditional-request.d.ts +8 -0
- package/dist/client/factory.d.ts +4 -0
- package/dist/client/query-serializer.d.ts +1 -0
- package/dist/client/request-compression.d.ts +12 -0
- package/dist/client/ssr-fetch.d.ts +10 -0
- package/dist/client/step-up-challenge.d.ts +10 -0
- package/dist/effect.d.ts +38 -0
- package/dist/effect.js +87 -0
- package/dist/errors/api-error.d.ts +35 -0
- package/dist/errors/error-codes.d.ts +21 -0
- package/dist/errors/find-current-error.d.ts +2 -0
- package/dist/errors/sdk-error.d.ts +52 -0
- package/dist/errors/sdk-error.js +8 -0
- package/dist/generated/api-types.d.ts +69961 -0
- package/dist/generated/console-routes.d.ts +12 -0
- package/dist/generated/error-catalog.d.ts +9 -0
- package/dist/generated/error-codes.d.ts +9 -0
- package/dist/generated/response-scalars.d.ts +9 -0
- package/dist/generated/response-schemas.d.ts +9 -0
- package/dist/generated/route-error-codes.d.ts +9 -0
- package/dist/generated/routes.d.ts +12 -0
- package/dist/index.d.ts +28 -45
- package/dist/index.js +150 -96216
- package/dist/proxy/builder.d.ts +17 -0
- package/dist/proxy/client-core.d.ts +28 -0
- package/dist/proxy/client.d.ts +5 -0
- package/dist/proxy/fetch-executor.d.ts +6 -0
- package/dist/proxy/flat-args.d.ts +24 -0
- package/dist/proxy/response-decode.d.ts +37 -0
- package/dist/proxy/sse.d.ts +11 -0
- package/dist/proxy/step-up-challenge.d.ts +4 -0
- package/dist/proxy/tanstack.d.ts +6 -0
- package/dist/proxy/transport.d.ts +63 -0
- package/dist/react-query.d.ts +2 -0
- package/dist/react-query.js +12 -0
- package/dist/readonly-deep.d.ts +3 -0
- package/dist/routes/console.d.ts +14 -0
- package/dist/routes/console.js +25 -0
- package/dist/routes/index.d.ts +4 -0
- package/dist/routes/index.js +10 -0
- package/dist/routes/types.d.ts +72 -0
- package/dist/runtime-exports.d.ts +4 -0
- package/dist/runtime-exports.js +16 -0
- package/dist/runtime.d.ts +11 -0
- package/dist/scalars/big-decimal.d.ts +4 -0
- package/dist/scalars/ethereum-address.d.ts +5 -0
- package/dist/scalars/exchange-rates.d.ts +13 -0
- package/dist/scalars/index.d.ts +10 -0
- package/dist/scalars/index.js +102 -0
- package/dist/scalars/organization-id.d.ts +5 -0
- package/dist/scalars/token-decimals.d.ts +4 -0
- package/dist/secret.d.ts +12 -0
- package/dist/sign-webhook-receipt.d.ts +16 -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 +24 -0
- package/dist/types.d.ts +37 -114
- 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 -3
- package/dist/wait-for-transaction.d.ts +44 -86
- package/dist/wait-for-transaction.js +151 -0
- package/dist/webhook-events.d.ts +543 -33
- package/package.json +110 -34
- package/dist/api-types.generated.d.ts +0 -14160
- package/dist/api-types.generated.d.ts.map +0 -1
- 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 +0 -217
- 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 -22
- 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 -654
- package/dist/dapi-errors.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -637
- 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/version.generated.d.ts +0 -8
- package/dist/version.generated.d.ts.map +0 -1
- package/dist/wait-for-transaction.d.ts.map +0 -1
- package/dist/webhook-events.d.ts.map +0 -1
|
@@ -1,94 +1,52 @@
|
|
|
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 { DalpClient } from "./proxy/client.ts";
|
|
2
|
+
import type { EvmTransactionStatusOutput } from "./generated/api-types.d.ts";
|
|
3
|
+
export interface WaitForTransactionContractError {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly args: Readonly<Record<string, string>>;
|
|
6
|
+
readonly why: string;
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly fix?: string;
|
|
24
9
|
}
|
|
25
10
|
export interface WaitForTransactionStatus {
|
|
26
|
-
transactionId: string;
|
|
27
|
-
status: string;
|
|
28
|
-
subStatus: string | null;
|
|
29
|
-
transactionHash: string | null;
|
|
30
|
-
errorMessage: string | null;
|
|
31
|
-
|
|
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
|
+
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";
|
|
32
26
|
}
|
|
33
27
|
export interface WaitForTransactionOptions {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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;
|
|
28
|
+
readonly timeoutMs?: number;
|
|
29
|
+
readonly pollIntervalMs?: number;
|
|
30
|
+
readonly signal?: AbortSignal;
|
|
31
|
+
readonly onStatus?: (status: WaitForTransactionStatus) => void;
|
|
32
|
+
readonly holdWhilePaused?: boolean;
|
|
33
|
+
readonly holdWhileRebuilding?: boolean;
|
|
34
|
+
readonly now?: () => number;
|
|
35
|
+
readonly sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
36
|
+
readonly readStatus?: (transactionId: string, signal?: AbortSignal) => Promise<WaitForTransactionStatus>;
|
|
51
37
|
}
|
|
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
|
-
*/
|
|
38
|
+
export type TransactionWaitFailureReason = "terminal-failure" | "timeout" | "aborted" | "funding-paused" | "indexer-rebuild";
|
|
58
39
|
export declare class DalpTransactionWaitError extends Error {
|
|
40
|
+
readonly code = "sdk.transaction.WAIT_FAILED";
|
|
41
|
+
readonly category: "operational";
|
|
59
42
|
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
|
-
});
|
|
43
|
+
readonly reason: TransactionWaitFailureReason;
|
|
44
|
+
readonly lastStatus?: WaitForTransactionStatus;
|
|
45
|
+
readonly elapsedMs?: number;
|
|
46
|
+
constructor(transactionId: string, reason: TransactionWaitFailureReason, lastStatus?: WaitForTransactionStatus, elapsedMs?: number);
|
|
47
|
+
get status(): string;
|
|
48
|
+
get subStatus(): string | null;
|
|
49
|
+
get retryable(): boolean;
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
51
|
+
export declare const isDalpTransactionWaitError: (error: unknown) => error is DalpTransactionWaitError;
|
|
52
|
+
export declare function waitForTransaction(client: DalpClient, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionSuccess>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// src/wait-for-transaction.ts
|
|
2
|
+
var failedStates = new Set(["FAILED", "DEAD_LETTER", "CANCELLED"]);
|
|
3
|
+
var isWaitForTransactionSuccess = (status) => status.status === "COMPLETED";
|
|
4
|
+
|
|
5
|
+
class DalpTransactionWaitError extends Error {
|
|
6
|
+
code = "sdk.transaction.WAIT_FAILED";
|
|
7
|
+
category = "operational";
|
|
8
|
+
transactionId;
|
|
9
|
+
reason;
|
|
10
|
+
lastStatus;
|
|
11
|
+
elapsedMs;
|
|
12
|
+
constructor(transactionId, reason, lastStatus, elapsedMs) {
|
|
13
|
+
let message;
|
|
14
|
+
if (reason === "terminal-failure") {
|
|
15
|
+
message = `Transaction ${transactionId} reached terminal state ${lastStatus?.status ?? "UNKNOWN"}`;
|
|
16
|
+
} else if (reason === "timeout") {
|
|
17
|
+
message = `Transaction ${transactionId} did not reach a terminal state within ${elapsedMs ?? 0}ms`;
|
|
18
|
+
} else if (reason === "funding-paused") {
|
|
19
|
+
message = `Transaction ${transactionId} is paused waiting for a gas funding payment`;
|
|
20
|
+
} else if (reason === "indexer-rebuild") {
|
|
21
|
+
const chainId = lastStatus?.indexerRebuild?.chainId;
|
|
22
|
+
message = `Transaction ${transactionId} is on chain, and the platform is still rebuilding its index of chain ${chainId ?? "unknown"} before the write can be read back`;
|
|
23
|
+
} else {
|
|
24
|
+
message = `Transaction status observation was aborted for transaction ${transactionId}`;
|
|
25
|
+
}
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "DalpTransactionWaitError";
|
|
28
|
+
this.transactionId = transactionId;
|
|
29
|
+
this.reason = reason;
|
|
30
|
+
this.lastStatus = lastStatus;
|
|
31
|
+
this.elapsedMs = elapsedMs;
|
|
32
|
+
}
|
|
33
|
+
get status() {
|
|
34
|
+
return this.lastStatus?.status ?? "UNKNOWN";
|
|
35
|
+
}
|
|
36
|
+
get subStatus() {
|
|
37
|
+
return this.lastStatus?.subStatus ?? null;
|
|
38
|
+
}
|
|
39
|
+
get retryable() {
|
|
40
|
+
return this.reason === "timeout" || this.reason === "funding-paused" || this.reason === "indexer-rebuild";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var isDalpTransactionWaitError = (error) => error instanceof DalpTransactionWaitError;
|
|
44
|
+
var defaultSleep = (milliseconds, signal) => new Promise((resolve, reject) => {
|
|
45
|
+
if (signal?.aborted === true) {
|
|
46
|
+
reject(signal.reason);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const onAbort = () => {
|
|
50
|
+
clearTimeout(timeout);
|
|
51
|
+
reject(signal?.reason);
|
|
52
|
+
};
|
|
53
|
+
const timeout = setTimeout(() => {
|
|
54
|
+
signal?.removeEventListener("abort", onAbort);
|
|
55
|
+
resolve();
|
|
56
|
+
}, milliseconds);
|
|
57
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
58
|
+
});
|
|
59
|
+
var routeStatusReader = (client) => async (transactionId, signal) => {
|
|
60
|
+
const result = await client.execute("transactionsV2.status", { transactionId }, signal === undefined ? undefined : { signal });
|
|
61
|
+
const body = result !== null && typeof result === "object" ? Reflect.get(result, "data") ?? result : result;
|
|
62
|
+
return body;
|
|
63
|
+
};
|
|
64
|
+
var MAX_UNREADABLE_HOLDS = 5;
|
|
65
|
+
var noParks = { fundingPaused: false, indexerRebuild: false };
|
|
66
|
+
var PAUSED_POLL_INTERVAL_MAX_MS = 30000;
|
|
67
|
+
function readParks(status, held) {
|
|
68
|
+
const fundingPaused = status.activeRequirement !== undefined && status.activeRequirement !== null;
|
|
69
|
+
const indexerRebuild = status.indexerRebuild !== undefined && status.indexerRebuild !== null;
|
|
70
|
+
return {
|
|
71
|
+
fundingPaused: fundingPaused || held.fundingPaused && status.activeRequirementUnavailable === true,
|
|
72
|
+
indexerRebuild: indexerRebuild || held.indexerRebuild && status.indexerRebuildUnavailable === true
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function namedPark(parks) {
|
|
76
|
+
if (parks.fundingPaused) {
|
|
77
|
+
return "funding-paused";
|
|
78
|
+
}
|
|
79
|
+
return parks.indexerRebuild ? "indexer-rebuild" : undefined;
|
|
80
|
+
}
|
|
81
|
+
async function waitForTransaction(client, transactionId, options = {}) {
|
|
82
|
+
const timeoutMs = options.timeoutMs ?? 120000;
|
|
83
|
+
const pollIntervalMs = options.pollIntervalMs ?? 1000;
|
|
84
|
+
const now = options.now ?? Date.now;
|
|
85
|
+
const sleep = options.sleep ?? defaultSleep;
|
|
86
|
+
const readStatus = options.readStatus ?? routeStatusReader(client);
|
|
87
|
+
const holdWhilePaused = options.holdWhilePaused ?? true;
|
|
88
|
+
const holdWhileRebuilding = options.holdWhileRebuilding ?? true;
|
|
89
|
+
const waitStartedAt = now();
|
|
90
|
+
let budgetStartedAt = waitStartedAt;
|
|
91
|
+
let pollDelayMs = pollIntervalMs;
|
|
92
|
+
let lastStatus;
|
|
93
|
+
let held = noParks;
|
|
94
|
+
let unreadableHolds = 0;
|
|
95
|
+
const isAborted = () => options.signal?.aborted === true;
|
|
96
|
+
while (true) {
|
|
97
|
+
if (isAborted()) {
|
|
98
|
+
throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
|
|
99
|
+
}
|
|
100
|
+
if (now() - budgetStartedAt >= timeoutMs) {
|
|
101
|
+
const ranOutIn = namedPark(held) ?? "timeout";
|
|
102
|
+
throw new DalpTransactionWaitError(transactionId, ranOutIn, lastStatus, now() - waitStartedAt);
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
lastStatus = await readStatus(transactionId, options.signal);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (isAborted()) {
|
|
108
|
+
throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
options.onStatus?.(lastStatus);
|
|
113
|
+
if (failedStates.has(lastStatus.status)) {
|
|
114
|
+
throw new DalpTransactionWaitError(transactionId, "terminal-failure", lastStatus);
|
|
115
|
+
}
|
|
116
|
+
if (isWaitForTransactionSuccess(lastStatus)) {
|
|
117
|
+
return lastStatus;
|
|
118
|
+
}
|
|
119
|
+
const ownParks = readParks(lastStatus, noParks);
|
|
120
|
+
held = readParks(lastStatus, held);
|
|
121
|
+
const parkedBy = namedPark(held);
|
|
122
|
+
unreadableHolds = parkedBy === undefined || namedPark(ownParks) !== undefined ? 0 : unreadableHolds + 1;
|
|
123
|
+
let holdsThroughIt = false;
|
|
124
|
+
if (parkedBy === "funding-paused") {
|
|
125
|
+
holdsThroughIt = holdWhilePaused;
|
|
126
|
+
} else if (parkedBy === "indexer-rebuild") {
|
|
127
|
+
holdsThroughIt = holdWhileRebuilding;
|
|
128
|
+
}
|
|
129
|
+
if (parkedBy === undefined) {
|
|
130
|
+
pollDelayMs = pollIntervalMs;
|
|
131
|
+
} else {
|
|
132
|
+
if (!holdsThroughIt) {
|
|
133
|
+
throw new DalpTransactionWaitError(transactionId, parkedBy, lastStatus, now() - waitStartedAt);
|
|
134
|
+
}
|
|
135
|
+
if (unreadableHolds <= MAX_UNREADABLE_HOLDS) {
|
|
136
|
+
budgetStartedAt = now();
|
|
137
|
+
}
|
|
138
|
+
pollDelayMs = Math.min(pollDelayMs * 2, Math.max(pollIntervalMs, PAUSED_POLL_INTERVAL_MAX_MS));
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
await sleep(Math.min(pollDelayMs, Math.max(0, timeoutMs - (now() - budgetStartedAt))), options.signal);
|
|
142
|
+
} catch {
|
|
143
|
+
throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
DalpTransactionWaitError,
|
|
149
|
+
isDalpTransactionWaitError,
|
|
150
|
+
waitForTransaction
|
|
151
|
+
};
|