diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index 56268f2..5768981 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -33,7 +33,10 @@ var estimateEVM = ({ provider, from, to, value, method, api, params }) => { } else { let contract = new ethers.Contract(to, api, provider); let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }); let contractArguments = getContractArguments({ contract, method, params }); if(contract[method] === undefined) { diff --git a/dist/esm/index.js b/dist/esm/index.js index 86f999f..09ef37f 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -756,7 +756,10 @@ var estimateEVM = ({ provider, from, to, value, method, api, params }) => { } else { let contract = new ethers.Contract(to, api, provider); let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }); let contractArguments = getContractArguments({ contract, method, params }); if(contract[method] === undefined) { diff --git a/dist/esm/index.solana.js b/dist/esm/index.solana.js index 57c646d..76495c8 100644 --- a/dist/esm/index.solana.js +++ b/dist/esm/index.solana.js @@ -507,7 +507,10 @@ var estimateEVM = ({ provider, from, to, value, method, api, params }) => { } else { let contract = new ethers.Contract(to, api, provider); let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }); let contractArguments = getContractArguments({ contract, method, params }); if(contract[method] === undefined) { diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index cdb4d21..1506586 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -40,7 +40,10 @@ } else { let contract = new ethers.ethers.Contract(to, api, provider); let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }); let contractArguments = getContractArguments({ contract, method, params }); if(contract[method] === undefined) { diff --git a/dist/umd/index.js b/dist/umd/index.js index 3a083f2..30171b3 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -762,7 +762,10 @@ } else { let contract = new ethers.ethers.Contract(to, api, provider); let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }); let contractArguments = getContractArguments({ contract, method, params }); if(contract[method] === undefined) { diff --git a/dist/umd/index.solana.js b/dist/umd/index.solana.js index 32fc653..3adc8e5 100644 --- a/dist/umd/index.solana.js +++ b/dist/umd/index.solana.js @@ -513,7 +513,10 @@ } else { let contract = new ethers.ethers.Contract(to, api, provider); let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }); let contractArguments = getContractArguments({ contract, method, params }); if(contract[method] === undefined) { diff --git a/package.evm.json b/package.evm.json index b584c51..16c5c9a 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client-evm", "moduleName": "Web3Client", - "version": "10.18.10", + "version": "10.18.11", "description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.", "main": "dist/umd/index.evm.js", "module": "dist/esm/index.evm.js", diff --git a/package.json b/package.json index b190999..7b0358d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client", "moduleName": "Web3Client", - "version": "10.18.10", + "version": "10.18.11", "description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.", "main": "dist/umd/index.js", "module": "dist/esm/index.js", diff --git a/package.solana.json b/package.solana.json index 3b9b4e6..0bcb893 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-client-solana", "moduleName": "Web3Client", - "version": "10.18.10", + "version": "10.18.11", "description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.", "main": "dist/umd/index.solana.js", "module": "dist/esm/index.solana.js", diff --git a/src/platforms/evm/estimate.js b/src/platforms/evm/estimate.js index 00948ce..aa37ec0 100644 --- a/src/platforms/evm/estimate.js +++ b/src/platforms/evm/estimate.js @@ -32,7 +32,10 @@ export default ({ provider, from, to, value, method, api, params }) => { } else { let contract = new ethers.Contract(to, api, provider) let fragment = contract.interface.fragments.find((fragment) => { - return fragment.name == method + return( + fragment.name == method && + (fragment.inputs && params && typeof(params) === 'object' ? fragment.inputs.length == Object.keys(params).length : true) + ) }) let contractArguments = getContractArguments({ contract, method, params }) if(contract[method] === undefined) {