Skip to main content

How do I use the Enso SDK?

Install @ensofinance/sdk and create an EnsoClient with your API key. Use it for Route, Bundle, protocol data, and balances. Install from the current docs page so the version stays accurate.

J
Written by Javier Diaz

Install @ensofinance/sdk and create an EnsoClient with your API key. The SDK wraps Route, Bundle, protocol data, approvals, and balances. Install from the current docs page so the package name and methods stay accurate.

Definition

The Enso SDK is a JavaScript library for calling the Enso API from an application, instead of writing every HTTP request by hand.

How it works

  • Install with your package manager, for example npm install @ensofinance/sdk (yarn, pnpm, and bun are also documented).

  • Construct new EnsoClient({ apiKey: "YOUR_API_KEY" }).

  • Call methods such as getRouteData and getBundleData with the same concepts as the REST API: fromAddress, tokenIn, tokenOut, amountIn, slippage, and routingStrategy.

  • Submit the returned tx with your wallet library. Use string amounts, and handle EnsoApiError when a call fails.

How Enso does this

The SDK page documents installation, EnsoClient, routing strategies, and core methods. The public package name is @ensofinance/sdk. This article does not pin a version number; use the version you install from the current page. For HTTP-only testing, you can still call https://api.enso.build with curl.

FAQ

Does the SDK replace an API key?

No. You still create a key in the Developer Portal and pass it into EnsoClient.

Are legacy routing strategies for new apps?

The SDK lists legacy strategy values, but Routing Strategies says they should not be selected for new implementations. Use router, delegate, or ensowallet-v2.

Related articles

  • How do I call the Route API with curl?

  • How do I authenticate Enso API requests?

  • How do I get an Enso API key?

  • What is a routing strategy?

  • How do I bundle multiple DeFi actions into one transaction?

Sources

Did this answer your question?