百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

routing-api

> 编程语言
开源

Uniswap Routing API 此仓库包含了 Uniswap V3 协议的路由 API。它部署了一个使用 @uniswap/smart-ord 协议的 API,部署在 AWS 上。

198 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Uniswap Routing API 此仓库包含了 Uniswap V3 协议的路由 API。它部署了一个使用 @uniswap/smart-ord 协议的 API,部署在 AWS 上。

Uniswap Routing API

This repository contains routing API for the Uniswap V3 protocol.

It deploys an API to AWS that uses @uniswap/smart-order-router to search for the most efficient way to swap token A for token B.

Development

To develop on the Routing API you must have an AWS account where you can deploy your API for testing.

Deploying the API

The best way to develop and test the API is to deploy your own instance to AWS.

  1. Install and configure AWS CLI and AWS CDK V1.
  2. Create .env file in the root directory of the project with :
…
  1. Install and build the package
    bash
    npm install && npm run build
  2. To deploy the API run:
    cdk deploy RoutingAPIStack
    This will deploy to the default account your AWS CLI is configured for. Once complete it will output something like:
    RoutingAPIStack.Url = https://...
    You can then try it out:
    bash
    curl --request GET '/quote?tokenInAddress=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenInChainId=1&tokenOutAddress=0x1f9840a85d5af5bf1d1762f925bdaddc4201f984&tokenOutChainId=1&amount=100&type=exactIn'

Tenderly Simulation

  1. To get a more accurate estimate of the transaction's gas cost, request a tenderly simulation along with the swap. This is done by setting the optional query param "simulateFromAddress". For example:
bash
curl --request GET '/quote?tokenInAddress=&simulateFromAddress=&...'
  1. Tenderly simulates the transaction and returns to us the simulated gasLimit as 'gasUseEstimate'. We use this gasLimit to update all our gas estimate heuristics. In the response body, the
{'gasUseEstimate':string, 'gasUseEstimateQuote':string, 'quoteGasAdjusted':string, and 'gasUseEstimateUSD':string}

fields will be updated/calculated using tenderly gasLimit estimate. These fields are already present even without Tenderly simulation, however in that case they are simply heuristics. The Tenderly gas estimates will be more accurate.

  1. If the simulation fails, there will be one more field present in the response body: 'simulationError'. If this field is set and it is set to true, that means the Tenderly Simulation failed. The
{'gasUseEstimate':string, 'gasUseEstimateQuote':string, 'quoteGasAdjusted':string, and 'gasUseEstimateUSD':string}

fields will still be included, however they will be heuristics rather then Tenderly estimates. These heuristic values are not reliable for sending transactions on chain.

Testing

Unit Tests

Unit tests are invoked by running npm run test:unit in the root directory. A 'watch' mode is also supported by running npm run test:unit:watch.

Integration Tests

Integration tests run against a local DynamoDB node deployed using dynamodb-local. Note that JDK 8 is a dependency of this package. Invoke the integration tests by running npm run test:integ in the root directory.

End-to-end Tests

The end-to-end tests fetch quotes from your deployed API, then execute the swaps on a Hardhat mainnet fork.

  1. First deploy your test API using the instructions above. Then update your .env file with the URL of the API, and the RPC URL of an archive node:

    UNISWAP_ROUTING_API='...'
    ARCHIVE_NODE_RPC='...'
  2. Run the tests with:

    bash
    npm run test:e2e

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言