Development
Integrating
To integrate the Sablier V2 Merkle API into your own product, start from the official @sablier/v2-merkle-api
repository. We recommend using:
Contributing
To contribute to the V2 Merkle API or deploy your own, head over to the GitHub
v2-merkle-api
repository. Get started by reviewing the controllers
directory.
Running an instance
Locally
In order to make the API work properly, you will need to create a .env
file by following the .env.example
file:
PINATA_ACCESS_TOKEN=
PINATA_API_KEY=
PINATA_API_SERVER=
PINATA_SECRET_API_KEY=
IPFS_GATEWAY=
After a campaign is created via the API, we use Pinata to upload and pin the file to IPFS. In order to obtain the
PINATA_API_KEY
, PINATA_SECRET_API_KEY
and PINATA_ACCESS_TOKEN
, follow these steps:
- Sign up or log in on https://app.pinata.cloud/
- Select the API Keys tab
- Select New Key
- The key should have the permissions
pinFileToIPFS
andpinJSONToIPFS
- Set a name for the key
- Click Create Key
- From the popup, take the API Key and the API Secret and put them in the
.env
file. TheIPFS_GATEWAY
variable can be any IPFS gateway but we recommend using a private one (Pinata offers this as well). For more details about the interactions with IPFS, checksrc/services/ipfs.rs
. - Select the "Access Controls" tab
- Click on the "Request Token" button
- Copy the token and put in th
.env
file in thePINATA_ACCESS_TOKEN
variable
Simulate the cloud environment by finally running:
$ cargo run --bin sablier_merkle_api
This command will run a standard web API and expose it on port 3000 on localhost.
Vercel
We use Vercel for hosting, and this is why we have separate binaries for each endpoint. For local development, use this command:
$ vercel dev
This command will run a standard web API and expose it on port 3000 on localhost.
If you wish to deploy your backend to vercel, check the official
Github Actions
workflow for deploying. Rust is supported through Vercel's rust runtime
.