summaryrefslogtreecommitdiff
path: root/python-aiothornode.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-aiothornode.spec')
-rw-r--r--python-aiothornode.spec435
1 files changed, 435 insertions, 0 deletions
diff --git a/python-aiothornode.spec b/python-aiothornode.spec
new file mode 100644
index 0000000..45c43db
--- /dev/null
+++ b/python-aiothornode.spec
@@ -0,0 +1,435 @@
+%global _empty_manifest_terminate_build 0
+Name: python-aiothornode
+Version: 0.1.7
+Release: 1
+Summary: THORChain node connection library for Python
+License: MIT
+URL: https://github.com/tirinox/aiothornode
+Source0: https://mirrors.aliyun.com/pypi/web/packages/09/16/292af8096430e6f62a5156f4fdf2bdf5c6c8142fb6875eda84848482cf1d/aiothornode-0.1.7.tar.gz
+BuildArch: noarch
+
+
+%description
+# aiothornode
+
+This is a simple Python library to access [THORChain](https://thorchain.org/) nodes. It is asynchronous and uses _aiohttp_.
+
+### Important
+
+v.0.1.0 breaking changes:
+1. NamedTuples instead of DataClasses for Thor entities
+2. Environments were renamed
+3. No more consensus features
+
+v.0.0.21 is hotfix. Port 1317 was disabled, so it is an emergency upgrade to save this lib. More news will be later...
+
+### Features:
+
+* Now it is just a convenient wrapper for THORNode API
+
+### Supported endpoints:
+
+* Constants
+* Mimir
+* Nodes (node accounts)
+* Current TX queue length
+* Pools (current and at arbitrary height)
+* Tendermint block at height
+* Inbound addresses and other chain info
+* Asgard & Yggdrasil vaults (new!)
+* Balance of THOR account
+
+## Installation
+
+`python -m pip install git+https://github.com/tirinox/aiothornode`
+
+## Quick start
+
+The following code is quite self-documenting:
+
+```
+import random
+
+from aiothornode.connector import *
+from aiothornode.env import *
+import asyncio
+import aiohttp
+
+
+def delim():
+ print('-' * 100)
+
+
+async def main():
+ env = MAINNET.copy()
+ # env = ThorEnvironment(...) # custom
+
+ async with aiohttp.ClientSession() as session:
+ connector = ThorConnector(env, session)
+
+ genesis = await connector.query_genesis()
+ print(f'Chain ID = {genesis["chain_id"]}')
+ delim()
+
+ chains = await connector.query_chain_info()
+ chains = list(chains.values())
+ print('Chain info:', chains)
+ delim()
+
+ print('Tendermint Block:')
+ tender_block = await connector.query_tendermint_block_raw(100001)
+ block_header = tender_block['result']['block']['header']
+ print(f'{block_header["height"] = } and {block_header["time"] = }')
+ delim()
+
+ constants = await connector.query_constants()
+ print(f'Constants: {constants}')
+ delim()
+
+ mimir = await connector.query_mimir()
+ mimir_1 = mimir.get('MINIMUMBONDINRUNE')
+ print(f'Mimir: {mimir}, MINIMUMBONDINRUNE = {mimir_1}')
+ delim()
+
+ queue = await connector.query_queue()
+ print(f'Queue: {queue}')
+ delim()
+
+ node_accounts = await connector.query_node_accounts(consensus=False)
+ print(f'Example node account: {random.sample(node_accounts, 1)[0]}')
+ delim()
+
+ pool = await connector.query_pool('BNB.BUSD-BD1', height=8218339)
+ print(pool)
+ delim()
+
+ pools = await connector.query_pools()
+ print(pools[0])
+ print(f'Total {len(pools)} pools')
+ delim()
+
+ bank = await connector.query_balance('thor1dheycdevq39qlkxs2a6wuuzyn4aqxhve4qxtxt')
+ print(f'Balance of {bank.address} is {bank.runes_float} Rune')
+ delim()
+
+
+if __name__ == '__main__':
+ asyncio.run(main())
+```
+
+## Testing
+
+Install PyTest and an async plugin for it:
+
+```
+pip install pytest
+pip install pytest-asyncio
+```
+
+Then run
+
+```
+pytest test
+```
+
+
+%package -n python3-aiothornode
+Summary: THORChain node connection library for Python
+Provides: python-aiothornode
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-aiothornode
+# aiothornode
+
+This is a simple Python library to access [THORChain](https://thorchain.org/) nodes. It is asynchronous and uses _aiohttp_.
+
+### Important
+
+v.0.1.0 breaking changes:
+1. NamedTuples instead of DataClasses for Thor entities
+2. Environments were renamed
+3. No more consensus features
+
+v.0.0.21 is hotfix. Port 1317 was disabled, so it is an emergency upgrade to save this lib. More news will be later...
+
+### Features:
+
+* Now it is just a convenient wrapper for THORNode API
+
+### Supported endpoints:
+
+* Constants
+* Mimir
+* Nodes (node accounts)
+* Current TX queue length
+* Pools (current and at arbitrary height)
+* Tendermint block at height
+* Inbound addresses and other chain info
+* Asgard & Yggdrasil vaults (new!)
+* Balance of THOR account
+
+## Installation
+
+`python -m pip install git+https://github.com/tirinox/aiothornode`
+
+## Quick start
+
+The following code is quite self-documenting:
+
+```
+import random
+
+from aiothornode.connector import *
+from aiothornode.env import *
+import asyncio
+import aiohttp
+
+
+def delim():
+ print('-' * 100)
+
+
+async def main():
+ env = MAINNET.copy()
+ # env = ThorEnvironment(...) # custom
+
+ async with aiohttp.ClientSession() as session:
+ connector = ThorConnector(env, session)
+
+ genesis = await connector.query_genesis()
+ print(f'Chain ID = {genesis["chain_id"]}')
+ delim()
+
+ chains = await connector.query_chain_info()
+ chains = list(chains.values())
+ print('Chain info:', chains)
+ delim()
+
+ print('Tendermint Block:')
+ tender_block = await connector.query_tendermint_block_raw(100001)
+ block_header = tender_block['result']['block']['header']
+ print(f'{block_header["height"] = } and {block_header["time"] = }')
+ delim()
+
+ constants = await connector.query_constants()
+ print(f'Constants: {constants}')
+ delim()
+
+ mimir = await connector.query_mimir()
+ mimir_1 = mimir.get('MINIMUMBONDINRUNE')
+ print(f'Mimir: {mimir}, MINIMUMBONDINRUNE = {mimir_1}')
+ delim()
+
+ queue = await connector.query_queue()
+ print(f'Queue: {queue}')
+ delim()
+
+ node_accounts = await connector.query_node_accounts(consensus=False)
+ print(f'Example node account: {random.sample(node_accounts, 1)[0]}')
+ delim()
+
+ pool = await connector.query_pool('BNB.BUSD-BD1', height=8218339)
+ print(pool)
+ delim()
+
+ pools = await connector.query_pools()
+ print(pools[0])
+ print(f'Total {len(pools)} pools')
+ delim()
+
+ bank = await connector.query_balance('thor1dheycdevq39qlkxs2a6wuuzyn4aqxhve4qxtxt')
+ print(f'Balance of {bank.address} is {bank.runes_float} Rune')
+ delim()
+
+
+if __name__ == '__main__':
+ asyncio.run(main())
+```
+
+## Testing
+
+Install PyTest and an async plugin for it:
+
+```
+pip install pytest
+pip install pytest-asyncio
+```
+
+Then run
+
+```
+pytest test
+```
+
+
+%package help
+Summary: Development documents and examples for aiothornode
+Provides: python3-aiothornode-doc
+%description help
+# aiothornode
+
+This is a simple Python library to access [THORChain](https://thorchain.org/) nodes. It is asynchronous and uses _aiohttp_.
+
+### Important
+
+v.0.1.0 breaking changes:
+1. NamedTuples instead of DataClasses for Thor entities
+2. Environments were renamed
+3. No more consensus features
+
+v.0.0.21 is hotfix. Port 1317 was disabled, so it is an emergency upgrade to save this lib. More news will be later...
+
+### Features:
+
+* Now it is just a convenient wrapper for THORNode API
+
+### Supported endpoints:
+
+* Constants
+* Mimir
+* Nodes (node accounts)
+* Current TX queue length
+* Pools (current and at arbitrary height)
+* Tendermint block at height
+* Inbound addresses and other chain info
+* Asgard & Yggdrasil vaults (new!)
+* Balance of THOR account
+
+## Installation
+
+`python -m pip install git+https://github.com/tirinox/aiothornode`
+
+## Quick start
+
+The following code is quite self-documenting:
+
+```
+import random
+
+from aiothornode.connector import *
+from aiothornode.env import *
+import asyncio
+import aiohttp
+
+
+def delim():
+ print('-' * 100)
+
+
+async def main():
+ env = MAINNET.copy()
+ # env = ThorEnvironment(...) # custom
+
+ async with aiohttp.ClientSession() as session:
+ connector = ThorConnector(env, session)
+
+ genesis = await connector.query_genesis()
+ print(f'Chain ID = {genesis["chain_id"]}')
+ delim()
+
+ chains = await connector.query_chain_info()
+ chains = list(chains.values())
+ print('Chain info:', chains)
+ delim()
+
+ print('Tendermint Block:')
+ tender_block = await connector.query_tendermint_block_raw(100001)
+ block_header = tender_block['result']['block']['header']
+ print(f'{block_header["height"] = } and {block_header["time"] = }')
+ delim()
+
+ constants = await connector.query_constants()
+ print(f'Constants: {constants}')
+ delim()
+
+ mimir = await connector.query_mimir()
+ mimir_1 = mimir.get('MINIMUMBONDINRUNE')
+ print(f'Mimir: {mimir}, MINIMUMBONDINRUNE = {mimir_1}')
+ delim()
+
+ queue = await connector.query_queue()
+ print(f'Queue: {queue}')
+ delim()
+
+ node_accounts = await connector.query_node_accounts(consensus=False)
+ print(f'Example node account: {random.sample(node_accounts, 1)[0]}')
+ delim()
+
+ pool = await connector.query_pool('BNB.BUSD-BD1', height=8218339)
+ print(pool)
+ delim()
+
+ pools = await connector.query_pools()
+ print(pools[0])
+ print(f'Total {len(pools)} pools')
+ delim()
+
+ bank = await connector.query_balance('thor1dheycdevq39qlkxs2a6wuuzyn4aqxhve4qxtxt')
+ print(f'Balance of {bank.address} is {bank.runes_float} Rune')
+ delim()
+
+
+if __name__ == '__main__':
+ asyncio.run(main())
+```
+
+## Testing
+
+Install PyTest and an async plugin for it:
+
+```
+pip install pytest
+pip install pytest-asyncio
+```
+
+Then run
+
+```
+pytest test
+```
+
+
+%prep
+%autosetup -n aiothornode-0.1.7
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-aiothornode -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.7-1
+- Package Spec generated