Giter Club home page Giter Club logo

Comments (4)

vporton avatar vporton commented on July 2, 2024

Sorry, the app was erroneous, now fixed. And the error is not that console.log don't work, but:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'provider')
    at readScore (App.tsx:76:1)

from web3-onboard.

vporton avatar vporton commented on July 2, 2024

Bug workaround:

  useEffect(() => {
    if (!wallet) {
      return;
    }
    (async () => {
      const provider = new ethers.BrowserProvider(wallet!.provider, 'any');
      console.log('provider', provider);
      const signer = await provider.getSigner();
      console.log('signer', signer);
      const address = await signer.getAddress()
      console.log('address', address);
      const message = "I certify that I am the owner of the Ethereum account\n" + address;
      const signature = await signer.signMessage(message);
    })()
  }, [wallet]);

  async function readScore() {
    if (!wallet) {
      await connect();
    }
  }

from web3-onboard.

Adamj1232 avatar Adamj1232 commented on July 2, 2024

@vporton thanks for posting!
I dont see this when working with our react demo project. We do something similar but not quite the same you can check it out here.

Let me know if this helps!

from web3-onboard.

vporton avatar vporton commented on July 2, 2024

Let me know if this helps!

It does not help, because it involves an additional user action to start the next action after connecting, instead of the ability to start an additional blockchain action (such as requesting from user a signature) automatically upon connecting.

BTW, code similar to my above code is buggy: It sometimes produces 4 asks for a signature instead of one.

from web3-onboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.