@lamarge/sdk 0.1.0 → 0.1.1
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 +1 -1
- package/dist/generated/api.d.ts +98 -64
- package/dist/maker.d.ts +6 -0
- package/dist/maker.js +23 -2
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ import { createClient, Maker, Quoter } from "@lamarge/sdk";
|
|
|
47
47
|
const master = new Maker(createClient({ apiUrl }), financialAccount, operatorAddress, "https://app.lamarge.trade");
|
|
48
48
|
await master.login();
|
|
49
49
|
const credential = await master.createCredential("quoter", quoteAccount.address);
|
|
50
|
-
const order = await master.addCapital({ venue: "hyperliquid", amount: "5000000", client_request_id, funding_source: "venue" }, credential,
|
|
50
|
+
const order = await master.waitForFunding(await master.addCapital({ venue: "hyperliquid", amount: "5000000", client_request_id, funding_source: "venue" }, credential, store));
|
|
51
51
|
|
|
52
52
|
const quoter = new Quoter(createClient({ apiUrl, token: credential.token }), credential.id, quoteAccount);
|
|
53
53
|
await quoter.lease(30);
|
package/dist/generated/api.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface paths {
|
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
70
|
* List venues
|
|
71
|
-
* @description Every venue in display order, with its settlement terms, token, permit domain, margin-transfer format and deposit minimum
|
|
71
|
+
* @description Every venue in display order, with its settlement terms, token, permit domain, margin-transfer format and deposit minimum, all null when disabled. Check them against the [deployment values](/how-it-works#deployment-values) before signing.
|
|
72
72
|
*/
|
|
73
73
|
get: operations["getVenues"];
|
|
74
74
|
put?: never;
|
|
@@ -90,7 +90,7 @@ export interface paths {
|
|
|
90
90
|
put?: never;
|
|
91
91
|
/**
|
|
92
92
|
* Aster signing network
|
|
93
|
-
* @description RPC URL of chain 1666 (`0x682`), which a wallet adds with `wallet_addEthereumChain` to sign an Aster transfer: wallets sign typed data only for their current chain. It answers only `eth_chainId` and `net_version`;
|
|
93
|
+
* @description RPC URL of chain 1666 (`0x682`), which a wallet adds with `wallet_addEthereumChain` to sign an Aster transfer: wallets sign typed data only for their current chain. It answers only `eth_chainId` and `net_version`; other methods get JSON-RPC error -32601.
|
|
94
94
|
*/
|
|
95
95
|
post: operations["postAsterSigningRpc"];
|
|
96
96
|
delete?: never;
|
|
@@ -108,7 +108,7 @@ export interface paths {
|
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
110
|
* Get a book
|
|
111
|
-
* @description Levels the taker pays on `from` and receives on `to`, best price first, then oldest; they are not reservations. A level is a quote that [admits takes](/how-it-works#quotes), with a signed expiry at least the maker timeout away and `min(available, max_fill)` at least `min_fill`. With a Hyperliquid `from`, or a pool held inside Lighter or Aster, the maker's balance must have been read within two minutes. Over 8000 candidate levels: 503 `SNAPSHOT_TOO_LARGE`.
|
|
111
|
+
* @description Levels the taker pays on `from` and receives on `to`, best price first, then oldest; they are not reservations. A level is a quote that [admits takes](/how-it-works#quotes), with a signed expiry at least the maker timeout away and `min(available, max_fill)` at least `min_fill`. With a Hyperliquid `from`, or a pool held inside Lighter or Aster (approved makers only), the maker's balance must have been read within two minutes. Over 8000 candidate levels: 503 `SNAPSHOT_TOO_LARGE`.
|
|
112
112
|
*/
|
|
113
113
|
get: operations["getBook"];
|
|
114
114
|
put?: never;
|
|
@@ -128,7 +128,7 @@ export interface paths {
|
|
|
128
128
|
};
|
|
129
129
|
/**
|
|
130
130
|
* Get the best route
|
|
131
|
-
* @description What takes would pay now on `to` for `amount_in` on `from`: one take, or two through another venue when no take
|
|
131
|
+
* @description What takes would pay now on `to` for `amount_in` on `from`: one take, or two through another venue when no direct take is possible (Lighter and Aster) or finds nothing, or when two pay at least 10 bps more and spend no less. The second take pays what the first delivers, less the Lighter account's transfer fee, rounded down to millionths; where it carries less, the first shrinks to fit. `capped`: the route spends less than `amount_in`. Takes are admitted as `POST /v1/takes` admits them, your own orders excluded; no route goes through Lighter without a linked account and a known fee. The error is what refuses the direct take, or every route; an unusable venue between only drops its routes. Nothing is reserved.
|
|
132
132
|
*/
|
|
133
133
|
get: operations["getRoute"];
|
|
134
134
|
put?: never;
|
|
@@ -148,7 +148,7 @@ export interface paths {
|
|
|
148
148
|
};
|
|
149
149
|
/**
|
|
150
150
|
* Get signed trade proof
|
|
151
|
-
* @description The settled trade's signed maker `QuoteSet`, funding authorization (`FundOffer`, or the delivery for a pool held inside a venue) and taker `PayTake
|
|
151
|
+
* @description The settled trade's signed maker `QuoteSet`, funding authorization (`FundOffer`, or the delivery for a pool held inside a venue) and taker `PayTake` (or the executed `payment` when paid from Lighter or Aster), with digests and relayed transactions. Public once all three are recorded.
|
|
152
152
|
*/
|
|
153
153
|
get: operations["getTradeProof"];
|
|
154
154
|
put?: never;
|
|
@@ -188,7 +188,7 @@ export interface paths {
|
|
|
188
188
|
};
|
|
189
189
|
/**
|
|
190
190
|
* Health
|
|
191
|
-
* @description Settlement readiness; 503 with the same body when
|
|
191
|
+
* @description Settlement readiness; 503 with the same body when a chain other than an exit-only escrow is not `ready`.
|
|
192
192
|
*/
|
|
193
193
|
get: operations["getHealth"];
|
|
194
194
|
put?: never;
|
|
@@ -330,7 +330,7 @@ export interface paths {
|
|
|
330
330
|
};
|
|
331
331
|
/**
|
|
332
332
|
* Read account setup
|
|
333
|
-
* @description The linked account's setup steps, each read from the venue now: a step the venue shows is recorded `done`, one it no longer accepts is `required` again with its `reason`. A
|
|
333
|
+
* @description The linked account's setup steps, each read from the venue now: a step the venue shows is recorded `done`, one it no longer accepts is `required` again with its `reason`. A permit prepared but not signed carries its `to_sign`. `ready` once every step is done ([setup](/quickstart#set-up-venue-accounts)).
|
|
334
334
|
*/
|
|
335
335
|
get: operations["getVenueSetup"];
|
|
336
336
|
put?: never;
|
|
@@ -454,7 +454,7 @@ export interface paths {
|
|
|
454
454
|
};
|
|
455
455
|
/**
|
|
456
456
|
* Get my exposure
|
|
457
|
-
* @description A consistent snapshot per venue, Lighter and Aster included; a credential sees its identity's amounts.
|
|
457
|
+
* @description A consistent snapshot per venue, Lighter and Aster included; a credential sees its identity's amounts. On escrow venues, check `chain_observation.current`; it is null on Lighter and Aster. Credential scope: `read`.
|
|
458
458
|
*/
|
|
459
459
|
get: operations["getV1MeExposure"];
|
|
460
460
|
put?: never;
|
|
@@ -476,7 +476,7 @@ export interface paths {
|
|
|
476
476
|
put?: never;
|
|
477
477
|
/**
|
|
478
478
|
* Prepare maker funds or a quote
|
|
479
|
-
* @description Funds the quote identity's capital pool on `venue`, or adds or replaces one of its quotes ([maker capital](/how-it-works#maker-capital)). Without `quote`, the order is left unquoted unless it belongs to the browser identity, whose quotes are re-signed. Idempotent on `client_request_id`. Lighter and Aster pools ([active market making](/market-making#active-market-making)): approved makers only (`MAKER_NOT_APPROVED`), one pool per account;
|
|
479
|
+
* @description Funds the quote identity's capital pool on `venue`, or adds or replaces one of its quotes ([maker capital](/how-it-works#maker-capital)). Without `quote`, the order is left unquoted unless it belongs to the browser identity, whose quotes are re-signed. Idempotent on `client_request_id`. Lighter and Aster pools ([active market making](/market-making#active-market-making)): approved makers only (`MAKER_NOT_APPROVED`), one pool per account, `funding_source: venue` and no `quote` (quote through `POST /v1/orders/{id}/quotes/prepare`); the preparation is `complete` at once. An unreadable Lighter transfer fee is `VENUE_UNAVAILABLE`.
|
|
480
480
|
*/
|
|
481
481
|
post: operations["prepareMaker"];
|
|
482
482
|
delete?: never;
|
|
@@ -498,7 +498,7 @@ export interface paths {
|
|
|
498
498
|
post?: never;
|
|
499
499
|
/**
|
|
500
500
|
* Cancel an unsigned maker preparation
|
|
501
|
-
* @description Cancels a `preparing` preparation
|
|
501
|
+
* @description Cancels a `preparing` preparation and restores its order's state; repeating returns it, other states are `STATE_CONFLICT`. An unsigned preparation also cancels at expiry.
|
|
502
502
|
*/
|
|
503
503
|
delete: operations["cancelMakerPreparation"];
|
|
504
504
|
options?: never;
|
|
@@ -576,13 +576,13 @@ export interface paths {
|
|
|
576
576
|
get?: never;
|
|
577
577
|
/**
|
|
578
578
|
* Replace the quote set
|
|
579
|
-
* @description Publishes a signed draft ([quotes](/how-it-works#quotes)). `STALE_QUOTE` unless the order is `live`, the lease current and the draft under five minutes old, before `valid_until`, at the current generation and `cancel_epoch`; `STALE_SEQUENCE` unless its sequence exceeds every published one; `STATE_CONFLICT` if a guarded draft's revision changed or the draft was accepted with another signature. Retries never restore a cancelled or superseded set; reserved fills keep their quote. ERC-1271 signers are checked on the supply chain. Credential scope: `quote`.
|
|
579
|
+
* @description Publishes a signed draft ([quotes](/how-it-works#quotes)). `STALE_QUOTE` unless the order is `live`, the lease current and the draft under five minutes old, before `valid_until`, at the current generation and `cancel_epoch`; `STALE_SEQUENCE` unless its sequence exceeds every published one; `STATE_CONFLICT` if a guarded draft's revision changed or the draft was accepted with another signature. Retries never restore a cancelled or superseded set; reserved fills keep their quote. ERC-1271 signers are checked on the supply venue's escrow chain; a Lighter or Aster pool needs an EOA signer. Credential scope: `quote`.
|
|
580
580
|
*/
|
|
581
581
|
put: operations["putQuotes"];
|
|
582
582
|
post?: never;
|
|
583
583
|
/**
|
|
584
584
|
* Pull the quotes
|
|
585
|
-
* @description Removes the order from admission and advances `cancel_epoch` on every call; drafts prepared before the receipt cannot be published. Earlier reservations continue and the signed set stays valid on chain ([cancellation](/how-it-works#cancellation)).
|
|
585
|
+
* @description Removes the order from admission and advances `cancel_epoch` on every call; drafts prepared before the receipt cannot be published. Earlier reservations continue and the signed set stays valid on chain ([cancellation](/how-it-works#cancellation)). Capital is not withdrawn. Credential scope: `cancel`.
|
|
586
586
|
*/
|
|
587
587
|
delete: operations["deleteQuotes"];
|
|
588
588
|
options?: never;
|
|
@@ -601,7 +601,7 @@ export interface paths {
|
|
|
601
601
|
put?: never;
|
|
602
602
|
/**
|
|
603
603
|
* Prepare a quote set
|
|
604
|
-
* @description Stores an immutable draft with the next sequence for a `live` order with a current lease, else `STATE_CONFLICT`; publish it signed within five minutes. Each quote pays the maker's linked, set-up account on another enabled venue ([quotes](/how-it-works#quotes)). At most 100 unpublished drafts per identity
|
|
604
|
+
* @description Stores an immutable draft with the next sequence for a `live` order with a current lease, else `STATE_CONFLICT`; publish it signed within five minutes. Each quote pays the maker's linked, set-up account on another enabled venue ([quotes](/how-it-works#quotes)). At most 100 unpublished, unexpired drafts per identity, else `RATE_LIMITED`. Credential scope: `quote`.
|
|
605
605
|
*/
|
|
606
606
|
post: operations["prepareQuotes"];
|
|
607
607
|
delete?: never;
|
|
@@ -761,7 +761,7 @@ export interface paths {
|
|
|
761
761
|
put?: never;
|
|
762
762
|
/**
|
|
763
763
|
* Close by signature
|
|
764
|
-
* @description Relays the prepared terms, signed by the linked address, as `closeOfferBySig`; LaMarge pays gas. The terms are rechecked as at preparation (a stale `dex` is `VALIDATION_ERROR`). A refused venue deposit stays in your available escrow balance. A recorded order is `closing`, off the books, until the transaction is final or a minute past its deadline; after a revert or expiry, sign again. `STATE_CONFLICT` during a financial operation on the venue, at 10 pending closes per owner and chain, or for a nonce reused with other terms; the same terms return the same close.
|
|
764
|
+
* @description Relays the prepared terms, signed by the linked address, as `closeOfferBySig`; LaMarge pays gas. The terms are rechecked as at preparation (a stale `dex` is `VALIDATION_ERROR`). A refused venue deposit stays in your available escrow balance. A recorded order is `closing`, off the books, until the transaction is final or a minute past its deadline; after a revert or expiry, sign again. `STATE_CONFLICT` during a financial operation on the venue, while a close of the order is pending, at 10 pending closes per owner and chain, or for a nonce reused with other terms; the same terms return the same close.
|
|
765
765
|
*/
|
|
766
766
|
post: operations["postEscrowClose"];
|
|
767
767
|
delete?: never;
|
|
@@ -785,7 +785,7 @@ export interface paths {
|
|
|
785
785
|
put?: never;
|
|
786
786
|
/**
|
|
787
787
|
* Create a recoverable transfer
|
|
788
|
-
* @description Records a route that withdraws from venue margin, then takes; moves no funds and reserves nothing. No payment setup needed; `funding_plan` asks for a permit when wallet funds need one. Retrying with the same `client_transfer_id` returns the intent; changed terms are `STATE_CONFLICT`.
|
|
788
|
+
* @description Records a route that withdraws from venue margin (not Lighter or Aster), then takes; moves no funds and reserves nothing. No payment setup needed; `funding_plan` asks for a permit when wallet funds need one. Retrying with the same `client_transfer_id` returns the intent; changed terms are `STATE_CONFLICT`.
|
|
789
789
|
*/
|
|
790
790
|
post: operations["postTransfer"];
|
|
791
791
|
delete?: never;
|
|
@@ -829,7 +829,7 @@ export interface paths {
|
|
|
829
829
|
put?: never;
|
|
830
830
|
/**
|
|
831
831
|
* Prepare this transfer's funding
|
|
832
|
-
* @description One withdrawal of `amount`, at most `amount_in`, from the payer's `from` margin to its escrow-chain address, for the take to deposit;
|
|
832
|
+
* @description One withdrawal of `amount`, at most `amount_in`, from the payer's `from` margin to its escrow-chain address, for the take to deposit; none from Lighter or Aster, which pay inside the venue (`VALIDATION_ERROR`). Retries return the same typed data until ten minutes after the first preparation, then `WITHDRAWAL_EXPIRED`: cancel and create another transfer. Another amount conflicts.
|
|
833
833
|
*/
|
|
834
834
|
post: operations["prepareTransferWithdrawal"];
|
|
835
835
|
delete?: never;
|
|
@@ -849,7 +849,7 @@ export interface paths {
|
|
|
849
849
|
put?: never;
|
|
850
850
|
/**
|
|
851
851
|
* Submit this transfer's funding signature
|
|
852
|
-
* @description Submits the signed preparation, recorded before the venue is called;
|
|
852
|
+
* @description Submits the signed preparation, recorded before the venue is called; answers 200 with the withdrawal, even `refused`, and retries return it. Never sign another for an `unknown` one.
|
|
853
853
|
*/
|
|
854
854
|
post: operations["submitTransferWithdrawal"];
|
|
855
855
|
delete?: never;
|
|
@@ -869,7 +869,7 @@ export interface paths {
|
|
|
869
869
|
put?: never;
|
|
870
870
|
/**
|
|
871
871
|
* Take at market
|
|
872
|
-
* @description Reserves up to `max_parts` fills paid from the payer's available balance in the `from` escrow ([takes](/how-it-works#takes)). One `pay_take` signature covers every payment and a wallet deposit of any shortfall; the deposit needs the payer's `permit` step (`SETUP_REQUIRED`). `PREFUNDING_REQUIRED`, reserving nothing, when balance and wallet together fall short: fund the wallet with a [transfer](/api-reference/transfers/create). `STATE_CONFLICT` while another financial preparation is open on `from`; `FILL_IN_PROGRESS` while another take is unpaid. Persist `client_take_id`: the same body returns the same take.
|
|
872
|
+
* @description Reserves up to `max_parts` fills paid from the payer's available balance in the `from` escrow ([takes](/how-it-works#takes)). One `pay_take` signature covers every payment and a wallet deposit of any shortfall; the deposit needs the payer's `permit` step (`SETUP_REQUIRED`). `PREFUNDING_REQUIRED`, reserving nothing, when balance and wallet together fall short: fund the wallet with a [transfer](/api-reference/transfers/create). `STATE_CONFLICT` while another financial preparation is open on `from`; `FILL_IN_PROGRESS` while another take is unpaid. Persist `client_take_id`: the same body returns the same take. Paid from Lighter or Aster: one fill and one `lighter_transfer` or `aster_transfer` signature; `PREFUNDING_REQUIRED` when that account cannot cover it with its fee, `VALIDATION_ERROR` when it backs a pool, `FORBIDDEN` while paying from a venue is suspended.
|
|
873
873
|
*/
|
|
874
874
|
post: operations["postTake"];
|
|
875
875
|
delete?: never;
|
|
@@ -973,7 +973,7 @@ export interface paths {
|
|
|
973
973
|
put?: never;
|
|
974
974
|
/**
|
|
975
975
|
* Report an in-venue delivery
|
|
976
|
-
* @description Reports the venue transfer that delivers a fill on Lighter or Aster ([active market making](/market-making#active-market-making)), with the maker's master session or a `quote` credential of the order's identity. The transfer moves at least `amount_out` from the maker's linked account to `delivery_to`, executes after the take and by `deliver_by`, and delivers only this fill. Lighter: the hash of an internal USDC transfer into collateral, memo the fill id zero-padded to 32
|
|
976
|
+
* @description Reports the venue transfer that delivers a fill on Lighter or Aster ([active market making](/market-making#active-market-making)), with the maker's master session or a `quote` credential of the order's identity. The transfer moves at least `amount_out` from the maker's linked account to `delivery_to`, executes after the take and by `deliver_by`, and delivers only this fill. Lighter: the hash of an internal USDC transfer into collateral, memo the fill id's 16 bytes, zero-padded to 32, at least at status `settlement.delivery.min_status` from `/v1/info` (2 or 3). Aster: the `transferId` of a USDT transfer from the Spot wallet, as both accounts' Spot histories show. Accepted while the payment is `LOCKED` and `maker_leg` is `NONE` or `ABANDONED`, before `report_by` and any refund consent; the operator then claims the payment. Exact retries return the fill.
|
|
977
977
|
*/
|
|
978
978
|
post: operations["submitDelivery"];
|
|
979
979
|
delete?: never;
|
|
@@ -1013,7 +1013,7 @@ export interface paths {
|
|
|
1013
1013
|
put?: never;
|
|
1014
1014
|
/**
|
|
1015
1015
|
* Prepare a withdrawal
|
|
1016
|
-
* @description Polymarket, Hyperliquid and Aster only ([margin transfers](/how-it-works#margin-transfers)). `amount` must fit a fresh read of the withdrawable balance less transfers relayed since, else `VALIDATION_ERROR`; a `queued`, `submitting` or `unknown` withdrawal on the venue is `STATE_CONFLICT`. On Aster the signed amount adds the venue fee.
|
|
1016
|
+
* @description Polymarket, Hyperliquid and Aster only ([margin transfers](/how-it-works#margin-transfers)). `amount` must fit a fresh read of the withdrawable balance less transfers relayed since, else `VALIDATION_ERROR`; a `queued`, `submitting` or `unknown` withdrawal on the venue is `STATE_CONFLICT`. On Aster the signed amount adds the venue fee. Relay within ten minutes.
|
|
1017
1017
|
*/
|
|
1018
1018
|
post: operations["postWithdrawalPrepare"];
|
|
1019
1019
|
delete?: never;
|
|
@@ -1053,7 +1053,7 @@ export interface paths {
|
|
|
1053
1053
|
put?: never;
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Create a maker credential
|
|
1056
|
-
* @description Creates a maker credential and its quote identity (same `id`) with an immutable `quote_signer`; at most 32 active. Scopes: `read`, `quote`, `cancel`; none reaches financial routes. After a lost response, revoke the credential and create another.
|
|
1056
|
+
* @description Creates a maker credential and its quote identity (same `id`) with an immutable `quote_signer`; at most 32 active. Scopes: `read`, `quote`, `cancel`; none reaches financial routes. After a lost response, revoke the credential and create another. `FORBIDDEN` when an admin disabled or archived the maker.
|
|
1057
1057
|
*/
|
|
1058
1058
|
post: operations["postV1Credentials"];
|
|
1059
1059
|
delete?: never;
|
|
@@ -1231,7 +1231,7 @@ export interface paths {
|
|
|
1231
1231
|
};
|
|
1232
1232
|
/**
|
|
1233
1233
|
* Read public snapshot
|
|
1234
|
-
* @description Public books and a committed cursor to replay strictly after.
|
|
1234
|
+
* @description Public books and a committed cursor to replay strictly after.
|
|
1235
1235
|
*/
|
|
1236
1236
|
get: operations["getV1Snapshot"];
|
|
1237
1237
|
put?: never;
|
|
@@ -1271,7 +1271,7 @@ export interface paths {
|
|
|
1271
1271
|
};
|
|
1272
1272
|
/**
|
|
1273
1273
|
* Read private and public snapshot
|
|
1274
|
-
* @description Your nonterminal orders and fills and unrevoked quote identities, with a replay cursor; `books` stays empty.
|
|
1274
|
+
* @description Your nonterminal orders and fills and unrevoked quote identities, with a replay cursor; `books` stays empty. Credential scope: `read`.
|
|
1275
1275
|
*/
|
|
1276
1276
|
get: operations["getV1MeSnapshot"];
|
|
1277
1277
|
put?: never;
|
|
@@ -1291,7 +1291,7 @@ export interface paths {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
/**
|
|
1293
1293
|
* WebSocket event replay
|
|
1294
|
-
* @description First text frame: a `StreamSubscription
|
|
1294
|
+
* @description First text frame, within five seconds: a `StreamSubscription`, else the socket closes; never put `token` in the URL ([WebSocket](/streaming#websocket)). Private streams need a session or `read` credential, rechecked about every 500 ms. Frames are `EventPage`s of up to 100 events, empty about every 500 ms when idle. A `StreamControl` precedes closure on authorization, capacity, resync or journal failure. Any later client message other than ping or pong, or a send blocked five seconds, closes the socket.
|
|
1295
1295
|
*/
|
|
1296
1296
|
get: operations["getV1Stream"];
|
|
1297
1297
|
put?: never;
|
|
@@ -1508,11 +1508,11 @@ export interface components {
|
|
|
1508
1508
|
chains: components["schemas"]["ChainHealth"][];
|
|
1509
1509
|
};
|
|
1510
1510
|
Challenge: {
|
|
1511
|
-
/** @description Sign with `personal_sign` exactly as given
|
|
1511
|
+
/** @description Sign with `personal_sign` exactly as given. */
|
|
1512
1512
|
message: string;
|
|
1513
1513
|
nonce: string;
|
|
1514
1514
|
expires_at: components["schemas"]["Timestamp"];
|
|
1515
|
-
/** @description
|
|
1515
|
+
/** @description Not returned: Aster's agent approval is the `agent` setup step's `to_sign`. */
|
|
1516
1516
|
typed_data?: components["schemas"]["TypedData"];
|
|
1517
1517
|
};
|
|
1518
1518
|
Session: {
|
|
@@ -1525,7 +1525,7 @@ export interface components {
|
|
|
1525
1525
|
venue: components["schemas"]["VenueId"];
|
|
1526
1526
|
/** @description Owner of the venue account; signs its transfers. */
|
|
1527
1527
|
address: components["schemas"]["Address"];
|
|
1528
|
-
/** @description Polymarket: the
|
|
1528
|
+
/** @description Polymarket: the signer's Deposit Wallet or Safe. Lighter: the account index. Null elsewhere. */
|
|
1529
1529
|
venue_wallet: string | null;
|
|
1530
1530
|
linked_at: components["schemas"]["Timestamp"];
|
|
1531
1531
|
};
|
|
@@ -1607,7 +1607,7 @@ export interface components {
|
|
|
1607
1607
|
escrow_balance: string | null;
|
|
1608
1608
|
/** @description Waiting at `deposit_address` to be swept into the available balance ([balances](/how-it-works#balances)). Read with `chain_balance`. */
|
|
1609
1609
|
deposit_balance: string | null;
|
|
1610
|
-
/** @description Tokens sent here become the linked address's available balance; null
|
|
1610
|
+
/** @description Tokens sent here become the linked address's available balance; null on a venue settled inside itself (Lighter, Aster). */
|
|
1611
1611
|
deposit_address: components["schemas"]["Address"] | null;
|
|
1612
1612
|
/**
|
|
1613
1613
|
* Format: date-time
|
|
@@ -1624,7 +1624,7 @@ export interface components {
|
|
|
1624
1624
|
* @enum {string}
|
|
1625
1625
|
*/
|
|
1626
1626
|
HeldIn: "escrow" | "venue" | (string & {});
|
|
1627
|
-
/** @description
|
|
1627
|
+
/** @description The account's funds on the venue, in its wallets and in the escrow, from the same snapshot as `portfolio`, each counted once, in the venue token's base units. */
|
|
1628
1628
|
Holdings: {
|
|
1629
1629
|
/** @description Movable or committable now: the venue's withdrawable margin less what a pool still owes, the wallets, and the escrow's available balance. */
|
|
1630
1630
|
available: string;
|
|
@@ -1640,7 +1640,7 @@ export interface components {
|
|
|
1640
1640
|
total: string;
|
|
1641
1641
|
};
|
|
1642
1642
|
Stats: {
|
|
1643
|
-
/** @description One
|
|
1643
|
+
/** @description One per venue (escrow chains, then Lighter and Aster), by output venue. */
|
|
1644
1644
|
assets: components["schemas"]["StatsAsset"][];
|
|
1645
1645
|
trades_30d: number;
|
|
1646
1646
|
/** @constant */
|
|
@@ -1681,7 +1681,7 @@ export interface components {
|
|
|
1681
1681
|
operator: components["schemas"]["Address"];
|
|
1682
1682
|
/** @description Funded with this deployment's operator; `POST /v1/closes` can close it. */
|
|
1683
1683
|
managed: boolean;
|
|
1684
|
-
/** @description Your own order operated by this deployment, already
|
|
1684
|
+
/** @description Your own order operated by this deployment, already in `/v1/balances` `holdings.orders`. Order zero is `escrow_balance` there; other orders add to it. */
|
|
1685
1685
|
in_balances: boolean;
|
|
1686
1686
|
/** @description A close by signature is pending. */
|
|
1687
1687
|
closing: boolean;
|
|
@@ -1844,17 +1844,17 @@ export interface components {
|
|
|
1844
1844
|
error: string | null;
|
|
1845
1845
|
/** @description Funded amount; inside a venue (Lighter, Aster), the maker's cap that deliveries consume. */
|
|
1846
1846
|
amount: components["schemas"]["Amount"];
|
|
1847
|
-
/** @description What the order holds, where `held_in` says: unlocked escrow; for a pool, its account's transferable balance at the last read less deliveries since, within the cap left. */
|
|
1847
|
+
/** @description What the order holds, where `held_in` says: unlocked escrow; for a Lighter or Aster pool, its account's transferable balance at the last read less deliveries since, within the cap left. */
|
|
1848
1848
|
held: components["schemas"]["Amount"];
|
|
1849
1849
|
/**
|
|
1850
1850
|
* @deprecated
|
|
1851
|
-
* @description
|
|
1851
|
+
* @description Former name of `held`; removed once makers have moved.
|
|
1852
1852
|
*/
|
|
1853
1853
|
escrow_available: components["schemas"]["Amount"];
|
|
1854
1854
|
/** @description Inside a venue, the last-read per-delivery fee, held back per reserved fill and for the next; `0` for an escrow order. */
|
|
1855
1855
|
delivery_fee: components["schemas"]["Amount"];
|
|
1856
1856
|
revision: components["schemas"]["Cursor"];
|
|
1857
|
-
/** @description
|
|
1857
|
+
/** @description `held` less unlocked admitted fills, their delivery fees and the next fill's; ignores quotes. Shared across receiving venues. */
|
|
1858
1858
|
available_to_quote: components["schemas"]["Amount"];
|
|
1859
1859
|
/** @description Settled fills' payments per paying venue, in its base units. */
|
|
1860
1860
|
received_by_venue: {
|
|
@@ -1997,7 +1997,7 @@ export interface components {
|
|
|
1997
1997
|
created_at: components["schemas"]["Timestamp"];
|
|
1998
1998
|
} | null;
|
|
1999
1999
|
withdrawal: components["schemas"]["Withdrawal"] | null;
|
|
2000
|
-
/** @description Returned on creation and with `funding_plan=true` while the transfer has no take and is not cancelled: before a withdrawal, or once a relayed withdrawal's funds at the wallet plus the available balance cover `amount_in`. Null otherwise, or when it cannot be computed. */
|
|
2000
|
+
/** @description Returned on creation and with `funding_plan=true` while the transfer has no take and is not cancelled: before a withdrawal, or once a relayed withdrawal's funds at the wallet plus the available balance cover `amount_in`. Null otherwise, when paying from Lighter or Aster, or when it cannot be computed. */
|
|
2001
2001
|
funding_plan: components["schemas"]["FundingPlan"] | null;
|
|
2002
2002
|
take_id: components["schemas"]["Uuid"] | null;
|
|
2003
2003
|
/** @description True once all its take's fills are final; null without a take. */
|
|
@@ -2005,7 +2005,7 @@ export interface components {
|
|
|
2005
2005
|
then?: components["schemas"]["TransferThen"];
|
|
2006
2006
|
/** @description The transfer this one continues. */
|
|
2007
2007
|
previous_transfer_id: components["schemas"]["Uuid"] | null;
|
|
2008
|
-
/** @description With `then`, once no part of its take can deliver more and unless cancelled: what a continuation may still pay, in `to` base units
|
|
2008
|
+
/** @description With `then`, once no part of its take can deliver more and unless cancelled: what a continuation may still pay, in `to` base units: what the take delivered, less what continuations may pay or paid (fees included) and the next payment's fee, in whole millionths. Null otherwise, or while Lighter's fee is unknown. */
|
|
2009
2009
|
continuable: components["schemas"]["Amount"] | null;
|
|
2010
2010
|
cancelled_at: components["schemas"]["Timestamp"] | null;
|
|
2011
2011
|
created_at: components["schemas"]["Timestamp"];
|
|
@@ -2155,12 +2155,12 @@ export interface components {
|
|
|
2155
2155
|
/** @enum {string} */
|
|
2156
2156
|
OrderState: "preparing" | "moving" | "funding" | "live" | "closing" | "closed" | "failed" | (string & {});
|
|
2157
2157
|
/**
|
|
2158
|
-
* @description `PAYING`: paid from Lighter or Aster, the maker locked and the transfer not yet executed
|
|
2158
|
+
* @description `PAYING`: paid from Lighter or Aster, the maker locked and the transfer not yet executed. `REFUNDING`: one leg refunded or abandoned while the other is still locked, or a `PAYING` transfer that ended unexecuted.
|
|
2159
2159
|
* @enum {string}
|
|
2160
2160
|
*/
|
|
2161
2161
|
FillState: "RESERVED" | "PAID" | "PAYING" | "LOCKED" | "CLAIMING" | "SETTLED" | "EXPIRED" | "REFUNDING" | "REFUNDED" | "MAKER_LOSS" | "TAKER_LOSS" | (string & {});
|
|
2162
2162
|
/**
|
|
2163
|
-
* @description The taker's lock on the `from_venue` chain.
|
|
2163
|
+
* @description The taker's lock on the `from_venue` chain; paid from Lighter or Aster, `CLAIMED` once the transfer executed.
|
|
2164
2164
|
* @enum {string}
|
|
2165
2165
|
*/
|
|
2166
2166
|
PaymentLeg: "NONE" | "LOCKED" | "CLAIMED" | "REFUNDED" | (string & {});
|
|
@@ -2291,12 +2291,12 @@ export interface components {
|
|
|
2291
2291
|
maker_escrow: components["schemas"]["Amount"];
|
|
2292
2292
|
/**
|
|
2293
2293
|
* @deprecated
|
|
2294
|
-
* @description `maker_escrow` + `maker_pool_inventory`,
|
|
2294
|
+
* @description `maker_escrow` + `maker_pool_inventory`, its former meaning; removed once makers have moved.
|
|
2295
2295
|
*/
|
|
2296
2296
|
maker_escrow_unlocked: components["schemas"]["Amount"];
|
|
2297
|
-
/** @description Lighter or Aster pool: the account's transferable balance at the last read, within the cap. Part of the venue account's equity, never added to it. */
|
|
2297
|
+
/** @description Lighter or Aster pool: the account's transferable balance at the last read less deliveries since, within the cap left. Part of the venue account's equity, never added to it. */
|
|
2298
2298
|
maker_pool_inventory: components["schemas"]["Amount"];
|
|
2299
|
-
/** @description Output of the maker's reserved or paid fills not yet locked or delivered
|
|
2299
|
+
/** @description Output of the maker's reserved or paid fills not yet locked or delivered; can exceed observed inventory. */
|
|
2300
2300
|
maker_reserved: components["schemas"]["Amount"];
|
|
2301
2301
|
maker_locked: components["schemas"]["Amount"];
|
|
2302
2302
|
/** @description Output the taker received (claim or accepted delivery) with payment still locked. */
|
|
@@ -2370,7 +2370,7 @@ export interface components {
|
|
|
2370
2370
|
/** @enum {string|null} */
|
|
2371
2371
|
withdrawal_to: "signer" | null;
|
|
2372
2372
|
/**
|
|
2373
|
-
* @description `required` lists a `permit` request first: prepare it with `POST /v1/accounts/{venue}/setup/permit`, sign and submit it; take once `done`. `pending`: submitted, not yet effective.
|
|
2373
|
+
* @description `required` lists a `permit` request first: prepare it with `POST /v1/accounts/{venue}/setup/permit`, sign and submit it; take once `done`. `pending`: submitted, not yet effective.
|
|
2374
2374
|
* @enum {string}
|
|
2375
2375
|
*/
|
|
2376
2376
|
payment_setup: "done" | "pending" | "required" | (string & {});
|
|
@@ -2426,9 +2426,9 @@ export interface components {
|
|
|
2426
2426
|
LeaseInput: {
|
|
2427
2427
|
/** @description Ignored for a browser identity. */
|
|
2428
2428
|
ttl_seconds: number;
|
|
2429
|
-
/** @description
|
|
2429
|
+
/** @description Round-trip time of your latest successful request, in ms; send with `api_rtt_age_ms`. Ignored for a browser identity. */
|
|
2430
2430
|
api_rtt_ms?: number;
|
|
2431
|
-
/** @description
|
|
2431
|
+
/** @description How long before this renewal that request completed, in ms; send with `api_rtt_ms`. */
|
|
2432
2432
|
api_rtt_age_ms?: number;
|
|
2433
2433
|
};
|
|
2434
2434
|
Lease: {
|
|
@@ -2454,7 +2454,7 @@ export interface components {
|
|
|
2454
2454
|
held: components["schemas"]["Amount"];
|
|
2455
2455
|
/**
|
|
2456
2456
|
* @deprecated
|
|
2457
|
-
* @description
|
|
2457
|
+
* @description Former name of `held`; removed once makers have moved.
|
|
2458
2458
|
*/
|
|
2459
2459
|
escrow_available: components["schemas"]["Amount"];
|
|
2460
2460
|
held_in: components["schemas"]["HeldIn"];
|
|
@@ -2620,7 +2620,7 @@ export interface components {
|
|
|
2620
2620
|
held: components["schemas"]["Amount"];
|
|
2621
2621
|
/**
|
|
2622
2622
|
* @deprecated
|
|
2623
|
-
* @description
|
|
2623
|
+
* @description Former name of `held`; removed once makers have moved.
|
|
2624
2624
|
*/
|
|
2625
2625
|
escrow_available: components["schemas"]["Amount"];
|
|
2626
2626
|
held_in: components["schemas"]["HeldIn"];
|
|
@@ -2704,7 +2704,7 @@ export interface components {
|
|
|
2704
2704
|
held: components["schemas"]["Amount"];
|
|
2705
2705
|
/**
|
|
2706
2706
|
* @deprecated
|
|
2707
|
-
* @description
|
|
2707
|
+
* @description Former name of `held`; removed once makers have moved.
|
|
2708
2708
|
*/
|
|
2709
2709
|
escrow_available: components["schemas"]["Amount"];
|
|
2710
2710
|
held_in: components["schemas"]["HeldIn"];
|
|
@@ -2762,7 +2762,7 @@ export interface components {
|
|
|
2762
2762
|
amount_in: components["schemas"]["Amount"];
|
|
2763
2763
|
amount_out: components["schemas"]["Amount"];
|
|
2764
2764
|
settled_at: components["schemas"]["Timestamp"];
|
|
2765
|
-
/** @description The
|
|
2765
|
+
/** @description The taker's master address, not a linked venue address. */
|
|
2766
2766
|
taker_address: components["schemas"]["Address"];
|
|
2767
2767
|
};
|
|
2768
2768
|
OrderHistoryPage: {
|
|
@@ -2944,7 +2944,7 @@ export interface components {
|
|
|
2944
2944
|
"application/json": components["schemas"]["Error"];
|
|
2945
2945
|
};
|
|
2946
2946
|
};
|
|
2947
|
-
/** @description `SNAPSHOT_TOO_LARGE`:
|
|
2947
|
+
/** @description `SNAPSHOT_TOO_LARGE`: over 1000 orders, fills or quote identities, or 8000 book levels; never partial. */
|
|
2948
2948
|
SnapshotTooLarge: {
|
|
2949
2949
|
headers: {
|
|
2950
2950
|
[name: string]: unknown;
|
|
@@ -3058,7 +3058,6 @@ export interface operations {
|
|
|
3058
3058
|
"text/html": string;
|
|
3059
3059
|
};
|
|
3060
3060
|
};
|
|
3061
|
-
400: components["responses"]["ValidationError"];
|
|
3062
3061
|
};
|
|
3063
3062
|
};
|
|
3064
3063
|
getVenues: {
|
|
@@ -3104,6 +3103,17 @@ export interface operations {
|
|
|
3104
3103
|
"application/json": unknown;
|
|
3105
3104
|
};
|
|
3106
3105
|
};
|
|
3106
|
+
400: components["responses"]["ValidationError"];
|
|
3107
|
+
413: components["responses"]["PayloadTooLarge"];
|
|
3108
|
+
/** @description Body not sent as `Content-Type: application/json`. */
|
|
3109
|
+
415: {
|
|
3110
|
+
headers: {
|
|
3111
|
+
[name: string]: unknown;
|
|
3112
|
+
};
|
|
3113
|
+
content: {
|
|
3114
|
+
"application/json": components["schemas"]["Error"];
|
|
3115
|
+
};
|
|
3116
|
+
};
|
|
3107
3117
|
};
|
|
3108
3118
|
};
|
|
3109
3119
|
getBook: {
|
|
@@ -3162,7 +3172,15 @@ export interface operations {
|
|
|
3162
3172
|
};
|
|
3163
3173
|
400: components["responses"]["ValidationError"];
|
|
3164
3174
|
401: components["responses"]["Unauthenticated"];
|
|
3165
|
-
|
|
3175
|
+
/** @description `FORBIDDEN`: paying from a venue is suspended after failed payments. */
|
|
3176
|
+
403: {
|
|
3177
|
+
headers: {
|
|
3178
|
+
[name: string]: unknown;
|
|
3179
|
+
};
|
|
3180
|
+
content: {
|
|
3181
|
+
"application/json": components["schemas"]["Error"];
|
|
3182
|
+
};
|
|
3183
|
+
};
|
|
3166
3184
|
/** @description `INSUFFICIENT_LIQUIDITY`: no route takes this amount. */
|
|
3167
3185
|
409: {
|
|
3168
3186
|
headers: {
|
|
@@ -3175,7 +3193,6 @@ export interface operations {
|
|
|
3175
3193
|
422: components["responses"]["VenueDisabled"];
|
|
3176
3194
|
429: components["responses"]["RateLimited"];
|
|
3177
3195
|
500: components["responses"]["Internal"];
|
|
3178
|
-
502: components["responses"]["VenueUnavailable"];
|
|
3179
3196
|
/** @description `OPERATOR_UNAVAILABLE`, retryable: settlement is not ready for new commitments; or `SNAPSHOT_TOO_LARGE`. */
|
|
3180
3197
|
503: {
|
|
3181
3198
|
headers: {
|
|
@@ -3255,7 +3272,7 @@ export interface operations {
|
|
|
3255
3272
|
};
|
|
3256
3273
|
requestBody?: never;
|
|
3257
3274
|
responses: {
|
|
3258
|
-
/** @description Every chain is ready. */
|
|
3275
|
+
/** @description Every chain but exit-only escrows is ready. */
|
|
3259
3276
|
200: {
|
|
3260
3277
|
headers: {
|
|
3261
3278
|
[name: string]: unknown;
|
|
@@ -3462,6 +3479,7 @@ export interface operations {
|
|
|
3462
3479
|
"application/json": components["schemas"]["VenueSetup"];
|
|
3463
3480
|
};
|
|
3464
3481
|
};
|
|
3482
|
+
400: components["responses"]["ValidationError"];
|
|
3465
3483
|
401: components["responses"]["Unauthenticated"];
|
|
3466
3484
|
403: components["responses"]["AccessRequired"];
|
|
3467
3485
|
422: components["responses"]["AccountNotLinked"];
|
|
@@ -3722,7 +3740,7 @@ export interface operations {
|
|
|
3722
3740
|
"application/json": components["schemas"]["Error"];
|
|
3723
3741
|
};
|
|
3724
3742
|
};
|
|
3725
|
-
/** @description `STATE_CONFLICT
|
|
3743
|
+
/** @description `STATE_CONFLICT`: the order's state forbids it, a `client_request_id` reused with other terms, or another funding, take payment or escrow close pending on the venue. */
|
|
3726
3744
|
409: {
|
|
3727
3745
|
headers: {
|
|
3728
3746
|
[name: string]: unknown;
|
|
@@ -4011,7 +4029,7 @@ export interface operations {
|
|
|
4011
4029
|
};
|
|
4012
4030
|
400: components["responses"]["ValidationError"];
|
|
4013
4031
|
401: components["responses"]["Unauthenticated"];
|
|
4014
|
-
/** @description `FORBIDDEN`
|
|
4032
|
+
/** @description `ACCESS_REQUIRED`, `FORBIDDEN` (no `quote` scope, quote identity revoked, or quoting disabled by an admin), or `MAKER_NOT_APPROVED` for a venue-held pool. */
|
|
4015
4033
|
403: {
|
|
4016
4034
|
headers: {
|
|
4017
4035
|
[name: string]: unknown;
|
|
@@ -4223,7 +4241,7 @@ export interface operations {
|
|
|
4223
4241
|
};
|
|
4224
4242
|
400: components["responses"]["BadSignature"];
|
|
4225
4243
|
401: components["responses"]["Unauthenticated"];
|
|
4226
|
-
/** @description `NOT_FOUND`: no close
|
|
4244
|
+
/** @description `NOT_FOUND`: no close with this id, or an expired one removed by a later `POST /v1/closes`. */
|
|
4227
4245
|
404: {
|
|
4228
4246
|
headers: {
|
|
4229
4247
|
[name: string]: unknown;
|
|
@@ -4443,11 +4461,29 @@ export interface operations {
|
|
|
4443
4461
|
400: components["responses"]["ValidationError"];
|
|
4444
4462
|
401: components["responses"]["Unauthenticated"];
|
|
4445
4463
|
403: components["responses"]["AccessRequired"];
|
|
4464
|
+
/** @description `NOT_FOUND`: unknown `previous_transfer_id`. */
|
|
4465
|
+
404: {
|
|
4466
|
+
headers: {
|
|
4467
|
+
[name: string]: unknown;
|
|
4468
|
+
};
|
|
4469
|
+
content: {
|
|
4470
|
+
"application/json": components["schemas"]["Error"];
|
|
4471
|
+
};
|
|
4472
|
+
};
|
|
4446
4473
|
409: components["responses"]["StateConflict"];
|
|
4447
4474
|
413: components["responses"]["PayloadTooLarge"];
|
|
4448
4475
|
422: components["responses"]["AccountNotLinked"];
|
|
4449
4476
|
429: components["responses"]["RateLimited"];
|
|
4450
4477
|
500: components["responses"]["Internal"];
|
|
4478
|
+
/** @description `VENUE_UNAVAILABLE`: the Lighter transfer fee a continuation (`previous_transfer_id`) pays is unknown. */
|
|
4479
|
+
502: {
|
|
4480
|
+
headers: {
|
|
4481
|
+
[name: string]: unknown;
|
|
4482
|
+
};
|
|
4483
|
+
content: {
|
|
4484
|
+
"application/json": components["schemas"]["Error"];
|
|
4485
|
+
};
|
|
4486
|
+
};
|
|
4451
4487
|
};
|
|
4452
4488
|
};
|
|
4453
4489
|
getTransfer: {
|
|
@@ -4758,10 +4794,8 @@ export interface operations {
|
|
|
4758
4794
|
};
|
|
4759
4795
|
};
|
|
4760
4796
|
413: components["responses"]["PayloadTooLarge"];
|
|
4761
|
-
422: components["responses"]["AccountNotLinked"];
|
|
4762
4797
|
429: components["responses"]["RateLimited"];
|
|
4763
4798
|
500: components["responses"]["Internal"];
|
|
4764
|
-
502: components["responses"]["VenueUnavailable"];
|
|
4765
4799
|
};
|
|
4766
4800
|
};
|
|
4767
4801
|
preparePaymentRefund: {
|
|
@@ -4822,7 +4856,7 @@ export interface operations {
|
|
|
4822
4856
|
};
|
|
4823
4857
|
content?: never;
|
|
4824
4858
|
};
|
|
4825
|
-
/** @description
|
|
4859
|
+
/** @description `VALIDATION_ERROR`: deadline past, over one hour or after `t2`; `BAD_SIGNATURE`: not the beneficiary's. */
|
|
4826
4860
|
400: {
|
|
4827
4861
|
headers: {
|
|
4828
4862
|
[name: string]: unknown;
|
|
@@ -4867,7 +4901,7 @@ export interface operations {
|
|
|
4867
4901
|
};
|
|
4868
4902
|
};
|
|
4869
4903
|
};
|
|
4870
|
-
/** @description `VALIDATION_ERROR`: this transaction never delivers the fill. `reason`: `not_a_transfer
|
|
4904
|
+
/** @description `VALIDATION_ERROR`: this transaction never delivers the fill. `reason`: `not_a_transfer`; on Lighter `transfer_failed` (status 0 or above 3), `wrong_sender`, `wrong_recipient`, `wrong_asset` (not USDC collateral) or `wrong_memo`; `amount_short`, `executed_late`, `before_fill` (an Aster transfer older than the fill) or `transfer_used` (it already settles another fill). No `reason`: a malformed request or an escrow-settled fill. */
|
|
4871
4905
|
400: {
|
|
4872
4906
|
headers: {
|
|
4873
4907
|
[name: string]: unknown;
|
|
@@ -4887,7 +4921,7 @@ export interface operations {
|
|
|
4887
4921
|
};
|
|
4888
4922
|
};
|
|
4889
4923
|
404: components["responses"]["NotFound"];
|
|
4890
|
-
/** @description `STATE_CONFLICT
|
|
4924
|
+
/** @description `STATE_CONFLICT`. `reason`: `not_due` (payment not locked yet, or fill delivered, refunded or expired), `refund_authorized` (refund consented) or `report_window_closed` (past `report_by`); final except `not_due` before the lock. */
|
|
4891
4925
|
409: {
|
|
4892
4926
|
headers: {
|
|
4893
4927
|
[name: string]: unknown;
|
|
@@ -4897,7 +4931,7 @@ export interface operations {
|
|
|
4897
4931
|
};
|
|
4898
4932
|
};
|
|
4899
4933
|
413: components["responses"]["PayloadTooLarge"];
|
|
4900
|
-
/** @description `ACCOUNT_NOT_LINKED`: the maker's venue account is unlinked. */
|
|
4934
|
+
/** @description `ACCOUNT_NOT_LINKED`: the maker's venue account is unlinked or changed. */
|
|
4901
4935
|
422: {
|
|
4902
4936
|
headers: {
|
|
4903
4937
|
[name: string]: unknown;
|
|
@@ -4906,7 +4940,7 @@ export interface operations {
|
|
|
4906
4940
|
"application/json": components["schemas"]["Error"];
|
|
4907
4941
|
};
|
|
4908
4942
|
};
|
|
4909
|
-
/** @description `DELIVERY_PENDING`: report the same hash after `Retry-After` (1 s). `reason`: `unknown_transaction` (unknown to the venue) or `not_final` (below the required status). */
|
|
4943
|
+
/** @description `DELIVERY_PENDING`: report the same hash after `Retry-After` (1 s). `reason`: `unknown_transaction` (unknown to the venue; on Aster, until both Spot histories show this id as a USDT transfer from the maker to `delivery_to`) or `not_final` (Lighter, below the required status). */
|
|
4910
4944
|
425: {
|
|
4911
4945
|
headers: {
|
|
4912
4946
|
[name: string]: unknown;
|
|
@@ -4917,7 +4951,7 @@ export interface operations {
|
|
|
4917
4951
|
};
|
|
4918
4952
|
429: components["responses"]["RateLimited"];
|
|
4919
4953
|
500: components["responses"]["Internal"];
|
|
4920
|
-
/** @description `VENUE_UNAVAILABLE`: the venue did not answer, or
|
|
4954
|
+
/** @description `VENUE_UNAVAILABLE`: the venue did not answer, or Lighter's per-minute read budget is spent. Report the same hash again. */
|
|
4921
4955
|
502: {
|
|
4922
4956
|
headers: {
|
|
4923
4957
|
[name: string]: unknown;
|
package/dist/maker.d.ts
CHANGED
|
@@ -107,6 +107,12 @@ export declare class Maker {
|
|
|
107
107
|
funding_source: FundingSource;
|
|
108
108
|
}, credential: Pick<Credential, "id" | "quote_signer">, store?: SignatureStore, expectedOwner?: string): Promise<Order>;
|
|
109
109
|
closeOrders(ids: string[]): Promise<Order[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Waits for the funding `addCapital` submitted: its preparation, not the order, says whether it
|
|
112
|
+
* landed, since a failed top-up returns the order to its prior state. Throws when it failed.
|
|
113
|
+
*/
|
|
114
|
+
waitForFunding(order: Order, timeoutMs?: number): Promise<Order>;
|
|
115
|
+
/** Waits until the order reaches one of `states`; for a funding, `waitForFunding`. */
|
|
110
116
|
waitFor(id: string, states: Order["state"][], timeoutMs?: number): Promise<Order>;
|
|
111
117
|
}
|
|
112
118
|
/** A scoped credential (`mk_`) quotes and cancels only its own orders; this key cannot withdraw capital. */
|
package/dist/maker.js
CHANGED
|
@@ -86,17 +86,38 @@ export class Maker {
|
|
|
86
86
|
}
|
|
87
87
|
return result;
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Waits for the funding `addCapital` submitted: its preparation, not the order, says whether it
|
|
91
|
+
* landed, since a failed top-up returns the order to its prior state. Throws when it failed.
|
|
92
|
+
*/
|
|
93
|
+
async waitForFunding(order, timeoutMs = 600_000) {
|
|
94
|
+
const end = Date.now() + timeoutMs;
|
|
95
|
+
for (const id = order.preparation_id; id;) {
|
|
96
|
+
const preparation = await this.client.call("getMakerPreparation", { path: { id } });
|
|
97
|
+
if (preparation.state === "complete")
|
|
98
|
+
break;
|
|
99
|
+
if (preparation.state === "failed" || preparation.state === "cancelled")
|
|
100
|
+
throw new Error(`Funding ${preparation.state}: ${preparation.order.error ?? "no reason given"}`);
|
|
101
|
+
if (Date.now() >= end)
|
|
102
|
+
throw new Error(`Funding of order ${order.id} still pending; recover it by the same client_request_id`);
|
|
103
|
+
await wait(2_000);
|
|
104
|
+
}
|
|
105
|
+
return this.waitFor(order.id, ["live"], end - Date.now());
|
|
106
|
+
}
|
|
107
|
+
/** Waits until the order reaches one of `states`; for a funding, `waitForFunding`. */
|
|
89
108
|
async waitFor(id, states, timeoutMs = 600_000) {
|
|
90
109
|
const end = Date.now() + timeoutMs;
|
|
91
|
-
|
|
110
|
+
// Read at least once, however little time is left.
|
|
111
|
+
for (;;) {
|
|
92
112
|
const order = await this.order(id);
|
|
93
113
|
if (states.includes(order.state))
|
|
94
114
|
return order;
|
|
95
115
|
if (order.state === "failed")
|
|
96
116
|
throw new Error(`Order failed: ${order.error}`);
|
|
117
|
+
if (Date.now() >= end)
|
|
118
|
+
throw new Error(`Order ${id} still pending; recover it by the same client_request_id`);
|
|
97
119
|
await wait(2_000);
|
|
98
120
|
}
|
|
99
|
-
throw new Error(`Order ${id} still pending; recover it by the same client_request_id`);
|
|
100
121
|
}
|
|
101
122
|
}
|
|
102
123
|
/** A scoped credential (`mk_`) quotes and cancels only its own orders; this key cannot withdraw capital. */
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lamarge/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TypeScript client for the LaMarge API: sign-in, transfers, takes and market making, with every signature checked first.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://docs.lamarge.trade/sdk",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/snowbl-capital/lamarge-sdk.git",
|
|
10
|
+
"directory": "sdk"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/snowbl-capital/lamarge-sdk/issues",
|
|
6
13
|
"type": "module",
|
|
7
14
|
"sideEffects": false,
|
|
8
15
|
"engines": {
|