@glamsystems/glam-sdk 1.0.12 → 1.0.13-test

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 (110) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1 -1
  3. package/index.cjs.js +1 -57320
  4. package/index.esm.js +1 -57081
  5. package/package.json +26 -15
  6. package/src/assets.d.ts +10 -17
  7. package/src/client/access.d.ts +13 -0
  8. package/src/client/base.d.ts +30 -7
  9. package/src/client/bridge.d.ts +183 -0
  10. package/src/client/bridgeRegistry.d.ts +32 -0
  11. package/src/client/epi.d.ts +78 -0
  12. package/src/client/fees.d.ts +4 -0
  13. package/src/client/invest.d.ts +1 -1
  14. package/src/client/jupiter.d.ts +27 -20
  15. package/src/client/loopscale.d.ts +84 -0
  16. package/src/client/mint.d.ts +54 -1
  17. package/src/client/price.d.ts +26 -39
  18. package/src/client.d.ts +9 -5
  19. package/src/constants.d.ts +11 -7
  20. package/src/deser/index.d.ts +1 -1
  21. package/src/deser/integrationPolicies.d.ts +30 -20
  22. package/src/deser/tokenAclLayouts.d.ts +67 -0
  23. package/src/error.d.ts +2 -1
  24. package/src/glamExports.d.ts +1351 -1546
  25. package/src/globalConfig.d.ts +27 -0
  26. package/src/index.d.ts +5 -1
  27. package/src/models/state.d.ts +2 -0
  28. package/src/utils/accounts.d.ts +9 -1
  29. package/src/utils/bitmask.d.ts +3 -0
  30. package/src/utils/common.d.ts +2 -0
  31. package/src/utils/glamPDAs.d.ts +6 -0
  32. package/src/utils/index.d.ts +0 -1
  33. package/src/utils/pkmap.d.ts +23 -18
  34. package/src/utils/positionCategorizer.d.ts +3 -21
  35. package/target/idl/ext_bridge-staging.json +2379 -0
  36. package/target/idl/ext_bridge.json +2379 -0
  37. package/target/idl/ext_cctp.json +1 -1
  38. package/target/idl/ext_drift.json +1613 -142
  39. package/target/idl/ext_epi-staging.json +2169 -0
  40. package/target/idl/ext_epi.json +2169 -0
  41. package/target/idl/ext_kamino-staging.json +1 -1
  42. package/target/idl/ext_kamino.json +109 -1
  43. package/target/idl/{ext_drift-staging.json → ext_loopscale-staging.json} +986 -1438
  44. package/target/idl/ext_loopscale.json +3541 -0
  45. package/target/idl/ext_marinade-staging.json +1587 -0
  46. package/target/idl/ext_spl-staging.json +1 -1
  47. package/target/idl/ext_spl.json +1 -1
  48. package/target/idl/glam_config.json +78 -9
  49. package/target/idl/glam_mint-staging.json +3002 -1244
  50. package/target/idl/glam_mint.json +239 -8
  51. package/target/idl/glam_policies.json +2 -7
  52. package/target/idl/glam_protocol-staging.json +187 -266
  53. package/target/idl/glam_protocol.json +217 -114
  54. package/target/idl/mock_layerzero_endpoint.json +144 -0
  55. package/target/idl/mock_layerzero_oft.json +155 -0
  56. package/target/types/ext_bridge-staging.d.ts +2385 -0
  57. package/target/types/ext_bridge-staging.ts +2385 -0
  58. package/target/types/ext_bridge.d.ts +2385 -0
  59. package/target/types/ext_bridge.ts +2385 -0
  60. package/target/types/ext_cctp.d.ts +1 -1
  61. package/target/types/ext_cctp.ts +1 -1
  62. package/target/types/ext_drift.d.ts +1609 -138
  63. package/target/types/ext_drift.ts +1613 -142
  64. package/target/types/ext_epi-staging.d.ts +2175 -0
  65. package/target/types/ext_epi-staging.ts +2175 -0
  66. package/target/types/ext_epi.d.ts +2175 -0
  67. package/target/types/ext_epi.ts +2175 -0
  68. package/target/types/ext_kamino-staging.d.ts +3433 -0
  69. package/target/types/ext_kamino-staging.ts +1 -1
  70. package/target/types/ext_kamino.d.ts +109 -1
  71. package/target/types/ext_kamino.ts +109 -1
  72. package/target/types/ext_loopscale-staging.d.ts +3547 -0
  73. package/target/types/{ext_drift-staging.ts → ext_loopscale-staging.ts} +988 -1440
  74. package/target/types/ext_loopscale.d.ts +3547 -0
  75. package/target/types/ext_loopscale.ts +3547 -0
  76. package/target/types/ext_marinade-staging.d.ts +1593 -0
  77. package/target/types/ext_marinade-staging.ts +1593 -0
  78. package/target/types/{ext_offchain.d.ts → ext_spl-staging.d.ts} +219 -19
  79. package/target/types/ext_spl-staging.ts +1 -1
  80. package/target/types/ext_spl.d.ts +1 -1
  81. package/target/types/ext_spl.ts +1 -1
  82. package/target/types/ext_stake_pool-staging.d.ts +1622 -0
  83. package/target/types/glam_config.d.ts +78 -9
  84. package/target/types/glam_config.ts +78 -9
  85. package/target/types/glam_mint-staging.d.ts +7856 -0
  86. package/target/types/glam_mint-staging.ts +3002 -1244
  87. package/target/types/glam_mint.d.ts +239 -8
  88. package/target/types/glam_mint.ts +239 -8
  89. package/target/types/glam_policies.d.ts +477 -0
  90. package/target/types/glam_policies.ts +2 -7
  91. package/target/types/glam_protocol-staging.d.ts +3292 -0
  92. package/target/types/glam_protocol-staging.ts +187 -266
  93. package/target/types/glam_protocol.d.ts +217 -114
  94. package/target/types/glam_protocol.ts +217 -114
  95. package/target/types/mock_layerzero_endpoint.d.ts +150 -0
  96. package/target/types/mock_layerzero_endpoint.ts +150 -0
  97. package/target/types/mock_layerzero_oft.d.ts +161 -0
  98. package/target/types/mock_layerzero_oft.ts +161 -0
  99. package/src/client/drift/index.d.ts +0 -2
  100. package/src/client/drift/protocol-v2.d.ts +0 -93
  101. package/src/client/drift/vaults.d.ts +0 -60
  102. package/src/deser/driftLayouts.d.ts +0 -217
  103. package/src/react/cluster-provider.d.ts +0 -22
  104. package/src/react/glam.d.ts +0 -51
  105. package/src/react/index.d.ts +0 -5
  106. package/src/react/query-keys.d.ts +0 -40
  107. package/src/react/useVaultBalanceSubscription.d.ts +0 -17
  108. package/src/utils/drift/index.d.ts +0 -2
  109. package/src/utils/drift/orderParams.d.ts +0 -28
  110. package/src/utils/drift/types.d.ts +0 -522
