The LendBook API provides endpoints to interact with a smart contract. It allows users to retrieve information such as the current block number, contract address, call contract functions, and access contract constants.
- Node.js and npm installed on your machine.
- An Ethereum node URL (e.g., Infura) for provider communication.
- A contract ABI JSON file.
- Set up a
.envfile with the following environment variables:
URL_PROVIDER=<Your Ethereum node URL>
CONTRACT_ADDRESS=<ORDERBOOKADDRESS>
USDC_ADDRESS=<USDC ADDRESS>
WETH_ADDRESS=<WETH ADDRESS>
CHAIN_ID=<Your chain ID>
MONGO_URI=mongodb+srv://<user>:<pass>@cluster0.rim1pqt.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
PORT=<PORT NUMBER>
- Clone this repository to your local machine.
- Navigate to the project directory in your terminal.
- Run
yarn installto install dependencies
- Start the API server by running
yarn start.
- Access the Swagger documentation at
/api-docsendpoint. - Explore the available endpoints and their descriptions.
Returns the current block number on the Ethereum blockchain.
Returns the address of the smart contract.
Calls a function of the smart contract by providing the function name as a parameter.
Returns the value of a constant from the smart contract by providing the constant name as a parameter.
Returns the balance of the provided wallet address for a specific token.
Returns the symbol of the provided token address.