OpenViSTAI · Agents · Blockchain · Crypto
Menu
Exchanges & Trading

VIA SDK

VIA SDK is a TypeScript package that wraps the VIA Router API for discovering on-chain and cross-chain swap routes, checking token allowances, building approval and swap or bridge transactions, and checking transaction status.

Independent OpenViST project profile, based on linked sources.

VIA SDK — OpenViST project profile in Exchanges & Trading.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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.

Source-based practical guide

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

  1. Install the SDK with the command below.

    Documented command
    npm i @viaprotocol/router-sdk
  2. Import Via and initialize a client with an API key, the router URL https://router-api.via.exchange, and a timeout, following the README example.

  3. Call routesPages() and build route request parameters with source and destination details, multiTx, and limit; set an offset for each page.

  4. 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.
Source-based practical guide

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 its routeId.
  • The wallet owner address, source token and amount, sender address, receive address, and action number.

Steps

  1. Select a route from a non-empty route result and take its routeId.

  2. Call getAllowanceStatus() with the owner, route ID, and action number.

  3. If approval is needed, call buildApprovalTx() with the route ID, owner, and action number.

  4. 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.
Evidence and transparency

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