Skip to content

Instantly share code, notes, and snippets.

@imylomylo
Last active May 14, 2019 14:07
Show Gist options
  • Save imylomylo/075ef3c5000de9abd924c3600ec1350f to your computer and use it in GitHub Desktop.
Save imylomylo/075ef3c5000de9abd924c3600ec1350f to your computer and use it in GitHub Desktop.
Token Orders RPC Response

tokencreate

TOKENNAME="TOKENA"
TOKENSUPPY=0.001
TOKENDESCRIPTION="short description token a"
curl -s --user $rpcuser:$rpcpassword --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", \"method\": \"tokencreate\", \"params\": [\"$TOKENNAME\", \"$TOKENSUPPLY\", \"$TOKENDESCRIPTION\"]}" -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

Response is a blockchain transaction id. This txid is re-used as the tokenid.

"ecd8b4ff52604997629d73c8797fa5b028295f918fbcc807bf2fb8536294f389"

tokeninfo

    curl -s --user $rpcuser:$rpcpassword --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", \"method\": \"tokeninfo\", \"params\": [\"$TOKENID\"]}" -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

Response is all about this tokenid.

{
  "result": "success",
  "tokenid": "ecd8b4ff52604997629d73c8797fa5b028295f918fbcc807bf2fb8536294f389",
  "owner": "024edf5c4b2d7d45c40bbad404ece9c470080d8d0c466a62b936bdf93cc1c01c15",
  "name": "TOKENA",
  "supply": 1000000,
  "description": "short description token a"
}

tokenorders

    curl -s --user $rpcuser:$rpcpassword --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", \"method\": \"tokenorders\", \"params\": [\"$TOKENID\"]}" -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

Response are all the order (b)uy and (s)ell offers for this tokenid. I am happy to buy 100 @ 0.0888 each and sell 1000 units at higher prices (0.09998 & 0.1111).

[
  {
    "funcid": "b",
    "txid": "2758b5324767acb7058b87b937bdd50c1744ca940d790faa7b507e0019b30521",
    "vout": 0,
    "amount": "8.88000000",
    "bidamount": "8.88000000",
    "origaddress": "RSefAPkRsd2JcQ4pkPHUzF4z3ExaDC1sJQ",
    "origtokenaddress": "RUK3ejSkNayJKYzANRzpC6yqxzaCMa6Hng",
    "tokenid": "ecd8b4ff52604997629d73c8797fa5b028295f918fbcc807bf2fb8536294f389",
    "totalrequired": 100,
    "price": "0.08880000"
  },
  {
    "funcid": "s",
    "txid": "5411ecabc8f36485ecb6ee02843321bdfcbb9f4bdc63050356987a91958ff75a",
    "vout": 0,
    "amount": "1000",
    "askamount": "1000",
    "origaddress": "RR2tjpFKaF36u4JesWG1vWjkgt2Wa448Qb",
    "origtokenaddress": "RBjnhNaqtSGym1PqpaQL3jY3XHgpH9qTRK",
    "tokenid": "ecd8b4ff52604997629d73c8797fa5b028295f918fbcc807bf2fb8536294f389",
    "totalrequired": "111.10000000",
    "price": "0.11110000"
  },
  {
    "funcid": "s",
    "txid": "28bcd2e68c9c4c0bc64ff31da6dd49402157ed8bc56a3d4088ba16d599e9aef3",
    "vout": 0,
    "amount": "1000",
    "askamount": "1000",
    "origaddress": "RR2tjpFKaF36u4JesWG1vWjkgt2Wa448Qb",
    "origtokenaddress": "RBjnhNaqtSGym1PqpaQL3jY3XHgpH9qTRK",
    "tokenid": "ecd8b4ff52604997629d73c8797fa5b028295f918fbcc807bf2fb8536294f389",
    "totalrequired": "99.98000000",
    "price": "0.09998000"
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment