forked from Qortal/qortal
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7c4b0bd7f2
@ -20,10 +20,7 @@ import org.qortal.asset.Asset;
|
||||
import org.qortal.controller.LiteNode;
|
||||
import org.qortal.controller.OnlineAccountsManager;
|
||||
import org.qortal.crypto.Crypto;
|
||||
import org.qortal.data.account.AccountData;
|
||||
import org.qortal.data.account.AccountPenaltyData;
|
||||
import org.qortal.data.account.RewardShareData;
|
||||
import org.qortal.data.account.SponsorshipReport;
|
||||
import org.qortal.data.account.*;
|
||||
import org.qortal.data.network.OnlineAccountData;
|
||||
import org.qortal.data.network.OnlineAccountLevel;
|
||||
import org.qortal.data.transaction.PublicizeTransactionData;
|
||||
@ -668,7 +665,7 @@ public class AddressesResource {
|
||||
description = "Returns sponsorship statistics for an account's sponsor",
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "the statistics",
|
||||
description = "statistics",
|
||||
content = @Content(mediaType = MediaType.APPLICATION_JSON, array = @ArraySchema(schema = @Schema(implementation = SponsorshipReport.class)))
|
||||
)
|
||||
}
|
||||
@ -698,4 +695,31 @@ public class AddressesResource {
|
||||
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/levels/{minLevel}")
|
||||
@Operation(
|
||||
summary = "Return accounts with levels greater than or equal to input",
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "online accounts",
|
||||
content = @Content(mediaType = MediaType.APPLICATION_JSON, array = @ArraySchema(schema = @Schema(implementation = AddressLevelPairing.class)))
|
||||
)
|
||||
}
|
||||
)
|
||||
@ApiErrors({ApiError.REPOSITORY_ISSUE})
|
||||
|
||||
public List<AddressLevelPairing> getAddressLevelPairings(@PathParam("minLevel") int minLevel) {
|
||||
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
|
||||
// get the level address pairings
|
||||
List<AddressLevelPairing> pairings = repository.getAccountRepository().getAddressLevelPairings(minLevel);
|
||||
|
||||
return pairings;
|
||||
} catch (DataException e) {
|
||||
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE, e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.qortal.data.account;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import java.util.Arrays;
|
||||
|
||||
// All properties to be converted to JSON via JAXB
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class AddressLevelPairing {
|
||||
|
||||
private String address;
|
||||
|
||||
private int level;
|
||||
|
||||
// Constructors
|
||||
|
||||
// For JAXB
|
||||
protected AddressLevelPairing() {
|
||||
}
|
||||
|
||||
public AddressLevelPairing(String address, int level) {
|
||||
this.address = address;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
// Getters / setters
|
||||
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SponsorshipReport{" +
|
||||
"address='" + address + '\'' +
|
||||
", level=" + level +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -165,7 +165,9 @@ public interface AccountRepository {
|
||||
*/
|
||||
public Optional<String> getSponsor(String address) throws DataException;
|
||||
|
||||
/** How to order results when fetching asset balances. */
|
||||
public List<AddressLevelPairing> getAddressLevelPairings(int minLevel) throws DataException;
|
||||
|
||||
/** How to order results when fetching asset balances. */
|
||||
public enum BalanceOrdering {
|
||||
/** assetID first, then balance, then account address */
|
||||
ASSET_BALANCE_ACCOUNT,
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.qortal.repository.hsqldb;
|
||||
|
||||
import cash.z.wallet.sdk.rpc.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.qortal.asset.Asset;
|
||||
|
Loading…
Reference in New Issue
Block a user