Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 881 Bytes

get-balance.md

File metadata and controls

47 lines (41 loc) · 881 Bytes
layout
title description tableOfContents outline pagination
visible
true
visible
visible
true
visible
true
visible
true

💰 Get Balance

Users can check their account balance with the given command. It returns the data limit and current usage in bytes.

{% tabs %} {% tab title="JS SDK" %}

const getBalance = async() => {
  /*
    @param {string} apiKey - your api key.
  */
  const apiKey = 'YOUR_API_KEY';
  const balance = await lighthouse.getBalance(apiKey);
  
  /* Sample Response (Unit is Bytes)
      {data: { dataLimit: 687194767360, dataUsed: 7012827847 }}
  */
}

{% endtab %}

{% tab title="API" %}

curl https://api.lighthouse.storage/api/user/user_data_usage?publicKey=<publicKey>

{% endtab %}

{% tab title="CLI" %}

lighthouse-web3 balance

{% endtab %} {% endtabs %}