@lumenwipe/sdk 0.7.0 → 0.9.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/CHANGELOG.md +382 -0
- package/LICENSE +201 -0
- package/README.md +99 -12
- package/dist/index.cjs +485 -58
- package/dist/index.d.cts +611 -22
- package/dist/index.d.ts +611 -22
- package/dist/index.js +470 -57
- package/package.json +34 -16
package/dist/index.d.cts
CHANGED
|
@@ -14,6 +14,10 @@ export declare interface AccountState {
|
|
|
14
14
|
thresholds: AccountThresholds;
|
|
15
15
|
numSubEntries: number;
|
|
16
16
|
numSponsoring: number;
|
|
17
|
+
/** Reserves another account pays for this one: its own base reserve when its creation was
|
|
18
|
+
* sponsored, and each sponsored subentry. Lowers the minimum balance. Absent when the read
|
|
19
|
+
* did not report it, which is treated as none. */
|
|
20
|
+
numSponsored?: number;
|
|
17
21
|
/** Ledger entries this account currently sponsors (on other accounts, or itself via a
|
|
18
22
|
* fully-sponsored account creation). Populated by replaying sponsorship-relevant
|
|
19
23
|
* operations and re-verifying each candidate's live sponsor - see sponsorship.ts. */
|
|
@@ -35,7 +39,17 @@ export declare interface AccountState {
|
|
|
35
39
|
/** Claimable balances where this account is listed as a claimant. Does not affect
|
|
36
40
|
* numSubEntries on this account; populated via the Horizon adapter. */
|
|
37
41
|
claimableBalances: ClaimableBalance[];
|
|
42
|
+
/** True when the account holds more claimable balances than one read returns, so
|
|
43
|
+
* `claimableBalances` is a bounded part of them. Set only by the account reader. While it is
|
|
44
|
+
* set the merge is never built: the rest would be stranded. */
|
|
45
|
+
claimableBalancesMore?: boolean;
|
|
38
46
|
subEntryMismatch: boolean;
|
|
47
|
+
/** Close time of the latest ledger (epoch seconds) when the claim predicates were judged.
|
|
48
|
+
* Absent means it could not be read, and only unconditional claims count as claimable. */
|
|
49
|
+
ledgerCloseTime?: number;
|
|
50
|
+
/** The latest ledger the enumeration's reads reflect, for debugging. Absent when the provider
|
|
51
|
+
* reports none. */
|
|
52
|
+
snapshotLedger?: number;
|
|
39
53
|
/** Detected DeFi positions (Blend, Aquarius, Soroswap, Phoenix, FxDAO), resolved via OctoPos on
|
|
40
54
|
* mainnet or a direct contract read on testnet / mainnet degraded mode - architecture.md §7.1.
|
|
41
55
|
* Never absent: an unconfigured deployment or provider outage still returns a result, stamped
|
|
@@ -158,6 +172,13 @@ export declare type AquariusPoolType = "constant_product" | "stable" | "concentr
|
|
|
158
172
|
*/
|
|
159
173
|
export declare type AssetDisposition = "convert" | "issuer" | "transfer" | "leave";
|
|
160
174
|
|
|
175
|
+
/** Body for `POST /v1/:network/close/batch-plan`: up to 20 accounts planned into one shared
|
|
176
|
+
* destination, read-only, with no decisions applied. */
|
|
177
|
+
export declare interface BatchPlanRequest {
|
|
178
|
+
addresses: string[];
|
|
179
|
+
destination?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
161
182
|
export declare interface BatchPlanResponse {
|
|
162
183
|
results: BatchPlanResult[];
|
|
163
184
|
}
|
|
@@ -229,11 +250,81 @@ export declare type ClaimPredicate = {
|
|
|
229
250
|
deadlineEpoch: string;
|
|
230
251
|
};
|
|
231
252
|
|
|
253
|
+
/**
|
|
254
|
+
* The swap quote on a convertible classic asset's `asset_disposition` subject (`subject.quote`),
|
|
255
|
+
* in stroops of XLM. Display data: the build re-quotes, and a convert answer carries its own floor
|
|
256
|
+
* in `params.minAmountOut`. Absent when the asset has no route, or when its balance is what a
|
|
257
|
+
* position's exit will pay in and is not known yet.
|
|
258
|
+
*/
|
|
259
|
+
export declare interface ClassicConversionQuote {
|
|
260
|
+
/** The XLM the route is expected to deliver for the balance the step will move. */
|
|
261
|
+
estimatedReceive: string;
|
|
262
|
+
/** The least XLM the route may deliver once slippage is applied. */
|
|
263
|
+
minAmountOut: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
232
266
|
export declare type CloseApiStatus = "ready" | "needs_decisions" | "blocked" | "complete";
|
|
233
267
|
|
|
268
|
+
/**
|
|
269
|
+
* One transaction in a `GET /v1/:network/close/delivered` answer. `delivered` means the ledger's
|
|
270
|
+
* own result for the confirmed transaction credited `amountStroops` of XLM to the destination,
|
|
271
|
+
* through a merge into it or, for a close routed through the relay account, the native payment
|
|
272
|
+
* that forwarded the merged balance. `unavailable` never carries an amount:
|
|
273
|
+
* - `not_found`: no provider holds the hash. It may be unknown, still pending, or older than the
|
|
274
|
+
* providers keep.
|
|
275
|
+
* - `failed`: the transaction failed, so it moved nothing.
|
|
276
|
+
* - `no_delivery`: it confirmed, but no merge into the destination and no forward of a merged
|
|
277
|
+
* balance to it is in it.
|
|
278
|
+
*/
|
|
279
|
+
export declare type CloseDeliveredEntry = {
|
|
280
|
+
hash: string;
|
|
281
|
+
status: "delivered";
|
|
282
|
+
ledger: number;
|
|
283
|
+
amountStroops: string;
|
|
284
|
+
} | {
|
|
285
|
+
hash: string;
|
|
286
|
+
status: "unavailable";
|
|
287
|
+
reason: "not_found" | "failed" | "no_delivery";
|
|
288
|
+
/** Set when the transaction is on the ledger: failed or no_delivery. */
|
|
289
|
+
ledger?: number;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Response from `GET /v1/:network/close/delivered`. `entries` follow the order of the requested
|
|
294
|
+
* hashes. `totalStroops` is present only when every entry is `delivered`. XLM that reached the
|
|
295
|
+
* destination by any other operation, and any asset other than XLM, is not counted.
|
|
296
|
+
*/
|
|
297
|
+
export declare interface CloseDeliveredResponse {
|
|
298
|
+
destination: string;
|
|
299
|
+
entries: CloseDeliveredEntry[];
|
|
300
|
+
totalStroops?: string;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Thrown when a close cannot finish: the API kept asking for another call past the round
|
|
304
|
+
* bound, or said another call is needed yet returned nothing to sign. Nothing is lost - the
|
|
305
|
+
* API re-reads live state, so running the close again picks up where it stopped. */
|
|
306
|
+
export declare class CloseDidNotConvergeError extends Error {
|
|
307
|
+
readonly rounds: number;
|
|
308
|
+
readonly bound: number;
|
|
309
|
+
readonly reason: CloseDidNotConvergeReason;
|
|
310
|
+
constructor(rounds: number, bound: number, reason: CloseDidNotConvergeReason);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export declare type CloseDidNotConvergeReason = "round_limit" | "empty_batch";
|
|
314
|
+
|
|
234
315
|
export declare interface CloseEngineDeps {
|
|
235
|
-
/** Fetches the next round of unsigned transactions from the API (via the proxy).
|
|
236
|
-
|
|
316
|
+
/** Fetches the next round of unsigned transactions from the API (via the proxy). Pass
|
|
317
|
+
* `planHash` on to `closeTransactions` when it is set. */
|
|
318
|
+
getTransactions: (request: {
|
|
319
|
+
planHash?: string;
|
|
320
|
+
}) => Promise<TransactionsResponse>;
|
|
321
|
+
/**
|
|
322
|
+
* The `planHash` of the plan the user reviewed. Sent with every fetch until the first
|
|
323
|
+
* transaction of this run confirms, and never after: from then on the account has changed on
|
|
324
|
+
* purpose. A round refused as `state_changed` while it was sent is not fetched again, since the
|
|
325
|
+
* reviewed plan itself is stale; `runClose` throws `CloseStateChangedError` at once.
|
|
326
|
+
*/
|
|
327
|
+
planHash?: string;
|
|
237
328
|
/**
|
|
238
329
|
* Verifies one server-built transaction against what the client independently expects.
|
|
239
330
|
* MUST throw on any mismatch. This is the trust anchor: the browser never signs a
|
|
@@ -253,14 +344,32 @@ export declare interface CloseEngineDeps {
|
|
|
253
344
|
xdr: string;
|
|
254
345
|
weight: number;
|
|
255
346
|
}>;
|
|
347
|
+
/** Turns a signed envelope into the final one, adding any co-signature or sponsorship. Runs
|
|
348
|
+
* once per transaction: a resend never comes back here. */
|
|
349
|
+
prepare?: (tx: CloseTransaction, xdr: string) => Promise<string>;
|
|
256
350
|
/** Submits a transaction whose accumulated weight already meets its requirement; resolves
|
|
257
351
|
* to the tx hash. */
|
|
258
352
|
submit: (tx: CloseTransaction, xdr: string) => Promise<string>;
|
|
259
|
-
/**
|
|
353
|
+
/** Settle unknown outcomes by hash instead of surfacing them. See `CloseReconciliation`. */
|
|
354
|
+
reconcile?: CloseReconciliation;
|
|
355
|
+
/** Called after a transaction confirms, with the transaction and its hash. With `reconcile`,
|
|
356
|
+
* `covers` names a merge only when the client parsed one, whatever the API claimed. */
|
|
260
357
|
onConfirmed?: (tx: CloseTransaction, hash: string) => void;
|
|
261
358
|
onProgress?: (message: string) => void;
|
|
262
359
|
/**
|
|
263
|
-
*
|
|
360
|
+
* Told each step of the close as it happens, in order: `preparing` before a round is fetched,
|
|
361
|
+
* then for each transaction `verifying`, `awaiting-signature` (the signer is asked),
|
|
362
|
+
* `submitting` (signed; from here on the network and any `prepare` step are waited on) and
|
|
363
|
+
* `confirmed`. A resumed transaction starts at `awaiting-signature`: it is not verified again.
|
|
364
|
+
* An observer only: each event is a fresh object, nothing it returns is awaited, and anything it
|
|
365
|
+
* throws or rejects with is ignored, so it can neither stop nor change the close.
|
|
366
|
+
*/
|
|
367
|
+
onProgressEvent?: (event: CloseProgressEvent) => void;
|
|
368
|
+
/**
|
|
369
|
+
* Overrides the round bound. Without it the bound is derived each round from the API's own
|
|
370
|
+
* `remaining.steps` (rounds done, plus steps left, plus a margin), only ever raised and capped
|
|
371
|
+
* at 200, so a long close is not cut short and a misbehaving API still cannot spin forever.
|
|
372
|
+
* This is what covers
|
|
264
373
|
* #59's mediator-cleanup concern: the API is stateless and re-reads live state every round,
|
|
265
374
|
* so `remaining.requiresAnotherCall` for that flow reflects "cleanup still sees something to
|
|
266
375
|
* remove," not a bounded countdown - if an asset keeps getting re-funded between rounds (or
|
|
@@ -268,6 +377,15 @@ export declare interface CloseEngineDeps {
|
|
|
268
377
|
* with a clear thrown error instead of looping indefinitely.
|
|
269
378
|
*/
|
|
270
379
|
maxRounds?: number;
|
|
380
|
+
/** Waits `ms` milliseconds; defaults to a timer. Injected so tests need not wait. */
|
|
381
|
+
sleep?: (ms: number) => Promise<void>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** Thrown when a transaction went out and neither a resend nor a lookup settled it. Not a failure:
|
|
385
|
+
* it may still land. Pass `submission` back as `unresolved`, or to `resolveSubmission`. */
|
|
386
|
+
export declare class CloseOutcomeUnknownError extends Error {
|
|
387
|
+
readonly submission: UnresolvedSubmission;
|
|
388
|
+
constructor(submission: UnresolvedSubmission);
|
|
271
389
|
}
|
|
272
390
|
|
|
273
391
|
/** Body for `POST /v1/:network/close/plan`. */
|
|
@@ -277,6 +395,77 @@ export declare interface ClosePlanRequest {
|
|
|
277
395
|
decisions?: DecisionAnswer[];
|
|
278
396
|
}
|
|
279
397
|
|
|
398
|
+
/** What `onProgressEvent` is told: a round being fetched, or a transaction of it changing phase. */
|
|
399
|
+
export declare type CloseProgressEvent = CloseRoundProgress | CloseTransactionProgress;
|
|
400
|
+
|
|
401
|
+
/** Where a close is, as `onProgressEvent` reports it. */
|
|
402
|
+
export declare type CloseProgressPhase = "preparing" | "verifying" | "awaiting-signature" | "submitting" | "confirmed";
|
|
403
|
+
|
|
404
|
+
/** What `runClose` needs to settle an unknown outcome. Opt-in: without it a failed `submit` is
|
|
405
|
+
* surfaced as it is, nothing is sent twice, and nothing here runs. */
|
|
406
|
+
export declare interface CloseReconciliation {
|
|
407
|
+
/** The hash of the exact final envelope, computed locally with the client's own passphrase, so
|
|
408
|
+
* the outer hash for a fee-bump. MUST NOT come from the API. */
|
|
409
|
+
hashOf: (signedXdr: string) => string;
|
|
410
|
+
/** Whether the client itself parsed an account merge of this account out of the envelope. */
|
|
411
|
+
closesAccount: (signedXdr: string) => boolean;
|
|
412
|
+
/** Unix seconds after which the envelope cannot land, from its own time bounds. */
|
|
413
|
+
validUntil: (signedXdr: string) => number | null;
|
|
414
|
+
/** Looks a hash up on the network, through `client.getTransaction` or a proxy of it. */
|
|
415
|
+
lookup: (hash: string) => Promise<TransactionLookupResponse>;
|
|
416
|
+
/** Told when a submission opens, before it is sent, and with null when it settles: persist it
|
|
417
|
+
* and an interrupted close still knows what to look up. Rejecting the first call stops the
|
|
418
|
+
* transaction unsent, which is what a caller that could not persist it should do. */
|
|
419
|
+
onSubmission?: (submission: UnresolvedSubmission | null) => void | Promise<void>;
|
|
420
|
+
/** A submission left over from an earlier run, settled first, by lookup only. */
|
|
421
|
+
unresolved?: UnresolvedSubmission;
|
|
422
|
+
/** A left-over submission confirmed: `onConfirmed` has no transaction to report for it. */
|
|
423
|
+
onResolved?: (submission: UnresolvedSubmission) => void;
|
|
424
|
+
/** Replaces `Date.now`, for tests. */
|
|
425
|
+
now?: () => number;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** A round is being fetched. Nothing is known about its batch yet. */
|
|
429
|
+
export declare interface CloseRoundProgress {
|
|
430
|
+
/** Always `preparing`. */
|
|
431
|
+
phase: "preparing";
|
|
432
|
+
/** Zero-based. */
|
|
433
|
+
round: number;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** How a run ended. `mergeConfirmed` is true only with `reconcile`, for a transaction the client
|
|
437
|
+
* parsed as a merge and saw confirmed under its own hash. Without `reconcile` it is always false:
|
|
438
|
+
* `runClose` returning then says only that the API asked for no more calls, and `covers` is API
|
|
439
|
+
* metadata, so a caller must establish the merge itself before calling the account closed. */
|
|
440
|
+
export declare interface CloseRunResult {
|
|
441
|
+
mergeConfirmed: boolean;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/** Thrown when the account kept changing while the API prepared a round (`state_changed`).
|
|
445
|
+
* Nothing was submitted for that round; plan again and run the close from the new plan. */
|
|
446
|
+
export declare class CloseStateChangedError extends Error {
|
|
447
|
+
readonly apiError: unknown;
|
|
448
|
+
constructor(apiError: unknown);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** Sub-entries and sponsorships the ledger still counts on an account. */
|
|
452
|
+
export declare interface CloseStatusRemaining {
|
|
453
|
+
subentries: number;
|
|
454
|
+
sponsoring: number;
|
|
455
|
+
sponsored: number;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Response from `GET /v1/:network/close/status`. Informational: `closed` means the account is
|
|
460
|
+
* absent and the last operation in its history is a merge, never that a given close finished.
|
|
461
|
+
*/
|
|
462
|
+
export declare interface CloseStatusResponse {
|
|
463
|
+
source: string;
|
|
464
|
+
phase: "open" | "ready_to_merge" | "closed" | "unknown";
|
|
465
|
+
/** Present while the account is on the ledger. */
|
|
466
|
+
remaining?: CloseStatusRemaining;
|
|
467
|
+
}
|
|
468
|
+
|
|
280
469
|
export declare interface CloseTransaction {
|
|
281
470
|
id: string;
|
|
282
471
|
order: number;
|
|
@@ -299,7 +488,7 @@ export declare interface CloseTransaction {
|
|
|
299
488
|
/**
|
|
300
489
|
* True when the account cannot pay this transaction's own fee without dropping below its
|
|
301
490
|
* reserve (architecture.md §8.1): the API built it with its own fee at zero, and the client
|
|
302
|
-
* must route the signed envelope through `POST /:network/fee-bump/sponsor` before submitting
|
|
491
|
+
* must route the signed envelope through `POST /v1/:network/fee-bump/sponsor` before submitting
|
|
303
492
|
* it, instead of submitting it directly. Absent (not `false`) on every ordinary transaction -
|
|
304
493
|
* an older client reading this field sees nothing here and simply submits as it always has.
|
|
305
494
|
*/
|
|
@@ -307,17 +496,55 @@ export declare interface CloseTransaction {
|
|
|
307
496
|
intent: TxIntent;
|
|
308
497
|
}
|
|
309
498
|
|
|
499
|
+
/** Thrown when a lookup by the client's own hash shows the transaction failed on the ledger. */
|
|
500
|
+
export declare class CloseTransactionFailedError extends Error {
|
|
501
|
+
readonly submission: UnresolvedSubmission;
|
|
502
|
+
constructor(submission: UnresolvedSubmission, message: string);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** One transaction of the current batch moved to `phase`. */
|
|
506
|
+
export declare interface CloseTransactionProgress {
|
|
507
|
+
/** `verifying`, `awaiting-signature` (the signer is asked), `submitting` (signed; the network
|
|
508
|
+
* is waited on) or `confirmed`. */
|
|
509
|
+
phase: Exclude<CloseProgressPhase, "preparing">;
|
|
510
|
+
/** Zero-based. */
|
|
511
|
+
round: number;
|
|
512
|
+
/** Zero-based position of this transaction in its batch. */
|
|
513
|
+
txIndex: number;
|
|
514
|
+
/** How many transactions this batch holds. Exact for this batch only. */
|
|
515
|
+
txCount: number;
|
|
516
|
+
/** The steps this transaction covers. API metadata in every phase but `confirmed`, which carries
|
|
517
|
+
* what `onConfirmed` is given: with `reconcile`, a merge only when the client parsed one. */
|
|
518
|
+
covers: CloseTransaction["covers"];
|
|
519
|
+
/** The API asked for another round after this batch. Each round is planned from live state, so
|
|
520
|
+
* the close as a whole holds at least `txCount` transactions and its total is not known. */
|
|
521
|
+
moreRoundsExpected: boolean;
|
|
522
|
+
}
|
|
523
|
+
|
|
310
524
|
/** Body for `POST /v1/:network/close/transactions`. */
|
|
311
525
|
export declare interface CloseTransactionsRequest {
|
|
312
526
|
source: string;
|
|
313
527
|
destination: string;
|
|
314
528
|
decisions?: DecisionAnswer[];
|
|
315
529
|
/**
|
|
316
|
-
* Deposit memo value
|
|
317
|
-
*
|
|
318
|
-
*
|
|
530
|
+
* Deposit memo value. Required when the destination is an exchange that mandates a
|
|
531
|
+
* memo, or an account whose `config.memo_required` data entry is set (SEP-29). A blank
|
|
532
|
+
* memo counts as none. An id memo is a decimal uint64 with no leading zeros.
|
|
319
533
|
*/
|
|
320
534
|
memo?: string;
|
|
535
|
+
/**
|
|
536
|
+
* The type of `memo`. For an exchange the registry lists, the registry's type is used and
|
|
537
|
+
* a different one is refused with `422 invalid_memo`; for any other destination this type
|
|
538
|
+
* is used, `text` when omitted. Has no effect without a memo.
|
|
539
|
+
*/
|
|
540
|
+
memoType?: "text" | "id";
|
|
541
|
+
/**
|
|
542
|
+
* The `planHash` of the plan the user reviewed. Send it with the first call after that plan, and
|
|
543
|
+
* the API answers `409 state_changed` when the account's sequence or the answers differ from
|
|
544
|
+
* those the plan was built from. Leave it out once a transaction of the close has confirmed: the
|
|
545
|
+
* account has then changed on purpose.
|
|
546
|
+
*/
|
|
547
|
+
planHash?: string;
|
|
321
548
|
}
|
|
322
549
|
|
|
323
550
|
export declare interface ConversionPath {
|
|
@@ -328,6 +555,15 @@ export declare interface ConversionPath {
|
|
|
328
555
|
destMin: string;
|
|
329
556
|
}
|
|
330
557
|
|
|
558
|
+
/** Body for `POST /v1/integrator/keys`. Both fields are optional. */
|
|
559
|
+
export declare interface CreateIntegratorKeyRequest {
|
|
560
|
+
/** A name for the key, 1 to 64 printable characters after trimming. */
|
|
561
|
+
label?: string;
|
|
562
|
+
/** The networks the key may call, at least one. Omit for every network. A scoped key is refused
|
|
563
|
+
* on routes without a network. */
|
|
564
|
+
networks?: Network[];
|
|
565
|
+
}
|
|
566
|
+
|
|
331
567
|
export declare interface DailyActivity {
|
|
332
568
|
/** UTC day, YYYY-MM-DD. */
|
|
333
569
|
date: string;
|
|
@@ -345,10 +581,11 @@ export declare interface DecisionAnswer {
|
|
|
345
581
|
params?: {
|
|
346
582
|
maxSlippageBps?: number;
|
|
347
583
|
/**
|
|
348
|
-
* Required by `convert_to_xlm` on a Soroban token
|
|
349
|
-
* shown the
|
|
350
|
-
*
|
|
351
|
-
*
|
|
584
|
+
* Required by `convert_to_xlm` on a Soroban token, optional on a classic asset: the least
|
|
585
|
+
* XLM, in stroops, the user was shown the conversion would deliver (the plan's
|
|
586
|
+
* `quote.minAmountOut`). The build refuses a route that no longer clears it
|
|
587
|
+
* (`quote_drifted`) instead of converting at a rate nobody agreed to, and the browser holds
|
|
588
|
+
* the built conversion's own minimum to at least this figure.
|
|
352
589
|
*/
|
|
353
590
|
minAmountOut?: string;
|
|
354
591
|
/**
|
|
@@ -381,8 +618,17 @@ export declare interface DecisionOption {
|
|
|
381
618
|
export declare interface DecisionPoint {
|
|
382
619
|
id: string;
|
|
383
620
|
type: "asset_disposition" | "confirmation" | "choice" | "claimable_balance";
|
|
621
|
+
/** Shape depends on `type`. A convertible classic asset's subject carries a
|
|
622
|
+
* `quote: ClassicConversionQuote`. A Soroban token's carries `quote` (with `priceImpactBps`,
|
|
623
|
+
* `flags: TokenQuoteFlag[]` and an optional `runnerUp`) when convertible, else a
|
|
624
|
+
* `reason: TokenUnquotedReason`. */
|
|
384
625
|
subject: Record<string, unknown>;
|
|
385
626
|
options: DecisionOption[];
|
|
627
|
+
/**
|
|
628
|
+
* The recommended option id, advisory only: nothing is applied for an unanswered decision. Empty
|
|
629
|
+
* when no option is safe to recommend, such as an asset with no swap route. A convertible asset
|
|
630
|
+
* defaults to converting; no decision ever recommends returning an asset to its issuer.
|
|
631
|
+
*/
|
|
386
632
|
default: string;
|
|
387
633
|
required: boolean;
|
|
388
634
|
}
|
|
@@ -503,14 +749,25 @@ export declare interface DefiRpcPolicy {
|
|
|
503
749
|
timeoutMs: number;
|
|
504
750
|
}
|
|
505
751
|
|
|
506
|
-
export declare type DemolishPhase = "IDLE" | "ANALYZING" | "PREFLIGHT_COMPLETE" | "SIGNER_SETUP" | "STEP_EXECUTING" | "STEP_CONFIRMED" | "STEP_FAILED" | "COMPLETE" | "ABORTED";
|
|
752
|
+
export declare type DemolishPhase = "IDLE" | "ANALYZING" | "PREFLIGHT_COMPLETE" | "SIGNER_SETUP" | "STEP_EXECUTING" | "STEP_CONFIRMED" | "STEP_FAILED" | "STEP_UNCONFIRMED" | "COMPLETE" | "ABORTED";
|
|
507
753
|
|
|
508
754
|
/**
|
|
509
755
|
* Every code the API can put in `error.code`. A code is a contract: it is added here first and
|
|
510
756
|
* never renamed or removed without a deprecation window. The API's runtime list
|
|
511
757
|
* (apps/api/src/common/error-codes.ts) is checked against this union at compile time.
|
|
512
758
|
*/
|
|
513
|
-
export declare type ErrorCode = "account_not_found" | "account_read_failed" | "account_too_large" | "admin_api_not_configured" | "allowances_read_failed" | "api_key_not_found" | "aquarius_trustline_missing" | "backstop_emissions_unclaimed" | "backstop_token_unconvertible" | "backstop_withdrawal_cooling_down" | "backstop_withdrawal_not_queued" | "bad_request" | "blend_emissions_trustline_missing" | "blend_repay_asset_balance_unknown" | "blend_repay_asset_missing" | "confirmation_timeout" | "conversion_floor_missing" | "conversion_provider_unrecognized" | "defi_exit_blocked" | "defi_exit_unsupported" | "defi_position_unrecognized" | "defi_positions_blocked" | "defi_positions_stale" | "defi_positions_unavailable" | "destination_not_acknowledged" | "destination_read_failed" | "fee_bump_exceeds_cap" | "fee_bump_not_configured" | "forbidden" | "forward_amount_exceeds_balance" | "inner_fee_not_zero" | "integrator_api_not_configured" | "internal_error" | "invalid_address" | "invalid_addresses" | "invalid_body" | "invalid_challenge" | "invalid_decisions" | "invalid_destination" | "invalid_memo" | "invalid_network" | "invalid_owner" | "invalid_rate_limit" | "invalid_request" | "invalid_signature" | "invalid_signed_xdr" | "invalid_source" | "invalid_spender" | "invalid_token" | "invalid_tokens" | "invalid_transaction_xdr" | "invalid_tx_hash" | "issuer_read_failed" | "issuer_supply_not_acknowledged" | "key_limit_reached" | "mediator_key_misconfiguration" | "mediator_not_configured" | "memo_required" | "merge_destination_unusable" | "merged_account_not_found" | "missing_parameters" | "missing_transaction" | "needs_decisions" | "not_found" | "operation_not_sponsorable" | "owner_not_found" | "path_lookup_failed" | "payload_too_large" | "phoenix_trustline_missing" | "plan_failed" | "provider_response_unusable" | "quote_drifted" | "rate_limited" | "registry_expired" | "request_failed" | "revoke_build_failed" | "revoke_needs_restore" | "revoke_simulation_failed" | "revoke_unsafe" | "service_unavailable" | "signer_normalization_unsafe" | "soroban_token_conversion_failed" | "soroban_token_conversion_unavailable" | "soroban_token_conversion_unsafe" | "soroban_token_needs_restore" | "soroban_token_route_lost" | "soroban_token_transfer_failed" | "soroban_token_transfer_unsafe" | "soroban_token_unreadable" | "soroswap_trustline_missing" | "source_sequence_too_far" | "stats_unavailable" | "submit_failed" | "submit_rejected" | "too_many_addresses" | "transaction_structure_not_allowed" | "transactions_failed" | "transfer_destination_missing" | "transfer_destination_unusable" | "trustline_cannot_be_left" | "trustline_deauthorized_with_balance" | "trustline_maintain_liabilities_with_balance" | "tx_not_verified" | "unauthorized" | "unprocessable_entity" | "unsupported_media_type" | "unsupported_memo_type" | "vault_undercollateralized" | "withdraw_before_repay";
|
|
759
|
+
export declare type ErrorCode = "account_not_found" | "account_read_failed" | "account_too_large" | "admin_api_not_configured" | "allowances_read_failed" | "api_key_not_found" | "aquarius_trustline_missing" | "backstop_emissions_unclaimed" | "backstop_token_unconvertible" | "backstop_withdrawal_cooling_down" | "backstop_withdrawal_not_queued" | "bad_request" | "blend_emissions_trustline_missing" | "blend_repay_asset_balance_unknown" | "blend_repay_asset_missing" | "claimable_balance_not_claimable_now" | "claimable_balance_reserve_short" | "claimable_balances_too_many" | "close_fee_balance_short" | "confirmation_timeout" | "conversion_floor_missing" | "conversion_impact_not_acknowledged" | "conversion_provider_unrecognized" | "defi_exit_blocked" | "defi_exit_unsupported" | "defi_position_unrecognized" | "defi_positions_blocked" | "defi_positions_stale" | "defi_positions_unavailable" | "destination_not_acknowledged" | "destination_read_failed" | "fee_bump_exceeds_cap" | "fee_bump_not_configured" | "forbidden" | "forward_amount_exceeds_balance" | "inner_fee_not_zero" | "integrator_api_not_configured" | "internal_error" | "invalid_address" | "invalid_addresses" | "invalid_body" | "invalid_challenge" | "invalid_decisions" | "invalid_destination" | "invalid_label" | "invalid_memo" | "invalid_network" | "invalid_networks" | "invalid_owner" | "invalid_plan_hash" | "invalid_rate_limit" | "invalid_request" | "invalid_signature" | "invalid_signed_xdr" | "invalid_source" | "invalid_spender" | "invalid_token" | "invalid_tokens" | "invalid_transaction_xdr" | "invalid_tx_hash" | "issuer_read_failed" | "issuer_supply_not_acknowledged" | "key_limit_reached" | "key_network_not_allowed" | "mediator_key_misconfiguration" | "mediator_not_configured" | "memo_required" | "merge_destination_unusable" | "merged_account_not_found" | "missing_parameters" | "missing_transaction" | "needs_decisions" | "not_found" | "operation_not_sponsorable" | "owner_not_found" | "path_lookup_failed" | "payload_too_large" | "phoenix_trustline_missing" | "plan_failed" | "provider_response_unusable" | "quote_drifted" | "rate_limited" | "registry_expired" | "request_failed" | "revoke_build_failed" | "revoke_needs_restore" | "revoke_simulation_failed" | "revoke_unsafe" | "route_lookup_unavailable" | "service_unavailable" | "signer_normalization_unsafe" | "soroban_token_conversion_failed" | "soroban_token_conversion_unavailable" | "soroban_token_conversion_unsafe" | "soroban_token_needs_restore" | "soroban_token_route_lost" | "soroban_token_transfer_failed" | "soroban_token_transfer_unsafe" | "soroban_token_unreadable" | "soroswap_trustline_missing" | "source_sequence_too_far" | "sponsor_source_unusable" | "sponsorship_budget_exhausted" | "state_changed" | "stats_unavailable" | "submit_failed" | "submit_rejected" | "time_bounds_required" | "too_many_addresses" | "transaction_expired" | "transaction_structure_not_allowed" | "transactions_failed" | "transfer_destination_missing" | "transfer_destination_unusable" | "trustline_cannot_be_left" | "trustline_deauthorized_with_balance" | "trustline_maintain_liabilities_with_balance" | "tx_not_verified" | "unauthorized" | "unprocessable_entity" | "unsupported_media_type" | "unsupported_memo_type" | "vault_undercollateralized" | "withdraw_before_repay";
|
|
760
|
+
|
|
761
|
+
/** One exchange in the registry: whether a close into it needs the mediator, and its memo rule. */
|
|
762
|
+
export declare interface ExchangeRegistryEntry {
|
|
763
|
+
address: string;
|
|
764
|
+
name: string;
|
|
765
|
+
domain: string;
|
|
766
|
+
requiresMediator: boolean;
|
|
767
|
+
requiresMemo: boolean;
|
|
768
|
+
/** The required memo type, if `requiresMemo` is true. */
|
|
769
|
+
memoType: "text" | "id" | "hash";
|
|
770
|
+
}
|
|
514
771
|
|
|
515
772
|
/** One transaction the close is expected to take. */
|
|
516
773
|
export declare interface ExecutionTxBreakdown {
|
|
@@ -521,7 +778,7 @@ export declare interface ExecutionTxBreakdown {
|
|
|
521
778
|
reason?: "op_batch" | "defi_dependency";
|
|
522
779
|
}
|
|
523
780
|
|
|
524
|
-
/** Response from `POST /:network/fee-bump/sponsor`. */
|
|
781
|
+
/** Response from `POST /v1/:network/fee-bump/sponsor`. */
|
|
525
782
|
export declare interface FeeBumpSponsorResponse {
|
|
526
783
|
transaction: string;
|
|
527
784
|
}
|
|
@@ -534,6 +791,31 @@ export declare interface FxdaoCdpPosition extends DefiPositionBase {
|
|
|
534
791
|
denomination: string;
|
|
535
792
|
collateralAmount: string;
|
|
536
793
|
debtAmount: string;
|
|
794
|
+
/** The denomination's registered stablecoin (`Currency(denomination).contract`), the token a
|
|
795
|
+
* repay burns. Read from the vault. */
|
|
796
|
+
debtToken?: string;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** One indicator of `GET /health/deep`: `rpc_<network>` carries `responseTime` in ms (and a fixed
|
|
800
|
+
* `message`, `"timeout"` or `"unreachable"`, when down); `exchange_registry` carries
|
|
801
|
+
* `daysRemaining`, negative once the registry has expired. */
|
|
802
|
+
export declare interface HealthDeepIndicator {
|
|
803
|
+
status: "up" | "down";
|
|
804
|
+
responseTime?: number;
|
|
805
|
+
message?: string;
|
|
806
|
+
daysRemaining?: number;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Body of `GET /health/deep`. It answers 200 with `status: "ok"` when Stellar RPC is reachable on
|
|
811
|
+
* every network, and 503 with this same shape and `status: "error"` when it is not: the indicators
|
|
812
|
+
* that failed are in `error`, the rest in `info`, and every one of them in `details`.
|
|
813
|
+
*/
|
|
814
|
+
export declare interface HealthDeepResponse {
|
|
815
|
+
status: "ok" | "error";
|
|
816
|
+
info: Record<string, HealthDeepIndicator>;
|
|
817
|
+
error: Record<string, HealthDeepIndicator>;
|
|
818
|
+
details: Record<string, HealthDeepIndicator>;
|
|
537
819
|
}
|
|
538
820
|
|
|
539
821
|
/** Response from `GET /health`. */
|
|
@@ -549,6 +831,72 @@ export declare class InsufficientSignatureWeightError extends Error {
|
|
|
549
831
|
constructor(pending: PendingRound);
|
|
550
832
|
}
|
|
551
833
|
|
|
834
|
+
/** Response from `POST /v1/integrator/auth/challenge`: a SEP-53 message for the wallet to sign. */
|
|
835
|
+
export declare interface IntegratorChallengeResponse {
|
|
836
|
+
message: string;
|
|
837
|
+
/** ISO 8601 time after which the challenge is rejected. */
|
|
838
|
+
expiresAt: string;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/** Response from `GET /v1/integrator/keys`. `usage` is null when the counts are unavailable. */
|
|
842
|
+
export declare interface IntegratorKeyList {
|
|
843
|
+
keys: IntegratorKeyListEntry[];
|
|
844
|
+
usage: IntegratorOwnerUsage | null;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** One entry of `GET /v1/integrator/keys`. `usage` is null when the counts are unavailable. */
|
|
848
|
+
export declare interface IntegratorKeyListEntry extends IntegratorKeyRecord {
|
|
849
|
+
usage: IntegratorKeyUsage | null;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/** An API key as the integrator routes describe it. Never carries the raw secret. */
|
|
853
|
+
export declare interface IntegratorKeyRecord {
|
|
854
|
+
/** The key's id (the SHA-256 hash of the secret). */
|
|
855
|
+
id: string;
|
|
856
|
+
/** ISO 8601. */
|
|
857
|
+
createdAt: string;
|
|
858
|
+
/** ISO 8601, or null while the key is active. */
|
|
859
|
+
revokedAt: string | null;
|
|
860
|
+
/** The previous key's id, if this key replaced one. */
|
|
861
|
+
rotatedFrom: string | null;
|
|
862
|
+
label: string | null;
|
|
863
|
+
/** The networks the key may call, or null for every network. */
|
|
864
|
+
networks: Network[] | null;
|
|
865
|
+
/** ISO 8601 time the key last authenticated a request, or null. Written at most once a minute. */
|
|
866
|
+
lastUsedAt: string | null;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/** One key's request counts. `rateLimitedLast30Days` counts 429s and is not part of the others. */
|
|
870
|
+
export declare interface IntegratorKeyUsage {
|
|
871
|
+
today: number;
|
|
872
|
+
last30Days: number;
|
|
873
|
+
rateLimitedLast30Days: number;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/** A wallet's request counts, shared by all its keys. */
|
|
877
|
+
export declare interface IntegratorOwnerUsage {
|
|
878
|
+
today: number;
|
|
879
|
+
last30Days: number;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/** Body for `POST /v1/integrator/auth/session`. */
|
|
883
|
+
export declare interface IntegratorSessionRequest {
|
|
884
|
+
/** The Stellar account (G...) that signed the challenge. */
|
|
885
|
+
address: string;
|
|
886
|
+
/** The challenge message exactly as returned by the challenge call. */
|
|
887
|
+
message: string;
|
|
888
|
+
/** Base64 ed25519 signature over the SEP-53 digest of the message. */
|
|
889
|
+
signature: string;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/** Response from `POST /v1/integrator/auth/session`. */
|
|
893
|
+
export declare interface IntegratorSessionResponse {
|
|
894
|
+
/** Bearer token for the key-management endpoints. */
|
|
895
|
+
token: string;
|
|
896
|
+
/** ISO 8601 time after which the token is rejected, 30 minutes after issue. */
|
|
897
|
+
expiresAt: string;
|
|
898
|
+
}
|
|
899
|
+
|
|
552
900
|
export declare type IntentOperation = IntentOperationBody & {
|
|
553
901
|
source: string;
|
|
554
902
|
};
|
|
@@ -635,10 +983,21 @@ export declare function isApiErrorCode<C extends ApiErrorCode>(error: unknown, c
|
|
|
635
983
|
code: C;
|
|
636
984
|
};
|
|
637
985
|
|
|
986
|
+
/** True for an answer that says the request was refused, so nothing went on. Everything else, a
|
|
987
|
+
* 5xx, a timeout, a dropped connection or an unreadable body, leaves the outcome unknown. */
|
|
988
|
+
export declare function isSubmitRefused(error: unknown): boolean;
|
|
989
|
+
|
|
990
|
+
/** Response from `POST /v1/integrator/keys` and `POST /v1/integrator/keys/{id}/rotate`. `key` is
|
|
991
|
+
* the raw secret, returned exactly once and never retrievable again. */
|
|
992
|
+
export declare interface IssuedIntegratorKey {
|
|
993
|
+
key: string;
|
|
994
|
+
record: IntegratorKeyRecord;
|
|
995
|
+
}
|
|
996
|
+
|
|
638
997
|
/** Thrown when the caller's `signal` aborts a request. Distinct from a timeout. */
|
|
639
998
|
export declare class LumenWipeAbortError extends Error {
|
|
640
|
-
readonly reason?: unknown
|
|
641
|
-
constructor(reason?: unknown
|
|
999
|
+
readonly reason?: unknown;
|
|
1000
|
+
constructor(reason?: unknown);
|
|
642
1001
|
}
|
|
643
1002
|
|
|
644
1003
|
/** Thrown when the API responds with a non-2xx status. `body` is the parsed error payload. */
|
|
@@ -664,13 +1023,25 @@ export declare class LumenWipeClient {
|
|
|
664
1023
|
private warnedDefaultNetwork;
|
|
665
1024
|
constructor(options: LumenWipeClientOptions);
|
|
666
1025
|
private resolveNetwork;
|
|
1026
|
+
/** The `/v1/{network}` path for `rest`. The network is checked before any request is built. */
|
|
1027
|
+
private v1;
|
|
667
1028
|
health(options?: RequestOptions): Promise<HealthResponse>;
|
|
1029
|
+
/** Whether Stellar RPC is reachable on every network, and the days left on the exchange registry.
|
|
1030
|
+
* A degraded service answers 503, thrown as a `LumenWipeApiError` whose `body` is a
|
|
1031
|
+
* `HealthDeepResponse` with `status: "error"`. Never retried: the 503 is the answer. */
|
|
1032
|
+
healthDeep(options?: RequestOptions): Promise<HealthDeepResponse>;
|
|
1033
|
+
/** The exchange registry the API closes against. Do not rely on it past `validUntil`. */
|
|
1034
|
+
getExchangeRegistry(options?: RequestOptions): Promise<ServedExchangeRegistry>;
|
|
668
1035
|
getAccount(address: string, network?: Network, options?: RequestOptions): Promise<AccountState>;
|
|
669
1036
|
getPaths(params: {
|
|
670
1037
|
fromAsset: string;
|
|
671
1038
|
amount: string;
|
|
672
1039
|
}, network?: Network, options?: RequestOptions): Promise<PathResponse>;
|
|
673
1040
|
closePlan(body: ClosePlanRequest, network?: Network, options?: RequestOptions): Promise<PlanResponse>;
|
|
1041
|
+
/** Plans up to 20 accounts into one shared destination in one call. Read-only: no decisions are
|
|
1042
|
+
* applied, so plan each account with `closePlan` before closing it. An address that cannot be
|
|
1043
|
+
* read or planned comes back as a `blocked` plan, never as a missing entry. */
|
|
1044
|
+
batchPlan(body: BatchPlanRequest, network?: Network, options?: RequestOptions): Promise<BatchPlanResponse>;
|
|
674
1045
|
/**
|
|
675
1046
|
* Builds the next unsigned transaction(s) for a close. A close can span several
|
|
676
1047
|
* transactions (a single transaction, or separate claim / cleanup / mediator-merge steps),
|
|
@@ -680,6 +1051,17 @@ export declare class LumenWipeClient {
|
|
|
680
1051
|
*/
|
|
681
1052
|
closeTransactions(body: CloseTransactionsRequest, network?: Network, options?: RequestOptions): Promise<TransactionsResponse>;
|
|
682
1053
|
submit(signedXdr: string, network?: Network, options?: RequestOptions): Promise<SubmitResponse>;
|
|
1054
|
+
/** Looks a transaction up by hash and sends nothing. `not_found` is not "did not land": the
|
|
1055
|
+
* transaction may be queued, or older than the window the response names. */
|
|
1056
|
+
getTransaction(hash: string, network?: Network, options?: RequestOptions): Promise<TransactionLookupResponse>;
|
|
1057
|
+
/** A close's phase and remaining work, from live state. Informational: a close is finished only
|
|
1058
|
+
* when the hash of the merge you signed is confirmed by `getTransaction`. */
|
|
1059
|
+
closeStatus(source: string, network?: Network, options?: RequestOptions): Promise<CloseStatusResponse>;
|
|
1060
|
+
/** The XLM confirmed close transactions delivered to `destination`, read from each one's ledger
|
|
1061
|
+
* result: a merge into it, or the relay account's forward of a merged balance. A hash that
|
|
1062
|
+
* cannot be read as delivered is an `unavailable` entry, not an error, and `totalStroops` is
|
|
1063
|
+
* set only when every entry is `delivered`. Pass 1 to 20 distinct hashes. */
|
|
1064
|
+
closeDelivered(destination: string, hashes: readonly string[], network?: Network, options?: RequestOptions): Promise<CloseDeliveredResponse>;
|
|
683
1065
|
mediatorCheck(address: string, network?: Network, options?: RequestOptions): Promise<MediatorCheckResult>;
|
|
684
1066
|
mediatorSign(transaction: string, network?: Network, options?: RequestOptions): Promise<MediatorSignResponse>;
|
|
685
1067
|
/** Wraps a wind-down transaction (its own fee already zero) in a signed CAP-15 fee-bump
|
|
@@ -696,6 +1078,15 @@ export declare class LumenWipeClient {
|
|
|
696
1078
|
token: string;
|
|
697
1079
|
spender: string;
|
|
698
1080
|
}, network?: Network, options?: RequestOptions): Promise<RevokeAllowanceResponse>;
|
|
1081
|
+
/** Accounts closed and XLM recovered through LumenWipe on the network. */
|
|
1082
|
+
getStats(network?: Network, options?: RequestOptions): Promise<StatsTotals>;
|
|
1083
|
+
/** The totals, the most recent closes and the daily activity on the network. */
|
|
1084
|
+
getStatsFeed(network?: Network, options?: RequestOptions): Promise<StatsFeed>;
|
|
1085
|
+
/** Counts a confirmed close that was submitted outside this API. The API re-reads the
|
|
1086
|
+
* transaction and counts it only if it built it, it confirmed and it merged an account;
|
|
1087
|
+
* `counted` is false for a hash already counted. Closes sent through `submit()` are counted
|
|
1088
|
+
* without this. */
|
|
1089
|
+
recordMerge(txHash: string, network?: Network, options?: RequestOptions): Promise<RecordMergeResponse>;
|
|
699
1090
|
}
|
|
700
1091
|
|
|
701
1092
|
export declare interface LumenWipeClientOptions {
|
|
@@ -709,12 +1100,57 @@ export declare interface LumenWipeClientOptions {
|
|
|
709
1100
|
fetch?: FetchLike;
|
|
710
1101
|
/** Per-request timeout in milliseconds. Defaults to 30000. `0`/`Infinity` disables it. */
|
|
711
1102
|
timeout?: number;
|
|
712
|
-
/** Opt-in retries. Off by default; never applied to `submit` or `
|
|
1103
|
+
/** Opt-in retries. Off by default; never applied to `submit`, `mediatorSign` or `healthDeep`. */
|
|
713
1104
|
retry?: RetryOptions;
|
|
714
1105
|
/** Receives one-time notices (plaintext `baseUrl`, defaulted network). Defaults to `console.warn`. */
|
|
715
1106
|
logger?: (message: string) => void;
|
|
716
1107
|
}
|
|
717
1108
|
|
|
1109
|
+
/**
|
|
1110
|
+
* Wallet-authenticated self-service API key management, kept apart from `LumenWipeClient` so the
|
|
1111
|
+
* main client stays small. It takes no API key and never sends one: the challenge and session
|
|
1112
|
+
* calls carry no `Authorization`, and the key calls carry only the session token passed to them.
|
|
1113
|
+
*
|
|
1114
|
+
* Sign in by signing the `challenge(address)` message with the wallet (SEP-53) and exchanging it
|
|
1115
|
+
* through `session(...)` for a token valid for 30 minutes. Every key belongs to that wallet.
|
|
1116
|
+
*/
|
|
1117
|
+
export declare class LumenWipeIntegratorClient {
|
|
1118
|
+
private readonly http;
|
|
1119
|
+
constructor(options: LumenWipeIntegratorClientOptions);
|
|
1120
|
+
/** A SEP-53 message for `address` (G...) to sign, valid until `expiresAt`. */
|
|
1121
|
+
challenge(address: string, options?: RequestOptions): Promise<IntegratorChallengeResponse>;
|
|
1122
|
+
/** Exchanges the signed challenge for a session token. */
|
|
1123
|
+
session(request: IntegratorSessionRequest, options?: RequestOptions): Promise<IntegratorSessionResponse>;
|
|
1124
|
+
/** The wallet's keys, each with its own request counts, and the wallet's total counts. */
|
|
1125
|
+
listKeys(token: string, options?: RequestOptions): Promise<IntegratorKeyList>;
|
|
1126
|
+
/** Creates a key, optionally named and limited to some networks. The raw `key` is in this
|
|
1127
|
+
* response only and can never be read again. */
|
|
1128
|
+
createKey(token: string, request?: CreateIntegratorKeyRequest, options?: RequestOptions): Promise<IssuedIntegratorKey>;
|
|
1129
|
+
/** Revokes one of the wallet's keys by its `id`. */
|
|
1130
|
+
revokeKey(token: string, id: string, options?: RequestOptions): Promise<RevokedIntegratorKey>;
|
|
1131
|
+
/** Revokes a key and issues its replacement, keeping its label and networks. The new raw `key`
|
|
1132
|
+
* is in this response only. */
|
|
1133
|
+
rotateKey(token: string, id: string, options?: RequestOptions): Promise<IssuedIntegratorKey>;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
export declare interface LumenWipeIntegratorClientOptions {
|
|
1137
|
+
/** Base URL of the LumenWipe API, e.g. `https://api.lumenwipe.com`. */
|
|
1138
|
+
baseUrl: string;
|
|
1139
|
+
/** Custom fetch (for environments without a global `fetch`, or for testing). */
|
|
1140
|
+
fetch?: FetchLike;
|
|
1141
|
+
/** Per-request timeout in milliseconds. Defaults to 30000. `0`/`Infinity` disables it. */
|
|
1142
|
+
timeout?: number;
|
|
1143
|
+
/** Opt-in retries. Off by default; never applied to creating, revoking or rotating a key. */
|
|
1144
|
+
retry?: RetryOptions;
|
|
1145
|
+
/** Receives one-time notices (plaintext `baseUrl`). Defaults to `console.warn`. */
|
|
1146
|
+
logger?: (message: string) => void;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/** Thrown before any request when `network` is not `"mainnet"` or `"testnet"`. */
|
|
1150
|
+
export declare class LumenWipeInvalidNetworkError extends Error {
|
|
1151
|
+
constructor();
|
|
1152
|
+
}
|
|
1153
|
+
|
|
718
1154
|
/** Thrown when a request exceeds the configured timeout. */
|
|
719
1155
|
export declare class LumenWipeTimeoutError extends Error {
|
|
720
1156
|
readonly timeoutMs: number;
|
|
@@ -733,7 +1169,7 @@ export declare interface MediatorCheckResult {
|
|
|
733
1169
|
registryFresh: boolean;
|
|
734
1170
|
}
|
|
735
1171
|
|
|
736
|
-
/** Response from `POST /:network/mediator/sign`. */
|
|
1172
|
+
/** Response from `POST /v1/:network/mediator/sign`. */
|
|
737
1173
|
export declare interface MediatorSignResponse {
|
|
738
1174
|
transaction: string;
|
|
739
1175
|
}
|
|
@@ -758,7 +1194,7 @@ export declare interface OpenOffer {
|
|
|
758
1194
|
price: string;
|
|
759
1195
|
}
|
|
760
1196
|
|
|
761
|
-
/** Response from `GET /:network/paths`. */
|
|
1197
|
+
/** Response from `GET /v1/:network/paths`. */
|
|
762
1198
|
export declare interface PathResponse {
|
|
763
1199
|
path: ConversionPath | null;
|
|
764
1200
|
}
|
|
@@ -774,12 +1210,23 @@ export declare interface PendingRound {
|
|
|
774
1210
|
accumulatedWeight: number;
|
|
775
1211
|
queue: CloseTransaction[];
|
|
776
1212
|
requiresAnotherCall: boolean;
|
|
1213
|
+
/** Zero-based round of the run that stopped, as its progress events numbered it. Set by
|
|
1214
|
+
* `runClose`; a resume without it counts from round 0. */
|
|
1215
|
+
round?: number;
|
|
1216
|
+
/** Zero-based position of `tx` in its batch. Set by `runClose`; 0 when absent. */
|
|
1217
|
+
txIndex?: number;
|
|
1218
|
+
/** How many transactions that batch held. Set by `runClose`; when absent, `txIndex + 1` plus
|
|
1219
|
+
* the length of `queue`. */
|
|
1220
|
+
txCount?: number;
|
|
777
1221
|
}
|
|
778
1222
|
|
|
779
1223
|
export declare interface PhoenixLpPosition extends DefiPositionBase {
|
|
780
1224
|
protocol: "phoenix";
|
|
781
1225
|
positionType: "lp";
|
|
782
1226
|
shareAmount: string;
|
|
1227
|
+
/** The pool's LP share token (`CONFIG.share_token`): a separate contract in Phoenix, where the
|
|
1228
|
+
* account's shares live and what a withdrawal transfers back to the pool. Read from the pool. */
|
|
1229
|
+
shareToken?: string;
|
|
783
1230
|
}
|
|
784
1231
|
|
|
785
1232
|
export declare interface PhoenixStakePosition extends DefiPositionBase {
|
|
@@ -863,6 +1310,11 @@ export declare interface QuoteInfo {
|
|
|
863
1310
|
expiresAtLedger: number;
|
|
864
1311
|
}
|
|
865
1312
|
|
|
1313
|
+
/** Body for `POST /v1/:network/stats/merges`. */
|
|
1314
|
+
export declare interface RecordMergeRequest {
|
|
1315
|
+
txHash: string;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
866
1318
|
/** Response from `POST /v1/:network/stats/merges`. `counted` is false for an already-counted hash. */
|
|
867
1319
|
export declare interface RecordMergeResponse {
|
|
868
1320
|
counted: boolean;
|
|
@@ -873,6 +1325,11 @@ export declare interface RequestOptions {
|
|
|
873
1325
|
signal?: AbortSignal;
|
|
874
1326
|
}
|
|
875
1327
|
|
|
1328
|
+
/** Settles a submission by its own hash. A lookup that fails, or that answers for another hash,
|
|
1329
|
+
* settles nothing. The ledger close time in a `not_found` only ever delays giving up: past the
|
|
1330
|
+
* deadline by both clocks is the only way out, so neither clock can end the wait early alone. */
|
|
1331
|
+
export declare function resolveSubmission(submission: UnresolvedSubmission, lookup: (hash: string) => Promise<TransactionLookupResponse>, now?: () => number): Promise<SubmissionOutcome>;
|
|
1332
|
+
|
|
876
1333
|
export declare interface RetryOptions {
|
|
877
1334
|
/** Total attempts including the first. Values below 2 disable retrying. */
|
|
878
1335
|
attempts: number;
|
|
@@ -880,11 +1337,16 @@ export declare interface RetryOptions {
|
|
|
880
1337
|
baseDelayMs: number;
|
|
881
1338
|
}
|
|
882
1339
|
|
|
883
|
-
/** Response from `POST /:network/allowances/revoke`. */
|
|
1340
|
+
/** Response from `POST /v1/:network/allowances/revoke`. */
|
|
884
1341
|
export declare interface RevokeAllowanceResponse {
|
|
885
1342
|
transaction: string;
|
|
886
1343
|
}
|
|
887
1344
|
|
|
1345
|
+
/** Response from `POST /v1/integrator/keys/{id}/revoke`. */
|
|
1346
|
+
export declare interface RevokedIntegratorKey {
|
|
1347
|
+
status: "revoked";
|
|
1348
|
+
}
|
|
1349
|
+
|
|
888
1350
|
/**
|
|
889
1351
|
* Runs the full multi-round close. Each round: fetch a batch of unsigned transactions,
|
|
890
1352
|
* verify every one before signing, sign it, and submit only once its accumulated signing
|
|
@@ -893,7 +1355,22 @@ export declare interface RevokeAllowanceResponse {
|
|
|
893
1355
|
* envelope once a different signer is available. Pass that error's `.pending` back in as
|
|
894
1356
|
* `resume` to continue exactly where it stopped.
|
|
895
1357
|
*/
|
|
896
|
-
export declare function runClose(deps: CloseEngineDeps, resume?: PendingRound): Promise<
|
|
1358
|
+
export declare function runClose(deps: CloseEngineDeps, resume?: PendingRound): Promise<CloseRunResult>;
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Response from `GET /v1/config/exchange-registry`. A consumer must refuse to rely on it past
|
|
1362
|
+
* `validUntil` (YYYY-MM-DD): a close into an exchange with the wrong memo rule succeeds on-chain and
|
|
1363
|
+
* is credited to nobody.
|
|
1364
|
+
*/
|
|
1365
|
+
export declare interface ServedExchangeRegistry {
|
|
1366
|
+
version: string;
|
|
1367
|
+
/** The date every entry was last checked against the exchanges' own deposit docs. */
|
|
1368
|
+
lastVerified: string;
|
|
1369
|
+
/** After this date the data is treated as unusable, not merely old. */
|
|
1370
|
+
validUntil: string;
|
|
1371
|
+
source: string;
|
|
1372
|
+
entries: ExchangeRegistryEntry[];
|
|
1373
|
+
}
|
|
897
1374
|
|
|
898
1375
|
/** A SEP-41 token balance the account holds in a contract's storage - not a classic trustline. */
|
|
899
1376
|
export declare interface SorobanTokenBalance {
|
|
@@ -979,6 +1456,14 @@ export declare type SponsoredEntry = {
|
|
|
979
1456
|
balanceId: string;
|
|
980
1457
|
};
|
|
981
1458
|
|
|
1459
|
+
/** How long `runClose` waits before each of those re-fetches: about one ledger close, the time a
|
|
1460
|
+
* lagging read provider needs to catch up with a transaction that just confirmed. */
|
|
1461
|
+
export declare const STATE_CHANGED_REFETCH_DELAY_MS = 3000;
|
|
1462
|
+
|
|
1463
|
+
/** How many times a round the API refused as `state_changed` is fetched again before the close
|
|
1464
|
+
* stops and asks for a new plan. */
|
|
1465
|
+
export declare const STATE_CHANGED_REFETCHES = 2;
|
|
1466
|
+
|
|
982
1467
|
/** Response from `GET /v1/:network/stats/feed`. `daily` is oldest first, one entry per day. */
|
|
983
1468
|
export declare interface StatsFeed {
|
|
984
1469
|
totals: StatsTotals;
|
|
@@ -1027,6 +1512,40 @@ export declare interface SubInvocationCall {
|
|
|
1027
1512
|
args: string[];
|
|
1028
1513
|
}
|
|
1029
1514
|
|
|
1515
|
+
/** How long past a transaction's time bounds it is still treated as able to land. Absorbs a
|
|
1516
|
+
* client clock running ahead, and the ledger close that decides whether it was in time. */
|
|
1517
|
+
export declare const SUBMISSION_GIVE_UP_MARGIN_SECONDS = 120;
|
|
1518
|
+
|
|
1519
|
+
/** Whether a submission is the close's merge. Only ever true for a merge the client parsed. */
|
|
1520
|
+
export declare const submissionClosesAccount: (submission: UnresolvedSubmission) => boolean;
|
|
1521
|
+
|
|
1522
|
+
export declare type SubmissionOutcome = {
|
|
1523
|
+
outcome: "confirmed";
|
|
1524
|
+
} | {
|
|
1525
|
+
outcome: "failed";
|
|
1526
|
+
message: string;
|
|
1527
|
+
} | {
|
|
1528
|
+
outcome: "expired";
|
|
1529
|
+
} | {
|
|
1530
|
+
outcome: "unknown";
|
|
1531
|
+
};
|
|
1532
|
+
|
|
1533
|
+
/** How many more times a transaction whose outcome is unknown is sent, as the same bytes. */
|
|
1534
|
+
export declare const SUBMIT_RESEND_ATTEMPTS = 2;
|
|
1535
|
+
|
|
1536
|
+
/** How long `runClose` waits before each of those: about one ledger close. */
|
|
1537
|
+
export declare const SUBMIT_RESEND_DELAY_MS = 5000;
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* `error.details` of a `confirmation_timeout` from `POST /v1/:network/submit`. It is an error, not
|
|
1541
|
+
* a 2xx, because a client that reads `hash` from a success would count the transaction confirmed.
|
|
1542
|
+
* Compute the hash from the envelope you signed rather than taking this one on trust.
|
|
1543
|
+
*/
|
|
1544
|
+
export declare interface SubmitPendingDetails {
|
|
1545
|
+
status: "pending";
|
|
1546
|
+
hash: string;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1030
1549
|
/** Body for `POST /v1/:network/submit`. */
|
|
1031
1550
|
export declare interface SubmitRequest {
|
|
1032
1551
|
signedXdr: string;
|
|
@@ -1039,6 +1558,50 @@ export declare interface SubmitResponse {
|
|
|
1039
1558
|
ledger: number;
|
|
1040
1559
|
}
|
|
1041
1560
|
|
|
1561
|
+
/**
|
|
1562
|
+
* Why a token's conversion is offered but not recommended (`subject.quote.flags`). Each one makes
|
|
1563
|
+
* converting need the `conversion_impact:<contract>` acknowledgement. `high_impact`: the price
|
|
1564
|
+
* impact is above 5%. `impact_unknown`: no price impact could be measured. `provider_disagreement`:
|
|
1565
|
+
* the best quote is more than 10% above the other provider's.
|
|
1566
|
+
*/
|
|
1567
|
+
export declare type TokenQuoteFlag = "high_impact" | "impact_unknown" | "provider_disagreement";
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Why a held Soroban token was not quoted for conversion: `subject.reason` on its
|
|
1571
|
+
* `asset_disposition` decision point when `subject.convertible` is false. `quote_limit`: past the
|
|
1572
|
+
* first 20 tokens one plan quotes. `provider_unavailable`: a swap provider failed, was rate
|
|
1573
|
+
* limited or ran out of time, so analyzing again may find a route. `no_route`: every provider
|
|
1574
|
+
* consulted answered that it has none. `metadata_unreadable`: the token does not report its
|
|
1575
|
+
* symbol or decimals, so no amount about it can be shown.
|
|
1576
|
+
*/
|
|
1577
|
+
export declare type TokenUnquotedReason = "quote_limit" | "provider_unavailable" | "no_route" | "metadata_unreadable";
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* Response from `GET /v1/:network/transactions/:hash`. `not_found` names the ledger window one RPC
|
|
1581
|
+
* provider searched: the transaction may still be queued, or be older than that window. Close times
|
|
1582
|
+
* are unix seconds.
|
|
1583
|
+
*/
|
|
1584
|
+
export declare type TransactionLookupResponse = {
|
|
1585
|
+
status: "confirmed";
|
|
1586
|
+
hash: string;
|
|
1587
|
+
ledger: number;
|
|
1588
|
+
} | {
|
|
1589
|
+
status: "failed";
|
|
1590
|
+
hash: string;
|
|
1591
|
+
ledger: number;
|
|
1592
|
+
message: string;
|
|
1593
|
+
resultCode?: string;
|
|
1594
|
+
} | {
|
|
1595
|
+
status: "not_found";
|
|
1596
|
+
hash: string;
|
|
1597
|
+
searched: {
|
|
1598
|
+
oldestLedger: number;
|
|
1599
|
+
oldestLedgerCloseTime: number;
|
|
1600
|
+
latestLedger: number;
|
|
1601
|
+
latestLedgerCloseTime: number;
|
|
1602
|
+
};
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1042
1605
|
export declare interface TransactionsResponse {
|
|
1043
1606
|
planHash: string;
|
|
1044
1607
|
status: CloseApiStatus;
|
|
@@ -1052,6 +1615,17 @@ export declare interface TransactionsResponse {
|
|
|
1052
1615
|
steps: number;
|
|
1053
1616
|
requiresAnotherCall: boolean;
|
|
1054
1617
|
};
|
|
1618
|
+
/**
|
|
1619
|
+
* The closing account's signers and thresholds as read at the start of this round, the read
|
|
1620
|
+
* the transactions were built from. A transaction can change them (signer normalization), so a
|
|
1621
|
+
* client judges signing weight against this, with each confirmed `SetOptions` of the round
|
|
1622
|
+
* applied on top, rather than against an earlier read. Absent from responses produced before
|
|
1623
|
+
* this field existed.
|
|
1624
|
+
*/
|
|
1625
|
+
sourceAccount?: {
|
|
1626
|
+
signers: AccountSigner[];
|
|
1627
|
+
thresholds: AccountThresholds;
|
|
1628
|
+
};
|
|
1055
1629
|
}
|
|
1056
1630
|
|
|
1057
1631
|
/**
|
|
@@ -1114,4 +1688,19 @@ export declare interface UnrecognizedDefiPosition {
|
|
|
1114
1688
|
reason: string;
|
|
1115
1689
|
}
|
|
1116
1690
|
|
|
1691
|
+
/**
|
|
1692
|
+
* A transaction handed to the network whose outcome is not settled. Never holds the envelope: a
|
|
1693
|
+
* refresh looks this hash up, and does not send anything again. `covers` names a merge only when
|
|
1694
|
+
* the client parsed one out of the envelope it signed.
|
|
1695
|
+
*/
|
|
1696
|
+
export declare interface UnresolvedSubmission {
|
|
1697
|
+
/** Computed by the client from the final envelope, never taken from the API. */
|
|
1698
|
+
hash: string;
|
|
1699
|
+
covers: CloseTransaction["covers"];
|
|
1700
|
+
/** Unix seconds after which the transaction cannot land; null when it has no time bounds. */
|
|
1701
|
+
validUntil: number | null;
|
|
1702
|
+
coversTargets?: string[];
|
|
1703
|
+
needsSponsoredFee?: boolean;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1117
1706
|
export { }
|