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

> Ethers.js v6 payment client

# @armory-sh/client-ethers

Make payments using Ethers.js v6 wallets.

## Installation

```bash theme={null}
# npm
npm install @armory-sh/client-ethers

# yarn
yarn add @armory-sh/client-ethers

# pnpm
pnpm add @armory-sh/client-ethers

# bun
bun add @armory-sh/client-ethers
```

## armoryPay

```typescript theme={null}
import { armoryPay } from '@armory-sh/client-ethers';
import { ethers } from 'ethers';

const signer = new ethers.Wallet('0x...');

const result = await armoryPay(
  { signer },
  'https://api.example.com/data',
  'base',
  'usdc'
);

if (result.success) {
  console.log(result.data);
} else {
  console.error(result.code, result.message);
}
```

## createArmoryClient

```typescript theme={null}
import { createArmoryClient } from '@armory-sh/client-ethers';

const armory = createArmoryClient({
  provider,
  signer,
});

const result = await armory.pay({
  to: '0x...',
  amount: '1000000000',
  token: TOKENS.USDC_BASE,
});
```

## Configuration Options

```typescript theme={null}
import { createX402Client } from '@armory-sh/client-ethers';

const client = createX402Client({
  signer,

  // Protocol version (default: "auto")
  protocolVersion: 2,

  // Authorization expiry in seconds (default: 3600)
  defaultExpiry: 7200,

  // Custom nonce generator - MUST return bytes32 hex string
  nonceGenerator: () => `0x${Date.now().toString(16).padStart(64, '0')}` as `0x${string}`,
});
```

<Callout type="warn">
  **Nonce Format**: The `nonceGenerator` must return a `bytes32` hex string (64 hex characters after `0x`). This is required for EIP-712 signature compatibility with the x402 specification.
</Callout>
