adrianhajdin / project_crowdfunding

With a stunning design, connected to the blockchain, metamask pairing, interaction with smart contracts, sending Ethereum through the blockchain network, and writing solidity code.
https://jsmastery.pro
675 stars 364 forks source link

MetaMask notification is not popped up after clicking add a new campaign #33

Closed Brijesh-Adeshara closed 1 year ago

Brijesh-Adeshara commented 1 year ago

i have tried so many times but i wonder why this happen

Brijesh-Adeshara commented 1 year ago

any idea how to resolve this

A-Pradeep commented 1 year ago

@Brijesh-Adeshara Is there any error logged on console upon createCampaign trigger ? Provide error log if any, to understand the issue better.

Brijesh-Adeshara commented 1 year ago

@A-Pradeep yes i attached one photo of the error WhatsApp Image 2023-04-08 at 5 33 46 PM

A-Pradeep commented 1 year ago

@Brijesh-Adeshara seems connect is not working, can you check with this following code. https://github.com/adrianhajdin/project_crowdfunding/blob/a554d7eaeefe1f6f2b73c8ecd837b6805aaed4b7/client/src/context/index.jsx#L14

Brijesh-Adeshara commented 1 year ago

@A-Pradeep Brother i add one line from this line import { EditionMetadataWithOwnerOutputSchema } from '@thirdweb-dev/sdk'; but still shows the same error attached photo error

A-Pradeep commented 1 year ago

@Brijesh-Adeshara Not sure why it's used for, but on YouTube I've not come across. Even added on my local project and not faced any issue. Can you remove that line and try once ?

Brijesh-Adeshara commented 1 year ago

@A-Pradeep yes tried it with and without that line but same error occured but if i try to create campaign from thirdweb dashboard then it is successfully completed like, from thirdweb dashboard the notification of gas fees is popped up from metamask and i able to add a campaign successfully but from front end it shows this error..

A-Pradeep commented 1 year ago

@Brijesh-Adeshara From Thirdweb it will work. Seems like your react app not able to trigger the MetaMask.

  1. Can you reinstall the packages once more npm i @thirdweb-dev/react @thirdweb-dev/sdk ethers@^5
  2. Can you cross check the main.tsx so that the ThirdwebProvider is at parent level.

For reference

  <ThirdwebProvider activeChain={ChainId.Goerli}>
    <Router>
      <StateContextProvider>
        <App />
      </StateContextProvider>
    </Router>
  </ThirdwebProvider>
  1. Make sure the CreateCampaign button logic is linked. Once connect() is true the button will show else, connect button will show.
A-Pradeep commented 1 year ago

@Brijesh-Adeshara It may sound stupid, but make sure the MetaMask extension is added on the Browser and you are using the Goerli test network

Brijesh-Adeshara commented 1 year ago

@A-Pradeep yes brother metamask extension is added and i am using goerli test network

Brijesh-Adeshara commented 1 year ago

@A-Pradeep can you plz provide your CreateCampaign.jsx file ??

A-Pradeep commented 1 year ago

@Brijesh-Adeshara Hope this helps https://gist.github.com/A-Pradeep/10fdc71b7c55db33095b7ad871ddc492

Brijesh-Adeshara commented 1 year ago

@A-Pradeep ok thanks..