Hi, I have the issue when calling pool.getData()

Code snippet
import TonWeb from 'tonweb';
import {Router, ROUTER_REVISION, ROUTER_REVISION_ADDRESS} from '@ston-fi/sdk';

export async function getStonfiLpData() {
const provider = new TonWeb.HttpProvider("https://toncenter.com/api/v2/jsonRPC", {apiKey: ${apiKey}});
const router = new Router(provider, {
revision: ROUTER_REVISION.V1,
address: ROUTER_REVISION_ADDRESS.V1,
});

const pool = await router.getPool({jettonAddresses: ['EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv', 'EQATcUc69sGSCCMSadsVUKdGwM1BMKS-HKCWGPk60xZGgwsK']});
// here throws an error
const poolData = await pool.getData();

return poolData;
}

The response is
Error: http provider parse response error
at Function.parseResponse (...\node_modules\tonweb\src\providers\HttpProviderUtils.js:51:25)
at HttpProvider.call2 ....\node_modules\tonweb\src\providers\index.js:159:34)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Y.getData (..../node_modules/@ston-fi/sdk/dist/index.js:244:43)
at async getStonfiLpData (..../src/services/stonfi1.js:13:20)
at async runApp (.../src/app.js:16:3) {
result: {
'@type': 'smc.runResult',
stack: [ [ 'num', '0x13f19' ] ],
exit_code: -13,
'@extra': '1705753807.8920226:7:0.24784247969995787'
}
}

Jan 20, 2024, 6:03 PM
🙏🙏
@admin
Jan 20, 2024, 7:04 PM
Try putting it in a try - catch, although this looks like an API error.

try {
const pool = await router.getPool({jettonAddresses: ['EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv', 'EQATcUc69sGSCCMSadsVUKdGwM1BMKS-HKCWGPk60xZGgwsK']});
const poolData = await pool.getData();
return poolData;
} catch (error) {
console.error("Error during HTTP request:", error);
throw error;
}
Jan 20, 2024, 10:06 PM

© 2024 Draquery.com All rights reserved.