@arca-network/sdk 1.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.
Files changed (67) hide show
  1. package/LICENSE +91 -0
  2. package/README.md +65 -0
  3. package/dist/admin.d.ts +159 -0
  4. package/dist/admin.d.ts.map +1 -0
  5. package/dist/admin.js +399 -0
  6. package/dist/admin.js.map +1 -0
  7. package/dist/arca.d.ts +1343 -0
  8. package/dist/arca.d.ts.map +1 -0
  9. package/dist/arca.js +3454 -0
  10. package/dist/arca.js.map +1 -0
  11. package/dist/cache.d.ts +29 -0
  12. package/dist/cache.d.ts.map +1 -0
  13. package/dist/cache.js +74 -0
  14. package/dist/cache.js.map +1 -0
  15. package/dist/candle-cdn.d.ts +17 -0
  16. package/dist/candle-cdn.d.ts.map +1 -0
  17. package/dist/candle-cdn.js +138 -0
  18. package/dist/candle-cdn.js.map +1 -0
  19. package/dist/client.d.ts +98 -0
  20. package/dist/client.d.ts.map +1 -0
  21. package/dist/client.js +225 -0
  22. package/dist/client.js.map +1 -0
  23. package/dist/errors.d.ts +153 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +243 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/events.d.ts +2 -0
  28. package/dist/events.d.ts.map +1 -0
  29. package/dist/events.js +6 -0
  30. package/dist/events.js.map +1 -0
  31. package/dist/index.d.ts +21 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +71 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/ladder.d.ts +40 -0
  36. package/dist/ladder.d.ts.map +1 -0
  37. package/dist/ladder.js +145 -0
  38. package/dist/ladder.js.map +1 -0
  39. package/dist/ladder.test.d.ts +2 -0
  40. package/dist/ladder.test.d.ts.map +1 -0
  41. package/dist/ladder.test.js +112 -0
  42. package/dist/ladder.test.js.map +1 -0
  43. package/dist/operation-handle.d.ts +88 -0
  44. package/dist/operation-handle.d.ts.map +1 -0
  45. package/dist/operation-handle.js +262 -0
  46. package/dist/operation-handle.js.map +1 -0
  47. package/dist/recovery.d.ts +20 -0
  48. package/dist/recovery.d.ts.map +1 -0
  49. package/dist/recovery.js +91 -0
  50. package/dist/recovery.js.map +1 -0
  51. package/dist/revalue.d.ts +22 -0
  52. package/dist/revalue.d.ts.map +1 -0
  53. package/dist/revalue.js +153 -0
  54. package/dist/revalue.js.map +1 -0
  55. package/dist/streams.d.ts +661 -0
  56. package/dist/streams.d.ts.map +1 -0
  57. package/dist/streams.js +2272 -0
  58. package/dist/streams.js.map +1 -0
  59. package/dist/types.d.ts +2814 -0
  60. package/dist/types.d.ts.map +1 -0
  61. package/dist/types.js +118 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/websocket.d.ts +240 -0
  64. package/dist/websocket.d.ts.map +1 -0
  65. package/dist/websocket.js +1288 -0
  66. package/dist/websocket.js.map +1 -0
  67. package/package.json +48 -0
