Skip to content

Commit 059f735

Browse files
authored
Merge pull request #2094 from hyperledger/ensLinea
Adds Support for Linea ENS
2 parents f27b4fe + 9382672 commit 059f735

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
1212
### Features
1313

1414
* bump snapshot version to 4.12.2 [#2093](https://github.com/hyperledger/web3j/pull/2093)
15+
* Adds Support for Linea ENS [#2094](https://github.com/hyperledger/web3j/pull/2094)
1516

1617
### BREAKING CHANGES
1718

Diff for: core/src/main/java/org/web3j/ens/Contracts.java

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class Contracts {
2222
public static final String RINKEBY = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
2323
public static final String GOERLI = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
2424
public static final String SEPOLIA = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
25+
public static final String LINEA = "0x50130b669B28C339991d8676FA73CF122a121267";
26+
public static final String LINEA_SEPOLIA = "0x5B2636F0f2137B4aE722C01dd5122D7d3e9541f7";
2527

2628
public static String resolveRegistryContract(String chainId) {
2729
final Long chainIdLong = Long.parseLong(chainId);
@@ -35,6 +37,10 @@ public static String resolveRegistryContract(String chainId) {
3537
return GOERLI;
3638
} else if (chainIdLong.equals(ChainIdLong.SEPOLIA)) {
3739
return SEPOLIA;
40+
} else if (chainIdLong.equals(ChainIdLong.LINEA)) {
41+
return LINEA;
42+
} else if (chainIdLong.equals(ChainIdLong.LINEA_SEPOLIA)) {
43+
return LINEA_SEPOLIA;
3844
} else {
3945
throw new EnsResolutionException(
4046
"Unable to resolve ENS registry contract for network id: " + chainId);

Diff for: core/src/main/java/org/web3j/tx/ChainIdLong.java

+2
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ public class ChainIdLong {
2525
public static final long KOVAN = 42;
2626
public static final long ETHEREUM_CLASSIC_MAINNET = 61;
2727
public static final long ETHEREUM_CLASSIC_TESTNET = 62;
28+
public static final long LINEA = 59144;
29+
public static final long LINEA_SEPOLIA = 59141;
2830
}

Diff for: core/src/test/java/org/web3j/ens/ContractsTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import static org.junit.jupiter.api.Assertions.assertEquals;
2020
import static org.junit.jupiter.api.Assertions.assertThrows;
21+
import static org.web3j.ens.Contracts.LINEA;
22+
import static org.web3j.ens.Contracts.LINEA_SEPOLIA;
2123
import static org.web3j.ens.Contracts.MAINNET;
2224
import static org.web3j.ens.Contracts.RINKEBY;
2325
import static org.web3j.ens.Contracts.ROPSTEN;
@@ -33,6 +35,8 @@ public void testResolveRegistryContract() {
3335
assertEquals(resolveRegistryContract(ChainIdLong.ROPSTEN + ""), (ROPSTEN));
3436
assertEquals(resolveRegistryContract(ChainIdLong.RINKEBY + ""), (RINKEBY));
3537
assertEquals(resolveRegistryContract(ChainIdLong.SEPOLIA + ""), (SEPOLIA));
38+
assertEquals(resolveRegistryContract(ChainIdLong.LINEA + ""), (LINEA));
39+
assertEquals(resolveRegistryContract(ChainIdLong.LINEA_SEPOLIA + ""), (LINEA_SEPOLIA));
3640
}
3741

3842
@Test

0 commit comments

Comments
 (0)