@subly_fi/pay 0.1.0
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 +54 -0
- package/dist/cli.js +26 -0
- package/dist/deposit.js +1216 -0
- package/dist/mcp-server.js +1916 -0
- package/dist/pay.js +1769 -0
- package/dist/withdraw.js +1157 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @subly_fi/pay
|
|
2
|
+
|
|
3
|
+
Subly client for [x402](https://x402.org)-style HTTP payments funded by
|
|
4
|
+
**Kamino vault yield** — your agent pays for paywalled APIs from the yield on
|
|
5
|
+
deposited USDC, and the principal is never spent. Non-custodial: it signs
|
|
6
|
+
locally with your own Solana key; Subly never holds it.
|
|
7
|
+
|
|
8
|
+
Ships one `pay` dispatcher bin with subcommands, all runnable with `npx` (no clone):
|
|
9
|
+
|
|
10
|
+
- `pay mcp` — an MCP server (Claude Code, Cursor, any MCP client)
|
|
11
|
+
- `pay fetch <url>` — one-shot: pay for a URL, print the receipt (used by the
|
|
12
|
+
OpenClaw skill)
|
|
13
|
+
- `pay deposit <amountRawUsdc>` / `pay withdraw <amountRawUsdc>` — vault
|
|
14
|
+
deposit / withdraw
|
|
15
|
+
|
|
16
|
+
## Wallet
|
|
17
|
+
|
|
18
|
+
Subly does not create wallets — bring your own Solana keypair:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
solana-keygen new --no-bip39-passphrase -o ~/.subly/agent.json
|
|
22
|
+
export SUBLY_DEMO_AGENT_KEYPAIR_PATH=~/.subly/agent.json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Send USDC (Solana mainnet) to the printed address — no SOL needed, fees are
|
|
26
|
+
sponsored — then deposit (vault minimum 1 USDC; deposit self-registers the
|
|
27
|
+
wallet):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx -y @subly_fi/pay deposit 1000000 # 1 USDC
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Use it
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Claude Code (no clone):
|
|
37
|
+
claude mcp add subly -- npx -y @subly_fi/pay mcp
|
|
38
|
+
|
|
39
|
+
# One-shot pay (also what the OpenClaw skill calls):
|
|
40
|
+
npx -y @subly_fi/pay fetch https://seller.example.com/api/premium
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Environment
|
|
44
|
+
|
|
45
|
+
| Var | Required | Default |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| `SUBLY_DEMO_AGENT_KEYPAIR_PATH` | yes (or `SUBLY_DEMO_AGENT_KEYPAIR` base58) | — |
|
|
48
|
+
| `SUBLY_FACILITATOR_URL` | no | `https://api.demo.sublyfi.com` |
|
|
49
|
+
| `SOLANA_RPC_URL` | no | public mainnet RPC |
|
|
50
|
+
| `SUBLY_MCP_MAX_AMOUNT_RAW_USDC` | no | `10000` (0.01 USDC) per-payment cap |
|
|
51
|
+
|
|
52
|
+
Requests authenticate with a signature from your wallet key — there is no API
|
|
53
|
+
token. The cap and the facilitator's yield-budget check both bound spending;
|
|
54
|
+
the principal is never touched.
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Single dispatcher bin for @sublyfi/pay so `npx -y @sublyfi/pay <subcommand>`
|
|
3
|
+
// resolves cleanly. Subcommands map to the bundled entry points; argv is
|
|
4
|
+
// reshaped so each entry sees its own positional args at the usual index.
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const TARGETS = {
|
|
9
|
+
mcp: "mcp-server.js",
|
|
10
|
+
fetch: "pay.js",
|
|
11
|
+
deposit: "deposit.js",
|
|
12
|
+
withdraw: "withdraw.js"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const [sub, ...rest] = process.argv.slice(2);
|
|
16
|
+
const target = sub === undefined ? undefined : TARGETS[sub];
|
|
17
|
+
if (target === undefined) {
|
|
18
|
+
console.error(
|
|
19
|
+
"usage: subly <mcp|fetch <url>|deposit <amountRawUsdc>|withdraw <amountRawUsdc>>"
|
|
20
|
+
);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
process.argv = [process.argv[0], join(here, target), ...rest];
|
|
26
|
+
await import(`./${target}`);
|