When calling the loadPools and getPoolData methods I face an error related to ergo-dex-sdk in some class named ErgoTree, this is my code:
(async function x() {
await ergo['loadPools']();
console.log(ergo['ammPools']);
})();
(async function x() {
console.log(await ergo['getPoolData'](1000, 50000));
})();
and this is the output for both function calls:
TypeError: Cannot read properties of undefined (reading 'ErgoTree')
at poolTemplateHash (/home/sati/Desktop/work/pattern/gateway1/gateway/node_modules/@ergolabs/ergo-dex-sdk/src/amm/common/contracts/n2tPoolContracts.ts:13:41)
at Object.poolBundle (/home/sati/Desktop/work/pattern/gateway1/gateway/node_modules/@ergolabs/ergo-dex-sdk/src/amm/common/contracts/n2tPoolContracts.ts:20:23)
at makeNativePools (/home/sati/Desktop/work/pattern/gateway1/gateway/node_modules/@ergolabs/ergo-dex-sdk/src/amm/common/services/pools.ts:9:58)
at Ergo.<anonymous> (/home/sati/Desktop/work/pattern/gateway1/gateway/src/chains/ergo/ergo.ts:502:44)
at Generator.next (<anonymous>)
at /home/sati/Desktop/work/pattern/gateway1/gateway/src/chains/ergo/ergo.ts:8:71
at new Promise (<anonymous>)
at __awaiter (/home/sati/Desktop/work/pattern/gateway1/gateway/src/chains/ergo/ergo.ts:4:12)
at Ergo.getPoolData (/home/sati/Desktop/work/pattern/gateway1/gateway/src/chains/ergo/ergo.ts:286:16)
at Ergo.<anonymous> (/home/sati/Desktop/work/pattern/gateway1/gateway/src/chains/ergo/ergo.ts:488:41)
Case
When calling the loadPools and getPoolData methods I face an error related to ergo-dex-sdk in some class named ErgoTree, this is my code:
and this is the output for both function calls: