diff --git a/README.md b/README.md index 05d325e..40e53dd 100644 --- a/README.md +++ b/README.md @@ -37,5 +37,5 @@ repositories { ## Requirements -- Android - API level 21 -- Java 8 +- Android - API level 24 +- Java 8 / 1.8 diff --git a/build.gradle b/build.gradle index 8fbddc8..5c8c446 100644 --- a/build.gradle +++ b/build.gradle @@ -15,11 +15,11 @@ repositories { } dependencies { - implementation 'org.web3j:core:4.6.0-android' - api 'net.sourceforge.streamsupport:streamsupport-cfuture:1.7.3' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' - testImplementation 'org.slf4j:slf4j-simple:1.7.32' + implementation 'org.web3j:core:4.8.8-android' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation 'org.slf4j:slf4j-simple:1.7.36' + testImplementation 'com.google.code.gson:gson:2.8.6' } test { diff --git a/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java b/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java index 93215f4..50d26e8 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java @@ -1,125 +1,147 @@ package org.torusresearch.fetchnodedetails; -import java8.util.concurrent.CompletableFuture; -import org.torusresearch.fetchnodedetails.types.*; +import org.torusresearch.fetchnodedetails.types.EthereumNetwork; +import org.torusresearch.fetchnodedetails.types.NodeDetails; +import org.torusresearch.fetchnodedetails.types.NodeInfo; +import org.torusresearch.fetchnodedetails.types.TorusNodePub; import org.web3j.crypto.Credentials; +import org.web3j.crypto.Hash; import org.web3j.protocol.Web3j; import org.web3j.protocol.http.HttpService; -import org.web3j.tuples.generated.Tuple6; -import org.web3j.tuples.generated.Tuple7; import org.web3j.tx.gas.DefaultGasProvider; import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.CompletableFuture; public class FetchNodeDetails { + public static String PROXY_ADDRESS_MAINNET = "0xf20336e16B5182637f09821c27BDe29b0AFcfe80"; + public static String PROXY_ADDRESS_ROPSTEN = "0x6258c9d6c12ed3edda59a1a6527e469517744aa7"; + public static String PROXY_ADDRESS_POLYGON = "0x9f072ba19b3370e512aa1b4bfcdaf97283168005"; + + public static NodeDetails NODE_DETAILS_MAINNET = new NodeDetails( + "19", + "0xf20336e16B5182637f09821c27BDe29b0AFcfe80", + new String[]{ + "https://torus-19.torusnode.com/jrpc", + "https://torus-node.ens.domains/jrpc", + "https://torus-node.matic.network/jrpc", + "https://torus.zilliqa.network/jrpc", + "https://torus-mainnet.cosmos.network/jrpc", + "https://torus2.etherscan.com/jrpc", + "https://torus-node-v2.skalelabs.com/jrpc", + "https://torus-node.binancex.dev/jrpc", + "https://torusnode.ont.io/jrpc" + }, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5"), new BigInteger("6"), new BigInteger("7"), new BigInteger("8"), new BigInteger("9"),}, + new TorusNodePub[]{ + new TorusNodePub( + "bbe83c64177c3775550e6ba6ac2bc059f6847d644c9e4894e42c60d7974d8c2b", + "82b49a7caf70def38cdad2740af45c1e4f969650105c5019a29bb18b21a9acb5" + ), + new TorusNodePub( + "c208cac4ef9a47d386097a9c915b28e9cb89213abee8d26a17198ee261201b0d", + "c7db2fe4631109f40833de9dc78d07e35706549ee48fa557b33e4e75e1047873" + ), new TorusNodePub + ( + "ca1766bb426d4ca5582818a0c5439d560ea64f5baa060793ab29dd3d0ceacfe", + "d46c1d08c40e1306e1bca328c2287b8268166b11a1ba4b8442ea2ad0c5e32152" + ), new TorusNodePub + ( + "c3934dd2f6f4b3d2e1e398cc501e143c1e1a381b52feb6d1525af34d16253768", + "71f5141a5035799099f5ea3e241e66946bc55dc857ac3bd7d6fcdb8dcd3eeeef" + ), new TorusNodePub + ( + "22e66f1929631d00bf026227581597f085fd94fd952fc0dca9f0833398b5c064", + "6088b3912e10a1e9d50355a609c10db7d188f16a2e2fd7357e51bf4f6a74f0a1" + ), new TorusNodePub + ( + "9dc9fa410f3ce9eb70df70cdea00a49f2c4cc7a31c08c0dab5f863ed35ff5139", + "627a291cb87a75c61da3f65d6818e1e05e360217179817ed27e8c73bca7ec122" + ), new TorusNodePub + ( + "118b9fc07e97b096d899b9f6658463ce6a8caa64038e37fc969df4e6023dd8c6", + "baf9fa4e51770f4796ea165dd03a769b8606681a38954a0a92c4cbffd6609ce9" + ), new TorusNodePub + ( + "8a6d8b925da15a273dec3d8f8395ec35cd6878f274b2b180e4e106999db64043", + "96f67f870c157743da0b1eb84d89bf30500d74dc84c11f501ee1cb013acc8c46" + ), new TorusNodePub + ( + "39cecb62e863729f572f7dfc46c24867981bf04bb405fed0df39e33984bfade5", + "61c2364434012e68a2be2e9952805037e52629d7762fafc8e10e9fb5bad8f790" + ) + }, + false); + private final String proxyAddress; private final NodeDetails nodeDetails = new NodeDetails(); private final String providerUrl; - private NodeListProxy proxyContract; + private TorusLookup torusLookup; public FetchNodeDetails() { - this(EthereumNetwork.MAINNET, "0x638646503746d5456209e33a2ff5e3226d698bea"); + this(EthereumNetwork.MAINNET, "0xf20336e16B5182637f09821c27BDe29b0AFcfe80"); } public FetchNodeDetails(EthereumNetwork network, String proxyAddress) { this.proxyAddress = proxyAddress; - this.providerUrl = "https://" + network.toString().toLowerCase() + ".infura.io/v3/" + "b8cdb0e4cff24599a286bf8e87ff1c96"; + this.providerUrl = "https://" + network.toString() + ".infura.io/v3/" + "b8cdb0e4cff24599a286bf8e87ff1c96"; this.setupWeb3(); } - public FetchNodeDetails(String proxyAddress, String providerUrl) { + public FetchNodeDetails(String providerUrl, String proxyAddress) { this.proxyAddress = proxyAddress; this.providerUrl = providerUrl; this.setupWeb3(); } -// public static void main(String[] args) { -// FetchNodeDetails fetchNodeDetails = new FetchNodeDetails(); -// try { -// // var epoch = fetchNodeDetails.getCurrentEpoch().get(); -// NodeDetails nodeDetails = fetchNodeDetails.getNodeDetails().get(); -// String[] epoch = nodeDetails.getTorusNodeEndpoints(); -// TorusNodePub[] items = nodeDetails.getTorusNodePub(); -// BigInteger[] indexes = nodeDetails.getTorusIndexes(); -// Arrays.stream(items).forEach(System.out::println); -// Arrays.stream(epoch).forEach(System.out::println); -// Arrays.stream(indexes).forEach(System.out::println); -// System.out.println(nodeDetails); -// } catch (Exception e) { -// System.out.println(e.toString()); -// } -// System.out.println("Hello world from fetch node details"); -// } - - public CompletableFuture getCurrentEpoch() { - return this.proxyContract.currentEpoch().sendAsync(); - } - - public CompletableFuture getEpochInfo(BigInteger epoch) { - return this.proxyContract.getEpochInfo(epoch).sendAsync() - .thenApply( - (Tuple7, BigInteger, BigInteger> result) -> - new EpochInfo(result.component1().toString(), result.component2().toString(), result.component3().toString(), - result.component4().toString(), result.component5().toArray(new String[0]), - result.component6().toString(), result.component7().toString()) - ); - } + public CompletableFuture getNodeDetails(String verifier, String verifierId) { + // For mainnet & ropsten, verifierId combination doesn't change the network details + if (this.nodeDetails.getUpdated() && (this.proxyAddress.equals(PROXY_ADDRESS_MAINNET) || this.proxyAddress.equals(PROXY_ADDRESS_ROPSTEN))) + return CompletableFuture.supplyAsync(() -> this.nodeDetails); + byte[] hashedVerifierId = Hash.sha3(verifierId.getBytes(StandardCharsets.UTF_8)); + CompletableFuture cf = new CompletableFuture<>(); + this.torusLookup.getNodeSet(verifier, hashedVerifierId).sendAsync().whenCompleteAsync((nodeEndPoints, err) -> { + if (err != null) { + if (this.proxyAddress.equals(FetchNodeDetails.PROXY_ADDRESS_MAINNET)) { + cf.complete(FetchNodeDetails.NODE_DETAILS_MAINNET); + } else { + cf.completeExceptionally(err); + } + return; + } + try { + String[] updatedEndpoints = new String[nodeEndPoints.component3().size()]; + TorusNodePub[] updatedNodePub = new TorusNodePub[nodeEndPoints.component3().size()]; - public CompletableFuture getNodeEndpoint(String nodeEthAddress) { - return this.proxyContract.getNodeDetails(nodeEthAddress).sendAsync().thenApply( - (Tuple6 result) -> - new NodeInfo(result.component1(), result.component2().toString(), result.component3().toString(16), - result.component4().toString(16), result.component5(), result.component6()) - ); - } + for (int i = 0; i < nodeEndPoints.component3().size(); i++) { + NodeInfo endPointElement = new NodeInfo(String.valueOf(nodeEndPoints.component2().get(i)), + new BigInteger(String.valueOf(nodeEndPoints.component3().get(i)), 10).toString(16).replace("0x", ""), + new BigInteger(String.valueOf(nodeEndPoints.component4().get(i)), 10).toString(16).replace("0x", "")); - public CompletableFuture getNodeDetails() { - if (this.nodeDetails.getUpdated()) return CompletableFuture.supplyAsync(() -> this.nodeDetails); - return this.getCurrentEpoch().thenCompose((epoch) -> { - this.nodeDetails.setNodeListAddress(this.proxyAddress); - this.nodeDetails.setCurrentEpoch(epoch.toString()); - return this.getEpochInfo(epoch); - }).thenCompose((latestEpochInfo) -> { - String[] nodeList = latestEpochInfo.getNodeList(); - BigInteger[] _torusIndexes = new BigInteger[nodeList.length]; - List> futures = new ArrayList<>(nodeList.length); - for (int i = 0, size = nodeList.length; i < size; i++) { - _torusIndexes[i] = new BigInteger(Integer.toString(i + 1)); - futures.add(this.getNodeEndpoint(nodeList[i])); - } - this.nodeDetails.setTorusIndexes(_torusIndexes); - CompletableFuture allFutures = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); - return allFutures.thenApply(v -> { - // futures.stream().map(CompletableFuture::join).collect(Collectors.toList() - NodeInfo[] nodeInfoArray = new NodeInfo[nodeList.length]; - for (int i = 0; i < futures.size(); i++) { - nodeInfoArray[i] = futures.get(i).join(); + String endpoint = "https://" + endPointElement.getDeclaredIp().split(":")[0] + "/jrpc"; + updatedEndpoints[i] = endpoint; + updatedNodePub[i] = new TorusNodePub(endPointElement.getPubKx(), endPointElement.getPubKy()); } - return nodeInfoArray; - }); - }).thenApply((nodeEndPoints) -> { - String[] updatedEndpoints = new String[nodeEndPoints.length]; - TorusNodePub[] updatedNodePub = new TorusNodePub[nodeEndPoints.length]; - for (int i = 0, size = nodeEndPoints.length; i < size; i++) { - NodeInfo endPointElement = nodeEndPoints[i]; - String endpoint = "https://" + endPointElement.getDeclaredIp().split(":")[0] + "/jrpc"; - updatedEndpoints[i] = endpoint; - updatedNodePub[i] = new TorusNodePub(endPointElement.getPubKx(), endPointElement.getPubKy()); + this.nodeDetails.setNodeListAddress(this.proxyAddress); + this.nodeDetails.setCurrentEpoch(nodeEndPoints.component1().toString()); + this.nodeDetails.setTorusNodeEndpoints(updatedEndpoints); + this.nodeDetails.setTorusNodePub(updatedNodePub); + this.nodeDetails.setTorusIndexes(nodeEndPoints.component5().toArray(new BigInteger[0])); + this.nodeDetails.setUpdated(true); + cf.complete(this.nodeDetails); + } catch (Exception err2) { + cf.completeExceptionally(err2); } - this.nodeDetails.setTorusNodeEndpoints(updatedEndpoints); - this.nodeDetails.setTorusNodePub(updatedNodePub); - this.nodeDetails.setUpdated(true); - return this.nodeDetails; }); + return cf; } private void setupWeb3() { Web3j web3j = Web3j.build(new HttpService(this.providerUrl)); Credentials credentials = Credentials.create("0x5bbbef76458bf30511c9ee6ed56783644eb339258d02656755c68098c4809130"); - this.proxyContract = new NodeListProxy(this.proxyAddress, web3j, credentials, new DefaultGasProvider()); + this.torusLookup = new TorusLookup(this.proxyAddress, web3j, credentials, new DefaultGasProvider()); } } diff --git a/src/main/java/org/torusresearch/fetchnodedetails/NodeListProxy.java b/src/main/java/org/torusresearch/fetchnodedetails/NodeListProxy.java deleted file mode 100644 index ec1bc81..0000000 --- a/src/main/java/org/torusresearch/fetchnodedetails/NodeListProxy.java +++ /dev/null @@ -1,400 +0,0 @@ -package org.torusresearch.fetchnodedetails; - -import io.reactivex.Flowable; -import org.web3j.abi.EventEncoder; -import org.web3j.abi.FunctionEncoder; -import org.web3j.abi.TypeReference; -import org.web3j.abi.datatypes.*; -import org.web3j.abi.datatypes.generated.Uint256; -import org.web3j.crypto.Credentials; -import org.web3j.protocol.Web3j; -import org.web3j.protocol.core.DefaultBlockParameter; -import org.web3j.protocol.core.RemoteCall; -import org.web3j.protocol.core.RemoteFunctionCall; -import org.web3j.protocol.core.methods.request.EthFilter; -import org.web3j.protocol.core.methods.response.BaseEventResponse; -import org.web3j.protocol.core.methods.response.TransactionReceipt; -import org.web3j.tuples.generated.Tuple6; -import org.web3j.tuples.generated.Tuple7; -import org.web3j.tx.Contract; -import org.web3j.tx.TransactionManager; -import org.web3j.tx.gas.ContractGasProvider; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -import static java.util.Arrays.asList; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version 4.5.4. - */ -@SuppressWarnings("rawtypes") -public class NodeListProxy extends Contract { - public static final String FUNC_CURRENTEPOCH = "currentEpoch"; - public static final String FUNC_ISOWNER = "isOwner"; - public static final String FUNC_OWNER = "owner"; - public static final String FUNC_RENOUNCEOWNERSHIP = "renounceOwnership"; - public static final String FUNC_TRANSFEROWNERSHIP = "transferOwnership"; - public static final String FUNC_SETCURRENTEPOCH = "setCurrentEpoch"; - public static final String FUNC_SETNODELISTCONTRACT = "setNodeListContract"; - public static final String FUNC_GETNODES = "getNodes"; - public static final String FUNC_GETNODEDETAILS = "getNodeDetails"; - public static final String FUNC_GETPSSSTATUS = "getPssStatus"; - public static final String FUNC_ISWHITELISTED = "isWhitelisted"; - public static final String FUNC_GETEPOCHINFO = "getEpochInfo"; - public static final Event EPOCHCHANGED_EVENT = new Event("EpochChanged", - asList(new TypeReference() { - }, new TypeReference() { - })); - public static final Event NODELISTCONTRACTCHANGED_EVENT = new Event("NodeListContractChanged", - asList(new TypeReference

() { - }, new TypeReference
() { - })); - public static final Event OWNERSHIPTRANSFERRED_EVENT = new Event("OwnershipTransferred", - asList(new TypeReference
(true) { - }, new TypeReference
(true) { - })); - protected static final HashMap _addresses; - private static final String BINARY = "0x608060405234801561001057600080fd5b50604051610f4a380380610f4a8339818101604052604081101561003357600080fd5b508051602090910151600061004f6001600160e01b036100c116565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600155600280546001600160a01b0319166001600160a01b03929092169190911790556100c5565b3390565b610e76806100d46000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80637d22c35c11610081578063bafb35811161005b578063bafb3581146102b4578063c7aa8ff714610433578063f2fde38b14610456576100d4565b80637d22c35c146102485780638da5cb5b146102885780638f32d59b146102ac576100d4565b806347de074f116100b257806347de074f146101b9578063715018a614610226578063766718081461022e576100d4565b806308704c0a146100d9578063135022c2146101015780631dd6b9b11461019c575b600080fd5b6100ff600480360360208110156100ef57600080fd5b50356001600160a01b031661047c565b005b61011e6004803603602081101561011757600080fd5b503561058c565b6040518088815260200187815260200186815260200185815260200180602001848152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561018257818101518382015260200161016a565b505050509050019850505050505050505060405180910390f35b6100ff600480360360208110156101b257600080fd5b50356106ff565b6101d6600480360360208110156101cf57600080fd5b5035610798565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102125781810151838201526020016101fa565b505050509050019250505060405180910390f35b6100ff6108b4565b610236610950565b60408051918252519081900360200190f35b6102746004803603604081101561025e57600080fd5b50803590602001356001600160a01b0316610956565b604080519115158252519081900360200190f35b6102906109e1565b604080516001600160a01b039092168252519081900360200190f35b6102746109f0565b6102da600480360360208110156102ca57600080fd5b50356001600160a01b0316610a14565b6040518080602001878152602001868152602001858152602001806020018060200184810384528a818151815260200191508051906020019080838360005b83811015610331578181015183820152602001610319565b50505050905090810190601f16801561035e5780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b83811015610391578181015183820152602001610379565b50505050905090810190601f1680156103be5780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b838110156103f15781810151838201526020016103d9565b50505050905090810190601f16801561041e5780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b6102366004803603604081101561044957600080fd5b5080359060200135610cd6565b6100ff6004803603602081101561046c57600080fd5b50356001600160a01b0316610d29565b6104846109f0565b6104ce576040805162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b604482015290519081900360640190fd5b6001600160a01b038116610529576040805162461bcd60e51b815260206004820152600f60248201527f6e6f207a65726f20616464726573730000000000000000000000000000000000604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fdc1f595b72ed3d34e3bd6fac603c555426330dc53cca030f6dcf09bcf2684816929181900390910190a15050565b6000806000806060600080600260009054906101000a90046001600160a01b03166001600160a01b031663135022c2896040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b1580156105f057600080fd5b505afa158015610604573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260e081101561062d57600080fd5b815160208301516040808501516060860151608087018051935195979496929591949193928201928464010000000082111561066857600080fd5b90830190602082018581111561067d57600080fd5b825186602082028301116401000000008211171561069a57600080fd5b82525081516020918201928201910280838360005b838110156106c75781810151838201526020016106af565b505050509190910160409081526020830151920151989f50969d50949b50929950909750919550929350505050919395979092949650565b6107076109f0565b610751576040805162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b604482015290519081900360640190fd5b6001805490829055604080518281526020810184905281517f528990bbb5369a7f6d5acab41233e32bddb4882673d0208805b59cbad0dc1ec8929181900390910190a15050565b600254604080516347de074f60e01b81526004810184905290516060926001600160a01b0316916347de074f916024808301926000929190829003018186803b1580156107e457600080fd5b505afa1580156107f8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561082157600080fd5b810190808051604051939291908464010000000082111561084157600080fd5b90830190602082018581111561085657600080fd5b825186602082028301116401000000008211171561087357600080fd5b82525081516020918201928201910280838360005b838110156108a0578181015183820152602001610888565b505050509050016040525050509050919050565b6108bc6109f0565b610906576040805162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60015481565b60025460408051631f48b0d760e21b8152600481018590526001600160a01b03848116602483015291516000939290921691637d22c35c91604480820192602092909190829003018186803b1580156109ae57600080fd5b505afa1580156109c2573d6000803e3d6000fd5b505050506040513d60208110156109d857600080fd5b50519392505050565b6000546001600160a01b031690565b600080546001600160a01b0316610a05610d87565b6001600160a01b031614905090565b6002546040805163859da85f60e01b81526001600160a01b03848116600483015291516060936000938493849387938493169163859da85f9160248083019288929190829003018186803b158015610a6b57600080fd5b505afa158015610a7f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260c0811015610aa857600080fd5b8101908080516040519392919084640100000000821115610ac857600080fd5b908301906020820185811115610add57600080fd5b8251640100000000811182820188101715610af757600080fd5b82525081516020918201929091019080838360005b83811015610b24578181015183820152602001610b0c565b50505050905090810190601f168015610b515780820380516001836020036101000a031916815260200191505b50604081815260208301519083015160608401516080909401805192969195919284640100000000821115610b8557600080fd5b908301906020820185811115610b9a57600080fd5b8251640100000000811182820188101715610bb457600080fd5b82525081516020918201929091019080838360005b83811015610be1578181015183820152602001610bc9565b50505050905090810190601f168015610c0e5780820380516001836020036101000a031916815260200191505b5060405260200180516040519392919084640100000000821115610c3157600080fd5b908301906020820185811115610c4657600080fd5b8251640100000000811182820188101715610c6057600080fd5b82525081516020918201929091019080838360005b83811015610c8d578181015183820152602001610c75565b50505050905090810190601f168015610cba5780820380516001836020036101000a031916815260200191505b5060405250969e959d50939b5091995097509550909350505050565b6002546040805163c7aa8ff760e01b8152600481018590526024810184905290516000926001600160a01b03169163c7aa8ff7916044808301926020929190829003018186803b1580156109ae57600080fd5b610d316109f0565b610d7b576040805162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b604482015290519081900360640190fd5b610d8481610d8b565b50565b3390565b6001600160a01b038116610de6576040805162461bcd60e51b815260206004820152601860248201527f4f776e61626c653a206e6f207a65726f20616464726573730000000000000000604482015290519081900360640190fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fea265627a7a7231582063f471c91f5092523badf4ee4de5e1f3dc1392dc87d2eeff035b010ca0ab132164736f6c634300050f0032"; - - static { - _addresses = new HashMap<>(); - _addresses.put("1578914500522", "0x1f5c8F1b6b14044875520A9eC05131eEfeC71112"); - _addresses.put("1577963254622", "0x08D07331C9cce30983929B3043B682c8DA019E02"); - _addresses.put("1577961918044", "0xa977A50Fa0F14E138EC021685408E0Cf07E26300"); - _addresses.put("1577961100099", "0x6320f4F7f2A06dEb8b9Ec635A70E427818421929"); - _addresses.put("1577960620355", "0xfa35b801Ec94B68017Ba6ad1d2898778552dd417"); - _addresses.put("1577961283304", "0x5811C3E88803dBeCeF269b40C1087bcc074D7Cd7"); - _addresses.put("1578913944784", "0x4eE5b52EE4fB80f124480800316Eb464f9978225"); - _addresses.put("1577963812859", "0x885B93D077463209BE9e6B4A15F0BFc7BD494f64"); - _addresses.put("1577963629748", "0xc41bCD899c474c0bD8FBd6009549f33B6D6dA47f"); - _addresses.put("1577966769986", "0x942d5C2cDE0574b29648108733B4A5ac1E13174D"); - _addresses.put("1577963881061", "0x616D136d8DE615d4b8dD67590B72C1238d432ac9"); - _addresses.put("1577964209403", "0x79B5EaF494167Ffe16c478405566b8b8e46af893"); - _addresses.put("1577960360239", "0xFB634d8d5560Ea3dE3D628Dc19F48a67DB502782"); - _addresses.put("1577962310796", "0x56F650571c5Ab0d8326Bc5AFeE14465f8a8D402D"); - _addresses.put("1577964565701", "0x7287D447C91eC608dDa0Eb71Dc18Aaec8a8978ef"); - _addresses.put("1577960486491", "0x33124b8180F4323F890968e83Ec9fccDab599747"); - } - - @Deprecated - protected NodeListProxy(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected NodeListProxy(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected NodeListProxy(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected NodeListProxy(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - @Deprecated - public static NodeListProxy load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new NodeListProxy(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static NodeListProxy load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new NodeListProxy(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static NodeListProxy load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new NodeListProxy(contractAddress, web3j, credentials, contractGasProvider); - } - - public static NodeListProxy load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new NodeListProxy(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String nodeListContractAddress, BigInteger epoch) { - String encodedConstructor = FunctionEncoder.encodeConstructor(asList(new org.web3j.abi.datatypes.Address(nodeListContractAddress), - new org.web3j.abi.datatypes.generated.Uint256(epoch))); - return deployRemoteCall(NodeListProxy.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String nodeListContractAddress, BigInteger epoch) { - String encodedConstructor = FunctionEncoder.encodeConstructor(asList(new org.web3j.abi.datatypes.Address(nodeListContractAddress), - new org.web3j.abi.datatypes.generated.Uint256(epoch))); - return deployRemoteCall(NodeListProxy.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String nodeListContractAddress, BigInteger epoch) { - String encodedConstructor = FunctionEncoder.encodeConstructor(asList(new org.web3j.abi.datatypes.Address(nodeListContractAddress), - new org.web3j.abi.datatypes.generated.Uint256(epoch))); - return deployRemoteCall(NodeListProxy.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String nodeListContractAddress, BigInteger epoch) { - String encodedConstructor = FunctionEncoder.encodeConstructor(asList(new org.web3j.abi.datatypes.Address(nodeListContractAddress), - new org.web3j.abi.datatypes.generated.Uint256(epoch))); - return deployRemoteCall(NodeListProxy.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); - } - - public static String getPreviouslyDeployedAddress(String networkId) { - return _addresses.get(networkId); - } - - public List getEpochChangedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(EPOCHCHANGED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList<>(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - EpochChangedEventResponse typedResponse = new EpochChangedEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.oldEpoch = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); - typedResponse.newEpoch = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public Flowable epochChangedEventFlowable(EthFilter filter) { - return web3j.ethLogFlowable(filter).map(log -> { - EventValuesWithLog eventValues = extractEventParametersWithLog(EPOCHCHANGED_EVENT, log); - EpochChangedEventResponse typedResponse = new EpochChangedEventResponse(); - typedResponse.log = log; - typedResponse.oldEpoch = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); - typedResponse.newEpoch = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); - return typedResponse; - }); - } - - public Flowable epochChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { - EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); - filter.addSingleTopic(EventEncoder.encode(EPOCHCHANGED_EVENT)); - return epochChangedEventFlowable(filter); - } - - public List getNodeListContractChangedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(NODELISTCONTRACTCHANGED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList<>(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - NodeListContractChangedEventResponse typedResponse = new NodeListContractChangedEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.oldContract = (String) eventValues.getNonIndexedValues().get(0).getValue(); - typedResponse.newContract = (String) eventValues.getNonIndexedValues().get(1).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public Flowable nodeListContractChangedEventFlowable(EthFilter filter) { - return web3j.ethLogFlowable(filter).map(log -> { - EventValuesWithLog eventValues = extractEventParametersWithLog(NODELISTCONTRACTCHANGED_EVENT, log); - NodeListContractChangedEventResponse typedResponse = new NodeListContractChangedEventResponse(); - typedResponse.log = log; - typedResponse.oldContract = (String) eventValues.getNonIndexedValues().get(0).getValue(); - typedResponse.newContract = (String) eventValues.getNonIndexedValues().get(1).getValue(); - return typedResponse; - }); - } - - public Flowable nodeListContractChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { - EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); - filter.addSingleTopic(EventEncoder.encode(NODELISTCONTRACTCHANGED_EVENT)); - return nodeListContractChangedEventFlowable(filter); - } - - public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList<>(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.previousOwner = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.newOwner = (String) eventValues.getIndexedValues().get(1).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public Flowable ownershipTransferredEventFlowable(EthFilter filter) { - return web3j.ethLogFlowable(filter).map(log -> { - EventValuesWithLog eventValues = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, log); - OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); - typedResponse.log = log; - typedResponse.previousOwner = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.newOwner = (String) eventValues.getIndexedValues().get(1).getValue(); - return typedResponse; - }); - } - - public Flowable ownershipTransferredEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { - EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); - filter.addSingleTopic(EventEncoder.encode(OWNERSHIPTRANSFERRED_EVENT)); - return ownershipTransferredEventFlowable(filter); - } - - public RemoteFunctionCall currentEpoch() { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_CURRENTEPOCH, - Collections.emptyList(), - Collections.singletonList(new TypeReference() { - })); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); - } - - public RemoteFunctionCall isOwner() { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ISOWNER, - Collections.emptyList(), - Collections.singletonList(new TypeReference() { - })); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteFunctionCall owner() { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_OWNER, - Collections.emptyList(), - Collections.singletonList(new TypeReference
() { - })); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteFunctionCall renounceOwnership() { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( - FUNC_RENOUNCEOWNERSHIP, - Collections.emptyList(), - Collections.emptyList()); - return executeRemoteCallTransaction(function); - } - - public RemoteFunctionCall transferOwnership(String newOwner) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( - FUNC_TRANSFEROWNERSHIP, - Collections.singletonList(new Address(newOwner)), - Collections.emptyList()); - return executeRemoteCallTransaction(function); - } - - public RemoteFunctionCall setCurrentEpoch(BigInteger _newEpoch) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( - FUNC_SETCURRENTEPOCH, - Collections.singletonList(new Uint256(_newEpoch)), - Collections.emptyList()); - return executeRemoteCallTransaction(function); - } - - public RemoteFunctionCall setNodeListContract(String nodeListContractAddress) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( - FUNC_SETNODELISTCONTRACT, - Collections.singletonList(new Address(nodeListContractAddress)), - Collections.emptyList()); - return executeRemoteCallTransaction(function); - } - - public RemoteFunctionCall getNodes(BigInteger epoch) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETNODES, - Collections.singletonList(new Uint256(epoch)), - Collections.singletonList(new TypeReference>() { - })); - return new RemoteFunctionCall<>(function, - () -> { - List result = (List) executeCallSingleValueReturn(function, List.class); - return convertToNative(result); - }); - } - - public RemoteFunctionCall> getNodeDetails(String nodeAddress) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETNODEDETAILS, - Collections.singletonList(new Address(nodeAddress)), - asList(new TypeReference() { - }, new TypeReference() { - }, new TypeReference() { - }, new TypeReference() { - }, new TypeReference() { - }, new TypeReference() { - })); - return new RemoteFunctionCall<>(function, - () -> { - List results = executeCallMultipleValueReturn(function); - return new Tuple6<>( - (String) results.get(0).getValue(), - (BigInteger) results.get(1).getValue(), - (BigInteger) results.get(2).getValue(), - (BigInteger) results.get(3).getValue(), - (String) results.get(4).getValue(), - (String) results.get(5).getValue()); - }); - } - - public RemoteFunctionCall getPssStatus(BigInteger oldEpoch, BigInteger newEpoch) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETPSSSTATUS, - asList(new org.web3j.abi.datatypes.generated.Uint256(oldEpoch), - new org.web3j.abi.datatypes.generated.Uint256(newEpoch)), - Collections.singletonList(new TypeReference() { - })); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); - } - - public RemoteFunctionCall isWhitelisted(BigInteger epoch, String nodeAddress) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ISWHITELISTED, - asList(new org.web3j.abi.datatypes.generated.Uint256(epoch), - new org.web3j.abi.datatypes.Address(nodeAddress)), - Collections.singletonList(new TypeReference() { - })); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteFunctionCall, BigInteger, BigInteger>> getEpochInfo(BigInteger epoch) { - final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETEPOCHINFO, - Collections.singletonList(new Uint256(epoch)), - asList(new TypeReference() { - }, new TypeReference() { - }, new TypeReference() { - }, new TypeReference() { - }, new TypeReference>() { - }, new TypeReference() { - }, new TypeReference() { - })); - return new RemoteFunctionCall<>(function, - () -> { - List results = executeCallMultipleValueReturn(function); - return new Tuple7<>( - (BigInteger) results.get(0).getValue(), - (BigInteger) results.get(1).getValue(), - (BigInteger) results.get(2).getValue(), - (BigInteger) results.get(3).getValue(), - convertToNative((List
) results.get(4).getValue()), - (BigInteger) results.get(5).getValue(), - (BigInteger) results.get(6).getValue()); - }); - } - - protected String getStaticDeployedAddress(String networkId) { - return _addresses.get(networkId); - } - - public static class EpochChangedEventResponse extends BaseEventResponse { - public BigInteger oldEpoch; - - public BigInteger newEpoch; - } - - public static class NodeListContractChangedEventResponse extends BaseEventResponse { - public String oldContract; - - public String newContract; - } - - public static class OwnershipTransferredEventResponse extends BaseEventResponse { - public String previousOwner; - - public String newOwner; - } -} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/TorusLookup.java b/src/main/java/org/torusresearch/fetchnodedetails/TorusLookup.java new file mode 100644 index 0000000..9532663 --- /dev/null +++ b/src/main/java/org/torusresearch/fetchnodedetails/TorusLookup.java @@ -0,0 +1,70 @@ +package org.torusresearch.fetchnodedetails; + +import org.web3j.abi.TypeReference; +import org.web3j.abi.datatypes.DynamicArray; +import org.web3j.abi.datatypes.Type; +import org.web3j.abi.datatypes.Utf8String; +import org.web3j.abi.datatypes.generated.Uint256; +import org.web3j.crypto.Credentials; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.RemoteFunctionCall; +import org.web3j.tuples.generated.Tuple5; +import org.web3j.tx.Contract; +import org.web3j.tx.gas.ContractGasProvider; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.Callable; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version 1.4.1. + */ +@SuppressWarnings("rawtypes") +public class TorusLookup extends Contract { + public static final String BINARY = "0x608060405234801561001057600080fd5b5060405161145938038061145983398101604081905261002f91610095565b600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b0319166001600160a01b03929092169190911790556100c5565b6000602082840312156100a757600080fd5b81516001600160a01b03811681146100be57600080fd5b9392505050565b611385806100d46000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c8063a9487fd911610076578063decde7661161005b578063decde76614610144578063f2fde38b14610157578063f4f59bed1461016a57600080fd5b8063a9487fd91461010d578063d59936e91461012057600080fd5b80633f3787d2146100a8578063715018a6146100bd5780638da5cb5b146100c55780638f32d59b146100ef575b600080fd5b6100bb6100b6366004610ce0565b61017d565b005b6100bb6101f7565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6000546001600160a01b0316331460405190151581526020016100e6565b6100bb61011b366004610ded565b610294565b61013361012e366004610eb1565b6104af565b6040516100e6959493929190610f89565b6100d2610152366004610eb1565b6109a7565b6100bb610165366004610ce0565b6109ee565b6100bb610178366004610ded565b610a4d565b6000546001600160a01b031633146101d55760405162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b60448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b60448201526064016101cc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146102e75760405162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b60448201526064016101cc565b60015460405163ac205deb60e01b81526000916001600160a01b03169063ac205deb90610318908690600401611030565b600060405180830381865afa158015610335573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261035d9190810190611090565b9350505050806103af5760405162461bcd60e51b815260206004820152601c60248201527f506c65617365206372656174652076657269666965722066697273740000000060448201526064016101cc565b60006002846040516103c1919061111f565b908152604080519182900360209081018320805480830285018301909352828452919083018282801561041d57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116103ff575b505050505090506000815111156104765760405162461bcd60e51b815260206004820152601f60248201527f566572696669657220616c7265616479206861732061206e6f6465207365740060448201526064016101cc565b82600285604051610487919061111f565b908152602001604051809103902090805190602001906104a8929190610c51565b5050505050565b600060608060608060006002886040516104c9919061111f565b908152604080519182900360209081018320805480830285018301909352828452919083018282801561052557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610507575b505050505090508051600014156105b05760405166191959985d5b1d60ca1b815260029060070190815260408051918290036020908101832080548083028501830190935282845291908301828280156105a857602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161058a575b505050505090505b80516105fe5760405162461bcd60e51b815260206004820152601f60248201527f536574204e6f6465536574202d3e2076657269666965722f64656661756c740060448201526064016101cc565b805160009061060d908961113b565b905060008282815181106106235761062361115d565b6020026020010151905060008190506000816001600160a01b031663766718086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610672573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106969190611173565b6040516309a8116160e11b8152600481018290529091506000906001600160a01b0384169063135022c290602401600060405180830381865afa1580156106e1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610709919081019061118c565b50509450505050506000815167ffffffffffffffff81111561072d5761072d610d04565b604051908082528060200260200182016040528015610756578160200160208202803683370190505b5090506000825167ffffffffffffffff81111561077557610775610d04565b6040519080825280602002602001820160405280156107a857816020015b60608152602001906001900390816107935790505b5090506000835167ffffffffffffffff8111156107c7576107c7610d04565b6040519080825280602002602001820160405280156107f0578160200160208202803683370190505b5090506000845167ffffffffffffffff81111561080f5761080f610d04565b604051908082528060200260200182016040528015610838578160200160208202803683370190505b50905060005b855181101561098957610852816001611278565b8582815181106108645761086461115d565b60200260200101818152505060008060008a6001600160a01b031663bafb35818a86815181106108965761089661115d565b60200260200101516040518263ffffffff1660e01b81526004016108c991906001600160a01b0391909116815260200190565b600060405180830381865afa1580156108e6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261090e9190810190611290565b5050935093505092508287858151811061092a5761092a61115d565b6020026020010181905250818685815181106109485761094861115d565b602002602001018181525050808585815181106109675761096761115d565b602002602001018181525050505050808061098190611334565b91505061083e565b50949d50909b50995091975090955050505050509295509295909350565b815160208184018101805160028252928201918501919091209190528054829081106109d257600080fd5b6000918252602090912001546001600160a01b03169150829050565b6000546001600160a01b03163314610a415760405162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b60448201526064016101cc565b610a4a81610ba0565b50565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260206004820152601660248201527527bbb730b136329d103737ba103a34329037bbb732b960511b60448201526064016101cc565b60015460405163ac205deb60e01b81526000916001600160a01b03169063ac205deb90610ad1908690600401611030565b600060405180830381865afa158015610aee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b169190810190611090565b935050505080610b685760405162461bcd60e51b815260206004820152601c60248201527f506c65617365206372656174652076657269666965722066697273740000000060448201526064016101cc565b81600284604051610b79919061111f565b90815260200160405180910390209080519060200190610b9a929190610c51565b50505050565b6001600160a01b038116610bf65760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c653a206e6f207a65726f2061646472657373000000000000000060448201526064016101cc565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054828255906000526020600020908101928215610ca6579160200282015b82811115610ca657825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610c71565b50610cb2929150610cb6565b5090565b5b80821115610cb25760008155600101610cb7565b6001600160a01b0381168114610a4a57600080fd5b600060208284031215610cf257600080fd5b8135610cfd81610ccb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610d4357610d43610d04565b604052919050565b600067ffffffffffffffff821115610d6557610d65610d04565b50601f01601f191660200190565b600082601f830112610d8457600080fd5b8135610d97610d9282610d4b565b610d1a565b818152846020838601011115610dac57600080fd5b816020850160208301376000918101602001919091529392505050565b600067ffffffffffffffff821115610de357610de3610d04565b5060051b60200190565b60008060408385031215610e0057600080fd5b823567ffffffffffffffff80821115610e1857600080fd5b610e2486838701610d73565b9350602091508185013581811115610e3b57600080fd5b85019050601f81018613610e4e57600080fd5b8035610e5c610d9282610dc9565b81815260059190911b82018301908381019088831115610e7b57600080fd5b928401925b82841015610ea2578335610e9381610ccb565b82529284019290840190610e80565b80955050505050509250929050565b60008060408385031215610ec457600080fd5b823567ffffffffffffffff811115610edb57600080fd5b610ee785828601610d73565b95602094909401359450505050565b60005b83811015610f11578181015183820152602001610ef9565b83811115610b9a5750506000910152565b60008151808452610f3a816020860160208601610ef6565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015610f7e57815187529582019590820190600101610f62565b509495945050505050565b600060a08201878352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015610fe55760bf19888703018452610fd3868351610f22565b95509284019290840190600101610fb7565b50505050508281036040840152610ffc8187610f4e565b905082810360608401526110108186610f4e565b905082810360808401526110248185610f4e565b98975050505050505050565b602081526000610cfd6020830184610f22565b600082601f83011261105457600080fd5b8151611062610d9282610d4b565b81815284602083860101111561107757600080fd5b611088826020830160208701610ef6565b949350505050565b600080600080608085870312156110a657600080fd5b84516110b181610ccb565b602086015190945067ffffffffffffffff808211156110cf57600080fd5b6110db88838901611043565b945060408701519150808211156110f157600080fd5b506110fe87828801611043565b9250506060850151801515811461111457600080fd5b939692955090935050565b60008251611131818460208701610ef6565b9190910192915050565b60008261115857634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561118557600080fd5b5051919050565b600080600080600080600060e0888a0312156111a757600080fd5b8751965060208089015196506040890151955060608901519450608089015167ffffffffffffffff8111156111db57600080fd5b8901601f81018b136111ec57600080fd5b80516111fa610d9282610dc9565b81815260059190911b8201830190838101908d83111561121957600080fd5b928401925b8284101561124057835161123181610ccb565b8252928401929084019061121e565b809750505050505060a0880151915060c0880151905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b6000821982111561128b5761128b611262565b500190565b60008060008060008060c087890312156112a957600080fd5b865167ffffffffffffffff808211156112c157600080fd5b6112cd8a838b01611043565b975060208901519650604089015195506060890151945060808901519150808211156112f857600080fd5b6113048a838b01611043565b935060a089015191508082111561131a57600080fd5b5061132789828a01611043565b9150509295509295509295565b600060001982141561134857611348611262565b506001019056fea2646970667358221220ff4c563c9b5bbc18744cd81e5b7c83da3779a5a6e7fbab8be085b388cee415ec64736f6c634300080b0033"; + + public static final String FUNC_GETNODESET = "getNodeSet"; + + protected static final HashMap _addresses; + + static { + _addresses = new HashMap(); + } + + protected TorusLookup(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + public RemoteFunctionCall, List, List, List>> getNodeSet(String _verifier, byte[] hashedVerifierId) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETNODESET, + Arrays.asList(new org.web3j.abi.datatypes.Utf8String(_verifier), + new org.web3j.abi.datatypes.generated.Bytes32(hashedVerifierId)), + Arrays.asList(new TypeReference() { + }, new TypeReference>() { + }, new TypeReference>() { + }, new TypeReference>() { + }, new TypeReference>() { + })); + return new RemoteFunctionCall, List, List, List>>(function, + new Callable, List, List, List>>() { + @Override + public Tuple5, List, List, List> call() throws Exception { + List results = executeCallMultipleValueReturn(function); + return new Tuple5, List, List, List>( + (BigInteger) results.get(0).getValue(), + convertToNative((List) results.get(1).getValue()), + convertToNative((List) results.get(2).getValue()), + convertToNative((List) results.get(3).getValue()), + convertToNative((List) results.get(4).getValue())); + } + }); + } +} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/EthereumNetwork.java b/src/main/java/org/torusresearch/fetchnodedetails/types/EthereumNetwork.java index 858885d..0a8bc5a 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/EthereumNetwork.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/EthereumNetwork.java @@ -1,6 +1,17 @@ package org.torusresearch.fetchnodedetails.types; public enum EthereumNetwork { - MAINNET, - ROPSTEN, + MAINNET("mainnet"), + ROPSTEN("ropsten"), + POLYGON("polygon-mainnet"); + + private final String val; + + EthereumNetwork(String s) { + this.val = s; + } + + public String toString() { + return val; + } } diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java b/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java index b311679..1f49b51 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java @@ -2,6 +2,7 @@ import java.math.BigInteger; import java.util.Arrays; +import java.util.Objects; public class NodeDetails { private String currentEpoch; @@ -82,4 +83,23 @@ public String toString() { ", updated=" + updated + '}'; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof NodeDetails)) return false; + NodeDetails that = (NodeDetails) o; + return Objects.equals(getCurrentEpoch(), that.getCurrentEpoch()) && Objects.equals(getNodeListAddress(), that.getNodeListAddress()) + && Arrays.equals(getTorusNodeEndpoints(), that.getTorusNodeEndpoints()) && Arrays.equals(getTorusIndexes(), that.getTorusIndexes()) && + Arrays.equals(getTorusNodePub(), that.getTorusNodePub()) && Objects.equals(getUpdated(), that.getUpdated()); + } + + @Override + public int hashCode() { + int result = Objects.hash(getCurrentEpoch(), getNodeListAddress(), getUpdated()); + result = 31 * result + Arrays.hashCode(getTorusNodeEndpoints()); + result = 31 * result + Arrays.hashCode(getTorusIndexes()); + result = 31 * result + Arrays.hashCode(getTorusNodePub()); + return result; + } } diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeInfo.java b/src/main/java/org/torusresearch/fetchnodedetails/types/NodeInfo.java index cb44f03..fc49564 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeInfo.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/NodeInfo.java @@ -2,33 +2,20 @@ public final class NodeInfo { private final String declaredIp; - private final String position; private final String pubKx; private final String pubKy; - private final String tmP2PListenAddress; - private final String p2pListenAddress; - public NodeInfo(String _declaredIp, String _position, String _pubKx, String _pubKy, String _tmP2PListenAddress, String _p2pListenAddress) { + public NodeInfo(String _declaredIp, String _pubKx, String _pubKy) { this.declaredIp = _declaredIp; - this.position = _position; this.pubKx = _pubKx; this.pubKy = _pubKy; - this.tmP2PListenAddress = _tmP2PListenAddress; - this.p2pListenAddress = _p2pListenAddress; } + public String getDeclaredIp() { return declaredIp; } - public String getP2pListenAddress() { - return p2pListenAddress; - } - - public String getPosition() { - return position; - } - public String getPubKx() { return pubKx; } @@ -37,19 +24,13 @@ public String getPubKy() { return pubKy; } - public String getTmP2PListenAddress() { - return tmP2PListenAddress; - } @Override public String toString() { return "NodeInfo{" + - "declaredIp='" + declaredIp + '\'' + - ", position='" + position + '\'' + + ", position='" + declaredIp + '\'' + ", pubKx='" + pubKx + '\'' + ", pubKy='" + pubKy + '\'' + - ", tmP2PListenAddress='" + tmP2PListenAddress + '\'' + - ", p2pListenAddress='" + p2pListenAddress + '\'' + '}'; } } diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNodePub.java b/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNodePub.java index c623cdb..639fc22 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNodePub.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNodePub.java @@ -1,5 +1,7 @@ package org.torusresearch.fetchnodedetails.types; +import java.util.Objects; + public class TorusNodePub { private final String X; private final String Y; @@ -24,4 +26,17 @@ public String toString() { ", Y='" + Y + '\'' + '}'; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof TorusNodePub)) return false; + TorusNodePub that = (TorusNodePub) o; + return Objects.equals(getX(), that.getX()) && Objects.equals(getY(), that.getY()); + } + + @Override + public int hashCode() { + return Objects.hash(getX(), getY()); + } } diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java b/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java index b9302e4..a020e9e 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java @@ -1,59 +1,42 @@ package org.torusresearch.fetchnodedetailstest; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.torusresearch.fetchnodedetails.FetchNodeDetails; -import org.torusresearch.fetchnodedetails.types.EpochInfo; +import org.torusresearch.fetchnodedetails.types.EthereumNetwork; import org.torusresearch.fetchnodedetails.types.NodeDetails; -import org.torusresearch.fetchnodedetails.types.NodeInfo; +import org.torusresearch.fetchnodedetailstest.config.Config; -import java.math.BigInteger; +import java.io.UnsupportedEncodingException; import java.util.concurrent.ExecutionException; import static org.junit.jupiter.api.Assertions.assertEquals; class FetchNodeDetailsTest { - private static final String EPOCH_18_INFO = "EpochInfo{id='19', n='9', k='5', t='2', nodeList=[0x58df12150e765cfa08d3d7027ffefe3ebc6a977d, 0x3e7802ac3428d29d942abe0d967481b36f84023f, 0x70eaf5a4b5c1e4585283976eef0c7ef0beb7676e, 0xc1be81db2ec118bb8ca6d0775bbf440a0a1a8312, 0x6651a20286e600af76d985a4d155db8c31f2c1aa, 0x3609c974fe0251fee429da927676163016ab12aa, 0x564cca5c23a40a9b322d567e5458a1edf3f1457f, 0x65f8296b232afefd295ff4fd854b67f26de15e33, 0xf4cbfad568777ddd64b860b6886241c6b25d2491], prevEpoch='18', nextEpoch='20'}"; - private static final String FIRST_NODE_INFO = "NodeInfo{declaredIp='torus-19.torusnode.com:443', position='1', pubKx='bbe83c64177c3775550e6ba6ac2bc059f6847d644c9e4894e42c60d7974d8c2b', pubKy='82b49a7caf70def38cdad2740af45c1e4f969650105c5019a29bb18b21a9acb5', tmP2PListenAddress='', p2pListenAddress=''}"; - private static final String NODE_DETAILS = "NodeDetails{currentEpoch='19', nodeListAddress='0x638646503746d5456209e33a2ff5e3226d698bea', torusNodeEndpoints=[https://torus-19.torusnode.com/jrpc, https://torus-node.ens.domains/jrpc, https://torus-node.matic.network/jrpc, https://torus.zilliqa.network/jrpc, https://torus-mainnet.cosmos.network/jrpc, https://torus2.etherscan.com/jrpc, https://torus-node-v2.skalelabs.com/jrpc, https://torus-node.binancex.dev/jrpc, https://torusnode.ont.io/jrpc], torusIndexes=[1, 2, 3, 4, 5, 6, 7, 8, 9], torusNodePub=[TorusNodePub{X='bbe83c64177c3775550e6ba6ac2bc059f6847d644c9e4894e42c60d7974d8c2b', Y='82b49a7caf70def38cdad2740af45c1e4f969650105c5019a29bb18b21a9acb5'}, TorusNodePub{X='c208cac4ef9a47d386097a9c915b28e9cb89213abee8d26a17198ee261201b0d', Y='c7db2fe4631109f40833de9dc78d07e35706549ee48fa557b33e4e75e1047873'}, TorusNodePub{X='ca1766bb426d4ca5582818a0c5439d560ea64f5baa060793ab29dd3d0ceacfe', Y='d46c1d08c40e1306e1bca328c2287b8268166b11a1ba4b8442ea2ad0c5e32152'}, TorusNodePub{X='c3934dd2f6f4b3d2e1e398cc501e143c1e1a381b52feb6d1525af34d16253768', Y='71f5141a5035799099f5ea3e241e66946bc55dc857ac3bd7d6fcdb8dcd3eeeef'}, TorusNodePub{X='22e66f1929631d00bf026227581597f085fd94fd952fc0dca9f0833398b5c064', Y='6088b3912e10a1e9d50355a609c10db7d188f16a2e2fd7357e51bf4f6a74f0a1'}, TorusNodePub{X='9dc9fa410f3ce9eb70df70cdea00a49f2c4cc7a31c08c0dab5f863ed35ff5139', Y='627a291cb87a75c61da3f65d6818e1e05e360217179817ed27e8c73bca7ec122'}, TorusNodePub{X='118b9fc07e97b096d899b9f6658463ce6a8caa64038e37fc969df4e6023dd8c6', Y='baf9fa4e51770f4796ea165dd03a769b8606681a38954a0a92c4cbffd6609ce9'}, TorusNodePub{X='8a6d8b925da15a273dec3d8f8395ec35cd6878f274b2b180e4e106999db64043', Y='96f67f870c157743da0b1eb84d89bf30500d74dc84c11f501ee1cb013acc8c46'}, TorusNodePub{X='39cecb62e863729f572f7dfc46c24867981bf04bb405fed0df39e33984bfade5', Y='61c2364434012e68a2be2e9952805037e52629d7762fafc8e10e9fb5bad8f790'}], updated=true}"; - FetchNodeDetails fetchNodeDetails; - BigInteger currentEpoch = new BigInteger("19"); - - @BeforeEach - public void setup() { - System.out.println("Setup Starting"); - fetchNodeDetails = new FetchNodeDetails(); - } - @DisplayName("Gets Current Epoch Correctly") + @DisplayName("Gets the Node details for Mainnet") @Test - public void shouldGetCurrentEpoch() throws ExecutionException, InterruptedException { - BigInteger epoch = this.fetchNodeDetails.getCurrentEpoch().get(); - assertEquals(this.currentEpoch, epoch); - } - - @DisplayName("Gets the Epoch Info") - @Test - public void shouldGetEpochInfo() throws ExecutionException, InterruptedException { - EpochInfo epochInfo = this.fetchNodeDetails.getEpochInfo(this.currentEpoch).get(); - assertEquals(EPOCH_18_INFO, epochInfo.toString()); + public void shouldGetNodeDetailsMainnet() throws ExecutionException, InterruptedException, UnsupportedEncodingException { + fetchNodeDetails = new FetchNodeDetails(); + NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); + assertEquals(Config.MAINNET, nodeDetails); } - @DisplayName("Gets the First Node Endpoint") + @DisplayName("Gets the Node details for Ropsten") @Test - public void shouldGetNodeEndpoint() throws ExecutionException, InterruptedException { - EpochInfo epochInfo = this.fetchNodeDetails.getEpochInfo(this.currentEpoch).get(); - NodeInfo nodeInfo = this.fetchNodeDetails.getNodeEndpoint(epochInfo.getNodeList()[0]).get(); - assertEquals(FIRST_NODE_INFO, nodeInfo.toString()); + public void shouldGetNodeDetailsRopsten() throws ExecutionException, InterruptedException, UnsupportedEncodingException { + fetchNodeDetails = new FetchNodeDetails(EthereumNetwork.ROPSTEN, FetchNodeDetails.PROXY_ADDRESS_ROPSTEN); + NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); + assertEquals(Config.ROPSTEN, nodeDetails); } - @DisplayName("Gets the Node details") + @DisplayName("Gets the Node details for Polygon") @Test - public void shouldGetNodeDetails() throws ExecutionException, InterruptedException { - NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails().get(); - assertEquals(NODE_DETAILS, nodeDetails.toString()); + public void shouldGetNodeDetailsPolygon() throws ExecutionException, InterruptedException, UnsupportedEncodingException { + fetchNodeDetails = new FetchNodeDetails(EthereumNetwork.POLYGON, FetchNodeDetails.PROXY_ADDRESS_POLYGON); + NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); + assertEquals(Config.POLYGON, nodeDetails); } } \ No newline at end of file diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/Config.java b/src/test/java/org/torusresearch/fetchnodedetailstest/config/Config.java new file mode 100644 index 0000000..2143e67 --- /dev/null +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/Config.java @@ -0,0 +1,51 @@ +package org.torusresearch.fetchnodedetailstest.config; + +import com.google.gson.Gson; +import org.torusresearch.fetchnodedetails.types.NodeDetails; + +import java.io.File; +import java.io.FileReader; +import java.io.Reader; + +public class Config { + public static NodeDetails MAINNET; + public static NodeDetails ROPSTEN; + public static NodeDetails POLYGON; + + static { + try { + String basePath = "src/test/java/org/torusresearch/fetchnodedetailstest/config/"; + MAINNET = getNodeDetailsFromFile(basePath + "mainnet.json"); + ROPSTEN = getNodeDetailsFromFile(basePath + "ropsten.json"); + POLYGON = getNodeDetailsFromFile(basePath + "polygon.json"); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + static NodeDetails getNodeDetailsFromFile(String path) { + try { + + // create Gson instance + Gson gson = new Gson(); + + // create a reader + Reader reader = new FileReader(new File(path)); + + // convert JSON file to map + NodeDetails details = gson.fromJson(reader, NodeDetails.class); + + System.out.println(details.toString()); + + // close reader + reader.close(); + + return details; + + } catch (Exception ex) { + ex.printStackTrace(); + } + + return null; + } +} diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json new file mode 100644 index 0000000..5de691b --- /dev/null +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json @@ -0,0 +1,55 @@ +{ + "currentEpoch": "19", + "nodeListAddress": "0xf20336e16B5182637f09821c27BDe29b0AFcfe80", + "torusNodeEndpoints": [ + "https://torus-19.torusnode.com/jrpc", + "https://torus-node.ens.domains/jrpc", + "https://torus-node.matic.network/jrpc", + "https://torus.zilliqa.network/jrpc", + "https://torus-mainnet.cosmos.network/jrpc", + "https://torus2.etherscan.com/jrpc", + "https://torus-node-v2.skalelabs.com/jrpc", + "https://torus-node.binancex.dev/jrpc", + "https://torusnode.ont.io/jrpc" + ], + "torusNodePub": [ + { + "X": "bbe83c64177c3775550e6ba6ac2bc059f6847d644c9e4894e42c60d7974d8c2b", + "Y": "82b49a7caf70def38cdad2740af45c1e4f969650105c5019a29bb18b21a9acb5" + }, + { + "X": "c208cac4ef9a47d386097a9c915b28e9cb89213abee8d26a17198ee261201b0d", + "Y": "c7db2fe4631109f40833de9dc78d07e35706549ee48fa557b33e4e75e1047873" + }, + { + "X": "ca1766bb426d4ca5582818a0c5439d560ea64f5baa060793ab29dd3d0ceacfe", + "Y": "d46c1d08c40e1306e1bca328c2287b8268166b11a1ba4b8442ea2ad0c5e32152" + }, + { + "X": "c3934dd2f6f4b3d2e1e398cc501e143c1e1a381b52feb6d1525af34d16253768", + "Y": "71f5141a5035799099f5ea3e241e66946bc55dc857ac3bd7d6fcdb8dcd3eeeef" + }, + { + "X": "22e66f1929631d00bf026227581597f085fd94fd952fc0dca9f0833398b5c064", + "Y": "6088b3912e10a1e9d50355a609c10db7d188f16a2e2fd7357e51bf4f6a74f0a1" + }, + { + "X": "9dc9fa410f3ce9eb70df70cdea00a49f2c4cc7a31c08c0dab5f863ed35ff5139", + "Y": "627a291cb87a75c61da3f65d6818e1e05e360217179817ed27e8c73bca7ec122" + }, + { + "X": "118b9fc07e97b096d899b9f6658463ce6a8caa64038e37fc969df4e6023dd8c6", + "Y": "baf9fa4e51770f4796ea165dd03a769b8606681a38954a0a92c4cbffd6609ce9" + }, + { + "X": "8a6d8b925da15a273dec3d8f8395ec35cd6878f274b2b180e4e106999db64043", + "Y": "96f67f870c157743da0b1eb84d89bf30500d74dc84c11f501ee1cb013acc8c46" + }, + { + "X": "39cecb62e863729f572f7dfc46c24867981bf04bb405fed0df39e33984bfade5", + "Y": "61c2364434012e68a2be2e9952805037e52629d7762fafc8e10e9fb5bad8f790" + } + ], + "torusIndexes": [1, 2, 3, 4, 5, 6, 7, 8, 9], + "updated": true +} diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/polygon.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/polygon.json new file mode 100644 index 0000000..3c68dd0 --- /dev/null +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/polygon.json @@ -0,0 +1,35 @@ +{ + "currentEpoch": "1", + "nodeListAddress": "0x9f072ba19b3370e512aa1b4bfcdaf97283168005", + "torusNodeEndpoints": [ + "https://node-1.torus-cluster-1.com/jrpc", + "https://node-2.torus-cluster-1.com/jrpc", + "https://node-3.torus-cluster-1.com/jrpc", + "https://node-4.torus-cluster-1.com/jrpc", + "https://node-5.torus-cluster-1.com/jrpc" + ], + "torusNodePub": [ + { + "X": "805f81fd2fdc0d207b5a8b6643cd8f885bb761942f31fd6e138fcf8871d44cff", + "Y": "10bd6ec1675147256fbc4094c05191975a175d49ae8716ee83409929e6a302e7" + }, + { + "X": "28394dafddfa20cb9ef5c9c26c31415c613565c3bbd9a82af8bfc88376e65353", + "Y": "5507f59c00d585fbed0ca08773a24faea4724e2b68be3da1e7281d5968251f1b" + }, + { + "X": "4a190019eea47a45e6edb6a871a850b67fb72dcd9e255a07156c31dbf3a40035", + "Y": "565aa310a9e736f03d0693df4723880cafe25edba46c9ee88ace6453044d5ae9" + }, + { + "X": "8a0f03b3ad07b1bd6068bb0aad3fe9feea5181643b04d292c65769c96b5990f8", + "Y": "4b34b66a7d91ff85f330a3c012a7bf45f5509be57bdf61885a906214d818a695" + }, + { + "X": "dcf3b3c5a9e43533b875862b4dcfd5614535e7838d9a916f3f735e28e345cd9d", + "Y": "856d980747c1d171972b2ea34831670763d4b493ea7537b295b4be4c25b012fc" + } + ], + "torusIndexes": [1, 2, 3, 4, 5], + "updated": true +} diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/ropsten.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/ropsten.json new file mode 100644 index 0000000..e6db972 --- /dev/null +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/ropsten.json @@ -0,0 +1,35 @@ +{ + "currentEpoch": "15", + "nodeListAddress": "0x6258c9d6c12ed3edda59a1a6527e469517744aa7", + "torusNodeEndpoints": [ + "https://teal-15-1.torusnode.com/jrpc", + "https://teal-15-3.torusnode.com/jrpc", + "https://teal-15-4.torusnode.com/jrpc", + "https://teal-15-5.torusnode.com/jrpc", + "https://teal-15-2.torusnode.com/jrpc" + ], + "torusNodePub": [ + { + "X": "1363aad8868cacd7f8946c590325cd463106fb3731f08811ab4302d2deae35c3", + "Y": "d77eebe5cdf466b475ec892d5b4cffbe0c1670525debbd97eee6dae2f87a7cbe" + }, + { + "X": "7c8cc521c48690f016bea593f67f88ad24f447dd6c31bbab541e59e207bf029d", + "Y": "b359f0a82608db2e06b953b36d0c9a473a00458117ca32a5b0f4563a7d539636" + }, + { + "X": "8a86543ca17df5687719e2549caa024cf17fe0361e119e741eaee668f8dd0a6f", + "Y": "9cdb254ff915a76950d6d13d78ef054d5d0dc34e2908c00bb009a6e4da701891" + }, + { + "X": "25a98d9ae006aed1d77e81d58be8f67193d13d01a9888e2923841894f4b0bf9c", + "Y": "f63d40df480dacf68922004ed36dbab9e2969181b047730a5ce0797fb6958249" + }, + { + "X": "d908f41f8e06324a8a7abcf702adb6a273ce3ae63d86a3d22723e1bbf1438c9a", + "Y": "f977530b3ec0e525438c72d1e768380cbc5fb3b38a760ee925053b2e169428ce" + } + ], + "torusIndexes": [1, 2, 3, 4, 5], + "updated": true +}