@@ -0,0 +1,2814 @@
1
+ import type { OrderHandle } from './operation-handle';
2
+ export type UserId = `usr_${string}`;
3
+ export type RealmId = `rlm_${string}`;
4
+ export type ApiKeyId = `key_${string}`;
5
+ export type OrgId = `org_${string}`;
6
+ export type OrgMemberId = `mem_${string}`;
7
+ export type ObjectId = `obj_${string}`;
8
+ export type OperationId = `op_${string}`;
9
+ export type EventId = `evt_${string}`;
10
+ export type DeltaId = `dlt_${string}`;
11
+ export type BalanceId = `bal_${string}`;
12
+ export type ReservedBalanceId = `rsv_${string}`;
13
+ export type PositionId = `pos_${string}`;
14
+ export type InvitationId = `inv_${string}`;
15
+ export type ReconciliationId = `rec_${string}`;
16
+ export type SimAccountId = `act_${string}`;
17
+ export type SimPositionId = `sps_${string}`;
18
+ export type MarginMode = 'cross' | 'isolated';
19
+ export type SimOrderId = `ord_${string}`;
20
+ export type SimFillId = `fil_${string}`;
21
+ export type ErrorId = `err_${string}`;
22
+ export type WatchId = `req_${string}`;
23
+ /** Any TypeID-formatted identifier. */
24
+ export type TypeId = `${string}_${string}`;
25
+ export interface ApiResponse<T> {
26
+ success: boolean;
27
+ data?: T;
28
+ error?: {
29
+ code: string;
30
+ message: string;
31
+ errorId?: ErrorId;
32
+ details?: Record<string, unknown>;
33
+ };
34
+ }
35
+ /**
36
+ * Legacy single-axis realm type. Retained as a derived alias of `asset`
37
+ * (live↔production, paper↔development). Prefer `asset` + `lifecycle`.
38
+ */
39
+ export type RealmType = 'development' | 'production';
40
+ /**
41
+ * Value tier — the real-money risk axis. `paper` realms transact simulated
42
+ * funds (auto-minted, dev chain); `live` realms transact real money
43
+ * (KYB-gated, production chain, withdrawals require a real destination,
44
+ * value-moving actions require browser step-up).
45
+ */
46
+ export type RealmAsset = 'paper' | 'live';
47
+ /**
48
+ * Durability tier — orthogonal to {@link RealmAsset}. `permanent` realms are
49
+ * never auto-reaped and require step-up to archive; `temporary` realms are
50
+ * disposable (reaped after the retention window).
51
+ */
52
+ export type RealmLifecycle = 'permanent' | 'temporary';
53
+ /**
54
+ * Custody backing tier. `chain` realms are backed by an on-chain custody pool
55
+ * (every realm today); `ledger-only` is reserved for a future tier.
56
+ */
57
+ export type RealmBacking = 'chain' | 'ledger-only';
58
+ export interface RealmSettings {
59
+ /** Default application fee in tenths of a basis point (e.g. 40 = 4.0 bps) */
60
+ defaultApplicationFeeTenthsBps?: number | null;
61
+ }
62
+ export interface Realm {
63
+ id: RealmId;
64
+ orgId: OrgId;
65
+ name: string;
66
+ slug: string;
67
+ /** Legacy alias of {@link Realm.asset} (live→production, paper→development). */
68
+ type: RealmType;
69
+ asset: RealmAsset;
70
+ lifecycle: RealmLifecycle;
71
+ backing: RealmBacking;
72
+ description: string | null;
73
+ settings?: RealmSettings | null;
74
+ archivedAt?: string | null;
75
+ createdBy?: UserId | null;
76
+ createdAt: string;
77
+ updatedAt: string;
78
+ }
79
+ /** Optional two-axis inputs for {@link ArcaAdmin.createRealm}. */
80
+ export interface CreateRealmAxes {
81
+ asset?: RealmAsset;
82
+ lifecycle?: RealmLifecycle;
83
+ backing?: RealmBacking;
84
+ }
85
+ export interface RealmListResponse {
86
+ realms: Realm[];
87
+ total: number;
88
+ }
89
+ export type ArcaObjectType = 'denominated' | 'exchange' | 'deposit' | 'withdrawal' | 'escrow' | 'info';
90
+ export type ArcaObjectStatus = 'active' | 'deleting' | 'deleted' | 'withdrawn';
91
+ export type BrowsePathKind = 'folder' | 'isolation_zone';
92
+ export interface IsolationInfo {
93
+ isBoundaryRoot: boolean;
94
+ isInsideBoundary: boolean;
95
+ boundaryRootPath?: string | null;
96
+ boundaryId?: string | null;
97
+ }
98
+ /**
99
+ * Recovery-hatch state of the isolation boundary the object lives in.
100
+ *
101
+ * Hydrated only when the boundary is non-active (i.e. the recovery
102
+ * key holder has called `lockForRecovery()` or `withdraw()` on-chain).
103
+ * For active boundaries the field is omitted entirely so the API
104
+ * stays compact in the happy path.
105
+ *
106
+ * State machine (see `documents/architecture.md`):
107
+ * - `soft_frozen` — precautionary lock, reversible by the recovery
108
+ * key holder via `unlockBoundary()`. The platform refuses new
109
+ * value-moving operations on this boundary but no funds have
110
+ * left.
111
+ * - `hard_frozen` — irreversible. A `Withdrawn` event has fired;
112
+ * the platform has swept user wallets in this boundary into a
113
+ * system-owned recovery arca at `recoveryArcaPath`.
114
+ */
115
+ export interface BoundarySnapshot {
116
+ boundaryId: string;
117
+ status: 'active' | 'soft_frozen' | 'hard_frozen';
118
+ lockedAt?: string | null;
119
+ frozenAt?: string | null;
120
+ recoveryActor?: string | null;
121
+ recoveryTxHash?: string | null;
122
+ recoveryArcaPath?: string | null;
123
+ }
124
+ export interface ArcaObject {
125
+ id: ObjectId;
126
+ realmId: RealmId;
127
+ path: string;
128
+ displayName?: string | null;
129
+ type: ArcaObjectType;
130
+ denomination: string | null;
131
+ status: ArcaObjectStatus;
132
+ metadata: string | null;
133
+ labels: Record<string, string> | null;
134
+ deletedAt: string | null;
135
+ withdrawnAt?: string | null;
136
+ systemOwned: boolean;
137
+ isolation?: IsolationInfo | null;
138
+ /**
139
+ * Present only when the object's isolation boundary has been
140
+ * frozen by the on-chain recovery hatch. Use this to render a
141
+ * "boundary frozen" banner and disable mutating action buttons
142
+ * (transfers, withdrawals, etc.) on the object.
143
+ */
144
+ boundary?: BoundarySnapshot | null;
145
+ createdAt: string;
146
+ updatedAt: string;
147
+ }
148
+ export interface ArcaObjectListResponse {
149
+ objects: ArcaObject[];
150
+ total: number;
151
+ /**
152
+ * Opaque pagination token. Present (non-empty) when more pages exist —
153
+ * pass it back as `cursor` on the next `listObjects` call. Empty or
154
+ * undefined means the current page is the last.
155
+ */
156
+ nextCursor?: string;
157
+ }
158
+ export interface ArcaObjectBrowseResponse {
159
+ folders: string[];
160
+ paths?: BrowsePathEntry[];
161
+ objects: ArcaObject[];
162
+ currentIsolation?: IsolationInfo | null;
163
+ total?: number;
164
+ /**
165
+ * Opaque pagination token for the `objects` list. Folders are always
166
+ * returned in full; only the direct-children object list paginates.
167
+ * Empty or undefined means no further object pages.
168
+ */
169
+ nextCursor?: string;
170
+ }
171
+ export interface BrowsePathEntry {
172
+ path: string;
173
+ kind: BrowsePathKind;
174
+ hasObjects: boolean;
175
+ isEmpty: boolean;
176
+ isolation?: IsolationInfo | null;
177
+ /**
178
+ * The folder's effective creation timestamp.
179
+ * - For `kind: "isolation_zone"`: the zone row's `created_at`.
180
+ * - For `kind: "folder"`: `MIN(descendant.createdAt)` over arcas
181
+ * returned by the browse query.
182
+ * Absent when the folder has no arca descendants and is not an
183
+ * isolation zone.
184
+ */
185
+ createdAt?: string | null;
186
+ /**
187
+ * Folder-level labels (see `Arca.getFolderLabels` /
188
+ * `Arca.updateFolderLabels`). Folders are virtual aggregations of
189
+ * arca paths; labels here are stored independently in
190
+ * `folder_labels` keyed by `(realmId, path)`. Absent when no
191
+ * folder_labels row exists.
192
+ */
193
+ labels?: Record<string, string> | null;
194
+ }
195
+ /** Response from `Arca.getFolderLabels` / `Arca.updateFolderLabels`. */
196
+ export interface FolderLabelsResponse {
197
+ realmId: RealmId;
198
+ path: string;
199
+ labels: Record<string, string>;
200
+ createdAt?: string | null;
201
+ updatedAt?: string | null;
202
+ }
203
+ /** Request body for `Arca.updateFolderLabels`. */
204
+ export interface UpdateFolderLabelsRequest {
205
+ realmId: RealmId;
206
+ path: string;
207
+ /**
208
+ * Full label set to apply to the folder. This is a full overwrite,
209
+ * not a merge — pass the desired final state. Pass `{}` (or omit)
210
+ * to delete all labels on the folder.
211
+ */
212
+ labels: Record<string, string>;
213
+ }
214
+ export interface IsolationZone {
215
+ id: string;
216
+ realmId: RealmId;
217
+ path: string;
218
+ boundaryId: string;
219
+ createdAt: string;
220
+ updatedAt: string;
221
+ isolation?: IsolationInfo | null;
222
+ }
223
+ export interface EnsureArcaObjectResponse {
224
+ object: ArcaObject;
225
+ operation: Operation | null;
226
+ }
227
+ export interface DeleteArcaObjectResponse {
228
+ object: ArcaObject;
229
+ operation: Operation;
230
+ }
231
+ export interface ArcaPositionCurrent {
232
+ id: PositionId;
233
+ realmId: RealmId;
234
+ arcaId: ObjectId;
235
+ market: string;
236
+ side: string;
237
+ size: string;
238
+ leverage: number;
239
+ entryPx?: string | null;
240
+ marginUsed?: string | null;
241
+ unrealizedPnl?: string | null;
242
+ updatedAt: string;
243
+ }
244
+ export interface ArcaObjectDetailResponse {
245
+ object: ArcaObject;
246
+ operations: Operation[];
247
+ events: ArcaEvent[];
248
+ deltas: StateDelta[];
249
+ balances: ArcaBalance[];
250
+ reservedBalances?: ReservedBalance[];
251
+ positions?: ArcaPositionCurrent[];
252
+ }
253
+ export type ReservedBalanceStatus = 'held' | 'released' | 'cancelled';
254
+ export interface ReservedBalance {
255
+ id: ReservedBalanceId;
256
+ arcaId: ObjectId;
257
+ operationId: OperationId;
258
+ denomination: string;
259
+ amount: string;
260
+ status: ReservedBalanceStatus;
261
+ direction: 'inbound' | 'outbound';
262
+ sourceArcaPath?: string | null;
263
+ destinationArcaPath?: string | null;
264
+ createdAt: string;
265
+ updatedAt: string;
266
+ }
267
+ export interface ArcaObjectVersionsResponse {
268
+ versions: ArcaObject[];
269
+ }
270
+ export type OperationType = 'transfer' | 'create' | 'delete' | 'deposit' | 'withdrawal' | 'swap' | 'order' | 'fill' | 'cancel' | 'fee_distribution' | 'adjustment' | 'funding' | 'venue_close' | 'twap';
271
+ export type OperationState = 'pending' | 'completed' | 'failed' | 'expired';
272
+ export interface Operation {
273
+ id: OperationId;
274
+ realmId: RealmId;
275
+ path: string;
276
+ type: OperationType;
277
+ state: OperationState;
278
+ sourceArcaPath: string | null;
279
+ targetArcaPath: string | null;
280
+ input: string | null;
281
+ outcome: string | null;
282
+ parsedOutcome: Record<string, unknown> | null;
283
+ failureMessage: string | null;
284
+ actorType: string | null;
285
+ actorId: UserId | null;
286
+ tokenJti: string | null;
287
+ workflowIds: string[] | null;
288
+ createdAt: string;
289
+ updatedAt: string;
290
+ context?: OperationContext;
291
+ }
292
+ export interface OperationListResponse {
293
+ operations: Operation[];
294
+ total: number;
295
+ /**
296
+ * Opaque pagination token. Present (non-empty) when more pages exist —
297
+ * pass it back as `cursor` on the next `listOperations` call. Empty
298
+ * or undefined means the current page is the last.
299
+ */
300
+ nextCursor?: string;
301
+ }
302
+ export interface OperationDetailResponse {
303
+ operation: Operation;
304
+ context?: OperationContext;
305
+ events: ArcaEvent[];
306
+ deltas: StateDelta[];
307
+ evidence?: OperationEvidence;
308
+ }
309
+ export interface OperationEvidenceExportResponse {
310
+ version: string;
311
+ realmId: RealmId;
312
+ from: string;
313
+ to: string;
314
+ exportedAt: string;
315
+ nextCursor?: string | null;
316
+ operations: OperationDetailResponse[];
317
+ }
318
+ export interface OperationEvidence {
319
+ version: string;
320
+ journal: OperationEvidenceJournal;
321
+ integrity: OperationEvidenceIntegrity;
322
+ }
323
+ export interface OperationEvidenceJournal {
324
+ entries: JournalEntryEvidence[];
325
+ legs: JournalLegEvidence[];
326
+ proofs: JournalProofEvidence[];
327
+ chainTransactions: ChainTransactionEvidence[];
328
+ }
329
+ export interface OperationEvidenceIntegrity {
330
+ appendOnlyHistory: boolean;
331
+ proofUniqueness: ProofUniquenessEvidence;
332
+ runtimeChecks: IntegrityAnnotation[];
333
+ cryptographicSequence: CryptographicSequenceState;
334
+ }
335
+ export interface ProofUniquenessEvidence {
336
+ enforced: boolean;
337
+ mechanism: string;
338
+ }
339
+ export interface CryptographicSequenceState {
340
+ present: boolean;
341
+ note: string;
342
+ }
343
+ export interface IntegrityAnnotation {
344
+ key: string;
345
+ label: string;
346
+ description: string;
347
+ }
348
+ export interface JournalEntryEvidence {
349
+ id: string;
350
+ realmId: RealmId;
351
+ operationId?: OperationId | null;
352
+ opType: string;
353
+ authority: string;
354
+ status: string;
355
+ idempotencyKey?: string | null;
356
+ rejectionReason?: string | null;
357
+ createdAt: string;
358
+ committedAt?: string | null;
359
+ }
360
+ export interface JournalLegEvidence {
361
+ entryId: string;
362
+ id: string;
363
+ accountId: string;
364
+ denomination: string;
365
+ amount: string;
366
+ kind: string;
367
+ reason?: string | null;
368
+ }
369
+ export interface JournalProofEvidence {
370
+ entryId: string;
371
+ id: string;
372
+ proofType: string;
373
+ externalRef: string;
374
+ }
375
+ export interface ChainTransactionEvidence {
376
+ id: string;
377
+ realmId: RealmId;
378
+ operationId: OperationId;
379
+ txHash?: string | null;
380
+ chain: string;
381
+ direction: string;
382
+ status: string;
383
+ confirmations: number;
384
+ blockNumber?: number | null;
385
+ amount?: string | null;
386
+ fromAddress?: string | null;
387
+ gasUsed?: number | null;
388
+ gasPrice?: string | null;
389
+ gasCostWei?: string | null;
390
+ userOpHash?: string | null;
391
+ nonce?: number | null;
392
+ createdAt: string;
393
+ updatedAt: string;
394
+ }
395
+ export interface FeeBreakdown {
396
+ exchange: string;
397
+ platform: string;
398
+ builder: string;
399
+ }
400
+ export interface FillContext {
401
+ side: string;
402
+ size: string;
403
+ price: string;
404
+ market: string;
405
+ direction?: FillDirection;
406
+ orderId?: string;
407
+ orderOperationId?: string;
408
+ realizedPnl: string;
409
+ fee: string;
410
+ feeBreakdown?: FeeBreakdown;
411
+ netBalanceChange: string;
412
+ startPosition?: string;
413
+ resultingPosition?: FillResultingPosition;
414
+ isLiquidation: boolean;
415
+ }
416
+ export interface TransferContext {
417
+ amount: string;
418
+ denomination: string;
419
+ sourceArcaPath: string;
420
+ targetArcaPath: string;
421
+ feeAmount?: string;
422
+ }
423
+ export interface DepositContext {
424
+ amount: string;
425
+ denomination: string;
426
+ destination?: string;
427
+ }
428
+ export interface WithdrawalContext {
429
+ amount: string;
430
+ denomination: string;
431
+ txHash?: string;
432
+ }
433
+ export interface OrderPlacedContext {
434
+ orderId: string;
435
+ market: string;
436
+ side: string;
437
+ orderType: string;
438
+ size: string;
439
+ leverage?: string;
440
+ }
441
+ export interface CancelContext {
442
+ orderId: string;
443
+ }
444
+ export interface DeleteContext {
445
+ objectPath: string;
446
+ }
447
+ export type OperationContext = {
448
+ type: 'fill';
449
+ fill: FillContext;
450
+ } | {
451
+ type: 'transfer';
452
+ transfer: TransferContext;
453
+ } | {
454
+ type: 'deposit';
455
+ deposit: DepositContext;
456
+ } | {
457
+ type: 'withdrawal';
458
+ withdrawal: WithdrawalContext;
459
+ } | {
460
+ type: 'order';
461
+ order: OrderPlacedContext;
462
+ } | {
463
+ type: 'cancel';
464
+ cancel: CancelContext;
465
+ } | {
466
+ type: 'delete';
467
+ delete: DeleteContext;
468
+ };
469
+ export interface ArcaEvent {
470
+ id: EventId;
471
+ realmId: RealmId;
472
+ operationId: OperationId | null;
473
+ /**
474
+ * Path of the originating operation, embedded by the server on
475
+ * `listEvents` so clients don't need to fetch the operations list
476
+ * just to render an event row. Always set when `operationId` is
477
+ * non-null and the operation still exists; absent for events from
478
+ * deleted operations or older server responses.
479
+ */
480
+ operationPath?: string | null;
481
+ arcaPath: string | null;
482
+ type: string;
483
+ path: string | null;
484
+ payload: string | null;
485
+ createdAt: string;
486
+ }
487
+ export interface EventListResponse {
488
+ events: ArcaEvent[];
489
+ total: number;
490
+ /**
491
+ * Opaque pagination token. Present (non-empty) when more pages exist —
492
+ * pass it back as `cursor` on the next `listEvents` call. Empty or
493
+ * undefined means the current page is the last.
494
+ */
495
+ nextCursor?: string;
496
+ }
497
+ export interface EventDetailResponse {
498
+ event: ArcaEvent;
499
+ operation: Operation | null;
500
+ deltas: StateDelta[];
501
+ }
502
+ export type DeltaType = 'balance_change' | 'balance_adjustment' | 'settlement_change' | 'position_change' | 'status_change' | 'hold_change' | 'labels_change' | 'creation' | 'deletion';
503
+ export interface StateDelta {
504
+ id: DeltaId;
505
+ realmId: RealmId;
506
+ eventId: EventId | null;
507
+ arcaPath: string;
508
+ deltaType: DeltaType;
509
+ beforeValue: string | null;
510
+ afterValue: string | null;
511
+ internal?: boolean;
512
+ createdAt: string;
513
+ }
514
+ export interface StateDeltaListResponse {
515
+ deltas: StateDelta[];
516
+ total: number;
517
+ }
518
+ export interface ArcaBalance {
519
+ id?: BalanceId;
520
+ arcaId?: ObjectId;
521
+ denomination: string;
522
+ amount?: string;
523
+ arriving?: string;
524
+ settled?: string;
525
+ departing?: string;
526
+ total?: string;
527
+ }
528
+ export interface ArcaBalanceListResponse {
529
+ balances: ArcaBalance[];
530
+ }
531
+ export interface FundAccountResponse {
532
+ operation: Operation;
533
+ /** Pool address for on-chain deposits (present when chain custody is active). */
534
+ poolAddress?: string;
535
+ /** Token contract address (e.g., USDC). */
536
+ tokenAddress?: string;
537
+ /** Chain identifier (e.g., "reth", "arbitrum"). */
538
+ chain?: string;
539
+ /** Intent expiration timestamp. */
540
+ expiresAt?: string;
541
+ }
542
+ export interface TransferResponse {
543
+ operation: Operation;
544
+ fee?: {
545
+ amount: string;
546
+ denomination: string;
547
+ };
548
+ }
549
+ export interface FeeEstimateParams {
550
+ action: 'transfer' | 'order';
551
+ amount: string;
552
+ sourcePath?: string;
553
+ targetPath?: string;
554
+ /** Override the transfer fee (e.g. `"0"` to disable). Non-production realms only. */
555
+ feeOverride?: string;
556
+ }
557
+ export interface FeeEstimate {
558
+ fee: {
559
+ amount: string;
560
+ denomination: string;
561
+ };
562
+ netAmount: string;
563
+ }
564
+ export interface NonceResponse {
565
+ nonce: number;
566
+ path: string;
567
+ }
568
+ export interface ExplorerSummary {
569
+ objectCount: number;
570
+ operationCount: number;
571
+ eventCount: number;
572
+ pendingOperationCount?: number;
573
+ expiredOperationCount?: number;
574
+ }
575
+ export interface BatchSummariesResponse {
576
+ summaries: Record<string, ExplorerSummary>;
577
+ }
578
+ export interface CanonicalPosition {
579
+ id: PositionId;
580
+ realmId: RealmId;
581
+ arcaId: ObjectId;
582
+ market: string;
583
+ side: string;
584
+ size: string;
585
+ leverage: number;
586
+ updatedAt: string;
587
+ }
588
+ export interface SnapshotBalancesResponse {
589
+ realmId: string;
590
+ arcaId: string;
591
+ asOf: string;
592
+ balances: ArcaBalance[];
593
+ positions: CanonicalPosition[];
594
+ }
595
+ export interface AssetBreakdown {
596
+ asset: string;
597
+ category: 'spot' | 'perp' | 'exchange';
598
+ amount: string;
599
+ price: string | null;
600
+ valueUsd: string;
601
+ weightedAvgLeverage?: string | null;
602
+ avgEntryPrice?: string | null;
603
+ }
604
+ export interface BalanceValue {
605
+ denomination: string;
606
+ amount: string;
607
+ price: string | null;
608
+ valueUsd: string;
609
+ }
610
+ export interface PositionValue {
611
+ market: string;
612
+ side: string;
613
+ size: string;
614
+ leverage: number;
615
+ entryPrice: string;
616
+ markPrice?: string | null;
617
+ unrealizedPnl?: string | null;
618
+ valueUsd?: string | null;
619
+ }
620
+ export interface ReservedValue {
621
+ denomination: string;
622
+ amount: string;
623
+ price: string | null;
624
+ valueUsd: string;
625
+ operationId: OperationId;
626
+ sourceArcaPath?: string | null;
627
+ destinationArcaPath?: string | null;
628
+ startedAt?: string | null;
629
+ inTransit?: boolean;
630
+ }
631
+ export interface ObjectValuation {
632
+ objectId: ObjectId;
633
+ path: string;
634
+ type: string;
635
+ denomination: string | null;
636
+ valueUsd: string;
637
+ realizedValue?: string | null;
638
+ unrealizedValue?: string | null;
639
+ balances: BalanceValue[];
640
+ reservedBalances: ReservedValue[];
641
+ pendingInbound?: ReservedValue[];
642
+ positions: PositionValue[] | null;
643
+ }
644
+ export interface PathAggregation {
645
+ prefix: string;
646
+ totalEquityUsd: string;
647
+ departingUsd: string;
648
+ arrivingUsd?: string;
649
+ breakdown: AssetBreakdown[];
650
+ asOf?: string;
651
+ availableIntervals?: string[];
652
+ cumInflowsUsd?: string;
653
+ cumOutflowsUsd?: string;
654
+ }
655
+ export interface WatchSnapshotBalanceEntry {
656
+ entityId: string;
657
+ entityPath?: string;
658
+ balances: BalanceValue[];
659
+ }
660
+ export interface WatchSnapshot {
661
+ path: string;
662
+ balances: WatchSnapshotBalanceEntry[];
663
+ operations: Operation[];
664
+ bufferedOperations?: Operation[];
665
+ exchange: ExchangeState | null;
666
+ valuation: ObjectValuation | null;
667
+ valuations?: Record<string, ObjectValuation>;
668
+ watchId: string | null;
669
+ }
670
+ export type AggregationSourceDto = {
671
+ type: 'prefix';
672
+ value: string;
673
+ } | {
674
+ type: 'pattern';
675
+ value: string;
676
+ } | {
677
+ type: 'paths';
678
+ paths: string[];
679
+ } | {
680
+ type: 'watch';
681
+ value: string;
682
+ };
683
+ export interface CreateWatchResponse {
684
+ watchId: WatchId;
685
+ aggregation: PathAggregation;
686
+ }
687
+ export interface PnlResponse {
688
+ prefix: string;
689
+ from: string;
690
+ to: string;
691
+ startingEquityUsd: string;
692
+ endingEquityUsd: string;
693
+ netInflowsUsd: string;
694
+ netOutflowsUsd: string;
695
+ pnlUsd: string;
696
+ externalFlows?: ExternalFlowEntry[];
697
+ }
698
+ export interface ExternalFlowEntry {
699
+ operationId: OperationId;
700
+ type: string;
701
+ direction: string;
702
+ amount: string;
703
+ denomination: string;
704
+ valueUsd: string;
705
+ sourceArcaPath: string | null;
706
+ targetArcaPath: string | null;
707
+ timestamp: string;
708
+ }
709
+ export interface PnlHistoryResponse {
710
+ prefix: string;
711
+ from: string;
712
+ to: string;
713
+ points: number;
714
+ resolution?: string;
715
+ resolutionRequested?: string;
716
+ serverNow?: string;
717
+ startingEquityUsd: string;
718
+ /** Timestamp of the first non-zero equity point (after leading-zero
719
+ * trimming). Use as `flowsSince` for the live watch to avoid
720
+ * double-counting flows already reflected in `startingEquityUsd`. */
721
+ effectiveFrom?: string;
722
+ pnlPoints: PnlPoint[];
723
+ externalFlows?: ExternalFlowEntry[];
724
+ midPrices?: Record<string, string>;
725
+ }
726
+ export interface PnlPoint {
727
+ timestamp: string;
728
+ pnlUsd: string;
729
+ equityUsd: string;
730
+ status?: ChartPointStatus;
731
+ cumInflowsUsd?: string;
732
+ cumOutflowsUsd?: string;
733
+ lastEventOpId?: string;
734
+ midSetId?: string;
735
+ /** Present when the chart is created with `anchor: 'equity'`.
736
+ * Equal to pnlUsd shifted so the live (rightmost) point equals current equity. */
737
+ valueUsd?: string;
738
+ }
739
+ export interface EquityHistoryResponse {
740
+ prefix: string;
741
+ from: string;
742
+ to: string;
743
+ points: number;
744
+ resolution?: string;
745
+ resolutionRequested?: string;
746
+ serverNow?: string;
747
+ equityPoints: EquityPoint[];
748
+ }
749
+ export type ChartPointStatus = 'open' | 'sealed' | 'carried' | 'incomplete';
750
+ export interface EquityPoint {
751
+ timestamp: string;
752
+ equityUsd: string;
753
+ status?: ChartPointStatus;
754
+ cumInflowsUsd?: string;
755
+ cumOutflowsUsd?: string;
756
+ lastEventOpId?: string;
757
+ midSetId?: string;
758
+ }
759
+ export interface ReconciliationState {
760
+ id: ReconciliationId;
761
+ realmId: RealmId;
762
+ arcaId: ObjectId;
763
+ venue: string;
764
+ expectedBalanceUsd: string;
765
+ venueReportedUsd: string;
766
+ expectedPositionsJson: string | null;
767
+ venuePositionsJson: string | null;
768
+ lastSeenVenueHash: string | null;
769
+ driftDetectedAt: string | null;
770
+ lastReconciledAt: string | null;
771
+ updatedAt: string;
772
+ }
773
+ export interface ReconciliationStateListResponse {
774
+ items: ReconciliationState[];
775
+ total: number;
776
+ }
777
+ export interface BuilderProfile {
778
+ id: UserId;
779
+ email: string;
780
+ orgName: string;
781
+ orgId?: OrgId;
782
+ role?: OrgRole;
783
+ isPlatformAdmin?: boolean;
784
+ }
785
+ export type OrgRole = 'owner' | 'admin' | 'developer' | 'viewer';
786
+ export type MemberType = 'user' | 'service_account';
787
+ export type InvitationStatus = 'pending' | 'accepted' | 'expired' | 'revoked';
788
+ export interface Organization {
789
+ id: OrgId;
790
+ name: string;
791
+ slug: string;
792
+ createdBy: UserId;
793
+ createdAt: string;
794
+ updatedAt: string;
795
+ kybStatus?: string;
796
+ builderAgreementVersionAccepted?: number | null;
797
+ }
798
+ export interface ActiveTerms {
799
+ version: number;
800
+ title: string;
801
+ contentUrl: string;
802
+ isActive: boolean;
803
+ createdAt: string;
804
+ }
805
+ export interface MyOrgMembership {
806
+ orgId: OrgId;
807
+ orgName: string;
808
+ orgSlug: string;
809
+ role: OrgRole;
810
+ realmTypeScope?: RealmType[];
811
+ }
812
+ export interface CreateOrgResponse {
813
+ organization: Organization;
814
+ membership: MyOrgMembership;
815
+ }
816
+ export interface OrgMember {
817
+ id: OrgMemberId;
818
+ orgId: OrgId;
819
+ userId: UserId;
820
+ email?: string;
821
+ memberType: MemberType;
822
+ role: OrgRole;
823
+ realmTypeScope?: RealmType[];
824
+ invitedBy?: string;
825
+ createdAt: string;
826
+ }
827
+ export interface OrgMemberListResponse {
828
+ members: OrgMember[];
829
+ total: number;
830
+ }
831
+ export interface Invitation {
832
+ id: InvitationId;
833
+ orgId: OrgId;
834
+ orgName?: string;
835
+ email: string;
836
+ role: OrgRole;
837
+ realmTypeScope?: RealmType[];
838
+ status: InvitationStatus;
839
+ expiresAt: string;
840
+ invitedBy: UserId;
841
+ inviteLink?: string;
842
+ createdAt: string;
843
+ }
844
+ export interface InvitationListResponse {
845
+ invitations: Invitation[];
846
+ total: number;
847
+ }
848
+ export interface InvitationPreview {
849
+ orgName: string;
850
+ email: string;
851
+ role: OrgRole;
852
+ status: InvitationStatus;
853
+ expiresAt: string;
854
+ }
855
+ export interface InviteMemberRequest {
856
+ email: string;
857
+ role: OrgRole;
858
+ realmTypeScope?: RealmType[];
859
+ }
860
+ export interface UpdateMemberRequest {
861
+ role?: OrgRole;
862
+ realmTypeScope?: RealmType[];
863
+ }
864
+ export interface AuthResponse {
865
+ token: string;
866
+ refreshToken?: string;
867
+ expiresAt: string;
868
+ builder: BuilderProfile;
869
+ }
870
+ export interface RefreshResponse {
871
+ token: string;
872
+ refreshToken: string;
873
+ expiresAt: string;
874
+ }
875
+ export type ApiKeyStatus = 'active' | 'revoked';
876
+ export interface ApiKey {
877
+ id: ApiKeyId;
878
+ orgId: OrgId;
879
+ createdBy: UserId;
880
+ name: string;
881
+ keyPrefix: string;
882
+ status: ApiKeyStatus;
883
+ scope: string | null;
884
+ /** When set, the key is locked to a single realm; requests to any
885
+ * other realm are rejected. Omitted for org-wide keys. */
886
+ realmId?: RealmId | null;
887
+ createdAt: string;
888
+ revokedAt: string | null;
889
+ updatedAt: string;
890
+ }
891
+ /** Permission preset for an API key. read = view-only; trade = view +
892
+ * place/cancel orders; full = no action restriction (realm-lock only). */
893
+ export type ApiKeyPermissions = 'read' | 'trade' | 'full';
894
+ /**
895
+ * Options for creating an API key.
896
+ *
897
+ * @example
898
+ * ```ts
899
+ * // Unscoped key (full access)
900
+ * await admin.createApiKey({ name: 'my-key' });
901
+ *
902
+ * // Realm-locked, read-only dev key (environment isolation + least privilege)
903
+ * await admin.createApiKey({
904
+ * name: 'dev-ci',
905
+ * realmId: 'rlm_dev',
906
+ * permissions: 'read',
907
+ * });
908
+ *
909
+ * // Custom IAM policy scope
910
+ * await admin.createApiKey({
911
+ * name: 'read-only',
912
+ * scope: {
913
+ * statements: [
914
+ * { effect: 'Allow', actions: ['arca:Read'], resources: ['/users/alice/*'] },
915
+ * ],
916
+ * },
917
+ * });
918
+ * ```
919
+ */
920
+ export interface CreateApiKeyOptions {
921
+ /** Human-readable name for the API key. */
922
+ name: string;
923
+ /** Optional IAM policy scope. Omit for full-access keys. Mutually
924
+ * exclusive with `permissions`. */
925
+ scope?: TokenScope;
926
+ /** Optional realm lock: bind the key to a single realm so requests to
927
+ * any other realm are rejected. Use for dev/staging/prod isolation. */
928
+ realmId?: RealmId;
929
+ /** Optional least-privilege preset. Mutually exclusive with `scope`.
930
+ * read = view-only; trade = view + place/cancel orders; full = no
931
+ * action restriction (combine with `realmId` for realm-lock-only). */
932
+ permissions?: ApiKeyPermissions;
933
+ }
934
+ export interface ApiKeyCreatedResponse {
935
+ apiKey: ApiKey;
936
+ rawKey: string;
937
+ }
938
+ export interface ApiKeyListResponse {
939
+ apiKeys: ApiKey[];
940
+ total: number;
941
+ }
942
+ export interface BrowseObjectsOptions {
943
+ /**
944
+ * Path prefix to browse (default: '/').
945
+ * Must start with '/'. Use a trailing slash to browse a subtree.
946
+ */
947
+ path?: string;
948
+ /** @deprecated Use `path` instead. */
949
+ prefix?: string;
950
+ includeDeleted?: boolean;
951
+ }
952
+ export interface CreateIsolationZoneOptions {
953
+ /** Full path that should become an isolation zone root. */
954
+ path: string;
955
+ }
956
+ /** Effect of a policy statement. */
957
+ export type PolicyEffect = 'Allow' | 'Deny';
958
+ /**
959
+ * A single policy statement with an effect, actions, and resource patterns.
960
+ * Used in scoped tokens and scoped API keys.
961
+ *
962
+ * - `Allow` (default) grants the listed actions on the listed resources.
963
+ * - `Deny` explicitly blocks them, **overriding any Allow statements**.
964
+ *
965
+ * @example
966
+ * ```ts
967
+ * // Allow transfers within a user's subtree
968
+ * const allow: PolicyStatement = {
969
+ * effect: 'Allow',
970
+ * actions: ['arca:TransferFrom', 'arca:ReceiveTo'],
971
+ * resources: ['/users/u123/*'],
972
+ * };
973
+ *
974
+ * // Safety rail: deny everything on internal paths
975
+ * const deny: PolicyStatement = {
976
+ * effect: 'Deny',
977
+ * actions: ['arca:*'],
978
+ * resources: ['/_internal/*'],
979
+ * };
980
+ * ```
981
+ */
982
+ export interface PolicyStatement {
983
+ /** 'Allow' (default) or 'Deny'. Deny always overrides Allow. */
984
+ effect?: PolicyEffect;
985
+ /** Actions to grant or deny (e.g. 'arca:TransferFrom', 'arca:Read', 'arca:*') */
986
+ actions: string[];
987
+ /** Resource path patterns (e.g. '/users/*', '*') */
988
+ resources: string[];
989
+ }
990
+ /**
991
+ * IAM-style scope containing policy statements.
992
+ * Each statement grants a set of actions on a set of resources.
993
+ * Default: read-only on all resources.
994
+ */
995
+ export interface TokenScope {
996
+ statements: PolicyStatement[];
997
+ }
998
+ /** Entry in the action catalog returned by GET /api/v1/permissions */
999
+ export interface ActionCatalogEntry {
1000
+ action: string;
1001
+ description: string;
1002
+ category: string;
1003
+ }
1004
+ /** Alias entry in the action catalog */
1005
+ export interface AliasCatalogEntry {
1006
+ alias: string;
1007
+ expandsTo: string[];
1008
+ }
1009
+ /** Response from GET /api/v1/permissions */
1010
+ export interface PermissionCatalogResponse {
1011
+ actions: ActionCatalogEntry[];
1012
+ aliases: AliasCatalogEntry[];
1013
+ }
1014
+ export interface InvariantViolation {
1015
+ entityId: string | null;
1016
+ message: string;
1017
+ }
1018
+ export interface InvariantCheckResult {
1019
+ id: string;
1020
+ name?: string;
1021
+ passed: boolean;
1022
+ violationCount: number;
1023
+ violations: InvariantViolation[];
1024
+ }
1025
+ export interface InvariantCheckResponse {
1026
+ allPassed: boolean;
1027
+ results: InvariantCheckResult[];
1028
+ }
1029
+ /** Configuration using an API key (backend/programmatic use). */
1030
+ export interface ArcaApiKeyConfig {
1031
+ /** API key (format: arca_<prefix>_<secret>) */
1032
+ apiKey: string;
1033
+ /** Realm slug or UUID */
1034
+ realm: string;
1035
+ /** Base URL of the Arca API. Defaults to https://api.arcaos.io */
1036
+ baseUrl?: string;
1037
+ /**
1038
+ * CDN base URL for historical candle data. Defaults to "https://data.arcaos.io".
1039
+ * getCandles() fetches finalized candle chunks from the CDN and only falls
1040
+ * back to the REST API for the current (in-progress) period.
1041
+ * Pass `null` or `""` to disable CDN and use the REST API exclusively.
1042
+ */
1043
+ candleCdnBaseUrl?: string | null;
1044
+ /**
1045
+ * Cache configuration for historical data (equity history, PnL history, candles).
1046
+ * Pass `false` to disable caching entirely. Default: 50 entries, 5-minute TTL.
1047
+ */
1048
+ cache?: import('./cache').CacheConfig | false;
1049
+ /**
1050
+ * Optional handler invoked on HTTP 412 `STEP_UP_REQUIRED`. When
1051
+ * configured, the SDK transparently runs the handler and retries the
1052
+ * original request with the resulting step-up token. Used by the
1053
+ * portal to wire an in-app confirmation modal.
1054
+ */
1055
+ onStepUpRequired?: import('./client').StepUpHandler;
1056
+ }
1057
+ /** Configuration using a scoped token (frontend/end-user use). */
1058
+ export interface ArcaTokenConfig {
1059
+ /** Scoped JWT token issued by the builder's backend via POST /auth/token.
1060
+ * Optional when `tokenProvider` is set — the provider fetches the first token. */
1061
+ token?: string;
1062
+ /**
1063
+ * Async function that returns a fresh scoped JWT.
1064
+ * When set, the SDK calls it automatically:
1065
+ * - Proactively ~30 seconds before the current token expires
1066
+ * - Reactively on HTTP 401 (then retries the failed request)
1067
+ * - On WebSocket reconnect
1068
+ *
1069
+ * The function should call your backend to mint a new token via POST /auth/token.
1070
+ * Concurrent calls are deduplicated — only one in-flight refresh at a time.
1071
+ */
1072
+ tokenProvider?: TokenProvider;
1073
+ /** Realm slug, UUID, or omit to use the realm embedded in the token */
1074
+ realm?: string;
1075
+ /** Base URL of the Arca API. Defaults to https://api.arcaos.io */
1076
+ baseUrl?: string;
1077
+ /**
1078
+ * CDN base URL for historical candle data. Defaults to "https://data.arcaos.io".
1079
+ * getCandles() fetches finalized candle chunks from the CDN and only falls
1080
+ * back to the REST API for the current (in-progress) period.
1081
+ * Pass `null` or `""` to disable CDN and use the REST API exclusively.
1082
+ */
1083
+ candleCdnBaseUrl?: string | null;
1084
+ /**
1085
+ * Cache configuration for historical data (equity history, PnL history, candles).
1086
+ * Pass `false` to disable caching entirely. Default: 50 entries, 5-minute TTL.
1087
+ */
1088
+ cache?: import('./cache').CacheConfig | false;
1089
+ /**
1090
+ * Optional handler invoked on HTTP 412 `STEP_UP_REQUIRED`. When
1091
+ * configured, the SDK transparently runs the handler and retries the
1092
+ * original request with the resulting step-up token. Used by the
1093
+ * portal to wire an in-app confirmation modal.
1094
+ */
1095
+ onStepUpRequired?: import('./client').StepUpHandler;
1096
+ }
1097
+ /** Async function that returns a fresh scoped JWT token. */
1098
+ export type TokenProvider = () => Promise<string>;
1099
+ /** Callback for unrecoverable authentication errors. */
1100
+ export type AuthErrorListener = (error: Error) => void;
1101
+ /** SDK configuration — pass either an API key or a scoped token. */
1102
+ export type ArcaConfig = ArcaApiKeyConfig | ArcaTokenConfig;
1103
+ export interface EnsureDenominatedArcaOptions {
1104
+ /** Full Arca path (e.g. /users/u123/usd/main) */
1105
+ ref: string;
1106
+ /** Optional metadata */
1107
+ metadata?: string;
1108
+ /** Optional labels */
1109
+ labels?: Record<string, string>;
1110
+ /** Optional operation path (idempotency key). Use nonce API with separator ":" to generate. */
1111
+ operationPath?: string;
1112
+ }
1113
+ export interface EnsureArcaOptions {
1114
+ /** Full Arca path */
1115
+ ref: string;
1116
+ /** Arca object type */
1117
+ type: 'denominated' | 'exchange' | 'deposit' | 'withdrawal' | 'escrow';
1118
+ /** Optional metadata */
1119
+ metadata?: string;
1120
+ /** Optional labels */
1121
+ labels?: Record<string, string>;
1122
+ /** Optional operation path (idempotency key). Use nonce API with separator ":" to generate. */
1123
+ operationPath?: string;
1124
+ }
1125
+ export interface EnsureInfoOptions {
1126
+ /** Directory path (e.g. /users/u123). /.info is appended automatically if not present. */
1127
+ ref: string;
1128
+ /** Optional labels */
1129
+ labels?: Record<string, string>;
1130
+ /** Optional operation path (idempotency key). Use nonce API with separator ":" to generate. */
1131
+ operationPath?: string;
1132
+ }
1133
+ export interface EnsureDeletedOptions {
1134
+ /** Full Arca path to delete */
1135
+ ref: string;
1136
+ /** Optional path of the Arca to sweep remaining funds into */
1137
+ sweepTo?: string;
1138
+ /** Liquidate all exchange positions before deletion (exchange objects only) */
1139
+ liquidatePositions?: boolean;
1140
+ /** Operation path (idempotency key). Auto-generated if not provided. */
1141
+ operationPath?: string;
1142
+ }
1143
+ export interface TransferOptions {
1144
+ /** Operation path (idempotency key) */
1145
+ path: string;
1146
+ /** Source Arca path */
1147
+ from: string;
1148
+ /** Target Arca path */
1149
+ to: string;
1150
+ /** Amount as decimal string */
1151
+ amount: string;
1152
+ /** Override the transfer fee (e.g. `"0"` to disable). Non-production realms only. */
1153
+ feeOverride?: string;
1154
+ }
1155
+ export interface FundAccountOptions {
1156
+ /** Target Arca path */
1157
+ arcaRef: string;
1158
+ /** Amount as decimal string */
1159
+ amount: string;
1160
+ /** Operation path for idempotency. If provided, duplicate calls return the existing operation. */
1161
+ path?: string;
1162
+ /** Sender wallet address (optional, used for on-chain deposit matching). */
1163
+ senderAddress?: string;
1164
+ /** Simulated deposit duration in seconds (development realms only; platform may ignore). */
1165
+ durationSeconds?: number;
1166
+ /** Whether the simulated deposit will succeed (development realms only; platform may ignore). */
1167
+ willSucceed?: boolean;
1168
+ }
1169
+ export interface DefundAccountOptions {
1170
+ /** Source Arca path to withdraw from */
1171
+ arcaPath: string;
1172
+ /** Amount as decimal string */
1173
+ amount: string;
1174
+ /** Destination on-chain address. If omitted, tokens are burned in development mode. */
1175
+ destinationAddress?: string;
1176
+ /** Operation path for idempotency */
1177
+ path?: string;
1178
+ }
1179
+ export interface DefundAccountResponse {
1180
+ operation: Operation;
1181
+ txHash?: string;
1182
+ }
1183
+ export interface UpdateLabelsOptions {
1184
+ /** Arca object ID */
1185
+ objectId: string;
1186
+ /** Labels to set (key -> value). Use null as value to remove a key. */
1187
+ labels: Record<string, string | null>;
1188
+ }
1189
+ export interface ListObjectsOptions {
1190
+ /**
1191
+ * Object path or path prefix to filter.
1192
+ * Exact path (no trailing slash): returns the single matching object.
1193
+ * Path prefix (trailing slash): returns all objects under that prefix.
1194
+ */
1195
+ path?: string;
1196
+ /** @deprecated Use `path` instead. */
1197
+ prefix?: string;
1198
+ /** Include deleted objects */
1199
+ includeDeleted?: boolean;
1200
+ /** Max rows to return (1-500, default 500). */
1201
+ limit?: number;
1202
+ /**
1203
+ * Pagination cursor. Pass the `nextCursor` value from a prior response
1204
+ * to fetch the next page. Omit (or pass empty) to start from the first
1205
+ * page. Empty `nextCursor` on the response means no more pages.
1206
+ */
1207
+ cursor?: string;
1208
+ }
1209
+ export interface ListOperationsOptions {
1210
+ /** Filter by a single operation type */
1211
+ type?: OperationType;
1212
+ /** Filter by multiple operation types (takes precedence over `type`) */
1213
+ types?: OperationType[];
1214
+ /** Filter by source or target arca path */
1215
+ arcaPath?: string;
1216
+ /** Filter by exact source or target Arca object ID */
1217
+ arcaId?: string;
1218
+ /** Filter by operation path prefix */
1219
+ path?: string;
1220
+ /** When true, each operation includes its typed context inline */
1221
+ includeContext?: boolean;
1222
+ /** Max rows to return (1-500, default 500) */
1223
+ limit?: number;
1224
+ /**
1225
+ * Pagination cursor. Pass the `nextCursor` value from a prior response
1226
+ * to fetch the next page. Omit (or pass empty) to start from the first
1227
+ * page. Empty `nextCursor` on the response means no more pages.
1228
+ */
1229
+ cursor?: string;
1230
+ }
1231
+ export interface GetOperationOptions {
1232
+ /** When true, includes journal-backed audit evidence and integrity metadata. */
1233
+ includeEvidence?: boolean;
1234
+ }
1235
+ export interface ExportOperationEvidenceOptions {
1236
+ from: string;
1237
+ to: string;
1238
+ type?: OperationType;
1239
+ types?: OperationType[];
1240
+ arcaPath?: string;
1241
+ arcaId?: string;
1242
+ path?: string;
1243
+ limit?: number;
1244
+ cursor?: string;
1245
+ }
1246
+ export interface ListEventsOptions {
1247
+ /** Filter by arca path */
1248
+ arcaPath?: string;
1249
+ /** Filter by event path prefix */
1250
+ path?: string;
1251
+ /** Max rows to return (1-500, default 500) */
1252
+ limit?: number;
1253
+ /**
1254
+ * Pagination cursor. Pass the `nextCursor` value from a prior response
1255
+ * to fetch the next page. Omit (or pass empty) to start from the first
1256
+ * page. Empty `nextCursor` on the response means no more pages.
1257
+ */
1258
+ cursor?: string;
1259
+ }
1260
+ export type EventConnectionStatus = 'connecting' | 'connected' | 'disconnected';
1261
+ /** All event types emitted by the Arca WebSocket stream. */
1262
+ export declare const EventType: {
1263
+ readonly OperationCreated: "operation.created";
1264
+ readonly OperationUpdated: "operation.updated";
1265
+ readonly EventCreated: "event.created";
1266
+ readonly ObjectCreated: "object.created";
1267
+ readonly ObjectUpdated: "object.updated";
1268
+ readonly ObjectDeleted: "object.deleted";
1269
+ readonly BalanceUpdated: "balance.updated";
1270
+ readonly ExchangeUpdated: "exchange.updated";
1271
+ /**
1272
+ * Phase 1 of two-phase fill delivery: the instant, incomplete venue-level
1273
+ * fill echo. `FillRecorded` (Phase 2) follows with the authoritative record;
1274
+ * merge the pair by `correlationId`.
1275
+ */
1276
+ readonly FillPreviewed: "fill.previewed";
1277
+ /** @deprecated Renamed to `FillPreviewed`. The wire value changed from
1278
+ * `exchange.fill` to `fill.previewed` pre-launch; this alias resolves to the
1279
+ * new value and will be removed in a future release. */
1280
+ readonly ExchangeFill: "fill.previewed";
1281
+ readonly FillRecorded: "fill.recorded";
1282
+ readonly ExchangeFunding: "exchange.funding";
1283
+ readonly AggregationUpdated: "aggregation.updated";
1284
+ readonly MidsUpdated: "mids.updated";
1285
+ readonly CandleClosed: "candle.closed";
1286
+ readonly CandleUpdated: "candle.updated";
1287
+ readonly TradeExecuted: "trade.executed";
1288
+ readonly TradesBatch: "trades.batch";
1289
+ readonly ObjectValuation: "object.valuation";
1290
+ readonly TwapStarted: "twap.started";
1291
+ readonly TwapProgress: "twap.progress";
1292
+ readonly TwapCompleted: "twap.completed";
1293
+ readonly TwapCancelled: "twap.cancelled";
1294
+ readonly TwapFailed: "twap.failed";
1295
+ readonly RealmCreated: "realm.created";
1296
+ readonly AgentText: "agent.text";
1297
+ readonly AgentToolUse: "agent.tool_use";
1298
+ readonly AgentPlan: "agent.plan";
1299
+ readonly AgentConversationLog: "agent.conversation_log";
1300
+ readonly AgentDone: "agent.done";
1301
+ readonly AgentStepUpdated: "agent.step_updated";
1302
+ readonly AgentExecutionDone: "agent.execution_done";
1303
+ };
1304
+ export type EventType = (typeof EventType)[keyof typeof EventType];
1305
+ /** Channel groups for WebSocket subscriptions. */
1306
+ export declare const Channel: {
1307
+ readonly Operations: "operations";
1308
+ readonly Balances: "balances";
1309
+ readonly Exchange: "exchange";
1310
+ readonly Objects: "objects";
1311
+ readonly Events: "events";
1312
+ readonly Aggregation: "aggregation";
1313
+ readonly Agent: "agent";
1314
+ };
1315
+ export type Channel = (typeof Channel)[keyof typeof Channel];
1316
+ /** Routing and correlation metadata common to all WebSocket events. */
1317
+ export interface EventEnvelope {
1318
+ realmId?: string;
1319
+ entityId?: string;
1320
+ entityPath?: string;
1321
+ eventId?: string;
1322
+ correlationId?: string;
1323
+ sequence?: number;
1324
+ timestamp?: string;
1325
+ deliverySeq?: number;
1326
+ }
1327
+ interface BaseRealmEvent extends EventEnvelope {
1328
+ summary?: ExplorerSummary;
1329
+ }
1330
+ export interface OperationCreatedEvent extends BaseRealmEvent {
1331
+ type: typeof EventType.OperationCreated;
1332
+ operation: Operation;
1333
+ }
1334
+ export interface OperationUpdatedEvent extends BaseRealmEvent {
1335
+ type: typeof EventType.OperationUpdated;
1336
+ operation: Operation;
1337
+ }
1338
+ export interface EventCreatedEvent extends BaseRealmEvent {
1339
+ type: typeof EventType.EventCreated;
1340
+ event: ArcaEvent;
1341
+ }
1342
+ export interface ObjectCreatedEvent extends BaseRealmEvent {
1343
+ type: typeof EventType.ObjectCreated;
1344
+ object?: ArcaObject;
1345
+ }
1346
+ export interface ObjectUpdatedEvent extends BaseRealmEvent {
1347
+ type: typeof EventType.ObjectUpdated;
1348
+ object?: ArcaObject;
1349
+ }
1350
+ export interface ObjectDeletedEvent extends BaseRealmEvent {
1351
+ type: typeof EventType.ObjectDeleted;
1352
+ }
1353
+ export interface BalanceUpdatedEvent extends BaseRealmEvent {
1354
+ type: typeof EventType.BalanceUpdated;
1355
+ balances?: ArcaBalance[];
1356
+ heldOutbound?: ReservedBalance[];
1357
+ heldInbound?: ReservedBalance[];
1358
+ }
1359
+ export interface ExchangeUpdatedEvent extends BaseRealmEvent {
1360
+ type: typeof EventType.ExchangeUpdated;
1361
+ exchangeState: ExchangeState;
1362
+ }
1363
+ export interface FillPreviewedEvent extends BaseRealmEvent {
1364
+ type: typeof EventType.FillPreviewed;
1365
+ fill: SimFill;
1366
+ }
1367
+ /** @deprecated Renamed to `FillPreviewedEvent` (event `exchange.fill` → `fill.previewed`). */
1368
+ export type ExchangeFillEvent = FillPreviewedEvent;
1369
+ export interface FillRecordedEvent extends BaseRealmEvent {
1370
+ type: typeof EventType.FillRecorded;
1371
+ fill: Fill;
1372
+ }
1373
+ export interface ExchangeFundingEvent extends BaseRealmEvent {
1374
+ type: typeof EventType.ExchangeFunding;
1375
+ funding: FundingPayment;
1376
+ }
1377
+ export interface AggregationUpdatedEvent extends BaseRealmEvent {
1378
+ type: typeof EventType.AggregationUpdated;
1379
+ aggregation?: PathAggregation;
1380
+ /** Present and true when the server detected and corrected a cache drift. */
1381
+ driftCorrected?: boolean;
1382
+ }
1383
+ export interface ObjectValuationEvent extends EventEnvelope {
1384
+ type: typeof EventType.ObjectValuation;
1385
+ path: string;
1386
+ watchId: string;
1387
+ valuation: ObjectValuation;
1388
+ /** Present and true when the server detected and corrected a cache drift. */
1389
+ driftCorrected?: boolean;
1390
+ }
1391
+ export interface MidsUpdatedEvent extends EventEnvelope {
1392
+ type: typeof EventType.MidsUpdated;
1393
+ mids: Record<string, string>;
1394
+ /** Oldest source timestamp among the mids in this update. */
1395
+ marketDataAsOf?: string;
1396
+ }
1397
+ export interface CandleClosedEvent extends EventEnvelope {
1398
+ type: typeof EventType.CandleClosed;
1399
+ market: string;
1400
+ interval: CandleInterval;
1401
+ candle: Candle;
1402
+ }
1403
+ export interface CandleUpdatedEvent extends EventEnvelope {
1404
+ type: typeof EventType.CandleUpdated;
1405
+ market: string;
1406
+ interval: CandleInterval;
1407
+ candle: Candle;
1408
+ }
1409
+ /** A single trade from the market-wide trade tape. */
1410
+ export interface MarketTrade {
1411
+ /** Canonical market identifier (e.g. "hl:0:BTC"). */
1412
+ market: string;
1413
+ /** Trade price as a decimal string. */
1414
+ px: string;
1415
+ /** Trade size as a decimal string. */
1416
+ sz: string;
1417
+ /** Trade side: "buy" or "sell". */
1418
+ side: 'buy' | 'sell';
1419
+ /** Trade timestamp (UTC string). */
1420
+ time: string;
1421
+ /** On-chain transaction hash, if available. */
1422
+ hash?: string;
1423
+ }
1424
+ export interface TradeExecutedEvent extends EventEnvelope {
1425
+ type: typeof EventType.TradeExecuted;
1426
+ market: string;
1427
+ trade: MarketTrade;
1428
+ }
1429
+ /** Callback-friendly trade event (what onTradeExecuted delivers). */
1430
+ export interface TradeEvent {
1431
+ market: string;
1432
+ trade: MarketTrade;
1433
+ }
1434
+ export interface RealmCreatedEvent extends EventEnvelope {
1435
+ type: typeof EventType.RealmCreated;
1436
+ realm: Realm;
1437
+ }
1438
+ /**
1439
+ * Common fields available on every TWAP event. The `twap` payload is the
1440
+ * full server-side TwapResponse, identical to what `getTwap()` returns;
1441
+ * use it as the authoritative state instead of refetching. The `twapId`
1442
+ * mirrors `twap.twapId` and is also exposed at the top level so simple
1443
+ * filters (e.g. `event.twapId === target`) don't have to drill in.
1444
+ */
1445
+ interface BaseTwapEvent extends BaseRealmEvent {
1446
+ twapId?: string;
1447
+ twap?: Twap;
1448
+ }
1449
+ export interface TwapStartedEvent extends BaseTwapEvent {
1450
+ type: typeof EventType.TwapStarted;
1451
+ }
1452
+ export interface TwapProgressEvent extends BaseTwapEvent {
1453
+ type: typeof EventType.TwapProgress;
1454
+ /** Total executed size at the moment the slice resolved. */
1455
+ executedSize?: string;
1456
+ /** Total executed notional (USD) at the moment the slice resolved. */
1457
+ executedNotional?: string;
1458
+ /** Cumulative count of slices the scanner has dispatched so far. */
1459
+ sliceCount?: number;
1460
+ filledSlices?: number;
1461
+ failedSlices?: number;
1462
+ /** Status of the most recently resolved slice: "completed" | "failed". */
1463
+ lastSliceStatus?: string;
1464
+ }
1465
+ export interface TwapCompletedEvent extends BaseTwapEvent {
1466
+ type: typeof EventType.TwapCompleted;
1467
+ }
1468
+ export interface TwapCancelledEvent extends BaseTwapEvent {
1469
+ type: typeof EventType.TwapCancelled;
1470
+ }
1471
+ export interface TwapFailedEvent extends BaseTwapEvent {
1472
+ type: typeof EventType.TwapFailed;
1473
+ }
1474
+ export type TwapEvent = TwapStartedEvent | TwapProgressEvent | TwapCompletedEvent | TwapCancelledEvent | TwapFailedEvent;
1475
+ export interface AgentTextEvent {
1476
+ type: typeof EventType.AgentText;
1477
+ chatId: string;
1478
+ content: string;
1479
+ }
1480
+ export interface AgentToolUseEvent {
1481
+ type: typeof EventType.AgentToolUse;
1482
+ chatId: string;
1483
+ tool: string;
1484
+ input: Record<string, unknown>;
1485
+ }
1486
+ export interface AgentPlanEvent {
1487
+ type: typeof EventType.AgentPlan;
1488
+ chatId: string;
1489
+ summary: string;
1490
+ steps: AgentPlanStep[];
1491
+ }
1492
+ export interface AgentPlanStep {
1493
+ id: string;
1494
+ description: string;
1495
+ operation: string;
1496
+ params: Record<string, unknown>;
1497
+ dependsOn?: string[];
1498
+ }
1499
+ export interface AgentConversationLogEvent {
1500
+ type: typeof EventType.AgentConversationLog;
1501
+ chatId: string;
1502
+ log: Record<string, unknown>;
1503
+ }
1504
+ export interface AgentDoneEvent {
1505
+ type: typeof EventType.AgentDone;
1506
+ chatId: string;
1507
+ }
1508
+ export interface AgentStepUpdatedEvent {
1509
+ type: typeof EventType.AgentStepUpdated;
1510
+ chatId: string;
1511
+ stepId: string;
1512
+ status: string;
1513
+ error?: string;
1514
+ operationId?: string;
1515
+ resolvedSize?: string;
1516
+ }
1517
+ export interface AgentExecutionDoneEvent {
1518
+ type: typeof EventType.AgentExecutionDone;
1519
+ chatId: string;
1520
+ }
1521
+ export type AgentEvent = AgentTextEvent | AgentToolUseEvent | AgentPlanEvent | AgentConversationLogEvent | AgentDoneEvent | AgentStepUpdatedEvent | AgentExecutionDoneEvent;
1522
+ export type TypedRealmEvent = OperationCreatedEvent | OperationUpdatedEvent | EventCreatedEvent | ObjectCreatedEvent | ObjectUpdatedEvent | ObjectDeletedEvent | BalanceUpdatedEvent | ExchangeUpdatedEvent | FillPreviewedEvent | FillRecordedEvent | ExchangeFundingEvent | AggregationUpdatedEvent | ObjectValuationEvent | MidsUpdatedEvent | CandleClosedEvent | CandleUpdatedEvent | TradeExecutedEvent | RealmCreatedEvent | TwapStartedEvent | TwapProgressEvent | TwapCompletedEvent | TwapCancelledEvent | TwapFailedEvent;
1523
+ /**
1524
+ * Narrow a raw ``RealmEvent`` into a discriminated ``TypedRealmEvent``.
1525
+ * Returns `undefined` if the event type is unrecognized or the payload
1526
+ * is missing required fields for the given type.
1527
+ */
1528
+ export declare function toTypedEvent(event: RealmEvent): TypedRealmEvent | undefined;
1529
+ /** Realm event from the WebSocket stream (untyped union -- prefer TypedRealmEvent). */
1530
+ export interface RealmEvent {
1531
+ realmId?: string;
1532
+ type: string;
1533
+ entityId?: string;
1534
+ entityPath?: string;
1535
+ aggregation?: PathAggregation | Record<string, unknown>;
1536
+ summary?: ExplorerSummary | Record<string, unknown>;
1537
+ operation?: Operation;
1538
+ event?: ArcaEvent;
1539
+ object?: ArcaObject;
1540
+ mids?: Record<string, string>;
1541
+ exchangeState?: ExchangeState;
1542
+ valuation?: ObjectValuation;
1543
+ balances?: ArcaBalance[];
1544
+ heldOutbound?: ReservedBalance[];
1545
+ heldInbound?: ReservedBalance[];
1546
+ path?: string;
1547
+ watchId?: string;
1548
+ fill?: SimFill;
1549
+ funding?: FundingPayment;
1550
+ realm?: Realm;
1551
+ market?: string;
1552
+ interval?: CandleInterval;
1553
+ candle?: Candle;
1554
+ trade?: MarketTrade;
1555
+ /** Present and true when the server detected and corrected a cache drift. */
1556
+ driftCorrected?: boolean;
1557
+ twap?: Twap;
1558
+ twapId?: string;
1559
+ executedSize?: string;
1560
+ executedNotional?: string;
1561
+ sliceCount?: number;
1562
+ filledSlices?: number;
1563
+ failedSlices?: number;
1564
+ lastSliceStatus?: string;
1565
+ eventId?: string;
1566
+ correlationId?: string;
1567
+ sequence?: number;
1568
+ timestamp?: string;
1569
+ deliverySeq?: number;
1570
+ }
1571
+ export type EventCallback = (event: RealmEvent) => void;
1572
+ export interface CreatePerpsExchangeOptions {
1573
+ /** Full Arca path (e.g. /exchanges/hl1) */
1574
+ ref: string;
1575
+ /**
1576
+ * Venue the exchange object trades against. `'hl-sim'` (the default)
1577
+ * provisions a simulated Hyperliquid account for paper realms; `'hl'`
1578
+ * provisions a live Hyperliquid account (production realms, gated by the
1579
+ * platform's HL feature flag). The legacy long forms `'sim-exchange'` and
1580
+ * `'hyperliquid'` are still accepted.
1581
+ */
1582
+ venue?: 'hl-sim' | 'hl' | 'sim-exchange' | 'hyperliquid';
1583
+ /**
1584
+ * @deprecated Use `venue` instead. This field carried no venue
1585
+ * information (it was always `'hyperliquid'`) and is ignored. It will be
1586
+ * removed in a future release.
1587
+ */
1588
+ exchangeType?: 'hyperliquid';
1589
+ /** Optional operation path (idempotency key) */
1590
+ operationPath?: string;
1591
+ }
1592
+ export interface FeeTarget {
1593
+ /** Path of the Arca to receive a share of the application fee */
1594
+ arcaPath: string;
1595
+ /** Percentage of the distributable fee (1-100, must sum to <= 100) */
1596
+ percentage: number;
1597
+ }
1598
+ export interface PlaceOrderOptions {
1599
+ /** Operation path (idempotency key) */
1600
+ path: string;
1601
+ /** Exchange Arca object ID */
1602
+ objectId: string;
1603
+ /** Coin in canonical format (e.g. "hl:0:BTC", "hl:1:SILVER") */
1604
+ market: string;
1605
+ /** Order side */
1606
+ side: 'buy' | 'sell';
1607
+ /** Order type */
1608
+ orderType: 'MARKET' | 'LIMIT';
1609
+ /**
1610
+ * Order size as a decimal string in **base-asset units** (e.g. for
1611
+ * `"hl:0:BTC"` this is BTC, not USD). For example, `size: "0.001"` on
1612
+ * `hl:0:BTC` opens a 0.001 BTC position.
1613
+ *
1614
+ * Hyperliquid enforces a global $10 minimum on `size * price`. Reduce-only
1615
+ * orders and `positionTpsl` trigger orders are exempt so dust positions
1616
+ * can always be closed. Use `getOrderLimits()` to read the current floor.
1617
+ *
1618
+ * For `positionTpsl` trigger orders, pass `"0"` to auto-fill from the
1619
+ * current position size.
1620
+ */
1621
+ size: string;
1622
+ /** Limit price (required for LIMIT orders) */
1623
+ price?: string;
1624
+ /** Optional leverage override. If omitted, the exchange uses the account's current per-market leverage setting.
1625
+ *
1626
+ * Required when `isolated` is true. On Hyperliquid, isolated orders
1627
+ * are bucketed by leverage — the matching engine needs `leverage` to
1628
+ * identify which margin bucket the order applies to. Missing leverage
1629
+ * on an isolated order is rejected with a 400.
1630
+ */
1631
+ leverage?: number;
1632
+ /** If true, only reduces an existing position */
1633
+ reduceOnly?: boolean;
1634
+ /** If true, the order targets the asset's isolated-margin bucket.
1635
+ *
1636
+ * Required (with positive `leverage`) on isolated-only markets — those
1637
+ * whose `marginModes` is `['isolated']` (e.g. `hl:1:CL`), where
1638
+ * Hyperliquid's matching engine refuses cross orders. Omitted on
1639
+ * cross-eligible markets defaults to cross (HL's default). Read
1640
+ * `Market.marginModes` to discover which margin modes an asset
1641
+ * supports — do not infer it from `isHip3`, since some HIP-3 markets
1642
+ * (e.g. `hl:1:TSLA`) are cross-eligible.
1643
+ *
1644
+ * Builders rarely set this directly — `closePosition()` auto-fills
1645
+ * it from market metadata, and the portal renders an "Isolated"
1646
+ * badge on isolated-only markets and forces the flag.
1647
+ */
1648
+ isolated?: boolean;
1649
+ /** Time in force (default: GTC) */
1650
+ timeInForce?: 'GTC' | 'IOC' | 'ALO';
1651
+ /** Application fee in tenths of a basis point (e.g. 45 = 4.5 bps). Additive to base exchange fee. */
1652
+ applicationFeeTenthsBps?: number;
1653
+ /** Fee routing targets. Percentage-based splits of the distributable application fee. */
1654
+ feeTargets?: FeeTarget[];
1655
+ /** If true, this is a trigger order (TP/SL). When set, triggerPx and tpsl are required. */
1656
+ isTrigger?: boolean;
1657
+ /** Trigger price — mark price threshold to activate the order */
1658
+ triggerPx?: string;
1659
+ /** If true, execute as market order when triggered; if false, use price as limit */
1660
+ isMarket?: boolean;
1661
+ /** Take profit or stop loss: 'tp' or 'sl'. Required when isTrigger is true. */
1662
+ tpsl?: 'tp' | 'sl';
1663
+ /** Grouping controls TP/SL lifecycle: 'na' (standalone), 'normalTpsl' (fixed, parent-linked), 'positionTpsl' (auto-resizes with position) */
1664
+ grouping?: 'na' | 'normalTpsl' | 'positionTpsl';
1665
+ /** When true, the server resolves the actual max order size at execution time.
1666
+ * `size` serves as the reference (what was displayed to the user).
1667
+ * The server will never fill more than the reference size, and will reject
1668
+ * if the resolved max deviates below the reference by more than sizeTolerance. */
1669
+ useMax?: boolean;
1670
+ /** Maximum allowed downward size adjustment as a fraction (0.01 = 1%).
1671
+ * When the order fails a margin check, the server may reduce `size` by up to
1672
+ * this percentage to fit the available margin. Never increases size.
1673
+ * Works with or without `useMax`. Defaults to 0 (exact-or-reject).
1674
+ * Recommended: 0.01 for interactive flows, 0.02 for retail/volatile.
1675
+ * Server-side maximum: 0.25. */
1676
+ sizeTolerance?: number;
1677
+ /** @deprecated Use `sizeTolerance` instead. Alias kept for backward compatibility. */
1678
+ maxSizeTolerance?: number;
1679
+ }
1680
+ export interface ClosePositionOptions {
1681
+ /** Operation path (idempotency key) */
1682
+ path: string;
1683
+ /** Exchange Arca object ID */
1684
+ objectId: string;
1685
+ /** Coin in canonical format (e.g. "hl:0:BTC", "hl:1:SILVER") */
1686
+ market: string;
1687
+ /** Partial close size as decimal string. If omitted, closes the full position. */
1688
+ size?: string;
1689
+ /** Time in force (default: IOC) */
1690
+ timeInForce?: 'GTC' | 'IOC' | 'ALO';
1691
+ /** Application fee in tenths of a basis point (e.g. 45 = 4.5 bps). Additive to base exchange fee. */
1692
+ applicationFeeTenthsBps?: number;
1693
+ /** Fee routing targets. Percentage-based splits of the distributable application fee. */
1694
+ feeTargets?: FeeTarget[];
1695
+ /** Override automatic isolated/leverage inference.
1696
+ *
1697
+ * By default `closePosition()` reads the position's `leverage` and
1698
+ * uses market metadata to decide whether `isolated` should be set
1699
+ * for this market. Pass these only to override that default — typical
1700
+ * builders should leave them unset.
1701
+ */
1702
+ isolated?: boolean;
1703
+ /** Leverage override. Defaults to the position's `leverage`. */
1704
+ leverage?: number;
1705
+ }
1706
+ export interface CancelOrderOptions {
1707
+ /** Operation path (idempotency key) */
1708
+ path: string;
1709
+ /** Exchange Arca object ID */
1710
+ objectId: string;
1711
+ /** ID of the order to cancel */
1712
+ orderId: string;
1713
+ }
1714
+ /**
1715
+ * Options for {@link Arca.setStopLoss} / {@link Arca.setTakeProfit}.
1716
+ *
1717
+ * Both place a *position-attached* trigger order (`grouping: 'positionTpsl'`,
1718
+ * `reduceOnly: true`). The closing side is inferred from the open position
1719
+ * (a `long` is protected by a sell trigger, a `short` by a buy trigger), and the
1720
+ * size tracks the position automatically — it auto-resizes as the position
1721
+ * grows or shrinks and is cancelled when the position closes or is
1722
+ * liquidated. There must be an open position for `market` or the call throws.
1723
+ */
1724
+ export interface SetPositionTriggerOptions {
1725
+ /** Operation path (idempotency key). */
1726
+ path: string;
1727
+ /** Exchange Arca object ID. */
1728
+ objectId: string;
1729
+ /** Coin in canonical format (e.g. "hl:0:BTC", "hl:1:SILVER"). */
1730
+ market: string;
1731
+ /** Trigger (mark) price at which the order activates. Positive decimal string. */
1732
+ triggerPx: string;
1733
+ /**
1734
+ * Execute as a market order when triggered (default `true`). When `false`,
1735
+ * a `limitPrice` is required — the order rests as a limit at that price once
1736
+ * triggered.
1737
+ */
1738
+ isMarket?: boolean;
1739
+ /** Limit price for a trigger-limit order. Required when `isMarket` is `false`. */
1740
+ limitPrice?: string;
1741
+ /**
1742
+ * Replace any existing position TP/SL of the same type (`tp`/`sl`) for this
1743
+ * market before placing the new one (default `true`). Set `false` to stack
1744
+ * multiple triggers. Implemented as cancel-existing then place-new.
1745
+ */
1746
+ replace?: boolean;
1747
+ /** Time in force for the resting trigger (default `GTC`). */
1748
+ timeInForce?: 'GTC' | 'IOC' | 'ALO';
1749
+ /** Application fee in tenths of a basis point (e.g. 45 = 4.5 bps). */
1750
+ applicationFeeTenthsBps?: number;
1751
+ /** Fee routing targets. Percentage-based splits of the distributable application fee. */
1752
+ feeTargets?: FeeTarget[];
1753
+ /** Override leverage inference. Defaults to the position's leverage. */
1754
+ leverage?: number;
1755
+ /** Override isolated inference. Defaults to the market's margin mode. */
1756
+ isolated?: boolean;
1757
+ }
1758
+ /**
1759
+ * Options for {@link Arca.setPositionTpsl}, a convenience that attaches a
1760
+ * stop-loss and/or take-profit to an open position in one call. At least one
1761
+ * of `stopLossPx` / `takeProfitPx` must be provided. Each leg is placed as an
1762
+ * independent `positionTpsl` order; the `path` is used as a base and the legs
1763
+ * derive sub-paths (`<path>/sl`, `<path>/tp`).
1764
+ */
1765
+ export interface SetPositionTpslOptions {
1766
+ /** Base operation path; legs derive `<path>/sl` and `<path>/tp`. */
1767
+ path: string;
1768
+ /** Exchange Arca object ID. */
1769
+ objectId: string;
1770
+ /** Coin in canonical format. */
1771
+ market: string;
1772
+ /** Stop-loss trigger (mark) price. Omit to leave the stop-loss unset. */
1773
+ stopLossPx?: string;
1774
+ /** Take-profit trigger (mark) price. Omit to leave the take-profit unset. */
1775
+ takeProfitPx?: string;
1776
+ /** Execute as market orders on trigger (default `true`). */
1777
+ isMarket?: boolean;
1778
+ /** Replace existing position TP/SL of the same type(s) for this market (default `true`). */
1779
+ replace?: boolean;
1780
+ /** Application fee in tenths of a basis point. */
1781
+ applicationFeeTenthsBps?: number;
1782
+ /** Fee routing targets. */
1783
+ feeTargets?: FeeTarget[];
1784
+ }
1785
+ /** Result of {@link Arca.setPositionTpsl}: the handle for each leg that was placed. */
1786
+ export interface SetPositionTpslResult {
1787
+ /** Handle for the stop-loss leg, present when `stopLossPx` was provided. */
1788
+ stopLoss?: OrderHandle;
1789
+ /** Handle for the take-profit leg, present when `takeProfitPx` was provided. */
1790
+ takeProfit?: OrderHandle;
1791
+ }
1792
+ /**
1793
+ * Options for {@link Arca.clearPositionTpsl}, which cancels resting
1794
+ * position-attached TP/SL orders for a market.
1795
+ */
1796
+ export interface ClearPositionTpslOptions {
1797
+ /** Base operation path; each cancel derives a sub-path. */
1798
+ path: string;
1799
+ /** Exchange Arca object ID. */
1800
+ objectId: string;
1801
+ /** Coin in canonical format. */
1802
+ market: string;
1803
+ /**
1804
+ * Restrict to one type. Omit to clear both stop-loss and take-profit
1805
+ * position triggers for the market.
1806
+ */
1807
+ tpsl?: 'tp' | 'sl';
1808
+ }
1809
+ export interface OrderOperationResponse {
1810
+ operation: Operation;
1811
+ fee?: {
1812
+ amount: string;
1813
+ denomination: string;
1814
+ };
1815
+ }
1816
+ export type TwapStatus = 'active' | 'completed' | 'cancelled' | 'failed';
1817
+ export interface Twap {
1818
+ twapId: string;
1819
+ realmId: RealmId;
1820
+ operationId: OperationId;
1821
+ exchangeObjectId: string;
1822
+ exchangeObjectPath: string;
1823
+ simAccountId: string;
1824
+ type: 'twap' | 'dca';
1825
+ market: string;
1826
+ side: 'buy' | 'sell';
1827
+ totalSize: string | null;
1828
+ executedSize: string;
1829
+ executedNotional: string;
1830
+ /**
1831
+ * Running counter of slices the scanner has dispatched so far. Starts
1832
+ * at 0 and increments once per dispatch. To render "X of N" before
1833
+ * the first slice resolves, use {@link expectedSliceCount}.
1834
+ */
1835
+ sliceCount: number;
1836
+ /**
1837
+ * Planned total slice count, computed at create time as
1838
+ * `max(1, durationSeconds / intervalSeconds)`. Stable for the
1839
+ * TWAP's lifetime; use this when displaying progress as "X / N"
1840
+ * since {@link sliceCount} is 0 until the first slice dispatches.
1841
+ */
1842
+ expectedSliceCount: number;
1843
+ filledSlices: number;
1844
+ failedSlices: number;
1845
+ intervalSeconds: number;
1846
+ /** Echo of the request's `durationMinutes`. */
1847
+ durationMinutes: number;
1848
+ startTime: string;
1849
+ endTime: string | null;
1850
+ status: TwapStatus;
1851
+ /**
1852
+ * High-level discriminator for terminal state:
1853
+ * `"user"`, `"liquidated"`, `"consecutive_failures"`. Set on both
1854
+ * `cancelled` and `failed` TWAPs. Use this for programmatic branching.
1855
+ */
1856
+ cancelReason: string | null;
1857
+ /**
1858
+ * Descriptive failure detail captured from the last slice when the
1859
+ * TWAP terminates as `failed` (e.g. "Slippage cap hit at 1.5%",
1860
+ * "MARKET_DATA_UNAVAILABLE"). Pair with {@link cancelReason} for UI
1861
+ * surfaces — `cancelReason` is the enum, `failureReason` is the
1862
+ * message.
1863
+ */
1864
+ failureReason: string | null;
1865
+ /**
1866
+ * Mid-price snapshot at creation, captured server-side so clients
1867
+ * can render a stable "vs target" delta from slice 1. Null when mid
1868
+ * was unavailable at create time (cold cache); fall back to live
1869
+ * mark in that case.
1870
+ */
1871
+ targetPrice: string | null;
1872
+ reduceOnly: boolean;
1873
+ leverage: number | null;
1874
+ slippageBps: number;
1875
+ randomize: boolean;
1876
+ consecutiveFailures: number;
1877
+ createdAt: string;
1878
+ updatedAt: string;
1879
+ }
1880
+ export interface PlaceTwapOptions {
1881
+ /** Operation path (idempotency key). Example: `"/wallets/main/twap/btc-accumulate"` */
1882
+ path: string;
1883
+ /** Exchange Arca object ID (e.g. `"hl:0:BTC"`) */
1884
+ exchangeId: string;
1885
+ /** Canonical market identifier (e.g. `"hl:0:BTC"`) */
1886
+ market: string;
1887
+ /** `"buy"` or `"sell"` */
1888
+ side: 'buy' | 'sell';
1889
+ /**
1890
+ * Total size to execute over the duration, in **base-asset units**
1891
+ * (e.g. for `"hl:0:BTC"` this is BTC, not USD). The TWAP scanner divides
1892
+ * `totalSize` by the number of slices and dispatches each slice as a
1893
+ * market-unit market order.
1894
+ *
1895
+ * Hyperliquid enforces a $10 minimum notional per order, so
1896
+ * `(totalSize / numSlices) * mid` must be ≥ $10 unless the TWAP is
1897
+ * `reduceOnly`. The platform pre-validates this at create time when a
1898
+ * mid price is cached. Use `getTwapLimits()` to read the floor.
1899
+ */
1900
+ totalSize: string;
1901
+ /** Duration in minutes (1 to 43200 = 30 days) */
1902
+ durationMinutes: number;
1903
+ /** Interval between slices in seconds (10 to 3600, default 30) */
1904
+ intervalSeconds?: number;
1905
+ /** Add timing jitter to slice placement (default false) */
1906
+ randomize?: boolean;
1907
+ /** Reduce-only mode (default false) */
1908
+ reduceOnly?: boolean;
1909
+ /** Leverage multiplier */
1910
+ leverage?: number;
1911
+ /** Max slippage in basis points (10 to 1000, default 300 = 3%) */
1912
+ slippageBps?: number;
1913
+ }
1914
+ export interface TwapOperationResponse {
1915
+ twap: Twap;
1916
+ operation: Operation | null;
1917
+ }
1918
+ /**
1919
+ * Universal TWAP constraints + a duration-keyed recommendation curve,
1920
+ * returned by {@link Arca.getTwapLimits}. The server is the source of
1921
+ * truth; SDKs cache the response for the process lifetime so a single
1922
+ * GET on first use covers every subsequent validation. Bumping limits
1923
+ * is a server-side change only.
1924
+ */
1925
+ export interface TwapLimits {
1926
+ limits: TwapLimitsConfig;
1927
+ recommendation: TwapRecommendationCurve;
1928
+ }
1929
+ export interface TwapLimitsConfig {
1930
+ /**
1931
+ * Coarse minimum total size accepted by the create-time validator.
1932
+ * The authoritative per-market precision lives in the meta cache and
1933
+ * is surfaced through the markets API; this is just a lower bound
1934
+ * for any market.
1935
+ */
1936
+ minTotalSize: string;
1937
+ maxDurationMinutes: number;
1938
+ minIntervalSeconds: number;
1939
+ maxIntervalSeconds: number;
1940
+ minSlippageBps: number;
1941
+ maxSlippageBps: number;
1942
+ defaultIntervalSeconds: number;
1943
+ defaultSlippageBps: number;
1944
+ maxConcurrentPerObject: number;
1945
+ }
1946
+ export interface TwapRecommendationCurve {
1947
+ /**
1948
+ * Sorted by `maxDurationMinutes` ascending. Pick the first bucket
1949
+ * whose `maxDurationMinutes` is `>= durationMinutes`; the
1950
+ * corresponding `recommendedIntervalSeconds` produces ~12–30 slices
1951
+ * in the common case. See
1952
+ * {@link Arca.recommendedIntervalSeconds} for the helper.
1953
+ */
1954
+ buckets: TwapRecommendationBucket[];
1955
+ }
1956
+ export interface TwapRecommendationBucket {
1957
+ maxDurationMinutes: number;
1958
+ recommendedIntervalSeconds: number;
1959
+ }
1960
+ /**
1961
+ * Static venue-wide order limits returned by {@link Arca.getOrderLimits}.
1962
+ * Hyperliquid enforces a $10 minimum notional (`size * price`) on every
1963
+ * non-reduce-only order. Reduce-only orders and `positionTpsl` triggers
1964
+ * are exempt so dust positions can always be closed.
1965
+ */
1966
+ export interface OrderLimits {
1967
+ /** Minimum order notional in USD (size * price). Hyperliquid: 10. */
1968
+ minOrderNotionalUsd: number;
1969
+ }
1970
+ export interface SimAccount {
1971
+ id: SimAccountId;
1972
+ realmId: RealmId;
1973
+ name: string;
1974
+ createdAt: string;
1975
+ updatedAt: string;
1976
+ }
1977
+ export interface SimMarginSummary {
1978
+ /** Cross-venue term: account equity (wallet/cash + unrealized PnL effects). */
1979
+ equity: string;
1980
+ /** Cross-venue term: margin currently allocated to open positions. */
1981
+ initialMarginUsed: string;
1982
+ /** Cross-venue term: minimum margin required to avoid liquidation. */
1983
+ maintenanceMarginRequired: string;
1984
+ /** Withdrawable amount: equity minus maintenance margin, floored at zero. Not free margin for new trades — use `equity - initialMarginUsed` for available trading margin. */
1985
+ availableToWithdraw: string;
1986
+ totalNtlPos: string;
1987
+ totalUnrealizedPnl: string;
1988
+ totalRawUsd?: string;
1989
+ }
1990
+ export type OrderSide = 'buy' | 'sell';
1991
+ export type PositionSide = 'long' | 'short';
1992
+ export type OrderStatus = 'PENDING' | 'OPEN' | 'PARTIALLY_FILLED' | 'FILLED' | 'CANCELLED' | 'FAILED' | 'WAITING_FOR_TRIGGER' | 'TRIGGERED';
1993
+ export type LeverageType = 'cross' | 'isolated';
1994
+ export interface SimPosition {
1995
+ id: SimPositionId;
1996
+ accountId: SimAccountId;
1997
+ realmId: RealmId;
1998
+ market: string;
1999
+ side: PositionSide;
2000
+ size: string;
2001
+ entryPrice: string;
2002
+ leverage: number;
2003
+ marginUsed: string;
2004
+ /**
2005
+ * The position's margin mode. Isolated positions carry their own dedicated
2006
+ * collateral (`isolatedMargin`) and are liquidated independently of the
2007
+ * cross pool.
2008
+ */
2009
+ marginMode: MarginMode;
2010
+ /**
2011
+ * Locked collateral for an isolated position (decimal string). May exceed
2012
+ * the leverage-implied margin after `updateIsolatedMargin`. Omitted for
2013
+ * cross positions.
2014
+ */
2015
+ isolatedMargin?: string | null;
2016
+ liquidationPrice: string | null;
2017
+ unrealizedPnl: string | null;
2018
+ returnOnEquity: string | null;
2019
+ positionValue: string | null;
2020
+ /**
2021
+ * Cumulative funding paid (negative) or received (positive) over the
2022
+ * position's *current open lot* — i.e. since net position size last went
2023
+ * 0 → non-zero. Resets when the lot ends: a full close removes the
2024
+ * position; a flip-through-zero starts a fresh lot at zero funding.
2025
+ * Decimal string. Omitted when no funding has accrued.
2026
+ */
2027
+ cumulativeFunding?: string | null;
2028
+ /**
2029
+ * Cumulative trading fee paid over the position's *current open lot*,
2030
+ * summed across the exchange / platform / builder buckets below. Same
2031
+ * lot semantics as `cumulativeFunding`. Provided as a convenience so
2032
+ * UIs can show a single "fees accrued" number; equal by construction
2033
+ * to `cumulativeExchangeFee + cumulativePlatformFee + cumulativeBuilderFee`.
2034
+ * Decimal string. Omitted when no fees have accrued.
2035
+ */
2036
+ cumulativeFee?: string | null;
2037
+ /** Cumulative exchange (taker / maker) fee component. See `cumulativeFee`. */
2038
+ cumulativeExchangeFee?: string | null;
2039
+ /** Cumulative platform fee component. See `cumulativeFee`. */
2040
+ cumulativePlatformFee?: string | null;
2041
+ /** Cumulative builder fee component. See `cumulativeFee`. */
2042
+ cumulativeBuilderFee?: string | null;
2043
+ /** Present when computed fields (unrealizedPnl, positionValue, returnOnEquity) could not be calculated. */
2044
+ error?: string | null;
2045
+ createdAt: string;
2046
+ updatedAt: string;
2047
+ }
2048
+ export interface PositionListResponse {
2049
+ positions: SimPosition[];
2050
+ total: number;
2051
+ }
2052
+ export interface OrderListResponse {
2053
+ orders: SimOrder[];
2054
+ total: number;
2055
+ }
2056
+ export interface SimOrder {
2057
+ id: SimOrderId;
2058
+ accountId: SimAccountId;
2059
+ realmId: RealmId;
2060
+ market: string;
2061
+ side: OrderSide;
2062
+ orderType: 'MARKET' | 'LIMIT';
2063
+ price: string | null;
2064
+ size: string;
2065
+ filledSize: string;
2066
+ avgFillPrice: string | null;
2067
+ status: OrderStatus;
2068
+ reduceOnly: boolean;
2069
+ timeInForce: 'GTC' | 'IOC' | 'ALO';
2070
+ leverage: number;
2071
+ /**
2072
+ * Venue builder-code fee echoed on the order, in tenths of a basis point
2073
+ * (the value configured via the order's `applicationFeeTenthsBps`).
2074
+ */
2075
+ builderFeeBps?: number | null;
2076
+ /** True if this is a trigger (TP/SL) order */
2077
+ isTrigger?: boolean;
2078
+ /** Trigger price — mark price threshold to activate */
2079
+ triggerPx?: string | null;
2080
+ /** If true, executes as market when triggered */
2081
+ isMarket?: boolean;
2082
+ /** 'tp' for take profit, 'sl' for stop loss */
2083
+ tpsl?: 'tp' | 'sl' | '';
2084
+ /** Lifecycle grouping: 'na', 'normalTpsl', or 'positionTpsl' */
2085
+ grouping?: 'na' | 'normalTpsl' | 'positionTpsl' | '';
2086
+ /** Parent order ID for normalTpsl child orders */
2087
+ parentOrderId?: string;
2088
+ createdAt: string;
2089
+ updatedAt: string;
2090
+ }
2091
+ export interface SimFill {
2092
+ id: SimFillId;
2093
+ orderId: SimOrderId;
2094
+ accountId?: SimAccountId;
2095
+ realmId?: RealmId;
2096
+ market: string;
2097
+ side: OrderSide;
2098
+ price: string;
2099
+ size: string;
2100
+ fee: string;
2101
+ builderFee?: string;
2102
+ cloid?: string;
2103
+ isMaker?: boolean;
2104
+ platformFee?: string;
2105
+ realizedPnl: string | null;
2106
+ isLiquidation: boolean;
2107
+ createdAt?: string;
2108
+ /** True if this is an optimistic fill generated by the SDK before the canonical event arrives. */
2109
+ isOptimistic?: boolean;
2110
+ }
2111
+ export interface FundingPayment {
2112
+ accountId: string;
2113
+ market: string;
2114
+ side: string;
2115
+ size: string;
2116
+ price: string;
2117
+ fundingRate: string;
2118
+ payment: string;
2119
+ }
2120
+ export type FillDirection = 'open_long' | 'close_long' | 'increase_long' | 'reduce_long' | 'open_short' | 'close_short' | 'increase_short' | 'reduce_short';
2121
+ export interface FillResultingPosition {
2122
+ side: PositionSide;
2123
+ size: string;
2124
+ entryPx?: string;
2125
+ leverage: number;
2126
+ }
2127
+ export interface Fill {
2128
+ id: string;
2129
+ /** Platform operation ID. Absent on preview fills from `fill.previewed`. */
2130
+ operationId?: string;
2131
+ fillId?: string;
2132
+ orderOperationId?: string;
2133
+ orderId?: string;
2134
+ market: string;
2135
+ side?: OrderSide;
2136
+ size?: string;
2137
+ price?: string;
2138
+ direction?: FillDirection;
2139
+ startPosition?: string;
2140
+ fee?: string;
2141
+ exchangeFee?: string;
2142
+ platformFee?: string;
2143
+ builderFee?: string;
2144
+ realizedPnl?: string;
2145
+ /** Absent on preview fills from `fill.previewed`; populated by `fill.recorded`. */
2146
+ resultingPosition?: FillResultingPosition;
2147
+ isLiquidation?: boolean;
2148
+ createdAt: string;
2149
+ /** True if this is an optimistic fill generated by the SDK before the canonical event arrives. */
2150
+ isOptimistic?: boolean;
2151
+ }
2152
+ export interface FillListResponse {
2153
+ fills: Fill[];
2154
+ total: number;
2155
+ cursor?: string;
2156
+ }
2157
+ export interface ListFillsOptions {
2158
+ market?: string;
2159
+ startTime?: string;
2160
+ endTime?: string;
2161
+ limit?: number;
2162
+ cursor?: string;
2163
+ }
2164
+ /**
2165
+ * Costs attributed to the current open position via proportional close-out
2166
+ * accounting. Closing X% of a position discharges X% of its accumulated costs.
2167
+ */
2168
+ export interface OpenPositionCosts {
2169
+ exchangeFees: string;
2170
+ platformFees: string;
2171
+ builderFees: string;
2172
+ fundingPaid: string;
2173
+ fundingReceived: string;
2174
+ total: string;
2175
+ }
2176
+ export interface MarketTradeSummary {
2177
+ market: string;
2178
+ totalRealizedPnl: string;
2179
+ totalFees: string;
2180
+ totalExchangeFees?: string;
2181
+ totalPlatformFees?: string;
2182
+ totalBuilderFees?: string;
2183
+ totalFundingPaid?: string;
2184
+ totalFundingReceived?: string;
2185
+ tradeCount: number;
2186
+ totalVolume: string;
2187
+ openPositionCosts?: OpenPositionCosts | null;
2188
+ }
2189
+ export interface TradeSummaryTotals {
2190
+ totalRealizedPnl: string;
2191
+ totalFees: string;
2192
+ totalExchangeFees?: string;
2193
+ totalPlatformFees?: string;
2194
+ totalBuilderFees?: string;
2195
+ totalFundingPaid?: string;
2196
+ totalFundingReceived?: string;
2197
+ tradeCount: number;
2198
+ totalVolume: string;
2199
+ }
2200
+ export interface TradeSummaryResponse {
2201
+ markets: MarketTradeSummary[];
2202
+ totals: TradeSummaryTotals;
2203
+ }
2204
+ export interface TradeSummaryOptions {
2205
+ startTime?: string;
2206
+ endTime?: string;
2207
+ }
2208
+ export interface SimFeeTierEntry {
2209
+ tier: number;
2210
+ label: string;
2211
+ minVolume14d: number;
2212
+ takerBps: number;
2213
+ makerBps: number;
2214
+ }
2215
+ export interface SimFeeRates {
2216
+ taker: string;
2217
+ maker: string;
2218
+ platformFee?: string;
2219
+ tier?: number;
2220
+ tierLabel?: string;
2221
+ volume14d?: string;
2222
+ schedule?: SimFeeTierEntry[];
2223
+ }
2224
+ /**
2225
+ * A pending order operation projected as a structured intent.
2226
+ * Analogous to a transfer hold: "we intend to place this order
2227
+ * but haven't heard back from the venue yet."
2228
+ */
2229
+ export interface ExchangeIntent {
2230
+ operationId: string;
2231
+ operationPath: string;
2232
+ market: string;
2233
+ side: OrderSide;
2234
+ size: string;
2235
+ orderType: 'MARKET' | 'LIMIT';
2236
+ reduceOnly: boolean;
2237
+ createdAt: string;
2238
+ }
2239
+ export interface ExchangeState {
2240
+ account: SimAccount;
2241
+ marginSummary: SimMarginSummary;
2242
+ /** Hyperliquid-parity shape; same values as marginSummary in cross mode. */
2243
+ crossMarginSummary?: SimMarginSummary;
2244
+ /** Hyperliquid-parity maintenance threshold in cross mode. */
2245
+ crossMaintenanceMarginUsed?: string;
2246
+ positions: SimPosition[] | null;
2247
+ openOrders: SimOrder[] | null;
2248
+ feeRates?: SimFeeRates | null;
2249
+ /** Pending order operations that haven't settled yet. */
2250
+ pendingIntents: ExchangeIntent[];
2251
+ }
2252
+ /**
2253
+ * Describes predicted effects of a mutation before the server confirms.
2254
+ * Available synchronously on `OperationHandle.predicted`.
2255
+ */
2256
+ export interface PredictedEffect {
2257
+ type: 'transfer' | 'order' | 'fund' | 'defund';
2258
+ /** Predicted balance changes keyed by arca path. */
2259
+ balanceChanges?: Record<string, {
2260
+ departing?: string;
2261
+ arriving?: string;
2262
+ }>;
2263
+ /** For orders: the intent of the order being placed. */
2264
+ orderIntent?: {
2265
+ market: string;
2266
+ side: string;
2267
+ size: string;
2268
+ reduceOnly: boolean;
2269
+ };
2270
+ }
2271
+ export interface SimOrderWithFills {
2272
+ order: SimOrder;
2273
+ fills: SimFill[];
2274
+ }
2275
+ export interface LeverageInfo {
2276
+ type: LeverageType;
2277
+ value: number;
2278
+ }
2279
+ export interface ActiveAssetData {
2280
+ /** Coin/asset (e.g. BTC, ETH) */
2281
+ market: string;
2282
+ /** Current leverage setting */
2283
+ leverage: {
2284
+ type: LeverageType;
2285
+ value: number;
2286
+ };
2287
+ /** Max buy size in tokens (positive) */
2288
+ maxBuySize: string;
2289
+ /** Max sell size in tokens (positive) */
2290
+ maxSellSize: string;
2291
+ /** Max buy size in USD (positive) */
2292
+ maxBuyUsd: string;
2293
+ /** Max sell size in USD (positive) */
2294
+ maxSellUsd: string;
2295
+ /** Raw available margin in USD (equity minus margin in use). Direction-agnostic.
2296
+ * Use for "buying power" display. Per-side max exposure uses maxBuyUsd/maxSellUsd. */
2297
+ availableToTrade: string;
2298
+ /** Current mark price */
2299
+ markPx: string;
2300
+ /** Effective fee rate as a decimal (all-in: exchange taker + platform + builder fee) */
2301
+ feeRate: string;
2302
+ /** Base maintenance margin rate as a decimal (e.g. "0.01" for 1%, "0.03" for 3%). */
2303
+ maintenanceMarginRate: string;
2304
+ /** Ordered margin tiers for this asset, if any. */
2305
+ marginTiers?: MarginTier[];
2306
+ /** Top-of-book best bid as a decimal string. Market sells are margin-checked
2307
+ * at the bid, so this is the directional execution price for max sell sizing.
2308
+ * Equals `markPx` when no order book is available. */
2309
+ bidPx?: string;
2310
+ /** Top-of-book best ask as a decimal string. Market buys are margin-checked
2311
+ * at the ask, so this is the directional execution price for max buy sizing.
2312
+ * Equals `markPx` when no order book is available. */
2313
+ askPx?: string;
2314
+ }
2315
+ /** How the `amount` should be interpreted by `Arca.orderBreakdown()`. */
2316
+ export type OrderBreakdownAmountType = 'spend' | 'notional' | 'tokens';
2317
+ /** Account-wide context required by `Arca.orderBreakdown()` to compute a
2318
+ * cross-margin liquidation estimate. The estimate matches the formula the
2319
+ * sim-exchange backend uses at read time
2320
+ * (`marginAvailable = equity - maintenanceMargin`, then
2321
+ * `liq = mid -/+ marginAvailable / size`), so the preview reflects the
2322
+ * liquidation price the position will actually have once the order fills. */
2323
+ export interface OrderBreakdownAccountContext {
2324
+ /** Account equity in USD. From `ExchangeState.marginSummary.equity`. */
2325
+ equity: string;
2326
+ /** Total maintenance margin requirement (USD) from all positions in the
2327
+ * account EXCEPT any position in the same market as this order. The caller
2328
+ * computes this by summing `mmr * size * entryPrice` across
2329
+ * `exchangeState.positions.filter(p => p.market !== market)`. The same-market
2330
+ * position (if any) is passed separately via `existingPosition` so the
2331
+ * helper can apply same-side-add / reduce / flip merge semantics. */
2332
+ otherMaintenanceMargin: string;
2333
+ /** Existing open position in the same market as this order, if any. The
2334
+ * helper merges this with the new order using the same rules as
2335
+ * `PositionService.ApplyFill` (same side blends entry, opposite side
2336
+ * reduces or flips). Omit when the account has no position in this market. */
2337
+ existingPosition?: {
2338
+ side: 'long' | 'short';
2339
+ size: string;
2340
+ entryPrice: string;
2341
+ };
2342
+ }
2343
+ /** Input options for `Arca.orderBreakdown()`.
2344
+ *
2345
+ * When `maintenanceMarginRate` is provided, `accountContext` is also
2346
+ * required (compile-time enforced) so the returned
2347
+ * `estimatedLiquidationPrice` reflects cross-margin reality rather than a
2348
+ * misleading isolated-position estimate. */
2349
+ export type OrderBreakdownOptions = OrderBreakdownOptionsBase & ({
2350
+ maintenanceMarginRate?: undefined;
2351
+ accountContext?: undefined;
2352
+ } | {
2353
+ maintenanceMarginRate: string;
2354
+ accountContext: OrderBreakdownAccountContext;
2355
+ });
2356
+ interface OrderBreakdownOptionsBase {
2357
+ /** The amount to convert. */
2358
+ amount: string;
2359
+ /** How to interpret `amount`:
2360
+ * - `'spend'`: total deducted from balance (margin + fee). Solves for tokens.
2361
+ * - `'notional'`: position exposure in USD. Computes margin and fee on top.
2362
+ * - `'tokens'`: token count. Computes everything from tokens. */
2363
+ amountType: OrderBreakdownAmountType;
2364
+ /** Leverage multiplier. */
2365
+ leverage: number;
2366
+ /** All-in fee rate as a decimal string (from `ActiveAssetData.feeRate`). */
2367
+ feeRate: string;
2368
+ /** Price to use for conversion. Pass mark price for market orders, limit price for limit orders. */
2369
+ price: string;
2370
+ /** Order side. */
2371
+ side: 'buy' | 'sell';
2372
+ /** Decimal places for token rounding (from market meta `szDecimals`). */
2373
+ szDecimals?: number;
2374
+ /** Ordered margin tiers for laddered leverage. Optional; if absent, scalar leverage is used. */
2375
+ marginTiers?: MarginTier[];
2376
+ }
2377
+ /** Result of `Arca.orderBreakdown()`. */
2378
+ export interface OrderBreakdown {
2379
+ /** Position size in tokens (the committed quantity submitted to the exchange). */
2380
+ tokens: string;
2381
+ /** Position exposure in USD (tokens * price). */
2382
+ notionalUsd: string;
2383
+ /** Margin required from balance (notional / leverage). */
2384
+ marginRequired: string;
2385
+ /** Estimated fee from balance (notional * feeRate). */
2386
+ estimatedFee: string;
2387
+ /** Total deducted from balance (margin + fee). */
2388
+ totalSpend: string;
2389
+ /** Price used for the calculation. */
2390
+ price: string;
2391
+ /** Fee rate used for the calculation. */
2392
+ feeRate: string;
2393
+ /** Effective leverage ratio (notional / required margin). Matches isolated `leverage` when un-tiered. */
2394
+ effectiveLeverage?: string;
2395
+ /** Effective maintenance margin rate (maintenance margin / notional) for the total size. */
2396
+ effectiveMaintenanceMarginRate?: string;
2397
+ /** The notional value marking the start of the next margin tier, if any exist beyond the current notional. */
2398
+ nextTierThreshold?: string;
2399
+ /** Estimated cross-margin liquidation price for the position that will
2400
+ * exist after this order fills. Computed using the supplied
2401
+ * `accountContext` (account equity, maintenance margin from other
2402
+ * positions, and any existing same-market position to merge with). Omitted
2403
+ * when `maintenanceMarginRate` was not provided, when the order fully
2404
+ * closes an opposite-side position, or when no positive liquidation
2405
+ * price exists (e.g. the account is already over-collateralized enough
2406
+ * that no positive mark would trigger liquidation). */
2407
+ estimatedLiquidationPrice?: string;
2408
+ }
2409
+ /** Per-asset fee rate entry returned by `getAssetFees`. */
2410
+ export interface AssetFeeEntry {
2411
+ /** Coin in canonical format (e.g. "hl:0:BTC", "hl:1:TSLA") */
2412
+ market: string;
2413
+ /** Effective taker fee rate as a decimal string (e.g. "0.00045" = 4.5 bps) */
2414
+ takerFeeRate: string;
2415
+ /** Effective maker fee rate as a decimal string (e.g. "0.00015" = 1.5 bps) */
2416
+ makerFeeRate: string;
2417
+ }
2418
+ export interface UpdateLeverageOptions {
2419
+ /** Exchange Arca object ID */
2420
+ objectId: string;
2421
+ /** Coin in canonical format (e.g. "hl:0:BTC", "hl:1:SILVER") */
2422
+ market: string;
2423
+ /** Leverage multiplier (1 to maxLeverage for the asset) */
2424
+ leverage: number;
2425
+ }
2426
+ export interface UpdateLeverageResponse {
2427
+ accountId: string;
2428
+ market: string;
2429
+ leverage: number;
2430
+ previousLeverage: number;
2431
+ }
2432
+ export interface LeverageSetting {
2433
+ market: string;
2434
+ leverage: number;
2435
+ /** Asset's configured margin mode. */
2436
+ marginMode: MarginMode;
2437
+ }
2438
+ export interface UpdateIsolatedMarginOptions {
2439
+ /** Exchange Arca object ID */
2440
+ objectId: string;
2441
+ /** Coin in canonical format (e.g. "hl:1:CL") */
2442
+ market: string;
2443
+ /**
2444
+ * Signed USD amount as a decimal string: positive adds collateral to the
2445
+ * isolated position, negative removes it. Removal is rejected if it would
2446
+ * drop the position below its maintenance margin.
2447
+ */
2448
+ amount: string;
2449
+ }
2450
+ export interface UpdateIsolatedMarginResponse {
2451
+ accountId: string;
2452
+ market: string;
2453
+ /** Resulting locked isolated collateral. */
2454
+ isolatedMargin: string;
2455
+ /** Recomputed liquidation price. */
2456
+ liquidationPrice: string;
2457
+ }
2458
+ export interface SetMarginModeOptions {
2459
+ /** Exchange Arca object ID */
2460
+ objectId: string;
2461
+ /** Coin in canonical format (e.g. "hl:0:BTC") */
2462
+ market: string;
2463
+ /** Asset's configured margin mode. */
2464
+ marginMode: MarginMode;
2465
+ }
2466
+ export interface SetMarginModeResponse {
2467
+ accountId: string;
2468
+ market: string;
2469
+ marginMode: MarginMode;
2470
+ }
2471
+ export interface CandleHistoryBounds {
2472
+ earliestMs: number;
2473
+ hlEarliestMs: number;
2474
+ }
2475
+ export interface LogoSource {
2476
+ url: string;
2477
+ format: "png" | "webp";
2478
+ width: 128 | 256 | 512;
2479
+ }
2480
+ export interface MarginTier {
2481
+ lowerBound: string;
2482
+ maxLeverage: number;
2483
+ }
2484
+ export interface MarginTable {
2485
+ description: string;
2486
+ marginTiers: MarginTier[];
2487
+ }
2488
+ export type MarketAssetType = 'crypto' | 'equity' | 'commodity' | 'index' | 'forex' | 'etf' | 'custom' | 'hl-native' | 'meme' | 'private' | 'stablecoin';
2489
+ export type MarketAssetDescriptionStatus = 'curated' | 'hl_only';
2490
+ export interface Market {
2491
+ /** Case-sensitive canonical market ID to pass back to trading and market-data APIs (e.g. "hl:0:BTC", "hl:0:kSHIB", "hl:1:TSLA"). */
2492
+ name: string;
2493
+ dex?: string;
2494
+ /** Display symbol only. Do not reconstruct API market IDs from this field. */
2495
+ symbol: string;
2496
+ /** Venue-native market symbol for display or venue deep links (e.g. "BTC", "xyz:TSLA"). Do not pass to Arca APIs. */
2497
+ venueSymbol?: string;
2498
+ displayName?: string;
2499
+ logoUrl?: string;
2500
+ logoSources?: LogoSource[];
2501
+ exchange: string;
2502
+ /** Machine-readable asset class when Arca recognizes the underlying instrument. */
2503
+ assetType?: MarketAssetType;
2504
+ /** Human-readable label for `assetType`, suitable for UI grouping. */
2505
+ categoryLabel?: string;
2506
+ /** True when the asset is mapped to Arca's underlying-instrument registry. */
2507
+ mapped?: boolean;
2508
+ /** True when a curated display name is available. */
2509
+ hasDisplayName?: boolean;
2510
+ /** True when a curated logo URL or logo source set is available. */
2511
+ hasLogo?: boolean;
2512
+ /** Whether curated display metadata is available or the asset is only known from the live venue listing. */
2513
+ descriptionStatus?: MarketAssetDescriptionStatus;
2514
+ isHip3?: boolean;
2515
+ deployerDisplayName?: string;
2516
+ index: number;
2517
+ szDecimals: number;
2518
+ maxLeverage: number;
2519
+ /**
2520
+ * @deprecated Hyperliquid-specific. Read `marginModes` instead — it is the
2521
+ * explicit, exchange-agnostic signal for which margin modes an asset
2522
+ * supports. `onlyIsolated === true` is equivalent to
2523
+ * `marginModes` being `['isolated']`. This field will be removed in a
2524
+ * future major version.
2525
+ */
2526
+ onlyIsolated: boolean;
2527
+ /**
2528
+ * The margin modes this asset supports. `['isolated']` for isolated-only
2529
+ * markets; `['cross', 'isolated']` otherwise. Read this instead of inferring
2530
+ * from `onlyIsolated` or `isHip3` — margin mode is independent of HIP-3 (some
2531
+ * HIP-3 markets, e.g. `hl:1:TSLA`, are cross-eligible). Optional for
2532
+ * backward compatibility with older servers that don't populate it.
2533
+ */
2534
+ marginModes?: MarginMode[];
2535
+ feeScale?: number;
2536
+ marginTableId?: number;
2537
+ candleHistory?: CandleHistoryBounds;
2538
+ }
2539
+ export interface SimMetaResponse {
2540
+ universe: Market[];
2541
+ marginTables?: Record<string, MarginTable>;
2542
+ }
2543
+ export interface SimMidsResponse {
2544
+ mids: Record<string, string>;
2545
+ }
2546
+ export interface MarketTicker {
2547
+ market: string;
2548
+ dex?: string;
2549
+ symbol: string;
2550
+ exchange: string;
2551
+ markPx: string;
2552
+ midPx: string;
2553
+ prevDayPx: string;
2554
+ dayNtlVlm: string;
2555
+ priceChange24hPct: string;
2556
+ openInterest: string;
2557
+ funding: string;
2558
+ /** Unix timestamp in milliseconds of the next funding event. */
2559
+ nextFundingTime?: number;
2560
+ /** HIP-3 fee multiplier. 1.0 for standard perps; >1 for HIP-3 assets. */
2561
+ feeScale: number;
2562
+ isDelisted: boolean;
2563
+ }
2564
+ export interface MarketTickersResponse {
2565
+ tickers: MarketTicker[];
2566
+ }
2567
+ export interface SimBookLevel {
2568
+ price: string;
2569
+ size: string;
2570
+ orderCount: number;
2571
+ }
2572
+ export interface SimBookResponse {
2573
+ market: string;
2574
+ bids: SimBookLevel[];
2575
+ asks: SimBookLevel[];
2576
+ time: number;
2577
+ }
2578
+ export type CandleInterval = '15s' | '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
2579
+ export interface Candle {
2580
+ /** Bar open time as Unix epoch milliseconds (UTC). Daily candles open at UTC midnight. */
2581
+ t: number;
2582
+ /** Open price (string to preserve decimal precision). */
2583
+ o: string;
2584
+ /** High price. */
2585
+ h: string;
2586
+ /** Low price. */
2587
+ l: string;
2588
+ /** Close price. */
2589
+ c: string;
2590
+ /** Volume in base asset units. */
2591
+ v: string;
2592
+ /** Number of trades in the bar. */
2593
+ n: number;
2594
+ /** Data source. Absent/undefined = venue-native (Hyperliquid), "ext" = external historical data. */
2595
+ s?: string;
2596
+ }
2597
+ export interface CandlesResponse {
2598
+ market: string;
2599
+ interval: string;
2600
+ candles: Candle[];
2601
+ }
2602
+ export interface CandleEvent {
2603
+ market: string;
2604
+ interval: CandleInterval;
2605
+ candle: Candle;
2606
+ publishedAt?: string;
2607
+ platformReceivedAt?: string;
2608
+ wsSentAt?: string;
2609
+ }
2610
+ /** Result of {@link CandleChartStream.ensureRange} or {@link CandleChartStream.loadMore}. */
2611
+ export interface LoadRangeResult {
2612
+ /** Number of new candles fetched in this call (0 when the range was already loaded). */
2613
+ loadedCount: number;
2614
+ /** Total candles now in the chart array. */
2615
+ totalCount: number;
2616
+ /** Time range of all candles in the array. */
2617
+ range: {
2618
+ start: number;
2619
+ end: number;
2620
+ };
2621
+ /** True if the earliest available candle for this asset is now loaded. */
2622
+ reachedStart: boolean;
2623
+ }
2624
+ /** Emitted by {@link CandleChartStream} on every chart change. */
2625
+ export interface CandleChartUpdate {
2626
+ /** Full candle array (historical + live), sorted by `t`, deduped. */
2627
+ candles: Candle[];
2628
+ /** The candle that triggered this update. */
2629
+ latestCandle: Candle;
2630
+ }
2631
+ export interface SparklinesResponse {
2632
+ sparklines: Record<string, number[]>;
2633
+ }
2634
+ export type AuthAuditEventType = 'sign_in' | 'token_minted' | 'api_key_authenticated' | 'permission_denied';
2635
+ export interface AuthAuditEntry {
2636
+ id: TypeId;
2637
+ builderId: UserId;
2638
+ eventType: AuthAuditEventType;
2639
+ actorType: string;
2640
+ actorId: UserId;
2641
+ realmId: RealmId | null;
2642
+ subject: string | null;
2643
+ action: string | null;
2644
+ resource: string | null;
2645
+ scopeSummary: string | null;
2646
+ ipAddress: string | null;
2647
+ tokenJti: string | null;
2648
+ expiresAt: string | null;
2649
+ success: boolean;
2650
+ errorMessage: string | null;
2651
+ operationCount?: number;
2652
+ createdAt: string;
2653
+ }
2654
+ export interface AuthAuditListResponse {
2655
+ entries: AuthAuditEntry[];
2656
+ total: number;
2657
+ }
2658
+ export interface AuthAuditFilters {
2659
+ eventType?: AuthAuditEventType;
2660
+ realmId?: string;
2661
+ since?: string;
2662
+ until?: string;
2663
+ success?: boolean;
2664
+ limit?: number;
2665
+ offset?: number;
2666
+ }
2667
+ export interface MintTokenRequest {
2668
+ /** Realm to lock the token to */
2669
+ realmId: string;
2670
+ /** End-user identifier (e.g. "user-alice") — recorded as the actor in the audit trail */
2671
+ sub: string;
2672
+ /** IAM policy scope */
2673
+ scope: TokenScope;
2674
+ /** Token lifetime in minutes (1-1440, default 60) */
2675
+ expirationMinutes?: number;
2676
+ }
2677
+ export interface MintTokenResponse {
2678
+ /** The signed scoped JWT */
2679
+ token: string;
2680
+ /** Expiration timestamp (RFC 3339) */
2681
+ expiresAt: string;
2682
+ }
2683
+ export interface CredentialScopeResponse {
2684
+ credentialType: 'scoped_token' | 'api_key' | 'builder';
2685
+ credentialId: string;
2686
+ subject: string | null;
2687
+ scope: string | null;
2688
+ fullAccess: boolean;
2689
+ createdAt: string | null;
2690
+ expiresAt: string | null;
2691
+ }
2692
+ export type ReturnStrategy = 'redirect' | 'close' | 'navigate';
2693
+ export interface CreatePaymentLinkOptions {
2694
+ type: 'deposit' | 'withdrawal';
2695
+ arcaRef: string;
2696
+ amount: string;
2697
+ returnUrl?: string;
2698
+ returnStrategy?: ReturnStrategy;
2699
+ expiresInMinutes?: number;
2700
+ metadata?: Record<string, unknown>;
2701
+ /**
2702
+ * On-chain destination address (0x-prefixed 20-byte hex EOA) the
2703
+ * platform sends tokens to via `pool.operatorWithdraw(...)` when a
2704
+ * withdrawal payment link is completed.
2705
+ *
2706
+ * **Required for production-realm withdrawal links** — the platform
2707
+ * refuses to invent a destination on a real chain. Optional for
2708
+ * development-realm withdrawal links (defaults to the burn address).
2709
+ * Ignored for deposit links (depositor address is taken from the
2710
+ * inbound on-chain Transfer event).
2711
+ */
2712
+ destinationAddress?: string;
2713
+ }
2714
+ export interface PaymentLinkResponse {
2715
+ id: string;
2716
+ url: string;
2717
+ token: string;
2718
+ type: 'deposit' | 'withdrawal';
2719
+ status: string;
2720
+ amount: string;
2721
+ denomination: string;
2722
+ operationId: string;
2723
+ expiresAt: string;
2724
+ returnUrl?: string;
2725
+ returnStrategy?: ReturnStrategy;
2726
+ createdAt: string;
2727
+ }
2728
+ export interface CreatePaymentLinkResponse {
2729
+ paymentLink: PaymentLinkResponse;
2730
+ operation: Operation;
2731
+ }
2732
+ export interface ListPaymentLinksOptions {
2733
+ type?: 'deposit' | 'withdrawal';
2734
+ status?: string;
2735
+ }
2736
+ export interface PaymentLinkListResponse {
2737
+ paymentLinks: PaymentLinkResponse[];
2738
+ total: number;
2739
+ }
2740
+ export type CustodyBoundaryStatus = 'active' | 'locked';
2741
+ export type CustodyExchangeArcaStatus = 'active' | 'deleted';
2742
+ export type CustodyVenueHaltType = 'withdrawals' | 'all_flows';
2743
+ export interface CustodyPendingExit {
2744
+ amount: string;
2745
+ destination: string;
2746
+ executesAt: string;
2747
+ }
2748
+ export interface CustodyBoundary {
2749
+ id: string;
2750
+ realmId: string;
2751
+ balance: string;
2752
+ status: CustodyBoundaryStatus;
2753
+ lockedBy: string | null;
2754
+ recoveryKey: string | null;
2755
+ agentAddress: string | null;
2756
+ timeLock: number;
2757
+ pendingExit: CustodyPendingExit | null;
2758
+ }
2759
+ export interface CustodyExchangeArca {
2760
+ id: string;
2761
+ boundaryId: string;
2762
+ status: CustodyExchangeArcaStatus;
2763
+ balance: string;
2764
+ vaultAddress: string;
2765
+ }
2766
+ export interface CustodyVenueHalt {
2767
+ type: CustodyVenueHaltType;
2768
+ expiresAt: string;
2769
+ }
2770
+ export interface CustodyStatus {
2771
+ contractAddress: string;
2772
+ chainId: number;
2773
+ totalBalance: string;
2774
+ boundaries: CustodyBoundary[];
2775
+ exchangeArcas: CustodyExchangeArca[];
2776
+ venueHalt: CustodyVenueHalt | null;
2777
+ }
2778
+ export interface CustodyBoundaryListResponse {
2779
+ boundaries: CustodyBoundary[];
2780
+ }
2781
+ export interface CustodyExchangeArcaListResponse {
2782
+ exchangeArcas: CustodyExchangeArca[];
2783
+ }
2784
+ export interface RegisterRecoveryKeyOptions {
2785
+ boundaryId: string;
2786
+ walletAddress: string;
2787
+ }
2788
+ export interface RegisterRecoveryKeyResponse {
2789
+ transactionHash: string;
2790
+ boundaryId: string;
2791
+ walletAddress: string;
2792
+ }
2793
+ /**
2794
+ * Unsigned EVM transaction data for user-signed custody operations
2795
+ * (lock, unlock, withdraw, assignRecoveryKey).
2796
+ * Submit via any Ethereum-compatible wallet or library.
2797
+ */
2798
+ export interface PreparedCustodyTransaction {
2799
+ to: string;
2800
+ data: string;
2801
+ chainId: number;
2802
+ value: string;
2803
+ }
2804
+ /**
2805
+ * Client-side generated recovery key.
2806
+ * The mnemonic must be backed up by the user — it is never sent to a server.
2807
+ * The address is derived from the mnemonic and registered on the custody contract.
2808
+ */
2809
+ export interface GeneratedRecoveryKey {
2810
+ mnemonic: string;
2811
+ address: string;
2812
+ }
2813
+ export {};
2814
+ //# sourceMappingURL=types.d.ts.map