-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update LedgerResponse
and AccountResponse
, remove outdated fields, and add missing fields.
#549
Merged
overcat
merged 5 commits into
lightsail-network:master
from
overcat-deprecation:horizon-model
Oct 21, 2023
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
223 changes: 44 additions & 179 deletions
223
src/main/java/org/stellar/sdk/responses/LedgerResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,228 +1,93 @@ | ||
package org.stellar.sdk.responses; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
|
||
/** | ||
* Represents ledger response. | ||
* | ||
* @see <a href="https://developers.stellar.org/docs/glossary/ledger/" target="_blank">Ledger | ||
* documentation</a> | ||
* @see <a | ||
* href="https://developers.stellar.org/docs/fundamentals-and-concepts/stellar-data-structures/ledgers" | ||
* target="_blank">Ledger documentation</a> | ||
* @see <a href="https://developers.stellar.org/api/horizon/resources/ledgers/object/" | ||
* target="_blank">Horizon API</a> | ||
* @see org.stellar.sdk.requests.LedgersRequestBuilder | ||
* @see org.stellar.sdk.Server#ledgers() | ||
*/ | ||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LedgerResponse extends Response implements Pageable { | ||
@SerializedName("sequence") | ||
private final Long sequence; | ||
|
||
@SerializedName("hash") | ||
private final String hash; | ||
@SerializedName("id") | ||
String id; | ||
|
||
@SerializedName("paging_token") | ||
private final String pagingToken; | ||
String pagingToken; | ||
|
||
@SerializedName("hash") | ||
String hash; | ||
|
||
@SerializedName("prev_hash") | ||
private final String prevHash; | ||
String prevHash; | ||
|
||
@SerializedName("transaction_count") | ||
private final Integer transactionCount; | ||
@SerializedName("sequence") | ||
Long sequence; | ||
|
||
@SerializedName("successful_transaction_count") | ||
private final Integer successfulTransactionCount; | ||
Integer successfulTransactionCount; | ||
|
||
@SerializedName("failed_transaction_count") | ||
private final Integer failedTransactionCount; | ||
Integer failedTransactionCount; | ||
|
||
@SerializedName("operation_count") | ||
private final Integer operationCount; | ||
Integer operationCount; | ||
|
||
@SerializedName("tx_set_operation_count") | ||
Integer txSetOperationCount; | ||
|
||
@SerializedName("closed_at") | ||
private final String closedAt; | ||
String closedAt; | ||
|
||
@SerializedName("total_coins") | ||
private final String totalCoins; | ||
String totalCoins; | ||
|
||
@SerializedName("fee_pool") | ||
private final String feePool; | ||
|
||
@SerializedName("base_fee") | ||
private final Long baseFee; | ||
|
||
@SerializedName("base_reserve") | ||
private final String baseReserve; | ||
String feePool; | ||
|
||
@SerializedName("base_fee_in_stroops") | ||
private final String baseFeeInStroops; | ||
String baseFeeInStroops; | ||
|
||
@SerializedName("base_reserve_in_stroops") | ||
private final String baseReserveInStroops; | ||
String baseReserveInStroops; | ||
|
||
@SerializedName("max_tx_set_size") | ||
private final Integer maxTxSetSize; | ||
Integer maxTxSetSize; | ||
|
||
@SerializedName("protocol_version") | ||
private final Integer protocolVersion; | ||
Integer protocolVersion; | ||
|
||
@SerializedName("header_xdr") | ||
private final String headerXdr; | ||
String headerXdr; | ||
|
||
@SerializedName("_links") | ||
private final Links links; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome! |
||
|
||
LedgerResponse( | ||
Long sequence, | ||
String hash, | ||
String pagingToken, | ||
String prevHash, | ||
Integer transactionCount, | ||
Integer successfulTransactionCount, | ||
Integer failedTransactionCount, | ||
Integer operationCount, | ||
String closedAt, | ||
String totalCoins, | ||
String feePool, | ||
Long baseFee, | ||
String baseReserve, | ||
String baseFeeInStroops, | ||
String baseReserveInStroops, | ||
Integer maxTxSetSize, | ||
Integer protocolVersion, | ||
String headerXdr, | ||
Links links) { | ||
this.sequence = sequence; | ||
this.hash = hash; | ||
this.pagingToken = pagingToken; | ||
this.prevHash = prevHash; | ||
this.transactionCount = transactionCount; | ||
this.successfulTransactionCount = successfulTransactionCount; | ||
this.failedTransactionCount = failedTransactionCount; | ||
this.operationCount = operationCount; | ||
this.closedAt = closedAt; | ||
this.totalCoins = totalCoins; | ||
this.feePool = feePool; | ||
this.baseFee = baseFee; | ||
this.baseFeeInStroops = baseFeeInStroops; | ||
this.baseReserve = baseReserve; | ||
this.baseReserveInStroops = baseReserveInStroops; | ||
this.maxTxSetSize = maxTxSetSize; | ||
this.protocolVersion = protocolVersion; | ||
this.headerXdr = headerXdr; | ||
this.links = links; | ||
} | ||
|
||
public Long getSequence() { | ||
return sequence; | ||
} | ||
|
||
public String getHash() { | ||
return hash; | ||
} | ||
|
||
public String getPagingToken() { | ||
return pagingToken; | ||
} | ||
|
||
public String getPrevHash() { | ||
return prevHash; | ||
} | ||
|
||
/** | ||
* @deprecated Will be removed in Horizon 0.17.0 | ||
*/ | ||
public Integer getTransactionCount() { | ||
return transactionCount; | ||
} | ||
|
||
public Integer getSuccessfulTransactionCount() { | ||
return successfulTransactionCount; | ||
} | ||
|
||
public Integer getFailedTransactionCount() { | ||
return failedTransactionCount; | ||
} | ||
|
||
public Integer getOperationCount() { | ||
return operationCount; | ||
} | ||
|
||
public String getClosedAt() { | ||
return closedAt; | ||
} | ||
|
||
public String getTotalCoins() { | ||
return totalCoins; | ||
} | ||
|
||
public String getFeePool() { | ||
return feePool; | ||
} | ||
|
||
public Long getBaseFee() { | ||
return baseFee; | ||
} | ||
|
||
public String getBaseReserve() { | ||
return baseReserve; | ||
} | ||
|
||
public String getBaseFeeInStroops() { | ||
return baseFeeInStroops; | ||
} | ||
|
||
public String getBaseReserveInStroops() { | ||
return baseReserveInStroops; | ||
} | ||
|
||
public Integer getMaxTxSetSize() { | ||
return maxTxSetSize; | ||
} | ||
|
||
public Integer getProtocolVersion() { | ||
return protocolVersion; | ||
} | ||
|
||
public String getHeaderXdr() { | ||
return headerXdr; | ||
} | ||
|
||
public Links getLinks() { | ||
return links; | ||
} | ||
Links links; | ||
|
||
/** Links connected to ledger. */ | ||
@Value | ||
public static class Links { | ||
@SerializedName("effects") | ||
private final Link effects; | ||
@SerializedName("self") | ||
Link self; | ||
|
||
@SerializedName("transactions") | ||
Link transactions; | ||
|
||
@SerializedName("operations") | ||
private final Link operations; | ||
Link operations; | ||
|
||
@SerializedName("self") | ||
private final Link self; | ||
@SerializedName("payments") | ||
Link payments; | ||
|
||
@SerializedName("transactions") | ||
private final Link transactions; | ||
|
||
Links(Link effects, Link operations, Link self, Link transactions) { | ||
this.effects = effects; | ||
this.operations = operations; | ||
this.self = self; | ||
this.transactions = transactions; | ||
} | ||
|
||
public Link getEffects() { | ||
return effects; | ||
} | ||
|
||
public Link getOperations() { | ||
return operations; | ||
} | ||
|
||
public Link getSelf() { | ||
return self; | ||
} | ||
|
||
public Link getTransactions() { | ||
return transactions; | ||
} | ||
@SerializedName("effects") | ||
Link effects; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consideration, add reference to https://developers.stellar.org/docs/fundamentals-and-concepts/stellar-data-structures/accounts to the
AccountResponse
class docs, noticed you added similar link forLedgerResponse
, that content looks great!Also, do you feel it's worthwhile to refactor
AccountResponse
to use lombok also, noticed you included that refactoring on pr forLedgerResponse
, understand if not, as it's not related to the change scope.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
I did not refactor AccountResponse using Lombok because it would cause breaking changes. I think I will have a separate PR later to use Lombok to rewrite all the code.