File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
abi-parser/src/main/java/com/openelements/hiero/smartcontract/abi Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 11package com .openelements .hiero .smartcontract .abi .model ;
22
33import com .openelements .hiero .smartcontract .abi .util .HexConverter ;
4+ import com .openelements .hiero .smartcontract .abi .util .KeccakUtil ;
45import java .nio .charset .StandardCharsets ;
56import java .util .List ;
67import java .util .Objects ;
@@ -27,19 +28,16 @@ public List<AbiParameter> getNonIndexedInputParameters() {
2728 return inputs .stream ().filter (parameter -> !parameter .indexed ()).toList ();
2829 }
2930
30-
31- @ NonNull
32- public String createEventSignature () {
31+ @ NonNull
32+ private String createEventSignature () {
3333 final List <String > canonicalParameterTypes = inputs .stream ().map (AbiParameter ::getCanonicalType ).toList ();
3434 return name + "(" + String .join ("," , canonicalParameterTypes ) + ")" ;
3535 }
3636
3737 @ NonNull
38- public byte [] createEventSignatureHash () {
38+ private byte [] createEventSignatureHash () {
3939 final String eventSignature = createEventSignature ();
40- Keccak .DigestKeccak kecc = new Keccak .Digest256 ();
41- kecc .update (eventSignature .getBytes (StandardCharsets .UTF_8 ));
42- return kecc .digest ();
40+ return KeccakUtil .keccak256 (eventSignature .getBytes (StandardCharsets .UTF_8 ));
4341 }
4442
4543 @ NonNull
Original file line number Diff line number Diff line change 1+ package com .openelements .hiero .smartcontract .abi .util ;
2+
3+ import org .bouncycastle .jcajce .provider .digest .Keccak ;
4+
5+ public class KeccakUtil {
6+
7+ public static byte [] keccak256 (final byte [] data ) {
8+ Keccak .DigestKeccak kecc = new Keccak .Digest256 ();
9+ kecc .update (data );
10+ return kecc .digest ();
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments