diff --git a/.vscode/settings.json b/.vscode/settings.json index 3390f9e..67dcf14 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,6 +14,7 @@ "Lamports", "ledgerhq", "localnet", + "mnde", "MR2LqxoSbw831bNy68utpu5n4YqBH3AzDmddkgk9LQv", "Msol", "MsolAmount", diff --git a/packages/jest-utils/src/equalityTesters.ts b/packages/jest-utils/src/equalityTesters.ts index d4547e6..3b5816c 100644 --- a/packages/jest-utils/src/equalityTesters.ts +++ b/packages/jest-utils/src/equalityTesters.ts @@ -4,11 +4,11 @@ import BN from 'bn.js' // Use to global configuration of Jest /* -* / * * @type {import('ts-jest').JestConfigWithTsJest} * / -* module.exports = { -* setupFilesAfterEnv: ['/setup/equalityTesters.ts'], -* } -*/ + * / * * @type {import('ts-jest').JestConfigWithTsJest} * / + * module.exports = { + * setupFilesAfterEnv: ['/setup/equalityTesters.ts'], + * } + */ /** * Equality testers for jest to compare BN and PublicKey. diff --git a/packages/marinade-ts-cli/package.json b/packages/marinade-ts-cli/package.json index 73e8006..90cb8c6 100644 --- a/packages/marinade-ts-cli/package.json +++ b/packages/marinade-ts-cli/package.json @@ -25,7 +25,9 @@ "solana", "marinade.finance", "blockchain", - "staking" + "staking", + "msol", + "mnde" ], "dependencies": { "@coral-xyz/anchor": "0.28", diff --git a/packages/marinade-ts-cli/src/commands/balance.ts b/packages/marinade-ts-cli/src/commands/balance.ts index 0250576..bc0cebf 100644 --- a/packages/marinade-ts-cli/src/commands/balance.ts +++ b/packages/marinade-ts-cli/src/commands/balance.ts @@ -15,8 +15,8 @@ export function installShowBalance(program: Command) { .command('balance') .description('Show account balance') .argument( - '', - 'Account to show balance for (default: keypair wallet pubkey)', + '[account-pubkey]', + 'Account to show balance for (default: wallet pubkey)', parsePubkey ) .action(async (accountPubkey: Promise) => { @@ -53,19 +53,33 @@ export async function showBalance({ mSolMintAddress, accountPubkey ) - const { - value: { amount: amountMSOL }, - } = await connection.getTokenAccountBalance(userMSolATA) - const mSolATABalance = new BN(amountMSOL) - console.log(`mSOL Balance: ${lamportsToSol(mSolATABalance)}`) + try { + const { + value: { amount: amountMSOL }, + } = await connection.getTokenAccountBalance(userMSolATA) + const mSolATABalance = new BN(amountMSOL) + console.log(`mSOL Balance: ${lamportsToSol(mSolATABalance)}`) + } catch (e) { + logger.error( + `MSOL ATA of the account ${accountPubkey.toBase58()} does not exist`, + e + ) + } - const userLpATA = await getAssociatedTokenAccountAddress( - lpMint.address, - accountPubkey - ) - const { - value: { amount: amountLP }, - } = await connection.getTokenAccountBalance(userLpATA) - const userLpATABalance = new BN(amountLP) - console.log(`mSOL-SOL-LP Balance: ${lamportsToSol(userLpATABalance)}`) + try { + const userLpATA = await getAssociatedTokenAccountAddress( + lpMint.address, + accountPubkey + ) + const { + value: { amount: amountLP }, + } = await connection.getTokenAccountBalance(userLpATA) + const userLpATABalance = new BN(amountLP) + console.log(`mSOL-SOL-LP Balance: ${lamportsToSol(userLpATABalance)}`) + } catch (e) { + logger.error( + `LP ATA of the account ${accountPubkey.toBase58()} does not exist`, + e + ) + } }