@signet-base/cli 0.3.1 → 0.3.3
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 +38 -7
- package/bin/signet.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Signet CLI
|
|
2
2
|
|
|
3
|
-
Command-line tool for [Signet](https://signet.sebayaki.com) onchain advertising.
|
|
3
|
+
Command-line tool for [Signet](https://signet.sebayaki.com) — onchain advertising on Base (Hunt Town Co-op).
|
|
4
|
+
|
|
5
|
+
AI agents and humans can pay USDC to place URLs on the Signet spotlight via the [x402 payment protocol](https://www.x402.org).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @signet-base/cli
|
|
11
|
+
# or use directly with npx
|
|
12
|
+
npx @signet-base/cli
|
|
13
|
+
```
|
|
4
14
|
|
|
5
15
|
## Usage
|
|
6
16
|
|
|
@@ -13,9 +23,11 @@ npx @signet-base/cli list -n 10
|
|
|
13
23
|
npx @signet-base/cli estimate
|
|
14
24
|
npx @signet-base/cli estimate --hours 6
|
|
15
25
|
|
|
16
|
-
# Post a URL to spotlight (
|
|
17
|
-
npx @signet-base/cli post --url https://example.com --hours 0
|
|
18
|
-
|
|
26
|
+
# Post a URL to spotlight (simulate first)
|
|
27
|
+
npx @signet-base/cli post --url https://example.com --hours 0 --simulate
|
|
28
|
+
|
|
29
|
+
# Post for real (requires funded wallet with USDC + ETH on Base)
|
|
30
|
+
PRIVATE_KEY=0x... npx @signet-base/cli post --url https://example.com --hours 0
|
|
19
31
|
```
|
|
20
32
|
|
|
21
33
|
## Environment Variables
|
|
@@ -23,9 +35,28 @@ npx @signet-base/cli post --url https://example.com --private-key 0x...
|
|
|
23
35
|
| Variable | Description |
|
|
24
36
|
|----------|-------------|
|
|
25
37
|
| `PRIVATE_KEY` | Wallet private key for posting (alternative to `--private-key`) |
|
|
38
|
+
| `SIGNET_API_URL` | Custom API URL (default: `https://signet.sebayaki.com`) |
|
|
26
39
|
|
|
27
40
|
## How It Works
|
|
28
41
|
|
|
29
|
-
1. **`list`** —
|
|
30
|
-
2. **`estimate`** — Queries the estimated USDC cost
|
|
31
|
-
3. **`post`** — Uses
|
|
42
|
+
1. **`list`** — Reads recent signatures directly from the Signet contract on Base
|
|
43
|
+
2. **`estimate`** — Queries the ZapV2 contract for estimated USDC cost (includes 5% buffer)
|
|
44
|
+
3. **`post`** — Uses x402 to pay USDC and place a URL on the spotlight:
|
|
45
|
+
- Fetches price estimate from chain
|
|
46
|
+
- Sends POST to get 402 Payment Required response
|
|
47
|
+
- Signs EIP-3009 `transferWithAuthorization` for USDC
|
|
48
|
+
- Submits with payment header → server settles + executes Zap on-chain
|
|
49
|
+
|
|
50
|
+
## Example Transaction
|
|
51
|
+
|
|
52
|
+
First x402-powered spotlight placement on Base mainnet:
|
|
53
|
+
|
|
54
|
+
- **TX**: [`0x7d5cb81b...`](https://basescan.org/tx/0x7d5cb81b3f9de246bfbc1e689b74ae244d689380227110dc430d984969e14485)
|
|
55
|
+
- **Cost**: $12.29 USDC
|
|
56
|
+
- **Block**: 41917202
|
|
57
|
+
|
|
58
|
+
## Links
|
|
59
|
+
|
|
60
|
+
- [Signet](https://signet.sebayaki.com)
|
|
61
|
+
- [Hunt Town Docs](https://docs.hunt.town)
|
|
62
|
+
- [x402 Protocol](https://www.x402.org)
|
package/bin/signet.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { dirname, join } from "path";
|
|
2
5
|
import { program } from "commander";
|
|
3
6
|
import { list } from "../src/commands/list.js";
|
|
4
7
|
import { post } from "../src/commands/post.js";
|
|
5
8
|
import { estimate } from "../src/commands/estimate.js";
|
|
6
9
|
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
12
|
+
|
|
7
13
|
program
|
|
8
14
|
.name("signet")
|
|
9
15
|
.description("Signet — onchain advertising CLI")
|
|
10
|
-
.version(
|
|
16
|
+
.version(pkg.version);
|
|
11
17
|
|
|
12
18
|
program
|
|
13
19
|
.command("list")
|