thaifi-wallet-cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ /** `thaifi fund` — show the deposit address and open the web Deposit page. */
2
+ import { loadStore } from "../store.js";
3
+ async function openBrowser(url) {
4
+ const { exec } = await import("node:child_process");
5
+ const cmd = process.platform === "darwin"
6
+ ? `open "${url}"`
7
+ : process.platform === "win32"
8
+ ? `start "" "${url}"`
9
+ : `xdg-open "${url}"`;
10
+ exec(cmd, () => undefined);
11
+ }
12
+ export async function fund(options = {}) {
13
+ const store = loadStore();
14
+ if (!store?.userAddress) {
15
+ console.error("Not paired. Run `thaifi login` first.");
16
+ process.exitCode = 1;
17
+ return;
18
+ }
19
+ console.log("Deposit address (your wallet):");
20
+ console.log(" " + store.userAddress);
21
+ console.log("");
22
+ console.log("Send pathUSD (or any ThaiFi TIP-20 token) to this address");
23
+ console.log("from any ThaiFi wallet.");
24
+ console.log("");
25
+ console.log("Deposit page: " + store.walletUrl + "/deposit");
26
+ console.log("(Bridge USDC from other chains — coming soon)");
27
+ if (options.browser !== false) {
28
+ await openBrowser(store.walletUrl + "/deposit");
29
+ }
30
+ }
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import { balance } from "./commands/balance.js";
8
8
  import { transfer } from "./commands/transfer.js";
9
9
  import { request } from "./commands/request.js";
10
10
  import { services } from "./commands/services.js";
11
+ import { fund } from "./commands/fund.js";
11
12
  const program = new Command();
12
13
  program
13
14
  .name("thaifi")
@@ -38,6 +39,11 @@ program
38
39
  .argument("<amount>", "Amount in human units (e.g. 1.5)")
39
40
  .option("--token <address>", "Token contract (default: pathUSD)")
40
41
  .action(transfer);
42
+ program
43
+ .command("fund")
44
+ .description("Show your deposit address and open the web Deposit page")
45
+ .option("--no-browser", "Print the address without opening a browser")
46
+ .action(fund);
41
47
  program
42
48
  .command("request")
43
49
  .description("HTTP request with automatic x402/MPP payments (curl-like)")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thaifi-wallet-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "ThaiFi Wallet CLI for AI agents — pair with wallet.thaifi.com, sign with on-chain access keys (spending limits enforced on-chain), x402/MPP payments",
5
5
  "type": "module",
6
6
  "bin": {