Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Query blockchain data from The Graph Network's decentralized indexers.

## Environments

| Environment | Base URL |
|-------------|----------|
| Mainnet | `https://gateway.thegraph.com` |
| Testnet | `https://testnet.gateway.thegraph.com` |
| Environment | Base URL | x402 Payment Network |
|-------------|----------|---------------------|
| Mainnet | `https://gateway.thegraph.com` | Base |
| Testnet | `https://testnet.gateway.thegraph.com` | Base Sepolia |

## Authentication

Expand All @@ -25,7 +25,7 @@ Get an API key from [Subgraph Studio](https://thegraph.com/studio) and include i

### Option 2: x402 Payment (best for agents)

Pay per query with USDC. No API key required.
Pay per query with USDC on Base. No API key required. The x402 protocol handles payment negotiation automatically.

**Endpoints:**
- `POST /api/x402/subgraphs/id/{subgraph_id}`
Expand All @@ -44,24 +44,24 @@ curl -X POST https://gateway.thegraph.com/api/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6

### With x402 Payment

Any x402 tooling that supports exact scheme will work with the gateway's x402 endpoints. We recommend to use the official Graph x402 client:
Any x402 tooling that supports exact scheme will work with the gateway's x402 endpoints. We recommend the official Graph x402 client.

```bash
npm install @graphprotocol/client-x402
```

**Option A: Command Line**
**Option A: Command Line (no install required)**

```bash
export X402_PRIVATE_KEY=0xabc123...

npx graphclient-x402 "{ pairs(first: 5) { id } }" \
npx @graphprotocol/client-x402 "{ pairs(first: 5) { id } }" \
--endpoint https://gateway.thegraph.com/api/x402/subgraphs/id/<SUBGRAPH_ID> \
--chain base
```

**Option B: Programmatic**

```bash
npm install @graphprotocol/client-x402
```

```typescript
import { createGraphQuery } from '@graphprotocol/client-x402'

Expand Down Expand Up @@ -109,5 +109,5 @@ const result = await execute(GetPairsDocument, { first: 5 })
```

**Environment Variables:**
- `X402_PRIVATE_KEY`: Wallet private key for payment signing
- `X402_CHAIN`: `base` (mainnet) or `base-sepolia` (testnet)
- `X402_PRIVATE_KEY` (required): Wallet private key for payment signing
- `X402_CHAIN` (optional): `base` (mainnet, default) or `base-sepolia` (testnet)
Loading