Wallet

Examples of using different wallet connectors.

Local EOA Wallet

Use a private key for signing:

import { createAgent } from '@regent/core';
import { http } from '@regent/http';
import { wallets } from '@regent/wallet';

const agent = await createAgent({
  name: 'wallet-agent',
  version: '1.0.0',
})
  .use(http())
  .use(wallets({
    config: {
      agent: {
        type: 'local',
        privateKey: process.env.AGENT_WALLET_PRIVATE_KEY!,
      },
      developer: {
        type: 'local',
        privateKey: process.env.DEVELOPER_WALLET_PRIVATE_KEY!,
      },
    },
  }))
  .build();

// Access wallets
const agentAddress = await agent.wallets.agent?.connector.getAddress();
console.log('Agent wallet:', agentAddress);

From Environment Variables

Environment variables:

Thirdweb Engine Wallet

Use thirdweb Engine for managed wallets:

Environment config:

Server-Orchestrated Wallet (Regent)

Use a server-orchestrated wallet:

Environment config:

Challenge Signing

Sign authentication challenges:

EIP-712 Typed Data Signing

Custom Wallet Connector

Bring your own wallet:

Wallet Capabilities

Check what a wallet can do:

Get Wallet Metadata

With Viem

Use viem for advanced wallet operations:

Complete Example

Last updated