Git Product home page Git Product logo

routing-api's Introduction

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 :
    THROTTLE_PER_FIVE_MINS = '' # Optional
    WEB3_RPC_{CHAIN ID} = { RPC Provider}
    # RPC Providers must be set for the following CHAIN IDs:
    # MAINNET = 1
    # ROPSTEN = 3
    # RINKEBY = 4
    # GOERLI = 5
    # KOVAN = 42
    # OPTIMISM = 10
    # OPTIMISTIC_KOVAN = 69
    # ARBITRUM_ONE = 42161
    # ARBITRUM_RINKEBY = 421611
    # POLYGON = 137
    # POLYGON_MUMBAI = 80001
    # BNB = 56
    # BASE = 8453
    # BLAST = 81457
    # ZORA = 7777777
    # ZKSYNC = 324
    TENDERLY_USER = '' # For enabling Tenderly simulations
    TENDERLY_PROJECT = '' # For enabling Tenderly simulations
    TENDERLY_ACCESS_KEY = '' # For enabling Tenderly simulations
    TENDERLY_NODE_API_KEY = '' # For enabling Tenderly node-level RPC access
    ALCHEMY_QUERY_KEY = '' # For Alchemy subgraph query access
    GQL_URL = '' # The GraphQL endpoint url, for Uniswap graphql query access
    GQL_H_ORGN = '' # The GraphQL header origin, for Uniswap graphql query access
    
  3. Install and build the package
    npm install && npm run build
    
  4. 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:
    curl --request GET '<INSERT_YOUR_URL_HERE>/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:
curl --request GET '<INSERT_YOUR_URL_HERE>/quote?tokenInAddress=<0x...>&simulateFromAddress=<FROM_ADDRESS>&...'
  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:

    npm run test:e2e
    

routing-api's People

Contributors

andysmith415 avatar cgkol avatar conjunctivenormalform avatar ewilz avatar gndelia avatar jsy1218 avatar lint-action avatar lynnshaoyu avatar marktoda avatar matteenm avatar mhxw avatar mikeki avatar raghava-pamula avatar rileydcampbell avatar rollingtumbling avatar snreynolds avatar unicorn-here avatar willpote avatar xrsv avatar zhongeric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

routing-api's Issues

No Route Found for token

Issue: Upon trying to swap with the public Uniswap app to Holdenomics token (address 0x1d7e00a59297161d1733897b5add6a382cc6bf2a) the routing API returns no route found.

Expected behaviour: The API returns a route, as with other tokens.
Actual behaviour: No route found.

When the auto router API is turned off in settings, the V2 LP is found and trades can occur.

How can I run it locally ?

When I follow the document, I can easily install it in aws. But for some reason I need to run this api locally or on a VPS. How can I do that?

How to start the current project with localstack tool

I want to start a local service to test the current project, so I tried many methods. There is nothing better than localstack. I studied it, but it is stagnant at present, so I hope to have relevant local test documents. Thank you

Get error after deployed successd

After deployed the stack, I got the url like:

Outputs:
RoutingAPIStack.Url = https://xxxxxxx.execute-api.ap-southeast-1.amazonaws.com/prod/

BTW, this is my .env:
THROTTLE_PER_FIVE_MINS = '' # Optional
WEB_RPC_1 = "https://mainnet.infura.io/v3/xxxxxxxxxxxxxxxxxxxxxx"

Then I send the query :
curl --request GET 'https://xxxxxxxxxx.execute-api.ap-southeast-1.amazonaws.com/prod/quote?tokenInAddress=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenInChainId=1&tokenOutAddress=0x1f9840a85d5af5bf1d1762f925bdaddc4201f984&tokenOutChainId=1&amount=100&type=exactIn'

Getting internal_error:
{"errorCode":"INTERNAL_ERROR","detail":"Unexpected error","id":"fee8f"}

And the id is different each time I try to query the same params.

Is therr any configs I set wrongly?
Branch: main
commit: 98439fa

Aws secret Manager

