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 e29f2fa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
4 changes: 4 additions & 0 deletions ts-client/.turbo/turbo-build.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

> @meteora-ag/[email protected] build /Users/mcsam/Development/meteora-monorepo/packages/vault-sdk/ts-client
> rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.esm.json

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 "@repo/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",
"@repo/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
2 changes: 1 addition & 1 deletion ts-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"extends": "@repo/config/typescript/react-library",
"compilerOptions": {
"outDir": "dist",
"lib": ["dom", "dom.iterable", "esnext"],
Expand Down

0 comments on commit e29f2fa

Please sign in to comment.