Unable to transfer token on polygon using enableWeb3 automatically

unable to transfer token on polygon using enableWeb3 automatically.i want to send token automatically without authentication so due to this trying to send with private key enableweb3 functionality.but it not works.

“Internal json-rpc error” will occur on Moralis.transfer

async function sendToken() {

try {
    //console.log(Moralis.CoreManager.get("VERSION"))
    await Moralis.start({ serverUrl, appId });

    await Moralis.enableWeb3({
        chainId: 0x89,
        privateKey:"ddddkkkkk",
    });
   
alert("For ats trans");
    // sending 0.5 tokens with 18 decimals
    const options = {
        type: "erc20",
        amount: Moralis.Units.Token("0.5", "18"),
        receiver: "abcd",
        contractAddress: "xyzz",
    };
    //let result = await Moralis.transfer(options);

    
    setTimeout(() => {
        console.log("we waited 204586560000 ms to run this code, oh boy wowwoowee!");
    }, 5000);
    alert('ready to hit req');
    const transaction1 = await Moralis.transfer(options);
    let result1 = await transaction1.wait();
alert(result1.transactionHash);
} catch (error) {
    alert(error.message);
return false;
regError("Something went wrong.please check and try again.");
//console.error("trigger smart contract error", error);

}
}

This was working when speedy nodes were working. Now you have to use web3 or ethers directly.

Can you provide any solution with example?

and this is not rpc it web3 so why not it will work

I don’t understand the question with:[quote=“dineshkanse91, post:3, topic:17830”]
and this is not rpc it web3 so why not it will work
[/quote]

The solution is to use a RPC url directly with web3 or ethers

Can you provide any solution from web3 api o send transaction/token directly without any authentication with the help of private key

Hello friend,
can anyone provide webapi3 signedtransaction solution

best solution at this web api 3 https://docs.alchemy.com/alchemy/apis/polygon/eth-call

if you have any webapi3 then plz provide solution bcoz i just purchase moralis subscrption

You can’t use the Moralis Web3API for signing transactions.

You can use ethers.js library from the Moralis SDK (or install ethers separately).

You have to set up a wallet instance with your private key and create a contract connection with the contract’s address and ABI in order to call the contract’s function that you want (in this case, transfer).

For RPC, you can certainly use Alchemy or a node provider like Chainstack.

hi there is an error started for all web3api

Can you update your Moralis server (click the refresh icon next to your server on the admin page).