Hi,
There is a problem that I am trying to figure out since 1 day, the APIs are successfully deployed on AWS. But during API calls It returns an internal server error in response. can any one helps me to understand the aws secret manager to write the secrete in the aws code.

Despite successful deployment, the API remains uncallable.

"After successfully deploying the routing-api, I attempted to invoke it using the command: curl --request GET 'https://xxxxx.execute-api.xxx.amazonaws.com/prod/quote?tokenInAddress=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenInChainId=1&tokenOutAddress=0x1f9840a85d5af5bf1d1762f925bdaddc4201f984&tokenOutChainId=1&amount=100&type=exactIn'. However, it resulted in an error:
{"errorCode":"INTERNAL_ERROR","detail":"Unexpected error","id":"0e6df"}.

Below is my .env file configuration. I am wondering if there is an error in my .env file setup. The code is based on the latest commit ab901a7.

cdk deploy error 'RoutingAPI-SEV3-Simulation'

I got an error message when deploying a RoutingAPIStack.
There is already a Construct with name 'RoutingAPI-SEV3-Simulation' in RoutingAPIStack [RoutingAPIStack]

In routing-api-stack.ts, 'simulationAlarmSev2' and 'simulationAlarmSev3' are the same alarm name 'RoutingAPI-SEV3-Simulation'.

Create record to show possible url paths in ipfs

Currently there is no way of knowing what cached pool data is available to grab through ipfs so we want to add a record that populates the urls for fetching pool data on ipfs for the various chains

RoutingAPIStack high monthly cost on AWS

Hi! thanks for this excellent piece of software. I have deployed RoutingAPIStack to AWS and am surprised by the relatively high AWS charges. I have $25 in lambda usage fees despite only having used the API for less 100 queries over 6 days.

Specifically, I see the following in my AWS bill:

AWS Lambda - Total Compute - US East (Ohio)-Tier-1 | 1,563,577.501 Lambda-GB-Second   USD 26.06

If this bill scales w/ actual usage it won't be feasible for me to integrate this API--and Uniswap--with my product. Is there a large upfront cost to setting up the RoutingAPIStack, perhaps upfront caching, or should I expect the cost to scale linearly with my users?

Getting 500 Error from API's

Hi,
There is a problem that I am trying to figure out since 1 day, the APIs are successfully deployed on AWS. But during API calls It returns an internal server error in response. I followed the steps in the documentation which is connected to an AWS account and it deployed successfully.

Clarify blocklist reasoning

In the latest update for the blocklist the update includes an entry for

b493f3a#diff-3b254b61721239b3517f6d8212a09403b8231d3852cfe70e2ec73b048fee3155R1109-R1112

      "address": "0x76175599887730786bdA1545D0D7AcE8737fEBB1",
      "name": "ENS DAO",
      "symbol": "ENS",
      "decimals": 18

This is a fake ENS DAO token. The correct token contract is at 0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72.

Can you add clarification that its blocked because its fake, under the keyword values

  "keywords": ["uniswap", "unsupported", "broken"]

Thanks

Error query parameters not found

Hey Uniswap Team,
I was trying to make the necessary changes to get the routing api server work for our chain, hence i needed a local environment, some searching showed, aws sam could be used to test it out locally, so i did cdk synth , gave the template files for different region out into sam build <path to one of the region template file>,
and used the command sam local start-lambda to run the api server
issue is am trying to run the curl command given in the readme.md of the repo :
"curl --request GET '<INSERT_YOUR_URL_HERE>/quote?tokenInAddress=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenInChainId=1&tokenOutAddress=0x1f9840a85d5af5bf1d1762f925bdaddc4201f984&tokenOutChainId=1&amount=100&type=exactIn'
" but i seem to be getting the error, query parameters are not supported is it because aws sam cannot be used to deploy the routing api locally or the readme.md is outdated and the api has been changed into a post?

Cryptic errors are not useful

Each time the error Unexpected error. is returned, log is fired with more information. I would like to know, where I can even see this log entries. I also don't believe that returning Unexpected error. error message somehow provides more security then Unexpected error building request injected. error message for example or that it has any other benefit at all.

