@glamsystems/glam-sdk 1.1.0 → 1.1.1-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 (141) hide show
  1. package/index.cjs.d.ts +0 -1
  2. package/index.cjs.js +120789 -1
  3. package/index.esm.d.ts +0 -1
  4. package/index.esm.js +120308 -1
  5. package/package.json +15 -27
  6. package/target/idl/glam_mint-staging.json +480 -1
  7. package/target/idl/glam_mint.json +247 -1
  8. package/target/types/glam_mint-staging.ts +480 -1
  9. package/target/types/glam_mint.ts +247 -1
  10. package/LICENSE +0 -201
  11. package/buffer-layout.d.ts +0 -88
  12. package/src/assets.d.ts +0 -39
  13. package/src/client/access.d.ts +0 -57
  14. package/src/client/base.d.ts +0 -234
  15. package/src/client/bridge.d.ts +0 -205
  16. package/src/client/bridgeRegistry.d.ts +0 -32
  17. package/src/client/cctp.d.ts +0 -164
  18. package/src/client/epi.d.ts +0 -228
  19. package/src/client/fees.d.ts +0 -33
  20. package/src/client/invest.d.ts +0 -37
  21. package/src/client/jupiter-lend/borrow.d.ts +0 -92
  22. package/src/client/jupiter-lend/earn.d.ts +0 -64
  23. package/src/client/jupiter-lend/index.d.ts +0 -3
  24. package/src/client/jupiter-lend/shared.d.ts +0 -129
  25. package/src/client/jupiter.d.ts +0 -53
  26. package/src/client/kamino/farm.d.ts +0 -39
  27. package/src/client/kamino/index.d.ts +0 -4
  28. package/src/client/kamino/lending.d.ts +0 -94
  29. package/src/client/kamino/types.d.ts +0 -56
  30. package/src/client/kamino/vaults.d.ts +0 -39
  31. package/src/client/loopscale/borrow.d.ts +0 -118
  32. package/src/client/loopscale/core.d.ts +0 -604
  33. package/src/client/loopscale/index.d.ts +0 -5
  34. package/src/client/loopscale/lend.d.ts +0 -123
  35. package/src/client/loopscale/vault.d.ts +0 -43
  36. package/src/client/marinade.d.ts +0 -42
  37. package/src/client/mint.d.ts +0 -143
  38. package/src/client/orca.d.ts +0 -255
  39. package/src/client/phoenix.d.ts +0 -214
  40. package/src/client/price.d.ts +0 -182
  41. package/src/client/stake-pool.d.ts +0 -39
  42. package/src/client/stake.d.ts +0 -34
  43. package/src/client/state.d.ts +0 -56
  44. package/src/client/timelock.d.ts +0 -31
  45. package/src/client/vault.d.ts +0 -98
  46. package/src/client.d.ts +0 -82
  47. package/src/clientConfig.d.ts +0 -32
  48. package/src/constants.d.ts +0 -111
  49. package/src/deser/base.d.ts +0 -18
  50. package/src/deser/index.d.ts +0 -4
  51. package/src/deser/integrationPolicies.d.ts +0 -195
  52. package/src/deser/kaminoLayouts.d.ts +0 -264
  53. package/src/deser/loopscaleLayouts.d.ts +0 -157
  54. package/src/deser/tokenAclLayouts.d.ts +0 -67
  55. package/src/error.d.ts +0 -29
  56. package/src/glamExports.d.ts +0 -6260
  57. package/src/globalConfig.d.ts +0 -27
  58. package/src/index.d.ts +0 -24
  59. package/src/models/acl.d.ts +0 -43
  60. package/src/models/index.d.ts +0 -8
  61. package/src/models/mint.d.ts +0 -57
  62. package/src/models/state.d.ts +0 -94
  63. package/src/models/types.d.ts +0 -28
  64. package/src/protocols.d.ts +0 -29
  65. package/src/utils/accounts.d.ts +0 -71
  66. package/src/utils/bitmask.d.ts +0 -53
  67. package/src/utils/blockhash.d.ts +0 -11
  68. package/src/utils/common.d.ts +0 -73
  69. package/src/utils/computeBudget.d.ts +0 -15
  70. package/src/utils/evm.d.ts +0 -10
  71. package/src/utils/fraction.d.ts +0 -29
  72. package/src/utils/glamPDAs.d.ts +0 -15
  73. package/src/utils/helius.d.ts +0 -66
  74. package/src/utils/index.d.ts +0 -17
  75. package/src/utils/jupiterApi.d.ts +0 -95
  76. package/src/utils/lookupTables.d.ts +0 -83
  77. package/src/utils/phoenixApi.d.ts +0 -146
  78. package/src/utils/pkmap.d.ts +0 -87
  79. package/src/utils/pkset.d.ts +0 -73
  80. package/src/utils/positionCategorizer.d.ts +0 -38
  81. package/src/utils/rpc.d.ts +0 -18
  82. package/src/utils/timelock.d.ts +0 -52
  83. package/src/utils/transaction.d.ts +0 -13
  84. package/target/idl/ext_bridge-staging.json +0 -2379
  85. package/target/idl/ext_bridge.json +0 -2379
  86. package/target/idl/ext_drift.json +0 -5464
  87. package/target/idl/ext_epi-staging.json +0 -2862
  88. package/target/idl/ext_epi.json +0 -2862
  89. package/target/idl/ext_loopscale-staging.json +0 -4708
  90. package/target/idl/ext_loopscale.json +0 -4708
  91. package/target/idl/ext_marinade-staging.json +0 -1587
  92. package/target/idl/ext_phoenix-staging.json +0 -3525
  93. package/target/idl/ext_phoenix.json +0 -3525
  94. package/target/idl/mock_layerzero_endpoint.json +0 -144
  95. package/target/idl/mock_layerzero_oft.json +0 -155
  96. package/target/idl/mock_wormhole_verify_vaa_shim.json +0 -58
  97. package/target/types/ext_bridge-staging.d.ts +0 -2385
  98. package/target/types/ext_bridge-staging.ts +0 -2385
  99. package/target/types/ext_bridge.d.ts +0 -2385
  100. package/target/types/ext_bridge.ts +0 -2385
  101. package/target/types/ext_cctp-staging.d.ts +0 -1268
  102. package/target/types/ext_cctp.d.ts +0 -1268
  103. package/target/types/ext_drift.d.ts +0 -5470
  104. package/target/types/ext_drift.ts +0 -5470
  105. package/target/types/ext_epi-staging.d.ts +0 -2868
  106. package/target/types/ext_epi-staging.ts +0 -2868
  107. package/target/types/ext_epi.d.ts +0 -2868
  108. package/target/types/ext_epi.ts +0 -2868
  109. package/target/types/ext_jupiter-staging.d.ts +0 -1966
  110. package/target/types/ext_jupiter.d.ts +0 -1966
  111. package/target/types/ext_kamino-staging.d.ts +0 -3433
  112. package/target/types/ext_kamino.d.ts +0 -3433
  113. package/target/types/ext_loopscale-staging.d.ts +0 -4714
  114. package/target/types/ext_loopscale-staging.ts +0 -4714
  115. package/target/types/ext_loopscale.d.ts +0 -4714
  116. package/target/types/ext_loopscale.ts +0 -4714
  117. package/target/types/ext_marinade-staging.d.ts +0 -1593
  118. package/target/types/ext_marinade-staging.ts +0 -1593
  119. package/target/types/ext_marinade.d.ts +0 -1593
  120. package/target/types/ext_orca-staging.d.ts +0 -2829
  121. package/target/types/ext_orca.d.ts +0 -2829
  122. package/target/types/ext_phoenix-staging.d.ts +0 -3531
  123. package/target/types/ext_phoenix-staging.ts +0 -3531
  124. package/target/types/ext_phoenix.d.ts +0 -3531
  125. package/target/types/ext_phoenix.ts +0 -3531
  126. package/target/types/ext_spl-staging.d.ts +0 -1274
  127. package/target/types/ext_spl.d.ts +0 -1274
  128. package/target/types/ext_stake_pool-staging.d.ts +0 -1622
  129. package/target/types/ext_stake_pool.d.ts +0 -1622
  130. package/target/types/glam_config.d.ts +0 -755
  131. package/target/types/glam_mint-staging.d.ts +0 -8802
  132. package/target/types/glam_mint.d.ts +0 -6349
  133. package/target/types/glam_policies.d.ts +0 -477
  134. package/target/types/glam_protocol-staging.d.ts +0 -3362
  135. package/target/types/glam_protocol.d.ts +0 -2783
  136. package/target/types/mock_layerzero_endpoint.d.ts +0 -150
  137. package/target/types/mock_layerzero_endpoint.ts +0 -150
  138. package/target/types/mock_layerzero_oft.d.ts +0 -161
  139. package/target/types/mock_layerzero_oft.ts +0 -161
  140. package/target/types/mock_wormhole_verify_vaa_shim.d.ts +0 -64
  141. package/target/types/mock_wormhole_verify_vaa_shim.ts +0 -64
