Skip to content
Merged
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
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { registerContracts } from "./lib/contracts";
import { registerDev } from "./lib/dev";
import { registerInstances } from "./lib/instances";
import { registerLogin } from "./lib/login";
import { registerOrders } from "./lib/orders";
import { registerSell } from "./lib/sell";
import { registerSSH } from "./lib/ssh";
import { registerUpgrade } from "./lib/upgrade";
import { registerOrders } from "./lib/orders";

const program = new Command();

Expand Down
6 changes: 2 additions & 4 deletions src/lib/buy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async function placeBuyOrder(props: PlaceBuyOrderArguments) {
return logLoginMessageAndQuit();
}

const orderQuantity = quantity ?? 1;
const orderQuantity = quantity ? Number(quantity) : 1;
const durationMs = parseDuration(duration);
if (!durationMs) {
return logAndQuit("Invalid duration");
Expand Down Expand Up @@ -133,8 +133,6 @@ async function placeBuyOrder(props: PlaceBuyOrderArguments) {
}
}

console.log(`\n${c.green("Order placed successfully")}`);

const response = await fetch(await getApiUrl("orders_create"), {
method: "POST",
body: JSON.stringify(params),
Expand All @@ -150,5 +148,5 @@ async function placeBuyOrder(props: PlaceBuyOrderArguments) {
}

const data = (await response.json()) as PostOrderResponse;
console.log("Order placed");
console.log(`\n${c.green("Order placed successfully")}`);
}
2 changes: 1 addition & 1 deletion src/lib/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Table from "cli-table3";
import { Command } from "commander";
import { loadConfig } from "../helpers/config";
import { logLoginMessageAndQuit } from "../helpers/errors";
import { getApiUrl } from "../helpers/urls";
import Table from "cli-table3";

interface Contract {
object: string;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/orders.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Table from "cli-table3";
import type { Command } from "commander";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import relativeTime from "dayjs/plugin/relativeTime";
import { loadConfig } from "../helpers/config";
import { logAndQuit, logLoginMessageAndQuit } from "../helpers/errors";
import { getApiUrl } from "../helpers/urls";
import { loadConfig } from "../helpers/config";
import type { ListResponseBody, Order } from "./types";
import type { Command } from "commander";
import Table from "cli-table3";

const usdFormatter = new Intl.NumberFormat("en-US", {
style: "currency",
Expand Down