@win-trader/bindings 0.0.4 → 0.3.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/cex-feed/dist/index.d.ts +662 -0
- package/cex-feed/dist/index.js +173 -0
- package/config-manager/dist/index.d.ts +267 -213
- package/config-manager/dist/index.js +67 -49
- package/market-governor/dist/index.d.ts +660 -0
- package/market-governor/dist/index.js +178 -0
- package/mock-oracle/dist/index.d.ts +84 -0
- package/mock-oracle/dist/index.js +37 -0
- package/mock-token/dist/index.d.ts +680 -667
- package/mock-token/dist/index.js +257 -252
- package/package.json +9 -22
- package/position-manager/dist/index.d.ts +520 -361
- package/position-manager/dist/index.js +172 -132
- package/request-router/dist/index.d.ts +275 -208
- package/request-router/dist/index.js +74 -56
- package/vault/dist/index.d.ts +914 -856
- package/vault/dist/index.js +310 -295
- package/oracle/dist/index.d.ts +0 -555
- package/oracle/dist/index.js +0 -150
- package/oracle-router/dist/index.d.ts +0 -673
- package/oracle-router/dist/index.js +0 -208
|
@@ -1,673 +0,0 @@
|
|
|
1
|
-
import { Buffer } from "buffer";
|
|
2
|
-
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from "@stellar/stellar-sdk/contract";
|
|
3
|
-
import type { u32, u64, i128 } from "@stellar/stellar-sdk/contract";
|
|
4
|
-
export * from "@stellar/stellar-sdk";
|
|
5
|
-
export * as contract from "@stellar/stellar-sdk/contract";
|
|
6
|
-
export * as rpc from "@stellar/stellar-sdk/rpc";
|
|
7
|
-
export declare const OracleRouterError: {
|
|
8
|
-
1: {
|
|
9
|
-
message: string;
|
|
10
|
-
};
|
|
11
|
-
2: {
|
|
12
|
-
message: string;
|
|
13
|
-
};
|
|
14
|
-
3: {
|
|
15
|
-
message: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Every oracle source returned data older than `staleness_threshold`,
|
|
19
|
-
* or returned invalid (zero/negative) prices, or a future timestamp.
|
|
20
|
-
*/
|
|
21
|
-
4: {
|
|
22
|
-
message: string;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Spread between source prices exceeds `max_deviation_bps`.
|
|
26
|
-
*/
|
|
27
|
-
5: {
|
|
28
|
-
message: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* No SEP-40 oracle sources are configured for the requested symbol.
|
|
32
|
-
*/
|
|
33
|
-
6: {
|
|
34
|
-
message: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Cross-contract call to an oracle source failed.
|
|
38
|
-
*/
|
|
39
|
-
7: {
|
|
40
|
-
message: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Oracle configuration field is invalid (e.g., zero threshold, out-of-range bps).
|
|
44
|
-
*/
|
|
45
|
-
8: {
|
|
46
|
-
message: string;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Fewer than `min_required_sources` valid prices were returned.
|
|
50
|
-
*/
|
|
51
|
-
9: {
|
|
52
|
-
message: string;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* `set_oracle_sources` called with more than `MAX_ORACLE_SOURCES` entries.
|
|
56
|
-
*/
|
|
57
|
-
10: {
|
|
58
|
-
message: string;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Deviation math would overflow on the supplied prices.
|
|
62
|
-
*/
|
|
63
|
-
11: {
|
|
64
|
-
message: string;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* `upgrade` rejected — no `propose_upgrade` was made before commit.
|
|
68
|
-
*/
|
|
69
|
-
12: {
|
|
70
|
-
message: string;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* `upgrade` rejected — timelock has not elapsed yet.
|
|
74
|
-
*/
|
|
75
|
-
13: {
|
|
76
|
-
message: string;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* `upgrade` rejected — `new_wasm_hash` does not match the proposed
|
|
80
|
-
* `PendingUpgrade.wasm_hash`.
|
|
81
|
-
*/
|
|
82
|
-
14: {
|
|
83
|
-
message: string;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* A source's `decimals()` differs from `shared::constants::PRICE_DECIMALS`,
|
|
87
|
-
* or the source could not be queried for its scale.
|
|
88
|
-
*/
|
|
89
|
-
15: {
|
|
90
|
-
message: string;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Even-count median averaging would overflow on the supplied prices.
|
|
94
|
-
*/
|
|
95
|
-
16: {
|
|
96
|
-
message: string;
|
|
97
|
-
};
|
|
98
|
-
17: {
|
|
99
|
-
message: string;
|
|
100
|
-
};
|
|
101
|
-
18: {
|
|
102
|
-
message: string;
|
|
103
|
-
};
|
|
104
|
-
19: {
|
|
105
|
-
message: string;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
export type StorageKey = {
|
|
109
|
-
tag: "Initialized";
|
|
110
|
-
values: void;
|
|
111
|
-
} | {
|
|
112
|
-
tag: "ConfigManager";
|
|
113
|
-
values: void;
|
|
114
|
-
} | {
|
|
115
|
-
tag: "OracleConfig";
|
|
116
|
-
values: void;
|
|
117
|
-
} | {
|
|
118
|
-
tag: "ConfigVersion";
|
|
119
|
-
values: void;
|
|
120
|
-
} | {
|
|
121
|
-
tag: "Sources";
|
|
122
|
-
values: readonly [string];
|
|
123
|
-
} | {
|
|
124
|
-
tag: "CachedPrice";
|
|
125
|
-
values: readonly [string];
|
|
126
|
-
} | {
|
|
127
|
-
tag: "CachedPriceV2";
|
|
128
|
-
values: readonly [string, u64];
|
|
129
|
-
} | {
|
|
130
|
-
tag: "Version";
|
|
131
|
-
values: void;
|
|
132
|
-
} | {
|
|
133
|
-
tag: "PositionManager";
|
|
134
|
-
values: void;
|
|
135
|
-
} | {
|
|
136
|
-
tag: "LatestRoundId";
|
|
137
|
-
values: void;
|
|
138
|
-
} | {
|
|
139
|
-
tag: "Round";
|
|
140
|
-
values: readonly [u64];
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Cached aggregated median price for a symbol. `fetched_at` bounds router
|
|
144
|
-
* cache duration; `oldest_source_update` ensures the cached median is not
|
|
145
|
-
* served after any source response used to compute it has gone stale.
|
|
146
|
-
*/
|
|
147
|
-
export interface CachedPrice {
|
|
148
|
-
fetched_at: u64;
|
|
149
|
-
oldest_source_update: u64;
|
|
150
|
-
price: i128;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Authoritative per-market state: the side aggregates, the funding indices,
|
|
154
|
-
* the funding EMA, and the market configuration.
|
|
155
|
-
*
|
|
156
|
-
* Soroban limits UDT field names to 30 characters, so where a doc glossary
|
|
157
|
-
* term is longer the field drops the redundant qualifier and its doc
|
|
158
|
-
* comment carries the full term (e.g. `receiver_backed_index_long` is the
|
|
159
|
-
* doc's `receiver_backed_payer_index` for the long side).
|
|
160
|
-
*/
|
|
161
|
-
export interface Market {
|
|
162
|
-
config: MarketConfig;
|
|
163
|
-
/**
|
|
164
|
-
* `INDEX_PRECISION`-scaled bps/day payer rate as of the last refresh.
|
|
165
|
-
*/
|
|
166
|
-
current_payer_rate: i128;
|
|
167
|
-
current_payer_side: PayerSide;
|
|
168
|
-
last_funding_checkpoint: u64;
|
|
169
|
-
long: MarketSide;
|
|
170
|
-
/**
|
|
171
|
-
* Cumulative payer fee per unit of dominant-side size that is LP
|
|
172
|
-
* revenue on collection (§8.2).
|
|
173
|
-
*/
|
|
174
|
-
lp_backed_index_long: i128;
|
|
175
|
-
lp_backed_index_short: i128;
|
|
176
|
-
lp_payer_remainder: i128;
|
|
177
|
-
/**
|
|
178
|
-
* Sub-stroop carry of the receiver-liability accrual (§8.3).
|
|
179
|
-
*/
|
|
180
|
-
pending_remainder: i128;
|
|
181
|
-
/**
|
|
182
|
-
* Cumulative payer fee per unit of dominant-side size whose collection
|
|
183
|
-
* restores cash backing an already-accrued receiver claim (§8.2).
|
|
184
|
-
*/
|
|
185
|
-
receiver_backed_index_long: i128;
|
|
186
|
-
receiver_backed_index_short: i128;
|
|
187
|
-
/**
|
|
188
|
-
* Cumulative funding credit per unit of light-side size (§8.2).
|
|
189
|
-
*/
|
|
190
|
-
receiver_index_long: i128;
|
|
191
|
-
receiver_index_remainder: i128;
|
|
192
|
-
receiver_index_short: i128;
|
|
193
|
-
receiver_payer_remainder: i128;
|
|
194
|
-
short: MarketSide;
|
|
195
|
-
/**
|
|
196
|
-
* §8.1 signed EMA of the instantaneous skew: a fraction of one at
|
|
197
|
-
* `INDEX_PRECISION` scale, positive when history says longs dominate.
|
|
198
|
-
* Decays toward the current skew with the global half-life.
|
|
199
|
-
*/
|
|
200
|
-
skew_ema: i128;
|
|
201
|
-
}
|
|
202
|
-
export interface LpConfig {
|
|
203
|
-
lp_request_delay: u64;
|
|
204
|
-
max_withdraw_utilization_bps: u32;
|
|
205
|
-
min_deposit_nav_factor_bps: u32;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Represents a single trader's open leveraged position.
|
|
209
|
-
*/
|
|
210
|
-
export interface Position {
|
|
211
|
-
/**
|
|
212
|
-
* Asset units at `PRICE_PRECISION`.
|
|
213
|
-
*/
|
|
214
|
-
base_exposure: i128;
|
|
215
|
-
borrow_debt: i128;
|
|
216
|
-
/**
|
|
217
|
-
* Cash owned by an optional-order executor.
|
|
218
|
-
*/
|
|
219
|
-
execution_budget: i128;
|
|
220
|
-
funding_paid_to_lps_debt: i128;
|
|
221
|
-
funding_paid_to_receivers_debt: i128;
|
|
222
|
-
funding_received_debt: i128;
|
|
223
|
-
id: u64;
|
|
224
|
-
is_long: boolean;
|
|
225
|
-
last_increased_time: u64;
|
|
226
|
-
market: string;
|
|
227
|
-
owner: string;
|
|
228
|
-
/**
|
|
229
|
-
* Fixed gross capacity assigned when risk opens.
|
|
230
|
-
*/
|
|
231
|
-
risk_units: i128;
|
|
232
|
-
/**
|
|
233
|
-
* USD notional at `PRICE_PRECISION`.
|
|
234
|
-
*/
|
|
235
|
-
size: i128;
|
|
236
|
-
/**
|
|
237
|
-
* Trigger price for the optional stop-loss order; `0` = none.
|
|
238
|
-
*/
|
|
239
|
-
stop_loss: i128;
|
|
240
|
-
/**
|
|
241
|
-
* Trader-owned collateral recorded in contract state (the doc's
|
|
242
|
-
* "stored collateral"). Effective collateral — stored collateral after
|
|
243
|
-
* pending fees and funding credits — is always derived, never stored.
|
|
244
|
-
*/
|
|
245
|
-
stored_collateral: i128;
|
|
246
|
-
/**
|
|
247
|
-
* Trigger price for the optional take-profit order; `0` = none.
|
|
248
|
-
*/
|
|
249
|
-
take_profit: i128;
|
|
250
|
-
}
|
|
251
|
-
export interface LpRequest {
|
|
252
|
-
amount: i128;
|
|
253
|
-
execute_after: u64;
|
|
254
|
-
id: u64;
|
|
255
|
-
kind: LpRequestKind;
|
|
256
|
-
owner: string;
|
|
257
|
-
request_time: u64;
|
|
258
|
-
status: LpRequestStatus;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Which side currently pays funding (§8.1: the side the blended integral
|
|
262
|
-
* skew points at — under the EMA this can be the *lighter* side for a
|
|
263
|
-
* while after the book flips). `None` when the blend is exactly zero.
|
|
264
|
-
*/
|
|
265
|
-
export type PayerSide = {
|
|
266
|
-
tag: "None";
|
|
267
|
-
values: void;
|
|
268
|
-
} | {
|
|
269
|
-
tag: "Long";
|
|
270
|
-
values: void;
|
|
271
|
-
} | {
|
|
272
|
-
tag: "Short";
|
|
273
|
-
values: void;
|
|
274
|
-
};
|
|
275
|
-
export type RiskState = {
|
|
276
|
-
tag: "Normal";
|
|
277
|
-
values: void;
|
|
278
|
-
} | {
|
|
279
|
-
tag: "Warning";
|
|
280
|
-
values: void;
|
|
281
|
-
} | {
|
|
282
|
-
tag: "Adl";
|
|
283
|
-
values: void;
|
|
284
|
-
} | {
|
|
285
|
-
tag: "HardCap";
|
|
286
|
-
values: void;
|
|
287
|
-
};
|
|
288
|
-
export interface MarketSide {
|
|
289
|
-
base_exposure: i128;
|
|
290
|
-
risk_state: RiskState;
|
|
291
|
-
risk_units: i128;
|
|
292
|
-
size_open_interest: i128;
|
|
293
|
-
stored_collateral_total: i128;
|
|
294
|
-
}
|
|
295
|
-
export interface RoundPrice {
|
|
296
|
-
price: i128;
|
|
297
|
-
symbol: string;
|
|
298
|
-
}
|
|
299
|
-
export interface OracleRound {
|
|
300
|
-
id: u64;
|
|
301
|
-
previous_id: u64;
|
|
302
|
-
previous_timestamp: u64;
|
|
303
|
-
prices: Array<RoundPrice>;
|
|
304
|
-
timestamp: u64;
|
|
305
|
-
}
|
|
306
|
-
export interface GlobalConfig {
|
|
307
|
-
base_borrow_rate_bps_day: i128;
|
|
308
|
-
/**
|
|
309
|
-
* §8.1 half-life of the funding skew EMA, seconds (global: one memory
|
|
310
|
-
* horizon for every market).
|
|
311
|
-
*/
|
|
312
|
-
funding_half_life_seconds: u64;
|
|
313
|
-
hard_cap_factor_limit_bps: u32;
|
|
314
|
-
lp_revenue_share_bps: u32;
|
|
315
|
-
max_active_markets: u32;
|
|
316
|
-
max_adl_reward: i128;
|
|
317
|
-
max_insolvent_touch_reward: i128;
|
|
318
|
-
max_variable_borrow_bps_day: i128;
|
|
319
|
-
min_collateral: i128;
|
|
320
|
-
min_position_lifetime: u64;
|
|
321
|
-
risk_capacity_limit_bps: u32;
|
|
322
|
-
risk_keeper_revenue_share_bps: u32;
|
|
323
|
-
}
|
|
324
|
-
export interface MarketConfig {
|
|
325
|
-
adl_pnl_factor_bps: u32;
|
|
326
|
-
adl_reward_bps: u32;
|
|
327
|
-
/**
|
|
328
|
-
* §11.1 closing-fee tier when the close worsens skew.
|
|
329
|
-
*/
|
|
330
|
-
close_fee_high_bps: u32;
|
|
331
|
-
/**
|
|
332
|
-
* §11.1 closing-fee tier when the close improves or preserves skew.
|
|
333
|
-
*/
|
|
334
|
-
close_fee_low_bps: u32;
|
|
335
|
-
hard_cap_pnl_factor_bps: u32;
|
|
336
|
-
/**
|
|
337
|
-
* Margin required to open or add risk (§12.3). Divides max leverage:
|
|
338
|
-
* a position may not be created closer to liquidation than this.
|
|
339
|
-
*/
|
|
340
|
-
initial_margin_bps: u32;
|
|
341
|
-
/**
|
|
342
|
-
* §8.1 weight of the instantaneous skew in the funding blend, in bps;
|
|
343
|
-
* the rest is the half-life EMA. `BPS` reproduces pure instant skew.
|
|
344
|
-
*/
|
|
345
|
-
instant_weight_bps: u32;
|
|
346
|
-
liquidation_reward_bps: u32;
|
|
347
|
-
/**
|
|
348
|
-
* Margin below which the position is liquidatable (§12.3). Must not
|
|
349
|
-
* exceed `initial_margin_bps`; the gap is the entry buffer.
|
|
350
|
-
*/
|
|
351
|
-
maintenance_margin_bps: u32;
|
|
352
|
-
market_risk_factor_bps: u32;
|
|
353
|
-
max_funding_rate_bps_day: i128;
|
|
354
|
-
max_long_base_exposure: i128;
|
|
355
|
-
max_long_size_open_interest: i128;
|
|
356
|
-
max_short_base_exposure: i128;
|
|
357
|
-
max_short_size_open_interest: i128;
|
|
358
|
-
recovery_pnl_factor_bps: u32;
|
|
359
|
-
warning_pnl_factor_bps: u32;
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Global safety thresholds for price validation.
|
|
363
|
-
*/
|
|
364
|
-
export interface OracleConfig {
|
|
365
|
-
/**
|
|
366
|
-
* How long a cached aggregated price remains valid after the router
|
|
367
|
-
* fetch (in seconds). A cache hit also requires every source timestamp
|
|
368
|
-
* used for the cached median to remain within `staleness_threshold`.
|
|
369
|
-
* Must be > 0 and <= `staleness_threshold`.
|
|
370
|
-
*/
|
|
371
|
-
cache_duration: u64;
|
|
372
|
-
/**
|
|
373
|
-
* Maximum allowed spread between oracle sources in basis points
|
|
374
|
-
* (e.g., 100 = 1%). Bounded at `crate::constants::MAX_DEVIATION_BPS_CEILING`.
|
|
375
|
-
*/
|
|
376
|
-
max_deviation_bps: i128;
|
|
377
|
-
/**
|
|
378
|
-
* Minimum number of source responses that must agree within
|
|
379
|
-
* `max_deviation_bps` for OracleRouter to return a price. Floored at
|
|
380
|
-
* `crate::constants::MIN_REQUIRED_SOURCES_FLOOR`, ceilinged at
|
|
381
|
-
* `crate::constants::MAX_ORACLE_SOURCES`.
|
|
382
|
-
*/
|
|
383
|
-
min_required_sources: u32;
|
|
384
|
-
/**
|
|
385
|
-
* Maximum age of an external SEP-40 price feed before it is rejected
|
|
386
|
-
* as stale (in seconds).
|
|
387
|
-
*/
|
|
388
|
-
staleness_threshold: u64;
|
|
389
|
-
}
|
|
390
|
-
export type LpRequestKind = {
|
|
391
|
-
tag: "Deposit";
|
|
392
|
-
values: void;
|
|
393
|
-
} | {
|
|
394
|
-
tag: "Withdrawal";
|
|
395
|
-
values: void;
|
|
396
|
-
};
|
|
397
|
-
/**
|
|
398
|
-
* Data required during a WASM migration. Single definition for all contracts.
|
|
399
|
-
*/
|
|
400
|
-
export interface MigrationData {
|
|
401
|
-
version: u32;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Pending WASM upgrade — set by `propose_upgrade`, consumed by `upgrade`
|
|
405
|
-
* (cleared atomically on a successful install), or cleared by `cancel_upgrade`.
|
|
406
|
-
* Single shape across every protocol contract. Contracts store it at
|
|
407
|
-
* the shared `pending_upgrade` Symbol key in their own instance storage (see
|
|
408
|
-
* `crate::upgrade::pending_upgrade_key`). `upgrade` refuses to install
|
|
409
|
-
* unless `pending.wasm_hash` matches the supplied hash and `now >= eta`.
|
|
410
|
-
*/
|
|
411
|
-
export interface PendingUpgrade {
|
|
412
|
-
eta: u64;
|
|
413
|
-
wasm_hash: Buffer;
|
|
414
|
-
}
|
|
415
|
-
export type LpRequestStatus = {
|
|
416
|
-
tag: "Pending";
|
|
417
|
-
values: void;
|
|
418
|
-
} | {
|
|
419
|
-
tag: "Settled";
|
|
420
|
-
values: void;
|
|
421
|
-
} | {
|
|
422
|
-
tag: "Failed";
|
|
423
|
-
values: void;
|
|
424
|
-
} | {
|
|
425
|
-
tag: "Expired";
|
|
426
|
-
values: void;
|
|
427
|
-
};
|
|
428
|
-
export interface SettlementResult {
|
|
429
|
-
/**
|
|
430
|
-
* Shares minted for a deposit or assets paid for a withdrawal.
|
|
431
|
-
*/
|
|
432
|
-
amount: i128;
|
|
433
|
-
status: SettlementStatus;
|
|
434
|
-
}
|
|
435
|
-
export type SettlementStatus = {
|
|
436
|
-
tag: "Settled";
|
|
437
|
-
values: void;
|
|
438
|
-
} | {
|
|
439
|
-
tag: "Failed";
|
|
440
|
-
values: void;
|
|
441
|
-
};
|
|
442
|
-
export interface AccountingSnapshot {
|
|
443
|
-
cash_lp_equity: i128;
|
|
444
|
-
cash_shortfall: i128;
|
|
445
|
-
free_lp_capital: i128;
|
|
446
|
-
lp_blocked_side_count: u32;
|
|
447
|
-
non_lp_claims: i128;
|
|
448
|
-
open_position_count: u64;
|
|
449
|
-
physical_cash: i128;
|
|
450
|
-
required_risk_backing: i128;
|
|
451
|
-
total_risk_units: i128;
|
|
452
|
-
vault_nav: i128;
|
|
453
|
-
}
|
|
454
|
-
export declare const UpgradeableError: {
|
|
455
|
-
/**
|
|
456
|
-
* When migration is attempted but not allowed due to upgrade state.
|
|
457
|
-
*/
|
|
458
|
-
1100: {
|
|
459
|
-
message: string;
|
|
460
|
-
};
|
|
461
|
-
};
|
|
462
|
-
export declare const MerkleDistributorError: {
|
|
463
|
-
/**
|
|
464
|
-
* The merkle root is not set.
|
|
465
|
-
*/
|
|
466
|
-
1300: {
|
|
467
|
-
message: string;
|
|
468
|
-
};
|
|
469
|
-
/**
|
|
470
|
-
* The provided index was already claimed.
|
|
471
|
-
*/
|
|
472
|
-
1301: {
|
|
473
|
-
message: string;
|
|
474
|
-
};
|
|
475
|
-
/**
|
|
476
|
-
* The proof is invalid.
|
|
477
|
-
*/
|
|
478
|
-
1302: {
|
|
479
|
-
message: string;
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
|
-
/**
|
|
483
|
-
* Storage keys for the data associated with `MerkleDistributor`
|
|
484
|
-
*/
|
|
485
|
-
export type MerkleDistributorStorageKey = {
|
|
486
|
-
tag: "Root";
|
|
487
|
-
values: void;
|
|
488
|
-
} | {
|
|
489
|
-
tag: "Claimed";
|
|
490
|
-
values: readonly [u32];
|
|
491
|
-
};
|
|
492
|
-
/**
|
|
493
|
-
* Rounding direction for division operations
|
|
494
|
-
*/
|
|
495
|
-
export type Rounding = {
|
|
496
|
-
tag: "Floor";
|
|
497
|
-
values: void;
|
|
498
|
-
} | {
|
|
499
|
-
tag: "Ceil";
|
|
500
|
-
values: void;
|
|
501
|
-
} | {
|
|
502
|
-
tag: "Truncate";
|
|
503
|
-
values: void;
|
|
504
|
-
};
|
|
505
|
-
export declare const SorobanFixedPointError: {
|
|
506
|
-
/**
|
|
507
|
-
* Arithmetic overflow occurred
|
|
508
|
-
*/
|
|
509
|
-
1500: {
|
|
510
|
-
message: string;
|
|
511
|
-
};
|
|
512
|
-
/**
|
|
513
|
-
* Division by zero
|
|
514
|
-
*/
|
|
515
|
-
1501: {
|
|
516
|
-
message: string;
|
|
517
|
-
};
|
|
518
|
-
};
|
|
519
|
-
export declare const CryptoError: {
|
|
520
|
-
/**
|
|
521
|
-
* The merkle proof length is out of bounds.
|
|
522
|
-
*/
|
|
523
|
-
1400: {
|
|
524
|
-
message: string;
|
|
525
|
-
};
|
|
526
|
-
/**
|
|
527
|
-
* The index of the leaf is out of bounds.
|
|
528
|
-
*/
|
|
529
|
-
1401: {
|
|
530
|
-
message: string;
|
|
531
|
-
};
|
|
532
|
-
/**
|
|
533
|
-
* No data in hasher state.
|
|
534
|
-
*/
|
|
535
|
-
1402: {
|
|
536
|
-
message: string;
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
export declare const PausableError: {
|
|
540
|
-
/**
|
|
541
|
-
* The operation failed because the contract is paused.
|
|
542
|
-
*/
|
|
543
|
-
1000: {
|
|
544
|
-
message: string;
|
|
545
|
-
};
|
|
546
|
-
/**
|
|
547
|
-
* The operation failed because the contract is not paused.
|
|
548
|
-
*/
|
|
549
|
-
1001: {
|
|
550
|
-
message: string;
|
|
551
|
-
};
|
|
552
|
-
};
|
|
553
|
-
/**
|
|
554
|
-
* Storage key for the pausable state
|
|
555
|
-
*/
|
|
556
|
-
export type PausableStorageKey = {
|
|
557
|
-
tag: "Paused";
|
|
558
|
-
values: void;
|
|
559
|
-
};
|
|
560
|
-
export interface Client {
|
|
561
|
-
/**
|
|
562
|
-
* Construct and simulate a migrate transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
563
|
-
*/
|
|
564
|
-
migrate: ({ migration_data, operator }: {
|
|
565
|
-
migration_data: MigrationData;
|
|
566
|
-
operator: string;
|
|
567
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
568
|
-
/**
|
|
569
|
-
* Construct and simulate a upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
570
|
-
*/
|
|
571
|
-
upgrade: ({ new_wasm_hash, operator }: {
|
|
572
|
-
new_wasm_hash: Buffer;
|
|
573
|
-
operator: string;
|
|
574
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
575
|
-
/**
|
|
576
|
-
* Construct and simulate a get_price transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
577
|
-
*/
|
|
578
|
-
get_price: ({ symbol }: {
|
|
579
|
-
symbol: string;
|
|
580
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
581
|
-
/**
|
|
582
|
-
* Construct and simulate a get_round transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
583
|
-
*/
|
|
584
|
-
get_round: ({ round_id }: {
|
|
585
|
-
round_id: u64;
|
|
586
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<OracleRound>>;
|
|
587
|
-
/**
|
|
588
|
-
* Construct and simulate a publish_round transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
589
|
-
*/
|
|
590
|
-
publish_round: ({ caller }: {
|
|
591
|
-
caller: string;
|
|
592
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
|
|
593
|
-
/**
|
|
594
|
-
* Construct and simulate a cancel_upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
595
|
-
*/
|
|
596
|
-
cancel_upgrade: ({ caller }: {
|
|
597
|
-
caller: string;
|
|
598
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
599
|
-
/**
|
|
600
|
-
* Construct and simulate a latest_round_id transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
601
|
-
*/
|
|
602
|
-
latest_round_id: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
|
|
603
|
-
/**
|
|
604
|
-
* Construct and simulate a propose_upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
605
|
-
*/
|
|
606
|
-
propose_upgrade: ({ caller, wasm_hash }: {
|
|
607
|
-
caller: string;
|
|
608
|
-
wasm_hash: Buffer;
|
|
609
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
610
|
-
/**
|
|
611
|
-
* Construct and simulate a bump_oracle_state transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
612
|
-
*/
|
|
613
|
-
bump_oracle_state: (options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
614
|
-
/**
|
|
615
|
-
* Construct and simulate a get_oracle_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
616
|
-
*/
|
|
617
|
-
get_oracle_config: (options?: MethodOptions) => Promise<AssembledTransaction<OracleConfig>>;
|
|
618
|
-
/**
|
|
619
|
-
* Construct and simulate a set_oracle_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
620
|
-
*/
|
|
621
|
-
set_oracle_config: ({ caller, config }: {
|
|
622
|
-
caller: string;
|
|
623
|
-
config: OracleConfig;
|
|
624
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
625
|
-
/**
|
|
626
|
-
* Construct and simulate a set_oracle_sources transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
627
|
-
*/
|
|
628
|
-
set_oracle_sources: ({ caller, symbol, sources }: {
|
|
629
|
-
caller: string;
|
|
630
|
-
symbol: string;
|
|
631
|
-
sources: Array<string>;
|
|
632
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
633
|
-
/**
|
|
634
|
-
* Construct and simulate a set_position_manager transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
635
|
-
*/
|
|
636
|
-
set_position_manager: ({ caller, position_manager }: {
|
|
637
|
-
caller: string;
|
|
638
|
-
position_manager: string;
|
|
639
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
640
|
-
}
|
|
641
|
-
export declare class Client extends ContractClient {
|
|
642
|
-
readonly options: ContractClientOptions;
|
|
643
|
-
static deploy<T = Client>(
|
|
644
|
-
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
645
|
-
{ config_manager_address }: {
|
|
646
|
-
config_manager_address: string;
|
|
647
|
-
},
|
|
648
|
-
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
649
|
-
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
650
|
-
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
651
|
-
wasmHash: Buffer | string;
|
|
652
|
-
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
653
|
-
salt?: Buffer | Uint8Array;
|
|
654
|
-
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
655
|
-
format?: "hex" | "base64";
|
|
656
|
-
}): Promise<AssembledTransaction<T>>;
|
|
657
|
-
constructor(options: ContractClientOptions);
|
|
658
|
-
readonly fromJSON: {
|
|
659
|
-
migrate: (json: string) => AssembledTransaction<null>;
|
|
660
|
-
upgrade: (json: string) => AssembledTransaction<null>;
|
|
661
|
-
get_price: (json: string) => AssembledTransaction<bigint>;
|
|
662
|
-
get_round: (json: string) => AssembledTransaction<OracleRound>;
|
|
663
|
-
publish_round: (json: string) => AssembledTransaction<bigint>;
|
|
664
|
-
cancel_upgrade: (json: string) => AssembledTransaction<null>;
|
|
665
|
-
latest_round_id: (json: string) => AssembledTransaction<bigint>;
|
|
666
|
-
propose_upgrade: (json: string) => AssembledTransaction<null>;
|
|
667
|
-
bump_oracle_state: (json: string) => AssembledTransaction<null>;
|
|
668
|
-
get_oracle_config: (json: string) => AssembledTransaction<OracleConfig>;
|
|
669
|
-
set_oracle_config: (json: string) => AssembledTransaction<null>;
|
|
670
|
-
set_oracle_sources: (json: string) => AssembledTransaction<null>;
|
|
671
|
-
set_position_manager: (json: string) => AssembledTransaction<null>;
|
|
672
|
-
};
|
|
673
|
-
}
|