@glamsystems/glam-sdk 0.1.22 → 0.1.23

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.
@@ -22,41 +22,40 @@ export declare class StakingClient {
22
22
  readonly base: BaseClient;
23
23
  readonly marinade: MarinadeClient;
24
24
  constructor(base: BaseClient, marinade: MarinadeClient);
25
- unstake(glamState: PublicKey, asset: PublicKey, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
26
- stakePoolDepositSol(glamState: PublicKey, stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
27
- stakePoolDepositStake(glamState: PublicKey, stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
28
- stakePoolWithdrawStake(glamState: PublicKey, stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
29
- initializeAndDelegateStake(glamState: PublicKey, vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
30
- deactivate(glamState: PublicKey, stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
31
- withdraw(glamState: PublicKey, stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
32
- merge(glamState: PublicKey, destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
33
- split(glamState: PublicKey, existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
25
+ unstake(asset: PublicKey, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
26
+ stakePoolDepositSol(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
27
+ stakePoolDepositStake(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
28
+ stakePoolWithdrawStake(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
29
+ initializeAndDelegateStake(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
30
+ deactivate(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
31
+ withdraw(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
32
+ merge(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
33
+ split(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
34
34
  newStake: PublicKey;
35
35
  txSig: TransactionSignature;
36
36
  }>;
37
- redelegate(glamState: PublicKey, existingStake: PublicKey, vote: PublicKey, txOptions?: TxOptions): Promise<{
37
+ redelegate(existingStake: PublicKey, vote: PublicKey, txOptions?: TxOptions): Promise<{
38
38
  newStake: PublicKey;
39
39
  txSig: TransactionSignature;
40
40
  }>;
41
- getStakeAccountPda(state: PublicKey, accountId: string): [PublicKey, number];
42
41
  getStakePoolWithdrawAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
43
42
  getStakePoolDepositAuthority(programId: PublicKey, stakePool: PublicKey): PublicKey;
44
- getStakeAccountsWithStates(withdrawAuthority: PublicKey): Promise<StakeAccountInfo[]>;
43
+ getStakeAccountsWithStates(withdrawAuthority?: PublicKey): Promise<StakeAccountInfo[]>;
45
44
  getStakeAccountVoter(stakeAccount: PublicKey): Promise<PublicKey | null>;
46
45
  getStakePoolAccountData(stakePool: PublicKey): Promise<StakePoolAccountData>;
47
46
  createStakeAccount(signer: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
48
- stakePoolDepositSolTx(glamState: PublicKey, stakePool: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
49
- stakePoolDepositStakeTx(glamState: PublicKey, stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
50
- stakePoolWithdrawStakeTx(glamState: PublicKey, stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
51
- initializeAndDelegateStakeTx(glamState: PublicKey, vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
52
- deactivateStakeTx(glamState: PublicKey, stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
53
- withdrawStakeTx(glamState: PublicKey, stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
54
- mergeStakeTx(glamState: PublicKey, destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
55
- splitStakeTx(glamState: PublicKey, existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
47
+ stakePoolDepositSolTx(stakePool: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
48
+ stakePoolDepositStakeTx(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
49
+ stakePoolWithdrawStakeTx(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
50
+ initializeAndDelegateStakeTx(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
51
+ deactivateStakeTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
52
+ withdrawStakeTx(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
53
+ mergeStakeTx(destinationStake: PublicKey, sourceStake: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
54
+ splitStakeTx(existingStake: PublicKey, lamports: BN, txOptions?: TxOptions): Promise<{
56
55
  tx: VersionedTransaction;
57
56
  newStake: PublicKey;
58
57
  }>;
59
- redelegateStakeTx(glamState: PublicKey, existingStake: PublicKey, vote: PublicKey, txOptions?: TxOptions): Promise<{
58
+ redelegateStakeTx(existingStake: PublicKey, vote: PublicKey, txOptions?: TxOptions): Promise<{
60
59
  tx: VersionedTransaction;
61
60
  newStake: PublicKey;
62
61
  }>;
@@ -2,14 +2,17 @@ import { PublicKey, VersionedTransaction, TransactionInstruction, TransactionSig
2
2
  import { BN } from "@coral-xyz/anchor";
3
3
  import { BaseClient, TxOptions } from "./base";
4
4
  import { DelegateAcl, StateModel } from "../models";
5
- type PublicKeyOrString = PublicKey | string;
6
5
  export declare class StateClient {
7
6
  readonly base: BaseClient;
8
7
  constructor(base: BaseClient);
9
- createState(partialStateModel: Partial<StateModel>, singleTx?: boolean, txOptions?: TxOptions): Promise<[TransactionSignature, PublicKey]>;
10
- updateState(glamState: PublicKeyOrString, updated: Partial<StateModel>, txOptions?: TxOptions): Promise<TransactionSignature>;
11
- updateStateTx(glamState: PublicKey, updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
12
- closeState(glamState: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
8
+ create(partialStateModel: Partial<StateModel>, singleTx?: boolean, txOptions?: TxOptions): Promise<[TransactionSignature, PublicKey]>;
9
+ update(updated: Partial<StateModel>, txOptions?: TxOptions): Promise<TransactionSignature>;
10
+ updateApplyTimelock(txOptions?: TxOptions): Promise<string>;
11
+ emergencyUpdate(updated: Partial<StateModel>, txOptions?: TxOptions): Promise<TransactionSignature>;
12
+ updateStateTx(updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
13
+ updateStateApplyTimelockTx(txOptions: TxOptions): Promise<VersionedTransaction>;
14
+ emergencyUpdateStateTx(updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
15
+ close(txOptions?: TxOptions): Promise<TransactionSignature>;
13
16
  /**
14
17
  * Create a full state model from a partial state model
15
18
  */
@@ -21,20 +24,19 @@ export declare class StateClient {
21
24
  * @param delegates Public keys of delegates to be deleted
22
25
  * @returns
23
26
  */
24
- deleteDelegateAcls(statePda: PublicKey, delegates: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
25
- upsertDelegateAcls(glamState: PublicKey, delegateAcls: DelegateAcl[], txOptions?: TxOptions): Promise<TransactionSignature>;
26
- closeTokenAccounts(glamState: PublicKey, tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
27
+ deleteDelegateAcls(delegates: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
28
+ upsertDelegateAcls(delegateAcls: DelegateAcl[], txOptions?: TxOptions): Promise<TransactionSignature>;
29
+ closeTokenAccounts(tokenAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
27
30
  /**
28
31
  * Close vault's token accounts, all token accounts must use the same token program
29
32
  */
30
- closeTokenAccountIx(glamState: PublicKey, tokenAccounts: PublicKey[], tokenProgram?: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction>;
31
- closeTokenAccountsTx(glamState: PublicKey, accounts: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
32
- deposit(glamState: PublicKey | string, asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
33
- depositSol(glamState: PublicKey, lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
34
- depositSolTx(glamState: PublicKey, lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
35
- withdraw(glamState: PublicKey, asset: PublicKey | string, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
36
- depositTx(statePda: PublicKey, asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
37
- withdrawIxs(glamState: PublicKey, asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<TransactionInstruction[]>;
38
- withdrawTx(glamState: PublicKey, asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
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>;
39
42
  }
40
- export {};
@@ -1,11 +1,11 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
- import { PublicKey, VersionedTransaction, TransactionSignature } from "@solana/web3.js";
2
+ import { VersionedTransaction, TransactionSignature } from "@solana/web3.js";
3
3
  import { BaseClient, TxOptions } from "./base";
4
4
  export declare class WSolClient {
5
5
  readonly base: BaseClient;
6
6
  constructor(base: BaseClient);
7
- wrap(glamState: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
8
- unwrap(glamState: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
9
- wrapTx(glamState: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
10
- unwrapTx(glamState: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
7
+ wrap(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
8
+ unwrap(txOptions?: TxOptions): Promise<TransactionSignature>;
9
+ wrapTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
10
+ unwrapTx(txOptions: TxOptions): Promise<VersionedTransaction>;
11
11
  }
@@ -1,4 +1,5 @@
1
1
  import { Provider, Wallet } from "@coral-xyz/anchor";
2
+ import { PublicKey } from "@solana/web3.js";
2
3
  export declare enum ClusterNetwork {
3
4
  Mainnet = "mainnet-beta",
4
5
  Testnet = "testnet",
@@ -9,5 +10,6 @@ export type GlamClientConfig = {
9
10
  provider?: Provider;
10
11
  wallet?: Wallet;
11
12
  cluster?: ClusterNetwork;
13
+ statePda?: PublicKey;
12
14
  jupiterApi?: string;
13
15
  };
@@ -9,6 +9,7 @@ export declare const STAKE_ACCOUNT_SIZE = 200;
9
9
  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
+ export declare const KAMINO_SCOPE_PRICES: PublicKey;
12
13
  /**
13
14
  * Token mints. If no devnet version is defined, assume mainnet and devnet addresses are the same.
14
15
  *
package/src/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./client";
5
5
  export * from "./client/jupiter";
6
6
  export * from "./client/drift";
7
7
  export * from "./client/base";
8
+ export * from "./utils/glamPDAs";
8
9
  export * from "./utils/helpers";
9
10
  export * from "./utils/priorityfee";
10
11
  export * from "./utils/driftOrderParams";
package/src/models.d.ts CHANGED
@@ -27,13 +27,21 @@ export declare class StateIdlModel implements StateModelType {
27
27
  company: CompanyModel | null;
28
28
  owner: ManagerModel | null;
29
29
  created: CreatedModel | null;
30
+ baseAsset: PublicKey | null;
31
+ updateTimelock: number | null;
32
+ timeUnit: {
33
+ slot: {};
34
+ } | {
35
+ second: {};
36
+ } | null;
30
37
  delegateAcls: DelegateAcl[] | null;
31
38
  integrations: Integration[] | null;
32
39
  driftMarketIndexesPerp: number[] | null;
33
40
  driftMarketIndexesSpot: number[] | null;
34
41
  driftOrderTypes: number[] | null;
35
- baseAsset: PublicKey | null;
36
- maxCap: BN | null;
42
+ kaminoLendingMarkets: PublicKey[] | null;
43
+ meteoraDlmmPools: PublicKey[] | null;
44
+ maxSwapSlippageBps: number | null;
37
45
  metadata: Metadata | null;
38
46
  rawOpenfunds: FundOpenfundsModel | null;
39
47
  constructor(data: Partial<StateModelType>);
@@ -49,7 +57,7 @@ export declare class StateModel extends StateIdlModel {
49
57
  get mintAddresses(): PublicKey[];
50
58
  get sparkleKey(): string;
51
59
  /**
52
- * Build a StateModel from onchain accounts
60
+ * Build a StateModel from onchain data
53
61
  *
54
62
  * @param stateAccount provides core fund data
55
63
  * @param openfundsMetadataAccount includes fund rawOpenfunds data and share class rawOpenfunds data
@@ -87,20 +95,27 @@ export declare class MintIdlModel implements MintModelType {
87
95
  imageUri: string | null;
88
96
  allowlist: PublicKey[] | null;
89
97
  blocklist: PublicKey[] | null;
90
- lockUpPeriodInSeconds: number | null;
98
+ lockUpPeriod: number | null;
99
+ yearInSeconds: number | null;
91
100
  permanentDelegate: PublicKey | null;
92
101
  defaultAccountStateFrozen: boolean | null;
93
102
  feeStructure: FeeStructure | null;
94
103
  feeParams: FeeParams | null;
95
- valuation: Valuation | null;
104
+ notifyAndSettle: NotifyAndSettle | null;
105
+ maxCap: BN | null;
96
106
  minSubscription: BN | null;
97
107
  minRedemption: BN | null;
108
+ subscriptionPaused: boolean | null;
109
+ redemptionPaused: boolean | null;
98
110
  isRawOpenfunds: boolean | null;
99
111
  rawOpenfunds: MintOpenfundsModel | null;
100
112
  constructor(data: Partial<MintModelType>);
101
113
  }
102
114
  export declare class MintModel extends MintIdlModel {
103
115
  constructor(data: Partial<MintIdlModel>);
116
+ /**
117
+ * @deprecated
118
+ */
104
119
  static mintAddress(statePda: PublicKey, idx?: number, glamProgramId?: PublicKey): PublicKey;
105
120
  }
106
121
  export type MintOpenfundsModelType = IdlTypes<GlamProtocol>["mintOpenfundsModel"];
@@ -177,7 +192,7 @@ export type Integration = IdlTypes<GlamProtocol>["integration"];
177
192
  export type FeeStructure = IdlTypes<GlamProtocol>["feeStructure"];
178
193
  export type FeeParams = IdlTypes<GlamProtocol>["feeParams"];
179
194
  export type AccruedFees = IdlTypes<GlamProtocol>["accruedFees"];
180
- export type Valuation = IdlTypes<GlamProtocol>["valuation"];
195
+ export type NotifyAndSettle = IdlTypes<GlamProtocol>["notifyAndSettle"];
181
196
  export declare class PriceDenom {
182
197
  static readonly SOL: {
183
198
  sol: {};
@@ -186,3 +201,11 @@ export declare class PriceDenom {
186
201
  usd: {};
187
202
  };
188
203
  }
204
+ export declare class TimeUnit {
205
+ static readonly Slot: {
206
+ slot: {};
207
+ };
208
+ static readonly Second: {
209
+ second: {};
210
+ };
211
+ }
@@ -0,0 +1,18 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import { StateModel } from "../models";
3
+ /**
4
+ * Compute state account PDA from state model
5
+ */
6
+ export declare function getStatePda(stateModel: Partial<StateModel>, programId: PublicKey, owner?: PublicKey): PublicKey;
7
+ /**
8
+ * Compute vault PDA from state PDA
9
+ */
10
+ export declare function getVaultPda(statePda: PublicKey, programId: PublicKey): PublicKey;
11
+ /**
12
+ * Compute escrow PDA from state PDA
13
+ */
14
+ export declare function getEscrowPda(statePda: PublicKey, programId: PublicKey): PublicKey;
15
+ export declare function getOpenfundsPda(statePda: PublicKey, programId: PublicKey): PublicKey;
16
+ export declare function getMintPda(statePda: PublicKey, mintIdx: number, programId: PublicKey): PublicKey;
17
+ export declare function getExtraMetasPda(mint: PublicKey): PublicKey;
18
+ export declare function getAccountPolicyPda(tokenAccount: PublicKey): PublicKey;
@@ -13,5 +13,6 @@ export declare const parseMeteoraPosition: (connection: Connection, position: Pu
13
13
  binArrayLower: PublicKey;
14
14
  binArrayUpper: PublicKey;
15
15
  }>;
16
+ export declare function fetchLookupTables(connection: Connection, authority: PublicKey, firstEntry: PublicKey): Promise<AddressLookupTableAccount[]>;
16
17
  export declare const getSimulationComputeUnits: (connection: Connection, instructions: Array<TransactionInstruction>, payer: PublicKey, lookupTables?: Array<AddressLookupTableAccount>) => Promise<number | undefined>;
17
18
  export declare const setsAreEqual: (a: Set<any>, b: Set<any>) => boolean;