diff --git a/src/Contract.php b/src/Contract.php index 69c5c9b..81a1e81 100644 --- a/src/Contract.php +++ b/src/Contract.php @@ -504,7 +504,7 @@ class Contract if ($argsLen !== count($function['inputs'])) { continue; } else { - $paramsLen = $argsLen - 1; + $paramsLen = $argsLen; } } try { @@ -599,7 +599,7 @@ class Contract if ($argsLen !== count($function['inputs'])) { continue; } else { - $paramsLen = $argsLen - 1; + $paramsLen = $argsLen; } } try { @@ -718,7 +718,7 @@ class Contract if ($argsLen !== count($function['inputs'])) { continue; } else { - $paramsLen = $argsLen - 1; + $paramsLen = $argsLen; } } try { diff --git a/test/unit/ContractTest.php b/test/unit/ContractTest.php index 66e7be7..49db731 100644 --- a/test/unit/ContractTest.php +++ b/test/unit/ContractTest.php @@ -631,6 +631,17 @@ class ContractTest extends TestCase $this->assertTrue($result !== null); } }); + // test issue 143 + $contract->at($this->contractAddress)->call('balanceOf', $fromAccount, function ($err, $result) use ($contract) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($result)) { + // $bn = Utils::toBn($result); + // $this->assertEquals($bn->toString(), '10000', 'Balance should be 10000.'); + $this->assertTrue($result !== null); + } + }); } /**