Courses

Developing Decentralized Applications (DApps) on Polygon
Polygon · Chapter 10

Developing Decentralized Applications (DApps) on Polygon

A DApp connects a familiar website to a smart contract. For the Counter app, the screen only needs the current value, a Connect Wallet button and an Increment button.

The basics

  • Read the value when the page loads. Show the selected network beside it.
  • Before a write, require the wallet to be on Amoy. Do not silently send a transaction to a different chain.
  • Show wallet rejection, pending confirmation and transaction failure as separate states. Disable repeated submissions while waiting.

Try it yourself

Draw the Counter screen in four states: disconnected, connected, waiting and confirmed. Write a short message for a user who rejects the transaction.

Read more in the official documentation

@ Daniel Burlacu