curvefi/curve-js

Support for xDAI chain?

Closed this issue · 2 comments

I created a test bench for the library with xDAI:

import curve from '@curvefi/api';

(async () => {
  await curve.init(
    'JsonRpc',
    {
      url: 'https://rpc.xdaichain.com',
    },
    {
      chainId: 100,
    }
  );

  console.log(await curve.getBalances(['DAI', 'WBTC']));
  // // [ '1000.0', '0.0' ]
})();

Calling any method results in

E:\dxdao\curve-fi-bench\node_modules\@ethersproject\logger\src.ts\index.ts:225
        const error: any = new Error(message);
                           ^
Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.5.0)
    at Logger.makeError (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\logger\src.ts\index.ts:225:28)
    at Logger.throwError (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\logger\src.ts\index.ts:237:20)
    at Reader._peekBytes (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\abstract-coder.ts:184:24)
    at Reader.readBytes (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\abstract-coder.ts:198:26)
    at Reader.readValue (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\abstract-coder.ts:205:36)
    at NumberCoder.decode (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\number.ts:48:28)
    at E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\array.ts:108:31
    at Array.forEach (<anonymous>)
    at unpack (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\array.ts:89:12)
    at TupleCoder.decode (E:\dxdao\curve-fi-bench\node_modules\@ethersproject\abi\src.ts\coders\tuple.ts:58:47) {
  reason: 'data out-of-bounds',
  code: 'BUFFER_OVERRUN',
  length: 0,
  offset: 32
}

My guess is that the library can't resolve the contract address for xDAI.

edit:

Seem like the case. The library points to mainnet's router 0xfA9a30350048B2BF66865ee20363067c66f67e58

Yeah. We will add xDAI later. There are only ethereum and polygon now

Done

#70