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:
- 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.
- 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
oreth_sendTransaction
) do not seem to apply here, or they require different handling. - 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:
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.