Skip to content
Get started

Get user balance by asset

user.wallet.get_balance_by_asset(straddress, WalletGetBalanceByAssetParams**kwargs) -> WalletGetBalanceByAssetResponse
GET/api/v1/users/{address}/wallet/balance

Get user balance by asset

ParametersExpand Collapse
address: str

The user account address

asset_id: str

Asset ID for lookup

with_text: Optional[bool]

Include text variation fields

with_value: Optional[bool]

Calculate and include USD values for amounts, where applicable

ReturnsExpand Collapse
class WalletGetBalanceByAssetResponse:

Asset and balance contents for a given wallet

asset: AssetSpec

Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc)

id: str
group: Literal["native", "token"]
One of the following:
"native"
"token"
group_key: str
values: WalletAsset

Derived values and amounts.

One of the following:
class WalletAssetKnown:
amount: str

Wallet balance in native denom.

amount_scaled: str

Amount scaled to the asset's standard unit / decimal places.

asset_info: AssetInfo

Asset identifiers with associated metadata

asset: AssetSpec

Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc)

id: str
group: Literal["native", "token"]
One of the following:
"native"
"token"
group_key: str
classification: AssetClassification

The asset's classification metadata. Assets are classfied to provide context on their usage throughout the Neptune API (e.g. regular assets, neptune receipt tokens, LSTs, etc.)

Each asset belongs to only a single classification type. This object contains metadata pertaining to the given classification.

While some fields may be common among the distinct classifcations, each classification is distinct and subject to independent change.

One of the following:
class Regular:
kind: Literal["regular"]
neptune_receipt_asset: Optional[AssetSpec]

Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc)

id: str
group: Literal["native", "token"]
One of the following:
"native"
"token"
group_key: str
class NeptuneReceiptToken:
kind: Literal["neptune_receipt_token"]
origin_asset: AssetSpec

Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc)

id: str
group: Literal["native", "token"]
One of the following:
"native"
"token"
group_key: str
class LiquidStakingToken:
kind: Literal["liquid_staking_token"]
origin_asset: Optional[AssetSpec]

Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc)

id: str
group: Literal["native", "token"]
One of the following:
"native"
"token"
group_key: str
metadata: AssetMetadata

Additional metadata for assets

decimals_denom: int

Denom exponent, or num. of decimal places that shift between denom/standard amounts (e.g. 18 for INJ)

formatuint32
minimum0
decimals_display: int

Number of decimals used when displaying amounts of this asset (this is subjective and used for generating text representations)

formatuint32
minimum0
name: str

Full name of the asset

symbol: str

Symbol of the asset, e.g.: NEPT INJ

symbol_denom: str

Denom symbol for the asset (e.g. inj for INJ, sat for BTC)

extra: Extra
text: Optional[ExtraText]

Human-readable field variants. Will not be null when query param with_text is true.

amount: str
value: Optional[ExtraValue]

USD values for the corresponding amounts above. Will not be null when query param with_value is true.

Note

This variant group contains an additional price field (set to the number used in value calculation).

The embedded text group will contain the text variant if with_text was specified as well.

amount: str
extra: ExtraValueExtra
text: Optional[ExtraValueExtraText]

Human-readable variants of USD values. Will not be null when query params with_text and with_value are true.

amount: str
price: str

Text representation of price

price: str

Price used in value calculations

kind: Literal["known"]
class WalletAssetUnknown:
amount: str

Wallet balance in native denom.

kind: Literal["unknown"]
error: None

Error data. Guaranteed null for successful response.

status: int

HTTP status. Successful responses are guaranteed to be < 400. Conversely, error responses are guaranteed to be >= 400.

formatuint16
minimum0
maximum65535
status_text: str

HTTP status text

Get user balance by asset

from neptune_api_v2 import NeptuneAPIV2

client = NeptuneAPIV2()
response = client.user.wallet.get_balance_by_asset(
    address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0",
    asset_id="token;-K-//-//3-",
)
print(response.data)
{
  "data": {
    "asset": {
      "id": "native;inj",
      "group": "native",
      "group_key": "inj"
    },
    "values": {
      "kind": "known",
      "asset_info": {
        "asset": {
          "id": "native;inj",
          "group": "native",
          "group_key": "inj"
        },
        "metadata": {
          "name": "Injective",
          "symbol": "INJ",
          "symbol_denom": "inj",
          "decimals_denom": 18,
          "decimals_display": 4
        },
        "classification": {
          "kind": "regular",
          "neptune_receipt_asset": {
            "id": "token;inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f",
            "group": "token",
            "group_key": "inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f"
          }
        }
      },
      "amount": "121433424019244729044",
      "amount_scaled": "121.433424019244729044",
      "extra": {
        "text": {
          "amount": "121.4334 INJ"
        },
        "value": {
          "amount": "364.099906908102433329",
          "price": "2.99835",
          "extra": {
            "text": {
              "price": "$2.99",
              "amount": "$364.09"
            }
          }
        }
      }
    }
  },
  "error": null,
  "status": 200,
  "status_text": "200 OK"
}
{
  "data": null,
  "error": {
    "kind": "internal",
    "scope": "server",
    "message": "An unexpected error occurred"
  },
  "status": 500,
  "status_text": "500 Internal Server Error"
}
Returns Examples
{
  "data": {
    "asset": {
      "id": "native;inj",
      "group": "native",
      "group_key": "inj"
    },
    "values": {
      "kind": "known",
      "asset_info": {
        "asset": {
          "id": "native;inj",
          "group": "native",
          "group_key": "inj"
        },
        "metadata": {
          "name": "Injective",
          "symbol": "INJ",
          "symbol_denom": "inj",
          "decimals_denom": 18,
          "decimals_display": 4
        },
        "classification": {
          "kind": "regular",
          "neptune_receipt_asset": {
            "id": "token;inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f",
            "group": "token",
            "group_key": "inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f"
          }
        }
      },
      "amount": "121433424019244729044",
      "amount_scaled": "121.433424019244729044",
      "extra": {
        "text": {
          "amount": "121.4334 INJ"
        },
        "value": {
          "amount": "364.099906908102433329",
          "price": "2.99835",
          "extra": {
            "text": {
              "price": "$2.99",
              "amount": "$364.09"
            }
          }
        }
      }
    }
  },
  "error": null,
  "status": 200,
  "status_text": "200 OK"
}
{
  "data": null,
  "error": {
    "kind": "internal",
    "scope": "server",
    "message": "An unexpected error occurred"
  },
  "status": 500,
  "status_text": "500 Internal Server Error"
}