Installing Narya SDK

You can install Narya SDK in two ways:

  1. As an NPM module
  2. As a Git submodule, like what the Foundry framework does.

If you already use npm or yarn to manage your dependencies, you may want to continue using the NPM way so that all your dependencies are in one place. Otherwise, you may want to use the Foundry way as it's a simple git submodule.

Installing via NPM

If you prefer to use NPM, you can install the SDK @narya-ai/contracts using npm or yarn, for example:

npm install --save-dev @narya-ai/contracts
# or
yarn add --dev @narya-ai/contracts

This will add the SDK to the node_modules folder.

Installing via Git Submodule / Foundry

If you prefer to use Foundry to manage dependencies, you can install the SDK:

# If not installed, follow the instructions at https://github.com/foundry-rs/foundry#installation

# Install Narya SDK
forge install https://github.com/NaryaAI/narya-contracts

If you prefer to use Git submodule directly, you can install the SDK:

git submodule add https://github.com/NaryaAI/narya-contracts lib/narya-contracts
git submodule update --init --recursive

Both commands will add the Narya SDK under the lib/narya-contracts folder.

remappings.txt

It's important to keep the remappings.txt file under your repo root in sync with how the Narya SDK is installed so that the engine can find the right definitions.

Create a new file remappings.txt in your project root folder if you don't already have one.

If you install the Narya SDK via NPM, update your remappings.txt file to look like this:

@narya-ai/=node_modules/@narya-ai/
ds-test/=node_modules/@narya-ai/contracts/lib/forge-std/lib/ds-test/src/
forge-std/=node_modules/@narya-ai/contracts/lib/forge-std/src/

If you install the Narya SDK via Git submodule or forge install, update your remappings.txt file to look like this:

@narya-ai/contracts/=lib/narya-contracts/
ds-test/=lib/narya-contracts/lib/forge-std/lib/ds-test/src/
forge-std/=lib/narya-contracts/lib/forge-std/src/

Next Steps

Now it's time to write your first test!