Added minter address to block summary API results

This commit is contained in:
QuickMythril 2024-12-03 02:01:12 -05:00
parent 8bd293ccd5
commit e4c4507f6b

View File

@ -1,7 +1,13 @@
package org.qortal.data.block; package org.qortal.data.block;
import org.qortal.account.Account;
import org.qortal.repository.DataException;
import org.qortal.repository.Repository;
import org.qortal.repository.RepositoryManager;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import java.util.Arrays; import java.util.Arrays;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@ -103,6 +109,23 @@ public class BlockSummaryData {
this.minterLevel = minterLevel; this.minterLevel = minterLevel;
} }
@XmlElement(name = "minterAddress")
public String getMinterAddress() {
if (this.minterPublicKey == null) {
return "Unknown";
}
try (final Repository repository = RepositoryManager.getRepository()) {
return Account.getRewardShareMintingAddress(repository, this.minterPublicKey);
} catch (DataException e) {
// Log the exception as needed
return "Unknown";
}
}
@XmlElement(name = "minterLevel")
public Integer getMinterLevelXml() {
return this.getMinterLevel();
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {