@glamsystems/glam-sdk 1.0.2 → 1.0.3-alpha.0
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 +3548 -2715
- package/index.esm.js +3543 -2717
- package/package.json +4 -3
- package/src/client/cctp.d.ts +45 -0
- package/src/client/drift.d.ts +5 -4
- package/src/client/jupiter.d.ts +1 -0
- package/src/client/kamino.d.ts +59 -26
- package/src/client/mint.d.ts +1 -1
- package/src/client/price.d.ts +63 -8
- package/src/client/vault.d.ts +1 -18
- package/src/client.d.ts +4 -1
- package/src/constants.d.ts +1 -0
- package/src/deser/base.d.ts +17 -0
- package/src/deser/driftLayouts.d.ts +4 -6
- package/src/deser/index.d.ts +3 -0
- package/src/deser/kaminoLayouts.d.ts +205 -3
- package/src/index.d.ts +1 -0
- package/src/models/mint.d.ts +6 -0
- package/src/models/types.d.ts +0 -16
- package/src/utils/common.d.ts +2 -0
- package/src/utils/fraction.d.ts +29 -0
- package/src/utils/index.d.ts +3 -0
- package/src/utils/pkmap.d.ts +82 -0
- package/src/utils/pkset.d.ts +73 -0
- package/target/idl/ext_kamino.json +226 -0
- package/target/idl/glam_config.json +10 -0
- package/target/idl/glam_mint.json +297 -152
- package/target/idl/glam_protocol.json +14 -561
- package/target/types/ext_kamino.d.ts +226 -0
- package/target/types/ext_kamino.ts +226 -0
- package/target/types/glam_config.d.ts +10 -0
- package/target/types/glam_config.ts +10 -0
- package/target/types/glam_mint.d.ts +293 -148
- package/target/types/glam_mint.ts +297 -152
- package/target/types/glam_protocol.d.ts +14 -561
- package/target/types/glam_protocol.ts +14 -561
- package/src/client/validator.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glamsystems/glam-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3-alpha.0",
|
|
4
4
|
"description": "TypeScript SDK for the GLAM Protocol",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -20,15 +20,16 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@coral-xyz/anchor": "^0.31.1",
|
|
22
22
|
"@coral-xyz/borsh": "^0.31.1",
|
|
23
|
+
"@glamsystems/sanctum-lst-list": "^0.2.54",
|
|
23
24
|
"@marinade.finance/marinade-ts-sdk": "^5.0.15",
|
|
24
25
|
"@meteora-ag/dlmm": "^1.4.11",
|
|
25
26
|
"@solana/spl-stake-pool": "^1.1.5",
|
|
26
27
|
"@solana/spl-token": "^0.4.9",
|
|
27
28
|
"@solana/spl-token-metadata": "^0.1.4",
|
|
28
29
|
"@solana/web3.js": "^1.98.0",
|
|
29
|
-
"@glamsystems/sanctum-lst-list": "^0.2.54",
|
|
30
30
|
"bs58": "^5.0.0",
|
|
31
|
-
"buffer": "^6.0.3"
|
|
31
|
+
"buffer": "^6.0.3",
|
|
32
|
+
"decimal.js": "^10.6.0"
|
|
32
33
|
},
|
|
33
34
|
"engines": {
|
|
34
35
|
"node": ">=20.18.0"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, VersionedTransaction, TransactionSignature, Keypair } from "@solana/web3.js";
|
|
3
|
+
import { BaseClient, TxOptions } from "./base";
|
|
4
|
+
export declare class CctpClient {
|
|
5
|
+
readonly base: BaseClient;
|
|
6
|
+
constructor(base: BaseClient);
|
|
7
|
+
/**
|
|
8
|
+
* Bridge USDC to another chain using Circle's CCTP protocol
|
|
9
|
+
*
|
|
10
|
+
* @param amount Amount of USDC to bridge (in smallest units)
|
|
11
|
+
* @param domain Destination domain (e.g., 0 for Ethereum, 1 for Avalanche)
|
|
12
|
+
* @param recipient Recipient address on destination chain
|
|
13
|
+
* @param params Additional parameters (maxFee, minFinalityThreshold)
|
|
14
|
+
* @param txOptions Transaction options
|
|
15
|
+
*/
|
|
16
|
+
bridgeUsdc(amount: BN | number, domain: number, recipient: PublicKey, params: {
|
|
17
|
+
maxFee: BN;
|
|
18
|
+
minFinalityThreshold: number;
|
|
19
|
+
}, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
20
|
+
/**
|
|
21
|
+
* Create transaction for bridging USDC to another chain
|
|
22
|
+
*
|
|
23
|
+
* @param amount Amount of USDC to bridge (in smallest units)
|
|
24
|
+
* @param domain Destination domain
|
|
25
|
+
* @param recipient Recipient address on destination chain
|
|
26
|
+
* @param params Additional parameters
|
|
27
|
+
* @param txOptions Transaction options
|
|
28
|
+
* @returns Tuple of [transaction, message event keypair]
|
|
29
|
+
*/
|
|
30
|
+
bridgeUsdcTx(amount: BN, domain: number, recipient: PublicKey, params: {
|
|
31
|
+
maxFee: BN;
|
|
32
|
+
minFinalityThreshold: number;
|
|
33
|
+
}, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
|
|
34
|
+
/**
|
|
35
|
+
* Get all PDAs required for CCTP deposit for burn operation
|
|
36
|
+
*
|
|
37
|
+
* @param messageTransmitterProgram Message transmitter program ID
|
|
38
|
+
* @param tokenMessengerMinterProgram Token messenger minter program ID
|
|
39
|
+
* @param usdcAddress USDC mint address
|
|
40
|
+
* @param destinationDomain Destination domain
|
|
41
|
+
* @returns Object containing all required PDAs
|
|
42
|
+
*/
|
|
43
|
+
private getDepositForBurnPdas;
|
|
44
|
+
findV2Messages(sender: PublicKey): Promise<PublicKey[]>;
|
|
45
|
+
}
|
package/src/client/drift.d.ts
CHANGED
|
@@ -81,12 +81,13 @@ export declare class DriftClient {
|
|
|
81
81
|
user: PublicKey;
|
|
82
82
|
userStats: PublicKey;
|
|
83
83
|
};
|
|
84
|
-
parsePerpMarket(data: Buffer): PerpMarket;
|
|
85
|
-
parseSpotMarket(data: Buffer): SpotMarket;
|
|
86
|
-
calcSpotBalance(
|
|
84
|
+
parsePerpMarket(address: PublicKey, data: Buffer): PerpMarket;
|
|
85
|
+
parseSpotMarket(address: PublicKey, data: Buffer): SpotMarket;
|
|
86
|
+
calcSpotBalance(scaledBalance: BN, scaledBalanceType: SpotBalanceType, decimals: number, cumulativeDepositInterest: BN, cumulativeBorrowInterest: BN): {
|
|
87
87
|
amount: number;
|
|
88
88
|
uiAmount: number;
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
|
+
calcSpotBalanceBn(scaledBalance: BN, decimals: number, interest: BN): BN;
|
|
90
91
|
getDriftUserPdas(subAccountId?: number): {
|
|
91
92
|
user: PublicKey;
|
|
92
93
|
userStats: PublicKey;
|
package/src/client/jupiter.d.ts
CHANGED
package/src/client/kamino.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstr
|
|
|
3
3
|
import { BaseClient, TxOptions } from "./base";
|
|
4
4
|
import { KVaultAllocation, KVaultState } from "../deser/kaminoLayouts";
|
|
5
5
|
import { VaultClient } from "./vault";
|
|
6
|
+
import Decimal from "decimal.js";
|
|
7
|
+
import { BigFractionBytes } from "../utils";
|
|
6
8
|
interface RefreshObligationAccounts {
|
|
7
9
|
lendingMarket: PublicKey;
|
|
8
10
|
obligation: PublicKey;
|
|
@@ -33,27 +35,55 @@ interface RefreshObligationFarmsForReserveAccounts {
|
|
|
33
35
|
rent: PublicKey;
|
|
34
36
|
systemProgram: PublicKey;
|
|
35
37
|
}
|
|
36
|
-
interface ParsedReserve {
|
|
38
|
+
export interface ParsedReserve {
|
|
37
39
|
address: PublicKey;
|
|
38
40
|
market: PublicKey;
|
|
39
41
|
farmCollateral: PublicKey | null;
|
|
40
42
|
farmDebt: PublicKey | null;
|
|
41
43
|
liquidityMint: PublicKey;
|
|
44
|
+
liquidityMintDecimals: number;
|
|
42
45
|
liquiditySupplyVault: PublicKey;
|
|
43
46
|
collateralMint: PublicKey;
|
|
44
47
|
collateralSupplyVault: PublicKey;
|
|
48
|
+
scopePriceFeed: PublicKey;
|
|
45
49
|
feeVault: PublicKey;
|
|
50
|
+
collateralExchangeRate: Decimal;
|
|
51
|
+
cumulativeBorrowRate: Decimal;
|
|
46
52
|
}
|
|
47
|
-
interface ParsedObligation {
|
|
53
|
+
export interface ParsedObligation {
|
|
48
54
|
address: PublicKey;
|
|
49
|
-
lendingMarket: PublicKey
|
|
55
|
+
lendingMarket: PublicKey;
|
|
50
56
|
deposits: {
|
|
51
57
|
reserve: PublicKey;
|
|
58
|
+
depositedAmount: BN;
|
|
59
|
+
marketValueSf: BN;
|
|
52
60
|
}[];
|
|
53
61
|
borrows: {
|
|
54
62
|
reserve: PublicKey;
|
|
63
|
+
borrowedAmountSf: BN;
|
|
64
|
+
marketValueSf: BN;
|
|
65
|
+
cumulativeBorrowRateBsf: BigFractionBytes;
|
|
66
|
+
}[];
|
|
67
|
+
}
|
|
68
|
+
interface ParsedFarmState {
|
|
69
|
+
globalConfig: PublicKey;
|
|
70
|
+
farmTokenMint: PublicKey;
|
|
71
|
+
farmTokenDecimals: BN;
|
|
72
|
+
farmTokenProgram: PublicKey;
|
|
73
|
+
farmVault: PublicKey;
|
|
74
|
+
rewards: {
|
|
75
|
+
index: number;
|
|
76
|
+
mint: PublicKey;
|
|
77
|
+
minClaimDurationSeconds: BN;
|
|
78
|
+
tokenProgram: PublicKey;
|
|
79
|
+
rewardsVault: PublicKey;
|
|
55
80
|
}[];
|
|
56
81
|
}
|
|
82
|
+
interface ParsedFarmUser {
|
|
83
|
+
pubkey: PublicKey;
|
|
84
|
+
farmState: PublicKey;
|
|
85
|
+
unclaimedRewards: BN[];
|
|
86
|
+
}
|
|
57
87
|
export declare class KaminoLendingClient {
|
|
58
88
|
readonly base: BaseClient;
|
|
59
89
|
readonly vault: VaultClient;
|
|
@@ -114,12 +144,14 @@ export declare class KaminoLendingClient {
|
|
|
114
144
|
tag: number;
|
|
115
145
|
id: number;
|
|
116
146
|
}): PublicKey;
|
|
117
|
-
|
|
147
|
+
getFarmUserState(farmUser: PublicKey, farm: PublicKey): PublicKey;
|
|
118
148
|
refreshObligationIx(accounts: RefreshObligationAccounts, programId?: PublicKey): TransactionInstruction;
|
|
119
149
|
refreshReserveIx(accounts: RefreshReserveAccounts, programId?: PublicKey): TransactionInstruction;
|
|
120
150
|
refreshObligationFarmsForReserveIx(args: RefreshObligationFarmsForReserveArgs, accounts: RefreshObligationFarmsForReserveAccounts, programId?: PublicKey): TransactionInstruction;
|
|
121
151
|
refreshReservesBatchIx(reserves: PublicKey[], lendingMarkets: PublicKey[], skipPriceUpdates: boolean, programId?: PublicKey): TransactionInstruction;
|
|
152
|
+
refreshReservesBatchIxV2(reserves: ParsedReserve[], skipPriceUpdates: boolean, programId?: PublicKey): TransactionInstruction;
|
|
122
153
|
refreshReserveIxs(lendingMarket: PublicKey, reserves: PublicKey[]): TransactionInstruction[];
|
|
154
|
+
refreshReserveIxsV2(lendingMarket: PublicKey, reserves: ParsedReserve[]): TransactionInstruction[];
|
|
123
155
|
refreshObligationCollateralFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
|
|
124
156
|
refreshObligationDebtFarmsForReservesIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
|
|
125
157
|
getMarketAuthority(market: PublicKey): PublicKey;
|
|
@@ -134,9 +166,15 @@ export declare class KaminoLendingClient {
|
|
|
134
166
|
* Fetches and parses an obligation account
|
|
135
167
|
*/
|
|
136
168
|
fetchAndParseObligation(obligation: PublicKey): Promise<ParsedObligation>;
|
|
137
|
-
|
|
138
|
-
parseReserveAccount(reserve: PublicKey, data: Buffer): ParsedReserve;
|
|
169
|
+
parseReserveAccount(pubkey: PublicKey, data: Buffer): ParsedReserve;
|
|
139
170
|
fetchAndParseReserves(reserves: PublicKey[]): Promise<ParsedReserve[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Finds and parses a reserve account for a given market and asset
|
|
173
|
+
*
|
|
174
|
+
* @param market The lending market public key
|
|
175
|
+
* @param asset The asset public key
|
|
176
|
+
* @returns The parsed reserve account
|
|
177
|
+
*/
|
|
140
178
|
findAndParseReserve(market: PublicKey, asset: PublicKey): Promise<ParsedReserve>;
|
|
141
179
|
/**
|
|
142
180
|
* Finds and parses Kamino obligations for a given owner and market (optional)
|
|
@@ -150,28 +188,15 @@ export declare class KaminoLendingClient {
|
|
|
150
188
|
}
|
|
151
189
|
export declare class KaminoFarmClient {
|
|
152
190
|
readonly base: BaseClient;
|
|
153
|
-
|
|
191
|
+
readonly kaminoLending: KaminoLendingClient;
|
|
192
|
+
constructor(base: BaseClient, kaminoLending: KaminoLendingClient);
|
|
154
193
|
/**
|
|
155
194
|
* Finds and parses farm states for the given owner
|
|
156
|
-
* @param owner
|
|
157
|
-
* @returns
|
|
158
195
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}[]>;
|
|
164
|
-
parseFarm(data: Buffer): Promise<{
|
|
165
|
-
globalConfig: PublicKey;
|
|
166
|
-
rewards: {
|
|
167
|
-
index: number;
|
|
168
|
-
mint: PublicKey;
|
|
169
|
-
minClaimDurationSeconds: any;
|
|
170
|
-
tokenProgram: PublicKey;
|
|
171
|
-
rewardsVault: PublicKey;
|
|
172
|
-
}[];
|
|
173
|
-
}>;
|
|
174
|
-
fetchAndParseFarms(farms: PublicKey[]): Promise<Map<any, any>>;
|
|
196
|
+
findAndParseFarmUserStates(owner: PublicKey): Promise<ParsedFarmUser[]>;
|
|
197
|
+
parseFarmState(data: Buffer): Promise<ParsedFarmState>;
|
|
198
|
+
fetchAndParseFarmStates(farms: PublicKey[]): Promise<Map<string, ParsedFarmState>>;
|
|
199
|
+
farmVaultTokenAccount: (farm: PublicKey, mint: PublicKey) => PublicKey;
|
|
175
200
|
farmVaultsAuthority: (farm: PublicKey) => PublicKey;
|
|
176
201
|
rewardsTreasuryVault: (globalConfig: PublicKey, mint: PublicKey) => PublicKey;
|
|
177
202
|
/**
|
|
@@ -180,7 +205,15 @@ export declare class KaminoFarmClient {
|
|
|
180
205
|
* @param vaultFarmStates GLAM vault's farm states to harvest rewards from
|
|
181
206
|
*/
|
|
182
207
|
harvest(vaultFarmStates: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
183
|
-
|
|
208
|
+
stake(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
209
|
+
unstake(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
210
|
+
/**
|
|
211
|
+
* farmState.isFarmDelegated = 0
|
|
212
|
+
* farmState.token.mint !== PublicKey.default
|
|
213
|
+
*/
|
|
214
|
+
stakeTx(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
215
|
+
unstakeTx(amount: BN, farmState: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
216
|
+
harvestTx(farmUesrStates: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
184
217
|
}
|
|
185
218
|
export declare class KaminoVaultsClient {
|
|
186
219
|
readonly base: BaseClient;
|
package/src/client/mint.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ declare class MintTxBuilder extends BaseTxBuilder {
|
|
|
69
69
|
forceTransfer(from: PublicKey, to: PublicKey, amount: BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
70
70
|
}
|
|
71
71
|
declare class TxBuilder extends BaseTxBuilder {
|
|
72
|
-
initialize(initMintParams: InitMintParams, stateParams
|
|
72
|
+
initialize(initMintParams: InitMintParams, stateParams: UpdateStateParams | null, txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
|
|
73
73
|
update(mintModel: Partial<MintIdlModel>, txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
|
|
74
74
|
pauseSubscription(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
|
|
75
75
|
unpauseSubscription(txOptions?: TxOptions): Promise<anchor.web3.VersionedTransaction>;
|
package/src/client/price.d.ts
CHANGED
|
@@ -1,23 +1,66 @@
|
|
|
1
|
-
import { AccountMeta, PublicKey, TransactionInstruction
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AccountMeta, Commitment, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
import { BN } from "@coral-xyz/anchor";
|
|
3
|
+
import { KaminoLendingClient, KaminoVaultsClient, ParsedReserve } from "./kamino";
|
|
4
|
+
import { BaseClient } from "./base";
|
|
4
5
|
import { StateModel } from "../models";
|
|
5
|
-
import { DriftClient, DriftVaultsClient } from "./drift";
|
|
6
|
+
import { DriftClient, DriftVaultsClient, SpotMarket } from "./drift";
|
|
7
|
+
import { PkMap, PkSet } from "../utils";
|
|
8
|
+
import { CctpClient } from "./cctp";
|
|
9
|
+
import { TokenListItem } from "./jupiter";
|
|
10
|
+
export declare abstract class Holding {
|
|
11
|
+
mintAddress: PublicKey;
|
|
12
|
+
decimals: number;
|
|
13
|
+
amount: BN;
|
|
14
|
+
uiAmount: number;
|
|
15
|
+
price: number;
|
|
16
|
+
protocol: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class KaminoLendHolding extends Holding {
|
|
19
|
+
obligation: PublicKey;
|
|
20
|
+
market: PublicKey;
|
|
21
|
+
reserve: PublicKey;
|
|
22
|
+
direction: "deposit" | "borrow";
|
|
23
|
+
}
|
|
24
|
+
export declare class DriftSpotHolding extends Holding {
|
|
25
|
+
user: PublicKey;
|
|
26
|
+
marketIndex: number;
|
|
27
|
+
direction: "deposit" | "borrow";
|
|
28
|
+
}
|
|
29
|
+
export declare class OutgoingBridgeHolding extends Holding {
|
|
30
|
+
destinationDomain: number;
|
|
31
|
+
destinationAddress: PublicKey;
|
|
32
|
+
status: string;
|
|
33
|
+
delayReason: string | null;
|
|
34
|
+
attestation: string;
|
|
35
|
+
}
|
|
36
|
+
export declare class TokenHolding extends Holding {
|
|
37
|
+
tokenAccount: PublicKey;
|
|
38
|
+
}
|
|
39
|
+
export declare class VaultHoldings {
|
|
40
|
+
readonly vaultState: PublicKey;
|
|
41
|
+
readonly slot: BN;
|
|
42
|
+
holdings: Holding[];
|
|
43
|
+
constructor(vaultState: PublicKey, slot: BN);
|
|
44
|
+
add(holding: Holding): void;
|
|
45
|
+
}
|
|
6
46
|
export declare class PriceClient {
|
|
7
47
|
readonly base: BaseClient;
|
|
8
48
|
readonly klend: KaminoLendingClient;
|
|
9
49
|
readonly kvaults: KaminoVaultsClient;
|
|
10
50
|
readonly drift: DriftClient;
|
|
11
51
|
readonly dvaults: DriftVaultsClient;
|
|
52
|
+
readonly cctp: CctpClient;
|
|
12
53
|
private _stateModel;
|
|
13
54
|
private _lookupTables;
|
|
14
55
|
private _kaminoVaults;
|
|
15
|
-
constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, drift: DriftClient, dvaults: DriftVaultsClient);
|
|
56
|
+
constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, drift: DriftClient, dvaults: DriftVaultsClient, cctp: CctpClient);
|
|
16
57
|
get cachedStateModel(): StateModel | null;
|
|
17
58
|
set cachedStateModel(stateModel: StateModel);
|
|
18
59
|
get lookupTables(): PublicKey[];
|
|
19
60
|
get kaminoVaults(): PublicKey[];
|
|
20
61
|
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
*
|
|
21
64
|
* Calculates the Assets Under Management (AUM) based on cached pricing data.
|
|
22
65
|
*
|
|
23
66
|
* @warning This is a convenience method for testing purposes only and should NOT be used in production.
|
|
@@ -31,14 +74,25 @@ export declare class PriceClient {
|
|
|
31
74
|
*/
|
|
32
75
|
getAum(): Promise<BN>;
|
|
33
76
|
/**
|
|
34
|
-
*
|
|
77
|
+
* Fetches all holdings in the vault.
|
|
78
|
+
*
|
|
79
|
+
* @param commitment Commitment level for fetching accounts
|
|
80
|
+
* @param priceBaseAssetMint Price denominator asset mint (USDC, SOL, JLP etc.)
|
|
81
|
+
* @returns VaultHoldings object containing all holdings
|
|
35
82
|
*/
|
|
36
|
-
|
|
83
|
+
getVaultHoldings(commitment: Commitment, priceBaseAssetMint?: PublicKey): Promise<VaultHoldings>;
|
|
84
|
+
getPubkeysForTokenHoldings(commitment?: Commitment): Promise<PublicKey[]>;
|
|
85
|
+
getPubkeysForSpotHoldings(commitment?: Commitment): Promise<PkMap<PkSet>>;
|
|
86
|
+
getPubkeysForKaminoHoldings(commitment?: Commitment): Promise<PkMap<PkSet>>;
|
|
87
|
+
getTokenHoldings(tokenAccountPubkeys: PublicKey[], accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>): TokenHolding[];
|
|
88
|
+
getDriftSpotHoldings(userPubkeys: Iterable<PublicKey>, spotMarketsMap: PkMap<SpotMarket>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>): DriftSpotHolding[];
|
|
89
|
+
getKaminoLendHoldings(obligationPubkeys: Iterable<PublicKey>, reservesMap: PkMap<ParsedReserve>, accountsDataMap: PkMap<Buffer>, tokenPricesMap: PkMap<TokenListItem>): KaminoLendHolding[];
|
|
90
|
+
getOutgoingBridgeHoldings(messagePubkeys: PublicKey[], tokenPricesMap: PkMap<TokenListItem>): Promise<OutgoingBridgeHolding[]>;
|
|
37
91
|
/**
|
|
38
92
|
* Returns an instruction that prices Kamino obligations.
|
|
39
93
|
* If there are no Kamino obligations, returns null.
|
|
40
94
|
*/
|
|
41
|
-
|
|
95
|
+
priceKaminoObligationsIxs(): Promise<TransactionInstruction[]>;
|
|
42
96
|
priceKaminoVaultSharesIx(): Promise<TransactionInstruction[] | null>;
|
|
43
97
|
/**
|
|
44
98
|
* Returns an instruction that prices all Drift users (aka sub-accounts) controlled by the GLAM vault.
|
|
@@ -62,6 +116,7 @@ export declare class PriceClient {
|
|
|
62
116
|
* If there are no Meteora positions, returns null.
|
|
63
117
|
*/
|
|
64
118
|
priceVaultIxs(): Promise<TransactionInstruction[]>;
|
|
119
|
+
validateAumIx(): Promise<TransactionInstruction>;
|
|
65
120
|
getbaseAssetOracle(): Promise<PublicKey>;
|
|
66
121
|
remainingAccountsForPricingDriftVaultDepositors(parsedVaultDepositors: {
|
|
67
122
|
address: PublicKey;
|
package/src/client/vault.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BN } from "@coral-xyz/anchor";
|
|
2
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction
|
|
2
|
+
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
3
|
import { BaseClient, TxOptions } from "./base";
|
|
4
4
|
export declare class VaultClient {
|
|
5
5
|
readonly base: BaseClient;
|
|
@@ -17,10 +17,6 @@ export declare class VaultClient {
|
|
|
17
17
|
* @param txOptions
|
|
18
18
|
*/
|
|
19
19
|
unwrap(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
20
|
-
bridgeUsdc(amount: BN | number, domain: number, recipient: PublicKey, params: {
|
|
21
|
-
maxFee: BN;
|
|
22
|
-
minFinalityThreshold: number;
|
|
23
|
-
}, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
24
20
|
/**
|
|
25
21
|
* Transfers SOL from vault to another account
|
|
26
22
|
*
|
|
@@ -77,19 +73,6 @@ export declare class VaultClient {
|
|
|
77
73
|
closeTokenAccountsTx(pubkeys: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
78
74
|
depositSolTx(lamports: number | BN, wrap?: boolean, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
79
75
|
depositTx(asset: PublicKey, amount: number | BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
80
|
-
getDepositForBurnPdas: (messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, usdcAddress: PublicKey, destinationDomain: Number) => {
|
|
81
|
-
messageTransmitterAccount: PublicKey;
|
|
82
|
-
tokenMessengerAccount: PublicKey;
|
|
83
|
-
tokenMinterAccount: PublicKey;
|
|
84
|
-
localToken: PublicKey;
|
|
85
|
-
remoteTokenMessengerKey: PublicKey;
|
|
86
|
-
authorityPda: PublicKey;
|
|
87
|
-
tokenMessengerEventAuthority: PublicKey;
|
|
88
|
-
};
|
|
89
76
|
tokenTransferIxs(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions?: TxOptions): Promise<TransactionInstruction[]>;
|
|
90
77
|
tokenTransferTx(mint: PublicKey, amount: number | BN, to: PublicKey, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
91
|
-
bridgeUsdcTx(amount: BN, domain: number, recipient: PublicKey, params: {
|
|
92
|
-
maxFee: BN;
|
|
93
|
-
minFinalityThreshold: number;
|
|
94
|
-
}, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
|
|
95
78
|
}
|
package/src/client.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { DriftClient, DriftVaultsClient } from "./client/drift";
|
|
|
4
4
|
import { JupiterSwapClient } from "./client/jupiter";
|
|
5
5
|
import { MarinadeClient } from "./client/marinade";
|
|
6
6
|
import { VaultClient } from "./client/vault";
|
|
7
|
-
import { StakingClient } from "./client/staking";
|
|
8
7
|
import { StateClient } from "./client/state";
|
|
9
8
|
import { KaminoLendingClient, KaminoFarmClient, KaminoVaultsClient } from "./client/kamino";
|
|
10
9
|
import { InvestClient } from "./client/invest";
|
|
@@ -13,6 +12,8 @@ import { FeesClient } from "./client/fees";
|
|
|
13
12
|
import { MintClient } from "./client/mint";
|
|
14
13
|
import { AccessClient } from "./client/access";
|
|
15
14
|
import { TimelockClient } from "./client/timelock";
|
|
15
|
+
import { StakingClient } from "./client/staking";
|
|
16
|
+
import { CctpClient } from "./client/cctp";
|
|
16
17
|
/**
|
|
17
18
|
* Main entrypoint for the GLAM SDK
|
|
18
19
|
*
|
|
@@ -35,6 +36,7 @@ export declare class GlamClient extends BaseClient {
|
|
|
35
36
|
private _kaminoVaults?;
|
|
36
37
|
private _fees?;
|
|
37
38
|
private _timelock?;
|
|
39
|
+
private _cctp?;
|
|
38
40
|
constructor(config?: GlamClientConfig);
|
|
39
41
|
get drift(): DriftClient;
|
|
40
42
|
get driftVaults(): DriftVaultsClient;
|
|
@@ -52,4 +54,5 @@ export declare class GlamClient extends BaseClient {
|
|
|
52
54
|
get kaminoFarm(): KaminoFarmClient;
|
|
53
55
|
get kaminoVaults(): KaminoVaultsClient;
|
|
54
56
|
get timelock(): TimelockClient;
|
|
57
|
+
get cctp(): CctpClient;
|
|
55
58
|
}
|
package/src/constants.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const SEED_INTEGRATION_AUTHORITY = "integration-authority";
|
|
|
12
12
|
export declare const STAKE_ACCOUNT_SIZE = 200;
|
|
13
13
|
export declare const METEORA_POSITION_SIZE = 8120;
|
|
14
14
|
export declare const KAMINO_OBTRIGATION_SIZE = 3344;
|
|
15
|
+
export declare const KAMINO_RESERVE_SIZE = 8624;
|
|
15
16
|
export declare const DRIFT_VAULT_DEPOSITOR_SIZE = 272;
|
|
16
17
|
export declare const JUPITER_API_DEFAULT = "https://lite-api.jup.ag";
|
|
17
18
|
export declare const JITO_TIP_DEFAULT: PublicKey;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { struct } from "@coral-xyz/borsh";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
/**
|
|
4
|
+
* Base class for decodable on-chain account structures.
|
|
5
|
+
*
|
|
6
|
+
* This class provides a generic decode method that can be inherited by all
|
|
7
|
+
* account deserializer classes, eliminating the need to implement the same
|
|
8
|
+
* decode logic in each class.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class Decodable {
|
|
11
|
+
readonly _address: PublicKey;
|
|
12
|
+
static _layout: ReturnType<typeof struct>;
|
|
13
|
+
static decode<T extends Decodable>(this: {
|
|
14
|
+
new (): T;
|
|
15
|
+
_layout: ReturnType<typeof struct>;
|
|
16
|
+
}, address: PublicKey, buffer: Buffer): T;
|
|
17
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BN } from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
|
-
|
|
3
|
+
import { Decodable } from "./base";
|
|
4
|
+
export declare class DriftVault extends Decodable {
|
|
4
5
|
discriminator: number[];
|
|
5
6
|
name: number[];
|
|
6
7
|
pubkey: PublicKey;
|
|
@@ -48,10 +49,9 @@ export declare class DriftVault {
|
|
|
48
49
|
cumulativeFuel: BN;
|
|
49
50
|
padding: BN[];
|
|
50
51
|
static _layout: any;
|
|
51
|
-
static decode(buffer: Buffer): DriftVault;
|
|
52
52
|
get nameStr(): string;
|
|
53
53
|
}
|
|
54
|
-
export declare class DriftSpotMarket {
|
|
54
|
+
export declare class DriftSpotMarket extends Decodable {
|
|
55
55
|
discriminator: number[];
|
|
56
56
|
marketPda: PublicKey;
|
|
57
57
|
oracle: PublicKey;
|
|
@@ -71,10 +71,9 @@ export declare class DriftSpotMarket {
|
|
|
71
71
|
poolId: number;
|
|
72
72
|
padding5: number[];
|
|
73
73
|
static _layout: any;
|
|
74
|
-
static decode(buffer: Buffer): DriftSpotMarket;
|
|
75
74
|
get nameStr(): string;
|
|
76
75
|
}
|
|
77
|
-
export declare class DriftPerpMarket {
|
|
76
|
+
export declare class DriftPerpMarket extends Decodable {
|
|
78
77
|
discriminator: number[];
|
|
79
78
|
marketPda: PublicKey;
|
|
80
79
|
oracle: PublicKey;
|
|
@@ -85,6 +84,5 @@ export declare class DriftPerpMarket {
|
|
|
85
84
|
padding3: number[];
|
|
86
85
|
marketIndex: number;
|
|
87
86
|
static _layout: any;
|
|
88
|
-
static decode(buffer: Buffer): DriftPerpMarket;
|
|
89
87
|
get nameStr(): string;
|
|
90
88
|
}
|