Hello everyone,
I’m currently developing a Dapp using the Plug wallet and encountering a few issues with the requestTransfer
method. I’ve been testing this locally, making sure that the host is set to my local network and that there is a positive balance in my wallet on the local ledger. Despite this, when I request a transfer, it errors with “insufficient funds” most of the time, and occasionally, I get an “invalid service definition” error.
Here is the code snippet I’m using:
const transferICP = async (toAccount, amountE8s) => {
console.log("Connected network:", await window.ic.plug.agent);
try {
console.log("Transferring ICP to:", toAccount, "Amount:", amountE8s);
const params = {
to: toAccount,
amount: amountE8s,
};
const transferResult = await window.ic.plug.requestTransfer(params);
console.log("Transfer successful:", transferResult);
return transferResult;
} catch (error) {
console.error("Error during ICP transfer:", error);
throw error;
}
};
Transferring through the Plug plugin directly to the destination account works without issue. I’ve also double-checked that the e8s amount I’m passing is correct and that the host is set to my local network. Does anyone know if there are any known bugs with this method, or is there something I might be missing in my setup?
Any insights or similar experiences would be greatly appreciated!
Thank you!