Skip to content

Commit

Permalink
chore: testing submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
00xSam committed Dec 2, 2024
1 parent 799e689 commit c18b10a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ target
**/*.rs.bk
node_modules

ts-client/dist/
ts-client/dist/
ts-client/.turbo/
4 changes: 4 additions & 0 deletions ts-client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { config } from '@meteora-ag/config/eslint/base';

/** @type {import("eslint").Linter.Config} */
export default config;
23 changes: 9 additions & 14 deletions ts-client/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@mercurial-finance/vault-sdk",
"name": "@meteora-ag/vault-sdk",
"version": "2.2.1",
"description": "Mercurial Vault SDK is a typescript library that allows you to interact with Mercurial v2's vault.",
"main": "dist/cjs/index.js",
Expand All @@ -13,21 +13,10 @@
"dist"
],
"keywords": [],
"author": "mercurial-finance",
"author": "meteora-ag",
"license": "MIT",
"dependencies": {
"@coral-xyz/anchor": "^0.28.0",
"@solana/buffer-layout": "^4.0.1",
"@solana/spl-token": "^0.4.6",
"@solana/spl-token-registry": "^0.2.4574",
"@solana/web3.js": "^1.91.6",
"bn.js": "5.2.1",
"cross-fetch": "^3.1.5",
"decimal.js": "10.3.1",
"jsbi": "4.3.0"
},
"devDependencies": {
"@tsconfig/recommended": "^1.0.1",
"@meteora-ag/config": "workspace:*",
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.1",
"@types/jest": "^27.5.1",
Expand All @@ -39,6 +28,12 @@
"ts-mocha": "^10.0.0",
"typescript": "^5.5.4"
},
"peerDependencies": {
"bn.js": "^5.2.1",
"@coral-xyz/anchor": "^0.28.0",
"@solana/spl-token": "^0.4.9",
"@solana/web3.js": "^1.95.3"
},
"directories": {
"test": "tests"
},
Expand Down
6 changes: 6 additions & 0 deletions ts-client/src/vault/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ const getVaultState = async (
vaultState.lpMint,
vaultState.tokenMint,
]);
if (!vaultLpAccount || !vaultAccount) throw new Error('Missing vault account');

const vaultLpMint = unpackMint(vaultState.lpMint, vaultLpAccount, vaultLpAccount?.owner);
const vaultMint = unpackMint(vaultState.tokenMint, vaultAccount, vaultAccount?.owner);

Expand All @@ -164,6 +166,8 @@ const getVaultStateByPda = async (vaultPda: PublicKey, program: VaultProgram): P
vaultState.lpMint,
vaultState.tokenMint,
]);
if (!vaultLpAccount || !vaultAccount) throw new Error('Missing vault account');

const vaultLpMint = unpackMint(vaultState.lpMint, vaultLpAccount, vaultLpAccount?.owner);
const vaultMint = unpackMint(vaultState.tokenMint, vaultAccount, vaultAccount?.owner);

Expand Down Expand Up @@ -720,6 +724,8 @@ export default class VaultImpl implements VaultImplementation {
// opt.strategy reserved for testing
const selectedStrategy = await this.getStrategyWithHighestLiquidity();

if (!selectedStrategy) throw new Error('No strategy with highest liquidity found');

const currentLiquidity = new BN(selectedStrategy.strategyState.currentLiquidity);
const availableAmount = currentLiquidity.add(vaultLiquidity);

Expand Down
8 changes: 2 additions & 6 deletions ts-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"extends": "@meteora-ag/config/typescript/react-library",
"compilerOptions": {
"outDir": "dist",
"lib": ["dom", "dom.iterable", "esnext"],
"types": ["jest", "mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"noImplicitAny": false,
"skipLibCheck": true
"noImplicitAny": false
}
}

0 comments on commit c18b10a

Please sign in to comment.