@carrot-protocol/clend-vaults-rpc 0.0.30-execution-fee1-dev-c23f9d0 → 0.0.30-execution-fee1-dev-e23928b
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/dist/addresses.d.ts +2 -0
- package/dist/addresses.js +9 -0
- package/dist/addresses.js.map +1 -1
- package/dist/events.d.ts +70 -13
- package/dist/events.js +166 -18
- package/dist/events.js.map +1 -1
- package/dist/idl/clend_vaults.d.ts +1660 -180
- package/dist/idl/clend_vaults.json +1747 -267
- package/dist/math.d.ts +23 -1
- package/dist/math.js +71 -3
- package/dist/math.js.map +1 -1
- package/dist/program.d.ts +10 -3
- package/dist/program.js +135 -25
- package/dist/program.js.map +1 -1
- package/dist/rpc.d.ts +40 -9
- package/dist/rpc.js +341 -90
- package/dist/rpc.js.map +1 -1
- package/dist/state.d.ts +6 -2
- package/dist/state.js +14 -7
- package/dist/state.js.map +1 -1
- package/dist/swapper.d.ts +3 -2
- package/dist/swapper.js +15 -3
- package/dist/swapper.js.map +1 -1
- package/package.json +2 -2
package/dist/rpc.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { ClendVaultsProgram } from "./program";
|
|
|
4
4
|
import { ClendClient, Bank } from "@carrot-protocol/clend-rpc";
|
|
5
5
|
import { Vault, VaultEquity } from "./state";
|
|
6
6
|
import { ClendVaultsJupSwapper } from "./swapper";
|
|
7
|
-
export
|
|
8
|
-
|
|
7
|
+
export interface SwapperConfig {
|
|
8
|
+
jupApiKey?: string;
|
|
9
|
+
excludeDexes?: string[];
|
|
10
|
+
}
|
|
9
11
|
export declare class ClendVaultsClient {
|
|
10
12
|
readonly connection: Connection;
|
|
11
13
|
readonly program: ClendVaultsProgram;
|
|
@@ -13,7 +15,7 @@ export declare class ClendVaultsClient {
|
|
|
13
15
|
readonly swapper: ClendVaultsJupSwapper;
|
|
14
16
|
readonly skipPreflight: boolean;
|
|
15
17
|
private vaultCache;
|
|
16
|
-
constructor(provider: AnchorProvider, skipPreflight?: boolean,
|
|
18
|
+
constructor(provider: AnchorProvider, skipPreflight?: boolean, swapperConfig?: SwapperConfig);
|
|
17
19
|
address(): web3.PublicKey;
|
|
18
20
|
getVault(vault: web3.PublicKey, useCache?: boolean): Promise<Vault>;
|
|
19
21
|
getVaultFromAccountInfo(vault: web3.PublicKey, vaultAccountInfo: web3.AccountInfo<Buffer>): Promise<Vault>;
|
|
@@ -33,9 +35,9 @@ export declare class ClendVaultsClient {
|
|
|
33
35
|
updateAssetFlags(vault: web3.PublicKey, assetMint: web3.PublicKey, newFlags: BN): Promise<string>;
|
|
34
36
|
updateClendAccountFlags(vault: web3.PublicKey, clendAccount: web3.PublicKey, newFlags: BN): Promise<string>;
|
|
35
37
|
updateVaultFlags(vault: web3.PublicKey, newFlags: BN): Promise<string>;
|
|
36
|
-
issue(vault: web3.PublicKey, assetMint: web3.PublicKey, amount: BN, minAmountOut: BN): Promise<string>;
|
|
37
|
-
prepareIssueIxns(user: web3.PublicKey, vault: web3.PublicKey, assetMint: web3.PublicKey, amount: BN, minAmountOut: BN): Promise<web3.TransactionInstruction[]>;
|
|
38
|
-
redeem(vault: web3.PublicKey, assetMint: web3.PublicKey, sharesAmount: BN, minAmountOut: BN): Promise<string>;
|
|
38
|
+
issue(vault: web3.PublicKey, assetMint: web3.PublicKey, amount: BN, minAmountOut: BN, vaultManager?: web3.Signer): Promise<string>;
|
|
39
|
+
prepareIssueIxns(user: web3.PublicKey, vault: web3.PublicKey, assetMint: web3.PublicKey, amount: BN, minAmountOut: BN, additionalIxnCount: number): Promise<web3.TransactionInstruction[]>;
|
|
40
|
+
redeem(vault: web3.PublicKey, assetMint: web3.PublicKey, sharesAmount: BN, minAmountOut: BN, vaultManager?: web3.Signer, additionalIxnCount?: number): Promise<string>;
|
|
39
41
|
prepareRedeemIxns(user: web3.PublicKey, vault: web3.PublicKey, assetMint: web3.PublicKey, amount: BN, minAmountOut: BN): Promise<web3.TransactionInstruction[]>;
|
|
40
42
|
clendAccountDeposit(vault: web3.PublicKey, clendAccount: web3.PublicKey, assetMint: web3.PublicKey, amount: BN): Promise<string>;
|
|
41
43
|
clendAccountWithdraw(vault: web3.PublicKey, clendAccount: web3.PublicKey, assetMint: web3.PublicKey, amount: BN): Promise<string>;
|
|
@@ -91,7 +93,25 @@ export declare class ClendVaultsClient {
|
|
|
91
93
|
ixns: web3.TransactionInstruction[];
|
|
92
94
|
luts: web3.PublicKey[];
|
|
93
95
|
}>;
|
|
94
|
-
prepareRedeemFromClendAccountIxns(user: web3.PublicKey, vault: web3.PublicKey, clendAccount: web3.PublicKey, outputAssetMint: web3.PublicKey, collateralMint: web3.PublicKey, debtMint: web3.PublicKey, totalSharesToRedeem: BN, sharesToRedeemFromClendAccount: BN, slippageBps: number): Promise<{
|
|
96
|
+
prepareRedeemFromClendAccountIxns(user: web3.PublicKey, vault: web3.PublicKey, clendAccount: web3.PublicKey, outputAssetMint: web3.PublicKey, collateralMint: web3.PublicKey, debtMint: web3.PublicKey, totalSharesToRedeem: BN, sharesToRedeemFromClendAccount: BN, slippageBps: number, targetLeverage: number, additionalIxnCount?: number): Promise<{
|
|
97
|
+
ixns: web3.TransactionInstruction[];
|
|
98
|
+
luts: web3.PublicKey[];
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Prepare instructions for issuing into a vault *and* depositing into a CLend account
|
|
102
|
+
* to reach a target leverage.
|
|
103
|
+
*
|
|
104
|
+
* Order:
|
|
105
|
+
* 1) userSessionStart
|
|
106
|
+
* 2) issueStart (pull tokens from user into vault)
|
|
107
|
+
* 3) CLend deposit leverage ixns (move vault funds into CLend account at target leverage)
|
|
108
|
+
* 4) issueEnd (mint vault shares to user)
|
|
109
|
+
* 5) userSessionEnd
|
|
110
|
+
*/
|
|
111
|
+
prepareIssueIntoClendAccountIxns(user: web3.PublicKey, vault: web3.PublicKey, clendAccount: web3.PublicKey, inputAssetMint: web3.PublicKey, // what user is depositing into the vault
|
|
112
|
+
collateralMint: web3.PublicKey, // CLend collateral mint
|
|
113
|
+
debtMint: web3.PublicKey, // CLend debt mint
|
|
114
|
+
inputAmount: BN, slippageBps: number, targetLeverage: number, additionalIxnCount?: number): Promise<{
|
|
95
115
|
ixns: web3.TransactionInstruction[];
|
|
96
116
|
luts: web3.PublicKey[];
|
|
97
117
|
}>;
|
|
@@ -103,6 +123,18 @@ export declare class ClendVaultsClient {
|
|
|
103
123
|
ixns: web3.TransactionInstruction[];
|
|
104
124
|
luts: web3.PublicKey[];
|
|
105
125
|
}>;
|
|
126
|
+
getDepositLeverageCollateralIxns(vault: web3.PublicKey, vaultManager: web3.PublicKey, user: web3.PublicKey, clendGroup: web3.PublicKey, clendAccount: web3.PublicKey, collateralMint: web3.PublicKey, debtMint: web3.PublicKey, collateralDecimals: number, debtDecimals: number, borrowAmount: BN, // protocol debt we want to borrow (from params fn)
|
|
127
|
+
depositAmount: BN, // user's collateral already in the vault (issueStart)
|
|
128
|
+
slippageBps: number, additionalIxnCount: number): Promise<{
|
|
129
|
+
ixns: web3.TransactionInstruction[];
|
|
130
|
+
luts: web3.PublicKey[];
|
|
131
|
+
}>;
|
|
132
|
+
getDepositLeverageDebtIxns(vault: web3.PublicKey, vaultManager: web3.PublicKey, user: web3.PublicKey, clendGroup: web3.PublicKey, clendAccount: web3.PublicKey, collateralMint: web3.PublicKey, debtMint: web3.PublicKey, collateralDecimals: number, debtDecimals: number, initialUserDebtContributionForSwap: BN, // user deposit already in vault
|
|
133
|
+
finalLoopBorrowAmount: BN, // protocol borrow (from params fn)
|
|
134
|
+
slippageBps: number, additionalIxnCount: number): Promise<{
|
|
135
|
+
ixns: web3.TransactionInstruction[];
|
|
136
|
+
luts: web3.PublicKey[];
|
|
137
|
+
}>;
|
|
106
138
|
swap(vault: web3.PublicKey, inputMint: web3.PublicKey, outputMint: web3.PublicKey, inAmount: BN): Promise<string>;
|
|
107
139
|
distributeFees(vault: web3.PublicKey, sharesDestinationOwner: web3.PublicKey): Promise<string>;
|
|
108
140
|
updateSbOraclePrice(vault: web3.PublicKey, queue: web3.PublicKey, feed: web3.PublicKey): Promise<string>;
|
|
@@ -110,5 +142,4 @@ export declare class ClendVaultsClient {
|
|
|
110
142
|
send(ixns: web3.TransactionInstruction[], additionalSigners?: web3.Signer[], luts?: web3.PublicKey[]): Promise<string>;
|
|
111
143
|
confirmTx(txSig: string): Promise<void>;
|
|
112
144
|
}
|
|
113
|
-
export declare function buildEquityRemainingAccounts(vaultState: Vault, clendClient: ClendClient): Promise<AccountMeta[]>;
|
|
114
|
-
export {};
|
|
145
|
+
export declare function buildEquityRemainingAccounts(vaultState: Vault, clendClient: ClendClient): Promise<web3.AccountMeta[]>;
|