curve-js
curve-js copied to clipboard
Issue with Curve Function
Hello, I'm new using Curve Finance API and also in JS. I'm trying to the replicate the same code that has been given in the example - https://github.com/curvefi/curve-js#general-methods I'm getting this error in my console:
TypeError: curve.getTVL is not a function
at file:///Users/new.ts:4:17
at Generator.next (<anonymous>)
at file:///Users/new.ts:7:71
at new Promise (<anonymous>)
at __awaiter (file:///Users/new.ts:3:12)
at file:///Users/new.ts:3:13
at file:///Users/new.ts:33:3
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
Does anyone know why is it showing this error?
GM sir. I had the same issue with the current release (2.26.3) on Windows. I was able to solve it by replacing curve.init(parameters) with curve.default.init(parameters) . You basically need to replace every "curve" call by a curve.default . Hope it'll works for you
There is no curve.init in that example. It works like this:
(async () => {
await curve.init('JsonRpc', { url: ETH_RPC }, { gasPrice: 0 });
console.log(await curve.getTVL());
}()