@glamsystems/glam-sdk 1.0.13 → 1.0.14-alpha.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.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/index.cjs.js +14513 -21874
  3. package/index.esm.js +14492 -21817
  4. package/package.json +2 -2
  5. package/src/assets.d.ts +6 -15
  6. package/src/client/base.d.ts +24 -5
  7. package/src/client/bridge.d.ts +184 -0
  8. package/src/client/bridgeRegistry.d.ts +32 -0
  9. package/src/client/epi.d.ts +78 -0
  10. package/src/client/fees.d.ts +1 -0
  11. package/src/client/jupiter.d.ts +22 -18
  12. package/src/client/price.d.ts +13 -37
  13. package/src/client.d.ts +6 -5
  14. package/src/constants.d.ts +5 -7
  15. package/src/deser/index.d.ts +0 -1
  16. package/src/deser/integrationPolicies.d.ts +23 -20
  17. package/src/error.d.ts +2 -1
  18. package/src/glamExports.d.ts +2423 -1787
  19. package/src/globalConfig.d.ts +22 -0
  20. package/src/index.d.ts +3 -1
  21. package/src/react/glam.d.ts +0 -4
  22. package/src/react/query-keys.d.ts +1 -3
  23. package/src/utils/accounts.d.ts +4 -1
  24. package/src/utils/common.d.ts +2 -0
  25. package/src/utils/index.d.ts +0 -1
  26. package/src/utils/positionCategorizer.d.ts +3 -21
  27. package/target/idl/ext_cctp.json +1 -1
  28. package/target/idl/ext_kamino-staging.json +1 -1
  29. package/target/idl/ext_kamino.json +109 -1
  30. package/target/idl/ext_spl-staging.json +1 -1
  31. package/target/idl/ext_spl.json +1 -1
  32. package/target/idl/glam_config.json +75 -9
  33. package/target/idl/glam_mint.json +205 -11
  34. package/target/idl/glam_policies.json +2 -7
  35. package/target/idl/glam_protocol-staging.json +118 -522
  36. package/target/idl/glam_protocol.json +204 -121
  37. package/target/types/ext_bridge.d.ts +2398 -0
  38. package/target/types/ext_cctp.d.ts +1 -1
  39. package/target/types/ext_cctp.ts +1 -1
  40. package/target/types/ext_epi.d.ts +2175 -0
  41. package/target/types/ext_kamino-staging.ts +1 -1
  42. package/target/types/ext_kamino.d.ts +109 -1
  43. package/target/types/ext_kamino.ts +109 -1
  44. package/target/types/ext_spl-staging.ts +1 -1
  45. package/target/types/ext_spl.d.ts +1 -1
  46. package/target/types/ext_spl.ts +1 -1
  47. package/target/types/glam_config.d.ts +75 -9
  48. package/target/types/glam_config.ts +75 -9
  49. package/target/types/glam_mint.d.ts +205 -11
  50. package/target/types/glam_mint.ts +205 -11
  51. package/target/types/glam_policies.ts +2 -7
  52. package/target/types/glam_protocol-staging.ts +118 -522
  53. package/target/types/glam_protocol.d.ts +204 -121
  54. package/target/types/glam_protocol.ts +204 -121
  55. package/src/client/drift/index.d.ts +0 -2
  56. package/src/client/drift/protocol-v2.d.ts +0 -130
  57. package/src/client/drift/vaults.d.ts +0 -60
  58. package/src/deser/driftLayouts.d.ts +0 -217
  59. package/src/utils/drift/index.d.ts +0 -2
  60. package/src/utils/drift/orderParams.d.ts +0 -28
  61. package/src/utils/drift/types.d.ts +0 -522
  62. package/target/idl/ext_drift-staging.json +0 -5442
  63. package/target/idl/ext_drift.json +0 -4962
  64. package/target/types/ext_drift-staging.ts +0 -5448
  65. package/target/types/ext_drift.d.ts +0 -4968
  66. package/target/types/ext_drift.ts +0 -4968
  67. package/target/types/ext_offchain.d.ts +0 -1074
