@glamsystems/glam-sdk 0.1.23 → 0.1.24

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glamsystems/glam-sdk",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "TypeScript SDK for the GLAM Protocol",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -18,8 +18,8 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@coral-xyz/anchor": "^0.31.0",
22
- "@coral-xyz/borsh": "^0.31.0",
21
+ "@coral-xyz/anchor": "^0.31.1",
22
+ "@coral-xyz/borsh": "^0.31.1",
23
23
  "@marinade.finance/marinade-ts-sdk": "^5.0.15",
24
24
  "@meteora-ag/dlmm": "^1.4.11",
25
25
  "@solana/spl-stake-pool": "^1.1.5",
@@ -1,4 +1,20 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
+ export declare const STAKE_POOLS: {
3
+ name: string;
4
+ symbol: string;
5
+ mint: string;
6
+ logoURI: string;
7
+ tokenProgram: any;
8
+ poolState: any;
9
+ }[];
10
+ export declare const STAKE_POOLS_MAP: Map<string, {
11
+ name: string;
12
+ symbol: string;
13
+ mint: string;
14
+ logoURI: string;
15
+ tokenProgram: any;
16
+ poolState: any;
17
+ }>;
2
18
  /**
3
19
  * Metadata for an asset for pricing
4
20
  */
@@ -6,6 +22,7 @@ export interface AssetMeta {
6
22
  decimals: number;
7
23
  oracle: PublicKey;
8
24
  programId?: PublicKey;
25
+ isLst?: boolean;
9
26
  }
10
27
  export declare const ASSETS_MAINNET: Map<string, AssetMeta>;
11
28
  export declare const ASSETS_TESTS: Map<string, AssetMeta>;
