@glamsystems/glam-sdk 1.0.12 → 1.0.14-alpha.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 (75) hide show
  1. package/README.md +1 -1
  2. package/index.cjs.js +23827 -26772
  3. package/index.esm.js +23795 -26716
  4. package/package.json +2 -2
  5. package/src/assets.d.ts +9 -15
  6. package/src/client/access.d.ts +13 -0
  7. package/src/client/base.d.ts +27 -6
  8. package/src/client/bridge.d.ts +184 -0
  9. package/src/client/bridgeRegistry.d.ts +32 -0
  10. package/src/client/epi.d.ts +78 -0
  11. package/src/client/fees.d.ts +4 -0
  12. package/src/client/invest.d.ts +1 -1
  13. package/src/client/jupiter.d.ts +22 -18
  14. package/src/client/mint.d.ts +54 -1
  15. package/src/client/price.d.ts +13 -37
  16. package/src/client.d.ts +6 -5
  17. package/src/constants.d.ts +10 -7
  18. package/src/deser/index.d.ts +1 -1
  19. package/src/deser/integrationPolicies.d.ts +23 -20
  20. package/src/deser/tokenAclLayouts.d.ts +67 -0
  21. package/src/error.d.ts +2 -1
  22. package/src/glamExports.d.ts +2344 -1758
  23. package/src/globalConfig.d.ts +22 -0
  24. package/src/index.d.ts +4 -1
  25. package/src/react/glam.d.ts +0 -4
  26. package/src/react/query-keys.d.ts +1 -3
  27. package/src/utils/accounts.d.ts +9 -1
  28. package/src/utils/bitmask.d.ts +3 -0
  29. package/src/utils/common.d.ts +2 -0
  30. package/src/utils/glamPDAs.d.ts +5 -0
  31. package/src/utils/index.d.ts +0 -1
  32. package/src/utils/positionCategorizer.d.ts +3 -21
  33. package/target/idl/ext_cctp.json +1 -1
  34. package/target/idl/ext_kamino-staging.json +1 -1
  35. package/target/idl/ext_kamino.json +109 -1
  36. package/target/idl/ext_spl-staging.json +1 -1
  37. package/target/idl/ext_spl.json +1 -1
  38. package/target/idl/glam_config.json +78 -9
  39. package/target/idl/glam_mint-staging.json +865 -0
  40. package/target/idl/glam_mint.json +227 -8
  41. package/target/idl/glam_policies.json +2 -7
  42. package/target/idl/glam_protocol-staging.json +176 -275
  43. package/target/idl/glam_protocol.json +212 -114
  44. package/target/types/ext_bridge.d.ts +2397 -0
  45. package/target/types/ext_cctp.d.ts +1 -1
  46. package/target/types/ext_cctp.ts +1 -1
  47. package/target/types/ext_epi.d.ts +2175 -0
  48. package/target/types/ext_kamino-staging.ts +1 -1
  49. package/target/types/ext_kamino.d.ts +109 -1
  50. package/target/types/ext_kamino.ts +109 -1
  51. package/target/types/ext_spl-staging.ts +1 -1
  52. package/target/types/ext_spl.d.ts +1 -1
  53. package/target/types/ext_spl.ts +1 -1
  54. package/target/types/glam_config.d.ts +78 -9
  55. package/target/types/glam_config.ts +78 -9
  56. package/target/types/glam_mint-staging.ts +865 -0
  57. package/target/types/glam_mint.d.ts +227 -8
  58. package/target/types/glam_mint.ts +227 -8
  59. package/target/types/glam_policies.ts +2 -7
  60. package/target/types/glam_protocol-staging.ts +176 -275
  61. package/target/types/glam_protocol.d.ts +212 -114
  62. package/target/types/glam_protocol.ts +212 -114
  63. package/src/client/drift/index.d.ts +0 -2
  64. package/src/client/drift/protocol-v2.d.ts +0 -93
  65. package/src/client/drift/vaults.d.ts +0 -60
  66. package/src/deser/driftLayouts.d.ts +0 -217
  67. package/src/utils/drift/index.d.ts +0 -2
  68. package/src/utils/drift/orderParams.d.ts +0 -28
  69. package/src/utils/drift/types.d.ts +0 -522
  70. package/target/idl/ext_drift-staging.json +0 -3993
  71. package/target/idl/ext_drift.json +0 -3993
  72. package/target/types/ext_drift-staging.ts +0 -3999
  73. package/target/types/ext_drift.d.ts +0 -3999
  74. package/target/types/ext_drift.ts +0 -3999
  75. package/target/types/ext_offchain.d.ts +0 -1074
