@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.
- package/index.cjs.js +1716 -1146
- package/index.esm.js +1709 -1149
- package/package.json +1 -1
- package/src/client/base.d.ts +39 -22
- package/src/client/drift.d.ts +36 -35
- package/src/client/investor.d.ts +10 -10
- package/src/client/jupiter.d.ts +13 -14
- package/src/client/kamino.d.ts +12 -17
- package/src/client/marinade.d.ts +10 -10
- package/src/client/meteora.d.ts +6 -6
- package/src/client/mint.d.ts +13 -21
- package/src/client/price.d.ts +8 -6
- package/src/client/staking.d.ts +20 -21
- package/src/client/state.d.ts +20 -18
- package/src/client/wsol.d.ts +5 -5
- package/src/clientConfig.d.ts +2 -0
- package/src/constants.d.ts +1 -0
- package/src/index.d.ts +1 -0
- package/src/models.d.ts +29 -6
- package/src/utils/glamPDAs.d.ts +18 -0
- package/src/utils/helpers.d.ts +1 -0
- package/target/idl/glam_protocol.json +870 -416
- package/target/types/glam_protocol.d.ts +859 -405
- package/target/types/glam_protocol.ts +869 -415
package/package.json
CHANGED
package/src/client/base.d.ts
CHANGED
|
@@ -37,8 +37,11 @@ export declare class BaseClient {
|
|
|
37
37
|
program: GlamProgram;
|
|
38
38
|
jupiterApi: string;
|
|
39
39
|
blockhashWithCache: BlockhashWithCache;
|
|
40
|
+
private _statePda?;
|
|
40
41
|
constructor(config?: GlamClientConfig);
|
|
41
42
|
get detectedCluster(): ClusterNetwork;
|
|
43
|
+
get statePda(): PublicKey;
|
|
44
|
+
set statePda(statePda: PublicKey);
|
|
42
45
|
isMainnet(): boolean;
|
|
43
46
|
isPhantom(): boolean;
|
|
44
47
|
/**
|
|
@@ -55,52 +58,66 @@ export declare class BaseClient {
|
|
|
55
58
|
getAdressLookupTableAccounts(keys?: string[] | PublicKey[]): Promise<AddressLookupTableAccount[]>;
|
|
56
59
|
getWallet(): Wallet;
|
|
57
60
|
getSigner(): PublicKey;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
get signer(): PublicKey;
|
|
62
|
+
get wallet(): Wallet;
|
|
63
|
+
get vaultPda(): PublicKey;
|
|
64
|
+
get escrowPda(): PublicKey;
|
|
65
|
+
get mintPda(): PublicKey;
|
|
66
|
+
get extraMetasPda(): PublicKey;
|
|
67
|
+
get openfundsPda(): PublicKey;
|
|
63
68
|
/**
|
|
64
|
-
* Fetch all the token accounts (including token program and token 2022 program) owned by
|
|
69
|
+
* Fetch all the token accounts (including token program and token 2022 program) owned by the specified account.
|
|
65
70
|
*
|
|
66
71
|
* @param owner
|
|
67
72
|
* @returns
|
|
68
73
|
*/
|
|
69
74
|
getTokenAccountsByOwner(owner: PublicKey): Promise<TokenAccount[]>;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
getSolAndTokenBalances(owner: PublicKey): Promise<{
|
|
76
|
+
balanceLamports: number;
|
|
77
|
+
uiAmount: number;
|
|
78
|
+
tokenAccounts: TokenAccount[];
|
|
79
|
+
}>;
|
|
80
|
+
getAta(mint: PublicKey, owner: PublicKey, tokenProgram?: anchor.web3.PublicKey): PublicKey;
|
|
81
|
+
getVaultAta(mint: PublicKey, tokenProgramId?: PublicKey): PublicKey;
|
|
82
|
+
getVaultBalance(): Promise<number>;
|
|
83
|
+
getVaultLamports(): Promise<number>;
|
|
84
|
+
getVaultTokenBalance(mintPubkey: PublicKey): Promise<{
|
|
85
|
+
amount: BN;
|
|
86
|
+
uiAmount: number;
|
|
87
|
+
}>;
|
|
88
|
+
fetchMintAndTokenProgram(mintPubkey: PublicKey): Promise<{
|
|
73
89
|
mint: Mint;
|
|
74
90
|
tokenProgram: anchor.web3.PublicKey;
|
|
75
91
|
}>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
getAccountPolicyPda(glamState: PublicKey, subject: PublicKey, mintIdx?: number): PublicKey;
|
|
92
|
+
getMintAta(user: PublicKey): PublicKey;
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated
|
|
95
|
+
*/
|
|
81
96
|
getName(stateModel: Partial<StateModel>): string;
|
|
82
|
-
isLockupEnabled(
|
|
83
|
-
fetchStateAccount(statePda
|
|
84
|
-
fetchOpenfundsMetadataAccount(
|
|
85
|
-
fetchMintAccount(state: PublicKey, mintIdx: number): Promise<Mint>;
|
|
97
|
+
isLockupEnabled(): Promise<boolean>;
|
|
98
|
+
fetchStateAccount(statePda?: PublicKey): Promise<StateAccount>;
|
|
99
|
+
fetchOpenfundsMetadataAccount(statePda?: PublicKey): Promise<OpenfundsMetadataAccount>;
|
|
86
100
|
/**
|
|
87
101
|
* Generates instructions to wrap SOL into wSOL if the vault doesn't have enough wSOL
|
|
88
102
|
*
|
|
89
103
|
* @param lamports Desired amount of wSOL
|
|
90
104
|
* @returns Array of instructions, null if no instructions are needed
|
|
91
105
|
*/
|
|
92
|
-
maybeWrapSol(
|
|
106
|
+
maybeWrapSol(lamports: number | BN, signer?: PublicKey): Promise<TransactionInstruction[]>;
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated
|
|
109
|
+
*/
|
|
93
110
|
getAssetIdFromCurrency(currency: string): string;
|
|
94
111
|
listGlamStates(): Promise<PublicKey[]>;
|
|
95
112
|
/**
|
|
96
113
|
* Fetch glam state from onchain accounts and build a StateModel
|
|
97
114
|
*
|
|
98
|
-
* @param statePda
|
|
115
|
+
* @param statePda Optional state PDA, if not specified, use the client's state PDA
|
|
99
116
|
* @returns
|
|
100
117
|
*/
|
|
101
|
-
|
|
118
|
+
fetchStateModel(statePda?: PublicKey): Promise<StateModel>;
|
|
102
119
|
/**
|
|
103
|
-
* Fetch all glam
|
|
120
|
+
* Fetch all glam state models if no filter options provided
|
|
104
121
|
*
|
|
105
122
|
* @param filterOptions
|
|
106
123
|
* @returns
|
package/src/client/drift.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstr
|
|
|
3
3
|
import { MarketType, OrderParams, PositionDirection, SpotPosition, PerpPosition, ModifyOrderParams, OracleSource, SpotBalanceType, MarginMode, Order } from "../utils/driftTypes";
|
|
4
4
|
import { BaseClient, TxOptions } from "./base";
|
|
5
5
|
import { AccountMeta } from "@solana/web3.js";
|
|
6
|
-
import {
|
|
6
|
+
import { StateModel } from "../models";
|
|
7
7
|
import { BN } from "@coral-xyz/anchor";
|
|
8
8
|
interface OrderConstants {
|
|
9
9
|
perpBaseScale: number;
|
|
@@ -57,20 +57,19 @@ export declare class DriftClient {
|
|
|
57
57
|
private perpMarkets;
|
|
58
58
|
private marketConfigs;
|
|
59
59
|
constructor(base: BaseClient);
|
|
60
|
-
initialize(
|
|
61
|
-
updateUserCustomMarginRatio(
|
|
60
|
+
initialize(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
61
|
+
updateUserCustomMarginRatio(maxLeverage: number, // 1=1x, 2=2x ... 50=50x leverage
|
|
62
62
|
subAccountId?: number): Promise<TransactionSignature>;
|
|
63
|
-
updateUserMarginTradingEnabled(
|
|
64
|
-
updateUserDelegate(
|
|
65
|
-
deleteUser(
|
|
66
|
-
deposit(
|
|
67
|
-
withdraw(
|
|
68
|
-
placeOrder(
|
|
69
|
-
modifyOrder(
|
|
70
|
-
cancelOrders(
|
|
71
|
-
cancelOrdersByIds(
|
|
72
|
-
settlePnl(
|
|
73
|
-
priceDrift(statePda: PublicKey | string, priceDenom: PriceDenom, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
63
|
+
updateUserMarginTradingEnabled(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
64
|
+
updateUserDelegate(delegate: PublicKey | string, subAccountId?: number): Promise<TransactionSignature>;
|
|
65
|
+
deleteUser(subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
66
|
+
deposit(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
67
|
+
withdraw(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
68
|
+
placeOrder(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
69
|
+
modifyOrder(modifyOrderParams: ModifyOrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
70
|
+
cancelOrders(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
71
|
+
cancelOrdersByIds(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
72
|
+
settlePnl(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
74
73
|
getMarketPda: (marketType: MarketType, marketIndex: number) => anchor.web3.PublicKey;
|
|
75
74
|
getUserPda: (authority: PublicKey, subAccountId?: number) => anchor.web3.PublicKey;
|
|
76
75
|
getUserStatsPda: (authority: PublicKey) => PublicKey;
|
|
@@ -84,7 +83,7 @@ export declare class DriftClient {
|
|
|
84
83
|
amount: number;
|
|
85
84
|
uiAmount: number;
|
|
86
85
|
}>;
|
|
87
|
-
getDriftUserPdas(
|
|
86
|
+
getDriftUserPdas(subAccountId?: number): {
|
|
88
87
|
user: PublicKey;
|
|
89
88
|
userStats: PublicKey;
|
|
90
89
|
};
|
|
@@ -95,7 +94,10 @@ export declare class DriftClient {
|
|
|
95
94
|
fetchAndParsePerpMarkets(marketIndexes: number[]): Promise<PerpMarket[]>;
|
|
96
95
|
fetchMarketConfigs(): Promise<DriftMarketConfigs>;
|
|
97
96
|
charsToName(chars: number[] | Buffer): string;
|
|
98
|
-
fetchDriftUser(
|
|
97
|
+
fetchDriftUser(subAccountId?: number): Promise<DriftUser | null>;
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated
|
|
100
|
+
*/
|
|
99
101
|
fetchPolicyConfig(glamState: StateModel): Promise<{
|
|
100
102
|
driftAccessControl: number;
|
|
101
103
|
driftDelegatedAccount: anchor.web3.PublicKey;
|
|
@@ -106,26 +108,25 @@ export declare class DriftClient {
|
|
|
106
108
|
driftMarketIndexesSpot: number[];
|
|
107
109
|
}>;
|
|
108
110
|
marketTypeEquals: (a: MarketType | undefined, b: MarketType) => boolean;
|
|
109
|
-
composeRemainingAccounts(
|
|
110
|
-
initializeUserStatsIx(
|
|
111
|
-
initializeUserIx(
|
|
112
|
-
initializeTx(
|
|
113
|
-
updateUserCustomMarginRatioIx(
|
|
111
|
+
composeRemainingAccounts(subAccountId: number, marketType?: MarketType, marketIndex?: number): Promise<AccountMeta[]>;
|
|
112
|
+
initializeUserStatsIx(glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
113
|
+
initializeUserIx(glamSigner: PublicKey, subAccountId: number): Promise<TransactionInstruction>;
|
|
114
|
+
initializeTx(subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
115
|
+
updateUserCustomMarginRatioIx(maxLeverage: number, // 1=1x, 2=2x ... 50=50x leverage
|
|
114
116
|
subAccountId?: number, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
115
|
-
updateUserCustomMarginRatioTx(
|
|
117
|
+
updateUserCustomMarginRatioTx(maxLeverage: number, // 1=1x, 2=2x ... 50=50x leverage
|
|
116
118
|
subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
117
|
-
updateUserMarginTradingEnabledIx(
|
|
118
|
-
updateUserMarginTradingEnabledTx(
|
|
119
|
-
updateUserDelegateIx(
|
|
120
|
-
updateUserDelegateTx(
|
|
121
|
-
deleteUserTx(
|
|
122
|
-
depositTx(
|
|
123
|
-
withdrawTx(
|
|
124
|
-
placeOrderTx(
|
|
125
|
-
modifyOrderTx(
|
|
126
|
-
cancelOrdersTx(
|
|
127
|
-
cancelOrdersByIdsTx(
|
|
128
|
-
settlePnlTx(
|
|
129
|
-
priceDriftTx(glamState: PublicKey, priceDenom: PriceDenom, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
119
|
+
updateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
120
|
+
updateUserMarginTradingEnabledTx(marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
121
|
+
updateUserDelegateIx(delegate: PublicKey | string, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
122
|
+
updateUserDelegateTx(delegate: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
123
|
+
deleteUserTx(subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
124
|
+
depositTx(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
125
|
+
withdrawTx(amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
126
|
+
placeOrderTx(orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
127
|
+
modifyOrderTx(modifyOrderParams: ModifyOrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
128
|
+
cancelOrdersTx(marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
129
|
+
cancelOrdersByIdsTx(orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
130
|
+
settlePnlTx(marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
130
131
|
}
|
|
131
132
|
export {};
|
package/src/client/investor.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ import { BaseClient, TxOptions } from "./base";
|
|
|
4
4
|
export declare class InvestorClient {
|
|
5
5
|
readonly base: BaseClient;
|
|
6
6
|
constructor(base: BaseClient);
|
|
7
|
-
subscribe(
|
|
8
|
-
queuedRedeem(
|
|
9
|
-
fulfill(
|
|
10
|
-
claim(
|
|
11
|
-
subscribeTx(
|
|
12
|
-
queuedSubscribeTx(
|
|
13
|
-
queuedRedeemTx(
|
|
14
|
-
fulfillTx(
|
|
15
|
-
claimAssetTx(
|
|
16
|
-
claimShareTx(
|
|
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>;
|
|
10
|
+
claim(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
11
|
+
subscribeTx(asset: PublicKey, amount: BN, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
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>;
|
|
15
|
+
claimAssetTx(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
16
|
+
claimShareTx(asset: PublicKey, mintId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
17
17
|
}
|
package/src/client/jupiter.d.ts
CHANGED
|
@@ -51,22 +51,22 @@ type SwapInstructions = {
|
|
|
51
51
|
export declare class JupiterSwapClient {
|
|
52
52
|
readonly base: BaseClient;
|
|
53
53
|
constructor(base: BaseClient);
|
|
54
|
-
swap(
|
|
54
|
+
swap(options: {
|
|
55
55
|
quoteParams?: QuoteParams;
|
|
56
56
|
quoteResponse?: QuoteResponse;
|
|
57
57
|
swapInstructions?: SwapInstructions;
|
|
58
58
|
}, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
|
-
setMaxSwapSlippage(
|
|
59
|
+
setMaxSwapSlippage(slippageBps: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
60
60
|
fetchProgramLabels(): Promise<any>;
|
|
61
61
|
fetchTokenPrices(pubkeys: string[]): Promise<any>;
|
|
62
|
-
swapTx(
|
|
62
|
+
swapTx(options: {
|
|
63
63
|
quoteParams?: QuoteParams;
|
|
64
64
|
quoteResponse?: QuoteResponse;
|
|
65
65
|
swapInstructions?: SwapInstructions;
|
|
66
66
|
}, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
67
|
-
setMaxSwapSlippageTx(
|
|
68
|
-
setMaxSwapSlippageIx(
|
|
69
|
-
getPreInstructions: (
|
|
67
|
+
setMaxSwapSlippageTx(slippageBps: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
68
|
+
setMaxSwapSlippageIx(slippageBps: number, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
69
|
+
getPreInstructions: (signer: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, inputTokenProgram?: PublicKey, outputTokenProgram?: PublicKey) => Promise<TransactionInstruction[]>;
|
|
70
70
|
getTokenProgram: (mint: PublicKey) => Promise<PublicKey>;
|
|
71
71
|
toTransactionInstruction: (ixPayload: InstructionFromJupiter, vaultStr: string) => TransactionInstruction;
|
|
72
72
|
getQuoteResponse(quoteParams: QuoteParams): Promise<any>;
|
|
@@ -83,7 +83,7 @@ export declare class JupiterVoteClient {
|
|
|
83
83
|
* @param txOptions
|
|
84
84
|
* @returns
|
|
85
85
|
*/
|
|
86
|
-
stakeJup(
|
|
86
|
+
stakeJup(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
87
87
|
/**
|
|
88
88
|
* Unstake all staked JUP.
|
|
89
89
|
*
|
|
@@ -91,21 +91,20 @@ export declare class JupiterVoteClient {
|
|
|
91
91
|
* @param txOptions
|
|
92
92
|
* @returns
|
|
93
93
|
*/
|
|
94
|
-
unstakeJup(
|
|
95
|
-
withdrawJup(
|
|
96
|
-
claimAndStake(
|
|
97
|
-
cancelUnstake(
|
|
94
|
+
unstakeJup(txOptions?: TxOptions): Promise<string>;
|
|
95
|
+
withdrawJup(txOptions?: TxOptions): Promise<string>;
|
|
96
|
+
claimAndStake(distributor: PublicKey, amountUnlocked: BN, amountLocked: BN, proof: number[][], txOptions?: TxOptions): Promise<string>;
|
|
97
|
+
cancelUnstake(txOptions?: TxOptions): Promise<string>;
|
|
98
98
|
/**
|
|
99
99
|
* Vote on a proposal. The vote account will be created if it doesn't exist.
|
|
100
100
|
*
|
|
101
|
-
* @param statePda
|
|
102
101
|
* @param proposal
|
|
103
102
|
* @param side
|
|
104
103
|
* @param txOptions
|
|
105
104
|
* @returns
|
|
106
105
|
*/
|
|
107
|
-
voteOnProposal(
|
|
108
|
-
fetchVotes(
|
|
106
|
+
voteOnProposal(proposal: PublicKey, side: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
107
|
+
fetchVotes(proposals: PublicKey[] | string[]): Promise<{
|
|
109
108
|
proposal: PublicKey;
|
|
110
109
|
voter: PublicKey;
|
|
111
110
|
side: number;
|
package/src/client/kamino.d.ts
CHANGED
|
@@ -29,64 +29,59 @@ export declare class KaminoLendingClient {
|
|
|
29
29
|
/**
|
|
30
30
|
* Initializes Kamino user metadata
|
|
31
31
|
*
|
|
32
|
-
* @param statePda
|
|
33
32
|
* @param market Lending market
|
|
34
33
|
* @param referrer Referrer user metadata
|
|
35
34
|
* @param txOptions
|
|
36
35
|
* @returns
|
|
37
36
|
*/
|
|
38
|
-
initUserMetadata(
|
|
37
|
+
initUserMetadata(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
39
38
|
/**
|
|
40
39
|
* Deposits asset to the lending market.
|
|
41
40
|
*
|
|
42
|
-
* @param statePda
|
|
43
41
|
* @param market Lending market
|
|
44
42
|
* @param asset Asset mint
|
|
45
43
|
* @param amount Amount to deposit
|
|
46
44
|
* @param txOptions
|
|
47
45
|
* @returns
|
|
48
46
|
*/
|
|
49
|
-
deposit(
|
|
47
|
+
deposit(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
50
48
|
/**
|
|
51
49
|
* Withdraws asset from the lending market.
|
|
52
50
|
*
|
|
53
|
-
* @param statePda
|
|
54
51
|
* @param market Lending market
|
|
55
52
|
* @param asset Asset mint
|
|
56
53
|
* @param amount Amount to deposit
|
|
57
54
|
* @param txOptions
|
|
58
55
|
* @returns
|
|
59
56
|
*/
|
|
60
|
-
withdraw(
|
|
57
|
+
withdraw(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
61
58
|
/**
|
|
62
59
|
* Borrows asset from the lending market.
|
|
63
60
|
*
|
|
64
|
-
* @param statePda GLAM state
|
|
65
61
|
* @param market Lending market
|
|
66
62
|
* @param asset Asset mint
|
|
67
63
|
* @param amount Amount to borrow
|
|
68
64
|
* @param txOptions
|
|
69
65
|
* @returns
|
|
70
66
|
*/
|
|
71
|
-
borrow(
|
|
67
|
+
borrow(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
72
68
|
/**
|
|
73
69
|
* Repays asset to the lending market.
|
|
74
70
|
*
|
|
75
|
-
* @param statePda
|
|
76
71
|
* @param market
|
|
77
72
|
* @param asset
|
|
78
73
|
* @param amount
|
|
79
74
|
* @param txOptions
|
|
80
75
|
* @returns
|
|
81
76
|
*/
|
|
82
|
-
repay(
|
|
77
|
+
repay(market: PublicKey | string, asset: PublicKey | string, amount: BN | number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
83
78
|
getUserMetadataPda(owner: PublicKey): PublicKey;
|
|
84
79
|
getObligationPda(owner: PublicKey, market: PublicKey, args?: {
|
|
85
80
|
tag: number;
|
|
86
81
|
id: number;
|
|
87
82
|
}): PublicKey;
|
|
88
83
|
getObligationFarmState(obligation: PublicKey, farm: PublicKey): PublicKey;
|
|
89
|
-
initUserMetadataTx(
|
|
84
|
+
initUserMetadataTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
90
85
|
refreshReserveIxs(lendingMarket: PublicKey, reserves: PublicKey[]): TransactionInstruction[];
|
|
91
86
|
refreshObligationFarmsForReserveIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
|
|
92
87
|
getRefreshIxs(obligation: PublicKey, refreshFarms?: boolean): Promise<TransactionInstruction[]>;
|
|
@@ -116,10 +111,10 @@ export declare class KaminoLendingClient {
|
|
|
116
111
|
};
|
|
117
112
|
fetchAndParseReserves(reserves: PublicKey[]): Promise<ParsedReserve[]>;
|
|
118
113
|
findAndParseReserve(market: PublicKey, asset: PublicKey): Promise<ParsedReserve>;
|
|
119
|
-
depositTx(
|
|
120
|
-
withdrawTx(
|
|
121
|
-
borrowTx(
|
|
122
|
-
repayTx(
|
|
114
|
+
depositTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
115
|
+
withdrawTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
116
|
+
borrowTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
117
|
+
repayTx(market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
123
118
|
}
|
|
124
119
|
export declare class KaminoFarmClient {
|
|
125
120
|
readonly base: BaseClient;
|
|
@@ -141,7 +136,7 @@ export declare class KaminoFarmClient {
|
|
|
141
136
|
fetchAndParseFarms(farms: PublicKey[]): Promise<Map<any, any>>;
|
|
142
137
|
farmVaultsAuthority: (farm: PublicKey) => PublicKey;
|
|
143
138
|
rewardsTreasuryVault: (globalConfig: PublicKey, mint: PublicKey) => PublicKey;
|
|
144
|
-
harvest(
|
|
145
|
-
harvestTx(
|
|
139
|
+
harvest(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
140
|
+
harvestTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
146
141
|
}
|
|
147
142
|
export {};
|
package/src/client/marinade.d.ts
CHANGED
|
@@ -11,12 +11,12 @@ export type Ticket = {
|
|
|
11
11
|
export declare class MarinadeClient {
|
|
12
12
|
readonly base: BaseClient;
|
|
13
13
|
constructor(base: BaseClient);
|
|
14
|
-
deposit(
|
|
15
|
-
depositStakeAccount(
|
|
16
|
-
orderUnstake(
|
|
17
|
-
claim(
|
|
18
|
-
getTickets(
|
|
19
|
-
getParsedTickets(
|
|
14
|
+
deposit(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
15
|
+
depositStakeAccount(stakeAccount: PublicKey): Promise<TransactionSignature>;
|
|
16
|
+
orderUnstake(amount: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
17
|
+
claim(tickets: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
18
|
+
getTickets(): Promise<PublicKey[]>;
|
|
19
|
+
getParsedTickets(): Promise<Ticket[]>;
|
|
20
20
|
getMarinadeState(): {
|
|
21
21
|
marinadeStateAddress: PublicKey;
|
|
22
22
|
msolMintAddress: PublicKey;
|
|
@@ -28,8 +28,8 @@ export declare class MarinadeClient {
|
|
|
28
28
|
solLeg: PublicKey;
|
|
29
29
|
};
|
|
30
30
|
getParsedStakeAccountInfo(stakeAccount: PublicKey): Promise<any>;
|
|
31
|
-
depositTx(
|
|
32
|
-
depositStakeAccountTx(
|
|
33
|
-
orderUnstakeTx(
|
|
34
|
-
claimTx(
|
|
31
|
+
depositTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
32
|
+
depositStakeAccountTx(stakeAccount: PublicKey, txOptions: TxOptions): Promise<any>;
|
|
33
|
+
orderUnstakeTx(amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
34
|
+
claimTx(tickets: PublicKey[], txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
35
35
|
}
|
package/src/client/meteora.d.ts
CHANGED
|
@@ -7,12 +7,12 @@ export declare class MeteoraDlmmClient {
|
|
|
7
7
|
private _dlmmPool;
|
|
8
8
|
constructor(base: BaseClient);
|
|
9
9
|
getDlmmPool(pool: PublicKey | string): Promise<DLMM>;
|
|
10
|
-
initializePosition(
|
|
11
|
-
initializePositionPda(
|
|
12
|
-
addLiquidityByStrategy(
|
|
13
|
-
removeLiquidityByRange(
|
|
14
|
-
claimFee(
|
|
15
|
-
closePosition(
|
|
10
|
+
initializePosition(pool: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
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>;
|
|
13
|
+
removeLiquidityByRange(position: PublicKey | string, bpsToRemove: number, txOptions?: TxOptions): Promise<string>;
|
|
14
|
+
claimFee(position: PublicKey | string, txOptions?: TxOptions): Promise<string>;
|
|
15
|
+
closePosition(position: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
16
16
|
getPositionPda(lbPair: PublicKey, base: PublicKey, lowerBinId: number, // i32
|
|
17
17
|
width: number): PublicKey;
|
|
18
18
|
autoFillY(dlmmPool: DLMM, amountX: BN): Promise<{
|
package/src/client/mint.d.ts
CHANGED
|
@@ -5,62 +5,54 @@ import { MintModel } from "../models";
|
|
|
5
5
|
export declare class MintClient {
|
|
6
6
|
readonly base: BaseClient;
|
|
7
7
|
constructor(base: BaseClient);
|
|
8
|
-
fetchTokenHolders(
|
|
9
|
-
getHolders(
|
|
10
|
-
update(
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
fetchTokenHolders(): Promise<TokenAccount[]>;
|
|
9
|
+
getHolders(): Promise<TokenAccount[]>;
|
|
10
|
+
update(mintModel: Partial<MintModel>, txOptions?: TxOptions): Promise<string>;
|
|
11
|
+
updateApplyTimelock(txOptions?: TxOptions): Promise<string>;
|
|
12
|
+
emergencyUpdate(mintModel: Partial<MintModel>, txOptions?: TxOptions): Promise<string>;
|
|
13
|
+
closeMintIx(): Promise<anchor.web3.TransactionInstruction>;
|
|
14
|
+
closeMint(txOptions?: TxOptions): Promise<string>;
|
|
13
15
|
/**
|
|
14
|
-
* Create a glam mint token account for
|
|
16
|
+
* Create a glam mint token account for the specified user
|
|
15
17
|
*
|
|
16
|
-
* @param glamState
|
|
17
18
|
* @param owner Owner of the token account
|
|
18
|
-
* @param mintId ID of the mint (only 0 is supported)
|
|
19
19
|
* @param setFrozen If true, the token account will be frozen
|
|
20
20
|
* @param txOptions
|
|
21
21
|
* @returns Transaction signature
|
|
22
22
|
*/
|
|
23
|
-
createTokenAccount(
|
|
23
|
+
createTokenAccount(owner: PublicKey, setFrozen?: boolean, txOptions?: TxOptions): Promise<string>;
|
|
24
24
|
/**
|
|
25
25
|
* Freeze or unfreeze token accounts of a glam mint
|
|
26
26
|
*
|
|
27
|
-
* @param glamState
|
|
28
|
-
* @param mintId ID of the mint (only 0 is supported)
|
|
29
27
|
* @param tokenAccounts List of token accounts to freeze or unfreeze
|
|
30
28
|
* @param frozen If true, the token accounts will be frozen; otherwise, they will be unfrozen
|
|
31
29
|
* @param txOptions
|
|
32
30
|
* @returns Transaction signature
|
|
33
31
|
*/
|
|
34
|
-
setTokenAccountsStates(
|
|
32
|
+
setTokenAccountsStates(tokenAccounts: PublicKey[], frozen: boolean, txOptions?: TxOptions): Promise<string>;
|
|
35
33
|
/**
|
|
36
34
|
* Mint tokens to recipient. Token account will be created if it does not exist.
|
|
37
35
|
*
|
|
38
|
-
* @param glamState
|
|
39
|
-
* @param mintId ID of the mint (only 0 is supported)
|
|
40
36
|
* @param recipient Recipient public key
|
|
41
37
|
* @param amount Amount of tokens to mint
|
|
42
38
|
* @param forceThaw If true, automatically unfreeze the token account before minting
|
|
43
39
|
* @param txOptions
|
|
44
40
|
* @returns Transaction signature
|
|
45
41
|
*/
|
|
46
|
-
mint(
|
|
42
|
+
mint(recipient: PublicKey, amount: anchor.BN, forceThaw?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
47
43
|
/**
|
|
48
44
|
* Burn tokens from a token account
|
|
49
45
|
*
|
|
50
|
-
* @param glamState
|
|
51
|
-
* @param mintId ID of the mint (only 0 is supported)
|
|
52
46
|
* @param amount Amount of tokens to burn
|
|
53
47
|
* @param from Owner of the token account
|
|
54
48
|
* @param forceThaw If true, automatically unfree the token account before burning
|
|
55
49
|
* @param txOptions
|
|
56
50
|
* @returns Transaction signature
|
|
57
51
|
*/
|
|
58
|
-
burn(
|
|
52
|
+
burn(amount: anchor.BN, from: PublicKey, forceThaw?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
59
53
|
/**
|
|
60
54
|
* Transfer tokens from one token account to another
|
|
61
55
|
*
|
|
62
|
-
* @param glamState
|
|
63
|
-
* @param mintId ID of the mint (only 0 is supported)
|
|
64
56
|
* @param amount Amount of tokens to transfer
|
|
65
57
|
* @param from Owner of the sender token account
|
|
66
58
|
* @param to Owner of the recipient token account
|
|
@@ -68,5 +60,5 @@ export declare class MintClient {
|
|
|
68
60
|
* @param txOptions
|
|
69
61
|
* @returns
|
|
70
62
|
*/
|
|
71
|
-
forceTransfer(
|
|
63
|
+
forceTransfer(amount: anchor.BN, from: PublicKey, to: PublicKey, forceThaw?: boolean, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
72
64
|
}
|
package/src/client/price.d.ts
CHANGED
|
@@ -2,24 +2,26 @@ import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
|
2
2
|
import { KaminoLendingClient } from "./kamino";
|
|
3
3
|
import { BaseClient } from "./base";
|
|
4
4
|
import { PriceDenom } from "../models";
|
|
5
|
+
import { DriftClient } from "./drift";
|
|
5
6
|
export declare class PriceClient {
|
|
6
7
|
readonly base: BaseClient;
|
|
7
8
|
readonly klend: KaminoLendingClient;
|
|
8
|
-
|
|
9
|
+
readonly drift: DriftClient;
|
|
10
|
+
constructor(base: BaseClient, klend: KaminoLendingClient, drift: DriftClient);
|
|
9
11
|
/**
|
|
10
12
|
* !! This is a convenience method that calculates the AUM of the vault based on priced assets.
|
|
11
13
|
* !! It doesn't reflect the actual AUM of the vault.
|
|
12
14
|
* !! If the vault has not been priced or pricing data is outdated, the number is NOT meaningful.
|
|
13
15
|
*/
|
|
14
|
-
getAum(
|
|
15
|
-
|
|
16
|
-
priceVaultIxs(
|
|
17
|
-
remainingAccountsForPricingMeteora: (
|
|
16
|
+
getAum(): Promise<BN>;
|
|
17
|
+
priceKaminoIx(priceDenom: PriceDenom): Promise<TransactionInstruction>;
|
|
18
|
+
priceVaultIxs(priceDenom: PriceDenom): Promise<TransactionInstruction[]>;
|
|
19
|
+
remainingAccountsForPricingMeteora: () => Promise<{
|
|
18
20
|
pubkey: PublicKey;
|
|
19
21
|
isSigner: boolean;
|
|
20
22
|
isWritable: boolean;
|
|
21
23
|
}[]>;
|
|
22
|
-
remainingAccountsForPricingVaultAssets: (
|
|
24
|
+
remainingAccountsForPricingVaultAssets: () => Promise<{
|
|
23
25
|
pubkey: PublicKey;
|
|
24
26
|
isSigner: boolean;
|
|
25
27
|
isWritable: boolean;
|