Retrieve Price
This tutorial will guide you through building a project on Conflux eSpace using Hardhat and retrieving the CFX price through the Pyth oracle.
前提条件
Before starting, ensure you have the following software installed:
- Node.js and npm
- Hardhat
- Conflux wallet extension
Step 1: Create a Hardhat Project
First, create a new Hardhat project:
mkdir conflux-pyth-cfx-price
cd conflux-pyth-cfx-price
npx hardhat
Follow the prompts to create a basic JavaScript project.
Step 2: Install Necessary Dependencies
Install the Pyth SDK and other required dependencies:
npm install @pythnetwork/pyth-sdk-solidity @pythnetwork/pyth-evm-js dotenv