Giter VIP home page Giter VIP logo

sologenic-api's Introduction

Sologenic API

A JSON-RPC server providing set of API methods to be used by exchanges for fast & easy SOLO currency integration. Supposed to be run in private isolated network.

Configuration

Use environment variables for configuration.

JSON_RPC_ENDPOINT โ€“ rippled server URL (for testnet use https://s.altnet.rippletest.net:51234). APP_PORT โ€“ server port (8080 by default).

You can pass TESTNET=true to automatically configure server to use testnet.

Run the server

There are 3 ways you can run the server.

Using Docker:

docker run -it -p 8080:8080 -e TESTNET=true sologenic/sologenic-api

docker-compose (by default runs in testnet):

docker-compose up -d

Using locally installed Node.js:

git clone [email protected]:sologenic/sologenic-api.git
cd sologenic-api
npm i && TESTNET=true node index.js

API reference

get_balance

Returns XRP and SOLO balance of an address.

curl -H "Content-Type: application/json" -X POST \
     -d '{ "method": "get_balance", "params": { "address": "rLPA9rWx4WF3JJWN2QnrZE1fkahptc9Jn8" } }' \
     http://localhost:8080
{
   "result":{
      "xrp":"999.999768",
      "solo":"4905.7437"
   }
}

generate_address

Returns new address and secret generated offline.

curl -H "Content-Type: application/json" -X POST \
     -d '{ "method": "generate_address", "params": {} }' \
     http://localhost:8080
{
   "result":{
      "address":"r9zkrS5HKSYgpNVE1Gs9Gv5736DEUvik5v",
      "secret":"snra7wtNULsjdSwnGRS2uMXGGKi1q"
   }
}

get_transaction

Returns transaction details.

Returns null if transaction currency isn't SOLO.

curl -H "Content-Type: application/json" -X POST \
     -d '{ "method": "get_transaction", "params": { "id": "4A34D30DB25D6BF02F80CC714AD12F236DE4D2AA9B222FC6BF44780EE4364200" } }' \
     http://localhost:8080
{
   "result":{
      "id":"4A34D30DB25D6BF02F80CC714AD12F236DE4D2AA9B222FC6BF44780EE4364200",
      "confirmations":37,
      "time":1580390510,
      "ledger":4194290,
      "amount":"300.89",
      "sender":"rLPA9rWx4WF3JJWN2QnrZE1fkahptc9Jn8",
      "recipient":"rnuBmbM6tVv6R5FXYGr7cCgPoXKQBzMCBK?dt=7399"
   }
}

get_transactions

Returns transactions belonging to an address (both incoming and outgoing).

You may specify minimum_ledger and maximum_ledger (both inclusive). If specified only transactions from these ledgers will be returned.

You can use this feature to paginate transactions.

By default if minimum_ledger and maximum_ledger are not specified API method returns transactions for past 1000 ledgers.

curl -H "Content-Type: application/json" -X POST \
     -d '{ "method": "get_transactions", "params": { "address": "rnuBmbM6tVv6R5FXYGr7cCgPoXKQBzMCBK" } }' \
     http://localhost:8080
{
   "result":{
      "transactions":[
         {
            "id":"431C405A107BFDA7251386055A9A31C1C2370F2FF2FF15E0F710F09BDDF29E5A",
            "confirmations":17,
            "time":1580390952,
            "ledger":4194437,
            "amount":"30.33",
            "sender":"rLPA9rWx4WF3JJWN2QnrZE1fkahptc9Jn8",
            "recipient":"rnuBmbM6tVv6R5FXYGr7cCgPoXKQBzMCBK?dt=766"
         },
         {
            "id":"4A34D30DB25D6BF02F80CC714AD12F236DE4D2AA9B222FC6BF44780EE4364200",
            "confirmations":164,
            "time":1580390510,
            "ledger":4194290,
            "amount":"300.89",
            "sender":"rLPA9rWx4WF3JJWN2QnrZE1fkahptc9Jn8",
            "recipient":"rnuBmbM6tVv6R5FXYGr7cCgPoXKQBzMCBK?dt=7399"
         }
      ],
      "minimum_ledger":4193455,
      "maximum_ledger":4194454
   }
}

send_transaction

Creates, signs and broadcasts SOLO transaction to network.

curl -H "Content-Type: application/json" -X POST \
     -d '{ "method": "send_transaction", "params": { "sender_address": "rLPA9rWx4WF3JJWN2QnrZE1fkahptc9Jn8",
                                                     "sender_secret": "SECRET",
                                                     "recipient_address": "rnuBmbM6tVv6R5FXYGr7cCgPoXKQBzMCBK?dt=7399",
                                                     "amount": "300.89" } }' \
     http://localhost:8080
{
   "result":"4A34D30DB25D6BF02F80CC714AD12F236DE4D2AA9B222FC6BF44780EE4364200"
}

get_status

Returns various status information (currently returns only last synced ledger).

curl -H "Content-Type: application/json" -X POST \
     -d '{ "method": "get_status", "params": {} }' \
     http://localhost:8080
{
   "result":{
      "latest_ledger":4194744
   }
}

sologenic-api's People

Contributors

yivo avatar

Stargazers

Tomyleexrp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.