Pyth Feed Boilerplate is a React-based dApp for fetching and displaying real-time price feeds from the Pyth Network. This boilerplate provides a quickstart template for developers to quickly create similar applications on the Core blockchain.
Purpose: The quickstart guide helps developers rapidly set up a functional dApp with essential setup instructions and code snippets. For detailed instructions and advanced configurations, refer to the full-length guide further down.
Project Setup: Clone the repository and install dependencies. Configuration: Set up the Pyth price feed smart contract and integrate it with the React app. Running the Application: Start the app and view real-time price feeds.
Before setting up the project, ensure you have the following installed:
- Node.js and npm
- MetaMask browser extension
- Git
Clone the repository to your local machine using GitHub Desktop or Git:
gh repo clone Camnaz/Core-Pyth-Feed-Boiler
cd Core-Pyth-Feed-BoilerNavigate to the project directory and install the necessary dependencies:
npm install
Navigate to the frontend directory and install the dependencies:
cd frontend
npm install
cd ..- Add Private Key: Create a 'secret.json' file in the project root and add your private key.
{
"PrivateKey": "your-private-key-here"
}npx hardhat compile
Once deployed, update Smart Contract Address: Open src/App.js and replace
0xYourContractAddresswith your deployed contract address on the Core blockchain.
Install the Babel plugin to avoid dependency issues:
npm install --save-dev @babel/plugin-proposal-private-property-in-objectcd frontend
Start the React application:
npm startOpen your browser and navigate to if it has not already:
http://localhost:3000
Congratulations, you now have a Pyth data feed for CORE/USD, and are able to view the Core price live which is updated every few seconds. You are able to use this boilerplate to imbed Pyth price feeds for Core into different Dapps, or as a learning resource.
Error: One of your dependencies, babel-preset-react-app, is importing the "@babel/plugin-proposal-private-property-in-object" package without declaring it in its dependencies. Solution: Install the Babel plugin manually:
npm install --save-dev @babel/plugin-proposal-private-property-in-objectError: MetaMask - RPC Error: Request of type 'wallet_requestPermissions' already pending.
Solution: Open MetaMask and approve or reject the pending permission request.
Error: no matching function (argument="name", value="updatePrice", code=INVALID_ARGUMENT, version=abi/5.7.0)
Solution: Ensure the ABI file is up-to-date and contains the correct function names.