@@ -1,522 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- export declare function readUnsignedBigInt64LE(buffer: Buffer, offset: number): BN;
3
- export declare function readSignedBigInt64LE(buffer: Buffer, offset: number): BN;
4
- export declare function readI128LE(buffer: Buffer, offset: number): BN;
5
- export declare const ZERO: any;
6
- export declare enum ExchangeStatus {
7
- ACTIVE = 0,
8
- DEPOSIT_PAUSED = 1,
9
- WITHDRAW_PAUSED = 2,
10
- AMM_PAUSED = 4,
11
- FILL_PAUSED = 8,
12
- LIQ_PAUSED = 16,
13
- FUNDING_PAUSED = 32,
14
- SETTLE_PNL_PAUSED = 64,
15
- AMM_IMMEDIATE_FILL_PAUSED = 128,
16
- PAUSED = 255
17
- }
18
- export declare class MarketStatus {
19
- static readonly INITIALIZED: {
20
- initialized: {};
21
- };
22
- static readonly ACTIVE: {
23
- active: {};
24
- };
25
- static readonly FUNDING_PAUSED: {
26
- fundingPaused: {};
27
- };
28
- static readonly AMM_PAUSED: {
29
- ammPaused: {};
30
- };
31
- static readonly FILL_PAUSED: {
32
- fillPaused: {};
33
- };
34
- static readonly WITHDRAW_PAUSED: {
35
- withdrawPaused: {};
36
- };
37
- static readonly REDUCE_ONLY: {
38
- reduceOnly: {};
39
- };
40
- static readonly SETTLEMENT: {
41
- settlement: {};
42
- };
43
- static readonly DELISTED: {
44
- delisted: {};
45
- };
46
- }
47
- export declare enum PerpOperation {
48
- UPDATE_FUNDING = 1,
49
- AMM_FILL = 2,
50
- FILL = 4,
51
- SETTLE_PNL = 8,
52
- SETTLE_PNL_WITH_POSITION = 16,
53
- LIQUIDATION = 32
54
- }
55
- export declare enum SpotOperation {
56
- UPDATE_CUMULATIVE_INTEREST = 1,
57
- FILL = 2,
58
- DEPOSIT = 4,
59
- WITHDRAW = 8,
60
- LIQUIDATION = 16
61
- }
62
- export declare enum InsuranceFundOperation {
63
- INIT = 1,
64
- ADD = 2,
65
- REQUEST_REMOVE = 4,
66
- REMOVE = 8
67
- }
68
- export declare enum UserStatus {
69
- BEING_LIQUIDATED = 1,
70
- BANKRUPT = 2,
71
- REDUCE_ONLY = 4,
72
- ADVANCED_LP = 8,
73
- PROTECTED_MAKER = 16
74
- }
75
- export declare class MarginMode {
76
- static readonly DEFAULT: {
77
- default: {};
78
- };
79
- static readonly HIGH_LEVERAGE: {
80
- highLeverage: {};
81
- };
82
- }
83
- export declare class ContractType {
84
- static readonly PERPETUAL: {
85
- perpetual: {};
86
- };
87
- static readonly FUTURE: {
88
- future: {};
89
- };
90
- static readonly PREDICTION: {
91
- prediction: {};
92
- };
93
- }
94
- export declare class ContractTier {
95
- static readonly A: {
96
- a: {};
97
- };
98
- static readonly B: {
99
- b: {};
100
- };
101
- static readonly C: {
102
- c: {};
103
- };
104
- static readonly SPECULATIVE: {
105
- speculative: {};
106
- };
107
- static readonly HIGHLY_SPECULATIVE: {
108
- highlySpeculative: {};
109
- };
110
- static readonly ISOLATED: {
111
- isolated: {};
112
- };
113
- }
114
- export declare class AssetTier {
115
- static readonly COLLATERAL: {
116
- collateral: {};
117
- };
118
- static readonly PROTECTED: {
119
- protected: {};
120
- };
121
- static readonly CROSS: {
122
- cross: {};
123
- };
124
- static readonly ISOLATED: {
125
- isolated: {};
126
- };
127
- static readonly UNLISTED: {
128
- unlisted: {};
129
- };
130
- }
131
- export declare class SwapDirection {
132
- static readonly ADD: {
133
- add: {};
134
- };
135
- static readonly REMOVE: {
136
- remove: {};
137
- };
138
- }
139
- export declare class SpotBalanceType {
140
- static readonly DEPOSIT: {
141
- deposit: {};
142
- };
143
- static readonly BORROW: {
144
- borrow: {};
145
- };
146
- }
147
- export declare class PositionDirection {
148
- static readonly LONG: {
149
- long: {};
150
- };
151
- static readonly SHORT: {
152
- short: {};
153
- };
154
- }
155
- export declare class DepositDirection {
156
- static readonly DEPOSIT: {
157
- deposit: {};
158
- };
159
- static readonly WITHDRAW: {
160
- withdraw: {};
161
- };
162
- }
163
- export declare class OracleSource {
164
- static readonly PYTH: {
165
- pyth: {};
166
- };
167
- static readonly PYTH_1K: {
168
- pyth1K: {};
169
- };
170
- static readonly PYTH_1M: {
171
- pyth1M: {};
172
- };
173
- static readonly PYTH_PULL: {
174
- pythPull: {};
175
- };
176
- static readonly PYTH_1K_PULL: {
177
- pyth1KPull: {};
178
- };
179
- static readonly PYTH_1M_PULL: {
180
- pyth1MPull: {};
181
- };
182
- static readonly SWITCHBOARD: {
183
- switchboard: {};
184
- };
185
- static readonly QUOTE_ASSET: {
186
- quoteAsset: {};
187
- };
188
- static readonly PYTH_STABLE_COIN: {
189
- pythStableCoin: {};
190
- };
191
- static readonly PYTH_STABLE_COIN_PULL: {
192
- pythStableCoinPull: {};
193
- };
194
- static readonly Prelaunch: {
195
- prelaunch: {};
196
- };
197
- static readonly SWITCHBOARD_ON_DEMAND: {
198
- switchboardOnDemand: {};
199
- };
200
- static readonly PYTH_LAZER: {
201
- pythLazer: {};
202
- };
203
- static readonly PYTH_LAZER_1K: {
204
- pythLazer1K: {};
205
- };
206
- static readonly PYTH_LAZER_1M: {
207
- pythLazer1M: {};
208
- };
209
- static readonly PYTH_LAZER_STABLE_COIN: {
210
- pythLazerStableCoin: {};
211
- };
212
- static fromString(name: string): OracleSource;
213
- static get(n: Number): any;
214
- }
215
- export declare class OracleSourceNum {
216
- static readonly PYTH = 0;
217
- static readonly PYTH_1K = 1;
218
- static readonly PYTH_1M = 2;
219
- static readonly PYTH_PULL = 3;
220
- static readonly PYTH_1K_PULL = 4;
221
- static readonly PYTH_1M_PULL = 5;
222
- static readonly SWITCHBOARD = 6;
223
- static readonly QUOTE_ASSET = 7;
224
- static readonly PYTH_STABLE_COIN = 8;
225
- static readonly PYTH_STABLE_COIN_PULL = 9;
226
- static readonly PRELAUNCH = 10;
227
- static readonly SWITCHBOARD_ON_DEMAND = 11;
228
- static readonly PYTH_LAZER = 12;
229
- static readonly PYTH_LAZER_1K = 13;
230
- static readonly PYTH_LAZER_1M = 14;
231
- static readonly PYTH_LAZER_STABLE_COIN = 15;
232
- }
233
- export declare class OrderType {
234
- static readonly LIMIT: {
235
- limit: {};
236
- };
237
- static readonly TRIGGER_MARKET: {
238
- triggerMarket: {};
239
- };
240
- static readonly TRIGGER_LIMIT: {
241
- triggerLimit: {};
242
- };
243
- static readonly MARKET: {
244
- market: {};
245
- };
246
- static readonly ORACLE: {
247
- oracle: {};
248
- };
249
- }
250
- export declare type MarketTypeStr = "perp" | "spot";
251
- export declare class MarketType {
252
- static readonly SPOT: {
253
- spot: {};
254
- };
255
- static readonly PERP: {
256
- perp: {};
257
- };
258
- }
259
- export declare class OrderStatus {
260
- static readonly INIT: {
261
- init: {};
262
- };
263
- static readonly OPEN: {
264
- open: {};
265
- };
266
- static readonly FILLED: {
267
- filled: {};
268
- };
269
- static readonly CANCELED: {
270
- canceled: {};
271
- };
272
- }
273
- export declare class OrderAction {
274
- static readonly PLACE: {
275
- place: {};
276
- };
277
- static readonly CANCEL: {
278
- cancel: {};
279
- };
280
- static readonly EXPIRE: {
281
- expire: {};
282
- };
283
- static readonly FILL: {
284
- fill: {};
285
- };
286
- static readonly TRIGGER: {
287
- trigger: {};
288
- };
289
- }
290
- export declare class OrderActionExplanation {
291
- static readonly NONE: {
292
- none: {};
293
- };
294
- static readonly INSUFFICIENT_FREE_COLLATERAL: {
295
- insufficientFreeCollateral: {};
296
- };
297
- static readonly ORACLE_PRICE_BREACHED_LIMIT_PRICE: {
298
- oraclePriceBreachedLimitPrice: {};
299
- };
300
- static readonly MARKET_ORDER_FILLED_TO_LIMIT_PRICE: {
301
- marketOrderFilledToLimitPrice: {};
302
- };
303
- static readonly ORDER_EXPIRED: {
304
- orderExpired: {};
305
- };
306
- static readonly LIQUIDATION: {
307
- liquidation: {};
308
- };
309
- static readonly ORDER_FILLED_WITH_AMM: {
310
- orderFilledWithAmm: {};
311
- };
312
- static readonly ORDER_FILLED_WITH_AMM_JIT: {
313
- orderFilledWithAmmJit: {};
314
- };
315
- static readonly ORDER_FILLED_WITH_AMM_JIT_LP_SPLIT: {
316
- orderFilledWithAmmJitLpSplit: {};
317
- };
318
- static readonly ORDER_FILLED_WITH_LP_JIT: {
319
- orderFilledWithLpJit: {};
320
- };
321
- static readonly ORDER_FILLED_WITH_MATCH: {
322
- orderFilledWithMatch: {};
323
- };
324
- static readonly ORDER_FILLED_WITH_MATCH_JIT: {
325
- orderFilledWithMatchJit: {};
326
- };
327
- static readonly MARKET_EXPIRED: {
328
- marketExpired: {};
329
- };
330
- static readonly RISK_INCREASING_ORDER: {
331
- riskingIncreasingOrder: {};
332
- };
333
- static readonly ORDER_FILLED_WITH_SERUM: {
334
- orderFillWithSerum: {};
335
- };
336
- static readonly ORDER_FILLED_WITH_OPENBOOK_V2: {
337
- orderFilledWithOpenbookV2: {};
338
- };
339
- static readonly ORDER_FILLED_WITH_PHOENIX: {
340
- orderFillWithPhoenix: {};
341
- };
342
- static readonly REDUCE_ONLY_ORDER_INCREASED_POSITION: {
343
- reduceOnlyOrderIncreasedPosition: {};
344
- };
345
- static readonly DERISK_LP: {
346
- deriskLp: {};
347
- };
348
- static readonly TRANSFER_PERP_POSITION: {
349
- transferPerpPosition: {};
350
- };
351
- }
352
- export declare class OrderTriggerCondition {
353
- static readonly ABOVE: {
354
- above: {};
355
- };
356
- static readonly BELOW: {
357
- below: {};
358
- };
359
- static readonly TRIGGERED_ABOVE: {
360
- triggeredAbove: {};
361
- };
362
- static readonly TRIGGERED_BELOW: {
363
- triggeredBelow: {};
364
- };
365
- }
366
- export declare class SpotFulfillmentType {
367
- static readonly EXTERNAL: {
368
- external: {};
369
- };
370
- static readonly MATCH: {
371
- match: {};
372
- };
373
- }
374
- export declare class SpotFulfillmentStatus {
375
- static readonly ENABLED: {
376
- enabled: {};
377
- };
378
- static readonly DISABLED: {
379
- disabled: {};
380
- };
381
- }
382
- export declare class DepositExplanation {
383
- static readonly NONE: {
384
- none: {};
385
- };
386
- static readonly TRANSFER: {
387
- transfer: {};
388
- };
389
- static readonly BORROW: {
390
- borrow: {};
391
- };
392
- static readonly REPAY_BORROW: {
393
- repayBorrow: {};
394
- };
395
- }
396
- export declare class SettlePnlExplanation {
397
- static readonly NONE: {
398
- none: {};
399
- };
400
- static readonly EXPIRED_POSITION: {
401
- expiredPosition: {};
402
- };
403
- }
404
- export declare class SpotFulfillmentConfigStatus {
405
- static readonly ENABLED: {
406
- enabled: {};
407
- };
408
- static readonly DISABLED: {
409
- disabled: {};
410
- };
411
- }
412
- export declare class StakeAction {
413
- static readonly STAKE: {
414
- stake: {};
415
- };
416
- static readonly UNSTAKE_REQUEST: {
417
- unstakeRequest: {};
418
- };
419
- static readonly UNSTAKE_CANCEL_REQUEST: {
420
- unstakeCancelRequest: {};
421
- };
422
- static readonly UNSTAKE: {
423
- unstake: {};
424
- };
425
- static readonly UNSTAKE_TRANSFER: {
426
- unstakeTransfer: {};
427
- };
428
- static readonly STAKE_TRANSFER: {
429
- stakeTransfer: {};
430
- };
431
- }
432
- export type Order = {
433
- status: OrderStatus;
434
- orderType: OrderType;
435
- marketType: MarketType;
436
- slot: BN;
437
- orderId: number;
438
- userOrderId: number;
439
- marketIndex: number;
440
- price: BN;
441
- baseAssetAmount: BN;
442
- quoteAssetAmount: BN;
443
- baseAssetAmountFilled: BN;
444
- quoteAssetAmountFilled: BN;
445
- direction: PositionDirection;
446
- reduceOnly: boolean;
447
- triggerPrice: BN;
448
- triggerCondition: OrderTriggerCondition;
449
- existingPositionDirection: PositionDirection;
450
- postOnly: boolean;
451
- immediateOrCancel: boolean;
452
- oraclePriceOffset: number;
453
- auctionDuration: number;
454
- auctionStartPrice: BN;
455
- auctionEndPrice: BN;
456
- maxTs: BN;
457
- bitFlags: number;
458
- postedSlotTail: number;
459
- };
460
- export type OrderParams = {
461
- orderType: OrderType;
462
- marketType: MarketType;
463
- userOrderId: number;
464
- direction: PositionDirection;
465
- baseAssetAmount: BN;
466
- price: BN;
467
- marketIndex: number;
468
- reduceOnly: boolean;
469
- postOnly: PostOnlyParams;
470
- immediateOrCancel: boolean;
471
- triggerPrice: BN | null;
472
- triggerCondition: OrderTriggerCondition;
473
- oraclePriceOffset: number | null;
474
- auctionDuration: number | null;
475
- maxTs: BN | null;
476
- auctionStartPrice: BN | null;
477
- auctionEndPrice: BN | null;
478
- };
479
- export declare class PostOnlyParams {
480
- static readonly NONE: {
481
- none: {};
482
- };
483
- static readonly MUST_POST_ONLY: {
484
- mustPostOnly: {};
485
- };
486
- static readonly TRY_POST_ONLY: {
487
- tryPostOnly: {};
488
- };
489
- static readonly SLIDE: {
490
- slide: {};
491
- };
492
- }
493
- export type NecessaryOrderParams = {
494
- orderType: OrderType;
495
- marketIndex: number;
496
- baseAssetAmount: BN;
497
- direction: PositionDirection;
498
- };
499
- export type OptionalOrderParams = {
500
- [Property in keyof OrderParams]?: OrderParams[Property];
501
- } & NecessaryOrderParams;
502
- export type ModifyOrderParams = {
503
- direction: PositionDirection | null;
504
- baseAssetAmount: BN | null;
505
- price: BN | null;
506
- reduceOnly: boolean | null;
507
- postOnly: PostOnlyParams | null;
508
- bitFlags: number | null;
509
- maxTs: BN | null;
510
- triggerPrice: BN | null;
511
- triggerCondition: OrderTriggerCondition | null;
512
- oraclePriceOffset: number | null;
513
- auctionDuration: number | null;
514
- auctionStartPrice: BN | null;
515
- auctionEndPrice: BN | null;
516
- policy: number | null;
517
- };
518
- export declare enum ModifyOrderPolicy {
519
- MustModify = 1,
520
- ExcludePreviousFill = 2
521
- }
522
- export declare const DefaultOrderParams: OrderParams;