diff --git a/dash-sdk-java/src/test/java/org/dashj/platform/sdk/VoteTest.java b/dash-sdk-java/src/test/java/org/dashj/platform/sdk/VoteTest.java index ebc85cd..7198423 100644 --- a/dash-sdk-java/src/test/java/org/dashj/platform/sdk/VoteTest.java +++ b/dash-sdk-java/src/test/java/org/dashj/platform/sdk/VoteTest.java @@ -85,6 +85,53 @@ public void getVoteContendorsTest() throws Exception { } + @Test + public void getVoteContendorsMainNetTest() throws Exception { + String name = "fuzzyduck"; + ArrayList indexes = new ArrayList<>(); + indexes.add(new PlatformValue("dash")); + indexes.add(new PlatformValue(name)); + SWIGTYPE_p_DashSdk mainnetSdk = dashsdk.platformMobileSdkCreateDashSdk(BigInteger.ZERO, BigInteger.ZERO, false); + Result result = dashsdk.platformMobileVotingGetVoteContenders( + mainnetSdk, + "parentNameAndLabel", + indexes, + "domain", + new Identifier(dpnsContractId) + ); + Contenders contenders = result.unwrap(); + assertNotNull(contenders); + System.out.println("Username: " + name); + System.out.println("Contenders: " + contenders.getContenders().size()); + TupleContestedDocumentVotePollWinnerInfoBlockInfo winner = contenders.getWinner(); + System.out.println(" Winner:" + (winner != null ? "" : "none")); + if (winner != null) { + System.out.print(" " + winner.getO_0().getTag()); + if (winner.getO_0().getTag() == ContestedDocumentVotePollWinnerInfo.Tag.WonByIdentity) { + System.out.print(" " + Base58.encode(winner.getO_0().getWon_by_identity().get_0().get_0().get_0())); + } + System.out.println(); + } + System.out.println(" Abstain: " + contenders.getAbstainVoteTally()); + System.out.println(" Lock: " + contenders.getLockVoteTally()); + System.out.println(" ---------------"); + for (Map.Entry entry : contenders.getContenders().entrySet()) { + System.out.println(" Identifier: " + Base58.encode(entry.getKey().get_0().get_0())); + byte [] serializedDocument = entry.getValue().getV0().get_0().getSerialized_document(); + System.out.println(" Serialized: " + (serializedDocument != null ? Base64.getEncoder().encodeToString(serializedDocument) : "null")); + if (serializedDocument != null) { + Result result2 = dashsdk.platformMobileFetchDocumentDeserializeDocumentSdk( + sdk, serializedDocument, new Identifier(dpnsContractId), "domain"); + Document document = result2.unwrap(); + long createdAt = document.getV0().get_0().getCreated_at().toLong(); + System.out.println(" createdAt: " + DateFormat.getDateInstance(DateFormat.LONG).format(createdAt)); + } + System.out.println(" Votes: " + entry.getValue().getV0().get_0().getVoteTally()); + System.out.println(" ---------------"); + } + dashsdk.platformMobileSdkDestroyDashSdk(mainnetSdk); + } + @Test public void getVoteContendorsForNonExistantTest() throws Exception { ArrayList indexes = new ArrayList<>(); diff --git a/dpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.kt b/dpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.kt index d2293eb..d766079 100644 --- a/dpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.kt +++ b/dpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.kt @@ -449,15 +449,29 @@ class DapiClient( ): Identity? { logger.info("getIdentity(${id.toBase58()}, $prove)") val identityId = Identifier.from(id) - val result = dashsdk.platformMobileFetchIdentityFetchIdentityWithSdk( - rustSdk, - identityId.toNative() - ) - return try { - Identity(result.unwrap().get()) - } catch (e: Exception) { - null - } + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileFetchIdentityFetchIdentityWithSdk( + rustSdk, + identityId.toNative() + ) + try { + return try { + Identity(result.unwrap().get()) + } catch (e: Exception) { + null + } + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } /** @@ -467,15 +481,29 @@ class DapiClient( */ fun getIdentityByFirstPublicKey(pubKeyHash: ByteArray, prove: Boolean = false): Identity? { logger.info("getIdentityByFirstPublicKey(${pubKeyHash.toHex()})") - val result = dashsdk.platformMobileFetchIdentityFetchIdentityWithKeyhashSdk( - rustSdk, - pubKeyHash - ) - return try { - Identity(result.unwrap()) - } catch (e: Exception) { - null - } + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileFetchIdentityFetchIdentityWithKeyhashSdk( + rustSdk, + pubKeyHash + ) + try { + return try { + Identity(result.unwrap()) + } catch (e: Exception) { + null + } + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } /** @@ -535,16 +563,31 @@ class DapiClient( logger.info("getDataContract(${contractIdByteArray.toBase58()})") val contractId = Identifier.from(contractIdByteArray) - val dataContract = dashsdk.platformMobileDataContractsFetchDataContract( - rustSdk, - contractId.toNative() - ) - return try { - DataContract.from(dataContract.unwrap().get()) - } catch (e: Exception) { - logger.error("get data contract error", e) - throw NotFoundException("DataContract ${contractIdByteArray.toBase58()} not found") - } + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val dataContractResult = dashsdk.platformMobileDataContractsFetchDataContract( + rustSdk, + contractId.toNative() + ) + try { + return try { + DataContract.from(dataContractResult.unwrap().get()) + } catch (e: Exception) { + null + } + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + logger.error("get data contract error", e) + throw NotFoundException("DataContract ${contractIdByteArray.toBase58()} not found") + } + logger.error("get data contract error", e) + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } /** @@ -572,19 +615,32 @@ class DapiClient( documentQuery.startAfter != null -> Start(documentQuery.startAfter!!.toBuffer(), false) else -> null } - val result = dashsdk.platformMobileFetchDocumentFetchDocumentsWithQueryAndSdk( - rustSdk, - rustContractIdentifier, - type, - documentQuery.encodeWhere(), - documentQuery.encodeOrderBy(), - if (documentQuery.limit == -1) 100 else documentQuery.limit.toLong(), - start - ) - logger.info("getDocuments(...) result = {}", result) - return result.unwrap().map { - Document(it, contractIdentifier) - } + var retriesLeft = DEFAULT_RETRY_COUNT + val exceptionList = arrayListOf() + do { + val result = dashsdk.platformMobileFetchDocumentFetchDocumentsWithQueryAndSdk( + rustSdk, + rustContractIdentifier, + type, + documentQuery.encodeWhere(), + documentQuery.encodeOrderBy(), + if (documentQuery.limit == -1) 100 else documentQuery.limit.toLong(), + start + ) + try { + return result.unwrap().map { + Document(it, contractIdentifier) + } + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while (retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } /* Core */ @@ -1062,19 +1118,48 @@ class DapiClient( fun getIdentityBalance(identifier: Identifier) : Long { logger.info("getIdentityBalance({})", identifier) - val result = dashsdk.platformMobileFetchIdentityFetchIdentityBalanceWithSdk(rustSdk, identifier.toNative()) - return result.unwrap() + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileFetchIdentityFetchIdentityBalanceWithSdk(rustSdk, identifier.toNative()) + try { + return result.unwrap() + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } fun getVoteContenders(dataContractId: Identifier, documentType: String, indexName: String, indexes: List): Contenders { - val result = dashsdk.platformMobileVotingGetVoteContenders( - rustSdk, - indexName, - indexes.map { PlatformValue(it) }, - documentType, - dataContractId.toNative() - ) - return Contenders(result.unwrap()) + logger.info("getVoteContenders({}, {}, {}, {})", dataContractId, documentType, indexName, indexes) + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileVotingGetVoteContenders( + rustSdk, + indexName, + indexes.map { PlatformValue(it) }, + documentType, + dataContractId.toNative() + ) + try { + return Contenders(result.unwrap()) + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } fun getContestedResources( @@ -1084,15 +1169,30 @@ class DapiClient( startAt: PlatformValue? = null, startAtInclude: Boolean = false ): ContestedResources { - val result = dashsdk.platformMobileVotingGetContestedResources( - rustSdk, - documentType, - dataContractId.toNative(), - limit, - startAt, - startAtInclude - ) - return ContestedResources(result.unwrap()) + logger.info("getContestedResources({}, {}, {}, ...)", dataContractId, documentType, limit) + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileVotingGetContestedResources( + rustSdk, + documentType, + dataContractId.toNative(), + limit, + startAt, + startAtInclude + ) + try { + return ContestedResources(result.unwrap()) + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } fun deserializeDocument(serializedDocument: ByteArray, dataContractId: Identifier, documentType: String): Document { @@ -1145,28 +1245,58 @@ class DapiClient( limit: Int = DEFAULT_LIMIT, orderAscending: Boolean = true ): VotePollsGroupedByTimestamp { - val result = dashsdk.platformMobileVotingGetVotePolls( - rustSdk, - startTime.toTimestampMillis(), - startTimeIncluded, - endTime.toTimestampMillis(), - endTimeIncluded, - limit, - 0, - orderAscending - ) - return VotePollsGroupedByTimestamp(result.unwrap()); + logger.info("getVotePolls($startTime, $endTime, $limit, $orderAscending)") + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileVotingGetVotePolls( + rustSdk, + startTime.toTimestampMillis(), + startTimeIncluded, + endTime.toTimestampMillis(), + endTimeIncluded, + limit, + 0, + orderAscending + ) + try { + return VotePollsGroupedByTimestamp(result.unwrap()) + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } fun getLastVoteFromMasternode(protxHash: Sha256Hash, dataContractId: Identifier, documentType: String, indexName: String, indexes: List): ResourceVotesByIdentity { - val result = dashsdk.platformMobileVotingGetLastVoteFromMasternode( - rustSdk, - Identifier.from(protxHash).toNative(), - indexName, - indexes.map { PlatformValue(it) }, - documentType, - dataContractId.toNative() - ) - return ResourceVotesByIdentity(result.unwrap()) + logger.info("getLastVoteFromMasternode({}, {}, {}, {}, {})", protxHash, dataContractId, documentType, indexName, indexes) + val exceptionList = arrayListOf() + var retriesLeft = retries + do { + val result = dashsdk.platformMobileVotingGetLastVoteFromMasternode( + rustSdk, + Identifier.from(protxHash).toNative(), + indexName, + indexes.map { PlatformValue(it) }, + documentType, + dataContractId.toNative() + ) + try { + return ResourceVotesByIdentity(result.unwrap()) + } catch (e: Exception) { + if (e.message?.contains("context provider error: invalid quorum: quorum not found") == true) { + exceptionList.add(e) + retriesLeft-- + } else { + throw e + } + } + } while(retriesLeft > 0) + throw MaxRetriesReachedException(exceptionList) } } diff --git a/dpp/src/main/java/org/dashj/platform/dapiclient/MaxRetriesReachedException.kt b/dpp/src/main/java/org/dashj/platform/dapiclient/MaxRetriesReachedException.kt index 9b08629..4635fef 100644 --- a/dpp/src/main/java/org/dashj/platform/dapiclient/MaxRetriesReachedException.kt +++ b/dpp/src/main/java/org/dashj/platform/dapiclient/MaxRetriesReachedException.kt @@ -6,4 +6,8 @@ */ package org.dashj.platform.dapiclient -class MaxRetriesReachedException(e: Exception) : Exception(e) +class MaxRetriesReachedException(exceptions: List) : Exception(exceptions.first()) { + constructor(e: Exception) : this(listOf(e)) +} + + diff --git a/dpp/src/main/java/org/dashj/platform/dashpay/BlockchainIdentity.kt b/dpp/src/main/java/org/dashj/platform/dashpay/BlockchainIdentity.kt index 157826a..4a91b4c 100644 --- a/dpp/src/main/java/org/dashj/platform/dashpay/BlockchainIdentity.kt +++ b/dpp/src/main/java/org/dashj/platform/dashpay/BlockchainIdentity.kt @@ -229,7 +229,8 @@ class BlockchainIdentity { authenticationGroupExtension: AuthenticationGroupExtension, registeredIdentity: Identity? = null ) : this(platform, transaction.getUsedDerivationPathIndex(0), transaction.lockedOutpoint, wallet, authenticationGroupExtension) { - Preconditions.checkArgument(!transaction.assetLockPublicKey.isPubKeyOnly || transaction.assetLockPublicKey.isEncrypted) + // we don't use the assetLockPublicKey, so there is no reason to check its properties + // Preconditions.checkArgument(!transaction.assetLockPublicKey.isPubKeyOnly || transaction.assetLockPublicKey.isEncrypted) assetLockTransaction = transaction registrationFundingPrivateKey = transaction.assetLockPublicKey diff --git a/dpp/src/main/java/org/dashj/platform/sdk/platform/Documents.kt b/dpp/src/main/java/org/dashj/platform/sdk/platform/Documents.kt index 98b8b2c..c4a921f 100644 --- a/dpp/src/main/java/org/dashj/platform/sdk/platform/Documents.kt +++ b/dpp/src/main/java/org/dashj/platform/sdk/platform/Documents.kt @@ -287,7 +287,7 @@ class Documents(val platform: Platform) { endTime, endTimeIncluded, DOCUMENT_LIMIT, orderAscending) count = batch.size - val lastVotePoll = batch.last() + val lastVotePoll = batch.lastOrNull() currentStartTime = when (lastVotePoll) { is ContestedDocumentResourceVotePoll -> { val voteContenders = getVoteContenders( diff --git a/dpp/src/main/java/org/dashj/platform/sdk/platform/Names.kt b/dpp/src/main/java/org/dashj/platform/sdk/platform/Names.kt index 2693278..1cc893b 100644 --- a/dpp/src/main/java/org/dashj/platform/sdk/platform/Names.kt +++ b/dpp/src/main/java/org/dashj/platform/sdk/platform/Names.kt @@ -420,7 +420,7 @@ class Names(val platform: Platform) { count = nextList.size results.addAll(nextList) startAt = resources.list.lastOrNull()?.value - } while(count != 100) + } while(count == 100) return results } diff --git a/examples/src/main/kotlin/dashj/org/platform/AllContestedNames.kt b/examples/src/main/kotlin/dashj/org/platform/AllContestedNames.kt new file mode 100644 index 0000000..f362d98 --- /dev/null +++ b/examples/src/main/kotlin/dashj/org/platform/AllContestedNames.kt @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2024-present, Dash Core Group + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +package dashj.org.platform + +import com.google.common.base.Stopwatch +import org.dashj.platform.dapiclient.SystemIds +import org.dashj.platform.dpp.voting.ContestedDocumentResourceVotePoll +import org.dashj.platform.sdk.Client +import org.dashj.platform.sdk.client.ClientOptions +import org.dashj.platform.sdk.platform.Documents +import java.util.concurrent.TimeUnit + +/** + * ContestedNames - Display all of the currently contested usernames + */ +class AllContestedNames { + companion object { + lateinit var sdk: Client + + @JvmStatic + fun main(args: Array) { + sdk = Client(ClientOptions(network = args[0])) + sdk.platform.useValidNodes() + getDocuments() + } + + private fun getDocuments() { + val platform = sdk.platform + val watch = Stopwatch.createStarted() + + val names = platform.names.getAllContestedNames() + + println("${names.size} results returned in ${watch.elapsed(TimeUnit.MILLISECONDS)}") + names.forEach { + println(it) + } + } + } +} \ No newline at end of file diff --git a/examples/src/main/kotlin/dashj/org/platform/RegisteredNames.kt b/examples/src/main/kotlin/dashj/org/platform/RegisteredNames.kt index 3e93f18..28539e1 100644 --- a/examples/src/main/kotlin/dashj/org/platform/RegisteredNames.kt +++ b/examples/src/main/kotlin/dashj/org/platform/RegisteredNames.kt @@ -53,7 +53,7 @@ class RegisteredNames { lastItem = documents.last().id if (documents.size == 100) { queryOpts = DocumentQuery.Builder() - .startAfter(lastItem) + .startAt(lastItem) .orderBy("normalizedLabel") .limit(100) .build() diff --git a/examples/src/main/kotlin/dashj/org/platform/ShowContactRequests.kt b/examples/src/main/kotlin/dashj/org/platform/ShowContactRequests.kt index fa5a8fc..463336e 100644 --- a/examples/src/main/kotlin/dashj/org/platform/ShowContactRequests.kt +++ b/examples/src/main/kotlin/dashj/org/platform/ShowContactRequests.kt @@ -31,7 +31,7 @@ class ShowContactRequests { scanner.next() } - sdk = Client(ClientOptions(network = args[0])) + sdk = Client(ClientOptions(network)) sdk.platform.useValidNodes() if (!sdk.platform.hasApp("dashpay")) { println("$network does not support dashpay") @@ -101,6 +101,49 @@ class ShowContactRequests { println(e.message) } } while (requests == 0 || documents!!.size >= Documents.DOCUMENT_LIMIT) + + do { + println("query: ${queryOpts.toJSON()}") + var identityId = id + + try { + documents = if (id == "all") { + platform.documents.get(ContactRequests.CONTACTREQUEST_DOCUMENT, queryOpts) + } else { + // resolve name if possible + if (identityId.length != 44 && identityId.length != 43) { + val nameDocument = platform.names.resolve(id) + if (nameDocument != null) { + val records = nameDocument.data["records"] as MutableMap + identityId = Identifier.from(records["identity"]).toString() + } + } + ContactRequests(platform).get(identityId, true, 0L, false) + } + + requests += 1 + + for (doc in documents) { + val toUserId = doc.data["toUserId"] as Identifier + println("===================================================") + println("from: ${doc.ownerId} -> to: $toUserId") + println() + println("contactRequest: ${JSONObject(doc.toJSON())}") + } + + if (documents.isEmpty()) { + println("No identities found matching $id") + } + + startAt += Documents.DOCUMENT_LIMIT + if (documents.isNotEmpty()) { + queryOpts = DocumentQuery.Builder().startAfter(documents.last().id).build() + } + } catch (e: Exception) { + println("\nError retrieving results (startAt = $startAt)") + println(e.message) + } + } while (requests == 0 || documents!!.size >= Documents.DOCUMENT_LIMIT) } } } diff --git a/platform-mobile/src/config.rs b/platform-mobile/src/config.rs index f06af7f..6932fba 100644 --- a/platform-mobile/src/config.rs +++ b/platform-mobile/src/config.rs @@ -62,10 +62,9 @@ pub const TESTNET_ADDRESS_LIST: [&str; 20] = [ ]; -pub const MAINNET_ADDRESS_LIST: [&str; 150] = [ - "149.28.241.190", "216.238.75.46", "134.255.182.186", "66.245.196.52", "157.66.81.162", "213.199.34.250", "157.90.238.161", "5.182.33.231", "37.60.236.212", "207.244.247.40", "45.32.70.131", "158.220.122.76", "52.33.9.172", "185.158.107.124", "185.198.234.17", "93.190.140.101", "194.163.153.225", "194.146.13.7", "93.190.140.112", "65.108.74.95", "44.240.99.214", "5.75.133.148", "192.248.178.237", "95.179.159.65", "139.84.232.129", "37.60.243.119", "194.195.87.34", "46.254.241.7", "45.77.77.195", "65.108.246.145", "64.176.10.71", "158.247.247.241", "37.60.244.220", "2.58.82.231", "139.180.143.115", "185.198.234.54", "213.199.44.112", "37.27.67.154", "134.255.182.185", "86.107.168.28", "139.84.137.143", "173.212.239.124", "157.10.199.77", "5.189.186.78", "139.84.170.10", "173.249.53.139", "37.60.236.151", "37.27.67.159", "104.200.24.196", "37.60.236.225", "172.104.90.249", "57.128.212.163", "37.60.236.249", "158.220.122.74", "185.198.234.25", "134.255.183.250", "185.192.96.70", "134.255.183.248", "52.36.102.91", "134.255.183.247", "49.13.28.255", "168.119.102.10", "86.107.168.44", "49.13.237.193", "37.27.83.17", "134.255.182.187", "142.132.165.149", "193.203.15.209", "38.242.198.100", "192.175.127.198", "37.27.67.163", "198.7.115.43", "70.34.206.123", "163.172.20.205", "65.108.74.78", "108.61.165.170", "157.10.199.79", "31.220.88.116", "185.166.217.154", "37.27.67.164", "31.220.85.180", "161.97.170.251", "157.10.199.82", "91.107.226.241", "167.88.169.16", "216.238.99.9", "62.169.17.112", "52.10.213.198", "149.28.201.164", "198.7.115.38", "37.60.236.161", "49.13.193.251", "46.254.241.9", "65.108.74.75", "192.99.44.64", "95.179.241.182", "95.216.146.18", "185.194.216.84", "31.220.84.93", "185.197.250.227", "149.28.247.165", "86.107.168.29", "213.199.34.251", "108.160.135.149", "185.198.234.12", "87.228.24.64", "45.32.52.10", "91.107.204.136", "64.176.35.235", "167.179.90.255", "157.66.81.130", "157.10.199.125", "46.254.241.8", "49.12.102.105", "134.255.182.189", "81.17.101.141", "65.108.74.79", "64.23.134.67", "54.69.95.118", "158.220.122.13", "49.13.154.121", "75.119.149.9", "93.190.140.111", "93.190.140.114", "195.201.238.55", "135.181.110.216", "45.76.141.74", "65.21.145.147", "50.116.28.103", "188.245.90.255", "65.109.65.126", "188.208.196.183", "37.60.236.201", "95.179.139.125", "213.199.34.248", "213.199.35.18", "213.199.35.6", "37.60.243.59", "37.27.67.156", "37.60.236.247", "159.69.204.162", "46.254.241.11", "173.199.71.83", "185.215.166.126", "91.234.35.132", "157.66.81.218", "213.199.35.15", "114.132.172.215", "93.190.140.162", "65.108.74.109" +pub const MAINNET_ADDRESS_LIST: [&str; 124] = [ + "149.28.241.190", "216.238.75.46", "134.255.182.186", "109.199.122.22", "157.66.81.162", "213.199.34.250", "157.90.238.161", "5.182.33.231", "37.60.236.212", "207.244.247.40", "158.220.122.76", "52.33.9.172", "185.158.107.124", "185.198.234.17", "93.190.140.101", "194.163.153.225", "194.146.13.7", "93.190.140.112", "75.119.132.2", "44.240.99.214", "5.75.133.148", "192.248.178.237", "95.179.159.65", "139.84.232.129", "37.60.243.119", "194.195.87.34", "46.254.241.7", "161.97.160.92", "45.77.77.195", "65.108.246.145", "64.176.10.71", "37.60.244.220", "2.58.82.231", "185.198.234.54", "213.199.44.112", "134.255.182.185", "139.84.137.143", "173.212.239.124", "157.10.199.77", "5.189.186.78", "173.249.53.139", "37.60.236.151", "104.200.24.196", "37.60.236.225", "172.104.90.249", "57.128.212.163", "37.60.236.249", "158.220.122.74", "185.198.234.25", "134.255.183.250", "185.192.96.70", "134.255.183.248", "52.36.102.91", "161.97.160.87", "134.255.183.247", "49.13.28.255", "168.119.102.10", "49.13.237.193", "37.27.83.17", "134.255.182.187", "142.132.165.149", "38.242.198.100", "192.175.127.198", "198.7.115.43", "70.34.206.123", "108.61.165.170", "157.10.199.79", "31.220.88.116", "185.166.217.154", "161.97.170.251", "157.10.199.82", "91.107.226.241", "216.238.99.9", "62.169.17.112", "52.10.213.198", "198.7.115.38", "37.60.236.161", "49.13.193.251", "46.254.241.9", "185.215.167.70", "95.216.146.18", "185.194.216.84", "31.220.84.93", "185.197.250.227", "149.28.247.165", "213.199.34.251", "108.160.135.149", "185.198.234.12", "87.228.24.64", "45.32.52.10", "91.107.204.136", "157.66.81.130", "157.10.199.125", "46.254.241.8", "49.12.102.105", "134.255.182.189", "81.17.101.141", "64.23.134.67", "54.69.95.118", "158.220.122.13", "82.211.25.69", "93.190.140.111", "93.190.140.114", "195.201.238.55", "135.181.110.216", "109.199.123.11", "50.116.28.103", "188.245.90.255", "130.162.233.186", "65.109.65.126", "37.60.236.201", "95.179.139.125", "213.199.34.248", "213.199.35.18", "213.199.35.6", "37.60.243.59", "37.60.236.247", "159.69.204.162", "46.254.241.11", "173.199.71.83", "185.215.166.126", "157.66.81.218", "213.199.35.15", "93.190.140.162" ]; - #[ferment_macro::export] pub fn testnet_address_list() -> Vec { TESTNET_ADDRESS_LIST.iter().map(|&s| s.to_string()).collect() diff --git a/platform-mobile/src/fetch_document.rs b/platform-mobile/src/fetch_document.rs index ba22912..81add68 100644 --- a/platform-mobile/src/fetch_document.rs +++ b/platform-mobile/src/fetch_document.rs @@ -340,7 +340,8 @@ fn docs_get_all_query_sdk_test() { vec![], vec![OrderClause { field: "normalizedLabel".into(), ascending: true }], 100, - Some(StartPoint::StartAfter(docs.last().unwrap().id().to_vec())) + // TODO - use StartAfter instead + Some(StartPoint::StartAt(docs.last().unwrap().id().to_vec())) ) }; match docs_result2 { diff --git a/platform-mobile/src/voting.rs b/platform-mobile/src/voting.rs index d4f07d5..c41681d 100644 --- a/platform-mobile/src/voting.rs +++ b/platform-mobile/src/voting.rs @@ -349,7 +349,25 @@ fn get_vote_contenders_test() { let resources_result = get_vote_contenders( &mut sdk, "parentNameAndLabel".to_string(), - vec![Value::Text("dash".to_string()), Value::Text("test110".to_string())], + vec![Value::Text("dash".to_string()), Value::Text("fuzzyduck".to_string())], + "domain".to_string(), + contract_id + ); + match resources_result { + Ok(resources) => println!("contested resources = {:?}", resources), + Err(e) => panic!("error: {}", e) + } +} + +#[test] +fn get_vote_contenders_main_test() { + let mut sdk = create_dash_sdk_using_core_mainnet(); + tracing::warn!("sdk: {:?}", sdk.get_sdk()); + let contract_id = Identifier::from(dpns_contract::ID_BYTES); + let resources_result = get_vote_contenders( + &mut sdk, + "parentNameAndLabel".to_string(), + vec![Value::Text("dash".to_string()), Value::Text("fuzzyduck".to_string())], "domain".to_string(), contract_id );