@win-trader/bindings 0.1.0 → 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 +266 -282
- package/config-manager/dist/index.js +67 -51
- 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 +672 -672
- package/mock-token/dist/index.js +256 -253
- package/package.json +9 -22
- package/position-manager/dist/index.d.ts +491 -553
- package/position-manager/dist/index.js +172 -188
- package/request-router/dist/index.d.ts +274 -277
- package/request-router/dist/index.js +74 -58
- package/vault/dist/index.d.ts +916 -937
- package/vault/dist/index.js +310 -299
- package/oracle/dist/index.d.ts +0 -625
- package/oracle/dist/index.js +0 -152
- package/oracle-router/dist/index.d.ts +0 -743
- package/oracle-router/dist/index.js +0 -210
|
@@ -0,0 +1,662 @@
|
|
|
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, Option } 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 CexFeedError: {
|
|
8
|
+
600: {
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
601: {
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
610: {
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
611: {
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
620: {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
621: {
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
622: {
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type Key = {
|
|
31
|
+
tag: "ConfigManager";
|
|
32
|
+
values: void;
|
|
33
|
+
} | {
|
|
34
|
+
tag: "TimelockSeconds";
|
|
35
|
+
values: void;
|
|
36
|
+
} | {
|
|
37
|
+
tag: "Publishers";
|
|
38
|
+
values: void;
|
|
39
|
+
} | {
|
|
40
|
+
tag: "Config";
|
|
41
|
+
values: void;
|
|
42
|
+
} | {
|
|
43
|
+
tag: "PendingSources";
|
|
44
|
+
values: void;
|
|
45
|
+
} | {
|
|
46
|
+
tag: "Price";
|
|
47
|
+
values: readonly [string, string];
|
|
48
|
+
};
|
|
49
|
+
export interface FeedConfig {
|
|
50
|
+
/**
|
|
51
|
+
* Largest one-sided distance of any fresh source from the median.
|
|
52
|
+
*/
|
|
53
|
+
max_deviation_bps: u32;
|
|
54
|
+
/**
|
|
55
|
+
* A source older than this is ignored.
|
|
56
|
+
*/
|
|
57
|
+
max_source_age_seconds: u64;
|
|
58
|
+
/**
|
|
59
|
+
* Fewer fresh sources than this and `lastprice` returns `None`.
|
|
60
|
+
*/
|
|
61
|
+
min_sources: u32;
|
|
62
|
+
}
|
|
63
|
+
export interface SourcePrice {
|
|
64
|
+
price: i128;
|
|
65
|
+
symbol: string;
|
|
66
|
+
}
|
|
67
|
+
export interface PendingSources {
|
|
68
|
+
config: FeedConfig;
|
|
69
|
+
effective_at: u64;
|
|
70
|
+
publishers: Array<string>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* SEP-40 asset identifier. Markets are quoted as `Other(market symbol)`.
|
|
74
|
+
*/
|
|
75
|
+
export type Asset = {
|
|
76
|
+
tag: "Stellar";
|
|
77
|
+
values: readonly [string];
|
|
78
|
+
} | {
|
|
79
|
+
tag: "Other";
|
|
80
|
+
values: readonly [string];
|
|
81
|
+
};
|
|
82
|
+
export interface PriceData {
|
|
83
|
+
price: i128;
|
|
84
|
+
timestamp: u64;
|
|
85
|
+
}
|
|
86
|
+
export interface StampedPrice {
|
|
87
|
+
observed_at: u64;
|
|
88
|
+
price: i128;
|
|
89
|
+
}
|
|
90
|
+
export interface Market {
|
|
91
|
+
config: MarketConfig;
|
|
92
|
+
current_payer_rate: i128;
|
|
93
|
+
current_payer_side: PayerSide;
|
|
94
|
+
last_funding_checkpoint: u64;
|
|
95
|
+
long: MarketSide;
|
|
96
|
+
long_payer_remainders: RemainderGroup;
|
|
97
|
+
lp_backed_index_long: i128;
|
|
98
|
+
lp_backed_index_short: i128;
|
|
99
|
+
pending_receiver_funding: i128;
|
|
100
|
+
receiver_backed_index_long: i128;
|
|
101
|
+
receiver_backed_index_short: i128;
|
|
102
|
+
receiver_index_long: i128;
|
|
103
|
+
receiver_index_short: i128;
|
|
104
|
+
short: MarketSide;
|
|
105
|
+
short_payer_remainders: RemainderGroup;
|
|
106
|
+
skew_ema: i128;
|
|
107
|
+
}
|
|
108
|
+
export type Trigger = {
|
|
109
|
+
tag: "None";
|
|
110
|
+
values: void;
|
|
111
|
+
} | {
|
|
112
|
+
tag: "Attached";
|
|
113
|
+
values: readonly [TriggerInstruction];
|
|
114
|
+
};
|
|
115
|
+
export interface LpConfig {
|
|
116
|
+
lp_request_delay_seconds: u64;
|
|
117
|
+
max_withdraw_utilization_bps: u32;
|
|
118
|
+
min_deposit_nav_factor_bps: u32;
|
|
119
|
+
}
|
|
120
|
+
export interface Position {
|
|
121
|
+
base_exposure: i128;
|
|
122
|
+
borrow_index_snapshot: i128;
|
|
123
|
+
id: u64;
|
|
124
|
+
is_long: boolean;
|
|
125
|
+
lp_payer_index_snapshot: i128;
|
|
126
|
+
market: string;
|
|
127
|
+
opened_at: u64;
|
|
128
|
+
owner: string;
|
|
129
|
+
pending_mutation_action_id: Option<u64>;
|
|
130
|
+
receiver_index_snapshot: i128;
|
|
131
|
+
receiver_payer_index_snapshot: i128;
|
|
132
|
+
risk_units: i128;
|
|
133
|
+
size: i128;
|
|
134
|
+
stop_loss: Trigger;
|
|
135
|
+
stored_collateral: i128;
|
|
136
|
+
stored_minimum_borrow_fee: i128;
|
|
137
|
+
take_profit: Trigger;
|
|
138
|
+
}
|
|
139
|
+
export interface LpRequest {
|
|
140
|
+
amount: i128;
|
|
141
|
+
execute_after: u64;
|
|
142
|
+
id: u64;
|
|
143
|
+
kind: LpRequestKind;
|
|
144
|
+
owner: string;
|
|
145
|
+
request_time: u64;
|
|
146
|
+
/**
|
|
147
|
+
* The resolve reward fixed when the request was made.
|
|
148
|
+
*/
|
|
149
|
+
reward: i128;
|
|
150
|
+
status: LpRequestStatus;
|
|
151
|
+
}
|
|
152
|
+
export type PayerSide = {
|
|
153
|
+
tag: "None";
|
|
154
|
+
values: void;
|
|
155
|
+
} | {
|
|
156
|
+
tag: "Long";
|
|
157
|
+
values: void;
|
|
158
|
+
} | {
|
|
159
|
+
tag: "Short";
|
|
160
|
+
values: void;
|
|
161
|
+
};
|
|
162
|
+
export type RiskState = {
|
|
163
|
+
tag: "Normal";
|
|
164
|
+
values: void;
|
|
165
|
+
} | {
|
|
166
|
+
tag: "Warning";
|
|
167
|
+
values: void;
|
|
168
|
+
} | {
|
|
169
|
+
tag: "Adl";
|
|
170
|
+
values: void;
|
|
171
|
+
} | {
|
|
172
|
+
tag: "HardCap";
|
|
173
|
+
values: void;
|
|
174
|
+
};
|
|
175
|
+
export type ActionKind = {
|
|
176
|
+
tag: "MarketOpen";
|
|
177
|
+
values: void;
|
|
178
|
+
} | {
|
|
179
|
+
tag: "LimitOpen";
|
|
180
|
+
values: void;
|
|
181
|
+
} | {
|
|
182
|
+
tag: "Decrease";
|
|
183
|
+
values: void;
|
|
184
|
+
} | {
|
|
185
|
+
tag: "Close";
|
|
186
|
+
values: void;
|
|
187
|
+
};
|
|
188
|
+
export interface MarketSide {
|
|
189
|
+
base_exposure: i128;
|
|
190
|
+
hard_cap_payout_factor: i128;
|
|
191
|
+
hard_cap_reference_pnl: i128;
|
|
192
|
+
risk_state: RiskState;
|
|
193
|
+
risk_units: i128;
|
|
194
|
+
size_open_interest: i128;
|
|
195
|
+
stored_collateral_total: i128;
|
|
196
|
+
}
|
|
197
|
+
export interface OpenPayload {
|
|
198
|
+
acceptable_price: i128;
|
|
199
|
+
expires_at: u64;
|
|
200
|
+
is_long: boolean;
|
|
201
|
+
size: i128;
|
|
202
|
+
stop_loss: i128;
|
|
203
|
+
submitted_collateral: i128;
|
|
204
|
+
take_profit: i128;
|
|
205
|
+
}
|
|
206
|
+
export interface ClosePayload {
|
|
207
|
+
acceptable_price: i128;
|
|
208
|
+
position_id: u64;
|
|
209
|
+
}
|
|
210
|
+
export interface GlobalConfig {
|
|
211
|
+
base_borrow_rate_bps_day: i128;
|
|
212
|
+
borrow_lp_revenue_share_bps: u32;
|
|
213
|
+
config_timelock_seconds: u64;
|
|
214
|
+
fee_lp_revenue_share_bps: u32;
|
|
215
|
+
funding_half_life_seconds: u64;
|
|
216
|
+
global_hard_cap_limit_bps: u32;
|
|
217
|
+
hard_cap_relatch_band_bps: u32;
|
|
218
|
+
keeper_rewards: KeeperRewards;
|
|
219
|
+
max_active_markets: u32;
|
|
220
|
+
max_market_order_lifetime: u64;
|
|
221
|
+
max_order_lifetime_seconds: u64;
|
|
222
|
+
max_price_age_seconds: u64;
|
|
223
|
+
max_variable_borrow_bps_day: i128;
|
|
224
|
+
min_borrow_fee_seconds: u64;
|
|
225
|
+
min_collateral: i128;
|
|
226
|
+
min_position_lifetime: u64;
|
|
227
|
+
risk_capacity_limit_bps: u32;
|
|
228
|
+
}
|
|
229
|
+
export interface MarketConfig {
|
|
230
|
+
adl_pnl_factor_bps: u32;
|
|
231
|
+
close_pnl_fee_bps: u32;
|
|
232
|
+
close_size_fee_bps: u32;
|
|
233
|
+
hard_cap_pnl_factor_bps: u32;
|
|
234
|
+
initial_margin_bps: u32;
|
|
235
|
+
instant_weight_bps: u32;
|
|
236
|
+
maintenance_margin_bps: u32;
|
|
237
|
+
market_risk_factor_bps: u32;
|
|
238
|
+
max_funding_rate_bps_day: i128;
|
|
239
|
+
max_long_base_exposure: i128;
|
|
240
|
+
max_long_size_open_interest: i128;
|
|
241
|
+
max_short_base_exposure: i128;
|
|
242
|
+
max_short_size_open_interest: i128;
|
|
243
|
+
open_fee_bps: u32;
|
|
244
|
+
order_execution_delay_seconds: u64;
|
|
245
|
+
recovery_pnl_factor_bps: u32;
|
|
246
|
+
warning_pnl_factor_bps: u32;
|
|
247
|
+
}
|
|
248
|
+
export type ActionOutcome = {
|
|
249
|
+
tag: "Executed";
|
|
250
|
+
values: void;
|
|
251
|
+
} | {
|
|
252
|
+
tag: "Failed";
|
|
253
|
+
values: void;
|
|
254
|
+
} | {
|
|
255
|
+
tag: "Cancelled";
|
|
256
|
+
values: void;
|
|
257
|
+
} | {
|
|
258
|
+
tag: "Expired";
|
|
259
|
+
values: void;
|
|
260
|
+
} | {
|
|
261
|
+
tag: "Superseded";
|
|
262
|
+
values: void;
|
|
263
|
+
} | {
|
|
264
|
+
tag: "NotReady";
|
|
265
|
+
values: void;
|
|
266
|
+
} | {
|
|
267
|
+
tag: "Pending";
|
|
268
|
+
values: void;
|
|
269
|
+
} | {
|
|
270
|
+
tag: "RequiresLiquidation";
|
|
271
|
+
values: void;
|
|
272
|
+
};
|
|
273
|
+
export type ActionPayload = {
|
|
274
|
+
tag: "MarketOpen";
|
|
275
|
+
values: readonly [OpenPayload];
|
|
276
|
+
} | {
|
|
277
|
+
tag: "LimitOpen";
|
|
278
|
+
values: readonly [OpenPayload, TriggerCondition];
|
|
279
|
+
} | {
|
|
280
|
+
tag: "Decrease";
|
|
281
|
+
values: readonly [DecreasePayload];
|
|
282
|
+
} | {
|
|
283
|
+
tag: "Close";
|
|
284
|
+
values: readonly [ClosePayload];
|
|
285
|
+
};
|
|
286
|
+
export type FailureReason = {
|
|
287
|
+
tag: "PriceBoundExceeded";
|
|
288
|
+
values: void;
|
|
289
|
+
} | {
|
|
290
|
+
tag: "CapacityExceeded";
|
|
291
|
+
values: void;
|
|
292
|
+
} | {
|
|
293
|
+
tag: "ExposureCapExceeded";
|
|
294
|
+
values: void;
|
|
295
|
+
} | {
|
|
296
|
+
tag: "SideRestricted";
|
|
297
|
+
values: void;
|
|
298
|
+
} | {
|
|
299
|
+
tag: "InsufficientCollateral";
|
|
300
|
+
values: void;
|
|
301
|
+
} | {
|
|
302
|
+
tag: "UnpayableProfit";
|
|
303
|
+
values: void;
|
|
304
|
+
} | {
|
|
305
|
+
tag: "PositionGone";
|
|
306
|
+
values: void;
|
|
307
|
+
} | {
|
|
308
|
+
tag: "MarketPaused";
|
|
309
|
+
values: void;
|
|
310
|
+
} | {
|
|
311
|
+
tag: "SizeTooSmall";
|
|
312
|
+
values: void;
|
|
313
|
+
};
|
|
314
|
+
export interface KeeperRewards {
|
|
315
|
+
adl: i128;
|
|
316
|
+
close: i128;
|
|
317
|
+
decrease: i128;
|
|
318
|
+
expiry: i128;
|
|
319
|
+
limit_order: i128;
|
|
320
|
+
liquidation: i128;
|
|
321
|
+
lp_resolve: i128;
|
|
322
|
+
open: i128;
|
|
323
|
+
sl: i128;
|
|
324
|
+
tp: i128;
|
|
325
|
+
}
|
|
326
|
+
export type LpRequestKind = {
|
|
327
|
+
tag: "Deposit";
|
|
328
|
+
values: void;
|
|
329
|
+
} | {
|
|
330
|
+
tag: "Withdrawal";
|
|
331
|
+
values: void;
|
|
332
|
+
};
|
|
333
|
+
export interface MigrationData {
|
|
334
|
+
version: u32;
|
|
335
|
+
}
|
|
336
|
+
export interface PendingAction {
|
|
337
|
+
action_id: u64;
|
|
338
|
+
commit_observed_at: u64;
|
|
339
|
+
created_at: u64;
|
|
340
|
+
escrowed_collateral: i128;
|
|
341
|
+
execute_after: u64;
|
|
342
|
+
kind: ActionKind;
|
|
343
|
+
market_id: string;
|
|
344
|
+
owner: string;
|
|
345
|
+
payload: ActionPayload;
|
|
346
|
+
}
|
|
347
|
+
export interface PendingUpgrade {
|
|
348
|
+
eta: u64;
|
|
349
|
+
wasm_hash: Buffer;
|
|
350
|
+
}
|
|
351
|
+
export interface RemainderGroup {
|
|
352
|
+
distribution_remainder: i128;
|
|
353
|
+
lp_payer_remainder: i128;
|
|
354
|
+
receiver_liability_remainder: i128;
|
|
355
|
+
receiver_payer_remainder: i128;
|
|
356
|
+
}
|
|
357
|
+
export interface DecreasePayload {
|
|
358
|
+
acceptable_price: i128;
|
|
359
|
+
position_id: u64;
|
|
360
|
+
size_removed: i128;
|
|
361
|
+
}
|
|
362
|
+
export type LpRequestStatus = {
|
|
363
|
+
tag: "Pending";
|
|
364
|
+
values: void;
|
|
365
|
+
} | {
|
|
366
|
+
tag: "Settled";
|
|
367
|
+
values: void;
|
|
368
|
+
} | {
|
|
369
|
+
tag: "Failed";
|
|
370
|
+
values: void;
|
|
371
|
+
};
|
|
372
|
+
export interface PendingFeesView {
|
|
373
|
+
borrow: i128;
|
|
374
|
+
funding_paid_to_lps: i128;
|
|
375
|
+
funding_paid_to_receivers: i128;
|
|
376
|
+
funding_received: i128;
|
|
377
|
+
}
|
|
378
|
+
export interface PendingPriceFeed {
|
|
379
|
+
effective_at: u64;
|
|
380
|
+
price_feed: string;
|
|
381
|
+
}
|
|
382
|
+
export interface SettlementResult {
|
|
383
|
+
amount: i128;
|
|
384
|
+
reward: i128;
|
|
385
|
+
status: SettlementStatus;
|
|
386
|
+
}
|
|
387
|
+
export type SettlementStatus = {
|
|
388
|
+
tag: "Settled";
|
|
389
|
+
values: void;
|
|
390
|
+
} | {
|
|
391
|
+
tag: "Failed";
|
|
392
|
+
values: void;
|
|
393
|
+
} | {
|
|
394
|
+
tag: "NotReady";
|
|
395
|
+
values: void;
|
|
396
|
+
};
|
|
397
|
+
export interface TriggerCondition {
|
|
398
|
+
trigger_above: boolean;
|
|
399
|
+
trigger_price: i128;
|
|
400
|
+
}
|
|
401
|
+
export interface AccountingSnapshot {
|
|
402
|
+
cash_lp_equity: i128;
|
|
403
|
+
cash_shortfall: i128;
|
|
404
|
+
deleveraging_side_count: u32;
|
|
405
|
+
free_lp_capital: i128;
|
|
406
|
+
min_equity_clear_of_adl: i128;
|
|
407
|
+
non_lp_claims: i128;
|
|
408
|
+
open_position_count: u64;
|
|
409
|
+
physical_cash: i128;
|
|
410
|
+
required_risk_backing: i128;
|
|
411
|
+
restricted_side_count: u32;
|
|
412
|
+
total_risk_units: i128;
|
|
413
|
+
vault_nav: i128;
|
|
414
|
+
}
|
|
415
|
+
export interface TriggerInstruction {
|
|
416
|
+
acceptable_price: i128;
|
|
417
|
+
commit_observed_at: u64;
|
|
418
|
+
committed_at: u64;
|
|
419
|
+
execute_after: u64;
|
|
420
|
+
trigger_price: i128;
|
|
421
|
+
}
|
|
422
|
+
export interface PendingGlobalConfig {
|
|
423
|
+
config: GlobalConfig;
|
|
424
|
+
effective_at: u64;
|
|
425
|
+
}
|
|
426
|
+
export interface PendingMarketConfig {
|
|
427
|
+
config: MarketConfig;
|
|
428
|
+
effective_at: u64;
|
|
429
|
+
}
|
|
430
|
+
export interface EventHeader {
|
|
431
|
+
actor: string;
|
|
432
|
+
event_version: u32;
|
|
433
|
+
ledger_timestamp: u64;
|
|
434
|
+
market: string;
|
|
435
|
+
}
|
|
436
|
+
export declare const UpgradeableError: {
|
|
437
|
+
/**
|
|
438
|
+
* When migration is attempted but not allowed due to upgrade state.
|
|
439
|
+
*/
|
|
440
|
+
1100: {
|
|
441
|
+
message: string;
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
export declare const MerkleDistributorError: {
|
|
445
|
+
/**
|
|
446
|
+
* The merkle root is not set.
|
|
447
|
+
*/
|
|
448
|
+
1300: {
|
|
449
|
+
message: string;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* The provided index was already claimed.
|
|
453
|
+
*/
|
|
454
|
+
1301: {
|
|
455
|
+
message: string;
|
|
456
|
+
};
|
|
457
|
+
/**
|
|
458
|
+
* The proof is invalid.
|
|
459
|
+
*/
|
|
460
|
+
1302: {
|
|
461
|
+
message: string;
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Rounding direction for division operations
|
|
466
|
+
*/
|
|
467
|
+
export type Rounding = {
|
|
468
|
+
tag: "Floor";
|
|
469
|
+
values: void;
|
|
470
|
+
} | {
|
|
471
|
+
tag: "Ceil";
|
|
472
|
+
values: void;
|
|
473
|
+
} | {
|
|
474
|
+
tag: "Truncate";
|
|
475
|
+
values: void;
|
|
476
|
+
};
|
|
477
|
+
export declare const SorobanFixedPointError: {
|
|
478
|
+
/**
|
|
479
|
+
* Arithmetic overflow occurred
|
|
480
|
+
*/
|
|
481
|
+
1500: {
|
|
482
|
+
message: string;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Division by zero
|
|
486
|
+
*/
|
|
487
|
+
1501: {
|
|
488
|
+
message: string;
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
export declare const PausableError: {
|
|
492
|
+
/**
|
|
493
|
+
* The operation failed because the contract is paused.
|
|
494
|
+
*/
|
|
495
|
+
1000: {
|
|
496
|
+
message: string;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* The operation failed because the contract is not paused.
|
|
500
|
+
*/
|
|
501
|
+
1001: {
|
|
502
|
+
message: string;
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* Storage keys for the data associated with `MerkleDistributor`
|
|
507
|
+
*/
|
|
508
|
+
export type MerkleDistributorStorageKey = {
|
|
509
|
+
tag: "Root";
|
|
510
|
+
values: void;
|
|
511
|
+
} | {
|
|
512
|
+
tag: "Claimed";
|
|
513
|
+
values: readonly [u32];
|
|
514
|
+
};
|
|
515
|
+
export declare const CryptoError: {
|
|
516
|
+
/**
|
|
517
|
+
* The merkle proof length is out of bounds.
|
|
518
|
+
*/
|
|
519
|
+
1400: {
|
|
520
|
+
message: string;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* The index of the leaf is out of bounds.
|
|
524
|
+
*/
|
|
525
|
+
1401: {
|
|
526
|
+
message: string;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* No data in hasher state.
|
|
530
|
+
*/
|
|
531
|
+
1402: {
|
|
532
|
+
message: string;
|
|
533
|
+
};
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* Storage key for the pausable state
|
|
537
|
+
*/
|
|
538
|
+
export type PausableStorageKey = {
|
|
539
|
+
tag: "Paused";
|
|
540
|
+
values: void;
|
|
541
|
+
};
|
|
542
|
+
export interface Client {
|
|
543
|
+
/**
|
|
544
|
+
* Construct and simulate a 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.
|
|
545
|
+
*/
|
|
546
|
+
config: (options?: MethodOptions) => Promise<AssembledTransaction<FeedConfig>>;
|
|
547
|
+
/**
|
|
548
|
+
* Construct and simulate a decimals 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.
|
|
549
|
+
* SEP-40: prices carry `PRICE_DECIMALS` places.
|
|
550
|
+
*/
|
|
551
|
+
decimals: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
|
|
552
|
+
/**
|
|
553
|
+
* Construct and simulate a lastprice 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.
|
|
554
|
+
* SEP-40: the median of the fresh sources for `Other(symbol)`, stamped
|
|
555
|
+
* with the oldest of them. `None` below `min_sources` fresh sources or
|
|
556
|
+
* past `max_deviation_bps`.
|
|
557
|
+
*/
|
|
558
|
+
lastprice: ({ asset }: {
|
|
559
|
+
asset: Asset;
|
|
560
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<PriceData>>>;
|
|
561
|
+
/**
|
|
562
|
+
* Construct and simulate a publishers 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
|
+
publishers: (options?: MethodOptions) => Promise<AssembledTransaction<Array<string>>>;
|
|
565
|
+
/**
|
|
566
|
+
* Construct and simulate a set_prices 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.
|
|
567
|
+
* Record `publisher`'s prices, observed on its exchange at `observed_at`.
|
|
568
|
+
* The stamp is `min(observed_at, ledger time)`: a price that lands late
|
|
569
|
+
* keeps its older observation time, so it can never pass as observed
|
|
570
|
+
* after a commit it predates. One call carries every symbol.
|
|
571
|
+
*/
|
|
572
|
+
set_prices: ({ publisher, observed_at, prices }: {
|
|
573
|
+
publisher: string;
|
|
574
|
+
observed_at: u64;
|
|
575
|
+
prices: Array<SourcePrice>;
|
|
576
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
577
|
+
/**
|
|
578
|
+
* Construct and simulate a source_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.
|
|
579
|
+
* One publisher's last price for `symbol`, fresh or not.
|
|
580
|
+
*/
|
|
581
|
+
source_price: ({ publisher, symbol }: {
|
|
582
|
+
publisher: string;
|
|
583
|
+
symbol: string;
|
|
584
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<PriceData>>>;
|
|
585
|
+
/**
|
|
586
|
+
* Construct and simulate a apply_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.
|
|
587
|
+
* Permissionless once due; lapses one timelock after that.
|
|
588
|
+
*/
|
|
589
|
+
apply_sources: ({ caller }: {
|
|
590
|
+
caller: string;
|
|
591
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
592
|
+
/**
|
|
593
|
+
* Construct and simulate a cancel_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.
|
|
594
|
+
*/
|
|
595
|
+
cancel_sources: ({ caller }: {
|
|
596
|
+
caller: string;
|
|
597
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
598
|
+
/**
|
|
599
|
+
* Construct and simulate a pending_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.
|
|
600
|
+
*/
|
|
601
|
+
pending_sources: (options?: MethodOptions) => Promise<AssembledTransaction<Option<PendingSources>>>;
|
|
602
|
+
/**
|
|
603
|
+
* Construct and simulate a propose_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.
|
|
604
|
+
* Replace the publisher set and config after `timelock_seconds`; a new
|
|
605
|
+
* proposal overwrites the pending one.
|
|
606
|
+
*/
|
|
607
|
+
propose_sources: ({ caller, publishers, config }: {
|
|
608
|
+
caller: string;
|
|
609
|
+
publishers: Array<string>;
|
|
610
|
+
config: FeedConfig;
|
|
611
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
612
|
+
/**
|
|
613
|
+
* Construct and simulate a remove_publisher 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.
|
|
614
|
+
* Drop a compromised publisher now. Never adds a publisher; with fewer
|
|
615
|
+
* publishers than `min_sources`, `lastprice` returns `None` and the
|
|
616
|
+
* protocol stops settling until a new set is applied. A pending proposal
|
|
617
|
+
* that includes the removed publisher is cancelled with it.
|
|
618
|
+
*/
|
|
619
|
+
remove_publisher: ({ caller, publisher }: {
|
|
620
|
+
caller: string;
|
|
621
|
+
publisher: string;
|
|
622
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
623
|
+
/**
|
|
624
|
+
* Construct and simulate a timelock_seconds 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.
|
|
625
|
+
*/
|
|
626
|
+
timelock_seconds: (options?: MethodOptions) => Promise<AssembledTransaction<u64>>;
|
|
627
|
+
}
|
|
628
|
+
export declare class Client extends ContractClient {
|
|
629
|
+
readonly options: ContractClientOptions;
|
|
630
|
+
static deploy<T = Client>(
|
|
631
|
+
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
632
|
+
{ config_manager, timelock_seconds, publishers, config }: {
|
|
633
|
+
config_manager: string;
|
|
634
|
+
timelock_seconds: u64;
|
|
635
|
+
publishers: Array<string>;
|
|
636
|
+
config: FeedConfig;
|
|
637
|
+
},
|
|
638
|
+
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
639
|
+
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
640
|
+
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
641
|
+
wasmHash: Buffer | string;
|
|
642
|
+
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
643
|
+
salt?: Buffer | Uint8Array;
|
|
644
|
+
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
645
|
+
format?: "hex" | "base64";
|
|
646
|
+
}): Promise<AssembledTransaction<T>>;
|
|
647
|
+
constructor(options: ContractClientOptions);
|
|
648
|
+
readonly fromJSON: {
|
|
649
|
+
config: (json: string) => AssembledTransaction<FeedConfig>;
|
|
650
|
+
decimals: (json: string) => AssembledTransaction<number>;
|
|
651
|
+
lastprice: (json: string) => AssembledTransaction<Option<PriceData>>;
|
|
652
|
+
publishers: (json: string) => AssembledTransaction<string[]>;
|
|
653
|
+
set_prices: (json: string) => AssembledTransaction<null>;
|
|
654
|
+
source_price: (json: string) => AssembledTransaction<Option<PriceData>>;
|
|
655
|
+
apply_sources: (json: string) => AssembledTransaction<null>;
|
|
656
|
+
cancel_sources: (json: string) => AssembledTransaction<null>;
|
|
657
|
+
pending_sources: (json: string) => AssembledTransaction<Option<PendingSources>>;
|
|
658
|
+
propose_sources: (json: string) => AssembledTransaction<null>;
|
|
659
|
+
remove_publisher: (json: string) => AssembledTransaction<null>;
|
|
660
|
+
timelock_seconds: (json: string) => AssembledTransaction<bigint>;
|
|
661
|
+
};
|
|
662
|
+
}
|