From d68975997ad87c12e3243c3c89397cfb9e44949a Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Sun, 28 Jan 2024 14:53:41 +0800 Subject: [PATCH] Update comment --- src/Contracts/Types/Address.php | 4 ++-- src/Contracts/Types/BaseArray.php | 16 ++++++++-------- src/Contracts/Types/Boolean.php | 4 ++-- src/Contracts/Types/Bytes.php | 4 ++-- src/Contracts/Types/DynamicArray.php | 6 +++--- src/Contracts/Types/DynamicBytes.php | 4 ++-- src/Contracts/Types/IType.php | 4 ++-- src/Contracts/Types/Integer.php | 4 ++-- src/Contracts/Types/Str.php | 4 ++-- src/Contracts/Types/Tuple.php | 12 ++++++------ src/Contracts/Types/Uinteger.php | 4 ++-- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Contracts/Types/Address.php b/src/Contracts/Types/Address.php index a73b589a..2e317145 100644 --- a/src/Contracts/Types/Address.php +++ b/src/Contracts/Types/Address.php @@ -55,10 +55,10 @@ public function isDynamicType() * to do: iban * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { $value = (string) $value; diff --git a/src/Contracts/Types/BaseArray.php b/src/Contracts/Types/BaseArray.php index 3fb70fa0..820920b5 100644 --- a/src/Contracts/Types/BaseArray.php +++ b/src/Contracts/Types/BaseArray.php @@ -94,23 +94,23 @@ public function encodeElements($value, $name) * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { - return implode('', $this->encodeElements($value, $name)); + return implode('', $this->encodeElements($value, $abiType)); } /** * outputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function outputFormat($value, $name) - { - throw new InvalidArgumentException('Should not call outputFormat in BaseArray directly'); - } + // public function outputFormat($value, $abiType) + // { + // throw new InvalidArgumentException('Should not call outputFormat in BaseArray directly'); + // } } \ No newline at end of file diff --git a/src/Contracts/Types/Boolean.php b/src/Contracts/Types/Boolean.php index f5b6e77d..048aa1af 100644 --- a/src/Contracts/Types/Boolean.php +++ b/src/Contracts/Types/Boolean.php @@ -52,10 +52,10 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { if (!is_bool($value)) { throw new InvalidArgumentException('The value to inputFormat function must be boolean.'); diff --git a/src/Contracts/Types/Bytes.php b/src/Contracts/Types/Bytes.php index 913d7a54..8af0b1bc 100644 --- a/src/Contracts/Types/Bytes.php +++ b/src/Contracts/Types/Bytes.php @@ -53,10 +53,10 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { if (!Utils::isHex($value)) { throw new InvalidArgumentException('The value to inputFormat must be hex bytes.'); diff --git a/src/Contracts/Types/DynamicArray.php b/src/Contracts/Types/DynamicArray.php index a4f40f45..6ce32473 100644 --- a/src/Contracts/Types/DynamicArray.php +++ b/src/Contracts/Types/DynamicArray.php @@ -53,12 +53,12 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { - $results = $this->encodeElements($value, $name); + $results = $this->encodeElements($value, $abiType); $encodeSize = IntegerFormatter::format(count($value)); return $encodeSize . implode('', $results); } diff --git a/src/Contracts/Types/DynamicBytes.php b/src/Contracts/Types/DynamicBytes.php index 0adbce6f..f959884a 100644 --- a/src/Contracts/Types/DynamicBytes.php +++ b/src/Contracts/Types/DynamicBytes.php @@ -53,10 +53,10 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { if (!Utils::isHex($value)) { throw new InvalidArgumentException('The value to inputFormat must be hex bytes.'); diff --git a/src/Contracts/Types/IType.php b/src/Contracts/Types/IType.php index 6dc9cc35..e6699776 100644 --- a/src/Contracts/Types/IType.php +++ b/src/Contracts/Types/IType.php @@ -32,8 +32,8 @@ public function isDynamicType(); * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name); + public function inputFormat($value, $abiType); } \ No newline at end of file diff --git a/src/Contracts/Types/Integer.php b/src/Contracts/Types/Integer.php index a1495944..d0279de9 100644 --- a/src/Contracts/Types/Integer.php +++ b/src/Contracts/Types/Integer.php @@ -54,10 +54,10 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { return IntegerFormatter::format($value); } diff --git a/src/Contracts/Types/Str.php b/src/Contracts/Types/Str.php index 2bee6d04..a8b968f5 100644 --- a/src/Contracts/Types/Str.php +++ b/src/Contracts/Types/Str.php @@ -54,10 +54,10 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { $value = Utils::toHex($value); $prefix = IntegerFormatter::format(mb_strlen($value) / 2); diff --git a/src/Contracts/Types/Tuple.php b/src/Contracts/Types/Tuple.php index b95841f0..8e1eb33d 100644 --- a/src/Contracts/Types/Tuple.php +++ b/src/Contracts/Types/Tuple.php @@ -54,15 +54,15 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $abiTypes + * @param string $abiType * @return string */ - public function inputFormat($params, $abiTypes) + public function inputFormat($params, $abiType) { $result = []; $rawHead = []; $tail = []; - foreach ($abiTypes['coders'] as $key => $abiType) { + foreach ($abiType['coders'] as $key => $abiType) { if ($abiType['dynamic']) { $rawHead[] = null; $tail[] = $abiType['solidityType']->encode($params[$key], $abiType); @@ -105,14 +105,14 @@ public function inputFormat($params, $abiTypes) * outputFormat * * @param string $value - * @param array $abiTypes + * @param array $abiType * @return string */ - public function outputFormat($value, $abiTypes) + public function outputFormat($value, $abiType) { $results = []; $staticOffset = 0; - foreach ($abiTypes['coders'] as $key => $abiType) { + foreach ($abiType['coders'] as $key => $abiType) { if ($abiType['dynamic']) { $startPosHex = mb_substr($value, $staticOffset, 64); $startPos = Utils::hexToNumber($startPosHex); diff --git a/src/Contracts/Types/Uinteger.php b/src/Contracts/Types/Uinteger.php index 9b528c42..086768da 100644 --- a/src/Contracts/Types/Uinteger.php +++ b/src/Contracts/Types/Uinteger.php @@ -54,10 +54,10 @@ public function isDynamicType() * inputFormat * * @param mixed $value - * @param string $name + * @param array $abiType * @return string */ - public function inputFormat($value, $name) + public function inputFormat($value, $abiType) { return IntegerFormatter::format($value); }