@hyperbridge/simplex 0.16.12 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/simplex.js +1728 -409
- package/dist/bin/simplex.js.map +1 -1
- package/dist/index.cjs +1086 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +224 -23
- package/dist/index.d.ts +224 -23
- package/dist/index.js +1080 -134
- package/dist/index.js.map +1 -1
- package/dist/sqlite.cjs +67 -4
- package/dist/sqlite.cjs.map +1 -1
- package/dist/sqlite.d.cts +21 -2
- package/dist/sqlite.d.ts +21 -2
- package/dist/sqlite.js +66 -4
- package/dist/sqlite.js.map +1 -1
- package/dist/{types-B5zkFhxR.d.cts → types-BPyUX8qu.d.cts} +64 -1
- package/dist/{types-B5zkFhxR.d.ts → types-BPyUX8qu.d.ts} +64 -1
- package/dist/ui/assets/Novatica-Medium-CjNgGPEL.ttf +0 -0
- package/dist/ui/assets/index-CK8E6aPx.css +1 -0
- package/dist/ui/assets/index-D8DLeEH0.js +106 -0
- package/dist/ui/index.html +2 -2
- package/package.json +5 -5
- package/dist/ui/assets/index-QU1Ik7IX.js +0 -106
- package/dist/ui/assets/index-XKHMOpY2.css +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { EventEmitter as EventEmitter$1 } from 'node:events';
|
|
|
2
2
|
import { HexString, ERC7821Call, ChainConfig, Order, TokenInfo, IntentsCoprocessor, ExecutionResult, IntentGateway, FillOptions, FillerConfig as FillerConfig$1 } from '@hyperbridge/sdk';
|
|
3
3
|
import { PublicClient, Hash, AbiEvent, BlockNumber, BlockTag, GetLogsParameters, GetLogsReturnType, WalletClient, Transport, Chain } from 'viem';
|
|
4
4
|
import { LocalAccount, Account } from 'viem/accounts';
|
|
5
|
-
import { L as LoggerContext, a as LogLevel, b as Logger, A as ActivityStore, c as ActivityInsert, d as ActivityEvent, O as OrderHistoryPage, W as WalletTx, e as LimitOrderStore, f as LimitOrder, g as LimitOrderFilter, B as BidStore, S as SimplexDataStore, h as LimitOrderFill, i as StoredBid, j as LogSink, k as BidStats, l as StateStore } from './types-
|
|
6
|
-
export { m as ActivityType, n as BidInsert, o as
|
|
5
|
+
import { L as LoggerContext, a as LogLevel, b as Logger, A as ActivityStore, c as ActivityInsert, d as ActivityEvent, O as OrderHistoryPage, W as WalletTx, e as LimitOrderStore, f as LimitOrder, g as LimitOrderFilter, B as BidStore, S as SimplexDataStore, h as LimitOrderFill, i as StoredBid, j as LogSink, k as BidStats, l as StateStore, I as InventoryStore } from './types-BPyUX8qu.cjs';
|
|
6
|
+
export { m as ActivityType, n as BidInsert, o as InventorySnapshot, p as LimitOrderFillInsert, q as LimitOrderFillRecord, r as LimitOrderHold, s as LimitOrderInsert, t as LimitOrderPosting, u as LimitOrderSide, v as LimitOrderStatus, w as OperatorNotification, R as RuntimeState, x as WalletTxKind, y as addLogSink, z as configureLogger, C as getLogger } from './types-BPyUX8qu.cjs';
|
|
7
7
|
import { ChannelCredentials } from '@grpc/grpc-js';
|
|
8
8
|
import { EventEmitter } from 'events';
|
|
9
9
|
import Decimal$1, { Decimal } from 'decimal.js';
|
|
@@ -936,7 +936,11 @@ declare class UserOpSender {
|
|
|
936
936
|
*/
|
|
937
937
|
private estimateGas;
|
|
938
938
|
private buildSignedUserOp;
|
|
939
|
-
/**
|
|
939
|
+
/**
|
|
940
|
+
* Mirrors the gas-price selection used by the delegation and fill paths: Pimlico's and
|
|
941
|
+
* Alchemy's own pricing, otherwise the chain's gas price raised to the priority fee a
|
|
942
|
+
* rundler bundler requires, when the bundler gives one.
|
|
943
|
+
*/
|
|
940
944
|
private getGasPrice;
|
|
941
945
|
private sendBundlerRpc;
|
|
942
946
|
private waitForUserOpReceipt;
|
|
@@ -1419,10 +1423,10 @@ declare function validateAssetDefinitions(assets: Record<string, AssetDefinition
|
|
|
1419
1423
|
* 1. the user's `[assets]` table — an *escape hatch* for assets the registry
|
|
1420
1424
|
* doesn't ship (or per-deployment overrides), never required for shipped
|
|
1421
1425
|
* symbols;
|
|
1422
|
-
* 2. shipped symbols (USDC, USDT, DAI, CNGN, USDR, ZARP, EURC, XSGD, TRYB
|
|
1423
|
-
* resolved per chain from the SDK chain registry (`chain.ts`) —
|
|
1424
|
-
* source of truth shared with the rest of the SDK, so an
|
|
1425
|
-
* correction there is never shadowed by a parallel table here.
|
|
1426
|
+
* 2. shipped symbols (USDC, USDT, DAI, CNGN, USDR, ZARP, EURC, XSGD, TRYB,
|
|
1427
|
+
* BRIDGE) resolved per chain from the SDK chain registry (`chain.ts`) —
|
|
1428
|
+
* the single source of truth shared with the rest of the SDK, so an
|
|
1429
|
+
* address correction there is never shadowed by a parallel table here.
|
|
1426
1430
|
*
|
|
1427
1431
|
* Address lookups are per `(symbol, chain)` — a chain where no layer knows the
|
|
1428
1432
|
* asset simply doesn't trade pairs involving it. The registry holds addresses
|
|
@@ -1605,6 +1609,85 @@ declare class BalanceProvider extends EventEmitter$1 {
|
|
|
1605
1609
|
private trackHyperbridgeBalance;
|
|
1606
1610
|
}
|
|
1607
1611
|
|
|
1612
|
+
/** The stretch of time a summary covers. Each is cut into buckets of one size. */
|
|
1613
|
+
type ProfitPeriod = "7d" | "30d" | "12w" | "12m" | "all";
|
|
1614
|
+
type ProfitBucket = "day" | "week" | "month" | "year";
|
|
1615
|
+
/** What a stretch of fills came to, in dollars at the latest rate. Unpriced tokens are left out. */
|
|
1616
|
+
interface ProfitFigures {
|
|
1617
|
+
/** What the stretch's fills added to inventory, less what they took out of it. */
|
|
1618
|
+
profitUsd: number;
|
|
1619
|
+
/** The inventory held when the stretch began. Null when nothing within reach of then records it. */
|
|
1620
|
+
startInventoryUsd: number | null;
|
|
1621
|
+
/** `profitUsd` over `startInventoryUsd`, as a percentage. Null without a starting inventory. */
|
|
1622
|
+
returnPct: number | null;
|
|
1623
|
+
/**
|
|
1624
|
+
* What moved in and out over the stretch other than through fills, net: deposits, withdrawals,
|
|
1625
|
+
* fees and vault yield. Null when the indexer has no reading for both ends of the stretch.
|
|
1626
|
+
*/
|
|
1627
|
+
transfersUsd: number | null;
|
|
1628
|
+
boughtUsd: number;
|
|
1629
|
+
soldUsd: number;
|
|
1630
|
+
buys: number;
|
|
1631
|
+
sells: number;
|
|
1632
|
+
}
|
|
1633
|
+
interface ProfitBucketFigures extends ProfitFigures {
|
|
1634
|
+
/** When the bucket starts, in milliseconds since the epoch. */
|
|
1635
|
+
start: number;
|
|
1636
|
+
}
|
|
1637
|
+
/** One book's buys against its sells over the period, in the book's own tokens. */
|
|
1638
|
+
interface BookProfit {
|
|
1639
|
+
book: string;
|
|
1640
|
+
base: string;
|
|
1641
|
+
quote: string;
|
|
1642
|
+
/** Base bought and sold in the period. */
|
|
1643
|
+
bought: number;
|
|
1644
|
+
sold: number;
|
|
1645
|
+
/** Quote per base, averaged over the period's buys and its sells. Null for a side with none. */
|
|
1646
|
+
averageBuy: number | null;
|
|
1647
|
+
averageSell: number | null;
|
|
1648
|
+
/** How far the average sell sits above the average buy, as a percentage. Null without both. */
|
|
1649
|
+
spreadPct: number | null;
|
|
1650
|
+
/** What the period's fills did to the base and the quote held: positive is more than before. */
|
|
1651
|
+
baseChange: number;
|
|
1652
|
+
quoteChange: number;
|
|
1653
|
+
/** The rate the book's tokens are valued at: midway between its latest buy and latest sell. */
|
|
1654
|
+
rate: number | null;
|
|
1655
|
+
/** Both changes in dollars. Null when the book's tokens have no dollar price. */
|
|
1656
|
+
profitUsd: number | null;
|
|
1657
|
+
}
|
|
1658
|
+
/** The inventory a period began with, token by token. */
|
|
1659
|
+
interface StartingInventory {
|
|
1660
|
+
/** The instant it describes, in milliseconds since the epoch. */
|
|
1661
|
+
at: number;
|
|
1662
|
+
/** A stored snapshot, or the balances as they stand now. Either is adjusted by what happened between. */
|
|
1663
|
+
source: "snapshot" | "balances";
|
|
1664
|
+
/** When that record was taken. */
|
|
1665
|
+
recordedAt: number;
|
|
1666
|
+
usd: number;
|
|
1667
|
+
tokens: Array<{
|
|
1668
|
+
symbol: string;
|
|
1669
|
+
amount: number;
|
|
1670
|
+
usd: number | null;
|
|
1671
|
+
}>;
|
|
1672
|
+
}
|
|
1673
|
+
interface Profitability {
|
|
1674
|
+
period: ProfitPeriod;
|
|
1675
|
+
bucket: ProfitBucket;
|
|
1676
|
+
/** The start of the first bucket and the moment the summary was taken, in milliseconds. */
|
|
1677
|
+
from: number;
|
|
1678
|
+
to: number;
|
|
1679
|
+
totals: ProfitFigures;
|
|
1680
|
+
/** One entry per bucket, oldest first, including buckets nothing happened in. */
|
|
1681
|
+
series: ProfitBucketFigures[];
|
|
1682
|
+
books: BookProfit[];
|
|
1683
|
+
/** Null when there is no snapshot, and the period began more than {@link BALANCES_REACH_MS} ago. */
|
|
1684
|
+
startInventory: StartingInventory | null;
|
|
1685
|
+
/** Fills in the period priced at their order's rate, because they kept no record of what they took in. */
|
|
1686
|
+
estimatedFills: number;
|
|
1687
|
+
/** Tokens the period touched that have no dollar price, and so are in none of the dollar figures. */
|
|
1688
|
+
unpricedTokens: string[];
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1608
1691
|
/**
|
|
1609
1692
|
* Wire contracts between the UI server and the browser bundle. The server
|
|
1610
1693
|
* types its response literals with these and `ui/src` imports them type-only,
|
|
@@ -1751,7 +1834,7 @@ interface FillerTomlConfig {
|
|
|
1751
1834
|
* Optional asset-registry escape hatch: symbol → { chain → address }. Only
|
|
1752
1835
|
* needed for assets the built-in registry does not ship, or to override a
|
|
1753
1836
|
* shipped address for a deployment. Shipped symbols: USDC, USDT, DAI, CNGN
|
|
1754
|
-
* (SDK chain registry) + curated USDR, ZARP, EURC, XSGD and
|
|
1837
|
+
* (SDK chain registry) + curated USDR, ZARP, EURC, XSGD, TRYB and BRIDGE.
|
|
1755
1838
|
*/
|
|
1756
1839
|
assets?: Record<string, AssetDefinition>;
|
|
1757
1840
|
/**
|
|
@@ -2044,6 +2127,8 @@ interface BidPlan {
|
|
|
2044
2127
|
fillerOutputs: TokenInfo[];
|
|
2045
2128
|
/** The take signed beside each output: the escrow this bid's fill earns. */
|
|
2046
2129
|
fillerInputs: TokenInfo[];
|
|
2130
|
+
/** The decimals `fillerInputs[leg]` is counted in: the input token's, on the order's source chain. */
|
|
2131
|
+
inputDecimals?: number;
|
|
2047
2132
|
fundingCalls: ERC7821Call[];
|
|
2048
2133
|
partialFill: boolean;
|
|
2049
2134
|
profit: number;
|
|
@@ -2167,6 +2252,7 @@ declare class ContractInteractionService {
|
|
|
2167
2252
|
cacheService: CacheService;
|
|
2168
2253
|
private logger;
|
|
2169
2254
|
private sdkHelperCache;
|
|
2255
|
+
private blockTimes;
|
|
2170
2256
|
private solverAccountAddress;
|
|
2171
2257
|
private signer;
|
|
2172
2258
|
constructor(clientManager: ChainClientManager, configService: FillerConfigService, signer: Signer, sharedCacheService?: CacheService);
|
|
@@ -2325,11 +2411,28 @@ declare class ContractInteractionService {
|
|
|
2325
2411
|
*
|
|
2326
2412
|
* Operators configure seconds because that is the unit the risk is actually in, but the
|
|
2327
2413
|
* contract compares against block numbers so `order.deadline` and this read the same
|
|
2328
|
-
* clock. The conversion uses the chain's
|
|
2329
|
-
* up, since erring long costs a slightly stale quote while erring
|
|
2330
|
-
* winnable bids.
|
|
2414
|
+
* clock. The conversion uses the chain's block time from {@link blockTimeSeconds}; it is
|
|
2415
|
+
* deliberately rounded up, since erring long costs a slightly stale quote while erring
|
|
2416
|
+
* short silently drops winnable bids.
|
|
2331
2417
|
*/
|
|
2332
2418
|
private bidValidUntilBlock;
|
|
2419
|
+
/**
|
|
2420
|
+
* Seconds per block on `chain`. Measured once, when simplex starts ({@link initCache}), and
|
|
2421
|
+
* kept until it stops. A chain with no measurement yet, because it was added later or its
|
|
2422
|
+
* blocks could not be read at startup, is measured at its first bid.
|
|
2423
|
+
*
|
|
2424
|
+
* The nominal `Chain.blockTime` cannot be relied on alone: it goes stale when a chain
|
|
2425
|
+
* speeds up (BSC makes a block every 0.45s against a declared 0.75s) and some chains
|
|
2426
|
+
* declare none. Converting at a slower block time than the chain's ends a bid early, so
|
|
2427
|
+
* the faster of the measured and the declared figure is used, and a stalled or idle
|
|
2428
|
+
* stretch in the sample never shortens a bid.
|
|
2429
|
+
*
|
|
2430
|
+
* Blocks that cannot be read fall back to the declared figure, then to
|
|
2431
|
+
* {@link FALLBACK_BLOCK_TIME_SECONDS}. That answer is not kept.
|
|
2432
|
+
*/
|
|
2433
|
+
private blockTimeSeconds;
|
|
2434
|
+
/** The average block time over the chain's last {@link BLOCK_TIME_SAMPLE_BLOCKS} blocks, in seconds. */
|
|
2435
|
+
private measureBlockTimeSeconds;
|
|
2333
2436
|
/**
|
|
2334
2437
|
* Builds the signed, never-executed UserOperation that carries one limit order
|
|
2335
2438
|
* to the HyperFX orderbook.
|
|
@@ -2701,6 +2804,52 @@ interface Book {
|
|
|
2701
2804
|
base: string;
|
|
2702
2805
|
quote: string;
|
|
2703
2806
|
}
|
|
2807
|
+
/** Live price levels. All prices and sizes are decimal integer strings at 1e18. */
|
|
2808
|
+
interface OrderbookLevel {
|
|
2809
|
+
fillChain: string;
|
|
2810
|
+
priceBucket: string;
|
|
2811
|
+
price: string;
|
|
2812
|
+
worstPrice: string;
|
|
2813
|
+
baseSize: string;
|
|
2814
|
+
quoteSize: string;
|
|
2815
|
+
orderCount: number;
|
|
2816
|
+
solverCount: number;
|
|
2817
|
+
}
|
|
2818
|
+
interface OrderbookSnapshot extends Book {
|
|
2819
|
+
/** Best first: bids descending, asks ascending. */
|
|
2820
|
+
bids: OrderbookLevel[];
|
|
2821
|
+
asks: OrderbookLevel[];
|
|
2822
|
+
/** True backing liquidity, in quote for bids and base for asks. */
|
|
2823
|
+
bidLiquidity: string;
|
|
2824
|
+
askLiquidity: string;
|
|
2825
|
+
/** Price bucket width, quote per 1 base at 1e18; null when the orderbook does not report one. */
|
|
2826
|
+
granularity: string | null;
|
|
2827
|
+
}
|
|
2828
|
+
/** One solver's order inside a price level. Prices and sizes are decimal integer strings at 1e18. */
|
|
2829
|
+
interface OrderbookLevelOrder {
|
|
2830
|
+
solver: string;
|
|
2831
|
+
commitment: string;
|
|
2832
|
+
fillChain: string;
|
|
2833
|
+
price: string;
|
|
2834
|
+
/** What the order publishes as depth, in the token its side pays out: quote for bids, base for asks. */
|
|
2835
|
+
advertisedSize: string;
|
|
2836
|
+
/** The signed output before any balance cap, in the same token as `advertisedSize`. */
|
|
2837
|
+
quotedAmount: string;
|
|
2838
|
+
/** True when the solver's balance, not the quote, binds `advertisedSize`. */
|
|
2839
|
+
resized: boolean;
|
|
2840
|
+
expiresAt: string;
|
|
2841
|
+
acceptedSources: string[];
|
|
2842
|
+
}
|
|
2843
|
+
interface OrderbookLevelQuery {
|
|
2844
|
+
side: "BID" | "ASK";
|
|
2845
|
+
fillChain: string;
|
|
2846
|
+
priceBucket: string;
|
|
2847
|
+
sourceChain?: string;
|
|
2848
|
+
}
|
|
2849
|
+
interface OrderbookFilters {
|
|
2850
|
+
sourceChain?: string;
|
|
2851
|
+
fillChain?: string;
|
|
2852
|
+
}
|
|
2704
2853
|
interface TokenMinSize {
|
|
2705
2854
|
symbol: string;
|
|
2706
2855
|
size: string;
|
|
@@ -2851,6 +3000,14 @@ declare class OrderbookClient {
|
|
|
2851
3000
|
constructor(url: string, requestTimeoutMs: number, loggers?: LoggerContext);
|
|
2852
3001
|
/** The limits to validate against before posting, plus the books on offer. */
|
|
2853
3002
|
limits(): Promise<OrderbookLimits>;
|
|
3003
|
+
/** The public book across all solvers, restricted to the selected route. */
|
|
3004
|
+
snapshot(id: string, filters?: OrderbookFilters): Promise<OrderbookSnapshot | null>;
|
|
3005
|
+
/**
|
|
3006
|
+
* The orders behind one price level. The orderbook filters orders by side and route but not by
|
|
3007
|
+
* price bucket, so this walks the side's orders on the level's fill chain and keeps the bucket.
|
|
3008
|
+
* Null when the book does not exist.
|
|
3009
|
+
*/
|
|
3010
|
+
levelOrders(id: string, level: OrderbookLevelQuery): Promise<OrderbookLevelOrder[] | null>;
|
|
2854
3011
|
submitOrder(userOp: HexString): Promise<SubmitOrderResult>;
|
|
2855
3012
|
/**
|
|
2856
3013
|
* The entry this solver holds at `commitment`, or null when it holds none.
|
|
@@ -2949,7 +3106,10 @@ interface CancelledLimitOrder {
|
|
|
2949
3106
|
interface ReconcileReport {
|
|
2950
3107
|
/** Orderbook entries no limit order here owns, now withdrawn. */
|
|
2951
3108
|
cancelled: number;
|
|
2952
|
-
/**
|
|
3109
|
+
/**
|
|
3110
|
+
* Limit orders posted again: their entry had gone, or it was signed for an
|
|
3111
|
+
* EntryPoint the fill chain no longer uses.
|
|
3112
|
+
*/
|
|
2953
3113
|
reposted: number;
|
|
2954
3114
|
/** Postings the orderbook is not backing in full, left alone and surfaced. */
|
|
2955
3115
|
underFunded: number;
|
|
@@ -2985,6 +3145,8 @@ declare class LimitOrderService {
|
|
|
2985
3145
|
private logger;
|
|
2986
3146
|
private cachedLimits?;
|
|
2987
3147
|
private onEvent?;
|
|
3148
|
+
/** Re-signs in flight, by order id. A fill's resize waits one out rather than reposting alongside it. */
|
|
3149
|
+
private readonly resigning;
|
|
2988
3150
|
constructor(store: LimitOrderStore, client: OrderbookClient, contractService: ContractInteractionService, configService: FillerConfigService, assetRegistry: AssetRegistry, signer: Signer, defaultTtlSecs: number, delegationService?: DelegationService | undefined, loggers?: LoggerContext,
|
|
2989
3151
|
/** Where a new order's nonce starts; tests pin it, production draws it at random. */
|
|
2990
3152
|
startingNonce?: () => bigint,
|
|
@@ -3025,6 +3187,10 @@ declare class LimitOrderService {
|
|
|
3025
3187
|
*/
|
|
3026
3188
|
private withdraw;
|
|
3027
3189
|
private signAndCancel;
|
|
3190
|
+
/** Public market levels read through the configured orderbook client. */
|
|
3191
|
+
orderbookSnapshot(book: string, filters?: OrderbookFilters): Promise<OrderbookSnapshot | null>;
|
|
3192
|
+
/** Every solver's order behind one public price level. */
|
|
3193
|
+
orderbookLevelOrders(book: string, level: OrderbookLevelQuery): Promise<OrderbookLevelOrder[] | null>;
|
|
3028
3194
|
/**
|
|
3029
3195
|
* The pairs an order can be written against, the smallest payout each token may carry, and
|
|
3030
3196
|
* the tokens the orderbook registers on each chain.
|
|
@@ -3130,9 +3296,25 @@ declare class LimitOrderService {
|
|
|
3130
3296
|
* They drift apart when a request never got an answer or the process died
|
|
3131
3297
|
* between two of them: an entry the orderbook still lists that nothing here
|
|
3132
3298
|
* owns, an order here whose entry has gone, or an entry the orderbook has cut
|
|
3133
|
-
* down because the solver cannot cover what it quoted.
|
|
3299
|
+
* down because the solver cannot cover what it quoted. A posted op is also
|
|
3300
|
+
* signed over one EntryPoint, so when the fill chain moves to another, every
|
|
3301
|
+
* entry signed before the move is withdrawn and posted again.
|
|
3134
3302
|
*/
|
|
3135
3303
|
reconcile(now?: Date): Promise<ReconcileReport>;
|
|
3304
|
+
/**
|
|
3305
|
+
* Withdraws a posting signed for an EntryPoint its fill chain no longer uses,
|
|
3306
|
+
* and posts it again signed for the one it uses now. Answers whether a new
|
|
3307
|
+
* posting landed.
|
|
3308
|
+
*
|
|
3309
|
+
* The row is read again and claimed out of `open` first: a fill can have worked
|
|
3310
|
+
* it down or started its own repost since reconciliation listed it, and that
|
|
3311
|
+
* write is the one to follow. A fill that lands once the claim is taken waits
|
|
3312
|
+
* in `resize` for this to finish. The EntryPoint is only written with a posting
|
|
3313
|
+
* that landed, so a pass cut short anywhere leaves a row the next pass still
|
|
3314
|
+
* reads as stale, or as having no entry, and finishes the job.
|
|
3315
|
+
*/
|
|
3316
|
+
private resign;
|
|
3317
|
+
private signAgain;
|
|
3136
3318
|
/**
|
|
3137
3319
|
* Lowers every open order's `remaining` to what the solver's account will still
|
|
3138
3320
|
* pay for it, and puts the order back on the book at that size.
|
|
@@ -3191,6 +3373,8 @@ declare class LimitOrderService {
|
|
|
3191
3373
|
* only the second one.
|
|
3192
3374
|
*/
|
|
3193
3375
|
private submit;
|
|
3376
|
+
/** The EntryPoint a posting on `chain` is signed for now. */
|
|
3377
|
+
private entryPointFor;
|
|
3194
3378
|
/**
|
|
3195
3379
|
* The entry the orderbook holds at `commitment`, if it holds one. A lookup that
|
|
3196
3380
|
* fails answers null, which sends the caller down the nonce-bump path it would
|
|
@@ -3769,6 +3953,10 @@ interface FillerRuntime {
|
|
|
3769
3953
|
rebalancingService?: RebalancingService;
|
|
3770
3954
|
resolvedChains: ResolvedChainConfig[];
|
|
3771
3955
|
fillerAddress: HexString;
|
|
3956
|
+
/** The indexer this filler reads history from: order details, and what it held at past moments. */
|
|
3957
|
+
indexerUrl: string;
|
|
3958
|
+
/** A token's registry symbol and on-chain decimals, where either can be had. */
|
|
3959
|
+
describeToken: TokenDescriber;
|
|
3772
3960
|
watchOnly?: Record<number, boolean>;
|
|
3773
3961
|
config: FillerTomlConfig;
|
|
3774
3962
|
/** Where the config came from, when it came from a file. */
|
|
@@ -3977,6 +4165,7 @@ interface SimplexStatus {
|
|
|
3977
4165
|
declare class LimitOrderController {
|
|
3978
4166
|
private runtime;
|
|
3979
4167
|
private emit;
|
|
4168
|
+
private indexed?;
|
|
3980
4169
|
constructor(runtime: FillerRuntime, emit: LimitOrderEmitter);
|
|
3981
4170
|
private get service();
|
|
3982
4171
|
list(filter?: LimitOrderFilter): Promise<LimitOrder[]>;
|
|
@@ -3993,12 +4182,32 @@ declare class LimitOrderController {
|
|
|
3993
4182
|
fills: LimitOrderFill[];
|
|
3994
4183
|
bids: StoredBid[];
|
|
3995
4184
|
} | null>;
|
|
4185
|
+
/**
|
|
4186
|
+
* What the operator's buys and sells earned over `period`, bucketed on a clock
|
|
4187
|
+
* `tzOffsetMinutes` behind UTC.
|
|
4188
|
+
*
|
|
4189
|
+
* Profit is the change the period's fills made to what the solver holds, and
|
|
4190
|
+
* it is compared with the inventory the period began with. That inventory
|
|
4191
|
+
* comes from the stored snapshots and, when the balances have been read in
|
|
4192
|
+
* full, from what is held now, each carried to the period's start by what
|
|
4193
|
+
* moved between. The indexer says what moved, deposits and withdrawals
|
|
4194
|
+
* included, wherever it has followed the solver; elsewhere the fills and
|
|
4195
|
+
* sends on record stand in. It answers whether or not an orderbook is
|
|
4196
|
+
* configured, and whether or not the indexer does.
|
|
4197
|
+
*/
|
|
4198
|
+
profitability(period: ProfitPeriod, tzOffsetMinutes?: number): Promise<Profitability>;
|
|
4199
|
+
/** One reader for the life of the filler, so the readings it has already fetched are kept. */
|
|
4200
|
+
private indexerInventory;
|
|
3996
4201
|
/** The pairs the orderbook lists, the smallest payout each token may carry, and its tokens per chain. */
|
|
3997
4202
|
books(): Promise<{
|
|
3998
4203
|
books: Book[];
|
|
3999
4204
|
minOrderSizes: TokenMinSize[];
|
|
4000
4205
|
chains: ChainInfo[];
|
|
4001
4206
|
}>;
|
|
4207
|
+
/** Public bids and asks across solvers, optionally restricted to a route. */
|
|
4208
|
+
orderbookSnapshot(book: string, filters?: OrderbookFilters): Promise<OrderbookSnapshot | null>;
|
|
4209
|
+
/** Every solver's order behind one public price level. */
|
|
4210
|
+
orderbookLevelOrders(book: string, level: OrderbookLevelQuery): Promise<OrderbookLevelOrder[] | null>;
|
|
4002
4211
|
/** Creates the order, posts it, and reports what the orderbook made of it. */
|
|
4003
4212
|
create(request: CreateLimitOrderRequest): Promise<PostedLimitOrder>;
|
|
4004
4213
|
cancel(id: string): Promise<CancelledLimitOrder>;
|
|
@@ -4240,20 +4449,12 @@ declare class Simplex extends EventEmitter$1 {
|
|
|
4240
4449
|
get internals(): FillerRuntime;
|
|
4241
4450
|
}
|
|
4242
4451
|
|
|
4243
|
-
/**
|
|
4244
|
-
* Process-local data store — the default when `Simplex.start` is given no
|
|
4245
|
-
* `data` option.
|
|
4246
|
-
*
|
|
4247
|
-
* Nothing survives the process. That is fine for tests, short-lived embedded
|
|
4248
|
-
* fillers and watch-only observers, but a filler that submits bids should use a
|
|
4249
|
-
* durable store: a lost bid record is a Hyperbridge deposit nobody retracts.
|
|
4250
|
-
* Settled rows are evicted past a cap; live bids (deposits still reclaimable) are never dropped.
|
|
4251
|
-
*/
|
|
4252
4452
|
declare class MemoryDataStore implements SimplexDataStore {
|
|
4253
4453
|
readonly bids: BidStore;
|
|
4254
4454
|
readonly activity: ActivityStore;
|
|
4255
4455
|
readonly state: StateStore;
|
|
4256
4456
|
readonly limitOrders: LimitOrderStore;
|
|
4457
|
+
readonly inventory: InventoryStore;
|
|
4257
4458
|
}
|
|
4258
4459
|
|
|
4259
4460
|
/**
|
|
@@ -4320,4 +4521,4 @@ declare class OrderScanner implements OrderScanner$1 {
|
|
|
4320
4521
|
private closeNow;
|
|
4321
4522
|
}
|
|
4322
4523
|
|
|
4323
|
-
export { ActivityEvent, ActivityInsert, ActivityStore, type AllowlistConfig, type AssetBalanceRow, AssetController, type AssetDefinition, type AuthorizationRequest, type BalanceIssue, type BalanceSnapshot, BidStats, BidStore, type BinanceConfig, type CancelledLimitOrder, type ChainBalanceRow, type ChainConfirmationPolicy, ChainController, type ChainInput, type ChainView, type CreateLimitOrderRequest, type CurveConfig, type CurvePoint, type DerivingSigner, type Eip7702Authorization$1 as Eip7702Authorization, type FillerConfigFile, type FillerTomlConfig, type HyperbridgeBalance, LimitOrder, LimitOrderController, LimitOrderFill, LimitOrderFilter, LimitOrderStore, LimitOrderValidationError, LogLevel, LogSink, Logger, LoggerContext, MemoryDataStore, type MpcVaultSignerConfig, OrderScanner, type OrderScanner$1 as OrderScannerContract, type OrderScannerHandlers, type OrderScannerOptions, type PairConfig, PairController, type PairView, type PostedLimitOrder, type PostingOutcome, type PrivateKeySignerConfig, type QueueConfig, RebalanceController, type RebalancingConfig, type ResolvedChainConfig, type ScannedFill, type ScannedOrder, type ScannerChainConfig, type SecretPhraseSignerConfig, type Signature, type Signer, type SignerConfig, type SignerTransaction, SignerType, Simplex, type SimplexConfig, SimplexDataStore, type SimplexEvents, type SimplexOptions, type SimplexStatus, type SolverWork, StateStore, StoredBid, type Subscription, type TurnkeySignerConfig, type TypedDataPayload, USD_STABLE_SYMBOLS, type UserProvidedChainConfig, type VaultBalanceRow, VaultController, type VaultSweepDeposit, type VaultSweepResult, type VaultSweepSkip, type VaultSweepSkipReason, type VaultSweepSubmission, type VaultToml, type VaultTomlConfig, WalletController, WalletTx, assertConfirmationCoverage, canDerive, createSigner, digestSigner, formatChainKey, isRegistrySymbol, mpcVaultSigner, normalizeSymbol, parseChainKey, pickAnchorStable, privateKeySigner, registrySymbols, secretPhraseSigner, turnkeySigner, validateAssetDefinitions, validateConfig, validatePairConfigs, validateSecretPhrase, validateSignerConfig, validateVaultToml, viemSigner };
|
|
4524
|
+
export { ActivityEvent, ActivityInsert, ActivityStore, type AllowlistConfig, type AssetBalanceRow, AssetController, type AssetDefinition, type AuthorizationRequest, type BalanceIssue, type BalanceSnapshot, BidStats, BidStore, type BinanceConfig, type BookProfit, type CancelledLimitOrder, type ChainBalanceRow, type ChainConfirmationPolicy, ChainController, type ChainInput, type ChainView, type CreateLimitOrderRequest, type CurveConfig, type CurvePoint, type DerivingSigner, type Eip7702Authorization$1 as Eip7702Authorization, type FillerConfigFile, type FillerTomlConfig, type HyperbridgeBalance, InventoryStore, LimitOrder, LimitOrderController, LimitOrderFill, LimitOrderFilter, LimitOrderStore, LimitOrderValidationError, LogLevel, LogSink, Logger, LoggerContext, MemoryDataStore, type MpcVaultSignerConfig, OrderScanner, type OrderScanner$1 as OrderScannerContract, type OrderScannerHandlers, type OrderScannerOptions, type PairConfig, PairController, type PairView, type PostedLimitOrder, type PostingOutcome, type PrivateKeySignerConfig, type ProfitBucket, type ProfitBucketFigures, type ProfitFigures, type ProfitPeriod, type Profitability, type QueueConfig, RebalanceController, type RebalancingConfig, type ResolvedChainConfig, type ScannedFill, type ScannedOrder, type ScannerChainConfig, type SecretPhraseSignerConfig, type Signature, type Signer, type SignerConfig, type SignerTransaction, SignerType, Simplex, type SimplexConfig, SimplexDataStore, type SimplexEvents, type SimplexOptions, type SimplexStatus, type SolverWork, type StartingInventory, StateStore, StoredBid, type Subscription, type TurnkeySignerConfig, type TypedDataPayload, USD_STABLE_SYMBOLS, type UserProvidedChainConfig, type VaultBalanceRow, VaultController, type VaultSweepDeposit, type VaultSweepResult, type VaultSweepSkip, type VaultSweepSkipReason, type VaultSweepSubmission, type VaultToml, type VaultTomlConfig, WalletController, WalletTx, assertConfirmationCoverage, canDerive, createSigner, digestSigner, formatChainKey, isRegistrySymbol, mpcVaultSigner, normalizeSymbol, parseChainKey, pickAnchorStable, privateKeySigner, registrySymbols, secretPhraseSigner, turnkeySigner, validateAssetDefinitions, validateConfig, validatePairConfigs, validateSecretPhrase, validateSignerConfig, validateVaultToml, viemSigner };
|