diff --git a/build.gradle b/build.gradle index 5c8c446..6109576 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,8 @@ repositories { } dependencies { - implementation 'org.web3j:core:4.8.8-android' + implementation 'com.squareup.okhttp3:okhttp:4.9.3' + implementation 'com.google.code.gson:gson:2.9.0' 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' diff --git a/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java b/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java index cd3488d..efde8a8 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/FetchNodeDetails.java @@ -1,106 +1,67 @@ package org.torusresearch.fetchnodedetails; +import com.google.gson.GsonBuilder; +import org.torusresearch.fetchnodedetails.types.APIUtils; +import org.torusresearch.fetchnodedetails.types.FNDResponse; import org.torusresearch.fetchnodedetails.types.NodeDetails; -import org.torusresearch.fetchnodedetails.types.NodeInfo; import org.torusresearch.fetchnodedetails.types.TorusNetwork; -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.tx.gas.DefaultGasProvider; +import org.torusresearch.fetchnodedetails.types.Utils; -import java.math.BigInteger; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; +import java.util.Arrays; +import java.util.List; import java.util.concurrent.CompletableFuture; public class FetchNodeDetails { - public static String PROXY_ADDRESS_MAINNET = "0xf20336e16B5182637f09821c27BDe29b0AFcfe80"; - public static String PROXY_ADDRESS_TESTNET = "0xd084604e5FA387FbC2Da8bAab07fDD6aDED4614A"; - public static String PROXY_ADDRESS_CYAN = "0x9f072ba19b3370e512aa1b4bfcdaf97283168005"; - public static String PROXY_ADDRESS_AQUA = "0x29Dea82a0509153b91040ee13cDBba0f03efb625"; - public static String PROXY_ADDRESS_CELESTE = "0x6Bffb4e89453069E7487f0fa5c9f4a2D771cce6c"; + private List multi_cluster_networks = Arrays.asList("celeste"); - - public static HashMap NETWORK_MAP = new HashMap() { - { - put(TorusNetwork.MAINNET, "mainnet"); - put(TorusNetwork.TESTNET, "goerli"); - put(TorusNetwork.CYAN, "polygon-mainnet"); - put(TorusNetwork.AQUA, "polygon-mainnet"); - put(TorusNetwork.CELESTE, "polygon-mainnet"); - } - }; - - 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 TorusLookup torusLookup; + private TorusNetwork torusNetwork = TorusNetwork.SAPPHIRE_MAINNET; public FetchNodeDetails() { - this(TorusNetwork.MAINNET, "0xf20336e16B5182637f09821c27BDe29b0AFcfe80"); - } - - public FetchNodeDetails(TorusNetwork network, String proxyAddress) { - this.proxyAddress = proxyAddress; - this.providerUrl = "https://" + NETWORK_MAP.get(network) + ".infura.io/v3/" + "b8cdb0e4cff24599a286bf8e87ff1c96"; - this.setupWeb3(); + this(TorusNetwork.SAPPHIRE_MAINNET); } - public FetchNodeDetails(String providerUrl, String proxyAddress) { - this.proxyAddress = proxyAddress; - this.providerUrl = providerUrl; - this.setupWeb3(); + public FetchNodeDetails(TorusNetwork network) { + this.torusNetwork = network; } 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_TESTNET))) + if (this.nodeDetails.getUpdated() && !(multi_cluster_networks.contains(this.torusNetwork.name()))) 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()]; - - 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", "")); - 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); - } - }); + CompletableFuture cf = new CompletableFuture<>(); + try { + String fndServerEndpoint = "https://fnd.tor.us/node-details"; + String url = fndServerEndpoint + "?network=" + this.torusNetwork + "&verifier=" + verifier + "&verifierId=" + verifierId; + CompletableFuture response = APIUtils.get(url); + FNDResponse fndResponse = + new GsonBuilder().disableHtmlEscaping().create().fromJson(response.get(), FNDResponse.class); + this.setNodeDetails(fndResponse.getNodeDetails(), true); + cf.complete(this.nodeDetails); + return cf; + } catch (Exception ex) { + ex.printStackTrace(); + } + NodeDetails nodeDetails = Utils.fetchLocalConfig(this.torusNetwork); + if (nodeDetails == null) cf.completeExceptionally(new Exception("Failed to fetch node details")); + else { + this.setNodeDetails(nodeDetails, false); + cf.complete(this.nodeDetails); + } return cf; } - private void setupWeb3() { - Web3j web3j = Web3j.build(new HttpService(this.providerUrl)); - Credentials credentials = Credentials.create("0x5bbbef76458bf30511c9ee6ed56783644eb339258d02656755c68098c4809130"); - this.torusLookup = new TorusLookup(this.proxyAddress, web3j, credentials, new DefaultGasProvider()); + private void setNodeDetails(NodeDetails nodeDetails, boolean updated) { + this.nodeDetails.setTorusNodeEndpoints(nodeDetails.getTorusNodeEndpoints()); + this.nodeDetails.setTorusNodePub(nodeDetails.getTorusNodePub()); + this.nodeDetails.setCurrentEpoch(nodeDetails.getCurrentEpoch()); + this.nodeDetails.setUpdated(updated); + this.nodeDetails.setTorusIndexes(nodeDetails.getTorusIndexes()); + this.nodeDetails.setTorusNodeRSSEndpoints(nodeDetails.getTorusNodeRSSEndpoints()); + this.nodeDetails.setTorusNodeSSSEndpoints(nodeDetails.getTorusNodeSSSEndpoints()); + this.nodeDetails.setTorusNodeTSSEndpoints(nodeDetails.getTorusNodeTSSEndpoints()); } } diff --git a/src/main/java/org/torusresearch/fetchnodedetails/TorusLookup.java b/src/main/java/org/torusresearch/fetchnodedetails/TorusLookup.java deleted file mode 100644 index 9532663..0000000 --- a/src/main/java/org/torusresearch/fetchnodedetails/TorusLookup.java +++ /dev/null @@ -1,70 +0,0 @@ -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/APIUtils.java b/src/main/java/org/torusresearch/fetchnodedetails/types/APIUtils.java new file mode 100644 index 0000000..bfd009b --- /dev/null +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/APIUtils.java @@ -0,0 +1,62 @@ +package org.torusresearch.fetchnodedetails.types; + +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.internal.http2.Header; + +public class APIUtils { + public static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); + private static final OkHttpClient client = new OkHttpClient().newBuilder().writeTimeout(10, TimeUnit.SECONDS).build(); + + private APIUtils() { + } + + public static Callback toCallback(CompletableFuture future) { + return new Callback() { + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(e); + } + + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) { + try { + future.complete(Objects.requireNonNull(response.body()).string()); + } catch (IOException e) { + e.printStackTrace(); + future.completeExceptionally(e); + } + } + }; + } + + public static CompletableFuture get(String url) { + return _get(url, new Header[0]); + } + + public static CompletableFuture get(String url, Header[] headers) { + return _get(url, headers); + } + + private static CompletableFuture _get(String url, Header[] headers) { + Request.Builder requestBuilder = new Request.Builder().url(url); + for (Header header : headers) { + requestBuilder.addHeader(header.name.utf8(), header.value.utf8()); + } + Request request = requestBuilder.build(); + CompletableFuture future = new CompletableFuture<>(); + client.newCall(request).enqueue(toCallback(future)); + return future; + } +} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/EpochInfo.java b/src/main/java/org/torusresearch/fetchnodedetails/types/EpochInfo.java deleted file mode 100644 index 096de19..0000000 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/EpochInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.torusresearch.fetchnodedetails.types; - -import java.util.Arrays; - -public final class EpochInfo { - private final String id; - private final String n; - private final String k; - private final String t; - private final String[] nodeList; - private final String prevEpoch; - private final String nextEpoch; - - public EpochInfo(String _id, String _n, String _k, String _t, String[] _nodeList, String _prevEpoch, String _nextEpoch) { - this.id = _id; - this.n = _n; - this.k = _k; - this.t = _t; - this.nodeList = _nodeList.clone(); - this.prevEpoch = _prevEpoch; - this.nextEpoch = _nextEpoch; - } - - public String getId() { - return id; - } - - public String getK() { - return k; - } - - public String getN() { - return n; - } - - public String getNextEpoch() { - return nextEpoch; - } - - public String getPrevEpoch() { - return prevEpoch; - } - - public String getT() { - return t; - } - - public String[] getNodeList() { - return nodeList.clone(); - } - - @Override - public String toString() { - return "EpochInfo{" + - "id='" + id + '\'' + - ", n='" + n + '\'' + - ", k='" + k + '\'' + - ", t='" + t + '\'' + - ", nodeList=" + Arrays.toString(nodeList) + - ", prevEpoch='" + prevEpoch + '\'' + - ", nextEpoch='" + nextEpoch + '\'' + - '}'; - } -} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/FNDResponse.java b/src/main/java/org/torusresearch/fetchnodedetails/types/FNDResponse.java new file mode 100644 index 0000000..ce22c49 --- /dev/null +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/FNDResponse.java @@ -0,0 +1,27 @@ +package org.torusresearch.fetchnodedetails.types; + +public class FNDResponse { + private NodeDetails nodeDetails; + private boolean success; + + public FNDResponse(NodeDetails nodeDetails, boolean success) { + this.nodeDetails = nodeDetails; + this.success = success; + } + + public NodeDetails getNodeDetails() { + return nodeDetails; + } + + public void setNodeDetails(NodeDetails nodeDetails) { + this.nodeDetails = nodeDetails; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } +} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/LegacyNetworkMigrationInfo.java b/src/main/java/org/torusresearch/fetchnodedetails/types/LegacyNetworkMigrationInfo.java new file mode 100644 index 0000000..d5418b5 --- /dev/null +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/LegacyNetworkMigrationInfo.java @@ -0,0 +1,27 @@ +package org.torusresearch.fetchnodedetails.types; + +public class LegacyNetworkMigrationInfo { + + private Boolean migrationCompleted = false; + private String networkIdentifier; + private TorusNetwork networkMigratedTo; + + + public LegacyNetworkMigrationInfo(Boolean migrationCompleted, String networkIdentifier, TorusNetwork networkMigratedTo) { + this.migrationCompleted = migrationCompleted; + this.networkIdentifier = networkIdentifier; + this.networkMigratedTo = networkMigratedTo; + } + + public Boolean getMigrationCompleted() { + return migrationCompleted; + } + + public String getNetworkIdentifier() { + return networkIdentifier; + } + + public TorusNetwork getNetworkMigratedTo() { + return networkMigratedTo; + } +} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java b/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java index 1f49b51..f19e10e 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/NodeDetails.java @@ -1,13 +1,16 @@ package org.torusresearch.fetchnodedetails.types; +import java.io.Serializable; import java.math.BigInteger; import java.util.Arrays; import java.util.Objects; -public class NodeDetails { +public class NodeDetails implements Serializable { private String currentEpoch; - private String nodeListAddress; private String[] torusNodeEndpoints; + private String[] torusNodeSSSEndpoints; + private String[] torusNodeRSSEndpoints; + private String[] torusNodeTSSEndpoints; private BigInteger[] torusIndexes; private TorusNodePub[] torusNodePub; private Boolean updated = false; @@ -15,10 +18,14 @@ public class NodeDetails { public NodeDetails() { } - public NodeDetails(String _currentEpoch, String _nodeListAddress, String[] _torusNodeEndpoints, BigInteger[] _torusIndexes, TorusNodePub[] _torusNodePub, Boolean _updated) { + public NodeDetails(String _currentEpoch, String[] _torusNodeEndpoints, + String[] _torusNodeSSSEndpoints, String[] _torusNodeRSSEndpoints, String[] _torusNodeTSSEndpoints, + BigInteger[] _torusIndexes, TorusNodePub[] _torusNodePub, Boolean _updated) { this.currentEpoch = _currentEpoch; - this.nodeListAddress = _nodeListAddress; this.torusNodeEndpoints = _torusNodeEndpoints.clone(); + this.torusNodeSSSEndpoints = _torusNodeSSSEndpoints.clone(); + this.torusNodeRSSEndpoints = _torusNodeRSSEndpoints.clone(); + this.torusNodeTSSEndpoints = _torusNodeTSSEndpoints.clone(); this.torusIndexes = _torusIndexes.clone(); this.torusNodePub = _torusNodePub.clone(); this.updated = _updated; @@ -48,12 +55,28 @@ public void setCurrentEpoch(String currentEpoch) { this.currentEpoch = currentEpoch; } - public String getNodeListAddress() { - return nodeListAddress; + public String[] getTorusNodeSSSEndpoints() { + return torusNodeSSSEndpoints; } - public void setNodeListAddress(String nodeListAddress) { - this.nodeListAddress = nodeListAddress; + public void setTorusNodeSSSEndpoints(String[] torusNodeSSSEndpoints) { + this.torusNodeSSSEndpoints = torusNodeSSSEndpoints; + } + + public String[] getTorusNodeRSSEndpoints() { + return torusNodeRSSEndpoints; + } + + public void setTorusNodeRSSEndpoints(String[] torusNodeRSSEndpoints) { + this.torusNodeRSSEndpoints = torusNodeRSSEndpoints; + } + + public String[] getTorusNodeTSSEndpoints() { + return torusNodeTSSEndpoints; + } + + public void setTorusNodeTSSEndpoints(String[] torusNodeTSSEndpoints) { + this.torusNodeTSSEndpoints = torusNodeTSSEndpoints; } public String[] getTorusNodeEndpoints() { @@ -76,8 +99,10 @@ public void setTorusNodePub(TorusNodePub[] torusNodePub) { public String toString() { return "NodeDetails{" + "currentEpoch='" + currentEpoch + '\'' + - ", nodeListAddress='" + nodeListAddress + '\'' + ", torusNodeEndpoints=" + Arrays.toString(torusNodeEndpoints) + + ", torusNodeSSSEndpoints=" + Arrays.toString(torusNodeSSSEndpoints) + + ", torusNodeRSSEndpoints=" + Arrays.toString(torusNodeRSSEndpoints) + + ", torusNodeTSSEndpoints=" + Arrays.toString(torusNodeTSSEndpoints) + ", torusIndexes=" + Arrays.toString(torusIndexes) + ", torusNodePub=" + Arrays.toString(torusNodePub) + ", updated=" + updated + @@ -89,15 +114,21 @@ 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()) && + return Objects.equals(getCurrentEpoch(), that.getCurrentEpoch()) && Arrays.equals(getTorusNodeEndpoints(), that.getTorusNodeEndpoints()) + && Arrays.equals(getTorusNodeSSSEndpoints(), that.getTorusNodeSSSEndpoints()) + && Arrays.equals(getTorusNodeRSSEndpoints(), that.getTorusNodeRSSEndpoints()) + && Arrays.equals(getTorusNodeTSSEndpoints(), that.getTorusNodeTSSEndpoints()) + && 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()); + int result = Objects.hash(getCurrentEpoch(), getUpdated()); result = 31 * result + Arrays.hashCode(getTorusNodeEndpoints()); + result = 31 * result + Arrays.hashCode(getTorusNodeSSSEndpoints()); + result = 31 * result + Arrays.hashCode(getTorusNodeRSSEndpoints()); + result = 31 * result + Arrays.hashCode(getTorusNodeTSSEndpoints()); 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 deleted file mode 100644 index fc49564..0000000 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/NodeInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.torusresearch.fetchnodedetails.types; - -public final class NodeInfo { - private final String declaredIp; - private final String pubKx; - private final String pubKy; - - public NodeInfo(String _declaredIp, String _pubKx, String _pubKy) { - this.declaredIp = _declaredIp; - this.pubKx = _pubKx; - this.pubKy = _pubKy; - } - - - public String getDeclaredIp() { - return declaredIp; - } - - public String getPubKx() { - return pubKx; - } - - public String getPubKy() { - return pubKy; - } - - - @Override - public String toString() { - return "NodeInfo{" + - ", position='" + declaredIp + '\'' + - ", pubKx='" + pubKx + '\'' + - ", pubKy='" + pubKy + '\'' + - '}'; - } -} diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNetwork.java b/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNetwork.java index d400243..cb783e1 100644 --- a/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNetwork.java +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/TorusNetwork.java @@ -5,8 +5,9 @@ public enum TorusNetwork { TESTNET("testnet"), CYAN("cyan"), AQUA("aqua"), - CELESTE("celeste"); - + CELESTE("celeste"), + SAPPHIRE_DEVNET("sapphire_devnet"), + SAPPHIRE_MAINNET("sapphire_mainnet"); private final String val; diff --git a/src/main/java/org/torusresearch/fetchnodedetails/types/Utils.java b/src/main/java/org/torusresearch/fetchnodedetails/types/Utils.java new file mode 100644 index 0000000..0ef21d1 --- /dev/null +++ b/src/main/java/org/torusresearch/fetchnodedetails/types/Utils.java @@ -0,0 +1,132 @@ +package org.torusresearch.fetchnodedetails.types; + +import java.math.BigInteger; +import java.util.HashMap; +import java.util.Map; + +public class Utils { + + public static HashMap LEGACY_NETWORKS_ROUTE_MAP = new HashMap() { + { + put(TorusNetwork.AQUA.toString(), new LegacyNetworkMigrationInfo(true, "aqua", TorusNetwork.SAPPHIRE_MAINNET)); + put(TorusNetwork.CELESTE.toString(), new LegacyNetworkMigrationInfo(false, "celeste", TorusNetwork.SAPPHIRE_MAINNET)); + put(TorusNetwork.CYAN.toString(), new LegacyNetworkMigrationInfo(true, "cyan", TorusNetwork.SAPPHIRE_MAINNET)); + put(TorusNetwork.MAINNET.toString(), new LegacyNetworkMigrationInfo(true, "mainnet", TorusNetwork.SAPPHIRE_MAINNET)); + put(TorusNetwork.TESTNET.toString(), new LegacyNetworkMigrationInfo(true, "teal", TorusNetwork.SAPPHIRE_DEVNET)); + } + }; + + public static NodeDetails NODE_DETAILS_TESTNET = new NodeDetails("1", new String[]{"https://sapphire-dev-2-1.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-2.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-3.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-4.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-5.authnetwork.dev/sss/teal/jrpc",}, + new String[]{"https://sapphire-dev-2-1.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-2.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-3.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-4.authnetwork.dev/sss/teal/jrpc", "https://sapphire-dev-2-5.authnetwork.dev/sss/teal/jrpc"}, + new String[]{"https://sapphire-dev-2-1.authnetwork.dev/rss/teal", "https://sapphire-dev-2-2.authnetwork.dev/rss/teal", "https://sapphire-dev-2-3.authnetwork.dev/rss/teal", "https://sapphire-dev-2-4.authnetwork.dev/rss/teal", "https://sapphire-dev-2-5.authnetwork.dev/rss/teal"}, + new String[]{"https://sapphire-dev-2-1.authnetwork.dev/tss/teal", "https://sapphire-dev-2-2.authnetwork.dev/tss/teal", "https://sapphire-dev-2-3.authnetwork.dev/tss/teal", "https://sapphire-dev-2-4.authnetwork.dev/tss/teal", "https://sapphire-dev-2-5.authnetwork.dev/tss/teal"}, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5")}, + new TorusNodePub[]{new TorusNodePub("f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247", "54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7"), + new TorusNodePub("bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a", "ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a"), + new TorusNodePub("b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb", "759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c"), + new TorusNodePub("7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767", "336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b"), + new TorusNodePub("bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773", "bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4")}, + false); + + public static NodeDetails NODE_DETAILS_MAINNET = new NodeDetails("1", new String[]{"https://sapphire-1.auth.network/sss/mainnet/jrpc", "https://sapphire-2.auth.network/sss/mainnet/jrpc", "https://sapphire-3.auth.network/sss/mainnet/jrpc", "https://sapphire-4.auth.network/sss/mainnet/jrpc", "https://sapphire-5.auth.network/sss/mainnet/jrpc"}, + new String[]{"https://sapphire-1.auth.network/sss/mainnet/jrpc", "https://sapphire-2.auth.network/sss/mainnet/jrpc", "https://sapphire-3.auth.network/sss/mainnet/jrpc", "https://sapphire-4.auth.network/sss/mainnet/jrpc", "https://sapphire-5.auth.network/sss/mainnet/jrpc"}, + new String[]{"https://sapphire-1.auth.network/rss/mainnet", "https://sapphire-2.auth.network/rss/mainnet", "https://sapphire-3.auth.network/rss/mainnet", "https://sapphire-4.auth.network/rss/mainnet", "https://sapphire-5.auth.network/rss/mainnet"}, + new String[]{"https://sapphire-1.auth.network/tss/mainnet", "https://sapphire-2.auth.network/tss/mainnet", "https://sapphire-3.auth.network/tss/mainnet", "https://sapphire-4.auth.network/tss/mainnet", "https://sapphire-5.auth.network/tss/mainnet"}, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5")}, + new TorusNodePub[]{new TorusNodePub("e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1"), + new TorusNodePub("9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107"), + new TorusNodePub("555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e"), + new TorusNodePub("2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247"), + new TorusNodePub("3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4")}, + false); + + public static NodeDetails NODE_DETAILS_CYAN = new NodeDetails("1", new String[]{"https://sapphire-1.auth.network/sss/cyan/jrpc", "https://sapphire-2.auth.network/sss/cyan/jrpc", "https://sapphire-3.auth.network/sss/cyan/jrpc", "https://sapphire-4.auth.network/sss/cyan/jrpc", "https://sapphire-5.auth.network/sss/cyan/jrpc"}, + new String[]{"https://sapphire-1.auth.network/sss/cyan/jrpc", "https://sapphire-2.auth.network/sss/cyan/jrpc", "https://sapphire-3.auth.network/sss/cyan/jrpc", "https://sapphire-4.auth.network/sss/cyan/jrpc", "https://sapphire-5.auth.network/sss/cyan/jrpc"}, + new String[]{"https://sapphire-1.auth.network/rss/cyan", "https://sapphire-2.auth.network/rss/cyan", "https://sapphire-3.auth.network/rss/cyan", "https://sapphire-4.auth.network/rss/cyan", "https://sapphire-5.auth.network/rss/cyan"}, + new String[]{"https://sapphire-1.auth.network/tss/cyan", "https://sapphire-2.auth.network/tss/cyan", "https://sapphire-3.auth.network/tss/cyan", "https://sapphire-4.auth.network/tss/cyan", "https://sapphire-5.auth.network/tss/cyan"}, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5")}, + new TorusNodePub[]{new TorusNodePub("e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1"), + new TorusNodePub("9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107"), + new TorusNodePub("555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e"), + new TorusNodePub("2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247"), + new TorusNodePub("3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4")}, + false); + + public static NodeDetails NODE_DETAILS_AQUA = new NodeDetails("1", new String[]{"https://sapphire-1.auth.network/sss/aqua/jrpc", "https://sapphire-2.auth.network/sss/aqua/jrpc", "https://sapphire-3.auth.network/sss/aqua/jrpc", "https://sapphire-4.auth.network/sss/aqua/jrpc", "https://sapphire-5.auth.network/sss/aqua/jrpc"}, + new String[]{"https://sapphire-1.auth.network/sss/aqua/jrpc", "https://sapphire-2.auth.network/sss/aqua/jrpc", "https://sapphire-3.auth.network/sss/aqua/jrpc", "https://sapphire-4.auth.network/sss/aqua/jrpc", "https://sapphire-5.auth.network/sss/aqua/jrpc"}, + new String[]{"https://sapphire-1.auth.network/rss/aqua", "https://sapphire-2.auth.network/rss/aqua", "https://sapphire-3.auth.network/rss/aqua", "https://sapphire-4.auth.network/rss/aqua", "https://sapphire-5.auth.network/rss/aqua"}, + new String[]{"https://sapphire-1.auth.network/tss/aqua", "https://sapphire-2.auth.network/tss/aqua", "https://sapphire-3.auth.network/tss/aqua", "https://sapphire-4.auth.network/tss/aqua", "https://sapphire-5.auth.network/tss/aqua"}, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5")}, + new TorusNodePub[]{new TorusNodePub("e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1"), + new TorusNodePub("9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107"), + new TorusNodePub("555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e"), + new TorusNodePub("2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247"), + new TorusNodePub("3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4")}, + false); + + + public static NodeDetails NODE_DETAILS_SAPPHIRE_MAINNET = new NodeDetails("1", new String[]{"https://sapphire-1.auth.network/sss/jrpc", "https://sapphire-2.auth.network/sss/jrpc", "https://sapphire-3.auth.network/sss/jrpc", "https://sapphire-4.auth.network/sss/jrpc", "https://sapphire-5.auth.network/sss/jrpc"}, + new String[]{"https://sapphire-1.auth.network/sss/jrpc", "https://sapphire-2.auth.network/sss/jrpc", "https://sapphire-3.auth.network/sss/jrpc", "https://sapphire-4.auth.network/sss/jrpc", "https://sapphire-5.auth.network/sss/jrpc"}, + new String[]{"https://sapphire-1.auth.network/rss", "https://sapphire-2.auth.network/rss", "https://sapphire-3.auth.network/rss", "https://sapphire-4.auth.network/rss", "https://sapphire-5.auth.network/rss"}, + new String[]{"https://sapphire-1.auth.network/tss", "https://sapphire-2.auth.network/tss", "https://sapphire-3.auth.network/tss", "https://sapphire-4.auth.network/tss", "https://sapphire-5.auth.network/tss"}, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5")}, + new TorusNodePub[]{new TorusNodePub("e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1"), + new TorusNodePub("9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107"), + new TorusNodePub("555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e"), + new TorusNodePub("2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247"), + new TorusNodePub("3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4")}, + false); + + public static NodeDetails NODE_DETAILS_SAPPHIRE_DEVNET = new NodeDetails("1", new String[]{"https://sapphire-dev-2-1.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-2.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-3.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-4.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-5.authnetwork.dev/sss/jrpc"}, + new String[]{"https://sapphire-dev-2-1.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-2.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-3.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-4.authnetwork.dev/sss/jrpc", "https://sapphire-dev-2-5.authnetwork.dev/sss/jrpc"}, + new String[]{"https://sapphire-dev-2-1.authnetwork.dev/rss", "https://sapphire-dev-2-2.authnetwork.dev/rss", "https://sapphire-dev-2-3.authnetwork.dev/rss", "https://sapphire-dev-2-4.authnetwork.dev/rss", "https://sapphire-dev-2-5.authnetwork.dev/rss"}, + new String[]{"https://sapphire-dev-2-1.authnetwork.dev/tss", "https://sapphire-dev-2-2.authnetwork.dev/tss", "https://sapphire-dev-2-3.authnetwork.dev/tss", "https://sapphire-dev-2-4.authnetwork.dev/tss", "https://sapphire-dev-2-5.authnetwork.dev/tss"}, + new BigInteger[]{new BigInteger("1"), new BigInteger("2"), new BigInteger("3"), new BigInteger("4"), new BigInteger("5")}, + new TorusNodePub[]{new TorusNodePub("f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247", "54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7"), + new TorusNodePub("bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a", "ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a"), + new TorusNodePub("b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb", "759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c"), + new TorusNodePub("7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767", "336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b"), + new TorusNodePub("bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773", "bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4")}, + false); + + public static NodeDetails fetchLocalConfig(TorusNetwork network) { + NodeDetails nodeDetails = null; + switch (network) { + case SAPPHIRE_DEVNET: + nodeDetails = NODE_DETAILS_SAPPHIRE_DEVNET; + case SAPPHIRE_MAINNET: + nodeDetails = NODE_DETAILS_SAPPHIRE_MAINNET; + case MAINNET: + nodeDetails = NODE_DETAILS_MAINNET; + case AQUA: + nodeDetails = NODE_DETAILS_AQUA; + case CYAN: + nodeDetails = NODE_DETAILS_CYAN; + case TESTNET: + nodeDetails = NODE_DETAILS_TESTNET; + } + return nodeDetails; + } + + public static final Map NETWORK_MAP = new HashMap() { + { + put(TorusNetwork.MAINNET, "mainnet"); + put(TorusNetwork.TESTNET, "goerli"); + put(TorusNetwork.CYAN, "polygon-mainnet"); + put(TorusNetwork.AQUA, "polygon-mainnet"); + put(TorusNetwork.CELESTE, "polygon-mainnet"); + + } + }; + + public static final Map SIGNER_MAP = new HashMap() { + { + put(TorusNetwork.MAINNET, "https://signer.tor.us"); + put(TorusNetwork.TESTNET, "https://signer.tor.us"); + put(TorusNetwork.CYAN, "https://signer-polygon.tor.us"); + put(TorusNetwork.AQUA, "https://signer-polygon.tor.us"); + put(TorusNetwork.CELESTE, "https://signer-polygon.tor.us"); + + } + }; +} diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java b/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java index a6a0cf1..bd4c176 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/FetchNodeDetailsTest.java @@ -1,48 +1,47 @@ package org.torusresearch.fetchnodedetailstest; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.torusresearch.fetchnodedetails.FetchNodeDetails; -import org.torusresearch.fetchnodedetails.types.TorusNetwork; import org.torusresearch.fetchnodedetails.types.NodeDetails; +import org.torusresearch.fetchnodedetails.types.TorusNetwork; import org.torusresearch.fetchnodedetailstest.config.Config; -import java.io.UnsupportedEncodingException; import java.util.concurrent.ExecutionException; -import static org.junit.jupiter.api.Assertions.assertEquals; - class FetchNodeDetailsTest { FetchNodeDetails fetchNodeDetails; @DisplayName("Gets the Node details for Mainnet") @Test - public void shouldGetNodeDetailsMainnet() throws ExecutionException, InterruptedException, UnsupportedEncodingException { - fetchNodeDetails = new FetchNodeDetails(); + public void shouldGetNodeDetailsMainnet() throws ExecutionException, InterruptedException { + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.MAINNET); NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); assertEquals(Config.MAINNET, nodeDetails); } @DisplayName("Gets the Node details for Testnet") @Test - public void shouldGetNodeDetailsRopsten() throws ExecutionException, InterruptedException, UnsupportedEncodingException { - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.TESTNET, FetchNodeDetails.PROXY_ADDRESS_TESTNET); + public void shouldGetNodeDetailsRopsten() throws ExecutionException, InterruptedException { + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.TESTNET); NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); assertEquals(Config.TESTNET, nodeDetails); } @DisplayName("Gets the Node details for Cyan") @Test - public void shouldGetNodeDetailsCyan() throws ExecutionException, InterruptedException, UnsupportedEncodingException { - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CYAN, FetchNodeDetails.PROXY_ADDRESS_CYAN); + public void shouldGetNodeDetailsCyan() throws ExecutionException, InterruptedException { + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CYAN); NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); assertEquals(Config.CYAN, nodeDetails); } @DisplayName("Gets the Node details for Aqua") @Test - public void shouldGetNodeDetailsAqua() throws ExecutionException, InterruptedException, UnsupportedEncodingException { - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.AQUA, FetchNodeDetails.PROXY_ADDRESS_AQUA); + public void shouldGetNodeDetailsAqua() throws ExecutionException, InterruptedException { + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.AQUA); NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); assertEquals(Config.AQUA, nodeDetails); } @@ -50,8 +49,24 @@ public void shouldGetNodeDetailsAqua() throws ExecutionException, InterruptedExc @DisplayName("Gets the Node details for Celeste") @Test public void shouldGetNodeDetailsCeleste() throws ExecutionException, InterruptedException { - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CELESTE, FetchNodeDetails.PROXY_ADDRESS_CELESTE); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CELESTE); NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); assertEquals(Config.CELESTE, nodeDetails); } + + @DisplayName("Gets the Node details for SapphireDevnet") + @Test + public void shouldGetNodeDetailsSapphireDevnet() throws ExecutionException, InterruptedException { + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.SAPPHIRE_DEVNET); + NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); + assertEquals(Config.SAPPHIRE_DEVNET, nodeDetails); + } + + @DisplayName("Gets the Node details for SapphireMainnet") + @Test + public void shouldGetNodeDetailsSapphireMainnet() throws ExecutionException, InterruptedException { + fetchNodeDetails = new FetchNodeDetails(); + NodeDetails nodeDetails = this.fetchNodeDetails.getNodeDetails("google", "hello@tor.us").get(); + assertEquals(Config.SAPPHIRE_MAINNET, 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 index 8d05596..6519ac9 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/config/Config.java +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/Config.java @@ -1,9 +1,9 @@ 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; @@ -14,6 +14,8 @@ public class Config { public static NodeDetails AQUA; public static NodeDetails CELESTE; + public static NodeDetails SAPPHIRE_DEVNET; + public static NodeDetails SAPPHIRE_MAINNET; static { try { @@ -23,6 +25,8 @@ public class Config { CYAN = getNodeDetailsFromFile(basePath + "cyan.json"); AQUA = getNodeDetailsFromFile(basePath + "aqua.json"); CELESTE = getNodeDetailsFromFile(basePath + "celeste.json"); + SAPPHIRE_DEVNET = getNodeDetailsFromFile(basePath + "sapphire_devnet.json"); + SAPPHIRE_MAINNET = getNodeDetailsFromFile(basePath + "sapphire_mainnet.json"); } catch (Exception ex) { ex.printStackTrace(); } @@ -35,7 +39,7 @@ static NodeDetails getNodeDetailsFromFile(String path) { Gson gson = new Gson(); // create a reader - Reader reader = new FileReader(new File(path)); + Reader reader = new FileReader(path); // convert JSON file to map NodeDetails details = gson.fromJson(reader, NodeDetails.class); diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/aqua.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/aqua.json index 0f17525..6ddacd1 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/config/aqua.json +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/aqua.json @@ -2,32 +2,53 @@ "currentEpoch": "1", "nodeListAddress": "0x29Dea82a0509153b91040ee13cDBba0f03efb625", "torusNodeEndpoints": [ - "https://node-1.cluster-2.aqua.web3auth.io/jrpc", - "https://node-2.cluster-2.aqua.web3auth.io/jrpc", - "https://node-3.cluster-2.aqua.web3auth.io/jrpc", - "https://node-4.cluster-2.aqua.web3auth.io/jrpc", - "https://node-5.cluster-2.aqua.web3auth.io/jrpc" + "https://sapphire-1.auth.network/sss/aqua/jrpc", + "https://sapphire-2.auth.network/sss/aqua/jrpc", + "https://sapphire-3.auth.network/sss/aqua/jrpc", + "https://sapphire-4.auth.network/sss/aqua/jrpc", + "https://sapphire-5.auth.network/sss/aqua/jrpc" + ], + "torusNodeSSSEndpoints": [ + "https://sapphire-1.auth.network/sss/aqua/jrpc", + "https://sapphire-2.auth.network/sss/aqua/jrpc", + "https://sapphire-3.auth.network/sss/aqua/jrpc", + "https://sapphire-4.auth.network/sss/aqua/jrpc", + "https://sapphire-5.auth.network/sss/aqua/jrpc" + ], + "torusNodeRSSEndpoints": [ + "https://sapphire-1.auth.network/rss/aqua", + "https://sapphire-2.auth.network/rss/aqua", + "https://sapphire-3.auth.network/rss/aqua", + "https://sapphire-4.auth.network/rss/aqua", + "https://sapphire-5.auth.network/rss/aqua" + ], + "torusNodeTSSEndpoints": [ + "https://sapphire-1.auth.network/tss/aqua", + "https://sapphire-2.auth.network/tss/aqua", + "https://sapphire-3.auth.network/tss/aqua", + "https://sapphire-4.auth.network/tss/aqua", + "https://sapphire-5.auth.network/tss/aqua" ], "torusNodePub": [ { - "X": "7d376a4a7ce6bba7a8a49001aaa2de3f24e0f56ee73a77c6678ec00363616f25", - "Y": "d5752873e522f98b4ded27690aadfda57ff5dc2fd0c3055b9d83663441667010" + "X": "e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", + "Y": "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1" }, { - "X": "e1b5debe1d9b42eb9917a5fe84fa5f48cae7a770b1f49f0546fbe26b1efaff3", - "Y": "8947458cbfd8b40c7bc6160c7c746c2dca65c7d6ffdccd5579203b92a020b4ad" + "X": "9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", + "Y": "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107" }, { - "X": "98c3582b138b375b643984094882c17ca7ee090787c0a7065d229672845aa25e", - "Y": "2c3923bd015faac2cf3d91ab4cf8c6cdd4eb9f99e407a35703edf17e8c35d" + "X": "555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", + "Y": "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e" }, { - "X": "e7ef4c1ea43bd385ab8bfb02a5aedcd33bed35b95980c0729e9a35edd02a8597", - "Y": "d540aa7d1c9cafd2216e089b8c795a9034368960729103c9a2c875d76b81fc6d" + "X": "2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", + "Y": "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247" }, { - "X": "bb7d3500ead64d0bccd97f24b5c848ff6cbe867c0c03ca9f2922626ac5d1e49d", - "Y": "865ea03db0501bc9ffa83600202de437c7c10aa511c58ba54683b4d5f56ae314" + "X": "3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", + "Y": "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4" } ], "torusIndexes": [1, 2, 3, 4, 5], diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/celeste.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/celeste.json index e403fb4..7556d32 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/config/celeste.json +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/celeste.json @@ -11,7 +11,7 @@ "torusNodePub": [ { "X": "184a61fc08255c33ac8d57da86d957725e45157a4dfe6b80838b9c0acf450133", - "Y": "6b2189341bc8ba97cd849f58bac8d6fa4484c42d57a529797a4d615bf20fbcd" + "Y": "06b2189341bc8ba97cd849f58bac8d6fa4484c42d57a529797a4d615bf20fbcd" }, { "X": "3ca052df886a84096c2b2eded87cbfacab06d5e231b75a0fe8b6bc7fa4ed04a1", diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/cyan.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/cyan.json index 3c68dd0..f1f577c 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/config/cyan.json +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/cyan.json @@ -1,33 +1,53 @@ { "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" + "https://sapphire-1.auth.network/sss/cyan/jrpc", + "https://sapphire-2.auth.network/sss/cyan/jrpc", + "https://sapphire-3.auth.network/sss/cyan/jrpc", + "https://sapphire-4.auth.network/sss/cyan/jrpc", + "https://sapphire-5.auth.network/sss/cyan/jrpc" + ], + "torusNodeSSSEndpoints": [ + "https://sapphire-1.auth.network/sss/cyan/jrpc", + "https://sapphire-2.auth.network/sss/cyan/jrpc", + "https://sapphire-3.auth.network/sss/cyan/jrpc", + "https://sapphire-4.auth.network/sss/cyan/jrpc", + "https://sapphire-5.auth.network/sss/cyan/jrpc" + ], + "torusNodeRSSEndpoints": [ + "https://sapphire-1.auth.network/rss/cyan", + "https://sapphire-2.auth.network/rss/cyan", + "https://sapphire-3.auth.network/rss/cyan", + "https://sapphire-4.auth.network/rss/cyan", + "https://sapphire-5.auth.network/rss/cyan" + ], + "torusNodeTSSEndpoints": [ + "https://sapphire-1.auth.network/tss/cyan", + "https://sapphire-2.auth.network/tss/cyan", + "https://sapphire-3.auth.network/tss/cyan", + "https://sapphire-4.auth.network/tss/cyan", + "https://sapphire-5.auth.network/tss/cyan" ], "torusNodePub": [ { - "X": "805f81fd2fdc0d207b5a8b6643cd8f885bb761942f31fd6e138fcf8871d44cff", - "Y": "10bd6ec1675147256fbc4094c05191975a175d49ae8716ee83409929e6a302e7" + "X": "e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", + "Y": "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1" }, { - "X": "28394dafddfa20cb9ef5c9c26c31415c613565c3bbd9a82af8bfc88376e65353", - "Y": "5507f59c00d585fbed0ca08773a24faea4724e2b68be3da1e7281d5968251f1b" + "X": "9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", + "Y": "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107" }, { - "X": "4a190019eea47a45e6edb6a871a850b67fb72dcd9e255a07156c31dbf3a40035", - "Y": "565aa310a9e736f03d0693df4723880cafe25edba46c9ee88ace6453044d5ae9" + "X": "555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", + "Y": "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e" }, { - "X": "8a0f03b3ad07b1bd6068bb0aad3fe9feea5181643b04d292c65769c96b5990f8", - "Y": "4b34b66a7d91ff85f330a3c012a7bf45f5509be57bdf61885a906214d818a695" + "X": "2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", + "Y": "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247" }, { - "X": "dcf3b3c5a9e43533b875862b4dcfd5614535e7838d9a916f3f735e28e345cd9d", - "Y": "856d980747c1d171972b2ea34831670763d4b493ea7537b295b4be4c25b012fc" + "X": "3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", + "Y": "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4" } ], "torusIndexes": [1, 2, 3, 4, 5], diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json index 5de691b..404bfaf 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/mainnet.json @@ -1,55 +1,61 @@ { - "currentEpoch": "19", - "nodeListAddress": "0xf20336e16B5182637f09821c27BDe29b0AFcfe80", + "currentEpoch": "1", "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" + "https://sapphire-1.auth.network/sss/mainnet/jrpc", + "https://sapphire-2.auth.network/sss/mainnet/jrpc", + "https://sapphire-3.auth.network/sss/mainnet/jrpc", + "https://sapphire-4.auth.network/sss/mainnet/jrpc", + "https://sapphire-5.auth.network/sss/mainnet/jrpc" + ], + "torusNodeSSSEndpoints": [ + "https://sapphire-1.auth.network/sss/mainnet/jrpc", + "https://sapphire-2.auth.network/sss/mainnet/jrpc", + "https://sapphire-3.auth.network/sss/mainnet/jrpc", + "https://sapphire-4.auth.network/sss/mainnet/jrpc", + "https://sapphire-5.auth.network/sss/mainnet/jrpc" + ], + "torusNodeRSSEndpoints": [ + "https://sapphire-1.auth.network/rss/mainnet", + "https://sapphire-2.auth.network/rss/mainnet", + "https://sapphire-3.auth.network/rss/mainnet", + "https://sapphire-4.auth.network/rss/mainnet", + "https://sapphire-5.auth.network/rss/mainnet" + ], + "torusNodeTSSEndpoints": [ + "https://sapphire-1.auth.network/tss/mainnet", + "https://sapphire-2.auth.network/tss/mainnet", + "https://sapphire-3.auth.network/tss/mainnet", + "https://sapphire-4.auth.network/tss/mainnet", + "https://sapphire-5.auth.network/tss/mainnet" ], "torusNodePub": [ { - "X": "bbe83c64177c3775550e6ba6ac2bc059f6847d644c9e4894e42c60d7974d8c2b", - "Y": "82b49a7caf70def38cdad2740af45c1e4f969650105c5019a29bb18b21a9acb5" - }, - { - "X": "c208cac4ef9a47d386097a9c915b28e9cb89213abee8d26a17198ee261201b0d", - "Y": "c7db2fe4631109f40833de9dc78d07e35706549ee48fa557b33e4e75e1047873" - }, - { - "X": "ca1766bb426d4ca5582818a0c5439d560ea64f5baa060793ab29dd3d0ceacfe", - "Y": "d46c1d08c40e1306e1bca328c2287b8268166b11a1ba4b8442ea2ad0c5e32152" - }, - { - "X": "c3934dd2f6f4b3d2e1e398cc501e143c1e1a381b52feb6d1525af34d16253768", - "Y": "71f5141a5035799099f5ea3e241e66946bc55dc857ac3bd7d6fcdb8dcd3eeeef" + "X": "e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", + "Y": "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1" }, { - "X": "22e66f1929631d00bf026227581597f085fd94fd952fc0dca9f0833398b5c064", - "Y": "6088b3912e10a1e9d50355a609c10db7d188f16a2e2fd7357e51bf4f6a74f0a1" + "X": "9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", + "Y": "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107" }, { - "X": "9dc9fa410f3ce9eb70df70cdea00a49f2c4cc7a31c08c0dab5f863ed35ff5139", - "Y": "627a291cb87a75c61da3f65d6818e1e05e360217179817ed27e8c73bca7ec122" + "X": "555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", + "Y": "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e" }, { - "X": "118b9fc07e97b096d899b9f6658463ce6a8caa64038e37fc969df4e6023dd8c6", - "Y": "baf9fa4e51770f4796ea165dd03a769b8606681a38954a0a92c4cbffd6609ce9" + "X": "2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", + "Y": "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247" }, { - "X": "8a6d8b925da15a273dec3d8f8395ec35cd6878f274b2b180e4e106999db64043", - "Y": "96f67f870c157743da0b1eb84d89bf30500d74dc84c11f501ee1cb013acc8c46" - }, - { - "X": "39cecb62e863729f572f7dfc46c24867981bf04bb405fed0df39e33984bfade5", - "Y": "61c2364434012e68a2be2e9952805037e52629d7762fafc8e10e9fb5bad8f790" + "X": "3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", + "Y": "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4" } ], - "torusIndexes": [1, 2, 3, 4, 5, 6, 7, 8, 9], + "torusIndexes": [ + 1, + 2, + 3, + 4, + 5 + ], "updated": true -} +} \ No newline at end of file diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/sapphire_devnet.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/sapphire_devnet.json new file mode 100644 index 0000000..6e0db85 --- /dev/null +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/sapphire_devnet.json @@ -0,0 +1,61 @@ +{ + "currentEpoch": "1", + "torusNodeEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-2.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-3.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-4.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-5.authnetwork.dev/sss/jrpc" + ], + "torusNodeSSSEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-2.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-3.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-4.authnetwork.dev/sss/jrpc", + "https://sapphire-dev-2-5.authnetwork.dev/sss/jrpc" + ], + "torusNodeRSSEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/rss", + "https://sapphire-dev-2-2.authnetwork.dev/rss", + "https://sapphire-dev-2-3.authnetwork.dev/rss", + "https://sapphire-dev-2-4.authnetwork.dev/rss", + "https://sapphire-dev-2-5.authnetwork.dev/rss" + ], + "torusNodeTSSEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/tss", + "https://sapphire-dev-2-2.authnetwork.dev/tss", + "https://sapphire-dev-2-3.authnetwork.dev/tss", + "https://sapphire-dev-2-4.authnetwork.dev/tss", + "https://sapphire-dev-2-5.authnetwork.dev/tss" + ], + "torusNodePub": [ + { + "X": "f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247", + "Y": "54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7" + }, + { + "X": "bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a", + "Y": "ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a" + }, + { + "X": "b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb", + "Y": "759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c" + }, + { + "X": "7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767", + "Y": "336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b" + }, + { + "X": "bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773", + "Y": "bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4" + } + ], + "torusIndexes": [ + 1, + 2, + 3, + 4, + 5 + ], + "updated": true +} \ No newline at end of file diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/sapphire_mainnet.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/sapphire_mainnet.json new file mode 100644 index 0000000..acc6a91 --- /dev/null +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/sapphire_mainnet.json @@ -0,0 +1,61 @@ +{ + "currentEpoch": "1", + "torusNodeEndpoints": [ + "https://sapphire-1.auth.network/sss/jrpc", + "https://sapphire-2.auth.network/sss/jrpc", + "https://sapphire-3.auth.network/sss/jrpc", + "https://sapphire-4.auth.network/sss/jrpc", + "https://sapphire-5.auth.network/sss/jrpc" + ], + "torusNodeSSSEndpoints": [ + "https://sapphire-1.auth.network/sss/jrpc", + "https://sapphire-2.auth.network/sss/jrpc", + "https://sapphire-3.auth.network/sss/jrpc", + "https://sapphire-4.auth.network/sss/jrpc", + "https://sapphire-5.auth.network/sss/jrpc" + ], + "torusNodeRSSEndpoints": [ + "https://sapphire-1.auth.network/rss", + "https://sapphire-2.auth.network/rss", + "https://sapphire-3.auth.network/rss", + "https://sapphire-4.auth.network/rss", + "https://sapphire-5.auth.network/rss" + ], + "torusNodeTSSEndpoints": [ + "https://sapphire-1.auth.network/tss", + "https://sapphire-2.auth.network/tss", + "https://sapphire-3.auth.network/tss", + "https://sapphire-4.auth.network/tss", + "https://sapphire-5.auth.network/tss" + ], + "torusNodePub": [ + { + "X": "e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052", + "Y": "54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1" + }, + { + "X": "9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637", + "Y": "fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107" + }, + { + "X": "555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476", + "Y": "606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e" + }, + { + "X": "2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128", + "Y": "4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247" + }, + { + "X": "3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a", + "Y": "dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4" + } + ], + "torusIndexes": [ + 1, + 2, + 3, + 4, + 5 + ], + "updated": true +} \ No newline at end of file diff --git a/src/test/java/org/torusresearch/fetchnodedetailstest/config/testnet.json b/src/test/java/org/torusresearch/fetchnodedetailstest/config/testnet.json index 2273d9d..b5b4146 100644 --- a/src/test/java/org/torusresearch/fetchnodedetailstest/config/testnet.json +++ b/src/test/java/org/torusresearch/fetchnodedetailstest/config/testnet.json @@ -1,35 +1,61 @@ { - "currentEpoch": "15", - "nodeListAddress": "0xd084604e5FA387FbC2Da8bAab07fDD6aDED4614A", + "currentEpoch": "1", "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" + "https://sapphire-dev-2-1.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-2.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-3.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-4.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-5.authnetwork.dev/sss/teal/jrpc" + ], + "torusNodeSSSEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-2.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-3.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-4.authnetwork.dev/sss/teal/jrpc", + "https://sapphire-dev-2-5.authnetwork.dev/sss/teal/jrpc" + ], + "torusNodeRSSEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/rss/teal", + "https://sapphire-dev-2-2.authnetwork.dev/rss/teal", + "https://sapphire-dev-2-3.authnetwork.dev/rss/teal", + "https://sapphire-dev-2-4.authnetwork.dev/rss/teal", + "https://sapphire-dev-2-5.authnetwork.dev/rss/teal" + ], + "torusNodeTSSEndpoints": [ + "https://sapphire-dev-2-1.authnetwork.dev/tss/teal", + "https://sapphire-dev-2-2.authnetwork.dev/tss/teal", + "https://sapphire-dev-2-3.authnetwork.dev/tss/teal", + "https://sapphire-dev-2-4.authnetwork.dev/tss/teal", + "https://sapphire-dev-2-5.authnetwork.dev/tss/teal" ], "torusNodePub": [ { - "X": "1363aad8868cacd7f8946c590325cd463106fb3731f08811ab4302d2deae35c3", - "Y": "d77eebe5cdf466b475ec892d5b4cffbe0c1670525debbd97eee6dae2f87a7cbe" + "X": "f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247", + "Y": "54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7" }, { - "X": "7c8cc521c48690f016bea593f67f88ad24f447dd6c31bbab541e59e207bf029d", - "Y": "b359f0a82608db2e06b953b36d0c9a473a00458117ca32a5b0f4563a7d539636" + "X": "bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a", + "Y": "ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a" }, { - "X": "8a86543ca17df5687719e2549caa024cf17fe0361e119e741eaee668f8dd0a6f", - "Y": "9cdb254ff915a76950d6d13d78ef054d5d0dc34e2908c00bb009a6e4da701891" + "X": "b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb", + "Y": "759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c" }, { - "X": "25a98d9ae006aed1d77e81d58be8f67193d13d01a9888e2923841894f4b0bf9c", - "Y": "f63d40df480dacf68922004ed36dbab9e2969181b047730a5ce0797fb6958249" + "X": "7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767", + "Y": "336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b" }, { - "X": "d908f41f8e06324a8a7abcf702adb6a273ce3ae63d86a3d22723e1bbf1438c9a", - "Y": "f977530b3ec0e525438c72d1e768380cbc5fb3b38a760ee925053b2e169428ce" + "X": "bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773", + "Y": "bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4" } ], - "torusIndexes": [1, 2, 3, 4, 5], + "torusIndexes": [ + 1, + 2, + 3, + 4, + 5 + ], "updated": true }