I am trying to transfer ICP using plug wallet but the following code produces error. I cannot figure out what is wrong with it
const transfer = async () => {
const params = {
to: `${AccountIdentifier.fromPrincipal({
principal : Principal.fromText('rkp4c-7iaaa-aaaaa-aaaca-cai'),
subAccount : SubAccount.fromPrincipal(Principal.fromText(canisterId))
}).toHex()
}`,
amount: 100000000,
opts: {
memo: "1347768404",
},
};
const result = await window.ic.plug.requestTransfer(params);
console.log({result});
};
but i am getting this error
VM50:221 Uncaught (in promise) Error: The transaction that was just attempted failed because you don’t have enough funds. Review your balance before trying again, or contact the project’s developers.
at Object.i [as resolver] (:221:2456)
at e.onResponseMessage (:221:4060)
at e.onMessage (:221:3162)
at t.receiveMessage (:209:857)
I have created a Testnet on Plug and am interacting with it. I have ensured I have enough ICP. Also when I transfer manually with same parameters transaction goes through
Any insights as to what could be the cause of this error will be really helpful.