From f172adb3890582df2874f11b8b61229d21b2a5a4 Mon Sep 17 00:00:00 2001 From: Jayant Krishnamurthy Date: Thu, 1 Feb 2024 09:52:31 -0800 Subject: [PATCH] [doc] Provide installation directions for Foundry (#1274) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../ethereum/entropy_sdk/solidity/README.md | 22 ++++++++++++++++++- target_chains/ethereum/sdk/solidity/README.md | 20 +++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/target_chains/ethereum/entropy_sdk/solidity/README.md b/target_chains/ethereum/entropy_sdk/solidity/README.md index 4cf406d2..ddbe5731 100644 --- a/target_chains/ethereum/entropy_sdk/solidity/README.md +++ b/target_chains/ethereum/entropy_sdk/solidity/README.md @@ -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. diff --git a/target_chains/ethereum/sdk/solidity/README.md b/target_chains/ethereum/sdk/solidity/README.md index acc61c7c..94e218c9 100644 --- a/target_chains/ethereum/sdk/solidity/README.md +++ b/target_chains/ethereum/sdk/solidity/README.md @@ -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.