# Configuration

## WDK Manager Configuration

{% code title="Create WDK Instance" lineNumbers="true" %}

```javascript
import WDK from '@tetherto/wdk'

const wdk = new WDK(seedPhrase)
```

{% endcode %}

The WDK Manager itself only requires a seed phrase for initialization. Configuration is done through the registration of wallets and protocols.

## Wallet Registration Configuration

{% code title="Register WDK Wallet" lineNumbers="true" %}

```javascript
import WDK from '@tetherto/wdk'
import WalletManagerEvm from '@tetherto/wdk-wallet-evm'
import WalletManagerTon from '@tetherto/wdk-wallet-ton'

const wdk = new WDK(seedPhrase)
  .registerWallet('ethereum', WalletManagerEvm, {
    provider: 'https://eth.drpc.org'
  })
  .registerWallet('ton', WalletManagerTon, {
    tonApiKey: 'YOUR_TON_API_KEY',
    tonApiEndpoint: 'https://tonapi.io'
  })
```

{% endcode %}

## Protocol Registration Configuration

{% code title="Register WDK Protocol" lineNumbers="true" %}

```javascript
import veloraProtocolEvm from '@tetherto/wdk-protocol-swap-velora-evm'

const wdk = new WDK(seedPhrase)
  .registerProtocol('ethereum', 'velora', veloraProtocolEvm, {
    apiKey: 'YOUR_velora_API_KEY'
  })
```

{% endcode %}

## Configuration Options

### Wallet Configuration

Each wallet manager requires its own configuration object when registered. The configuration depends on the specific wallet module being used.

#### EVM Wallet Configuration

{% code title="Ethereum WDK Wallet Configuration" lineNumbers="true" %}

```javascript
const ethereumWalletConfig = {
  provider: 'https://eth.drpc.org', // RPC endpoint
  // Additional EVM-specific configuration options
}

wdk.registerWallet('ethereum', WalletManagerEvm, ethereumWalletConfig)
```

{% endcode %}

#### TON Wallet Configuration

{% code title="TON WDK Wallet Configuration" lineNumbers="true" %}

```javascript
const tonWalletConfig = {
  tonClient: {
    secretKey: 'YOUR_TON_API_KEY',
    url: 'https://toncenter.com/api/v2/jsonRPC'
  }
}

wdk.registerWallet('ton', WalletManagerTon, tonWalletConfig)
```

{% endcode %}

### Protocol Configuration

Protocols also require their own configuration objects when registered.

#### Swap Protocol Configuration

{% code title="Swap WDK Protocol Configuration" lineNumbers="true" %}

```javascript
const veloraProtocolConfig = {
  apiKey: 'YOUR_velora_API_KEY',
  baseUrl: 'https://apiv5.velora.io'
}

wdk.registerProtocol('ethereum', 'velora', veloraProtocolEvm, veloraProtocolConfig)
```

{% endcode %}

### Middleware Configuration

Middleware functions can be registered to enhance account functionality.

{% code title="Middleware WDK Protocol Configuration" lineNumbers="true" %}

````javascript
// Simple logging middleware
wdk.registerMiddleware('ethereum', async (account) => {
  console.log('New account created:', await account.getAddress())
})



## Environment Variables

For production applications, consider using environment variables for sensitive configuration:

{% code title="WDK environment variables Configuration" lineNumbers="true" %}
```javascript
const wdk = new WDK(process.env.SEED_PHRASE)
  .registerWallet('ethereum', WalletManagerEvm, {
    provider: process.env.ETHEREUM_RPC_URL
  })
  .registerProtocol('ethereum', 'velora', veloraProtocolEvm, {
    apiKey: process.env.velora_API_KEY
  })
````

{% endcode %}

***

## Next Steps

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-code">:code:</i></td><td><strong>WDK Core Usage</strong></td><td>Get started with WDK's usage</td><td><a href="usage">usage</a></td></tr><tr><td><i class="fa-code">:code:</i></td><td><strong>WDK Core API</strong></td><td>Get started with WDK's API</td><td><a href="api-reference">api-reference</a></td></tr><tr><td><i class="fa-code">:code:</i></td><td><strong>Wallet Modules</strong></td><td>Explore blockchain-specific wallet modules</td><td><a href="../wallet-modules">wallet-modules</a></td></tr><tr><td><i class="fa-code">:code:</i></td><td><strong>Bridge Modules</strong></td><td>Cross-chain USD₮0 bridges</td><td><a href="../bridge-modules">bridge-modules</a></td></tr></tbody></table>

***

### Need Help?

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-discord">:discord:</i></td><td><strong>Discord Community</strong></td><td>Connect with developers, ask questions, share your projects</td><td><a href="https://discord.gg/arYXDhHB2w" class="button primary">Join Community</a></td><td><a href="https://discord.gg/arYXDhHB2w">https://discord.gg/arYXDhHB2w</a></td></tr><tr><td><i class="fa-github">:github:</i></td><td><strong>GitHub Issues</strong></td><td>Report bugs, request features, and get technical help</td><td><a href="https://github.com/tetherto/wdk-core" class="button secondary">Open an Issue</a></td><td><a href="https://github.com/tetherto/wdk-core">https://github.com/tetherto/wdk-core</a></td></tr><tr><td><i class="fa-envelope">:envelope:</i></td><td><strong>Email Contact</strong></td><td>For sensitive or private matters, contact our team directly</td><td><a href="mailto:wallet-info.tether.io" class="button secondary">Send an email</a></td><td><a href="mailto:wallet-info.tether.io">mailto:wallet-info.tether.io</a></td></tr></tbody></table>
