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

How to support more chainId? #19

Closed liu798675179 closed 2 years ago

liu798675179 commented 2 years ago

my code:

// use custom provider:
// Network Name: Heco-Mainnet
// New RPC URL: https://http-mainnet-node.huobichain.com
// ChainID: 128
// Symbol: HT
// Block Explorer URL: https://hecoinfo.com
const rpc_url = "https://http-mainnet-node.huobichain.com";
const provider = new ethers.providers.JsonRpcProvider(rpc_url);

const uniswapPair = new uniswapSimple.UniswapPair({
        fromTokenContractAddress: "0xa71edc38d189767582c38a3145b5873052c3e47a",
        toTokenContractAddress: "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f",
        ethereumAddress: ethereumAddress,
        ethereumProvider: provider
        // providerUrl: rpc_url,
        // chainId: 128,
});

// throw error
const uniswapPairFactory = await uniswapPair.createFactory();

error:

Error [UniswapError]: ChainId - 128 is not supported. This lib only supports mainnet(1), ropsten(4), kovan(42), rinkeby(4), görli(5) and ropsten(3)

Should I change sdk source code?

joshstevens19 commented 2 years ago

hey this lib does not support heco mainnet right now so that chain will not work with the SDK.