Link Address (non-crypto)

my bad it’s react, just not react-moralis

@Yomoo do you know how I can make this code update the ‘User’ database?

    const web3 = async () =>{ 
      const Moralis = require('moralis')
      await Moralis.enable().then(async () => await Moralis.link(window.ethereum._state.accounts[0]));
    }

I sign the transaction thinking it worked but maybe the problem is I’ve already logged in using login() function from react-moralis (non-crypto)… idk

Hi @wesleyt95

What exactly do you want to update in your database?

ethAddress using Moralis.link() function I posted above

Moralis.link updates the database automatically if linking was successful

I sign the transaction thinking it worked but maybe the problem is I’ve already logged in using login() function from react-moralis (non-crypto)… idk

[quote=“wesleyt95, post:22, topic:3838”]

    const web3 = async () =>{ 
      const Moralis = require('moralis')
      await Moralis.enable().then(async () => await Moralis.link(window.ethereum._state.accounts[0]));
    }

here’s the function I’m using in case u didn’t see that either @malik

can you use https://codesandbox.io/ to add your complete code there and test it?
in theory the database should update, in particular this is the code from Moralis SDK:
https://github.com/MoralisWeb3/Moralis-JS-SDK/blob/6b9a6d3a64c94b32f1ec9e7ab609673293439db6/src/MoralisWeb3.js#L131-L134