joshstevens19 / simple-uniswap-sdk

Uniswap SDK which handles the routes automatically for you, changes in trade quotes reactive subscriptions, exposure to formatted easy to understand information, bringing back the best trade quotes automatically, generating transactions for you and much more.
MIT License
188 stars 95 forks source link

Must have a `fromTokenContractAddress` on the context #31

Closed elhaix closed 2 years ago

elhaix commented 2 years ago

When defining a UniswapPair:

 const uniswapPair = new UniswapPair({
   fromTokenContractAddress: fromTokenContractAddress,
   toTokenContractAddress: toTokenContractAddress,
   walletAddress: walletAddress,
   chainId: ChainId.ROPSTEN,
 });

Exception: Must have a fromTokenContractAddress on the context

C:\Dev\Uniswap-Misc\Uniswap-v3-Contract-WS\node_modules\simple-uniswap-sdk\dist\cjs\common\errors\uniswap-error.js:20
        var _this = _super.call(this, message) || this;
                           ^

Error [UniswapError]: **Must have a `fromTokenContractAddress` on the context**
    at new UniswapError (C:\Dev\Uniswap-Misc\Uniswap-v3-Contract-WS\node_modules\simple-uniswap-sdk\dist\cjs\common\errors\uniswap-error.js:20:28)
    at new UniswapPair (C:\Dev\Uniswap-Misc\Uniswap-v3-Contract-WS\node_modules\simple-uniswap-sdk\dist\cjs\factories\pair\uniswap-pair.js:55:19)
    at etherTradeExample (C:\Dev\Uniswap-Misc\Uniswap-v3-Contract-WS\Uniswap-v3-SimpleSDK1.js:120:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 6
}

Node.js v17.3.0

From what I can see, I have used fromTokenContractAddress. Am I missing something?

elhaix commented 2 years ago

Must have been a typo somewhere. I re-copied/pasted from the example, put in my variable and it worked.