Moralis.transfer problem (SOLVED)

Hi Guys, i am running a Moralis.transfer() and i’m having problems with huge taxes…
I’ve also tried Moralis.enableweb3() in the first line but it and an approve function but it is not working.

buyStarter2 = async() => {
await Moralis.authenticate();
const options = {type: “native”, amount: Moralis.Units.BNB(“0.5”), receiver: “0x2f979f0458380dA68a939442318C39e61f79fc5f”}
let result = await Moralis.transfer(options);
}

That’s the output I get for running this function
Can anyone help me out? thanks very much

errado

Hey @Eul4, I believe if you want to use MM, you need to:

  1. Authenticate with Moralis.authenticate and I suggest you do it in a separate function
  2. Enable Web3 with Moralis.enableWeb3 after successfully authenticating
  3. Then do the transfer with Moralis.transfer, you will not need any approve function in this case since you are dealing with native tokens. Only use approve function when you want smart contracts to access you ERC20 token funds.

For the gas fees so high, not entirely sure about thata but I suggest you to change Moralis.Units.BNB to Moralis.Units.ETH. ETH is just indicating that it is converting from regular units to the amount in wei and it is universal for all networks. Cheers and Happy BUIDL~

Thanks for the reply, I’ve done this now

metamask = async () => {
await Moralis.authenticate();
const web3 = await Moralis.enableWeb3();
}
and

buyStarter2 = async() => {

const options = {type: “native”, amount: Moralis.Units.ETH(“0.5”), receiver: “0x2f979f0458380dA68a939442318C39e61f79fc5f”}
let result = await Moralis.transfer(options);
}

but still, I get the gas fees :frowning:

gas fees can happen from how metamask gets the response from calling gas estimation to the node that is configured in metamask. you can get that high gas fee when the account doesn’t have enough funds to complete that transaction (in that case you should also get an error, like transaction will revert)

it shouldn’t be something related to Moralis for that wrong gas estimation, it should be the same gas estimation if you try to do the transaction directly with web3

1 Like

Oh, that’s right
I don’t have the BNB. I’ve tried with less and it worked
thanks very much