41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* XO Wallet CLI - Terminal User Interface for XO crypto wallet.
|
|
*
|
|
* Features:
|
|
* 1. View wallet state and balance
|
|
* 2. Create invitations for P2PKH transactions
|
|
* 3. Import and accept invitations
|
|
* 4. Sign and broadcast transactions
|
|
* 5. Real-time updates via SSE
|
|
*/
|
|
|
|
import { join } from "node:path";
|
|
|
|
import { App } from "./app.js";
|
|
import { getDataDir } from "./utils/paths.js";
|
|
|
|
/**
|
|
* Main entry point.
|
|
*/
|
|
async function main(): Promise<void> {
|
|
try {
|
|
const dataDir = getDataDir();
|
|
// Create and start the application
|
|
await App.create({
|
|
syncServerUrl: process.env["SYNC_SERVER_URL"] ?? "http://localhost:3000",
|
|
databasePath: process.env["DB_PATH"] ?? dataDir,
|
|
databaseFilename: process.env["DB_FILENAME"] ?? "xo-wallet.db",
|
|
invitationStoragePath:
|
|
process.env["INVITATION_STORAGE_PATH"] ??
|
|
join(dataDir, "xo-invitations.db"),
|
|
});
|
|
} catch (error) {
|
|
console.error("Failed to start XO Wallet CLI:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the application
|
|
main();
|