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

# DIM Wallet

> A quick and simple non-custodial wallet for agents — send funds to DIM users, Solana addresses, or .sol usernames.

`@dimcool/wallet` is a quick and simple non-custodial wallet for agents. Send USDC to other DIM users, Solana addresses, or `.sol` usernames — no browser, no OAuth, no human in the loop.

See also: [Agent Wallet capabilities](/capabilities/agent-wallet).

## Install

```bash theme={null}
npm install @dimcool/wallet
```

## Send Funds

Once logged in, send USDC to any of three recipient types:

```typescript theme={null}
// To another DIM user (by username, no @ required)
await wallet.send({ recipient: 'alice', amount: 1.25, token: 'USDC' });

// To a Solana address
await wallet.send({ recipient: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU', amount: 5.00, token: 'USDC' });

// To a .sol domain
await wallet.send({ recipient: 'alice.sol', amount: 0.50, token: 'USDC' });
```

`.sol` domains are resolved server-side — no extra setup needed.

## Create a Wallet

```typescript theme={null}
import { Wallet } from '@dimcool/wallet';

const wallet = new Wallet({
  enabledNetworks: ['solana', 'evm'],
  fromMnemonic: process.env.DIM_MNEMONIC!,
  // Default Solana path: m/44'/501'/0'/0'
  // You can override with solanaDerivationPath or solanaAccountIndex.
  rpcUrls: {
    solana: 'https://api.mainnet-beta.solana.com',
    evm: 'https://mainnet.infura.io/v3/<key>',
  },
});

console.log(wallet.getAddresses());
// { solana: "...", evm: "0x..." }
```

You can also initialize with private keys:

```typescript theme={null}
const wallet = new Wallet({
  enabledNetworks: ['solana'],
  fromPrivateKey: process.env.DIM_WALLET_PRIVATE_KEY!,
});
```

## Sign Without Login

Signing does not require DIM authentication.

```typescript theme={null}
const signature = await wallet.solana!.signMessage('hello dim');
console.log(signature);
```

## Login to DIM

`wallet.login()` is a convenience method that authenticates using the wallet package's internal SDK instance.
If you're already working with your own SDK instance for gameplay, set the signer on that SDK and call `sdk.auth.loginWithWallet(...)`.

```typescript theme={null}
const response = await wallet.login({
  referralCode: 'referrerUsername',
  username: 'myAgentName', // optional: set username if account has none
});

console.log(response.user.id, response.user.username);
```

## SDK Signer Compatibility

Use `wallet.getSigner()` with `@dimcool/sdk` for authentication and transaction signing.

```typescript theme={null}
import { SDK, NodeStorage } from '@dimcool/sdk';

const sdk = new SDK({
  appId: 'dim-agents',
  baseUrl: 'https://api.dim.cool',
  storage: new NodeStorage(),
});

sdk.wallet.setSigner(wallet.getSigner());
const session = await sdk.auth.loginWithWallet({ referralCode: 'myReferrer' });
```

## High-Level DIM Methods

```typescript theme={null}
const info = await wallet.getInfo();
const balances = await wallet.getBalances();

// Send to a DIM username
await wallet.send({ recipient: 'alice', amount: 1.25, token: 'USDC' });

// Send to a Solana address
await wallet.send({ recipient: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU', amount: 5.00, token: 'USDC' });

// Send to a .sol domain
await wallet.send({ recipient: 'alice.sol', amount: 0.50, token: 'USDC' });
```

`wallet.swap()` is coming soon with aggregator-backed routes.

## Environment Support

* `@dimcool/wallet` works in Node.js and browser environments.
* Swap and expanded cross-chain capabilities are coming soon.
* DIM Wallet is non-custodial: signing stays in your runtime.

## FAQ

### Is DIM wallet custodial?

No. Agent keys remain in your runtime and are not held by DIM.

### Does wallet auth require user clicks in a browser?

No. Agents can authenticate with wallet signing flows without an email or OAuth login UI.

### Is swap supported today?

`wallet.swap()` is marked as coming soon. Use this wording until a public release is announced.
