Socket
Book a DemoInstallSign in
Socket

@suave-money/sdk

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@suave-money/sdk

The Suave SDK enables effective usage of the [Suave Bridge Aggregation API](https://docs.suave.money/suave.ag/api/routes) from TypeScript or JavaScript. Use this toolkit to find desirable cross-chain swapping routes and handle route execution.

latest
npmnpm
Version
1.0.2
Version published
Maintainers
2
Created
Source

Suave SDK

The Suave SDK enables effective usage of the Suave Bridge Aggregation API from TypeScript or JavaScript. Use this toolkit to find desirable cross-chain swapping routes and handle route execution.

DISCLAIMER: This SDK currently only supports executing routes in a browser-like environment.

Installation

You will need to also have viem installed to get started. To install everything with npm, use this command:

npm install --save @suave_money/sdk viem

Getting Started - Requesting Route Quotes

Here is an example of obtaining route qoutes from Suave:

import { getRoutes, RouteResponse } from '@suave_money/sdk'

// Find a route for USDC on Arbitrum -> DAI on Polygon
const routes: RouteResponse[] = await getRoutes({
  inputAmount: '10000000', // 10 USDC
  fromChainId: 42161, // Arbitrum
  fromToken: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // USDC on Arbitrum
  toChainId: 137, // Polygon
  toToken: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', // DAI on Polygon
})

Getting Started - Executing Route Quotes

Here is an example of executing a route:

import { executeRoute, RouteResponse } from '@suave_money/sdk'
import { createWalletClient, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = createWalletClient({
  chain: mainnet,
  transport: http()
})

const routes: RouteResponse[] = /* ... */

const chosenRoute = routes[0]

await executeRoute(chosenRoute, {
  walletClient: client
})

FAQs

Package last updated on 15 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts