# Flash SDK

### Introduction

Flash.trade SDK written in typescript provides the easist way for developers, partners and others to integrate with flash.trade. This page will walk you through setting up the flash client, creating transactions and executing them.

### Install the Flash SDK

```bash
npm install flash-sdk

yarn add flash-sdk
```

### Setting up the Flash SDK

{% code overflow="wrap" %}

```typescript
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PerpetualsClient, PoolConfig } from 'flash-sdk';

const RPC_URL = process.env.RPC_URL;

// Configure the AnchorProvider
const provider: AnchorProvider = AnchorProvider.local(RPC_URL, {
    commitment: 'processed',
    preflightCommitment: 'processed',
    skipPreflight: true,
});

// Configure the pool you want to interact with 
// for devnet : devnet.1,devnet.2,devnet.3,devnet.4,devnet.5
// for mainnet : Crypto.1,Virtual.1,Governance.1,Community.1,Community.2
// all the pool details can be found by running `code ./node_modules/flash-sdk/dist/PoolConfig.json`
const POOL_CONFIG = PoolConfig.fromIdsByName('Crypto.1', 'mainnet-beta'); 

// You can now setup the Flash client
const flashClient = new PerpetualsClient(
    provider,
    POOL_CONFIG.programId,
    POOL_CONFIG.perpComposibilityProgramId,
    POOL_CONFIG.fbNftRewardProgramId,
    POOL_CONFIG.rewardDistributionProgram.programId,
    {
        prioritizationFee: 0, // this can be set dynamically by calling flashClient.setPrioritizationFee
    }
)
```

{% endcode %}

{% hint style="success" %}
Detailed Example:

Checkout the public repo [here](https://github.com/flash-trade/flash-trade-sdk/tree/main/examples).
{% endhint %}

{% hint style="info" %}
NOTE : if you are using AnchorProvider it is necessary to pass ANCHOR\_WALLET as an environment variable. This wallet/keypair doesn't have to sign the transaction but if you are using it as part of the view functions then this wallet pubkey will be used for simulations. It also needs be initialized, i.e has to have some SOL in it.&#x20;
{% endhint %}
