This app was created for R&D purposes. Please refer to the full version of the demo apps linked below:
This demo dApp is a pared down version of WalletConnect's react-dapp-v2 demo. This version of the app only showcases connecting a dApp and a wallet for Ethereum (EVM) chains via JSON-RPC and Hedera via the official @hashgraph/sdk
library.
This dApp is meant to be used in conjuction with the corresponding hedera-walletconnect-wallet. Please also set up that project.
For integrating Hedera, The dApp's responsibility is to build the transaction with the Hedera SDK, freeze the transaction, convert the transaction to bytes, and then pass the payload to the wallet via WalletConnect to the wallet. The wallet's responsibility is to use the Hedera SDK to reconstruct the transaction object from bytes, extract and format information about the transaction to present to the user, sign and submit the transaction to the Hedera network if approved, and report approval/rejection results back to the dApp.
This is an example implementation of a React dApp (generated via create-react-app
) using the standalone
client for WalletConnect v2 to:
- handle pairings
- manage sessions
- send JSON-RPC requests to a paired wallet
- Install the app's dependencies:
yarn
- To test Hedera integration, go to Hedera Portal to create a Testnet account.
- Set up your local environment variables by copying the example into your own
.env.local
file:
cp .env.local.example .env.local
Your .env.local
now contains the following environment variables:
NEXT_PUBLIC_PROJECT_ID
(placeholder) - You can generate your own ProjectId at https://cloud.walletconnect.comNEXT_PUBLIC_RELAY_URL
(already set)NEXT_PUBLIC_HEDERA_ACCOUNT_ID
(placeholder) - Get your testnet account id from https://portal.hedera.com/NEXT_PUBLIC_HEDERA_PRIVATE_KEY
(placeholder) - Get your testnet private key from https://portal.hedera.com/
yarn dev
Then go to http://localhost:3000 (Note that you may have a better experience running in an incognito browser window)
yarn test
yarn build