Issue with kdaFee in @klever/sdk-node for KDA fee payments

Hey Klever team!

I’m working on a project with @klever/sdk-node and trying to pay fees in KDA (like KIRA-31QW) instead of KLV. I started with v2.3.0 and now updated to the latest version, but I still can’t get kdaFee to work.

I see kdaFee (e.g., {"kda": "KIRA-31QW", "amount": 15}) in transaction hashes, so it’s supported on the blockchain, but not through the SDK. I’ve tried passing it in buildTransaction options and inside the contract payload—either it throws an “unknown error” or gets ignored, and fees stay in KLV. The docs at Klever Documentation don’t show a clear example for this.

Is kdaFee supported in the latest SDK? If so, how do I use it—any working example? If not, is it a bug or limitation, and is there a workaround (like using the API directly)? Thanks a lot for any help!
@Duka @Eduardo_Alex

2 Likes

Do you mean something like this? @Sovkosov_Ignat

// Define the kdaFee with KIRA-31QW
const selectedkdaFee = "KIRA-31QW";

// Set the transaction options
const txOptions = {
  kdaFee: selectedkdaFee
};

// Build the transfer transaction
const unsignedTx = await kleverInstance.buildTransaction(
  [{
    payload: {
      amount: amount,      // Amount to be sent
      receiver: receiver,  // Receiver address
      kda: kda            // The KDA type (e.g., KLV or other token)
    },
    type: TransactionType.Transfer  // Specify transaction type as Transfer
  }],
  undefined,  // No encodedData needed for a simple transfer
  txOptions   // Options including kdaFee
);

// Sign the transaction using Klever Web
const signedTx = await window.kleverWeb.signTransaction(unsignedTx);

// Broadcast the signed transaction
const broadcastResult = await kleverInstance.broadcastTransactions([signedTx]);

// Log the result of the broadcast
console.log(broadcastResult);
4 Likes

@CryptoJaeger
Thanks for the method! We tried it, but it didn’t work for us. We’re using Node.js with klever sdk-node 2.3.0`, and your code is for a browser setup with klever Web.
Appreciate your help! :rocket:

1 Like

Hello @Sovkosov_Ignat!

We’ve just updated the sdk-node library to support KDA fee, as requested!
You can check out the latest release for details.

To use it, here’s a quick example of how your implementation might look:

const transferPayload = {
  amount: 1 * 10 ** 6,
  receiver: "destination-address",
  kda: "KLV",
};

const tx = {
  type: TransactionType.Transfer,
  payload: transferPayload,
};

const account = new Account(privateKey);
await utils.accountsReady([account]);

const options = {
  kdaFee: "KLV", // Set the asset to be used for the KDA fee
};

const res1 = await account.buildTransaction([tx], undefined, options);

Let us know if you run into anything or need further help! :rocket:

5 Likes

You guys are awesome! Such incredible speed! Thanks, I’ll keep you posted once I’m done testing :star_struck: @Nicollas

2 Likes