It wouldn't require much effort to change error messages, I could do it based on log entries, but it wouldn't alleviate this issue entirely as log entries are pretty cryptic as well.

https://github.com/Uniswap/routing-api/blob/954e04080dbc41cc899b5f157cf10093b3866914/lib/handlers/handler.ts#L75C1-L84C2

Routing Breaks for large liquidity amounts

Not sure exactly why this happens, but if you quote large amounts the routing breaks.

Take this example:

100,000 Matic yields more during the swap then 1,000,000 matic

image

image

While this may not seem like a major issue in this context, it is when you have a smaller amount of liquidity, and your using mixed routing for v2/v3.

How can I deploy the API to a Linux server?

I've deployed the API to an AWS stack but I want to deploy to my Linux server too. How can I done that? I've tried to create and run a Docker container but it didn't work.

Change naming of JSON_RPC_PROVIDER urls to use the Chain Name instead of ChainId

If the idea is to keep routing-api inline with SOR usage, the .env variables should be:

   JSON_RPC_PROVIDER_{CHAIN NAME} = { RPC Provider}
   # Ex: JSON_RPC_PROVIDER_MAINNET
   ...

It's also a lot easier to read

Also update README to remove // in example CURL req
curl --request GET '<INSERT_YOUR_URL_HERE>/quote?tokenInAddress=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenInChainId=1&tokenOutAddress=0x1f9840a85d5af5bf1d1762f925bdaddc4201f984&tokenOutChainId=1&amount=100&type=exactIn'
to
curl --request GET '<INSERT_YOUR_URL_HERE>quote?tokenInAddress=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&tokenInChainId=1&tokenOutAddress=0x1f9840a85d5af5bf1d1762f925bdaddc4201f984&tokenOutChainId=1&amount=100&type=exactIn'

indexing_error while fetching pools on subgraph

I had this issues while while fetching pools on the subgraph

{
    "name": "RoutingLambda",
    "requestId": "73a213f3-bd36-da34-83c6-db19e46c028b",
    "hostname": "169.254.81.245",
    "pid": 12,
    "level": 30,
    "err": {
        "message": "indexing_error: {\"response\":{\"errors\":[{\"message\":\"indexing_error\"}],\"status\":200,\"headers\":{}},\"request\":{\"query\":\"\\n      query getPools($pageSize: Int!, $id: String) {\\n        pools(\\n          first: $pageSize\\n          \\n          where: { id_gt: $id }\\n        ) {\\n          id\\n          token0 {\\n            symbol\\n            id\\n          }\\n          token1 {\\n            symbol\\n            id\\n          }\\n          feeTier\\n          liquidity\\n          totalValueLockedUSD\\n          totalValueLockedETH\\n        }\\n      }\\n    \",\"variables\":{\"pageSize\":1000,\"id\":\"\"}}}",
        "name": "Error",
        "stack": "Error: indexing_error: {\"response\":{\"errors\":[{\"message\":\"indexing_error\"}],\"status\":200,\"headers\":{}},\"request\":{\"query\":\"\\n      query getPools($pageSize: Int!, $id: String) {\\n        pools(\\n          first: $pageSize\\n          \\n          where: { id_gt: $id }\\n        ) {\\n          id\\n          token0 {\\n            symbol\\n            id\\n          }\\n          token1 {\\n            symbol\\n            id\\n          }\\n          feeTier\\n          liquidity\\n          totalValueLockedUSD\\n          totalValueLockedETH\\n        }\\n      }\\n    \",\"variables\":{\"pageSize\":1000,\"id\":\"\"}}}\n    at /var/task/index.js:80:13966\n    at l (/var/task/index.js:80:9141)\n    at Object.next (/var/task/index.js:80:8445)\n    at p (/var/task/index.js:80:8003)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
    },
    "msg": "Failed to get pools from subgraph. Retry attempt: 1",
    "time": "2024-02-16T06:47:49.956Z",
    "v": 0
}