@@ -8,7 +8,7 @@ export type GlamProtocol = {
8
8
  "address": "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz",
9
9
  "metadata": {
10
10
  "name": "glamProtocol",
11
- "version": "1.0.3",
11
+ "version": "1.0.4",
12
12
  "spec": "0.1.0",
13
13
  "description": "Glam Protocol"
14
14
  },
@@ -450,6 +450,149 @@ export type GlamProtocol = {
450
450
  }
451
451
  ]
452
452
  },
453
+ {
454
+ "name": "jupiterSwapV2",
455
+ "discriminator": [
456
+ 28,
457
+ 155,
458
+ 14,
459
+ 63,
460
+ 87,
461
+ 96,
462
+ 62,
463
+ 221
464
+ ],
465
+ "accounts": [
466
+ {
467
+ "name": "glamState",
468
+ "writable": true
469
+ },
470
+ {
471
+ "name": "glamVault",
472
+ "writable": true,
473
+ "pda": {
474
+ "seeds": [
475
+ {
476
+ "kind": "const",
477
+ "value": [
478
+ 118,
479
+ 97,
480
+ 117,
481
+ 108,
482
+ 116
483
+ ]
484
+ },
485
+ {
486
+ "kind": "account",
487
+ "path": "glamState"
488
+ }
489
+ ]
490
+ }
491
+ },
492
+ {
493
+ "name": "glamSigner",
494
+ "writable": true,
495
+ "signer": true
496
+ },
497
+ {
498
+ "name": "cpiProgram",
499
+ "address": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
500
+ },
501
+ {
502
+ "name": "inputStakePool",
503
+ "optional": true
504
+ },
505
+ {
506
+ "name": "outputStakePool",
507
+ "optional": true
508
+ },
509
+ {
510
+ "name": "glamConfig",
511
+ "optional": true,
512
+ "pda": {
513
+ "seeds": [
514
+ {
515
+ "kind": "const",
516
+ "value": [
517
+ 103,
518
+ 108,
519
+ 111,
520
+ 98,
521
+ 97,
522
+ 108,
523
+ 45,
524
+ 99,
525
+ 111,
526
+ 110,
527
+ 102,
528
+ 105,
529
+ 103
530
+ ]
531
+ }
532
+ ],
533
+ "program": {
534
+ "kind": "const",
535
+ "value": [
536
+ 10,
537
+ 11,
538
+ 0,
539
+ 83,
540
+ 72,
541
+ 16,
542
+ 46,
543
+ 144,
544
+ 46,
545
+ 42,
546
+ 79,
547
+ 22,
548
+ 157,
549
+ 123,
550
+ 21,
551
+ 242,
552
+ 192,
553
+ 146,
554
+ 1,
555
+ 78,
556
+ 88,
557
+ 59,
558
+ 102,
559
+ 9,
560
+ 190,
561
+ 226,
562
+ 92,
563
+ 189,
564
+ 187,
565
+ 232,
566
+ 83,
567
+ 220
568
+ ]
569
+ }
570
+ }
571
+ },
572
+ {
573
+ "name": "solUsdOracle",
574
+ "optional": true
575
+ },
576
+ {
577
+ "name": "inputTokenOracle",
578
+ "optional": true
579
+ },
580
+ {
581
+ "name": "outputTokenOracle",
582
+ "optional": true
583
+ }
584
+ ],
585
+ "args": [
586
+ {
587
+ "name": "skipQuotePriceCheck",
588
+ "type": "bool"
589
+ },
590
+ {
591
+ "name": "data",
592
+ "type": "bytes"
593
+ }
594
+ ]
595
+ },
453
596
  {
454
597
  "name": "linkUnlinkMintByMintAuthority",
455
598
  "docs": [
@@ -1002,8 +1145,8 @@ export type GlamProtocol = {
1002
1145
  },
1003
1146
  {
1004
1147
  "code": 48010,
1005
- "name": "invalidAccountOwner",
1006
- "msg": "Account owner does not match expected program"
1148
+ "name": "unexpectedProgramOwner",
1149
+ "msg": "Account is owned by an unexpected program"
1007
1150
  },
1008
1151
  {
1009
1152
  "code": 48011,
@@ -1032,8 +1175,8 @@ export type GlamProtocol = {
1032
1175
  },
1033
1176
  {
1034
1177
  "code": 49004,
1035
- "name": "invalidIndex",
1036
- "msg": "Invalid index"
1178
+ "name": "invalidAssetsLen",
1179
+ "msg": "Too many assets: max 100"
1037
1180
  },
1038
1181
  {
1039
1182
  "code": 49005,
@@ -1092,11 +1235,26 @@ export type GlamProtocol = {
1092
1235
  },
1093
1236
  {
1094
1237
  "code": 49016,
1238
+ "name": "staleDriftInterest",
1239
+ "msg": "Drift spot market cumulative interest is stale"
1240
+ },
1241
+ {
1242
+ "code": 49017,
1243
+ "name": "assetBalanceNotZero",
1244
+ "msg": "Cannot delete asset: vault token account balance is not zero"
1245
+ },
1246
+ {
1247
+ "code": 49018,
1248
+ "name": "cannotDeleteBaseAsset",
1249
+ "msg": "Cannot delete base asset from allowlist"
1250
+ },
1251
+ {
1252
+ "code": 49019,
1095
1253
  "name": "integrationAclLimitExceeded",
1096
1254
  "msg": "Integration ACL limit exceeded"
1097
1255
  },
1098
1256
  {
1099
- "code": 49017,
1257
+ "code": 49020,
1100
1258
  "name": "delegateAclLimitExceeded",
1101
1259
  "msg": "Delegate ACL limit exceeded"
1102
1260
  },
@@ -1140,6 +1298,11 @@ export type GlamProtocol = {
1140
1298
  "name": "multipleStakeAccountsDisallowed",
1141
1299
  "msg": "Multiple stake accounts disallowed"
1142
1300
  },
1301
+ {
1302
+ "code": 50008,
1303
+ "name": "maxDeviationExceeded",
1304
+ "msg": "Max deviation exceeded"
1305
+ },
1143
1306
  {
1144
1307
  "code": 51000,
1145
1308
  "name": "invalidAssetPrice",
@@ -1178,7 +1341,7 @@ export type GlamProtocol = {
1178
1341
  {
1179
1342
  "code": 51105,
1180
1343
  "name": "priceDivergenceTooLarge",
1181
- "msg": "Price confidence interval too wide"
1344
+ "msg": "No priced assets found"
1182
1345
  },
1183
1346
  {
1184
1347
  "code": 51106,
@@ -1187,18 +1350,18 @@ export type GlamProtocol = {
1187
1350
  },
1188
1351
  {
1189
1352
  "code": 51107,
1190
- "name": "invalidSharesRebase",
1191
- "msg": "Invalid shares rebase: new base must be greater than current"
1353
+ "name": "mathError",
1354
+ "msg": "Math error"
1192
1355
  },
1193
1356
  {
1194
1357
  "code": 51108,
1195
- "name": "duplicatePosition",
1196
- "msg": "Duplicate position already priced"
1358
+ "name": "typeCastingError",
1359
+ "msg": "Type casting error"
1197
1360
  },
1198
1361
  {
1199
1362
  "code": 51109,
1200
- "name": "unsupportedVaultState",
1201
- "msg": "Vault protocol or pending fee update not supported for pricing"
1363
+ "name": "baseAssetNotSupported",
1364
+ "msg": "Base asset must have 6 decimals."
1202
1365
  },
1203
1366
  {
1204
1367
  "code": 51110,
@@ -1217,14 +1380,24 @@ export type GlamProtocol = {
1217
1380
  },
1218
1381
  {
1219
1382
  "code": 51113,
1220
- "name": "invalidDiscriminator",
1221
- "msg": "Account discriminator does not match expected value"
1383
+ "name": "unexpectedDiscriminator",
1384
+ "msg": "Invalid account: discriminator mismatch"
1222
1385
  },
1223
1386
  {
1224
1387
  "code": 51114,
1225
1388
  "name": "invalidAccountData",
1226
1389
  "msg": "Invalid account data"
1227
1390
  },
1391
+ {
1392
+ "code": 51115,
1393
+ "name": "oraclePriceSuspended",
1394
+ "msg": "Oracle price is suspended"
1395
+ },
1396
+ {
1397
+ "code": 51116,
1398
+ "name": "assetNotInPricingSet",
1399
+ "msg": "Asset not in pricing set"
1400
+ },
1228
1401
  {
1229
1402
  "code": 50100,
1230
1403
  "name": "transferRateLimitExceeded",
@@ -1254,6 +1427,16 @@ export type GlamProtocol = {
1254
1427
  "code": 52003,
1255
1428
  "name": "lockUp",
1256
1429
  "msg": "Policy violation: lock-up has not expired"
1430
+ },
1431
+ {
1432
+ "code": 52004,
1433
+ "name": "policyNotSet",
1434
+ "msg": "Protocol policy not set"
1435
+ },
1436
+ {
1437
+ "code": 52005,
1438
+ "name": "unsupportedOracleSource",
1439
+ "msg": "Oracle source not supported in this context"
1257
1440
  }
1258
1441
  ],
1259
1442
  "types": [
@@ -1343,30 +1526,6 @@ export type GlamProtocol = {
1343
1526
  ]
1344
1527
  }
1345
1528
  },
1346
- {
1347
- "name": "assetRateLimit",
1348
- "type": {
1349
- "kind": "struct",
1350
- "fields": [
1351
- {
1352
- "name": "mint",
1353
- "type": "pubkey"
1354
- },
1355
- {
1356
- "name": "periodType",
1357
- "type": {
1358
- "defined": {
1359
- "name": "periodType"
1360
- }
1361
- }
1362
- },
1363
- {
1364
- "name": "amount",
1365
- "type": "u64"
1366
- }
1367
- ]
1368
- }
1369
- },
1370
1529
  {
1371
1530
  "name": "createdModel",
1372
1531
  "type": {
@@ -1418,28 +1577,6 @@ export type GlamProtocol = {
1418
1577
  ]
1419
1578
  }
1420
1579
  },
1421
- {
1422
- "name": "delegateRateLimit",
1423
- "type": {
1424
- "kind": "struct",
1425
- "fields": [
1426
- {
1427
- "name": "delegate",
1428
- "type": "pubkey"
1429
- },
1430
- {
1431
- "name": "limits",
1432
- "type": {
1433
- "vec": {
1434
- "defined": {
1435
- "name": "assetRateLimit"
1436
- }
1437
- }
1438
- }
1439
- }
1440
- ]
1441
- }
1442
- },
1443
1580
  {
1444
1581
  "name": "emergencyAccessUpdateArgs",
1445
1582
  "type": {
@@ -1948,6 +2085,10 @@ export type GlamProtocol = {
1948
2085
  "vec": "pubkey"
1949
2086
  }
1950
2087
  }
2088
+ },
2089
+ {
2090
+ "name": "maxDeviationBps",
2091
+ "type": "i16"
1951
2092
  }
1952
2093
  ]
1953
2094
  }
@@ -2110,26 +2251,6 @@ export type GlamProtocol = {
2110
2251
  ]
2111
2252
  }
2112
2253
  },
2113
- {
2114
- "name": "periodType",
2115
- "repr": {
2116
- "kind": "rust"
2117
- },
2118
- "type": {
2119
- "kind": "enum",
2120
- "variants": [
2121
- {
2122
- "name": "day"
2123
- },
2124
- {
2125
- "name": "week"
2126
- },
2127
- {
2128
- "name": "month"
2129
- }
2130
- ]
2131
- }
2132
- },
2133
2254
  {
2134
2255
  "name": "pricedProtocol",
2135
2256
  "type": {
@@ -2497,34 +2618,6 @@ export type GlamProtocol = {
2497
2618
  ]
2498
2619
  }
2499
2620
  },
2500
- {
2501
- "name": "transferRateLimitPolicy",
2502
- "type": {
2503
- "kind": "struct",
2504
- "fields": [
2505
- {
2506
- "name": "vaultDefaults",
2507
- "type": {
2508
- "vec": {
2509
- "defined": {
2510
- "name": "assetRateLimit"
2511
- }
2512
- }
2513
- }
2514
- },
2515
- {
2516
- "name": "delegateOverrides",
2517
- "type": {
2518
- "vec": {
2519
- "defined": {
2520
- "name": "delegateRateLimit"
2521
- }
2522
- }
2523
- }
2524
- }
2525
- ]
2526
- }
2527
- },
2528
2621
  {
2529
2622
  "name": "valuationModel",
2530
2623
  "type": {
@@ -2546,6 +2639,16 @@ export type GlamProtocol = {
2546
2639
  "type": "u16",
2547
2640
  "value": "4"
2548
2641
  },
2642
+ {
2643
+ "name": "protoJupiterSwapPermSkipQuotePriceCheck",
2644
+ "type": "u64",
2645
+ "value": "32"
2646
+ },
2647
+ {
2648
+ "name": "protoJupiterSwapPermSkipQuotePriceCheckLimited",
2649
+ "type": "u64",
2650
+ "value": "16"
2651
+ },
2549
2652
  {
2550
2653
  "name": "protoJupiterSwapPermSwapAllowlisted",
2551
2654
  "type": "u64",
@@ -2600,11 +2703,6 @@ export type GlamProtocol = {
2600
2703
  "name": "protoSystemPermWsol",
2601
2704
  "type": "u64",
2602
2705
  "value": "1"
2603
- },
2604
- {
2605
- "name": "protoTransferLimit",
2606
- "type": "u16",
2607
- "value": "8"
2608
2706
  }
2609
2707
  ]
2610
2708
  };
@@ -1,2 +0,0 @@
1
- export * from "./protocol-v2";
2
- export * from "./vaults";
@@ -1,93 +0,0 @@
1
- import * as anchor from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, AccountMeta } from "@solana/web3.js";
3
- import { MarketType, OrderParams, PositionDirection, ModifyOrderParams } from "../../utils/drift/types";
4
- import { DriftPerpMarket, DriftSpotMarket, DriftUser } from "../../deser/driftLayouts";
5
- import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
6
- import { VaultClient } from "../vault";
7
- export declare const DRIFT_SIGNER: anchor.web3.PublicKey;
8
- export declare const DRIFT_MARGIN_PRECISION = 10000;
9
- export interface OrderConstants {
10
- perpBaseScale: number;
11
- quoteScale: number;
12
- }
13
- export declare class DriftMarketConfigs {
14
- readonly orderConstants: OrderConstants;
15
- readonly perpMarkets: DriftPerpMarket[];
16
- readonly spotMarkets: DriftSpotMarket[];
17
- constructor(orderConstants: OrderConstants, perpMarkets: DriftPerpMarket[], spotMarkets: DriftSpotMarket[]);
18
- getPerp(marketIndex: number): DriftPerpMarket | undefined;
19
- getSpot(mintOrIndex: PublicKey | number): DriftSpotMarket | undefined;
20
- }
21
- declare class TxBuilder extends BaseTxBuilder<DriftProtocolClient> {
22
- initializeUserStatsIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
23
- initializeUserIx(glamSigner: PublicKey, subAccountId: number): Promise<TransactionInstruction>;
24
- updateUserPoolIdIx(subAccountId: number, poolId: number): Promise<TransactionInstruction>;
25
- initializeIxs(subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
26
- initializeTx(subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
27
- depositIxs(amount: anchor.BN, marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
28
- depositTx(amount: anchor.BN, marketIndex: number, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
29
- withdrawIxs(amount: anchor.BN, marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
30
- withdrawTx(amount: anchor.BN, marketIndex: number, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
31
- updateUserCustomMarginRatioIx(maxLeverage: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
32
- updateUserCustomMarginRatioTx(maxLeverage: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
33
- updateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
34
- updateUserMarginTradingEnabledTx(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
35
- updateUserDelegateIx(delegate: PublicKey | string, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
36
- updateUserDelegateTx(delegate: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
37
- deleteUserIx(subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
38
- deleteUserTx(subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
39
- placeOrderIx(orderParams: OrderParams, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
40
- placeOrderTx(orderParams: OrderParams, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
41
- modifyOrderIx(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
42
- modifyOrderTx(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
43
- cancelOrdersIx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
44
- cancelOrdersTx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
45
- cancelOrdersByIdsIx(orderIds: number[], subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
46
- cancelOrdersByIdsTx(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
47
- settlePnlIx(marketIndex: number, subAccountId: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
48
- settlePnlTx(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
49
- }
50
- export declare class DriftProtocolClient {
51
- readonly base: BaseClient;
52
- readonly vault: VaultClient;
53
- private spotMarkets;
54
- private perpMarkets;
55
- private marketConfigs;
56
- txBuilder: TxBuilder;
57
- constructor(base: BaseClient, vault: VaultClient);
58
- initialize(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
59
- updateUserCustomMarginRatio(maxLeverage: number, subAccountId?: number): Promise<TransactionSignature>;
60
- updateUserMarginTradingEnabled(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
61
- updateUserDelegate(delegate: PublicKey | string, subAccountId?: number): Promise<TransactionSignature>;
62
- deleteUser(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
63
- deposit(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
64
- withdraw(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
65
- placeOrder(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
66
- modifyOrder(modifyOrderParams: ModifyOrderParams, orderId: number, marketIndex: number, marketType: MarketType, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
67
- cancelOrders(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
68
- cancelOrdersByIds(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
69
- settlePnl(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
70
- getMarketPda: (marketType: MarketType, marketIndex: number) => anchor.web3.PublicKey;
71
- getUserPda: (authority: PublicKey, subAccountId?: number) => anchor.web3.PublicKey;
72
- getUserStatsPda: (authority: PublicKey) => PublicKey;
73
- getGlamReferrerPdas(): {
74
- user: PublicKey;
75
- userStats: PublicKey;
76
- };
77
- getDriftUserPdas(subAccountId?: number): {
78
- user: PublicKey;
79
- userStats: PublicKey;
80
- };
81
- getSubAccountId(driftUser: PublicKey): number;
82
- get driftStatePda(): PublicKey;
83
- fetchAndParseSpotMarket(marketIndex: number, skipCache?: boolean): Promise<DriftSpotMarket>;
84
- fetchAndParseSpotMarkets(marketIndexes: number[], skipCache?: boolean): Promise<DriftSpotMarket[]>;
85
- fetchAndParsePerpMarket(marketIndex: number, skipCache?: boolean): Promise<DriftPerpMarket>;
86
- fetchAndParsePerpMarkets(marketIndexes: number[], skipCache?: boolean): Promise<DriftPerpMarket[]>;
87
- fetchMarketConfigs(skipCache?: boolean): Promise<DriftMarketConfigs>;
88
- fetchAndParseDriftUser(subAccountId?: number): Promise<DriftUser | null>;
89
- fetchAndParseDriftUsers(): Promise<DriftUser[]>;
90
- marketTypeEquals: (a: MarketType | undefined, b: MarketType) => boolean | undefined;
91
- composeRemainingAccounts(subAccountId: number, marketType?: MarketType, marketIndex?: number): Promise<AccountMeta[]>;
92
- }
93
- export {};
@@ -1,60 +0,0 @@
1
- import { PublicKey, VersionedTransaction, TransactionSignature, AccountMeta, Commitment } from "@solana/web3.js";
2
- import { DriftVault, PerpPosition, SpotPosition } from "../../deser/driftLayouts";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
4
- import { BN } from "@coral-xyz/anchor";
5
- import { DriftProtocolClient } from "./protocol-v2";
6
- declare class TxBuilder extends BaseTxBuilder<DriftVaultsClient> {
7
- initializeVaultDepositorTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
8
- depositTx(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
9
- requestWithdrawTx(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
10
- cancelWithdrawRequestTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
11
- withdrawTx(driftVault: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
12
- }
13
- export declare class DriftVaultsClient {
14
- readonly base: BaseClient;
15
- readonly drift: DriftProtocolClient;
16
- txBuilder: TxBuilder;
17
- constructor(base: BaseClient, drift: DriftProtocolClient);
18
- fetchUserPositions(user: PublicKey): Promise<{
19
- perpPositions: PerpPosition[];
20
- spotPositions: SpotPosition[];
21
- }>;
22
- getDepositorPda(driftVault: PublicKey): PublicKey;
23
- parseDriftVaults(driftVaults: PublicKey[]): Promise<DriftVault[]>;
24
- parseDriftVault(driftVault: PublicKey): Promise<DriftVault>;
25
- composeRemainingAccounts(user: PublicKey): Promise<AccountMeta[]>;
26
- parseDepositor(depositor: PublicKey, data: Buffer): {
27
- address: PublicKey;
28
- driftVault: PublicKey;
29
- shares: any;
30
- };
31
- /**
32
- * Finds all drift vault depositors
33
- */
34
- findAndParseVaultDepositors(commitment?: Commitment): Promise<{
35
- address: PublicKey;
36
- driftVault: PublicKey;
37
- shares: any;
38
- }[]>;
39
- /**
40
- * Initialize a vault depositor
41
- */
42
- initializeVaultDepositor(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
43
- /**
44
- * Deposit to a drift vault
45
- */
46
- deposit(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
47
- /**
48
- * Request withdrawal from a drift vault
49
- */
50
- requestWithdraw(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
51
- /**
52
- * Cancel a withdrawal request
53
- */
54
- cancelWithdrawRequest(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
55
- /**
56
- * Withdraw from a drift vault
57
- */
58
- withdraw(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
59
- }
60
- export {};