@carrot-protocol/clend-vaults-rpc 0.0.2-pub1-dev-a741874
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/.prettierignore +2 -0
- package/makefile +18 -0
- package/package.json +26 -0
- package/src/addresses.ts +19 -0
- package/src/idl/clend_vaults.json +1550 -0
- package/src/idl/clend_vaults.ts +1556 -0
- package/src/index.ts +5 -0
- package/src/math.ts +103 -0
- package/src/program.ts +551 -0
- package/src/rpc.ts +1354 -0
- package/src/state.ts +188 -0
- package/src/swapper.ts +221 -0
- package/src/utils.ts +7 -0
- package/tsconfig.json +18 -0
package/.prettierignore
ADDED
package/makefile
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@carrot-protocol/clend-vaults-rpc",
|
|
3
|
+
"version": "0.0.2-pub1-dev-a741874",
|
|
4
|
+
"description": "clend vaults rpc client",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "rm -rf *.tgz dist node_modules package-lock.json",
|
|
8
|
+
"build": "npm i && tsc && npm pack",
|
|
9
|
+
"fmt": "prettier --write src/",
|
|
10
|
+
"fmt:check": "prettier --check src/",
|
|
11
|
+
"test": "for file in test/*.test.ts; do npx ts-mocha -p ./tsconfig.json -t 1000000 \"$file\" || exit 1; done",
|
|
12
|
+
"version-check": "current_version=$(node -p -e \"require('./package.json').version\") && if npm view @carrot-protocol/clend-vaults-rpc@$current_version > /dev/null 2>&1; then echo \"Version $current_version already exists. Please bump it in package.json\"; exit 1; fi"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^24.5.2",
|
|
18
|
+
"prettier": "^3.6.2"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@jup-ag/api": "6.0.44",
|
|
22
|
+
"@carrot-protocol/clend-rpc": "0.1.44",
|
|
23
|
+
"@coral-xyz/anchor": "^0.31.1",
|
|
24
|
+
"@solana/spl-token": "^0.4.14"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/addresses.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { web3 } from "@coral-xyz/anchor";
|
|
2
|
+
|
|
3
|
+
// Program id from your IDL
|
|
4
|
+
export const CLEND_VAULTS_PROGRAM_ID = new web3.PublicKey(
|
|
5
|
+
"CVAU7TAbdfv7s6rxSmcNKg2AGswZAChXaovoKdvxVs5Q",
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
// PDA: ["vault", shares_mint]
|
|
9
|
+
export function getVaultPda(sharesMint: web3.PublicKey): web3.PublicKey {
|
|
10
|
+
return web3.PublicKey.findProgramAddressSync(
|
|
11
|
+
[Buffer.from("vault"), sharesMint.toBuffer()],
|
|
12
|
+
CLEND_VAULTS_PROGRAM_ID,
|
|
13
|
+
)[0];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Jupiter program id used by your `swap` instruction
|
|
17
|
+
export const JUPITER_SWAP_PROGRAM_ID = new web3.PublicKey(
|
|
18
|
+
"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
|
|
19
|
+
);
|