@@ -108,6 +108,9 @@ export declare class BaseClient {
108
108
  * @deprecated
109
109
  */
110
110
  getAssetIdFromCurrency(currency: string): string;
111
+ /**
112
+ * @deprecated
113
+ */
111
114
  listGlamStates(): Promise<PublicKey[]>;
112
115
  /**
113
116
  * Fetch glam state from onchain accounts and build a StateModel
@@ -5,13 +5,13 @@ export declare class InvestorClient {
5
5
  readonly base: BaseClient;
6
6
  constructor(base: BaseClient);
7
7
  subscribe(asset: PublicKey, amount: BN, mintId?: number, queued?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
8
- queuedRedeem(asset: PublicKey, amount: BN, mintId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
9
- fulfill(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
8
+ queuedRedeem(amount: BN, mintId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
9
+ fulfill(mintId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
10
10
  claim(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
11
11
  subscribeTx(asset: PublicKey, amount: BN, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
12
12
  queuedSubscribeTx(asset: PublicKey, amount: BN, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
13
- queuedRedeemTx(asset: PublicKey, amount: BN, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
14
- fulfillTx(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
13
+ queuedRedeemTx(amount: BN, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
14
+ fulfillTx(mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
15
15
  claimAssetTx(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
16
16
  claimShareTx(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
17
17
  }
@@ -83,8 +83,8 @@ export declare class KaminoLendingClient {
83
83
  getObligationFarmState(obligation: PublicKey, farm: PublicKey): PublicKey;
84
84
  initUserMetadataTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
85
85
  refreshReserveIxs(lendingMarket: PublicKey, reserves: PublicKey[]): TransactionInstruction[];
86
- refreshObligationFarmsForReserveIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
87
- getRefreshIxs(obligation: PublicKey, refreshFarms?: boolean): Promise<TransactionInstruction[]>;
86
+ refreshObligationCollateralFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
87
+ refreshObligationDebtFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
88
88
  getMarketAuthority(market: PublicKey): PublicKey;
89
89
  reservePdas(market: PublicKey, mint: PublicKey): {
90
90
  liquiditySupplyVault: PublicKey;
@@ -1,6 +1,8 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature } from "@solana/web3.js";
2
+ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, Keypair } from "@solana/web3.js";
3
+ import { MarinadeState } from "@marinade.finance/marinade-ts-sdk";
3
4
  import { BaseClient, TxOptions } from "./base";
5
+ import { StakeAccountInfo } from "../utils/helpers";
4
6
  export type Ticket = {
5
7
  address: PublicKey;
6
8
  lamports: number;
@@ -12,12 +14,17 @@ export declare class MarinadeClient {
12
14
  readonly base: BaseClient;
13
15
  constructor(base: BaseClient);
14
16
  deposit(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
17
+ depositNative(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
15
18
  depositStakeAccount(stakeAccount: PublicKey): Promise<TransactionSignature>;
19
+ withdrawStakeAccount(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
16
20
  orderUnstake(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
17
21
  claim(tickets: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
18
22
  getTickets(): Promise<PublicKey[]>;
19
23
  getParsedTickets(): Promise<Ticket[]>;
20
- getMarinadeState(): {
24
+ /**
25
+ * @deprecated Use Marinade.getMarinadeState() instead
26
+ */
27
+ get marinadeStateStatic(): {
21
28
  marinadeStateAddress: PublicKey;
22
29
  msolMintAddress: PublicKey;
23
30
  treasuryMsolAccount: PublicKey;
@@ -27,9 +34,18 @@ export declare class MarinadeClient {
27
34
  msolLegAuthority: PublicKey;
28
35
  solLeg: PublicKey;
29
36
  };
37
+ fetchMarinadeState(): Promise<MarinadeState>;
30
38
  getParsedStakeAccountInfo(stakeAccount: PublicKey): Promise<any>;
31
39
  depositTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
40
+ createStakeAccount(signer: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
41
+ depositNativeTx(amount: BN, txOptions: TxOptions): Promise<any>;
32
42
  depositStakeAccountTx(stakeAccount: PublicKey, txOptions: TxOptions): Promise<any>;
43
+ parseAccountList(data: Buffer, itemSize: number): any[];
44
+ getIndexes(stakeAccount: StakeAccountInfo, stakeList: any, validatorList: any): Promise<{
45
+ stakeIndex: number;
46
+ validatorIndex: number;
47
+ }>;
48
+ withdrawStakeAccountTx(amount: BN, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
33
49
  orderUnstakeTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
34
50
  claimTx(tickets: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
35
51
  }
@@ -9,7 +9,7 @@ export declare class MeteoraDlmmClient {
9
9
  getDlmmPool(pool: PublicKey | string): Promise<DLMM>;
10
10
  initializePosition(pool: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
11
11
  initializePositionPda(pool: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
12
- addLiquidityByStrategy(position: PublicKey | string, amountX: BN | number, amountY: BN | number, strategyType: keyof typeof Strategy, txOptions?: TxOptions): Promise<string>;
12
+ addLiquidityByStrategy(position: PublicKey | string, amountX: BN | number, amountY: BN | number, strategyType: keyof typeof Strategy, maxActiveBinSlippage: number, txOptions?: TxOptions): Promise<string>;
13
13
  removeLiquidityByRange(position: PublicKey | string, bpsToRemove: number, txOptions?: TxOptions): Promise<string>;
14
14
  claimFee(position: PublicKey | string, txOptions?: TxOptions): Promise<string>;
15
15
  closePosition(position: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
@@ -21,7 +21,7 @@ export declare class PriceClient {
21
21
  isSigner: boolean;
22
22
  isWritable: boolean;
23
23
  }[]>;
24
- remainingAccountsForPricingVaultAssets: () => Promise<{
24
+ remainingAccountsForPricingVaultAssets: (baseAssetOnly?: boolean) => Promise<{
25
25
  pubkey: PublicKey;
26
26
  isSigner: boolean;
27
27
  isWritable: boolean;
@@ -2,6 +2,7 @@ import { BN } from "@coral-xyz/anchor";
2
2
  import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
3
  import { BaseClient, TxOptions } from "./base";
4
4
  import { MarinadeClient } from "./marinade";
5
+ import { StakeAccountInfo } from "../utils/helpers";
5
6
  interface StakePoolAccountData {
6
7
  programId: PublicKey;
7
8
  depositAuthority: PublicKey;
@@ -12,12 +13,6 @@ interface StakePoolAccountData {
12
13
  tokenProgramId: PublicKey;
13
14
  validatorList: PublicKey;
14
15
  }
15
- type StakeAccountInfo = {
16
- address: PublicKey;
17
- lamports: number;
18
- state: string;
19
- voter?: PublicKey;
20
- };
21
16
  export declare class StakingClient {
22
17
  readonly base: BaseClient;
23
18
  readonly marinade: MarinadeClient;
@@ -1,5 +1,4 @@
1
- import { PublicKey, VersionedTransaction, TransactionInstruction, TransactionSignature } from "@solana/web3.js";
2
- import { BN } from "@coral-xyz/anchor";
1
+ import { PublicKey, VersionedTransaction, TransactionSignature } from "@solana/web3.js";
3
2
  import { BaseClient, TxOptions } from "./base";
4
3
  import { DelegateAcl, StateModel } from "../models";
5
4
  export declare class StateClient {
@@ -26,17 +25,4 @@ export declare class StateClient {
26
25
  */
27
26
  deleteDelegateAcls(delegates: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
28
27
  upsertDelegateAcls(delegateAcls: DelegateAcl[], txOptions?: TxOptions): Promise<TransactionSignature>;
29
- closeTokenAccounts(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
30
- /**
31
- * Close vault's token accounts, all token accounts must use the same token program
32
- */
33
- closeTokenAccountIx(tokenAccounts: PublicKey[], tokenProgram?: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction>;
34
- closeTokenAccountsTx(accounts: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
35
- deposit(asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
36
- depositSol(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
37
- depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
38
- withdraw(asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
39
- depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
40
- withdrawIxs(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<TransactionInstruction[]>;
41
- withdrawTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
42
28
  }
@@ -0,0 +1,27 @@
1
+ import { BN } from "@coral-xyz/anchor";
2
+ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
3
+ import { BaseClient, TxOptions } from "./base";
4
+ export declare class VaultClient {
5
+ readonly base: BaseClient;
6
+ constructor(base: BaseClient);
7
+ wrap(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
8
+ unwrap(txOptions?: TxOptions): Promise<TransactionSignature>;
9
+ systemTransfer(amount: BN | number, to: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
10
+ closeTokenAccounts(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
11
+ deposit(asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
12
+ depositSol(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
13
+ withdraw(asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
14
+ wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
15
+ unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
16
+ systemTransferTx(amount: BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
17
+ /**
18
+ * Returns an instruction that closes multiple vault token accounts
19
+ * All token accounts must be owned by the same token program
20
+ */
21
+ closeTokenAccountIx(tokenAccounts: PublicKey[], tokenProgram?: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction>;
22
+ closeTokenAccountsTx(accounts: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
23
+ depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
24
+ depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
25
+ withdrawIxs(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<TransactionInstruction[]>;
26
+ withdrawTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
27
+ }
package/src/client.d.ts CHANGED
@@ -4,7 +4,7 @@ import { DriftClient } from "./client/drift";
4
4
  import { JupiterSwapClient } from "./client/jupiter";
5
5
  import { JupiterVoteClient } from "./client/jupiter";
6
6
  import { MarinadeClient } from "./client/marinade";
7
- import { WSolClient } from "./client/wsol";
7
+ import { VaultClient } from "./client/vault";
8
8
  import { StakingClient } from "./client/staking";
9
9
  import { StateClient } from "./client/state";
10
10
  import { MintClient } from "./client/mint";
@@ -24,7 +24,7 @@ export declare class GlamClient extends BaseClient {
24
24
  private _jupiterSwap?;
25
25
  private _jupiterVote?;
26
26
  private _marinade?;
27
- private _wsol?;
27
+ private _vault?;
28
28
  private _price?;
29
29
  private _staking?;
30
30
  private _state?;
@@ -38,7 +38,7 @@ export declare class GlamClient extends BaseClient {
38
38
  get jupiterSwap(): JupiterSwapClient;
39
39
  get jupiterVote(): JupiterVoteClient;
40
40
  get marinade(): MarinadeClient;
41
- get wsol(): WSolClient;
41
+ get vault(): VaultClient;
42
42
  get staking(): StakingClient;
43
43
  get price(): PriceClient;
44
44
  get state(): StateClient;
@@ -10,6 +10,7 @@ export declare const METEORA_POSITION_SIZE = 8120;
10
10
  export declare const KAMINO_OBTRIGATION_SIZE = 3344;
11
11
  export declare const JITO_TIP_DEFAULT: PublicKey;
12
12
  export declare const KAMINO_SCOPE_PRICES: PublicKey;
13
+ export declare const MARINADE_NATIVE_STAKE_AUTHORITY: PublicKey;
13
14
  /**
14
15
  * Token mints. If no devnet version is defined, assume mainnet and devnet addresses are the same.
15
16
  *
@@ -17,10 +18,7 @@ export declare const KAMINO_SCOPE_PRICES: PublicKey;
17
18
  */
18
19
  export declare const WSOL: PublicKey;
19
20
  export declare const MSOL: PublicKey;
20
- export declare const JITOSOL: PublicKey;
21
21
  export declare const USDC: PublicKey;
22
- export declare const WETH: PublicKey;
23
- export declare const WBTC: PublicKey;
24
22
  export declare const JUP: PublicKey;
25
23
  /**
26
24
  * Program IDs
package/src/models.d.ts CHANGED
@@ -22,7 +22,6 @@ export declare class StateIdlModel implements StateModelType {
22
22
  uri: string | null;
23
23
  enabled: boolean | null;
24
24
  assets: PublicKey[] | null;
25
- externalVaultAccounts: PublicKey[] | null;
26
25
  mints: MintModel[] | null;
27
26
  company: CompanyModel | null;
28
27
  owner: ManagerModel | null;
@@ -36,6 +35,7 @@ export declare class StateIdlModel implements StateModelType {
36
35
  } | null;
37
36
  delegateAcls: DelegateAcl[] | null;
38
37
  integrations: Integration[] | null;
38
+ borrowableAssets: PublicKey[] | null;
39
39
  driftMarketIndexesPerp: number[] | null;
40
40
  driftMarketIndexesSpot: number[] | null;
41
41
  driftOrderTypes: number[] | null;
@@ -48,7 +48,12 @@ export declare class StateIdlModel implements StateModelType {
48
48
  }
49
49
  export declare class StateModel extends StateIdlModel {
50
50
  readonly glamProgramId: PublicKey;
51
- constructor(data: Partial<StateIdlModel>, glamProgramId?: PublicKey);
51
+ externalVaultAccounts: PublicKey[] | null;
52
+ pricedAssets: any[] | null;
53
+ ledger: LedgerEntry[] | null;
54
+ timelockExpiresAt: number | null;
55
+ pendingUpdates: any | null;
56
+ constructor(data: Partial<StateModel>, glamProgramId?: PublicKey);
52
57
  get idStr(): string;
53
58
  get vaultPda(): PublicKey;
54
59
  get openfundsPda(): PublicKey;
@@ -193,6 +198,7 @@ export type FeeStructure = IdlTypes<GlamProtocol>["feeStructure"];
193
198
  export type FeeParams = IdlTypes<GlamProtocol>["feeParams"];
194
199
  export type AccruedFees = IdlTypes<GlamProtocol>["accruedFees"];
195
200
  export type NotifyAndSettle = IdlTypes<GlamProtocol>["notifyAndSettle"];
201
+ export type LedgerEntry = IdlTypes<GlamProtocol>["ledgerEntry"];
196
202
  export declare class PriceDenom {
197
203
  static readonly SOL: {
198
204
  sol: {};
@@ -200,6 +206,16 @@ export declare class PriceDenom {
200
206
  static readonly USD: {
201
207
  usd: {};
202
208
  };
209
+ static readonly ASSET: {
210
+ asset6: {};
211
+ };
212
+ static fromAsset(asset: PublicKey): {
213
+ sol: {};
214
+ } | {
215
+ usd: {};
216
+ } | {
217
+ asset6: {};
218
+ };
203
219
  }
204
220
  export declare class TimeUnit {
205
221
  static readonly Slot: {
@@ -36,8 +36,9 @@ interface GlamProviderContext {
36
36
  driftUser: DriftUser;
37
37
  setActiveGlamState: (f: GlamStateCache) => void;
38
38
  refresh: () => Promise<void>;
39
+ refetchGlamStates: () => Promise<void>;
39
40
  }
40
- interface UserWallet {
41
+ export interface UserWallet {
41
42
  queryKey: string[];
42
43
  pubkey?: PublicKey;
43
44
  balanceLamports: number;
@@ -49,6 +50,7 @@ export interface Vault {
49
50
  balanceLamports: number;
50
51
  uiAmount: number;
51
52
  tokenAccounts: TokenAccount[];
53
+ driftUser?: DriftUser;
52
54
  }
53
55
  interface GlamStateCache {
54
56
  address: string;
@@ -1,9 +1,13 @@
1
1
  import { Connection, PublicKey, TransactionInstruction, AddressLookupTableAccount } from "@solana/web3.js";
2
+ export type StakeAccountInfo = {
3
+ address: PublicKey;
4
+ lamports: number;
5
+ state: string;
6
+ voter?: PublicKey;
7
+ };
2
8
  export declare const fetchStakeAccounts: (connection: Connection, withdrawAuthority: PublicKey) => Promise<PublicKey[]>;
3
- export declare const fetchMarinadeTicketAccounts: (connection: Connection, beneficiary: PublicKey) => Promise<{
4
- pubkey: PublicKey;
5
- account: import("@solana/web3.js").AccountInfo<Buffer | import("@solana/web3.js").ParsedAccountData>;
6
- }[]>;
9
+ export declare const getStakeAccountsWithStates: (connection: Connection, withdrawAuthority: PublicKey) => Promise<StakeAccountInfo[]>;
10
+ export declare const fetchMarinadeTicketAccounts: (connection: Connection, beneficiary: PublicKey) => Promise<import("@solana/web3.js").GetProgramAccountsResponse>;
7
11
  export declare const fetchKaminoObligations: (connection: Connection, owner: PublicKey, market?: PublicKey) => Promise<PublicKey[]>;
8
12
  export declare const fetchMeteoraPositions: (connection: Connection, owner: PublicKey) => Promise<PublicKey[]>;
9
13
  export declare const parseMeteoraPosition: (connection: Connection, position: PublicKey) => Promise<{