monkey patch sdk.api.abi.call

This commit is contained in:
0xngmi
2022-05-03 11:13:50 +01:00
parent ed6f4e0723
commit 72a3a64219

11
test.js
View File

@@ -8,6 +8,7 @@ const {
humanizeNumber,
} = require("@defillama/sdk/build/computeTVL/humanizeNumber");
const { util } = require("@defillama/sdk");
const sdk = require("@defillama/sdk");
const whitelistedExportKeys = require('./projects/helper/whitelistedExportKeys.json')
const chainList = require('./projects/helper/chains.json')
const handleError = require('./utils/handleError')
@@ -99,6 +100,16 @@ if (process.argv.length < 3) {
}
const passedFile = path.resolve(process.cwd(), process.argv[2]);
const originalCall = sdk.api.abi.call
sdk.api.abi.call = async (...args)=>{
try{
return await originalCall(...args)
} catch(e){
console.log("sdk.api.abi.call errored with params:", args)
throw e
}
}
(async () => {
let module = {};
try {