Skip to content

Commit

Permalink
Fix missing in AccountResponse class.
Browse files Browse the repository at this point in the history
  • Loading branch information
lijamie98 committed Aug 5, 2022
1 parent 7ad758b commit 58126e6
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ As this project is pre 1.0, breaking changes may happen for minor version bumps.

## Pending

## 0.37.0

* Fix missing `auth_clawback_enabled` field in AccountResponse class. ([#449](https://github.com/stellar/java-stellar-sdk/pull/449))

## 0.36.0

* Fix bug in `KeyPair.fromSecretSeed(char[] seed)`. ([#447](https://github.com/stellar/java-stellar-sdk/pull/447))
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

sourceCompatibility = JavaVersion.VERSION_1_8.toString()
version = '0.36.0'
version = '0.37.0'
group = 'stellar'
jar.enabled = false

Expand Down
105 changes: 82 additions & 23 deletions src/main/java/org/stellar/sdk/responses/AccountResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,61 @@

/**
* Represents account response.
* @see <a href="https://developers.stellar.org/api/resources/accounts/" target="_blank">Account documentation</a>
*
* @see <a href="https://developers.stellar.org/api/resources/accounts/" target="_blank">Account
* documentation</a>
* @see org.stellar.sdk.requests.AccountsRequestBuilder
* @see org.stellar.sdk.Server#accounts()
*/
public class AccountResponse extends Response implements org.stellar.sdk.TransactionBuilderAccount {
@SerializedName("account_id")
private String accountId;

@SerializedName("sequence")
private Long sequenceNumber;

@SerializedName("subentry_count")
private Integer subentryCount;

@SerializedName("sequence_ledger")
private Long sequenceUpdatedAtLedger;

@SerializedName("sequence_time")
private Long sequenceUpdatedAtTime;

@SerializedName("inflation_destination")
private String inflationDestination;

@SerializedName("home_domain")
private String homeDomain;

@SerializedName("last_modified_ledger")
private Integer lastModifiedLedger;

@SerializedName("thresholds")
private Thresholds thresholds;

@SerializedName("flags")
private Flags flags;

@SerializedName("balances")
private Balance[] balances;

@SerializedName("signers")
private Signer[] signers;

@SerializedName("data")
private Data data;

@SerializedName("_links")
private Links links;

@SerializedName("num_sponsoring")
private Integer numSponsoring;

@SerializedName("num_sponsored")
private Integer numSponsored;

@SerializedName("sponsor")
private String sponsor;

Expand Down Expand Up @@ -80,7 +98,7 @@ public Long getSequenceNumber() {

@Override
public void setSequenceNumber(long seqNum) {
sequenceNumber = seqNum;
sequenceNumber = seqNum;
}

@Override
Expand Down Expand Up @@ -149,14 +167,14 @@ public Optional<String> getSponsor() {
return Optional.fromNullable(this.sponsor);
}

/**
* Represents account thresholds.
*/
/** Represents account thresholds. */
public static class Thresholds {
@SerializedName("low_threshold")
private final int lowThreshold;

@SerializedName("med_threshold")
private final int medThreshold;

@SerializedName("high_threshold")
private final int highThreshold;

Expand All @@ -179,21 +197,33 @@ public int getHighThreshold() {
}
}

/**
* Represents account flags.
*/
/** Represents account flags. */
public static class Flags {
@SerializedName("auth_required")
private final boolean authRequired;

@SerializedName("auth_revocable")
private final boolean authRevocable;

@SerializedName("auth_immutable")
private final boolean authImmutable;

@SerializedName("auth_clawback_enabled")
private final boolean authClawbackEnabled;

public Flags(boolean authRequired, boolean authRevocable, boolean authImmutable) {
this(authRequired, authRevocable, authImmutable, false);
}

public Flags(
boolean authRequired,
boolean authRevocable,
boolean authImmutable,
boolean authClawbackEnabled) {
this.authRequired = authRequired;
this.authRevocable = authRevocable;
this.authImmutable = authImmutable;
this.authClawbackEnabled = authClawbackEnabled;
}

public boolean getAuthRequired() {
Expand All @@ -207,46 +237,72 @@ public boolean getAuthRevocable() {
public boolean getAuthImmutable() {
return authImmutable;
}

public boolean getAuthClawbackEnabled() {
return authClawbackEnabled;
}
}

/**
* Represents account balance.
*/
/** Represents account balance. */
public static class Balance {
@SerializedName("asset_type")
private final String assetType;

@SerializedName("asset_code")
private String assetCode;

@SerializedName("asset_issuer")
private String assetIssuer;

@SerializedName("liquidity_pool_id")
private LiquidityPoolID liquidityPoolID;

@SerializedName("limit")
private final String limit;

@SerializedName("balance")
private final String balance;

@SerializedName("buying_liabilities")
private final String buyingLiabilities;

@SerializedName("selling_liabilities")
private final String sellingLiabilities;

@SerializedName("is_authorized")
private final Boolean isAuthorized;

@SerializedName("is_authorized_to_maintain_liabilities")
private final Boolean isAuthorizedToMaintainLiabilities;

@SerializedName("last_modified_ledger")
private final Integer lastModifiedLedger;

@SerializedName("sponsor")
private String sponsor;

public Balance(String assetType, String assetCode, String assetIssuer, LiquidityPoolID liquidityPoolID, String balance, String limit, String buyingLiabilities, String sellingLiabilities, Boolean isAuthorized, Boolean isAuthorizedToMaintainLiabilities, Integer lastModifiedLedger, String sponsor) {
public Balance(
String assetType,
String assetCode,
String assetIssuer,
LiquidityPoolID liquidityPoolID,
String balance,
String limit,
String buyingLiabilities,
String sellingLiabilities,
Boolean isAuthorized,
Boolean isAuthorizedToMaintainLiabilities,
Integer lastModifiedLedger,
String sponsor) {
this.assetType = checkNotNull(assetType, "assertType cannot be null");
this.balance = checkNotNull(balance, "balance cannot be null");
this.limit = limit;
this.assetCode = assetCode;
this.assetIssuer = assetIssuer;
this.liquidityPoolID = liquidityPoolID;
this.buyingLiabilities = checkNotNull(buyingLiabilities, "buyingLiabilities cannot be null");
this.sellingLiabilities = checkNotNull(sellingLiabilities, "sellingLiabilities cannot be null");
this.sellingLiabilities =
checkNotNull(sellingLiabilities, "sellingLiabilities cannot be null");
this.isAuthorized = isAuthorized;
this.isAuthorizedToMaintainLiabilities = isAuthorizedToMaintainLiabilities;
this.lastModifiedLedger = lastModifiedLedger;
Expand Down Expand Up @@ -311,16 +367,17 @@ public Optional<String> getSponsor() {
}
}

/**
* Represents account signers.
*/
/** Represents account signers. */
public static class Signer {
@SerializedName("key")
private final String key;

@SerializedName("type")
private final String type;

@SerializedName("weight")
private final int weight;

@SerializedName("sponsor")
private String sponsor;

Expand Down Expand Up @@ -361,17 +418,16 @@ public Links getLinks() {
return links;
}

/**
* Data connected to account.
*/
public static class Data extends HashMap<String,String> {
/** Data connected to account. */
public static class Data extends HashMap<String, String> {
@Override
public int size() {
return super.size();
}

/**
* Gets base64-encoded value for a given key.
*
* @param key Data entry name
* @return base64-encoded value
*/
Expand All @@ -381,6 +437,7 @@ public String get(String key) {

/**
* Gets raw value for a given key.
*
* @param key Data entry name
* @return raw value
*/
Expand All @@ -390,18 +447,20 @@ public byte[] getDecoded(String key) {
}
}

/**
* Links connected to account.
*/
/** Links connected to account. */
public static class Links {
@SerializedName("effects")
private final Link effects;

@SerializedName("offers")
private final Link offers;

@SerializedName("operations")
private final Link operations;

@SerializedName("self")
private final Link self;

@SerializedName("transactions")
private final Link transactions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ public void testDeserializeLiquidityPoolBalanc() {
" \"flags\": {\n" +
" \"auth_required\": false,\n" +
" \"auth_revocable\": true,\n" +
" \"auth_immutable\": true\n" +
" \"auth_immutable\": true,\n" +
" \"auth_clawback_enabled\": true\n" +
" },\n" +
" \"balances\": [\n" +
" {\n" +
Expand Down

0 comments on commit 58126e6

Please sign in to comment.