I create my wallet like this
const wallet = ethers.Wallet.createRandom()
I use metamask to send RIF tokens to the public address. I confirm the new balance of the account and it is accurate, the ERC20 transaction worked.
When I try to send some of the RIF token from that wallet, like this:
const connectedWallet = await wallet.connect(provider)
const contract = new ethers.Contract(
process.env.CONTRACT_ADDRESS,
rifContractAbi,
onlineWallet,
)
await contract.transfer(to, tokens)
I get the following error:
error: Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"id\":246,\"error\":{\"code\":-32010,\"message\":\"the sender account doesn't exist\"}}\n", error={"code":-32010}, requestBody="{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xf8a8808403e252e08290999419f64674d8a5b4e652319f5e239efd3bc969a1fe80b844a9059cbb00000000000000000000000010d158b42bfbf39641896ad8b8fd9cf7078d2f4e0000000000000000000000000000000000000000000000000de0b483f7abe82062a0175a2b6e35c1ff301ff45341bf5a63a3895a63404c78b6644cd2f8dee5b9a030a010fbbd608476a555bccd9f3ccf67ceac46183f1be4a82b14a46bbb78ba312fc9\"],\"id\":246,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://public-node.testnet.rsk.co", code=SERVER_ERROR, version=web/5.7.0)
As soon as I sent some RBTC to that account the transaction works.