Skip to content

Commit bec8146

Browse files
authored
feat: Update Lambda names (#2565)
Signed-off-by: emiliyank <e.kadiyski@gmail.com>
1 parent 6f6474d commit bec8146

28 files changed

+382
-385
lines changed

examples/src/main/java/com/hedera/hashgraph/sdk/examples/AccountHooksExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private static class AccountWithKey {
116116
private static AccountWithKey createAccountWithHooks(Client client, ContractId contractId) throws Exception {
117117
System.out.println("Creating account with lambda EVM hook...");
118118

119-
LambdaEvmHook lambdaHook = new LambdaEvmHook(contractId);
119+
EvmHook lambdaHook = new EvmHook(contractId);
120120

121121
Key adminKey = OPERATOR_KEY.getPublicKey();
122122
HookCreationDetails hookDetails =
@@ -157,11 +157,11 @@ private static void addHooksToAccount(
157157
Key adminKey = OPERATOR_KEY.getPublicKey();
158158

159159
// Create basic lambda hooks with no storage updates
160-
LambdaEvmHook basicHook = new LambdaEvmHook(contractId);
160+
EvmHook basicHook = new EvmHook(contractId);
161161
HookCreationDetails hook1 =
162162
new HookCreationDetails(HookExtensionPoint.ACCOUNT_ALLOWANCE_HOOK, 1L, basicHook, adminKey);
163163

164-
LambdaEvmHook basicHook2 = new LambdaEvmHook(contractId);
164+
EvmHook basicHook2 = new EvmHook(contractId);
165165
HookCreationDetails hook2 =
166166
new HookCreationDetails(HookExtensionPoint.ACCOUNT_ALLOWANCE_HOOK, 2L, basicHook2, adminKey);
167167

examples/src/main/java/com/hedera/hashgraph/sdk/examples/ContractHooksExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private static ContractId createContractWithHooks(Client client, ContractId hook
9898
System.out.println("Creating contract with lambda EVM hook...");
9999

100100
// Build a basic lambda EVM hook (no admin key, no storage updates) - like the integration test
101-
var lambdaHook = new LambdaEvmHook(hookContractId);
101+
var lambdaHook = new EvmHook(hookContractId);
102102
var hookDetails = new HookCreationDetails(HookExtensionPoint.ACCOUNT_ALLOWANCE_HOOK, 1L, lambdaHook);
103103

104104
var response = new ContractCreateTransaction()
@@ -126,7 +126,7 @@ private static void addHooksToContract(Client client, ContractId hookContractId,
126126
Key adminKey = OPERATOR_KEY.getPublicKey();
127127

128128
// Hook 3: Basic lambda hook with no storage updates (using ID 3 to avoid conflict with existing hook 1)
129-
LambdaEvmHook basicHook = new LambdaEvmHook(hookContractId);
129+
EvmHook basicHook = new EvmHook(hookContractId);
130130
HookCreationDetails hook3 =
131131
new HookCreationDetails(HookExtensionPoint.ACCOUNT_ALLOWANCE_HOOK, 3L, basicHook, adminKey);
132132
try {

examples/src/main/java/com/hedera/hashgraph/sdk/examples/LambdaSStoreExample.java renamed to examples/src/main/java/com/hedera/hashgraph/sdk/examples/HookStoreExample.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
import java.util.Objects;
1111

1212
/**
13-
* How to work with LambdaSStoreTransaction.
13+
* How to work with HookStoreTransaction.
1414
* <p>
15-
* This example demonstrates how to update storage slots of existing lambda hooks using LambdaSStoreTransaction.
16-
* The example includes prerequisite setup (creating a hook contract and account with lambda hook)
17-
* to demonstrate the LambdaSStoreTransaction functionality.
15+
* This example demonstrates how to update storage slots of existing EVM hooks using HookStoreTransaction.
16+
* The example includes prerequisite setup (creating a hook contract and account with EVM hook)
17+
* to demonstrate the HookStoreTransaction functionality.
1818
*/
19-
class LambdaSStoreExample {
19+
class HookStoreExample {
2020

2121
/*
2222
* See .env.sample in the examples folder root for how to specify values below
@@ -52,7 +52,7 @@ class LambdaSStoreExample {
5252
private static final String SDK_LOG_LEVEL = Dotenv.load().get("SDK_LOG_LEVEL", "SILENT");
5353

5454
public static void main(String[] args) throws Exception {
55-
System.out.println("Lambda SStore Example Start!");
55+
System.out.println("Hook Store Example Start!");
5656

5757
/*
5858
* Step 0:
@@ -66,8 +66,8 @@ public static void main(String[] args) throws Exception {
6666

6767
/*
6868
* Step 1:
69-
* Set up prerequisites: Create hook contract and account with lambda hook.
70-
* Note: This is not part of LambdaSStoreTransaction itself, but required for the example.
69+
* Set up prerequisites: Create hook contract and account with EVM hook.
70+
* Note: This is not part of HookStoreTransaction itself, but required for the example.
7171
*/
7272
System.out.println("Setting up prerequisites...");
7373
ContractId contractId = createContractId(client);
@@ -77,34 +77,34 @@ public static void main(String[] args) throws Exception {
7777

7878
/*
7979
* Step 2:
80-
* Demonstrate LambdaSStoreTransaction - the core functionality.
80+
* Demonstrate HookStoreTransaction - the core functionality.
8181
*/
82-
System.out.println("\n=== LambdaSStoreTransaction Example ===");
82+
System.out.println("\n=== HookStoreTransaction Example ===");
8383

8484
// Create storage update (equivalent to TypeScript sample)
8585
byte[] storageKey = new byte[32];
8686
Arrays.fill(storageKey, (byte) 1);
8787
byte[] storageValue = new byte[32];
8888
Arrays.fill(storageValue, (byte) 200);
8989

90-
LambdaStorageUpdate storageUpdate = new LambdaStorageUpdate.LambdaStorageSlot(storageKey, storageValue);
90+
EvmHookStorageUpdate storageUpdate = new EvmHookStorageUpdate.EvmHookStorageSlot(storageKey, storageValue);
9191

9292
// Create HookId for the existing hook (accountId with hook ID 1)
9393
HookId hookId = new HookId(new HookEntityId(accountId), 1L);
9494

95-
// Execute LambdaSStoreTransaction (matches TypeScript pattern)
96-
TransactionResponse lambdaStoreResponse = new LambdaSStoreTransaction()
95+
// Execute HookStoreTransaction (matches TypeScript pattern)
96+
TransactionResponse hookStoreResponse = new HookStoreTransaction()
9797
.setHookId(hookId)
9898
.addStorageUpdate(storageUpdate)
9999
.freezeWith(client)
100100
.sign(accountKey)
101101
.execute(client);
102102

103-
lambdaStoreResponse.getReceipt(client);
104-
System.out.println("Successfully updated lambda hook storage!");
103+
hookStoreResponse.getReceipt(client);
104+
System.out.println("Successfully updated EVM hook storage!");
105105

106106
client.close();
107-
System.out.println("Lambda SStore Example Complete!");
107+
System.out.println("Hook Store Example Complete!");
108108
}
109109

110110
/**
@@ -121,18 +121,18 @@ private static class AccountWithKey {
121121
}
122122

123123
/**
124-
* Creates an account with a lambda hook that has initial storage.
125-
* This is a prerequisite for the LambdaSStoreTransaction example.
124+
* Creates an account with an EVM hook that has initial storage.
125+
* This is a prerequisite for the HookStoreTransaction example.
126126
*/
127127
private static AccountWithKey createAccountWithLambdaHook(Client client, ContractId contractId) throws Exception {
128-
System.out.println("Creating account with lambda hook");
129-
// Create lambda hook with initial storage updates
130-
LambdaEvmHook lambdaHook = new LambdaEvmHook(contractId);
128+
System.out.println("Creating account with EVM hook");
129+
// Create EVM hook with initial storage updates
130+
EvmHook evmHook = new EvmHook(contractId);
131131

132132
// Create hook creation details
133133
Key adminKey = OPERATOR_KEY.getPublicKey();
134134
HookCreationDetails hookDetails =
135-
new HookCreationDetails(HookExtensionPoint.ACCOUNT_ALLOWANCE_HOOK, 1L, lambdaHook, adminKey);
135+
new HookCreationDetails(HookExtensionPoint.ACCOUNT_ALLOWANCE_HOOK, 1L, evmHook, adminKey);
136136

137137
// Create account with lambda hook
138138
PrivateKey accountKey = PrivateKey.generateED25519();
@@ -151,7 +151,7 @@ private static AccountWithKey createAccountWithLambdaHook(Client client, Contrac
151151
AccountId accountId = accountCreateReceipt.accountId;
152152
Objects.requireNonNull(accountId);
153153
System.out.println("Created account with ID: " + accountId);
154-
System.out.println("Successfully created account with lambda hook and initial storage!");
154+
System.out.println("Successfully created account with EVM hook and initial storage!");
155155

156156
return new AccountWithKey(accountId, accountKey);
157157
} catch (Exception e) {

sdk/src/main/java/com/hedera/hashgraph/sdk/LambdaEvmHook.java renamed to sdk/src/main/java/com/hedera/hashgraph/sdk/EvmHook.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,83 +8,83 @@
88
import java.util.Objects;
99

1010
/**
11-
* Definition of a lambda EVM hook.
11+
* Definition of an EVM hook.
1212
* <p>
1313
* This class represents a hook implementation that is programmed in EVM bytecode
1414
* and can access state or interact with external contracts. It includes the
1515
* hook specification and any initial storage updates.
1616
*/
17-
public class LambdaEvmHook extends EvmHookSpec {
18-
private final List<LambdaStorageUpdate> storageUpdates;
17+
public class EvmHook extends EvmHookSpec {
18+
private final List<EvmHookStorageUpdate> storageUpdates;
1919

2020
/**
21-
* Create a new LambdaEvmHook with no initial storage updates.
21+
* Create a new EvmHook with no initial storage updates.
2222
*
2323
* @param contractId underlying contract of the hook
2424
*/
25-
public LambdaEvmHook(ContractId contractId) {
25+
public EvmHook(ContractId contractId) {
2626
this(contractId, Collections.emptyList());
2727
}
2828

2929
/**
30-
* Create a new LambdaEvmHook with initial storage updates.
30+
* Create a new EvmHook with initial storage updates.
3131
*
3232
* @param contractId underlying contract of the hook
33-
* @param storageUpdates the initial storage updates for the lambda
33+
* @param storageUpdates the initial storage updates for the EVM hook
3434
*/
35-
public LambdaEvmHook(ContractId contractId, List<LambdaStorageUpdate> storageUpdates) {
35+
public EvmHook(ContractId contractId, List<EvmHookStorageUpdate> storageUpdates) {
3636
super(Objects.requireNonNull(contractId, "contractId cannot be null"));
3737
this.storageUpdates = new ArrayList<>(Objects.requireNonNull(storageUpdates, "storageUpdates cannot be null"));
3838
}
3939

4040
/**
41-
* Get the initial storage updates for this lambda.
41+
* Get the initial storage updates for this EVM hook.
4242
*
4343
* @return an immutable list of storage updates
4444
*/
45-
public List<LambdaStorageUpdate> getStorageUpdates() {
45+
public List<EvmHookStorageUpdate> getStorageUpdates() {
4646
return Collections.unmodifiableList(storageUpdates);
4747
}
4848

4949
/**
50-
* Convert this LambdaEvmHook to a protobuf message.
50+
* Convert this EvmHook to a protobuf message.
5151
*
52-
* @return the protobuf LambdaEvmHook
52+
* @return the protobuf EvmHook
5353
*/
54-
com.hedera.hashgraph.sdk.proto.LambdaEvmHook toProtobuf() {
54+
com.hedera.hashgraph.sdk.proto.EvmHook toProtobuf() {
5555
var specProto = com.hedera.hashgraph.sdk.proto.EvmHookSpec.newBuilder()
5656
.setContractId(getContractId().toProtobuf())
5757
.build();
58-
var builder = com.hedera.hashgraph.sdk.proto.LambdaEvmHook.newBuilder().setSpec(specProto);
58+
var builder = com.hedera.hashgraph.sdk.proto.EvmHook.newBuilder().setSpec(specProto);
5959

60-
for (LambdaStorageUpdate update : storageUpdates) {
60+
for (EvmHookStorageUpdate update : storageUpdates) {
6161
builder.addStorageUpdates(update.toProtobuf());
6262
}
6363

6464
return builder.build();
6565
}
6666

6767
/**
68-
* Create a LambdaEvmHook from a protobuf message.
68+
* Create an EvmHook from a protobuf message.
6969
*
70-
* @param proto the protobuf LambdaEvmHook
71-
* @return a new LambdaEvmHook instance
70+
* @param proto the protobuf EvmHook
71+
* @return a new EvmHook instance
7272
*/
73-
public static LambdaEvmHook fromProtobuf(com.hedera.hashgraph.sdk.proto.LambdaEvmHook proto) {
74-
var storageUpdates = new ArrayList<LambdaStorageUpdate>();
73+
public static EvmHook fromProtobuf(com.hedera.hashgraph.sdk.proto.EvmHook proto) {
74+
var storageUpdates = new ArrayList<EvmHookStorageUpdate>();
7575
for (var protoUpdate : proto.getStorageUpdatesList()) {
76-
storageUpdates.add(LambdaStorageUpdate.fromProtobuf(protoUpdate));
76+
storageUpdates.add(EvmHookStorageUpdate.fromProtobuf(protoUpdate));
7777
}
7878

79-
return new LambdaEvmHook(ContractId.fromProtobuf(proto.getSpec().getContractId()), storageUpdates);
79+
return new EvmHook(ContractId.fromProtobuf(proto.getSpec().getContractId()), storageUpdates);
8080
}
8181

8282
@Override
8383
public boolean equals(Object o) {
8484
if (this == o) return true;
8585
if (o == null || getClass() != o.getClass()) return false;
8686

87-
LambdaEvmHook that = (LambdaEvmHook) o;
87+
EvmHook that = (EvmHook) o;
8888
return super.equals(o) && storageUpdates.equals(that.storageUpdates);
8989
}
9090

@@ -95,6 +95,6 @@ public int hashCode() {
9595

9696
@Override
9797
public String toString() {
98-
return "LambdaEvmHook{contractId=" + getContractId() + ", storageUpdates=" + storageUpdates + "}";
98+
return "EvmHook{contractId=" + getContractId() + ", storageUpdates=" + storageUpdates + "}";
9999
}
100100
}

sdk/src/main/java/com/hedera/hashgraph/sdk/LambdaMappingEntry.java renamed to sdk/src/main/java/com/hedera/hashgraph/sdk/EvmHookMappingEntry.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
/**
1010
* Represents an entry in a Solidity mapping.
1111
* <p>
12-
* This class is used to specify updates to Solidity mapping entries in a
13-
* lambda EVM hook's storage. It supports both explicit key bytes and
12+
* This class is used to specify updates to Solidity mapping entries in an
13+
* EVM hook's storage. It supports both explicit key bytes and
1414
* preimage-based keys for variable-length mapping keys.
1515
*/
16-
public class LambdaMappingEntry {
16+
public class EvmHookMappingEntry {
1717
private final byte[] key;
1818
private final byte[] preimage;
1919
private final byte[] value;
@@ -24,9 +24,9 @@ public class LambdaMappingEntry {
2424
* @param key the explicit mapping key (max 32 bytes, minimal representation)
2525
* @param value the mapping value (max 32 bytes, minimal representation)
2626
*/
27-
public static LambdaMappingEntry ofKey(byte[] key, byte[] value) {
27+
public static EvmHookMappingEntry ofKey(byte[] key, byte[] value) {
2828
Objects.requireNonNull(key, "key cannot be null");
29-
return new LambdaMappingEntry(key, null, value);
29+
return new EvmHookMappingEntry(key, null, value);
3030
}
3131

3232
/**
@@ -35,12 +35,12 @@ public static LambdaMappingEntry ofKey(byte[] key, byte[] value) {
3535
* @param preimage the preimage bytes for the mapping key
3636
* @param value the mapping value (max 32 bytes, minimal representation)
3737
*/
38-
public static LambdaMappingEntry withPreimage(byte[] preimage, byte[] value) {
38+
public static EvmHookMappingEntry withPreimage(byte[] preimage, byte[] value) {
3939
Objects.requireNonNull(preimage, "preimage cannot be null");
40-
return new LambdaMappingEntry(null, preimage, value);
40+
return new EvmHookMappingEntry(null, preimage, value);
4141
}
4242

43-
private LambdaMappingEntry(byte[] key, byte[] preimage, byte[] value) {
43+
private EvmHookMappingEntry(byte[] key, byte[] preimage, byte[] value) {
4444
Objects.requireNonNull(value, "value cannot be null");
4545
this.key = key != null ? key.clone() : null;
4646
this.preimage = preimage != null ? preimage.clone() : null;
@@ -95,10 +95,10 @@ public byte[] getValue() {
9595
/**
9696
* Convert this mapping entry to a protobuf message.
9797
*
98-
* @return the protobuf LambdaMappingEntry
98+
* @return the protobuf EvmHookMappingEntry
9999
*/
100-
com.hedera.hashgraph.sdk.proto.LambdaMappingEntry toProtobuf() {
101-
var builder = com.hedera.hashgraph.sdk.proto.LambdaMappingEntry.newBuilder();
100+
com.hedera.hashgraph.sdk.proto.EvmHookMappingEntry toProtobuf() {
101+
var builder = com.hedera.hashgraph.sdk.proto.EvmHookMappingEntry.newBuilder();
102102

103103
if (key != null) {
104104
builder.setKey(ByteString.copyFrom(key));
@@ -114,21 +114,21 @@ com.hedera.hashgraph.sdk.proto.LambdaMappingEntry toProtobuf() {
114114
}
115115

116116
/**
117-
* Create a LambdaMappingEntry from a protobuf message.
117+
* Create an EvmHookMappingEntry from a protobuf message.
118118
*
119-
* @param proto the protobuf LambdaMappingEntry
120-
* @return a new LambdaMappingEntry instance
119+
* @param proto the protobuf EvmHookMappingEntry
120+
* @return a new EvmHookMappingEntry instance
121121
*/
122-
public static LambdaMappingEntry fromProtobuf(com.hedera.hashgraph.sdk.proto.LambdaMappingEntry proto) {
122+
public static EvmHookMappingEntry fromProtobuf(com.hedera.hashgraph.sdk.proto.EvmHookMappingEntry proto) {
123123
return switch (proto.getEntryKeyCase()) {
124124
case KEY ->
125-
LambdaMappingEntry.ofKey(
125+
EvmHookMappingEntry.ofKey(
126126
proto.getKey().toByteArray(), proto.getValue().toByteArray());
127127
case PREIMAGE ->
128-
LambdaMappingEntry.withPreimage(
128+
EvmHookMappingEntry.withPreimage(
129129
proto.getPreimage().toByteArray(), proto.getValue().toByteArray());
130130
case ENTRYKEY_NOT_SET ->
131-
throw new IllegalArgumentException("LambdaMappingEntry must have either key or preimage set");
131+
throw new IllegalArgumentException("EvmHookMappingEntry must have either key or preimage set");
132132
};
133133
}
134134

@@ -137,7 +137,7 @@ public boolean equals(Object o) {
137137
if (this == o) return true;
138138
if (o == null || getClass() != o.getClass()) return false;
139139

140-
LambdaMappingEntry that = (LambdaMappingEntry) o;
140+
EvmHookMappingEntry that = (EvmHookMappingEntry) o;
141141
return Arrays.equals(key, that.key)
142142
&& Arrays.equals(preimage, that.preimage)
143143
&& Arrays.equals(value, that.value);
@@ -151,10 +151,10 @@ public int hashCode() {
151151
@Override
152152
public String toString() {
153153
if (key != null) {
154-
return "LambdaMappingEntry{key=" + java.util.Arrays.toString(key) + ", value="
154+
return "EvmHookMappingEntry{key=" + java.util.Arrays.toString(key) + ", value="
155155
+ java.util.Arrays.toString(value) + "}";
156156
} else {
157-
return "LambdaMappingEntry{preimage=" + java.util.Arrays.toString(preimage) + ", value="
157+
return "EvmHookMappingEntry{preimage=" + java.util.Arrays.toString(preimage) + ", value="
158158
+ java.util.Arrays.toString(value) + "}";
159159
}
160160
}

0 commit comments

Comments
 (0)