How can i retrive the Route for two tokens that have not a pair ?

The following code uses two tokens that doesn't have a pair on uniswap, and during the execution encouter an error that is reported below. The same code if applied on tokens with a pair works well ( forx example WETH and DAI ) , so i am wondering what i have to change to make this works also with tokens without a pair?

Documentation Reference: https://docs.uniswap.org/sdk/2.0.0/reference


const { ChainId, Token, TokenAmount, Pair, Route, Fetcher } = require("@uniswap/sdk");

( async () => {
    const AKITA = new Token(
    const SHIBA = new Token(
    const pair = await Fetcher.fetchPairData(AKITA, SHIBA);
    const route = new Route([pair], SHIBA)  
    const trade = new Trade(route, new TokenAmount( SHIBA, '1000000000000000000' ), TradeType.EXACT_INPUT)


Warning: 0x3301ee63fb29f863f2333bd4466acb46cd8323e6 is not checksummed.
Warning: 0xf32aa187d5bc16a2c02a6afb7df1459d0d107574 is not checksummed.
(node:138647) UnhandledPromiseRejectionWarning: Error: call revert exception (method="getReserves()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.4.1)
    at Logger.makeError (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/node_modules/@ethersproject/logger/lib/index.js:199:21)
    at Logger.throwError (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/node_modules/@ethersproject/logger/lib/index.js:208:20)
    at Interface.decodeFunctionResult (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface.js:384:23)
    at Contract.<anonymous> (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/lib/index.js:338:56)
    at step (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/lib/index.js:48:23)
    at Object.next (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/lib/index.js:29:53)
    at fulfilled (/home/pero/projects/web3-testing/node_modules/@ethersproject/contracts/lib/index.js:20:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:138647) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:138647) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.