As a result poolCache.json for chains like polygon aren't created, so the routing-api can't work.

I use the main branch with the .env like this (didn't change the code)

TENDERLY_USER=xxx
TENDERLY_PROJECT=xxx
TENDERLY_ACCESS_KEY=xxx
THROTTLE_PER_FIVE_MINS=''
JSON_RPC_PROVIDER_1=https://mainnet.infura.io/v3/xxx
JSON_RPC_PROVIDER_3=https://ropsten.infura.io/v3/xxx
JSON_RPC_PROVIDER_4=https://rinkeby.infura.io/v3/xxx
JSON_RPC_PROVIDER_5=https://goerli.infura.io/v3/xxx
JSON_RPC_PROVIDER_42=https://kovan.infura.io/v3/xxx
JSON_RPC_PROVIDER_10=https://optimism-mainnet.infura.io/v3/xxx
JSON_RPC_PROVIDER_69=https://optimism-kovan.infura.io/v3/xxx
JSON_RPC_PROVIDER_42161=https://arbitrum-mainnet.infura.io/v3/xxx
JSON_RPC_PROVIDER_421611=https://arbitrum-rinkeby.infura.io/v3/xxx
JSON_RPC_PROVIDER_80001=https://polygon-mumbai.infura.io/v3/xxx
JSON_RPC_PROVIDER_421613=https://arbitrum-rinkeby.infura.io/v3/xxx
JSON_RPC_PROVIDER_11155111=https://polygon-mumbai.infura.io/v3/xxx
JSON_RPC_PROVIDER_42220=https://optimism-mainnet.infura.io/v3/xxx
JSON_RPC_PROVIDER_44787=https://optimism-kovan.infura.io/v3/xxx
JSON_RPC_PROVIDER_43114=https://arbitrum-mainnet.infura.io/v3/xxx
JSON_RPC_PROVIDER_8453=https://kovan.infura.io/v3/xxx
JSON_RPC_PROVIDER_56=​https://bsc-dataseed4.binance.org/​
JSON_RPC_PROVIDER_137=https://polygon-mainnet.g.alchemy.com/v2/xxx
UNI_RPC_PROVIDER_CONFIG='{}'
UNICORN_SECRET=''

xxx is the infuraId or alchemyId

Or are there any public routing URL services for the uniswap widget?

sample env improvement

THROTTLE_PER_FIVE_MINS = '' # Optional
JSON_RPC_PROVIDER_{CHAIN ID} = { RPC Provider}

RPC Providers must be set for the following CHAIN IDs:

MAINNET = 1

ROPSTEN = 3

RINKEBY = 4

GOERLI = 5

KOVAN = 42

OPTIMISM = 10

OPTIMISTIC_KOVAN = 69

ARBITRUM_ONE = 42161

ARBITRUM_RINKEBY = 421611

POLYGON = 137

POLYGON_MUMBAI = 80001

BNB = 56

TENDERLY_USER = '' # For enabling Tenderly simulations
TENDERLY_PROJECT = '' # For enabling Tenderly simulations
TENDERLY_ACCESS_KEY = '' # For enabling Tenderly simulations

I have set the rpc url but its throw internal server error, Can you please update a required field in sample env file for better understanding.

Thanks.

Failure to deploy

I successfully deployed and used routing api. I then undeployed it running cdk destroy RoutingAPIStack. Now when I try to deploy it again a get an error at some point during deployment process. I'm not sure how to diagnose this. I tried to revert back to the older version of routing api I used previously. I tried to delete s3 buckets that were left after the process and repeated bootstrapping process hoping to arrive at a known state. Now my only assumption would be that the problem is that I use AWS CDK v2, which documentation says should be compatible anyways.

I want a confirmation if the problem is on my end or not and to take a hint as to what is the source of the problem and how to fix it.

    at FullCloudFormationDeployment.monitorDeployment (/usr/lib/node_modules/aws-cdk/lib/index.js:426:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/usr/lib/node_modules/aws-cdk/lib/index.js:429:153380)
    at async /usr/lib/node_modules/aws-cdk/lib/index.js:429:137002

The stack named RoutingAPIStack failed creation, it may need to be manually deleted from the AWS console: 
ROLLBACK_COMPLETE: Embedded stack arn:aws:cloudformation:region:id:stack/RoutingAPIStack-RoutingDatabaseStackNestedStackRoutingDatabaseStackNestedStackResource-9FQTG2UOR6G0/8afadc00-400e-11ee-83a6-0a8c8e93396c was not successfully created: 
The following resource(s) failed to create: [CacheReqFlagDB8C36522C, RouteCachingDB1361CA88, V3PoolsCachingDB667282EE]. 

Use RPC URL rather than Infura project ID

Hello, we are using the routing API and would like to spin up multiple routing API nodes with connections to different rpc URLS. It seems currently this project depends on an infura project ID. Is there a workaround or is roadmapped?

Cheers thanks for the project,
Kyle

Installation Error:: `@uniswap/router-sdk missing`

npm ERR! 404  '@uniswap/router-sdk@https://registry.npmjs.org/@uniswap/router-sdk/-/router-sdk-1.0.0-beta.3.tgz' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)

