"invalid receiver address" error when using buildTransaction with extension v1.0

Hi,

I’m trying to create transactions from a web app using window.kleverWeb.buildTransaction() on Testnet, but I always get the error “invalid receiver address”.

Setup:

  • Extension version: 1.0

  • Provider: { api: 'https://api.testnet.klever.org', node: 'https://node.testnet.klever.org' }

  • window.kleverWeb.address returns a valid address

Code that fails:

javascript

const tx = await window.kleverWeb.buildTransaction([{
  type: 0,
  payload: {
    receiver: 'klv1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpgm89z',
    amount: 1000000,
    kda: 'KLV'
  }
}], []);
```

**Error:**
```
POST https://node.testnet.klever.org/transaction/send 400 (Bad Request)
validation error: invalid receiver address

What is the correct payload format for buildTransaction in extension v1.0?

Thanks.

After extensive testing, we found the correct way to mint SFTs with metadata using the Klever Web Extension.

The Problem

Using window.kleverWeb.buildTransaction() always returned “invalid receiver address” error, even with correct parameters.

The Solution

Don’t use buildTransaction(). Instead, call the node API directly and use the extension only for signing and broadcasting.

Working Flow

Step 1: Get account nonce

javascript

const accountResponse = await fetch(`https://api.testnet.klever.org/v1.0/address/${senderAddress}`);
const accountData = await accountResponse.json();
const nonce = accountData.data.account.nonce; // lowercase!

Step 2: Build transaction payload

javascript

// Metadata must be Base64 encoded
const metadataJson = JSON.stringify({ title: "My NFT", description: "..." });
const metadataBase64 = btoa(unescape(encodeURIComponent(metadataJson)));

const txData = {
  type: 11,  // AssetTrigger (NOT 15!)
  nonce: nonce,
  sender: senderAddress,
  data: [metadataBase64],  // Metadata goes here as Base64
  permID: 0,
  contracts: [{
    triggerType: 0,  // Mint
    receiver: receiverAddress,
    amount: 1,
    value: null,
    assetId: "YOUR-ASSET-ID",
    contractType: 11
  }],
  kdaFee: ""
};

Step 3: Send to node API to build unsigned transaction

javascript

const response = await fetch('https://node.testnet.klever.org/transaction/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(txData)
});
const result = await response.json();

Step 4: Sign with extension

javascript

const signedTx = await window.kleverWeb.signTransaction(result.data.result);

Step 5: Broadcast with extension

javascript

const broadcast = await window.kleverWeb.broadcastTransactions([signedTx]);

Key Discoveries

  1. Transaction type is 11, not 15 (as some docs suggest)

  2. contractType must also be 11 inside the contracts array

  3. Metadata goes in the data field as Base64, not in URIs

  4. Nonce property is lowercase (nonce, not Nonce)

Reading Metadata Back

To read the metadata from minted SFTs, query the transaction list:

javascript

const response = await fetch(`https://api.testnet.klever.org/v1.0/transaction/list?asset=YOUR-ASSET-ID&type=11&limit=100`);

The metadata is in transaction.data[0] as hex-encoded string (for old mints) or Base64 (for new mints).

Hope this helps others struggling with the same issue! :rocket:

3 Likes