Skip to content
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

Use TransactionInfo within GetTransactionResponse #251

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Jul 17, 2024

WARNING: This is a breaking API change; see Known limitations, below.

What

Use TransactionInfo (from the getTransactions() handler) as part of the getTransaction() handler.

Why

One is a subset of the other, and this makes it easier for both the code and documentation to reflect that.

It also guarantees that the endpoints don't diverge in the future.

This is partially related to #124, where I realized I was duplicating work by parsing out the transaction fields separately for each endpoint: this would make the work more streamlined.

Known limitations

According to the CI integration test runs, this breaks getTransaction's integration tests because createdAt is encoded as an int64 rather than a string in the schema for getTransactions. We need to change this for JavaScript which is a breaking API change.

@Shaptic Shaptic requested review from aditya1702, psheth9, 2opremio and a team and removed request for aditya1702 and psheth9 July 17, 2024 02:17
@Shaptic Shaptic added the breaking-change Breaking change tag label Jul 17, 2024
@Shaptic Shaptic changed the title Use TransactionInfo within GetTransactionResponse Breaking API change: Use TransactionInfo within GetTransactionResponse Jul 17, 2024
@Shaptic Shaptic changed the base branch from main to v22-breaking-changes July 17, 2024 16:15
@Shaptic Shaptic changed the title Breaking API change: Use TransactionInfo within GetTransactionResponse Use TransactionInfo within GetTransactionResponse Jul 17, 2024
Copy link
Contributor

@psheth9 psheth9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner !! just one comment on removing the status field

@@ -29,8 +29,6 @@ const (

// GetTransactionResponse is the response for the Soroban-RPC getTransaction() endpoint
type GetTransactionResponse struct {
// Status is one of: TransactionSuccess, TransactionNotFound, or TransactionFailed.
Status string `json:"status"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could still keep the Status field to show what actually happened with Txn. Any strong motive to remove this field? or is it rarely used by users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it's still part of TransactionInfo. It can take on one additional value (TransactionNotFound) for this endpoint, but since it's a string regardless this doesn't impact the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Breaking change tag
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants