Просмотр исходного кода

[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
Jayant Krishnamurthy 1 год назад
Родитель
Сommit
f172adb389

+ 21 - 1
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.

+ 20 - 0
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.