# FT4 client setup with TypeScript · Chromia Docs (concept)

> This section discusses how to install and initialize the FT4 client.

Source: https://docs.chromia.com/build/ft4/client/client-setup/

# FT4 client setup with TypeScript

This section discusses how to install and initialize the FT4 client.

#### Install the client

Use [npm](https://docs.npmjs.com/cli/v10/commands/npm-init) to install the
[FT4 client](https://www.npmjs.com/package/@chromia/ft4):

Plain text

```
npm install @chromia/ft4@2.1.0 postchain-client@^2.1.0
```

#### Initialize the client

In your JavaScript code, initialize the FT4 client:

JavaScript

```
const { createClient } = require("postchain-client");
const { createConnection } = require("@chromia/ft4");

const url = "http://localhost:7740";
const client = await createClient({
  nodeUrlPool: url,
  blockchainIid: 0,
});

const connection = createConnection(client);
```

In the code snippet above, we import the necessary modules from the `postchain-client` and `@chromia/ft4` packages.
Next, we define the `url` of the Postchain network we want to connect to (in this case,
"[http://localhost:7740](http://localhost:7740/)"). We then create an instance of the `IClient` using the specified URL
and the internal ID of the chain, which by default is `0` on a local network.

With the client initialized, you can now utilize its capabilities to interact with the Postchain network and perform
various operations, such as sending transactions and querying the blockchain.

We then pass the client to the [`createConnection`](https://docs.chromia.com/pages/ft4-ts-client/functions/ft-session.createConnection/) method from FT4, allowing us to easily use all of the FT4 features.

#### Test the connection

To test the connection, add a function to call a method on the connection object:

JavaScript

```
const { createClient } = require("postchain-client");
const { createConnection } = require("@chromia/ft4");

async function main() {
  const url = "http://localhost:7740";
  const client = await createClient({
    nodeUrlPool: url,
    blockchainIid: 0,
  });

  const connection = createConnection(client);
  console.log(await connection.getAllAssets()); // This line is new
}

main();
```

Run the above example with `node index.js`. This will print all the assets registered on the blockchain. If no assets
are registered, the response will look like this:

JavaScript

```
{ data: [], nextCursor: null }
```

[View this page on docs.chromia.com](https://docs.chromia.com/build/ft4/client/client-setup/)Content mirrored from the live docs
