Show contract parameters in MethodDecoding (#4024)

* Add decoding of Inner Contract Deployment params #3715

* Fixed TypedInput when formatted value

* Fix TypedInput

* PR Grumble

* Add test to `Param.toParams`
This commit is contained in:
Nicolas Gotchac
2017-01-05 12:06:58 +01:00
committed by Jaco Greeff
parent ddeb06d9cc
commit d16ab5eac5
9 changed files with 207 additions and 64 deletions

View File

@@ -26,7 +26,9 @@ export function decodeCallData (data) {
if (data.substr(0, 2) === '0x') {
return decodeCallData(data.slice(2));
} else if (data.length < 8) {
}
if (data.length < 8) {
throw new Error('Input to decodeCallData should be method signature + data');
}
@@ -42,10 +44,14 @@ export function decodeCallData (data) {
export function decodeMethodInput (methodAbi, paramdata) {
if (!methodAbi) {
throw new Error('decodeMethodInput should receive valid method-specific ABI');
} else if (paramdata && paramdata.length) {
}
if (paramdata && paramdata.length) {
if (!isHex(paramdata)) {
throw new Error('Input to decodeMethodInput should be a hex value');
} else if (paramdata.substr(0, 2) === '0x') {
}
if (paramdata.substr(0, 2) === '0x') {
return decodeMethodInput(methodAbi, paramdata.slice(2));
}
}