I tried installing it directly from github sudo npm install --save https://github.com/Uniswap/router-sdk.git
but it leads to more errors


lib/cron/cache-pools.ts:1:26 - error TS2307: Cannot find module '@uniswap/router-sdk' or its corresponding type declara                                             tions.

1 import { Protocol } from '@uniswap/router-sdk'
                           ~~~~~~~~~~~~~~~~~~~~~

lib/handlers/quote-to-ratio/quote-to-ratio.ts:2:26 - error TS2307: Cannot find module '@uniswap/router-sdk' or its corr                                             esponding type declarations.

2 import { Protocol } from '@uniswap/router-sdk'
                           ~~~~~~~~~~~~~~~~~~~~~

lib/handlers/quote-to-ratio/quote-to-ratio.ts:215:38 - error TS2339: Property 'pools' does not exist on type 'V3Route |                                              V2Route'.
  Property 'pools' does not exist on type 'V2Route'.

215         const pools = subRoute.route.pools
                                         ~~~~~

lib/handlers/quote-to-ratio/quote-to-ratio.ts:258:38 - error TS2339: Property 'pairs' does not exist on type 'V3Route |                                              V2Route'.
  Property 'pairs' does not exist on type 'V3Route'.

258         const pools = subRoute.route.pairs
                                         ~~~~~

lib/handlers/quote/quote.ts:2:26 - error TS2307: Cannot find module '@uniswap/router-sdk' or its corresponding type dec                                             larations.

2 import { Protocol } from '@uniswap/router-sdk'
                           ~~~~~~~~~~~~~~~~~~~~~

lib/handlers/quote/quote.ts:228:38 - error TS2339: Property 'pools' does not exist on type 'V3Route | V2Route'.
  Property 'pools' does not exist on type 'V2Route'.

228         const pools = subRoute.route.pools
                                         ~~~~~

lib/handlers/quote/quote.ts:271:38 - error TS2339: Property 'pairs' does not exist on type 'V3Route | V2Route'.
  Property 'pairs' does not exist on type 'V3Route'.

271         const pools = subRoute.route.pairs
                                         ~~~~~

lib/handlers/router-entities/aws-subgraph-provider.ts:1:26 - error TS2307: Cannot find module '@uniswap/router-sdk' or                                              its corresponding type declarations.

1 import { Protocol } from '@uniswap/router-sdk'
                           ~~~~~~~~~~~~~~~~~~~~~

lib/util/pool-cache-key.ts:1:26 - error TS2307: Cannot find module '@uniswap/router-sdk' or its corresponding type decl                                             arations.

1 import { Protocol } from '@uniswap/router-sdk'
                           ~~~~~~~~~~~~~~~~~~~~~

node_modules/@uniswap/smart-order-router/build/main/src/routers/alpha-router/alpha-router.d.ts:1:26 - error TS2307: Can                                             not find module '@uniswap/router-sdk' or its corresponding type declarations.

