@glamsystems/glam-sdk 1.0.3 → 1.0.4

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 (38) hide show
  1. package/README.md +1 -1
  2. package/index.cjs.js +1995 -1905
  3. package/index.esm.js +1993 -1907
  4. package/package.json +1 -1
  5. package/src/client/access.d.ts +9 -7
  6. package/src/client/base.d.ts +15 -7
  7. package/src/client/cctp.d.ts +52 -18
  8. package/src/client/drift/index.d.ts +3 -0
  9. package/src/client/{drift.d.ts → drift/protocol-v2.d.ts} +17 -104
  10. package/src/client/drift/types.d.ts +53 -0
  11. package/src/client/drift/vaults.d.ts +61 -0
  12. package/src/client/fees.d.ts +12 -3
  13. package/src/client/invest.d.ts +18 -8
  14. package/src/client/jupiter.d.ts +11 -6
  15. package/src/client/kamino/farm.d.ts +39 -0
  16. package/src/client/kamino/index.d.ts +4 -0
  17. package/src/client/kamino/lending.d.ts +84 -0
  18. package/src/client/kamino/types.d.ts +88 -0
  19. package/src/client/kamino/vaults.d.ts +30 -0
  20. package/src/client/marinade.d.ts +18 -21
  21. package/src/client/mint.d.ts +25 -60
  22. package/src/client/price.d.ts +5 -22
  23. package/src/client/stake-pool.d.ts +39 -0
  24. package/src/client/stake.d.ts +34 -0
  25. package/src/client/state.d.ts +9 -11
  26. package/src/client/timelock.d.ts +9 -17
  27. package/src/client/vault.d.ts +26 -14
  28. package/src/client.d.ts +8 -5
  29. package/src/utils/glamApi.d.ts +7 -0
  30. package/target/idl/ext_marinade.json +16 -20
  31. package/target/idl/glam_protocol.json +5 -0
  32. package/target/types/ext_marinade.d.ts +16 -20
  33. package/target/types/ext_marinade.ts +16 -20
  34. package/target/types/glam_protocol.d.ts +5 -0
  35. package/target/types/glam_protocol.ts +5 -0
  36. package/src/client/kamino.d.ts +0 -255
  37. package/src/client/meteora.d.ts +0 -0
  38. package/src/client/staking.d.ts +0 -52
