This repository contains a suite of tests, scripts, and notebook templates to get started using the Synthetix Python SDK and interacting with the protocol. Visit tests for more information on testing contracts and creating test environments.
- Before you begin, ensure you have:
- An API key from Alchemy
- A wallet address and the private key for that address (optional)
- Installed Python 3.10 or greater
- Run
python --version
in your terminal to check
- Run
- Clone this repository:
git clone https://github.com/Synthetixio/sdk-playground.git
cd sdk-playground
- Install dependencies using uv:
uv sync
- Install Foundry:
Review the installation guide or run the following:
curl -L https://foundry.paradigm.xyz | bash
# install foundry
foundryup
- Install
ape
plugins:
uv run ape plugins install .
- Make a copy of the
.env.example
file, name it .env, and then enter the details for your RPC and wallet.
The private key is optional. If one is not provided, the SDK will simulate the specified address, but transaction signing will be disabled.
If you've completed the steps above, you can run any of the scripts in the scripts
directory using the Ape framework. For example:
# run the file at scripts/base_fork.py
uv run ape run base_fork
By default, these scripts won't submit transactions. To enable this, you must edit the script and set submit=True
. This precaution helps avoid unintended transactions on the blockchain.
Always use caution and carefully review the code before submitting transactions.
There are also some Jupyter notebooks that don't rely on the Ape framework. You can open these using VS Code or Jupyter Notebook. Use the environment created above to run these notebooks.
For example, if you've properly set up your notebook environment, you can copy the template from notebooks/templates/base_sepolia.ipynb
and start calling the contracts. If a private key is provided, you can also submit transactions.
For a full list of available methods, see the Python SDK documentation.