⚙️Initialization

How to install and connect Dev3 SDK.

The SDK can be installed within your project by following three straightforward steps:

  1. Read your API key from the Dev3 Dashboard

  2. Install the NPM package

  3. Initialize the main SDK object

This usually takes up to 10 minutes, taking into the account that you have already built your first project on the Dev3 Dashboard. The steps are explained in the detail below.

1. Get API key

Before integrating the SDK make sure you've visited the Dev3 Dashboard and created your project as the project contains secrets required to initialize the SDK properly.

If you're having trouble creating the project, please refer to the Welcome to Dev3 docs where you can learn how to easily create your first project in minutes, all followed by the screenshots!

Once your project is initialized, go to the Project Dashboard - home screen presented when you open the project page. Here, you'll find two secret values: project-id and api-key, as shown below:

2. Install SDK

To install the SDK within your project, simply run:

npm install dev3-sdk

3. Initialize SDK

Somewhere in your code, create the main SDK object which you're going to use for all the interactions, by providing the api-key and project-id values obtained in step 1.

import { Dev3SDK } from 'dev3-sdk';
// or:
// const { Dev3SDK } = require('dev3-sdk');

const sdk = new Dev3SDK(
    "<api-key-from-the-dashboard>",
    "<project-id-from-the-dashboard>"
);

And you're basically done. To check if the connection is successful, you can always run a test command, for example fetch a list of deployable contracts offered by the Dev3 platform:

const deployableContracts = await sdk.getManifests();
console.log("deployable contracts", deployableContracts);

Live example

Run this flow on a live coding environment here!

Last updated