Introduction to Mii Libra API

Mii Libra API is a graphql api for interacting with the Libra Blockchain (testnet), it acts as a data layer in front of the blockchain. It abstracts the complexity of serialization and deserialization away, made it easy to interact with the Libra Blockchain.

API Endpoint:

https://libra-graphql.herokuapp.com

There are 3 types of API available - Query APIs, Mutation APIs, and Subscription API.

Query APIs

  • queryByAddress(address) - returns get_account_state_response: {account_state_with_proof} of the given account address argument.

  • queryBySequenceNumber(address, sequenceNumber) - returns transaction_with_proof of the given account address and sequence number arguments.

  • querySentEvents(address) - return events_with_proof (all sent events) of the given account address argument.

  • queryReceivedEvents(address) - return events_with_proof (all received events) of the given account address argument.


Mutation APIs

  • createAccount() - returns address (hex string), publicKey (hex string), and mnemonic (string - words).
    Note: this API is not involved with the Libra Blockchain.

  • mintCoin(address, amount) - returns get_account_state_response: {account_state_with_proof} which is the latest state of the given address argument. If mintCoin transaction succeeded, the newly minted coins is reflected in the balance.

  • transferCoins( fromAddress, sequenceNumber, toAddress, amount, mnemonic) - returns transaction_with_proof of the newly transferred transaction.
    Note: sender account must be created by Mii Libra API's createAccount.


Subscription API

  • receivedCoins(receiverAddress) - returns transaction_with_proof to receiver address.


To play around with the Mii Libra APIs in graphql playground, you can visit this link.