Skip to main content

Tech stack


Quick start

Note on dependencies You do not need to install @incentiv/dapp-sdk separately when using this example. The package.json already references the SDK via "file:..", which points one directory up to the local source. If you publish or move the example outside the monorepo, change that line to "@incentiv/dapp-sdk": "^x.y.z" and re‑install.

Configuration

Network and contract settings live in src/config.ts:
Switch environments in src/App.tsx by modifying:

App anatomy

1. src/App.tsx

  • handleConnect – asks the SDK for an account address and sets up the provider & signer.
  • handleFetchData – reads storedValue() and lastSetter() from the Storage contract.
  • handleSubmit – calls setValue(); the SDK opens the Portal for signing and then shows a success/error modal.
  • A useEffect hook listens for new blocks and keeps the UI in sync.

2. src/components/Modal.tsx

Reusable modal component used for success/error feedback.

Runtime flow

Troubleshooting


Production build

Ensure your production host allows pop‑ups for the Incentiv Portal domain.

Video: Incentiv dApp SDK Example

License

MIT – provided “as‑is” for educational purposes.