[SOLVED] Metamask not detect

<html>

    <head>

        <title>Vanilla Boilerpate</title>

            <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js" ></script>

            <script src="https://unpkg.com/moralis/dist/moralis.js"></script>

        

    </head>

    <body>

        <button onclick="runcode()">Run code</button>

        <br><br>

        <script>

            function runcode(){

                    // sending 0.5 ETH

                    const options = {type: "native", amount: Moralis.Units.ETH("0.5"), receiver: "0x02458D2d139865695332314a09b00a9bb9906aD1"}

                        let result = await Moralis.transfer(options)

            }

        </script>

    </body>

</html>

can someone help me why my metamask not detect im using local ganache

Working version:

<html>

    <head>

        <title>Vanilla Boilerpate</title>

            <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js" ></script>

            <script src="https://unpkg.com/moralis/dist/moralis.js"></script>

        

    </head>

    <body>

        <button onclick="runcode()">Run code</button>

        <br><br>

        <script>
            Moralis.enable();
            async function runcode(){

                    // sending 0.5 ETH

                    const options = {type: "native", amount: Moralis.Units.ETH("0.5"), receiver: "0x02458D2d139865695332314a09b00a9bb9906aD1"}

                        let result = await Moralis.transfer(options)

            }

        </script>

    </body>

</html>
1 Like

i want ask something,at the video i see they use real eth if i use eth from ganache can transfer or not

You can transfer using ganache

1 Like

so i need change my eth main net to ganache local right?

Yes, in MetaMask that

1 Like