Introduction to KleverChain SDK

Introduction to develop and start integration with KleverChain main methods

The SDK module provides a quick and easy way to make contract calls directly to the Klever blockchain directly.

Installation

$ npm install @klever/sdk

or

$ yarn add @klever/sdk

Setup

Web App

After installation, the KleverSDK folder will automatically appear inside your public, assets or static folder (according to the framework used).

To load the KleverSDK WASM file into your DOM you just need to import the loader script in your index.html or app.html:

You can achieve this placing one of the script tags below:

//If you're using React:
<script src="%PUBLIC_URL%/kleverSDK/kleverSDKLoader.js"></script>
//If you're using Vue or Svelte:
<script src="/kleverSDK/kleverSDKLoader.js"></script>
//If you're using Sveltekit:
<script src="%sveltekit.assets%/kleverSDK/kleverSDKLoader.js"></script>
//If you're using Angular:
<script src="assets/kleverSDK/kleverSDKLoader.js"></script>
//If you're using NextJS:
import Script from "next/script";

<Script
  src="/kleverSDK/kleverSDKLoader.js"
  strategy="beforeInteractive"
/>

You can use any framework you like.

NodeJS

NodeJS version 18+ is required, since we rely on the newly implemented fetch API.

Just require the kleverSDKLoader that appeared on the root level of your project after installation.

//CommonJS
require("./kleverSDK/kleverSDKLoader");
...

Last updated