@arcaresearch/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/admin.d.ts +70 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +208 -0
- package/dist/admin.js.map +1 -0
- package/dist/arca.d.ts +307 -0
- package/dist/arca.d.ts.map +1 -0
- package/dist/arca.js +780 -0
- package/dist/arca.js.map +1 -0
- package/dist/client.d.ts +32 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +119 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +53 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +122 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +2 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +6 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +1067 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +38 -0
- package/dist/types.js.map +1 -0
- package/dist/websocket.d.ts +83 -0
- package/dist/websocket.d.ts.map +1 -0
- package/dist/websocket.js +383 -0
- package/dist/websocket.js.map +1 -0
- package/package.json +40 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
export type UserId = `usr_${string}`;
|
|
2
|
+
export type RealmId = `rlm_${string}`;
|
|
3
|
+
export type ApiKeyId = `key_${string}`;
|
|
4
|
+
export type OrgId = `org_${string}`;
|
|
5
|
+
export type OrgMemberId = `mem_${string}`;
|
|
6
|
+
export type ObjectId = `obj_${string}`;
|
|
7
|
+
export type OperationId = `op_${string}`;
|
|
8
|
+
export type EventId = `evt_${string}`;
|
|
9
|
+
export type DeltaId = `dlt_${string}`;
|
|
10
|
+
export type BalanceId = `bal_${string}`;
|
|
11
|
+
export type ReservedBalanceId = `rsv_${string}`;
|
|
12
|
+
export type PositionId = `pos_${string}`;
|
|
13
|
+
export type InvitationId = `inv_${string}`;
|
|
14
|
+
export type ReconciliationId = `rec_${string}`;
|
|
15
|
+
export type SimAccountId = `act_${string}`;
|
|
16
|
+
export type SimPositionId = `sps_${string}`;
|
|
17
|
+
export type SimOrderId = `ord_${string}`;
|
|
18
|
+
export type SimFillId = `fil_${string}`;
|
|
19
|
+
export type ErrorId = `err_${string}`;
|
|
20
|
+
export type WatchId = `req_${string}`;
|
|
21
|
+
/** Any TypeID-formatted identifier. */
|
|
22
|
+
export type TypeId = `${string}_${string}`;
|
|
23
|
+
export interface ApiResponse<T> {
|
|
24
|
+
success: boolean;
|
|
25
|
+
data?: T;
|
|
26
|
+
error?: {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
errorId?: ErrorId;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type RealmType = 'demo' | 'production' | 'staging' | 'development' | 'testing';
|
|
33
|
+
export interface RealmSettings {
|
|
34
|
+
/** Default builder fee in tenths of a basis point (e.g. 40 = 4.0 bps) */
|
|
35
|
+
defaultBuilderFeeBps?: number | null;
|
|
36
|
+
}
|
|
37
|
+
export interface Realm {
|
|
38
|
+
id: RealmId;
|
|
39
|
+
orgId: OrgId;
|
|
40
|
+
name: string;
|
|
41
|
+
slug: string;
|
|
42
|
+
type: RealmType;
|
|
43
|
+
description: string | null;
|
|
44
|
+
settings?: RealmSettings | null;
|
|
45
|
+
archivedAt?: string | null;
|
|
46
|
+
createdBy?: UserId | null;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
}
|
|
50
|
+
export interface RealmListResponse {
|
|
51
|
+
realms: Realm[];
|
|
52
|
+
total: number;
|
|
53
|
+
}
|
|
54
|
+
export type ArcaObjectType = 'denominated' | 'exchange' | 'deposit' | 'withdrawal' | 'escrow';
|
|
55
|
+
export type ArcaObjectStatus = 'active' | 'deleting' | 'deleted';
|
|
56
|
+
export interface ArcaObject {
|
|
57
|
+
id: ObjectId;
|
|
58
|
+
realmId: RealmId;
|
|
59
|
+
path: string;
|
|
60
|
+
type: ArcaObjectType;
|
|
61
|
+
denomination: string | null;
|
|
62
|
+
status: ArcaObjectStatus;
|
|
63
|
+
metadata: string | null;
|
|
64
|
+
deletedAt: string | null;
|
|
65
|
+
systemOwned: boolean;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ArcaObjectListResponse {
|
|
70
|
+
objects: ArcaObject[];
|
|
71
|
+
total: number;
|
|
72
|
+
}
|
|
73
|
+
export interface ArcaObjectBrowseResponse {
|
|
74
|
+
prefix: string;
|
|
75
|
+
folders: string[];
|
|
76
|
+
objects: ArcaObject[];
|
|
77
|
+
}
|
|
78
|
+
export interface CreateArcaObjectResponse {
|
|
79
|
+
object: ArcaObject;
|
|
80
|
+
operation: Operation;
|
|
81
|
+
}
|
|
82
|
+
export interface DeleteArcaObjectResponse {
|
|
83
|
+
object: ArcaObject;
|
|
84
|
+
operation: Operation;
|
|
85
|
+
}
|
|
86
|
+
export interface ArcaPositionCurrent {
|
|
87
|
+
id: PositionId;
|
|
88
|
+
realmId: RealmId;
|
|
89
|
+
arcaId: ObjectId;
|
|
90
|
+
market: string;
|
|
91
|
+
side: string;
|
|
92
|
+
size: string;
|
|
93
|
+
leverage: number;
|
|
94
|
+
entryPrice?: string | null;
|
|
95
|
+
updatedAt: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ArcaObjectDetailResponse {
|
|
98
|
+
object: ArcaObject;
|
|
99
|
+
operations: Operation[];
|
|
100
|
+
events: ArcaEvent[];
|
|
101
|
+
deltas: StateDelta[];
|
|
102
|
+
balances: ArcaBalance[];
|
|
103
|
+
reservedBalances: ReservedBalance[];
|
|
104
|
+
positions: ArcaPositionCurrent[];
|
|
105
|
+
}
|
|
106
|
+
export type ReservedBalanceStatus = 'held' | 'released' | 'cancelled';
|
|
107
|
+
export interface ReservedBalance {
|
|
108
|
+
id: ReservedBalanceId;
|
|
109
|
+
arcaId: ObjectId;
|
|
110
|
+
operationId: OperationId;
|
|
111
|
+
denomination: string;
|
|
112
|
+
amount: string;
|
|
113
|
+
status: ReservedBalanceStatus;
|
|
114
|
+
direction: 'inbound' | 'outbound';
|
|
115
|
+
sourceArcaPath?: string | null;
|
|
116
|
+
destinationArcaPath?: string | null;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
updatedAt: string;
|
|
119
|
+
}
|
|
120
|
+
export interface ArcaObjectVersionsResponse {
|
|
121
|
+
versions: ArcaObject[];
|
|
122
|
+
}
|
|
123
|
+
export type OperationType = 'transfer' | 'create' | 'delete' | 'deposit' | 'withdrawal' | 'swap' | 'order' | 'cancel' | 'fee_distribution';
|
|
124
|
+
export type OperationState = 'pending' | 'completed' | 'failed' | 'expired';
|
|
125
|
+
export interface Operation {
|
|
126
|
+
id: OperationId;
|
|
127
|
+
realmId: RealmId;
|
|
128
|
+
path: string;
|
|
129
|
+
type: OperationType;
|
|
130
|
+
state: OperationState;
|
|
131
|
+
sourceArcaPath: string | null;
|
|
132
|
+
targetArcaPath: string | null;
|
|
133
|
+
input: string | null;
|
|
134
|
+
outcome: string | null;
|
|
135
|
+
actorType: string | null;
|
|
136
|
+
actorId: UserId | null;
|
|
137
|
+
tokenJti: string | null;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
updatedAt: string;
|
|
140
|
+
}
|
|
141
|
+
export interface OperationListResponse {
|
|
142
|
+
operations: Operation[];
|
|
143
|
+
total: number;
|
|
144
|
+
}
|
|
145
|
+
export interface OperationDetailResponse {
|
|
146
|
+
operation: Operation;
|
|
147
|
+
events: ArcaEvent[];
|
|
148
|
+
deltas: StateDelta[];
|
|
149
|
+
}
|
|
150
|
+
export interface ArcaEvent {
|
|
151
|
+
id: EventId;
|
|
152
|
+
realmId: RealmId;
|
|
153
|
+
operationId: OperationId | null;
|
|
154
|
+
arcaPath: string | null;
|
|
155
|
+
type: string;
|
|
156
|
+
path: string | null;
|
|
157
|
+
payload: string | null;
|
|
158
|
+
createdAt: string;
|
|
159
|
+
}
|
|
160
|
+
export interface EventListResponse {
|
|
161
|
+
events: ArcaEvent[];
|
|
162
|
+
total: number;
|
|
163
|
+
}
|
|
164
|
+
export interface EventDetailResponse {
|
|
165
|
+
event: ArcaEvent;
|
|
166
|
+
operation: Operation | null;
|
|
167
|
+
deltas: StateDelta[];
|
|
168
|
+
}
|
|
169
|
+
export type DeltaType = 'balance_change' | 'settlement_change' | 'position_change' | 'status_change' | 'hold_change' | 'creation' | 'deletion';
|
|
170
|
+
export interface StateDelta {
|
|
171
|
+
id: DeltaId;
|
|
172
|
+
realmId: RealmId;
|
|
173
|
+
eventId: EventId | null;
|
|
174
|
+
arcaPath: string;
|
|
175
|
+
deltaType: DeltaType;
|
|
176
|
+
beforeValue: string | null;
|
|
177
|
+
afterValue: string | null;
|
|
178
|
+
createdAt: string;
|
|
179
|
+
}
|
|
180
|
+
export interface StateDeltaListResponse {
|
|
181
|
+
deltas: StateDelta[];
|
|
182
|
+
total: number;
|
|
183
|
+
}
|
|
184
|
+
export interface ArcaBalance {
|
|
185
|
+
id: BalanceId;
|
|
186
|
+
arcaId: ObjectId;
|
|
187
|
+
denomination: string;
|
|
188
|
+
amount: string;
|
|
189
|
+
}
|
|
190
|
+
export interface ArcaBalanceListResponse {
|
|
191
|
+
balances: ArcaBalance[];
|
|
192
|
+
}
|
|
193
|
+
export interface InitiateDepositResponse {
|
|
194
|
+
operation: Operation;
|
|
195
|
+
/** Pool address for on-chain deposits (present when chain custody is active). */
|
|
196
|
+
poolAddress?: string;
|
|
197
|
+
/** Token contract address (e.g., USDC). */
|
|
198
|
+
tokenAddress?: string;
|
|
199
|
+
/** Chain identifier (e.g., "reth", "arbitrum"). */
|
|
200
|
+
chain?: string;
|
|
201
|
+
/** Intent expiration timestamp. */
|
|
202
|
+
expiresAt?: string;
|
|
203
|
+
}
|
|
204
|
+
export interface TransferResponse {
|
|
205
|
+
operation: Operation;
|
|
206
|
+
}
|
|
207
|
+
export interface NonceResponse {
|
|
208
|
+
nonce: number;
|
|
209
|
+
path: string;
|
|
210
|
+
}
|
|
211
|
+
export interface ExplorerSummary {
|
|
212
|
+
objectCount: number;
|
|
213
|
+
operationCount: number;
|
|
214
|
+
eventCount: number;
|
|
215
|
+
pendingOperationCount?: number;
|
|
216
|
+
expiredOperationCount?: number;
|
|
217
|
+
}
|
|
218
|
+
export interface CanonicalPosition {
|
|
219
|
+
id: PositionId;
|
|
220
|
+
realmId: RealmId;
|
|
221
|
+
arcaId: ObjectId;
|
|
222
|
+
market: string;
|
|
223
|
+
side: string;
|
|
224
|
+
size: string;
|
|
225
|
+
leverage: number;
|
|
226
|
+
updatedAt: string;
|
|
227
|
+
}
|
|
228
|
+
export interface SnapshotBalancesResponse {
|
|
229
|
+
realmId: string;
|
|
230
|
+
arcaId: string;
|
|
231
|
+
asOf: string;
|
|
232
|
+
balances: ArcaBalance[];
|
|
233
|
+
positions: CanonicalPosition[];
|
|
234
|
+
}
|
|
235
|
+
export interface AssetBreakdown {
|
|
236
|
+
asset: string;
|
|
237
|
+
category: 'spot' | 'perp' | 'exchange';
|
|
238
|
+
amount: string;
|
|
239
|
+
price: string | null;
|
|
240
|
+
valueUsd: string;
|
|
241
|
+
weightedAvgLeverage?: string | null;
|
|
242
|
+
avgEntryPrice?: string | null;
|
|
243
|
+
}
|
|
244
|
+
export interface BalanceValue {
|
|
245
|
+
denomination: string;
|
|
246
|
+
amount: string;
|
|
247
|
+
price: string | null;
|
|
248
|
+
valueUsd: string;
|
|
249
|
+
}
|
|
250
|
+
export interface PositionValue {
|
|
251
|
+
coin: string;
|
|
252
|
+
side: string;
|
|
253
|
+
size: string;
|
|
254
|
+
entryPrice: string;
|
|
255
|
+
markPrice: string | null;
|
|
256
|
+
unrealizedPnl: string;
|
|
257
|
+
valueUsd: string;
|
|
258
|
+
}
|
|
259
|
+
export interface ReservedValue {
|
|
260
|
+
denomination: string;
|
|
261
|
+
amount: string;
|
|
262
|
+
price: string | null;
|
|
263
|
+
valueUsd: string;
|
|
264
|
+
operationId: OperationId;
|
|
265
|
+
sourceArcaPath?: string | null;
|
|
266
|
+
destinationArcaPath?: string | null;
|
|
267
|
+
startedAt?: string | null;
|
|
268
|
+
inTransit?: boolean;
|
|
269
|
+
}
|
|
270
|
+
export interface ObjectValuation {
|
|
271
|
+
objectId: ObjectId;
|
|
272
|
+
path: string;
|
|
273
|
+
type: string;
|
|
274
|
+
denomination: string | null;
|
|
275
|
+
valueUsd: string;
|
|
276
|
+
balances: BalanceValue[];
|
|
277
|
+
reservedBalances: ReservedValue[];
|
|
278
|
+
pendingInbound?: ReservedValue[];
|
|
279
|
+
positions: PositionValue[] | null;
|
|
280
|
+
}
|
|
281
|
+
export interface PathAggregation {
|
|
282
|
+
prefix: string;
|
|
283
|
+
totalEquityUsd: string;
|
|
284
|
+
totalReservedUsd: string;
|
|
285
|
+
totalInTransitUsd?: string;
|
|
286
|
+
breakdown: AssetBreakdown[];
|
|
287
|
+
objects: ObjectValuation[];
|
|
288
|
+
asOf?: string;
|
|
289
|
+
}
|
|
290
|
+
export interface AggregationSourceDto {
|
|
291
|
+
type: 'prefix' | 'pattern' | 'paths' | 'watch';
|
|
292
|
+
value: string;
|
|
293
|
+
}
|
|
294
|
+
export interface CreateWatchResponse {
|
|
295
|
+
watchId: WatchId;
|
|
296
|
+
aggregation: PathAggregation;
|
|
297
|
+
}
|
|
298
|
+
export interface PnlResponse {
|
|
299
|
+
prefix: string;
|
|
300
|
+
from: string;
|
|
301
|
+
to: string;
|
|
302
|
+
startingEquityUsd: string;
|
|
303
|
+
endingEquityUsd: string;
|
|
304
|
+
netInflowsUsd: string;
|
|
305
|
+
netOutflowsUsd: string;
|
|
306
|
+
pnlUsd: string;
|
|
307
|
+
externalFlows: ExternalFlowEntry[];
|
|
308
|
+
}
|
|
309
|
+
export interface ExternalFlowEntry {
|
|
310
|
+
operationId: OperationId;
|
|
311
|
+
type: string;
|
|
312
|
+
direction: string;
|
|
313
|
+
amount: string;
|
|
314
|
+
denomination: string;
|
|
315
|
+
valueUsd: string;
|
|
316
|
+
sourceArcaPath: string | null;
|
|
317
|
+
targetArcaPath: string | null;
|
|
318
|
+
timestamp: string;
|
|
319
|
+
}
|
|
320
|
+
export interface EquityHistoryResponse {
|
|
321
|
+
prefix: string;
|
|
322
|
+
from: string;
|
|
323
|
+
to: string;
|
|
324
|
+
points: number;
|
|
325
|
+
equityPoints: EquityPoint[];
|
|
326
|
+
}
|
|
327
|
+
export interface EquityPoint {
|
|
328
|
+
timestamp: string;
|
|
329
|
+
equityUsd: string;
|
|
330
|
+
}
|
|
331
|
+
export interface EquityLookbackResponse {
|
|
332
|
+
range: string;
|
|
333
|
+
points: EquityPoint[];
|
|
334
|
+
}
|
|
335
|
+
export interface ReconciliationState {
|
|
336
|
+
id: ReconciliationId;
|
|
337
|
+
realmId: RealmId;
|
|
338
|
+
arcaId: ObjectId;
|
|
339
|
+
venue: string;
|
|
340
|
+
expectedBalanceUsd: string;
|
|
341
|
+
venueReportedUsd: string;
|
|
342
|
+
expectedPositionsJson: string | null;
|
|
343
|
+
venuePositionsJson: string | null;
|
|
344
|
+
lastSeenVenueHash: string | null;
|
|
345
|
+
driftDetectedAt: string | null;
|
|
346
|
+
lastReconciledAt: string | null;
|
|
347
|
+
updatedAt: string;
|
|
348
|
+
}
|
|
349
|
+
export interface ReconciliationStateListResponse {
|
|
350
|
+
items: ReconciliationState[];
|
|
351
|
+
total: number;
|
|
352
|
+
}
|
|
353
|
+
export interface BuilderProfile {
|
|
354
|
+
id: UserId;
|
|
355
|
+
email: string;
|
|
356
|
+
orgName: string;
|
|
357
|
+
orgId?: OrgId;
|
|
358
|
+
role?: OrgRole;
|
|
359
|
+
isPlatformAdmin?: boolean;
|
|
360
|
+
}
|
|
361
|
+
export type OrgRole = 'owner' | 'admin' | 'developer' | 'viewer';
|
|
362
|
+
export type MemberType = 'user' | 'service_account';
|
|
363
|
+
export type InvitationStatus = 'pending' | 'accepted' | 'expired' | 'revoked';
|
|
364
|
+
export interface Organization {
|
|
365
|
+
id: OrgId;
|
|
366
|
+
name: string;
|
|
367
|
+
slug: string;
|
|
368
|
+
createdBy: UserId;
|
|
369
|
+
createdAt: string;
|
|
370
|
+
updatedAt: string;
|
|
371
|
+
}
|
|
372
|
+
export interface MyOrgMembership {
|
|
373
|
+
orgId: OrgId;
|
|
374
|
+
orgName: string;
|
|
375
|
+
orgSlug: string;
|
|
376
|
+
role: OrgRole;
|
|
377
|
+
realmTypeScope?: RealmType[];
|
|
378
|
+
}
|
|
379
|
+
export interface OrgMember {
|
|
380
|
+
id: OrgMemberId;
|
|
381
|
+
orgId: OrgId;
|
|
382
|
+
userId: UserId;
|
|
383
|
+
email?: string;
|
|
384
|
+
memberType: MemberType;
|
|
385
|
+
role: OrgRole;
|
|
386
|
+
realmTypeScope?: RealmType[];
|
|
387
|
+
invitedBy?: string;
|
|
388
|
+
createdAt: string;
|
|
389
|
+
}
|
|
390
|
+
export interface OrgMemberListResponse {
|
|
391
|
+
members: OrgMember[];
|
|
392
|
+
total: number;
|
|
393
|
+
}
|
|
394
|
+
export interface Invitation {
|
|
395
|
+
id: InvitationId;
|
|
396
|
+
orgId: OrgId;
|
|
397
|
+
orgName?: string;
|
|
398
|
+
email: string;
|
|
399
|
+
role: OrgRole;
|
|
400
|
+
realmTypeScope?: RealmType[];
|
|
401
|
+
status: InvitationStatus;
|
|
402
|
+
expiresAt: string;
|
|
403
|
+
invitedBy: UserId;
|
|
404
|
+
inviteLink?: string;
|
|
405
|
+
createdAt: string;
|
|
406
|
+
}
|
|
407
|
+
export interface InvitationListResponse {
|
|
408
|
+
invitations: Invitation[];
|
|
409
|
+
total: number;
|
|
410
|
+
}
|
|
411
|
+
export interface InvitationPreview {
|
|
412
|
+
orgName: string;
|
|
413
|
+
email: string;
|
|
414
|
+
role: OrgRole;
|
|
415
|
+
status: InvitationStatus;
|
|
416
|
+
expiresAt: string;
|
|
417
|
+
}
|
|
418
|
+
export interface InviteMemberRequest {
|
|
419
|
+
email: string;
|
|
420
|
+
role: OrgRole;
|
|
421
|
+
realmTypeScope?: RealmType[];
|
|
422
|
+
}
|
|
423
|
+
export interface UpdateMemberRequest {
|
|
424
|
+
role?: OrgRole;
|
|
425
|
+
realmTypeScope?: RealmType[];
|
|
426
|
+
}
|
|
427
|
+
export interface AuthResponse {
|
|
428
|
+
token: string;
|
|
429
|
+
refreshToken?: string;
|
|
430
|
+
expiresAt: string;
|
|
431
|
+
builder: BuilderProfile;
|
|
432
|
+
}
|
|
433
|
+
export interface RefreshResponse {
|
|
434
|
+
token: string;
|
|
435
|
+
refreshToken: string;
|
|
436
|
+
expiresAt: string;
|
|
437
|
+
}
|
|
438
|
+
export type ApiKeyStatus = 'active' | 'revoked';
|
|
439
|
+
export interface ApiKey {
|
|
440
|
+
id: ApiKeyId;
|
|
441
|
+
builderId: UserId;
|
|
442
|
+
name: string;
|
|
443
|
+
keyPrefix: string;
|
|
444
|
+
status: ApiKeyStatus;
|
|
445
|
+
createdAt: string;
|
|
446
|
+
revokedAt: string | null;
|
|
447
|
+
updatedAt: string;
|
|
448
|
+
}
|
|
449
|
+
export interface ApiKeyCreatedResponse {
|
|
450
|
+
apiKey: ApiKey;
|
|
451
|
+
rawKey: string;
|
|
452
|
+
}
|
|
453
|
+
export interface ApiKeyListResponse {
|
|
454
|
+
apiKeys: ApiKey[];
|
|
455
|
+
total: number;
|
|
456
|
+
}
|
|
457
|
+
export interface BrowseObjectsOptions {
|
|
458
|
+
prefix?: string;
|
|
459
|
+
includeDeleted?: boolean;
|
|
460
|
+
}
|
|
461
|
+
/** Effect of a policy statement. */
|
|
462
|
+
export type PolicyEffect = 'Allow' | 'Deny';
|
|
463
|
+
/**
|
|
464
|
+
* A single policy statement with an effect, actions, and resource patterns.
|
|
465
|
+
* Used in scoped tokens and scoped API keys.
|
|
466
|
+
*
|
|
467
|
+
* - `Allow` (default) grants the listed actions on the listed resources.
|
|
468
|
+
* - `Deny` explicitly blocks them, **overriding any Allow statements**.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* // Allow transfers within a user's subtree
|
|
473
|
+
* const allow: PolicyStatement = {
|
|
474
|
+
* effect: 'Allow',
|
|
475
|
+
* actions: ['arca:TransferFrom', 'arca:ReceiveTo'],
|
|
476
|
+
* resources: ['/users/u123/*'],
|
|
477
|
+
* };
|
|
478
|
+
*
|
|
479
|
+
* // Safety rail: deny everything on internal paths
|
|
480
|
+
* const deny: PolicyStatement = {
|
|
481
|
+
* effect: 'Deny',
|
|
482
|
+
* actions: ['arca:*'],
|
|
483
|
+
* resources: ['/_internal/*'],
|
|
484
|
+
* };
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
export interface PolicyStatement {
|
|
488
|
+
/** 'Allow' (default) or 'Deny'. Deny always overrides Allow. */
|
|
489
|
+
effect?: PolicyEffect;
|
|
490
|
+
/** Actions to grant or deny (e.g. 'arca:TransferFrom', 'arca:Read', 'arca:*') */
|
|
491
|
+
actions: string[];
|
|
492
|
+
/** Resource path patterns (e.g. '/users/*', '*') */
|
|
493
|
+
resources: string[];
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* IAM-style scope containing policy statements.
|
|
497
|
+
* Each statement grants a set of actions on a set of resources.
|
|
498
|
+
* Default: read-only on all resources.
|
|
499
|
+
*/
|
|
500
|
+
export interface TokenScope {
|
|
501
|
+
statements: PolicyStatement[];
|
|
502
|
+
}
|
|
503
|
+
/** Entry in the action catalog returned by GET /api/v1/permissions */
|
|
504
|
+
export interface ActionCatalogEntry {
|
|
505
|
+
action: string;
|
|
506
|
+
description: string;
|
|
507
|
+
category: string;
|
|
508
|
+
}
|
|
509
|
+
/** Alias entry in the action catalog */
|
|
510
|
+
export interface AliasCatalogEntry {
|
|
511
|
+
alias: string;
|
|
512
|
+
expandsTo: string[];
|
|
513
|
+
}
|
|
514
|
+
/** Response from GET /api/v1/permissions */
|
|
515
|
+
export interface PermissionCatalogResponse {
|
|
516
|
+
actions: ActionCatalogEntry[];
|
|
517
|
+
aliases: AliasCatalogEntry[];
|
|
518
|
+
}
|
|
519
|
+
export interface InvariantViolation {
|
|
520
|
+
entityId: string | null;
|
|
521
|
+
message: string;
|
|
522
|
+
}
|
|
523
|
+
export interface InvariantCheckResult {
|
|
524
|
+
id: string;
|
|
525
|
+
passed: boolean;
|
|
526
|
+
violationCount: number;
|
|
527
|
+
violations: InvariantViolation[];
|
|
528
|
+
}
|
|
529
|
+
export interface InvariantCheckResponse {
|
|
530
|
+
allPassed: boolean;
|
|
531
|
+
results: InvariantCheckResult[];
|
|
532
|
+
}
|
|
533
|
+
/** Configuration using an API key (backend/programmatic use). */
|
|
534
|
+
export interface ArcaApiKeyConfig {
|
|
535
|
+
/** API key (format: arca_<prefix>_<secret>) */
|
|
536
|
+
apiKey: string;
|
|
537
|
+
/** Realm slug or UUID */
|
|
538
|
+
realm: string;
|
|
539
|
+
/** Base URL of the Arca API. Defaults to https://api.arcaos.io */
|
|
540
|
+
baseUrl?: string;
|
|
541
|
+
}
|
|
542
|
+
/** Configuration using a scoped token (frontend/end-user use). */
|
|
543
|
+
export interface ArcaTokenConfig {
|
|
544
|
+
/** Scoped JWT token issued by the builder's backend via POST /auth/token */
|
|
545
|
+
token: string;
|
|
546
|
+
/** Realm slug, UUID, or omit to use the realm embedded in the token */
|
|
547
|
+
realm?: string;
|
|
548
|
+
/** Base URL of the Arca API. Defaults to https://api.arcaos.io */
|
|
549
|
+
baseUrl?: string;
|
|
550
|
+
}
|
|
551
|
+
/** SDK configuration — pass either an API key or a scoped token. */
|
|
552
|
+
export type ArcaConfig = ArcaApiKeyConfig | ArcaTokenConfig;
|
|
553
|
+
export interface CreateDenominatedArcaOptions {
|
|
554
|
+
/** Full Arca path (e.g. /users/u123/usd/main) */
|
|
555
|
+
ref: string;
|
|
556
|
+
/** Denomination (e.g. USD, BTC) */
|
|
557
|
+
denomination: string;
|
|
558
|
+
/** Optional metadata */
|
|
559
|
+
metadata?: string;
|
|
560
|
+
/** Optional operation path (idempotency key). Use nonce API with separator ":" to generate. */
|
|
561
|
+
operationPath?: string;
|
|
562
|
+
}
|
|
563
|
+
/** @deprecated Use CreateDenominatedArcaOptions instead */
|
|
564
|
+
export type EnsureDenominatedArcaOptions = CreateDenominatedArcaOptions;
|
|
565
|
+
export interface CreateArcaOptions {
|
|
566
|
+
/** Full Arca path */
|
|
567
|
+
ref: string;
|
|
568
|
+
/** Arca object type */
|
|
569
|
+
type: 'denominated' | 'exchange' | 'deposit' | 'withdrawal' | 'escrow';
|
|
570
|
+
/** Denomination (required for denominated type) */
|
|
571
|
+
denomination?: string;
|
|
572
|
+
/** Optional metadata */
|
|
573
|
+
metadata?: string;
|
|
574
|
+
/** Optional operation path (idempotency key). Use nonce API with separator ":" to generate. */
|
|
575
|
+
operationPath?: string;
|
|
576
|
+
}
|
|
577
|
+
export interface EnsureDeletedOptions {
|
|
578
|
+
/** Full Arca path to delete */
|
|
579
|
+
ref: string;
|
|
580
|
+
/** Optional path of the Arca to sweep remaining funds into */
|
|
581
|
+
sweepTo?: string;
|
|
582
|
+
/** Liquidate all exchange positions before deletion (exchange objects only) */
|
|
583
|
+
liquidatePositions?: boolean;
|
|
584
|
+
/** Operation path (idempotency key). Auto-generated if not provided. */
|
|
585
|
+
operationPath?: string;
|
|
586
|
+
}
|
|
587
|
+
export interface TransferOptions {
|
|
588
|
+
/** Operation path (idempotency key) */
|
|
589
|
+
path: string;
|
|
590
|
+
/** Source Arca path */
|
|
591
|
+
from: string;
|
|
592
|
+
/** Target Arca path */
|
|
593
|
+
to: string;
|
|
594
|
+
/** Amount as decimal string */
|
|
595
|
+
amount: string;
|
|
596
|
+
}
|
|
597
|
+
export interface DepositOptions {
|
|
598
|
+
/** Target Arca path */
|
|
599
|
+
arcaRef: string;
|
|
600
|
+
/** Amount as decimal string */
|
|
601
|
+
amount: string;
|
|
602
|
+
/** Operation path for idempotency. If provided, duplicate calls return the existing operation. */
|
|
603
|
+
path?: string;
|
|
604
|
+
/** Sender wallet address (optional, used for on-chain deposit matching). */
|
|
605
|
+
senderAddress?: string;
|
|
606
|
+
}
|
|
607
|
+
export interface WithdrawalOptions {
|
|
608
|
+
/** Source Arca path to withdraw from */
|
|
609
|
+
arcaPath: string;
|
|
610
|
+
/** Amount as decimal string */
|
|
611
|
+
amount: string;
|
|
612
|
+
/** Destination on-chain address. If omitted, tokens are burned (demo/sim mode). */
|
|
613
|
+
destinationAddress?: string;
|
|
614
|
+
/** Operation path for idempotency */
|
|
615
|
+
path?: string;
|
|
616
|
+
}
|
|
617
|
+
export interface InitiateWithdrawalResponse {
|
|
618
|
+
operation: Operation;
|
|
619
|
+
txHash?: string;
|
|
620
|
+
}
|
|
621
|
+
export interface ListObjectsOptions {
|
|
622
|
+
/** Path prefix to filter */
|
|
623
|
+
prefix?: string;
|
|
624
|
+
/** Include deleted objects */
|
|
625
|
+
includeDeleted?: boolean;
|
|
626
|
+
}
|
|
627
|
+
export interface ListOperationsOptions {
|
|
628
|
+
/** Filter by operation type */
|
|
629
|
+
type?: OperationType;
|
|
630
|
+
/** Filter by source or target arca path */
|
|
631
|
+
arcaPath?: string;
|
|
632
|
+
/** Filter by operation path prefix */
|
|
633
|
+
path?: string;
|
|
634
|
+
}
|
|
635
|
+
export interface ListEventsOptions {
|
|
636
|
+
/** Filter by arca path */
|
|
637
|
+
arcaPath?: string;
|
|
638
|
+
/** Filter by event path prefix */
|
|
639
|
+
path?: string;
|
|
640
|
+
}
|
|
641
|
+
export type EventConnectionStatus = 'connecting' | 'connected' | 'disconnected';
|
|
642
|
+
/** All event types emitted by the Arca WebSocket stream. */
|
|
643
|
+
export declare const EventType: {
|
|
644
|
+
readonly OperationCreated: "operation.created";
|
|
645
|
+
readonly OperationUpdated: "operation.updated";
|
|
646
|
+
readonly EventCreated: "event.created";
|
|
647
|
+
readonly ObjectCreated: "object.created";
|
|
648
|
+
readonly ObjectUpdated: "object.updated";
|
|
649
|
+
readonly ObjectDeleted: "object.deleted";
|
|
650
|
+
readonly BalanceUpdated: "balance.updated";
|
|
651
|
+
readonly ExchangeUpdated: "exchange.updated";
|
|
652
|
+
readonly AggregationUpdated: "aggregation.updated";
|
|
653
|
+
readonly MidsUpdated: "mids.updated";
|
|
654
|
+
readonly RealmCreated: "realm.created";
|
|
655
|
+
readonly AgentText: "agent.text";
|
|
656
|
+
readonly AgentToolUse: "agent.tool_use";
|
|
657
|
+
readonly AgentPlan: "agent.plan";
|
|
658
|
+
readonly AgentConversationLog: "agent.conversation_log";
|
|
659
|
+
readonly AgentDone: "agent.done";
|
|
660
|
+
readonly AgentStepUpdated: "agent.step_updated";
|
|
661
|
+
readonly AgentExecutionDone: "agent.execution_done";
|
|
662
|
+
};
|
|
663
|
+
export type EventType = (typeof EventType)[keyof typeof EventType];
|
|
664
|
+
/** Channel groups for WebSocket subscriptions. */
|
|
665
|
+
export declare const Channel: {
|
|
666
|
+
readonly Operations: "operations";
|
|
667
|
+
readonly Balances: "balances";
|
|
668
|
+
readonly Exchange: "exchange";
|
|
669
|
+
readonly Objects: "objects";
|
|
670
|
+
readonly Events: "events";
|
|
671
|
+
readonly Aggregation: "aggregation";
|
|
672
|
+
readonly Agent: "agent";
|
|
673
|
+
};
|
|
674
|
+
export type Channel = (typeof Channel)[keyof typeof Channel];
|
|
675
|
+
interface BaseRealmEvent {
|
|
676
|
+
realmId: string;
|
|
677
|
+
entityId: string;
|
|
678
|
+
entityPath: string;
|
|
679
|
+
summary?: ExplorerSummary;
|
|
680
|
+
}
|
|
681
|
+
export interface OperationCreatedEvent extends BaseRealmEvent {
|
|
682
|
+
type: typeof EventType.OperationCreated;
|
|
683
|
+
operation: Operation;
|
|
684
|
+
}
|
|
685
|
+
export interface OperationUpdatedEvent extends BaseRealmEvent {
|
|
686
|
+
type: typeof EventType.OperationUpdated;
|
|
687
|
+
operation: Operation;
|
|
688
|
+
}
|
|
689
|
+
export interface EventCreatedEvent extends BaseRealmEvent {
|
|
690
|
+
type: typeof EventType.EventCreated;
|
|
691
|
+
event: ArcaEvent;
|
|
692
|
+
}
|
|
693
|
+
export interface ObjectCreatedEvent extends BaseRealmEvent {
|
|
694
|
+
type: typeof EventType.ObjectCreated;
|
|
695
|
+
object?: ArcaObject;
|
|
696
|
+
}
|
|
697
|
+
export interface ObjectUpdatedEvent extends BaseRealmEvent {
|
|
698
|
+
type: typeof EventType.ObjectUpdated;
|
|
699
|
+
object?: ArcaObject;
|
|
700
|
+
}
|
|
701
|
+
export interface ObjectDeletedEvent extends BaseRealmEvent {
|
|
702
|
+
type: typeof EventType.ObjectDeleted;
|
|
703
|
+
}
|
|
704
|
+
export interface BalanceUpdatedEvent extends BaseRealmEvent {
|
|
705
|
+
type: typeof EventType.BalanceUpdated;
|
|
706
|
+
}
|
|
707
|
+
export interface ExchangeUpdatedEvent extends BaseRealmEvent {
|
|
708
|
+
type: typeof EventType.ExchangeUpdated;
|
|
709
|
+
exchangeState: ExchangeState;
|
|
710
|
+
}
|
|
711
|
+
export interface AggregationUpdatedEvent extends BaseRealmEvent {
|
|
712
|
+
type: typeof EventType.AggregationUpdated;
|
|
713
|
+
aggregation?: PathAggregation;
|
|
714
|
+
}
|
|
715
|
+
export interface MidsUpdatedEvent {
|
|
716
|
+
type: typeof EventType.MidsUpdated;
|
|
717
|
+
mids: Record<string, string>;
|
|
718
|
+
}
|
|
719
|
+
export interface RealmCreatedEvent {
|
|
720
|
+
type: typeof EventType.RealmCreated;
|
|
721
|
+
realm: Realm;
|
|
722
|
+
}
|
|
723
|
+
export interface AgentTextEvent {
|
|
724
|
+
type: typeof EventType.AgentText;
|
|
725
|
+
chatId: string;
|
|
726
|
+
content: string;
|
|
727
|
+
}
|
|
728
|
+
export interface AgentToolUseEvent {
|
|
729
|
+
type: typeof EventType.AgentToolUse;
|
|
730
|
+
chatId: string;
|
|
731
|
+
tool: string;
|
|
732
|
+
input: Record<string, unknown>;
|
|
733
|
+
}
|
|
734
|
+
export interface AgentPlanEvent {
|
|
735
|
+
type: typeof EventType.AgentPlan;
|
|
736
|
+
chatId: string;
|
|
737
|
+
summary: string;
|
|
738
|
+
steps: AgentPlanStep[];
|
|
739
|
+
}
|
|
740
|
+
export interface AgentPlanStep {
|
|
741
|
+
id: string;
|
|
742
|
+
description: string;
|
|
743
|
+
operation: string;
|
|
744
|
+
params: Record<string, unknown>;
|
|
745
|
+
dependsOn?: string[];
|
|
746
|
+
}
|
|
747
|
+
export interface AgentConversationLogEvent {
|
|
748
|
+
type: typeof EventType.AgentConversationLog;
|
|
749
|
+
chatId: string;
|
|
750
|
+
log: Record<string, unknown>;
|
|
751
|
+
}
|
|
752
|
+
export interface AgentDoneEvent {
|
|
753
|
+
type: typeof EventType.AgentDone;
|
|
754
|
+
chatId: string;
|
|
755
|
+
}
|
|
756
|
+
export interface AgentStepUpdatedEvent {
|
|
757
|
+
type: typeof EventType.AgentStepUpdated;
|
|
758
|
+
chatId: string;
|
|
759
|
+
stepId: string;
|
|
760
|
+
status: string;
|
|
761
|
+
error?: string;
|
|
762
|
+
operationId?: string;
|
|
763
|
+
resolvedSize?: string;
|
|
764
|
+
}
|
|
765
|
+
export interface AgentExecutionDoneEvent {
|
|
766
|
+
type: typeof EventType.AgentExecutionDone;
|
|
767
|
+
chatId: string;
|
|
768
|
+
}
|
|
769
|
+
export type AgentEvent = AgentTextEvent | AgentToolUseEvent | AgentPlanEvent | AgentConversationLogEvent | AgentDoneEvent | AgentStepUpdatedEvent | AgentExecutionDoneEvent;
|
|
770
|
+
export type TypedRealmEvent = OperationCreatedEvent | OperationUpdatedEvent | EventCreatedEvent | ObjectCreatedEvent | ObjectUpdatedEvent | ObjectDeletedEvent | BalanceUpdatedEvent | ExchangeUpdatedEvent | AggregationUpdatedEvent | MidsUpdatedEvent | RealmCreatedEvent;
|
|
771
|
+
export interface EventSubscriptionOptions {
|
|
772
|
+
/** Optional path prefix to filter events client-side */
|
|
773
|
+
prefix?: string;
|
|
774
|
+
/** Called when connection status changes */
|
|
775
|
+
onStatus?: (status: EventConnectionStatus) => void;
|
|
776
|
+
}
|
|
777
|
+
/** Realm event from the WebSocket stream (untyped union -- prefer TypedRealmEvent). */
|
|
778
|
+
export interface RealmEvent {
|
|
779
|
+
realmId: string;
|
|
780
|
+
type: string;
|
|
781
|
+
entityId: string;
|
|
782
|
+
entityPath: string;
|
|
783
|
+
aggregation?: PathAggregation | Record<string, unknown>;
|
|
784
|
+
summary?: ExplorerSummary | Record<string, unknown>;
|
|
785
|
+
operation?: Operation;
|
|
786
|
+
event?: ArcaEvent;
|
|
787
|
+
object?: ArcaObject;
|
|
788
|
+
mids?: Record<string, string>;
|
|
789
|
+
exchangeState?: ExchangeState;
|
|
790
|
+
realm?: Realm;
|
|
791
|
+
coin?: string;
|
|
792
|
+
interval?: CandleInterval;
|
|
793
|
+
candle?: Candle;
|
|
794
|
+
}
|
|
795
|
+
export type EventCallback = (event: RealmEvent) => void;
|
|
796
|
+
export interface EventSubscription {
|
|
797
|
+
close(): void;
|
|
798
|
+
}
|
|
799
|
+
export interface CreatePerpsExchangeOptions {
|
|
800
|
+
/** Full Arca path (e.g. /exchanges/hl1) */
|
|
801
|
+
ref: string;
|
|
802
|
+
/** Exchange provider. Currently only 'hyperliquid'. */
|
|
803
|
+
exchangeType?: 'hyperliquid';
|
|
804
|
+
/** Optional operation path (idempotency key) */
|
|
805
|
+
operationPath?: string;
|
|
806
|
+
}
|
|
807
|
+
export interface FeeTarget {
|
|
808
|
+
/** Path of the Arca to receive a share of the builder fee */
|
|
809
|
+
arcaPath: string;
|
|
810
|
+
/** Percentage of the distributable fee (1-100, must sum to <= 100) */
|
|
811
|
+
percentage: number;
|
|
812
|
+
}
|
|
813
|
+
export interface PlaceOrderOptions {
|
|
814
|
+
/** Operation path (idempotency key) */
|
|
815
|
+
path: string;
|
|
816
|
+
/** Exchange Arca object ID */
|
|
817
|
+
objectId: string;
|
|
818
|
+
/** Coin/asset to trade (e.g. BTC, ETH) */
|
|
819
|
+
coin: string;
|
|
820
|
+
/** Order side */
|
|
821
|
+
side: 'BUY' | 'SELL';
|
|
822
|
+
/** Order type */
|
|
823
|
+
orderType: 'MARKET' | 'LIMIT';
|
|
824
|
+
/** Order size as decimal string */
|
|
825
|
+
size: string;
|
|
826
|
+
/** Size denomination: 'token' (default) or 'usd' */
|
|
827
|
+
szDenom?: 'token' | 'usd';
|
|
828
|
+
/** Limit price (required for LIMIT orders) */
|
|
829
|
+
price?: string;
|
|
830
|
+
/** Leverage multiplier (default: 1) */
|
|
831
|
+
leverage?: number;
|
|
832
|
+
/** If true, only reduces an existing position */
|
|
833
|
+
reduceOnly?: boolean;
|
|
834
|
+
/** Time in force (default: GTC) */
|
|
835
|
+
timeInForce?: 'GTC' | 'IOC' | 'ALO';
|
|
836
|
+
/** Builder fee in tenths of a basis point (e.g. 45 = 4.5 bps). Additive to base exchange fee. */
|
|
837
|
+
builderFeeBps?: number;
|
|
838
|
+
/** Fee routing targets. Percentage-based splits of the distributable builder fee. */
|
|
839
|
+
feeTargets?: FeeTarget[];
|
|
840
|
+
}
|
|
841
|
+
export interface CancelOrderOptions {
|
|
842
|
+
/** Operation path (idempotency key) */
|
|
843
|
+
path: string;
|
|
844
|
+
/** Exchange Arca object ID */
|
|
845
|
+
objectId: string;
|
|
846
|
+
/** ID of the order to cancel */
|
|
847
|
+
orderId: string;
|
|
848
|
+
}
|
|
849
|
+
export interface OrderOperationResponse {
|
|
850
|
+
operation: Operation;
|
|
851
|
+
}
|
|
852
|
+
export interface SimAccount {
|
|
853
|
+
id: SimAccountId;
|
|
854
|
+
realmId: RealmId;
|
|
855
|
+
name: string;
|
|
856
|
+
usdBalance: string;
|
|
857
|
+
createdAt: string;
|
|
858
|
+
updatedAt: string;
|
|
859
|
+
}
|
|
860
|
+
export interface SimMarginSummary {
|
|
861
|
+
accountValue: string;
|
|
862
|
+
totalNtlPos: string;
|
|
863
|
+
totalMarginUsed: string;
|
|
864
|
+
withdrawable: string;
|
|
865
|
+
totalUnrealizedPnl: string;
|
|
866
|
+
totalRawUsd?: string;
|
|
867
|
+
}
|
|
868
|
+
export interface SimPosition {
|
|
869
|
+
id: SimPositionId;
|
|
870
|
+
accountId: SimAccountId;
|
|
871
|
+
realmId: RealmId;
|
|
872
|
+
coin: string;
|
|
873
|
+
side: string;
|
|
874
|
+
size: string;
|
|
875
|
+
entryPrice: string;
|
|
876
|
+
leverage: number;
|
|
877
|
+
marginUsed: string;
|
|
878
|
+
liquidationPrice: string | null;
|
|
879
|
+
unrealizedPnl: string | null;
|
|
880
|
+
createdAt: string;
|
|
881
|
+
updatedAt: string;
|
|
882
|
+
}
|
|
883
|
+
export interface SimOrder {
|
|
884
|
+
id: SimOrderId;
|
|
885
|
+
accountId: SimAccountId;
|
|
886
|
+
realmId: RealmId;
|
|
887
|
+
coin: string;
|
|
888
|
+
side: string;
|
|
889
|
+
orderType: string;
|
|
890
|
+
price: string | null;
|
|
891
|
+
size: string;
|
|
892
|
+
filledSize: string;
|
|
893
|
+
avgFillPrice: string | null;
|
|
894
|
+
status: string;
|
|
895
|
+
reduceOnly: boolean;
|
|
896
|
+
timeInForce: string;
|
|
897
|
+
leverage: number;
|
|
898
|
+
/** Builder fee in tenths of a basis point (e.g. 45 = 4.5 bps) */
|
|
899
|
+
builderFeeBps?: number | null;
|
|
900
|
+
createdAt: string;
|
|
901
|
+
updatedAt: string;
|
|
902
|
+
}
|
|
903
|
+
export interface SimFill {
|
|
904
|
+
id: SimFillId;
|
|
905
|
+
orderId: SimOrderId;
|
|
906
|
+
accountId: SimAccountId;
|
|
907
|
+
realmId: RealmId;
|
|
908
|
+
coin: string;
|
|
909
|
+
side: string;
|
|
910
|
+
price: string;
|
|
911
|
+
size: string;
|
|
912
|
+
fee: string;
|
|
913
|
+
builderFee?: string;
|
|
914
|
+
realizedPnl: string | null;
|
|
915
|
+
isLiquidation: boolean;
|
|
916
|
+
createdAt: string;
|
|
917
|
+
}
|
|
918
|
+
export interface SimFeeTierEntry {
|
|
919
|
+
tier: number;
|
|
920
|
+
label: string;
|
|
921
|
+
minVolume14d: number;
|
|
922
|
+
takerBps: number;
|
|
923
|
+
makerBps: number;
|
|
924
|
+
}
|
|
925
|
+
export interface SimFeeRates {
|
|
926
|
+
taker: string;
|
|
927
|
+
maker: string;
|
|
928
|
+
platformFee?: string;
|
|
929
|
+
tier?: number;
|
|
930
|
+
tierLabel?: string;
|
|
931
|
+
volume14d?: string;
|
|
932
|
+
schedule?: SimFeeTierEntry[];
|
|
933
|
+
}
|
|
934
|
+
export interface ExchangeState {
|
|
935
|
+
account: SimAccount;
|
|
936
|
+
marginSummary: SimMarginSummary;
|
|
937
|
+
positions: SimPosition[];
|
|
938
|
+
openOrders: SimOrder[];
|
|
939
|
+
feeRates?: SimFeeRates | null;
|
|
940
|
+
}
|
|
941
|
+
export interface SimOrderWithFills {
|
|
942
|
+
order: SimOrder;
|
|
943
|
+
fills: SimFill[];
|
|
944
|
+
}
|
|
945
|
+
export interface ActiveAssetData {
|
|
946
|
+
/** Coin/asset (e.g. BTC, ETH) */
|
|
947
|
+
coin: string;
|
|
948
|
+
/** Current leverage setting */
|
|
949
|
+
leverage: {
|
|
950
|
+
type: string;
|
|
951
|
+
value: number;
|
|
952
|
+
};
|
|
953
|
+
/** Max trade sizes in tokens: [max sell (negative), max buy (positive)] */
|
|
954
|
+
maxTradeSzs: [string, string];
|
|
955
|
+
/** Max trade sizes in USD: [sell USD, buy USD] */
|
|
956
|
+
availableToTrade: [string, string];
|
|
957
|
+
/** Current mark price */
|
|
958
|
+
markPx: string;
|
|
959
|
+
/** Effective fee rate as a decimal */
|
|
960
|
+
feeRate: string;
|
|
961
|
+
}
|
|
962
|
+
export interface UpdateLeverageOptions {
|
|
963
|
+
/** Exchange Arca object ID */
|
|
964
|
+
objectId: string;
|
|
965
|
+
/** Coin/asset to set leverage for (e.g. BTC, ETH) */
|
|
966
|
+
coin: string;
|
|
967
|
+
/** Leverage multiplier (1 to maxLeverage for the asset) */
|
|
968
|
+
leverage: number;
|
|
969
|
+
}
|
|
970
|
+
export interface UpdateLeverageResponse {
|
|
971
|
+
accountId: string;
|
|
972
|
+
coin: string;
|
|
973
|
+
leverage: number;
|
|
974
|
+
previousLeverage: number;
|
|
975
|
+
}
|
|
976
|
+
export interface LeverageSetting {
|
|
977
|
+
coin: string;
|
|
978
|
+
leverage: number;
|
|
979
|
+
}
|
|
980
|
+
export interface SimMetaAsset {
|
|
981
|
+
name: string;
|
|
982
|
+
index: number;
|
|
983
|
+
szDecimals: number;
|
|
984
|
+
maxLeverage: number;
|
|
985
|
+
onlyIsolated: boolean;
|
|
986
|
+
}
|
|
987
|
+
export interface SimMetaResponse {
|
|
988
|
+
universe: SimMetaAsset[];
|
|
989
|
+
}
|
|
990
|
+
export interface SimMidsResponse {
|
|
991
|
+
mids: Record<string, string>;
|
|
992
|
+
}
|
|
993
|
+
export interface SimBookLevel {
|
|
994
|
+
price: string;
|
|
995
|
+
size: string;
|
|
996
|
+
orderCount: number;
|
|
997
|
+
}
|
|
998
|
+
export interface SimBookResponse {
|
|
999
|
+
coin: string;
|
|
1000
|
+
bids: SimBookLevel[];
|
|
1001
|
+
asks: SimBookLevel[];
|
|
1002
|
+
time: number;
|
|
1003
|
+
}
|
|
1004
|
+
export type CandleInterval = '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
|
|
1005
|
+
export interface Candle {
|
|
1006
|
+
t: number;
|
|
1007
|
+
o: string;
|
|
1008
|
+
h: string;
|
|
1009
|
+
l: string;
|
|
1010
|
+
c: string;
|
|
1011
|
+
v: string;
|
|
1012
|
+
n: number;
|
|
1013
|
+
}
|
|
1014
|
+
export interface CandlesResponse {
|
|
1015
|
+
coin: string;
|
|
1016
|
+
interval: string;
|
|
1017
|
+
candles: Candle[];
|
|
1018
|
+
}
|
|
1019
|
+
export interface CandleEvent {
|
|
1020
|
+
coin: string;
|
|
1021
|
+
interval: CandleInterval;
|
|
1022
|
+
candle: Candle;
|
|
1023
|
+
}
|
|
1024
|
+
export type AuthAuditEventType = 'sign_in' | 'token_minted' | 'api_key_authenticated' | 'permission_denied';
|
|
1025
|
+
export interface AuthAuditEntry {
|
|
1026
|
+
id: TypeId;
|
|
1027
|
+
builderId: UserId;
|
|
1028
|
+
eventType: AuthAuditEventType;
|
|
1029
|
+
actorType: string;
|
|
1030
|
+
actorId: UserId;
|
|
1031
|
+
realmId: RealmId | null;
|
|
1032
|
+
subject: string | null;
|
|
1033
|
+
action: string | null;
|
|
1034
|
+
resource: string | null;
|
|
1035
|
+
scopeSummary: string | null;
|
|
1036
|
+
ipAddress: string | null;
|
|
1037
|
+
tokenJti: string | null;
|
|
1038
|
+
expiresAt: string | null;
|
|
1039
|
+
success: boolean;
|
|
1040
|
+
errorMessage: string | null;
|
|
1041
|
+
operationCount?: number;
|
|
1042
|
+
createdAt: string;
|
|
1043
|
+
}
|
|
1044
|
+
export interface AuthAuditListResponse {
|
|
1045
|
+
entries: AuthAuditEntry[];
|
|
1046
|
+
total: number;
|
|
1047
|
+
}
|
|
1048
|
+
export interface AuthAuditFilters {
|
|
1049
|
+
eventType?: AuthAuditEventType;
|
|
1050
|
+
realmId?: string;
|
|
1051
|
+
since?: string;
|
|
1052
|
+
until?: string;
|
|
1053
|
+
success?: boolean;
|
|
1054
|
+
limit?: number;
|
|
1055
|
+
offset?: number;
|
|
1056
|
+
}
|
|
1057
|
+
export interface CredentialScopeResponse {
|
|
1058
|
+
credentialType: 'scoped_token' | 'api_key' | 'builder';
|
|
1059
|
+
credentialId: string;
|
|
1060
|
+
subject: string | null;
|
|
1061
|
+
scope: string | null;
|
|
1062
|
+
fullAccess: boolean;
|
|
1063
|
+
createdAt: string | null;
|
|
1064
|
+
expiresAt: string | null;
|
|
1065
|
+
}
|
|
1066
|
+
export {};
|
|
1067
|
+
//# sourceMappingURL=types.d.ts.map
|