@agg-build/sdk 4.32.0 → 4.33.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/README.md +15 -0
- package/dist/{agg-websocket-ClGhhROZ.mjs → agg-websocket-C2neMzGT.mjs} +117 -4
- package/dist/agg-websocket-C2neMzGT.mjs.map +1 -0
- package/dist/{agg-websocket-DsEtBkLk.d.mts → agg-websocket-CvYdVJPc.d.mts} +2452 -2171
- package/dist/agg-websocket-CvYdVJPc.d.mts.map +1 -0
- package/dist/{agg-websocket-DsEtBkLk.d.ts → agg-websocket-CvYdVJPc.d.ts} +2452 -2171
- package/dist/agg-websocket-CvYdVJPc.d.ts.map +1 -0
- package/dist/{agg-websocket-CVZ7laJ4.js → agg-websocket-MYZiMRXn.js} +116 -3
- package/dist/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +568 -100
- package/dist/index.mjs +567 -101
- package/dist/index.mjs.map +1 -1
- package/dist/market-data.d.mts +1 -1
- package/dist/market-data.d.ts +1 -1
- package/dist/market-data.js +1 -1
- package/dist/market-data.mjs +1 -1
- package/package.json +1 -1
- package/dist/agg-websocket-ClGhhROZ.mjs.map +0 -1
- package/dist/agg-websocket-DsEtBkLk.d.mts.map +0 -1
- package/dist/agg-websocket-DsEtBkLk.d.ts.map +0 -1
|
@@ -527,6 +527,8 @@ type UnifiedBalanceResponse = {
|
|
|
527
527
|
lastSyncedAt: string;
|
|
528
528
|
/** Chain wallet address; native venue collateral uses account IDs instead. */
|
|
529
529
|
address?: string | undefined;
|
|
530
|
+
/** `custody=self`: the linked wallet this balance belongs to (owner of a deposit/legacy wallet). */
|
|
531
|
+
walletAddress?: string | undefined;
|
|
530
532
|
custodyKind?: "EOA" | "DEPOSIT_WALLET" | "POLYMARKET_LEGACY" | "VENUE_ACCOUNT" | undefined;
|
|
531
533
|
/** Native cash is venue-scoped, not fungible EOA inventory. */
|
|
532
534
|
venue?: Venue | undefined;
|
|
@@ -1649,1646 +1651,2352 @@ declare function projectedOrderbookChecksum(book: {
|
|
|
1649
1651
|
}>;
|
|
1650
1652
|
}): number;
|
|
1651
1653
|
//#endregion
|
|
1652
|
-
//#region src/types.d.ts
|
|
1653
|
-
/**
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
* client sends, and end users cannot change it.
|
|
1666
|
-
*/
|
|
1667
|
-
tradingMode: AppTradingMode;
|
|
1668
|
-
/**
|
|
1669
|
-
* One-time simulated balance granted on first paper use, in dollars.
|
|
1670
|
-
* Interpolate this into paper copy rather than hardcoding a figure.
|
|
1671
|
-
*/
|
|
1672
|
-
paperStartingBalance: number;
|
|
1654
|
+
//#region src/ws-types.d.ts
|
|
1655
|
+
/**
|
|
1656
|
+
* WebSocket protocol types for the Agg platform.
|
|
1657
|
+
* All callback timestamps are in **seconds** (converted from server ms at SDK dispatch).
|
|
1658
|
+
* These are plain TS interfaces — no Zod dependency for partner-side usage.
|
|
1659
|
+
*/
|
|
1660
|
+
/** Aggregated level wire format: [price, totalSize, {venue: sizeAtPrice}] */
|
|
1661
|
+
type WsAttributedLevel = [number, number, Record<string, number>];
|
|
1662
|
+
/** Per-venue level wire format: [price, size] */
|
|
1663
|
+
type WsVenueLevel = [number, number];
|
|
1664
|
+
interface WsVenueInfo {
|
|
1665
|
+
bestBid: number | null;
|
|
1666
|
+
bestAsk: number | null;
|
|
1673
1667
|
}
|
|
1674
|
-
interface
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1668
|
+
interface WsVenueBook {
|
|
1669
|
+
bids: WsVenueLevel[];
|
|
1670
|
+
asks: WsVenueLevel[];
|
|
1671
|
+
}
|
|
1672
|
+
interface WsOrderbookSnapshot {
|
|
1673
|
+
type: "orderbook_snapshot";
|
|
1674
|
+
outcomeId: string;
|
|
1675
|
+
channel?: "orderbook" | "trades";
|
|
1676
|
+
seq: number;
|
|
1677
|
+
checksum: number;
|
|
1678
|
+
bids: WsAttributedLevel[];
|
|
1679
|
+
asks: WsAttributedLevel[];
|
|
1680
|
+
venueOrderbooks: Record<string, WsVenueBook>;
|
|
1681
|
+
venues: Record<string, WsVenueInfo>;
|
|
1682
|
+
midpoint: number | null;
|
|
1683
|
+
spread: number | null;
|
|
1684
|
+
/** @unit seconds (converted from server ms) */
|
|
1685
|
+
timestamp: number;
|
|
1678
1686
|
/**
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1681
|
-
*
|
|
1682
|
-
* denylist mode, use `blockedCountries` as before. Only Novig uses this
|
|
1683
|
-
* today — a client that reads only `blockedCountries` sees an allowlisted
|
|
1684
|
-
* venue as unrestricted, which is exactly the misread this field closes.
|
|
1687
|
+
* Sticky tick of this outcome's book, inferred at runtime by the engine.
|
|
1688
|
+
* `null` until inferred. Optional — older snapshot producers (REST fallback)
|
|
1689
|
+
* may omit this field entirely.
|
|
1685
1690
|
*/
|
|
1686
|
-
|
|
1691
|
+
tick?: number | null;
|
|
1692
|
+
/** Provenance of the published `midpoint`. See {@link MarkSource}. */
|
|
1693
|
+
markSource?: MarkSource$1;
|
|
1687
1694
|
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1695
|
+
/**
|
|
1696
|
+
* Provenance tag for a published midpoint. Mirrors the Rust engine
|
|
1697
|
+
* `MarkSource::as_str()` output.
|
|
1698
|
+
*/
|
|
1699
|
+
type WsMarkSource = "local" | "local_merged" | "local_one_sided" | "sibling" | "local_boundary" | "none";
|
|
1700
|
+
type MarkSource$1 = WsMarkSource;
|
|
1701
|
+
interface WsOrderbookDelta {
|
|
1702
|
+
type: "orderbook_delta";
|
|
1703
|
+
outcomeId: string;
|
|
1704
|
+
channel?: "orderbook" | "trades";
|
|
1705
|
+
seq: number;
|
|
1706
|
+
checksum: number;
|
|
1707
|
+
bidChanges: WsAttributedLevel[];
|
|
1708
|
+
askChanges: WsAttributedLevel[];
|
|
1709
|
+
venueDeltaBooks: Record<string, {
|
|
1710
|
+
bidChanges: WsVenueLevel[];
|
|
1711
|
+
askChanges: WsVenueLevel[];
|
|
1712
|
+
}>;
|
|
1713
|
+
venues: Record<string, WsVenueInfo>;
|
|
1714
|
+
midpoint: number | null;
|
|
1715
|
+
spread: number | null;
|
|
1716
|
+
/** @unit seconds (converted from server ms) */
|
|
1717
|
+
timestamp: number;
|
|
1690
1718
|
}
|
|
1691
|
-
interface
|
|
1692
|
-
|
|
1693
|
-
|
|
1719
|
+
interface WsTrade {
|
|
1720
|
+
type: "trade";
|
|
1721
|
+
outcomeId: string;
|
|
1722
|
+
channel?: "orderbook" | "trades";
|
|
1723
|
+
venue: string;
|
|
1724
|
+
side: "buy" | "sell";
|
|
1725
|
+
price: number;
|
|
1726
|
+
size: number;
|
|
1727
|
+
/** @unit seconds (converted from server ms) */
|
|
1728
|
+
timestamp: number;
|
|
1729
|
+
/** Venue-unique trade id, when the venue supplies one (Hyperliquid today). */
|
|
1730
|
+
tradeId?: string;
|
|
1694
1731
|
}
|
|
1695
|
-
type
|
|
1696
|
-
interface
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1732
|
+
type WsCandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
1733
|
+
interface WsSubscribed {
|
|
1734
|
+
type: "subscribed";
|
|
1735
|
+
/** Confirmed ids. For `orderbook`/`trades` these are venueMarketOutcomeIds.
|
|
1736
|
+
* For `arb` this historically mirrors the marketIds — prefer `marketIds`. */
|
|
1737
|
+
outcomeIds: string[];
|
|
1738
|
+
/** Confirmed marketIds — only set on `arb` confirmations, whose
|
|
1739
|
+
* subscriptions are keyed by marketIds, not outcomeIds. */
|
|
1740
|
+
marketIds?: string[];
|
|
1741
|
+
channel: "orderbook" | "trades" | "arb" | "arb-feed" | "app-events" | "catalog";
|
|
1742
|
+
/** Echo of the request's `id`, when one was sent. */
|
|
1743
|
+
id?: string | number;
|
|
1702
1744
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1745
|
+
interface WsUnsubscribed {
|
|
1746
|
+
type: "unsubscribed";
|
|
1747
|
+
/** See {@link WsSubscribed.outcomeIds}. */
|
|
1748
|
+
outcomeIds: string[];
|
|
1749
|
+
/** Confirmed marketIds — only set on `arb` confirmations. */
|
|
1750
|
+
marketIds?: string[];
|
|
1751
|
+
channel: "orderbook" | "trades" | "arb" | "arb-feed" | "app-events" | "catalog";
|
|
1752
|
+
id?: string | number;
|
|
1706
1753
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
email: string;
|
|
1716
|
-
redirectUrl?: string;
|
|
1717
|
-
/** Cloudflare Turnstile token — required when a prior authStart returned `challenge_required`. */
|
|
1718
|
-
turnstileToken?: string;
|
|
1719
|
-
earlyAccessCode?: string;
|
|
1720
|
-
};
|
|
1721
|
-
/** SIWE / SIWS sign-in. `kind` is optional so callers that predate the discriminator still compile. */
|
|
1722
|
-
interface AggAuthWalletVerifyBody {
|
|
1723
|
-
kind?: "wallet";
|
|
1724
|
-
message: string;
|
|
1725
|
-
signature: string;
|
|
1726
|
-
earlyAccessCode?: string;
|
|
1754
|
+
interface WsConnected {
|
|
1755
|
+
type: "connected";
|
|
1756
|
+
appId: string;
|
|
1757
|
+
userId?: string;
|
|
1758
|
+
/** Protocol revision. 2 adds error codes, request ids, event ids and resume. */
|
|
1759
|
+
protocolVersion?: number;
|
|
1760
|
+
/** `key` when admitted by `x-app-api-key`, `browser` when admitted by Origin. */
|
|
1761
|
+
auth?: "browser" | "key";
|
|
1727
1762
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1763
|
+
interface WsAuthenticated {
|
|
1764
|
+
type: "authenticated";
|
|
1765
|
+
userId: string;
|
|
1766
|
+
/** Token expiry (Unix ms). Re-authenticate before it, or user events stop. */
|
|
1767
|
+
expiresAt?: number;
|
|
1768
|
+
id?: string | number;
|
|
1769
|
+
}
|
|
1770
|
+
/** Sent about a minute before the user token expires. */
|
|
1771
|
+
interface WsAuthExpiring {
|
|
1772
|
+
type: "auth_expiring";
|
|
1773
|
+
userId: string;
|
|
1774
|
+
/** @unit milliseconds */
|
|
1775
|
+
expiresAt: number;
|
|
1733
1776
|
}
|
|
1734
|
-
/** Body for `POST /auth/verify` — mirrors the API's union on `kind`. */
|
|
1735
|
-
type AggAuthVerifyBody = AggAuthWalletVerifyBody | AggAuthPrivyVerifyBody;
|
|
1736
|
-
type AggAuthStartResult = {
|
|
1737
|
-
type: "nonce";
|
|
1738
|
-
nonce: string;
|
|
1739
|
-
statement?: string;
|
|
1740
|
-
} | {
|
|
1741
|
-
type: "redirect";
|
|
1742
|
-
url: string;
|
|
1743
|
-
} | {
|
|
1744
|
-
type: "magic_link";
|
|
1745
|
-
success: true;
|
|
1746
|
-
} | {
|
|
1747
|
-
type: "challenge_required";
|
|
1748
|
-
siteKey: string;
|
|
1749
|
-
};
|
|
1750
1777
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
* `redirectUrl` is required for OAuth/email providers: the callback / magic-link
|
|
1754
|
-
* verify hands the partner a `link_confirm_token` by redirecting to `redirectUrl`,
|
|
1755
|
-
* and the partner app completes the flow by calling `/confirm` from that page.
|
|
1756
|
-
*
|
|
1757
|
-
* Wallet providers (`siwe`/`siws`) instead return a `wallet_challenge` with a
|
|
1758
|
-
* `message` the user signs VERBATIM; the signature is then confirmed with
|
|
1759
|
-
* `{ kind: "wallet_signature", message, signature }`.
|
|
1778
|
+
* The user session ended and the connection continues at app level: market
|
|
1779
|
+
* data keeps flowing, user events stop until you `authenticate` again.
|
|
1760
1780
|
*/
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
email: string;
|
|
1767
|
-
redirectUrl: string;
|
|
1768
|
-
} | {
|
|
1769
|
-
provider: "siwe" | "siws";
|
|
1770
|
-
address: string;
|
|
1771
|
-
};
|
|
1772
|
-
type AggLinkAccountResult = {
|
|
1773
|
-
type: "redirect";
|
|
1774
|
-
url: string;
|
|
1775
|
-
} | {
|
|
1776
|
-
type: "magic_link";
|
|
1777
|
-
success: true;
|
|
1778
|
-
} | {
|
|
1779
|
-
type: "wallet_challenge";
|
|
1780
|
-
message: string;
|
|
1781
|
-
};
|
|
1781
|
+
interface WsAuthExpired {
|
|
1782
|
+
type: "auth_expired";
|
|
1783
|
+
userId: string;
|
|
1784
|
+
reason: "expired" | "revoked" | "suspended";
|
|
1785
|
+
}
|
|
1782
1786
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
*
|
|
1785
|
-
*
|
|
1786
|
-
* byte-for-byte, so do not reconstruct or edit it client-side.
|
|
1787
|
+
* End of a resume replay. When `complete` is false, events may have been
|
|
1788
|
+
* missed (outside the retention window, or the log was unavailable):
|
|
1789
|
+
* reconcile orders, balances and withdrawals over REST.
|
|
1787
1790
|
*/
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1791
|
+
interface WsResumed {
|
|
1792
|
+
type: "resumed";
|
|
1793
|
+
stream: "user" | "app";
|
|
1794
|
+
fromEventId: string;
|
|
1795
|
+
replayed: number;
|
|
1796
|
+
complete: boolean;
|
|
1797
|
+
id?: string | number;
|
|
1798
|
+
}
|
|
1793
1799
|
/**
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
1798
|
-
*
|
|
1799
|
-
* Collisions with a different Principal surface as HTTP 409 and are thrown by the
|
|
1800
|
-
* SDK's request layer — catch them at the call site, don't expect them here.
|
|
1800
|
+
* Upstream delivery was interrupted; frames on `channels` may be missing.
|
|
1801
|
+
* Orderbooks are resnapshotted automatically; trades and arb updates in the
|
|
1802
|
+
* gap are not recoverable. Catalog changes are: catch up over
|
|
1803
|
+
* `GET /catalog/changes` (`AggClient.watchCatalog` does this).
|
|
1801
1804
|
*/
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
type AggSessionUser = AuthUser | UserProfile;
|
|
1807
|
-
interface AggClientSessionInput {
|
|
1808
|
-
accessToken: string;
|
|
1809
|
-
refreshToken?: string;
|
|
1810
|
-
user?: AggSessionUser;
|
|
1805
|
+
interface WsStreamInterrupted {
|
|
1806
|
+
type: "stream_interrupted";
|
|
1807
|
+
channels: string[];
|
|
1808
|
+
timestamp: number;
|
|
1811
1809
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
id: string;
|
|
1817
|
-
username: string | null;
|
|
1818
|
-
avatarUrl: string | null;
|
|
1819
|
-
walletAddress?: string | null;
|
|
1820
|
-
} | null;
|
|
1821
|
-
authHint: {
|
|
1822
|
-
wasAuthenticated: boolean;
|
|
1823
|
-
};
|
|
1810
|
+
interface WsHeartbeat {
|
|
1811
|
+
type: "heartbeat";
|
|
1812
|
+
/** @unit seconds (converted from server ms) */
|
|
1813
|
+
ts: number;
|
|
1824
1814
|
}
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
"transaction" |
|
|
1830
|
-
/** Solana transaction — bridge legs on SVM. ed25519, NOT secp256k1. */
|
|
1831
|
-
"solana_transaction" | "hl_l1_action" |
|
|
1832
|
-
/**
|
|
1833
|
-
* EIP-7702 authorization over `{ contractAddress, chainId, nonce }`.
|
|
1834
|
-
*
|
|
1835
|
-
* A signature over a RAW digest — `keccak(0x05 ‖ rlp([chainId, delegate,
|
|
1836
|
-
* nonce]))` — not EIP-191 and not EIP-712. Many wallets do not expose this,
|
|
1837
|
-
* and that is expected: reject it and the server falls back to asking the
|
|
1838
|
-
* user to broadcast a plain approve instead.
|
|
1839
|
-
*/
|
|
1840
|
-
"eip7702_authorization" |
|
|
1841
|
-
/**
|
|
1842
|
-
* A Gnosis Safe transaction relayed through Polymarket — a legacy Polymarket
|
|
1843
|
-
* wallet funding a fill. The payload is the SafeTx as EIP-712 typed data,
|
|
1844
|
-
* but the wallet must `personal_sign` the RAW 32 bytes of
|
|
1845
|
-
* `hashTypedData(payload)` (`signMessage({ message: { raw: hash } })`):
|
|
1846
|
-
* Polymarket's relayer only accepts that shape. `payload.safeTxHash` carries
|
|
1847
|
-
* the digest for convenience; the server recomputes it from the typed data.
|
|
1848
|
-
*/
|
|
1849
|
-
"safe_tx";
|
|
1850
|
-
/** One payload the client must sign before a fill can proceed. */
|
|
1851
|
-
interface SignatureRequest {
|
|
1852
|
-
/** Echo this back with the signature. */
|
|
1853
|
-
stepId: string;
|
|
1854
|
-
/** Payload shape. Discriminates how to sign — not which venue. */
|
|
1855
|
-
type: SignatureRequestType;
|
|
1856
|
-
venue: string;
|
|
1857
|
-
/** The address that must produce this signature. Sign with this key, not another. */
|
|
1858
|
-
signerAddress: string;
|
|
1859
|
-
/** Absent for non-EVM payloads (e.g. Hyperliquid L1 actions). */
|
|
1860
|
-
chainId?: number;
|
|
1861
|
-
/** Sign verbatim. */
|
|
1862
|
-
payload: unknown;
|
|
1863
|
-
expiresAt: string;
|
|
1864
|
-
/** Why this signature is being asked for, when the server knows (e.g. `"fee"`, `"funding_and_fee"`). Display only. */
|
|
1865
|
-
purpose?: string;
|
|
1815
|
+
interface WsResolvedOutcome {
|
|
1816
|
+
label: string;
|
|
1817
|
+
winner?: boolean;
|
|
1818
|
+
externalIdentifier?: string;
|
|
1866
1819
|
/**
|
|
1867
|
-
*
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
1870
|
-
* fill.
|
|
1820
|
+
* Per-share USDC payout in [0, 1] once settled. A void or split pays less
|
|
1821
|
+
* than 1 on every side (e.g. 0.5), so `winner` alone can't tell it from a
|
|
1822
|
+
* win. Absent when unknown.
|
|
1871
1823
|
*/
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
*
|
|
1878
|
-
* Return a 0x-prefixed hex string for anything the wallet SIGNS:
|
|
1879
|
-
*
|
|
1880
|
-
* - `eip712` — `signTypedData` over `payload`.
|
|
1881
|
-
* - `personal_sign` — EIP-191 over `payload`: a UTF-8 string or `{ raw: "0x…" }
|
|
1882
|
-
* bytes (Polymarket proxy batches). Pass it directly as viem `message`.
|
|
1883
|
-
* - `safe_tx` — `personal_sign` over the RAW 32 bytes of
|
|
1884
|
-
* `hashTypedData(payload)` (viem: `signMessage({ message: { raw: hash } })`,
|
|
1885
|
-
* MetaMask: `personal_sign` with the hex hash). The wallet shows a hash, not
|
|
1886
|
-
* a structured prompt — that is what Polymarket's own relayer requires.
|
|
1887
|
-
* - `hl_l1_action` — Hyperliquid L1 action, EIP-712 in phantom-agent form.
|
|
1888
|
-
* - `eip7702_authorization` — an EIP-7702 authorization over
|
|
1889
|
-
* `{ contractAddress, chainId, nonce }`. This is a signature over a RAW
|
|
1890
|
-
* digest, not EIP-191 and not EIP-712, and many wallets do not expose it.
|
|
1891
|
-
* **Throwing here does not help**: there is no reject verb, so a thrown
|
|
1892
|
-
* signer is indistinguishable from a slow user — the request simply expires
|
|
1893
|
-
* and the fill dies. If your wallet cannot produce this signature, declare
|
|
1894
|
-
* `approveMode: "user_broadcast"` on the fill instead and the approve is
|
|
1895
|
-
* requested as a `transaction` the user sends themselves. Handling this
|
|
1896
|
-
* request is what makes funding gasless.
|
|
1897
|
-
* - `solana_transaction` — `payload.messageBase64` is the serialized Solana
|
|
1898
|
-
* transaction MESSAGE; `payload.transactionBase64` is the full unsigned
|
|
1899
|
-
* `VersionedTransaction` for wallets that need one to display/simulate.
|
|
1900
|
-
* Return `0x` + 128 hex chars: the 64-byte ed25519 signature over the
|
|
1901
|
-
* decoded message. With a wallet adapter: `const signed = await
|
|
1902
|
-
* wallet.signTransaction(VersionedTransaction.deserialize(base64decode(transactionBase64)))`
|
|
1903
|
-
* then return the signature at the index of `signerAddress` in
|
|
1904
|
-
* `signed.message.staticAccountKeys`, hex-encoded. Do NOT send it — the
|
|
1905
|
-
* server co-signs as fee payer and broadcasts. The user needs no SOL.
|
|
1906
|
-
* The signature MUST be over the UNMODIFIED message: the server verifies
|
|
1907
|
-
* it against the bytes it persisted, so a wallet that inserts
|
|
1908
|
-
* instructions before signing (priority fee, guards, Lighthouse) gets a
|
|
1909
|
-
* 400 — disable such features for this request or sign the raw message.
|
|
1910
|
-
*
|
|
1911
|
-
* Return `{ txHash }` for anything the wallet BROADCASTS:
|
|
1912
|
-
*
|
|
1913
|
-
* - `transaction` — send it, then return the hash **immediately, without
|
|
1914
|
-
* awaiting the receipt**. The server watches for the mined receipt itself
|
|
1915
|
-
* and will not resume until it matches the request byte-for-byte.
|
|
1916
|
-
*/
|
|
1917
|
-
type SignerFn = (req: SignatureRequest) => Promise<string | {
|
|
1918
|
-
txHash: string;
|
|
1919
|
-
}>;
|
|
1920
|
-
/**
|
|
1921
|
-
* How long `fillSelfCustody` will keep waiting before giving up.
|
|
1922
|
-
*
|
|
1923
|
-
* Covers a first-time user: sign the wallet-setup batch, wait for it on-chain,
|
|
1924
|
-
* then sign the order. Generous because the wait is a relayer transaction
|
|
1925
|
-
* confirming, not a human deciding.
|
|
1926
|
-
*/
|
|
1927
|
-
declare const SELF_CUSTODY_FILL_TIMEOUT_MS: number;
|
|
1928
|
-
/** Gap between re-reads while an on-chain step is in flight. */
|
|
1929
|
-
declare const SELF_CUSTODY_POLL_INTERVAL_MS = 2000;
|
|
1930
|
-
/**
|
|
1931
|
-
* How long `fillSelfCustody` waits on the `signer` for ONE optional request
|
|
1932
|
-
* signed by a wallet other than the user's — e.g. a partner's activation
|
|
1933
|
-
* sponsor. Such a request can delay the batch's submission by at most this long,
|
|
1934
|
-
* after which it is declined and the required signatures go out without it.
|
|
1935
|
-
* Required requests, and optional ones the user's own wallet signs (the fill's
|
|
1936
|
-
* `signingAddress` or any required request's `signerAddress`, e.g. a referral
|
|
1937
|
-
* code), are never bounded by this.
|
|
1938
|
-
*/
|
|
1939
|
-
declare const OPTIONAL_SIGNATURE_TIMEOUT_MS = 15000;
|
|
1940
|
-
/**
|
|
1941
|
-
* How long `fillSelfCustody` waits on an optional Polymarket buy fee pre-sign
|
|
1942
|
-
* (`purpose: "app_fee"`). It never holds the order (that round is already
|
|
1943
|
-
* posted), so it can wait for a slow wallet: just under the server's 60s grace,
|
|
1944
|
-
* after which the request is expired and a post-fill signature asked instead.
|
|
1945
|
-
*/
|
|
1946
|
-
declare const OPTIONAL_FEE_SIGNATURE_TIMEOUT_MS = 55000;
|
|
1947
|
-
/**
|
|
1948
|
-
* States a run never leaves. Everything else means "still working".
|
|
1949
|
-
*
|
|
1950
|
-
* Typed against `ExecutionOverallState` so a typo'd or renamed literal (e.g.
|
|
1951
|
-
* `cancelled` drifting to `canceled`) is a compile error instead of a state
|
|
1952
|
-
* that silently stops being treated as terminal. Mirrors
|
|
1953
|
-
* `ExecutionOverallStateTB` in the contract; keep the two in step.
|
|
1954
|
-
*/
|
|
1955
|
-
declare const TERMINAL_EXECUTION_STATES: ReadonlySet<ExecutionOverallState>;
|
|
1956
|
-
type SportsGameStatus = "scheduled" | "live" | "paused" | "finished" | "cancelled" | "postponed" | "unknown";
|
|
1957
|
-
interface SportsLiveParticipant {
|
|
1958
|
-
position: "first" | "second";
|
|
1959
|
-
name: string;
|
|
1960
|
-
shortName: string | null;
|
|
1961
|
-
imageUrl: string | null;
|
|
1962
|
-
score: string | null;
|
|
1824
|
+
payoutPerShare?: number;
|
|
1825
|
+
/** Venue refunded every holder their stake (valued at entry price). */
|
|
1826
|
+
refundAtCost?: boolean;
|
|
1827
|
+
/** Who decided `winner`: the venue itself, or inferred from matched markets. */
|
|
1828
|
+
winnerSource?: "venue" | "matched";
|
|
1963
1829
|
}
|
|
1964
|
-
interface
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
status:
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1830
|
+
interface WsMarketResolved {
|
|
1831
|
+
type: "market_resolved";
|
|
1832
|
+
outcomeId: string;
|
|
1833
|
+
status: "resolved" | "closed";
|
|
1834
|
+
/** Winning outcome label, or null if unknown. */
|
|
1835
|
+
result: string | null;
|
|
1836
|
+
/** Per-outcome resolution data. */
|
|
1837
|
+
outcomes: WsResolvedOutcome[];
|
|
1838
|
+
/** @unit seconds (converted from server ms) */
|
|
1839
|
+
timestamp: number;
|
|
1972
1840
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1841
|
+
/** Machine-readable error codes. Branch on `code`, not on `message`. */
|
|
1842
|
+
type WsErrorCode = "missing_app_id" | "invalid_app" | "origin_not_allowed" | "api_key_required" | "invalid_api_key" | "invalid_token" | "token_app_mismatch" | "admin_token_not_allowed" | "too_many_connections" | "rate_limited" | "invalid_message" | "too_many_ids" | "subscription_limit" | "outcomes_blocked" | "not_subscribed" | "snapshot_unavailable" | "app_events_forbidden" | "internal_error";
|
|
1843
|
+
interface WsError {
|
|
1844
|
+
type: "error";
|
|
1845
|
+
/** Absent only on servers older than protocol version 2. */
|
|
1846
|
+
code?: WsErrorCode;
|
|
1847
|
+
message: string;
|
|
1848
|
+
/** Echo of the `id` of the request that caused the error. */
|
|
1849
|
+
id?: string | number;
|
|
1850
|
+
/** Outcome ids the error applies to. */
|
|
1851
|
+
outcomeIds?: string[];
|
|
1852
|
+
/** Market ids the error applies to (arb). */
|
|
1853
|
+
marketIds?: string[];
|
|
1976
1854
|
}
|
|
1977
|
-
interface
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
/** WebSocket URL for real-time feeds. Must be set explicitly to use createWebSocket(). */
|
|
1991
|
-
wsUrl?: string;
|
|
1992
|
-
/** Opt in after immutable history publication/CDN rollout. Defaults false. */
|
|
1993
|
-
preferImmutableHistory?: boolean;
|
|
1855
|
+
interface WsOrderSubmitted {
|
|
1856
|
+
type: "order_submitted";
|
|
1857
|
+
venue: string;
|
|
1858
|
+
orderId: string;
|
|
1859
|
+
side: string;
|
|
1860
|
+
price: number;
|
|
1861
|
+
size: number;
|
|
1862
|
+
outcomeId?: string;
|
|
1863
|
+
marketId?: string;
|
|
1864
|
+
/** @unit seconds (converted from server ms) */
|
|
1865
|
+
timestamp: number;
|
|
1866
|
+
/** Owner of the event. */
|
|
1867
|
+
userId?: string;
|
|
1994
1868
|
/**
|
|
1995
|
-
*
|
|
1996
|
-
*
|
|
1869
|
+
* Position in the stream named by `stream` (`user` or `app`). Increasing
|
|
1870
|
+
* per stream; the SDK resumes from the last one after a reconnect and
|
|
1871
|
+
* drops duplicates. Absent if the server's event log was unavailable.
|
|
1997
1872
|
*/
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
1873
|
+
eventId?: string;
|
|
1874
|
+
stream?: "user" | "app";
|
|
1875
|
+
/** True when re-delivered by a resume. */
|
|
1876
|
+
replayed?: boolean;
|
|
1877
|
+
}
|
|
1878
|
+
interface WsBalanceUpdate {
|
|
1879
|
+
type: "balance_update";
|
|
1880
|
+
venue: string;
|
|
1881
|
+
tradingBalanceCents: number;
|
|
1882
|
+
walletBalanceCents?: number;
|
|
1883
|
+
/** @unit seconds (converted from server ms) */
|
|
1884
|
+
timestamp: number;
|
|
1885
|
+
/** Owner of the event. */
|
|
1886
|
+
userId?: string;
|
|
2009
1887
|
/**
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
* client-side signature cannot proceed. The signature requests never
|
|
2014
|
-
* come back on `POST /execution/fill` itself: `fillSelfCustody()` polls
|
|
2015
|
-
* `GET /execution/status` for them (`pendingSignatures`), signs each one
|
|
2016
|
-
* with this function, and posts the result to
|
|
2017
|
-
* `POST /execution/fill/:quoteId/signatures`.
|
|
1888
|
+
* Position in the stream named by `stream` (`user` or `app`). Increasing
|
|
1889
|
+
* per stream; the SDK resumes from the last one after a reconnect and
|
|
1890
|
+
* drops duplicates. Absent if the server's event log was unavailable.
|
|
2018
1891
|
*/
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
address: string;
|
|
2024
|
-
uri: string;
|
|
2025
|
-
nonce: string;
|
|
2026
|
-
chainId?: number;
|
|
2027
|
-
statement?: string;
|
|
2028
|
-
issuedAt?: string;
|
|
1892
|
+
eventId?: string;
|
|
1893
|
+
stream?: "user" | "app";
|
|
1894
|
+
/** True when re-delivered by a resume. */
|
|
1895
|
+
replayed?: boolean;
|
|
2029
1896
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
/**
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
1897
|
+
type WsOrderEventType = "cancelled" | "created" | "signed" | "pending_bridge" | "bridge_complete" | "submitting" | "submitted" | "expired" | "dag_started" | "dag_completed" | "dag_failed" | "dag_cancelled" | "step_started" | "step_completed" | "step_waiting" | "step_failed" | "step_retrying" | "filled" | "partial_fill" | "failed" | "bridge_ws_subscribed" | "bridge_ws_subscribe_failed" | "bridge_polling_fallback";
|
|
1898
|
+
interface WsOrderEvent {
|
|
1899
|
+
type: "order_event";
|
|
1900
|
+
event: WsOrderEventType;
|
|
1901
|
+
userId: string;
|
|
1902
|
+
orderId: string;
|
|
1903
|
+
/** Partner trade id from `placeOrder()`, when the order carried one. */
|
|
1904
|
+
externalId?: string;
|
|
1905
|
+
venue: string;
|
|
1906
|
+
dagRunId?: string;
|
|
1907
|
+
stepId?: string;
|
|
1908
|
+
stepType?: string;
|
|
1909
|
+
/** Authenticated notification that a wait is parked; fetch status for its payload. */
|
|
1910
|
+
waitingFor?: {
|
|
1911
|
+
topic: string;
|
|
1912
|
+
filterValue: string;
|
|
1913
|
+
};
|
|
1914
|
+
/** 1-based step index. Pair with `totalSteps` to render "Step 3 of 7". */
|
|
1915
|
+
sequence?: number;
|
|
1916
|
+
totalSteps?: number;
|
|
1917
|
+
templateName?: string;
|
|
1918
|
+
/** Maps sequence → stepType for all steps — sent on dag_started so labels are available upfront. */
|
|
1919
|
+
stepTypes?: Record<number, string>;
|
|
1920
|
+
filledAmountRaw?: string;
|
|
1921
|
+
remainingAmountRaw?: string;
|
|
1922
|
+
/**
|
|
1923
|
+
* Quote-time and actual shares + payout. All 6-decimal atomic units
|
|
1924
|
+
* (so 1.234567 shares = "1234567", "$50 to win" = "50000000"). Set
|
|
1925
|
+
* on `filled` / `partial_fill` so the UI can render "Quoted X / Got Y"
|
|
1926
|
+
* without re-deriving from cost ÷ price (which loses precision on
|
|
1927
|
+
* fractional fills and divides by zero before `executionPrice` exists).
|
|
1928
|
+
*/
|
|
1929
|
+
quotedSharesRaw?: string;
|
|
1930
|
+
actualSharesRaw?: string;
|
|
1931
|
+
quotedToWinRaw?: string;
|
|
1932
|
+
actualToWinRaw?: string;
|
|
1933
|
+
/** Quote-time price (decimal string, e.g. "0.5"). Pair with `executionPriceRaw`
|
|
1934
|
+
* to render the slippage diff inline. */
|
|
1935
|
+
quotedPriceRaw?: string;
|
|
1936
|
+
/**
|
|
1937
|
+
* Actual avg fill price (decimal string): `filledAmountRaw / actualSharesRaw`.
|
|
1938
|
+
* A sell's is net of fee; most venues report a buy's fee separately in
|
|
1939
|
+
* `actualVenueFeeRaw`. On Hyperliquid this event carries the quote; the realized
|
|
1940
|
+
* price lands on the order shortly after (`GET /execution/orders`).
|
|
1941
|
+
*/
|
|
1942
|
+
executionPriceRaw?: string;
|
|
1943
|
+
/**
|
|
1944
|
+
* Set on `partial_fill` events only. One of `"venue_capacity"`,
|
|
1945
|
+
* `"price_slipped"`, `"user_cancelled"`, `"timeout"`, `"bridge_short"`,
|
|
1946
|
+
* or a venue-specific tag.
|
|
1947
|
+
*/
|
|
1948
|
+
partialFillReason?: string;
|
|
1949
|
+
errorReason?: string;
|
|
1950
|
+
attempt?: number;
|
|
1951
|
+
correlationId?: string;
|
|
1952
|
+
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
1953
|
+
timestamp: number;
|
|
1954
|
+
/**
|
|
1955
|
+
* Position in the stream named by `stream` (`user` or `app`). Increasing
|
|
1956
|
+
* per stream; the SDK resumes from the last one after a reconnect and
|
|
1957
|
+
* drops duplicates. Absent if the server's event log was unavailable.
|
|
1958
|
+
*/
|
|
1959
|
+
eventId?: string;
|
|
1960
|
+
stream?: "user" | "app";
|
|
1961
|
+
/** True when re-delivered by a resume. */
|
|
1962
|
+
replayed?: boolean;
|
|
2040
1963
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
1964
|
+
interface WsRedeemEvent {
|
|
1965
|
+
type: "redeem_event";
|
|
1966
|
+
redeemId: string;
|
|
1967
|
+
venueMarketOutcomeId: string;
|
|
1968
|
+
status: "submitted" | "confirmed" | "failed";
|
|
1969
|
+
callsId: string | null;
|
|
1970
|
+
pendingUserOpId: string | null;
|
|
1971
|
+
txHash: string | null;
|
|
1972
|
+
errorMessage: string | null;
|
|
1973
|
+
/** @unit seconds (converted from server ms) */
|
|
1974
|
+
timestamp: number;
|
|
1975
|
+
/** Owner of the event. */
|
|
1976
|
+
userId?: string;
|
|
1977
|
+
/**
|
|
1978
|
+
* Position in the stream named by `stream` (`user` or `app`). Increasing
|
|
1979
|
+
* per stream; the SDK resumes from the last one after a reconnect and
|
|
1980
|
+
* drops duplicates. Absent if the server's event log was unavailable.
|
|
1981
|
+
*/
|
|
1982
|
+
eventId?: string;
|
|
1983
|
+
stream?: "user" | "app";
|
|
1984
|
+
/** True when re-delivered by a resume. */
|
|
1985
|
+
replayed?: boolean;
|
|
2057
1986
|
}
|
|
2058
|
-
/**
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
1987
|
+
/** Top-level withdrawal lifecycle states surfaced to partner clients. */
|
|
1988
|
+
type WsWithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1989
|
+
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1990
|
+
interface WsWithdrawalLifecycleLeg {
|
|
1991
|
+
sourceChainId: number;
|
|
1992
|
+
destChainId: number;
|
|
1993
|
+
type: "transfer" | "bridge";
|
|
1994
|
+
status: WsWithdrawalLegStatus;
|
|
1995
|
+
amountRaw: string;
|
|
1996
|
+
txHash: string | null;
|
|
1997
|
+
bridgeOperationId: string | null;
|
|
1998
|
+
/** Human-readable failure reason when `status === "failed"`. Null/absent when succeeded or in-flight. */
|
|
1999
|
+
errorMessage?: string | null;
|
|
2062
2000
|
}
|
|
2063
|
-
type ChartResolution = "1m" | "5m" | "1h" | "1d";
|
|
2064
2001
|
/**
|
|
2065
|
-
*
|
|
2066
|
-
*
|
|
2067
|
-
* "delayed" badge on the chart.
|
|
2002
|
+
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
2003
|
+
* consumers should pass through unknown enum values rather than failing.
|
|
2068
2004
|
*/
|
|
2069
|
-
interface
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2005
|
+
interface WsWithdrawalLifecycleEvent {
|
|
2006
|
+
type: "withdrawal_lifecycle";
|
|
2007
|
+
withdrawalId: string;
|
|
2008
|
+
userId: string;
|
|
2009
|
+
status: WsWithdrawalLifecycleStatus;
|
|
2010
|
+
/** Requested withdrawal amount in destination-token native decimals. */
|
|
2011
|
+
requestedAmountRaw?: string;
|
|
2012
|
+
/** Terminal settled amount in destination-token native decimals. */
|
|
2013
|
+
completedAmountRaw?: string | null;
|
|
2014
|
+
/** Realized platform fee in destination-token native decimals. Only present on terminal events. */
|
|
2015
|
+
feeRaw?: string | null;
|
|
2016
|
+
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
2017
|
+
terminal: boolean;
|
|
2018
|
+
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
2019
|
+
leg?: WsWithdrawalLifecycleLeg;
|
|
2020
|
+
/** All legs at the moment of emission (snapshot). */
|
|
2021
|
+
legs?: WsWithdrawalLifecycleLeg[];
|
|
2022
|
+
/** Failure reason for terminal `failed` / `partial`. */
|
|
2023
|
+
errorMessage?: string;
|
|
2024
|
+
correlationId?: string;
|
|
2025
|
+
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
2026
|
+
timestamp: number;
|
|
2027
|
+
/**
|
|
2028
|
+
* Position in the stream named by `stream` (`user` or `app`). Increasing
|
|
2029
|
+
* per stream; the SDK resumes from the last one after a reconnect and
|
|
2030
|
+
* drops duplicates. Absent if the server's event log was unavailable.
|
|
2031
|
+
*/
|
|
2032
|
+
eventId?: string;
|
|
2033
|
+
stream?: "user" | "app";
|
|
2034
|
+
/** True when re-delivered by a resume. */
|
|
2035
|
+
replayed?: boolean;
|
|
2081
2036
|
}
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
/** Freshness signal — see {@link ChartBarsMeta}. */
|
|
2093
|
-
meta: ChartBarsMeta;
|
|
2037
|
+
interface WsArbMarketUpdate {
|
|
2038
|
+
type: "arb_market_update";
|
|
2039
|
+
marketId: string;
|
|
2040
|
+
/** Producer assertion that globally inactive venues were excluded. */
|
|
2041
|
+
activeVenuesOnly: true;
|
|
2042
|
+
venueEventId: string | null;
|
|
2043
|
+
arbReturn: number;
|
|
2044
|
+
ts: number;
|
|
2045
|
+
liquidityUsd?: number;
|
|
2046
|
+
liquidityTier?: "deep" | "shallow";
|
|
2094
2047
|
}
|
|
2095
|
-
interface
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
from: number;
|
|
2103
|
-
to: number;
|
|
2104
|
-
finalizedThrough: number;
|
|
2105
|
-
chunks: Array<{
|
|
2106
|
-
key: string;
|
|
2107
|
-
url: string;
|
|
2108
|
-
sha256: string;
|
|
2109
|
-
from: number;
|
|
2110
|
-
to: number;
|
|
2111
|
-
points: number;
|
|
2112
|
-
}>;
|
|
2113
|
-
meta: ChartBarsMeta;
|
|
2048
|
+
interface WsArbFeedEntry {
|
|
2049
|
+
marketId: string;
|
|
2050
|
+
venueEventId: string | null;
|
|
2051
|
+
arbReturn: number;
|
|
2052
|
+
ts: number;
|
|
2053
|
+
liquidityUsd?: number;
|
|
2054
|
+
liquidityTier?: "deep" | "shallow";
|
|
2114
2055
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2056
|
+
interface WsArbFeedBatch {
|
|
2057
|
+
type: "arb_feed_batch";
|
|
2058
|
+
feed: "arb";
|
|
2059
|
+
/** Producer assertion that globally inactive venues were excluded. */
|
|
2060
|
+
activeVenuesOnly: true;
|
|
2061
|
+
entries: WsArbFeedEntry[];
|
|
2062
|
+
flushTs: number;
|
|
2063
|
+
chunk: number;
|
|
2064
|
+
chunkCount: number;
|
|
2119
2065
|
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2066
|
+
/**
|
|
2067
|
+
* Catalog feed item: one event or market with its current state. The same
|
|
2068
|
+
* shape is served by `GET /catalog/changes` and pushed as a `catalog_change`
|
|
2069
|
+
* frame on the `catalog` channel.
|
|
2070
|
+
*
|
|
2071
|
+
* Items are state, not history: apply one when its (version, changedAt) is
|
|
2072
|
+
* newer than what you hold for (entity, id). `AggClient.watchCatalog` does
|
|
2073
|
+
* this for you.
|
|
2074
|
+
*/
|
|
2075
|
+
type CatalogEntity = "event" | "market";
|
|
2076
|
+
type CatalogChangeOp = "created" | "updated" | "deleted";
|
|
2077
|
+
interface CatalogCategoryRef {
|
|
2078
|
+
id: string;
|
|
2079
|
+
name: string;
|
|
2126
2080
|
}
|
|
2127
|
-
interface
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2081
|
+
interface CatalogOutcomeRef {
|
|
2082
|
+
/** venueMarketOutcomeId — subscribe to `orderbook`/`trades` with it. */
|
|
2083
|
+
id: string;
|
|
2084
|
+
label: string;
|
|
2085
|
+
title: string | null;
|
|
2131
2086
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2087
|
+
/** Where an entity sits in its cross-venue matched cluster. */
|
|
2088
|
+
interface CatalogClusterFields {
|
|
2089
|
+
/** Matched or verified to at least one other venue. */
|
|
2090
|
+
matched: boolean;
|
|
2091
|
+
/**
|
|
2092
|
+
* The cluster's anchor id (event id for events, market id for markets).
|
|
2093
|
+
* Equals `id` for the anchor, null when unmatched. Anchors can change —
|
|
2094
|
+
* key your storage on `id`.
|
|
2095
|
+
*/
|
|
2096
|
+
clusterAnchorId: string | null;
|
|
2097
|
+
/** Venues in the matched cluster; just this entity's venue when unmatched. */
|
|
2098
|
+
clusterVenues: string[];
|
|
2136
2099
|
}
|
|
2137
|
-
interface
|
|
2138
|
-
|
|
2100
|
+
interface CatalogEventSnapshot extends CatalogClusterFields {
|
|
2101
|
+
id: string;
|
|
2139
2102
|
venue: string;
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
/** Smallest limit-order size on this market, raw 6-dec shares.
|
|
2146
|
-
* Absent means no known minimum. */
|
|
2147
|
-
minSizeRaw?: string;
|
|
2103
|
+
externalIdentifier: string;
|
|
2104
|
+
title: string;
|
|
2105
|
+
slug: string | null;
|
|
2106
|
+
status: string;
|
|
2107
|
+
startDate: string;
|
|
2148
2108
|
endDate: string | null;
|
|
2149
|
-
|
|
2109
|
+
createdAt: string;
|
|
2110
|
+
categories: CatalogCategoryRef[];
|
|
2150
2111
|
}
|
|
2151
|
-
interface
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
* book was published (see `hasOrderbook`).
|
|
2166
|
-
*/
|
|
2167
|
-
deployerVenue?: string | null;
|
|
2112
|
+
interface CatalogMarketSnapshot extends CatalogClusterFields {
|
|
2113
|
+
id: string;
|
|
2114
|
+
venueEventId: string;
|
|
2115
|
+
venue: string;
|
|
2116
|
+
externalIdentifier: string;
|
|
2117
|
+
question: string;
|
|
2118
|
+
shortTitle: string | null;
|
|
2119
|
+
status: string;
|
|
2120
|
+
startDate: string;
|
|
2121
|
+
endDate: string | null;
|
|
2122
|
+
createdAt: string;
|
|
2123
|
+
outcomes: CatalogOutcomeRef[];
|
|
2124
|
+
/** The parent event's categories. */
|
|
2125
|
+
categories: CatalogCategoryRef[];
|
|
2168
2126
|
}
|
|
2127
|
+
interface CatalogChange {
|
|
2128
|
+
entity: CatalogEntity;
|
|
2129
|
+
id: string;
|
|
2130
|
+
op: CatalogChangeOp;
|
|
2131
|
+
/** Structural version of this entity; increases on every structural write. */
|
|
2132
|
+
version: number;
|
|
2133
|
+
/** When the latest structural change touching this entity was recorded (ISO). */
|
|
2134
|
+
changedAt: string;
|
|
2135
|
+
/** Null only on `deleted`, when the row is already gone. */
|
|
2136
|
+
venue: string | null;
|
|
2137
|
+
/** Set when `entity` is "event" and `op` is not "deleted". */
|
|
2138
|
+
event?: CatalogEventSnapshot;
|
|
2139
|
+
/** Set when `entity` is "market" and `op` is not "deleted". */
|
|
2140
|
+
market?: CatalogMarketSnapshot;
|
|
2141
|
+
}
|
|
2142
|
+
/** Narrowing for the catalog feed. Deletes pass the venue filter (they carry no venue). */
|
|
2143
|
+
interface CatalogFilter {
|
|
2144
|
+
venues?: string[];
|
|
2145
|
+
entities?: CatalogEntity[];
|
|
2146
|
+
}
|
|
2147
|
+
/** A `catalog` channel frame. Live only — catch up with `GET /catalog/changes`. */
|
|
2148
|
+
type WsCatalogChange = CatalogChange & {
|
|
2149
|
+
type: "catalog_change";
|
|
2150
|
+
};
|
|
2151
|
+
type WsServerMessage = WsOrderbookSnapshot | WsOrderbookDelta | WsTrade | WsSubscribed | WsUnsubscribed | WsConnected | WsAuthenticated | WsHeartbeat | WsMarketResolved | WsError | WsOrderSubmitted | WsBalanceUpdate | WsOrderEvent | WsRedeemEvent | WsWithdrawalLifecycleEvent | WsArbMarketUpdate | WsArbFeedBatch | WsAuthExpiring | WsAuthExpired | WsResumed | WsStreamInterrupted | WsCatalogChange;
|
|
2169
2152
|
/**
|
|
2170
|
-
*
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
* - `local_merged` — midpoint from the cross-venue merged book
|
|
2174
|
-
* - `local_one_sided` — only one side present; mark is the live side, NOT a midpoint
|
|
2175
|
-
* - `sibling` — derived from the complementary outcome (e.g. NO from YES)
|
|
2176
|
-
* - `local_boundary` — clamped to the [tick, 1-tick] boundary
|
|
2177
|
-
* - `none` — no mark available
|
|
2153
|
+
* A user event as delivered on the `app-events` channel: the raw server
|
|
2154
|
+
* frame (timestamps in milliseconds, not converted), always with `userId`,
|
|
2155
|
+
* `stream: "app"` and normally an `eventId`.
|
|
2178
2156
|
*/
|
|
2179
|
-
type
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2157
|
+
type WsAppEvent = ((Omit<WsOrderSubmitted, "timestamp"> & {
|
|
2158
|
+
timestamp: number;
|
|
2159
|
+
}) | (Omit<WsBalanceUpdate, "timestamp"> & {
|
|
2160
|
+
timestamp: number;
|
|
2161
|
+
}) | WsOrderEvent | (Omit<WsRedeemEvent, "timestamp"> & {
|
|
2162
|
+
timestamp: number | string;
|
|
2163
|
+
}) | WsWithdrawalLifecycleEvent) & {
|
|
2164
|
+
userId: string;
|
|
2165
|
+
stream: "app";
|
|
2166
|
+
};
|
|
2167
|
+
type WsClientMessage = {
|
|
2168
|
+
action: "subscribe";
|
|
2169
|
+
channel: "orderbook" | "trades";
|
|
2170
|
+
outcomeIds: string[];
|
|
2171
|
+
} | {
|
|
2172
|
+
action: "unsubscribe";
|
|
2173
|
+
channel: "orderbook" | "trades";
|
|
2174
|
+
outcomeIds: string[];
|
|
2175
|
+
} | {
|
|
2176
|
+
action: "resnapshot";
|
|
2177
|
+
channel: "orderbook";
|
|
2178
|
+
outcomeIds: string[];
|
|
2179
|
+
} | {
|
|
2180
|
+
action: "subscribe";
|
|
2181
|
+
channel: "arb";
|
|
2182
|
+
marketIds: string[];
|
|
2183
|
+
} | {
|
|
2184
|
+
action: "unsubscribe";
|
|
2185
|
+
channel: "arb";
|
|
2186
|
+
marketIds: string[];
|
|
2187
|
+
} | {
|
|
2188
|
+
action: "subscribe";
|
|
2189
|
+
channel: "arb-feed";
|
|
2190
|
+
} | {
|
|
2191
|
+
action: "unsubscribe";
|
|
2192
|
+
channel: "arb-feed";
|
|
2193
|
+
} | {
|
|
2194
|
+
action: "authenticate";
|
|
2195
|
+
token: string;
|
|
2196
|
+
resumeFrom?: string;
|
|
2197
|
+
} | {
|
|
2198
|
+
action: "subscribe";
|
|
2199
|
+
channel: "app-events";
|
|
2200
|
+
resumeFrom?: string;
|
|
2201
|
+
} | {
|
|
2202
|
+
action: "unsubscribe";
|
|
2203
|
+
channel: "app-events";
|
|
2204
|
+
} | {
|
|
2205
|
+
action: "subscribe";
|
|
2206
|
+
channel: "catalog";
|
|
2207
|
+
venues?: string[];
|
|
2208
|
+
entities?: CatalogEntity[];
|
|
2209
|
+
id?: string | number;
|
|
2210
|
+
} | {
|
|
2211
|
+
action: "unsubscribe";
|
|
2212
|
+
channel: "catalog";
|
|
2213
|
+
id?: string | number;
|
|
2214
|
+
};
|
|
2215
|
+
type DiagnosticEvent = {
|
|
2216
|
+
type: "seq_gap";
|
|
2217
|
+
marketId: string;
|
|
2218
|
+
outcomeId: string;
|
|
2219
|
+
expected: number;
|
|
2220
|
+
received: number;
|
|
2221
|
+
} | {
|
|
2222
|
+
type: "checksum_mismatch";
|
|
2223
|
+
marketId: string;
|
|
2224
|
+
outcomeId: string;
|
|
2225
|
+
expected: number;
|
|
2226
|
+
computed: number;
|
|
2227
|
+
} | {
|
|
2228
|
+
type: "reconnect";
|
|
2229
|
+
attempt: number;
|
|
2230
|
+
delayMs: number;
|
|
2231
|
+
} |
|
|
2232
|
+
/** The server closed with a configuration error (4001/4003); the SDK does not retry. */
|
|
2233
|
+
{
|
|
2234
|
+
type: "connection_rejected";
|
|
2235
|
+
code: number;
|
|
2236
|
+
reason: string;
|
|
2237
|
+
} | {
|
|
2238
|
+
type: "stream_interrupted";
|
|
2239
|
+
channels: string[];
|
|
2240
|
+
} | {
|
|
2241
|
+
type: "stale_connection";
|
|
2242
|
+
lastMessageAge: number;
|
|
2243
|
+
} | {
|
|
2244
|
+
type: "book_watchdog_resync";
|
|
2245
|
+
outcomeId: string;
|
|
2246
|
+
/** null when there is no local book (its snapshot never arrived). */
|
|
2247
|
+
localSeq: number | null;
|
|
2248
|
+
serverSeq: number;
|
|
2249
|
+
action: "resnapshot" | "resubscribe";
|
|
2250
|
+
} |
|
|
2251
|
+
/** `status` is null when the REST check failed before a response (network error or timeout). */
|
|
2252
|
+
{
|
|
2253
|
+
type: "book_watchdog_error";
|
|
2254
|
+
status: number | null;
|
|
2255
|
+
};
|
|
2256
|
+
type DiagnosticCallback = (event: DiagnosticEvent) => void;
|
|
2257
|
+
//#endregion
|
|
2258
|
+
//#region src/catalog-feed.d.ts
|
|
2259
|
+
/** Recommended REST/WS overlap: re-read this much before the resume point. */
|
|
2260
|
+
declare const CATALOG_DEFAULT_OVERLAP_MS = 60000;
|
|
2261
|
+
interface GetCatalogChangesParams {
|
|
2262
|
+
/** Start of the walk. Required unless `cursor` is sent; at most 24 hours ago. */
|
|
2263
|
+
since?: string | Date;
|
|
2264
|
+
/** `nextCursor` from the previous page. Takes precedence over `since`. */
|
|
2195
2265
|
cursor?: string;
|
|
2266
|
+
/** 1–500, default 200. */
|
|
2196
2267
|
limit?: number;
|
|
2197
|
-
|
|
2198
|
-
|
|
2268
|
+
venues?: string[];
|
|
2269
|
+
entities?: CatalogEntity[];
|
|
2270
|
+
}
|
|
2271
|
+
interface CatalogChangesPage {
|
|
2272
|
+
data: CatalogChange[];
|
|
2273
|
+
/** Always set — pass it back to continue, including after `hasMore` is false. */
|
|
2274
|
+
nextCursor: string;
|
|
2275
|
+
/** More changes are already available. A page may hold fewer than `limit` items while true. */
|
|
2276
|
+
hasMore: boolean;
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* `GET /catalog/changes` answers 410 `resync_required` when the position is
|
|
2280
|
+
* older than the 24h retention window: re-list with the list endpoints, then
|
|
2281
|
+
* resume from the time that re-list started.
|
|
2282
|
+
*/
|
|
2283
|
+
declare function isCatalogResyncRequired(err: unknown): boolean;
|
|
2284
|
+
interface WatchCatalogOptions {
|
|
2285
|
+
/** Where to start: changes after this time are delivered (minus `overlapMs`). At most 24h ago. */
|
|
2286
|
+
since: string | Date;
|
|
2287
|
+
venues?: string[];
|
|
2288
|
+
entities?: CatalogEntity[];
|
|
2199
2289
|
/**
|
|
2200
|
-
*
|
|
2201
|
-
*
|
|
2290
|
+
* Only deliver matched (cross-venue) entities. An entity already delivered
|
|
2291
|
+
* is still delivered when it leaves its cluster (`matched: false`) or is
|
|
2292
|
+
* deleted, so you can drop it.
|
|
2202
2293
|
*/
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2294
|
+
matchedOnly?: boolean;
|
|
2295
|
+
/** Re-read this much before the resume point on every catch-up. Default 60s. */
|
|
2296
|
+
overlapMs?: number;
|
|
2297
|
+
/** REST page size (1–500). Server default when omitted. */
|
|
2298
|
+
pageLimit?: number;
|
|
2299
|
+
/** Called once per newer state of an entity, in apply order. */
|
|
2300
|
+
onChange: (change: CatalogChange) => void;
|
|
2301
|
+
/** A catch-up finished and live frames flow directly. */
|
|
2302
|
+
onSynced?: (info: {
|
|
2303
|
+
lastChangedAt: string | undefined;
|
|
2304
|
+
}) => void;
|
|
2305
|
+
/** REST or socket errors (catch-up retries on its own), and throws from `onChange`. */
|
|
2306
|
+
onError?: (err: unknown) => void;
|
|
2307
|
+
/**
|
|
2308
|
+
* The resume point fell out of the 24h window. Catch-up stops until you
|
|
2309
|
+
* re-list and call `handle.resync(startOfReList)`. Falls back to `onError`.
|
|
2310
|
+
*/
|
|
2311
|
+
onResyncRequired?: () => void;
|
|
2312
|
+
/**
|
|
2313
|
+
* Share an existing socket. When omitted a dedicated connection is opened
|
|
2314
|
+
* (requires `wsUrl`) and closed by `stop()`.
|
|
2315
|
+
*/
|
|
2316
|
+
socket?: AggWebSocket;
|
|
2317
|
+
}
|
|
2318
|
+
interface CatalogWatchHandle {
|
|
2319
|
+
/** Unsubscribe; closes the socket if the watcher opened it. */
|
|
2320
|
+
stop(): void;
|
|
2321
|
+
/** Latest applied `changedAt` — persist it and pass it as `since` to resume later. */
|
|
2322
|
+
readonly lastChangedAt: string | undefined;
|
|
2323
|
+
/** Resume from `since` after `onResyncRequired`, once you have re-listed. */
|
|
2324
|
+
resync(since: string | Date): void;
|
|
2325
|
+
/** Resolves after the first catch-up completes. */
|
|
2326
|
+
readonly ready: Promise<void>;
|
|
2216
2327
|
}
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2328
|
+
//#endregion
|
|
2329
|
+
//#region src/types.d.ts
|
|
2330
|
+
/** App-level paper/live mode. An app is one or the other, never both. */
|
|
2331
|
+
type AppTradingMode = "live" | "paper";
|
|
2332
|
+
interface AppClientConfigResponse {
|
|
2333
|
+
prophetxExecutionMode?: "clearinghouse" | "direct";
|
|
2334
|
+
novigExecutionMode?: "clearinghouse" | "direct";
|
|
2335
|
+
disabledVenues: Venue[];
|
|
2336
|
+
disabledCategoryPresets: string[];
|
|
2337
|
+
earlyAccessEnabled: boolean;
|
|
2338
|
+
authOptions: AppClientAuthOption[];
|
|
2339
|
+
/**
|
|
2340
|
+
* Server-owned execution mode. Prefer this over any locally-configured
|
|
2341
|
+
* `trading.executionMode` — the API enforces it regardless of what the
|
|
2342
|
+
* client sends, and end users cannot change it.
|
|
2343
|
+
*/
|
|
2344
|
+
tradingMode: AppTradingMode;
|
|
2345
|
+
/**
|
|
2346
|
+
* One-time simulated balance granted on first paper use, in dollars.
|
|
2347
|
+
* Interpolate this into paper copy rather than hardcoding a figure.
|
|
2348
|
+
*/
|
|
2349
|
+
paperStartingBalance: number;
|
|
2234
2350
|
}
|
|
2235
|
-
interface
|
|
2351
|
+
interface VenueGeoPolicyEntry {
|
|
2352
|
+
venue: Venue;
|
|
2353
|
+
/** ISO 3166-1 alpha-2, upper-case. Empty means no country restriction. */
|
|
2354
|
+
blockedCountries: string[];
|
|
2236
2355
|
/**
|
|
2237
|
-
*
|
|
2238
|
-
*
|
|
2356
|
+
* ISO 3166-1 alpha-2, upper-case. When present, this venue is ALLOWLIST
|
|
2357
|
+
* mode: ONLY these countries are permitted (`blockedCountries` is always
|
|
2358
|
+
* `[]` alongside this and must be ignored). Absent/undefined ⇒ ordinary
|
|
2359
|
+
* denylist mode, use `blockedCountries` as before. Only Novig uses this
|
|
2360
|
+
* today — a client that reads only `blockedCountries` sees an allowlisted
|
|
2361
|
+
* venue as unrestricted, which is exactly the misread this field closes.
|
|
2239
2362
|
*/
|
|
2240
|
-
|
|
2241
|
-
/** Venue-native outcome id or synthetic external id for direct live rows. */
|
|
2242
|
-
externalOutcomeId: string | null;
|
|
2243
|
-
/** False for this endpoint; live crypto markets are not smart-route inputs. */
|
|
2244
|
-
routeable: boolean;
|
|
2245
|
-
/** False for this endpoint; split-order routing is not supported here. */
|
|
2246
|
-
splitOrdersAllowed: boolean;
|
|
2247
|
-
label: string;
|
|
2248
|
-
title: string | null;
|
|
2249
|
-
midpoint: number | null;
|
|
2250
|
-
bestBid: number | null;
|
|
2251
|
-
bestAsk: number | null;
|
|
2252
|
-
markSource: MarkSource$1 | string | null;
|
|
2253
|
-
lastKnownPrice: number | null;
|
|
2254
|
-
orderbookDepth: RecurringCryptoOutcomeOrderbookDepth | null;
|
|
2363
|
+
allowedCountries?: string[];
|
|
2255
2364
|
}
|
|
2256
|
-
interface
|
|
2257
|
-
|
|
2258
|
-
volume24h: number | null;
|
|
2259
|
-
openInterest: number | null;
|
|
2260
|
-
liquidity: number | null;
|
|
2261
|
-
spread: number | null;
|
|
2365
|
+
interface VenueGeoPolicyResponse {
|
|
2366
|
+
venues: VenueGeoPolicyEntry[];
|
|
2262
2367
|
}
|
|
2263
|
-
interface
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
sourceDomain: string | null;
|
|
2267
|
-
rawCriteria: unknown;
|
|
2268
|
-
confidence: RecurringCryptoSourceConfidence;
|
|
2368
|
+
interface RpcTokenResponse {
|
|
2369
|
+
token: string;
|
|
2370
|
+
expiresAt: number;
|
|
2269
2371
|
}
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
provider: string | null;
|
|
2278
|
-
providerMarketId: string | null;
|
|
2279
|
-
confidence: RecurringCryptoSourceConfidence;
|
|
2280
|
-
fetchedAt?: string | null;
|
|
2281
|
-
ageMs?: number | null;
|
|
2282
|
-
refreshing?: boolean;
|
|
2283
|
-
stale?: boolean;
|
|
2372
|
+
type AggAuthProviderType = "siwe" | "siws" | "google" | "twitter" | "apple" | "email";
|
|
2373
|
+
interface AppClientAuthOption {
|
|
2374
|
+
provider: AggAuthProviderType;
|
|
2375
|
+
type: "oauth" | "email" | "wallet";
|
|
2376
|
+
enabled: boolean;
|
|
2377
|
+
callbackUrl?: string;
|
|
2378
|
+
statement?: string;
|
|
2284
2379
|
}
|
|
2285
|
-
type
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2380
|
+
type AggAuthDeliveryMode = "body" | "cookie-refresh";
|
|
2381
|
+
interface AggClientAuthOptions {
|
|
2382
|
+
getEarlyAccessCode?: () => string | null;
|
|
2383
|
+
}
|
|
2384
|
+
type AggAuthStartBody = {
|
|
2385
|
+
provider: Exclude<AggAuthProviderType, "email">;
|
|
2386
|
+
redirectUrl?: string;
|
|
2387
|
+
/** Cloudflare Turnstile token — required when a prior authStart returned `challenge_required`. */
|
|
2388
|
+
turnstileToken?: string;
|
|
2389
|
+
earlyAccessCode?: string;
|
|
2295
2390
|
} | {
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
asset: string;
|
|
2303
|
-
quoteAsset?: "USD";
|
|
2304
|
-
resolution: RecurringCryptoResolution;
|
|
2391
|
+
provider: "email";
|
|
2392
|
+
email: string;
|
|
2393
|
+
redirectUrl?: string;
|
|
2394
|
+
/** Cloudflare Turnstile token — required when a prior authStart returned `challenge_required`. */
|
|
2395
|
+
turnstileToken?: string;
|
|
2396
|
+
earlyAccessCode?: string;
|
|
2305
2397
|
};
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
quoteAsset?: "USD";
|
|
2398
|
+
/** SIWE / SIWS sign-in. `kind` is optional so callers that predate the discriminator still compile. */
|
|
2399
|
+
interface AggAuthWalletVerifyBody {
|
|
2400
|
+
kind?: "wallet";
|
|
2401
|
+
message: string;
|
|
2402
|
+
signature: string;
|
|
2403
|
+
earlyAccessCode?: string;
|
|
2313
2404
|
}
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
markets?: CryptoReferencePriceMarketInput[];
|
|
2320
|
-
windowMarkets?: RecurringCryptoWindowMarket[];
|
|
2321
|
-
signal?: AbortSignal;
|
|
2405
|
+
/** Privy sign-in. Requires the app's wallet provider to be Privy; the token must come from that Privy app. */
|
|
2406
|
+
interface AggAuthPrivyVerifyBody {
|
|
2407
|
+
kind: "privy";
|
|
2408
|
+
privyToken: string;
|
|
2409
|
+
earlyAccessCode?: string;
|
|
2322
2410
|
}
|
|
2323
|
-
|
|
2324
|
-
|
|
2411
|
+
/** Body for `POST /auth/verify` — mirrors the API's union on `kind`. */
|
|
2412
|
+
type AggAuthVerifyBody = AggAuthWalletVerifyBody | AggAuthPrivyVerifyBody;
|
|
2413
|
+
type AggAuthStartResult = {
|
|
2414
|
+
type: "nonce";
|
|
2415
|
+
nonce: string;
|
|
2416
|
+
statement?: string;
|
|
2417
|
+
} | {
|
|
2418
|
+
type: "redirect";
|
|
2419
|
+
url: string;
|
|
2420
|
+
} | {
|
|
2421
|
+
type: "magic_link";
|
|
2422
|
+
success: true;
|
|
2423
|
+
} | {
|
|
2424
|
+
type: "challenge_required";
|
|
2425
|
+
siteKey: string;
|
|
2426
|
+
};
|
|
2427
|
+
/**
|
|
2428
|
+
* Body for `POST /users/me/link-account/start` — authenticated account linking.
|
|
2429
|
+
*
|
|
2430
|
+
* `redirectUrl` is required for OAuth/email providers: the callback / magic-link
|
|
2431
|
+
* verify hands the partner a `link_confirm_token` by redirecting to `redirectUrl`,
|
|
2432
|
+
* and the partner app completes the flow by calling `/confirm` from that page.
|
|
2433
|
+
*
|
|
2434
|
+
* Wallet providers (`siwe`/`siws`) instead return a `wallet_challenge` with a
|
|
2435
|
+
* `message` the user signs VERBATIM; the signature is then confirmed with
|
|
2436
|
+
* `{ kind: "wallet_signature", message, signature }`.
|
|
2437
|
+
*/
|
|
2438
|
+
type AggLinkAccountBody = {
|
|
2439
|
+
provider: "google" | "twitter" | "apple";
|
|
2440
|
+
redirectUrl: string;
|
|
2441
|
+
} | {
|
|
2442
|
+
provider: "email";
|
|
2443
|
+
email: string;
|
|
2444
|
+
redirectUrl: string;
|
|
2445
|
+
} | {
|
|
2446
|
+
provider: "siwe" | "siws";
|
|
2447
|
+
address: string;
|
|
2448
|
+
};
|
|
2449
|
+
type AggLinkAccountResult = {
|
|
2450
|
+
type: "redirect";
|
|
2451
|
+
url: string;
|
|
2452
|
+
} | {
|
|
2453
|
+
type: "magic_link";
|
|
2454
|
+
success: true;
|
|
2455
|
+
} | {
|
|
2456
|
+
type: "wallet_challenge";
|
|
2457
|
+
message: string;
|
|
2458
|
+
};
|
|
2459
|
+
/**
|
|
2460
|
+
* Wallet branch of `POST /users/me/link-account/confirm`. Requires `kind` so it
|
|
2461
|
+
* can never be confused with the `token` branch. `message` MUST be the exact
|
|
2462
|
+
* `message` returned by `/start`'s `wallet_challenge` — the server compares it
|
|
2463
|
+
* byte-for-byte, so do not reconstruct or edit it client-side.
|
|
2464
|
+
*/
|
|
2465
|
+
type AggLinkAccountWalletConfirmBody = {
|
|
2466
|
+
kind: "wallet_signature";
|
|
2325
2467
|
message: string;
|
|
2468
|
+
signature: string;
|
|
2469
|
+
};
|
|
2470
|
+
/**
|
|
2471
|
+
* Success result of /users/me/link-account/confirm.
|
|
2472
|
+
* - `linked` — new Account row written.
|
|
2473
|
+
* - `already_linked_same` — identity was already attached to the caller's Principal
|
|
2474
|
+
* (idempotent; safe to retry).
|
|
2475
|
+
*
|
|
2476
|
+
* Collisions with a different Principal surface as HTTP 409 and are thrown by the
|
|
2477
|
+
* SDK's request layer — catch them at the call site, don't expect them here.
|
|
2478
|
+
*/
|
|
2479
|
+
type AggLinkAccountConfirmResult = {
|
|
2480
|
+
status: "linked" | "already_linked_same";
|
|
2481
|
+
provider: string;
|
|
2482
|
+
};
|
|
2483
|
+
type AggSessionUser = AuthUser | UserProfile;
|
|
2484
|
+
interface AggClientSessionInput {
|
|
2485
|
+
accessToken: string;
|
|
2486
|
+
refreshToken?: string;
|
|
2487
|
+
user?: AggSessionUser;
|
|
2326
2488
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2489
|
+
/** Non-sensitive auth snapshot persisted to localStorage for UI bootstrapping.
|
|
2490
|
+
* Tokens are NEVER included — they exist only in process memory. */
|
|
2491
|
+
interface PersistedAuthSnapshot {
|
|
2492
|
+
user: {
|
|
2493
|
+
id: string;
|
|
2494
|
+
username: string | null;
|
|
2495
|
+
avatarUrl: string | null;
|
|
2496
|
+
walletAddress?: string | null;
|
|
2497
|
+
} | null;
|
|
2498
|
+
authHint: {
|
|
2499
|
+
wasAuthenticated: boolean;
|
|
2500
|
+
};
|
|
2331
2501
|
}
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
interface
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
up: RecurringCryptoPriceComparison;
|
|
2381
|
-
down: RecurringCryptoPriceComparison;
|
|
2382
|
-
};
|
|
2502
|
+
/** Auth lifecycle status for UI state machines. */
|
|
2503
|
+
type AuthStatus = "unknown" | "authenticated" | "unauthenticated";
|
|
2504
|
+
type SignatureRequestType = "eip712" | "personal_sign" |
|
|
2505
|
+
/** EVM transaction — bridge legs and approvals. secp256k1. */
|
|
2506
|
+
"transaction" |
|
|
2507
|
+
/** Solana transaction — bridge legs on SVM. ed25519, NOT secp256k1. */
|
|
2508
|
+
"solana_transaction" | "hl_l1_action" |
|
|
2509
|
+
/**
|
|
2510
|
+
* EIP-7702 authorization over `{ contractAddress, chainId, nonce }`.
|
|
2511
|
+
*
|
|
2512
|
+
* A signature over a RAW digest — `keccak(0x05 ‖ rlp([chainId, delegate,
|
|
2513
|
+
* nonce]))` — not EIP-191 and not EIP-712. Many wallets do not expose this,
|
|
2514
|
+
* and that is expected: reject it and the server falls back to asking the
|
|
2515
|
+
* user to broadcast a plain approve instead.
|
|
2516
|
+
*/
|
|
2517
|
+
"eip7702_authorization" |
|
|
2518
|
+
/**
|
|
2519
|
+
* A Gnosis Safe transaction relayed through Polymarket — a legacy Polymarket
|
|
2520
|
+
* wallet funding a fill. The payload is the SafeTx as EIP-712 typed data,
|
|
2521
|
+
* but the wallet must `personal_sign` the RAW 32 bytes of
|
|
2522
|
+
* `hashTypedData(payload)` (`signMessage({ message: { raw: hash } })`):
|
|
2523
|
+
* Polymarket's relayer only accepts that shape. `payload.safeTxHash` carries
|
|
2524
|
+
* the digest for convenience; the server recomputes it from the typed data.
|
|
2525
|
+
*/
|
|
2526
|
+
"safe_tx";
|
|
2527
|
+
/** One payload the client must sign before a fill can proceed. */
|
|
2528
|
+
interface SignatureRequest {
|
|
2529
|
+
/** Echo this back with the signature. */
|
|
2530
|
+
stepId: string;
|
|
2531
|
+
/** Payload shape. Discriminates how to sign — not which venue. */
|
|
2532
|
+
type: SignatureRequestType;
|
|
2533
|
+
venue: string;
|
|
2534
|
+
/** The address that must produce this signature. Sign with this key, not another. */
|
|
2535
|
+
signerAddress: string;
|
|
2536
|
+
/** Absent for non-EVM payloads (e.g. Hyperliquid L1 actions). */
|
|
2537
|
+
chainId?: number;
|
|
2538
|
+
/** Sign verbatim. */
|
|
2539
|
+
payload: unknown;
|
|
2540
|
+
expiresAt: string;
|
|
2541
|
+
/** Why this signature is being asked for, when the server knows (e.g. `"fee"`, `"funding_and_fee"`). Display only. */
|
|
2542
|
+
purpose?: string;
|
|
2543
|
+
/**
|
|
2544
|
+
* The fill proceeds without this one (e.g. `purpose: "hl_referral"`, a
|
|
2545
|
+
* partner referral parked beside a Hyperliquid order). `fillSelfCustody`
|
|
2546
|
+
* skips it if your signer throws or it has expired, instead of failing the
|
|
2547
|
+
* fill.
|
|
2548
|
+
*/
|
|
2549
|
+
optional?: boolean;
|
|
2383
2550
|
}
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2551
|
+
/**
|
|
2552
|
+
* Supplied by the partner. Receives a payload, returns a signature. The SDK
|
|
2553
|
+
* never sees the key.
|
|
2554
|
+
*
|
|
2555
|
+
* Return a 0x-prefixed hex string for anything the wallet SIGNS:
|
|
2556
|
+
*
|
|
2557
|
+
* - `eip712` — `signTypedData` over `payload`.
|
|
2558
|
+
* - `personal_sign` — EIP-191 over `payload`: a UTF-8 string or `{ raw: "0x…" }
|
|
2559
|
+
* bytes (Polymarket proxy batches). Pass it directly as viem `message`.
|
|
2560
|
+
* - `safe_tx` — `personal_sign` over the RAW 32 bytes of
|
|
2561
|
+
* `hashTypedData(payload)` (viem: `signMessage({ message: { raw: hash } })`,
|
|
2562
|
+
* MetaMask: `personal_sign` with the hex hash). The wallet shows a hash, not
|
|
2563
|
+
* a structured prompt — that is what Polymarket's own relayer requires.
|
|
2564
|
+
* - `hl_l1_action` — Hyperliquid L1 action, EIP-712 in phantom-agent form.
|
|
2565
|
+
* - `eip7702_authorization` — an EIP-7702 authorization over
|
|
2566
|
+
* `{ contractAddress, chainId, nonce }`. This is a signature over a RAW
|
|
2567
|
+
* digest, not EIP-191 and not EIP-712, and many wallets do not expose it.
|
|
2568
|
+
* **Throwing here does not help**: there is no reject verb, so a thrown
|
|
2569
|
+
* signer is indistinguishable from a slow user — the request simply expires
|
|
2570
|
+
* and the fill dies. If your wallet cannot produce this signature, declare
|
|
2571
|
+
* `approveMode: "user_broadcast"` on the fill instead and the approve is
|
|
2572
|
+
* requested as a `transaction` the user sends themselves. Handling this
|
|
2573
|
+
* request is what makes funding gasless.
|
|
2574
|
+
* - `solana_transaction` — `payload.messageBase64` is the serialized Solana
|
|
2575
|
+
* transaction MESSAGE; `payload.transactionBase64` is the full unsigned
|
|
2576
|
+
* `VersionedTransaction` for wallets that need one to display/simulate.
|
|
2577
|
+
* Return `0x` + 128 hex chars: the 64-byte ed25519 signature over the
|
|
2578
|
+
* decoded message. With a wallet adapter: `const signed = await
|
|
2579
|
+
* wallet.signTransaction(VersionedTransaction.deserialize(base64decode(transactionBase64)))`
|
|
2580
|
+
* then return the signature at the index of `signerAddress` in
|
|
2581
|
+
* `signed.message.staticAccountKeys`, hex-encoded. Do NOT send it — the
|
|
2582
|
+
* server co-signs as fee payer and broadcasts. The user needs no SOL.
|
|
2583
|
+
* The signature MUST be over the UNMODIFIED message: the server verifies
|
|
2584
|
+
* it against the bytes it persisted, so a wallet that inserts
|
|
2585
|
+
* instructions before signing (priority fee, guards, Lighthouse) gets a
|
|
2586
|
+
* 400 — disable such features for this request or sign the raw message.
|
|
2587
|
+
*
|
|
2588
|
+
* Return `{ txHash }` for anything the wallet BROADCASTS:
|
|
2589
|
+
*
|
|
2590
|
+
* - `transaction` — send it, then return the hash **immediately, without
|
|
2591
|
+
* awaiting the receipt**. The server watches for the mined receipt itself
|
|
2592
|
+
* and will not resume until it matches the request byte-for-byte.
|
|
2593
|
+
*/
|
|
2594
|
+
type SignerFn = (req: SignatureRequest) => Promise<string | {
|
|
2595
|
+
txHash: string;
|
|
2596
|
+
}>;
|
|
2597
|
+
/**
|
|
2598
|
+
* How long `fillSelfCustody` will keep waiting before giving up.
|
|
2599
|
+
*
|
|
2600
|
+
* Covers a first-time user: sign the wallet-setup batch, wait for it on-chain,
|
|
2601
|
+
* then sign the order. Generous because the wait is a relayer transaction
|
|
2602
|
+
* confirming, not a human deciding.
|
|
2603
|
+
*/
|
|
2604
|
+
declare const SELF_CUSTODY_FILL_TIMEOUT_MS: number;
|
|
2605
|
+
/** Gap between re-reads while an on-chain step is in flight. */
|
|
2606
|
+
declare const SELF_CUSTODY_POLL_INTERVAL_MS = 2000;
|
|
2607
|
+
/**
|
|
2608
|
+
* How long `fillSelfCustody` waits on the `signer` for ONE optional request
|
|
2609
|
+
* signed by a wallet other than the user's — e.g. a partner's activation
|
|
2610
|
+
* sponsor. Such a request can delay the batch's submission by at most this long,
|
|
2611
|
+
* after which it is declined and the required signatures go out without it.
|
|
2612
|
+
* Required requests, and optional ones the user's own wallet signs (the fill's
|
|
2613
|
+
* `signingAddress` or any required request's `signerAddress`, e.g. a referral
|
|
2614
|
+
* code), are never bounded by this.
|
|
2615
|
+
*/
|
|
2616
|
+
declare const OPTIONAL_SIGNATURE_TIMEOUT_MS = 15000;
|
|
2617
|
+
/**
|
|
2618
|
+
* How long `fillSelfCustody` waits on an optional Polymarket buy fee pre-sign
|
|
2619
|
+
* (`purpose: "app_fee"`). It never holds the order (that round is already
|
|
2620
|
+
* posted), so it can wait for a slow wallet: just under the server's 60s grace,
|
|
2621
|
+
* after which the request is expired and a post-fill signature asked instead.
|
|
2622
|
+
*/
|
|
2623
|
+
declare const OPTIONAL_FEE_SIGNATURE_TIMEOUT_MS = 55000;
|
|
2624
|
+
/**
|
|
2625
|
+
* States a run never leaves. Everything else means "still working".
|
|
2626
|
+
*
|
|
2627
|
+
* Typed against `ExecutionOverallState` so a typo'd or renamed literal (e.g.
|
|
2628
|
+
* `cancelled` drifting to `canceled`) is a compile error instead of a state
|
|
2629
|
+
* that silently stops being treated as terminal. Mirrors
|
|
2630
|
+
* `ExecutionOverallStateTB` in the contract; keep the two in step.
|
|
2631
|
+
*/
|
|
2632
|
+
declare const TERMINAL_EXECUTION_STATES: ReadonlySet<ExecutionOverallState>;
|
|
2633
|
+
type SportsGameStatus = "scheduled" | "live" | "paused" | "finished" | "cancelled" | "postponed" | "unknown";
|
|
2634
|
+
interface SportsLiveParticipant {
|
|
2635
|
+
position: "first" | "second";
|
|
2636
|
+
name: string;
|
|
2637
|
+
shortName: string | null;
|
|
2638
|
+
imageUrl: string | null;
|
|
2639
|
+
score: string | null;
|
|
2401
2640
|
}
|
|
2402
|
-
interface
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
markets: RecurringCryptoVenueMarket[];
|
|
2411
|
-
comparisons: RecurringCryptoWindowComparisons;
|
|
2641
|
+
interface SportsLiveState {
|
|
2642
|
+
eventId: string;
|
|
2643
|
+
sport: string;
|
|
2644
|
+
status: SportsGameStatus;
|
|
2645
|
+
participants: [SportsLiveParticipant, SportsLiveParticipant];
|
|
2646
|
+
period: string | null;
|
|
2647
|
+
clock: string | null;
|
|
2648
|
+
updatedAt: string | null;
|
|
2412
2649
|
}
|
|
2413
|
-
interface
|
|
2414
|
-
data:
|
|
2415
|
-
|
|
2416
|
-
hasMore: boolean;
|
|
2650
|
+
interface SportsLiveResponse {
|
|
2651
|
+
data: SportsLiveState[];
|
|
2652
|
+
missingEventIds: string[];
|
|
2417
2653
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
/**
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
* Absent means no known minimum. */
|
|
2427
|
-
minSizeRaw?: string;
|
|
2428
|
-
orderbook: Orderbook;
|
|
2654
|
+
interface AggClientOptions {
|
|
2655
|
+
/** Browser adapters can inject a Worker transport; other runtimes keep the native client. */
|
|
2656
|
+
webSocketFactory?: (options: AggWebSocketOptions) => AggWebSocket;
|
|
2657
|
+
baseUrl: string;
|
|
2658
|
+
/** Public App ID — sent as x-app-id header. For client-side partner usage. */
|
|
2659
|
+
appId?: string;
|
|
2660
|
+
/** Secret admin key — sent as x-admin-key header. Server-side only. */
|
|
2661
|
+
adminKey?: string;
|
|
2429
2662
|
/**
|
|
2430
|
-
*
|
|
2431
|
-
*
|
|
2432
|
-
* metadata. Optional — only populated when the engine has emitted runtime
|
|
2433
|
-
* metadata for this entry.
|
|
2663
|
+
* Partner API key for server-side use. Sent as `x-app-api-key`. NEVER embed
|
|
2664
|
+
* in browser bundles, source maps, or logs. Keys start with `agg_<appId>_`.
|
|
2434
2665
|
*/
|
|
2435
|
-
|
|
2436
|
-
/**
|
|
2437
|
-
|
|
2666
|
+
apiKey?: string;
|
|
2667
|
+
/** WebSocket URL for real-time feeds. Must be set explicitly to use createWebSocket(). */
|
|
2668
|
+
wsUrl?: string;
|
|
2669
|
+
/** Opt in after immutable history publication/CDN rollout. Defaults false. */
|
|
2670
|
+
preferImmutableHistory?: boolean;
|
|
2438
2671
|
/**
|
|
2439
|
-
*
|
|
2440
|
-
*
|
|
2441
|
-
* one Hyperliquid deployer member, only one member's book is published per
|
|
2442
|
-
* request — this names which one, so a caller never pairs this entry's depth
|
|
2443
|
-
* with a different member's `venueMarketId`.
|
|
2672
|
+
* @deprecated Kalshi live discovery and trading are retired. This ignored
|
|
2673
|
+
* compatibility option remains to avoid breaking existing SDK consumers.
|
|
2444
2674
|
*/
|
|
2445
|
-
|
|
2675
|
+
kalshiDemo?: boolean;
|
|
2676
|
+
/** Optional auth request hooks used to enrich auth payloads. */
|
|
2677
|
+
auth?: AggClientAuthOptions;
|
|
2678
|
+
/** Move refresh delivery to an HttpOnly cookie on auth endpoints. Defaults to "body". */
|
|
2679
|
+
authDelivery?: AggAuthDeliveryMode;
|
|
2680
|
+
/** Persist a non-sensitive auth hint to localStorage for UI bootstrapping.
|
|
2681
|
+
* Tokens are NEVER persisted — they exist only in process memory.
|
|
2682
|
+
* When authDelivery is "body", refresh tokens are lost on page reload.
|
|
2683
|
+
* When authDelivery is "cookie-refresh", refresh tokens survive via HttpOnly cookies
|
|
2684
|
+
* and the SDK attempts a silent refresh on cold start. Defaults to true. */
|
|
2685
|
+
persistSession?: boolean;
|
|
2686
|
+
/**
|
|
2687
|
+
* Supplies signatures for self-custodial fills. Required whenever
|
|
2688
|
+
* `fillSelfCustody()` is called with `signingAddress` — the SDK never
|
|
2689
|
+
* holds a key itself, so without this option a fill that needs a
|
|
2690
|
+
* client-side signature cannot proceed. The signature requests never
|
|
2691
|
+
* come back on `POST /execution/fill` itself: `fillSelfCustody()` polls
|
|
2692
|
+
* `GET /execution/status` for them (`pendingSignatures`), signs each one
|
|
2693
|
+
* with this function, and posts the result to
|
|
2694
|
+
* `POST /execution/fill/:quoteId/signatures`.
|
|
2695
|
+
*/
|
|
2696
|
+
signer?: SignerFn;
|
|
2446
2697
|
}
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
matchedMarkets: MatchedOrderbookMarket[];
|
|
2456
|
-
}>;
|
|
2457
|
-
meta: {
|
|
2458
|
-
requestedCount: number;
|
|
2459
|
-
okCount: number;
|
|
2460
|
-
errorCount: number;
|
|
2461
|
-
};
|
|
2698
|
+
interface SiweMessageParams {
|
|
2699
|
+
domain: string;
|
|
2700
|
+
address: string;
|
|
2701
|
+
uri: string;
|
|
2702
|
+
nonce: string;
|
|
2703
|
+
chainId?: number;
|
|
2704
|
+
statement?: string;
|
|
2705
|
+
issuedAt?: string;
|
|
2462
2706
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2707
|
+
interface SiwsMessageParams {
|
|
2708
|
+
domain: string;
|
|
2709
|
+
/** Base58-encoded Solana public key. */
|
|
2710
|
+
address: string;
|
|
2711
|
+
uri: string;
|
|
2712
|
+
nonce: string;
|
|
2713
|
+
/** Solana chain ID: "mainnet", "devnet", "testnet", or "localnet". Defaults to "mainnet". */
|
|
2714
|
+
chainId?: string;
|
|
2715
|
+
statement?: string;
|
|
2716
|
+
issuedAt?: string;
|
|
2717
|
+
}
|
|
2718
|
+
/** OHLCV bar point for chart rendering. */
|
|
2719
|
+
interface ChartCandle {
|
|
2720
|
+
/** Venue average; distinct from OHLC close. */
|
|
2721
|
+
mean?: number;
|
|
2722
|
+
/** Open time in Unix milliseconds. */
|
|
2723
|
+
t: number;
|
|
2724
|
+
/** Open price (0-1). */
|
|
2725
|
+
o: number;
|
|
2726
|
+
/** High price (0-1). */
|
|
2727
|
+
h: number;
|
|
2728
|
+
/** Low price (0-1). */
|
|
2729
|
+
l: number;
|
|
2730
|
+
/** Close price (0-1). */
|
|
2731
|
+
c: number;
|
|
2732
|
+
/** Volume (null if unavailable). */
|
|
2733
|
+
v: number | null;
|
|
2734
|
+
}
|
|
2735
|
+
/** @deprecated Historical chart bars are canonical per outcome. Use ChartBarsResponse instead. */
|
|
2736
|
+
interface ChartVenueCandles {
|
|
2466
2737
|
venue: string;
|
|
2467
|
-
|
|
2468
|
-
spread: number | null;
|
|
2469
|
-
timestamp: number | null;
|
|
2470
|
-
arbReturn?: number | null;
|
|
2471
|
-
/** Provenance of `midpoint`. */
|
|
2472
|
-
markSource?: MarkSource$1;
|
|
2473
|
-
/**
|
|
2474
|
-
* When `markSource === "sibling"`, the matched venueMarketId whose book
|
|
2475
|
-
* supplied the headline mark. Allows the FE to label "sourced from venue X"
|
|
2476
|
-
* without re-running the matching logic.
|
|
2477
|
-
*/
|
|
2478
|
-
siblingVenueMarketId?: string;
|
|
2479
|
-
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2480
|
-
bestBid?: number | null;
|
|
2481
|
-
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2482
|
-
bestAsk?: number | null;
|
|
2738
|
+
candles: ChartCandle[];
|
|
2483
2739
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2740
|
+
type ChartResolution = "1m" | "5m" | "1h" | "1d";
|
|
2741
|
+
/**
|
|
2742
|
+
* Freshness signal embedded in every chart response. Compare
|
|
2743
|
+
* `staleSeconds` against the resolution to decide whether to show a
|
|
2744
|
+
* "delayed" badge on the chart.
|
|
2745
|
+
*/
|
|
2746
|
+
interface ChartBarsMeta {
|
|
2747
|
+
state?: "ready" | "warming" | "unsupported" | "failed" | "empty";
|
|
2748
|
+
complete?: boolean;
|
|
2749
|
+
retryAfterMs?: number;
|
|
2750
|
+
/** Agg fetch/publication time. Does not measure upstream delivery latency. */
|
|
2751
|
+
fetchedAtMs?: number;
|
|
2752
|
+
/** Server-side wall clock when the response was assembled, in milliseconds. */
|
|
2753
|
+
serverTime: number;
|
|
2754
|
+
/** `open_time` of the most-recent bar in `data`, in milliseconds. Null if `data` is empty. */
|
|
2755
|
+
lastBarOpenTime: number | null;
|
|
2756
|
+
/** `serverTime - lastBarOpenTime` in seconds. Null if `data` is empty. */
|
|
2757
|
+
staleSeconds: number | null;
|
|
2758
|
+
}
|
|
2759
|
+
/** Response from GET /charts/bars. */
|
|
2760
|
+
interface ChartBarsResponse {
|
|
2761
|
+
/** VenueMarketOutcome.id requested by the caller. */
|
|
2486
2762
|
venueMarketOutcomeId: string;
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
/**
|
|
2490
|
-
|
|
2491
|
-
/**
|
|
2492
|
-
|
|
2493
|
-
/**
|
|
2494
|
-
|
|
2763
|
+
/** Venue of the canonical historical series. */
|
|
2764
|
+
venue: string;
|
|
2765
|
+
/** Resolution returned by the backend. */
|
|
2766
|
+
resolution: ChartResolution;
|
|
2767
|
+
/** Bars sorted in ascending open time. */
|
|
2768
|
+
data: ChartCandle[];
|
|
2769
|
+
/** Freshness signal — see {@link ChartBarsMeta}. */
|
|
2770
|
+
meta: ChartBarsMeta;
|
|
2495
2771
|
}
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
marketStatus?: MarketStatus;
|
|
2514
|
-
/**
|
|
2515
|
-
* Structured refusal, mirroring GET /orderbooks per-item errors:
|
|
2516
|
-
* `market_resolved` for settled markets (prices are nulled instead of
|
|
2517
|
-
* serving a stale mark), `market_not_found` for unknown ids.
|
|
2518
|
-
*/
|
|
2519
|
-
error?: {
|
|
2520
|
-
code: "market_resolved" | "market_not_found";
|
|
2521
|
-
message: string;
|
|
2522
|
-
retryable: boolean;
|
|
2523
|
-
};
|
|
2772
|
+
interface ChartHistoryManifest {
|
|
2773
|
+
version: 1;
|
|
2774
|
+
revision: string | null;
|
|
2775
|
+
venueMarketOutcomeId: string;
|
|
2776
|
+
venue: string;
|
|
2777
|
+
resolution: ChartResolution;
|
|
2778
|
+
semantics: "venue-ohlcv-v1" | "polymarket-price-samples-v1" | "kalshi-ohlcv-quote-fallback-v2";
|
|
2779
|
+
from: number;
|
|
2780
|
+
to: number;
|
|
2781
|
+
finalizedThrough: number;
|
|
2782
|
+
chunks: Array<{
|
|
2783
|
+
key: string;
|
|
2784
|
+
url: string;
|
|
2785
|
+
sha256: string;
|
|
2786
|
+
from: number;
|
|
2787
|
+
to: number;
|
|
2788
|
+
points: number;
|
|
2524
2789
|
}>;
|
|
2790
|
+
meta: ChartBarsMeta;
|
|
2525
2791
|
}
|
|
2526
|
-
/**
|
|
2527
|
-
interface
|
|
2528
|
-
/** CRC of returned depth-limited levels; full engine checksum remains unchanged. */
|
|
2529
|
-
snapshotChecksum?: number;
|
|
2530
|
-
venueMarketOutcomeId: string;
|
|
2531
|
-
venueMarketId: string;
|
|
2792
|
+
/** Matched market reference returned by batch/aggregate endpoints. */
|
|
2793
|
+
interface VenueMarketRef {
|
|
2532
2794
|
venue: string;
|
|
2533
|
-
|
|
2534
|
-
bids: Array<{
|
|
2535
|
-
price: number;
|
|
2536
|
-
size: number;
|
|
2537
|
-
}>;
|
|
2538
|
-
asks: Array<{
|
|
2539
|
-
price: number;
|
|
2540
|
-
size: number;
|
|
2541
|
-
}>;
|
|
2542
|
-
};
|
|
2543
|
-
midpoint: number | null;
|
|
2544
|
-
spread: number | null;
|
|
2545
|
-
seq: number;
|
|
2546
|
-
checksum: number;
|
|
2547
|
-
timestamp: number;
|
|
2548
|
-
/** Sticky tick of this outcome's book, inferred at runtime. `null` until inferred. */
|
|
2549
|
-
tick: number | null;
|
|
2550
|
-
/** Provenance of `midpoint`. See {@link MarkSource}. */
|
|
2551
|
-
markSource: MarkSource$1;
|
|
2795
|
+
venueMarketId: string;
|
|
2552
2796
|
}
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2797
|
+
type OrderbookBatchItemStatus = "ok" | "market_not_found" | "market_resolved" | "market_closed" | "market_paused" | "market_unopened" | "book_not_loaded";
|
|
2798
|
+
type OrderbookBatchItemErrorCode = "market_not_found" | "market_resolved" | "market_closed" | "market_paused" | "market_unopened" | "book_not_loaded";
|
|
2799
|
+
interface OrderbookBatchItemError {
|
|
2800
|
+
code: OrderbookBatchItemErrorCode;
|
|
2801
|
+
message: string;
|
|
2802
|
+
retryable: boolean;
|
|
2558
2803
|
}
|
|
2559
|
-
interface
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
offset?: number;
|
|
2804
|
+
interface OrderbooksOnlyError {
|
|
2805
|
+
code: "use_orderbooks_endpoint";
|
|
2806
|
+
message: string;
|
|
2807
|
+
retryable: boolean;
|
|
2564
2808
|
}
|
|
2565
|
-
interface
|
|
2566
|
-
|
|
2567
|
-
|
|
2809
|
+
interface OrderbookServiceUnavailableError {
|
|
2810
|
+
code: "orderbook_service_unavailable";
|
|
2811
|
+
message: string;
|
|
2812
|
+
retryable: boolean;
|
|
2813
|
+
}
|
|
2814
|
+
interface RequestedOrderbookMarket {
|
|
2815
|
+
venueMarketId: string;
|
|
2568
2816
|
venue: string;
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
executionPrice: string | null;
|
|
2580
|
-
txHash: string | null;
|
|
2581
|
-
errorMessage: string | null;
|
|
2582
|
-
createdAt: string;
|
|
2583
|
-
updatedAt: string;
|
|
2817
|
+
marketStatus: "open" | "closed" | "resolved" | "unopened" | "paused";
|
|
2818
|
+
tickSize: number | null;
|
|
2819
|
+
/** Limit-order size step on this venue, raw 6-dec shares ("10000" = 0.01).
|
|
2820
|
+
* Absent means a 1-unit step. */
|
|
2821
|
+
sizeStepRaw?: string;
|
|
2822
|
+
/** Smallest limit-order size on this market, raw 6-dec shares.
|
|
2823
|
+
* Absent means no known minimum. */
|
|
2824
|
+
minSizeRaw?: string;
|
|
2825
|
+
endDate: string | null;
|
|
2826
|
+
resolutionDate: string | null;
|
|
2584
2827
|
}
|
|
2585
|
-
interface
|
|
2586
|
-
|
|
2587
|
-
|
|
2828
|
+
interface MatchedOrderbookMarket extends VenueMarketRef {
|
|
2829
|
+
marketStatus: "open" | "closed" | "resolved" | "unopened" | "paused";
|
|
2830
|
+
tickSize: number | null;
|
|
2831
|
+
/** Limit-order size step on this venue, raw 6-dec shares ("10000" = 0.01).
|
|
2832
|
+
* Absent means a 1-unit step. */
|
|
2833
|
+
sizeStepRaw?: string;
|
|
2834
|
+
/** Smallest limit-order size on this market, raw 6-dec shares.
|
|
2835
|
+
* Absent means no known minimum. */
|
|
2836
|
+
minSizeRaw?: string;
|
|
2837
|
+
hasOrderbook: boolean;
|
|
2838
|
+
/**
|
|
2839
|
+
* Hyperliquid HIP-4 deployer namespace this member belongs to (e.g. "ap").
|
|
2840
|
+
* `null` for every other venue and for Hyperliquid members without one.
|
|
2841
|
+
* Names which deployer this cluster member is — distinct from whether its
|
|
2842
|
+
* book was published (see `hasOrderbook`).
|
|
2843
|
+
*/
|
|
2844
|
+
deployerVenue?: string | null;
|
|
2588
2845
|
}
|
|
2589
|
-
/**
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2846
|
+
/**
|
|
2847
|
+
* Provenance of a published `midpoint`. Mirrors the engine's `MarkSource`.
|
|
2848
|
+
*
|
|
2849
|
+
* - `local` — true two-sided midpoint from the venue's own book
|
|
2850
|
+
* - `local_merged` — midpoint from the cross-venue merged book
|
|
2851
|
+
* - `local_one_sided` — only one side present; mark is the live side, NOT a midpoint
|
|
2852
|
+
* - `sibling` — derived from the complementary outcome (e.g. NO from YES)
|
|
2853
|
+
* - `local_boundary` — clamped to the [tick, 1-tick] boundary
|
|
2854
|
+
* - `none` — no mark available
|
|
2855
|
+
*/
|
|
2856
|
+
type MarkSource = "local" | "local_merged" | "local_one_sided" | "sibling" | "local_boundary" | "none";
|
|
2857
|
+
declare const RECURRENCE_CADENCES: readonly ["PT5M", "PT10M", "PT15M", "PT30M", "PT1H", "PT4H", "P1D", "P1W", "P1M", "P1Y"];
|
|
2858
|
+
type RecurrenceCadence = (typeof RECURRENCE_CADENCES)[number];
|
|
2859
|
+
type RecurrenceFilter = RecurrenceCadence | "null";
|
|
2860
|
+
type RecurringCryptoDuration = "PT5M" | "PT15M" | "PT30M" | "PT1H" | "PT4H" | "P1D";
|
|
2861
|
+
type RecurringCryptoDurationInput = RecurringCryptoDuration | "5m" | "15m" | "30m" | "1h" | "4h" | "1d";
|
|
2862
|
+
type RecurringCryptoSourceConfidence = "verified" | "inferred" | "missing";
|
|
2863
|
+
interface ListRecurringCryptoMarketsOptions {
|
|
2864
|
+
assets?: string[];
|
|
2865
|
+
durations?: RecurringCryptoDurationInput[];
|
|
2866
|
+
interval?: RecurringCryptoDurationInput;
|
|
2867
|
+
window?: "current";
|
|
2868
|
+
venues?: Venue[];
|
|
2869
|
+
status?: MarketStatus[];
|
|
2870
|
+
windowStartFrom?: string;
|
|
2871
|
+
windowStartTo?: string;
|
|
2872
|
+
cursor?: string;
|
|
2873
|
+
limit?: number;
|
|
2874
|
+
includeOrderbookPrices?: boolean;
|
|
2875
|
+
includeReferencePrices?: boolean;
|
|
2876
|
+
/**
|
|
2877
|
+
* @deprecated Ignored by the API. Recurring windows are listed from AGG's own
|
|
2878
|
+
* market data before they open, so the response is the same either way.
|
|
2879
|
+
*/
|
|
2880
|
+
includeDirectVenueMarkets?: boolean;
|
|
2881
|
+
includeOrderbookDepth?: boolean;
|
|
2882
|
+
orderbookDepth?: number;
|
|
2883
|
+
orderbookDepthAmountUsd?: number;
|
|
2594
2884
|
}
|
|
2595
|
-
|
|
2596
|
-
interface SimpleOrderbookLevel {
|
|
2885
|
+
interface RecurringCryptoOrderbookDepthLevel {
|
|
2597
2886
|
price: number;
|
|
2598
2887
|
size: number;
|
|
2888
|
+
notionalUsd: number;
|
|
2889
|
+
cumulativeSize: number;
|
|
2890
|
+
cumulativeNotionalUsd: number;
|
|
2891
|
+
fillSize: number | null;
|
|
2892
|
+
fillNotionalUsd: number | null;
|
|
2599
2893
|
}
|
|
2600
|
-
|
|
2601
|
-
|
|
2894
|
+
interface RecurringCryptoOrderbookDepthSide {
|
|
2895
|
+
levels: RecurringCryptoOrderbookDepthLevel[];
|
|
2896
|
+
totalSize: number;
|
|
2897
|
+
totalNotionalUsd: number;
|
|
2898
|
+
requestedNotionalUsd: number | null;
|
|
2899
|
+
filledSize: number | null;
|
|
2900
|
+
filledNotionalUsd: number | null;
|
|
2901
|
+
unfilledNotionalUsd: number | null;
|
|
2902
|
+
avgPrice: number | null;
|
|
2903
|
+
worstPrice: number | null;
|
|
2904
|
+
fillsComplete: boolean | null;
|
|
2905
|
+
}
|
|
2906
|
+
interface RecurringCryptoOutcomeOrderbookDepth {
|
|
2907
|
+
currency: "USD";
|
|
2908
|
+
amountUsd: number | null;
|
|
2909
|
+
buy: RecurringCryptoOrderbookDepthSide;
|
|
2910
|
+
sell: RecurringCryptoOrderbookDepthSide;
|
|
2911
|
+
}
|
|
2912
|
+
interface RecurringCryptoOutcome {
|
|
2913
|
+
/**
|
|
2914
|
+
* Canonical Agg outcome id. Null for direct live venue rows because those
|
|
2915
|
+
* rows are discovery data and cannot be passed to smart order routing.
|
|
2916
|
+
*/
|
|
2917
|
+
venueMarketOutcomeId: string | null;
|
|
2918
|
+
/** Venue-native outcome id or synthetic external id for direct live rows. */
|
|
2919
|
+
externalOutcomeId: string | null;
|
|
2920
|
+
/** False for this endpoint; live crypto markets are not smart-route inputs. */
|
|
2921
|
+
routeable: boolean;
|
|
2922
|
+
/** False for this endpoint; split-order routing is not supported here. */
|
|
2923
|
+
splitOrdersAllowed: boolean;
|
|
2924
|
+
label: string;
|
|
2925
|
+
title: string | null;
|
|
2926
|
+
midpoint: number | null;
|
|
2602
2927
|
bestBid: number | null;
|
|
2603
2928
|
bestAsk: number | null;
|
|
2929
|
+
markSource: MarkSource | string | null;
|
|
2930
|
+
lastKnownPrice: number | null;
|
|
2931
|
+
orderbookDepth: RecurringCryptoOutcomeOrderbookDepth | null;
|
|
2604
2932
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
asks: AggregatedOrderbookLevel[];
|
|
2611
|
-
};
|
|
2612
|
-
venueOrderbooks: Record<string, {
|
|
2613
|
-
bids: SimpleOrderbookLevel[];
|
|
2614
|
-
asks: SimpleOrderbookLevel[];
|
|
2615
|
-
}>;
|
|
2616
|
-
venues: Record<string, VenuePriceInfo>;
|
|
2617
|
-
midpoint: number | null;
|
|
2933
|
+
interface RecurringCryptoMarketMetrics {
|
|
2934
|
+
volume: number | null;
|
|
2935
|
+
volume24h: number | null;
|
|
2936
|
+
openInterest: number | null;
|
|
2937
|
+
liquidity: number | null;
|
|
2618
2938
|
spread: number | null;
|
|
2619
|
-
timestamp: number;
|
|
2620
|
-
/** Sequence number (present in live responses). */
|
|
2621
|
-
seq?: number;
|
|
2622
|
-
/** CRC32 checksum (present in live responses). */
|
|
2623
|
-
checksum?: number | null;
|
|
2624
|
-
/** Markets matched across venues for this canonical market. */
|
|
2625
|
-
matchedMarkets?: Array<{
|
|
2626
|
-
venue: string;
|
|
2627
|
-
venueMarketId: string;
|
|
2628
|
-
}>;
|
|
2629
2939
|
}
|
|
2630
|
-
interface
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
* `trades.filled` webhook carries it. Reusing it on a different quote is
|
|
2637
|
-
* rejected with 409.
|
|
2638
|
-
*/
|
|
2639
|
-
externalId?: string;
|
|
2640
|
-
/** Trading mode. Defaults to live. */
|
|
2641
|
-
mode?: ExecutionMode;
|
|
2642
|
-
/**
|
|
2643
|
-
* Optional intent fallback. When the supplied `quoteId` has expired in the
|
|
2644
|
-
* cache (e.g. user clicked Buy after a tab was inactive), the server
|
|
2645
|
-
* resolves the latest quote for this intent and refreshes/executes against
|
|
2646
|
-
* that instead of returning 400 `quote_not_found`. Same intent = same buttons
|
|
2647
|
-
* the user pressed in the UI; a different `maxSpend`, mode, or venue scope is
|
|
2648
|
-
* a different intent and won't match.
|
|
2649
|
-
*/
|
|
2650
|
-
fallbackToLatest?: {
|
|
2651
|
-
outcomeId: string;
|
|
2652
|
-
side: "buy" | "sell";
|
|
2653
|
-
maxSpend?: number;
|
|
2654
|
-
sellShares?: number;
|
|
2655
|
-
allowedVenues?: Venue[];
|
|
2656
|
-
};
|
|
2657
|
-
/**
|
|
2658
|
-
* Self-custody: the wallet that will sign this fill. Must be a wallet
|
|
2659
|
-
* already linked to this account. Omit for managed custody (the default).
|
|
2660
|
-
*/
|
|
2661
|
-
signingAddress?: string;
|
|
2662
|
-
/**
|
|
2663
|
-
* Self-custody buys only: other wallets linked to this account whose balances
|
|
2664
|
-
* may fund the fill. Must match the set the quote was priced with.
|
|
2665
|
-
*/
|
|
2666
|
-
fundingAddresses?: string[];
|
|
2667
|
-
/**
|
|
2668
|
-
* Self-custody only: which approve shape a cross-chain fill uses when the
|
|
2669
|
-
* bridge needs an ERC20 approve. Omit (the default) for "sponsored" — the
|
|
2670
|
-
* approve costs the wallet no gas, but the wallet must sign a one-time
|
|
2671
|
-
* EIP-7702 authorization over a RAW DIGEST, which many wallets cannot
|
|
2672
|
-
* produce. Send "user_broadcast" when yours cannot: the user sends the
|
|
2673
|
-
* approve from their own wallet and pays its gas. Only your client can know
|
|
2674
|
-
* which applies — it is a property of the wallet software, not of the
|
|
2675
|
-
* address or the chain.
|
|
2676
|
-
*
|
|
2677
|
-
* Worth surfacing in your UI: "user_broadcast" never establishes the
|
|
2678
|
-
* delegation, so an approve is needed on EVERY bridge. "sponsored" costs one
|
|
2679
|
-
* signature once per chain.
|
|
2680
|
-
*
|
|
2681
|
-
* Neither mode makes bridging free — the approve is only one of the costs.
|
|
2682
|
-
* Relay's fee comes out of the amount delivered on every bridge, and one-time
|
|
2683
|
-
* costs apply per route. Quote with `deepEstimate` and read
|
|
2684
|
-
* `feeBreakdown.bridgeFees` and `feeBreakdown.setupCosts` rather than
|
|
2685
|
-
* inferring cost from the approve mode.
|
|
2686
|
-
*/
|
|
2687
|
-
approveMode?: "sponsored" | "user_broadcast";
|
|
2940
|
+
interface RecurringCryptoResolution {
|
|
2941
|
+
sourceName: string | null;
|
|
2942
|
+
sourceUrl: string | null;
|
|
2943
|
+
sourceDomain: string | null;
|
|
2944
|
+
rawCriteria: unknown;
|
|
2945
|
+
confidence: RecurringCryptoSourceConfidence;
|
|
2688
2946
|
}
|
|
2689
|
-
interface
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
* reused). Drive the whole round trip through `fillSelfCustody()` rather
|
|
2704
|
-
* than reading this field on the fill response by hand.
|
|
2705
|
-
*/
|
|
2706
|
-
pendingSignatures?: SignatureRequest[];
|
|
2947
|
+
interface RecurringCryptoReferencePrice {
|
|
2948
|
+
asset: string;
|
|
2949
|
+
quoteAsset: "USD";
|
|
2950
|
+
raw: string | null;
|
|
2951
|
+
decimals: number | null;
|
|
2952
|
+
normalized: number | null;
|
|
2953
|
+
timestamp: string | null;
|
|
2954
|
+
provider: string | null;
|
|
2955
|
+
providerMarketId: string | null;
|
|
2956
|
+
confidence: RecurringCryptoSourceConfidence;
|
|
2957
|
+
fetchedAt?: string | null;
|
|
2958
|
+
ageMs?: number | null;
|
|
2959
|
+
refreshing?: boolean;
|
|
2960
|
+
stale?: boolean;
|
|
2707
2961
|
}
|
|
2708
|
-
type
|
|
2709
|
-
type
|
|
2710
|
-
|
|
2711
|
-
timestamp: number;
|
|
2962
|
+
type CryptoReferencePriceTarget = {
|
|
2963
|
+
type: "venueMarket";
|
|
2964
|
+
venueMarketId: string;
|
|
2712
2965
|
} | {
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2966
|
+
type: "venueEvent";
|
|
2967
|
+
venueEventId: string;
|
|
2968
|
+
} | {
|
|
2969
|
+
type: "externalVenueMarket";
|
|
2970
|
+
venue: Venue;
|
|
2971
|
+
externalMarketId: string;
|
|
2972
|
+
} | {
|
|
2973
|
+
type: "market";
|
|
2974
|
+
venue: Venue;
|
|
2975
|
+
venueEventId?: string;
|
|
2976
|
+
venueMarketId: string;
|
|
2977
|
+
externalEventId?: string | null;
|
|
2978
|
+
externalMarketId?: string;
|
|
2979
|
+
asset: string;
|
|
2980
|
+
quoteAsset?: "USD";
|
|
2981
|
+
resolution: RecurringCryptoResolution;
|
|
2727
2982
|
};
|
|
2728
|
-
interface
|
|
2729
|
-
venue: "polymarket" | "hyperliquid";
|
|
2730
|
-
venueOrderId: string;
|
|
2731
|
-
signerAddress: string;
|
|
2732
|
-
cancelSignature: CancelOrderSignature;
|
|
2733
|
-
}
|
|
2734
|
-
interface PlaceLimitOrderParams {
|
|
2735
|
-
/** BETDEX uses hosted cash: GTC/IOC only, no signer, post-only or expiry.
|
|
2736
|
-
* Native odds are rounded conservatively and stake is rounded down. GTC
|
|
2737
|
-
* unmatched liquidity is cancelled at the in-play transition. SELL closes
|
|
2738
|
-
* the same For outcome and requires collateral as well as owned inventory.
|
|
2739
|
-
*/
|
|
2983
|
+
interface CryptoReferencePriceExternalMarketInput {
|
|
2740
2984
|
venue: Venue;
|
|
2741
|
-
|
|
2742
|
-
side: "buy" | "sell";
|
|
2743
|
-
limitPriceRaw: string;
|
|
2744
|
-
sizeRaw: string;
|
|
2745
|
-
timeInForce: LimitOrderTimeInForce;
|
|
2746
|
-
postOnly?: boolean;
|
|
2747
|
-
expiresAt?: string;
|
|
2748
|
-
clientOrderId?: string;
|
|
2749
|
-
/** Linked account EOA. Polymarket supports GTC/GTD buys; Hyperliquid supports GTC/ALO buys and sells. Agent keys stay on the client. Omit for managed custody. */
|
|
2750
|
-
signingAddress?: string;
|
|
2751
|
-
/** Same bridge approval mode as market fills; defaults to sponsored. */
|
|
2752
|
-
approveMode?: ExecuteManagedParams["approveMode"];
|
|
2753
|
-
/** Self-custody buys only: other wallets linked to this account whose balances may bridge in to fund the order. Requires signingAddress. */
|
|
2754
|
-
fundingAddresses?: string[];
|
|
2985
|
+
externalMarketId: string;
|
|
2755
2986
|
}
|
|
2756
|
-
interface
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2987
|
+
interface CryptoReferencePriceMarketInput extends RecurringCryptoVenueMarket {
|
|
2988
|
+
asset: string;
|
|
2989
|
+
quoteAsset?: "USD";
|
|
2990
|
+
}
|
|
2991
|
+
interface GetCryptoReferencePricesOptions {
|
|
2992
|
+
targets?: CryptoReferencePriceTarget[];
|
|
2993
|
+
venueMarketIds?: string[];
|
|
2994
|
+
venueEventIds?: string[];
|
|
2995
|
+
externalMarkets?: CryptoReferencePriceExternalMarketInput[];
|
|
2996
|
+
markets?: CryptoReferencePriceMarketInput[];
|
|
2997
|
+
windowMarkets?: RecurringCryptoWindowMarket[];
|
|
2998
|
+
signal?: AbortSignal;
|
|
2999
|
+
}
|
|
3000
|
+
interface CryptoReferencePriceError {
|
|
3001
|
+
code: "not_found" | "not_recurring_crypto" | "reference_feed_missing" | "price_unavailable" | "stale_price";
|
|
3002
|
+
message: string;
|
|
3003
|
+
}
|
|
3004
|
+
interface CryptoReferencePriceSource {
|
|
3005
|
+
provider: string | null;
|
|
3006
|
+
providerMarketId: string | null;
|
|
3007
|
+
confidence: RecurringCryptoSourceConfidence;
|
|
3008
|
+
}
|
|
3009
|
+
interface CryptoReferencePriceResult {
|
|
3010
|
+
target: CryptoReferencePriceTarget;
|
|
3011
|
+
venue: Venue | null;
|
|
3012
|
+
venueEventId: string | null;
|
|
3013
|
+
venueMarketId: string | null;
|
|
3014
|
+
externalEventId: string | null;
|
|
3015
|
+
externalMarketId: string | null;
|
|
3016
|
+
asset: string | null;
|
|
3017
|
+
quoteAsset: "USD" | null;
|
|
3018
|
+
raw: string | null;
|
|
3019
|
+
decimals: number | null;
|
|
3020
|
+
normalized: number | null;
|
|
3021
|
+
providerTimestamp: string | null;
|
|
3022
|
+
fetchedAt: string | null;
|
|
3023
|
+
ageMs: number | null;
|
|
3024
|
+
refreshing: boolean;
|
|
3025
|
+
stale: boolean;
|
|
3026
|
+
source: CryptoReferencePriceSource;
|
|
3027
|
+
error: CryptoReferencePriceError | null;
|
|
3028
|
+
}
|
|
3029
|
+
interface CryptoReferencePricesResponse {
|
|
3030
|
+
data: CryptoReferencePriceResult[];
|
|
3031
|
+
softRefreshMs: number;
|
|
3032
|
+
hardMaxAgeMs: number;
|
|
3033
|
+
}
|
|
3034
|
+
type RecurringCryptoComparisonPriceSource = "referencePrice" | "midpoint" | "lastKnownPrice";
|
|
3035
|
+
interface RecurringCryptoComparisonPoint {
|
|
2761
3036
|
venue: Venue;
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
3037
|
+
venueMarketId: string;
|
|
3038
|
+
value: number;
|
|
3039
|
+
label: string | null;
|
|
3040
|
+
source: RecurringCryptoComparisonPriceSource;
|
|
3041
|
+
provider: string | null;
|
|
3042
|
+
providerMarketId: string | null;
|
|
3043
|
+
timestamp: string | null;
|
|
3044
|
+
confidence: RecurringCryptoSourceConfidence | null;
|
|
2768
3045
|
}
|
|
2769
|
-
interface
|
|
3046
|
+
interface RecurringCryptoPriceComparison {
|
|
3047
|
+
count: number;
|
|
3048
|
+
min: RecurringCryptoComparisonPoint | null;
|
|
3049
|
+
max: RecurringCryptoComparisonPoint | null;
|
|
3050
|
+
spread: number | null;
|
|
3051
|
+
spreadBps: number | null;
|
|
3052
|
+
byVenue: RecurringCryptoComparisonPoint[];
|
|
3053
|
+
}
|
|
3054
|
+
interface RecurringCryptoWindowComparisons {
|
|
3055
|
+
referencePrice: RecurringCryptoPriceComparison;
|
|
3056
|
+
outcomePrices: {
|
|
3057
|
+
up: RecurringCryptoPriceComparison;
|
|
3058
|
+
down: RecurringCryptoPriceComparison;
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
interface RecurringCryptoVenueMarket {
|
|
2770
3062
|
venue: Venue;
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
*
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
* bridging: funds must already sit on the venue's own chain, and `allowedSourceChainIds` /
|
|
2815
|
-
* `chainBalances` are ignored alongside it. You own price and minimum
|
|
2816
|
-
* checks — an order the venue refuses fails after acceptance and uses up its `externalId`.
|
|
2817
|
-
*/
|
|
2818
|
-
skipQuote?: boolean;
|
|
3063
|
+
venueEventId: string;
|
|
3064
|
+
venueMarketId: string;
|
|
3065
|
+
externalEventId: string | null;
|
|
3066
|
+
externalMarketId: string;
|
|
3067
|
+
question: string;
|
|
3068
|
+
status: MarketStatus;
|
|
3069
|
+
priceSource: "snag" | "direct";
|
|
3070
|
+
/** False for this endpoint; live crypto markets are not smart-route inputs. */
|
|
3071
|
+
routeable: boolean;
|
|
3072
|
+
/** False for this endpoint; split-order routing is not supported here. */
|
|
3073
|
+
splitOrdersAllowed: boolean;
|
|
3074
|
+
outcomes: RecurringCryptoOutcome[];
|
|
3075
|
+
metrics: RecurringCryptoMarketMetrics;
|
|
3076
|
+
resolution: RecurringCryptoResolution;
|
|
3077
|
+
referencePrice: RecurringCryptoReferencePrice;
|
|
3078
|
+
}
|
|
3079
|
+
interface RecurringCryptoWindowMarket {
|
|
3080
|
+
id: string;
|
|
3081
|
+
asset: string;
|
|
3082
|
+
quoteAsset: "USD";
|
|
3083
|
+
duration: RecurringCryptoDuration;
|
|
3084
|
+
windowStart: string;
|
|
3085
|
+
windowEnd: string;
|
|
3086
|
+
status: MarketStatus;
|
|
3087
|
+
markets: RecurringCryptoVenueMarket[];
|
|
3088
|
+
comparisons: RecurringCryptoWindowComparisons;
|
|
3089
|
+
}
|
|
3090
|
+
interface RecurringCryptoMarketsResponse {
|
|
3091
|
+
data: RecurringCryptoWindowMarket[];
|
|
3092
|
+
nextCursor: string | null;
|
|
3093
|
+
hasMore: boolean;
|
|
3094
|
+
}
|
|
3095
|
+
/** Per-venue orderbook entry with native tick spacing. */
|
|
3096
|
+
interface VenueOrderbookEntry {
|
|
3097
|
+
venueMarketId: string;
|
|
3098
|
+
tickSize: number | null;
|
|
3099
|
+
/** Limit-order size step on this venue, raw 6-dec shares ("10000" = 0.01).
|
|
3100
|
+
* Absent means a 1-unit step. */
|
|
3101
|
+
sizeStepRaw?: string;
|
|
3102
|
+
/** Smallest limit-order size on this market, raw 6-dec shares.
|
|
3103
|
+
* Absent means no known minimum. */
|
|
3104
|
+
minSizeRaw?: string;
|
|
3105
|
+
orderbook: Orderbook;
|
|
2819
3106
|
/**
|
|
2820
|
-
*
|
|
2821
|
-
*
|
|
2822
|
-
*
|
|
2823
|
-
*
|
|
2824
|
-
* balance can fail the order after it was accepted. Requires a `read_write` `x-app-api-key`.
|
|
3107
|
+
* Sticky tick of this venue's book inferred at runtime by the engine. May
|
|
3108
|
+
* differ from the seed `tickSize` when the live grid is finer than the DB
|
|
3109
|
+
* metadata. Optional — only populated when the engine has emitted runtime
|
|
3110
|
+
* metadata for this entry.
|
|
2825
3111
|
*/
|
|
2826
|
-
|
|
3112
|
+
tick?: number | null;
|
|
3113
|
+
/** Provenance of this venue book's published midpoint. See {@link MarkSource}. */
|
|
3114
|
+
markSource?: MarkSource;
|
|
2827
3115
|
/**
|
|
2828
|
-
*
|
|
2829
|
-
*
|
|
2830
|
-
*
|
|
3116
|
+
* Hyperliquid HIP-4 deployer namespace whose book this entry publishes
|
|
3117
|
+
* (e.g. "ap"). `null` for every other venue. When a cluster has more than
|
|
3118
|
+
* one Hyperliquid deployer member, only one member's book is published per
|
|
3119
|
+
* request — this names which one, so a caller never pairs this entry's depth
|
|
3120
|
+
* with a different member's `venueMarketId`.
|
|
2831
3121
|
*/
|
|
2832
|
-
|
|
3122
|
+
deployerVenue?: string | null;
|
|
2833
3123
|
}
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
3124
|
+
/** Response from GET /orderbooks (batch). */
|
|
3125
|
+
interface BatchOrderbooksResponse {
|
|
3126
|
+
data: Array<{
|
|
3127
|
+
venueMarketId: string;
|
|
3128
|
+
status: OrderbookBatchItemStatus;
|
|
3129
|
+
error: OrderbookBatchItemError | null;
|
|
3130
|
+
requestedMarket: RequestedOrderbookMarket | null;
|
|
3131
|
+
venueOrderbooks: Record<string, VenueOrderbookEntry>;
|
|
3132
|
+
matchedMarkets: MatchedOrderbookMarket[];
|
|
3133
|
+
}>;
|
|
3134
|
+
meta: {
|
|
3135
|
+
requestedCount: number;
|
|
3136
|
+
okCount: number;
|
|
3137
|
+
errorCount: number;
|
|
3138
|
+
};
|
|
2846
3139
|
}
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
3140
|
+
/** A single market midpoint row returned by GET /midpoints. */
|
|
3141
|
+
interface MidpointRow {
|
|
3142
|
+
venueMarketId: string;
|
|
3143
|
+
venue: string;
|
|
3144
|
+
midpoint: number | null;
|
|
3145
|
+
spread: number | null;
|
|
3146
|
+
timestamp: number | null;
|
|
3147
|
+
arbReturn?: number | null;
|
|
3148
|
+
/** Provenance of `midpoint`. */
|
|
3149
|
+
markSource?: MarkSource;
|
|
3150
|
+
/**
|
|
3151
|
+
* When `markSource === "sibling"`, the matched venueMarketId whose book
|
|
3152
|
+
* supplied the headline mark. Allows the FE to label "sourced from venue X"
|
|
3153
|
+
* without re-running the matching logic.
|
|
3154
|
+
*/
|
|
3155
|
+
siblingVenueMarketId?: string;
|
|
3156
|
+
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
3157
|
+
bestBid?: number | null;
|
|
3158
|
+
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
3159
|
+
bestAsk?: number | null;
|
|
2851
3160
|
}
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
3161
|
+
/** Per-outcome midpoint from a live orderbook. */
|
|
3162
|
+
interface OutcomeMidpointRow {
|
|
3163
|
+
venueMarketOutcomeId: string;
|
|
3164
|
+
label: string;
|
|
3165
|
+
midpoint: number | null;
|
|
3166
|
+
/** Provenance of `midpoint`. */
|
|
3167
|
+
markSource?: MarkSource;
|
|
3168
|
+
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
3169
|
+
bestBid?: number | null;
|
|
3170
|
+
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
3171
|
+
bestAsk?: number | null;
|
|
2858
3172
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
3173
|
+
/** Response from GET /midpoints (batch). */
|
|
3174
|
+
interface BatchMidpointsResponse {
|
|
3175
|
+
data: Array<MidpointRow & {
|
|
3176
|
+
outcomes: OutcomeMidpointRow[];
|
|
3177
|
+
matched: MidpointRow[];
|
|
3178
|
+
/**
|
|
3179
|
+
* Live, quality-gated cross-venue arbitrage return for this market's
|
|
3180
|
+
* cluster as a decimal fraction (`0.0085` = 0.85%), computed fresh by
|
|
3181
|
+
* the engine on this request. Prefer it over the `arbReturn` embedded
|
|
3182
|
+
* in venue-event listings, which a background sync can leave stale.
|
|
3183
|
+
* Only present when the request set `bestPrice=true`.
|
|
3184
|
+
*/
|
|
3185
|
+
arbReturn?: number | null;
|
|
3186
|
+
/**
|
|
3187
|
+
* DB status of the requested market. Present whenever the id resolves
|
|
3188
|
+
* to a known market. Resolved markets never serve a price (see `error`).
|
|
3189
|
+
*/
|
|
3190
|
+
marketStatus?: MarketStatus;
|
|
3191
|
+
/**
|
|
3192
|
+
* Structured refusal, mirroring GET /orderbooks per-item errors:
|
|
3193
|
+
* `market_resolved` for settled markets (prices are nulled instead of
|
|
3194
|
+
* serving a stale mark), `market_not_found` for unknown ids.
|
|
3195
|
+
*/
|
|
3196
|
+
error?: {
|
|
3197
|
+
code: "market_resolved" | "market_not_found";
|
|
3198
|
+
message: string;
|
|
3199
|
+
retryable: boolean;
|
|
3200
|
+
};
|
|
3201
|
+
}>;
|
|
2879
3202
|
}
|
|
2880
|
-
|
|
3203
|
+
/** Response from GET /orderbook/outcome/:id (single outcome). */
|
|
3204
|
+
interface OutcomeOrderbookResponse {
|
|
3205
|
+
/** CRC of returned depth-limited levels; full engine checksum remains unchanged. */
|
|
3206
|
+
snapshotChecksum?: number;
|
|
3207
|
+
venueMarketOutcomeId: string;
|
|
3208
|
+
venueMarketId: string;
|
|
3209
|
+
venue: string;
|
|
3210
|
+
orderbook: {
|
|
3211
|
+
bids: Array<{
|
|
3212
|
+
price: number;
|
|
3213
|
+
size: number;
|
|
3214
|
+
}>;
|
|
3215
|
+
asks: Array<{
|
|
3216
|
+
price: number;
|
|
3217
|
+
size: number;
|
|
3218
|
+
}>;
|
|
3219
|
+
};
|
|
3220
|
+
midpoint: number | null;
|
|
3221
|
+
spread: number | null;
|
|
3222
|
+
seq: number;
|
|
3223
|
+
checksum: number;
|
|
3224
|
+
timestamp: number;
|
|
3225
|
+
/** Sticky tick of this outcome's book, inferred at runtime. `null` until inferred. */
|
|
3226
|
+
tick: number | null;
|
|
3227
|
+
/** Provenance of `midpoint`. See {@link MarkSource}. */
|
|
3228
|
+
markSource: MarkSource;
|
|
3229
|
+
}
|
|
3230
|
+
/** Standard paginated list response from the API. */
|
|
3231
|
+
interface PaginatedResponse<T> {
|
|
3232
|
+
data: T[];
|
|
3233
|
+
nextCursor: string | null;
|
|
3234
|
+
hasMore: boolean;
|
|
3235
|
+
}
|
|
3236
|
+
interface OrderListQuery {
|
|
3237
|
+
userId?: string;
|
|
3238
|
+
status?: string;
|
|
3239
|
+
limit?: number;
|
|
3240
|
+
offset?: number;
|
|
3241
|
+
}
|
|
3242
|
+
interface TradeExecutorOrder {
|
|
2881
3243
|
id: string;
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
3244
|
+
userId: string;
|
|
3245
|
+
venue: string;
|
|
3246
|
+
status: string;
|
|
3247
|
+
marketId: string;
|
|
3248
|
+
tokenId: string;
|
|
3249
|
+
side: string;
|
|
3250
|
+
amountRaw: string;
|
|
3251
|
+
quoteId: string | null;
|
|
3252
|
+
externalId: string | null;
|
|
3253
|
+
clientOrderId: string | null;
|
|
3254
|
+
dagRunId: string | null;
|
|
3255
|
+
filledAmountRaw: string | null;
|
|
3256
|
+
executionPrice: string | null;
|
|
3257
|
+
txHash: string | null;
|
|
3258
|
+
errorMessage: string | null;
|
|
2897
3259
|
createdAt: string;
|
|
2898
3260
|
updatedAt: string;
|
|
2899
|
-
latestAttempt: BalanceRefillAttempt | null;
|
|
2900
3261
|
}
|
|
2901
|
-
interface
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
minimumRaw: string;
|
|
2905
|
-
refillAmountRaw: string;
|
|
2906
|
-
/** Optional daily refill limit. Defaults to $1,002 in 6-decimal USD units. */
|
|
2907
|
-
dailyCapRaw?: string;
|
|
2908
|
-
/** Optional per-refill fee limit. Defaults to $2 in 6-decimal USD units. */
|
|
2909
|
-
maxFeeRaw?: string;
|
|
3262
|
+
interface TradeExecutorOrderListResponse {
|
|
3263
|
+
orders: TradeExecutorOrder[];
|
|
3264
|
+
total: number;
|
|
2910
3265
|
}
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
status?: BalanceRefillPolicyStatus;
|
|
3266
|
+
/** A single level in the aggregated orderbook with per-venue attribution. */
|
|
3267
|
+
interface AggregatedOrderbookLevel {
|
|
3268
|
+
price: number;
|
|
3269
|
+
size: number;
|
|
3270
|
+
venues: Record<string, number>;
|
|
2917
3271
|
}
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
requestId?: string;
|
|
2923
|
-
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
2924
|
-
amountRaw: string;
|
|
2925
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2926
|
-
/** Recipient address. EVM destinations use 0x-prefixed 20-byte hex; Solana uses base58. */
|
|
2927
|
-
destinationAddress: string;
|
|
2928
|
-
/** Chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
2929
|
-
destinationChainId: number;
|
|
2930
|
-
/**
|
|
2931
|
-
* When `true`, the server caps the withdrawal to the maximum deliverable amount
|
|
2932
|
-
* instead of rejecting an over-balance request. Use only when the user explicitly
|
|
2933
|
-
* clicked Max — manual over-typed amounts must still surface the unviable state.
|
|
2934
|
-
*/
|
|
2935
|
-
max?: boolean;
|
|
3272
|
+
/** A simple orderbook level without venue attribution. */
|
|
3273
|
+
interface SimpleOrderbookLevel {
|
|
3274
|
+
price: number;
|
|
3275
|
+
size: number;
|
|
2936
3276
|
}
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
interface WithdrawalLeg {
|
|
2942
|
-
type: WithdrawalLegType;
|
|
2943
|
-
status: WithdrawalLegStatus;
|
|
2944
|
-
sourceChainId: number;
|
|
2945
|
-
destChainId: number;
|
|
2946
|
-
amountRaw: string;
|
|
2947
|
-
txHash: string | null;
|
|
2948
|
-
bridgeOperationId: string | null;
|
|
2949
|
-
/** Human-readable failure reason when `status === "failed"`. Null when succeeded or in-flight. */
|
|
2950
|
-
errorMessage?: string | null;
|
|
3277
|
+
/** Per-venue best-bid/ask info. */
|
|
3278
|
+
interface VenuePriceInfo {
|
|
3279
|
+
bestBid: number | null;
|
|
3280
|
+
bestAsk: number | null;
|
|
2951
3281
|
}
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
3282
|
+
/** Response from GET /orderbook/:venueMarketId — canonical aggregated orderbook. */
|
|
3283
|
+
interface AggregatedOrderbookResponse {
|
|
3284
|
+
venueMarketId: string;
|
|
3285
|
+
orderbook: {
|
|
3286
|
+
bids: AggregatedOrderbookLevel[];
|
|
3287
|
+
asks: AggregatedOrderbookLevel[];
|
|
3288
|
+
};
|
|
3289
|
+
venueOrderbooks: Record<string, {
|
|
3290
|
+
bids: SimpleOrderbookLevel[];
|
|
3291
|
+
asks: SimpleOrderbookLevel[];
|
|
3292
|
+
}>;
|
|
3293
|
+
venues: Record<string, VenuePriceInfo>;
|
|
3294
|
+
midpoint: number | null;
|
|
3295
|
+
spread: number | null;
|
|
3296
|
+
timestamp: number;
|
|
3297
|
+
/** Sequence number (present in live responses). */
|
|
3298
|
+
seq?: number;
|
|
3299
|
+
/** CRC32 checksum (present in live responses). */
|
|
3300
|
+
checksum?: number | null;
|
|
3301
|
+
/** Markets matched across venues for this canonical market. */
|
|
3302
|
+
matchedMarkets?: Array<{
|
|
3303
|
+
venue: string;
|
|
3304
|
+
venueMarketId: string;
|
|
3305
|
+
}>;
|
|
3306
|
+
}
|
|
3307
|
+
interface ExecuteManagedParams {
|
|
3308
|
+
quoteId: string;
|
|
3309
|
+
/**
|
|
3310
|
+
* Optional idempotency key: your own id for this trade, unique within your
|
|
3311
|
+
* app. Saved on every order the quote splits into, so
|
|
3312
|
+
* `getExecutionOrders({ externalId })` returns all legs and each
|
|
3313
|
+
* `trades.filled` webhook carries it. Reusing it on a different quote is
|
|
3314
|
+
* rejected with 409.
|
|
2961
3315
|
*/
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
custodyKind?: "DEPOSIT_WALLET" | "VENUE_ACCOUNT";
|
|
2966
|
-
/** Venue that owns the source (for example, `pred` or `tiprun`). */
|
|
2967
|
-
venue?: string;
|
|
2968
|
-
sourceVenueAccountId?: string;
|
|
2969
|
-
/** Lossless native account ID, not an EVM address. */
|
|
2970
|
-
sourceExternalAccountId?: string;
|
|
2971
|
-
status: WithdrawalSourceStatus;
|
|
2972
|
-
txHash: string | null;
|
|
2973
|
-
bridgeOperationId: string | null;
|
|
3316
|
+
externalId?: string;
|
|
3317
|
+
/** Trading mode. Defaults to live. */
|
|
3318
|
+
mode?: ExecutionMode;
|
|
2974
3319
|
/**
|
|
2975
|
-
*
|
|
2976
|
-
*
|
|
2977
|
-
*
|
|
3320
|
+
* Optional intent fallback. When the supplied `quoteId` has expired in the
|
|
3321
|
+
* cache (e.g. user clicked Buy after a tab was inactive), the server
|
|
3322
|
+
* resolves the latest quote for this intent and refreshes/executes against
|
|
3323
|
+
* that instead of returning 400 `quote_not_found`. Same intent = same buttons
|
|
3324
|
+
* the user pressed in the UI; a different `maxSpend`, mode, or venue scope is
|
|
3325
|
+
* a different intent and won't match.
|
|
2978
3326
|
*/
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
*/
|
|
2986
|
-
interface WithdrawalExpected {
|
|
2987
|
-
outputRaw: string | null;
|
|
2988
|
-
feeRaw: string | null;
|
|
2989
|
-
etaSeconds: number | null;
|
|
2990
|
-
}
|
|
2991
|
-
/** Body for POST /execution/withdraw/preview — identical to a withdraw request. */
|
|
2992
|
-
type WithdrawPreviewParams = WithdrawManagedParams;
|
|
2993
|
-
interface WithdrawalQuoteParams {
|
|
2994
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2995
|
-
destinationChainId: number;
|
|
2996
|
-
}
|
|
2997
|
-
interface WithdrawalQuoteResponse {
|
|
2998
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
2999
|
-
destinationChainId: number;
|
|
3000
|
-
maxDeliverableRaw: string;
|
|
3001
|
-
rawBalanceRaw: string;
|
|
3002
|
-
decimals: number;
|
|
3003
|
-
}
|
|
3004
|
-
/** Response from POST /execution/withdraw/preview. All amounts are raw strings in destination-token native decimals. */
|
|
3005
|
-
interface WithdrawPreviewResponse {
|
|
3006
|
-
receiveAmountRaw: string | null;
|
|
3007
|
-
feeRaw: string | null;
|
|
3008
|
-
relayFeeRaw: string | null;
|
|
3009
|
-
networkFeeRaw: string | null;
|
|
3010
|
-
pricingStatus: "quoted" | "unviable";
|
|
3011
|
-
quoteExpiresAt: string | null;
|
|
3012
|
-
unviableReason: string | null;
|
|
3013
|
-
maxDeliverableRaw: string | null;
|
|
3014
|
-
}
|
|
3015
|
-
interface WithdrawManagedResponse {
|
|
3016
|
-
withdrawalId: string;
|
|
3017
|
-
status: WithdrawalLifecycleStatus;
|
|
3018
|
-
requested: {
|
|
3019
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
3020
|
-
amountRaw: string;
|
|
3327
|
+
fallbackToLatest?: {
|
|
3328
|
+
outcomeId: string;
|
|
3329
|
+
side: "buy" | "sell";
|
|
3330
|
+
maxSpend?: number;
|
|
3331
|
+
sellShares?: number;
|
|
3332
|
+
allowedVenues?: Venue[];
|
|
3021
3333
|
};
|
|
3022
3334
|
/**
|
|
3023
|
-
*
|
|
3024
|
-
*
|
|
3335
|
+
* Self-custody: the wallet that will sign this fill. Must be a wallet
|
|
3336
|
+
* already linked to this account. Omit for managed custody (the default).
|
|
3025
3337
|
*/
|
|
3026
|
-
|
|
3027
|
-
destination: {
|
|
3028
|
-
chainId: number;
|
|
3029
|
-
address: string;
|
|
3030
|
-
tokenSymbol: WithdrawTokenSymbol;
|
|
3031
|
-
};
|
|
3032
|
-
legs: WithdrawalLeg[];
|
|
3033
|
-
expected: WithdrawalExpected;
|
|
3034
|
-
pricingStatus: "unquoted" | "quoting" | "quoted" | "unviable";
|
|
3338
|
+
signingAddress?: string;
|
|
3035
3339
|
/**
|
|
3036
|
-
*
|
|
3037
|
-
*
|
|
3038
|
-
* returns `null`; populated values arrive via the GET status endpoint or
|
|
3039
|
-
* via a terminal `withdrawal_lifecycle` WS event.
|
|
3340
|
+
* Self-custody buys only: other wallets linked to this account whose balances
|
|
3341
|
+
* may fund the fill. Must match the set the quote was priced with.
|
|
3040
3342
|
*/
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3343
|
+
fundingAddresses?: string[];
|
|
3344
|
+
/**
|
|
3345
|
+
* Self-custody only: which approve shape a cross-chain fill uses when the
|
|
3346
|
+
* bridge needs an ERC20 approve. Omit (the default) for "sponsored" — the
|
|
3347
|
+
* approve costs the wallet no gas, but the wallet must sign a one-time
|
|
3348
|
+
* EIP-7702 authorization over a RAW DIGEST, which many wallets cannot
|
|
3349
|
+
* produce. Send "user_broadcast" when yours cannot: the user sends the
|
|
3350
|
+
* approve from their own wallet and pays its gas. Only your client can know
|
|
3351
|
+
* which applies — it is a property of the wallet software, not of the
|
|
3352
|
+
* address or the chain.
|
|
3353
|
+
*
|
|
3354
|
+
* Worth surfacing in your UI: "user_broadcast" never establishes the
|
|
3355
|
+
* delegation, so an approve is needed on EVERY bridge. "sponsored" costs one
|
|
3356
|
+
* signature once per chain.
|
|
3357
|
+
*
|
|
3358
|
+
* Neither mode makes bridging free — the approve is only one of the costs.
|
|
3359
|
+
* Relay's fee comes out of the amount delivered on every bridge, and one-time
|
|
3360
|
+
* costs apply per route. Quote with `deepEstimate` and read
|
|
3361
|
+
* `feeBreakdown.bridgeFees` and `feeBreakdown.setupCosts` rather than
|
|
3362
|
+
* inferring cost from the approve mode.
|
|
3363
|
+
*/
|
|
3364
|
+
approveMode?: "sponsored" | "user_broadcast";
|
|
3062
3365
|
}
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
status
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3366
|
+
interface ExecuteManagedResponse {
|
|
3367
|
+
alreadyAccepted?: boolean;
|
|
3368
|
+
quoteId: string;
|
|
3369
|
+
orderIds: string[];
|
|
3370
|
+
status: "pending";
|
|
3371
|
+
redeemId?: string;
|
|
3372
|
+
message?: string;
|
|
3373
|
+
/**
|
|
3374
|
+
* What this fill is waiting to be signed, if anything. On the immediate
|
|
3375
|
+
* `POST /execution/fill` response this is always absent or empty — even
|
|
3376
|
+
* for a self-custody fill, the DAG parks asynchronously, after this
|
|
3377
|
+
* response has already been sent. Real entries only ever come back from
|
|
3378
|
+
* polling `GET /execution/status` or from the next
|
|
3379
|
+
* `POST /execution/fill/:quoteId/signatures` response (this same shape,
|
|
3380
|
+
* reused). Drive the whole round trip through `fillSelfCustody()` rather
|
|
3381
|
+
* than reading this field on the fill response by hand.
|
|
3382
|
+
*/
|
|
3383
|
+
pendingSignatures?: SignatureRequest[];
|
|
3071
3384
|
}
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3385
|
+
type LimitOrderTimeInForce = "GTC" | "GTD" | "FOK" | "FAK" | "IOC" | "ALO";
|
|
3386
|
+
type CancelOrderSignature = {
|
|
3387
|
+
signature: string;
|
|
3388
|
+
timestamp: number;
|
|
3389
|
+
} | {
|
|
3390
|
+
venue: "hyperliquid";
|
|
3391
|
+
action: {
|
|
3392
|
+
type: "cancel";
|
|
3393
|
+
cancels: Array<{
|
|
3394
|
+
a: number;
|
|
3395
|
+
o: number;
|
|
3396
|
+
}>;
|
|
3397
|
+
};
|
|
3398
|
+
nonce: number;
|
|
3399
|
+
signature: {
|
|
3400
|
+
r: string;
|
|
3401
|
+
s: string;
|
|
3402
|
+
v: 27 | 28;
|
|
3403
|
+
};
|
|
3404
|
+
};
|
|
3405
|
+
interface CancelVenueOrderParams {
|
|
3406
|
+
venue: "polymarket" | "hyperliquid";
|
|
3407
|
+
venueOrderId: string;
|
|
3408
|
+
signerAddress: string;
|
|
3409
|
+
cancelSignature: CancelOrderSignature;
|
|
3076
3410
|
}
|
|
3077
|
-
interface
|
|
3078
|
-
|
|
3411
|
+
interface PlaceLimitOrderParams {
|
|
3412
|
+
/** BETDEX uses hosted cash: GTC/IOC only, no signer, post-only or expiry.
|
|
3413
|
+
* Native odds are rounded conservatively and stake is rounded down. GTC
|
|
3414
|
+
* unmatched liquidity is cancelled at the in-play transition. SELL closes
|
|
3415
|
+
* the same For outcome and requires collateral as well as owned inventory.
|
|
3416
|
+
*/
|
|
3417
|
+
venue: Venue;
|
|
3418
|
+
venueMarketOutcomeId: string;
|
|
3079
3419
|
side: "buy" | "sell";
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3420
|
+
limitPriceRaw: string;
|
|
3421
|
+
sizeRaw: string;
|
|
3422
|
+
timeInForce: LimitOrderTimeInForce;
|
|
3423
|
+
postOnly?: boolean;
|
|
3424
|
+
expiresAt?: string;
|
|
3425
|
+
clientOrderId?: string;
|
|
3426
|
+
/** Linked account EOA. Polymarket supports GTC/GTD buys; Hyperliquid supports GTC/ALO buys and sells. Agent keys stay on the client. Omit for managed custody. */
|
|
3427
|
+
signingAddress?: string;
|
|
3428
|
+
/** Same bridge approval mode as market fills; defaults to sponsored. */
|
|
3429
|
+
approveMode?: ExecuteManagedParams["approveMode"];
|
|
3430
|
+
/** Self-custody buys only: other wallets linked to this account whose balances may bridge in to fund the order. Requires signingAddress. */
|
|
3431
|
+
fundingAddresses?: string[];
|
|
3087
3432
|
}
|
|
3088
|
-
interface
|
|
3089
|
-
|
|
3433
|
+
interface PlaceLimitOrderResponse {
|
|
3434
|
+
orderId: string;
|
|
3435
|
+
/** Poll getExecutionStatus and answer submitFillSignatures using this ID. */
|
|
3436
|
+
quoteId?: string;
|
|
3437
|
+
status: "pending" | "submitting" | "submitted" | "cancel_pending" | "partial_fill" | "open" | "partially_filled_open" | "filled" | "cancelled" | "expired" | "failed";
|
|
3438
|
+
venue: Venue;
|
|
3439
|
+
venueOrderId?: string | null;
|
|
3440
|
+
reservedCostRaw?: string | null;
|
|
3441
|
+
limitPriceRaw: string;
|
|
3442
|
+
limitSizeRaw: string;
|
|
3443
|
+
filledSizeRaw: string;
|
|
3444
|
+
remainingSizeRaw: string;
|
|
3445
|
+
}
|
|
3446
|
+
interface PlaceOrderParams {
|
|
3447
|
+
venue: Venue;
|
|
3448
|
+
venueMarketOutcomeId: string;
|
|
3090
3449
|
side: "buy" | "sell";
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3450
|
+
/** Buy only. Maximum all-in USD spend, inclusive of app fee. */
|
|
3451
|
+
maxSpend?: number;
|
|
3452
|
+
/** Sell only. Number of contracts to sell. */
|
|
3453
|
+
sellShares?: number;
|
|
3454
|
+
/**
|
|
3455
|
+
* Your trade id. Required, unique within your app — two different users of
|
|
3456
|
+
* the same app cannot share one. A repeat returns 409 instead of trading twice.
|
|
3457
|
+
*/
|
|
3458
|
+
externalId: string;
|
|
3459
|
+
/** Slippage cap in bps. Defaults to 500 (5%). Set explicitly on sells. */
|
|
3460
|
+
slipCapBps?: number;
|
|
3461
|
+
/** Restrict funding to these chain IDs. Omit to allow every funded chain. */
|
|
3462
|
+
allowedSourceChainIds?: number[];
|
|
3463
|
+
/** USD budgets capped by refreshed wallet balances; omitted chains cannot fund. */
|
|
3464
|
+
chainBalances?: Record<string, number>;
|
|
3465
|
+
/** Per-trade app fee in bips (0..10000), replacing the app's configured rate. Needs an app API key. Buy only. */
|
|
3466
|
+
appFeeBips?: number;
|
|
3467
|
+
/** Per-venue app fee in bips (each 0..10000), e.g. `{ polymarket: 20, hyperliquid: 10 }`. Wins over `appFeeBips` on the venues it names; `appFeeBips` still covers the rest. Needs an app API key. Buy only. */
|
|
3468
|
+
appFeeBipsByVenue?: Record<string, number>;
|
|
3469
|
+
/** Referral: EVM address that receives the referral fee. Needs an app API key. */
|
|
3470
|
+
referrer?: string;
|
|
3471
|
+
/** Referral fee in bips of routed notional (1..10000). Snag-free. */
|
|
3472
|
+
referrerFeeBips?: number;
|
|
3473
|
+
/** Per-venue referral fee in bips (each 0..10000; 0 = none on that venue). Wins over `referrerFeeBips` on the venues it names. Needs `referrer` and an app API key. Not for `skipQuote`. */
|
|
3474
|
+
referrerFeeBipsByVenue?: Record<string, number>;
|
|
3475
|
+
/** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
|
|
3476
|
+
referralPayer?: "user" | "app";
|
|
3477
|
+
/** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
|
|
3478
|
+
referralPayerAddress?: string;
|
|
3479
|
+
/**
|
|
3480
|
+
* User-paid referral only: a wallet that pays Hyperliquid's one-time 1 USDC
|
|
3481
|
+
* activation fee for a referrer with no HyperCore account (self-custody
|
|
3482
|
+
* Hyperliquid buys). Before the fill a pending signature with this
|
|
3483
|
+
* `signerAddress` and `purpose: "hl_activation_sponsor"` is passed to your
|
|
3484
|
+
* `signer`; it is `optional`, so declining it — or not answering within
|
|
3485
|
+
* `OPTIONAL_SIGNATURE_TIMEOUT_MS` — never costs the trade.
|
|
3486
|
+
*/
|
|
3487
|
+
referralActivationSponsorAddress?: string;
|
|
3488
|
+
/**
|
|
3489
|
+
* Skip the smart-route solver and send one order straight to `venue` (predict,
|
|
3490
|
+
* hyperliquid, novig and prophetx only; others return 400). Requires a `read_write` `x-app-api-key`. No
|
|
3491
|
+
* bridging: funds must already sit on the venue's own chain, and `allowedSourceChainIds` /
|
|
3492
|
+
* `chainBalances` are ignored alongside it. You own price and minimum
|
|
3493
|
+
* checks — an order the venue refuses fails after acceptance and uses up its `externalId`.
|
|
3494
|
+
*/
|
|
3495
|
+
skipQuote?: boolean;
|
|
3496
|
+
/**
|
|
3497
|
+
* With `skipQuote`, skip the balance check and fund hold on a buy: nothing checks the
|
|
3498
|
+
* balance and an underfunded order fails at the venue. Sells still check the position.
|
|
3499
|
+
* Without `skipQuote`, skip only the quote-time balance refresh: the route uses the last
|
|
3500
|
+
* stored balances, and the fund hold and balance check still run. Faster, but a stale
|
|
3501
|
+
* balance can fail the order after it was accepted. Requires a `read_write` `x-app-api-key`.
|
|
3502
|
+
*/
|
|
3503
|
+
skipBalance?: boolean;
|
|
3504
|
+
/**
|
|
3505
|
+
* With `skipQuote`, the price to trade at (e.g. `0.52`). Optional: if omitted, the best
|
|
3506
|
+
* available price at submission is used (best ask to buy, bid to sell). Ignored on
|
|
3507
|
+
* prophetx, which prices the order itself within `slipCapBps`.
|
|
3508
|
+
*/
|
|
3509
|
+
price?: number;
|
|
3097
3510
|
}
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3511
|
+
interface PlaceOrderResponse {
|
|
3512
|
+
orderId: string;
|
|
3513
|
+
externalId: string;
|
|
3514
|
+
venue: Venue;
|
|
3515
|
+
status: "pending";
|
|
3103
3516
|
quoteId: string;
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
currentSequence: number;
|
|
3111
|
-
currentStepType: string | null;
|
|
3112
|
-
completedSequences: number[];
|
|
3113
|
-
stepTypes: Record<number, string>;
|
|
3114
|
-
status: "running" | "completed" | "failed";
|
|
3115
|
-
errorReason: string | null;
|
|
3517
|
+
/** `null` if the order row doesn't carry a quoted price. Not zero. */
|
|
3518
|
+
quotedPriceRaw: string | null;
|
|
3519
|
+
/** `null` under the same conditions as `quotedPriceRaw`. Not zero. */
|
|
3520
|
+
quotedCostRaw: string | null;
|
|
3521
|
+
/** `null` under the same conditions as `quotedPriceRaw`. Not zero. */
|
|
3522
|
+
quotedSharesRaw: string | null;
|
|
3116
3523
|
}
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3524
|
+
interface ValidateManagedParams {
|
|
3525
|
+
venueMarketOutcomeIds: string[];
|
|
3526
|
+
side: "buy" | "sell";
|
|
3527
|
+
amount: number;
|
|
3528
|
+
}
|
|
3529
|
+
interface ValidateManagedResponse {
|
|
3530
|
+
canExecute: boolean;
|
|
3531
|
+
availableBalanceRaw: string;
|
|
3532
|
+
requiredBalanceRaw: string;
|
|
3533
|
+
bridgeSourceChainId?: number;
|
|
3534
|
+
bridgeAmountRaw?: string;
|
|
3535
|
+
}
|
|
3536
|
+
type BalanceRefillPolicyStatus = "enabled" | "paused";
|
|
3537
|
+
type BalanceRefillAttemptStatus = "reserved" | "executing" | "completed" | "failed";
|
|
3538
|
+
interface BalanceRefillAttempt {
|
|
3539
|
+
id: string;
|
|
3540
|
+
policyId: string;
|
|
3541
|
+
status: BalanceRefillAttemptStatus;
|
|
3542
|
+
/** Target-chain balance when the threshold was crossed, in 6-decimal USD units. */
|
|
3543
|
+
triggerBalanceRaw: string;
|
|
3544
|
+
/** Minimum amount the refill must deliver, in 6-decimal USD units. */
|
|
3545
|
+
requestedDeliveryRaw: string;
|
|
3546
|
+
/** Reserved source amount, in 6-decimal USD units. */
|
|
3547
|
+
sourceAmountRaw: string;
|
|
3548
|
+
completedAmountRaw: string | null;
|
|
3549
|
+
sourceChainId: number;
|
|
3550
|
+
targetChainId: number;
|
|
3551
|
+
feeRaw: string | null;
|
|
3552
|
+
errorMessage: string | null;
|
|
3124
3553
|
startedAt: string | null;
|
|
3125
3554
|
completedAt: string | null;
|
|
3126
|
-
|
|
3127
|
-
/** Venue legs this step funds or executes; join to `orders[].orderId`. */
|
|
3128
|
-
orderIds: string[];
|
|
3129
|
-
/** Display class. `internal` steps are not meant to be rendered. */
|
|
3130
|
-
kind: ExecutionDisplayStepKind;
|
|
3131
|
-
/** Steps sharing a groupId render as ONE row. */
|
|
3132
|
-
groupId: string;
|
|
3133
|
-
/** Rolled-up status for the group; identical on every member. */
|
|
3134
|
-
groupStatus: ExecutionDisplayGroupStatus;
|
|
3135
|
-
/** Row copy, phrased for the current `groupStatus`. */
|
|
3136
|
-
label: string;
|
|
3137
|
-
/** Set on `kind: "bridge"` only. */
|
|
3138
|
-
bridge?: {
|
|
3139
|
-
amount: string;
|
|
3140
|
-
tokenSymbol: string;
|
|
3141
|
-
fromChain: string;
|
|
3142
|
-
toChain: string;
|
|
3143
|
-
};
|
|
3555
|
+
createdAt: string;
|
|
3144
3556
|
}
|
|
3145
|
-
interface
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3557
|
+
interface BalanceRefillPolicy {
|
|
3558
|
+
id: string;
|
|
3559
|
+
targetChainId: number;
|
|
3560
|
+
targetTokenAddress: string;
|
|
3561
|
+
targetTokenSymbol: "USDC";
|
|
3562
|
+
/** Balance floor, in 6-decimal USD units. */
|
|
3563
|
+
minimumRaw: string;
|
|
3564
|
+
/** Minimum delivered amount per refill, in 6-decimal USD units. */
|
|
3565
|
+
refillAmountRaw: string;
|
|
3566
|
+
dailyCapRaw: string;
|
|
3567
|
+
maxFeeRaw: string;
|
|
3568
|
+
status: BalanceRefillPolicyStatus;
|
|
3569
|
+
cooldownSeconds: number;
|
|
3570
|
+
lastObservedRaw: string | null;
|
|
3571
|
+
lastEvaluatedAt: string | null;
|
|
3572
|
+
nextEligibleAt: string | null;
|
|
3573
|
+
consentedAt: string;
|
|
3574
|
+
createdAt: string;
|
|
3162
3575
|
updatedAt: string;
|
|
3576
|
+
latestAttempt: BalanceRefillAttempt | null;
|
|
3163
3577
|
}
|
|
3164
|
-
interface
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
steps: ExecutionStatusStep[];
|
|
3174
|
-
orders: ExecutionStatusOrder[];
|
|
3175
|
-
/**
|
|
3176
|
-
* What this run is waiting to be signed, mirroring the fill response's
|
|
3177
|
-
* field of the same name. This is the polling route `fillSelfCustody` reads
|
|
3178
|
-
* while an on-chain step is in flight — a caller polling this route for
|
|
3179
|
-
* progress learns about newly-parked steps here too, not just from the
|
|
3180
|
-
* signatures endpoint.
|
|
3181
|
-
*/
|
|
3182
|
-
pendingSignatures?: SignatureRequest[];
|
|
3183
|
-
}
|
|
3184
|
-
type ExecutionPositionsQuery = GetPositionsQuery & {
|
|
3185
|
-
mode?: ExecutionMode;
|
|
3186
|
-
};
|
|
3187
|
-
type ExecutionPositionGroup = PositionGroup;
|
|
3188
|
-
/** Whose cash to return: the managed server wallet (default) or the account's linked wallets. */
|
|
3189
|
-
type BalanceCustody = "managed" | "self";
|
|
3190
|
-
type ManagedBalancesParams = {
|
|
3191
|
-
mode?: ExecutionMode;
|
|
3192
|
-
custody?: BalanceCustody;
|
|
3193
|
-
};
|
|
3194
|
-
type ManagedBalancesResponse = UnifiedBalanceResponse;
|
|
3195
|
-
interface PaperTradingAppOptions {
|
|
3196
|
-
/** App ID for the paper account namespace. Defaults to AggClient appId. */
|
|
3197
|
-
appId?: string;
|
|
3198
|
-
}
|
|
3199
|
-
interface PaperTradingListParams {
|
|
3200
|
-
limit?: number;
|
|
3201
|
-
cursor?: string;
|
|
3578
|
+
interface CreateBalanceRefillPolicyParams {
|
|
3579
|
+
targetChainId: number;
|
|
3580
|
+
targetTokenSymbol?: "USDC";
|
|
3581
|
+
minimumRaw: string;
|
|
3582
|
+
refillAmountRaw: string;
|
|
3583
|
+
/** Optional daily refill limit. Defaults to $1,002 in 6-decimal USD units. */
|
|
3584
|
+
dailyCapRaw?: string;
|
|
3585
|
+
/** Optional per-refill fee limit. Defaults to $2 in 6-decimal USD units. */
|
|
3586
|
+
maxFeeRaw?: string;
|
|
3202
3587
|
}
|
|
3203
|
-
interface
|
|
3204
|
-
|
|
3588
|
+
interface UpdateBalanceRefillPolicyParams {
|
|
3589
|
+
minimumRaw?: string;
|
|
3590
|
+
refillAmountRaw?: string;
|
|
3591
|
+
dailyCapRaw?: string;
|
|
3592
|
+
maxFeeRaw?: string;
|
|
3593
|
+
status?: BalanceRefillPolicyStatus;
|
|
3205
3594
|
}
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3595
|
+
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
3596
|
+
type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD" | "USD1";
|
|
3597
|
+
interface WithdrawManagedParams {
|
|
3598
|
+
/** Idempotency key for exact-amount transfers. Retry the same request, never a new key, after a lost response. Not combined with max. */
|
|
3599
|
+
requestId?: string;
|
|
3600
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
3601
|
+
amountRaw: string;
|
|
3602
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
3603
|
+
/** Recipient address. EVM destinations use 0x-prefixed 20-byte hex; Solana uses base58. */
|
|
3604
|
+
destinationAddress: string;
|
|
3605
|
+
/** Chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
3606
|
+
destinationChainId: number;
|
|
3607
|
+
/**
|
|
3608
|
+
* When `true`, the server caps the withdrawal to the maximum deliverable amount
|
|
3609
|
+
* instead of rejecting an over-balance request. Use only when the user explicitly
|
|
3610
|
+
* clicked Max — manual over-typed amounts must still surface the unviable state.
|
|
3611
|
+
*/
|
|
3612
|
+
max?: boolean;
|
|
3613
|
+
/**
|
|
3614
|
+
* Self-custody: the linked EVM wallet that owns and signs this withdrawal.
|
|
3615
|
+
* `amountRaw` is then the amount debited (fees come out of it) and `max` is
|
|
3616
|
+
* not supported. Omit for managed custody.
|
|
3617
|
+
*/
|
|
3618
|
+
signingAddress?: string;
|
|
3619
|
+
/**
|
|
3620
|
+
* Self-custody only: what the signing wallet can sign. Send the same value to
|
|
3621
|
+
* `getWithdrawalQuote`, `withdrawPreview` and `withdrawManaged`. `"sponsored"`
|
|
3622
|
+
* (default): it can sign an EIP-7702 authorization and Calibur batch.
|
|
3623
|
+
* `"user_broadcast"`: it cannot (e.g. MetaMask); the withdrawal still never
|
|
3624
|
+
* asks for gas, and sources that would need a batch are left out.
|
|
3625
|
+
*/
|
|
3626
|
+
approveMode?: "sponsored" | "user_broadcast";
|
|
3211
3627
|
}
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3628
|
+
type WithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
3629
|
+
type WithdrawalSourceStatus = "pending" | "submitted" | "confirmed" | "failed";
|
|
3630
|
+
type WithdrawalLegType = "transfer" | "bridge";
|
|
3631
|
+
type WithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
3632
|
+
interface WithdrawalLeg {
|
|
3633
|
+
type: WithdrawalLegType;
|
|
3634
|
+
status: WithdrawalLegStatus;
|
|
3635
|
+
sourceChainId: number;
|
|
3636
|
+
destChainId: number;
|
|
3637
|
+
amountRaw: string;
|
|
3638
|
+
txHash: string | null;
|
|
3639
|
+
bridgeOperationId: string | null;
|
|
3640
|
+
/** Human-readable failure reason when `status === "failed"`. Null when succeeded or in-flight. */
|
|
3641
|
+
errorMessage?: string | null;
|
|
3216
3642
|
}
|
|
3217
|
-
interface
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3643
|
+
interface WithdrawManagedSourceItem {
|
|
3644
|
+
sourceId: string;
|
|
3645
|
+
chainId: number;
|
|
3646
|
+
tokenSymbol: WithdrawalSourceTokenSymbol;
|
|
3647
|
+
/** On-chain token address on `chainId`. */
|
|
3648
|
+
tokenAddress: string;
|
|
3649
|
+
/**
|
|
3650
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Required to interpret
|
|
3651
|
+
* `amountRaw`: BNB USDC is 18-dec, EVM USDC is 6-dec.
|
|
3652
|
+
*/
|
|
3653
|
+
decimals: number;
|
|
3654
|
+
amountRaw: string;
|
|
3655
|
+
/** Smart-wallet or native-account custody; absent for ordinary EOA sources. */
|
|
3656
|
+
custodyKind?: "DEPOSIT_WALLET" | "VENUE_ACCOUNT";
|
|
3657
|
+
/** Venue that owns the source (for example, `pred` or `tiprun`). */
|
|
3658
|
+
venue?: string;
|
|
3659
|
+
sourceVenueAccountId?: string;
|
|
3660
|
+
/** Lossless native account ID, not an EVM address. */
|
|
3661
|
+
sourceExternalAccountId?: string;
|
|
3662
|
+
status: WithdrawalSourceStatus;
|
|
3663
|
+
txHash: string | null;
|
|
3664
|
+
bridgeOperationId: string | null;
|
|
3665
|
+
/**
|
|
3666
|
+
* Present only while a venue-account source is submitted but not confirmed:
|
|
3667
|
+
* what it is waiting on (`awaiting_venue_approval` = the venue has not
|
|
3668
|
+
* approved the withdrawal yet).
|
|
3669
|
+
*/
|
|
3670
|
+
pendingReason?: "awaiting_venue_submission" | "awaiting_venue_approval" | "awaiting_chain" | "awaiting_venue_balance" | "rechecking";
|
|
3221
3671
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3672
|
+
/**
|
|
3673
|
+
* `pricingStatus === "quoted"` means the response includes a fresh preflight
|
|
3674
|
+
* quote; other states may carry null `expected.*` fields. Do NOT treat null
|
|
3675
|
+
* fields as missing.
|
|
3676
|
+
*/
|
|
3677
|
+
interface WithdrawalExpected {
|
|
3678
|
+
outputRaw: string | null;
|
|
3679
|
+
feeRaw: string | null;
|
|
3680
|
+
etaSeconds: number | null;
|
|
3230
3681
|
}
|
|
3231
|
-
|
|
3232
|
-
type
|
|
3233
|
-
interface
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
realizedPnlRaw: string;
|
|
3244
|
-
realizedPnl: number;
|
|
3245
|
-
kycStatus: "verified";
|
|
3246
|
-
kycVerified: true;
|
|
3247
|
-
status: "active" | "archived";
|
|
3248
|
-
createdAt: string;
|
|
3249
|
-
updatedAt: string;
|
|
3682
|
+
/** Body for POST /execution/withdraw/preview — identical to a withdraw request. */
|
|
3683
|
+
type WithdrawPreviewParams = WithdrawManagedParams;
|
|
3684
|
+
interface WithdrawalQuoteParams {
|
|
3685
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
3686
|
+
destinationChainId: number;
|
|
3687
|
+
/**
|
|
3688
|
+
* Self-custody: quote the Max of this linked EVM wallet (the amount it can
|
|
3689
|
+
* debit) instead of the managed wallet. Same field as `withdrawManaged`.
|
|
3690
|
+
*/
|
|
3691
|
+
signingAddress?: string;
|
|
3692
|
+
/** Self-custody only: same field as `withdrawManaged`. Max excludes what this mode cannot spend. */
|
|
3693
|
+
approveMode?: "sponsored" | "user_broadcast";
|
|
3250
3694
|
}
|
|
3251
|
-
interface
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3695
|
+
interface WithdrawalQuoteResponse {
|
|
3696
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
3697
|
+
destinationChainId: number;
|
|
3698
|
+
maxDeliverableRaw: string;
|
|
3699
|
+
rawBalanceRaw: string;
|
|
3700
|
+
decimals: number;
|
|
3701
|
+
}
|
|
3702
|
+
/** Response from POST /execution/withdraw/preview. All amounts are raw strings in destination-token native decimals. */
|
|
3703
|
+
interface WithdrawPreviewResponse {
|
|
3704
|
+
receiveAmountRaw: string | null;
|
|
3705
|
+
feeRaw: string | null;
|
|
3706
|
+
relayFeeRaw: string | null;
|
|
3707
|
+
networkFeeRaw: string | null;
|
|
3708
|
+
pricingStatus: "quoted" | "unviable";
|
|
3709
|
+
quoteExpiresAt: string | null;
|
|
3710
|
+
unviableReason: string | null;
|
|
3711
|
+
maxDeliverableRaw: string | null;
|
|
3712
|
+
}
|
|
3713
|
+
interface WithdrawManagedResponse {
|
|
3714
|
+
withdrawalId: string;
|
|
3715
|
+
status: WithdrawalLifecycleStatus;
|
|
3716
|
+
requested: {
|
|
3717
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
3718
|
+
amountRaw: string;
|
|
3719
|
+
};
|
|
3720
|
+
/**
|
|
3721
|
+
* Terminal settled amount in destination-token native decimals.
|
|
3722
|
+
* Null until at least one source confirms.
|
|
3723
|
+
*/
|
|
3724
|
+
completedAmountRaw: string | null;
|
|
3725
|
+
destination: {
|
|
3726
|
+
chainId: number;
|
|
3727
|
+
address: string;
|
|
3728
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
3729
|
+
};
|
|
3730
|
+
legs: WithdrawalLeg[];
|
|
3731
|
+
expected: WithdrawalExpected;
|
|
3732
|
+
pricingStatus: "unquoted" | "quoting" | "quoted" | "unviable";
|
|
3733
|
+
/**
|
|
3734
|
+
* Persisted terminal-state error reason. Always `null` until the
|
|
3735
|
+
* withdrawal reaches `failed` / `partial`. The submit response always
|
|
3736
|
+
* returns `null`; populated values arrive via the GET status endpoint or
|
|
3737
|
+
* via a terminal `withdrawal_lifecycle` WS event.
|
|
3738
|
+
*/
|
|
3739
|
+
errorMessage: string | null;
|
|
3740
|
+
sources: WithdrawManagedSourceItem[];
|
|
3741
|
+
/** Self-custody only: signatures to answer via `submitWithdrawalSignatures`. */
|
|
3742
|
+
pendingSignatures?: SignatureRequest[];
|
|
3743
|
+
}
|
|
3744
|
+
/** One answer to a `pendingSignatures` entry (fill or withdrawal): a `signature`, or a `txHash` for broadcast steps. */
|
|
3745
|
+
interface SubmitSignature {
|
|
3746
|
+
stepId: string;
|
|
3747
|
+
signature?: string;
|
|
3748
|
+
txHash?: string;
|
|
3749
|
+
}
|
|
3750
|
+
interface DepositAddressesToken {
|
|
3751
|
+
symbol: string;
|
|
3752
|
+
address: string;
|
|
3753
|
+
decimals: number;
|
|
3754
|
+
}
|
|
3755
|
+
interface DepositAddressesSupportedChain {
|
|
3756
|
+
chainId: number;
|
|
3757
|
+
name: string;
|
|
3758
|
+
tokens: DepositAddressesToken[];
|
|
3759
|
+
}
|
|
3760
|
+
interface DepositAddressesReadyResponse {
|
|
3761
|
+
ready: true;
|
|
3762
|
+
evmAddress: string;
|
|
3763
|
+
svmAddress: string;
|
|
3764
|
+
supportedChains: DepositAddressesSupportedChain[];
|
|
3765
|
+
}
|
|
3766
|
+
interface DepositAddressesPendingResponse {
|
|
3767
|
+
ready: false;
|
|
3768
|
+
}
|
|
3769
|
+
type DepositAddressesResponse = DepositAddressesReadyResponse | DepositAddressesPendingResponse;
|
|
3770
|
+
interface GetPositionsParams {
|
|
3771
|
+
cursor?: string;
|
|
3772
|
+
limit?: number;
|
|
3773
|
+
status?: "active" | "closed";
|
|
3774
|
+
mode?: ExecutionMode;
|
|
3775
|
+
categoryIds?: string[];
|
|
3776
|
+
sort?: "realizedPnl";
|
|
3777
|
+
}
|
|
3778
|
+
interface GetOrdersParams {
|
|
3779
|
+
status?: string;
|
|
3780
|
+
cursor?: string;
|
|
3781
|
+
limit?: number;
|
|
3782
|
+
}
|
|
3783
|
+
interface OrderbookQuoteParams {
|
|
3784
|
+
marketId: string;
|
|
3785
|
+
side: "buy" | "sell";
|
|
3259
3786
|
size: number;
|
|
3260
|
-
avgEntryPrice: number;
|
|
3261
|
-
markPrice: number;
|
|
3262
|
-
markSource: PaperTradingMarkSource;
|
|
3263
|
-
markTimestamp: number | null;
|
|
3264
|
-
bestBidPrice: number | null;
|
|
3265
|
-
bestAskPrice: number | null;
|
|
3266
|
-
midpoint: number | null;
|
|
3267
|
-
spread: number | null;
|
|
3268
|
-
marketValueRaw: string;
|
|
3269
|
-
marketValue: number;
|
|
3270
|
-
unrealizedPnlRaw: string;
|
|
3271
|
-
unrealizedPnl: number;
|
|
3272
|
-
liquidationPrice: number | null;
|
|
3273
|
-
liquidationValueRaw: string;
|
|
3274
|
-
liquidationValue: number;
|
|
3275
|
-
liquidationPnlRaw: string;
|
|
3276
|
-
liquidationPnl: number;
|
|
3277
|
-
liquidityShares: number;
|
|
3278
|
-
liquidityStatus: PaperTradingLiquidityStatus;
|
|
3279
|
-
realizedPnlRaw: string;
|
|
3280
|
-
realizedPnl: number;
|
|
3281
|
-
createdAt: string;
|
|
3282
|
-
updatedAt: string;
|
|
3283
3787
|
}
|
|
3284
|
-
interface
|
|
3285
|
-
id: string;
|
|
3286
|
-
accountId: string;
|
|
3788
|
+
interface OrderbookQuoteFill {
|
|
3287
3789
|
venue: string;
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3790
|
+
size: number;
|
|
3791
|
+
avgPrice: number;
|
|
3792
|
+
cost: number;
|
|
3793
|
+
}
|
|
3794
|
+
interface OrderbookQuoteResponse {
|
|
3795
|
+
marketId: string;
|
|
3796
|
+
side: "buy" | "sell";
|
|
3797
|
+
requestedSize: number;
|
|
3798
|
+
filledSize: number;
|
|
3799
|
+
avgPrice: number | null;
|
|
3800
|
+
totalCost: number;
|
|
3801
|
+
slippage: number | null;
|
|
3802
|
+
fills: OrderbookQuoteFill[];
|
|
3803
|
+
}
|
|
3804
|
+
type ExecutionOrdersQuery = GetOrdersQuery & {
|
|
3805
|
+
mode?: ExecutionMode;
|
|
3806
|
+
};
|
|
3807
|
+
type ExecutionOrderItem = OrderListItem;
|
|
3808
|
+
type ExecutionStatusQuery = {
|
|
3809
|
+
quoteId: string;
|
|
3810
|
+
mode?: ExecutionMode;
|
|
3811
|
+
};
|
|
3812
|
+
type ExecutionOverallState = "created" | "routing" | "quoting" | "placing" | "confirming" | "filled" | "partially_filled" | "failed" | "cancelled" | "expired";
|
|
3813
|
+
interface ExecutionDagProgress {
|
|
3814
|
+
dagRunId: string;
|
|
3815
|
+
totalSteps: number;
|
|
3816
|
+
currentSequence: number;
|
|
3817
|
+
currentStepType: string | null;
|
|
3818
|
+
completedSequences: number[];
|
|
3819
|
+
stepTypes: Record<number, string>;
|
|
3820
|
+
status: "running" | "completed" | "failed";
|
|
3821
|
+
errorReason: string | null;
|
|
3822
|
+
}
|
|
3823
|
+
type ExecutionDisplayStepKind = "submit" | "setup" | "bridge" | "fill" | "internal";
|
|
3824
|
+
type ExecutionDisplayGroupStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
|
|
3825
|
+
interface ExecutionStatusStep {
|
|
3826
|
+
sequence: number;
|
|
3827
|
+
stepType: string;
|
|
3828
|
+
status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
|
|
3829
|
+
attempt: number;
|
|
3830
|
+
startedAt: string | null;
|
|
3831
|
+
completedAt: string | null;
|
|
3832
|
+
errorReason: string | null;
|
|
3833
|
+
/** Venue legs this step funds or executes; join to `orders[].orderId`. */
|
|
3834
|
+
orderIds: string[];
|
|
3835
|
+
/** Display class. `internal` steps are not meant to be rendered. */
|
|
3836
|
+
kind: ExecutionDisplayStepKind;
|
|
3837
|
+
/** Steps sharing a groupId render as ONE row. */
|
|
3838
|
+
groupId: string;
|
|
3839
|
+
/** Rolled-up status for the group; identical on every member. */
|
|
3840
|
+
groupStatus: ExecutionDisplayGroupStatus;
|
|
3841
|
+
/** Row copy, phrased for the current `groupStatus`. */
|
|
3842
|
+
label: string;
|
|
3843
|
+
/** Set on `kind: "bridge"` only. */
|
|
3844
|
+
bridge?: {
|
|
3845
|
+
amount: string;
|
|
3846
|
+
tokenSymbol: string;
|
|
3847
|
+
fromChain: string;
|
|
3848
|
+
toChain: string;
|
|
3849
|
+
};
|
|
3850
|
+
}
|
|
3851
|
+
interface ExecutionStatusOrder {
|
|
3852
|
+
orderId: string;
|
|
3853
|
+
venue: string;
|
|
3854
|
+
status: string;
|
|
3855
|
+
event: "filled" | "partial_fill" | "failed" | null;
|
|
3856
|
+
filledAmountRaw?: string;
|
|
3857
|
+
remainingAmountRaw?: string;
|
|
3858
|
+
quotedSharesRaw?: string;
|
|
3859
|
+
actualSharesRaw?: string;
|
|
3860
|
+
quotedToWinRaw?: string;
|
|
3861
|
+
actualToWinRaw?: string;
|
|
3862
|
+
quotedPriceRaw?: string;
|
|
3863
|
+
executionPriceRaw?: string;
|
|
3864
|
+
partialFillReason?: string;
|
|
3865
|
+
errorReason?: string;
|
|
3866
|
+
venueOrderId?: string;
|
|
3867
|
+
txHash?: string;
|
|
3868
|
+
/** The venue matched the order and its fill awaits venue confirmation. Not a fill. */
|
|
3869
|
+
matchedAt?: string;
|
|
3870
|
+
updatedAt: string;
|
|
3871
|
+
}
|
|
3872
|
+
interface ExecutionStatusResponse {
|
|
3873
|
+
executionId: string | null;
|
|
3874
|
+
quoteId: string;
|
|
3875
|
+
orderIds: string[];
|
|
3876
|
+
overallState: ExecutionOverallState;
|
|
3877
|
+
terminal: boolean;
|
|
3878
|
+
errorReason: string | null;
|
|
3879
|
+
pollAfterMs: number | null;
|
|
3880
|
+
dagProgress: ExecutionDagProgress | null;
|
|
3881
|
+
steps: ExecutionStatusStep[];
|
|
3882
|
+
orders: ExecutionStatusOrder[];
|
|
3883
|
+
/**
|
|
3884
|
+
* What this run is waiting to be signed, mirroring the fill response's
|
|
3885
|
+
* field of the same name. This is the polling route `fillSelfCustody` reads
|
|
3886
|
+
* while an on-chain step is in flight — a caller polling this route for
|
|
3887
|
+
* progress learns about newly-parked steps here too, not just from the
|
|
3888
|
+
* signatures endpoint.
|
|
3889
|
+
*/
|
|
3890
|
+
pendingSignatures?: SignatureRequest[];
|
|
3891
|
+
}
|
|
3892
|
+
type ExecutionPositionsQuery = GetPositionsQuery & {
|
|
3893
|
+
mode?: ExecutionMode;
|
|
3894
|
+
};
|
|
3895
|
+
type ExecutionPositionGroup = PositionGroup;
|
|
3896
|
+
/** Whose cash to return: the managed server wallet (default) or the account's linked wallets. */
|
|
3897
|
+
type BalanceCustody = "managed" | "self";
|
|
3898
|
+
type ManagedBalancesParams = {
|
|
3899
|
+
mode?: ExecutionMode;
|
|
3900
|
+
custody?: BalanceCustody;
|
|
3901
|
+
};
|
|
3902
|
+
type ManagedBalancesResponse = UnifiedBalanceResponse;
|
|
3903
|
+
interface PaperTradingAppOptions {
|
|
3904
|
+
/** App ID for the paper account namespace. Defaults to AggClient appId. */
|
|
3905
|
+
appId?: string;
|
|
3906
|
+
}
|
|
3907
|
+
interface PaperTradingListParams {
|
|
3908
|
+
limit?: number;
|
|
3909
|
+
cursor?: string;
|
|
3910
|
+
}
|
|
3911
|
+
interface PaperTradingAccountListParams extends PaperTradingListParams {
|
|
3912
|
+
externalId?: string;
|
|
3913
|
+
}
|
|
3914
|
+
interface CreatePaperTradingAccountParams {
|
|
3915
|
+
name?: string;
|
|
3916
|
+
externalId?: string;
|
|
3917
|
+
initialBalanceRaw?: string;
|
|
3918
|
+
initialBalance?: number;
|
|
3919
|
+
}
|
|
3920
|
+
interface SetPaperTradingBalanceParams {
|
|
3921
|
+
balanceRaw?: string;
|
|
3922
|
+
balance?: number;
|
|
3923
|
+
reason?: string;
|
|
3924
|
+
}
|
|
3925
|
+
interface ResetPaperTradingAccountParams {
|
|
3926
|
+
balanceRaw?: string;
|
|
3927
|
+
balance?: number;
|
|
3928
|
+
reason?: string;
|
|
3929
|
+
}
|
|
3930
|
+
interface PlacePaperTradingOrderParams {
|
|
3931
|
+
venueMarketOutcomeId: string;
|
|
3932
|
+
side: "buy" | "sell";
|
|
3933
|
+
spendRaw?: string;
|
|
3934
|
+
spend?: number;
|
|
3935
|
+
shares?: number;
|
|
3936
|
+
slippageBps?: number;
|
|
3937
|
+
clientOrderId?: string;
|
|
3938
|
+
}
|
|
3939
|
+
type PaperTradingMarkSource = "orderbook_midpoint" | "orderbook_best_bid" | "catalog_price";
|
|
3940
|
+
type PaperTradingLiquidityStatus = "full" | "partial" | "none";
|
|
3941
|
+
interface PaperTradingAccount {
|
|
3942
|
+
id: string;
|
|
3943
|
+
appId: string;
|
|
3944
|
+
name: string | null;
|
|
3945
|
+
externalId: string | null;
|
|
3946
|
+
currency: string;
|
|
3947
|
+
startingBalanceRaw: string;
|
|
3948
|
+
startingBalance: number;
|
|
3949
|
+
cashBalanceRaw: string;
|
|
3950
|
+
cashBalance: number;
|
|
3951
|
+
realizedPnlRaw: string;
|
|
3952
|
+
realizedPnl: number;
|
|
3953
|
+
kycStatus: "verified";
|
|
3954
|
+
kycVerified: true;
|
|
3955
|
+
status: "active" | "archived";
|
|
3956
|
+
createdAt: string;
|
|
3957
|
+
updatedAt: string;
|
|
3958
|
+
}
|
|
3959
|
+
interface PaperTradingPosition {
|
|
3960
|
+
id: string;
|
|
3961
|
+
accountId: string;
|
|
3962
|
+
venue: string;
|
|
3963
|
+
venueMarketId: string;
|
|
3964
|
+
venueMarketOutcomeId: string;
|
|
3965
|
+
marketQuestion: string;
|
|
3966
|
+
outcomeLabel: string;
|
|
3967
|
+
size: number;
|
|
3968
|
+
avgEntryPrice: number;
|
|
3969
|
+
markPrice: number;
|
|
3970
|
+
markSource: PaperTradingMarkSource;
|
|
3971
|
+
markTimestamp: number | null;
|
|
3972
|
+
bestBidPrice: number | null;
|
|
3973
|
+
bestAskPrice: number | null;
|
|
3974
|
+
midpoint: number | null;
|
|
3975
|
+
spread: number | null;
|
|
3976
|
+
marketValueRaw: string;
|
|
3977
|
+
marketValue: number;
|
|
3978
|
+
unrealizedPnlRaw: string;
|
|
3979
|
+
unrealizedPnl: number;
|
|
3980
|
+
liquidationPrice: number | null;
|
|
3981
|
+
liquidationValueRaw: string;
|
|
3982
|
+
liquidationValue: number;
|
|
3983
|
+
liquidationPnlRaw: string;
|
|
3984
|
+
liquidationPnl: number;
|
|
3985
|
+
liquidityShares: number;
|
|
3986
|
+
liquidityStatus: PaperTradingLiquidityStatus;
|
|
3987
|
+
realizedPnlRaw: string;
|
|
3988
|
+
realizedPnl: number;
|
|
3989
|
+
createdAt: string;
|
|
3990
|
+
updatedAt: string;
|
|
3991
|
+
}
|
|
3992
|
+
interface PaperTradingOrder {
|
|
3993
|
+
id: string;
|
|
3994
|
+
accountId: string;
|
|
3995
|
+
venue: string;
|
|
3996
|
+
venueMarketId: string;
|
|
3997
|
+
venueMarketOutcomeId: string;
|
|
3998
|
+
marketQuestion: string;
|
|
3999
|
+
outcomeLabel: string;
|
|
3292
4000
|
side: "buy" | "sell";
|
|
3293
4001
|
status: "filled" | "rejected";
|
|
3294
4002
|
clientOrderId: string | null;
|
|
@@ -4342,6 +5050,8 @@ type UserAuthResult = {
|
|
|
4342
5050
|
user: UserProfile;
|
|
4343
5051
|
};
|
|
4344
5052
|
declare class AggClient {
|
|
5053
|
+
private readonly venueEventReads;
|
|
5054
|
+
private eventReadSession;
|
|
4345
5055
|
private _appId?;
|
|
4346
5056
|
private adminKey?;
|
|
4347
5057
|
private apiKey?;
|
|
@@ -4355,6 +5065,7 @@ declare class AggClient {
|
|
|
4355
5065
|
private readonly webSocketAuthCleanups;
|
|
4356
5066
|
/** Sockets bound to this session. The browser provider keeps one. */
|
|
4357
5067
|
private readonly tradeSockets;
|
|
5068
|
+
private readonly signatureWaitListeners;
|
|
4358
5069
|
/** Token already sent on the open trade socket. Submit must not send it again. */
|
|
4359
5070
|
private tradeAuthSentForToken?;
|
|
4360
5071
|
/** User id from the latest `{ type: "authenticated" }` on the trade socket. */
|
|
@@ -4408,8 +5119,10 @@ declare class AggClient {
|
|
|
4408
5119
|
setAccessToken(token: string): void;
|
|
4409
5120
|
/** Set the current auth session tokens and optionally seed the user profile. */
|
|
4410
5121
|
setSession(session: AggClientSessionInput): void;
|
|
5122
|
+
private applySession;
|
|
4411
5123
|
/** Clear the user access token, refresh token, and user info. Broadcasts cross-tab logout. */
|
|
4412
5124
|
clearAccessToken(): void;
|
|
5125
|
+
private invalidateEventReadSession;
|
|
4413
5126
|
private broadcastAuth;
|
|
4414
5127
|
/**
|
|
4415
5128
|
* The App this client speaks for, or `undefined` for an admin-key-only
|
|
@@ -4821,709 +5534,238 @@ declare class AggClient {
|
|
|
4821
5534
|
to: number;
|
|
4822
5535
|
countBack?: number;
|
|
4823
5536
|
}, options?: {
|
|
4824
|
-
signal?: AbortSignal;
|
|
4825
|
-
decode?: (payload: string) => Promise<ChartBarsResponse>;
|
|
4826
|
-
}): Promise<ChartBarsResponse>;
|
|
4827
|
-
getChartHistoryManifest(params: {
|
|
4828
|
-
venueMarketOutcomeId: string;
|
|
4829
|
-
resolution?: ChartResolution;
|
|
4830
|
-
from?: number;
|
|
4831
|
-
to: number;
|
|
4832
|
-
countBack?: number;
|
|
4833
|
-
}, options?: {
|
|
4834
|
-
signal?: AbortSignal;
|
|
4835
|
-
}): Promise<ChartHistoryManifest>;
|
|
4836
|
-
/** Get live per-venue orderbooks for the explicit venueMarketIds requested. */
|
|
4837
|
-
getOrderbooks(params: {
|
|
4838
|
-
venueMarketIds: string[];
|
|
4839
|
-
depth?: number;
|
|
4840
|
-
}, options?: {
|
|
4841
|
-
signal?: AbortSignal;
|
|
4842
|
-
}): Promise<BatchOrderbooksResponse>;
|
|
4843
|
-
/** Get live midpoints for the explicit venueMarketIds requested. */
|
|
4844
|
-
getMidpoints(params: {
|
|
4845
|
-
venueMarketIds: string[];
|
|
4846
|
-
bestPrice?: boolean;
|
|
4847
|
-
maxMidpointIdsPerRequest?: number;
|
|
4848
|
-
}, options?: {
|
|
4849
|
-
signal?: AbortSignal;
|
|
4850
|
-
maxMidpointIdsPerRequest?: number;
|
|
4851
|
-
}): Promise<BatchMidpointsResponse>;
|
|
4852
|
-
getMidpoints(venueMarketIds: string[], options?: {
|
|
4853
|
-
signal?: AbortSignal;
|
|
4854
|
-
bestPrice?: boolean;
|
|
4855
|
-
maxMidpointIdsPerRequest?: number;
|
|
4856
|
-
}): Promise<BatchMidpointsResponse>;
|
|
4857
|
-
/** Get a single outcome-level orderbook from the engine. */
|
|
4858
|
-
getOutcomeOrderbook(outcomeId: string, options?: {
|
|
4859
|
-
depth?: number;
|
|
4860
|
-
signal?: AbortSignal;
|
|
4861
|
-
}): Promise<OutcomeOrderbookResponse | null>;
|
|
4862
|
-
/**
|
|
4863
|
-
* Compute optimal order routing across venues via the MILP solver.
|
|
4864
|
-
* Returns a user-scoped quote with per-venue fills and verification timing.
|
|
4865
|
-
* Deprecated aliases are accepted for source compatibility during the
|
|
4866
|
-
* outcome-level migration window.
|
|
4867
|
-
*/
|
|
4868
|
-
getSmartRoute(params: SmartRouteParams, options?: {
|
|
4869
|
-
signal?: AbortSignal;
|
|
4870
|
-
}): Promise<SmartRouteResponse>;
|
|
4871
|
-
/** Seed subscribed outcomes with one bounded batch of compatible snapshots. */
|
|
4872
|
-
getOutcomeOrderbooks(params: {
|
|
4873
|
-
venueMarketOutcomeIds: string[];
|
|
4874
|
-
depth?: number;
|
|
4875
|
-
}, options?: {
|
|
4876
|
-
signal?: AbortSignal;
|
|
4877
|
-
}): Promise<{
|
|
4878
|
-
data: (OutcomeOrderbookResponse | null)[];
|
|
4879
|
-
}>;
|
|
4880
|
-
/**
|
|
4881
|
-
* Create an AggWebSocket instance configured with this client's appId and current auth session.
|
|
4882
|
-
* Session changes update this socket until it or the client is destroyed.
|
|
4883
|
-
* Requires `wsUrl` to be set in the client options.
|
|
4884
|
-
*/
|
|
4885
|
-
createWebSocket(callbacks?: AggWebSocketCallbacks, options?: {
|
|
4886
|
-
enableLogs?: boolean;
|
|
4887
|
-
/**
|
|
4888
|
-
* Checks books with no update for 5 minutes against
|
|
4889
|
-
* `GET /orderbooks/outcomes` and heals any that drifted. On by default;
|
|
4890
|
-
* pass `false` to disable or an object to tune the timings.
|
|
4891
|
-
*/
|
|
4892
|
-
bookWatchdog?: false | Pick<BookWatchdogOptions, "silenceMs" | "checkIntervalMs">;
|
|
4893
|
-
/**
|
|
4894
|
-
* WebSocket implementation for runtimes without a global one (e.g. the
|
|
4895
|
-
* `ws` package on Node < 22). Node 22+ and browsers need nothing here.
|
|
4896
|
-
*/
|
|
4897
|
-
webSocketImpl?: AggWebSocketOptions["webSocketImpl"];
|
|
4898
|
-
}): AggWebSocket;
|
|
4899
|
-
private openTradeSockets;
|
|
4900
|
-
/**
|
|
4901
|
-
* User events are registered by `{ action: "authenticate" }`, not a channel
|
|
4902
|
-
* subscribe. The confirmation is `{ type: "authenticated" }`. Send that
|
|
4903
|
-
* frame only when the socket is already open and it has not been sent for
|
|
4904
|
-
* this token. Opening a socket here would lose the fill to the handshake.
|
|
4905
|
-
*/
|
|
4906
|
-
private confirmTradeSockets;
|
|
4907
|
-
private bindWebSocketAuth;
|
|
4908
|
-
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
4909
|
-
executeManaged(params: ExecuteManagedParams): Promise<ExecuteManagedResponse>;
|
|
4910
|
-
/** Submit signatures for a parked fill. Returns whatever is still outstanding. */
|
|
4911
|
-
submitFillSignatures(quoteId: string, signatures: Array<{
|
|
4912
|
-
stepId: string;
|
|
4913
|
-
signature?: string;
|
|
4914
|
-
txHash?: string;
|
|
4915
|
-
}>): Promise<ExecuteManagedResponse & {
|
|
4916
|
-
accepted?: number;
|
|
4917
|
-
}>;
|
|
4918
|
-
/**
|
|
4919
|
-
* Execute a quote in self-custodial mode.
|
|
4920
|
-
*
|
|
4921
|
-
* Identical to `executeManaged` when the server can sign for the user. When
|
|
4922
|
-
* it cannot, the DAG parks on a signature request instead — but that park
|
|
4923
|
-
* always happens asynchronously, in the trade-executor process, so it can
|
|
4924
|
-
* never show up on this `POST /execution/fill` response itself. This
|
|
4925
|
-
* drives the round trip from there: poll `getExecutionStatus` while an
|
|
4926
|
-
* on-chain step is in flight, sign whatever it hands back with the
|
|
4927
|
-
* configured `signer`, post the signatures back, and repeat until the
|
|
4928
|
-
* server reports nothing outstanding and the run reaches a terminal state.
|
|
4929
|
-
*
|
|
4930
|
-
* `options.signer` overrides the configured `signer` for this call, for an
|
|
4931
|
-
* app whose wallet signer lives outside the client (a React provider).
|
|
4932
|
-
*/
|
|
4933
|
-
fillSelfCustody(params: ExecuteManagedParams, options?: {
|
|
4934
|
-
signer?: SignerFn;
|
|
4935
|
-
}): Promise<ExecuteManagedResponse>;
|
|
4936
|
-
/**
|
|
4937
|
-
* Enqueue a limit order. For self-custody, poll getExecutionStatus with the
|
|
4938
|
-
* returned quoteId and answer pending requests through submitFillSignatures.
|
|
4939
|
-
* A pending response does not mean the order has reached the venue.
|
|
4940
|
-
*/
|
|
4941
|
-
placeLimitOrder(params: PlaceLimitOrderParams): Promise<PlaceLimitOrderResponse>;
|
|
4942
|
-
/**
|
|
4943
|
-
* Place a market order directly on a named venue — no prior quote needed.
|
|
4944
|
-
* Always produces exactly one order. `externalId` is required and unique
|
|
4945
|
-
* within your app — two different users of the same app cannot share one —
|
|
4946
|
-
* so retrying a timed-out call with the same value is safe.
|
|
4947
|
-
*/
|
|
4948
|
-
placeOrder(params: PlaceOrderParams): Promise<PlaceOrderResponse>;
|
|
4949
|
-
/** Redeem resolved winning positions by venue market outcome ids. */
|
|
4950
|
-
redeem(body: RedeemRequest): Promise<RedeemResponse>;
|
|
4951
|
-
/**
|
|
4952
|
-
* Redeem a resolved position held in a self-custody wallet. The server runs
|
|
4953
|
-
* it as a sell fill on the resolved market, so this quotes the sell and
|
|
4954
|
-
* drives `fillSelfCustody`. The same call works for every venue; the
|
|
4955
|
-
* configured `signer` sees a `transaction` (user pays gas) or one typed-data
|
|
4956
|
-
* signature (Polymarket, gasless). `options.signer` overrides it for this
|
|
4957
|
-
* call, as in `fillSelfCustody`.
|
|
4958
|
-
*/
|
|
4959
|
-
redeemSelfCustody(params: RedeemSelfCustodyParams, options?: {
|
|
4960
|
-
signer?: SignerFn;
|
|
4961
|
-
}): Promise<ExecuteManagedResponse>;
|
|
4962
|
-
/** List the authenticated user's managed balance refill policies. */
|
|
4963
|
-
getBalanceRefillPolicies(): Promise<BalanceRefillPolicy[]>;
|
|
4964
|
-
/** Create a managed-USDC refill policy for a target chain. */
|
|
4965
|
-
createBalanceRefillPolicy(params: CreateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
|
|
4966
|
-
/** Update thresholds or pause/resume an existing balance refill policy. */
|
|
4967
|
-
updateBalanceRefillPolicy(policyId: string, params: UpdateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
|
|
4968
|
-
/** Return the 25 most recent attempts for a refill policy. */
|
|
4969
|
-
getBalanceRefillAttempts(policyId: string): Promise<BalanceRefillAttempt[]>;
|
|
4970
|
-
/** Withdraw funds from managed wallets to an external address. */
|
|
4971
|
-
withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
|
|
4972
|
-
/**
|
|
4973
|
-
* Preview a withdrawal — real fee + receive estimate without creating one.
|
|
4974
|
-
* Optional: `withdrawManaged` does NOT require a prior preview, so partners
|
|
4975
|
-
* integrating against the SDK can ignore this entirely.
|
|
4976
|
-
*/
|
|
4977
|
-
withdrawPreview(params: WithdrawPreviewParams): Promise<WithdrawPreviewResponse>;
|
|
4978
|
-
/** Quote maximum deliverable withdrawal amount for a token and destination chain. */
|
|
4979
|
-
getWithdrawalQuote(params: WithdrawalQuoteParams): Promise<WithdrawalQuoteResponse>;
|
|
4980
|
-
/**
|
|
4981
|
-
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
4982
|
-
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
4983
|
-
* reconnect to recover events that fired before the listener was attached
|
|
4984
|
-
* or while the socket was disconnected. Same response shape as
|
|
4985
|
-
* `withdrawManaged`.
|
|
4986
|
-
*/
|
|
4987
|
-
getWithdrawalStatus(withdrawalId: string): Promise<WithdrawManagedResponse>;
|
|
4988
|
-
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
4989
|
-
syncManagedBalances(): Promise<SyncBalancesResponse>;
|
|
4990
|
-
/** Get managed wallet deposit addresses (EVM + Solana). Returns 202 shape while provisioning. */
|
|
4991
|
-
getDepositAddresses(options?: {
|
|
4992
|
-
signal?: AbortSignal;
|
|
4993
|
-
}): Promise<DepositAddressesResponse>;
|
|
4994
|
-
/**
|
|
4995
|
-
* Internal: record that a deposit tx was initiated via the in-app
|
|
4996
|
-
* connected-wallet flow, so the activity feed can label it correctly.
|
|
4997
|
-
* Best-effort — callers should not block the UX on this.
|
|
4998
|
-
*/
|
|
4999
|
-
recordDepositIntent(body: {
|
|
5000
|
-
chainId: number;
|
|
5001
|
-
txHash: string;
|
|
5002
|
-
}): Promise<void>;
|
|
5003
|
-
/** Get open positions grouped by matched market with per-venue breakdown. */
|
|
5004
|
-
getPositions(params?: GetPositionsParams, options?: {
|
|
5005
|
-
signal?: AbortSignal;
|
|
5006
|
-
}): Promise<PaginatedResponse<PositionGroup>>;
|
|
5007
|
-
/** Get crypto purchase quotes. */
|
|
5008
|
-
getRampQuotes(params: RampQuoteRequest): Promise<RampQuote[]>;
|
|
5009
|
-
/** Create a ramp widget session for checkout. */
|
|
5010
|
-
createRampSession(params: RampSessionRequest): Promise<RampWidgetSession>;
|
|
5011
|
-
/** Authoritative shared Novig/ProphetX KYC status for the current managed wallet. */
|
|
5012
|
-
getSharedKycStatus(): Promise<{
|
|
5013
|
-
verified: boolean;
|
|
5014
|
-
}>;
|
|
5015
|
-
/** Start shared KYC; already-verified wallets need no redirect. Kalshi v2 is not applicable. */
|
|
5016
|
-
initiateKyc(venue: string, redirectUri: string): Promise<{
|
|
5017
|
-
status: string;
|
|
5018
|
-
kycUrl?: string;
|
|
5019
|
-
}>;
|
|
5020
|
-
}
|
|
5021
|
-
//#endregion
|
|
5022
|
-
//#region src/best-split.d.ts
|
|
5023
|
-
declare const computeBestSplitsByAmount: typeof computeBestSplitsByAmount$1;
|
|
5024
|
-
//#endregion
|
|
5025
|
-
//#region src/ws-types.d.ts
|
|
5026
|
-
/**
|
|
5027
|
-
* WebSocket protocol types for the Agg platform.
|
|
5028
|
-
* All callback timestamps are in **seconds** (converted from server ms at SDK dispatch).
|
|
5029
|
-
* These are plain TS interfaces — no Zod dependency for partner-side usage.
|
|
5030
|
-
*/
|
|
5031
|
-
/** Aggregated level wire format: [price, totalSize, {venue: sizeAtPrice}] */
|
|
5032
|
-
type WsAttributedLevel = [number, number, Record<string, number>];
|
|
5033
|
-
/** Per-venue level wire format: [price, size] */
|
|
5034
|
-
type WsVenueLevel = [number, number];
|
|
5035
|
-
interface WsVenueInfo {
|
|
5036
|
-
bestBid: number | null;
|
|
5037
|
-
bestAsk: number | null;
|
|
5038
|
-
}
|
|
5039
|
-
interface WsVenueBook {
|
|
5040
|
-
bids: WsVenueLevel[];
|
|
5041
|
-
asks: WsVenueLevel[];
|
|
5042
|
-
}
|
|
5043
|
-
interface WsOrderbookSnapshot {
|
|
5044
|
-
type: "orderbook_snapshot";
|
|
5045
|
-
outcomeId: string;
|
|
5046
|
-
channel?: "orderbook" | "trades";
|
|
5047
|
-
seq: number;
|
|
5048
|
-
checksum: number;
|
|
5049
|
-
bids: WsAttributedLevel[];
|
|
5050
|
-
asks: WsAttributedLevel[];
|
|
5051
|
-
venueOrderbooks: Record<string, WsVenueBook>;
|
|
5052
|
-
venues: Record<string, WsVenueInfo>;
|
|
5053
|
-
midpoint: number | null;
|
|
5054
|
-
spread: number | null;
|
|
5055
|
-
/** @unit seconds (converted from server ms) */
|
|
5056
|
-
timestamp: number;
|
|
5057
|
-
/**
|
|
5058
|
-
* Sticky tick of this outcome's book, inferred at runtime by the engine.
|
|
5059
|
-
* `null` until inferred. Optional — older snapshot producers (REST fallback)
|
|
5060
|
-
* may omit this field entirely.
|
|
5061
|
-
*/
|
|
5062
|
-
tick?: number | null;
|
|
5063
|
-
/** Provenance of the published `midpoint`. See {@link MarkSource}. */
|
|
5064
|
-
markSource?: MarkSource;
|
|
5065
|
-
}
|
|
5066
|
-
/**
|
|
5067
|
-
* Provenance tag for a published midpoint. Mirrors the Rust engine
|
|
5068
|
-
* `MarkSource::as_str()` output.
|
|
5069
|
-
*/
|
|
5070
|
-
type WsMarkSource = "local" | "local_merged" | "local_one_sided" | "sibling" | "local_boundary" | "none";
|
|
5071
|
-
type MarkSource = WsMarkSource;
|
|
5072
|
-
interface WsOrderbookDelta {
|
|
5073
|
-
type: "orderbook_delta";
|
|
5074
|
-
outcomeId: string;
|
|
5075
|
-
channel?: "orderbook" | "trades";
|
|
5076
|
-
seq: number;
|
|
5077
|
-
checksum: number;
|
|
5078
|
-
bidChanges: WsAttributedLevel[];
|
|
5079
|
-
askChanges: WsAttributedLevel[];
|
|
5080
|
-
venueDeltaBooks: Record<string, {
|
|
5081
|
-
bidChanges: WsVenueLevel[];
|
|
5082
|
-
askChanges: WsVenueLevel[];
|
|
5083
|
-
}>;
|
|
5084
|
-
venues: Record<string, WsVenueInfo>;
|
|
5085
|
-
midpoint: number | null;
|
|
5086
|
-
spread: number | null;
|
|
5087
|
-
/** @unit seconds (converted from server ms) */
|
|
5088
|
-
timestamp: number;
|
|
5089
|
-
}
|
|
5090
|
-
interface WsTrade {
|
|
5091
|
-
type: "trade";
|
|
5092
|
-
outcomeId: string;
|
|
5093
|
-
channel?: "orderbook" | "trades";
|
|
5094
|
-
venue: string;
|
|
5095
|
-
side: "buy" | "sell";
|
|
5096
|
-
price: number;
|
|
5097
|
-
size: number;
|
|
5098
|
-
/** @unit seconds (converted from server ms) */
|
|
5099
|
-
timestamp: number;
|
|
5100
|
-
/** Venue-unique trade id, when the venue supplies one (Hyperliquid today). */
|
|
5101
|
-
tradeId?: string;
|
|
5102
|
-
}
|
|
5103
|
-
type WsCandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
5104
|
-
interface WsSubscribed {
|
|
5105
|
-
type: "subscribed";
|
|
5106
|
-
/** Confirmed ids. For `orderbook`/`trades` these are venueMarketOutcomeIds.
|
|
5107
|
-
* For `arb` this historically mirrors the marketIds — prefer `marketIds`. */
|
|
5108
|
-
outcomeIds: string[];
|
|
5109
|
-
/** Confirmed marketIds — only set on `arb` confirmations, whose
|
|
5110
|
-
* subscriptions are keyed by marketIds, not outcomeIds. */
|
|
5111
|
-
marketIds?: string[];
|
|
5112
|
-
channel: "orderbook" | "trades" | "arb" | "arb-feed" | "app-events";
|
|
5113
|
-
/** Echo of the request's `id`, when one was sent. */
|
|
5114
|
-
id?: string | number;
|
|
5115
|
-
}
|
|
5116
|
-
interface WsUnsubscribed {
|
|
5117
|
-
type: "unsubscribed";
|
|
5118
|
-
/** See {@link WsSubscribed.outcomeIds}. */
|
|
5119
|
-
outcomeIds: string[];
|
|
5120
|
-
/** Confirmed marketIds — only set on `arb` confirmations. */
|
|
5121
|
-
marketIds?: string[];
|
|
5122
|
-
channel: "orderbook" | "trades" | "arb" | "arb-feed" | "app-events";
|
|
5123
|
-
id?: string | number;
|
|
5124
|
-
}
|
|
5125
|
-
interface WsConnected {
|
|
5126
|
-
type: "connected";
|
|
5127
|
-
appId: string;
|
|
5128
|
-
userId?: string;
|
|
5129
|
-
/** Protocol revision. 2 adds error codes, request ids, event ids and resume. */
|
|
5130
|
-
protocolVersion?: number;
|
|
5131
|
-
/** `key` when admitted by `x-app-api-key`, `browser` when admitted by Origin. */
|
|
5132
|
-
auth?: "browser" | "key";
|
|
5133
|
-
}
|
|
5134
|
-
interface WsAuthenticated {
|
|
5135
|
-
type: "authenticated";
|
|
5136
|
-
userId: string;
|
|
5137
|
-
/** Token expiry (Unix ms). Re-authenticate before it, or user events stop. */
|
|
5138
|
-
expiresAt?: number;
|
|
5139
|
-
id?: string | number;
|
|
5140
|
-
}
|
|
5141
|
-
/** Sent about a minute before the user token expires. */
|
|
5142
|
-
interface WsAuthExpiring {
|
|
5143
|
-
type: "auth_expiring";
|
|
5144
|
-
userId: string;
|
|
5145
|
-
/** @unit milliseconds */
|
|
5146
|
-
expiresAt: number;
|
|
5147
|
-
}
|
|
5148
|
-
/**
|
|
5149
|
-
* The user session ended and the connection continues at app level: market
|
|
5150
|
-
* data keeps flowing, user events stop until you `authenticate` again.
|
|
5151
|
-
*/
|
|
5152
|
-
interface WsAuthExpired {
|
|
5153
|
-
type: "auth_expired";
|
|
5154
|
-
userId: string;
|
|
5155
|
-
reason: "expired" | "revoked" | "suspended";
|
|
5156
|
-
}
|
|
5157
|
-
/**
|
|
5158
|
-
* End of a resume replay. When `complete` is false, events may have been
|
|
5159
|
-
* missed (outside the retention window, or the log was unavailable):
|
|
5160
|
-
* reconcile orders, balances and withdrawals over REST.
|
|
5161
|
-
*/
|
|
5162
|
-
interface WsResumed {
|
|
5163
|
-
type: "resumed";
|
|
5164
|
-
stream: "user" | "app";
|
|
5165
|
-
fromEventId: string;
|
|
5166
|
-
replayed: number;
|
|
5167
|
-
complete: boolean;
|
|
5168
|
-
id?: string | number;
|
|
5169
|
-
}
|
|
5170
|
-
/**
|
|
5171
|
-
* Upstream delivery was interrupted; frames on `channels` may be missing.
|
|
5172
|
-
* Orderbooks are resnapshotted automatically; trades and arb updates in the
|
|
5173
|
-
* gap are not recoverable.
|
|
5174
|
-
*/
|
|
5175
|
-
interface WsStreamInterrupted {
|
|
5176
|
-
type: "stream_interrupted";
|
|
5177
|
-
channels: string[];
|
|
5178
|
-
timestamp: number;
|
|
5179
|
-
}
|
|
5180
|
-
interface WsHeartbeat {
|
|
5181
|
-
type: "heartbeat";
|
|
5182
|
-
/** @unit seconds (converted from server ms) */
|
|
5183
|
-
ts: number;
|
|
5184
|
-
}
|
|
5185
|
-
interface WsResolvedOutcome {
|
|
5186
|
-
label: string;
|
|
5187
|
-
winner?: boolean;
|
|
5188
|
-
externalIdentifier?: string;
|
|
5537
|
+
signal?: AbortSignal;
|
|
5538
|
+
decode?: (payload: string) => Promise<ChartBarsResponse>;
|
|
5539
|
+
}): Promise<ChartBarsResponse>;
|
|
5540
|
+
getChartHistoryManifest(params: {
|
|
5541
|
+
venueMarketOutcomeId: string;
|
|
5542
|
+
resolution?: ChartResolution;
|
|
5543
|
+
from?: number;
|
|
5544
|
+
to: number;
|
|
5545
|
+
countBack?: number;
|
|
5546
|
+
}, options?: {
|
|
5547
|
+
signal?: AbortSignal;
|
|
5548
|
+
}): Promise<ChartHistoryManifest>;
|
|
5549
|
+
/** Get live per-venue orderbooks for the explicit venueMarketIds requested. */
|
|
5550
|
+
getOrderbooks(params: {
|
|
5551
|
+
venueMarketIds: string[];
|
|
5552
|
+
depth?: number;
|
|
5553
|
+
}, options?: {
|
|
5554
|
+
signal?: AbortSignal;
|
|
5555
|
+
}): Promise<BatchOrderbooksResponse>;
|
|
5556
|
+
/** Get live midpoints for the explicit venueMarketIds requested. */
|
|
5557
|
+
getMidpoints(params: {
|
|
5558
|
+
venueMarketIds: string[];
|
|
5559
|
+
bestPrice?: boolean;
|
|
5560
|
+
maxMidpointIdsPerRequest?: number;
|
|
5561
|
+
}, options?: {
|
|
5562
|
+
signal?: AbortSignal;
|
|
5563
|
+
maxMidpointIdsPerRequest?: number;
|
|
5564
|
+
}): Promise<BatchMidpointsResponse>;
|
|
5565
|
+
getMidpoints(venueMarketIds: string[], options?: {
|
|
5566
|
+
signal?: AbortSignal;
|
|
5567
|
+
bestPrice?: boolean;
|
|
5568
|
+
maxMidpointIdsPerRequest?: number;
|
|
5569
|
+
}): Promise<BatchMidpointsResponse>;
|
|
5570
|
+
/** Get a single outcome-level orderbook from the engine. */
|
|
5571
|
+
getOutcomeOrderbook(outcomeId: string, options?: {
|
|
5572
|
+
depth?: number;
|
|
5573
|
+
signal?: AbortSignal;
|
|
5574
|
+
}): Promise<OutcomeOrderbookResponse | null>;
|
|
5189
5575
|
/**
|
|
5190
|
-
*
|
|
5191
|
-
*
|
|
5192
|
-
*
|
|
5576
|
+
* Compute optimal order routing across venues via the MILP solver.
|
|
5577
|
+
* Returns a user-scoped quote with per-venue fills and verification timing.
|
|
5578
|
+
* Deprecated aliases are accepted for source compatibility during the
|
|
5579
|
+
* outcome-level migration window.
|
|
5193
5580
|
*/
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
/**
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
/** Per-outcome resolution data. */
|
|
5207
|
-
outcomes: WsResolvedOutcome[];
|
|
5208
|
-
/** @unit seconds (converted from server ms) */
|
|
5209
|
-
timestamp: number;
|
|
5210
|
-
}
|
|
5211
|
-
/** Machine-readable error codes. Branch on `code`, not on `message`. */
|
|
5212
|
-
type WsErrorCode = "missing_app_id" | "invalid_app" | "origin_not_allowed" | "api_key_required" | "invalid_api_key" | "invalid_token" | "token_app_mismatch" | "admin_token_not_allowed" | "too_many_connections" | "rate_limited" | "invalid_message" | "too_many_ids" | "subscription_limit" | "outcomes_blocked" | "not_subscribed" | "snapshot_unavailable" | "app_events_forbidden" | "internal_error";
|
|
5213
|
-
interface WsError {
|
|
5214
|
-
type: "error";
|
|
5215
|
-
/** Absent only on servers older than protocol version 2. */
|
|
5216
|
-
code?: WsErrorCode;
|
|
5217
|
-
message: string;
|
|
5218
|
-
/** Echo of the `id` of the request that caused the error. */
|
|
5219
|
-
id?: string | number;
|
|
5220
|
-
/** Outcome ids the error applies to. */
|
|
5221
|
-
outcomeIds?: string[];
|
|
5222
|
-
/** Market ids the error applies to (arb). */
|
|
5223
|
-
marketIds?: string[];
|
|
5224
|
-
}
|
|
5225
|
-
interface WsOrderSubmitted {
|
|
5226
|
-
type: "order_submitted";
|
|
5227
|
-
venue: string;
|
|
5228
|
-
orderId: string;
|
|
5229
|
-
side: string;
|
|
5230
|
-
price: number;
|
|
5231
|
-
size: number;
|
|
5232
|
-
outcomeId?: string;
|
|
5233
|
-
marketId?: string;
|
|
5234
|
-
/** @unit seconds (converted from server ms) */
|
|
5235
|
-
timestamp: number;
|
|
5236
|
-
/** Owner of the event. */
|
|
5237
|
-
userId?: string;
|
|
5581
|
+
getSmartRoute(params: SmartRouteParams, options?: {
|
|
5582
|
+
signal?: AbortSignal;
|
|
5583
|
+
}): Promise<SmartRouteResponse>;
|
|
5584
|
+
/** Seed subscribed outcomes with one bounded batch of compatible snapshots. */
|
|
5585
|
+
getOutcomeOrderbooks(params: {
|
|
5586
|
+
venueMarketOutcomeIds: string[];
|
|
5587
|
+
depth?: number;
|
|
5588
|
+
}, options?: {
|
|
5589
|
+
signal?: AbortSignal;
|
|
5590
|
+
}): Promise<{
|
|
5591
|
+
data: (OutcomeOrderbookResponse | null)[];
|
|
5592
|
+
}>;
|
|
5238
5593
|
/**
|
|
5239
|
-
*
|
|
5240
|
-
*
|
|
5241
|
-
*
|
|
5594
|
+
* Catalog changes (events and markets created, changed or deleted) after
|
|
5595
|
+
* `since`, oldest first, one item per entity with its current state. Page
|
|
5596
|
+
* with `nextCursor` until `hasMore` is false. Positions older than 24h
|
|
5597
|
+
* throw an {@link AggApiError} with status 410 and code `resync_required`
|
|
5598
|
+
* (see `isCatalogResyncRequired`). Most callers want {@link watchCatalog}.
|
|
5242
5599
|
*/
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
replayed?: boolean;
|
|
5247
|
-
}
|
|
5248
|
-
interface WsBalanceUpdate {
|
|
5249
|
-
type: "balance_update";
|
|
5250
|
-
venue: string;
|
|
5251
|
-
tradingBalanceCents: number;
|
|
5252
|
-
walletBalanceCents?: number;
|
|
5253
|
-
/** @unit seconds (converted from server ms) */
|
|
5254
|
-
timestamp: number;
|
|
5255
|
-
/** Owner of the event. */
|
|
5256
|
-
userId?: string;
|
|
5600
|
+
getCatalogChanges(params: GetCatalogChangesParams, options?: {
|
|
5601
|
+
signal?: AbortSignal;
|
|
5602
|
+
}): Promise<CatalogChangesPage>;
|
|
5257
5603
|
/**
|
|
5258
|
-
*
|
|
5259
|
-
*
|
|
5260
|
-
*
|
|
5604
|
+
* Keep a copy of the catalog in sync from `since`: subscribes to the live
|
|
5605
|
+
* `catalog` channel, catches up over `GET /catalog/changes` (from the last
|
|
5606
|
+
* applied `changedAt` minus `overlapMs`) on every (re)subscribe and stream
|
|
5607
|
+
* interruption, and delivers each entity's newer state once to `onChange`.
|
|
5608
|
+
*
|
|
5609
|
+
* Persist `handle.lastChangedAt` and pass it back as `since` to resume
|
|
5610
|
+
* after a restart. When that is older than 24h, `onResyncRequired` fires:
|
|
5611
|
+
* re-list with the list endpoints, then call `handle.resync(startOfReList)`.
|
|
5612
|
+
*
|
|
5613
|
+
* Without `socket`, opens a dedicated app-level connection (requires
|
|
5614
|
+
* `wsUrl`) that `stop()` closes.
|
|
5261
5615
|
*/
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
}
|
|
5267
|
-
type WsOrderEventType = "cancelled" | "created" | "signed" | "pending_bridge" | "bridge_complete" | "submitting" | "submitted" | "expired" | "dag_started" | "dag_completed" | "dag_failed" | "dag_cancelled" | "step_started" | "step_completed" | "step_waiting" | "step_failed" | "step_retrying" | "filled" | "partial_fill" | "failed" | "bridge_ws_subscribed" | "bridge_ws_subscribe_failed" | "bridge_polling_fallback";
|
|
5268
|
-
interface WsOrderEvent {
|
|
5269
|
-
type: "order_event";
|
|
5270
|
-
event: WsOrderEventType;
|
|
5271
|
-
userId: string;
|
|
5272
|
-
orderId: string;
|
|
5273
|
-
/** Partner trade id from `placeOrder()`, when the order carried one. */
|
|
5274
|
-
externalId?: string;
|
|
5275
|
-
venue: string;
|
|
5276
|
-
dagRunId?: string;
|
|
5277
|
-
stepId?: string;
|
|
5278
|
-
stepType?: string;
|
|
5279
|
-
/** 1-based step index. Pair with `totalSteps` to render "Step 3 of 7". */
|
|
5280
|
-
sequence?: number;
|
|
5281
|
-
totalSteps?: number;
|
|
5282
|
-
templateName?: string;
|
|
5283
|
-
/** Maps sequence → stepType for all steps — sent on dag_started so labels are available upfront. */
|
|
5284
|
-
stepTypes?: Record<number, string>;
|
|
5285
|
-
filledAmountRaw?: string;
|
|
5286
|
-
remainingAmountRaw?: string;
|
|
5616
|
+
watchCatalog(options: WatchCatalogOptions & {
|
|
5617
|
+
/** WebSocket implementation for the dedicated connection (e.g. `ws` on Node < 22). */
|
|
5618
|
+
webSocketImpl?: AggWebSocketOptions["webSocketImpl"];
|
|
5619
|
+
}): CatalogWatchHandle;
|
|
5287
5620
|
/**
|
|
5288
|
-
*
|
|
5289
|
-
*
|
|
5290
|
-
*
|
|
5291
|
-
*
|
|
5292
|
-
* fractional fills and divides by zero before `executionPrice` exists).
|
|
5621
|
+
* URL and handshake headers for this client's app. Server-side clients with
|
|
5622
|
+
* an API key authenticate the handshake with it (the gateway then skips the
|
|
5623
|
+
* browser Origin check). Never in a browser: browsers cannot set handshake
|
|
5624
|
+
* headers, and keys must not ship there.
|
|
5293
5625
|
*/
|
|
5294
|
-
|
|
5295
|
-
actualSharesRaw?: string;
|
|
5296
|
-
quotedToWinRaw?: string;
|
|
5297
|
-
actualToWinRaw?: string;
|
|
5298
|
-
/** Quote-time price (decimal string, e.g. "0.5"). Pair with `executionPriceRaw`
|
|
5299
|
-
* to render the slippage diff inline. */
|
|
5300
|
-
quotedPriceRaw?: string;
|
|
5626
|
+
private webSocketOptions;
|
|
5301
5627
|
/**
|
|
5302
|
-
*
|
|
5303
|
-
*
|
|
5304
|
-
* `
|
|
5305
|
-
* price lands on the order shortly after (`GET /execution/orders`).
|
|
5628
|
+
* Create an AggWebSocket instance configured with this client's appId and current auth session.
|
|
5629
|
+
* Session changes update this socket until it or the client is destroyed.
|
|
5630
|
+
* Requires `wsUrl` to be set in the client options.
|
|
5306
5631
|
*/
|
|
5307
|
-
|
|
5632
|
+
createWebSocket(callbacks?: AggWebSocketCallbacks, options?: {
|
|
5633
|
+
enableLogs?: boolean;
|
|
5634
|
+
/**
|
|
5635
|
+
* Checks books with no update for 5 minutes against
|
|
5636
|
+
* `GET /orderbooks/outcomes` and heals any that drifted. On by default;
|
|
5637
|
+
* pass `false` to disable or an object to tune the timings.
|
|
5638
|
+
*/
|
|
5639
|
+
bookWatchdog?: false | Pick<BookWatchdogOptions, "silenceMs" | "checkIntervalMs">;
|
|
5640
|
+
/**
|
|
5641
|
+
* WebSocket implementation for runtimes without a global one (e.g. the
|
|
5642
|
+
* `ws` package on Node < 22). Node 22+ and browsers need nothing here.
|
|
5643
|
+
*/
|
|
5644
|
+
webSocketImpl?: AggWebSocketOptions["webSocketImpl"];
|
|
5645
|
+
}): AggWebSocket;
|
|
5646
|
+
private openTradeSockets;
|
|
5308
5647
|
/**
|
|
5309
|
-
*
|
|
5310
|
-
*
|
|
5311
|
-
*
|
|
5648
|
+
* User events are registered by `{ action: "authenticate" }`, not a channel
|
|
5649
|
+
* subscribe. The confirmation is `{ type: "authenticated" }`. Send that
|
|
5650
|
+
* frame only when the socket is already open and it has not been sent for
|
|
5651
|
+
* this token. Opening a socket here would lose the fill to the handshake.
|
|
5312
5652
|
*/
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
/**
|
|
5318
|
-
|
|
5653
|
+
private confirmTradeSockets;
|
|
5654
|
+
private bindWebSocketAuth;
|
|
5655
|
+
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
5656
|
+
executeManaged(params: ExecuteManagedParams): Promise<ExecuteManagedResponse>;
|
|
5657
|
+
/** Submit signatures for a parked fill. Returns whatever is still outstanding. */
|
|
5658
|
+
submitFillSignatures(quoteId: string, signatures: SubmitSignature[]): Promise<ExecuteManagedResponse & {
|
|
5659
|
+
accepted?: number;
|
|
5660
|
+
}>;
|
|
5661
|
+
/**
|
|
5662
|
+
* Execute a quote in self-custodial mode.
|
|
5663
|
+
*
|
|
5664
|
+
* Identical to `executeManaged` when the server can sign for the user. When
|
|
5665
|
+
* it cannot, the DAG parks on a signature request instead — but that park
|
|
5666
|
+
* always happens asynchronously, in the trade-executor process, so it can
|
|
5667
|
+
* never show up on this `POST /execution/fill` response itself. This
|
|
5668
|
+
* drives the round trip from there: poll `getExecutionStatus` while an
|
|
5669
|
+
* on-chain step is in flight, sign whatever it hands back with the
|
|
5670
|
+
* configured `signer`, post the signatures back, and repeat until the
|
|
5671
|
+
* server reports nothing outstanding and the run reaches a terminal state.
|
|
5672
|
+
*
|
|
5673
|
+
* `options.signer` overrides the configured `signer` for this call, for an
|
|
5674
|
+
* app whose wallet signer lives outside the client (a React provider).
|
|
5675
|
+
*/
|
|
5676
|
+
fillSelfCustody(params: ExecuteManagedParams, options?: {
|
|
5677
|
+
signer?: SignerFn;
|
|
5678
|
+
}): Promise<ExecuteManagedResponse>;
|
|
5679
|
+
/**
|
|
5680
|
+
* Enqueue a limit order. For self-custody, poll getExecutionStatus with the
|
|
5681
|
+
* returned quoteId and answer pending requests through submitFillSignatures.
|
|
5682
|
+
* A pending response does not mean the order has reached the venue.
|
|
5683
|
+
*/
|
|
5684
|
+
placeLimitOrder(params: PlaceLimitOrderParams): Promise<PlaceLimitOrderResponse>;
|
|
5685
|
+
/**
|
|
5686
|
+
* Place a market order directly on a named venue — no prior quote needed.
|
|
5687
|
+
* Always produces exactly one order. `externalId` is required and unique
|
|
5688
|
+
* within your app — two different users of the same app cannot share one —
|
|
5689
|
+
* so retrying a timed-out call with the same value is safe.
|
|
5690
|
+
*/
|
|
5691
|
+
placeOrder(params: PlaceOrderParams): Promise<PlaceOrderResponse>;
|
|
5692
|
+
/** Redeem resolved winning positions by venue market outcome ids. */
|
|
5693
|
+
redeem(body: RedeemRequest): Promise<RedeemResponse>;
|
|
5694
|
+
/**
|
|
5695
|
+
* Redeem a resolved position held in a self-custody wallet. The server runs
|
|
5696
|
+
* it as a sell fill on the resolved market, so this quotes the sell and
|
|
5697
|
+
* drives `fillSelfCustody`. The same call works for every venue; the
|
|
5698
|
+
* configured `signer` sees a `transaction` (user pays gas) or one typed-data
|
|
5699
|
+
* signature (Polymarket, gasless). `options.signer` overrides it for this
|
|
5700
|
+
* call, as in `fillSelfCustody`.
|
|
5701
|
+
*/
|
|
5702
|
+
redeemSelfCustody(params: RedeemSelfCustodyParams, options?: {
|
|
5703
|
+
signer?: SignerFn;
|
|
5704
|
+
}): Promise<ExecuteManagedResponse>;
|
|
5705
|
+
/** List the authenticated user's managed balance refill policies. */
|
|
5706
|
+
getBalanceRefillPolicies(): Promise<BalanceRefillPolicy[]>;
|
|
5707
|
+
/** Create a managed-USDC refill policy for a target chain. */
|
|
5708
|
+
createBalanceRefillPolicy(params: CreateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
|
|
5709
|
+
/** Update thresholds or pause/resume an existing balance refill policy. */
|
|
5710
|
+
updateBalanceRefillPolicy(policyId: string, params: UpdateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
|
|
5711
|
+
/** Return the 25 most recent attempts for a refill policy. */
|
|
5712
|
+
getBalanceRefillAttempts(policyId: string): Promise<BalanceRefillAttempt[]>;
|
|
5713
|
+
/** Withdraw funds from managed wallets to an external address. */
|
|
5714
|
+
withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
|
|
5715
|
+
/** Submit signatures for a parked self-custody withdrawal. Returns whatever is still outstanding. */
|
|
5716
|
+
submitWithdrawalSignatures(withdrawalId: string, signatures: SubmitSignature[]): Promise<WithdrawManagedResponse>;
|
|
5319
5717
|
/**
|
|
5320
|
-
*
|
|
5321
|
-
*
|
|
5322
|
-
*
|
|
5718
|
+
* Preview a withdrawal — real fee + receive estimate without creating one.
|
|
5719
|
+
* Optional: `withdrawManaged` does NOT require a prior preview, so partners
|
|
5720
|
+
* integrating against the SDK can ignore this entirely.
|
|
5323
5721
|
*/
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
replayed?: boolean;
|
|
5328
|
-
}
|
|
5329
|
-
interface WsRedeemEvent {
|
|
5330
|
-
type: "redeem_event";
|
|
5331
|
-
redeemId: string;
|
|
5332
|
-
venueMarketOutcomeId: string;
|
|
5333
|
-
status: "submitted" | "confirmed" | "failed";
|
|
5334
|
-
callsId: string | null;
|
|
5335
|
-
pendingUserOpId: string | null;
|
|
5336
|
-
txHash: string | null;
|
|
5337
|
-
errorMessage: string | null;
|
|
5338
|
-
/** @unit seconds (converted from server ms) */
|
|
5339
|
-
timestamp: number;
|
|
5340
|
-
/** Owner of the event. */
|
|
5341
|
-
userId?: string;
|
|
5722
|
+
withdrawPreview(params: WithdrawPreviewParams): Promise<WithdrawPreviewResponse>;
|
|
5723
|
+
/** Quote maximum deliverable withdrawal amount for a token and destination chain. */
|
|
5724
|
+
getWithdrawalQuote(params: WithdrawalQuoteParams): Promise<WithdrawalQuoteResponse>;
|
|
5342
5725
|
/**
|
|
5343
|
-
*
|
|
5344
|
-
*
|
|
5345
|
-
*
|
|
5726
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
5727
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
5728
|
+
* reconnect to recover events that fired before the listener was attached
|
|
5729
|
+
* or while the socket was disconnected. Same response shape as
|
|
5730
|
+
* `withdrawManaged`.
|
|
5346
5731
|
*/
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
5355
|
-
interface WsWithdrawalLifecycleLeg {
|
|
5356
|
-
sourceChainId: number;
|
|
5357
|
-
destChainId: number;
|
|
5358
|
-
type: "transfer" | "bridge";
|
|
5359
|
-
status: WsWithdrawalLegStatus;
|
|
5360
|
-
amountRaw: string;
|
|
5361
|
-
txHash: string | null;
|
|
5362
|
-
bridgeOperationId: string | null;
|
|
5363
|
-
/** Human-readable failure reason when `status === "failed"`. Null/absent when succeeded or in-flight. */
|
|
5364
|
-
errorMessage?: string | null;
|
|
5365
|
-
}
|
|
5366
|
-
/**
|
|
5367
|
-
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
5368
|
-
* consumers should pass through unknown enum values rather than failing.
|
|
5369
|
-
*/
|
|
5370
|
-
interface WsWithdrawalLifecycleEvent {
|
|
5371
|
-
type: "withdrawal_lifecycle";
|
|
5372
|
-
withdrawalId: string;
|
|
5373
|
-
userId: string;
|
|
5374
|
-
status: WsWithdrawalLifecycleStatus;
|
|
5375
|
-
/** Requested withdrawal amount in destination-token native decimals. */
|
|
5376
|
-
requestedAmountRaw?: string;
|
|
5377
|
-
/** Terminal settled amount in destination-token native decimals. */
|
|
5378
|
-
completedAmountRaw?: string | null;
|
|
5379
|
-
/** Realized platform fee in destination-token native decimals. Only present on terminal events. */
|
|
5380
|
-
feeRaw?: string | null;
|
|
5381
|
-
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
5382
|
-
terminal: boolean;
|
|
5383
|
-
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
5384
|
-
leg?: WsWithdrawalLifecycleLeg;
|
|
5385
|
-
/** All legs at the moment of emission (snapshot). */
|
|
5386
|
-
legs?: WsWithdrawalLifecycleLeg[];
|
|
5387
|
-
/** Failure reason for terminal `failed` / `partial`. */
|
|
5388
|
-
errorMessage?: string;
|
|
5389
|
-
correlationId?: string;
|
|
5390
|
-
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
5391
|
-
timestamp: number;
|
|
5732
|
+
getWithdrawalStatus(withdrawalId: string): Promise<WithdrawManagedResponse>;
|
|
5733
|
+
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
5734
|
+
syncManagedBalances(): Promise<SyncBalancesResponse>;
|
|
5735
|
+
/** Get managed wallet deposit addresses (EVM + Solana). Returns 202 shape while provisioning. */
|
|
5736
|
+
getDepositAddresses(options?: {
|
|
5737
|
+
signal?: AbortSignal;
|
|
5738
|
+
}): Promise<DepositAddressesResponse>;
|
|
5392
5739
|
/**
|
|
5393
|
-
*
|
|
5394
|
-
*
|
|
5395
|
-
*
|
|
5740
|
+
* Internal: record that a deposit tx was initiated via the in-app
|
|
5741
|
+
* connected-wallet flow, so the activity feed can label it correctly.
|
|
5742
|
+
* Best-effort — callers should not block the UX on this.
|
|
5396
5743
|
*/
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
/**
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
}
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
liquidityUsd?: number;
|
|
5419
|
-
liquidityTier?: "deep" | "shallow";
|
|
5420
|
-
}
|
|
5421
|
-
interface WsArbFeedBatch {
|
|
5422
|
-
type: "arb_feed_batch";
|
|
5423
|
-
feed: "arb";
|
|
5424
|
-
/** Producer assertion that globally inactive venues were excluded. */
|
|
5425
|
-
activeVenuesOnly: true;
|
|
5426
|
-
entries: WsArbFeedEntry[];
|
|
5427
|
-
flushTs: number;
|
|
5428
|
-
chunk: number;
|
|
5429
|
-
chunkCount: number;
|
|
5744
|
+
recordDepositIntent(body: {
|
|
5745
|
+
chainId: number;
|
|
5746
|
+
txHash: string;
|
|
5747
|
+
}): Promise<void>;
|
|
5748
|
+
/** Get open positions grouped by matched market with per-venue breakdown. */
|
|
5749
|
+
getPositions(params?: GetPositionsParams, options?: {
|
|
5750
|
+
signal?: AbortSignal;
|
|
5751
|
+
}): Promise<PaginatedResponse<PositionGroup>>;
|
|
5752
|
+
/** Get crypto purchase quotes. */
|
|
5753
|
+
getRampQuotes(params: RampQuoteRequest): Promise<RampQuote[]>;
|
|
5754
|
+
/** Create a ramp widget session for checkout. */
|
|
5755
|
+
createRampSession(params: RampSessionRequest): Promise<RampWidgetSession>;
|
|
5756
|
+
/** Authoritative shared Novig/ProphetX KYC status for the current managed wallet. */
|
|
5757
|
+
getSharedKycStatus(): Promise<{
|
|
5758
|
+
verified: boolean;
|
|
5759
|
+
}>;
|
|
5760
|
+
/** Start shared KYC; already-verified wallets need no redirect. Kalshi v2 is not applicable. */
|
|
5761
|
+
initiateKyc(venue: string, redirectUri: string): Promise<{
|
|
5762
|
+
status: string;
|
|
5763
|
+
kycUrl?: string;
|
|
5764
|
+
}>;
|
|
5430
5765
|
}
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
* frame (timestamps in milliseconds, not converted), always with `userId`,
|
|
5435
|
-
* `stream: "app"` and normally an `eventId`.
|
|
5436
|
-
*/
|
|
5437
|
-
type WsAppEvent = ((Omit<WsOrderSubmitted, "timestamp"> & {
|
|
5438
|
-
timestamp: number;
|
|
5439
|
-
}) | (Omit<WsBalanceUpdate, "timestamp"> & {
|
|
5440
|
-
timestamp: number;
|
|
5441
|
-
}) | WsOrderEvent | (Omit<WsRedeemEvent, "timestamp"> & {
|
|
5442
|
-
timestamp: number | string;
|
|
5443
|
-
}) | WsWithdrawalLifecycleEvent) & {
|
|
5444
|
-
userId: string;
|
|
5445
|
-
stream: "app";
|
|
5446
|
-
};
|
|
5447
|
-
type WsClientMessage = {
|
|
5448
|
-
action: "subscribe";
|
|
5449
|
-
channel: "orderbook" | "trades";
|
|
5450
|
-
outcomeIds: string[];
|
|
5451
|
-
} | {
|
|
5452
|
-
action: "unsubscribe";
|
|
5453
|
-
channel: "orderbook" | "trades";
|
|
5454
|
-
outcomeIds: string[];
|
|
5455
|
-
} | {
|
|
5456
|
-
action: "resnapshot";
|
|
5457
|
-
channel: "orderbook";
|
|
5458
|
-
outcomeIds: string[];
|
|
5459
|
-
} | {
|
|
5460
|
-
action: "subscribe";
|
|
5461
|
-
channel: "arb";
|
|
5462
|
-
marketIds: string[];
|
|
5463
|
-
} | {
|
|
5464
|
-
action: "unsubscribe";
|
|
5465
|
-
channel: "arb";
|
|
5466
|
-
marketIds: string[];
|
|
5467
|
-
} | {
|
|
5468
|
-
action: "subscribe";
|
|
5469
|
-
channel: "arb-feed";
|
|
5470
|
-
} | {
|
|
5471
|
-
action: "unsubscribe";
|
|
5472
|
-
channel: "arb-feed";
|
|
5473
|
-
} | {
|
|
5474
|
-
action: "authenticate";
|
|
5475
|
-
token: string;
|
|
5476
|
-
resumeFrom?: string;
|
|
5477
|
-
} | {
|
|
5478
|
-
action: "subscribe";
|
|
5479
|
-
channel: "app-events";
|
|
5480
|
-
resumeFrom?: string;
|
|
5481
|
-
} | {
|
|
5482
|
-
action: "unsubscribe";
|
|
5483
|
-
channel: "app-events";
|
|
5484
|
-
};
|
|
5485
|
-
type DiagnosticEvent = {
|
|
5486
|
-
type: "seq_gap";
|
|
5487
|
-
marketId: string;
|
|
5488
|
-
outcomeId: string;
|
|
5489
|
-
expected: number;
|
|
5490
|
-
received: number;
|
|
5491
|
-
} | {
|
|
5492
|
-
type: "checksum_mismatch";
|
|
5493
|
-
marketId: string;
|
|
5494
|
-
outcomeId: string;
|
|
5495
|
-
expected: number;
|
|
5496
|
-
computed: number;
|
|
5497
|
-
} | {
|
|
5498
|
-
type: "reconnect";
|
|
5499
|
-
attempt: number;
|
|
5500
|
-
delayMs: number;
|
|
5501
|
-
} |
|
|
5502
|
-
/** The server closed with a configuration error (4001/4003); the SDK does not retry. */
|
|
5503
|
-
{
|
|
5504
|
-
type: "connection_rejected";
|
|
5505
|
-
code: number;
|
|
5506
|
-
reason: string;
|
|
5507
|
-
} | {
|
|
5508
|
-
type: "stream_interrupted";
|
|
5509
|
-
channels: string[];
|
|
5510
|
-
} | {
|
|
5511
|
-
type: "stale_connection";
|
|
5512
|
-
lastMessageAge: number;
|
|
5513
|
-
} | {
|
|
5514
|
-
type: "book_watchdog_resync";
|
|
5515
|
-
outcomeId: string;
|
|
5516
|
-
/** null when there is no local book (its snapshot never arrived). */
|
|
5517
|
-
localSeq: number | null;
|
|
5518
|
-
serverSeq: number;
|
|
5519
|
-
action: "resnapshot" | "resubscribe";
|
|
5520
|
-
} |
|
|
5521
|
-
/** `status` is null when the REST check failed before a response (network error or timeout). */
|
|
5522
|
-
{
|
|
5523
|
-
type: "book_watchdog_error";
|
|
5524
|
-
status: number | null;
|
|
5525
|
-
};
|
|
5526
|
-
type DiagnosticCallback = (event: DiagnosticEvent) => void;
|
|
5766
|
+
//#endregion
|
|
5767
|
+
//#region src/best-split.d.ts
|
|
5768
|
+
declare const computeBestSplitsByAmount: typeof computeBestSplitsByAmount$1;
|
|
5527
5769
|
//#endregion
|
|
5528
5770
|
//#region src/orderbook-utils.d.ts
|
|
5529
5771
|
interface OrderbookLevel {
|
|
@@ -5995,6 +6237,8 @@ interface AggWebSocketDiagnostics {
|
|
|
5995
6237
|
tradeOutcomeIds: string[];
|
|
5996
6238
|
arbMarketIds: string[];
|
|
5997
6239
|
arbFeedSubscribers: number;
|
|
6240
|
+
/** Active `subscribeCatalog` callers. Absent on transports without catalog support. */
|
|
6241
|
+
catalogSubscribers?: number;
|
|
5998
6242
|
cachedBooks: number;
|
|
5999
6243
|
cachedArb: number;
|
|
6000
6244
|
resyncingBooks: number;
|
|
@@ -6048,6 +6292,19 @@ interface AggWebSocketOptions {
|
|
|
6048
6292
|
/** Check silent books against REST and heal any that drifted. Off when omitted. */
|
|
6049
6293
|
bookWatchdog?: BookWatchdogOptions;
|
|
6050
6294
|
}
|
|
6295
|
+
/** Lifecycle hooks for {@link AggWebSocket.subscribeCatalog}. */
|
|
6296
|
+
interface CatalogSubscribeOptions {
|
|
6297
|
+
/**
|
|
6298
|
+
* The server confirmed this caller's filter — after the first subscribe and
|
|
6299
|
+
* again after every reconnect. Frames before this may be missing: catch up
|
|
6300
|
+
* over `GET /catalog/changes` from here.
|
|
6301
|
+
*/
|
|
6302
|
+
onSubscribed?: () => void;
|
|
6303
|
+
/** Upstream delivery was interrupted; frames may be missing. Catch up over REST. */
|
|
6304
|
+
onInterrupted?: () => void;
|
|
6305
|
+
/** The server rejected this caller's subscribe frame. */
|
|
6306
|
+
onError?: (error: WsError) => void;
|
|
6307
|
+
}
|
|
6051
6308
|
/**
|
|
6052
6309
|
* Agg WebSocket client. Single WS connection with refcounted market subscriptions.
|
|
6053
6310
|
*/
|
|
@@ -6108,6 +6365,11 @@ declare class AggWebSocket {
|
|
|
6108
6365
|
/** Set once a connection has been established; later connects resume. */
|
|
6109
6366
|
private hasConnected;
|
|
6110
6367
|
private readonly appEventCbs;
|
|
6368
|
+
private readonly catalogSubs;
|
|
6369
|
+
/** Union filter last sent on this connection; null when not subscribed. */
|
|
6370
|
+
private catalogSentKey;
|
|
6371
|
+
private catalogFrameSeq;
|
|
6372
|
+
private catalogAckedSeq;
|
|
6111
6373
|
/** Last close was a configuration error; don't reconnect until connect() is called. */
|
|
6112
6374
|
private rejected;
|
|
6113
6375
|
constructor(options: AggWebSocketOptions);
|
|
@@ -6140,6 +6402,25 @@ declare class AggWebSocket {
|
|
|
6140
6402
|
* Returns an unsubscribe function.
|
|
6141
6403
|
*/
|
|
6142
6404
|
subscribeArbFeed(cb: (b: WsArbFeedBatch) => void): () => void;
|
|
6405
|
+
/**
|
|
6406
|
+
* Subscribe to the catalog feed: new, changed and deleted events and
|
|
6407
|
+
* markets. Live only — pair it with `GET /catalog/changes` (or use
|
|
6408
|
+
* `AggClient.watchCatalog`, which does both).
|
|
6409
|
+
*
|
|
6410
|
+
* One server subscription is shared by every caller. Its filter is the
|
|
6411
|
+
* union of the callers' filters (no filter when any caller has none), and
|
|
6412
|
+
* each caller only receives frames matching its own filter. The subscribe
|
|
6413
|
+
* is re-sent on every reconnect; `onSubscribed` fires each time the server
|
|
6414
|
+
* confirms it. Returns an unsubscribe function.
|
|
6415
|
+
*/
|
|
6416
|
+
subscribeCatalog(filter: CatalogFilter, cb: (change: WsCatalogChange) => void, opts?: CatalogSubscribeOptions): () => void;
|
|
6417
|
+
/**
|
|
6418
|
+
* Send the union filter if it differs from what the server holds. Callers
|
|
6419
|
+
* in `confirm` wait for this frame's ack. Returns whether a frame was sent.
|
|
6420
|
+
*/
|
|
6421
|
+
private sendCatalogSubscribe;
|
|
6422
|
+
private handleCatalogAck;
|
|
6423
|
+
private handleCatalogChange;
|
|
6143
6424
|
/**
|
|
6144
6425
|
* Subscribe to a feed by outcome ID.
|
|
6145
6426
|
* @param outcomeId The venueMarketOutcomeId to subscribe to.
|
|
@@ -6233,5 +6514,5 @@ declare class AggWebSocket {
|
|
|
6233
6514
|
private isOrderbookDebugEnabled;
|
|
6234
6515
|
}
|
|
6235
6516
|
//#endregion
|
|
6236
|
-
export { WsAttributedLevel as $, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW as $a, SmartRouteCustodyWarning as $i, GetCryptoReferencePricesOptions as $n, ComputeSplitsResponse as $o, PaperTradingPortfolio as $r, VenueMarket as $s, BalanceCustody as $t, isAggApiError as A, VenueGeoPolicyEntry as Aa, isVenueActive as Ac, RecurringCryptoWindowMarket as Ai, CryptoReferencePriceTarget as An, formatOutcomeLabel as Ao, OPTIONAL_SIGNATURE_TIMEOUT_MS as Ar, ServerWallet as As, WsWithdrawalLifecycleStatus as At, withTimeout as B, WithdrawPreviewResponse as Ba, ResolvedCorrelatedMarketsResponse as Bi, ExecutionDagProgress as Bn, ProvisionHostedVenueAccountBody as Bo, OutcomeMidpointRow as Br, UpdateUserBody as Bs, AggClientAuthOptions as Bt, CandleBuilder as C, UserActivityRedeemLeg as Ca, RETINA_IMAGE_SIZES as Cc, RecurringCryptoOutcomeOrderbookDepth as Ci, CreateBalanceRefillPolicyParams as Cn, isNonEmptyString as Co, NewsFeedMarketFeedResponse as Cr, OrderbookHistoryResponse as Cs, WsUnsubscribed as Ct, AggApiFieldError as D, UserActivityWithdrawal as Da, VENUE_CHAIN_IDS as Dc, RecurringCryptoSourceConfidence as Di, CryptoReferencePriceMarketInput as Dn, safeParse as Do, NewsFeedPageOptions as Dr, PriceSource as Ds, WsWithdrawalLegStatus as Dt, AggApiErrorInit as E, UserActivityUserOp as Ea, VENUES as Ec, RecurringCryptoResolution as Ei, CryptoReferencePriceExternalMarketInput as En, parseEmailStrict as Eo, NewsFeedMarketNewsResult as Er, PricePoint as Es, WsVenueLevel as Et, isPostFillFeeRequest as F, VenueSoloQuote as Fa, RedeemSelfCustodyParams as Fi, DepositAddressesSupportedChain as Fn, HostedVenueActivityQuery as Fo, OrderbookQuoteFill as Fr, SetupVenueKeyStep as Fs, AggAuthProviderType as Ft, computeChecksum as G, WithdrawalLegType as Ga, SearchResponse as Gi, ExecutionOrdersQuery as Gn, AttributedOrderbook as Go, PaperTradingAppOptions as Gr, ValidateManagedRequest as Gs, AggLinkAccountResult as Gt, OrderbookState as H, WithdrawalExpected as Ha, SELF_CUSTODY_FILL_TIMEOUT_MS as Hi, ExecutionDisplayStepKind as Hn, QuoteErrorCode as Ho, PaginatedResponse as Hr, UserHolding as Hs, AggClientSessionInput as Ht, isSameWalletAddress as I, WithdrawManagedParams as Ia, RequestedOrderbookMarket as Ii, DepositAddressesToken as In, HostedVenueBalance as Io, OrderbookQuoteParams as Ir, SyncBalancesResponse as Is, AggAuthStartBody as It, DiagnosticEvent as J, WithdrawalQuoteResponse as Ja, SignatureRequestType as Ji, ExecutionPositionsQuery as Jn, AuthTokenResponse as Jo, PaperTradingLiquidityStatus as Jr, VenueEvent as Js, AggregatedOrderbookLevel as Jt, snapshotToOrderbook as K, WithdrawalLifecycleStatus as Ka, SetPaperTradingBalanceParams as Ki, ExecutionOverallState as Kn, AttributedOrderbookLevel as Ko, PaperTradingBalanceAdjustment as Kr, ValidateTradeRequest as Ks, AggLinkAccountWalletConfirmBody as Kt, orderSignatureRound as L, WithdrawManagedResponse as La, ResetPaperTradingAccountParams as Li, EventBootstrapResponse as Ln, HostedVenueDepositAddress as Lo, OrderbookQuoteResponse as Lr, TradeSplit as Ls, AggAuthStartResult as Lt, isOptionalFeeRequest as M, VenueMarketRef as Ma, isVenueInactive as Mc, RedeemLegStatus as Mi, DepositAddressesPendingResponse as Mn, HostedVenueAccount as Mo, OrderbookBatchItemError as Mr, SettlementDifference as Ms, AggClient as Mt, isOrderSignatureStep as N, VenueOrderbookEntry as Na, RedeemRequest as Ni, DepositAddressesReadyResponse as Nn, HostedVenueActivity as No, OrderbookBatchItemErrorCode as Nr, SettlementSource as Ns, AggAuthDeliveryMode as Nt, AggRateLimitResponse as O, ValidateManagedParams as Oa, Venue as Oc, RecurringCryptoVenueMarket as Oi, CryptoReferencePriceResult as On, getWalletAddressFromUserProfile as Oo, NewsFeedStatusResponse as Or, PricesHistoryResponse as Os, WsWithdrawalLifecycleEvent as Ot, isPolymarketOrderSignatureStep as P, VenuePriceInfo as Pa, RedeemResponse as Pi, DepositAddressesResponse as Pn, HostedVenueActivityCode as Po, OrderbookBatchItemStatus as Pr, SetupDepositAddressStep as Ps, AggAuthPrivyVerifyBody as Pt, WsArbMarketUpdate as Q, projectedOrderbookChecksum as Qa, SmartRouteBridgeStep as Qi, ExecutionStatusStep as Qn, ComputeSplitsRequest as Qo, PaperTradingOrdersPage as Qr, VenueKeySummary as Qs, AuthStatus as Qt, signatureTimeoutMs as R, WithdrawManagedSourceItem as Ra, ResolveCorrelatedMarketsParams as Ri, ExecuteManagedParams as Rn, HostedVenueWithdrawal as Ro, OrderbookServiceUnavailableError as Rr, TradeStep as Rs, AggAuthVerifyBody as Rt, Candle as S, UserActivityRedeem as Sa, ImageSize as Sc, RecurringCryptoOutcome as Si, CorrelatedMarketsStatus as Sn, isFiniteNonNeg as So, NewsFeedMarketFeedItem as Sr, OrderbookHistoryPoint as Ss, WsTrade as St, AggApiError as T, UserActivityType as Ta, INACTIVE_VENUES as Tc, RecurringCryptoReferencePrice as Ti, CryptoReferencePriceError as Tn, parseEmail as To, NewsFeedMarketNewsResponse as Tr, PositionGroup as Ts, WsVenueInfo as Tt, VenueOrderbookLevel as U, WithdrawalLeg as Ua, SELF_CUSTODY_POLL_INTERVAL_MS as Ui, ExecutionMode as Un, Account as Uo, PaperTradingAccount as Ur, UserProfile as Us, AggLinkAccountBody as Ut, OrderbookLevel as V, WithdrawTokenSymbol as Va, RpcTokenResponse as Vi, ExecutionDisplayGroupStatus as Vn, QuoteError as Vo, OutcomeOrderbookResponse as Vr, UpsertVenueKey as Vs, AggClientOptions as Vt, applyOrderbookDelta as W, WithdrawalLegStatus as Wa, SearchParams as Wi, ExecutionOrderItem as Wn, App as Wo, PaperTradingAccountsPage as Wr, ValidateBalanceOnClientStep as Ws, AggLinkAccountConfirmResult as Wt, WsArbFeedBatch as X, WithdrawalSourceTokenSymbol as Xa, SimpleOrderbookLevel as Xi, ExecutionStatusQuery as Xn, BookQuality as Xo, PaperTradingMarkSource as Xr, VenueEventWithMarkets as Xs, AppClientConfigResponse as Xt, WsAppEvent as Y, WithdrawalSourceStatus as Ya, SignerFn as Yi, ExecutionStatusOrder as Yn, AuthUser as Yo, PaperTradingListParams as Yr, VenueEventListItem as Ys, AggregatedOrderbookResponse as Yt, WsArbFeedEntry as Z, orderbookCrc32 as Za, SmartRouteAllocation as Zi, ExecutionStatusResponse as Zn, Category as Zo, PaperTradingOrder as Zr, VenueKeyStatus as Zs, AppTradingMode as Zt, loadImmutableHistory as _, UpdateBalanceRefillPolicyParams as _a, MatchType as _c, RecurringCryptoDurationInput as _i, CorrelatedMarketQueryResult as _n, SafeParseSuccess as _o, NewsFeedArticleFeedResponse as _r, MidpointItem as _s, WsRedeemEvent as _t, BookWatchdogOptions as a, SmartRouteSettlementPlan as aa, WalletChainBalance as ac, PlacePaperTradingOrderParams as ai, BatchOrderbooksResponse as an, LimitPriceTickAdjustment as ao, LeaderboardSeries as ar, ExecuteTradeResponse as as, WsClientMessage as at, mergeClosedCandles as b, UserActivityItem as ba, AccountType as bc, RecurringCryptoOrderbookDepthLevel as bi, CorrelatedMarketSignalBatch as bn, isEmail as bo, NewsFeedListResponse as br, OrderListItem as bs, WsStreamInterrupted as bt, MarketDataEngine as c, SmartRouteStatus as ca, WithdrawalSource as cc, RampQuote as ci, CancelVenueOrderParams as cn, buildVenueUrl as co, LeaderboardStats as cr, GetHoldingsQuery as cs, WsErrorCode as ct, createAggClient as d, SportsLiveParticipant as da, OrderType as dc, RampWidgetSession as di, ChartCandle as dn, normalizeVenueMarketCluster as do, ManagedBalancesParams as dr, GetPositionsQuery as ds, WsMarketResolved as dt, SmartRouteFeeBreakdown as ea, VenueMarketListItem as ec, PaperTradingPosition as ei, BalanceRefillAttempt as en, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW as eo, GetOrdersParams as er, ComputeSplitsSelection as es, WsAuthExpired as et, HostedVenueFundingIntent as f, SportsLiveResponse as fa, TimeInForce as fc, RecurrenceCadence as fi, ChartHistoryManifest as fn, optimizedImageUrl as fo, ManagedBalancesResponse as fr, HelloResponse as fs, WsOrderEvent as ft, LoadImmutableHistoryOptions as g, TradeExecutorOrderListResponse as ga, MatchStatus as gc, RecurringCryptoDuration as gi, CorrelatedMarketCascadeResponse as gn, SafeParseResult as go, NewsFeedArticleFeedItem as gr, MatchedVenueMarketOutcomeRef as gs, WsOrderbookSnapshot as gt, prepareHostedVenueRoute as h, TradeExecutorOrder as ha, MarketStatus as hc, RecurringCryptoComparisonPriceSource as hi, CorrelatedMarketCascadeItem as hn, SafeParseFailure as ho, MidpointRow as hr, MatchedMidpointOutcome as hs, WsOrderbookDelta as ht, AggWebSocketOptions as i, SmartRouteSettlementLeg as ia, VerifyResponse as ic, PlaceLimitOrderResponse as ii, BatchMidpointsResponse as in, LimitPriceSide as io, LeaderboardRow as ir, ExecuteTradeRequest as is, WsCandleInterval as it, areOrdersFilled as j, VenueGeoPolicyResponse as ja, isVenueDataVisible as jc, RedeemLegResult as ji, CryptoReferencePricesResponse as jn, formatOutcomeTitle as jo, OrderListQuery as jr, SettlementDiff as js, computeBestSplitsByAmount as jt, TurnstileChallengeError as k, ValidateManagedResponse as ka, getEffectiveDisabledVenues as kc, RecurringCryptoWindowComparisons as ki, CryptoReferencePriceSource as kn, formatMarketQuestion as ko, OPTIONAL_FEE_SIGNATURE_TIMEOUT_MS as kr, ProphetxExecutionMode as ks, WsWithdrawalLifecycleLeg as kt, MarketView as l, SmartRouteVenueFill as la, WithdrawalSourceItem as lc, RampQuoteRequest as li, ChartBarsMeta as ln, sortVenues as lo, LimitOrderTimeInForce as lr, GetHoldingsResponse as ls, WsHeartbeat as lt, prepareHostedVenueFunding as m, TERMINAL_EXECUTION_STATES as ma, CONFIRMED_MATCH_STATUSES as mc, RecurringCryptoComparisonPoint as mi, ChartVenueCandles as mn, SplitsByAmountResult as mo, MatchedOrderbookMarket as mr, MatchedMidpoint as ms, WsOrderSubmitted as mt, AggWebSocketCallbacks as n, SmartRouteParams as na, VenuePositionBalance as nc, PersistedAuthSnapshot as ni, BalanceRefillPolicy as nn, isBalanceRefillWithinDailyCap as no, LeaderboardMetric as nr, DepositStep as ns, WsAuthenticated as nt, CandleTail as o, SmartRouteSetupCostLine as oa, WalletTokenBalance as oc, PositionRedeemStatus as oi, CancelManagedExecutionResponse as on, adjustLimitPriceRawToTick as oo, LeaderboardSeriesPoint as or, GetBalanceQuery as os, WsConnected as ot, HostedVenueFundingOptions as p, SportsLiveState as pa, TradeSide$1 as pc, RecurrenceFilter as pi, ChartResolution as pn, retinaImageUrl as po, MarkSource$1 as pr, MarketPriceHistory as ps, WsOrderEventType as pt, DiagnosticCallback as q, WithdrawalQuoteParams as qa, SignatureRequest as qi, ExecutionPositionGroup as qn, AuthCodeResponse as qo, PaperTradingBalanceResponse as qr, ValidateTradeResponse as qs, AggSessionUser as qt, AggWebSocketDiagnostics as r, SmartRouteResponse as ra, VerifyBody as rc, PlaceLimitOrderParams as ri, BalanceRefillPolicyStatus as rn, LIMIT_PRICE_RAW_SCALE as ro, LeaderboardQuery as rr, ExecuteManagedRequest as rs, WsBalanceUpdate as rt, HistoryRangeRequest as s, SmartRouteSide as sa, WithdrawManagedRequest as sc, RECURRENCE_CADENCES as si, CancelOrderSignature as sn, BuildVenueUrlOpts as so, LeaderboardSeriesQuery as sr, GetBalanceResponse as ss, WsError as st, AggWebSocket as t, SmartRouteFill as ta, VenueMarketOutcome as tc, PaperTradingPositionsPage as ti, BalanceRefillAttemptStatus as tn, getBalanceRefillMaximumRaw as to, GetPositionsParams as tr, CreateApp as ts, WsAuthExpiring as tt, MarketViewBatch as u, SportsGameStatus as ua, OrderStatus as uc, RampSessionRequest as ui, ChartBarsResponse as un, VenueMarketClusterNode as uo, ListRecurringCryptoMarketsOptions as ur, GetOrdersQuery as us, WsMarkSource as ut, aggregateMidpoint as v, UserActivityBridge as va, Chain as vc, RecurringCryptoMarketMetrics as vi, CorrelatedMarketSide as vn, enumGuard as vo, NewsFeedArticleWithSummary as vr, NonceResponse as vs, WsResumed as vt, CandleInterval as w, UserActivityTrade as wa, ACTIVE_VENUES as wc, RecurringCryptoPriceComparison as wi, CreatePaperTradingAccountParams as wn, parse as wo, NewsFeedMarketNewsParams as wr, OutcomeMidpoint as ws, WsVenueBook as wt, toChecksumAddress as x, UserActivityQuery as xa, IMAGE_SIZES as xc, RecurringCryptoOrderbookDepthSide as xi, CorrelatedMarketSignalDirection as xn, isEnum as xo, NewsFeedMarketFeedArticle as xr, Orderbook as xs, WsSubscribed as xt, mergeCandles as y, UserActivityDeposit as ya, AccountProvider as yc, RecurringCryptoMarketsResponse as yi, CorrelatedMarketSignal as yn, hasShape as yo, NewsFeedLinkedMarket as yr, NovigExecutionMode as ys, WsServerMessage as yt, userSignerAddresses as z, WithdrawPreviewParams as za, ResolveCorrelatedMarketsResponse as zi, ExecuteManagedResponse as zn, HostedVenueWithdrawalRequest as zo, OrderbooksOnlyError as zr, UnifiedBalanceResponse as zs, AggAuthWalletVerifyBody as zt };
|
|
6237
|
-
//# sourceMappingURL=agg-websocket-
|
|
6517
|
+
export { AggAuthStartBody as $, WsOrderbookDelta as $a, VenueSoloQuote as $i, OrderbookQuoteParams as $n, HostedVenueActivityQuery as $o, RequestedOrderbookMarket as $r, SetupVenueKeyStep as $s, DepositAddressesToken as $t, TurnstileChallengeError as A, DiagnosticCallback as Aa, TimeInForce as Ac, SportsLiveState as Ai, MarkSource as An, optimizedImageUrl as Ao, RecurrenceFilter as Ar, HelloResponse as As, ChartResolution as At, userSignerAddresses as B, WsBalanceUpdate as Ba, ImageSize as Bc, UserActivityRedeem as Bi, NewsFeedMarketFeedResponse as Bn, isFiniteNonNeg as Bo, RecurringCryptoOutcomeOrderbookDepth as Br, OrderbookHistoryPoint as Bs, CreateBalanceRefillPolicyParams as Bt, Candle as C, CatalogChangeOp as Ca, WalletChainBalance as Cc, SmartRouteSetupCostLine as Ci, LeaderboardSeriesPoint as Cn, LimitPriceTickAdjustment as Co, PositionRedeemStatus as Cr, ExecuteTradeResponse as Cs, CancelManagedExecutionResponse as Ct, AggApiErrorInit as D, CatalogFilter as Da, WithdrawalSourceItem as Dc, SportsGameStatus as Di, ListRecurringCryptoMarketsOptions as Dn, sortVenues as Do, RampSessionRequest as Dr, GetHoldingsResponse as Ds, ChartBarsResponse as Dt, AggApiError as E, CatalogEventSnapshot as Ea, WithdrawalSource as Ec, SmartRouteVenueFill as Ei, LimitOrderTimeInForce as En, buildVenueUrl as Eo, RampQuoteRequest as Er, GetHoldingsQuery as Es, ChartBarsMeta as Et, isPolymarketOrderSignatureStep as F, WsArbMarketUpdate as Fa, MatchType as Fc, UpdateBalanceRefillPolicyParams as Fi, NewsFeedArticleWithSummary as Fn, SafeParseSuccess as Fo, RecurringCryptoMarketMetrics as Fr, MidpointItem as Fs, CorrelatedMarketSide as Ft, applyOrderbookDelta as G, WsError as Ga, VENUE_CHAIN_IDS as Gc, UserActivityWithdrawal as Gi, NewsFeedStatusResponse as Gn, safeParse as Go, RecurringCryptoVenueMarket as Gr, PriceSource as Gs, CryptoReferencePriceResult as Gt, OrderbookLevel as H, WsCatalogChange as Ha, ACTIVE_VENUES as Hc, UserActivityTrade as Hi, NewsFeedMarketNewsResponse as Hn, parse as Ho, RecurringCryptoReferencePrice as Hr, OutcomeMidpoint as Hs, CryptoReferencePriceError as Ht, isPostFillFeeRequest as I, WsAttributedLevel as Ia, Chain as Ic, UserActivityBridge as Ii, NewsFeedLinkedMarket as In, enumGuard as Io, RecurringCryptoMarketsResponse as Ir, NonceResponse as Is, CorrelatedMarketSignal as It, computeBestSplitsByAmount as J, WsMarkSource as Ja, isVenueActive as Jc, VenueGeoPolicyEntry as Ji, OrderListQuery as Jn, formatOutcomeLabel as Jo, RedeemLegResult as Jr, ServerWallet as Js, CryptoReferencePricesResponse as Jt, computeChecksum as K, WsErrorCode as Ka, Venue as Kc, ValidateManagedParams as Ki, OPTIONAL_FEE_SIGNATURE_TIMEOUT_MS as Kn, getWalletAddressFromUserProfile as Ko, RecurringCryptoWindowComparisons as Kr, PricesHistoryResponse as Ks, CryptoReferencePriceSource as Kt, isSameWalletAddress as L, WsAuthExpired as La, AccountProvider as Lc, UserActivityDeposit as Li, NewsFeedListResponse as Ln, hasShape as Lo, RecurringCryptoOrderbookDepthLevel as Lr, NovigExecutionMode as Ls, CorrelatedMarketSignalBatch as Lt, areOrdersFilled as M, WsAppEvent as Ma, CONFIRMED_MATCH_STATUSES as Mc, TERMINAL_EXECUTION_STATES as Mi, MidpointRow as Mn, SplitsByAmountResult as Mo, RecurringCryptoComparisonPriceSource as Mr, MatchedMidpoint as Ms, CorrelatedMarketCascadeItem as Mt, isOptionalFeeRequest as N, WsArbFeedBatch as Na, MarketStatus as Nc, TradeExecutorOrder as Ni, NewsFeedArticleFeedItem as Nn, SafeParseFailure as No, RecurringCryptoDuration as Nr, MatchedMidpointOutcome as Ns, CorrelatedMarketCascadeResponse as Nt, AggApiFieldError as O, CatalogMarketSnapshot as Oa, OrderStatus as Oc, SportsLiveParticipant as Oi, ManagedBalancesParams as On, VenueMarketClusterNode as Oo, RampWidgetSession as Or, GetOrdersQuery as Os, ChartCandle as Ot, isOrderSignatureStep as P, WsArbFeedEntry as Pa, MatchStatus as Pc, TradeExecutorOrderListResponse as Pi, NewsFeedArticleFeedResponse as Pn, SafeParseResult as Po, RecurringCryptoDurationInput as Pr, MatchedVenueMarketOutcomeRef as Ps, CorrelatedMarketQueryResult as Pt, AggAuthProviderType as Q, WsOrderSubmitted as Qa, VenuePriceInfo as Qi, OrderbookQuoteFill as Qn, HostedVenueActivityCode as Qo, RedeemSelfCustodyParams as Qr, SetupDepositAddressStep as Qs, DepositAddressesSupportedChain as Qt, orderSignatureRound as R, WsAuthExpiring as Ra, AccountType as Rc, UserActivityItem as Ri, NewsFeedMarketFeedArticle as Rn, isEmail as Ro, RecurringCryptoOrderbookDepthSide as Rr, OrderListItem as Rs, CorrelatedMarketSignalDirection as Rt, toChecksumAddress as S, CatalogChange as Sa, VerifyResponse as Sc, SmartRouteSettlementPlan as Si, LeaderboardSeries as Sn, LimitPriceSide as So, PlacePaperTradingOrderParams as Sr, ExecuteTradeRequest as Ss, BatchOrderbooksResponse as St, CandleInterval as T, CatalogEntity as Ta, WithdrawManagedRequest as Tc, SmartRouteStatus as Ti, LeaderboardStats as Tn, BuildVenueUrlOpts as To, RampQuote as Tr, GetBalanceResponse as Ts, CancelVenueOrderParams as Tt, OrderbookState as U, WsClientMessage as Ua, INACTIVE_VENUES as Uc, UserActivityType as Ui, NewsFeedMarketNewsResult as Un, parseEmail as Uo, RecurringCryptoResolution as Ur, PositionGroup as Us, CryptoReferencePriceExternalMarketInput as Ut, withTimeout as V, WsCandleInterval as Va, RETINA_IMAGE_SIZES as Vc, UserActivityRedeemLeg as Vi, NewsFeedMarketNewsParams as Vn, isNonEmptyString as Vo, RecurringCryptoPriceComparison as Vr, OrderbookHistoryResponse as Vs, CreatePaperTradingAccountParams as Vt, VenueOrderbookLevel as W, WsConnected as Wa, VENUES as Wc, UserActivityUserOp as Wi, NewsFeedPageOptions as Wn, parseEmailStrict as Wo, RecurringCryptoSourceConfidence as Wr, PricePoint as Ws, CryptoReferencePriceMarketInput as Wt, AggAuthDeliveryMode as X, WsOrderEvent as Xa, isVenueInactive as Xc, VenueMarketRef as Xi, OrderbookBatchItemErrorCode as Xn, HostedVenueAccount as Xo, RedeemRequest as Xr, SettlementDifference as Xs, DepositAddressesReadyResponse as Xt, AggClient as Y, WsMarketResolved as Ya, isVenueDataVisible as Yc, VenueGeoPolicyResponse as Yi, OrderbookBatchItemError as Yn, formatOutcomeTitle as Yo, RedeemLegStatus as Yr, SettlementDiff as Ys, DepositAddressesPendingResponse as Yt, AggAuthPrivyVerifyBody as Z, WsOrderEventType as Za, VenueOrderbookEntry as Zi, OrderbookBatchItemStatus as Zn, HostedVenueActivity as Zo, RedeemResponse as Zr, SettlementSource as Zs, DepositAddressesResponse as Zt, LoadImmutableHistoryOptions as _, CatalogWatchHandle as _a, VenueMarket as _c, SmartRouteFeeBreakdown as _i, GetOrdersParams as _n, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW as _o, PaperTradingPosition as _r, ComputeSplitsResponse as _s, BalanceRefillAttempt as _t, BookWatchdogOptions as a, WithdrawTokenSymbol as aa, UpsertVenueKey as ac, SELF_CUSTODY_FILL_TIMEOUT_MS as ai, ExecutionDisplayStepKind as an, WsSubscribed as ao, PaginatedResponse as ar, QuoteError as as, AggClientSessionInput as at, mergeCandles as b, isCatalogResyncRequired as ba, VenuePositionBalance as bc, SmartRouteResponse as bi, LeaderboardQuery as bn, isBalanceRefillWithinDailyCap as bo, PlaceLimitOrderParams as br, DepositStep as bs, BalanceRefillPolicyStatus as bt, HistoryRangeRequest as c, WithdrawalLegStatus as ca, ValidateBalanceOnClientStep as cc, SearchResponse as ci, ExecutionOrdersQuery as cn, WsVenueBook as co, PaperTradingAppOptions as cr, App as cs, AggLinkAccountResult as ct, MarketViewBatch as d, WithdrawalQuoteParams as da, ValidateTradeResponse as dc, SignatureRequestType as di, ExecutionPositionsQuery as dn, WsWithdrawalLegStatus as do, PaperTradingLiquidityStatus as dr, AuthCodeResponse as ds, AggregatedOrderbookLevel as dt, WithdrawManagedParams as ea, SyncBalancesResponse as ec, ResetPaperTradingAccountParams as ei, EventBootstrapResponse as en, WsOrderbookSnapshot as eo, OrderbookQuoteResponse as er, HostedVenueBalance as es, AggAuthStartResult as et, createAggClient as f, WithdrawalQuoteResponse as fa, VenueEvent as fc, SignerFn as fi, ExecutionStatusOrder as fn, WsWithdrawalLifecycleEvent as fo, PaperTradingListParams as fr, AuthTokenResponse as fs, AggregatedOrderbookResponse as ft, prepareHostedVenueRoute as g, CatalogChangesPage as ga, VenueKeySummary as gc, SmartRouteCustodyWarning as gi, GetCryptoReferencePricesOptions as gn, projectedOrderbookChecksum as go, PaperTradingPortfolio as gr, ComputeSplitsRequest as gs, BalanceCustody as gt, prepareHostedVenueFunding as h, CATALOG_DEFAULT_OVERLAP_MS as ha, VenueKeyStatus as hc, SmartRouteBridgeStep as hi, ExecutionStatusStep as hn, orderbookCrc32 as ho, PaperTradingOrdersPage as hr, Category as hs, AuthStatus as ht, AggWebSocketOptions as i, WithdrawPreviewResponse as ia, UpdateUserBody as ic, RpcTokenResponse as ii, ExecutionDisplayGroupStatus as in, WsStreamInterrupted as io, OutcomeOrderbookResponse as ir, ProvisionHostedVenueAccountBody as is, AggClientOptions as it, isAggApiError as j, DiagnosticEvent as ja, TradeSide$1 as jc, SubmitSignature as ji, MatchedOrderbookMarket as jn, retinaImageUrl as jo, RecurringCryptoComparisonPoint as jr, MarketPriceHistory as js, ChartVenueCandles as jt, AggRateLimitResponse as k, CatalogOutcomeRef as ka, OrderType as kc, SportsLiveResponse as ki, ManagedBalancesResponse as kn, normalizeVenueMarketCluster as ko, RecurrenceCadence as kr, GetPositionsQuery as ks, ChartHistoryManifest as kt, MarketDataEngine as l, WithdrawalLegType as la, ValidateManagedRequest as lc, SetPaperTradingBalanceParams as li, ExecutionOverallState as ln, WsVenueInfo as lo, PaperTradingBalanceAdjustment as lr, AttributedOrderbook as ls, AggLinkAccountWalletConfirmBody as lt, HostedVenueFundingOptions as m, WithdrawalSourceTokenSymbol as ma, VenueEventWithMarkets as mc, SmartRouteAllocation as mi, ExecutionStatusResponse as mn, WsWithdrawalLifecycleStatus as mo, PaperTradingOrder as mr, BookQuality as ms, AppTradingMode as mt, AggWebSocketCallbacks as n, WithdrawManagedSourceItem as na, TradeStep as nc, ResolveCorrelatedMarketsResponse as ni, ExecuteManagedResponse as nn, WsResumed as no, OrderbooksOnlyError as nr, HostedVenueWithdrawal as ns, AggAuthWalletVerifyBody as nt, CatalogSubscribeOptions as o, WithdrawalExpected as oa, UserHolding as oc, SELF_CUSTODY_POLL_INTERVAL_MS as oi, ExecutionMode as on, WsTrade as oo, PaperTradingAccount as or, QuoteErrorCode as os, AggLinkAccountBody as ot, HostedVenueFundingIntent as p, WithdrawalSourceStatus as pa, VenueEventListItem as pc, SimpleOrderbookLevel as pi, ExecutionStatusQuery as pn, WsWithdrawalLifecycleLeg as po, PaperTradingMarkSource as pr, AuthUser as ps, AppClientConfigResponse as pt, snapshotToOrderbook as q, WsHeartbeat as qa, getEffectiveDisabledVenues as qc, ValidateManagedResponse as qi, OPTIONAL_SIGNATURE_TIMEOUT_MS as qn, formatMarketQuestion as qo, RecurringCryptoWindowMarket as qr, ProphetxExecutionMode as qs, CryptoReferencePriceTarget as qt, AggWebSocketDiagnostics as r, WithdrawPreviewParams as ra, UnifiedBalanceResponse as rc, ResolvedCorrelatedMarketsResponse as ri, ExecutionDagProgress as rn, WsServerMessage as ro, OutcomeMidpointRow as rr, HostedVenueWithdrawalRequest as rs, AggClientAuthOptions as rt, CandleTail as s, WithdrawalLeg as sa, UserProfile as sc, SearchParams as si, ExecutionOrderItem as sn, WsUnsubscribed as so, PaperTradingAccountsPage as sr, Account as ss, AggLinkAccountConfirmResult as st, AggWebSocket as t, WithdrawManagedResponse as ta, TradeSplit as tc, ResolveCorrelatedMarketsParams as ti, ExecuteManagedParams as tn, WsRedeemEvent as to, OrderbookServiceUnavailableError as tr, HostedVenueDepositAddress as ts, AggAuthVerifyBody as tt, MarketView as u, WithdrawalLifecycleStatus as ua, ValidateTradeRequest as uc, SignatureRequest as ui, ExecutionPositionGroup as un, WsVenueLevel as uo, PaperTradingBalanceResponse as ur, AttributedOrderbookLevel as us, AggSessionUser as ut, loadImmutableHistory as v, GetCatalogChangesParams as va, VenueMarketListItem as vc, SmartRouteFill as vi, GetPositionsParams as vn, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW as vo, PaperTradingPositionsPage as vr, ComputeSplitsSelection as vs, BalanceRefillAttemptStatus as vt, CandleBuilder as w, CatalogClusterFields as wa, WalletTokenBalance as wc, SmartRouteSide as wi, LeaderboardSeriesQuery as wn, adjustLimitPriceRawToTick as wo, RECURRENCE_CADENCES as wr, GetBalanceQuery as ws, CancelOrderSignature as wt, mergeClosedCandles as x, CatalogCategoryRef as xa, VerifyBody as xc, SmartRouteSettlementLeg as xi, LeaderboardRow as xn, LIMIT_PRICE_RAW_SCALE as xo, PlaceLimitOrderResponse as xr, ExecuteManagedRequest as xs, BatchMidpointsResponse as xt, aggregateMidpoint as y, WatchCatalogOptions as ya, VenueMarketOutcome as yc, SmartRouteParams as yi, LeaderboardMetric as yn, getBalanceRefillMaximumRaw as yo, PersistedAuthSnapshot as yr, CreateApp as ys, BalanceRefillPolicy as yt, signatureTimeoutMs as z, WsAuthenticated as za, IMAGE_SIZES as zc, UserActivityQuery as zi, NewsFeedMarketFeedItem as zn, isEnum as zo, RecurringCryptoOutcome as zr, Orderbook as zs, CorrelatedMarketsStatus as zt };
|
|
6518
|
+
//# sourceMappingURL=agg-websocket-CvYdVJPc.d.mts.map
|