From 72f1405e6c34e220fca726862b20b6afd1e0b13a Mon Sep 17 00:00:00 2001 From: tkenmoku Date: Tue, 31 Oct 2023 00:19:02 +0900 Subject: [PATCH] =?UTF-8?q?Tuple=E5=BD=A2=E5=BC=8F=E3=81=AE=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=81=8C=E5=85=A5=E5=8A=9B=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E6=99=82=E3=81=AE=E5=87=A6=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit トランザクション用のデータを生成するため、各要素をエンコーディングの上で文字列接続する必要がある。 --- src/Contracts/Ethabi.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Contracts/Ethabi.php b/src/Contracts/Ethabi.php index 27e003a1..d68d8c4f 100644 --- a/src/Contracts/Ethabi.php +++ b/src/Contracts/Ethabi.php @@ -370,6 +370,20 @@ protected function encodeWithOffset($type, $solidityType, $encoded, $offset) } return $result; } + + //配列形式の場合、各要素を必要なら加工の上で直結 + if (is_array($encoded)) { + $resultStr = ''; + foreach ($encoded as $item) { + if (is_string($item)) { + $resultStr .= $item; + } else { + $resultStr .= dechex($item); + } + } + return $resultStr; + } + return $encoded; }