Desposit function in Next.js and Moralis

44 Views Asked by At

I'm trying to make a simple function on the website. It should take amount of ETH as an input parameter and send it to a certain wallet. So it should have one placeholder for amount of ETH and "deposit" button.

I used Moralis to import the Connect Button. Now I can't figure out how to make a function.

I'm trying to follow instructions from moralis.io:

export default async function deposit(amount) {
    const options = {type: "native", amount: Moralis.Units.ETH("amount"), receiver: "0x.."}
    let result = await Moralis.transfer(options)
}

I'm very new to this.

Does this make any sense and how to make a front-end out of it?

Can someone help figure this one out?

1

There are 1 best solutions below

0
Alex On

Hi that deposit code is a function. You then call it somewhere in your code to run it. E.g.

deposit("amounthere");

I would recommend following an HTML/JavaScript course to learn the fundamentals, it will go a long way.