Skip to content

Commit

Permalink
v10.18.11: fix estimate with duplicate method names
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Aug 26, 2024
1 parent edd7c0d commit d76006e
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 10 deletions.
5 changes: 4 additions & 1 deletion dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion dist/umd/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.evm.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.solana.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/platforms/evm/estimate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d76006e

Please sign in to comment.