@glamsystems/glam-sdk 0.1.25 → 0.1.27
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/index.cjs.js +1991 -662
- package/index.esm.js +1986 -659
- package/package.json +1 -1
- package/src/client/assets.d.ts +7 -4
- package/src/client/base.d.ts +1 -2
- package/src/client/drift.d.ts +38 -7
- package/src/client/kamino.d.ts +26 -15
- package/src/client/marinade.d.ts +2 -8
- package/src/client/price.d.ts +35 -4
- package/src/client/staking.d.ts +2 -2
- package/src/client/state.d.ts +1 -0
- package/src/client/vault.d.ts +1 -1
- package/src/client.d.ts +6 -2
- package/src/constants.d.ts +3 -1
- package/src/deser/driftLayouts.d.ts +68 -0
- package/src/deser/kaminoLayouts.d.ts +55 -0
- package/src/utils/driftTypes.d.ts +1 -0
- package/src/utils/helpers.d.ts +5 -3
- package/target/idl/glam_protocol.json +969 -207
- package/target/types/glam_protocol.d.ts +965 -203
- package/target/types/glam_protocol.ts +969 -207
package/package.json
CHANGED
package/src/client/assets.d.ts
CHANGED
|
@@ -3,17 +3,19 @@ export declare const STAKE_POOLS: {
|
|
|
3
3
|
name: string;
|
|
4
4
|
symbol: string;
|
|
5
5
|
mint: string;
|
|
6
|
+
decimals: number;
|
|
6
7
|
logoURI: string;
|
|
7
|
-
tokenProgram:
|
|
8
|
-
poolState:
|
|
8
|
+
tokenProgram: PublicKey;
|
|
9
|
+
poolState: PublicKey;
|
|
9
10
|
}[];
|
|
10
11
|
export declare const STAKE_POOLS_MAP: Map<string, {
|
|
11
12
|
name: string;
|
|
12
13
|
symbol: string;
|
|
13
14
|
mint: string;
|
|
15
|
+
decimals: number;
|
|
14
16
|
logoURI: string;
|
|
15
|
-
tokenProgram:
|
|
16
|
-
poolState:
|
|
17
|
+
tokenProgram: PublicKey;
|
|
18
|
+
poolState: PublicKey;
|
|
17
19
|
}>;
|
|
18
20
|
/**
|
|
19
21
|
* Metadata for an asset for pricing
|
|
@@ -27,3 +29,4 @@ export interface AssetMeta {
|
|
|
27
29
|
export declare const ASSETS_MAINNET: Map<string, AssetMeta>;
|
|
28
30
|
export declare const ASSETS_TESTS: Map<string, AssetMeta>;
|
|
29
31
|
export declare const SOL_ORACLE: PublicKey;
|
|
32
|
+
export declare const USDC_ORACLE: PublicKey;
|
package/src/client/base.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare class BaseClient {
|
|
|
42
42
|
get detectedCluster(): ClusterNetwork;
|
|
43
43
|
get statePda(): PublicKey;
|
|
44
44
|
set statePda(statePda: PublicKey);
|
|
45
|
-
isMainnet(): boolean;
|
|
45
|
+
get isMainnet(): boolean;
|
|
46
46
|
isPhantom(): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Get metadata of an asset for pricing
|
|
@@ -54,7 +54,6 @@ export declare class BaseClient {
|
|
|
54
54
|
private getComputeBudgetIxs;
|
|
55
55
|
intoVersionedTransaction(tx: Transaction, { lookupTables, signer, computeUnitLimit, getPriorityFeeMicroLamports, maxFeeLamports, useMaxFee, jitoTipLamports, simulate, }: TxOptions): Promise<VersionedTransaction>;
|
|
56
56
|
sendAndConfirm(tx: VersionedTransaction | Transaction, additionalSigners?: Keypair[]): Promise<TransactionSignature>;
|
|
57
|
-
parseProgramLogs(logs?: null | string[]): string;
|
|
58
57
|
getAdressLookupTableAccounts(keys?: string[] | PublicKey[]): Promise<AddressLookupTableAccount[]>;
|
|
59
58
|
getWallet(): Wallet;
|
|
60
59
|
getSigner(): PublicKey;
|
package/src/client/drift.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as anchor from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
3
|
import { MarketType, OrderParams, PositionDirection, SpotPosition, PerpPosition, ModifyOrderParams, OracleSource, SpotBalanceType, MarginMode, Order } from "../utils/driftTypes";
|
|
4
|
+
import { DriftVault } from "../deser/driftLayouts";
|
|
4
5
|
import { BaseClient, TxOptions } from "./base";
|
|
5
6
|
import { AccountMeta } from "@solana/web3.js";
|
|
6
7
|
import { StateModel } from "../models";
|
|
@@ -88,17 +89,17 @@ export declare class DriftClient {
|
|
|
88
89
|
userStats: PublicKey;
|
|
89
90
|
};
|
|
90
91
|
get driftStatePda(): PublicKey;
|
|
91
|
-
fetchAndParseSpotMarket(marketIndex: number): Promise<SpotMarket>;
|
|
92
|
-
fetchAndParseSpotMarkets(marketIndexes: number[]): Promise<SpotMarket[]>;
|
|
93
|
-
fetchAndParsePerpMarket(marketIndex: number): Promise<PerpMarket>;
|
|
94
|
-
fetchAndParsePerpMarkets(marketIndexes: number[]): Promise<PerpMarket[]>;
|
|
95
|
-
fetchMarketConfigs(): Promise<DriftMarketConfigs>;
|
|
92
|
+
fetchAndParseSpotMarket(marketIndex: number, skipCache?: boolean): Promise<SpotMarket>;
|
|
93
|
+
fetchAndParseSpotMarkets(marketIndexes: number[], skipCache?: boolean): Promise<SpotMarket[]>;
|
|
94
|
+
fetchAndParsePerpMarket(marketIndex: number, skipCache?: boolean): Promise<PerpMarket>;
|
|
95
|
+
fetchAndParsePerpMarkets(marketIndexes: number[], skipCache?: boolean): Promise<PerpMarket[]>;
|
|
96
|
+
fetchMarketConfigs(skipCache?: boolean): Promise<DriftMarketConfigs>;
|
|
96
97
|
charsToName(chars: number[] | Buffer): string;
|
|
97
|
-
fetchDriftUser(subAccountId?: number): Promise<DriftUser | null>;
|
|
98
|
+
fetchDriftUser(subAccountId?: number, skipCache?: boolean): Promise<DriftUser | null>;
|
|
98
99
|
/**
|
|
99
100
|
* @deprecated
|
|
100
101
|
*/
|
|
101
|
-
fetchPolicyConfig(
|
|
102
|
+
fetchPolicyConfig(stateModel: StateModel): Promise<{
|
|
102
103
|
driftAccessControl: number;
|
|
103
104
|
driftDelegatedAccount: anchor.web3.PublicKey;
|
|
104
105
|
driftMarketIndexesPerp: number[];
|
|
@@ -129,4 +130,34 @@ export declare class DriftClient {
|
|
|
129
130
|
cancelOrdersByIdsTx(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
130
131
|
settlePnlTx(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
131
132
|
}
|
|
133
|
+
export declare class DriftVaultsClient {
|
|
134
|
+
readonly base: BaseClient;
|
|
135
|
+
readonly drift: DriftClient;
|
|
136
|
+
constructor(base: BaseClient, drift: DriftClient);
|
|
137
|
+
fetchUserPositions(user: PublicKey): Promise<{
|
|
138
|
+
perpPositions: PerpPosition[];
|
|
139
|
+
spotPositions: SpotPosition[];
|
|
140
|
+
}>;
|
|
141
|
+
getDepositorPda(driftVault: PublicKey): anchor.web3.PublicKey;
|
|
142
|
+
parseDriftVault(driftVault: PublicKey): Promise<DriftVault>;
|
|
143
|
+
composeRemainingAccounts(user: PublicKey): Promise<AccountMeta[]>;
|
|
144
|
+
parseDepositor(depositor: PublicKey, data: Buffer): {
|
|
145
|
+
address: anchor.web3.PublicKey;
|
|
146
|
+
driftVault: anchor.web3.PublicKey;
|
|
147
|
+
shares: any;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Finds all drift vault depositors
|
|
151
|
+
*/
|
|
152
|
+
findAndParseVaultDepositors(authority?: PublicKey): Promise<{
|
|
153
|
+
address: anchor.web3.PublicKey;
|
|
154
|
+
driftVault: anchor.web3.PublicKey;
|
|
155
|
+
shares: any;
|
|
156
|
+
}[]>;
|
|
157
|
+
initializeVaultDepositor(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
158
|
+
deposit(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
159
|
+
requestWithdraw(driftVault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
160
|
+
cancelWithdrawRequest(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
161
|
+
withdraw(driftVault: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
162
|
+
}
|
|
132
163
|
export {};
|
package/src/client/kamino.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BN } from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction, AccountMeta } from "@solana/web3.js";
|
|
3
3
|
import { BaseClient, TxOptions } from "./base";
|
|
4
|
+
import { KVaultAllocation, KVaultState } from "../deser/kaminoLayouts";
|
|
4
5
|
interface ParsedReserve {
|
|
5
6
|
address: PublicKey;
|
|
7
|
+
market: PublicKey;
|
|
6
8
|
farmCollateral: PublicKey | null;
|
|
7
9
|
farmDebt: PublicKey | null;
|
|
8
10
|
liquidityMint: PublicKey;
|
|
@@ -81,7 +83,6 @@ export declare class KaminoLendingClient {
|
|
|
81
83
|
id: number;
|
|
82
84
|
}): PublicKey;
|
|
83
85
|
getObligationFarmState(obligation: PublicKey, farm: PublicKey): PublicKey;
|
|
84
|
-
initUserMetadataTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
85
86
|
refreshReserveIxs(lendingMarket: PublicKey, reserves: PublicKey[]): TransactionInstruction[];
|
|
86
87
|
refreshObligationCollateralFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
|
|
87
88
|
refreshObligationDebtFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
|
|
@@ -92,25 +93,20 @@ export declare class KaminoLendingClient {
|
|
|
92
93
|
collateralSupplyVault: PublicKey;
|
|
93
94
|
feeVault: PublicKey;
|
|
94
95
|
};
|
|
96
|
+
parseObligation(obligation: PublicKey, data: Buffer): ParsedObligation;
|
|
95
97
|
/**
|
|
96
|
-
* Fetches and parses obligation account
|
|
97
|
-
*
|
|
98
|
-
* @param obligation User obligation pubkey
|
|
99
|
-
* @returns Pubkeys of reserves for deposits and borrows
|
|
98
|
+
* Fetches and parses an obligation account
|
|
100
99
|
*/
|
|
101
100
|
fetchAndParseObligation(obligation: PublicKey): Promise<ParsedObligation>;
|
|
102
101
|
pubkeyArraysEqual: (a: PublicKey[], b: PublicKey[]) => boolean;
|
|
103
|
-
|
|
104
|
-
liquiditySupplyVault: PublicKey;
|
|
105
|
-
collateralMint: PublicKey;
|
|
106
|
-
collateralSupplyVault: PublicKey;
|
|
107
|
-
feeVault: PublicKey;
|
|
108
|
-
farmCollateral: PublicKey;
|
|
109
|
-
farmDebt: PublicKey;
|
|
110
|
-
liquidityMint: PublicKey;
|
|
111
|
-
};
|
|
102
|
+
parseReserveAccount(reserve: PublicKey, data: Buffer): ParsedReserve;
|
|
112
103
|
fetchAndParseReserves(reserves: PublicKey[]): Promise<ParsedReserve[]>;
|
|
113
104
|
findAndParseReserve(market: PublicKey, asset: PublicKey): Promise<ParsedReserve>;
|
|
105
|
+
/**
|
|
106
|
+
* Finds and parses Kamino obligations for a given owner and market (optional)
|
|
107
|
+
*/
|
|
108
|
+
findAndParseObligations(owner: PublicKey, market?: PublicKey): Promise<ParsedObligation[]>;
|
|
109
|
+
initUserMetadataTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
114
110
|
depositTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
115
111
|
withdrawTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
116
112
|
borrowTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
@@ -139,4 +135,19 @@ export declare class KaminoFarmClient {
|
|
|
139
135
|
harvest(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
140
136
|
harvestTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
141
137
|
}
|
|
138
|
+
export declare class KaminoVaultsClient {
|
|
139
|
+
readonly base: BaseClient;
|
|
140
|
+
readonly kaminoLending: KaminoLendingClient;
|
|
141
|
+
private vaultStates;
|
|
142
|
+
private shareMintToVaultPdaMap;
|
|
143
|
+
constructor(base: BaseClient, kaminoLending: KaminoLendingClient);
|
|
144
|
+
deposit(vault: PublicKey, amount: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
145
|
+
withdraw(vault: PublicKey, amount: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
146
|
+
findAndParseKaminoVaults(): Promise<KVaultState[]>;
|
|
147
|
+
getVaultPdasByShareMints(mints: PublicKey[]): Promise<PublicKey[]>;
|
|
148
|
+
fetchAndParseVaultState(vault: PublicKey): Promise<KVaultState>;
|
|
149
|
+
composeRemainingAccounts(allocationStrategies: KVaultAllocation[]): Promise<AccountMeta[]>;
|
|
150
|
+
depositTx(vault: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
151
|
+
withdrawTx(vault: PublicKey, amount: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
152
|
+
}
|
|
142
153
|
export {};
|
package/src/client/marinade.d.ts
CHANGED
|
@@ -16,11 +16,7 @@ export declare class MarinadeClient {
|
|
|
16
16
|
deposit(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
17
17
|
depositNative(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
18
18
|
depositStakeAccount(stakeAccount: PublicKey): Promise<TransactionSignature>;
|
|
19
|
-
withdrawStakeAccount(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
20
|
-
orderUnstake(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
21
|
-
claim(tickets: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
22
|
-
getTickets(): Promise<PublicKey[]>;
|
|
23
|
-
getParsedTickets(): Promise<Ticket[]>;
|
|
19
|
+
withdrawStakeAccount(amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
24
20
|
/**
|
|
25
21
|
* @deprecated Use Marinade.getMarinadeState() instead
|
|
26
22
|
*/
|
|
@@ -45,7 +41,5 @@ export declare class MarinadeClient {
|
|
|
45
41
|
stakeIndex: number;
|
|
46
42
|
validatorIndex: number;
|
|
47
43
|
}>;
|
|
48
|
-
withdrawStakeAccountTx(amount: BN, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
|
|
49
|
-
orderUnstakeTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
50
|
-
claimTx(tickets: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
44
|
+
withdrawStakeAccountTx(amount: BN, deactivate: boolean, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
|
|
51
45
|
}
|
package/src/client/price.d.ts
CHANGED
|
@@ -1,20 +1,51 @@
|
|
|
1
1
|
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import { KaminoLendingClient } from "./kamino";
|
|
2
|
+
import { KaminoLendingClient, KaminoVaultsClient } from "./kamino";
|
|
3
3
|
import { BaseClient } from "./base";
|
|
4
4
|
import { PriceDenom } from "../models";
|
|
5
|
-
import { DriftClient } from "./drift";
|
|
5
|
+
import { DriftClient, DriftVaultsClient } from "./drift";
|
|
6
6
|
export declare class PriceClient {
|
|
7
7
|
readonly base: BaseClient;
|
|
8
8
|
readonly klend: KaminoLendingClient;
|
|
9
|
+
readonly kvaults: KaminoVaultsClient;
|
|
9
10
|
readonly drift: DriftClient;
|
|
10
|
-
|
|
11
|
+
readonly dvaults: DriftVaultsClient;
|
|
12
|
+
constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, drift: DriftClient, dvaults: DriftVaultsClient);
|
|
11
13
|
/**
|
|
12
14
|
* !! This is a convenience method that calculates the AUM of the vault based on priced assets.
|
|
13
15
|
* !! It doesn't reflect the actual AUM of the vault.
|
|
14
16
|
* !! If the vault has not been priced or pricing data is outdated, the number is NOT meaningful.
|
|
15
17
|
*/
|
|
16
18
|
getAum(): Promise<BN>;
|
|
17
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Returns an instruction that prices Kamino obligations.
|
|
21
|
+
* If there are no Kamino obligations, returns null.
|
|
22
|
+
*/
|
|
23
|
+
priceKaminoObligationsIx(priceDenom: PriceDenom): Promise<TransactionInstruction | null>;
|
|
24
|
+
priceKaminoVaultSharesIx(priceDenom: PriceDenom): Promise<TransactionInstruction | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns an instruction that prices the all Drift users (aka sub-accounts) controlled by the GLAM vault.
|
|
27
|
+
* These Drift users must share the same user_stats that's also controlled by the GLAM vault.
|
|
28
|
+
*/
|
|
29
|
+
priceDriftUsersIx(priceDenom: PriceDenom): Promise<TransactionInstruction | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns an instruction that prices a drift vault depositor.
|
|
32
|
+
* If there are no vault depositor accounts, returns null.
|
|
33
|
+
*/
|
|
34
|
+
priceDriftVaultDepositorsIx(priceDenom: PriceDenom): Promise<TransactionInstruction | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns an instruction that prices vault balance and tokens the vault holds
|
|
37
|
+
*/
|
|
38
|
+
priceVaultIx(priceDenom: PriceDenom): Promise<TransactionInstruction>;
|
|
39
|
+
/**
|
|
40
|
+
* Returns an instruction that prices stake accounts.
|
|
41
|
+
* If there are no stake accounts, returns null.
|
|
42
|
+
*/
|
|
43
|
+
priceStakesIx(priceDenom: PriceDenom): Promise<TransactionInstruction | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns an instruction that prices Meteora positions.
|
|
46
|
+
* If there are no Meteora positions, returns null.
|
|
47
|
+
*/
|
|
48
|
+
priceMeteoraPositionsIx(priceDenom: PriceDenom): Promise<TransactionInstruction | null>;
|
|
18
49
|
priceVaultIxs(priceDenom: PriceDenom): Promise<TransactionInstruction[]>;
|
|
19
50
|
remainingAccountsForPricingMeteora: () => Promise<{
|
|
20
51
|
pubkey: PublicKey;
|
package/src/client/staking.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ export declare class StakingClient {
|
|
|
17
17
|
readonly base: BaseClient;
|
|
18
18
|
readonly marinade: MarinadeClient;
|
|
19
19
|
constructor(base: BaseClient, marinade: MarinadeClient);
|
|
20
|
-
unstake(asset: PublicKey, amount: number | BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
20
|
+
unstake(asset: PublicKey, amount: number | BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
21
21
|
stakePoolDepositSol(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
22
22
|
stakePoolDepositStake(stakePool: PublicKey, stakeAccount: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
23
|
-
stakePoolWithdrawStake(stakePool: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
23
|
+
stakePoolWithdrawStake(stakePool: PublicKey, amount: BN, deactivate?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
24
24
|
initializeAndDelegateStake(vote: PublicKey, amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
25
25
|
deactivate(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
26
26
|
withdraw(stakeAccounts: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
package/src/client/state.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class StateClient {
|
|
|
11
11
|
updateStateTx(updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
12
12
|
updateStateApplyTimelockTx(txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
13
13
|
emergencyUpdateStateTx(updated: Partial<StateModel>, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
14
|
+
extend(newBytes: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
14
15
|
close(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
15
16
|
/**
|
|
16
17
|
* Create a full state model from a partial state model
|
package/src/client/vault.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ export declare class VaultClient {
|
|
|
22
22
|
closeTokenAccountsTx(accounts: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
23
23
|
depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
24
24
|
depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
25
|
-
withdrawIxs(asset: PublicKey, amount: number | BN, txOptions
|
|
25
|
+
withdrawIxs(asset: PublicKey, amount: number | BN, txOptions?: TxOptions): Promise<TransactionInstruction[]>;
|
|
26
26
|
withdrawTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
27
27
|
}
|
package/src/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlamClientConfig } from "./clientConfig";
|
|
2
2
|
import { BaseClient } from "./client/base";
|
|
3
|
-
import { DriftClient } from "./client/drift";
|
|
3
|
+
import { DriftClient, DriftVaultsClient } from "./client/drift";
|
|
4
4
|
import { JupiterSwapClient } from "./client/jupiter";
|
|
5
5
|
import { JupiterVoteClient } from "./client/jupiter";
|
|
6
6
|
import { MarinadeClient } from "./client/marinade";
|
|
@@ -8,7 +8,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";
|
|
11
|
-
import { KaminoFarmClient, KaminoLendingClient } from "./client/kamino";
|
|
11
|
+
import { KaminoFarmClient, KaminoLendingClient, KaminoVaultsClient } from "./client/kamino";
|
|
12
12
|
import { MeteoraDlmmClient } from "./client/meteora";
|
|
13
13
|
import { InvestorClient } from "./client/investor";
|
|
14
14
|
import { PriceClient } from "./client/price";
|
|
@@ -20,6 +20,7 @@ export { JUPITER_API_DEFAULT } from "./client/base";
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class GlamClient extends BaseClient {
|
|
22
22
|
private _drift?;
|
|
23
|
+
private _driftVaults?;
|
|
23
24
|
private _investor?;
|
|
24
25
|
private _jupiterSwap?;
|
|
25
26
|
private _jupiterVote?;
|
|
@@ -31,9 +32,11 @@ export declare class GlamClient extends BaseClient {
|
|
|
31
32
|
private _mint?;
|
|
32
33
|
private _kaminoLending?;
|
|
33
34
|
private _kaminoFarm?;
|
|
35
|
+
private _kaminoVaults?;
|
|
34
36
|
private _meteoraDlmm?;
|
|
35
37
|
constructor(config?: GlamClientConfig);
|
|
36
38
|
get drift(): DriftClient;
|
|
39
|
+
get driftVaults(): DriftVaultsClient;
|
|
37
40
|
get investor(): InvestorClient;
|
|
38
41
|
get jupiterSwap(): JupiterSwapClient;
|
|
39
42
|
get jupiterVote(): JupiterVoteClient;
|
|
@@ -45,5 +48,6 @@ export declare class GlamClient extends BaseClient {
|
|
|
45
48
|
get mint(): MintClient;
|
|
46
49
|
get kaminoLending(): KaminoLendingClient;
|
|
47
50
|
get kaminoFarm(): KaminoFarmClient;
|
|
51
|
+
get kaminoVaults(): KaminoVaultsClient;
|
|
48
52
|
get meteoraDlmm(): MeteoraDlmmClient;
|
|
49
53
|
}
|
package/src/constants.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export declare const SEED_MINT: string;
|
|
|
4
4
|
export declare const SEED_STATE: string;
|
|
5
5
|
export declare const SEED_VAULT: string;
|
|
6
6
|
export declare const SEED_ESCROW: string;
|
|
7
|
-
export declare const MARINADE_TICKET_SIZE = 88;
|
|
8
7
|
export declare const STAKE_ACCOUNT_SIZE = 200;
|
|
9
8
|
export declare const METEORA_POSITION_SIZE = 8120;
|
|
10
9
|
export declare const KAMINO_OBTRIGATION_SIZE = 3344;
|
|
10
|
+
export declare const DRIFT_VAULT_DEPOSITOR_SIZE = 272;
|
|
11
11
|
export declare const JITO_TIP_DEFAULT: PublicKey;
|
|
12
12
|
export declare const KAMINO_SCOPE_PRICES: PublicKey;
|
|
13
13
|
export declare const MARINADE_NATIVE_STAKE_AUTHORITY: PublicKey;
|
|
@@ -25,6 +25,7 @@ export declare const JUP: PublicKey;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare const MARINADE_PROGRAM_ID: PublicKey;
|
|
27
27
|
export declare const DRIFT_PROGRAM_ID: PublicKey;
|
|
28
|
+
export declare const DRIFT_VAULTS_PROGRAM_ID: PublicKey;
|
|
28
29
|
export declare const JUPITER_PROGRAM_ID: PublicKey;
|
|
29
30
|
export declare const SANCTUM_STAKE_POOL_PROGRAM_ID: PublicKey;
|
|
30
31
|
export declare const GOVERNANCE_PROGRAM_ID: PublicKey;
|
|
@@ -33,6 +34,7 @@ export declare const MERKLE_DISTRIBUTOR_PROGRAM: PublicKey;
|
|
|
33
34
|
export declare const TRANSFER_HOOK_PROGRAM: PublicKey;
|
|
34
35
|
export declare const METEORA_DLMM_PROGRAM: PublicKey;
|
|
35
36
|
export declare const KAMINO_LENDING_PROGRAM: PublicKey;
|
|
37
|
+
export declare const KAMINO_VAULTS_PROGRAM: PublicKey;
|
|
36
38
|
export declare const KAMINO_FARM_PROGRAM: PublicKey;
|
|
37
39
|
export declare const MEMO_PROGRAM: PublicKey;
|
|
38
40
|
/**
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
export declare const DriftVaultLayout: any;
|
|
4
|
+
export interface DriftVault {
|
|
5
|
+
discriminator: number[];
|
|
6
|
+
name: number[];
|
|
7
|
+
pubkey: PublicKey;
|
|
8
|
+
manager: PublicKey;
|
|
9
|
+
tokenAccount: PublicKey;
|
|
10
|
+
userStats: PublicKey;
|
|
11
|
+
user: PublicKey;
|
|
12
|
+
delegate: PublicKey;
|
|
13
|
+
liquidationDelegate: PublicKey;
|
|
14
|
+
userShares: BN;
|
|
15
|
+
totalShares: BN;
|
|
16
|
+
lastFeeUpdateTs: BN;
|
|
17
|
+
liquidationStartTs: BN;
|
|
18
|
+
redeemPeriod: BN;
|
|
19
|
+
totalWithdrawRequested: BN;
|
|
20
|
+
maxTokens: BN;
|
|
21
|
+
managementFee: BN;
|
|
22
|
+
initTs: BN;
|
|
23
|
+
netDeposits: BN;
|
|
24
|
+
managerNetDeposits: BN;
|
|
25
|
+
totalDeposits: BN;
|
|
26
|
+
totalWithdraws: BN;
|
|
27
|
+
managerTotalDeposits: BN;
|
|
28
|
+
managerTotalWithdraws: BN;
|
|
29
|
+
managerTotalFee: BN;
|
|
30
|
+
managerTotalProfitShare: BN;
|
|
31
|
+
minDepositAmount: BN;
|
|
32
|
+
lastManagerWithdrawRequest: {
|
|
33
|
+
shares: BN;
|
|
34
|
+
amount: BN;
|
|
35
|
+
ts: BN;
|
|
36
|
+
};
|
|
37
|
+
sharesBase: number;
|
|
38
|
+
profitShare: number;
|
|
39
|
+
hurdleRate: number;
|
|
40
|
+
spotMarketIndex: number;
|
|
41
|
+
bump: number;
|
|
42
|
+
permissioned: boolean;
|
|
43
|
+
vaultProtocol: boolean;
|
|
44
|
+
fuelDistributionMode: number;
|
|
45
|
+
feeUpdateStatus: number;
|
|
46
|
+
padding1: number;
|
|
47
|
+
lastCumulativeFuelPerShareTs: number;
|
|
48
|
+
cumulativeFuelPerShare: BN;
|
|
49
|
+
cumulativeFuel: BN;
|
|
50
|
+
padding: BN[];
|
|
51
|
+
}
|
|
52
|
+
export declare const DriftSpotMarket: any;
|
|
53
|
+
export interface DriftSpotMarket {
|
|
54
|
+
discriminator: number[];
|
|
55
|
+
marketPda: PublicKey;
|
|
56
|
+
oracle: PublicKey;
|
|
57
|
+
mint: PublicKey;
|
|
58
|
+
vault: PublicKey;
|
|
59
|
+
name: number[];
|
|
60
|
+
padding1: number[];
|
|
61
|
+
cumulativeDepositInterest: BN;
|
|
62
|
+
cumulativeBorrowInterest: BN;
|
|
63
|
+
padding2: number[];
|
|
64
|
+
decimals: number;
|
|
65
|
+
marketIndex: number;
|
|
66
|
+
padding3: number;
|
|
67
|
+
oracleSource: number;
|
|
68
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
export declare const VaultAllocationLayout: any;
|
|
4
|
+
export declare const KVaultStateLayout: any;
|
|
5
|
+
export interface KVaultAllocation {
|
|
6
|
+
reserve: PublicKey;
|
|
7
|
+
ctokenVault: PublicKey;
|
|
8
|
+
targetAllocationWeight: BN;
|
|
9
|
+
tokenAllocationCap: BN;
|
|
10
|
+
ctokenVaultBump: BN;
|
|
11
|
+
configPadding: BN[];
|
|
12
|
+
ctokenAllocation: BN;
|
|
13
|
+
lastInvestSlot: BN;
|
|
14
|
+
tokenTargetAllocationSf: BN;
|
|
15
|
+
statePadding: BN[];
|
|
16
|
+
}
|
|
17
|
+
export interface KVaultState {
|
|
18
|
+
discriminator: number[];
|
|
19
|
+
vaultAdminAuthority: PublicKey;
|
|
20
|
+
baseVaultAuthority: PublicKey;
|
|
21
|
+
baseVaultAuthorityBump: BN;
|
|
22
|
+
tokenMint: PublicKey;
|
|
23
|
+
tokenMintDecimals: BN;
|
|
24
|
+
tokenVault: PublicKey;
|
|
25
|
+
tokenProgram: PublicKey;
|
|
26
|
+
sharesMint: PublicKey;
|
|
27
|
+
sharesMintDecimals: BN;
|
|
28
|
+
tokenAvailable: BN;
|
|
29
|
+
sharesIssued: BN;
|
|
30
|
+
availableCrankFunds: BN;
|
|
31
|
+
padding0: BN;
|
|
32
|
+
performanceFeeBps: BN;
|
|
33
|
+
managementFeeBps: BN;
|
|
34
|
+
lastFeeChargeTimestamp: BN;
|
|
35
|
+
prevAumSf: BN;
|
|
36
|
+
pendingFeesSf: BN;
|
|
37
|
+
vaultAllocationStrategy: KVaultAllocation[];
|
|
38
|
+
padding1: BN[];
|
|
39
|
+
minDepositAmount: BN;
|
|
40
|
+
minWithdrawAmount: BN;
|
|
41
|
+
minInvestAmount: BN;
|
|
42
|
+
minInvestDelaySlots: BN;
|
|
43
|
+
crankFundFeePerReserve: BN;
|
|
44
|
+
pendingAdmin: PublicKey;
|
|
45
|
+
cumulativeEarnedInterestSf: BN;
|
|
46
|
+
cumulativeMgmtFeesSf: BN;
|
|
47
|
+
cumulativePerfFeesSf: BN;
|
|
48
|
+
name: number[];
|
|
49
|
+
vaultLookupTable: PublicKey;
|
|
50
|
+
vaultFarm: PublicKey;
|
|
51
|
+
creationTimestamp: BN;
|
|
52
|
+
padding2: BN;
|
|
53
|
+
allocationAdmin: PublicKey;
|
|
54
|
+
padding3: BN[];
|
|
55
|
+
}
|
package/src/utils/helpers.d.ts
CHANGED
|
@@ -5,10 +5,8 @@ export type StakeAccountInfo = {
|
|
|
5
5
|
state: string;
|
|
6
6
|
voter?: PublicKey;
|
|
7
7
|
};
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const findStakeAccounts: (connection: Connection, withdrawAuthority: PublicKey) => Promise<PublicKey[]>;
|
|
9
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>;
|
|
11
|
-
export declare const fetchKaminoObligations: (connection: Connection, owner: PublicKey, market?: PublicKey) => Promise<PublicKey[]>;
|
|
12
10
|
export declare const fetchMeteoraPositions: (connection: Connection, owner: PublicKey) => Promise<PublicKey[]>;
|
|
13
11
|
export declare const parseMeteoraPosition: (connection: Connection, position: PublicKey) => Promise<{
|
|
14
12
|
lbPair: PublicKey;
|
|
@@ -18,5 +16,9 @@ export declare const parseMeteoraPosition: (connection: Connection, position: Pu
|
|
|
18
16
|
binArrayUpper: PublicKey;
|
|
19
17
|
}>;
|
|
20
18
|
export declare function fetchLookupTables(connection: Connection, authority: PublicKey, firstEntry: PublicKey): Promise<AddressLookupTableAccount[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Parses program logs to extract error message
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseProgramLogs(logs?: null | string[]): string;
|
|
21
23
|
export declare const getSimulationComputeUnits: (connection: Connection, instructions: Array<TransactionInstruction>, payer: PublicKey, lookupTables?: Array<AddressLookupTableAccount>) => Promise<number | undefined>;
|
|
22
24
|
export declare const setsAreEqual: (a: Set<any>, b: Set<any>) => boolean;
|