@glamsystems/glam-sdk 1.0.13 → 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 (67) hide show
  1. package/README.md +1 -1
  2. package/index.cjs.js +14542 -21898
  3. package/index.esm.js +14521 -21841
  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 +2397 -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,217 +0,0 @@
1
- import { struct } from "@coral-xyz/borsh";
2
- import { BN } from "@coral-xyz/anchor";
3
- import { PublicKey } from "@solana/web3.js";
4
- import { Decodable } from "./base";
5
- import { PkMap } from "../utils";
6
- import { MarginMode, MarketType, OracleSource, Order, SpotBalanceType } from "../utils/drift/types";
7
- export declare class SpotPosition {
8
- marketIndex: number;
9
- balanceType: SpotBalanceType;
10
- scaledBalance: BN;
11
- openOrders: number;
12
- openBids: BN;
13
- openAsks: BN;
14
- cumulativeDeposits: BN;
15
- constructor(data: any);
16
- get marketPda(): PublicKey;
17
- calcBalance(decimals: number, cumulativeDepositInterest: BN, cumulativeBorrowInterest: BN): {
18
- amount: number;
19
- uiAmount: number;
20
- };
21
- calcBalanceBn(decimals: number, cumulativeDepositInterest: BN, cumulativeBorrowInterest: BN): BN;
22
- _interest(cumulativeDepositInterest: BN, cumulativeBorrowInterest: BN): BN;
23
- get direction(): "borrow" | "deposit";
24
- }
25
- export declare class PerpPosition {
26
- baseAssetAmount: BN;
27
- lastCumulativeFundingRate: BN;
28
- marketIndex: number;
29
- quoteAssetAmount: BN;
30
- quoteEntryAmount: BN;
31
- quoteBreakEvenAmount: BN;
32
- openOrders: number;
33
- openBids: BN;
34
- openAsks: BN;
35
- settledPnl: BN;
36
- lpShares: BN;
37
- remainderBaseAssetAmount: number;
38
- lastBaseAssetAmountPerLp: BN;
39
- lastQuoteAssetAmountPerLp: BN;
40
- perLpBase: number;
41
- constructor(data: any);
42
- get marketPda(): PublicKey;
43
- baseAssetValue(oraclePrice: BN): BN;
44
- unrealizedPnl(oraclePrice: BN): BN;
45
- getUsdValueScaled(oraclePrice: BN, cumulativeFundingRateLong: BN, cumulativeFundingRateShort: BN): BN;
46
- calcFundingPayment(cumulativeFundingRateLong: BN, cumulativeFundingRateShort: BN): BN;
47
- }
48
- export declare class DriftVaultDepositor extends Decodable {
49
- discriminator: number[];
50
- vault: PublicKey;
51
- pubkey: PublicKey;
52
- authority: PublicKey;
53
- vaultShares: BN;
54
- lastWithdrawRequest: {
55
- shares: BN;
56
- value: BN;
57
- ts: BN;
58
- };
59
- lastValidTs: BN;
60
- netDeposits: BN;
61
- totalDeposits: BN;
62
- totalWithdraws: BN;
63
- cumulativeProfitShareAmount: BN;
64
- profitShareFeePaid: BN;
65
- vaultSharesBase: number;
66
- lastFuelUpdateTs: number;
67
- cumulativeFuelPerShareAmount: BN;
68
- fuelAmount: BN;
69
- padding: BN[];
70
- static _layout: any;
71
- get netShares(): BN;
72
- /** Rebase shares to match the vault's current shares base. */
73
- private rebaseShares;
74
- /** Net shares rebased to the vault's current shares base. */
75
- netSharesRebased(vaultSharesBase: number): BN;
76
- }
77
- export declare class DriftVault extends Decodable {
78
- discriminator: number[];
79
- nameBytes: number[];
80
- pubkey: PublicKey;
81
- manager: PublicKey;
82
- tokenAccount: PublicKey;
83
- userStats: PublicKey;
84
- user: PublicKey;
85
- delegate: PublicKey;
86
- liquidationDelegate: PublicKey;
87
- userShares: BN;
88
- totalShares: BN;
89
- lastFeeUpdateTs: BN;
90
- liquidationStartTs: BN;
91
- redeemPeriod: BN;
92
- totalWithdrawRequested: BN;
93
- maxTokens: BN;
94
- managementFee: BN;
95
- initTs: BN;
96
- netDeposits: BN;
97
- managerNetDeposits: BN;
98
- totalDeposits: BN;
99
- totalWithdraws: BN;
100
- managerTotalDeposits: BN;
101
- managerTotalWithdraws: BN;
102
- managerTotalFee: BN;
103
- managerTotalProfitShare: BN;
104
- minDepositAmount: BN;
105
- lastManagerWithdrawRequest: {
106
- shares: BN;
107
- amount: BN;
108
- ts: BN;
109
- };
110
- sharesBase: number;
111
- profitShare: number;
112
- hurdleRate: number;
113
- spotMarketIndex: number;
114
- bump: number;
115
- permissioned: boolean;
116
- vaultProtocol: boolean;
117
- fuelDistributionMode: number;
118
- feeUpdateStatus: number;
119
- padding1: number;
120
- lastCumulativeFuelPerShareTs: number;
121
- cumulativeFuelPerShare: BN;
122
- cumulativeFuel: BN;
123
- managerBorrowedValue: BN;
124
- padding: BN[];
125
- static _layout: any;
126
- get name(): string;
127
- marketPda(marketType: MarketType, marketIndex: number): PublicKey;
128
- aum(spotPositions: SpotPosition[], perpPositions: PerpPosition[], spotMarketsMap: PkMap<DriftSpotMarket>, perpMarketsMap: PkMap<DriftPerpMarket>): BN;
129
- getBaseAsset(spotMarketsMap: PkMap<DriftSpotMarket>): {
130
- mint: PublicKey;
131
- decimals: number;
132
- };
133
- aumInBaseAsset(spotPositions: SpotPosition[], perpPositions: PerpPosition[], spotMarketsMap: PkMap<DriftSpotMarket>, perpMarketsMap: PkMap<DriftPerpMarket>): BN;
134
- }
135
- export declare class DriftUser {
136
- _address: PublicKey;
137
- authority: PublicKey;
138
- delegate: PublicKey;
139
- nameBytes: number[];
140
- subAccountId: number;
141
- spotPositions: SpotPosition[];
142
- perpPositions: PerpPosition[];
143
- orders: Order[];
144
- status: number;
145
- nextLiquidationId: number;
146
- nextOrderId: number;
147
- maxMarginRatio: number;
148
- lastAddPerpLpSharesTs: BN;
149
- settledPerpPnl: BN;
150
- totalDeposits: BN;
151
- totalWithdraws: BN;
152
- totalSocialLoss: BN;
153
- cumulativePerpFunding: BN;
154
- cumulativeSpotFees: BN;
155
- liquidationMarginFreed: BN;
156
- lastActiveSlot: BN;
157
- isMarginTradingEnabled: boolean;
158
- idle: boolean;
159
- openOrders: number;
160
- hasOpenOrder: boolean;
161
- openAuctions: number;
162
- hasOpenAuction: boolean;
163
- lastFuelBonusUpdateTs: number;
164
- marginMode: MarginMode;
165
- poolId: number;
166
- static decode(address: PublicKey, buffer: Buffer): DriftUser;
167
- get name(): string;
168
- getAddress(): PublicKey;
169
- }
170
- export declare class DriftSpotMarket extends Decodable {
171
- discriminator: number[];
172
- marketPda: PublicKey;
173
- oracle: PublicKey;
174
- lastOraclePrice: BN;
175
- mint: PublicKey;
176
- vault: PublicKey;
177
- nameBytes: number[];
178
- padding1: number[];
179
- cumulativeDepositInterest: BN;
180
- cumulativeBorrowInterest: BN;
181
- padding2: number[];
182
- decimals: number;
183
- marketIndex: number;
184
- padding3: number;
185
- oracleSourceOrd: number;
186
- padding4: number[];
187
- tokenProgram: number;
188
- poolId: number;
189
- padding5: number[];
190
- static _layout: any;
191
- get name(): string;
192
- get oracleSource(): OracleSource;
193
- get tokenProgramId(): PublicKey;
194
- }
195
- export declare class DriftPerpMarket extends Decodable {
196
- discriminator: number[];
197
- marketPda: PublicKey;
198
- oracle: PublicKey;
199
- lastOraclePrice: BN;
200
- cumulativeFundingRateLong: BN;
201
- cumulativeFundingRateShort: BN;
202
- padding1: number[];
203
- oracleSourceOrd: number;
204
- padding2: number[];
205
- nameBytes: number[];
206
- padding3: number[];
207
- marketIndex: number;
208
- padding4: number[];
209
- quoteSpotMarketIndex: number;
210
- static decode<T extends Decodable>(this: {
211
- new (): T;
212
- _layout: ReturnType<typeof struct>;
213
- }, address: PublicKey, buffer: Buffer): T;
214
- static _layout: any;
215
- get name(): string;
216
- get oracleSource(): OracleSource;
217
- }
@@ -1,2 +0,0 @@
1
- export * from "./types";
2
- export * from "./orderParams";
@@ -1,28 +0,0 @@
1
- import { OptionalOrderParams, OrderParams, OrderTriggerCondition } from "./types";
2
- import { BN } from "@coral-xyz/anchor";
3
- export declare function getLimitOrderParams(params: Omit<OptionalOrderParams, "orderType"> & {
4
- price: BN;
5
- }): OptionalOrderParams;
6
- export declare function getTriggerMarketOrderParams(params: Omit<OptionalOrderParams, "orderType"> & {
7
- triggerCondition: OrderTriggerCondition;
8
- triggerPrice: BN;
9
- }): OptionalOrderParams;
10
- export declare function getTriggerLimitOrderParams(params: Omit<OptionalOrderParams, "orderType"> & {
11
- triggerCondition: OrderTriggerCondition;
12
- triggerPrice: BN;
13
- price: BN;
14
- }): OptionalOrderParams;
15
- export declare function getMarketOrderParams(params: Omit<OptionalOrderParams, "orderType">): OptionalOrderParams;
16
- /**
17
- * Creates an OrderParams object with the given OptionalOrderParams and any params to override.
18
- *
19
- * example:
20
- * ```
21
- * const orderParams = getOrderParams(optionalOrderParams, { marketType: MarketType.PERP });
22
- * ```
23
- *
24
- * @param optionalOrderParams
25
- * @param overridingParams
26
- * @returns
27
- */
28
- export declare function getOrderParams(optionalOrderParams: OptionalOrderParams, overridingParams?: Record<string, any>): OrderParams;