snapshot-labs / lock

MIT License
31 stars 49 forks source link

Portis wallet error and no longer supported option #24

Closed samuveth closed 2 years ago

samuveth commented 2 years ago

When connecting with portis we get these error/warning and it's very slow: image

ayushkumar63123 commented 2 years ago

I found a fix for this on a forum: async function portisLogin() { const portis = new Portis('xxxxx', 'rinkeby') try { class MoralisPortisProvider { async activate() { this.provider = portis.provider; const MWeb3 = typeof Web3 === 'function' ? Web3 : window.web3; this.web3 = new MWeb3(this.provider) this.isActivated = true; return this.web3; } }

  // Global Moralis object overwritten
  Moralis.Web3.enable = async () => {
    const web3Provider = new MoralisPortisProvider()
    return await web3Provider.activate()
  };
  window.web3 = await Moralis.enable()
  portis.provider.isTrust = true // NEED TO ADD THIS!!
  const user = await Moralis.authenticate({ provider: portis.provider})

} catch (error) { console.log('authenticate failed', error); } renderApp(); } Use the above code for login through portis.

ayushkumar63123 commented 2 years ago

Please review my solution