1 import { Protocol } from '@uniswap/router-sdk';
                           ~~~~~~~~~~~~~~~~~~~~~

node_modules/@uniswap/smart-order-router/build/main/src/routers/alpha-router/entities/route-with-valid-quote.d.ts:1:26                                              - error TS2307: Cannot find module '@uniswap/router-sdk' or its corresponding type declarations.

1 import { Protocol } from '@uniswap/router-sdk';
                           ~~~~~~~~~~~~~~~~~~~~~

node_modules/@uniswap/smart-order-router/build/main/src/routers/alpha-router/entities/route-with-valid-quote.d.ts:40:25                                              - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum refere                                             nce.

40     readonly protocol = Protocol.V2;
                           ~~~~~~~~~~~

node_modules/@uniswap/smart-order-router/build/main/src/routers/alpha-router/entities/route-with-valid-quote.d.ts:72:25                                              - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum refere                                             nce.

72     readonly protocol = Protocol.V3;
                           ~~~~~~~~~~~

node_modules/@uniswap/smart-order-router/build/main/src/routers/router.d.ts:2:23 - error TS2307: Cannot find module '@u                                             niswap/router-sdk' or its corresponding type declarations.

2 import { Trade } from '@uniswap/router-sdk';

Cannot read property 'getTokenByAddress' of undefined

Hi i am getting this error on the Cloudwatch management console. Please help me to resolve it.

{
"name": "quote",
"requestId": "d671c605-6513-471f-a8cc-bdb235999d4e",
"hostname": "169.254.8.89",
"pid": 12,
"quoteId": "d671c",
"tokenInAddress": "0xc778417E063141139Fce010982780140Aa0cD5Ab",
"chainId": 3,
"tokenOutAddress": "0xA3e7390D6Ae19161925Df844Fe0B84cDBc87552B",
"amount": "10000000000000000",
"type": "exactOut",
"level": 50,
"err": {
"message": "Cannot read property 'getTokenByAddress' of undefined",
"name": "TypeError",
"stack": "TypeError: Cannot read property 'getTokenByAddress' of undefined\n at Xp (/lib/handlers/shared.ts:108:37)\n at uk.handleRequest (/lib/handlers/quote/quote.ts:67:30)\n at null. (/lib/handlers/handler.ts:168:52)"
},
"msg": "Unexpected error in handler",
"time": "2022-09-02T11:18:42.796Z",
"v": 0
}

Client-side Routing: Setup IPFS pool cache

Issue

  • Routing requires a list of all pools in V3. This data is not easily available on-chain, so today we pull it from the Subgraph.
  • To minimize dependencies on the Subgraph and improve latency, we have a cron job that runs every 5-10 minutes. It queries the Subgraph to get all the pools, and saves them into S3. Each request to the routing API queries this file in S3 to gets the list of pools.
  • For client-side routing we want to remove dependencies on hosted services, therefore we would like to move this pool cache file to IPFS. The interface would then query IPFS to get pools for routing.
  • Since IPFS files are immutable, and we'd like to update this pool cache every few minutes, we need to put it behind a stable IPNS address.

Tasks

  • Run plan by legal around storing this pool cache, and whether it can contain blocked tokens or not
  • Update cron job to publish the pool list to IPFS/IPNS
  • Update routing API to read pools from IPNS instead of S3

Update Optimism swap calldata based on compression alg

Optimism is updating their sequencer to use a compression alg for lower gas costs. Since we are calculating the gas manually in the gas model we'll need to update the calldata bytes to reflect how the compression is generating calldata.

Referencing this post

$PARA [Para Token] Balance not loading

Token Address: 0x32879B5C0fDbc2A81597F019717b412B9d755A09
Token Name (from contract): Para Token
Token Symbol (from contract): $PARA

Please review the API routing for this token, no balance loading @willpote, does CoinGecko and CoinMarketCap have any input in the results displayed in Uniswap?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.