# Application Quickstart

### Create a simple application interface

**In our application guide we will cover the following:**

* Installation&#x20;
* Setup
* Initialization of the IntentClient class
* The creation and submission of an intent&#x20;
* Fetching intentpool state to be displayed on the frontend

#### 1. Installation <a href="#id-1-installation" id="id-1-installation"></a>

To install the `fabriq-sdk` in your project, ensure you have Node.js and yarn installed in your environment and run the following command:

```typescript
yarn add fabriq-sdk
```

#### 2. Setup <a href="#id-2-setup" id="id-2-setup"></a>

Import `fabriq-sdk` into your project to start:

```typescript
import { IntentClient, intentPoolURL } from 'fabriq-sdk';
import { Hex, Address, maxUint256, createPublicClient, WalletClient, PublicClient} from 'viem';
```

#### 3. Initializing the IntentClient class <a href="#id-1-initializing-the-sdk" id="id-1-initializing-the-sdk"></a>

To create an instance of the IntentClient class, one has to create a wallet client first with the desired network and account(this example is using an embedded browser account). There is a possibility to add a specific intentPoolUrl to submit the intents to.

```typescript
const walletClient = createWalletClient({ 
   chain: hardhat, 
   transport: custom(window.ethereum) 
});

const intentClient = new intentClient(walletClient, intentPoolURL);
```

#### 4. Creating and submitting an Intent <a href="#id-2-creating-and-executing-an-intent" id="id-2-creating-and-executing-an-intent"></a>

To submit an intent to the intent pool, you need to specify the details of the intent you want to create.\
This involves defining the source and destination chain IDs , the asset amount to be transferred, the inputAddress which is the asset address on the source chain and the output address which is the asset address on the destination chain.

```typescript
intentClient.approvePermit2(tokenAddress: Address)

intentClient.submitIntent(
    inputAddress: Address,
    outputAddress: Address,
    amount: bigint,
    srcChainId: number,
    dstChainId: number
);
```

#### 5. Getting intent pool statistics data <a href="#id-2-creating-and-executing-an-intent" id="id-2-creating-and-executing-an-intent"></a>

The following functions will help get the intentpool data for an enhanced user experience on the application level.&#x20;

```typescript
 /**
   * Fetches the balance of a specific token for the current account.
*/
async getBalance(token: Address) {}

/**
 * Fetches details about a specific intent using its hash.
 */
async getIntent(intentHash: Hex) {}

/**
 * Retrieves all intents originating from a specific chain.
 */
async getAllIntentsWithOrigin(chainId: Number) {}

/**
 * Retrieves all intents targeting a specific destination chain.
 */
async getAllIntentsWithDestination(chainId: Number) {}

/**
 * Fetches a specified number of solved intents.
 */
async getSolvedIntents(numberOfIntents: Number) {}

/**
 * Fetches a specified number of pending intents.
 */
async getPendingIntents(numberOfIntents: Number) {}

```
