Quickstart
Learn how to integrate the Eco Routes SDK to enable cross-chain stablecoin transfers.
This guide will help you integrate the Eco Routes SDK to enable one-click stablecoin transfers across chains.
In this quickstart, you will:
Install SDK
Install the Eco SDK and peer dependency.
Create Transfer Intent
Create a Stable transfer intent to send USDC from Optimism to Base.
Request and Apply a Quote
Get quotes for the Eco Network to fulfill your intent.
Publish Intent
Publish your intent to chain.
Step 1: Installation
Install the SDK along with its peer dependencies:
Step 2: Creating an Intent
An intent represents the desired transfer outcome on a destination chain. The below code shows creating an intent that sends
USDC from Optimism (Chain ID 10
) to Base (Chain ID 8453
).
To create a simple stable send intent, create an instance of the RoutesService
and call createSimpleIntent
with the required parameters:
Step 3: Request and Apply a Quote
To request quotes for an intent and select the cheapest quote, use the OpenQuotingClient
and selectCheapestQuote
functions.
Then, you can apply the quote by calling applyQuoteToIntent
on the RoutesService
instance:
Step 4: Publishing the Intent
Once the intent is prepared, publish it to the origin chain using your preferred web3 library. Here’s an example
leveraging viem
.
Congrats! You just finished your first stablesend using Eco.
Keeping dependencies updated
Run the following command to ensure you’re using the latest versions: