Practical overview
When it fits
Use it when integrating VIA Router route discovery and transaction preparation into a TypeScript application rather than relying on a standalone exchange interface.
Who it is for
Developers building wallet, trading, or other applications that need VIA route discovery and transaction-building functions.
Documented uses
- Find swap or bridge routes using source and destination chains, token addresses, and an amount.
- Check whether token approval is needed and build an approval transaction.
- Build a transaction for a selected route and check its status after submission.
Requirements & limits
The package is installed through npm and the documented client uses an API key. The README says the default key is limited to one request per second per IP and directs developers seeking higher limits to contact VIA.
- The SDK depends on the VIA Router API and requires API-key configuration.
- Route queries use chain IDs, token addresses, an amount, and optional sender information; returned routes can be paginated.
- The README documents multi-transaction routes as an option and notes token approval may be required.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Set up the VIA SDK and retrieve swap or bridge routes
Initialize the VIA client and request paginated routes for a specified source and destination token.
Before you start
- A TypeScript project with npm.
- Source and destination chain IDs, token addresses, and an amount.
- A sender address; the README notes it may be null.
Steps
Install the SDK with the command below.
npm i @viaprotocol/router-sdkImport
Viaand initialize a client with an API key, the router URLhttps://router-api.via.exchange, and a timeout, following the README example.Call
routesPages()and build route request parameters with source and destination details,multiTx, andlimit; set an offset for each page.Call
getRoutes()for the pages, as in the README example.
Expected outcome
The SDK returns route results for the requested swap or bridge parameters.
Guide limitations
- The README states that the default API key is limited to 1 request per second per IP.
- The README recommends pagination because requesting a specific page is faster than requesting all pages at once.
Check allowance and build approval and swap transactions
Use a selected route to check token allowance and obtain approval and swap or bridge transaction data.
Before you start
- A VIA client initialized as described in the SDK README.
- A route returned by
getRoutes(), including itsrouteId. - The wallet owner address, source token and amount, sender address, receive address, and action number.
Steps
Select a route from a non-empty route result and take its
routeId.Call
getAllowanceStatus()with the owner, route ID, and action number.If approval is needed, call
buildApprovalTx()with the route ID, owner, and action number.Call
buildTx()with the route ID, sender address, receive address, and action number to obtain transaction data for the route.
Expected outcome
The SDK provides allowance status and transaction data for approval when needed and for the selected swap or bridge route.
Guide limitations
- The README says the contract must be approved to spend the token; it does not document wallet submission or confirmation of the returned transaction data.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- viaprotocol/via-sdk-js · Official homepage title · retained in its source language

