From https://github.com/markdalgleish/stellar.js