Decode contract call return.
This commit is contained in:
parent
12994a7884
commit
b1318bb0d2
@ -492,11 +492,13 @@ class Contract
|
|||||||
$transaction['to'] = $this->toAddress;
|
$transaction['to'] = $this->toAddress;
|
||||||
$transaction['data'] = $functionSignature . Utils::stripZero($data);
|
$transaction['data'] = $functionSignature . Utils::stripZero($data);
|
||||||
|
|
||||||
$this->eth->call($transaction, function ($err, $transaction) use ($callback){
|
$this->eth->call($transaction, function ($err, $transaction) use ($callback, $function){
|
||||||
if ($err !== null) {
|
if ($err !== null) {
|
||||||
return call_user_func($callback, $err, null);
|
return call_user_func($callback, $err, null);
|
||||||
}
|
}
|
||||||
return call_user_func($callback, null, $transaction);
|
$decodedTransaction = $this->ethabi->decodeParameters($function, $transaction);
|
||||||
|
|
||||||
|
return call_user_func($callback, null, $decodedTransaction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,11 @@ class Ethabi
|
|||||||
$param = mb_strtolower(Utils::stripZero($param));
|
$param = mb_strtolower(Utils::stripZero($param));
|
||||||
|
|
||||||
for ($i=0; $i<$typesLength; $i++) {
|
for ($i=0; $i<$typesLength; $i++) {
|
||||||
$result[$i] = $solidityTypes[$i]->decode($param, $offsets[$i], $types[$i]);
|
if (isset($outputTypes['outputs'][$i]['name'])) {
|
||||||
|
$result[$outputTypes['outputs'][$i]['name']] = $solidityTypes[$i]->decode($param, $offsets[$i], $types[$i]);
|
||||||
|
} else {
|
||||||
|
$result[$i] = $solidityTypes[$i]->decode($param, $offsets[$i], $types[$i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user