web3-eth-abi
Advanced tools
Comparing version 4.2.4-dev.2ef694c.0 to 4.2.4-dev.2f24244.0
@@ -37,2 +37,28 @@ "use strict"; | ||
} | ||
else if (error.data.startsWith('0x08c379a0')) { | ||
// If ABI was not provided, check for the 2 famous errors: 'Error(string)' or 'Panic(uint256)' | ||
errorName = 'Error'; | ||
errorSignature = 'Error(string)'; | ||
// decode abi.inputs according to EIP-838 | ||
errorArgs = (0, parameters_api_js_1.decodeParameters)([ | ||
{ | ||
name: 'message', | ||
type: 'string', | ||
}, | ||
], error.data.substring(10)); | ||
} | ||
else if (error.data.startsWith('0x4e487b71')) { | ||
errorName = 'Panic'; | ||
errorSignature = 'Panic(uint256)'; | ||
// decode abi.inputs according to EIP-838 | ||
errorArgs = (0, parameters_api_js_1.decodeParameters)([ | ||
{ | ||
name: 'code', | ||
type: 'uint256', | ||
}, | ||
], error.data.substring(10)); | ||
} | ||
else { | ||
console.error('No matching error abi found for error data', error.data); | ||
} | ||
} | ||
@@ -39,0 +65,0 @@ catch (err) { |
@@ -34,2 +34,28 @@ /* | ||
} | ||
else if (error.data.startsWith('0x08c379a0')) { | ||
// If ABI was not provided, check for the 2 famous errors: 'Error(string)' or 'Panic(uint256)' | ||
errorName = 'Error'; | ||
errorSignature = 'Error(string)'; | ||
// decode abi.inputs according to EIP-838 | ||
errorArgs = decodeParameters([ | ||
{ | ||
name: 'message', | ||
type: 'string', | ||
}, | ||
], error.data.substring(10)); | ||
} | ||
else if (error.data.startsWith('0x4e487b71')) { | ||
errorName = 'Panic'; | ||
errorSignature = 'Panic(uint256)'; | ||
// decode abi.inputs according to EIP-838 | ||
errorArgs = decodeParameters([ | ||
{ | ||
name: 'code', | ||
type: 'uint256', | ||
}, | ||
], error.data.substring(10)); | ||
} | ||
else { | ||
console.error('No matching error abi found for error data', error.data); | ||
} | ||
} | ||
@@ -36,0 +62,0 @@ catch (err) { |
{ | ||
"name": "web3-eth-abi", | ||
"version": "4.2.4-dev.2ef694c.0+2ef694c", | ||
"version": "4.2.4-dev.2f24244.0+2f24244", | ||
"description": "Web3 module encode and decode EVM in/output.", | ||
@@ -46,6 +46,6 @@ "main": "./lib/commonjs/index.js", | ||
"abitype": "0.7.1", | ||
"web3-errors": "1.2.2-dev.2ef694c.0+2ef694c", | ||
"web3-types": "1.7.1-dev.2ef694c.0+2ef694c", | ||
"web3-utils": "4.3.2-dev.2ef694c.0+2ef694c", | ||
"web3-validator": "2.0.7-dev.2ef694c.0+2ef694c" | ||
"web3-errors": "1.3.1-dev.2f24244.0+2f24244", | ||
"web3-types": "1.7.1-dev.2f24244.0+2f24244", | ||
"web3-utils": "4.3.2-dev.2f24244.0+2f24244", | ||
"web3-validator": "2.0.7-dev.2f24244.0+2f24244" | ||
}, | ||
@@ -69,3 +69,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "2ef694cc5b40cf44f4ec46c60e183970d2f5c18e" | ||
"gitHead": "2f2424487a6ba2865b5a381f22f83500a3133cda" | ||
} |
@@ -42,2 +42,32 @@ /* | ||
errorArgs = decodeParameters([...errorAbi.inputs], error.data.substring(10)); | ||
} else if (error.data.startsWith('0x08c379a0')) { | ||
// If ABI was not provided, check for the 2 famous errors: 'Error(string)' or 'Panic(uint256)' | ||
errorName = 'Error'; | ||
errorSignature = 'Error(string)'; | ||
// decode abi.inputs according to EIP-838 | ||
errorArgs = decodeParameters( | ||
[ | ||
{ | ||
name: 'message', | ||
type: 'string', | ||
}, | ||
], | ||
error.data.substring(10), | ||
); | ||
} else if (error.data.startsWith('0x4e487b71')) { | ||
errorName = 'Panic'; | ||
errorSignature = 'Panic(uint256)'; | ||
// decode abi.inputs according to EIP-838 | ||
errorArgs = decodeParameters( | ||
[ | ||
{ | ||
name: 'code', | ||
type: 'uint256', | ||
}, | ||
], | ||
error.data.substring(10), | ||
); | ||
} else { | ||
console.error('No matching error abi found for error data', error.data); | ||
} | ||
@@ -44,0 +74,0 @@ } catch (err) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
402526
7723