internet-court/internet-court-skill / vendored/kleros/kleros-ipfs-upload
kleros-ipfs-upload
VerifiedUpload one Kleros-ecosystem file per paid request to IPFS through the Kleros x402 gateway for $0.01 USDC on Base mainnet. Use for dispute evidence, MetaEvidence JSON, court/dispute/arbitrator policies, Curate item metadata, juror justifications, or any artifact a Kleros contract or subgraph will reference by CID. Trigger when the request mentions Kleros, court, arbitrator, dispute, juror, Curate, Proof of Humanity, evidence, meta-evidence, justification, explicitly names this gateway or skill, or asks to test or validate it. Do NOT use for generic IPFS/CID requests without Kleros context; recommend a general-purpose pinning service. Each request accepts exactly one file: different bytes require separate paid uploads, while identical bytes should reuse one CID.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 1.0 KB |
| SKILL.md | skill md | 19.4 KB |
| scripts/package.json | manifest | 218 B |
| scripts/pay-and-upload-cdp.ts | script | 5.0 KB |
| scripts/pay-and-upload.ts | script | 2.4 KB |
scripts/pay-and-upload.ts
View on GitHub/**
* Pay-and-upload a file to IPFS via the Kleros x402 gateway on Base mainnet.
*
* The x402-fetch SDK handles the 402 → sign EIP-3009 → retry-with-X-PAYMENT
* loop transparently. Each successful run spends $0.01 USDC on Base mainnet.
*
* Run standalone:
*
* cd path/to/this-dir
* npm install
* EVM_PRIVATE_KEY=0x... npx tsx pay-and-upload.ts ./somefile.txt
*
* Env vars:
* EVM_PRIVATE_KEY payer's Base mainnet private key (required)
* GATEWAY_URL defaults to https://kleros-ipfs-gateway.fly.dev
* OPERATION free-form tag, defaults to "evidence"
*
* Output: on success, prints each returned IPFS CID on its own line so the
* calling agent can parse them with a one-liner.
*/
import { readFile } from "node:fs/promises";
import { basename } from "node:path";
import { wrapFetchWithPayment, createSigner } from "x402-fetch";
const filePath = process.argv[2];
if (!filePath) {
console.error("Usage: tsx pay-and-upload.ts <file-path>");
process.exit(1);
}
const rawKey = process.env.EVM_PRIVATE_KEY;
if (!rawKey) {
console.error("EVM_PRIVATE_KEY env var is required");
process.exit(1);
}
const privateKey = (
rawKey.startsWith("0x") ? rawKey : `0x${rawKey}`
) as `0x${string}`;
const gatewayUrl =
process.env.GATEWAY_URL ?? "https://kleros-ipfs-gateway.fly.dev";
const operation = process.env.OPERATION ?? "evidence";
const signer = await createSigner("base", privateKey);
const fetchWithPay = wrapFetchWithPayment(fetch, signer);
const form = new FormData();
const bytes = await readFile(filePath);
form.append(
"file",
new Blob([bytes], { type: "application/octet-stream" }),
basename(filePath)
);
const url = `${gatewayUrl}/upload-to-ipfs?operation=${encodeURIComponent(
operation
)}`;
console.error(`POST ${url}`);
const res = await fetchWithPay(url, { method: "POST", body: form });
const text = await res.text();
if (!res.ok) {
console.error(`status: ${res.status}`);
console.error(`body: ${text}`);
process.exit(1);
}
const parsed = JSON.parse(text) as {
message: string;
cids: string[];
urls?: string[];
inconsistentCids?: string[];
};
for (const cid of parsed.cids) console.log(cid);
for (const u of parsed.urls ?? []) console.error(`url=${u}`);
if (parsed.inconsistentCids && parsed.inconsistentCids.length > 0) {
console.error(
`warning: inconsistentCids=${JSON.stringify(parsed.inconsistentCids)}`
);
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |