@lifi/compose-spec 0.17.0 → 0.18.0
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/index.d.cts +16 -6
- package/dist/index.d.ts +16 -6
- package/package.json +1 -1
- package/src/simulate.ts +17 -7
package/dist/index.d.cts
CHANGED
|
@@ -2271,9 +2271,17 @@ interface SimulateRequest {
|
|
|
2271
2271
|
readonly value?: bigint | string;
|
|
2272
2272
|
/**
|
|
2273
2273
|
* Block number to simulate against. Omitted ⇒ the chain head. Named tags
|
|
2274
|
-
* (e.g. "latest") are rejected with HTTP 400.
|
|
2274
|
+
* (e.g. "latest") are rejected with HTTP 400. A pinned block is always
|
|
2275
|
+
* reported back as `block`/`timestamp`, whatever `reportBlockContext` says.
|
|
2275
2276
|
*/
|
|
2276
2277
|
readonly block?: number;
|
|
2278
|
+
/**
|
|
2279
|
+
* Report the `block`/`timestamp` the simulation ran against. Defaults to
|
|
2280
|
+
* `true`. Resolving them costs the server one extra block-header RPC when
|
|
2281
|
+
* `block` is omitted; pass `false` to skip it, and the result then carries
|
|
2282
|
+
* no `block`/`timestamp`.
|
|
2283
|
+
*/
|
|
2284
|
+
readonly reportBlockContext?: boolean;
|
|
2277
2285
|
/** Funding instructions applied before simulation (max 40). */
|
|
2278
2286
|
readonly requirements?: readonly SlotFinderRequirement[];
|
|
2279
2287
|
/** Balances to read before and after the transaction (1–40 pairs). */
|
|
@@ -2291,7 +2299,8 @@ interface SimulateBalanceEntry {
|
|
|
2291
2299
|
/**
|
|
2292
2300
|
* HTTP 200, `status: "ok"`: the simulation ran successfully. Balance arrays are
|
|
2293
2301
|
* ordered to match the request `trackedBalances`. `gasUsed` is inner-call
|
|
2294
|
-
* execution gas only.
|
|
2302
|
+
* execution gas only. `block`/`timestamp` are present unless the request set
|
|
2303
|
+
* `reportBlockContext: false` without pinning a `block`.
|
|
2295
2304
|
*
|
|
2296
2305
|
* Note: the array element types are intentionally mutable (`SimulateBalanceEntry[]`,
|
|
2297
2306
|
* not `readonly SimulateBalanceEntry[]`) so they stay structurally identical to
|
|
@@ -2300,8 +2309,8 @@ interface SimulateBalanceEntry {
|
|
|
2300
2309
|
*/
|
|
2301
2310
|
interface SimulateOkResult {
|
|
2302
2311
|
readonly status: 'ok';
|
|
2303
|
-
readonly block
|
|
2304
|
-
readonly timestamp
|
|
2312
|
+
readonly block?: number;
|
|
2313
|
+
readonly timestamp?: number;
|
|
2305
2314
|
readonly balancesBefore: SimulateBalanceEntry[];
|
|
2306
2315
|
readonly balancesAfter: SimulateBalanceEntry[];
|
|
2307
2316
|
readonly deltas: SimulateBalanceEntry[];
|
|
@@ -2320,11 +2329,12 @@ interface SimulateRevertDecodeResult {
|
|
|
2320
2329
|
/**
|
|
2321
2330
|
* HTTP 200, `status: "revert"`: the simulation ran but the transaction reverted
|
|
2322
2331
|
* on-chain. A revert is a *successful simulation*, not a transport error.
|
|
2332
|
+
* `block`/`timestamp` are present under the same rule as on the `ok` arm.
|
|
2323
2333
|
*/
|
|
2324
2334
|
interface SimulateRevertResult {
|
|
2325
2335
|
readonly status: 'revert';
|
|
2326
|
-
readonly block
|
|
2327
|
-
readonly timestamp
|
|
2336
|
+
readonly block?: number;
|
|
2337
|
+
readonly timestamp?: number;
|
|
2328
2338
|
readonly revertReason?: string;
|
|
2329
2339
|
readonly code?: number;
|
|
2330
2340
|
readonly rawErrorBytes?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2271,9 +2271,17 @@ interface SimulateRequest {
|
|
|
2271
2271
|
readonly value?: bigint | string;
|
|
2272
2272
|
/**
|
|
2273
2273
|
* Block number to simulate against. Omitted ⇒ the chain head. Named tags
|
|
2274
|
-
* (e.g. "latest") are rejected with HTTP 400.
|
|
2274
|
+
* (e.g. "latest") are rejected with HTTP 400. A pinned block is always
|
|
2275
|
+
* reported back as `block`/`timestamp`, whatever `reportBlockContext` says.
|
|
2275
2276
|
*/
|
|
2276
2277
|
readonly block?: number;
|
|
2278
|
+
/**
|
|
2279
|
+
* Report the `block`/`timestamp` the simulation ran against. Defaults to
|
|
2280
|
+
* `true`. Resolving them costs the server one extra block-header RPC when
|
|
2281
|
+
* `block` is omitted; pass `false` to skip it, and the result then carries
|
|
2282
|
+
* no `block`/`timestamp`.
|
|
2283
|
+
*/
|
|
2284
|
+
readonly reportBlockContext?: boolean;
|
|
2277
2285
|
/** Funding instructions applied before simulation (max 40). */
|
|
2278
2286
|
readonly requirements?: readonly SlotFinderRequirement[];
|
|
2279
2287
|
/** Balances to read before and after the transaction (1–40 pairs). */
|
|
@@ -2291,7 +2299,8 @@ interface SimulateBalanceEntry {
|
|
|
2291
2299
|
/**
|
|
2292
2300
|
* HTTP 200, `status: "ok"`: the simulation ran successfully. Balance arrays are
|
|
2293
2301
|
* ordered to match the request `trackedBalances`. `gasUsed` is inner-call
|
|
2294
|
-
* execution gas only.
|
|
2302
|
+
* execution gas only. `block`/`timestamp` are present unless the request set
|
|
2303
|
+
* `reportBlockContext: false` without pinning a `block`.
|
|
2295
2304
|
*
|
|
2296
2305
|
* Note: the array element types are intentionally mutable (`SimulateBalanceEntry[]`,
|
|
2297
2306
|
* not `readonly SimulateBalanceEntry[]`) so they stay structurally identical to
|
|
@@ -2300,8 +2309,8 @@ interface SimulateBalanceEntry {
|
|
|
2300
2309
|
*/
|
|
2301
2310
|
interface SimulateOkResult {
|
|
2302
2311
|
readonly status: 'ok';
|
|
2303
|
-
readonly block
|
|
2304
|
-
readonly timestamp
|
|
2312
|
+
readonly block?: number;
|
|
2313
|
+
readonly timestamp?: number;
|
|
2305
2314
|
readonly balancesBefore: SimulateBalanceEntry[];
|
|
2306
2315
|
readonly balancesAfter: SimulateBalanceEntry[];
|
|
2307
2316
|
readonly deltas: SimulateBalanceEntry[];
|
|
@@ -2320,11 +2329,12 @@ interface SimulateRevertDecodeResult {
|
|
|
2320
2329
|
/**
|
|
2321
2330
|
* HTTP 200, `status: "revert"`: the simulation ran but the transaction reverted
|
|
2322
2331
|
* on-chain. A revert is a *successful simulation*, not a transport error.
|
|
2332
|
+
* `block`/`timestamp` are present under the same rule as on the `ok` arm.
|
|
2323
2333
|
*/
|
|
2324
2334
|
interface SimulateRevertResult {
|
|
2325
2335
|
readonly status: 'revert';
|
|
2326
|
-
readonly block
|
|
2327
|
-
readonly timestamp
|
|
2336
|
+
readonly block?: number;
|
|
2337
|
+
readonly timestamp?: number;
|
|
2328
2338
|
readonly revertReason?: string;
|
|
2329
2339
|
readonly code?: number;
|
|
2330
2340
|
readonly rawErrorBytes?: string;
|
package/package.json
CHANGED
package/src/simulate.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* optional native `value`), funds a sender, runs it in one `eth_call`, and
|
|
6
6
|
* reports the watched balances before and after, their signed deltas, and the
|
|
7
7
|
* inner-call gas. Unlike `POST /compose`, its response body is **un-enveloped**:
|
|
8
|
-
* `{ status, block
|
|
8
|
+
* `{ status, block?, timestamp?, ... }` lives at the top level (no `{ data }`
|
|
9
9
|
* wrapper).
|
|
10
10
|
*
|
|
11
11
|
* These are the single source of truth for the request/response shapes. The
|
|
@@ -123,9 +123,17 @@ export interface SimulateRequest {
|
|
|
123
123
|
readonly value?: bigint | string;
|
|
124
124
|
/**
|
|
125
125
|
* Block number to simulate against. Omitted ⇒ the chain head. Named tags
|
|
126
|
-
* (e.g. "latest") are rejected with HTTP 400.
|
|
126
|
+
* (e.g. "latest") are rejected with HTTP 400. A pinned block is always
|
|
127
|
+
* reported back as `block`/`timestamp`, whatever `reportBlockContext` says.
|
|
127
128
|
*/
|
|
128
129
|
readonly block?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Report the `block`/`timestamp` the simulation ran against. Defaults to
|
|
132
|
+
* `true`. Resolving them costs the server one extra block-header RPC when
|
|
133
|
+
* `block` is omitted; pass `false` to skip it, and the result then carries
|
|
134
|
+
* no `block`/`timestamp`.
|
|
135
|
+
*/
|
|
136
|
+
readonly reportBlockContext?: boolean;
|
|
129
137
|
/** Funding instructions applied before simulation (max 40). */
|
|
130
138
|
readonly requirements?: readonly SlotFinderRequirement[];
|
|
131
139
|
/** Balances to read before and after the transaction (1–40 pairs). */
|
|
@@ -145,7 +153,8 @@ export interface SimulateBalanceEntry {
|
|
|
145
153
|
/**
|
|
146
154
|
* HTTP 200, `status: "ok"`: the simulation ran successfully. Balance arrays are
|
|
147
155
|
* ordered to match the request `trackedBalances`. `gasUsed` is inner-call
|
|
148
|
-
* execution gas only.
|
|
156
|
+
* execution gas only. `block`/`timestamp` are present unless the request set
|
|
157
|
+
* `reportBlockContext: false` without pinning a `block`.
|
|
149
158
|
*
|
|
150
159
|
* Note: the array element types are intentionally mutable (`SimulateBalanceEntry[]`,
|
|
151
160
|
* not `readonly SimulateBalanceEntry[]`) so they stay structurally identical to
|
|
@@ -154,8 +163,8 @@ export interface SimulateBalanceEntry {
|
|
|
154
163
|
*/
|
|
155
164
|
export interface SimulateOkResult {
|
|
156
165
|
readonly status: 'ok';
|
|
157
|
-
readonly block
|
|
158
|
-
readonly timestamp
|
|
166
|
+
readonly block?: number;
|
|
167
|
+
readonly timestamp?: number;
|
|
159
168
|
readonly balancesBefore: SimulateBalanceEntry[];
|
|
160
169
|
readonly balancesAfter: SimulateBalanceEntry[];
|
|
161
170
|
readonly deltas: SimulateBalanceEntry[];
|
|
@@ -176,11 +185,12 @@ export interface SimulateRevertDecodeResult {
|
|
|
176
185
|
/**
|
|
177
186
|
* HTTP 200, `status: "revert"`: the simulation ran but the transaction reverted
|
|
178
187
|
* on-chain. A revert is a *successful simulation*, not a transport error.
|
|
188
|
+
* `block`/`timestamp` are present under the same rule as on the `ok` arm.
|
|
179
189
|
*/
|
|
180
190
|
export interface SimulateRevertResult {
|
|
181
191
|
readonly status: 'revert';
|
|
182
|
-
readonly block
|
|
183
|
-
readonly timestamp
|
|
192
|
+
readonly block?: number;
|
|
193
|
+
readonly timestamp?: number;
|
|
184
194
|
readonly revertReason?: string;
|
|
185
195
|
readonly code?: number;
|
|
186
196
|
readonly rawErrorBytes?: string;
|