> ## Documentation Index
> Fetch the complete documentation index at: https://docs.faremeter.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Wallet Configuration

> Setup guides for each wallet adapter in faremeter.

Each wallet adapter follows the same pattern: install, create, pass to a handler. This page covers setup for every supported wallet type.

## OWS (Open Wallet Standard)

For vault-backed signing on Solana and EVM. Private keys are encrypted at rest in the OWS vault and never exposed to your application.

```bash theme={null}
pnpm add @faremeter/wallet-ows @open-wallet-standard/core
```

First, import a key into the OWS vault (one-time setup):

```typescript theme={null}
import { importWalletPrivateKey } from "@open-wallet-standard/core"

// Import a Solana private key
importWalletPrivateKey("my-solana-wallet", privateKeyHex, "my-passphrase", undefined, "solana")

// Import an EVM private key
importWalletPrivateKey("my-evm-wallet", privateKeyHex, "my-passphrase", undefined, "eip155")
```

Then create wallets backed by the vault:

```typescript theme={null}
// Solana
import { createOWSSolanaWallet } from "@faremeter/wallet-ows"

const wallet = createOWSSolanaWallet("devnet", {
  walletNameOrId: "my-solana-wallet",
  passphrase: "my-passphrase",
})
```

```typescript theme={null}
// EVM
import { createOWSEvmWallet } from "@faremeter/wallet-ows"

const wallet = createOWSEvmWallet(
  { id: 84532, name: "Base Sepolia" },
  {
    walletNameOrId: "my-evm-wallet",
    passphrase: "my-passphrase",
  },
)
```

The `walletNameOrId` identifies the wallet in the vault. The `passphrase` unlocks it for each signing operation. You can optionally pass a `vaultPath` in the options to use a custom vault directory.

### Using OWS with Rides

OWS wallets work with `@faremeter/rides` via `addWalletAdapter`. See the [Rides SDK](/client/rides-sdk#addwalletadapter) docs for a complete example.

### Cleaning up

To remove a wallet from the vault:

```typescript theme={null}
import { deleteWallet } from "@open-wallet-standard/core"

deleteWallet("my-solana-wallet")
```

## Solana local keypair

For local development and server-side agents.

```bash theme={null}
pnpm add @faremeter/wallet-solana @solana/web3.js
```

```typescript theme={null}
import { Keypair } from "@solana/web3.js"
import { createLocalWallet } from "@faremeter/wallet-solana"
import { readFileSync } from "node:fs"

const keypairBytes = JSON.parse(readFileSync("~/.config/solana/id.json", "utf-8"))
const keypair = Keypair.fromSecretKey(new Uint8Array(keypairBytes))
const wallet = await createLocalWallet("devnet", keypair)
```

The `network` parameter (`"devnet"`, `"testnet"`, `"mainnet-beta"`) determines which Solana cluster the wallet targets.

If the keypair file does not exist or contains invalid data, `createLocalWallet` throws with a descriptive error.

## EVM private key

For local development and server-side agents.

```bash theme={null}
pnpm add @faremeter/wallet-evm
```

```typescript theme={null}
import { createLocalWallet } from "@faremeter/wallet-evm"

const wallet = await createLocalWallet(
  { id: 84532, name: "Base Sepolia" },
  process.env.EVM_PRIVATE_KEY,
)
```

The first parameter is a `ChainInfo` object with the chain's numeric ID and name. The private key should be a hex string starting with `0x`. The wallet supports EIP-712 typed signatures used by the EVM payment handler.

If the private key is malformed, the factory throws.

## Crossmint custodial

For managed wallets where you do not handle private keys directly. Crossmint provides a custodial wallet API.

```bash theme={null}
pnpm add @faremeter/wallet-crossmint
```

```typescript theme={null}
import { createCrossmintWallet } from "@faremeter/wallet-crossmint"

const wallet = await createCrossmintWallet(
  "devnet",
  process.env.CROSSMINT_API_KEY,
  process.env.CROSSMINT_WALLET_ADDRESS,
)
```

The first parameter is the Solana network (`"devnet"`, `"testnet"`, `"mainnet-beta"`). Currently supports Solana networks.

## Squads multisig

For DAOs and shared treasuries using Squads Protocol on Solana.

```bash theme={null}
pnpm add @faremeter/wallet-solana-squads
```

```typescript theme={null}
import { Keypair, Connection, PublicKey } from "@solana/web3.js"
import { createSquadsWallet } from "@faremeter/wallet-solana-squads"

const connection = new Connection("https://api.devnet.solana.com")
const keypair = Keypair.fromSecretKey(new Uint8Array(keypairBytes))
const multisigPda = new PublicKey("YOUR_MULTISIG_PDA")
const squadMember = Keypair.fromSecretKey(new Uint8Array(memberBytes))

const wallet = await createSquadsWallet(
  "devnet",
  connection,
  keypair,
  multisigPda,
  squadMember,
)
```

The factory takes five positional arguments: the network name, a Solana `Connection`, the transaction-signing `Keypair`, the multisig PDA address, and the squad member `Keypair`. Squads wallets create proposals that require approval from other multisig members. The payment flow includes a proposal and approval step before the transaction is submitted.

## Ledger hardware

For high-security signing with a Ledger hardware wallet.

```bash theme={null}
pnpm add @faremeter/wallet-ledger
```

```typescript theme={null}
// Solana
import { createLedgerSolanaWallet } from "@faremeter/wallet-ledger"

const wallet = await createLedgerSolanaWallet("devnet", "m/44'/501'/0'/0'")
```

```typescript theme={null}
// EVM
import { createLedgerEvmWallet, selectLedgerAccount } from "@faremeter/wallet-ledger"
import { createReadlineInterface } from "@faremeter/wallet-ledger"

const ui = createReadlineInterface({ stdin: process.stdin, stdout: process.stdout })
const wallet = await createLedgerEvmWallet(
  ui,
  { id: 84532, name: "Base Sepolia" },
  "m/44'/60'/0'/0/0",
)
```

There are separate factory functions for each chain. `createLedgerSolanaWallet` takes a network name and BIP-44 derivation path. `createLedgerEvmWallet` additionally requires a `UserInterface` for interactive account selection (use `createReadlineInterface()` for terminal UIs). You can also use `selectLedgerAccount` to let the user pick from multiple accounts before creating the wallet.

Requires the Ledger device to be connected and unlocked with the appropriate app open. If the device is not available, the factory throws.

## Passing wallets to handlers

All wallets -- including OWS -- follow the same pattern once created:

```typescript theme={null}
import { createPaymentHandler } from "@faremeter/payment-solana/exact"
import { lookupKnownSPLToken } from "@faremeter/info/solana"
import { PublicKey } from "@solana/web3.js"

const splTokenInfo = lookupKnownSPLToken("devnet", "USDC")
if (!splTokenInfo) throw new Error("Unknown SPL token")
const mint = new PublicKey(splTokenInfo.address)
const handler = createPaymentHandler(wallet, mint)
```

The handler uses the wallet to sign payments when a matching 402 requirement is received.

## Further reading

* [Payment Handlers](/client/payment-handlers) -- How to register handlers with the fetch wrapper.
* [Wallets & Signing](/concepts/wallets-and-signing) -- How the wallet adapter pattern works.
