👩💻Merkl API V4 NPM Package
Easily interact with the Merkl API using the dedicated NPM package
Last updated
Easily interact with the Merkl API using the dedicated NPM package
Last updated
Merkl API V4 comes with a dedicated NPM package to help you interact with it.
This quickstart guide will help you get started with interacting with the Eden Treaty app object using the Merkl API package.
To begin, install the @merkl/api
package into your project:
Here's a step-by-step guide to instantiating the Merkl API object and making API calls.
Initialize the Merkl API object by providing the base URL. Developers can leverage autocomplete features in their IDEs since all methods are strongly typed, ensuring a seamless development experience:
Below are examples of common API calls you can make. When making API calls, you can pass query
parameters as an object under the query
property and path
parameters directly in the method arguments, as shown in the examples below:
Retrieve a list of opportunities filtered by a specific chainId
:
Retrieve rewards for a specific user address. Note that all methods are strongly typed for better developer experience: this ensures reduced debugging time, as incorrect parameter usage is flagged early, and improved code completion in supported IDEs for faster development.
Retrieve campaigns filtered by token symbol, such as USDC
:
All API responses are wrapped within a data
attribute. This consistency across all API calls ensures that developers can reliably access the actual response payload. Access this attribute to get the actual response payload.
The Merkl API object methods are strongly typed, making it easier to catch errors during development.
For additional documentation and advanced usage, refer to the Merkl API swagger.
You're now ready to interact with the Merkl API! 🎉