@@ -1,604 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { AccountInfo as Web3AccountInfo, Commitment, Keypair, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction, AccountMeta } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions, type ProtocolPolicyTxBuilder } from "../base";
4
- import { LoopscaleLoan, LoopscaleMarketInformation, LoopscaleStrategy } from "../../deser";
5
- import { LoopscaleBorrowPolicy, LoopscaleLendingPolicy, LoopscaleVaultPolicy } from "../../deser/integrationPolicies";
6
- export declare const LOOPSCALE_BS_AUTH: PublicKey;
7
- export declare const LOOPSCALE_STRATEGY_DISCRIMINATOR: Buffer<ArrayBuffer>;
8
- export declare const LOOPSCALE_CREATE_LOAN_DISCRIMINATOR: Buffer<ArrayBuffer>;
9
- export declare const LOOPSCALE_CREATE_STRATEGY_DISCRIMINATOR: Buffer<ArrayBuffer>;
10
- export declare const LOOPSCALE_DEPOSIT_COLLATERAL_DISCRIMINATOR: Buffer<ArrayBuffer>;
11
- export declare const LOOPSCALE_BORROW_PRINCIPAL_DISCRIMINATOR: Buffer<ArrayBuffer>;
12
- export declare const LOOPSCALE_REPAY_PRINCIPAL_DISCRIMINATOR: Buffer<ArrayBuffer>;
13
- export declare const LOOPSCALE_WITHDRAW_COLLATERAL_DISCRIMINATOR: Buffer<ArrayBuffer>;
14
- export declare const LOOPSCALE_SELL_LEDGER_DISCRIMINATOR: Buffer<ArrayBuffer>;
15
- export declare const LOOPSCALE_DEPOSIT_STRATEGY_DISCRIMINATOR: Buffer<ArrayBuffer>;
16
- export declare const LOOPSCALE_UPDATE_STRATEGY_DISCRIMINATOR: Buffer<ArrayBuffer>;
17
- export declare const LOOPSCALE_WITHDRAW_STRATEGY_DISCRIMINATOR: Buffer<ArrayBuffer>;
18
- export declare const LOOPSCALE_CLOSE_STRATEGY_DISCRIMINATOR: Buffer<ArrayBuffer>;
19
- export declare const LOOPSCALE_UPDATE_STRATEGY_STANDARD_ACCOUNT_COUNT = 12;
20
- export type LoopscaleQuote = {
21
- apy: number;
22
- strategy: string;
23
- collateralIdentifier: string;
24
- ltv: number;
25
- lqt: number;
26
- amount: number;
27
- };
28
- export type LoopscaleMaxQuoteParams = {
29
- principalMint: PublicKey;
30
- collateralMint: PublicKey;
31
- collateralAmount: BN;
32
- durationType: number;
33
- duration: number;
34
- borrowAmount?: BN;
35
- externalYieldSource?: number;
36
- };
37
- export type LoopscaleMappedTransaction = {
38
- ixs: TransactionInstruction[];
39
- additionalSigners: Keypair[];
40
- };
41
- export type LoopscaleApiCollateralTermUpdate = {
42
- addCollateral?: Record<string, {
43
- durationsAndApys: Record<string, string>;
44
- }>;
45
- updateCollateral?: Record<string, {
46
- apyUpdate: Record<string, string>;
47
- }>;
48
- };
49
- export type LoopscaleApiUpdateStrategyParams = {
50
- originationsEnabled?: boolean;
51
- liquidityBuffer?: number;
52
- interestFee?: number;
53
- originationFee?: number;
54
- principalFee?: number;
55
- originationCap?: number;
56
- externalYieldSource?: {
57
- newExternalYieldSource: number;
58
- };
59
- };
60
- export type LoopscaleApiTransaction = {
61
- message?: string;
62
- signatures?: unknown[];
63
- };
64
- export type LoopscaleApiTransactionResponse = LoopscaleApiTransaction & {
65
- transaction?: LoopscaleApiTransaction;
66
- transactions?: LoopscaleApiTransaction[];
67
- loanAddress?: string;
68
- };
69
- export type LoopscaleApiTransactionPayload = LoopscaleApiTransactionResponse | LoopscaleApiTransactionResponse[];
70
- /**
71
- * Account inputs for a Loopscale borrow that are derived from on-chain market
72
- * and strategy state (see {@link LoopscaleCoreClient.resolveBorrowMarketAccounts}).
73
- */
74
- export type BorrowMarketAccounts = {
75
- marketInformation: PublicKey;
76
- principalMint: PublicKey;
77
- durationIndex: number;
78
- assetIndexGuidance: Buffer;
79
- };
80
- export type LoopscaleAssetIndexGuidance = {
81
- collateralAssetIndex: number;
82
- principalAssetIndex: number;
83
- ltvAssetIndex: number;
84
- };
85
- export declare function encodeLoopscaleAssetIndexGuidance(guidance: LoopscaleAssetIndexGuidance): Buffer;
86
- export type LoopscaleSellLedgerAssetIndexGuidance = {
87
- principalAssetIndex: number;
88
- collateralAssetIndex: number;
89
- };
90
- export declare function encodeLoopscaleSellLedgerAssetIndexGuidance(guidance: LoopscaleSellLedgerAssetIndexGuidance): Buffer;
91
- export type LoopscaleBorrowPrincipalTerms = {
92
- strategy: PublicKey;
93
- expectedLoanValues: LoopscaleExpectedLoanValues;
94
- assetIndexGuidance: Buffer;
95
- durationIndex: number;
96
- };
97
- export type LoopscaleBorrowQuoteTerms = LoopscaleBorrowPrincipalTerms & {
98
- quote: LoopscaleQuote;
99
- };
100
- export type LoopscaleSellLedgerTerms = {
101
- ledgerIndex: number;
102
- oldStrategy: PublicKey;
103
- newStrategy: PublicKey;
104
- oldStrategyMarketInformation: PublicKey;
105
- newStrategyMarketInformation: PublicKey;
106
- principalMint: PublicKey;
107
- assetIndexGuidance: Buffer;
108
- guidance: LoopscaleSellLedgerAssetIndexGuidance;
109
- remainingAccounts: AccountMeta[];
110
- };
111
- export type LoopscaleStrategyWithMarket = {
112
- strategy: LoopscaleStrategy;
113
- marketInfo: LoopscaleMarketInformation;
114
- };
115
- export declare function getLoopscaleApiMessages(response: LoopscaleApiTransactionPayload): string[];
116
- /**
117
- * Replaces signer-only setup accounts that Loopscale's API may include after
118
- * the standard accounts.
119
- *
120
- * Those API-provided signer pubkeys are not available to the GLAM caller. The
121
- * remapped ext_loopscale instruction only needs them to satisfy account signer
122
- * constraints for the generated setup path, so the SDK substitutes fresh local
123
- * keypairs and returns them for the caller to sign the transaction with.
124
- *
125
- * FIXME: When do we need to do this? Need a way to determine this dynamically.
126
- */
127
- export declare function replaceLoopscaleApiExtraSigners(ix: TransactionInstruction, standardAccountCount: number): LoopscaleMappedTransaction;
128
- export declare function createVaultWsolAtaSetupIxs(params: {
129
- mint: PublicKey;
130
- payer: PublicKey;
131
- owner: PublicKey;
132
- ata: PublicKey;
133
- }): TransactionInstruction[];
134
- export declare function createVaultTokenAtaSetupIx(params: {
135
- mint: PublicKey;
136
- payer: PublicKey;
137
- owner: PublicKey;
138
- ata: PublicKey;
139
- tokenProgram: PublicKey;
140
- }): TransactionInstruction;
141
- export declare function buildLoopscaleApiCollateralTermUpdates(strategy: LoopscaleStrategy, marketInfo: LoopscaleMarketInformation, collateralTerms: LoopscaleMultiCollateralTermsUpdateParams[]): LoopscaleApiCollateralTermUpdate | undefined;
142
- export type LoopscaleExpectedLoanValues = {
143
- expectedApy: BN;
144
- expectedLqt: [number, number, number, number, number];
145
- };
146
- export type LoopscaleExternalYieldSourceArgs = {
147
- newExternalYieldSource: number;
148
- createExternalYieldAccount: boolean;
149
- };
150
- export type LoopscaleOnchainExternalYieldSourceArgs = {
151
- newExternalYieldSource: number;
152
- externalYieldVault: PublicKey;
153
- };
154
- export type CreateLoanParams = {
155
- nonce: BN;
156
- };
157
- export type LoopscaleLpParams = {
158
- exactIn: {
159
- amountIn: BN;
160
- minAmountOut: BN;
161
- };
162
- } | {
163
- exactOut: {
164
- amountOut: BN;
165
- maxAmountIn: BN;
166
- };
167
- };
168
- export type LoopscaleVaultStakeParams = {
169
- amount: BN;
170
- principalAmount: BN;
171
- stakeAll: boolean | null;
172
- duration: number;
173
- durationType: number;
174
- actionType: number;
175
- };
176
- export type LoopscaleVaultUnstakeParams = {
177
- actionType: number;
178
- principalAmount: BN;
179
- };
180
- export type CreateStrategyParams = {
181
- originationCap: BN;
182
- liquidityBuffer: BN;
183
- interestFee: BN;
184
- originationFee: BN;
185
- principalFee: BN;
186
- originationsEnabled: boolean;
187
- externalYieldSourceArgs: LoopscaleOnchainExternalYieldSourceArgs | null;
188
- };
189
- export type LoopscaleCollateralTermsIndices = {
190
- collateralIndex: number;
191
- durationIndex: number;
192
- };
193
- export type LoopscaleMultiCollateralTermsUpdateParams = {
194
- apy: number;
195
- indices: LoopscaleCollateralTermsIndices[];
196
- };
197
- export type UpdateStrategyParams = {
198
- originationsEnabled?: boolean | null;
199
- liquidityBuffer?: BN | null;
200
- interestFee?: BN | null;
201
- originationFee?: BN | null;
202
- principalFee?: BN | null;
203
- originationCap?: BN | null;
204
- marketInformation?: PublicKey | null;
205
- externalYieldSourceArgs?: LoopscaleOnchainExternalYieldSourceArgs | null;
206
- };
207
- export type DepositCollateralParams = {
208
- amount: BN;
209
- assetType: number;
210
- assetIdentifier: PublicKey;
211
- assetIndexGuidance: number[];
212
- };
213
- export type UpdateWeightMatrixParams = {
214
- collateralIndex: number;
215
- weightMatrix: [number, number, number, number, number];
216
- expectedLoanValues: LoopscaleExpectedLoanValues;
217
- assetIndexGuidance: Buffer;
218
- };
219
- export type BorrowPrincipalParams = {
220
- amount: BN;
221
- assetIndexGuidance: number[];
222
- duration: number;
223
- expectedLoanValues: LoopscaleExpectedLoanValues;
224
- skipSolUnwrap: boolean;
225
- };
226
- export type CreateLoanAccounts = {
227
- loan: PublicKey;
228
- };
229
- export type CloseLoanAccounts = {
230
- loan: PublicKey;
231
- };
232
- export type CreateStrategyAccounts = {
233
- nonce: PublicKey;
234
- strategy: PublicKey;
235
- marketInformation: PublicKey;
236
- principalMint: PublicKey;
237
- };
238
- export type DepositStrategyAccounts = {
239
- strategy: PublicKey;
240
- principalMint: PublicKey;
241
- marketInformation: PublicKey;
242
- lenderTa?: PublicKey;
243
- strategyTa?: PublicKey;
244
- tokenProgram?: PublicKey;
245
- associatedTokenProgram?: PublicKey;
246
- };
247
- export type UpdateStrategyAccounts = {
248
- strategy: PublicKey;
249
- marketInformation: PublicKey;
250
- principalMint: PublicKey;
251
- strategyTa?: PublicKey;
252
- tokenProgram?: PublicKey;
253
- associatedTokenProgram?: PublicKey;
254
- remainingAccounts?: AccountMeta[];
255
- };
256
- export type WithdrawStrategyAccounts = {
257
- strategy: PublicKey;
258
- principalMint: PublicKey;
259
- marketInformation: PublicKey;
260
- lenderTa?: PublicKey;
261
- strategyTa?: PublicKey;
262
- tokenProgram?: PublicKey;
263
- };
264
- export type CloseStrategyAccounts = {
265
- strategy: PublicKey;
266
- principalMint: PublicKey;
267
- tokenProgram?: PublicKey;
268
- associatedTokenProgram?: PublicKey;
269
- };
270
- export type DepositWithdrawUserVaultAccounts = {
271
- vault: PublicKey;
272
- strategy: PublicKey;
273
- marketInformation: PublicKey;
274
- lpMint: PublicKey;
275
- principalMint: PublicKey;
276
- lpTokenProgram: PublicKey;
277
- principalTokenProgram: PublicKey;
278
- };
279
- export type StakeUserVaultLpAccounts = {
280
- nonce: PublicKey;
281
- vault: PublicKey;
282
- vaultStake: PublicKey;
283
- lpMint: PublicKey;
284
- };
285
- export type UnstakeUserVaultLpAccounts = {
286
- vault: PublicKey;
287
- lpMint: PublicKey;
288
- vaultStake: PublicKey;
289
- };
290
- export type ClaimVaultRewardsAccounts = {
291
- vault: PublicKey;
292
- vaultStake: PublicKey;
293
- vaultRewardsInfo?: PublicKey;
294
- userRewardsInfo?: PublicKey;
295
- associatedTokenProgram?: PublicKey;
296
- remainingAccounts?: AccountMeta[];
297
- };
298
- export type DepositCollateralAccounts = {
299
- loan: PublicKey;
300
- depositMint: PublicKey;
301
- assetIdentifier?: PublicKey;
302
- borrowerCollateralTa?: PublicKey;
303
- loanCollateralTa?: PublicKey;
304
- tokenProgram?: PublicKey;
305
- associatedTokenProgram?: PublicKey;
306
- };
307
- export type UpdateWeightMatrixAccounts = {
308
- loan: PublicKey;
309
- };
310
- export type BorrowPrincipalAccounts = {
311
- loan: PublicKey;
312
- strategy: PublicKey;
313
- };
314
- export type WithdrawCollateralParams = {
315
- amount: BN;
316
- collateralIndex: number;
317
- assetIndexGuidance: number[];
318
- expectedLoanValues: LoopscaleExpectedLoanValues;
319
- closeIfEligible: boolean;
320
- withdrawAll: boolean;
321
- };
322
- export type WithdrawCollateralAccounts = {
323
- loan: PublicKey;
324
- assetMint: PublicKey;
325
- borrowerTa?: PublicKey;
326
- loanTa?: PublicKey;
327
- tokenProgram?: PublicKey;
328
- associatedTokenProgram?: PublicKey;
329
- remainingAccounts?: AccountMeta[];
330
- };
331
- export type RepayPrincipalParams = {
332
- amount: BN;
333
- ledgerIndex: number;
334
- repayAll: boolean;
335
- };
336
- export type SellLedgerParams = {
337
- ledgerIndex: number;
338
- expectedSalePrice: BN;
339
- assetIndexGuidance: Buffer;
340
- };
341
- export type RepayPrincipalAccounts = {
342
- loan: PublicKey;
343
- strategy: PublicKey;
344
- marketInformation?: PublicKey;
345
- principalMint?: PublicKey;
346
- borrowerTa?: PublicKey;
347
- strategyTa?: PublicKey;
348
- tokenProgram?: PublicKey;
349
- associatedTokenProgram?: PublicKey;
350
- remainingAccounts?: AccountMeta[];
351
- };
352
- export type SellLedgerAccounts = {
353
- loan: PublicKey;
354
- oldStrategy: PublicKey;
355
- newStrategy: PublicKey;
356
- oldStrategyMarketInformation: PublicKey;
357
- newStrategyMarketInformation: PublicKey;
358
- principalMint: PublicKey;
359
- newStrategyTa?: PublicKey;
360
- lenderAuthTa?: PublicKey;
361
- userVault?: PublicKey;
362
- oldStrategyTa?: PublicKey;
363
- tokenProgram?: PublicKey;
364
- associatedTokenProgram?: PublicKey;
365
- remainingAccounts?: AccountMeta[];
366
- };
367
- export declare function getLoopscaleEventAuthorityPda(programId?: PublicKey): PublicKey;
368
- export declare function getLoopscaleLoanPda(borrower: PublicKey, nonce: BN, programId?: PublicKey): PublicKey;
369
- export declare function getLoopscaleStrategyPda(nonce: PublicKey, programId?: PublicKey): PublicKey;
370
- export declare function getLoopscaleVaultPda(vaultNonce: PublicKey, programId?: PublicKey): PublicKey;
371
- export declare function getLoopscaleVaultStrategyPda(vault: PublicKey, programId?: PublicKey): PublicKey;
372
- export declare function getLoopscaleVaultRewardsInfoPda(vault: PublicKey, programId?: PublicKey): PublicKey;
373
- export declare function getLoopscaleVaultStakePda(stakeNonce: PublicKey, vault: PublicKey, programId?: PublicKey): PublicKey;
374
- export declare function getLoopscaleUserRewardsInfoPda(vaultStake: PublicKey, programId?: PublicKey): PublicKey;
375
- export type PriceLoansAccounts = {
376
- loanAccounts: PublicKey[];
377
- oracleAccounts: PublicKey[];
378
- solUsdOracle?: PublicKey;
379
- baseAssetOracle?: PublicKey;
380
- glamConfig?: PublicKey;
381
- };
382
- export type PriceStrategiesAccounts = {
383
- strategyAccounts: PublicKey[];
384
- oracleAccounts: PublicKey[];
385
- solUsdOracle?: PublicKey;
386
- baseAssetOracle?: PublicKey;
387
- glamConfig?: PublicKey;
388
- };
389
- export type PriceVaultsAccounts = {
390
- numVaults: number;
391
- vaultAccounts: PublicKey[];
392
- strategyAccounts: PublicKey[];
393
- userLpTokenAccounts: PublicKey[];
394
- vaultStakeAccounts: PublicKey[];
395
- oracleAccounts: PublicKey[];
396
- solUsdOracle?: PublicKey;
397
- baseAssetOracle?: PublicKey;
398
- glamConfig?: PublicKey;
399
- };
400
- export declare function isLoopscaleLoanAccountInfo(info: Web3AccountInfo<Buffer> | null): info is Web3AccountInfo<Buffer>;
401
- export declare function isLoopscaleStrategyAccountInfo(info: Web3AccountInfo<Buffer> | null): info is Web3AccountInfo<Buffer>;
402
- export declare function isLoopscaleVaultAccountInfo(info: Web3AccountInfo<Buffer> | null): info is Web3AccountInfo<Buffer>;
403
- export declare function isLoopscaleVaultStakeAccountInfo(info: Web3AccountInfo<Buffer> | null): info is Web3AccountInfo<Buffer>;
404
- export declare function readLoopscaleStrategyPrincipalMint(data: Buffer): PublicKey;
405
- export declare function readLoopscaleVaultLpMint(data: Buffer): PublicKey;
406
- export declare function readLoopscaleVaultPrincipalMint(data: Buffer): PublicKey;
407
- export declare function readLoopscaleVaultStakeVault(data: Buffer): PublicKey;
408
- export declare function readLoopscaleVaultStakeAmount(data: Buffer): BN;
409
- export declare function readTokenAccountAmount(data: Buffer): bigint;
410
- export declare function readLoopscaleOracleMints(data: Buffer): PublicKey[];
411
- export declare class LoopscaleBorrowTxBuilder extends BaseTxBuilder<LoopscaleCoreClient> implements ProtocolPolicyTxBuilder<LoopscaleBorrowPolicy> {
412
- setPolicyIx(policy: LoopscaleBorrowPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
413
- setBorrowPolicyIx(policy: LoopscaleBorrowPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
414
- setPolicyTx(policy: LoopscaleBorrowPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
415
- setBorrowPolicyTx(policy: LoopscaleBorrowPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
416
- clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
417
- clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
418
- closeLoanIx(loan: PublicKey, signer?: PublicKey): Promise<TransactionInstruction>;
419
- closeLoanTx(loan: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
420
- depositCollateralIx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
421
- depositCollateralTx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
422
- /** @deprecated */
423
- updateWeightMatrixIx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
424
- /** @deprecated */
425
- updateWeightMatrixTx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
426
- }
427
- export declare class LoopscaleLendTxBuilder extends BaseTxBuilder<LoopscaleCoreClient> {
428
- setPolicyIx(policy: LoopscaleLendingPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
429
- setLendingPolicyIx(policy: LoopscaleLendingPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
430
- setPolicyTx(policy: LoopscaleLendingPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
431
- setLendingPolicyTx(policy: LoopscaleLendingPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
432
- clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
433
- clearLendingPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
434
- clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
435
- clearLendingPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
436
- createStrategyIx(params: CreateStrategyParams, accounts: CreateStrategyAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
437
- }
438
- export declare class LoopscaleVaultTxBuilder extends BaseTxBuilder<LoopscaleCoreClient> implements ProtocolPolicyTxBuilder<LoopscaleVaultPolicy> {
439
- setPolicyIx(policy: LoopscaleVaultPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
440
- setVaultPolicyIx(policy: LoopscaleVaultPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
441
- setPolicyTx(policy: LoopscaleVaultPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
442
- setVaultPolicyTx(policy: LoopscaleVaultPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
443
- clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
444
- clearVaultPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
445
- clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
446
- clearVaultPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
447
- depositUserVaultIx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
448
- depositUserVaultSetupIxs(accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): TransactionInstruction[];
449
- depositUserVaultIxs(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise<TransactionInstruction[]>;
450
- depositUserVaultTx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
451
- withdrawUserVaultIx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
452
- withdrawUserVaultIxs(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, signer?: PublicKey): Promise<TransactionInstruction[]>;
453
- withdrawUserVaultTx(params: LoopscaleLpParams, accounts: DepositWithdrawUserVaultAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
454
- stakeUserVaultLpIx(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
455
- stakeUserVaultLpSetupIxs(accounts: StakeUserVaultLpAccounts, signer?: PublicKey): TransactionInstruction[];
456
- stakeUserVaultLpIxs(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, signer?: PublicKey): Promise<TransactionInstruction[]>;
457
- stakeUserVaultLpTx(params: LoopscaleVaultStakeParams, accounts: StakeUserVaultLpAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
458
- unstakeUserVaultLpIx(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
459
- unstakeUserVaultLpSetupIxs(accounts: UnstakeUserVaultLpAccounts, signer?: PublicKey): TransactionInstruction[];
460
- unstakeUserVaultLpIxs(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, signer?: PublicKey): Promise<TransactionInstruction[]>;
461
- unstakeUserVaultLpTx(params: LoopscaleVaultUnstakeParams, accounts: UnstakeUserVaultLpAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
462
- claimVaultRewardsIx(mints: PublicKey[], accounts: ClaimVaultRewardsAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
463
- claimVaultRewardsTx(mints: PublicKey[], accounts: ClaimVaultRewardsAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
464
- private depositWithdrawUserVaultSetupIxs;
465
- }
466
- export declare class LoopscaleCoreClient {
467
- readonly base: BaseClient;
468
- readonly borrowTxBuilder: LoopscaleBorrowTxBuilder;
469
- readonly lendTxBuilder: LoopscaleLendTxBuilder;
470
- readonly vaultTxBuilder: LoopscaleVaultTxBuilder;
471
- constructor(base: BaseClient);
472
- get programId(): PublicKey;
473
- get integrationAuthorityPda(): PublicKey;
474
- getEventAuthorityPda(): PublicKey;
475
- getLoanPda(nonce: BN, borrower?: PublicKey): PublicKey;
476
- getStrategyPda(nonce: PublicKey): PublicKey;
477
- getVaultPda(vaultNonce: PublicKey): PublicKey;
478
- getVaultStrategyPda(vault: PublicKey): PublicKey;
479
- getVaultRewardsInfoPda(vault: PublicKey): PublicKey;
480
- getVaultStakePda(stakeNonce: PublicKey, vault: PublicKey): PublicKey;
481
- getUserRewardsInfoPda(vaultStake: PublicKey): PublicKey;
482
- getLoanTokenAta(loan: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
483
- getStrategyTokenAta(strategy: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
484
- getVaultLpTokenAta(lpMint: PublicKey, owner?: PublicKey, tokenProgram?: PublicKey): PublicKey;
485
- getVaultStakeLpTokenAta(vaultStake: PublicKey, lpMint: PublicKey, tokenProgram?: PublicKey): PublicKey;
486
- fetchLoan(loan: PublicKey): Promise<LoopscaleLoan>;
487
- fetchOwnedLoan(loan: PublicKey, borrower?: PublicKey): Promise<LoopscaleLoan>;
488
- fetchRegisteredLoans(commitment?: Commitment): Promise<LoopscaleLoan[]>;
489
- fetchRegisteredStrategies(commitment?: Commitment): Promise<LoopscaleStrategy[]>;
490
- fetchRegisteredVaultStakeAccountInfos(commitment?: Commitment): Promise<{
491
- address: PublicKey;
492
- info: Web3AccountInfo<Buffer>;
493
- }[]>;
494
- private fetchRegisteredExternalPositions;
495
- fetchStrategy(strategy: PublicKey): Promise<LoopscaleStrategy>;
496
- fetchOwnedStrategy(strategy: PublicKey, lender?: PublicKey): Promise<LoopscaleStrategy>;
497
- fetchStrategyMarket(strategy: PublicKey | LoopscaleStrategy): Promise<LoopscaleMarketInformation>;
498
- fetchOwnedStrategyWithMarket(strategy: PublicKey, lender?: PublicKey): Promise<LoopscaleStrategyWithMarket>;
499
- assertStrategyClosable(strategy: LoopscaleStrategy): void;
500
- assertStrategyPrincipalWithdrawable(strategy: LoopscaleStrategy, amount: BN, withdrawAll: boolean): void;
501
- /** Fetches, validates, and decodes a Loopscale MarketInformation account. */
502
- fetchMarketInformation(marketInformation: PublicKey): Promise<LoopscaleMarketInformation>;
503
- /**
504
- * Resolves the market-derived account inputs for a borrow: the asset index
505
- * guidance and the strategy duration index that matches the quoted APY.
506
- */
507
- resolveBorrowMarketAccounts(params: {
508
- strategy: PublicKey | LoopscaleStrategy;
509
- collateralMint: PublicKey;
510
- expectedApy: BN;
511
- }): Promise<BorrowMarketAccounts>;
512
- /**
513
- * Resolves the market-derived inputs for sell_ledger. Loopscale's sell API
514
- * emits principal/collateral asset-index hints plus the matching price oracle
515
- * remaining accounts.
516
- */
517
- resolveSellLedgerMarketAccounts(params: {
518
- loan: PublicKey | LoopscaleLoan;
519
- ledgerIndex: number;
520
- newStrategy: PublicKey | LoopscaleStrategy;
521
- }): Promise<LoopscaleSellLedgerTerms>;
522
- /**
523
- * Resolves borrow terms for a known strategy and expected loan values, without
524
- * consulting the quote API.
525
- */
526
- resolveBorrowTermsFromStrategy(params: {
527
- strategy: PublicKey | LoopscaleStrategy;
528
- principalMint: PublicKey;
529
- assetIdentifier: PublicKey;
530
- expectedApy: BN;
531
- expectedLqt: [number, number, number, number, number];
532
- }): Promise<LoopscaleBorrowPrincipalTerms>;
533
- /**
534
- * Resolves borrow terms for a caller-selected strategy by reading its
535
- * collateral map directly. If multiple populated duration slots exist for the
536
- * collateral, the caller must provide `requestedDurationIndex`.
537
- */
538
- resolveBorrowTermsFromTargetStrategy(params: {
539
- strategy: PublicKey | LoopscaleStrategy;
540
- principalMint: PublicKey;
541
- assetIdentifier: PublicKey;
542
- requestedDurationIndex?: number;
543
- }): Promise<LoopscaleBorrowPrincipalTerms>;
544
- /**
545
- * Fetches and selects a Loopscale quote, then resolves the borrow terms needed
546
- * for borrow_principal.
547
- */
548
- resolveBorrowTermsFromQuote(params: {
549
- principalMint: PublicKey;
550
- collateralMint: PublicKey;
551
- assetIdentifier: PublicKey;
552
- collateralAmount: BN;
553
- borrowAmount: BN;
554
- durationType: number;
555
- duration: number;
556
- externalYieldSource?: number;
557
- }): Promise<LoopscaleBorrowQuoteTerms>;
558
- private requireAssetIndex;
559
- private requireMarketAssetInfo;
560
- private requireDurationIndex;
561
- fetchMaxQuotes(params: LoopscaleMaxQuoteParams): Promise<LoopscaleQuote[]>;
562
- /**
563
- * Selects the first quote with a usable strategy, optionally requiring it to
564
- * support at least `borrowAmount` base units.
565
- */
566
- selectBestQuote(quotes: LoopscaleQuote[], externalYieldSource?: number, borrowAmount?: BN): Promise<LoopscaleQuote>;
567
- /**
568
- * Fetches quotes from Loopscale and selects the best one.
569
- */
570
- fetchBestQuote(params: LoopscaleMaxQuoteParams): Promise<LoopscaleQuote>;
571
- decompileApiMessage(message: string): Promise<TransactionInstruction[]>;
572
- mapApiIx(ix: TransactionInstruction): TransactionInstruction;
573
- addUpdateStrategyValidationMarket(ix: TransactionInstruction, marketInformation: PublicKey): TransactionInstruction;
574
- addDepositCollateralLedgerAccounts(ixs: TransactionInstruction[]): TransactionInstruction[];
575
- setDepositCollateralAssetIndexGuidance(ixs: TransactionInstruction[], assetIndexGuidance: number[]): TransactionInstruction[];
576
- getApiUpdateWeightMatrixAssetIndexGuidance(ixs: TransactionInstruction[], loan: PublicKey): number[];
577
- /**
578
- * Decompiles instructions from transaction messages and maps eligible ones to GLAM instructions
579
- *
580
- * @param messages Serialized transaction messages.
581
- * @param expectedDiscriminator Discriminator to look for in the instructions.
582
- * @returns
583
- */
584
- mapApiMessagesToGlamIxs(messages: string[], expectedDiscriminator: Buffer): Promise<TransactionInstruction[]>;
585
- /**
586
- * Fetches a transaction from the Loopscale API
587
- *
588
- * @param path API endpoint path.
589
- * @param init Request initialization options.
590
- * @returns
591
- */
592
- fetchApiTransaction(path: string, init: RequestInit): Promise<LoopscaleApiTransactionPayload>;
593
- /**
594
- * Signs a built transaction with the client wallet, has it co-signed by the
595
- * Loopscale MPC, and returns the co-signed transaction.
596
- */
597
- cosignTransaction(params: {
598
- tx: VersionedTransaction;
599
- identifier: string;
600
- }): Promise<VersionedTransaction>;
601
- coSignAndSend(ixs: TransactionInstruction[], txOptions?: TxOptions, additionalSigners?: Keypair[], identifierSuffix?: string): Promise<TransactionSignature>;
602
- sendCosignedIxBatches(txs: LoopscaleMappedTransaction[], txOptions?: TxOptions): Promise<TransactionSignature[]>;
603
- getBaseAssetOracle(): Promise<PublicKey>;
604
- }
@@ -1,5 +0,0 @@
1
- export * from "./borrow";
2
- export * from "./lend";
3
- export * from "./vault";
4
- export { LOOPSCALE_BS_AUTH, LOOPSCALE_STRATEGY_DISCRIMINATOR, buildLoopscaleApiCollateralTermUpdates, encodeLoopscaleAssetIndexGuidance, encodeLoopscaleSellLedgerAssetIndexGuidance, getLoopscaleEventAuthorityPda, getLoopscaleLoanPda, getLoopscaleStrategyPda, getLoopscaleUserRewardsInfoPda, getLoopscaleVaultPda, getLoopscaleVaultRewardsInfoPda, getLoopscaleVaultStakePda, getLoopscaleVaultStrategyPda, isLoopscaleStrategyAccountInfo, LoopscaleBorrowTxBuilder, LoopscaleLendTxBuilder, LoopscaleVaultTxBuilder, readLoopscaleStrategyPrincipalMint, } from "./core";
5
- export type { BorrowMarketAccounts, BorrowPrincipalAccounts, BorrowPrincipalParams, ClaimVaultRewardsAccounts, CloseLoanAccounts, CloseStrategyAccounts, CreateLoanAccounts, CreateLoanParams, CreateStrategyAccounts, CreateStrategyParams, DepositCollateralAccounts, DepositCollateralParams, DepositStrategyAccounts, DepositWithdrawUserVaultAccounts, LoopscaleApiCollateralTermUpdate, LoopscaleApiUpdateStrategyParams, LoopscaleAssetIndexGuidance, LoopscaleBorrowPrincipalTerms, LoopscaleBorrowQuoteTerms, LoopscaleCollateralTermsIndices, LoopscaleExpectedLoanValues, LoopscaleExternalYieldSourceArgs, LoopscaleLpParams, LoopscaleMappedTransaction, LoopscaleMaxQuoteParams, LoopscaleMultiCollateralTermsUpdateParams, LoopscaleOnchainExternalYieldSourceArgs, LoopscaleQuote, LoopscaleSellLedgerAssetIndexGuidance, LoopscaleSellLedgerTerms, LoopscaleStrategyWithMarket, LoopscaleVaultStakeParams, LoopscaleVaultUnstakeParams, PriceLoansAccounts, PriceStrategiesAccounts, RepayPrincipalAccounts, RepayPrincipalParams, SellLedgerAccounts, SellLedgerParams, StakeUserVaultLpAccounts, UnstakeUserVaultLpAccounts, UpdateStrategyAccounts, UpdateStrategyParams, UpdateWeightMatrixAccounts, UpdateWeightMatrixParams, WithdrawCollateralAccounts, WithdrawCollateralParams, WithdrawStrategyAccounts, } from "./core";