Help Needed: Integrating VeWorld Wallet Extension for Sending $B3TR Tokens on Testnet

Hello VeChain Community,

I’m currently working on a project where I need to integrate the VeWorld wallet extension into a basic web application. The goal is to allow users to connect their VeWorld wallet and send $B3TR tokens on the testnet. However, I’m facing multiple challenges and have struggled to find adequate documentation or resources to proceed.

Project Overview:

The project involves a simple frontend web app with the following requirements:

  • Connect to the VeWorld wallet extension.
  • Allow the user to send $B3TR tokens on the testnet.

Challenges Encountered:

  1. Lack of API Documentation: I couldn’t find specific documentation or examples for interacting with the VeWorld wallet extension. This has made it difficult to understand how to initiate transactions or even how to properly connect the wallet.
  2. Extension API Access: I tried inspecting the extension through Chrome DevTools to find relevant API methods, but it wasn’t clear how to utilize them for sending tokens. Typical methods used with other wallets (like eth_requestAccounts or eth_sendTransaction) do not seem to apply here, or they require different handling.
  3. Code Implementation Issues: I attempted to implement basic code to connect the wallet and send a transaction, but without understanding the correct API calls, I’m unable to proceed further. Below is the code I’ve been working with:
VeWorld Wallet Integration

Connect VeWorld Wallet

Connect Wallet Send $B3TR Token
<script>
    document.getElementById('connectWallet').addEventListener('click', async () => {
        if (window.veWorld) {
            try {
                const accounts = await window.veWorld.request({ method: 'eth_requestAccounts' });
                console.log('Connected account:', accounts[0]);
            } catch (error) {
                console.error('Error connecting wallet:', error);
            }
        } else {
            console.error('VeWorld wallet not found.');
        }
    });

    document.getElementById('sendToken').addEventListener('click', async () => {
        if (window.veWorld) {
            try {
                const transactionParams = {
                    from: /* sender's address */,
                    to: /* recipient's address */,
                    value: /* amount in Wei */,
                    data: /* transaction data, if any */,
                };

                const txHash = await window.veWorld.request({
                    method: 'eth_sendTransaction',
                    params: [transactionParams],
                });

                console.log('Transaction Hash:', txHash);
            } catch (error) {
                console.error('Error sending token:', error);
            }
        } else {
            console.error('VeWorld wallet not found.');
        }
    });
</script>

Request for Assistance:

I would greatly appreciate it if anyone could provide guidance on the following:

  • VeWorld API Documentation: Is there any official or community-driven documentation that details how to interact with the VeWorld extension? Even examples of basic wallet interactions (e.g., connecting, sending tokens) would be extremely helpful.
  • Correct API Usage: If anyone has successfully used the VeWorld extension to send transactions, could you share the correct method and parameters? Any code examples or tutorials would be invaluable.
  • Troubleshooting Tips: If there are known issues or specific steps required to enable the extension’s API, any advice would be welcome.

Thank you in advance for your help. I’m looking forward to any insights or suggestions that could help me move forward with this project.

Hi @TGT, If I am not mistaken I think you are looking for DApp Kit | VeChain Docs. Hope this helps.

Thank you for the feedback! What exactly form the library do you suggest on using or looking at to solve this issue?

I think this may be a good example as it will take you through the basics, connecting a wallet, verification and sending a transaction. It uses dApp-kit and the SDK. Buy me a coffee app

1 Like

Hey @VadneyK , as @brettski mentioned dapp-kit is the way to go, and that page is a really good starting point.

dapp-kit handles wallet communication for you, so you just need to take care of the data you want to read and write.

I also suggest you to use react and @vechain/dapp-kit-react since day one, as it provides additional hooks and functions to make your life easier.
Happy to provide further support, reaching out on tg as well :slight_smile: