APIs specification

In order to make it easier for developers to integrate with our protocol, we also provide a set of APIs endpoints that can be used to develop your applications.

All the following endpoints can be accessed at https://apis.milkyway.zone.

Available endpoints

Getting the smart contract state

In order to get the smart contract state of MilkTIA, you can use the following endpoint:

GET /milktia/contract-state

Getting the total value locked (TVL)

In order to get the total value locked in MilkTIA, you can use the following endpoint:

GET /milktia/tvl

Getting the annual percentage rate (APR)

In order to get the annual percentage rate of MilkTIA, you can use the following endpoint:

GET /milktia/apr

Getting the redemption rates

Historical redemption rates

In order to get the rates history of MilkTIA, you can use the following endpoint:

GET /milktia/rates/history?since=<timestamp>&order=<asc|desc>

Query params:

  • since: the timestamp from which the rates should be returned, in RFC3339 format (e.g. 2021-01-01T00:00:00Z) If not provided, the rates will be limited to a two weeks period.

  • order: the order in which the rates should be returned. The available options are:

    • asc, to return the rates in ascending order (default value)

    • desc, to return the rates in descending order

Current redemption rate

In order to get the current redemption rate of MilkTIA, you can use the following endpoint:

GET /milktia/rates/current

Getting unstake requests of a user

In order to get the requests of a user, you can use the following endpoint:

GET /milktia/unstake-requests/:address

Path params:

  • address: the address of the user

Getting the currently unstaking amount

In order to get the currently unstaking amount of MilkTIA, you can use the following endpoint:

GET /milktia/unstaking

Getting milkTIA price

In order to get the milkTIA price, you can use the following endpoint:

GET /milktia/price?amount=<amount>&currency=<currency>

Query params:

  • amount: the amount of milkTIA, expressed as milkTIA tokens (not umilktia)

  • currency: the currency in which the price should be expressed. The available options are:

    • tia, to express the price in TIA tokens (not utia)

    • fiat currencies

Examples:

  • /milktia/price?amount=1&currency=usd will return the price of 1 milkTIA (1000000umilktia) in USD

  • /milktia/price?amount=100&currency=tia will return the price of 100 milkTIA (100000000umilktia) in TIA tokens

Getting milkTIA fee details

Getting milkTIA generated fees in a time range

In order to get the milkTIA generated fees in a time range, you can use the following endpoint:

GET /milktia/fees/range?from=<RFC3339 timestamp>&to=<RFC3339 timestamp>&currency=<currency>

Query params:

  • from: the timestamp from which the fees should be returned, in RFC3339 format (e.g. 2021-01-01T00:00:00Z). If not provided will fall back to the current server time - 24 hours.

  • to: the timestamp until which the fees should be returned, in RFC3339 format (e.g. 2021-01-01T00:00:00Z). If not provided will fall back to the current server time.

  • currency: the currency in which the fees should be expressed. The available options are:

    • tia, to express the fees in TIA tokens (not utia)

    • fiat currencies

NOTE: The max range is 30 days.

Examples:

  • /milktia/fees/range?currency=usd will return the fees generated in usd in the last 24 hours

  • /milktia/fees/range?currency=tia will return the fees generated in TIA tokens in the last 24 hours

  • /milktia/fees/range?from=2021-01-01T00:00:00Z&to=2021-01-02T00:00:00Z&currency=usd will return the fees generated in usd between 2024-06-01T00:00:00Z and 2024-06-02T00:00:00Z

  • /milktia/fees/range?from=2021-01-01T00:00:00Z&to=2021-01-02T00:00:00Z&currency=tia will return the fees generated in TIA tokens between 2024-06-01T00:00:00Z and 2024-06-02T00:00:00Z

Getting milkTIA daily generated fees

In order to get the milkTIA daily generated fees, you can use the following endpoint:

GET /milktia/fees/daily?day=<YYYY-MM-dd>&currency=<currency>

Query params:

  • day: the day for which the fees should be returned, in YYYY-MM-dd format (e.g. 2021-01-01)

  • currency: the currency in which the fees should be expressed. The available options are:

    • tia, to express the fees in TIA tokens (not utia)

    • usd, to express the fees in USD

Getting milkTIA total generated fees

In order to get the milkTIA total generated fees, you can use the following endpoint:

GET /milktia/fees/total?currency=<currency>

Query params:

  • currency: the currency in which the fees should be expressed. The available options are:

    • tia, to express the fees in TIA tokens (not utia)

    • fiat currencies

Examples:

  • /milktia/fees/total?currency=usd will return the total generated fees of milkTIA in usd

  • /milktia/fees/total?currency=tia will return the total generated fees of milkTIA in TIA tokens

Last updated