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

getTransactions: Change TxInfo Status to string #187

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cmd/soroban-rpc/internal/methods/get_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func (req GetTransactionsRequest) isValid(maxLimit uint, ledgerRange ledgerbucke
}

type TransactionInfo struct {
// Successful indicates whether the transaction was successful or not
Successful bool `json:"status"`
// Status is one of: TransactionSuccess, TransactionFailed.
Status string `json:"status"`
// ApplicationOrder is the index of the transaction among all the transactions
// for that ledger.
ApplicationOrder int32 `json:"applicationOrder"`
Expand Down Expand Up @@ -198,7 +198,6 @@ LedgerLoop:
}

txInfo := TransactionInfo{
Successful: tx.Successful,
ApplicationOrder: tx.ApplicationOrder,
FeeBump: tx.FeeBump,
ResultXdr: base64.StdEncoding.EncodeToString(tx.Result),
Expand All @@ -208,6 +207,11 @@ LedgerLoop:
Ledger: tx.Ledger.Sequence,
LedgerCloseTime: tx.Ledger.CloseTime,
}
txInfo.Status = TransactionStatusFailed
if tx.Successful {
txInfo.Status = TransactionStatusSuccess
}

txns = append(txns, txInfo)
if len(txns) >= int(limit) {
break LedgerLoop
Expand Down
Loading