Skip to content

Instantly share code, notes, and snippets.

@irisli
Created September 4, 2014 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irisli/93776ef9c8c6145ba8b9 to your computer and use it in GitHub Desktop.
Save irisli/93776ef9c8c6145ba8b9 to your computer and use it in GitHub Desktop.
Detects which characters are valid in Stellar.
// Ways to use this:
// node stellarCurrencyDetector.js | sh
// node stellarCurrencyDetector.js | sh > stellarCurrencyDetectorOutput.txt
// Test results can be seen here: https://www.stellar.org/viewer/#test/gHQbh2U1CzPo4kH93CCmL5oxK79SqcT7mm
var hexes = [];
for (var i = 0; i <= 255; i++) {
hexes.push(i.toString(16).toUpperCase());
}
for (var i = 0; i < hexes.length; i++) {
console.log(
'curl -X POST https://test.stellar.org:9002 -d \'\n' +
'{\n' +
' "method": "submit",\n' +
' "params": [\n' +
' {\n' +
' "secret": "secretXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",\n' +
' "tx_json": {\n' +
' "TransactionType": "TrustSet",\n' +
' "Account": "gAccountXXXXXXXXXXXXXXXXXXXXXXXXXX",\n' +
' "LimitAmount": {\n' +
' "currency": "000000000000000000000000' + hexes[i] + hexes[i] + hexes[i] + '0000000000",\n' +
' "value": "10",\n' +
' "issuer": "gIssuerXXXXXXXXXXXXXXXXXXXXXXXXXXX"\n' +
' }\n' +
' }\n' +
' }\n' +
' ]\n' +
'}\';'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment