[doc] Provide installation directions for Foundry (#1274)

By default, foundry expects every library to be a git project. This approach does not work well with SDKs in monorepos (like ours). However, you can also install the dependencies using NPM and then use remappings.txt to point to the SDK. This is a little janky, but it seems to be the recommended approach for this case 🤷

see issue here foundry-rs/foundry#1847
This commit is contained in:
Jayant Krishnamurthy 2024-02-01 09:52:31 -08:00 committed by GitHub
parent b2c90a310d
commit f172adb389
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 1 deletions

View File

@ -9,10 +9,30 @@ Use this protocol at your own risk.
## Install
```shell
####Truffle/Hardhat
If you are using Truffle or Hardhat, simply install the NPM package:
```bash
npm install @pythnetwork/entropy-sdk-solidity
```
####Foundry
If you are using Foundry, you will need to create an NPM project if you don't already have one.
From the root directory of your project, run:
```bash
npm init -y
npm install @pythnetwork/entropy-sdk-solidity
```
Then add the following line to your `remappings.txt` file:
```text
@pythnetwork/entropy-sdk-solidity/=node_modules/@pythnetwork/entropy-sdk-solidity
```
## Setup
To use the SDK, you need the address of an Entropy contract on your blockchain and a randomness provider.

View File

@ -7,10 +7,30 @@ It is **strongly recommended** to follow the [consumer best practices](https://d
## Installation
####Truffle/Hardhat
If you are using Truffle or Hardhat, simply install the NPM package:
```bash
npm install @pythnetwork/pyth-sdk-solidity
```
####Foundry
If you are using Foundry, you will need to create an NPM project if you don't already have one.
From the root directory of your project, run:
```bash
npm init -y
npm install @pythnetwork/pyth-sdk-solidity
```
Then add the following line to your `remappings.txt` file:
```text
@pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity
```
## Example Usage
To consume prices you should use the [`IPyth`](IPyth.sol) interface. Please make sure to read the documentation of this interface in order to use the prices safely.