@@ -0,0 +1,84 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
+ import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
4
+ import { VaultClient } from "../vault";
5
+ import { ParsedReserve, ParsedObligation, RefreshObligationAccounts, RefreshReserveAccounts, RefreshObligationFarmsForReserveArgs, RefreshObligationFarmsForReserveAccounts } from "./types";
6
+ declare class TxBuilder extends BaseTxBuilder<KaminoLendingClient> {
7
+ refreshObligationIx(accounts: RefreshObligationAccounts): TransactionInstruction;
8
+ refreshReserveIx(accounts: RefreshReserveAccounts): TransactionInstruction;
9
+ refreshObligationFarmsForReserveIx(args: RefreshObligationFarmsForReserveArgs, accounts: RefreshObligationFarmsForReserveAccounts): TransactionInstruction;
10
+ refreshReservesBatchIx(reserves: ParsedReserve[], skipPriceUpdates: boolean): TransactionInstruction;
11
+ refreshReservesIxs(lendingMarket: PublicKey, reserves: ParsedReserve[]): TransactionInstruction[];
12
+ refreshObligationCollateralFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
13
+ refreshObligationDebtFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
14
+ /**
15
+ * Returns two instructions that refresh reserves in batch and refresh obligation
16
+ */
17
+ refreshReservesAndObligationIxs(obligation: PublicKey, targetReserve: ParsedReserve): Promise<TransactionInstruction[]>;
18
+ /**
19
+ * Returns an instruction to initialize obligation farm user if it doesn't exist
20
+ *
21
+ * @param mode 0 collateral farm, 1 debt farm
22
+ */
23
+ initObligationFarmUserForReserveIx(obligation: PublicKey, { address, market, farmCollateral, farmDebt }: ParsedReserve, mode: 0 | 1, signer?: PublicKey): Promise<{
24
+ farmUser: PublicKey;
25
+ initIx: TransactionInstruction;
26
+ }>;
27
+ initUserMetadataTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
28
+ depositIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
29
+ depositTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
30
+ withdrawIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
31
+ withdrawTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
32
+ borrowIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
33
+ borrowTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
34
+ repayIxs(market: PublicKey, asset: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
35
+ repayTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
36
+ }
37
+ export declare class KaminoLendingClient {
38
+ readonly base: BaseClient;
39
+ readonly vault: VaultClient;
40
+ private reserves;
41
+ private obligations;
42
+ txBuilder: TxBuilder;
43
+ constructor(base: BaseClient, vault: VaultClient);
44
+ /**
45
+ * Initializes Kamino user metadata
46
+ */
47
+ initUserMetadata(txOptions?: TxOptions): Promise<TransactionSignature>;
48
+ /**
49
+ * Deposits asset to the lending market.
50
+ */
51
+ deposit(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
52
+ /**
53
+ * Withdraws asset from the lending market.
54
+ */
55
+ withdraw(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
56
+ /**
57
+ * Borrows asset from the lending market.
58
+ */
59
+ borrow(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
60
+ /**
61
+ * Repays asset to the lending market.
62
+ */
63
+ repay(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
64
+ getUserMetadataPda(owner: PublicKey): PublicKey;
65
+ getObligationPda(owner: PublicKey, market: PublicKey, args?: {
66
+ tag: number;
67
+ id: number;
68
+ }): PublicKey;
69
+ getFarmUserState(farmUser: PublicKey, farm: PublicKey): PublicKey;
70
+ getMarketAuthority(market: PublicKey): PublicKey;
71
+ reservePdas(market: PublicKey, mint: PublicKey): {
72
+ liquiditySupplyVault: PublicKey;
73
+ collateralMint: PublicKey;
74
+ collateralSupplyVault: PublicKey;
75
+ feeVault: PublicKey;
76
+ };
77
+ parseObligation(obligation: PublicKey, data: Buffer): ParsedObligation;
78
+ fetchAndParseObligation(obligation: PublicKey): Promise<ParsedObligation>;
79
+ parseReserve(pubkey: PublicKey, data: Buffer): ParsedReserve;
80
+ fetchAndParseReserves(reserves: PublicKey[]): Promise<ParsedReserve[]>;
81
+ findAndParseReserve(market: PublicKey, asset: PublicKey): Promise<ParsedReserve>;
82
+ findAndParseObligations(owner: PublicKey, market?: PublicKey): Promise<ParsedObligation[]>;
83
+ }
84
+ export {};
@@ -0,0 +1,88 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey } from "@solana/web3.js";
3
+ import Decimal from "decimal.js";
4
+ import { BigFractionBytes } from "../../utils";
5
+ export declare const DEFAULT_OBLIGATION_ARGS: {
6
+ tag: number;
7
+ id: number;
8
+ };
9
+ export declare const EVENT_AUTHORITY: PublicKey;
10
+ export interface RefreshObligationAccounts {
11
+ lendingMarket: PublicKey;
12
+ obligation: PublicKey;
13
+ reserves: PublicKey[];
14
+ }
15
+ export interface RefreshReserveAccounts {
16
+ reserve: PublicKey;
17
+ lendingMarket: PublicKey;
18
+ pythOracle: PublicKey;
19
+ switchboardPriceOracle: PublicKey;
20
+ switchboardTwapOracle: PublicKey;
21
+ scopePrices: PublicKey;
22
+ }
23
+ export interface RefreshObligationFarmsForReserveArgs {
24
+ mode: number;
25
+ }
26
+ export interface RefreshObligationFarmsForReserveAccounts {
27
+ crank: PublicKey;
28
+ baseAccounts: {
29
+ obligation: PublicKey;
30
+ lendingMarketAuthority: PublicKey;
31
+ reserve: PublicKey;
32
+ reserveFarmState: PublicKey;
33
+ obligationFarmUserState: PublicKey;
34
+ lendingMarket: PublicKey;
35
+ };
36
+ farmsProgram: PublicKey;
37
+ rent: PublicKey;
38
+ systemProgram: PublicKey;
39
+ }
40
+ export interface ParsedReserve {
41
+ address: PublicKey;
42
+ market: PublicKey;
43
+ farmCollateral: PublicKey | null;
44
+ farmDebt: PublicKey | null;
45
+ liquidityMint: PublicKey;
46
+ liquidityMintDecimals: number;
47
+ liquiditySupplyVault: PublicKey;
48
+ collateralMint: PublicKey;
49
+ collateralSupplyVault: PublicKey;
50
+ scopePriceFeed: PublicKey;
51
+ feeVault: PublicKey;
52
+ collateralExchangeRate: Decimal;
53
+ cumulativeBorrowRate: Decimal;
54
+ }
55
+ export interface ParsedObligation {
56
+ address: PublicKey;
57
+ lendingMarket: PublicKey;
58
+ deposits: {
59
+ reserve: PublicKey;
60
+ depositedAmount: BN;
61
+ marketValueSf: BN;
62
+ }[];
63
+ borrows: {
64
+ reserve: PublicKey;
65
+ borrowedAmountSf: BN;
66
+ marketValueSf: BN;
67
+ cumulativeBorrowRateBsf: BigFractionBytes;
68
+ }[];
69
+ }
70
+ export interface ParsedFarmState {
71
+ globalConfig: PublicKey;
72
+ farmTokenMint: PublicKey;
73
+ farmTokenDecimals: BN;
74
+ farmTokenProgram: PublicKey;
75
+ farmVault: PublicKey;
76
+ rewards: {
77
+ index: number;
78
+ mint: PublicKey;
79
+ minClaimDurationSeconds: BN;
80
+ tokenProgram: PublicKey;
81
+ rewardsVault: PublicKey;
82
+ }[];
83
+ }
84
+ export interface ParsedFarmUser {
85
+ pubkey: PublicKey;
86
+ farmState: PublicKey;
87
+ unclaimedRewards: BN[];
88
+ }
@@ -0,0 +1,30 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, VersionedTransaction, TransactionSignature, AccountMeta } from "@solana/web3.js";
3
+ import { BaseClient, BaseTxBuilder, TxOptions } from "../base";
4
+ import { KVaultAllocation, KVaultState } from "../../deser/kaminoLayouts";
5
+ import { KaminoLendingClient } from "./lending";
6
+ declare class TxBuilder extends BaseTxBuilder<KaminoVaultsClient> {
7
+ depositTx(vault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
8
+ withdrawTx(vault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
9
+ }
10
+ export declare class KaminoVaultsClient {
11
+ readonly base: BaseClient;
12
+ readonly kaminoLending: KaminoLendingClient;
13
+ private vaultStates;
14
+ private shareMintToVaultPdaMap;
15
+ txBuilder: TxBuilder;
16
+ constructor(base: BaseClient, kaminoLending: KaminoLendingClient);
17
+ /**
18
+ * Deposit to a Kamino vault
19
+ */
20
+ deposit(vault: PublicKey, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
21
+ /**
22
+ * Withdraw from a Kamino vault
23
+ */
24
+ withdraw(vault: PublicKey, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
25
+ findAndParseKaminoVaults(): Promise<KVaultState[]>;
26
+ getVaultPdasByShareMints(mints: PublicKey[]): Promise<PublicKey[]>;
27
+ fetchAndParseVaultState(vault: PublicKey): Promise<KVaultState>;
28
+ composeRemainingAccounts(allocationStrategies: KVaultAllocation[], pricingMode?: boolean): Promise<AccountMeta[]>;
29
+ }
30
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
2
  import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, Keypair } from "@solana/web3.js";
3
3
  import { MarinadeState } from "@marinade.finance/marinade-ts-sdk";
4
- import { BaseClient, TxOptions } from "./base";
4
+ import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
5
5
  import { StakeAccountInfo } from "../utils/accounts";
6
+ import { StakeClient } from "./stake";
6
7
  export type Ticket = {
7
8
  address: PublicKey;
8
9
  lamports: number;
@@ -10,36 +11,32 @@ export type Ticket = {
10
11
  isDue: boolean;
11
12
  isClaimable: boolean;
12
13
  };
14
+ declare class TxBuilder extends BaseTxBuilder<MarinadeClient> {
15
+ depositIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
16
+ depositTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
17
+ depositNativeIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
18
+ depositNativeTx(amount: BN, txOptions: TxOptions): Promise<any>;
19
+ depositStakeAccountIx(stakeAccount: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
20
+ depositStakeAccountTx(stakeAccount: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
21
+ withdrawStakeAccountIxs(amount: BN, deactivate: boolean, glamSigner: PublicKey): Promise<[TransactionInstruction[], Keypair]>;
22
+ withdrawStakeAccountTx(amount: BN, deactivate: boolean, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
23
+ }
13
24
  export declare class MarinadeClient {
14
25
  readonly base: BaseClient;
15
- constructor(base: BaseClient);
26
+ readonly stake: StakeClient;
27
+ private marinadeState;
28
+ txBuilder: TxBuilder;
29
+ constructor(base: BaseClient, stake: StakeClient);
16
30
  deposit(amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
17
31
  depositNative(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
18
- depositStakeAccount(stakeAccount: PublicKey): Promise<TransactionSignature>;
32
+ depositStakeAccount(stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
19
33
  withdrawStakeAccount(amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
20
- /**
21
- * @deprecated Use Marinade.getMarinadeState() instead
22
- */
23
- get marinadeStateStatic(): {
24
- marinadeStateAddress: PublicKey;
25
- msolMintAddress: PublicKey;
26
- treasuryMsolAccount: PublicKey;
27
- reserveAddress: PublicKey;
28
- mSolMintAuthority: PublicKey;
29
- msolLeg: PublicKey;
30
- msolLegAuthority: PublicKey;
31
- solLeg: PublicKey;
32
- };
33
34
  fetchMarinadeState(): Promise<MarinadeState>;
34
35
  getParsedStakeAccountInfo(stakeAccount: PublicKey): Promise<any>;
35
- depositTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
36
- createStakeAccount(signer: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
37
- depositNativeTx(amount: BN, txOptions: TxOptions): Promise<any>;
38
- depositStakeAccountTx(stakeAccount: PublicKey, txOptions: TxOptions): Promise<any>;
39
36
  parseAccountList(data: Buffer, itemSize: number): any[];
40
37
  getIndexes(stakeAccount: StakeAccountInfo, stakeList: any, validatorList: any): Promise<{
41
38
  stakeIndex: number;
42
39
  validatorIndex: number;
43
40
  }>;
44
- withdrawStakeAccountTx(amount: BN, deactivate: boolean, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
45
41
  }
42
+ export {};
@@ -1,8 +1,7 @@
1
- import * as anchor from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TokenAccount, TxOptions } from "./base";
4
- import { MintIdlModel, StateAccountType } from "../models";
5
1
  import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
3
+ import { BaseClient, BaseTxBuilder, TokenAccount, TxOptions } from "./base";
4
+ import { MintIdlModel, RequestType, StateAccountType } from "../models";
6
5
  import { UpdateStateParams } from "./state";
7
6
  export type InitMintParams = {
8
7
  accountType: StateAccountType;
@@ -22,65 +21,31 @@ export type UpdateMintParams = {
22
21
  allowlist?: PublicKey[];
23
22
  blocklist?: PublicKey[];
24
23
  };
25
- declare class MintTxBuilder extends BaseTxBuilder {
26
- /**
27
- * Creates a glam mint token account
28
- *
29
- * @param owner Owner of the token account
30
- * @param setFrozen If true, the token account will be frozen immediately
31
- * @param txOptions
32
- */
33
- createTokenAccount(owner: PublicKey, setFrozen?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
34
- /**
35
- * Freezes or unfreezes token accounts
36
- *
37
- * @param tokenAccounts List of token accounts to freeze or unfreeze
38
- * @param frozen If true, the token accounts will be frozen; otherwise, they will be unfrozen
39
- * @param txOptions
40
- */
41
- setTokenAccountsStates(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
42
- /**
43
- * Mints tokens to recipient. Token account will be created if it does not exist.
44
- *
45
- * @param recipient Recipient public key
46
- * @param amount Amount of tokens to mint
47
- * @param forceThaw If true, automatically unfreeze the token account before minting
48
- * @param txOptions
49
- */
50
- mint(recipient: PublicKey, amount: anchor.BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
51
- /**
52
- * Burns tokens from a token account
53
- *
54
- * @param from Owner of the token account
55
- * @param amount Amount of tokens to burn
56
- * @param forceThaw If true, automatically unfree the token account before burning
57
- * @param txOptions
58
- */
59
- burn(from: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
60
- /**
61
- * Transfers tokens from one token account to another
62
- *
63
- * @param from Owner of the sender token account
64
- * @param to Owner of the recipient token account
65
- * @param amount Amount of tokens to transfer
66
- * @param forceThaw If true, automatically unfree the token accounts before transfer
67
- * @param txOptions
68
- */
69
- forceTransfer(from: PublicKey, to: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
70
- }
71
- declare class TxBuilder extends BaseTxBuilder {
72
- initialize(initMintParams: InitMintParams, stateParams: UpdateStateParams | null, txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
73
- update(mintModel: Partial<MintIdlModel>, txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
74
- pauseSubscription(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
75
- unpauseSubscription(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
76
- pauseRedemption(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
77
- unpauseRedemption(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
78
- closeMintIx(signer?: PublicKey): Promise<anchor.web3.TransactionInstruction>;
79
- closeMint(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
24
+ declare class TxBuilder extends BaseTxBuilder<MintClient> {
25
+ setTokenAccountsStatesIx(tokenAccounts: PublicKey[], frozen: boolean, glamSigner: PublicKey): Promise<TransactionInstruction>;
26
+ setTokenAccountsStatesTx(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
27
+ createTokenAccountIxs(owner: PublicKey, setFrozen: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
28
+ createTokenAccountTx(owner: PublicKey, setFrozen?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
29
+ mintIxs(recipient: PublicKey, amount: BN, forceThaw: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
30
+ mintTx(recipient: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
31
+ burnIxs(from: PublicKey, amount: BN, forceThaw: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
32
+ burnTx(from: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
33
+ forceTransferIxs(from: PublicKey, to: PublicKey, amount: BN, forceThaw: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
34
+ forceTransferTx(from: PublicKey, to: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
35
+ initializeIxs(initMintParams: InitMintParams, stateParams: UpdateStateParams | null, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
36
+ initializeTx(initMintParams: InitMintParams, stateParams: UpdateStateParams | null, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
37
+ updateIx(mintModel: Partial<MintIdlModel>, glamSigner: PublicKey): Promise<TransactionInstruction>;
38
+ updateTx(mintModel: Partial<MintIdlModel>, txOptions?: TxOptions): Promise<VersionedTransaction>;
39
+ emergencyUpdateIx(requestType: RequestType, setPaused: boolean, glamSigner: PublicKey): Promise<TransactionInstruction>;
40
+ pauseSubscriptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
41
+ unpauseSubscriptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
42
+ pauseRedemptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
43
+ unpauseRedemptionTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
44
+ closeMintIx(signer?: PublicKey): Promise<TransactionInstruction>;
45
+ closeMintTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
80
46
  }
81
47
  export declare class MintClient {
82
48
  readonly base: BaseClient;
83
- readonly mintTxBuilder: MintTxBuilder;
84
49
  readonly txBuilder: TxBuilder;
85
50
  constructor(base: BaseClient);
86
51
  /**
@@ -3,7 +3,7 @@ import { BN } from "@coral-xyz/anchor";
3
3
  import { KaminoLendingClient, KaminoVaultsClient, ParsedReserve } from "./kamino";
4
4
  import { BaseClient } from "./base";
5
5
  import { StateModel } from "../models";
6
- import { DriftClient, DriftVaultsClient, SpotMarket } from "./drift";
6
+ import { DriftProtocolClient, DriftVaultsClient, SpotMarket } from "./drift";
7
7
  import { PkMap, PkSet } from "../utils";
8
8
  import { CctpClient } from "./cctp";
9
9
  import { TokenListItem } from "./jupiter";
@@ -34,32 +34,17 @@ export declare class PriceClient {
34
34
  readonly base: BaseClient;
35
35
  readonly klend: KaminoLendingClient;
36
36
  readonly kvaults: KaminoVaultsClient;
37
- readonly drift: DriftClient;
37
+ readonly drift: DriftProtocolClient;
38
38
  readonly dvaults: DriftVaultsClient;
39
39
  readonly cctp: CctpClient;
40
40
  private _stateModel;
41
41
  private _lookupTables;
42
42
  private _kaminoVaults;
43
- constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, drift: DriftClient, dvaults: DriftVaultsClient, cctp: CctpClient);
43
+ constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, drift: DriftProtocolClient, dvaults: DriftVaultsClient, cctp: CctpClient);
44
44
  get cachedStateModel(): StateModel | null;
45
45
  set cachedStateModel(stateModel: StateModel);
46
46
  get lookupTables(): PublicKey[];
47
47
  get kaminoVaults(): PublicKey[];
48
- /**
49
- * @deprecated
50
- *
51
- * Calculates the Assets Under Management (AUM) based on cached pricing data.
52
- *
53
- * @warning This is a convenience method for testing purposes only and should NOT be used in production.
54
- * @warning The returned value may be inaccurate if:
55
- * - The vault has not been priced recently
56
- * - Pricing data is stale or outdated
57
- * - Not all assets have been included in the pricing calculation
58
- *
59
- * @returns The total AUM in the base asset denomination as a BN
60
- * @see priceVaultIxs() to update pricing data before calling this method
61
- */
62
- getAum(): Promise<BN>;
63
48
  /**
64
49
  * Fetches all holdings in the vault.
65
50
  *
@@ -70,6 +55,8 @@ export declare class PriceClient {
70
55
  getVaultHoldings(commitment: Commitment, priceBaseAssetMint?: PublicKey): Promise<VaultHoldings>;
71
56
  getPubkeysForTokenHoldings(commitment?: Commitment): Promise<PublicKey[]>;
72
57
  getPubkeysForSpotHoldings(commitment?: Commitment): Promise<PkMap<PkSet>>;
58
+ getPubkeysForDriftVaultsHoldings(commitment?: Commitment): Promise<PkMap<PkSet>>;
59
+ getPubkeysForKaminoVaultsHoldings(commitment?: Commitment): Promise<PkMap<PkSet>>;
73
60
  getPubkeysForKaminoHoldings(commitment?: Commitment): Promise<PkMap<PkSet>>;
74
61
  getTokenHoldings(tokenAccountPubkeys: PublicKey[], accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Holding[];
75
62
  getDriftSpotHoldings(userPubkeys: Iterable<PublicKey>, spotMarketsMap: PkMap<SpotMarket>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>, priceSource: string): Holding[];
@@ -98,10 +85,6 @@ export declare class PriceClient {
98
85
  * If there are no stake accounts, returns null.
99
86
  */
100
87
  priceStakeAccountsIx(): Promise<TransactionInstruction | null>;
101
- /**
102
- * Returns an instruction that prices Meteora positions.
103
- * If there are no Meteora positions, returns null.
104
- */
105
88
  priceVaultIxs(): Promise<TransactionInstruction[]>;
106
89
  validateAumIx(): Promise<TransactionInstruction>;
107
90
  getbaseAssetOracle(): Promise<PublicKey>;
@@ -0,0 +1,39 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
+ import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
+ import { MarinadeClient } from "./marinade";
5
+ import { StakeClient } from "./stake";
6
+ interface StakePoolAccountData {
7
+ programId: PublicKey;
8
+ depositAuthority: PublicKey;
9
+ withdrawAuthority: PublicKey;
10
+ poolMint: PublicKey;
11
+ feeAccount: PublicKey;
12
+ reserveStake: PublicKey;
13
+ tokenProgramId: PublicKey;
14
+ validatorList: PublicKey;
15
+ }
16
+ declare class TxBuilder extends BaseTxBuilder<StakePoolClient> {
17
+ depositSolIxs(stakePool: PublicKey, lamports: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
18
+ depositSolTx(stakePool: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
19
+ depositStakeIxs(stakePool: PublicKey, stakeAccount: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
20
+ depositStakeTx(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
21
+ withdrawStakeIxs(stakePool: PublicKey, amount: BN, deactivate: boolean, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
22
+ withdrawStakeTx(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
23
+ }
24
+ export declare class StakePoolClient {
25
+ readonly base: BaseClient;
26
+ readonly stake: StakeClient;
27
+ readonly marinade: MarinadeClient;
28
+ readonly txBuilder: TxBuilder;
29
+ constructor(base: BaseClient, stake: StakeClient, marinade: MarinadeClient);
30
+ unstake(asset: PublicKey, amount: number | BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
31
+ depositSol(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
32
+ depositStake(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
33
+ withdrawStake(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
34
+ getStakePoolWithdrawAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
35
+ getStakePoolDepositAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
36
+ getStakeAccountVoter(stakeAccount: PublicKey): Promise<PublicKey | null>;
37
+ getStakePoolAccountData(stakePool: PublicKey): Promise<StakePoolAccountData>;
38
+ }
39
+ export {};
@@ -0,0 +1,34 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
+ import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
+ declare class TxBuilder extends BaseTxBuilder<StakeClient> {
5
+ initializeAndDelegateStakeIxs(vote: PublicKey, amount: BN, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
6
+ initializeAndDelegateStakeTx(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
7
+ deactivateStakesIx(stakeAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
8
+ deactivateStakesTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
9
+ withdrawStakesIx(stakeAccounts: PublicKey[], glamSigner: PublicKey): Promise<TransactionInstruction>;
10
+ withdrawStakesTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
11
+ mergeStakeIx(destinationStake: PublicKey, sourceStake: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
12
+ mergeStakeTx(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
13
+ splitStakeIxs(existingStake: PublicKey, lamports: BN, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey]>;
14
+ splitStakeTx(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
15
+ moveStakeIx(sourceStake: PublicKey, destinationStake: PublicKey, amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction>;
16
+ moveStakeTx(sourceStake: PublicKey, destinationStake: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
17
+ }
18
+ export declare class StakeClient {
19
+ readonly base: BaseClient;
20
+ readonly txBuilder: TxBuilder;
21
+ constructor(base: BaseClient);
22
+ initializeAndDelegateStake(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
23
+ deactivate(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
24
+ withdraw(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
25
+ merge(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
26
+ split(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
27
+ newStake: PublicKey;
28
+ txSig: TransactionSignature;
29
+ }>;
30
+ move(sourceStake: PublicKey, destinationStake: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
31
+ getStakeAccountVoter(stakeAccount: PublicKey): Promise<PublicKey | null>;
32
+ createStakeAccount(signer: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
33
+ }
34
+ export {};
@@ -17,13 +17,15 @@ export type UpdateStateParams = {
17
17
  assets?: PublicKey[];
18
18
  borrowable?: PublicKey[];
19
19
  };
20
- declare class TxBuilder extends BaseTxBuilder {
21
- initialize(params: InitStateParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
22
- update(params: UpdateStateParams, txOptions: TxOptions): Promise<VersionedTransaction>;
23
- updateIx(params: UpdateStateParams, signer?: PublicKey): Promise<TransactionInstruction>;
24
- updateApplyTimelock(txOptions: TxOptions): Promise<VersionedTransaction>;
25
- extend(newBytes: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
26
- close(txOptions?: TxOptions): Promise<VersionedTransaction>;
20
+ declare class TxBuilder extends BaseTxBuilder<StateClient> {
21
+ initializeIx(params: InitStateParams, glamSigner: PublicKey): Promise<[TransactionInstruction, PublicKey]>;
22
+ initializeTx(params: InitStateParams, txOptions?: TxOptions): Promise<[VersionedTransaction, PublicKey]>;
23
+ updateIx(params: UpdateStateParams, glamSigner: PublicKey): Promise<TransactionInstruction>;
24
+ updateTx(params: UpdateStateParams, txOptions: TxOptions): Promise<VersionedTransaction>;
25
+ extendIx(newBytes: number, glamSigner: PublicKey): Promise<TransactionInstruction>;
26
+ extendTx(newBytes: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
27
+ closeIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
28
+ closeTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
27
29
  }
28
30
  export declare class StateClient {
29
31
  readonly base: BaseClient;
@@ -42,10 +44,6 @@ export declare class StateClient {
42
44
  * Only the fields provided in `params` will be updated; omitted fields remain unchanged.
43
45
  */
44
46
  update(params: UpdateStateParams, txOptions?: TxOptions): Promise<TransactionSignature>;
45
- /**
46
- * Applies timelock updates to GLAM state
47
- */
48
- updateApplyTimelock(txOptions?: TxOptions): Promise<TransactionSignature>;
49
47
  /**
50
48
  * Extends GLAM state account size
51
49
  */
@@ -1,21 +1,13 @@
1
- import { VersionedTransaction, TransactionSignature } from "@solana/web3.js";
2
- import { BaseClient, TxOptions } from "./base";
1
+ import { VersionedTransaction, TransactionSignature, PublicKey, TransactionInstruction } from "@solana/web3.js";
2
+ import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
3
3
  import { StateClient } from "./state";
4
- declare class TxBuilder {
5
- private base;
6
- constructor(base: BaseClient);
7
- /**
8
- * Builds transaction to apply pending state updates after timelock expires
9
- */
10
- applyStateTimelock(txOptions?: TxOptions): Promise<VersionedTransaction>;
11
- /**
12
- * Builds transaction to apply pending mint updates after timelock expires
13
- */
14
- applyMintTimelock(txOptions?: TxOptions): Promise<VersionedTransaction>;
15
- /**
16
- * Builds transaction to cancel pending timelock updates
17
- */
18
- cancelTimelock(txOptions?: TxOptions): Promise<VersionedTransaction>;
4
+ declare class TxBuilder extends BaseTxBuilder<TimelockClient> {
5
+ applyStateTimelockIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
6
+ applyStateTimelockTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
7
+ applyMintTimelockIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
8
+ applyMintTimelockTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
9
+ cancelTimelockIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
10
+ cancelTimelockTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
19
11
  }
20
12
  export declare class TimelockClient {
21
13
  readonly base: BaseClient;
@@ -1,8 +1,31 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
2
  import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
- import { BaseClient, TxOptions } from "./base";
3
+ import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
+ declare class TxBuilder extends BaseTxBuilder<VaultClient> {
5
+ wrapIxs(amount: BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
6
+ wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
7
+ unwrapIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
8
+ unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
9
+ systemTransferIx(amount: BN, to: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
10
+ systemTransferTx(amount: BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
11
+ /**
12
+ * Returns an instruction that closes the specified vault token account
13
+ */
14
+ closeTokenAccountIx(tokenAccount: PublicKey, tokenProgram: PublicKey, signer?: PublicKey): Promise<TransactionInstruction>;
15
+ closeTokenAccountsTx(pubkeys: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
16
+ depositSolIxs(lamports: number | BN, wrap: boolean, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
17
+ depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
18
+ depositIxs(asset: PublicKey, amount: number | BN, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
19
+ depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
20
+ /**
21
+ * Transfers tokens held by the vault to the specified recipient
22
+ */
23
+ tokenTransferIxs(mint: PublicKey, amount: number | BN, to: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction[]>;
24
+ tokenTransferTx(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
25
+ }
4
26
  export declare class VaultClient {
5
27
  readonly base: BaseClient;
28
+ readonly txBuilder: TxBuilder;
6
29
  constructor(base: BaseClient);
7
30
  /**
8
31
  * Wraps vault SOL to wSOL
@@ -60,19 +83,8 @@ export declare class VaultClient {
60
83
  * Generates instructions to wrap SOL into wSOL if the vault doesn't have enough wSOL
61
84
  *
62
85
  * @param lamports Desired amount of wSOL
63
- * @returns Array of instructions, null if no instructions are needed
86
+ * @returns Array of instructions, empty if wSOL is sufficient
64
87
  */
65
88
  maybeWrapSol(lamports: number | BN, signer?: PublicKey): Promise<TransactionInstruction[]>;
66
- wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
67
- unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
68
- systemTransferTx(amount: BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
69
- /**
70
- * Returns an instruction that closes the specified vault token account
71
- */
72
- closeTokenAccountIx(tokenAccount: PublicKey, tokenProgram?: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction>;
73
- closeTokenAccountsTx(pubkeys: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
74
- depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
75
- depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
76
- tokenTransferIxs(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction[]>;
77
- tokenTransferTx(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
78
89
  }
90
+ export {};