Skip to content
Litemint APIs client library for apps and games.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
index.html
litemint.api.js
litemint.api.min.js

README.md

Litemint API client library for apps and games

Description

The Litemint API client library for javaScript client-application developers to integrate apps and games on the Litemint platform.

Note: Contact hello@litemint.com to get your APP ID and API KEY to submit your app.

Features

The JavaScript client library supports various interfaces to initialize an app, retrieve the authenticated Litemint user from auth token, retrieve his/her public data from the Stellar blockchain and submit high scores.

Click here to learn more about the advantages of publishing your apps and games on Litemint.

Installing

Browser

Include on your page in the <script> tag:

<!-- Latest compiled minified JavaScript version -->
<script src="litemint.api.min.js"></script>

Usage

Initialize the app once:

Litemint.initialize();

Retrieve the user token:

Litemint.getToken().then(token => {
    console.log(token);
});

Validate the token and retrieve the user object:

// Set onlyFederated to true if your game requires accounts with gamer ID.
const onlyFederated = false;
Litemint.validateToken(token, onlyFederated)
.then(user => {
    console.log(user.id || user.address);
})
.catch(err => {
    console.log(err);
});

Submit a score (usually from your game server):

const scoreToSubmit = 700;
Litemint.submitScore(token, scoreToSubmit).then(result => {
    console.log(result.error);
});

And much more...

You can’t perform that action at this time.