getTransactionStatus
note
The getTransactionStatus
method is still a work-in-progress.
Clients will poll this to tell when the transaction has been completed.
- TODO: Figure out result/error and how that fits into the jsonrpc response object
- TODO: Figure out return values for non-contract-invocation transactions
Parameters
<hash>
- transaction hash to query, as a hex-encoded string
Returns
<object>
id
:<hash>
- hash of the transaction as a hex-encoded stringstatus
:<status>
- the current status of the transaction by hash, one of:- pending
- success
- error
results
:<object[]>
- (optional) Will be present on completed successful transactions.- xdr:
<xdr.ScVal
> - xdr-encoded return value of the contract call - TODO: Anything else we should include? Gas spent?
- xdr:
envelopeXdr
:<xdr.TransactionEnvelope>
- (optional) A base64 encoded string of the raw TransactionEnvelope XDR struct for this transaction.resultXdr
:<xdr.TransactionResult>
- (optional) A base64 encoded string of the raw TransactionResult XDR struct for this transaction.resultMetaXdr
:<xdr.TransactionResultMeta>
- (optional) A base64 encoded string of the raw TransactionResultMeta XDR struct for this transaction.error
:<object>
- (optional) Will be present on failed transactions.code
:<string>
- Short unique string representing the type of errormessage
:<string>
- Human friendly summary of the errordata
:<object>
- (optional) More data related to the error if available
Examples
Request
{
"jsonrpc": "2.0",
"id": 8675309,
"method": "getTransactionStatus",
"params": {
"hash": "97eb77da26e21d6a032fc0c311831d94a702ba336037da7c8a5ec51b3e39c485"
}
}
Response
Pending
{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"id": "d70916f8b8aa55c13d5974a38e32a3efe440ef6870c0f0a07075d1c128d23698",
"status": "pending"
}
}
Success
{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"id": "d70916f8b8aa55c13d5974a38e32a3efe440ef6870c0f0a07075d1c128d23698",
"status": "success",
"results": [
{
"xdr": "AAAAAQAAAAY="
}
]
}
}
Error
{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"id": "48dd243d4683745b7efa9f4fe6182f944b03cfd169135657e39c974e9b1fc50d",
"status": "error",
"error": {
"code": "tx_submission_failed",
"message": "Transaction submission failed",
"data": {
"envelope_xdr": "AAAAAgAAAAAdq+kGxmBG/ikQNdYHQ2fBAG+8Av/xp1ZfPZ9Xt42ragAAAGQAAoAp/////gAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAACgAAAAVoZWxsbwAAAAAAAAEAAAAHc29yb2JhbgAAAAAAAAAAAbeNq2oAAABAc6zcO/sTKyF26B1iJygLVrhhcVfK05rNW9gyeNwqSVeMFkHXpZ6D/6mqSB0KtvacxK4/VoiwWPrBQGPelnktBQ==",
"result_codes": {
"transaction": "tx_bad_seq"
},
"result_xdr": "AAAAAAAAAAD////7AAAAAA=="
}
}
}
}