@web42/w42 0.1.19 → 0.1.20
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.
- package/README.md +1 -17
- package/dist/commands/pay.js +1 -42
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,23 +95,7 @@ web42 register https://my-agent.example.com --visibility private --tags "nlp,sum
|
|
|
95
95
|
|
|
96
96
|
### `web42 pay`
|
|
97
97
|
|
|
98
|
-
AP2 payment commands —
|
|
99
|
-
|
|
100
|
-
#### `web42 pay wallet`
|
|
101
|
-
|
|
102
|
-
View your wallet balance.
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
web42 pay wallet
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
#### `web42 pay wallet topup <amount>`
|
|
109
|
-
|
|
110
|
-
Add funds to your wallet. Amount is in dollars.
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
web42 pay wallet topup 50.00
|
|
114
|
-
```
|
|
98
|
+
AP2 payment commands — intents, checkout, and human signing.
|
|
115
99
|
|
|
116
100
|
#### `web42 pay intent propose`
|
|
117
101
|
|
package/dist/commands/pay.js
CHANGED
|
@@ -4,46 +4,6 @@ import ora from "ora";
|
|
|
4
4
|
import { apiGet, apiPost } from "../utils/api.js";
|
|
5
5
|
import { requireAuth, setConfigValue, } from "../utils/config.js";
|
|
6
6
|
import { getTx, listTxs, updateTx } from "../utils/tx-store.js";
|
|
7
|
-
// ─── Wallet ───────────────────────────────────────────────
|
|
8
|
-
const walletCommand = new Command("wallet")
|
|
9
|
-
.description("View or top up your wallet balance")
|
|
10
|
-
.action(async () => {
|
|
11
|
-
requireAuth();
|
|
12
|
-
const spinner = ora("Fetching wallet...").start();
|
|
13
|
-
try {
|
|
14
|
-
const res = await apiGet("/api/pay/wallet");
|
|
15
|
-
spinner.stop();
|
|
16
|
-
console.log(JSON.stringify(res, null, 2));
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
spinner.fail("Failed to fetch wallet");
|
|
20
|
-
console.error(chalk.red(String(err)));
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
walletCommand
|
|
25
|
-
.command("topup")
|
|
26
|
-
.description("Add funds to your wallet")
|
|
27
|
-
.argument("<amount>", "Amount in dollars (e.g. 50.00)")
|
|
28
|
-
.action(async (amountStr) => {
|
|
29
|
-
requireAuth();
|
|
30
|
-
const amountCents = Math.round(parseFloat(amountStr) * 100);
|
|
31
|
-
if (isNaN(amountCents) || amountCents <= 0) {
|
|
32
|
-
console.error(chalk.red("Amount must be a positive number"));
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
const spinner = ora("Topping up wallet...").start();
|
|
36
|
-
try {
|
|
37
|
-
const res = await apiPost("/api/pay/wallet/topup", { amount_cents: amountCents });
|
|
38
|
-
spinner.stop();
|
|
39
|
-
console.log(JSON.stringify(res, null, 2));
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
spinner.fail("Failed to top up wallet");
|
|
43
|
-
console.error(chalk.red(String(err)));
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
7
|
// ─── Intent ───────────────────────────────────────────────
|
|
48
8
|
const intentCommand = new Command("intent").description("Manage payment intents");
|
|
49
9
|
intentCommand
|
|
@@ -293,8 +253,7 @@ const listCommand = new Command("list")
|
|
|
293
253
|
});
|
|
294
254
|
// ─── Root pay command ─────────────────────────────────────
|
|
295
255
|
export const payCommand = new Command("pay")
|
|
296
|
-
.description("AP2 payment mandates —
|
|
297
|
-
.addCommand(walletCommand)
|
|
256
|
+
.description("AP2 payment mandates — intents, checkout, signing")
|
|
298
257
|
.addCommand(intentCommand)
|
|
299
258
|
.addCommand(checkoutCommand)
|
|
300
259
|
.addCommand(signCommand)
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.1.
|
|
1
|
+
export declare const CLI_VERSION = "0.1.20";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.1.
|
|
1
|
+
export const CLI_VERSION = "0.1.20";
|