getTransactions returns envelopeJson and resultMetaJson swapped when using xdrFormat=json
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 72/100
Research direction
Start in cmd/stellar-rpc/internal/methods/get_transactions.go at the ResultJSON, ResultMetaJSON, and EnvelopeJSON assignments, then compare them with get_transaction.go. Reproduce the issue with the provided getTransactions and getTransaction curl requests and verify that envelopeJson contains the envelope while resultMetaJson contains the result metadata.
Written by the indexing model from the issue text.
Description
What version are you using?
stellar-rpc 25.0.1 (testnet), also confirmed on HEAD of main.
What did you do?
When calling getTransactions with "xdrFormat": "json", the envelopeJson and resultMetaJson fields are swapped compared to getTransaction (singular).
To reproduce on testnet, pick any recent ledger that contains a transaction and compare the two endpoints. For example:
Step 1: Find a transaction via getTransactions:
curl -s -X POST https://soroban-testnet.stellar.org \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransactions",
"params": {
"startLedger": 1412570,
"xdrFormat": "json",
"pagination": {"limit": 1}
}
}'
Note the txHash in the response, then query the same transaction via getTransaction:
Step 2: Get the same transaction via getTransaction:
curl -s -X POST https://soroban-testnet.stellar.org \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransaction",
"params": {
"hash": "<txHash from step 1>",
"xdrFormat": "json"
}
}'
Step 3: Compare the top-level keys of envelopeJson and resultMetaJson between the two responses.
What did you expect to see?
Both endpoints should return the same data in the same fields. Specifically, envelopeJson should contain the transaction envelope (a TransactionEnvelope with keys like tx, tx_fee_bump, etc.) and resultMetaJson should contain the transaction result metadata (a TransactionMeta with keys like v4, tx_changes_before, operations, etc.).
What did you see instead?
The fields are swapped in getTransactions:
| Field | getTransaction (correct) |
getTransactions (incorrect) |
|---|---|---|
envelopeJson |
Envelope (tx_fee_bump, ...) |
ResultMeta (v4, ...) |
resultMetaJson |
ResultMeta (v4, ...) |
Envelope (tx_fee_bump, ...) |
resultJson |
Result (correct) | Result (correct) |
The root cause is in cmd/stellar-rpc/internal/methods/get_transactions.go lines 153-155:
txInfo.ResultJSON = result
txInfo.ResultMetaJSON = envelope // BUG: should be EnvelopeJSON
txInfo.EnvelopeJSON = meta // BUG: should be ResultMetaJSON
The correct assignments (as seen in get_transaction.go lines 100-102) should be:
txInfo.ResultJSON = result
txInfo.EnvelopeJSON = envelope
txInfo.ResultMetaJSON = meta
- Dominant language
- Go
- Stars
- 59
- Forks
- 77
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 32
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-rpc
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stellar/stellar-rpc#994 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
stellar/stellar-rpc#988 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
stellar/stellar-rpc#919 · 1 comment ·
-
good first issue rpc-sdk-scrum
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
stellar/stellar-rpc#477 · 5 comments · 2 reactions ·
-
rpc-full-history rpc-sdk-scrum
stellar/stellar-rpc#1025 · 1 comment · 1 assignee ·
All issues in stellar/stellar-rpc
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100