Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/commands/KeysCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class KeysCommand {
);
const keychainFiles = files.filter((f) => f.endsWith(".keychain.json"));

const keypairData = await Promise.all(
const keypairResults = await Promise.allSettled(
keypairFiles.map(async (file) => {
const name = file.replace(".json", "");
const signer = await Signer.load(name);
Expand All @@ -139,6 +139,17 @@ export class KeysCommand {
})
);

const keypairData = keypairResults
.map((result, index) => {
if (result.status === "fulfilled") {
return result.value;
}
const name = keypairFiles[index]?.replace(".json", "") ?? "unknown";
console.warn(`Warning: Failed to load keypair "${name}": ${result.reason}`);
return null;
})
.filter((item): item is NonNullable<typeof item> => item !== null);

const keychainData = keychainFiles.map((file) => {
const name = file.replace(".keychain.json", "");
const config = KeychainConfig.load(name);
Expand Down
6 changes: 6 additions & 0 deletions src/commands/PerpsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ export class PerpsCommand {
if (opts.leverage && opts.size) {
throw new Error("Only one of --leverage or --size can be provided.");
}
if (opts.leverage) {
const lev = Number(opts.leverage);
if (isNaN(lev) || lev < 1 || lev > 100) {
throw new Error("Leverage must be a number between 1 and 100.");
}
}
if (opts.limit && (opts.tp || opts.sl)) {
throw new Error(
"--limit cannot be combined with --tp or --sl. Use 'perps set' after the limit order fills."
Expand Down
14 changes: 14 additions & 0 deletions src/commands/SpotCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,20 @@ export class SpotCommand {
}
const info = tokenMap.get(mint);
if (!info) {
console.warn(`Warning: Token metadata not found for mint ${mint}. Displaying with limited info.`);
outputTokens.push({
id: mint,
symbol: mint.slice(0, 8) + '...',
decimals: 0,
amount: Number(ata.amount),
rawAmount: ata.amount,
value: 0,
price: 0,
priceChange: 0,
isVerified: false,
scaledUiMultiplier: 1,
reclaimableLamports: ata.reclaimableLamports,
});
continue;
}
const multiplier = Swap.getScaledUiMultiplier(info);
Expand Down