Sending ETH one line of code Moralis.Units [SOLVED]

I’m getting a typeError of undefined when trying to use the native transfer. I noticed that Docs show a different style of implementation than the tutorial video Ivan did, but for me produce the same error.

the error in console

main.js:419 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ETH')
    at runcode (main.js:419)
    at HTMLButtonElement.onclick

according to docs

async function runcode(){
  

    // sending 0.5 ETH
    const options = {type: "native", amount: Moralis.Units.ETH("0.1"), receiver: "0xb8504ca9794c2da15725e608814b5d169b28cf9a"}
    let result = await Moralis.transfer(options);
    console.log(result);

   
  }

according to video within docs

function runcode(){
  
     Moralis.transfer({type: "native", receiver: "0xb8504ca9794c2da15725e608814b5d169b28cf9a", amount:Moralis.Units.ETH("0.1")});
   
  }

I’ve updated my database. Im wondering if I should just scrap my database and start fresh? I cant seem to view the logs or errors from the Moralis console UI anymore as well.

2 Likes

Hey @ibn5x

What do you mean? The logs page doesn’t load?

I cant seem to view the logs or errors from the Moralis console UI anymore as well.

You should use info from the docs.
Which version of Moralis SDL do you use?

Hey, @Yomoo thanks for getting back to me, from the Moralis Dashboard UI Logs and Error clicking on them now just goes to a white page and that’s it never loads.

Moralis version is 0.0.257

I tried both ways referencing the docs and the tutorials same results for some reason, I’ve noticed that I also can not do query constraints properly.

0.0.257 - is a server version.

I mean the version of moralis SDK

1 Like

I apologize, I have not got the jargon all the way down yet (diligently working on it). I am using 0.0.6 I believe

<script src="https://npmcdn.com/[email protected]/dist/moralis.js"></script>

That is the problem. You use very old version.

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

2 Likes

actually, I noticed Ivan using this version I thought I tried it as well, but I will give it another shot thank you for your time, you all are the best!

Thank you, such a tiny mistake huge problems. :+1: everything functions as it should.

1 Like