@settlemint/dalp-sdk 3.1.19-main.35432228082 → 3.1.19-main.35439985346
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/dist/auth.js +1 -1
- package/dist/{chunk-95q40brg.js → chunk-48jx8ba8.js} +1 -1
- package/dist/{chunk-sk9nc2q3.js → chunk-5qkmb0bq.js} +7 -1
- package/dist/generated/api-types.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/reads-as-funding-paused.d.ts +9 -0
- package/dist/reads-as-indexer-rebuild.d.ts +9 -0
- package/dist/wait-for-transaction.d.ts +9 -3
- package/dist/wait-for-transaction.js +36 -9
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -102,7 +102,7 @@ function createCookieStoreFetch2(cookieStore, fetchImpl = globalThis.fetch) {
|
|
|
102
102
|
// package.json
|
|
103
103
|
var package_default = {
|
|
104
104
|
name: "@settlemint/dalp-sdk",
|
|
105
|
-
version: "3.1.19-main.
|
|
105
|
+
version: "3.1.19-main.35439985346",
|
|
106
106
|
private: false,
|
|
107
107
|
description: "Fully typed SDK for the DALP tokenization platform API",
|
|
108
108
|
homepage: "https://settlemint.com",
|
|
@@ -6,5 +6,11 @@ function readsAsIndexerRebuild2(status) {
|
|
|
6
6
|
const rebuild = Reflect.get(status, "indexerRebuild");
|
|
7
7
|
return rebuild !== undefined && rebuild !== null;
|
|
8
8
|
}
|
|
9
|
+
function readsAsRebuildUnavailable(status) {
|
|
10
|
+
if (status === null || typeof status !== "object") {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return Reflect.get(status, "indexerRebuildUnavailable") === true;
|
|
14
|
+
}
|
|
9
15
|
|
|
10
|
-
export { readsAsIndexerRebuild2 };
|
|
16
|
+
export { readsAsIndexerRebuild2, readsAsRebuildUnavailable };
|
|
@@ -9849,10 +9849,12 @@ export type EvmTransactionStatusOutput = {
|
|
|
9849
9849
|
readonly shortfall: string;
|
|
9850
9850
|
readonly recommendedTotal: string;
|
|
9851
9851
|
} | null;
|
|
9852
|
+
readonly activeRequirementUnavailable?: boolean;
|
|
9852
9853
|
readonly indexerRebuild?: {
|
|
9853
9854
|
readonly chainId: number;
|
|
9854
9855
|
readonly blockNumber: number;
|
|
9855
9856
|
} | null;
|
|
9857
|
+
readonly indexerRebuildUnavailable?: boolean;
|
|
9856
9858
|
readonly createdAt: TimestampEncoded;
|
|
9857
9859
|
readonly updatedAt: TimestampEncoded;
|
|
9858
9860
|
};
|
|
@@ -50273,10 +50275,12 @@ export type transaction_statusStream_Response = {
|
|
|
50273
50275
|
readonly shortfall: string;
|
|
50274
50276
|
readonly recommendedTotal: string;
|
|
50275
50277
|
} | null;
|
|
50278
|
+
readonly activeRequirementUnavailable?: boolean;
|
|
50276
50279
|
readonly indexerRebuild?: {
|
|
50277
50280
|
readonly chainId: number;
|
|
50278
50281
|
readonly blockNumber: number;
|
|
50279
50282
|
} | null;
|
|
50283
|
+
readonly indexerRebuildUnavailable?: boolean;
|
|
50280
50284
|
readonly createdAt: string;
|
|
50281
50285
|
readonly updatedAt: string;
|
|
50282
50286
|
};
|
package/dist/index.js
CHANGED
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
createCookieStoreFetch2,
|
|
26
26
|
SDK_VERSION2,
|
|
27
27
|
SDK_USER_AGENT2
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-48jx8ba8.js";
|
|
29
29
|
import {
|
|
30
30
|
readsAsIndexerRebuild2
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5qkmb0bq.js";
|
|
32
32
|
import {
|
|
33
33
|
buildDalpClient
|
|
34
34
|
} from "./chunk-7y52nnrf.js";
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
* chain. The wire declares it absent or null when there is no ask.
|
|
10
10
|
*/
|
|
11
11
|
export declare function readsAsFundingPaused(status: unknown): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the platform could not read the ask for this row.
|
|
14
|
+
*
|
|
15
|
+
* `activeRequirementUnavailable` says the lookup failed, so `activeRequirement`
|
|
16
|
+
* reports nothing either way. Without it, a failed lookup and a write that owes
|
|
17
|
+
* nothing are the same bytes, and a wait that stands down on a pause counts a
|
|
18
|
+
* write that is still waiting for money as one that is merely slow.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readsAsRequirementUnavailable(status: unknown): boolean;
|
|
12
21
|
/**
|
|
13
22
|
* Longest gap between two status reads of a parked write.
|
|
14
23
|
*
|
|
@@ -12,3 +12,12 @@
|
|
|
12
12
|
* reads this must widen its own patience rather than report a timeout.
|
|
13
13
|
*/
|
|
14
14
|
export declare function readsAsIndexerRebuild(status: unknown): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the platform could not read the rebuild for this row.
|
|
17
|
+
*
|
|
18
|
+
* `indexerRebuildUnavailable` says the deployment registry could not be asked,
|
|
19
|
+
* so `indexerRebuild` reports nothing either way. A replay runs for hours, so a
|
|
20
|
+
* wait that reads that absence as "the replay finished" gives up on a write the
|
|
21
|
+
* platform is still catching up to.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readsAsRebuildUnavailable(status: unknown): boolean;
|
|
@@ -17,8 +17,12 @@ export interface WaitForTransactionStatus {
|
|
|
17
17
|
readonly result?: WaitForTransactionResult;
|
|
18
18
|
/** The open funding ask a write parked by the funding gate is waiting on. */
|
|
19
19
|
readonly activeRequirement?: EvmTransactionStatusOutput["activeRequirement"];
|
|
20
|
+
/** True when the platform could not read the ask, so the field above says nothing either way. */
|
|
21
|
+
readonly activeRequirementUnavailable?: EvmTransactionStatusOutput["activeRequirementUnavailable"];
|
|
20
22
|
/** The chain and block an index rebuild must reach before this write reads back. */
|
|
21
23
|
readonly indexerRebuild?: EvmTransactionStatusOutput["indexerRebuild"];
|
|
24
|
+
/** True when the platform could not read the rebuild, so the field above says nothing either way. */
|
|
25
|
+
readonly indexerRebuildUnavailable?: EvmTransactionStatusOutput["indexerRebuildUnavailable"];
|
|
22
26
|
}
|
|
23
27
|
/** Kind-scoped terminal result from the generated transaction status contract. */
|
|
24
28
|
export type WaitForTransactionResult = NonNullable<EvmTransactionStatusOutput["result"]>;
|
|
@@ -74,8 +78,10 @@ export declare const isDalpTransactionWaitError: (error: unknown) => error is Da
|
|
|
74
78
|
* never reported as a timeout and a resumed write gets its whole budget back.
|
|
75
79
|
* A status that reports an index rebuild restarts it for the same reason: the
|
|
76
80
|
* write is already on chain and the platform is replaying that chain's history
|
|
77
|
-
* before it can be read back.
|
|
78
|
-
*
|
|
79
|
-
*
|
|
81
|
+
* before it can be read back. A status that reports the platform could not read
|
|
82
|
+
* either one holds whichever wait the last readable status named, so an outage
|
|
83
|
+
* in that lookup cannot end a wait the write is still in. `holdWhilePaused:
|
|
84
|
+
* false` and `holdWhileRebuilding: false` end the wait on those statuses
|
|
85
|
+
* instead. The `elapsedMs` a timeout carries is the whole wait, pauses included.
|
|
80
86
|
*/
|
|
81
87
|
export declare function waitForTransaction(client: DalpClient, transactionId: string, options?: WaitForTransactionOptions): Promise<WaitForTransactionSuccess>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
readsAsIndexerRebuild2
|
|
3
|
-
|
|
2
|
+
readsAsIndexerRebuild2,
|
|
3
|
+
readsAsRebuildUnavailable
|
|
4
|
+
} from "./chunk-5qkmb0bq.js";
|
|
4
5
|
|
|
5
6
|
// src/reads-as-funding-paused.ts
|
|
6
7
|
function readsAsFundingPaused(status) {
|
|
@@ -10,6 +11,12 @@ function readsAsFundingPaused(status) {
|
|
|
10
11
|
const requirement = Reflect.get(status, "activeRequirement");
|
|
11
12
|
return requirement !== undefined && requirement !== null;
|
|
12
13
|
}
|
|
14
|
+
function readsAsRequirementUnavailable(status) {
|
|
15
|
+
if (status === null || typeof status !== "object") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return Reflect.get(status, "activeRequirementUnavailable") === true;
|
|
19
|
+
}
|
|
13
20
|
var PAUSED_POLL_INTERVAL_MAX_MS = 30000;
|
|
14
21
|
|
|
15
22
|
// src/wait-for-transaction.ts
|
|
@@ -75,6 +82,20 @@ var routeStatusReader = (client) => async (transactionId, signal) => {
|
|
|
75
82
|
const body = result !== null && typeof result === "object" ? Reflect.get(result, "data") ?? result : result;
|
|
76
83
|
return body;
|
|
77
84
|
};
|
|
85
|
+
var MAX_UNREADABLE_HOLDS = 5;
|
|
86
|
+
var noParks = { fundingPaused: false, indexerRebuild: false };
|
|
87
|
+
function readParks(status, held) {
|
|
88
|
+
return {
|
|
89
|
+
fundingPaused: readsAsFundingPaused(status) || held.fundingPaused && readsAsRequirementUnavailable(status),
|
|
90
|
+
indexerRebuild: readsAsIndexerRebuild2(status) || held.indexerRebuild && readsAsRebuildUnavailable(status)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function namedPark(parks) {
|
|
94
|
+
if (parks.fundingPaused) {
|
|
95
|
+
return "funding-paused";
|
|
96
|
+
}
|
|
97
|
+
return parks.indexerRebuild ? "indexer-rebuild" : undefined;
|
|
98
|
+
}
|
|
78
99
|
async function waitForTransaction(client, transactionId, options = {}) {
|
|
79
100
|
const timeoutMs = options.timeoutMs ?? 120000;
|
|
80
101
|
const pollIntervalMs = options.pollIntervalMs ?? 1000;
|
|
@@ -87,13 +108,16 @@ async function waitForTransaction(client, transactionId, options = {}) {
|
|
|
87
108
|
let budgetStartedAt = waitStartedAt;
|
|
88
109
|
let pollDelayMs = pollIntervalMs;
|
|
89
110
|
let lastStatus;
|
|
111
|
+
let held = noParks;
|
|
112
|
+
let unreadableHolds = 0;
|
|
90
113
|
const isAborted = () => options.signal?.aborted === true;
|
|
91
114
|
while (true) {
|
|
92
115
|
if (isAborted()) {
|
|
93
116
|
throw new DalpTransactionWaitError(transactionId, "aborted", lastStatus);
|
|
94
117
|
}
|
|
95
118
|
if (now() - budgetStartedAt >= timeoutMs) {
|
|
96
|
-
|
|
119
|
+
const ranOutIn = namedPark(held) ?? "timeout";
|
|
120
|
+
throw new DalpTransactionWaitError(transactionId, ranOutIn, lastStatus, now() - waitStartedAt);
|
|
97
121
|
}
|
|
98
122
|
try {
|
|
99
123
|
lastStatus = await readStatus(transactionId, options.signal);
|
|
@@ -110,13 +134,14 @@ async function waitForTransaction(client, transactionId, options = {}) {
|
|
|
110
134
|
if (isWaitForTransactionSuccess(lastStatus)) {
|
|
111
135
|
return lastStatus;
|
|
112
136
|
}
|
|
113
|
-
|
|
137
|
+
const ownParks = readParks(lastStatus, noParks);
|
|
138
|
+
held = readParks(lastStatus, held);
|
|
139
|
+
const parkedBy = namedPark(held);
|
|
140
|
+
unreadableHolds = parkedBy === undefined || namedPark(ownParks) !== undefined ? 0 : unreadableHolds + 1;
|
|
114
141
|
let holdsThroughIt = false;
|
|
115
|
-
if (
|
|
116
|
-
parkedBy = "funding-paused";
|
|
142
|
+
if (parkedBy === "funding-paused") {
|
|
117
143
|
holdsThroughIt = holdWhilePaused;
|
|
118
|
-
} else if (
|
|
119
|
-
parkedBy = "indexer-rebuild";
|
|
144
|
+
} else if (parkedBy === "indexer-rebuild") {
|
|
120
145
|
holdsThroughIt = holdWhileRebuilding;
|
|
121
146
|
}
|
|
122
147
|
if (parkedBy === undefined) {
|
|
@@ -125,7 +150,9 @@ async function waitForTransaction(client, transactionId, options = {}) {
|
|
|
125
150
|
if (!holdsThroughIt) {
|
|
126
151
|
throw new DalpTransactionWaitError(transactionId, parkedBy, lastStatus, now() - waitStartedAt);
|
|
127
152
|
}
|
|
128
|
-
|
|
153
|
+
if (unreadableHolds <= MAX_UNREADABLE_HOLDS) {
|
|
154
|
+
budgetStartedAt = now();
|
|
155
|
+
}
|
|
129
156
|
pollDelayMs = Math.min(pollDelayMs * 2, Math.max(pollIntervalMs, PAUSED_POLL_INTERVAL_MAX_MS));
|
|
130
157
|
}
|
|
131
158
|
try {
|
package/package.json
CHANGED