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

# Wallet Operations

> Create wallets, fund them, send payments, check balances, and manage agent status.

## Create an Agent Wallet

Every agent gets its own MPC-secured wallet. Specify the chain and initial policies at creation time.

```typescript TypeScript theme={null}
const agent = await aw.agents.create({
  name: "payment-agent",
  chain: "eip155:8453",  // Base mainnet
  policies: {
    maxTransactionAmount: "500",
    dailyLimit: "5000",
    allowedTokens: ["USDC"],
  },
  metadata: { team: "growth" },
});

console.log(`Agent ID: ${agent.id}`);
console.log(`Wallet address: ${agent.wallet.address}`);
console.log(`Chain: ${agent.wallet.chain}`);
```

```python Python theme={null}
agent = await aw.agents.create(
    name="payment-agent",
    chain="eip155:8453",
    policies={
        "max_transaction_amount": "500",
        "daily_limit": "5000",
        "allowed_tokens": ["USDC"],
    },
    metadata={"team": "growth"},
)

print(f"Agent ID: {agent.id}")
print(f"Wallet address: {agent.wallet.address}")
```

```bash cURL theme={null}
curl -X POST https://api.agentwallex.com/api/v1/agents \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_name": "payment-agent",
    "chain": "eip155:8453",
    "metadata": "{\"team\":\"growth\"}"
  }'
```

## Fund the Wallet

Send tokens to the agent's wallet address. The wallet address is a standard on-chain address that can receive tokens from any source.

> [!NOTE]
>
> In sandbox mode (`eip155:84532`), use a testnet faucet to get test tokens. No real funds are needed.

For x402 operations, you can also deposit via the balance endpoint:

```bash theme={null}
curl -X POST https://api.agentwallex.com/api/v1/x402/balances/deposit-address \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_abc123", "chain": "eip155:8453"}'
```

## Send a Payment

Execute an on-chain payment through the agent. The transaction passes through the policy engine and MPC signing before broadcast.

```typescript TypeScript theme={null}
const tx = await aw.payments.send({
  agentId: "agent_abc123",
  to: "0xRecipientAddress",
  amount: "50.00",
  token: "USDC",
  memo: "Payment for API access",
});

console.log(`Transaction ID: ${tx.id}`);
console.log(`Hash: ${tx.hash}`);
console.log(`Status: ${tx.status}`);   // "pending" -> "confirmed"
console.log(`Fee: ${tx.fee}`);         // Network gas fee
```

```python Python theme={null}
tx = await aw.payments.send(
    agent_id="agent_abc123",
    to="0xRecipientAddress",
    amount="50.00",
    token="USDC",
    memo="Payment for API access",
)

print(f"Hash: {tx.hash}")
print(f"Status: {tx.status}")
```

```bash cURL theme={null}
curl -X POST https://api.agentwallex.com/api/v1/transactions \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_abc123",
    "direction": "outbound",
    "type": "transfer",
    "to_address": "0xRecipientAddress",
    "amount": "50.00",
    "token": "USDC",
    "chain": "eip155:8453",
    "memo": "Payment for API access"
  }'
```

## Check Balance

Query the x402 balance for an agent:

```bash theme={null}
curl -X GET https://api.agentwallex.com/api/v1/x402/balances \
  -H "X-API-Key: awx_your_api_key"
```

## List Transactions

View transaction history for an agent:

```typescript TypeScript theme={null}
const { transactions } = await aw.payments.list({
  agentId: "agent_abc123",
  limit: 50,
  status: "confirmed",
});

transactions.forEach(tx => {
  console.log(`${tx.amount} ${tx.token} -> ${tx.to} (${tx.status})`);
});
```

```bash cURL theme={null}
curl -X GET "https://api.agentwallex.com/api/v1/transactions?agent_id=agent_abc123&status=confirmed&page_size=50" \
  -H "X-API-Key: awx_your_api_key"
```

## Freeze and Unfreeze

Instantly stop all transactions for an agent. Useful for emergencies or scheduled maintenance.

### Freeze

```typescript TypeScript theme={null}
await aw.agents.freeze("agent_abc123");
// All transactions are now blocked
```

```bash cURL theme={null}
curl -X PUT https://api.agentwallex.com/api/v1/agents/agent_abc123/status \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"status": "inactive"}'
```

### Unfreeze

```typescript TypeScript theme={null}
// Subject to 10-minute cool-down after freeze
await aw.agents.unfreeze("agent_abc123");
```

```bash cURL theme={null}
curl -X PUT https://api.agentwallex.com/api/v1/agents/agent_abc123/status \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"status": "active"}'
```

> [!WARNING]
>
> There is a mandatory 10-minute cool-down period after freezing before you can unfreeze. Attempting to unfreeze earlier will return an error.

## Delete an Agent

Permanently delete an agent and its wallet. This action is irreversible.

```bash theme={null}
curl -X DELETE https://api.agentwallex.com/api/v1/agents/agent_abc123 \
  -H "X-API-Key: awx_your_api_key"
```

> [!WARNING]
>
> Ensure the wallet balance is zero before deleting. Any remaining funds will be inaccessible after deletion.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.