@domfi/sdk 0.1.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/LICENSE +16 -0
- package/README.md +786 -0
- package/dist/actions.cjs +1 -0
- package/dist/actions.d.cts +17 -0
- package/dist/actions.d.ts +17 -0
- package/dist/actions.js +1 -0
- package/dist/api.cjs +1 -0
- package/dist/api.d.cts +664 -0
- package/dist/api.d.ts +664 -0
- package/dist/api.js +0 -0
- package/dist/chunk-2VSPOLVO.js +1 -0
- package/dist/chunk-5YZVCHRU.js +0 -0
- package/dist/chunk-77XMXAXE.js +1 -0
- package/dist/chunk-7OVWNPZQ.js +1 -0
- package/dist/chunk-BMYMNNJK.js +1 -0
- package/dist/chunk-C5Y2WM7C.js +1 -0
- package/dist/chunk-C64LJM7D.js +2 -0
- package/dist/chunk-CLOFJTBP.js +1 -0
- package/dist/chunk-CMREWGOI.js +1 -0
- package/dist/chunk-D5VE2O4F.js +1 -0
- package/dist/chunk-LDE3JHVE.js +1 -0
- package/dist/chunk-N4Q67DTE.js +1 -0
- package/dist/chunk-SZE5DE54.js +1 -0
- package/dist/chunk-XHQVWI2J.js +1 -0
- package/dist/chunk-YU5DN3PI.js +1 -0
- package/dist/config.cjs +2 -0
- package/dist/config.d.cts +132 -0
- package/dist/config.d.ts +132 -0
- package/dist/config.js +1 -0
- package/dist/contracts.cjs +1 -0
- package/dist/contracts.d.cts +13073 -0
- package/dist/contracts.d.ts +13073 -0
- package/dist/contracts.js +1 -0
- package/dist/delegation.cjs +1 -0
- package/dist/delegation.d.cts +7 -0
- package/dist/delegation.d.ts +7 -0
- package/dist/delegation.js +0 -0
- package/dist/errors.cjs +3 -0
- package/dist/errors.d.cts +155 -0
- package/dist/errors.d.ts +155 -0
- package/dist/errors.js +3 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +216 -0
- package/dist/index.d.ts +216 -0
- package/dist/index.js +1 -0
- package/dist/math.cjs +1 -0
- package/dist/math.d.cts +273 -0
- package/dist/math.d.ts +273 -0
- package/dist/math.js +1 -0
- package/dist/position-BnhSFyGe.d.cts +56 -0
- package/dist/position-BnhSFyGe.d.ts +56 -0
- package/dist/rawSchemas-MAT7EZCV.js +1 -0
- package/dist/referrals.cjs +1 -0
- package/dist/referrals.d.cts +66 -0
- package/dist/referrals.d.ts +66 -0
- package/dist/referrals.js +1 -0
- package/dist/serde.cjs +1 -0
- package/dist/serde.d.cts +24 -0
- package/dist/serde.d.ts +24 -0
- package/dist/serde.js +1 -0
- package/dist/token.cjs +1 -0
- package/dist/token.d.cts +32 -0
- package/dist/token.d.ts +32 -0
- package/dist/token.js +0 -0
- package/dist/trading.cjs +1 -0
- package/dist/trading.d.cts +20 -0
- package/dist/trading.d.ts +20 -0
- package/dist/trading.js +1 -0
- package/dist/types-7s13ZSql.d.ts +533 -0
- package/dist/types-BK6dYOXr.d.cts +118 -0
- package/dist/types-CMtixBIP.d.cts +464 -0
- package/dist/types-DB1r_Ppi.d.ts +464 -0
- package/dist/types-DDgJiEFg.d.ts +780 -0
- package/dist/types-DJBX-p4X.d.cts +780 -0
- package/dist/types-DQft82W7.d.cts +533 -0
- package/dist/types-DhCzEwnS.d.ts +118 -0
- package/dist/types-veTDfbhq.d.ts +436 -0
- package/dist/types-x1MvxSdy.d.cts +436 -0
- package/dist/units-BYd75H7U.d.cts +22 -0
- package/dist/units-BYd75H7U.d.ts +22 -0
- package/dist/units.cjs +1 -0
- package/dist/units.d.cts +248 -0
- package/dist/units.d.ts +248 -0
- package/dist/units.js +1 -0
- package/dist/valuation.cjs +1 -0
- package/dist/valuation.d.cts +5 -0
- package/dist/valuation.d.ts +5 -0
- package/dist/valuation.js +1 -0
- package/dist/vault.cjs +1 -0
- package/dist/vault.d.cts +34 -0
- package/dist/vault.d.ts +34 -0
- package/dist/vault.js +1 -0
- package/package.json +181 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
import { Address, PairIndex, OrderId, TradeId } from './units.js';
|
|
2
|
+
import { R as ReadOptions, e as ResultEnvelope, M as Market, n as MarketState, o as PriceHead, p as CandleParams, q as Candle, r as PriceTickParams, s as PageOptions, t as Page, u as PriceTick, w as PageItem, h as AccountPosition, x as AccountPositionLookupRef, y as AccountPositionLookupResult, z as AccountPositionBatchLookupRef, A as AccountOrder, m as AccountTrade, k as OrderLifecycle, B as TradeEventsPage, D as TradeEvent, g as ApiStatus, f as VaultHistoryPageOptions } from './types-7s13ZSql.js';
|
|
3
|
+
export { E as AccountPositionLookupStatus, G as AccountPositionResolvedRef, H as ApiDegradedReason, C as CursorPagination, F as Freshness, I as MarketConstraints, J as MarketContracts, K as MarketFeeSchedule, L as MarketRawState, N as MarketStatus, O as OpenAccountPosition, c as OpenTriggerAccountOrder, Q as OrderAction, S as OrderStatus, W as OrderType, X as PendingAccountPosition, P as PendingPositionReason, Y as PositionRef, Z as PositionSide, _ as PriceSelector, l as RemoveCollateralTracking } from './types-7s13ZSql.js';
|
|
4
|
+
import { DiagnosticsEnvelope } from '@domfi/sdk/errors';
|
|
5
|
+
import './errors.js';
|
|
6
|
+
|
|
7
|
+
type RawFreshness = {
|
|
8
|
+
source: string;
|
|
9
|
+
generated_at: string;
|
|
10
|
+
indexed_block?: number | null;
|
|
11
|
+
chain_head_block?: number | null;
|
|
12
|
+
lag_blocks?: number | null;
|
|
13
|
+
cache_status?: string | null;
|
|
14
|
+
cache_age_seconds?: number | null;
|
|
15
|
+
} & Record<string, unknown>;
|
|
16
|
+
type RawPagination = {
|
|
17
|
+
cursor: string | null;
|
|
18
|
+
next_cursor: string | null;
|
|
19
|
+
has_next: boolean;
|
|
20
|
+
limit: number;
|
|
21
|
+
} & Record<string, unknown>;
|
|
22
|
+
type RawMarketContracts = {
|
|
23
|
+
trading: string;
|
|
24
|
+
trading_storage: string;
|
|
25
|
+
pairs_storage: string;
|
|
26
|
+
pair_infos: string;
|
|
27
|
+
} & Record<string, unknown>;
|
|
28
|
+
type RawMarketConstraints = {
|
|
29
|
+
min_leverage: string;
|
|
30
|
+
max_leverage: string;
|
|
31
|
+
maker_max_leverage: string;
|
|
32
|
+
min_lev_position: string;
|
|
33
|
+
group_max_collateral: string;
|
|
34
|
+
max_allowed_collateral?: string | null;
|
|
35
|
+
max_negative_pnl_on_open_p?: number | null;
|
|
36
|
+
max_sl_p?: number | null;
|
|
37
|
+
liq_margin_threshold_p?: number | null;
|
|
38
|
+
market_orders_timeout: number;
|
|
39
|
+
max_trades_per_pair: number;
|
|
40
|
+
max_pending_market_orders: number;
|
|
41
|
+
} & Record<string, unknown>;
|
|
42
|
+
type RawMarketFeeSchedule = {
|
|
43
|
+
maker_fee_p: number;
|
|
44
|
+
taker_fee_p: number;
|
|
45
|
+
usage_fee_p: number;
|
|
46
|
+
utilization_threshold_p: number;
|
|
47
|
+
maker_max_leverage: number;
|
|
48
|
+
vault_fee_percent: number;
|
|
49
|
+
} & Record<string, unknown>;
|
|
50
|
+
type RawMarketFees = {
|
|
51
|
+
opening: RawMarketFeeSchedule;
|
|
52
|
+
closing: RawMarketFeeSchedule;
|
|
53
|
+
} & Record<string, unknown>;
|
|
54
|
+
type RawMarket = {
|
|
55
|
+
pair_index: number;
|
|
56
|
+
group_index: number;
|
|
57
|
+
fee_index: number;
|
|
58
|
+
symbol: string;
|
|
59
|
+
price_asset: string;
|
|
60
|
+
base_symbol: string;
|
|
61
|
+
quote_symbol: string;
|
|
62
|
+
feed_id: string;
|
|
63
|
+
price_feed: string;
|
|
64
|
+
contracts: RawMarketContracts;
|
|
65
|
+
is_listed: boolean;
|
|
66
|
+
is_paused: boolean;
|
|
67
|
+
is_done: boolean;
|
|
68
|
+
oracle_fee_wei: string;
|
|
69
|
+
constraints: RawMarketConstraints;
|
|
70
|
+
fees: RawMarketFees;
|
|
71
|
+
} & Record<string, unknown>;
|
|
72
|
+
type RawMarketRawState = {
|
|
73
|
+
acc_per_oi_long: string;
|
|
74
|
+
acc_per_oi_short: string;
|
|
75
|
+
last_funding_rate: string;
|
|
76
|
+
max_funding_fee_per_block: string;
|
|
77
|
+
spring_factor: string;
|
|
78
|
+
hill_inflection_point: string;
|
|
79
|
+
hill_pos_scale: number;
|
|
80
|
+
hill_neg_scale: number;
|
|
81
|
+
s_factor_up_scale_p: number;
|
|
82
|
+
s_factor_down_scale_p: number;
|
|
83
|
+
last_oi_delta: string;
|
|
84
|
+
last_update_block: number;
|
|
85
|
+
as_of_block: number;
|
|
86
|
+
last_trade_price: string;
|
|
87
|
+
oi_long: string;
|
|
88
|
+
oi_short: string;
|
|
89
|
+
oi_cap: string;
|
|
90
|
+
group_collateral_long?: string;
|
|
91
|
+
group_collateral_short?: string;
|
|
92
|
+
} & Record<string, unknown>;
|
|
93
|
+
type RawMarketState = {
|
|
94
|
+
pair_index: number;
|
|
95
|
+
oi_long: string;
|
|
96
|
+
oi_short: string;
|
|
97
|
+
oi_max: string;
|
|
98
|
+
oi_delta: string;
|
|
99
|
+
last_funding_1h: string;
|
|
100
|
+
last_funding_8h: string;
|
|
101
|
+
last_funding_24h: string;
|
|
102
|
+
last_funding_1y: string;
|
|
103
|
+
funding_fee_long: string;
|
|
104
|
+
funding_fee_short: string;
|
|
105
|
+
funding_fee_rate: string;
|
|
106
|
+
funding_rate_1h: string;
|
|
107
|
+
funding_rate_8h: string;
|
|
108
|
+
funding_rate_24h: string;
|
|
109
|
+
funding_rate_1y: string;
|
|
110
|
+
cumulative_volume: string;
|
|
111
|
+
volume_24h: string;
|
|
112
|
+
raw_state?: RawMarketRawState | null;
|
|
113
|
+
} & Record<string, unknown>;
|
|
114
|
+
type RawPriceHead = {
|
|
115
|
+
asset: string;
|
|
116
|
+
product_id: string;
|
|
117
|
+
price: string;
|
|
118
|
+
block_timestamp: number;
|
|
119
|
+
} & Record<string, unknown>;
|
|
120
|
+
type RawCandle = {
|
|
121
|
+
asset: string;
|
|
122
|
+
pair_index: number | null;
|
|
123
|
+
open: string;
|
|
124
|
+
high: string;
|
|
125
|
+
low: string;
|
|
126
|
+
close: string | null;
|
|
127
|
+
head_price: string | null;
|
|
128
|
+
head_time: number | null;
|
|
129
|
+
open_time: number;
|
|
130
|
+
close_time: number | null;
|
|
131
|
+
} & Record<string, unknown>;
|
|
132
|
+
type RawPriceTick = {
|
|
133
|
+
asset: string;
|
|
134
|
+
product_id: string;
|
|
135
|
+
pair_index: number | null;
|
|
136
|
+
price: string;
|
|
137
|
+
publish_id: string | null;
|
|
138
|
+
block_number: number;
|
|
139
|
+
tx_index: number;
|
|
140
|
+
log_index: number;
|
|
141
|
+
block_timestamp: number;
|
|
142
|
+
} & Record<string, unknown>;
|
|
143
|
+
type RawPositionRef = {
|
|
144
|
+
wallet: string;
|
|
145
|
+
pair_index: number;
|
|
146
|
+
index: number;
|
|
147
|
+
trade_id: string;
|
|
148
|
+
} & Record<string, unknown>;
|
|
149
|
+
type RawAccountPosition = {
|
|
150
|
+
kind: string;
|
|
151
|
+
trade_id: string | null;
|
|
152
|
+
order_id: string;
|
|
153
|
+
event_type: string;
|
|
154
|
+
pair_index: number | null;
|
|
155
|
+
buy_side: boolean | null;
|
|
156
|
+
open_price: string | null;
|
|
157
|
+
wanted_price: string | null;
|
|
158
|
+
collateral: string | null;
|
|
159
|
+
initial_collateral: string | null;
|
|
160
|
+
leverage: string | null;
|
|
161
|
+
trade_notional: string | null;
|
|
162
|
+
tp: string | null;
|
|
163
|
+
sl: string | null;
|
|
164
|
+
init_funding_fee?: string | null;
|
|
165
|
+
target_trade_id: string | null;
|
|
166
|
+
close_percentage: string | null;
|
|
167
|
+
remove_amount: string | null;
|
|
168
|
+
timestamp: number;
|
|
169
|
+
index: number | null;
|
|
170
|
+
limit_index: string | null;
|
|
171
|
+
transaction_hash: string | null;
|
|
172
|
+
} & Record<string, unknown>;
|
|
173
|
+
type RawAccountOrder = {
|
|
174
|
+
lifecycle_key: string;
|
|
175
|
+
order_id: string;
|
|
176
|
+
status: string;
|
|
177
|
+
wallet: string;
|
|
178
|
+
pair_index: number | null;
|
|
179
|
+
action: string;
|
|
180
|
+
order_type: string;
|
|
181
|
+
trigger_order_type: string | null;
|
|
182
|
+
trade_id: string | null;
|
|
183
|
+
position_ref: RawPositionRef | null;
|
|
184
|
+
limit_index: string | null;
|
|
185
|
+
initiated_event_type: string | null;
|
|
186
|
+
terminal_event_type: string | null;
|
|
187
|
+
latest_event_type: string | null;
|
|
188
|
+
initiated_tx_hash: string | null;
|
|
189
|
+
executed_tx_hash: string | null;
|
|
190
|
+
initiated_block: number | null;
|
|
191
|
+
executed_block: number | null;
|
|
192
|
+
timeout_block: number | null;
|
|
193
|
+
is_pending: boolean;
|
|
194
|
+
is_cancelled: boolean;
|
|
195
|
+
cancel_reason: number | null;
|
|
196
|
+
timestamp: number;
|
|
197
|
+
} & Record<string, unknown>;
|
|
198
|
+
type RawAccountTrade = {
|
|
199
|
+
trade_id: string;
|
|
200
|
+
pair_index: number;
|
|
201
|
+
buy_side: boolean;
|
|
202
|
+
open_price: string;
|
|
203
|
+
close_price: string | null;
|
|
204
|
+
initial_collateral: string;
|
|
205
|
+
collateral: string;
|
|
206
|
+
closing_collateral: string | null;
|
|
207
|
+
leverage: string;
|
|
208
|
+
trade_notional: string;
|
|
209
|
+
open_event_type: string;
|
|
210
|
+
close_reason: string | null;
|
|
211
|
+
percent_profit: string | null;
|
|
212
|
+
realized_pnl_usdc: string | null;
|
|
213
|
+
usdc_sent_to_trader: string | null;
|
|
214
|
+
open_timestamp: number;
|
|
215
|
+
close_timestamp: number | null;
|
|
216
|
+
trade_index: number;
|
|
217
|
+
limit_index: string | null;
|
|
218
|
+
funding_fee: string | null;
|
|
219
|
+
status: string;
|
|
220
|
+
open_tx_hash: string | null;
|
|
221
|
+
close_tx_hash: string | null;
|
|
222
|
+
timestamp: number;
|
|
223
|
+
} & Record<string, unknown>;
|
|
224
|
+
type RawOrderLifecycle = {
|
|
225
|
+
order_id: string;
|
|
226
|
+
status: string;
|
|
227
|
+
wallet: string;
|
|
228
|
+
pair_index: number | null;
|
|
229
|
+
action: string;
|
|
230
|
+
order_type: string;
|
|
231
|
+
trade_id: string | null;
|
|
232
|
+
initiated_trade_id: string | null;
|
|
233
|
+
terminal_trade_id: string | null;
|
|
234
|
+
position_ref: RawPositionRef | null;
|
|
235
|
+
limit_index: string | null;
|
|
236
|
+
initiated_event_type: string | null;
|
|
237
|
+
terminal_event_type: string | null;
|
|
238
|
+
latest_event_type: string | null;
|
|
239
|
+
initiated_tx_hash: string | null;
|
|
240
|
+
executed_tx_hash: string | null;
|
|
241
|
+
initiated_block: number | null;
|
|
242
|
+
executed_block: number | null;
|
|
243
|
+
timeout_block: number | null;
|
|
244
|
+
initiated_tx_index: number | null;
|
|
245
|
+
initiated_log_index: number | null;
|
|
246
|
+
executed_tx_index: number | null;
|
|
247
|
+
executed_log_index: number | null;
|
|
248
|
+
requested_remove_amount: string | null;
|
|
249
|
+
executed_remove_amount: string | null;
|
|
250
|
+
is_pending: boolean;
|
|
251
|
+
is_cancelled: boolean;
|
|
252
|
+
cancel_reason: number | null;
|
|
253
|
+
timestamp: number;
|
|
254
|
+
timeout_available: boolean;
|
|
255
|
+
} & Record<string, unknown>;
|
|
256
|
+
type RawTradeEvent = {
|
|
257
|
+
id: number;
|
|
258
|
+
time: number;
|
|
259
|
+
block_number: number;
|
|
260
|
+
tx_index: number;
|
|
261
|
+
log_index: number;
|
|
262
|
+
event_type: string;
|
|
263
|
+
order_id: string | null;
|
|
264
|
+
transaction_hash: string | null;
|
|
265
|
+
collateral: string | null;
|
|
266
|
+
leverage: string | null;
|
|
267
|
+
open_price: string | null;
|
|
268
|
+
close_price: string | null;
|
|
269
|
+
tp: string | null;
|
|
270
|
+
sl: string | null;
|
|
271
|
+
percentage_closed: string | null;
|
|
272
|
+
percent_profit: string | null;
|
|
273
|
+
usdc_sent_to_trader: string | null;
|
|
274
|
+
pnl_delta_usdc: string | null;
|
|
275
|
+
top_up_amount: string | null;
|
|
276
|
+
remove_amount: string | null;
|
|
277
|
+
new_leverage: string | null;
|
|
278
|
+
wanted_price: string | null;
|
|
279
|
+
cancel_reason: number | null;
|
|
280
|
+
} & Record<string, unknown>;
|
|
281
|
+
type RawTradeTimeline = {
|
|
282
|
+
trade_id: string;
|
|
283
|
+
events: RawTradeEvent[];
|
|
284
|
+
} & Record<string, unknown>;
|
|
285
|
+
type RawReferralCode = {
|
|
286
|
+
code_id: string | number;
|
|
287
|
+
code: string;
|
|
288
|
+
created_at: string;
|
|
289
|
+
} & Record<string, unknown>;
|
|
290
|
+
type RawReferralBinding = {
|
|
291
|
+
referee: string;
|
|
292
|
+
code: string;
|
|
293
|
+
bound_at: string;
|
|
294
|
+
} & Record<string, unknown>;
|
|
295
|
+
type RawStatus = {
|
|
296
|
+
network: string;
|
|
297
|
+
api_time: string;
|
|
298
|
+
chain_head_block: number | null;
|
|
299
|
+
indexed_block: number | null;
|
|
300
|
+
lag_blocks: number | null;
|
|
301
|
+
rpc_available: boolean;
|
|
302
|
+
postgres_available: boolean;
|
|
303
|
+
cache_available: boolean;
|
|
304
|
+
degraded: boolean;
|
|
305
|
+
degraded_reasons: string[];
|
|
306
|
+
api_schema_hash: string;
|
|
307
|
+
} & Record<string, unknown>;
|
|
308
|
+
type RawReadiness = {
|
|
309
|
+
status: "ready" | "degraded" | "unsafe" | string;
|
|
310
|
+
unsafe_reasons: string[];
|
|
311
|
+
degraded_reasons: string[];
|
|
312
|
+
} & Record<string, unknown>;
|
|
313
|
+
type RawApiEnvelope<T> = {
|
|
314
|
+
data: T;
|
|
315
|
+
freshness: RawFreshness;
|
|
316
|
+
readiness: RawReadiness;
|
|
317
|
+
};
|
|
318
|
+
type RawPageEnvelope<T> = RawApiEnvelope<T[]> & {
|
|
319
|
+
pagination: RawPagination;
|
|
320
|
+
};
|
|
321
|
+
type RawMarketResponse = RawApiEnvelope<RawMarket>;
|
|
322
|
+
type RawMarketsResponse = RawApiEnvelope<RawMarket[]>;
|
|
323
|
+
type RawMarketStateResponse = RawApiEnvelope<RawMarketState>;
|
|
324
|
+
type RawPriceHeadResponse = RawApiEnvelope<RawPriceHead[]>;
|
|
325
|
+
type RawCandlesResponse = RawApiEnvelope<RawCandle[]>;
|
|
326
|
+
type RawPriceTicksResponse = RawPageEnvelope<RawPriceTick>;
|
|
327
|
+
type RawAccountPositionsResponse = RawPageEnvelope<RawAccountPosition>;
|
|
328
|
+
type RawPositionLookupRef = {
|
|
329
|
+
pair_index: number;
|
|
330
|
+
index: number;
|
|
331
|
+
trade_id: string;
|
|
332
|
+
} & Record<string, unknown>;
|
|
333
|
+
type RawAccountPositionLookupResult = {
|
|
334
|
+
ref: RawPositionLookupRef;
|
|
335
|
+
status: "found" | "missing" | "pending";
|
|
336
|
+
position: RawAccountPosition | null;
|
|
337
|
+
pending_reasons: string[];
|
|
338
|
+
} & Record<string, unknown>;
|
|
339
|
+
type RawAccountPositionLookupResponse = RawApiEnvelope<RawAccountPositionLookupResult>;
|
|
340
|
+
type RawBatchAccountPositionsResponse = RawApiEnvelope<RawAccountPositionLookupResult[]>;
|
|
341
|
+
type RawAccountOrdersResponse = RawPageEnvelope<RawAccountOrder>;
|
|
342
|
+
type RawAccountTradesResponse = RawPageEnvelope<RawAccountTrade>;
|
|
343
|
+
type RawOrderResponse = RawApiEnvelope<RawOrderLifecycle>;
|
|
344
|
+
type RawTradeEventsResponse = RawApiEnvelope<RawTradeTimeline> & {
|
|
345
|
+
pagination: RawPagination;
|
|
346
|
+
};
|
|
347
|
+
type RawVaultEvent = {
|
|
348
|
+
time: number;
|
|
349
|
+
block_number: number;
|
|
350
|
+
tx_index: number;
|
|
351
|
+
log_index: number;
|
|
352
|
+
tx_hash: string | null;
|
|
353
|
+
id: string | null;
|
|
354
|
+
op_type: string | null;
|
|
355
|
+
assets: string | null;
|
|
356
|
+
shares: string | null;
|
|
357
|
+
current_epoch: number | null;
|
|
358
|
+
unlock_epoch: number | null;
|
|
359
|
+
lock_duration_seconds: number | null;
|
|
360
|
+
} & Record<string, unknown>;
|
|
361
|
+
type RawVaultStatsData = {
|
|
362
|
+
acc_pnl_per_token: string;
|
|
363
|
+
current_epoch: number;
|
|
364
|
+
current_value_locked: string;
|
|
365
|
+
epoch_start: number;
|
|
366
|
+
total_shares: string;
|
|
367
|
+
apr: string;
|
|
368
|
+
share_price: string;
|
|
369
|
+
collateralization_ratio: string;
|
|
370
|
+
over_collateralization: string;
|
|
371
|
+
} & Record<string, unknown>;
|
|
372
|
+
type RawVaultAccountData = {
|
|
373
|
+
total_assets: string;
|
|
374
|
+
total_shares: string;
|
|
375
|
+
total_locked_shares: string;
|
|
376
|
+
locked_deposits: RawVaultEvent[];
|
|
377
|
+
unlocked_deposits: RawVaultEvent[];
|
|
378
|
+
pending_withdraws: RawVaultEvent[];
|
|
379
|
+
history: RawVaultEvent[];
|
|
380
|
+
history_pagination: RawPagination;
|
|
381
|
+
} & Record<string, unknown>;
|
|
382
|
+
type RawVaultAccountHistoryData = {
|
|
383
|
+
history: RawVaultEvent[];
|
|
384
|
+
pagination: RawPagination;
|
|
385
|
+
} & Record<string, unknown>;
|
|
386
|
+
type RawVaultTransactionEventsData = {
|
|
387
|
+
tx_hash: string;
|
|
388
|
+
events: RawVaultEvent[];
|
|
389
|
+
} & Record<string, unknown>;
|
|
390
|
+
type RawVaultStatsResponse = RawApiEnvelope<RawVaultStatsData>;
|
|
391
|
+
type RawVaultAccountResponse = RawApiEnvelope<RawVaultAccountData>;
|
|
392
|
+
type RawVaultAccountHistoryResponse = RawApiEnvelope<RawVaultAccountHistoryData>;
|
|
393
|
+
type RawVaultTransactionEventsResponse = RawApiEnvelope<RawVaultTransactionEventsData>;
|
|
394
|
+
type RawApiStatusResponse = RawApiEnvelope<RawStatus>;
|
|
395
|
+
type RawRouteParamsMap = {
|
|
396
|
+
"markets.list": Record<string, never>;
|
|
397
|
+
"markets.get": {
|
|
398
|
+
pairIndex: number;
|
|
399
|
+
};
|
|
400
|
+
"markets.state": {
|
|
401
|
+
pairIndex: number;
|
|
402
|
+
};
|
|
403
|
+
"prices.head": Record<string, never>;
|
|
404
|
+
"prices.candles": {
|
|
405
|
+
asset?: string;
|
|
406
|
+
from: string;
|
|
407
|
+
interval: string;
|
|
408
|
+
pair_index?: number;
|
|
409
|
+
to?: string;
|
|
410
|
+
};
|
|
411
|
+
"prices.ticks": {
|
|
412
|
+
asset?: string;
|
|
413
|
+
cursor?: string;
|
|
414
|
+
from?: string;
|
|
415
|
+
limit?: number;
|
|
416
|
+
pair_index?: number;
|
|
417
|
+
to?: string;
|
|
418
|
+
};
|
|
419
|
+
"account.positions": {
|
|
420
|
+
cursor?: string;
|
|
421
|
+
limit?: number;
|
|
422
|
+
wallet: Address;
|
|
423
|
+
};
|
|
424
|
+
"account.position": {
|
|
425
|
+
index: number;
|
|
426
|
+
pairIndex: number;
|
|
427
|
+
trade_id: string;
|
|
428
|
+
wallet: Address;
|
|
429
|
+
};
|
|
430
|
+
"account.positionsBatch": {
|
|
431
|
+
positions: RawPositionLookupRef[];
|
|
432
|
+
wallet: Address;
|
|
433
|
+
};
|
|
434
|
+
"account.orders": {
|
|
435
|
+
cursor?: string;
|
|
436
|
+
limit?: number;
|
|
437
|
+
wallet: Address;
|
|
438
|
+
};
|
|
439
|
+
"account.trades": {
|
|
440
|
+
cursor?: string;
|
|
441
|
+
limit?: number;
|
|
442
|
+
wallet: Address;
|
|
443
|
+
};
|
|
444
|
+
"orders.get": {
|
|
445
|
+
orderId: string;
|
|
446
|
+
};
|
|
447
|
+
"trades.events": {
|
|
448
|
+
cursor?: string;
|
|
449
|
+
limit?: number;
|
|
450
|
+
tradeId: string;
|
|
451
|
+
wallet: Address;
|
|
452
|
+
};
|
|
453
|
+
"vault.stats": Record<string, never>;
|
|
454
|
+
"vault.account": {
|
|
455
|
+
cursor?: string;
|
|
456
|
+
limit?: number;
|
|
457
|
+
wallet: Address;
|
|
458
|
+
};
|
|
459
|
+
"vault.accountHistory": {
|
|
460
|
+
cursor?: string;
|
|
461
|
+
limit?: number;
|
|
462
|
+
wallet: Address;
|
|
463
|
+
};
|
|
464
|
+
"vault.transactionEvents": {
|
|
465
|
+
txHash: string;
|
|
466
|
+
};
|
|
467
|
+
"referrals.lookup": {
|
|
468
|
+
code: string;
|
|
469
|
+
};
|
|
470
|
+
"referrals.getBinding": {
|
|
471
|
+
address: Address;
|
|
472
|
+
};
|
|
473
|
+
"referrals.getCode": {
|
|
474
|
+
address: Address;
|
|
475
|
+
};
|
|
476
|
+
"status.get": Record<string, never>;
|
|
477
|
+
};
|
|
478
|
+
type RawRouteResultMap = {
|
|
479
|
+
"markets.list": RawMarketsResponse;
|
|
480
|
+
"markets.get": RawMarketResponse;
|
|
481
|
+
"markets.state": RawMarketStateResponse;
|
|
482
|
+
"prices.head": RawPriceHeadResponse;
|
|
483
|
+
"prices.candles": RawCandlesResponse;
|
|
484
|
+
"prices.ticks": RawPriceTicksResponse;
|
|
485
|
+
"account.positions": RawAccountPositionsResponse;
|
|
486
|
+
"account.position": RawAccountPositionLookupResponse;
|
|
487
|
+
"account.positionsBatch": RawBatchAccountPositionsResponse;
|
|
488
|
+
"account.orders": RawAccountOrdersResponse;
|
|
489
|
+
"account.trades": RawAccountTradesResponse;
|
|
490
|
+
"orders.get": RawOrderResponse;
|
|
491
|
+
"trades.events": RawTradeEventsResponse;
|
|
492
|
+
"vault.stats": RawVaultStatsResponse;
|
|
493
|
+
"vault.account": RawVaultAccountResponse;
|
|
494
|
+
"vault.accountHistory": RawVaultAccountHistoryResponse;
|
|
495
|
+
"vault.transactionEvents": RawVaultTransactionEventsResponse;
|
|
496
|
+
"referrals.lookup": RawReferralCode;
|
|
497
|
+
"referrals.getBinding": RawReferralBinding;
|
|
498
|
+
"referrals.getCode": RawReferralCode;
|
|
499
|
+
"status.get": RawApiStatusResponse;
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
type RawRouteKey = "markets.list" | "markets.get" | "markets.state" | "prices.head" | "prices.candles" | "prices.ticks" | "account.positions" | "account.position" | "account.positionsBatch" | "account.orders" | "account.trades" | "orders.get" | "trades.events" | "vault.stats" | "vault.account" | "vault.accountHistory" | "vault.transactionEvents" | "referrals.lookup" | "referrals.getBinding" | "referrals.getCode" | "status.get";
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* High-level REST read client.
|
|
506
|
+
*
|
|
507
|
+
* @throws ReadModelNotReadyError when strict readiness policy rejects stale or unsafe read models.
|
|
508
|
+
* @throws ValidationError when SDK input or remote payload validation fails.
|
|
509
|
+
* @throws TimeoutError when a configured read timeout expires.
|
|
510
|
+
* @throws AbortError when the caller-provided signal aborts the request.
|
|
511
|
+
* @throws ApiError or TransportError for REST API and transport failures.
|
|
512
|
+
*/
|
|
513
|
+
type DomfiInfoClient = {
|
|
514
|
+
/** Market metadata and state reads. */
|
|
515
|
+
markets: {
|
|
516
|
+
/** Lists all configured markets. */
|
|
517
|
+
list(opts?: ReadOptions): Promise<ResultEnvelope<Market[]>>;
|
|
518
|
+
/** Reads static metadata for one market. */
|
|
519
|
+
get(pairIndex: PairIndex, opts?: ReadOptions): Promise<ResultEnvelope<Market>>;
|
|
520
|
+
/** Reads dynamic state for one market. */
|
|
521
|
+
state(pairIndex: PairIndex, opts?: ReadOptions): Promise<ResultEnvelope<MarketState>>;
|
|
522
|
+
};
|
|
523
|
+
/** Price feed reads. */
|
|
524
|
+
prices: {
|
|
525
|
+
/** Reads the latest price heads. */
|
|
526
|
+
head(opts?: ReadOptions): Promise<ResultEnvelope<PriceHead[]>>;
|
|
527
|
+
/** Reads candles for an asset or pair. */
|
|
528
|
+
candles(params: CandleParams, opts?: ReadOptions): Promise<ResultEnvelope<Candle[]>>;
|
|
529
|
+
/** Reads one page of price ticks. */
|
|
530
|
+
ticks(params: PriceTickParams, opts?: PageOptions): Promise<Page<PriceTick>>;
|
|
531
|
+
/** Iterates price tick pages. */
|
|
532
|
+
ticksPages(params: PriceTickParams, opts?: PageOptions): AsyncIterable<Page<PriceTick>>;
|
|
533
|
+
/** Iterates individual price ticks across pages. */
|
|
534
|
+
ticksIterator(params: PriceTickParams, opts?: PageOptions): AsyncIterable<PageItem<PriceTick>>;
|
|
535
|
+
};
|
|
536
|
+
/** Account-scoped position, order, and trade reads. */
|
|
537
|
+
account: {
|
|
538
|
+
/** Reads one page of account positions. */
|
|
539
|
+
positions(wallet: Address, opts?: PageOptions): Promise<Page<AccountPosition>>;
|
|
540
|
+
/** Resolves one position reference for an account. */
|
|
541
|
+
position(wallet: Address, position: AccountPositionLookupRef, opts?: ReadOptions): Promise<ResultEnvelope<AccountPositionLookupResult>>;
|
|
542
|
+
/** Resolves multiple fully identified positions for an account. */
|
|
543
|
+
positionsBatch(wallet: Address, positions: AccountPositionBatchLookupRef[], opts?: ReadOptions): Promise<ResultEnvelope<AccountPositionLookupResult[]>>;
|
|
544
|
+
/** Iterates account position pages. */
|
|
545
|
+
positionsPages(wallet: Address, opts?: PageOptions): AsyncIterable<Page<AccountPosition>>;
|
|
546
|
+
/** Iterates individual account positions across pages. */
|
|
547
|
+
positionsIterator(wallet: Address, opts?: PageOptions): AsyncIterable<PageItem<AccountPosition>>;
|
|
548
|
+
/** Reads one page of account orders. */
|
|
549
|
+
orders(wallet: Address, opts?: PageOptions): Promise<Page<AccountOrder>>;
|
|
550
|
+
/** Iterates account order pages. */
|
|
551
|
+
ordersPages(wallet: Address, opts?: PageOptions): AsyncIterable<Page<AccountOrder>>;
|
|
552
|
+
/** Iterates individual account orders across pages. */
|
|
553
|
+
ordersIterator(wallet: Address, opts?: PageOptions): AsyncIterable<PageItem<AccountOrder>>;
|
|
554
|
+
/** Reads one page of account trades. */
|
|
555
|
+
trades(wallet: Address, opts?: PageOptions): Promise<Page<AccountTrade>>;
|
|
556
|
+
/** Iterates account trade pages. */
|
|
557
|
+
tradesPages(wallet: Address, opts?: PageOptions): AsyncIterable<Page<AccountTrade>>;
|
|
558
|
+
/** Iterates individual account trades across pages. */
|
|
559
|
+
tradesIterator(wallet: Address, opts?: PageOptions): AsyncIterable<PageItem<AccountTrade>>;
|
|
560
|
+
};
|
|
561
|
+
/** Order lifecycle reads. */
|
|
562
|
+
orders: {
|
|
563
|
+
/** Reads a full order lifecycle by order id. */
|
|
564
|
+
get(orderId: OrderId, opts?: ReadOptions): Promise<ResultEnvelope<OrderLifecycle>>;
|
|
565
|
+
};
|
|
566
|
+
/** Trade timeline reads. */
|
|
567
|
+
trades: {
|
|
568
|
+
/** Reads one page of trade events. */
|
|
569
|
+
events(tradeId: TradeId, params: {
|
|
570
|
+
wallet: Address;
|
|
571
|
+
}, opts?: PageOptions): Promise<TradeEventsPage>;
|
|
572
|
+
/** Iterates trade event pages. */
|
|
573
|
+
eventsPages(tradeId: TradeId, params: {
|
|
574
|
+
wallet: Address;
|
|
575
|
+
}, opts?: PageOptions): AsyncIterable<TradeEventsPage>;
|
|
576
|
+
/** Iterates individual trade events across pages. */
|
|
577
|
+
eventsIterator(tradeId: TradeId, params: {
|
|
578
|
+
wallet: Address;
|
|
579
|
+
}, opts?: PageOptions): AsyncIterable<PageItem<TradeEvent>>;
|
|
580
|
+
};
|
|
581
|
+
/** API health and readiness reads. */
|
|
582
|
+
status: {
|
|
583
|
+
get(opts?: ReadOptions): Promise<ResultEnvelope<ApiStatus>>;
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
/** Raw route name accepted by `DomfiRawClient` helper types. */
|
|
587
|
+
type RawRouteName = RawRouteKey;
|
|
588
|
+
/** Raw route parameter type for a specific route. */
|
|
589
|
+
type RawRouteParams<Route extends RawRouteName> = RawRouteParamsMap[Route];
|
|
590
|
+
/** Raw route result type for a specific route. */
|
|
591
|
+
type RawRouteResult<Route extends RawRouteName> = RawRouteResultMap[Route];
|
|
592
|
+
/** Raw account position lookup shape before SDK brand normalization. */
|
|
593
|
+
type RawAccountPositionLookupRef = {
|
|
594
|
+
pairIndex: number;
|
|
595
|
+
index: number;
|
|
596
|
+
tradeId: string;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* Raw REST route client.
|
|
600
|
+
*
|
|
601
|
+
* @throws ValidationError when route parameters or remote payloads fail validation.
|
|
602
|
+
* @throws TimeoutError when a configured read timeout expires.
|
|
603
|
+
* @throws AbortError when the caller-provided signal aborts the request.
|
|
604
|
+
* @throws ApiError or TransportError for REST API and transport failures.
|
|
605
|
+
*/
|
|
606
|
+
type DomfiRawClient = {
|
|
607
|
+
/** Raw market REST routes. */
|
|
608
|
+
markets: {
|
|
609
|
+
list(opts?: ReadOptions): Promise<RawRouteResult<"markets.list">>;
|
|
610
|
+
get(pairIndex: number, opts?: ReadOptions): Promise<RawRouteResult<"markets.get">>;
|
|
611
|
+
state(pairIndex: number, opts?: ReadOptions): Promise<RawRouteResult<"markets.state">>;
|
|
612
|
+
};
|
|
613
|
+
/** Raw price REST routes. */
|
|
614
|
+
prices: {
|
|
615
|
+
head(opts?: ReadOptions): Promise<RawRouteResult<"prices.head">>;
|
|
616
|
+
candles(params: RawRouteParams<"prices.candles">, opts?: ReadOptions): Promise<RawRouteResult<"prices.candles">>;
|
|
617
|
+
ticks(params: RawRouteParams<"prices.ticks">, opts?: PageOptions): Promise<RawRouteResult<"prices.ticks">>;
|
|
618
|
+
};
|
|
619
|
+
/** Raw account REST routes. */
|
|
620
|
+
account: {
|
|
621
|
+
positions(wallet: Address, opts?: PageOptions): Promise<RawRouteResult<"account.positions">>;
|
|
622
|
+
position(wallet: Address, lookup: RawAccountPositionLookupRef, opts?: ReadOptions): Promise<RawRouteResult<"account.position">>;
|
|
623
|
+
positionsBatch(wallet: Address, positions: RawRouteParams<"account.positionsBatch">["positions"], opts?: ReadOptions): Promise<RawRouteResult<"account.positionsBatch">>;
|
|
624
|
+
orders(wallet: Address, opts?: PageOptions): Promise<RawRouteResult<"account.orders">>;
|
|
625
|
+
trades(wallet: Address, opts?: PageOptions): Promise<RawRouteResult<"account.trades">>;
|
|
626
|
+
};
|
|
627
|
+
/** Raw order REST routes. */
|
|
628
|
+
orders: {
|
|
629
|
+
get(orderId: string, opts?: ReadOptions): Promise<RawRouteResult<"orders.get">>;
|
|
630
|
+
};
|
|
631
|
+
/** Raw trade REST routes. */
|
|
632
|
+
trades: {
|
|
633
|
+
events(tradeId: string, params: {
|
|
634
|
+
wallet: Address;
|
|
635
|
+
}, opts?: PageOptions): Promise<RawRouteResult<"trades.events">>;
|
|
636
|
+
};
|
|
637
|
+
/** Raw vault REST routes. */
|
|
638
|
+
vault: {
|
|
639
|
+
stats(opts?: ReadOptions): Promise<RawRouteResult<"vault.stats">>;
|
|
640
|
+
account(wallet: Address, opts?: VaultHistoryPageOptions): Promise<RawRouteResult<"vault.account">>;
|
|
641
|
+
accountHistory(wallet: Address, opts?: VaultHistoryPageOptions): Promise<RawRouteResult<"vault.accountHistory">>;
|
|
642
|
+
transactionEvents(txHash: string, opts?: ReadOptions): Promise<RawRouteResult<"vault.transactionEvents">>;
|
|
643
|
+
};
|
|
644
|
+
/** Raw referral REST routes. */
|
|
645
|
+
referrals: {
|
|
646
|
+
lookup(code: string, opts?: ReadOptions): Promise<RawRouteResult<"referrals.lookup">>;
|
|
647
|
+
getBinding(address: Address, opts?: ReadOptions): Promise<RawRouteResult<"referrals.getBinding">>;
|
|
648
|
+
getCode(address: Address, opts?: ReadOptions): Promise<RawRouteResult<"referrals.getCode">>;
|
|
649
|
+
};
|
|
650
|
+
status: {
|
|
651
|
+
get(opts?: ReadOptions): Promise<RawRouteResult<"status.get">>;
|
|
652
|
+
};
|
|
653
|
+
request<Route extends RawRouteName>(route: Route, params: RawRouteParams<Route>, opts?: ReadOptions): Promise<RawRouteResult<Route>>;
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
type ReadinessWarningEvent = {
|
|
657
|
+
readonly type: "warning";
|
|
658
|
+
readonly code: "READ_MODEL_NOT_READY";
|
|
659
|
+
readonly message: string;
|
|
660
|
+
readonly diagnostics: DiagnosticsEnvelope;
|
|
661
|
+
readonly degradedReasons: readonly string[];
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
export { AccountOrder, AccountPosition, AccountPositionBatchLookupRef, AccountPositionLookupRef, AccountPositionLookupResult, AccountTrade, ApiStatus, Candle, CandleParams, type DomfiInfoClient, type DomfiRawClient, Market, MarketState, OrderLifecycle, Page, PageItem, PageOptions, PriceHead, PriceTick, PriceTickParams, type RawAccountPositionLookupRef, type RawPagination, type RawRouteName, type RawRouteParams, type RawRouteResult, type RawVaultAccountData, type RawVaultAccountHistoryData, type RawVaultEvent, type RawVaultStatsData, type RawVaultTransactionEventsData, ReadOptions, type ReadinessWarningEvent, ResultEnvelope, TradeEvent, TradeEventsPage, VaultHistoryPageOptions };
|
package/dist/api.js
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={Usable:"usable",InvalidCode:"invalid_code",CodeNotFound:"code_not_found",AlreadyBound:"already_bound",SelfReferral:"self_referral"};export{e as a};
|
|
File without changes
|