Home

Awesome

Build Status

For Javascript api please use kulap-libra at https://github.com/kulapio/libra-core.

Docs

Architect

Libra Wallet Service Architect To build that APIs we need shell interactive that can send requests to Libra-cli so we use Node.js with child_process and rauschma/stringio libs to run a Libra-cli container every time when the user makes a request (stateless).

Required

Install

# Download source
git clone https://github.com/kulapio/libra-service.git

# Getting in
cd libra-service

# Install dependencies
npm i

# Apply default config from .env.example
npm run prestart

Config

PORT=3000
HOST=localhost
AMOUNT_TO_MINT=100
DOCKER_IMAGE=kulap/libra_client:0.3
USE_KULAP_FAUCET=true

Run

npm run start

Develop

npm run dev

Test

npm test

Warning

Endpoints

Create wallet:

POST /createWallet
Headers: Content-Typeapplication/json
Body: {}

Example Request:
curl --location --request POST "https://libraservice2.kulap.io/createWallet" \
  --header "Content-Type: application/json" \
  --data "{}"
Example Output:
{
    "address": "5554d60c1af7592673f0ac012ce483b842c06de3d896029cfe957c348621d5b7",
    "balance": "100",
    "mnemonic": "parrot afraid always popular trade grape divide wave dawn web identify kangaroo equal suffer humor creek scan stove hip kingdom skin enable flush announce;1"
}

Get balance:

POST /getBalance
Headers: Content-Typeapplication/json
Body:

KeyDescriptionRequired
adressLibra's wallet addressyes
Example Request:
curl --location --request POST "https://libraservice2.kulap.io/getBalance" \
  --header "Content-Type: application/json" \
  --data "{
	\"address\": \"87b647a009b06483be7a47296b6182294c71eced58837e8043a1f54fdb71d1ee\"
}"
Example Output:
{
    "address": "87b647a009b06483be7a47296b6182294c71eced58837e8043a1f54fdb71d1ee",
    "balance": "1000000123"
}

Transfer:

POST /transfer
Headers: Content-Typeapplication/json
Body:

KeyDescriptionRequired
fromAddressSender Libra's wallet addressno
mnemonicMnemonic phraseyes
toAddressReceiver Libra's wallet addressyes
amountAmount of Libra coins to transferyes
Example Request:
curl --location --request POST "https://libraservice2.kulap.io/transfer" \
  --header "Content-Type: application/json" \
  --data "{
	\"fromAddress\": \"3299692e5e635fa2473924177955b3be1e451efc3c03edd212de85c1070a6312\",
	\"mnemonic\": \"shoot brave host cause birth online aerobic hobby east service grow hip thank great fire collect drill elegant appear vote tackle napkin book size;1\",
	\"toAddress\": \"31c7092554bb804a4e25bd24399859428404c28cbc3b44dea5dc2a9f2314144b\",
	\"amount\": \"11\"
}"
Example Output:
{
    "address": "3299692e5e635fa2473924177955b3be1e451efc3c03edd212de85c1070a6312",
    "toAddress": "31c7092554bb804a4e25bd24399859428404c28cbc3b44dea5dc2a9f2314144b",
    "amount": "11"
}

Mint:

POST /mint
Headers: Content-Typeapplication/json
Body:

KeyDescriptionRequired
addressLibra's wallet addressyes
mintAmount of mint coinsyes
Example Request:
curl --location --request POST "https://libraservice2.kulap.io/mint" \
  --header "Content-Type: application/json" \
  --data "{
	\"address\": \"f80d5187740a76e3154ec6a24628b40a82040e71e76bdb4c1fac325fcdd73dcc\",
	\"amount\": \"100\"
}"
Example Output:
{
    "address": "f80d5187740a76e3154ec6a24628b40a82040e71e76bdb4c1fac325fcdd73dcc",
    "amount": "100"
}

Postman

https://documenter.getpostman.com/view/1671913/S1a32SZ5?version=latest

Contributors

License

Libra Service is released under the terms of the MIT license. See LICENSE for more information or see https://opensource.org/licenses/MIT.

Contributing

Contributions are welcome, feel free to fork and pull request.