@glamsystems/glam-sdk 0.1.19 → 0.1.21
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/README.md +3 -37
- package/index.cjs.js +1596 -220
- package/index.esm.js +1543 -218
- package/package.json +2 -4
- package/src/client/drift.d.ts +75 -59
- package/src/client/kamino.d.ts +36 -12
- package/src/client/meteora.d.ts +1 -1
- package/src/client/price.d.ts +4 -7
- package/src/client.d.ts +3 -1
- package/src/constants.d.ts +4 -0
- package/src/index.d.ts +3 -0
- package/src/react/glam.d.ts +2 -2
- package/src/utils/driftOrderParams.d.ts +28 -0
- package/src/utils/driftTypes.d.ts +1422 -0
- package/src/utils/driftUser.d.ts +2 -0
- package/src/utils/helpers.d.ts +1 -0
- package/src/utils/priorityfee.d.ts +1 -1
- package/target/idl/glam_protocol.json +8 -2
- package/target/types/glam_protocol.d.ts +8 -2
- package/target/types/glam_protocol.ts +8 -2
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glamsystems/glam-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "TypeScript SDK for the GLAM Protocol",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
7
7
|
"homepage": "https://www.glam.systems",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git@github.com:glamsystems/glam.git"
|
|
10
|
+
"url": "git@github.com:glamsystems/glam-sdk.git"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"glam",
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@coral-xyz/anchor": "^0.31.0",
|
|
22
22
|
"@coral-xyz/borsh": "^0.31.0",
|
|
23
|
-
"@drift-labs/sdk": "2.114.0-beta.3",
|
|
24
23
|
"@marinade.finance/marinade-ts-sdk": "^5.0.15",
|
|
25
|
-
"@pythnetwork/client": "^2.21.1",
|
|
26
24
|
"@meteora-ag/dlmm": "^1.4.11",
|
|
27
25
|
"@solana/spl-stake-pool": "^1.1.5",
|
|
28
26
|
"@solana/spl-token": "^0.4.9",
|
package/src/client/drift.d.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import * as anchor from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
-
import { MarketType, OrderParams, PositionDirection, SpotPosition, PerpPosition, ModifyOrderParams } from "
|
|
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
6
|
import { PriceDenom, StateModel } from "../models";
|
|
7
|
+
import { BN } from "@coral-xyz/anchor";
|
|
7
8
|
interface OrderConstants {
|
|
8
9
|
perpBaseScale: number;
|
|
9
10
|
quoteScale: number;
|
|
10
11
|
}
|
|
11
|
-
export interface
|
|
12
|
-
|
|
13
|
-
categories: string[];
|
|
14
|
-
symbol: string;
|
|
15
|
-
baseAsset: string;
|
|
12
|
+
export interface SpotMarket {
|
|
13
|
+
name: string;
|
|
16
14
|
marketIndex: number;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
marketPDA: string;
|
|
23
|
-
}
|
|
24
|
-
export interface SpotMarketConfig {
|
|
25
|
-
symbol: string;
|
|
15
|
+
marketPda: PublicKey;
|
|
16
|
+
vault: PublicKey;
|
|
17
|
+
oracle: PublicKey;
|
|
18
|
+
oracleSource: OracleSource;
|
|
19
|
+
mint: PublicKey;
|
|
26
20
|
decimals: number;
|
|
21
|
+
tokenProgram: PublicKey;
|
|
22
|
+
cumulativeDepositInterest: BN;
|
|
23
|
+
cumulativeBorrowInterest: BN;
|
|
24
|
+
}
|
|
25
|
+
export interface PerpMarket {
|
|
26
|
+
name: string;
|
|
27
27
|
marketIndex: number;
|
|
28
|
-
|
|
29
|
-
oracle:
|
|
30
|
-
oracleSource:
|
|
31
|
-
pythPullOraclePDA: string;
|
|
32
|
-
pythFeedId: string;
|
|
33
|
-
marketPDA: string;
|
|
34
|
-
mint: string;
|
|
35
|
-
serumMarket?: string;
|
|
36
|
-
phoenixMarket?: string;
|
|
37
|
-
openBookMarket?: string;
|
|
38
|
-
vaultPDA: string;
|
|
28
|
+
marketPda: PublicKey;
|
|
29
|
+
oracle: PublicKey;
|
|
30
|
+
oracleSource: OracleSource;
|
|
39
31
|
}
|
|
40
32
|
export interface DriftMarketConfigs {
|
|
41
33
|
orderConstants: OrderConstants;
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
perpMarkets: PerpMarket[];
|
|
35
|
+
spotMarkets: SpotMarket[];
|
|
44
36
|
}
|
|
45
|
-
export interface
|
|
46
|
-
delegate:
|
|
37
|
+
export interface DriftUser {
|
|
38
|
+
delegate: PublicKey;
|
|
47
39
|
name: string;
|
|
48
40
|
spotPositions: (SpotPosition & {
|
|
49
|
-
|
|
41
|
+
amount: number;
|
|
42
|
+
uiAmount: number;
|
|
43
|
+
mint: PublicKey;
|
|
44
|
+
decimals: number;
|
|
45
|
+
marketName: string;
|
|
50
46
|
})[];
|
|
51
47
|
perpPositions: PerpPosition[];
|
|
52
|
-
marginMode:
|
|
48
|
+
marginMode: MarginMode;
|
|
53
49
|
subAccountId: number;
|
|
54
50
|
isMarginTradingEnabled: boolean;
|
|
55
51
|
maxMarginRatio: number;
|
|
52
|
+
orders: Order[];
|
|
56
53
|
}
|
|
57
54
|
export declare class DriftClient {
|
|
58
55
|
readonly base: BaseClient;
|
|
56
|
+
private spotMarkets;
|
|
57
|
+
private perpMarkets;
|
|
58
|
+
private marketConfigs;
|
|
59
59
|
constructor(base: BaseClient);
|
|
60
60
|
initialize(statePda: PublicKey | string, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
61
61
|
updateUserCustomMarginRatio(statePda: PublicKey, maxLeverage: number, // 1=1x, 2=2x ... 50=50x leverage
|
|
@@ -63,34 +63,50 @@ export declare class DriftClient {
|
|
|
63
63
|
updateUserMarginTradingEnabled(statePda: PublicKey, marginTradingEnabled: boolean, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
64
64
|
updateUserDelegate(statePda: PublicKey | string, delegate: PublicKey | string, subAccountId?: number): Promise<TransactionSignature>;
|
|
65
65
|
deleteUser(statePda: PublicKey | string, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
66
|
-
deposit(statePda: PublicKey | string, amount: anchor.BN, marketIndex
|
|
67
|
-
withdraw(statePda: PublicKey | string, amount: anchor.BN, marketIndex
|
|
68
|
-
placeOrder(statePda: PublicKey | string, orderParams: OrderParams, subAccountId
|
|
69
|
-
modifyOrder(statePda: PublicKey | string, modifyOrderParams: ModifyOrderParams, subAccountId
|
|
70
|
-
cancelOrders(statePda: PublicKey | string, marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId
|
|
71
|
-
cancelOrdersByIds(statePda: PublicKey | string, orderIds: number[], subAccountId
|
|
72
|
-
settlePnl(statePda: PublicKey | string, marketIndex: number, subAccountId
|
|
73
|
-
priceDrift(statePda: PublicKey | string,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
deposit(statePda: PublicKey | string, amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
67
|
+
withdraw(statePda: PublicKey | string, amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
68
|
+
placeOrder(statePda: PublicKey | string, orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
69
|
+
modifyOrder(statePda: PublicKey | string, modifyOrderParams: ModifyOrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
70
|
+
cancelOrders(statePda: PublicKey | string, marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
71
|
+
cancelOrdersByIds(statePda: PublicKey | string, orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
72
|
+
settlePnl(statePda: PublicKey | string, marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
73
|
+
priceDrift(statePda: PublicKey | string, priceDenom: PriceDenom, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
74
|
+
getMarketPda: (marketType: MarketType, marketIndex: number) => anchor.web3.PublicKey;
|
|
75
|
+
getUserPda: (authority: PublicKey, subAccountId?: number) => anchor.web3.PublicKey;
|
|
76
|
+
getUserStatsPda: (authority: PublicKey) => PublicKey;
|
|
77
|
+
getGlamReferrerPdas(): {
|
|
78
|
+
user: PublicKey;
|
|
79
|
+
userStats: PublicKey;
|
|
80
|
+
};
|
|
81
|
+
parsePerpMarket(data: Buffer): PerpMarket;
|
|
82
|
+
parseSpotMarket(data: Buffer): SpotMarket;
|
|
83
|
+
calcSpotBalance(marketIndex: number, scaledBalance: BN, scaledBalanceType: SpotBalanceType): Promise<{
|
|
84
|
+
amount: number;
|
|
85
|
+
uiAmount: number;
|
|
82
86
|
}>;
|
|
87
|
+
getDriftUserPdas(statePda: PublicKey | string, subAccountId?: number): {
|
|
88
|
+
user: PublicKey;
|
|
89
|
+
userStats: PublicKey;
|
|
90
|
+
};
|
|
91
|
+
get driftStatePda(): PublicKey;
|
|
92
|
+
fetchAndParseSpotMarket(marketIndex: number): Promise<SpotMarket>;
|
|
93
|
+
fetchAndParseSpotMarkets(marketIndexes: number[]): Promise<SpotMarket[]>;
|
|
94
|
+
fetchAndParsePerpMarket(marketIndex: number): Promise<PerpMarket>;
|
|
95
|
+
fetchAndParsePerpMarkets(marketIndexes: number[]): Promise<PerpMarket[]>;
|
|
96
|
+
fetchMarketConfigs(): Promise<DriftMarketConfigs>;
|
|
97
|
+
charsToName(chars: number[] | Buffer): string;
|
|
98
|
+
fetchDriftUser(statePda: PublicKey | string, subAccountId?: number): Promise<DriftUser | null>;
|
|
83
99
|
fetchPolicyConfig(glamState: StateModel): Promise<{
|
|
84
100
|
driftAccessControl: number;
|
|
85
|
-
driftDelegatedAccount:
|
|
101
|
+
driftDelegatedAccount: anchor.web3.PublicKey;
|
|
86
102
|
driftMarketIndexesPerp: number[];
|
|
87
103
|
driftOrderTypes: number[];
|
|
88
104
|
driftMaxLeverage: number;
|
|
89
|
-
driftEnableSpot:
|
|
105
|
+
driftEnableSpot: boolean;
|
|
90
106
|
driftMarketIndexesSpot: number[];
|
|
91
107
|
}>;
|
|
92
108
|
marketTypeEquals: (a: MarketType | undefined, b: MarketType) => boolean;
|
|
93
|
-
composeRemainingAccounts(glamState: PublicKey, subAccountId: number,
|
|
109
|
+
composeRemainingAccounts(glamState: PublicKey, subAccountId: number, marketType?: MarketType, marketIndex?: number): Promise<AccountMeta[]>;
|
|
94
110
|
initializeUserStatsIx(glamState: PublicKey, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
95
111
|
initializeUserIx(glamState: PublicKey, glamSigner: PublicKey, subAccountId: number): Promise<TransactionInstruction>;
|
|
96
112
|
initializeTx(glamState: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
@@ -103,13 +119,13 @@ export declare class DriftClient {
|
|
|
103
119
|
updateUserDelegateIx(glamState: PublicKey, delegate: PublicKey | string, subAccountId?: number, txOptions?: TxOptions): Promise<TransactionInstruction>;
|
|
104
120
|
updateUserDelegateTx(glamState: PublicKey, delegate: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
105
121
|
deleteUserTx(glamState: PublicKey, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
106
|
-
depositTx(glamState: PublicKey, amount: anchor.BN, marketIndex
|
|
107
|
-
withdrawTx(statePda: PublicKey, amount: anchor.BN, marketIndex
|
|
108
|
-
placeOrderTx(glamState: PublicKey, orderParams: OrderParams, subAccountId
|
|
109
|
-
modifyOrderTx(statePda: PublicKey, modifyOrderParams: ModifyOrderParams, subAccountId
|
|
110
|
-
cancelOrdersTx(glamState: PublicKey, marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId
|
|
111
|
-
cancelOrdersByIdsTx(glamState: PublicKey, orderIds: number[], subAccountId
|
|
112
|
-
settlePnlTx(glamState: PublicKey, marketIndex: number, subAccountId
|
|
113
|
-
priceDriftTx(glamState: PublicKey,
|
|
122
|
+
depositTx(glamState: PublicKey, amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
123
|
+
withdrawTx(statePda: PublicKey, amount: anchor.BN, marketIndex?: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
124
|
+
placeOrderTx(glamState: PublicKey, orderParams: OrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
125
|
+
modifyOrderTx(statePda: PublicKey, modifyOrderParams: ModifyOrderParams, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
126
|
+
cancelOrdersTx(glamState: PublicKey, marketType: MarketType, marketIndex: number, direction: PositionDirection, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
127
|
+
cancelOrdersByIdsTx(glamState: PublicKey, orderIds: number[], subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
128
|
+
settlePnlTx(glamState: PublicKey, marketIndex: number, subAccountId?: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
129
|
+
priceDriftTx(glamState: PublicKey, priceDenom: PriceDenom, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
114
130
|
}
|
|
115
131
|
export {};
|
package/src/client/kamino.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ interface ParsedReserve {
|
|
|
12
12
|
feeVault: PublicKey;
|
|
13
13
|
}
|
|
14
14
|
interface ParsedObligation {
|
|
15
|
+
address: PublicKey;
|
|
16
|
+
lendingMarket: PublicKey | null;
|
|
15
17
|
deposits: {
|
|
16
18
|
reserve: PublicKey;
|
|
17
19
|
}[];
|
|
@@ -84,13 +86,10 @@ export declare class KaminoLendingClient {
|
|
|
84
86
|
id: number;
|
|
85
87
|
}): PublicKey;
|
|
86
88
|
getObligationFarmState(obligation: PublicKey, farm: PublicKey): PublicKey;
|
|
87
|
-
initUserMetadataTx(glamState: PublicKey, referrer: PublicKey, txOptions
|
|
89
|
+
initUserMetadataTx(glamState: PublicKey, referrer: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
88
90
|
refreshReserveIxs(lendingMarket: PublicKey, reserves: PublicKey[]): TransactionInstruction[];
|
|
89
91
|
refreshObligationFarmsForReserveIxs(obligation: PublicKey, lendingMarket: PublicKey, parsedReserves: ParsedReserve[]): TransactionInstruction[];
|
|
90
|
-
|
|
91
|
-
* Returns an array of instructions for refreshing an existing obligation and reserves it depends on.
|
|
92
|
-
*/
|
|
93
|
-
getRefreshIxs(obligation: PublicKey, lendingMarket: PublicKey): Promise<TransactionInstruction[]>;
|
|
92
|
+
getRefreshIxs(obligation: PublicKey, refreshFarms?: boolean): Promise<TransactionInstruction[]>;
|
|
94
93
|
getMarketAuthority(market: PublicKey): PublicKey;
|
|
95
94
|
reservePdas(market: PublicKey, mint: PublicKey): {
|
|
96
95
|
liquiditySupplyVault: PublicKey;
|
|
@@ -106,13 +105,15 @@ export declare class KaminoLendingClient {
|
|
|
106
105
|
*/
|
|
107
106
|
fetchAndParseObligation(obligation: PublicKey): Promise<ParsedObligation>;
|
|
108
107
|
pubkeyArraysEqual: (a: PublicKey[], b: PublicKey[]) => boolean;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
_parseReserveAccount(data: Buffer): {
|
|
109
|
+
liquiditySupplyVault: PublicKey;
|
|
110
|
+
collateralMint: PublicKey;
|
|
111
|
+
collateralSupplyVault: PublicKey;
|
|
112
|
+
feeVault: PublicKey;
|
|
113
|
+
farmCollateral: PublicKey;
|
|
114
|
+
farmDebt: PublicKey;
|
|
115
|
+
liquidityMint: PublicKey;
|
|
116
|
+
};
|
|
116
117
|
fetchAndParseReserves(reserves: PublicKey[]): Promise<ParsedReserve[]>;
|
|
117
118
|
findAndParseReserve(market: PublicKey, asset: PublicKey): Promise<ParsedReserve>;
|
|
118
119
|
depositTx(glamState: PublicKey, market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
@@ -120,4 +121,27 @@ export declare class KaminoLendingClient {
|
|
|
120
121
|
borrowTx(glamState: PublicKey, market: PublicKey, asset: PublicKey, amount: BN, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
121
122
|
repayTx(glamState: PublicKey, market: PublicKey, asset: PublicKey, amount: BN, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
122
123
|
}
|
|
124
|
+
export declare class KaminoFarmClient {
|
|
125
|
+
readonly base: BaseClient;
|
|
126
|
+
constructor(base: BaseClient);
|
|
127
|
+
findAndParseFarmStates(owner: PublicKey): Promise<{
|
|
128
|
+
userFarmState: PublicKey;
|
|
129
|
+
farmState: PublicKey;
|
|
130
|
+
}[]>;
|
|
131
|
+
parseFarm(data: Buffer): Promise<{
|
|
132
|
+
globalConfig: PublicKey;
|
|
133
|
+
rewards: {
|
|
134
|
+
index: number;
|
|
135
|
+
mint: PublicKey;
|
|
136
|
+
minClaimDurationSeconds: any;
|
|
137
|
+
tokenProgram: PublicKey;
|
|
138
|
+
rewardsVault: PublicKey;
|
|
139
|
+
}[];
|
|
140
|
+
}>;
|
|
141
|
+
fetchAndParseFarms(farms: PublicKey[]): Promise<Map<any, any>>;
|
|
142
|
+
farmVaultsAuthority: (farm: PublicKey) => PublicKey;
|
|
143
|
+
rewardsTreasuryVault: (globalConfig: PublicKey, mint: PublicKey) => PublicKey;
|
|
144
|
+
harvest(statePda: PublicKey | string, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
145
|
+
harvestTx(glamState: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
146
|
+
}
|
|
123
147
|
export {};
|
package/src/client/meteora.d.ts
CHANGED
package/src/client/price.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import {
|
|
2
|
+
import { KaminoLendingClient } from "./kamino";
|
|
3
3
|
import { BaseClient } from "./base";
|
|
4
4
|
import { PriceDenom } from "../models";
|
|
5
5
|
export declare class PriceClient {
|
|
6
6
|
readonly base: BaseClient;
|
|
7
|
-
|
|
7
|
+
readonly klend: KaminoLendingClient;
|
|
8
|
+
constructor(base: BaseClient, klend: KaminoLendingClient);
|
|
8
9
|
/**
|
|
9
10
|
* !! This is a convenience method that calculates the AUM of the vault based on priced assets.
|
|
10
11
|
* !! It doesn't reflect the actual AUM of the vault.
|
|
11
12
|
* !! If the vault has not been priced or pricing data is outdated, the number is NOT meaningful.
|
|
12
13
|
*/
|
|
13
14
|
getAum(glamState: PublicKey): Promise<BN>;
|
|
15
|
+
priceKaminoIxs(glamState: PublicKey, priceDenom: PriceDenom): Promise<any[]>;
|
|
14
16
|
priceVaultIxs(glamState: PublicKey, priceDenom: PriceDenom): Promise<TransactionInstruction[]>;
|
|
15
|
-
remainingAccountsForPricingKamino: (glamState: PublicKey) => Promise<{
|
|
16
|
-
pubkey: PublicKey;
|
|
17
|
-
isSigner: boolean;
|
|
18
|
-
isWritable: boolean;
|
|
19
|
-
}[]>;
|
|
20
17
|
remainingAccountsForPricingMeteora: (glamState: PublicKey) => Promise<{
|
|
21
18
|
pubkey: PublicKey;
|
|
22
19
|
isSigner: boolean;
|
package/src/client.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { WSolClient } from "./client/wsol";
|
|
|
8
8
|
import { StakingClient } from "./client/staking";
|
|
9
9
|
import { StateClient } from "./client/state";
|
|
10
10
|
import { MintClient } from "./client/mint";
|
|
11
|
-
import { KaminoLendingClient } from "./client/kamino";
|
|
11
|
+
import { KaminoFarmClient, KaminoLendingClient } from "./client/kamino";
|
|
12
12
|
import { MeteoraDlmmClient } from "./client/meteora";
|
|
13
13
|
import { InvestorClient } from "./client/investor";
|
|
14
14
|
import { PriceClient } from "./client/price";
|
|
@@ -30,6 +30,7 @@ export declare class GlamClient extends BaseClient {
|
|
|
30
30
|
private _state?;
|
|
31
31
|
private _mint?;
|
|
32
32
|
private _kaminoLending?;
|
|
33
|
+
private _kaminoFarm?;
|
|
33
34
|
private _meteoraDlmm?;
|
|
34
35
|
constructor(config?: GlamClientConfig);
|
|
35
36
|
get drift(): DriftClient;
|
|
@@ -43,5 +44,6 @@ export declare class GlamClient extends BaseClient {
|
|
|
43
44
|
get state(): StateClient;
|
|
44
45
|
get mint(): MintClient;
|
|
45
46
|
get kaminoLending(): KaminoLendingClient;
|
|
47
|
+
get kaminoFarm(): KaminoFarmClient;
|
|
46
48
|
get meteoraDlmm(): MeteoraDlmmClient;
|
|
47
49
|
}
|
package/src/constants.d.ts
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export * from "./client/drift";
|
|
|
7
7
|
export * from "./client/base";
|
|
8
8
|
export * from "./utils/helpers";
|
|
9
9
|
export * from "./utils/priorityfee";
|
|
10
|
+
export * from "./utils/driftOrderParams";
|
|
11
|
+
export * from "./utils/driftTypes";
|
|
12
|
+
export * from "./utils/driftUser";
|
|
10
13
|
export * from "./constants";
|
|
11
14
|
export * from "./error";
|
|
12
15
|
export * from "./client/assets";
|
package/src/react/glam.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DelegateAcl, StateModel } from "../models";
|
|
2
2
|
import { GlamClient } from "../client";
|
|
3
3
|
import { PublicKey } from "@solana/web3.js";
|
|
4
|
-
import { DriftMarketConfigs,
|
|
4
|
+
import { DriftMarketConfigs, DriftUser } from "../client/drift";
|
|
5
5
|
import { TokenAccount } from "../client/base";
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
@@ -33,7 +33,7 @@ interface GlamProviderContext {
|
|
|
33
33
|
prices: TokenPrice[];
|
|
34
34
|
jupTokenList?: JupTokenListItem[];
|
|
35
35
|
driftMarketConfigs: DriftMarketConfigs;
|
|
36
|
-
driftUser:
|
|
36
|
+
driftUser: DriftUser;
|
|
37
37
|
setActiveGlamState: (f: GlamStateCache) => void;
|
|
38
38
|
refresh: () => Promise<void>;
|
|
39
39
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OptionalOrderParams, OrderParams, OrderTriggerCondition } from "./driftTypes";
|
|
2
|
+
import { BN } from "@coral-xyz/anchor";
|
|
3
|
+
export declare function getLimitOrderParams(params: Omit<OptionalOrderParams, "orderType"> & {
|
|
4
|
+
price: BN;
|
|
5
|
+
}): OptionalOrderParams;
|
|
6
|
+
export declare function getTriggerMarketOrderParams(params: Omit<OptionalOrderParams, "orderType"> & {
|
|
7
|
+
triggerCondition: OrderTriggerCondition;
|
|
8
|
+
triggerPrice: BN;
|
|
9
|
+
}): OptionalOrderParams;
|
|
10
|
+
export declare function getTriggerLimitOrderParams(params: Omit<OptionalOrderParams, "orderType"> & {
|
|
11
|
+
triggerCondition: OrderTriggerCondition;
|
|
12
|
+
triggerPrice: BN;
|
|
13
|
+
price: BN;
|
|
14
|
+
}): OptionalOrderParams;
|
|
15
|
+
export declare function getMarketOrderParams(params: Omit<OptionalOrderParams, "orderType">): OptionalOrderParams;
|
|
16
|
+
/**
|
|
17
|
+
* Creates an OrderParams object with the given OptionalOrderParams and any params to override.
|
|
18
|
+
*
|
|
19
|
+
* example:
|
|
20
|
+
* ```
|
|
21
|
+
* const orderParams = getOrderParams(optionalOrderParams, { marketType: MarketType.PERP });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param optionalOrderParams
|
|
25
|
+
* @param overridingParams
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare function getOrderParams(optionalOrderParams: OptionalOrderParams, overridingParams?: Record<string, any>): OrderParams;
|