The Litemint API client library for javaScript client-application developers to integrate apps and games on the Litemint platform.
Note: Contact [email protected] to get your
APP ID
andAPI KEY
to submit your app.
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.
Include on your page in the <script>
tag:
<!-- Latest compiled minified JavaScript version -->
<script src="litemint.api.min.js"></script>
// Optional: Initialize with API key.
Litemint.initialize();
Litemint.getToken().then(token => {
console.log(token);
});
// 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);
});
const scoreToSubmit = 700;
Litemint.submitScore(token, scoreToSubmit).then(result => {
console.log(result.error);
});
And much more...