@@ -0,0 +1,84 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction, AccountMeta } from "@solana/web3.js";
3
+ import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
+ export declare const LOOPSCALE_BS_AUTH: PublicKey;
5
+ export type LoopscaleExpectedLoanValues = {
6
+ expectedApy: BN;
7
+ expectedLqt: [number, number, number, number, number];
8
+ };
9
+ export type CreateLoanParams = {
10
+ nonce: BN;
11
+ };
12
+ export type DepositCollateralParams = {
13
+ amount: BN;
14
+ assetType: number;
15
+ assetIdentifier: PublicKey;
16
+ assetIndexGuidance: Buffer;
17
+ };
18
+ export type UpdateWeightMatrixParams = {
19
+ collateralIndex: number;
20
+ weightMatrix: [number, number, number, number, number];
21
+ expectedLoanValues: LoopscaleExpectedLoanValues;
22
+ assetIndexGuidance: Buffer;
23
+ };
24
+ export type BorrowPrincipalParams = {
25
+ amount: BN;
26
+ assetIndexGuidance: Buffer;
27
+ duration: number;
28
+ expectedLoanValues: LoopscaleExpectedLoanValues;
29
+ skipSolUnwrap: boolean;
30
+ };
31
+ export type CreateLoanAccounts = {
32
+ loan: PublicKey;
33
+ };
34
+ export type DepositCollateralAccounts = {
35
+ loan: PublicKey;
36
+ depositMint: PublicKey;
37
+ borrowerCollateralTa?: PublicKey;
38
+ loanCollateralTa?: PublicKey;
39
+ assetIdentifier?: PublicKey;
40
+ tokenProgram?: PublicKey;
41
+ associatedTokenProgram?: PublicKey;
42
+ };
43
+ export type UpdateWeightMatrixAccounts = {
44
+ loan: PublicKey;
45
+ };
46
+ export type BorrowPrincipalAccounts = {
47
+ loan: PublicKey;
48
+ strategy: PublicKey;
49
+ marketInformation: PublicKey;
50
+ principalMint: PublicKey;
51
+ borrowerTa?: PublicKey;
52
+ strategyTa?: PublicKey;
53
+ tokenProgram?: PublicKey;
54
+ associatedTokenProgram?: PublicKey;
55
+ remainingAccounts?: AccountMeta[];
56
+ };
57
+ export declare function getLoopscaleEventAuthorityPda(programId?: PublicKey): PublicKey;
58
+ export declare function getLoopscaleLoanPda(borrower: PublicKey, nonce: BN | bigint | number, programId?: PublicKey): PublicKey;
59
+ declare class TxBuilder extends BaseTxBuilder<LoopscaleClient> {
60
+ createLoanIx(params: CreateLoanParams, accounts: CreateLoanAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
61
+ createLoanTx(params: CreateLoanParams, accounts: CreateLoanAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
62
+ depositCollateralIx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
63
+ depositCollateralTx(params: DepositCollateralParams, accounts: DepositCollateralAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
64
+ updateWeightMatrixIx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
65
+ updateWeightMatrixTx(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
66
+ borrowPrincipalIx(params: BorrowPrincipalParams, accounts: BorrowPrincipalAccounts, signer?: PublicKey): Promise<TransactionInstruction>;
67
+ borrowPrincipalTx(params: BorrowPrincipalParams, accounts: BorrowPrincipalAccounts, txOptions?: TxOptions): Promise<VersionedTransaction>;
68
+ }
69
+ export declare class LoopscaleClient {
70
+ readonly base: BaseClient;
71
+ readonly txBuilder: TxBuilder;
72
+ constructor(base: BaseClient);
73
+ getIntegrationAuthorityPda(): PublicKey;
74
+ getEventAuthorityPda(): PublicKey;
75
+ getBsAuth(): PublicKey;
76
+ getLoanPda(nonce: BN | bigint | number, borrower?: PublicKey): PublicKey;
77
+ getLoanTokenAta(loan: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
78
+ getStrategyTokenAta(strategy: PublicKey, mint: PublicKey, tokenProgram?: PublicKey): PublicKey;
79
+ createLoan(params: CreateLoanParams, accounts: CreateLoanAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
80
+ depositCollateral(params: DepositCollateralParams, accounts: DepositCollateralAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
81
+ updateWeightMatrix(params: UpdateWeightMatrixParams, accounts: UpdateWeightMatrixAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
82
+ borrowPrincipal(params: BorrowPrincipalParams, accounts: BorrowPrincipalAccounts, txOptions?: TxOptions): Promise<TransactionSignature>;
83
+ }
84
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ import { Connection, PublicKey, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
3
3
  import { BaseClient, BaseTxBuilder, TokenAccount, TxOptions } from "./base";
4
4
  import { PriceClient } from "./price";
5
5
  import { MintIdlModel, RequestType, StateAccountType } from "../models";
@@ -22,6 +22,23 @@ export type UpdateMintParams = {
22
22
  allowlist?: PublicKey[];
23
23
  blocklist?: PublicKey[];
24
24
  };
25
+ /**
26
+ * Resolves the list config + wallet entry pairs needed for permissionless thaw.
27
+ * Returns empty array if Token ACL is not enabled or no matching pairs found.
28
+ */
29
+ export declare function resolveThawAccounts(connection: Connection, mintPda: PublicKey, wallet: PublicKey): Promise<{
30
+ listConfig: PublicKey;
31
+ walletEntry: PublicKey;
32
+ }[]>;
33
+ /**
34
+ * Builds a permissionless thaw instruction for the Token ACL program.
35
+ * Standalone version of TxBuilder.thawPermissionlessIx for use outside
36
+ * the MintClient context (e.g., in invest.ts).
37
+ */
38
+ export declare function buildThawPermissionlessIx(mintPda: PublicKey, wallet: PublicKey, listAndWalletPairs: {
39
+ listConfig: PublicKey;
40
+ walletEntry: PublicKey;
41
+ }[], signer: PublicKey): TransactionInstruction;
25
42
  declare class TxBuilder extends BaseTxBuilder<MintClient> {
26
43
  setTokenAccountsStatesIx(tokenAccounts: PublicKey[], frozen: boolean, glamSigner: PublicKey): Promise<TransactionInstruction>;
27
44
  setTokenAccountsStatesTx(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
@@ -45,6 +62,30 @@ declare class TxBuilder extends BaseTxBuilder<MintClient> {
45
62
  unpauseRedemptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
46
63
  closeMintIx(signer?: PublicKey): Promise<TransactionInstruction>;
47
64
  closeMintTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
65
+ enableTokenAclIx(gatingProgram: PublicKey | undefined, glamSigner: PublicKey): Promise<TransactionInstruction>;
66
+ enableTokenAclTx(gatingProgram: PublicKey | undefined, txOptions?: TxOptions): Promise<VersionedTransaction>;
67
+ aclGateCreateListIx(seed: Buffer, mode: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
68
+ aclGateCreateListTx(seed: Buffer, mode: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
69
+ aclGateAddWalletIx(listConfig: PublicKey, wallet: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
70
+ aclGateAddWalletTx(listConfig: PublicKey, wallet: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
71
+ aclGateRemoveWalletIx(listConfig: PublicKey, walletEntry: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
72
+ aclGateRemoveWalletTx(listConfig: PublicKey, walletEntry: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
73
+ aclGateDeleteListIx(listConfig: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
74
+ aclGateDeleteListTx(listConfig: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
75
+ aclGateSetupExtraMetasIx(listConfigs: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
76
+ aclGateSetupExtraMetasTx(listConfigs: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
77
+ tokenAclFreezeIx(tokenAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
78
+ tokenAclFreezeTx(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
79
+ tokenAclThawIx(tokenAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
80
+ tokenAclThawTx(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
81
+ thawPermissionlessIx(wallet: PublicKey, listAndWalletPairs: {
82
+ listConfig: PublicKey;
83
+ walletEntry: PublicKey;
84
+ }[], signer: PublicKey): TransactionInstruction;
85
+ thawPermissionlessTx(wallet: PublicKey, listAndWalletPairs: {
86
+ listConfig: PublicKey;
87
+ walletEntry: PublicKey;
88
+ }[], txOptions?: TxOptions): Promise<VersionedTransaction>;
48
89
  }
49
90
  export declare class MintClient {
50
91
  readonly base: BaseClient;
@@ -69,6 +110,18 @@ export declare class MintClient {
69
110
  burn(from: PublicKey, amount: BN | number, unfreeze?: boolean, txOptions?: TxOptions): Promise<string>;
70
111
  createTokenAccount(owner: PublicKey, setFrozen: boolean, txOptions?: TxOptions): Promise<string>;
71
112
  setTokenAccountsStates(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<string>;
113
+ enableTokenAcl(gatingProgram?: PublicKey, txOptions?: TxOptions): Promise<string>;
72
114
  forceTransfer(from: PublicKey, to: PublicKey, amount: BN | number, unfreeze?: boolean, txOptions?: TxOptions): Promise<string>;
115
+ tokenAclFreeze(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<string>;
116
+ tokenAclThaw(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<string>;
117
+ aclGateCreateList(seed: Buffer, mode?: number, txOptions?: TxOptions): Promise<string>;
118
+ aclGateAddWallet(listConfig: PublicKey, wallet: PublicKey, txOptions?: TxOptions): Promise<string>;
119
+ aclGateRemoveWallet(listConfig: PublicKey, walletEntry: PublicKey, txOptions?: TxOptions): Promise<string>;
120
+ aclGateDeleteList(listConfig: PublicKey, txOptions?: TxOptions): Promise<string>;
121
+ aclGateSetupExtraMetas(listConfigs: PublicKey[], txOptions?: TxOptions): Promise<string>;
122
+ thawPermissionless(wallet: PublicKey, listAndWalletPairs: {
123
+ listConfig: PublicKey;
124
+ walletEntry: PublicKey;
125
+ }[], txOptions?: TxOptions): Promise<string>;
73
126
  }
74
127
  export {};
@@ -3,10 +3,11 @@ import { BN } from "@coral-xyz/anchor";
3
3
  import { KaminoLendingClient, KaminoVaultsClient } from "./kamino";
4
4
  import { BaseClient } from "./base";
5
5
  import { StateModel } from "../models";
6
- import { DriftProtocolClient, DriftVaultsClient } from "./drift";
7
6
  import { PkMap, PkSet } from "../utils";
8
- import { DriftSpotMarket, DriftPerpMarket, DriftVault, KVaultState, Reserve, DriftVaultDepositor } from "../deser";
7
+ import { KVaultState, Reserve } from "../deser";
9
8
  import { JupiterApiClient, TokenListItem } from "../utils/jupiterApi";
9
+ import { BridgeClient } from "./bridge";
10
+ import { EpiClient } from "./epi";
10
11
  /**
11
12
  * Represents a single asset holding within a vault.
12
13
  *
@@ -31,7 +32,7 @@ export declare class Holding {
31
32
  }
32
33
  /**
33
34
  * Aggregates all holdings for a GLAM vault.
34
- * Includes token balances, DeFi positions (Drift, Kamino).
35
+ * Includes token balances and supported DeFi positions.
35
36
  *
36
37
  * @param vaultState - The vault's state account address (stores vault configuration)
37
38
  * @param vaultPda - The vault's PDA that holds tokens and positions
@@ -52,29 +53,33 @@ export declare class VaultHoldings {
52
53
  add(holding: Holding): void;
53
54
  toJson(): string;
54
55
  }
56
+ type PricingChunk = {
57
+ ixs: TransactionInstruction[];
58
+ kaminoReserves: PublicKey[];
59
+ };
55
60
  export declare class PriceClient {
56
61
  readonly base: BaseClient;
57
62
  readonly klend: KaminoLendingClient;
58
63
  readonly kvaults: KaminoVaultsClient;
59
- readonly drift: DriftProtocolClient;
60
- readonly dvaults: DriftVaultsClient;
64
+ readonly bridge: BridgeClient;
65
+ readonly epi: EpiClient;
61
66
  private readonly getJupiterApi;
62
67
  private _stateModel;
63
68
  private _lookupTables;
64
69
  private _kaminoVaults;
65
- constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, drift: DriftProtocolClient, dvaults: DriftVaultsClient, getJupiterApi: () => JupiterApiClient);
70
+ private _priceVaultIxsQueue;
71
+ constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, bridge: BridgeClient, epi: EpiClient, getJupiterApi: () => JupiterApiClient);
66
72
  get jupiterApi(): JupiterApiClient;
67
73
  get cachedStateModel(): StateModel | null;
68
74
  set cachedStateModel(stateModel: StateModel);
69
75
  get lookupTables(): PublicKey[];
70
76
  get kaminoVaults(): PublicKey[];
77
+ private getKaminoObligationReserveSets;
71
78
  /**
72
79
  * Fetches all holdings in the vault.
73
80
  *
74
81
  * The source of truth for external positions is the `externalPositions` array
75
82
  * from the state account, which tracks:
76
- * - Drift user PDAs (direct trading positions)
77
- * - Drift vault depositor accounts (shares in drift vaults)
78
83
  * - Kamino obligation accounts (lending positions)
79
84
  * - Kamino vault share ATAs (shares in kamino vaults)
80
85
  *
@@ -85,12 +90,6 @@ export declare class PriceClient {
85
90
  */
86
91
  getVaultHoldings(commitment: Commitment, priceBaseAssetMint?: PublicKey): Promise<VaultHoldings>;
87
92
  getPubkeysForTokenHoldings(externalPositionsSet: PkSet, commitment?: Commitment): Promise<PublicKey[]>;
88
- getPubkeysForSpotHoldings(driftUserPdas: PublicKey[], commitment?: Commitment): Promise<PkMap<PkSet>>;
89
- getPubkeysForPerpHoldings(driftUserPdas: PublicKey[], commitment?: Commitment): Promise<PkMap<PkSet>>;
90
- /**
91
- * Parses drift vault depositors from known pubkeys.
92
- */
93
- getDepositorsAndDriftVaults(depositorPubkeys: PublicKey[], commitment?: Commitment): Promise<PkMap<DriftVault>>;
94
93
  /**
95
94
  * Gets kamino obligation reserves from known obligation pubkeys.
96
95
  */
@@ -106,45 +105,33 @@ export declare class PriceClient {
106
105
  */
107
106
  private getTokenPrice;
108
107
  getTokenHoldings(tokenAccountPubkeys: PublicKey[], accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
109
- getDriftHoldings(userPubkeys: Iterable<PublicKey>, spotMarketsMap: PkMap<DriftSpotMarket>, perpMarketsMap: PkMap<DriftPerpMarket>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
110
- getDriftVaultsHoldings(dvaultDepositorsAndVaults: PkMap<DriftVault>, dvaultDepositorsMap: PkMap<DriftVaultDepositor>, spotMarketsMap: PkMap<DriftSpotMarket>, perpMarketsMap: PkMap<DriftPerpMarket>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
111
108
  getKaminoLendHoldings(obligationPubkeys: Iterable<PublicKey>, reservesMap: PkMap<Reserve>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
112
109
  getKaminoVaultsHoldings(kvaultAtasAndStates: PkMap<KVaultState>, reservesMap: PkMap<Reserve>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Promise<Holding[]>;
113
110
  /**
114
111
  * Returns an instruction that prices Kamino obligations.
115
112
  * If there are no Kamino obligations, returns null.
116
113
  */
117
- priceKaminoObligationsIxs(): Promise<TransactionInstruction[]>;
118
- priceKaminoVaultSharesIx(): Promise<TransactionInstruction[] | null>;
119
- /**
120
- * Returns an instruction that prices all Drift users (aka sub-accounts) controlled by the GLAM vault.
121
- */
122
- priceDriftUsersIx(): Promise<TransactionInstruction | null>;
123
- /**
124
- * Returns an instruction that prices a drift vault depositor.
125
- * If there are no vault depositor accounts, returns null.
126
- */
127
- priceDriftVaultDepositorsIx(): Promise<TransactionInstruction | null>;
114
+ priceKaminoObligationsIxs(): Promise<PricingChunk>;
115
+ priceKaminoVaultSharesIx(): Promise<PricingChunk | null>;
128
116
  /**
129
117
  * Returns an instruction that prices vault balance and tokens
130
118
  */
131
- priceVaultTokensIx(): Promise<TransactionInstruction>;
119
+ priceVaultTokensIx(): Promise<PricingChunk>;
132
120
  /**
133
121
  * Returns an instruction that prices stake accounts.
134
122
  * If there are no stake accounts, returns null.
135
123
  */
136
124
  priceStakeAccountsIx(): Promise<TransactionInstruction | null>;
137
125
  priceVaultIxs(): Promise<TransactionInstruction[]>;
126
+ private enqueuePriceVaultIxs;
127
+ private priceManagedTransfersIxs;
128
+ private priceEpiValidatedPositionsIx;
129
+ private _priceVaultIxsImpl;
138
130
  validateAumIx(): Promise<TransactionInstruction>;
139
- getbaseAssetOracle(): Promise<PublicKey>;
140
- remainingAccountsForPricingDriftVaultDepositors(parsedVaultDepositors: {
141
- address: PublicKey;
142
- driftVault: PublicKey;
143
- shares: any;
144
- }[]): Promise<{
145
- remainingAccounts: AccountMeta[];
146
- numSpotMarkets: number;
147
- numPerpMarkets: number;
148
- }>;
149
- remainingAccountsForPricingVaultAssets(): Promise<AccountMeta[]>;
131
+ getBaseAssetOracle(): Promise<PublicKey>;
132
+ remainingAccountsForPricingVaultAssets(): Promise<[
133
+ AccountMeta[],
134
+ PublicKey[]
135
+ ]>;
150
136
  }
137
+ export {};
package/src/client.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { GlamClientConfig } from "./clientConfig";
2
2
  import { BaseClient } from "./client/base";
3
- import { DriftProtocolClient, DriftVaultsClient } from "./client/drift";
4
3
  import { JupiterSwapClient } from "./client/jupiter";
5
4
  import { MarinadeClient } from "./client/marinade";
6
5
  import { VaultClient } from "./client/vault";
@@ -15,14 +14,15 @@ import { TimelockClient } from "./client/timelock";
15
14
  import { StakeClient } from "./client/stake";
16
15
  import { StakePoolClient } from "./client/stake-pool";
17
16
  import { CctpClient } from "./client/cctp";
17
+ import { BridgeClient } from "./client/bridge";
18
+ import { EpiClient } from "./client/epi";
19
+ import { LoopscaleClient } from "./client/loopscale";
18
20
  /**
19
21
  * Main entrypoint for the GLAM SDK
20
22
  *
21
23
  * Lazy loads each client/module at first use
22
24
  */
23
25
  export declare class GlamClient extends BaseClient {
24
- private _drift?;
25
- private _driftVaults?;
26
26
  private _invest?;
27
27
  private _jupiterSwap?;
28
28
  private _marinade?;
@@ -39,9 +39,10 @@ export declare class GlamClient extends BaseClient {
39
39
  private _fees?;
40
40
  private _timelock?;
41
41
  private _cctp?;
42
+ private _bridge?;
43
+ private _epi?;
44
+ private _loopscale?;
42
45
  constructor(config?: GlamClientConfig);
43
- get drift(): DriftProtocolClient;
44
- get driftVaults(): DriftVaultsClient;
45
46
  get invest(): InvestClient;
46
47
  get fees(): FeesClient;
47
48
  get jupiterSwap(): JupiterSwapClient;
@@ -58,4 +59,7 @@ export declare class GlamClient extends BaseClient {
58
59
  get kaminoVaults(): KaminoVaultsClient;
59
60
  get timelock(): TimelockClient;
60
61
  get cctp(): CctpClient;
62
+ get bridge(): BridgeClient;
63
+ get epi(): EpiClient;
64
+ get loopscale(): LoopscaleClient;
61
65
  }
@@ -9,12 +9,15 @@ export declare const SEED_ACCOUNT_POLICY = "account-policy";
9
9
  export declare const SEED_EXTRA_ACCOUNT_METAS = "extra-account-metas";
10
10
  export declare const SEED_GLOBAL_CONFIG = "global-config";
11
11
  export declare const SEED_INTEGRATION_AUTHORITY = "integration-authority";
12
+ export declare const SEED_OBSERVATION_STATE = "observation-state";
13
+ export declare const SEED_BRIDGE_REGISTRY = "bridge-registry";
14
+ export declare const SEED_BRIDGE_SESSION = "bridge-session";
15
+ export declare const SEED_BRIDGE_TRANSFER_RECORD = "bridge-transfer-record";
12
16
  export declare const STAKE_ACCOUNT_SIZE = 200;
13
17
  export declare const METEORA_POSITION_SIZE = 8120;
14
18
  export declare const KAMINO_OBTRIGATION_SIZE = 3344;
15
19
  export declare const KAMINO_RESERVE_SIZE = 8624;
16
20
  export declare const KAMINO_VAULT_STATE_SIZE = 62552;
17
- export declare const DRIFT_VAULT_DEPOSITOR_SIZE = 272;
18
21
  export declare const JITO_TIP_DEFAULT: PublicKey;
19
22
  export declare const MARINADE_NATIVE_STAKE_AUTHORITY: PublicKey;
20
23
  /**
@@ -26,13 +29,12 @@ export declare const WSOL: PublicKey;
26
29
  export declare const MSOL: PublicKey;
27
30
  export declare const USDC: PublicKey;
28
31
  export declare const USDC_DEVNET: PublicKey;
32
+ export declare const USDT: PublicKey;
29
33
  export declare const JUP: PublicKey;
30
34
  /**
31
35
  * Program IDs
32
36
  */
33
37
  export declare const MARINADE_PROGRAM_ID: PublicKey;
34
- export declare const DRIFT_PROGRAM_ID: PublicKey;
35
- export declare const DRIFT_VAULTS_PROGRAM_ID: PublicKey;
36
38
  export declare const JUPITER_PROGRAM_ID: PublicKey;
37
39
  export declare const SANCTUM_STAKE_POOL_PROGRAM_ID: PublicKey;
38
40
  export declare const KAMINO_LENDING_PROGRAM: PublicKey;
@@ -42,6 +44,12 @@ export declare const MEMO_PROGRAM: PublicKey;
42
44
  export declare const ALT_PROGRAM_ID: PublicKey;
43
45
  export declare const TOKEN_MESSENGER_MINTER_V2: PublicKey;
44
46
  export declare const MESSAGE_TRANSMITTER_V2: PublicKey;
47
+ export declare const LOOPSCALE_PROGRAM_ID: PublicKey;
48
+ /**
49
+ * Token ACL (sRFC-37)
50
+ */
51
+ export declare const TOKEN_ACL_PROGRAM: PublicKey;
52
+ export declare const TOKEN_ACL_GATE_PROGRAM: PublicKey;
45
53
  /**
46
54
  * GLAM programs
47
55
  */
@@ -55,10 +63,6 @@ export declare const GLAM_REFERRER: PublicKey;
55
63
  * CCTP domain to chain name mapping
56
64
  */
57
65
  export declare const CCTP_DOMAIN_MAPPING: Record<number, string>;
58
- /**
59
- * Pool ID to lending pool name mapping for Drift Protocol policies
60
- */
61
- export declare const DRIFT_POOL_MAPPING: Record<number, string>;
62
66
  /**
63
67
  * Get protocol and permission mappings at runtime to ensure correct program IDs based on environment.
64
68
  *
@@ -1,3 +1,3 @@
1
1
  export { Decodable } from "./base";
2
- export * from "./driftLayouts";
3
2
  export * from "./kaminoLayouts";
3
+ export * from "./tokenAclLayouts";
@@ -16,8 +16,8 @@ export declare class MintPolicy {
16
16
  export declare class JupiterSwapPolicy {
17
17
  maxSlippageBps: number;
18
18
  swapAllowlist: PublicKey[] | null;
19
- static _layout: any;
20
- constructor(maxSlippageBps: number, swapAllowlist: PublicKey[] | null);
19
+ maxDeviationBps: number;
20
+ constructor(maxSlippageBps: number, swapAllowlist: PublicKey[] | null, maxDeviationBps?: number);
21
21
  static decode(buffer: Buffer<ArrayBufferLike>): JupiterSwapPolicy;
22
22
  encode(): Buffer;
23
23
  }
@@ -28,24 +28,6 @@ export declare class TransferPolicy {
28
28
  static decode(buffer: Buffer<ArrayBufferLike>): TransferPolicy;
29
29
  encode(): Buffer;
30
30
  }
31
- export declare class DriftVaultsPolicy {
32
- vaultsAllowlist: PublicKey[];
33
- static _layout: any;
34
- constructor(allowlist: PublicKey[]);
35
- static decode(buffer: Buffer<ArrayBufferLike>): DriftVaultsPolicy;
36
- encode(): Buffer;
37
- }
38
- export declare class DriftProtocolPolicy {
39
- spotMarketsAllowlist: number[];
40
- perpMarketsAllowlist: number[];
41
- borrowAllowlist: PublicKey[];
42
- orderPriceToleranceBps: number;
43
- static _layout: any;
44
- static _stagingLayout: any;
45
- constructor(spotMarketsAllowlist: number[], perpMarketsAllowlist: number[], borrowAllowlist: PublicKey[], orderPriceToleranceBps?: number);
46
- static decode(buffer: Buffer<ArrayBufferLike>, staging?: boolean): DriftProtocolPolicy;
47
- encode(staging?: boolean): Buffer;
48
- }
49
31
  export declare class KaminoLendingPolicy {
50
32
  marketsAllowlist: PublicKey[];
51
33
  borrowAllowlist: PublicKey[];
@@ -61,6 +43,13 @@ export declare class KaminoVaultsPolicy {
61
43
  static decode(buffer: Buffer<ArrayBufferLike>): KaminoVaultsPolicy;
62
44
  encode(): Buffer;
63
45
  }
46
+ export declare class LoopscalePolicy {
47
+ strategiesAllowlist: PublicKey[];
48
+ static _layout: any;
49
+ constructor(strategiesAllowlist: PublicKey[]);
50
+ static decode(buffer: Buffer<ArrayBufferLike>): LoopscalePolicy;
51
+ encode(): Buffer;
52
+ }
64
53
  export declare class CctpPolicy {
65
54
  allowedDestinations: {
66
55
  domain: number;
@@ -75,6 +64,27 @@ export declare class CctpPolicy {
75
64
  encode(): Buffer;
76
65
  get domainToAddressesMap(): Map<number, PublicKey[]>;
77
66
  }
67
+ export declare enum RouteManagementMode {
68
+ UnmanagedOnly = 0,
69
+ ManagedOnly = 1,
70
+ Either = 2
71
+ }
72
+ export type LayerzeroOftRoute = {
73
+ sourceMint: PublicKey;
74
+ destinationChain: number;
75
+ destinationRecipient: PublicKey;
76
+ providerProgram: PublicKey;
77
+ managementMode: RouteManagementMode;
78
+ minAmount: BN;
79
+ maxAmount: BN;
80
+ };
81
+ export declare class LayerzeroOftPolicy {
82
+ routes: LayerzeroOftRoute[];
83
+ static _layout: any;
84
+ constructor(routes: LayerzeroOftRoute[]);
85
+ static decode(buffer: Buffer<ArrayBufferLike>, _staging?: boolean): LayerzeroOftPolicy;
86
+ encode(): Buffer;
87
+ }
78
88
  export declare enum PeriodType {
79
89
  Day = 0,
80
90
  Week = 1,
@@ -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 CHANGED
@@ -7,7 +7,8 @@ export declare class GlamError extends Error {
7
7
  }
8
8
  /**
9
9
  * Extract the program ID that failed from transaction logs.
10
- * Looks for "Program <ID> failed:" log lines.
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.
11
12
  */
12
13
  export declare function extractFailedProgramId(logs?: string[] | null): string | undefined;
13
14
  /**