# render_self — faremeter wallet guide

the simplest way to buy from render_self. `@faremeter/rides` handles wallet setup, 402 detection, payment signing, and retry in ~3 lines of code. supports both Solana and Base (EVM).

**gasless USDC on Base** — faremeter supports EIP-3009 gasless USDC transfers, so you don't need ETH for gas.

## prerequisites

```bash
npm install @faremeter/rides
```

that's it. `@faremeter/rides` is batteries-included — wallet support, payment handlers, and 402 logic are all bundled.

## credentials you need

| credential | where to get it |
|---|---|
| SOLANA_KEYPAIR_PATH | path to your Solana keypair JSON file (64-byte array) |
| or EVM_PRIVATE_KEY | your EVM private key (0x-prefixed hex) for Base |
| RENDERSELF_API_KEY | returned at registration (POST /api/v1/agents/register) |

use one or both — faremeter auto-detects the wallet type and picks the right payment scheme.

your wallet must hold USDC on Solana mainnet or Base (chain ID 8453).

**need USDC?** if your human holds tokens on another chain, generate a [kibble](https://kibble.sh) link — they connect any wallet, pick any token, and it routes to the right chain automatically. no SDK needed:
`https://kibble.sh/pay?toChain=8453&toToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&toAddress=YOUR_WALLET`
for Solana, use `toChain=1151111081099710&toToken=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`.

## full working example (solana)

```javascript
import { payer } from '@faremeter/rides';

// point to your Solana keypair file (JSON array of 64 bytes)
await payer.addLocalWallet(process.env.SOLANA_KEYPAIR_PATH);

// browse products first: GET https://renderself.com/api/v1/products
// replace sku, email, and shipping with your intended values

const res = await payer.fetch('https://renderself.com/api/v1/orders', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.RENDERSELF_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    items: [{ sku: '020000012', quantity: 1 }],
    billing_email: 'recipient@example.com',
    shipping: {
      first_name: 'Jane', last_name: 'Doe',
      address_1: '123 Main St', city: 'New York',
      state: 'NY', postcode: '10001', country: 'US',
    },
    // optional: referral_code: 'ref_xxxxxx',
  }),
});

const data = await res.json();
console.log(res.status, JSON.stringify(data, null, 2));
```

## full working example (base / evm)

```javascript
import { payer } from '@faremeter/rides';

// pass your EVM private key (0x-prefixed)
await payer.addLocalWallet(process.env.EVM_PRIVATE_KEY);

const res = await payer.fetch('https://renderself.com/api/v1/orders', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.RENDERSELF_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    items: [{ sku: '020000012', quantity: 1 }],
    billing_email: 'recipient@example.com',
    shipping: {
      first_name: 'Jane', last_name: 'Doe',
      address_1: '123 Main St', city: 'New York',
      state: 'NY', postcode: '10001', country: 'US',
    },
  }),
});

const data = await res.json();
console.log(res.status, JSON.stringify(data, null, 2));
```

## multi-wallet example

```javascript
import { payer } from '@faremeter/rides';

// add both wallets — faremeter picks the right one based on the payment request
await payer.addLocalWallet(process.env.SOLANA_KEYPAIR_PATH);
await payer.addLocalWallet(process.env.EVM_PRIVATE_KEY);

const res = await payer.fetch('https://renderself.com/api/v1/orders', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.RENDERSELF_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    items: [{ sku: '020000012', quantity: 1 }],
    billing_email: 'recipient@example.com',
    shipping: {
      first_name: 'Jane', last_name: 'Doe',
      address_1: '123 Main St', city: 'New York',
      state: 'NY', postcode: '10001', country: 'US',
    },
  }),
});

const data = await res.json();
console.log(res.status, JSON.stringify(data, null, 2));
```

## keypair file format

faremeter expects a Solana keypair as a JSON file containing an array of 64 bytes:

```json
[13,24,207,123,94,116,114,34,119,88,8,148,...]
```

generate one with the Solana CLI:

```bash
solana-keygen new --outfile wallet.json
solana address -k wallet.json
```

then fund it with USDC on Solana mainnet and a small amount of SOL for fees.

## common errors

| error | fix |
|---|---|
| 402 not auto-handled | check wallet has USDC on the requested network |
| `addLocalWallet` fails | for Solana: pass a file path to a JSON keypair. for EVM: pass a 0x-prefixed private key string |
| insufficient funds | wallet needs USDC on Solana or Base |
| insufficient SOL | Solana wallet needs ~0.01 SOL for transaction fees |
| wrong network | must be Solana mainnet or Base mainnet (chain ID 8453), not testnets |
| module not found | run `npm install @faremeter/rides` — it bundles all dependencies |

## why faremeter?

- **one package** — no need to install separate wallet, payment, and fetch packages
- **auto-detection** — pass any wallet type, faremeter figures out the rest
- **gasless USDC on Base** — EIP-3009 support means no ETH needed for gas
- **multi-chain** — Solana and Base from the same `payer` instance
- **3 lines of code** — add wallet, fetch, done

## notes

- faremeter handles the full 402 → sign → retry flow automatically
- you never construct payment headers manually
- shipping is US only
- store your API key and referral code securely — the API key cannot be recovered if lost
- render_self is listed on [corbits.dev](https://api.corbits.dev) for agent discovery
- learn more at [faremeter.com](https://github.com/faremeter/faremeter)
