Midgard API connector package

Midgard API documentation can be found at https://midgard.mayachain.info/v2/doc

Note

This package is autogenerated from OpenAPI specs.

Warning

The following documentation is autogenerated and may not look pretty. Sorry for that, we are working on it.

Midgard Public API

The Midgard Public API queries THORChain and any chains linked via the Bifröst and prepares information about the network to be readily available for public users. The API parses transaction event data from THORChain and stores them in a time-series database to make time-dependent queries easy. Midgard does not hold critical information. To interact with THORChain protocol, users should query THORNode directly. # noqa: E501

OpenAPI spec version: 2.24.3 Contact: devs@thorchain.org Generated by: https://github.com/swagger-api/swagger-codegen.git

class xchainpy2_midgard.api.default_api.DefaultApi(api_client=None)

Bases: object

NOTE: This class is auto generated by the swagger code generator program.

Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen

get_actions(**kwargs)

Actions List # noqa: E501

List actions along with their related transactions. An action is generated by one or more inbound transactions with the intended action set in the transaction memo. The action may result in one or more outbound transactions. Results are paginated by sets of 50. Filters may be applied to query actions. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_actions(async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Comma separated list. Address of sender or recipient of any in/out transaction related to the action. :param str txid: ID of any in/out tx related to the action :param str asset: Comma separated list. Any asset that is part of the action (CHAIN.SYMBOL) Additionally, synth, nosynth, and norune filters can be used for swap, add/withdraw actions. :param str type: One or more comma separated unique types of action (swap, addLiquidity, withdraw, donate, refund, switch, thorname, runePoolDeposit, runePoolWithdraw) :param str tx_type: One or more comma separated transaction type of the action, it’s the tx type parsed from memo. For example: Loan is a swap event but it’s considered as loan tx type Type of Transactions: “unknown”, “add”, “withdraw”, “swap”, “limitOrder”, “outbound”, “donate”, “bond”, “unbond”, “leave”, “yggdrasilFund”, “yggdrasilReturn”, “reserve”, “refund”, “migrate”, “ragnarok”, “switch”, “noOp”, “consolidate”, “thorname”, “loanOpen”, “loanRepayment” :param str affiliate: Comma separated list. Affiliate address of the action (swap, refund) :param int limit: number of actions returned, default is 50 :param int offset: pagination offset, default is 0 :param int next_page_token: if this is given, the actions for the next page will be given :param int timestamp: if this is given, the actions older than the timestamp will be given :param int height: if this is given, the actions older than the height will be given :param int prev_page_token: if this is given, the actions for the previous page will be given :param int from_timestamp: if this is given, the actions newer than the timestamp will be given :param int from_height: if this is given, the actions newer than the height will be given :return: InlineResponse200

If the method is called asynchronously, returns the request thread.

get_actions_with_http_info(**kwargs)

Actions List # noqa: E501

List actions along with their related transactions. An action is generated by one or more inbound transactions with the intended action set in the transaction memo. The action may result in one or more outbound transactions. Results are paginated by sets of 50. Filters may be applied to query actions. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_actions_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Comma separated list. Address of sender or recipient of any in/out transaction related to the action. :param str txid: ID of any in/out tx related to the action :param str asset: Comma separated list. Any asset that is part of the action (CHAIN.SYMBOL) Additionally, synth, nosynth, and norune filters can be used for swap, add/withdraw actions. :param str type: One or more comma separated unique types of action (swap, addLiquidity, withdraw, donate, refund, switch, thorname, runePoolDeposit, runePoolWithdraw) :param str tx_type: One or more comma separated transaction type of the action, it’s the tx type parsed from memo. For example: Loan is a swap event but it’s considered as loan tx type Type of Transactions: “unknown”, “add”, “withdraw”, “swap”, “limitOrder”, “outbound”, “donate”, “bond”, “unbond”, “leave”, “yggdrasilFund”, “yggdrasilReturn”, “reserve”, “refund”, “migrate”, “ragnarok”, “switch”, “noOp”, “consolidate”, “thorname”, “loanOpen”, “loanRepayment” :param str affiliate: Comma separated list. Affiliate address of the action (swap, refund) :param int limit: number of actions returned, default is 50 :param int offset: pagination offset, default is 0 :param int next_page_token: if this is given, the actions for the next page will be given :param int timestamp: if this is given, the actions older than the timestamp will be given :param int height: if this is given, the actions older than the height will be given :param int prev_page_token: if this is given, the actions for the previous page will be given :param int from_timestamp: if this is given, the actions newer than the timestamp will be given :param int from_height: if this is given, the actions newer than the height will be given :return: InlineResponse200

If the method is called asynchronously, returns the request thread.

get_balance(address, **kwargs)

Current balance for an address # noqa: E501

Returns all coin amounts of the given address at the specified timestamp or height, or at the latest process block if neither is provided. (Only one of timestamp or height can be specified, not both.) This endpoint is enabled only if the midgard startup config allows it. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_balance(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Rune address. (required) :param int timestamp: Unix timestamp as seconds since 1970 (if provided, height must not be provided) :param int height: Block height (if provided, timestamp must not be provided) :return: Balance

If the method is called asynchronously, returns the request thread.

get_balance_with_http_info(address, **kwargs)

Current balance for an address # noqa: E501

Returns all coin amounts of the given address at the specified timestamp or height, or at the latest process block if neither is provided. (Only one of timestamp or height can be specified, not both.) This endpoint is enabled only if the midgard startup config allows it. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_balance_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Rune address. (required) :param int timestamp: Unix timestamp as seconds since 1970 (if provided, height must not be provided) :param int height: Block height (if provided, timestamp must not be provided) :return: Balance

If the method is called asynchronously, returns the request thread.

get_borrower_detail(address, **kwargs)

Borrower Details # noqa: E501

Returns an array of statistics for all the open loans associated with a given borrower address. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_borrower_detail(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match borrower, an asset address is given. Query can also be multiple addresses should be separated by comma (‘,’) (required) :return: BorrowerDetails

If the method is called asynchronously, returns the request thread.

get_borrower_detail_with_http_info(address, **kwargs)

Borrower Details # noqa: E501

Returns an array of statistics for all the open loans associated with a given borrower address. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_borrower_detail_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match borrower, an asset address is given. Query can also be multiple addresses should be separated by comma (‘,’) (required) :return: BorrowerDetails

If the method is called asynchronously, returns the request thread.

get_borrowers_addresses(**kwargs)

Borrowers List # noqa: E501

Returns an array containing the addresses for all borrowers. Addresses are only shown once. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_borrowers_addresses(async_req=True) >>> result = thread.get()

:param async_req bool :param str asset: Return only borrowers getting loan against this asset as collateral. :return: list[str]

If the method is called asynchronously, returns the request thread.

get_borrowers_addresses_with_http_info(**kwargs)

Borrowers List # noqa: E501

Returns an array containing the addresses for all borrowers. Addresses are only shown once. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_borrowers_addresses_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str asset: Return only borrowers getting loan against this asset as collateral. :return: list[str]

If the method is called asynchronously, returns the request thread.

get_churns(**kwargs)

Churns List # noqa: E501

Returns block height and timestamp for each churn. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_churns(async_req=True) >>> result = thread.get()

:param async_req bool :return: list[ChurnItem]

If the method is called asynchronously, returns the request thread.

get_churns_with_http_info(**kwargs)

Churns List # noqa: E501

Returns block height and timestamp for each churn. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_churns_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :return: list[ChurnItem]

If the method is called asynchronously, returns the request thread.

get_depth_history(pool, **kwargs)

Depth and Price History # noqa: E501

Returns the asset and rune depths and price. The values report the state at the end of each interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_depth_history(pool, async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return stats for this single pool. (required) :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: DepthHistory

If the method is called asynchronously, returns the request thread.

get_depth_history_with_http_info(pool, **kwargs)

Depth and Price History # noqa: E501

Returns the asset and rune depths and price. The values report the state at the end of each interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_depth_history_with_http_info(pool, async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return stats for this single pool. (required) :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: DepthHistory

If the method is called asynchronously, returns the request thread.

get_earnings_history(**kwargs)

Earnings History # noqa: E501

Returns earnings data for the specified interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_earnings_history(async_req=True) >>> result = thread.get()

:param async_req bool :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: EarningsHistory

If the method is called asynchronously, returns the request thread.

get_earnings_history_with_http_info(**kwargs)

Earnings History # noqa: E501

Returns earnings data for the specified interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_earnings_history_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: EarningsHistory

If the method is called asynchronously, returns the request thread.

get_health(**kwargs)

Health Info # noqa: E501

Returns an object containing the health response of the API. Meaning of heights: lastThorNode - Latest block as reported by ThorNode. lastFetched - Latest block fetched from ThorNode. lastCommitted - Latest block committed to the DB but not fully processed yet. lastAggregated - Latest block fully processed and aggregated. genesisInfo - The genesis height Midgard bootstrapped with. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_health(async_req=True) >>> result = thread.get()

:param async_req bool :return: Health

If the method is called asynchronously, returns the request thread.

get_health_with_http_info(**kwargs)

Health Info # noqa: E501

Returns an object containing the health response of the API. Meaning of heights: lastThorNode - Latest block as reported by ThorNode. lastFetched - Latest block fetched from ThorNode. lastCommitted - Latest block committed to the DB but not fully processed yet. lastAggregated - Latest block fully processed and aggregated. genesisInfo - The genesis height Midgard bootstrapped with. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_health_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :return: Health

If the method is called asynchronously, returns the request thread.

get_known_pools(**kwargs)

Known Pools List # noqa: E501

Returns an object with known pools and their statuses # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_known_pools(async_req=True) >>> result = thread.get()

:param async_req bool :return: KnownPools

If the method is called asynchronously, returns the request thread.

get_known_pools_with_http_info(**kwargs)

Known Pools List # noqa: E501

Returns an object with known pools and their statuses # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_known_pools_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :return: KnownPools

If the method is called asynchronously, returns the request thread.

get_liquidity_history(**kwargs)

Liquidity Changes History # noqa: E501

Returns withdrawals and deposits for given time interval. If pool is not specified returns for all pools History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_liquidity_history(async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return stats for given pool. Returns sum of all pools if missing :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400] :param int to: End time of the query as unix timestamp. If only count is given, defaults to now :param int _from: Start time of the query as unix timestamp :return: LiquidityHistory

If the method is called asynchronously, returns the request thread.

get_liquidity_history_with_http_info(**kwargs)

Liquidity Changes History # noqa: E501

Returns withdrawals and deposits for given time interval. If pool is not specified returns for all pools History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_liquidity_history_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return stats for given pool. Returns sum of all pools if missing :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400] :param int to: End time of the query as unix timestamp. If only count is given, defaults to now :param int _from: Start time of the query as unix timestamp :return: LiquidityHistory

If the method is called asynchronously, returns the request thread.

get_member_detail(address, **kwargs)

Member Details # noqa: E501

Returns an array of statistics for all the liquidity providers associated with a given member address. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_member_detail(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match liquidity providers. Either a rune or an asset address may be given. Query can also be multiple addresses should be separated by comma (‘,’) (required) :param bool show_savers: A flag to show saver vault membership details, the default is false. :return: MemberDetails

If the method is called asynchronously, returns the request thread.

get_member_detail_with_http_info(address, **kwargs)

Member Details # noqa: E501

Returns an array of statistics for all the liquidity providers associated with a given member address. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_member_detail_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match liquidity providers. Either a rune or an asset address may be given. Query can also be multiple addresses should be separated by comma (‘,’) (required) :param bool show_savers: A flag to show saver vault membership details, the default is false. :return: MemberDetails

If the method is called asynchronously, returns the request thread.

get_members_adresses(**kwargs)

Members List # noqa: E501

Returns an array containing the addresses for all pool members. Addresses are only shown once. If there’s both a RUNE address and an asset address for a member, only the RUNE address will be shown. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_members_adresses(async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return only members present in the pool. :return: list[str]

If the method is called asynchronously, returns the request thread.

get_members_adresses_with_http_info(**kwargs)

Members List # noqa: E501

Returns an array containing the addresses for all pool members. Addresses are only shown once. If there’s both a RUNE address and an asset address for a member, only the RUNE address will be shown. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_members_adresses_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return only members present in the pool. :return: list[str]

If the method is called asynchronously, returns the request thread.

get_network_data(**kwargs)

Network Data # noqa: E501

Returns an object containing Network data # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_network_data(async_req=True) >>> result = thread.get()

:param async_req bool :return: Network

If the method is called asynchronously, returns the request thread.

get_network_data_with_http_info(**kwargs)

Network Data # noqa: E501

Returns an object containing Network data # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_network_data_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :return: Network

If the method is called asynchronously, returns the request thread.

get_nodes(**kwargs)

Nodes List # noqa: E501

Returns a list of Node public keys and adresses. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_nodes(async_req=True) >>> result = thread.get()

:param async_req bool :return: list[Node]

If the method is called asynchronously, returns the request thread.

get_nodes_with_http_info(**kwargs)

Nodes List # noqa: E501

Returns a list of Node public keys and adresses. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_nodes_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :return: list[Node]

If the method is called asynchronously, returns the request thread.

get_pool(asset, **kwargs)

Details of a Pool # noqa: E501

Returns details of the pool: depths, price, 24h volume, APY. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_pool(asset, async_req=True) >>> result = thread.get()

:param async_req bool :param str asset: pool name (required) :param str period: Specifies the base interval from which APY is extrapolated. Default is 14d. :return: PoolDetail

If the method is called asynchronously, returns the request thread.

get_pool_stats(asset, **kwargs)

Pool Statistics # noqa: E501

Statistics about the pool. The description of the fields have pointers about the corresponding v2/history location. Visit the history endpoint for drilldowns. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_pool_stats(asset, async_req=True) >>> result = thread.get()

:param async_req bool :param str asset: pool name (required) :param str period: Restricts aggregation type fields to the last period only. Default is 14d. :return: PoolStatsDetail

If the method is called asynchronously, returns the request thread.

get_pool_stats_with_http_info(asset, **kwargs)

Pool Statistics # noqa: E501

Statistics about the pool. The description of the fields have pointers about the corresponding v2/history location. Visit the history endpoint for drilldowns. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_pool_stats_with_http_info(asset, async_req=True) >>> result = thread.get()

:param async_req bool :param str asset: pool name (required) :param str period: Restricts aggregation type fields to the last period only. Default is 14d. :return: PoolStatsDetail

If the method is called asynchronously, returns the request thread.

get_pool_with_http_info(asset, **kwargs)

Details of a Pool # noqa: E501

Returns details of the pool: depths, price, 24h volume, APY. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_pool_with_http_info(asset, async_req=True) >>> result = thread.get()

:param async_req bool :param str asset: pool name (required) :param str period: Specifies the base interval from which APY is extrapolated. Default is 14d. :return: PoolDetail

If the method is called asynchronously, returns the request thread.

get_pools(**kwargs)

Pools List # noqa: E501

Returns an array containing details for a set of pools # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_pools(async_req=True) >>> result = thread.get()

:param async_req bool :param str status: Filter for only pools with this status :param str period: Specifies the base interval from which annualPercentageRate and poolAPY is extrapolated. Default is 14d. :return: list[PoolDetail]

If the method is called asynchronously, returns the request thread.

get_pools_with_http_info(**kwargs)

Pools List # noqa: E501

Returns an array containing details for a set of pools # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_pools_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str status: Filter for only pools with this status :param str period: Specifies the base interval from which annualPercentageRate and poolAPY is extrapolated. Default is 14d. :return: list[PoolDetail]

If the method is called asynchronously, returns the request thread.

get_rune_pool_detail(address, **kwargs)

RUNEPool Details # noqa: E501

Returns an array of statistics for all the RUNEPool associated with given member addresses. Query can also be multiple addresses should be separated by comma (‘,’) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_rune_pool_detail(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match the RUNEPool. multiple rune addresses can be given. (required) :return: list[RUNEPoolProvider]

If the method is called asynchronously, returns the request thread.

get_rune_pool_detail_with_http_info(address, **kwargs)

RUNEPool Details # noqa: E501

Returns an array of statistics for all the RUNEPool associated with given member addresses. Query can also be multiple addresses should be separated by comma (‘,’) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_rune_pool_detail_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match the RUNEPool. multiple rune addresses can be given. (required) :return: list[RUNEPoolProvider]

If the method is called asynchronously, returns the request thread.

get_rune_pool_history(**kwargs)

RUNEPool total members and units History # noqa: E501

Returns RUNEPool members and units. The values report the state at the end of each interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_rune_pool_history(async_req=True) >>> result = thread.get()

:param async_req bool :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: RUNEPoolHistory

If the method is called asynchronously, returns the request thread.

get_rune_pool_history_with_http_info(**kwargs)

RUNEPool total members and units History # noqa: E501

Returns RUNEPool members and units. The values report the state at the end of each interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_rune_pool_history_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: RUNEPoolHistory

If the method is called asynchronously, returns the request thread.

get_saver_detail(address, **kwargs)

Saver Details # noqa: E501

Returns an array of statistics for all the savers associated with a given member address. Query can also be multiple addresses should be separated by comma (‘,’) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_saver_detail(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match the saver. an asset address should be given. (required) :return: SaverDetails

If the method is called asynchronously, returns the request thread.

get_saver_detail_with_http_info(address, **kwargs)

Saver Details # noqa: E501

Returns an array of statistics for all the savers associated with a given member address. Query can also be multiple addresses should be separated by comma (‘,’) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_saver_detail_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match the saver. an asset address should be given. (required) :return: SaverDetails

If the method is called asynchronously, returns the request thread.

get_savers_history(pool, **kwargs)

Savers Units and Depth History # noqa: E501

Returns savers depths and units. The values report the state at the end of each interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_savers_history(pool, async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return stats for this single pool. (required) :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: SaversHistory

If the method is called asynchronously, returns the request thread.

get_savers_history_with_http_info(pool, **kwargs)

Savers Units and Depth History # noqa: E501

Returns savers depths and units. The values report the state at the end of each interval. History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_savers_history_with_http_info(pool, async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return stats for this single pool. (required) :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: SaversHistory

If the method is called asynchronously, returns the request thread.

get_stats(**kwargs)

Global Stats # noqa: E501

Returns an object containing global stats for all pools and all transactions # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_stats(async_req=True) >>> result = thread.get()

:param async_req bool :return: StatsData

If the method is called asynchronously, returns the request thread.

get_stats_with_http_info(**kwargs)

Global Stats # noqa: E501

Returns an object containing global stats for all pools and all transactions # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_stats_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :return: StatsData

If the method is called asynchronously, returns the request thread.

get_swap_history(**kwargs)

Swaps History # noqa: E501

Returns swap count, volume, fees, slip in specified interval. If pool is not specified returns for all pools History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_swap_history(async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return history given pool. Returns sum of all pools if missing. :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: SwapHistory

If the method is called asynchronously, returns the request thread.

get_swap_history_with_http_info(**kwargs)

Swaps History # noqa: E501

Returns swap count, volume, fees, slip in specified interval. If pool is not specified returns for all pools History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_swap_history_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str pool: Return history given pool. Returns sum of all pools if missing. :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: SwapHistory

If the method is called asynchronously, returns the request thread.

get_thor_name_detail(name, **kwargs)

THORName Details # noqa: E501

Returns an array of chains and their addresses associated with the given THORName # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_thor_name_detail(name, async_req=True) >>> result = thread.get()

:param async_req bool :param str name: a THORName (required) :return: THORNameDetails

If the method is called asynchronously, returns the request thread.

get_thor_name_detail_with_http_info(name, **kwargs)

THORName Details # noqa: E501

Returns an array of chains and their addresses associated with the given THORName # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_thor_name_detail_with_http_info(name, async_req=True) >>> result = thread.get()

:param async_req bool :param str name: a THORName (required) :return: THORNameDetails

If the method is called asynchronously, returns the request thread.

get_thor_names_by_address(address, **kwargs)

Gives a list of THORNames by reverse lookup # noqa: E501

Returns an array of THORNames associated with the given address # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_thor_names_by_address(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match THORNames against. (required) :return: list[str]

If the method is called asynchronously, returns the request thread.

get_thor_names_by_address_with_http_info(address, **kwargs)

Gives a list of THORNames by reverse lookup # noqa: E501

Returns an array of THORNames associated with the given address # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_thor_names_by_address_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address to match THORNames against. (required) :return: list[str]

If the method is called asynchronously, returns the request thread.

get_thor_names_owner_by_address(address, **kwargs)

THORName owner # noqa: E501

Returns an array of THORNames owned by the address. The address is not necessarily an associated address for those thornames. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_thor_names_owner_by_address(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address which owns a THORName. (required) :return: list[str]

If the method is called asynchronously, returns the request thread.

get_thor_names_owner_by_address_with_http_info(address, **kwargs)

THORName owner # noqa: E501

Returns an array of THORNames owned by the address. The address is not necessarily an associated address for those thornames. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_thor_names_owner_by_address_with_http_info(address, async_req=True) >>> result = thread.get()

:param async_req bool :param str address: Address which owns a THORName. (required) :return: list[str]

If the method is called asynchronously, returns the request thread.

get_tvl_history(**kwargs)

Total Value Locked History # noqa: E501

Returns total pool depths, total bonds, and total value locked in specified interval. Total Value Locked = Total Bonds + 2 * Total Pool Depths History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_tvl_history(async_req=True) >>> result = thread.get()

:param async_req bool :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: TVLHistory

If the method is called asynchronously, returns the request thread.

get_tvl_history_with_http_info(**kwargs)

Total Value Locked History # noqa: E501

Returns total pool depths, total bonds, and total value locked in specified interval. Total Value Locked = Total Bonds + 2 * Total Pool Depths History endpoint has two modes: * With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries. * Without Interval parameter a single From..To search is performed with exact timestamps. * Interval: possible values: 5min, hour, day, week, month, quarter, year. * count: [1..400]. Defines number of intervals. Don’t provide if Interval is missing. * from/to: optional int, unix second. Possible usages with interval. * last 10 days: ?interval=day&count=10 * last 10 days before to: ?interval=day&count=10&to=1608825600 * next 10 days after from: ?interval=day&count=10&from=1606780800 * Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600 Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query. Possible configurations without interval: * exact search for one time frame: ?from=1606780899&to=1608825600 * one time frame until now: ?from=1606780899 * from chain start until now: no query parameters # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_tvl_history_with_http_info(async_req=True) >>> result = thread.get()

:param async_req bool :param str interval: Interval of calculations :param int count: Number of intervals to return. Should be between [1..400]. :param int to: End time of the query as unix timestamp. If only count is given, defaults to now. :param int _from: Start time of the query as unix timestamp :return: TVLHistory

If the method is called asynchronously, returns the request thread.

API Client

Midgard Public API

The Midgard Public API queries THORChain and any chains linked via the Bifröst and prepares information about the network to be readily available for public users. The API parses transaction event data from THORChain and stores them in a time-series database to make time-dependent queries easy. Midgard does not hold critical information. To interact with THORChain protocol, users should query THORNode directly. # noqa: E501

OpenAPI spec version: 2.24.3 Contact: devs@thorchain.org Generated by: https://github.com/swagger-api/swagger-codegen.git

class xchainpy2_midgard.api_client.ApiClient(configuration=None, header_name=None, header_value=None, cookie=None)

Bases: object

Generic API client for Swagger client library builds.

Swagger generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the Swagger templates.

NOTE: This class is auto generated by the swagger code generator program. Ref: https://github.com/swagger-api/swagger-codegen Do not edit the class manually.

Parameters:
  • configuration – .Configuration object for this client

  • header_name – a header to pass when making calls to the API.

  • header_value – a header value to pass when making calls to the API.

  • cookie – a cookie to include in the header when making calls to the API

NATIVE_TYPES_MAPPING = {'bool': <class 'bool'>, 'date': <class 'datetime.date'>, 'datetime': <class 'datetime.datetime'>, 'float': <class 'float'>, 'int': <class 'int'>, 'long': <class 'int'>, 'object': <class 'object'>, 'str': <class 'str'>}
PRIMITIVE_TYPES = (<class 'float'>, <class 'bool'>, <class 'bytes'>, <class 'str'>, <class 'int'>)
call_api(resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, _preload_content=True, _request_timeout=None)

Makes the HTTP request (synchronous) and returns deserialized data.

To make an async request, set the async_req parameter.

Parameters:
  • resource_path – Path to method endpoint.

  • method – Method to call.

  • path_params – Path parameters in the url.

  • query_params – Query parameters in the url.

  • header_params – Header parameters to be placed in the request header.

  • body – Request body.

  • dict (files) – Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • list (auth_settings) – Auth Settings names for the request.

  • response – Response data type.

  • dict – key -> filename, value -> filepath, for multipart/form-data.

  • bool (async_req) – execute request asynchronously

  • _return_http_data_only – response data without head status code and headers

  • collection_formats – dict of collection formats for path, query, header, and post parameters.

  • _preload_content – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

Returns:

If async_req parameter is True, the request will be called asynchronously. The method will return the request thread. If parameter async_req is False or missing, then the method will return the response directly.

deserialize(response, response_type)

Deserializes response into an object.

Parameters:
  • response – RESTResponse object to be deserialized.

  • response_type – class literal for deserialized object, or string of class name.

Returns:

deserialized object.

parameters_to_tuples(params, collection_formats)

Get parameters as list of tuples, formatting collections.

Parameters:
  • params – Parameters as dict or list of two-tuples

  • collection_formats (dict) – Parameter collection formats

Returns:

Parameters as list of tuples, collections formatted

prepare_post_parameters(post_params=None, files=None)

Builds form parameters.

Parameters:
  • post_params – Normal form parameters.

  • files – File parameters.

Returns:

Form parameters with files.

request(method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)

Makes the HTTP request using RESTClient.

sanitize_for_serialization(obj)

Builds a JSON POST object.

If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date

convert to string in iso8601 format.

If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is swagger model, return the properties dict.

Parameters:

obj – The data to serialize.

Returns:

The serialized form of data.

select_header_accept(accepts)

Returns Accept based on an array of accepts provided.

Parameters:

accepts – List of headers.

Returns:

Accept (e.g. application/json).

select_header_content_type(content_types)

Returns Content-Type based on an array of content_types provided.

Parameters:

content_types – List of content-types.

Returns:

Content-Type (e.g. application/json).

set_default_header(header_name, header_value)
update_params_for_auth(headers, querys, auth_settings)

Updates header and query params based on authentication setting.

Parameters:
  • headers – Header parameters dict to be updated.

  • querys – Query parameters tuple list to be updated.

  • auth_settings – Authentication setting identifiers list.

property user_agent

User agent for this API client

Configuration

Midgard Public API

The Midgard Public API queries THORChain and any chains linked via the Bifröst and prepares information about the network to be readily available for public users. The API parses transaction event data from THORChain and stores them in a time-series database to make time-dependent queries easy. Midgard does not hold critical information. To interact with THORChain protocol, users should query THORNode directly. # noqa: E501

OpenAPI spec version: 2.24.3 Contact: devs@thorchain.org Generated by: https://github.com/swagger-api/swagger-codegen.git

class xchainpy2_midgard.configuration.Configuration

Bases: object

NOTE: This class is auto generated by the swagger code generator program.

Ref: https://github.com/swagger-api/swagger-codegen Do not edit the class manually.

auth_settings()

Gets Auth Settings dict for api client.

Returns:

The Auth Settings information dict.

property debug

Debug status

Parameters:

value – The debug status, True or False.

Type:

bool

get_api_key_with_prefix(identifier)

Gets API key (with prefix if set).

Parameters:

identifier – The identifier of apiKey.

Returns:

The token for api key authentication.

get_basic_auth_token()

Gets HTTP basic authentication header (string).

Returns:

The token for basic HTTP authentication.

property logger_file

The logger file.

If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler.

Parameters:

value – The logger_file path.

Type:

str

property logger_format

The logger format.

The logger_formatter will be updated when sets logger_format.

Parameters:

value – The format string.

Type:

str

to_debug_report()

Gets the essential information for debugging.

Returns:

The report for debugging.

class xchainpy2_midgard.configuration.TypeWithDefault(name, bases, dct)

Bases: type

set_default(default)

Rest API helper functions

Midgard Public API

The Midgard Public API queries THORChain and any chains linked via the Bifröst and prepares information about the network to be readily available for public users. The API parses transaction event data from THORChain and stores them in a time-series database to make time-dependent queries easy. Midgard does not hold critical information. To interact with THORChain protocol, users should query THORNode directly. # noqa: E501

OpenAPI spec version: 2.24.3 Contact: devs@thorchain.org Generated by: https://github.com/swagger-api/swagger-codegen.git

exception xchainpy2_midgard.rest.ApiException(status=None, reason=None, http_resp=None)

Bases: Exception

class xchainpy2_midgard.rest.RESTClientObject(configuration, pools_size=4, maxsize=4)

Bases: object

async DELETE(url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None)
async GET(url, headers=None, query_params=None, _preload_content=True, _request_timeout=None)
async HEAD(url, headers=None, query_params=None, _preload_content=True, _request_timeout=None)
async OPTIONS(url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)
async PATCH(url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)
async POST(url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)
async PUT(url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)
async request(method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None)

Execute request

Parameters:
  • method – http request method

  • url – http request url

  • query_params – query parameters in the url

  • headers – http request headers

  • body – request json body, for application/json

  • post_params – request post parameters, application/x-www-form-urlencoded and multipart/form-data

  • _preload_content – this is a non-applicable field for the AiohttpClient.

  • _request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

class xchainpy2_midgard.rest.RESTResponse(resp, data)

Bases: IOBase

getheader(name, default=None)

Returns a given response header.

getheaders()

Returns a CIMultiDictProxy of the response headers.