Skip to content
Turns Stellar Horizon responses into meaningful descriptions (bundle)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

tx-result / ReadmeContributingChangelog


Licence Dependencies Vulnerabilities Bundle Downloads

Turns Stellar Horizon responses into meaningful descriptions.

(Weekly updates: Reddit, Twitter, Keybase, Telegram)


After posting a transaction to the network, most software needs to display comprehensive feedback to the user. This is especially true when an error happens.

This library produces human-readable descriptions for any possible code Stellar Core returns:

const response = await server.submitTransaction(transaction)
const result = new TxResult(response)

Result for successful transactions:

 validated: true,
 title: "The transaction has been validated",
 hash: "d89c...007e",
 ledger: 370369,
 offerResults: undefined,
 link: ""

Note: offerResults is as described in StellarSdk [server.submitTransaction()]( documentation.

Result for failed transactions:

 validated: false,
 title: "The transaction has been rejected",
 errors: [
   "Operation 1: The destination account doesn't exist.",
   "Operation 3: The source does not have enough funds."



  • NPM: npm install @cosmic-plus/tx-result
  • Yarn: yarn add @cosmic-plus/tx-result

In your script: const txResult = require("@cosmic-plus/tx-result")


bower install cosmic-plus-tx-result

In your HTML page:

<script src="./bower_components/cosmic-plus-tx-result/tx-result.js"></script>


In your HTML page:

<script src=""></script>

Note: For production release it is advised to serve your copy of the library.



new TxResult(txResponse)

The TxResult constructor.

Param Type Description
txResponse Object A response returned by StellarSdk server.submitTransaction().

await TxResult.fromPromise(promise) ⇒ TxResult

Returns the TxResult for an unresolved StellarSdk server.submitTransaction() Promise.

Param Type Description
promise Promise An unresolved Horizon response.

TxResult.describeTxCode(code) ⇒ String

Returns a comprehensive description for transaction return code.

See: Transaction possible errors

Param Type Description
code String A Stellar transaction return code.

TxResult.describeOpCode(code) ⇒ String

Returns a comprehensive description for operation return code.

See: Operations possible errors

Param Type Description
code String A Stellar operation return code.

await TxResult.forCosmicLink(cosmicLink) ⇒ TxResult

Submits cosmicLink using cosmicLink.send() then returns its TxResult. The advantage of using this function is that it generates reports for callbacks and StellarGuard submission as well.

Param Type Description
cosmicLink CosmicLink A .lock()ed cosmicLink


Organization: | @GitHub | @NPM

Follow: Reddit | Twitter | Medium | Codepen

Talk: Telegram | Keybase

You can’t perform that action at this time.