# Setup

### Installation

Adding [@delegatexyz/sdk](https://github.com/delegatexyz/delegate-javascript-sdk) to your project is just a single command.

```bash
npm install @delegatexyz/sdk viem
```

### Importing

{% code title="ES6 or Typescript" %}

```javascript
import { http } from "viem"
import { DelegateV1, DelegateV2 } from "@delegatexyz/sdk";
```

{% endcode %}

{% code title="NodeJS require" %}

```javascript
const { http } = require("viem");
const { DelegateV1, DelegateV2 } = require("@delegatexyz/sdk");
```

{% endcode %}

### Setup

The v1 or v2 SDK require the same parameters:

* **transport**: a valid viem [Transport](https://viem.sh/docs/clients/intro.html#transports).
* **chain (optional)**: [chain](https://viem.sh/docs/glossary/terms.html#chain) from `viem/chains` (or [define your own](https://viem.sh/docs/clients/chains.html#custom-chains))
* **account (optional)**: A [wallet client](https://viem.sh/docs/clients/wallet.html)

*`account` is only required to use the write functions*.

```typescript
import { http } from "viem"
import { DelegateV1, DelegateV2 } from "@delegatexyz/sdk";

const RPC_URL = "";
const v1 = new DelegateV1(http(RPC_URL))
const v2 = new DelegateV2(http(RPC_URL))
```
