Building KAPPs using Next.js

This thread is to help out each other to build using Next.js leveraging Klever Chain Network.

Does this both libraries for Web App & NodeJs work same ?

Web App - $npm install @klever/sdk-web
NodeJs - $npm install @klever/sdk-node

1 Like

Hello @Jason_Stackhouse, hope you’re doing well!

No, they may look similar, but they serve different purposes:

sdk-node is designed for server-side applications. In this library, you manually manage your accounts, signatures, and related operations.

sdk-web is meant for client-side applications. In this library, whenever you need to sign a transaction or manage accounts, it interacts with the Klever Extension to handle those tasks.

Let me know if you need further clarification!

2 Likes

If i am building a kapp. I want user to

connect wallet,
sign message to verify ownership,
get balance of the connected address,
stake KDA,
disconnect wallet,

I must use Klever Web SDK ! ( for client side )

Am i correct ?

Anything that is automated ( bots, scripts, algo, … ) I must use sdk-node else for web app : sdk-web

Both of them serves similar functions but KLEVER-SDK-WEB does it by interacting with Klever Extension & K5 Wallet while KLEVER-SDK-NODE is completely independent of all.

How do I getBalance of a KDA not KLV using Next.js ?

Ohk, solved.

Code:

const myWalletBalance = (await window.kleverWeb.getBalance(address)) / 1_000_000;
const myKDACoinBalance = (await window.kleverWeb.getAssetBalance(“KFI”)) / 1_000_000;

1 Like