v1 -> v2 Migration

Squid is launching v2! With this upgrade Squid delivers:

  • Lightning fast response times, always <1 sec, down to 300ms

  • Long term scaling improvements, we’re ready to handle hundreds of RPS

    • Each partner has an RPS limit in place, so please let us know if you need more!

Overview of Breaking Changes

As a part of this upgrade there are breaking changes you must implement to get access to the improved Squid v2

  1. Acquiring a v2 Integrator ID. Connect with the Squid team and we will enable your existing integratorID from a v1 Integrator ID to a v2Integrator ID.

    1. If you do not have a V1 Integrator ID to upgrade, you can apply for a v2 Integrator ID here and it will be sent to your email.

  2. Modify your hook implementations

    1. Including a fundAmount and fundToken to preHooks

    2. Include provider, description , and logoURI in both the preHook and postHook call

New SDK Version

npm install @0xsquid/sdk@^2.8.23

New Widget Version

Base URLs

Route Request Endpoint

Status Endpoint

Ethers version (Squid SDK integrations only)

Change /route from GET to POST

  • The /route endpoint is now POST. /status is still a /GET request.

Our SDK handles this behind the scenes. No changes needed

Importing types

  • v1:

  • v2: Slightly different import path

integrator-id is required on all requests in v2

v1

v2

V2 Parameters

API Migration

Migrating from v1 to v2, enables route requests under 1 second and sustainability scalability.. You can find out-of-the-box examples to implement Squid v2 in our github examples repo.

Route Request

The route request now uses the new endpoint and requires the updated Integrator ID in the headers.

Note the extraction of requestId from the response headers, which is now required for status checks.

Status Check

The status check endpoint has also been updated:

Ensure you're passing the requestId obtained from the route request.

API Parameter Changes

  • Include slippage as a number instead of an object

API Response Handling

  • Extract requestId from response headers for status checks

  • Use route.transactionRequest for transaction execution

SDK Migration

If you're using the Squid SDK, you can find the key changes to implement below. You can find out-of-the-box examples to implement Squid v2 and our SDK in our Github examples repo.

SDK Initialization

Initialize the SDK with the new base URL and your updated Integrator ID:

Get Route

The getRoute method now returns a requestId along with the route:

Execute Route

Use the transactionRequest object from the route to execute the transaction:

Check Status

Include the requestId when checking the transaction status:

Hook, Previously customContractCalls, Implementation (API and SDK)

customContractCalls have been renamed to postHook and postHook

Hooks now require additional parameters. Here are examples for both pre and postHooks:

PreHook Example

You can use a preHook to execute an action before a cross-chain swap.

PostHook Example

You can use a preHook to execute an action after a cross-chain swap.

Breaking Changes: Details And Examples

There are two required modifications to Request Params

  • slippage: NUMBER(0.01-99.99); this number can be 0.01 to 99.99 and represents the associated slippage with a transaction. This parameter is now optional and will be dynamically set by Squid if not included.

    • Recommendation: Slippage is an optional parameter. We recommend you don’t set the slippage value so it is dynamically set by Squid during the route request

      Request Params Modification Example for API

v1 Implementation
v2 Implementation

Request Params Modification Example for SDK

v1 Implementation
v2 Implementation

Hook Implementations

we have added a fundAmount and fundToken to preHooks. We have also added a provider, description , and logoURI to the both the preHook and postHook call.

Modified Hook Implementation API

v1 Implementation
v2 Implementation

Modified Hook Implementation SDK

v1 Implementation

v2 Implementation

Response Shape Change Example

Lastly, the request response shape has changed inside the actions steps. This is for integrators that utilize the request response.

  • Wrappers, bridges, and DEXes will now have an associated Provider: and logoURI: within the json response.

v1 Example Response
v2 Example Response

For more examples, you can explore our Github Examples Repo. Please reach out to us if you have any questions, thank you!

Last updated