@glamsystems/glam-sdk 1.1.0-alpha.5 → 1.1.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 (137) hide show
  1. package/LICENSE +201 -0
  2. package/buffer-layout.d.ts +88 -0
  3. package/index.cjs.d.ts +1 -0
  4. package/index.cjs.js +1 -92594
  5. package/index.esm.d.ts +1 -0
  6. package/index.esm.js +1 -92146
  7. package/package.json +29 -17
  8. package/src/assets.d.ts +39 -0
  9. package/src/client/access.d.ts +57 -0
  10. package/src/client/base.d.ts +234 -0
  11. package/src/client/bridge.d.ts +205 -0
  12. package/src/client/bridgeRegistry.d.ts +32 -0
  13. package/src/client/cctp.d.ts +164 -0
  14. package/src/client/epi.d.ts +228 -0
  15. package/src/client/fees.d.ts +33 -0
  16. package/src/client/invest.d.ts +37 -0
  17. package/src/client/jupiter-lend/borrow.d.ts +92 -0
  18. package/src/client/jupiter-lend/earn.d.ts +64 -0
  19. package/src/client/jupiter-lend/index.d.ts +3 -0
  20. package/src/client/jupiter-lend/shared.d.ts +129 -0
  21. package/src/client/jupiter.d.ts +53 -0
  22. package/src/client/kamino/farm.d.ts +39 -0
  23. package/src/client/kamino/index.d.ts +4 -0
  24. package/src/client/kamino/lending.d.ts +94 -0
  25. package/src/client/kamino/types.d.ts +56 -0
  26. package/src/client/kamino/vaults.d.ts +39 -0
  27. package/src/client/loopscale/borrow.d.ts +118 -0
  28. package/src/client/loopscale/core.d.ts +604 -0
  29. package/src/client/loopscale/index.d.ts +5 -0
  30. package/src/client/loopscale/lend.d.ts +123 -0
  31. package/src/client/loopscale/vault.d.ts +43 -0
  32. package/src/client/marinade.d.ts +42 -0
  33. package/src/client/mint.d.ts +143 -0
  34. package/src/client/orca.d.ts +255 -0
  35. package/src/client/phoenix.d.ts +214 -0
  36. package/src/client/price.d.ts +182 -0
  37. package/src/client/stake-pool.d.ts +39 -0
  38. package/src/client/stake.d.ts +34 -0
  39. package/src/client/state.d.ts +56 -0
  40. package/src/client/timelock.d.ts +31 -0
  41. package/src/client/vault.d.ts +98 -0
  42. package/src/client.d.ts +82 -0
  43. package/src/clientConfig.d.ts +32 -0
  44. package/src/constants.d.ts +111 -0
  45. package/src/deser/base.d.ts +18 -0
  46. package/src/deser/index.d.ts +4 -0
  47. package/src/deser/integrationPolicies.d.ts +195 -0
  48. package/src/deser/kaminoLayouts.d.ts +264 -0
  49. package/src/deser/loopscaleLayouts.d.ts +157 -0
  50. package/src/deser/tokenAclLayouts.d.ts +67 -0
  51. package/src/error.d.ts +29 -0
  52. package/src/glamExports.d.ts +6260 -0
  53. package/src/globalConfig.d.ts +27 -0
  54. package/src/index.d.ts +24 -0
  55. package/src/models/acl.d.ts +43 -0
  56. package/src/models/index.d.ts +8 -0
  57. package/src/models/mint.d.ts +57 -0
  58. package/src/models/state.d.ts +94 -0
  59. package/src/models/types.d.ts +28 -0
  60. package/src/protocols.d.ts +29 -0
  61. package/src/utils/accounts.d.ts +71 -0
  62. package/src/utils/bitmask.d.ts +53 -0
  63. package/src/utils/blockhash.d.ts +11 -0
  64. package/src/utils/common.d.ts +73 -0
  65. package/src/utils/computeBudget.d.ts +15 -0
  66. package/src/utils/evm.d.ts +10 -0
  67. package/src/utils/fraction.d.ts +29 -0
  68. package/src/utils/glamPDAs.d.ts +15 -0
  69. package/src/utils/helius.d.ts +66 -0
  70. package/src/utils/index.d.ts +17 -0
  71. package/src/utils/jupiterApi.d.ts +95 -0
  72. package/src/utils/lookupTables.d.ts +83 -0
  73. package/src/utils/phoenixApi.d.ts +146 -0
  74. package/src/utils/pkmap.d.ts +87 -0
  75. package/src/utils/pkset.d.ts +73 -0
  76. package/src/utils/positionCategorizer.d.ts +38 -0
  77. package/src/utils/rpc.d.ts +18 -0
  78. package/src/utils/timelock.d.ts +52 -0
  79. package/src/utils/transaction.d.ts +13 -0
  80. package/target/idl/ext_bridge-staging.json +2379 -0
  81. package/target/idl/ext_bridge.json +2379 -0
  82. package/target/idl/ext_drift.json +5464 -0
  83. package/target/idl/ext_epi-staging.json +2862 -0
  84. package/target/idl/ext_epi.json +2862 -0
  85. package/target/idl/ext_loopscale-staging.json +4708 -0
  86. package/target/idl/ext_loopscale.json +4708 -0
  87. package/target/idl/ext_marinade-staging.json +1587 -0
  88. package/target/idl/ext_phoenix-staging.json +3525 -0
  89. package/target/idl/ext_phoenix.json +3525 -0
  90. package/target/idl/mock_layerzero_endpoint.json +144 -0
  91. package/target/idl/mock_layerzero_oft.json +155 -0
  92. package/target/idl/mock_wormhole_verify_vaa_shim.json +58 -0
  93. package/target/types/ext_bridge-staging.d.ts +2385 -0
  94. package/target/types/ext_bridge-staging.ts +2385 -0
  95. package/target/types/ext_bridge.d.ts +2385 -0
  96. package/target/types/ext_bridge.ts +2385 -0
  97. package/target/types/ext_cctp-staging.d.ts +1268 -0
  98. package/target/types/ext_cctp.d.ts +1268 -0
  99. package/target/types/ext_drift.d.ts +5470 -0
  100. package/target/types/ext_drift.ts +5470 -0
  101. package/target/types/ext_epi-staging.d.ts +2868 -0
  102. package/target/types/ext_epi-staging.ts +2868 -0
  103. package/target/types/ext_epi.d.ts +2868 -0
  104. package/target/types/ext_epi.ts +2868 -0
  105. package/target/types/ext_jupiter-staging.d.ts +1966 -0
  106. package/target/types/ext_jupiter.d.ts +1966 -0
  107. package/target/types/ext_kamino-staging.d.ts +3433 -0
  108. package/target/types/ext_kamino.d.ts +3433 -0
  109. package/target/types/ext_loopscale-staging.d.ts +4714 -0
  110. package/target/types/ext_loopscale-staging.ts +4714 -0
  111. package/target/types/ext_loopscale.d.ts +4714 -0
  112. package/target/types/ext_loopscale.ts +4714 -0
  113. package/target/types/ext_marinade-staging.d.ts +1593 -0
  114. package/target/types/ext_marinade-staging.ts +1593 -0
  115. package/target/types/ext_marinade.d.ts +1593 -0
  116. package/target/types/ext_orca-staging.d.ts +2829 -0
  117. package/target/types/ext_orca.d.ts +2829 -0
  118. package/target/types/ext_phoenix-staging.d.ts +3531 -0
  119. package/target/types/ext_phoenix-staging.ts +3531 -0
  120. package/target/types/ext_phoenix.d.ts +3531 -0
  121. package/target/types/ext_phoenix.ts +3531 -0
  122. package/target/types/ext_spl-staging.d.ts +1274 -0
  123. package/target/types/ext_spl.d.ts +1274 -0
  124. package/target/types/ext_stake_pool-staging.d.ts +1622 -0
  125. package/target/types/ext_stake_pool.d.ts +1622 -0
  126. package/target/types/glam_config.d.ts +755 -0
  127. package/target/types/glam_mint-staging.d.ts +8802 -0
  128. package/target/types/glam_mint.d.ts +6349 -0
  129. package/target/types/glam_policies.d.ts +477 -0
  130. package/target/types/glam_protocol-staging.d.ts +3362 -0
  131. package/target/types/glam_protocol.d.ts +2783 -0
  132. package/target/types/mock_layerzero_endpoint.d.ts +150 -0
  133. package/target/types/mock_layerzero_endpoint.ts +150 -0
  134. package/target/types/mock_layerzero_oft.d.ts +161 -0
  135. package/target/types/mock_layerzero_oft.ts +161 -0
  136. package/target/types/mock_wormhole_verify_vaa_shim.d.ts +64 -0
  137. package/target/types/mock_wormhole_verify_vaa_shim.ts +64 -0
@@ -0,0 +1,264 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey } from "@solana/web3.js";
3
+ import { BigFractionBytes } from "../utils";
4
+ import { Decodable } from "./base";
5
+ import Decimal from "decimal.js";
6
+ export interface KVaultAllocation {
7
+ reserve: PublicKey;
8
+ ctokenVault: PublicKey;
9
+ targetAllocationWeight: BN;
10
+ tokenAllocationCap: BN;
11
+ ctokenVaultBump: BN;
12
+ configPadding: BN[];
13
+ ctokenAllocation: BN;
14
+ lastInvestSlot: BN;
15
+ tokenTargetAllocationSf: BN;
16
+ statePadding: BN[];
17
+ }
18
+ export declare class KVaultState extends Decodable {
19
+ discriminator: number[];
20
+ vaultAdminAuthority: PublicKey;
21
+ baseVaultAuthority: PublicKey;
22
+ baseVaultAuthorityBump: BN;
23
+ tokenMint: PublicKey;
24
+ tokenMintDecimals: BN;
25
+ tokenVault: PublicKey;
26
+ tokenProgram: PublicKey;
27
+ sharesMint: PublicKey;
28
+ sharesMintDecimals: BN;
29
+ tokenAvailable: BN;
30
+ sharesIssued: BN;
31
+ availableCrankFunds: BN;
32
+ padding0: BN;
33
+ performanceFeeBps: BN;
34
+ managementFeeBps: BN;
35
+ lastFeeChargeTimestamp: BN;
36
+ prevAumSf: BN;
37
+ pendingFeesSf: BN;
38
+ vaultAllocationStrategy: KVaultAllocation[];
39
+ padding1: BN[];
40
+ minDepositAmount: BN;
41
+ minWithdrawAmount: BN;
42
+ minInvestAmount: BN;
43
+ minInvestDelaySlots: BN;
44
+ crankFundFeePerReserve: BN;
45
+ pendingAdmin: PublicKey;
46
+ cumulativeEarnedInterestSf: BN;
47
+ cumulativeMgmtFeesSf: BN;
48
+ cumulativePerfFeesSf: BN;
49
+ name: number[];
50
+ vaultLookupTable: PublicKey;
51
+ vaultFarm: PublicKey;
52
+ creationTimestamp: BN;
53
+ padding2: BN;
54
+ allocationAdmin: PublicKey;
55
+ padding3: BN[];
56
+ static _layout: any;
57
+ get nameStr(): string;
58
+ get validAllocations(): KVaultAllocation[];
59
+ }
60
+ interface LastUpdate {
61
+ slot: BN;
62
+ stale: number;
63
+ priceStatus: number;
64
+ placeholder: number[];
65
+ }
66
+ interface PriceHeuristic {
67
+ lower: BN;
68
+ upper: BN;
69
+ exp: BN;
70
+ }
71
+ interface ScopeConfiguration {
72
+ priceFeed: PublicKey;
73
+ priceChain: number[];
74
+ twapChain: number[];
75
+ }
76
+ interface SwitchboardConfiguration {
77
+ priceAggregator: PublicKey;
78
+ twapAggregator: PublicKey;
79
+ }
80
+ interface PythConfiguration {
81
+ price: PublicKey;
82
+ }
83
+ interface TokenInfo {
84
+ name: number[];
85
+ heuristic: PriceHeuristic;
86
+ maxTwapDivergenceBps: BN;
87
+ maxAgePriceSeconds: BN;
88
+ maxAgeTwapSeconds: BN;
89
+ scopeConfiguration: ScopeConfiguration;
90
+ switchboardConfiguration: SwitchboardConfiguration;
91
+ pythConfiguration: PythConfiguration;
92
+ blockPriceUsage: number;
93
+ reserved: number[];
94
+ padding: BN[];
95
+ }
96
+ interface ReserveFees {
97
+ borrowFeeSf: BN;
98
+ flashLoanFeeSf: BN;
99
+ padding: number[];
100
+ }
101
+ interface CurvePoint {
102
+ utilizationRateBps: number;
103
+ borrowRateBps: number;
104
+ }
105
+ interface BorrowRateCurve {
106
+ points: CurvePoint[];
107
+ }
108
+ interface WithdrawalCaps {
109
+ configCapacity: BN;
110
+ currentTotal: BN;
111
+ lastIntervalStartTimestamp: BN;
112
+ configIntervalLengthSeconds: BN;
113
+ }
114
+ interface ReserveLiquidity {
115
+ mintPubkey: PublicKey;
116
+ supplyVault: PublicKey;
117
+ feeVault: PublicKey;
118
+ availableAmount: BN;
119
+ borrowedAmountSf: BN;
120
+ marketPriceSf: BN;
121
+ marketPriceLastUpdatedTs: BN;
122
+ mintDecimals: BN;
123
+ depositLimitCrossedTimestamp: BN;
124
+ borrowLimitCrossedTimestamp: BN;
125
+ cumulativeBorrowRateBsf: BigFractionBytes;
126
+ accumulatedProtocolFeesSf: BN;
127
+ accumulatedReferrerFeesSf: BN;
128
+ pendingReferrerFeesSf: BN;
129
+ absoluteReferralRateSf: BN;
130
+ tokenProgram: PublicKey;
131
+ padding2: BN[];
132
+ padding3: BN[];
133
+ }
134
+ interface ReserveCollateral {
135
+ mintPubkey: PublicKey;
136
+ mintTotalSupply: BN;
137
+ supplyVault: PublicKey;
138
+ padding1: BN[];
139
+ padding2: BN[];
140
+ }
141
+ interface ReserveConfig {
142
+ status: number;
143
+ assetTier: number;
144
+ hostFixedInterestRateBps: number;
145
+ reserved2: number[];
146
+ protocolOrderExecutionFeePct: number;
147
+ protocolTakeRatePct: number;
148
+ protocolLiquidationFeePct: number;
149
+ loanToValuePct: number;
150
+ liquidationThresholdPct: number;
151
+ minLiquidationBonusBps: number;
152
+ maxLiquidationBonusBps: number;
153
+ badDebtLiquidationBonusBps: number;
154
+ deleveragingMarginCallPeriodSecs: BN;
155
+ deleveragingThresholdDecreaseBpsPerDay: BN;
156
+ fees: ReserveFees;
157
+ borrowRateCurve: BorrowRateCurve;
158
+ borrowFactorPct: BN;
159
+ depositLimit: BN;
160
+ borrowLimit: BN;
161
+ tokenInfo: TokenInfo;
162
+ depositWithdrawalCap: WithdrawalCaps;
163
+ debtWithdrawalCap: WithdrawalCaps;
164
+ elevationGroups: number[];
165
+ disableUsageAsCollOutsideEmode: number;
166
+ utilizationLimitBlockBorrowingAbovePct: number;
167
+ autodeleverageEnabled: number;
168
+ reserved1: number[];
169
+ borrowLimitOutsideElevationGroup: BN;
170
+ borrowLimitAgainstThisCollateralInElevationGroup: BN[];
171
+ }
172
+ export declare class Reserve extends Decodable {
173
+ discriminator: number[];
174
+ version: BN;
175
+ lastUpdate: LastUpdate;
176
+ lendingMarket: PublicKey;
177
+ farmCollateral: PublicKey;
178
+ farmDebt: PublicKey;
179
+ liquidity: ReserveLiquidity;
180
+ reserveLiquidityPadding: BN[];
181
+ collateral: ReserveCollateral;
182
+ reserveCollateralPadding: BN[];
183
+ config: ReserveConfig;
184
+ configPadding: BN[];
185
+ borrowedAmountOutsideElevationGroup: BN;
186
+ borrowedAmountsAgainstThisReserveInElevationGroups: BN[];
187
+ padding: BN[];
188
+ static _layout: any;
189
+ get cumulativeBorrowRate(): Decimal;
190
+ /**
191
+ * @returns the stale exchange rate between the collateral tokens and the liquidity - this is a decimal number scaled by 1e18
192
+ */
193
+ get collateralExchangeRate(): Decimal;
194
+ get totalSupply(): Decimal;
195
+ get borrowedAmount(): Decimal;
196
+ get accumulatedProtocolFees(): Decimal;
197
+ get accumulatedReferrerFees(): Decimal;
198
+ get pendingReferrerFees(): Decimal;
199
+ get scopePriceFeed(): PublicKey;
200
+ get liquidityFeeReceiver(): PublicKey;
201
+ get farmDebtNullable(): PublicKey | null;
202
+ get farmCollateralNullable(): PublicKey | null;
203
+ }
204
+ interface ObligationCollateral {
205
+ depositReserve: PublicKey;
206
+ depositedAmount: BN;
207
+ marketValueSf: BN;
208
+ borrowedAmountAgainstThisCollateralInElevationGroup: BN;
209
+ padding: BN[];
210
+ }
211
+ interface ObligationLiquidity {
212
+ borrowReserve: PublicKey;
213
+ cumulativeBorrowRateBsf: BigFractionBytes;
214
+ padding: BN;
215
+ borrowedAmountSf: BN;
216
+ marketValueSf: BN;
217
+ borrowFactorAdjustedMarketValueSf: BN;
218
+ borrowedAmountOutsideElevationGroups: BN;
219
+ padding2: BN[];
220
+ }
221
+ interface ObligationOrder {
222
+ conditionThresholdSf: BN;
223
+ opportunityParameterSf: BN;
224
+ minExecutionBonusBps: number;
225
+ maxExecutionBonusBps: number;
226
+ conditionType: number;
227
+ opportunityType: number;
228
+ padding1: number[];
229
+ padding2: BN[];
230
+ }
231
+ export declare class Obligation extends Decodable {
232
+ discriminator: number[];
233
+ tag: BN;
234
+ lastUpdate: LastUpdate;
235
+ lendingMarket: PublicKey;
236
+ owner: PublicKey;
237
+ deposits: ObligationCollateral[];
238
+ lowestReserveDepositLiquidationLtv: BN;
239
+ depositedValueSf: BN;
240
+ borrows: ObligationLiquidity[];
241
+ borrowFactorAdjustedDebtValueSf: BN;
242
+ borrowedAssetsMarketValueSf: BN;
243
+ allowedBorrowValueSf: BN;
244
+ unhealthyBorrowValueSf: BN;
245
+ depositsAssetTiers: number[];
246
+ borrowsAssetTiers: number[];
247
+ elevationGroup: number;
248
+ numOfObsoleteDepositReserves: number;
249
+ hasDebt: number;
250
+ referrer: PublicKey;
251
+ borrowingDisabled: number;
252
+ autodeleverageTargetLtvPct: number;
253
+ lowestReserveDepositMaxLtvPct: number;
254
+ numOfObsoleteBorrowReserves: number;
255
+ reserved: number[];
256
+ highestBorrowFactorPct: BN;
257
+ autodeleverageMarginCallStartedTimestamp: BN;
258
+ orders: ObligationOrder[];
259
+ padding3: BN[];
260
+ static _layout: any;
261
+ get activeDeposits(): ObligationCollateral[];
262
+ get activeBorrows(): ObligationLiquidity[];
263
+ }
264
+ export {};
@@ -0,0 +1,157 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey } from "@solana/web3.js";
3
+ import { Decodable } from "./base";
4
+ export declare const STRATEGY_DURATION_COUNT = 5;
5
+ interface ExternalYieldAccounts {
6
+ externalYieldAccount: PublicKey;
7
+ externalYieldVault: PublicKey;
8
+ }
9
+ interface CapMonitor {
10
+ startTime1hr: BN;
11
+ startTime24hr: BN;
12
+ principal1hr: BN;
13
+ principal24hr: BN;
14
+ }
15
+ export declare const LOOPSCALE_STRATEGY_ACCOUNT_DISCRIMINATOR: Buffer<ArrayBuffer>;
16
+ export declare const LOOPSCALE_VAULT_DISCRIMINATOR: Buffer<ArrayBuffer>;
17
+ export declare const LOOPSCALE_VAULT_STAKE_DISCRIMINATOR: Buffer<ArrayBuffer>;
18
+ export declare function hasLoopscaleStrategyDiscriminator(data: Buffer): boolean;
19
+ export declare class LoopscaleStrategy extends Decodable {
20
+ discriminator: number[];
21
+ version: number;
22
+ nonce: PublicKey;
23
+ bump: number;
24
+ principalMint: PublicKey;
25
+ lender: PublicKey;
26
+ originationsEnabled: number;
27
+ externalYieldSource: number;
28
+ interestPerSecond: number[];
29
+ lastAccruedTimestamp: BN;
30
+ liquidityBuffer: BN;
31
+ tokenBalance: BN;
32
+ interestFee: BN;
33
+ principalFee: BN;
34
+ originationFee: BN;
35
+ originationCap: BN;
36
+ externalYieldAmount: BN;
37
+ currentDeployedAmount: BN;
38
+ outstandingInterestAmount: BN;
39
+ feeClaimable: BN;
40
+ cumulativePrincipalOriginated: BN;
41
+ cumulativeInterestAccrued: BN;
42
+ cumulativeLoanCount: BN;
43
+ activeLoanCount: BN;
44
+ marketInformation: PublicKey;
45
+ collateralMap: BN[][];
46
+ externalYieldAccounts: ExternalYieldAccounts;
47
+ supplyMonitor: CapMonitor;
48
+ withdrawMonitor: CapMonitor;
49
+ borrowMonitor: CapMonitor;
50
+ static _layout: any;
51
+ /**
52
+ * Returns the duration index whose collateral term for the given asset
53
+ * matches `expectedApy`, or null if no populated slot matches.
54
+ */
55
+ durationIndexForApy(collateralAssetIndex: number, expectedApy: BN): number | null;
56
+ /** Duration indexes that have a populated collateral term for the asset. */
57
+ populatedDurationIndexes(collateralAssetIndex: number): number[];
58
+ }
59
+ export declare class LoopscaleVault extends Decodable {
60
+ discriminator: number[];
61
+ manager: PublicKey;
62
+ nonce: PublicKey;
63
+ bump: number;
64
+ lpSupply: BN;
65
+ lpMint: PublicKey;
66
+ principalMint: PublicKey;
67
+ cumulativePrincipalDeposited: BN;
68
+ depositsEnabled: number;
69
+ maxEarlyUnstakeFee: BN;
70
+ static _layout: any;
71
+ }
72
+ export declare function hasLoopscaleVaultDiscriminator(data: Buffer): boolean;
73
+ export declare function hasLoopscaleVaultStakeDiscriminator(data: Buffer): boolean;
74
+ export declare const LOOPSCALE_LOAN_LEDGER_COUNT = 5;
75
+ export declare const LOOPSCALE_LOAN_COLLATERAL_COUNT = 5;
76
+ export declare const LOOPSCALE_LOAN_DISCRIMINATOR: Buffer<ArrayBuffer>;
77
+ export declare function hasLoopscaleLoanDiscriminator(data: Buffer): boolean;
78
+ export interface LoopscaleLoanDuration {
79
+ duration: number;
80
+ durationType: number;
81
+ }
82
+ export interface LoopscaleLedger {
83
+ status: number;
84
+ strategy: PublicKey;
85
+ principalMint: PublicKey;
86
+ marketInformation: PublicKey;
87
+ principalDue: BN;
88
+ principalRepaid: BN;
89
+ interestOutstanding: BN;
90
+ lastInterestUpdatedTime: BN;
91
+ duration: LoopscaleLoanDuration;
92
+ interestPerSecond: number[];
93
+ startTime: BN;
94
+ endTime: BN;
95
+ apy: BN;
96
+ }
97
+ export interface LoopscaleCollateral {
98
+ assetMint: PublicKey;
99
+ amount: BN;
100
+ assetType: number;
101
+ assetIdentifier: PublicKey;
102
+ }
103
+ export declare class LoopscaleLoan extends Decodable {
104
+ discriminator: number[];
105
+ version: number;
106
+ bump: number;
107
+ status: number;
108
+ borrower: PublicKey;
109
+ nonce: BN;
110
+ startTime: BN;
111
+ ledgers: LoopscaleLedger[];
112
+ collateral: LoopscaleCollateral[];
113
+ weightMatrix: number[][];
114
+ ltvMatrix: number[][];
115
+ lqtMatrix: number[][];
116
+ static _layout: any;
117
+ /** Ledgers that are not in the empty/unused (status 0) state. */
118
+ get activeLedgers(): LoopscaleLedger[];
119
+ /** Collateral entries that hold a non-zero amount or a set identifier. */
120
+ get activeCollateral(): LoopscaleCollateral[];
121
+ }
122
+ interface CollateralCaps {
123
+ maxAllocationPct: BN;
124
+ currentAllocationAmount: BN;
125
+ }
126
+ export interface LoopscaleAssetData {
127
+ assetIdentifier: PublicKey;
128
+ quoteMint: PublicKey;
129
+ oracleAccount: PublicKey;
130
+ oracleType: number;
131
+ maxUncertainty: BN;
132
+ maxAge: BN;
133
+ decimals: number;
134
+ ltv: BN;
135
+ liquidationThreshold: BN;
136
+ collateralCaps: CollateralCaps;
137
+ }
138
+ interface PrincipalCaps {
139
+ max1hr: BN;
140
+ max24hr: BN;
141
+ maxOutstanding: BN;
142
+ }
143
+ export declare class LoopscaleMarketInformation extends Decodable {
144
+ discriminator: number[];
145
+ authority: PublicKey;
146
+ delegate: PublicKey;
147
+ principalMint: PublicKey;
148
+ assetData: LoopscaleAssetData[];
149
+ borrowCaps: PrincipalCaps;
150
+ withdrawCaps: PrincipalCaps;
151
+ supplyCaps: PrincipalCaps;
152
+ version: number;
153
+ static _layout: any;
154
+ /** Index of `assetIdentifier` in the asset data table, or null if absent. */
155
+ findAssetIndex(assetIdentifier: PublicKey): number | null;
156
+ }
157
+ export {};
@@ -0,0 +1,67 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey } from "@solana/web3.js";
3
+ import { Decodable } from "./base";
4
+ /**
5
+ * Token ACL Gate ListConfig account layout.
6
+ *
7
+ * Onchain repr(C):
8
+ * discriminator: u8
9
+ * authority: Pubkey
10
+ * seed: Pubkey
11
+ * mode: u8
12
+ * wallets_count: u64 (LE)
13
+ *
14
+ * PDA seeds: ["list_config", authority, seed]
15
+ * Program: Token ACL Gate
16
+ */
17
+ export declare class TokenAclListConfig extends Decodable {
18
+ discriminator: number;
19
+ authority: PublicKey;
20
+ seed: PublicKey;
21
+ mode: number;
22
+ walletsCount: BN;
23
+ static _layout: any;
24
+ get modeName(): string;
25
+ }
26
+ /**
27
+ * Token ACL Gate WalletEntry account layout.
28
+ *
29
+ * Onchain repr(C):
30
+ * discriminator: u8
31
+ * wallet_address: Pubkey
32
+ * list_config: Pubkey
33
+ *
34
+ * PDA seeds: ["wallet_entry", list_config, wallet]
35
+ * Program: Token ACL Gate
36
+ */
37
+ export declare class TokenAclWalletEntry extends Decodable {
38
+ discriminator: number;
39
+ wallet: PublicKey;
40
+ listConfig: PublicKey;
41
+ static _layout: any;
42
+ }
43
+ /**
44
+ * Token ACL MintConfig account layout.
45
+ *
46
+ * Onchain repr(C):
47
+ * discriminator: u8
48
+ * bump: u8
49
+ * enable_permissionless_thaw: PodBool (u8)
50
+ * enable_permissionless_freeze: PodBool (u8)
51
+ * mint: Pubkey
52
+ * freeze_authority: Pubkey
53
+ * gating_program: Pubkey
54
+ *
55
+ * PDA seeds: ["MINT_CONFIG", mint]
56
+ * Program: Token ACL
57
+ */
58
+ export declare class TokenAclMintConfig extends Decodable {
59
+ discriminator: number;
60
+ bump: number;
61
+ enablePermissionlessThaw: number;
62
+ enablePermissionlessFreeze: number;
63
+ mint: PublicKey;
64
+ freezeAuthority: PublicKey;
65
+ gatingProgram: PublicKey;
66
+ static _layout: any;
67
+ }
package/src/error.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { TransactionError } from "@solana/web3.js";
2
+ export declare class GlamError extends Error {
3
+ message: string;
4
+ rawError: TransactionError | null | undefined;
5
+ programLogs?: string[];
6
+ constructor(message: string, rawError: TransactionError | null | undefined, programLogs?: string[]);
7
+ }
8
+ /**
9
+ * Extract the program ID that failed from transaction logs.
10
+ * Looks for "Program <ID> failed:" log lines and returns the first match,
11
+ * which corresponds to the innermost CPI that produced the root cause.
12
+ */
13
+ export declare function extractFailedProgramId(logs?: string[] | null): string | undefined;
14
+ /**
15
+ * Resolve a custom program error code to a human-readable message.
16
+ * When programId is provided, matches against the specific program's IDL
17
+ * to avoid collisions between programs using the same error code range.
18
+ * Accepts either a decimal number or a hex string (e.g. "0xBB80").
19
+ */
20
+ export declare function resolveErrorCode(code: number | string, programId?: string, staging?: boolean): string | undefined;
21
+ /**
22
+ * Parse the error message from a transaction error.
23
+ * Environment-agnostic: handles Anchor errors, program error codes,
24
+ * simulation failures, and common RPC/network errors.
25
+ *
26
+ * Callers (GUI, CLI) can handle environment-specific error types
27
+ * (e.g. WalletSignTransactionError) before delegating to this function.
28
+ */
29
+ export declare function parseTxError(error: any): string;