diff --git a/utils/sdk/client/python/.github/workflows/python.yml b/utils/sdk/client/python/.github/workflows/python.yml new file mode 100644 index 00000000..38a0c5e6 --- /dev/null +++ b/utils/sdk/client/python/.github/workflows/python.yml @@ -0,0 +1,34 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: lthn Python package + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r test-requirements.txt + - name: Test with pytest + run: | + pytest --cov=lthn diff --git a/utils/sdk/client/python/.gitignore b/utils/sdk/client/python/.gitignore new file mode 100644 index 00000000..65b06b95 --- /dev/null +++ b/utils/sdk/client/python/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Ipython Notebook +.ipynb_checkpoints diff --git a/utils/sdk/client/python/.gitlab-ci.yml b/utils/sdk/client/python/.gitlab-ci.yml new file mode 100644 index 00000000..b25bbb1b --- /dev/null +++ b/utils/sdk/client/python/.gitlab-ci.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=lthn + +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine +pytest-3.12: + extends: .pytest + image: python:3.12-alpine +pytest-3.13: + extends: .pytest + image: python:3.13-alpine diff --git a/utils/sdk/client/python/.openapi-generator-ignore b/utils/sdk/client/python/.openapi-generator-ignore new file mode 100644 index 00000000..def5120f --- /dev/null +++ b/utils/sdk/client/python/.openapi-generator-ignore @@ -0,0 +1,3 @@ +git_push.sh +.travis.yml +README.md diff --git a/utils/sdk/client/python/.openapi-generator/FILES b/utils/sdk/client/python/.openapi-generator/FILES new file mode 100644 index 00000000..fe750aec --- /dev/null +++ b/utils/sdk/client/python/.openapi-generator/FILES @@ -0,0 +1,88 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +docs/BlockApi.md +docs/BlockDetailsModel.md +docs/BlockProcessingPerformanceModel.md +docs/BlockTemplateModel.md +docs/BlockTemplateRequestModel.md +docs/DbStatInfoModel.md +docs/HeightModel.md +docs/InfoApi.md +docs/InfoModel.md +docs/MaintainersInfoModel.md +docs/PerformanceModel.md +docs/PosEntryModel.md +docs/SubmitBlockRequestModel.md +docs/SubmitBlockResponseModel.md +docs/TransactionAttachmentModel.md +docs/TransactionDetailsModel.md +docs/TransactionExtraModel.md +docs/TransactionInputModel.md +docs/TransactionOutputModel.md +docs/TxGenerationContextModel.md +docs/TxPoolPerformanceModel.md +docs/TxProcessingPerformanceModel.md +docs/VersionModel.md +lthn/__init__.py +lthn/api/__init__.py +lthn/api/block_api.py +lthn/api/info_api.py +lthn/api_client.py +lthn/api_response.py +lthn/configuration.py +lthn/exceptions.py +lthn/models/__init__.py +lthn/models/block_details_model.py +lthn/models/block_processing_performance_model.py +lthn/models/block_template_model.py +lthn/models/block_template_request_model.py +lthn/models/db_stat_info_model.py +lthn/models/height_model.py +lthn/models/info_model.py +lthn/models/maintainers_info_model.py +lthn/models/performance_model.py +lthn/models/pos_entry_model.py +lthn/models/submit_block_request_model.py +lthn/models/submit_block_response_model.py +lthn/models/transaction_attachment_model.py +lthn/models/transaction_details_model.py +lthn/models/transaction_extra_model.py +lthn/models/transaction_input_model.py +lthn/models/transaction_output_model.py +lthn/models/tx_generation_context_model.py +lthn/models/tx_pool_performance_model.py +lthn/models/tx_processing_performance_model.py +lthn/models/version_model.py +lthn/py.typed +lthn/rest.py +pyproject.toml +requirements.txt +setup.cfg +setup.py +test-requirements.txt +test/__init__.py +test/test_block_api.py +test/test_block_details_model.py +test/test_block_processing_performance_model.py +test/test_block_template_model.py +test/test_block_template_request_model.py +test/test_db_stat_info_model.py +test/test_height_model.py +test/test_info_api.py +test/test_info_model.py +test/test_maintainers_info_model.py +test/test_performance_model.py +test/test_pos_entry_model.py +test/test_submit_block_request_model.py +test/test_submit_block_response_model.py +test/test_transaction_attachment_model.py +test/test_transaction_details_model.py +test/test_transaction_extra_model.py +test/test_transaction_input_model.py +test/test_transaction_output_model.py +test/test_tx_generation_context_model.py +test/test_tx_pool_performance_model.py +test/test_tx_processing_performance_model.py +test/test_version_model.py +tox.ini diff --git a/utils/sdk/client/python/.openapi-generator/VERSION b/utils/sdk/client/python/.openapi-generator/VERSION new file mode 100644 index 00000000..971ecb25 --- /dev/null +++ b/utils/sdk/client/python/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.16.0 diff --git a/utils/sdk/client/python/docs/BlockApi.md b/utils/sdk/client/python/docs/BlockApi.md new file mode 100644 index 00000000..0d6b4c53 --- /dev/null +++ b/utils/sdk/client/python/docs/BlockApi.md @@ -0,0 +1,345 @@ +# lthn.BlockApi + +All URIs are relative to *http://127.0.0.1:36943* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_block_template**](BlockApi.md#create_block_template) | **POST** /block/template | Create a block template for mining +[**get_block**](BlockApi.md#get_block) | **GET** /block/{identifier} | Get a block by its hash or height (ID) +[**get_blocks**](BlockApi.md#get_blocks) | **GET** /block | Get one or more blocks, with optional pagination. +[**get_height**](BlockApi.md#get_height) | **GET** /block/height | Get the current blockchain height +[**submit_block**](BlockApi.md#submit_block) | **POST** /block/submit | Submit a new block to the network + + +# **create_block_template** +> BlockTemplateModel create_block_template(block_template_request_model) + +Create a block template for mining + +### Example + + +```python +import lthn +from lthn.models.block_template_model import BlockTemplateModel +from lthn.models.block_template_request_model import BlockTemplateRequestModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.BlockApi(api_client) + block_template_request_model = lthn.BlockTemplateRequestModel() # BlockTemplateRequestModel | + + try: + # Create a block template for mining + api_response = api_instance.create_block_template(block_template_request_model) + print("The response of BlockApi->create_block_template:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->create_block_template: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **block_template_request_model** | [**BlockTemplateRequestModel**](BlockTemplateRequestModel.md)| | + +### Return type + +[**BlockTemplateModel**](BlockTemplateModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**500** | text/plain | - | +**400** | text/plain | - | +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_block** +> BlockDetailsModel get_block(identifier) + +Get a block by its hash or height (ID) + +### Example + + +```python +import lthn +from lthn.models.block_details_model import BlockDetailsModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.BlockApi(api_client) + identifier = 'identifier_example' # str | The hash (hex string) or height (integer) of the block to retrieve. + + try: + # Get a block by its hash or height (ID) + api_response = api_instance.get_block(identifier) + print("The response of BlockApi->get_block:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->get_block: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **identifier** | **str**| The hash (hex string) or height (integer) of the block to retrieve. | + +### Return type + +[**BlockDetailsModel**](BlockDetailsModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**404** | text/plain | - | +**400** | text/plain | - | +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_blocks** +> List[BlockDetailsModel] get_blocks() + +Get one or more blocks, with optional pagination. + +### Example + + +```python +import lthn +from lthn.models.block_details_model import BlockDetailsModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.BlockApi(api_client) + + try: + # Get one or more blocks, with optional pagination. + api_response = api_instance.get_blocks() + print("The response of BlockApi->get_blocks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->get_blocks: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**List[BlockDetailsModel]**](BlockDetailsModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**404** | text/plain | - | +**400** | text/plain | - | +**200** | A list of block objects. | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_height** +> HeightModel get_height() + +Get the current blockchain height + +### Example + + +```python +import lthn +from lthn.models.height_model import HeightModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.BlockApi(api_client) + + try: + # Get the current blockchain height + api_response = api_instance.get_height() + print("The response of BlockApi->get_height:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->get_height: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**HeightModel**](HeightModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **submit_block** +> SubmitBlockResponseModel submit_block(submit_block_request_model) + +Submit a new block to the network + +### Example + + +```python +import lthn +from lthn.models.submit_block_request_model import SubmitBlockRequestModel +from lthn.models.submit_block_response_model import SubmitBlockResponseModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.BlockApi(api_client) + submit_block_request_model = lthn.SubmitBlockRequestModel() # SubmitBlockRequestModel | + + try: + # Submit a new block to the network + api_response = api_instance.submit_block(submit_block_request_model) + print("The response of BlockApi->submit_block:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->submit_block: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **submit_block_request_model** | [**SubmitBlockRequestModel**](SubmitBlockRequestModel.md)| | + +### Return type + +[**SubmitBlockResponseModel**](SubmitBlockResponseModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**406** | text/plain | - | +**400** | text/plain | - | +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/utils/sdk/client/python/docs/BlockDetailsModel.md b/utils/sdk/client/python/docs/BlockDetailsModel.md new file mode 100644 index 00000000..5bf0f75d --- /dev/null +++ b/utils/sdk/client/python/docs/BlockDetailsModel.md @@ -0,0 +1,53 @@ +# BlockDetailsModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**actual_timestamp** | **int** | | [optional] +**already_generated_coins** | **str** | | [optional] +**base_reward** | **int** | | [optional] +**blob** | **str** | | [optional] +**block_cumulative_size** | **int** | | [optional] +**block_tself_size** | **int** | | [optional] +**cumulative_diff_adjusted** | **str** | | [optional] +**cumulative_diff_precise** | **str** | | [optional] +**difficulty** | **str** | | [optional] +**effective_fee_median** | **int** | | [optional] +**height** | **int** | | [optional] +**id** | **str** | | [optional] +**is_orphan** | **bool** | | [optional] +**miner_text_info** | **str** | | [optional] +**object_in_json** | **str** | | [optional] +**penalty** | **int** | | [optional] +**pow_seed** | **str** | | [optional] +**prev_id** | **str** | | [optional] +**summary_reward** | **int** | | [optional] +**this_block_fee_median** | **int** | | [optional] +**timestamp** | **int** | | [optional] +**total_fee** | **int** | | [optional] +**total_txs_size** | **int** | | [optional] +**transactions_details** | [**List[TransactionDetailsModel]**](TransactionDetailsModel.md) | | [optional] +**type** | **int** | | [optional] + +## Example + +```python +from lthn.models.block_details_model import BlockDetailsModel + +# TODO update the JSON string below +json = "{}" +# create an instance of BlockDetailsModel from a JSON string +block_details_model_instance = BlockDetailsModel.from_json(json) +# print the JSON string representation of the object +print(BlockDetailsModel.to_json()) + +# convert the object into a dict +block_details_model_dict = block_details_model_instance.to_dict() +# create an instance of BlockDetailsModel from a dict +block_details_model_from_dict = BlockDetailsModel.from_dict(block_details_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/BlockProcessingPerformanceModel.md b/utils/sdk/client/python/docs/BlockProcessingPerformanceModel.md new file mode 100644 index 00000000..6550f71b --- /dev/null +++ b/utils/sdk/client/python/docs/BlockProcessingPerformanceModel.md @@ -0,0 +1,44 @@ +# BlockProcessingPerformanceModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_processing_time_0** | **int** | | [optional] +**block_processing_time_1** | **int** | | [optional] +**target_calculating_time_2** | **int** | | [optional] +**longhash_calculating_time_3** | **int** | | [optional] +**all_txs_insert_time_5** | **int** | | [optional] +**etc_stuff_6** | **int** | | [optional] +**insert_time_4** | **int** | | [optional] +**raise_block_core_event** | **int** | | [optional] +**validate_miner_transaction_time** | **int** | | [optional] +**collect_rangeproofs_data_from_tx_time** | **int** | | [optional] +**verify_multiple_zc_outs_range_proofs_time** | **int** | | [optional] +**target_calculating_enum_blocks** | **int** | | [optional] +**target_calculating_calc** | **int** | | [optional] +**pos_validate_ki_search** | **int** | | [optional] +**pos_validate_get_out_keys_for_inputs** | **int** | | [optional] +**pos_validate_zvp** | **int** | | [optional] + +## Example + +```python +from lthn.models.block_processing_performance_model import BlockProcessingPerformanceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of BlockProcessingPerformanceModel from a JSON string +block_processing_performance_model_instance = BlockProcessingPerformanceModel.from_json(json) +# print the JSON string representation of the object +print(BlockProcessingPerformanceModel.to_json()) + +# convert the object into a dict +block_processing_performance_model_dict = block_processing_performance_model_instance.to_dict() +# create an instance of BlockProcessingPerformanceModel from a dict +block_processing_performance_model_from_dict = BlockProcessingPerformanceModel.from_dict(block_processing_performance_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/BlockTemplateModel.md b/utils/sdk/client/python/docs/BlockTemplateModel.md new file mode 100644 index 00000000..e9a1d658 --- /dev/null +++ b/utils/sdk/client/python/docs/BlockTemplateModel.md @@ -0,0 +1,37 @@ +# BlockTemplateModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**blocktemplate_blob** | **str** | | [optional] +**difficulty** | **str** | | [optional] +**height** | **int** | | [optional] +**miner_tx_tgc** | [**TxGenerationContextModel**](TxGenerationContextModel.md) | | [optional] +**block_reward_without_fee** | **int** | | [optional] +**block_reward** | **int** | | [optional] +**txs_fee** | **int** | | [optional] +**prev_hash** | **str** | | [optional] +**seed** | **str** | | [optional] + +## Example + +```python +from lthn.models.block_template_model import BlockTemplateModel + +# TODO update the JSON string below +json = "{}" +# create an instance of BlockTemplateModel from a JSON string +block_template_model_instance = BlockTemplateModel.from_json(json) +# print the JSON string representation of the object +print(BlockTemplateModel.to_json()) + +# convert the object into a dict +block_template_model_dict = block_template_model_instance.to_dict() +# create an instance of BlockTemplateModel from a dict +block_template_model_from_dict = BlockTemplateModel.from_dict(block_template_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/BlockTemplateRequestModel.md b/utils/sdk/client/python/docs/BlockTemplateRequestModel.md new file mode 100644 index 00000000..065f68be --- /dev/null +++ b/utils/sdk/client/python/docs/BlockTemplateRequestModel.md @@ -0,0 +1,35 @@ +# BlockTemplateRequestModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**miner_address** | **str** | | [optional] +**stakeholder_address** | **str** | | [optional] +**ex_nonce** | **str** | | [optional] +**pos_block** | **bool** | | [optional] +**ignore_pow_ts_check** | **bool** | | [optional] +**pe** | [**PosEntryModel**](PosEntryModel.md) | | [optional] +**explicit_txs** | **List[str]** | | [optional] + +## Example + +```python +from lthn.models.block_template_request_model import BlockTemplateRequestModel + +# TODO update the JSON string below +json = "{}" +# create an instance of BlockTemplateRequestModel from a JSON string +block_template_request_model_instance = BlockTemplateRequestModel.from_json(json) +# print the JSON string representation of the object +print(BlockTemplateRequestModel.to_json()) + +# convert the object into a dict +block_template_request_model_dict = block_template_request_model_instance.to_dict() +# create an instance of BlockTemplateRequestModel from a dict +block_template_request_model_from_dict = BlockTemplateRequestModel.from_dict(block_template_request_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/DbStatInfoModel.md b/utils/sdk/client/python/docs/DbStatInfoModel.md new file mode 100644 index 00000000..67844f7e --- /dev/null +++ b/utils/sdk/client/python/docs/DbStatInfoModel.md @@ -0,0 +1,31 @@ +# DbStatInfoModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_count** | **int** | | [optional] +**write_tx_count** | **int** | | [optional] +**map_size** | **int** | | [optional] + +## Example + +```python +from lthn.models.db_stat_info_model import DbStatInfoModel + +# TODO update the JSON string below +json = "{}" +# create an instance of DbStatInfoModel from a JSON string +db_stat_info_model_instance = DbStatInfoModel.from_json(json) +# print the JSON string representation of the object +print(DbStatInfoModel.to_json()) + +# convert the object into a dict +db_stat_info_model_dict = db_stat_info_model_instance.to_dict() +# create an instance of DbStatInfoModel from a dict +db_stat_info_model_from_dict = DbStatInfoModel.from_dict(db_stat_info_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/HeightModel.md b/utils/sdk/client/python/docs/HeightModel.md new file mode 100644 index 00000000..9f5ebf81 --- /dev/null +++ b/utils/sdk/client/python/docs/HeightModel.md @@ -0,0 +1,29 @@ +# HeightModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**height** | **int** | | [optional] + +## Example + +```python +from lthn.models.height_model import HeightModel + +# TODO update the JSON string below +json = "{}" +# create an instance of HeightModel from a JSON string +height_model_instance = HeightModel.from_json(json) +# print the JSON string representation of the object +print(HeightModel.to_json()) + +# convert the object into a dict +height_model_dict = height_model_instance.to_dict() +# create an instance of HeightModel from a dict +height_model_from_dict = HeightModel.from_dict(height_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/InfoApi.md b/utils/sdk/client/python/docs/InfoApi.md new file mode 100644 index 00000000..914dc8a7 --- /dev/null +++ b/utils/sdk/client/python/docs/InfoApi.md @@ -0,0 +1,140 @@ +# lthn.InfoApi + +All URIs are relative to *http://127.0.0.1:36943* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_info**](InfoApi.md#get_info) | **GET** /info | Get detailed information about the blockchain and daemon state +[**version**](InfoApi.md#version) | **GET** /info/version | Get API version + + +# **get_info** +> InfoModel get_info(flags=flags) + +Get detailed information about the blockchain and daemon state + +### Example + + +```python +import lthn +from lthn.models.info_model import InfoModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.InfoApi(api_client) + flags = 'flags_example' # str | Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + + try: + # Get detailed information about the blockchain and daemon state + api_response = api_instance.get_info(flags=flags) + print("The response of InfoApi->get_info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InfoApi->get_info: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **flags** | **str**| Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. | [optional] + +### Return type + +[**InfoModel**](InfoModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **version** +> VersionModel version() + +Get API version + +Returns the current version of the API. + +### Example + + +```python +import lthn +from lthn.models.version_model import VersionModel +from lthn.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://127.0.0.1:36943 +# See configuration.py for a list of all supported configuration parameters. +configuration = lthn.Configuration( + host = "http://127.0.0.1:36943" +) + + +# Enter a context with an instance of the API client +with lthn.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lthn.InfoApi(api_client) + + try: + # Get API version + api_response = api_instance.version() + print("The response of InfoApi->version:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InfoApi->version: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**VersionModel**](VersionModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/utils/sdk/client/python/docs/InfoModel.md b/utils/sdk/client/python/docs/InfoModel.md new file mode 100644 index 00000000..b34a5fb1 --- /dev/null +++ b/utils/sdk/client/python/docs/InfoModel.md @@ -0,0 +1,74 @@ +# InfoModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**height** | **int** | | [optional] +**tx_count** | **int** | | [optional] +**tx_pool_size** | **int** | | [optional] +**alt_blocks_count** | **int** | | [optional] +**outgoing_connections_count** | **int** | | [optional] +**incoming_connections_count** | **int** | | [optional] +**synchronized_connections_count** | **int** | | [optional] +**white_peerlist_size** | **int** | | [optional] +**grey_peerlist_size** | **int** | | [optional] +**current_blocks_median** | **int** | | [optional] +**alias_count** | **int** | | [optional] +**current_max_allowed_block_size** | **int** | | [optional] +**daemon_network_state** | **str** | | [optional] +**synchronization_start_height** | **int** | | [optional] +**max_net_seen_height** | **int** | | [optional] +**mi** | [**MaintainersInfoModel**](MaintainersInfoModel.md) | | [optional] +**pos_allowed** | **bool** | | [optional] +**pos_difficulty** | **str** | | [optional] +**pow_difficulty** | **int** | | [optional] +**default_fee** | **int** | | [optional] +**minimum_fee** | **int** | | [optional] +**is_hardfork_active** | **List[bool]** | | [optional] +**net_time_delta_median** | **int** | | [optional] +**current_network_hashrate_50** | **int** | | [optional] +**current_network_hashrate_350** | **int** | | [optional] +**seconds_for_10_blocks** | **int** | | [optional] +**seconds_for_30_blocks** | **int** | | [optional] +**transactions_cnt_per_day** | **List[int]** | | [optional] +**transactions_volume_per_day** | **List[int]** | | [optional] +**last_pos_timestamp** | **int** | | [optional] +**last_pow_timestamp** | **int** | | [optional] +**total_coins** | **str** | | [optional] +**last_block_size** | **int** | | [optional] +**tx_count_in_last_block** | **int** | | [optional] +**pos_sequence_factor** | **float** | | [optional] +**pow_sequence_factor** | **float** | | [optional] +**block_reward** | **int** | | [optional] +**last_block_total_reward** | **int** | | [optional] +**pos_diff_total_coins_rate** | **int** | | [optional] +**last_block_timestamp** | **int** | | [optional] +**last_block_hash** | **str** | | [optional] +**pos_block_ts_shift_vs_actual** | **int** | | [optional] +**outs_stat** | **Dict[str, int]** | | [optional] +**performance_data** | [**PerformanceModel**](PerformanceModel.md) | | [optional] +**offers_count** | **int** | | [optional] +**expiration_median_timestamp** | **int** | | [optional] + +## Example + +```python +from lthn.models.info_model import InfoModel + +# TODO update the JSON string below +json = "{}" +# create an instance of InfoModel from a JSON string +info_model_instance = InfoModel.from_json(json) +# print the JSON string representation of the object +print(InfoModel.to_json()) + +# convert the object into a dict +info_model_dict = info_model_instance.to_dict() +# create an instance of InfoModel from a dict +info_model_from_dict = InfoModel.from_dict(info_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/MaintainersInfoModel.md b/utils/sdk/client/python/docs/MaintainersInfoModel.md new file mode 100644 index 00000000..c80b5a41 --- /dev/null +++ b/utils/sdk/client/python/docs/MaintainersInfoModel.md @@ -0,0 +1,33 @@ +# MaintainersInfoModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ver_major** | **int** | | [optional] +**ver_minor** | **int** | | [optional] +**ver_revision** | **int** | | [optional] +**build_no** | **int** | | [optional] +**mode** | **int** | | [optional] + +## Example + +```python +from lthn.models.maintainers_info_model import MaintainersInfoModel + +# TODO update the JSON string below +json = "{}" +# create an instance of MaintainersInfoModel from a JSON string +maintainers_info_model_instance = MaintainersInfoModel.from_json(json) +# print the JSON string representation of the object +print(MaintainersInfoModel.to_json()) + +# convert the object into a dict +maintainers_info_model_dict = maintainers_info_model_instance.to_dict() +# create an instance of MaintainersInfoModel from a dict +maintainers_info_model_from_dict = MaintainersInfoModel.from_dict(maintainers_info_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/PerformanceModel.md b/utils/sdk/client/python/docs/PerformanceModel.md new file mode 100644 index 00000000..4b7b302b --- /dev/null +++ b/utils/sdk/client/python/docs/PerformanceModel.md @@ -0,0 +1,32 @@ +# PerformanceModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_processing** | [**BlockProcessingPerformanceModel**](BlockProcessingPerformanceModel.md) | | [optional] +**tx_processing** | [**TxProcessingPerformanceModel**](TxProcessingPerformanceModel.md) | | [optional] +**tx_pool** | [**TxPoolPerformanceModel**](TxPoolPerformanceModel.md) | | [optional] +**db_stat_info** | [**DbStatInfoModel**](DbStatInfoModel.md) | | [optional] + +## Example + +```python +from lthn.models.performance_model import PerformanceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of PerformanceModel from a JSON string +performance_model_instance = PerformanceModel.from_json(json) +# print the JSON string representation of the object +print(PerformanceModel.to_json()) + +# convert the object into a dict +performance_model_dict = performance_model_instance.to_dict() +# create an instance of PerformanceModel from a dict +performance_model_from_dict = PerformanceModel.from_dict(performance_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/PosEntryModel.md b/utils/sdk/client/python/docs/PosEntryModel.md new file mode 100644 index 00000000..1d44ec66 --- /dev/null +++ b/utils/sdk/client/python/docs/PosEntryModel.md @@ -0,0 +1,36 @@ +# PosEntryModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**g_index** | **int** | | [optional] +**keyimage** | **str** | | [optional] +**block_timestamp** | **int** | | [optional] +**stake_unlock_time** | **int** | | [optional] +**tx_id** | **str** | | [optional] +**tx_out_index** | **int** | | [optional] +**wallet_index** | **int** | | [optional] + +## Example + +```python +from lthn.models.pos_entry_model import PosEntryModel + +# TODO update the JSON string below +json = "{}" +# create an instance of PosEntryModel from a JSON string +pos_entry_model_instance = PosEntryModel.from_json(json) +# print the JSON string representation of the object +print(PosEntryModel.to_json()) + +# convert the object into a dict +pos_entry_model_dict = pos_entry_model_instance.to_dict() +# create an instance of PosEntryModel from a dict +pos_entry_model_from_dict = PosEntryModel.from_dict(pos_entry_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/SubmitBlockRequestModel.md b/utils/sdk/client/python/docs/SubmitBlockRequestModel.md new file mode 100644 index 00000000..080a29fb --- /dev/null +++ b/utils/sdk/client/python/docs/SubmitBlockRequestModel.md @@ -0,0 +1,29 @@ +# SubmitBlockRequestModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_blob** | **str** | | [optional] + +## Example + +```python +from lthn.models.submit_block_request_model import SubmitBlockRequestModel + +# TODO update the JSON string below +json = "{}" +# create an instance of SubmitBlockRequestModel from a JSON string +submit_block_request_model_instance = SubmitBlockRequestModel.from_json(json) +# print the JSON string representation of the object +print(SubmitBlockRequestModel.to_json()) + +# convert the object into a dict +submit_block_request_model_dict = submit_block_request_model_instance.to_dict() +# create an instance of SubmitBlockRequestModel from a dict +submit_block_request_model_from_dict = SubmitBlockRequestModel.from_dict(submit_block_request_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/SubmitBlockResponseModel.md b/utils/sdk/client/python/docs/SubmitBlockResponseModel.md new file mode 100644 index 00000000..b228a9e4 --- /dev/null +++ b/utils/sdk/client/python/docs/SubmitBlockResponseModel.md @@ -0,0 +1,29 @@ +# SubmitBlockResponseModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **str** | | [optional] + +## Example + +```python +from lthn.models.submit_block_response_model import SubmitBlockResponseModel + +# TODO update the JSON string below +json = "{}" +# create an instance of SubmitBlockResponseModel from a JSON string +submit_block_response_model_instance = SubmitBlockResponseModel.from_json(json) +# print the JSON string representation of the object +print(SubmitBlockResponseModel.to_json()) + +# convert the object into a dict +submit_block_response_model_dict = submit_block_response_model_instance.to_dict() +# create an instance of SubmitBlockResponseModel from a dict +submit_block_response_model_from_dict = SubmitBlockResponseModel.from_dict(submit_block_response_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TransactionAttachmentModel.md b/utils/sdk/client/python/docs/TransactionAttachmentModel.md new file mode 100644 index 00000000..a07227ee --- /dev/null +++ b/utils/sdk/client/python/docs/TransactionAttachmentModel.md @@ -0,0 +1,31 @@ +# TransactionAttachmentModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**short_view** | **str** | | [optional] +**details_view** | **str** | | [optional] + +## Example + +```python +from lthn.models.transaction_attachment_model import TransactionAttachmentModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TransactionAttachmentModel from a JSON string +transaction_attachment_model_instance = TransactionAttachmentModel.from_json(json) +# print the JSON string representation of the object +print(TransactionAttachmentModel.to_json()) + +# convert the object into a dict +transaction_attachment_model_dict = transaction_attachment_model_instance.to_dict() +# create an instance of TransactionAttachmentModel from a dict +transaction_attachment_model_from_dict = TransactionAttachmentModel.from_dict(transaction_attachment_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TransactionDetailsModel.md b/utils/sdk/client/python/docs/TransactionDetailsModel.md new file mode 100644 index 00000000..f05703a3 --- /dev/null +++ b/utils/sdk/client/python/docs/TransactionDetailsModel.md @@ -0,0 +1,41 @@ +# TransactionDetailsModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**attachments** | [**List[TransactionAttachmentModel]**](TransactionAttachmentModel.md) | | [optional] +**blob** | **str** | | [optional] +**blob_size** | **int** | | [optional] +**extra** | [**List[TransactionExtraModel]**](TransactionExtraModel.md) | | [optional] +**fee** | **int** | | [optional] +**id** | **str** | | [optional] +**ins** | [**List[TransactionInputModel]**](TransactionInputModel.md) | | [optional] +**keeper_block** | **int** | | [optional] +**object_in_json** | **str** | | [optional] +**outs** | [**List[TransactionOutputModel]**](TransactionOutputModel.md) | | [optional] +**pub_key** | **str** | | [optional] +**timestamp** | **int** | | [optional] + +## Example + +```python +from lthn.models.transaction_details_model import TransactionDetailsModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TransactionDetailsModel from a JSON string +transaction_details_model_instance = TransactionDetailsModel.from_json(json) +# print the JSON string representation of the object +print(TransactionDetailsModel.to_json()) + +# convert the object into a dict +transaction_details_model_dict = transaction_details_model_instance.to_dict() +# create an instance of TransactionDetailsModel from a dict +transaction_details_model_from_dict = TransactionDetailsModel.from_dict(transaction_details_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TransactionExtraModel.md b/utils/sdk/client/python/docs/TransactionExtraModel.md new file mode 100644 index 00000000..2de532d0 --- /dev/null +++ b/utils/sdk/client/python/docs/TransactionExtraModel.md @@ -0,0 +1,31 @@ +# TransactionExtraModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**short_view** | **str** | | [optional] +**details_view** | **str** | | [optional] + +## Example + +```python +from lthn.models.transaction_extra_model import TransactionExtraModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TransactionExtraModel from a JSON string +transaction_extra_model_instance = TransactionExtraModel.from_json(json) +# print the JSON string representation of the object +print(TransactionExtraModel.to_json()) + +# convert the object into a dict +transaction_extra_model_dict = transaction_extra_model_instance.to_dict() +# create an instance of TransactionExtraModel from a dict +transaction_extra_model_from_dict = TransactionExtraModel.from_dict(transaction_extra_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TransactionInputModel.md b/utils/sdk/client/python/docs/TransactionInputModel.md new file mode 100644 index 00000000..7f9ded36 --- /dev/null +++ b/utils/sdk/client/python/docs/TransactionInputModel.md @@ -0,0 +1,33 @@ +# TransactionInputModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**global_indexes** | **List[int]** | | [optional] +**htlc_origin** | **str** | | [optional] +**kimage_or_ms_id** | **str** | | [optional] +**multisig_count** | **int** | | [optional] + +## Example + +```python +from lthn.models.transaction_input_model import TransactionInputModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TransactionInputModel from a JSON string +transaction_input_model_instance = TransactionInputModel.from_json(json) +# print the JSON string representation of the object +print(TransactionInputModel.to_json()) + +# convert the object into a dict +transaction_input_model_dict = transaction_input_model_instance.to_dict() +# create an instance of TransactionInputModel from a dict +transaction_input_model_from_dict = TransactionInputModel.from_dict(transaction_input_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TransactionOutputModel.md b/utils/sdk/client/python/docs/TransactionOutputModel.md new file mode 100644 index 00000000..325892f4 --- /dev/null +++ b/utils/sdk/client/python/docs/TransactionOutputModel.md @@ -0,0 +1,33 @@ +# TransactionOutputModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**global_index** | **int** | | [optional] +**is_spent** | **bool** | | [optional] +**minimum_sigs** | **int** | | [optional] +**pub_keys** | **List[str]** | | [optional] + +## Example + +```python +from lthn.models.transaction_output_model import TransactionOutputModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TransactionOutputModel from a JSON string +transaction_output_model_instance = TransactionOutputModel.from_json(json) +# print the JSON string representation of the object +print(TransactionOutputModel.to_json()) + +# convert the object into a dict +transaction_output_model_dict = transaction_output_model_instance.to_dict() +# create an instance of TransactionOutputModel from a dict +transaction_output_model_from_dict = TransactionOutputModel.from_dict(transaction_output_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TxGenerationContextModel.md b/utils/sdk/client/python/docs/TxGenerationContextModel.md new file mode 100644 index 00000000..0d6e61b1 --- /dev/null +++ b/utils/sdk/client/python/docs/TxGenerationContextModel.md @@ -0,0 +1,52 @@ +# TxGenerationContextModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset_ids** | **List[str]** | | [optional] +**blinded_asset_ids** | **List[str]** | | [optional] +**amount_commitments** | **List[str]** | | [optional] +**asset_id_blinding_masks** | **List[str]** | | [optional] +**amounts** | **List[str]** | | [optional] +**amount_blinding_masks** | **List[str]** | | [optional] +**pseudo_outs_blinded_asset_ids** | **List[str]** | | [optional] +**pseudo_outs_plus_real_out_blinding_masks** | **List[str]** | | [optional] +**real_zc_ins_asset_ids** | **List[str]** | | [optional] +**zc_input_amounts** | **List[int]** | | [optional] +**pseudo_out_amount_commitments_sum** | **str** | | [optional] +**pseudo_out_amount_blinding_masks_sum** | **str** | | [optional] +**real_in_asset_id_blinding_mask_x_amount_sum** | **str** | | [optional] +**amount_commitments_sum** | **str** | | [optional] +**amount_blinding_masks_sum** | **str** | | [optional] +**asset_id_blinding_mask_x_amount_sum** | **str** | | [optional] +**ao_asset_id** | **str** | | [optional] +**ao_asset_id_pt** | **str** | | [optional] +**ao_amount_commitment** | **str** | | [optional] +**ao_amount_blinding_mask** | **str** | | [optional] +**ao_commitment_in_outputs** | **bool** | | [optional] +**tx_key_pub** | **str** | | [optional] +**tx_key_sec** | **str** | | [optional] +**tx_pub_key_p** | **str** | | [optional] + +## Example + +```python +from lthn.models.tx_generation_context_model import TxGenerationContextModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TxGenerationContextModel from a JSON string +tx_generation_context_model_instance = TxGenerationContextModel.from_json(json) +# print the JSON string representation of the object +print(TxGenerationContextModel.to_json()) + +# convert the object into a dict +tx_generation_context_model_dict = tx_generation_context_model_instance.to_dict() +# create an instance of TxGenerationContextModel from a dict +tx_generation_context_model_from_dict = TxGenerationContextModel.from_dict(tx_generation_context_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TxPoolPerformanceModel.md b/utils/sdk/client/python/docs/TxPoolPerformanceModel.md new file mode 100644 index 00000000..ee9f0557 --- /dev/null +++ b/utils/sdk/client/python/docs/TxPoolPerformanceModel.md @@ -0,0 +1,39 @@ +# TxPoolPerformanceModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_processing_time** | **int** | | [optional] +**check_inputs_types_supported_time** | **int** | | [optional] +**expiration_validate_time** | **int** | | [optional] +**validate_amount_time** | **int** | | [optional] +**validate_alias_time** | **int** | | [optional] +**check_keyimages_ws_ms_time** | **int** | | [optional] +**check_inputs_time** | **int** | | [optional] +**begin_tx_time** | **int** | | [optional] +**update_db_time** | **int** | | [optional] +**db_commit_time** | **int** | | [optional] +**check_post_hf4_balance** | **int** | | [optional] + +## Example + +```python +from lthn.models.tx_pool_performance_model import TxPoolPerformanceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TxPoolPerformanceModel from a JSON string +tx_pool_performance_model_instance = TxPoolPerformanceModel.from_json(json) +# print the JSON string representation of the object +print(TxPoolPerformanceModel.to_json()) + +# convert the object into a dict +tx_pool_performance_model_dict = tx_pool_performance_model_instance.to_dict() +# create an instance of TxPoolPerformanceModel from a dict +tx_pool_performance_model_from_dict = TxPoolPerformanceModel.from_dict(tx_pool_performance_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/TxProcessingPerformanceModel.md b/utils/sdk/client/python/docs/TxProcessingPerformanceModel.md new file mode 100644 index 00000000..386fdf22 --- /dev/null +++ b/utils/sdk/client/python/docs/TxProcessingPerformanceModel.md @@ -0,0 +1,53 @@ +# TxProcessingPerformanceModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_check_inputs** | **int** | | [optional] +**tx_add_one_tx** | **int** | | [optional] +**tx_process_extra** | **int** | | [optional] +**tx_process_attachment** | **int** | | [optional] +**tx_process_inputs** | **int** | | [optional] +**tx_push_global_index** | **int** | | [optional] +**tx_check_exist** | **int** | | [optional] +**tx_print_log** | **int** | | [optional] +**tx_prapare_append** | **int** | | [optional] +**tx_append** | **int** | | [optional] +**tx_append_rl_wait** | **int** | | [optional] +**tx_append_is_expired** | **int** | | [optional] +**tx_store_db** | **int** | | [optional] +**tx_check_inputs_prefix_hash** | **int** | | [optional] +**tx_check_inputs_attachment_check** | **int** | | [optional] +**tx_check_inputs_loop** | **int** | | [optional] +**tx_check_inputs_loop_kimage_check** | **int** | | [optional] +**tx_check_inputs_loop_ch_in_val_sig** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_get_item_size** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_relative_to_absolute** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop_get_subitem** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop_find_tx** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop_handle_output** | **int** | | [optional] +**tx_mixin_count** | **int** | | [optional] + +## Example + +```python +from lthn.models.tx_processing_performance_model import TxProcessingPerformanceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of TxProcessingPerformanceModel from a JSON string +tx_processing_performance_model_instance = TxProcessingPerformanceModel.from_json(json) +# print the JSON string representation of the object +print(TxProcessingPerformanceModel.to_json()) + +# convert the object into a dict +tx_processing_performance_model_dict = tx_processing_performance_model_instance.to_dict() +# create an instance of TxProcessingPerformanceModel from a dict +tx_processing_performance_model_from_dict = TxProcessingPerformanceModel.from_dict(tx_processing_performance_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/docs/VersionModel.md b/utils/sdk/client/python/docs/VersionModel.md new file mode 100644 index 00000000..89d6bb7a --- /dev/null +++ b/utils/sdk/client/python/docs/VersionModel.md @@ -0,0 +1,33 @@ +# VersionModel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**version** | **str** | | [optional] +**version_long** | **str** | | [optional] +**major** | **str** | | [optional] +**minor** | **str** | | [optional] +**revision** | **str** | | [optional] + +## Example + +```python +from lthn.models.version_model import VersionModel + +# TODO update the JSON string below +json = "{}" +# create an instance of VersionModel from a JSON string +version_model_instance = VersionModel.from_json(json) +# print the JSON string representation of the object +print(VersionModel.to_json()) + +# convert the object into a dict +version_model_dict = version_model_instance.to_dict() +# create an instance of VersionModel from a dict +version_model_from_dict = VersionModel.from_dict(version_model_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/utils/sdk/client/python/lthn/__init__.py b/utils/sdk/client/python/lthn/__init__.py new file mode 100644 index 00000000..119c753c --- /dev/null +++ b/utils/sdk/client/python/lthn/__init__.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# Define package exports +__all__ = [ + "BlockApi", + "InfoApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "BlockDetailsModel", + "BlockProcessingPerformanceModel", + "BlockTemplateModel", + "BlockTemplateRequestModel", + "DbStatInfoModel", + "HeightModel", + "InfoModel", + "MaintainersInfoModel", + "PerformanceModel", + "PosEntryModel", + "SubmitBlockRequestModel", + "SubmitBlockResponseModel", + "TransactionAttachmentModel", + "TransactionDetailsModel", + "TransactionExtraModel", + "TransactionInputModel", + "TransactionOutputModel", + "TxGenerationContextModel", + "TxPoolPerformanceModel", + "TxProcessingPerformanceModel", + "VersionModel", +] + +# import apis into sdk package +from lthn.api.block_api import BlockApi as BlockApi +from lthn.api.info_api import InfoApi as InfoApi + +# import ApiClient +from lthn.api_response import ApiResponse as ApiResponse +from lthn.api_client import ApiClient as ApiClient +from lthn.configuration import Configuration as Configuration +from lthn.exceptions import OpenApiException as OpenApiException +from lthn.exceptions import ApiTypeError as ApiTypeError +from lthn.exceptions import ApiValueError as ApiValueError +from lthn.exceptions import ApiKeyError as ApiKeyError +from lthn.exceptions import ApiAttributeError as ApiAttributeError +from lthn.exceptions import ApiException as ApiException + +# import models into sdk package +from lthn.models.block_details_model import BlockDetailsModel as BlockDetailsModel +from lthn.models.block_processing_performance_model import BlockProcessingPerformanceModel as BlockProcessingPerformanceModel +from lthn.models.block_template_model import BlockTemplateModel as BlockTemplateModel +from lthn.models.block_template_request_model import BlockTemplateRequestModel as BlockTemplateRequestModel +from lthn.models.db_stat_info_model import DbStatInfoModel as DbStatInfoModel +from lthn.models.height_model import HeightModel as HeightModel +from lthn.models.info_model import InfoModel as InfoModel +from lthn.models.maintainers_info_model import MaintainersInfoModel as MaintainersInfoModel +from lthn.models.performance_model import PerformanceModel as PerformanceModel +from lthn.models.pos_entry_model import PosEntryModel as PosEntryModel +from lthn.models.submit_block_request_model import SubmitBlockRequestModel as SubmitBlockRequestModel +from lthn.models.submit_block_response_model import SubmitBlockResponseModel as SubmitBlockResponseModel +from lthn.models.transaction_attachment_model import TransactionAttachmentModel as TransactionAttachmentModel +from lthn.models.transaction_details_model import TransactionDetailsModel as TransactionDetailsModel +from lthn.models.transaction_extra_model import TransactionExtraModel as TransactionExtraModel +from lthn.models.transaction_input_model import TransactionInputModel as TransactionInputModel +from lthn.models.transaction_output_model import TransactionOutputModel as TransactionOutputModel +from lthn.models.tx_generation_context_model import TxGenerationContextModel as TxGenerationContextModel +from lthn.models.tx_pool_performance_model import TxPoolPerformanceModel as TxPoolPerformanceModel +from lthn.models.tx_processing_performance_model import TxProcessingPerformanceModel as TxProcessingPerformanceModel +from lthn.models.version_model import VersionModel as VersionModel + diff --git a/utils/sdk/client/python/lthn/api/__init__.py b/utils/sdk/client/python/lthn/api/__init__.py new file mode 100644 index 00000000..cfff57cd --- /dev/null +++ b/utils/sdk/client/python/lthn/api/__init__.py @@ -0,0 +1,6 @@ +# flake8: noqa + +# import apis into api package +from lthn.api.block_api import BlockApi +from lthn.api.info_api import InfoApi + diff --git a/utils/sdk/client/python/lthn/api/block_api.py b/utils/sdk/client/python/lthn/api/block_api.py new file mode 100644 index 00000000..117357c0 --- /dev/null +++ b/utils/sdk/client/python/lthn/api/block_api.py @@ -0,0 +1,1349 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import List +from typing_extensions import Annotated +from lthn.models.block_details_model import BlockDetailsModel +from lthn.models.block_template_model import BlockTemplateModel +from lthn.models.block_template_request_model import BlockTemplateRequestModel +from lthn.models.height_model import HeightModel +from lthn.models.submit_block_request_model import SubmitBlockRequestModel +from lthn.models.submit_block_response_model import SubmitBlockResponseModel + +from lthn.api_client import ApiClient, RequestSerialized +from lthn.api_response import ApiResponse +from lthn.rest import RESTResponseType + + +class BlockApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_block_template( + self, + block_template_request_model: BlockTemplateRequestModel, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BlockTemplateModel: + """Create a block template for mining + + + :param block_template_request_model: (required) + :type block_template_request_model: BlockTemplateRequestModel + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_block_template_serialize( + block_template_request_model=block_template_request_model, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '500': None, + '400': None, + '200': "BlockTemplateModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_block_template_with_http_info( + self, + block_template_request_model: BlockTemplateRequestModel, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BlockTemplateModel]: + """Create a block template for mining + + + :param block_template_request_model: (required) + :type block_template_request_model: BlockTemplateRequestModel + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_block_template_serialize( + block_template_request_model=block_template_request_model, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '500': None, + '400': None, + '200': "BlockTemplateModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_block_template_without_preload_content( + self, + block_template_request_model: BlockTemplateRequestModel, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a block template for mining + + + :param block_template_request_model: (required) + :type block_template_request_model: BlockTemplateRequestModel + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_block_template_serialize( + block_template_request_model=block_template_request_model, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '500': None, + '400': None, + '200': "BlockTemplateModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_block_template_serialize( + self, + block_template_request_model, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if block_template_request_model is not None: + _body_params = block_template_request_model + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/block/template', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_block( + self, + identifier: Annotated[StrictStr, Field(description="The hash (hex string) or height (integer) of the block to retrieve.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BlockDetailsModel: + """Get a block by its hash or height (ID) + + + :param identifier: The hash (hex string) or height (integer) of the block to retrieve. (required) + :type identifier: str + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_block_serialize( + identifier=identifier, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '404': None, + '400': None, + '200': "BlockDetailsModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_block_with_http_info( + self, + identifier: Annotated[StrictStr, Field(description="The hash (hex string) or height (integer) of the block to retrieve.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BlockDetailsModel]: + """Get a block by its hash or height (ID) + + + :param identifier: The hash (hex string) or height (integer) of the block to retrieve. (required) + :type identifier: str + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_block_serialize( + identifier=identifier, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '404': None, + '400': None, + '200': "BlockDetailsModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_block_without_preload_content( + self, + identifier: Annotated[StrictStr, Field(description="The hash (hex string) or height (integer) of the block to retrieve.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a block by its hash or height (ID) + + + :param identifier: The hash (hex string) or height (integer) of the block to retrieve. (required) + :type identifier: str + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_block_serialize( + identifier=identifier, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '404': None, + '400': None, + '200': "BlockDetailsModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_block_serialize( + self, + identifier, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if identifier is not None: + _path_params['identifier'] = identifier + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/block/{identifier}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_blocks( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BlockDetailsModel]: + """Get one or more blocks, with optional pagination. + + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_blocks_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '404': None, + '400': None, + '200': "List[BlockDetailsModel]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_blocks_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BlockDetailsModel]]: + """Get one or more blocks, with optional pagination. + + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_blocks_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '404': None, + '400': None, + '200': "List[BlockDetailsModel]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_blocks_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get one or more blocks, with optional pagination. + + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_blocks_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '404': None, + '400': None, + '200': "List[BlockDetailsModel]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_blocks_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/block', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_height( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HeightModel: + """Get the current blockchain height + + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_height_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "HeightModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_height_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HeightModel]: + """Get the current blockchain height + + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_height_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "HeightModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_height_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current blockchain height + + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_height_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "HeightModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_height_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/block/height', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def submit_block( + self, + submit_block_request_model: SubmitBlockRequestModel, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SubmitBlockResponseModel: + """Submit a new block to the network + + + :param submit_block_request_model: (required) + :type submit_block_request_model: SubmitBlockRequestModel + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_block_serialize( + submit_block_request_model=submit_block_request_model, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '406': None, + '400': None, + '200': "SubmitBlockResponseModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def submit_block_with_http_info( + self, + submit_block_request_model: SubmitBlockRequestModel, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SubmitBlockResponseModel]: + """Submit a new block to the network + + + :param submit_block_request_model: (required) + :type submit_block_request_model: SubmitBlockRequestModel + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_block_serialize( + submit_block_request_model=submit_block_request_model, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '406': None, + '400': None, + '200': "SubmitBlockResponseModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def submit_block_without_preload_content( + self, + submit_block_request_model: SubmitBlockRequestModel, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Submit a new block to the network + + + :param submit_block_request_model: (required) + :type submit_block_request_model: SubmitBlockRequestModel + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_block_serialize( + submit_block_request_model=submit_block_request_model, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '406': None, + '400': None, + '200': "SubmitBlockResponseModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _submit_block_serialize( + self, + submit_block_request_model, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if submit_block_request_model is not None: + _body_params = submit_block_request_model + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/block/submit', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/utils/sdk/client/python/lthn/api/info_api.py b/utils/sdk/client/python/lthn/api/info_api.py new file mode 100644 index 00000000..32c9fb0d --- /dev/null +++ b/utils/sdk/client/python/lthn/api/info_api.py @@ -0,0 +1,544 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from lthn.models.info_model import InfoModel +from lthn.models.version_model import VersionModel + +from lthn.api_client import ApiClient, RequestSerialized +from lthn.api_response import ApiResponse +from lthn.rest import RESTResponseType + + +class InfoApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_info( + self, + flags: Annotated[Optional[StrictStr], Field(description="Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> InfoModel: + """Get detailed information about the blockchain and daemon state + + + :param flags: Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. + :type flags: str + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_info_serialize( + flags=flags, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InfoModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_info_with_http_info( + self, + flags: Annotated[Optional[StrictStr], Field(description="Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[InfoModel]: + """Get detailed information about the blockchain and daemon state + + + :param flags: Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. + :type flags: str + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_info_serialize( + flags=flags, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InfoModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_info_without_preload_content( + self, + flags: Annotated[Optional[StrictStr], Field(description="Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get detailed information about the blockchain and daemon state + + + :param flags: Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. + :type flags: str + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_info_serialize( + flags=flags, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "InfoModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_info_serialize( + self, + flags, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if flags is not None: + + _query_params.append(('flags', flags)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def version( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VersionModel: + """Get API version + + Returns the current version of the API. + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._version_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VersionModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def version_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VersionModel]: + """Get API version + + Returns the current version of the API. + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._version_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VersionModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def version_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get API version + + Returns the current version of the API. + + :param _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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._version_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VersionModel", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _version_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/info/version', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/utils/sdk/client/python/lthn/api_client.py b/utils/sdk/client/python/lthn/api_client.py new file mode 100644 index 00000000..35986ff7 --- /dev/null +++ b/utils/sdk/client/python/lthn/api_client.py @@ -0,0 +1,804 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile +import uuid + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from lthn.configuration import Configuration +from lthn.api_response import ApiResponse, T as ApiResponseT +import lthn.models +from lthn import rest +from lthn.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI 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 OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + 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 decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + if isinstance(obj_dict, list): + # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() + return self.sanitize_for_serialization(obj_dict) + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(lthn.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, quote(str(value))) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/utils/sdk/client/python/lthn/api_response.py b/utils/sdk/client/python/lthn/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/utils/sdk/client/python/lthn/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/utils/sdk/client/python/lthn/configuration.py b/utils/sdk/client/python/lthn/configuration.py new file mode 100644 index 00000000..f4affa02 --- /dev/null +++ b/utils/sdk/client/python/lthn/configuration.py @@ -0,0 +1,576 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import http.client as httplib +import logging +from logging import FileHandler +import multiprocessing +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self + +import urllib3 + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: Number of retries for API requests. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "http://127.0.0.1:36943" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("lthn") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """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. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """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. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 6.0.1\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "http://127.0.0.1:36943", + 'description': "Local Daemon", + }, + { + 'url': "http://seed.lethean.io:36943", + 'description': "Seed Server", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/utils/sdk/client/python/lthn/exceptions.py b/utils/sdk/client/python/lthn/exceptions.py new file mode 100644 index 00000000..71fed3dd --- /dev/null +++ b/utils/sdk/client/python/lthn/exceptions.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/utils/sdk/client/python/lthn/models/__init__.py b/utils/sdk/client/python/lthn/models/__init__.py new file mode 100644 index 00000000..ac7c1722 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/__init__.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +# flake8: noqa +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from lthn.models.block_details_model import BlockDetailsModel +from lthn.models.block_processing_performance_model import BlockProcessingPerformanceModel +from lthn.models.block_template_model import BlockTemplateModel +from lthn.models.block_template_request_model import BlockTemplateRequestModel +from lthn.models.db_stat_info_model import DbStatInfoModel +from lthn.models.height_model import HeightModel +from lthn.models.info_model import InfoModel +from lthn.models.maintainers_info_model import MaintainersInfoModel +from lthn.models.performance_model import PerformanceModel +from lthn.models.pos_entry_model import PosEntryModel +from lthn.models.submit_block_request_model import SubmitBlockRequestModel +from lthn.models.submit_block_response_model import SubmitBlockResponseModel +from lthn.models.transaction_attachment_model import TransactionAttachmentModel +from lthn.models.transaction_details_model import TransactionDetailsModel +from lthn.models.transaction_extra_model import TransactionExtraModel +from lthn.models.transaction_input_model import TransactionInputModel +from lthn.models.transaction_output_model import TransactionOutputModel +from lthn.models.tx_generation_context_model import TxGenerationContextModel +from lthn.models.tx_pool_performance_model import TxPoolPerformanceModel +from lthn.models.tx_processing_performance_model import TxProcessingPerformanceModel +from lthn.models.version_model import VersionModel + diff --git a/utils/sdk/client/python/lthn/models/block_details_model.py b/utils/sdk/client/python/lthn/models/block_details_model.py new file mode 100644 index 00000000..757bd0c6 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/block_details_model.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from lthn.models.transaction_details_model import TransactionDetailsModel +from typing import Optional, Set +from typing_extensions import Self + +class BlockDetailsModel(BaseModel): + """ + BlockDetailsModel + """ # noqa: E501 + actual_timestamp: Optional[StrictInt] = None + already_generated_coins: Optional[StrictStr] = None + base_reward: Optional[StrictInt] = None + blob: Optional[StrictStr] = None + block_cumulative_size: Optional[StrictInt] = None + block_tself_size: Optional[StrictInt] = None + cumulative_diff_adjusted: Optional[StrictStr] = None + cumulative_diff_precise: Optional[StrictStr] = None + difficulty: Optional[StrictStr] = None + effective_fee_median: Optional[StrictInt] = None + height: Optional[StrictInt] = None + id: Optional[StrictStr] = None + is_orphan: Optional[StrictBool] = None + miner_text_info: Optional[StrictStr] = None + object_in_json: Optional[StrictStr] = None + penalty: Optional[StrictInt] = None + pow_seed: Optional[StrictStr] = None + prev_id: Optional[StrictStr] = None + summary_reward: Optional[StrictInt] = None + this_block_fee_median: Optional[StrictInt] = None + timestamp: Optional[StrictInt] = None + total_fee: Optional[StrictInt] = None + total_txs_size: Optional[StrictInt] = None + transactions_details: Optional[List[TransactionDetailsModel]] = None + type: Optional[Annotated[int, Field(le=4294967295, strict=True, ge=0)]] = None + __properties: ClassVar[List[str]] = ["actual_timestamp", "already_generated_coins", "base_reward", "blob", "block_cumulative_size", "block_tself_size", "cumulative_diff_adjusted", "cumulative_diff_precise", "difficulty", "effective_fee_median", "height", "id", "is_orphan", "miner_text_info", "object_in_json", "penalty", "pow_seed", "prev_id", "summary_reward", "this_block_fee_median", "timestamp", "total_fee", "total_txs_size", "transactions_details", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BlockDetailsModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in transactions_details (list) + _items = [] + if self.transactions_details: + for _item_transactions_details in self.transactions_details: + if _item_transactions_details: + _items.append(_item_transactions_details.to_dict()) + _dict['transactions_details'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BlockDetailsModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "actual_timestamp": obj.get("actual_timestamp"), + "already_generated_coins": obj.get("already_generated_coins"), + "base_reward": obj.get("base_reward"), + "blob": obj.get("blob"), + "block_cumulative_size": obj.get("block_cumulative_size"), + "block_tself_size": obj.get("block_tself_size"), + "cumulative_diff_adjusted": obj.get("cumulative_diff_adjusted"), + "cumulative_diff_precise": obj.get("cumulative_diff_precise"), + "difficulty": obj.get("difficulty"), + "effective_fee_median": obj.get("effective_fee_median"), + "height": obj.get("height"), + "id": obj.get("id"), + "is_orphan": obj.get("is_orphan"), + "miner_text_info": obj.get("miner_text_info"), + "object_in_json": obj.get("object_in_json"), + "penalty": obj.get("penalty"), + "pow_seed": obj.get("pow_seed"), + "prev_id": obj.get("prev_id"), + "summary_reward": obj.get("summary_reward"), + "this_block_fee_median": obj.get("this_block_fee_median"), + "timestamp": obj.get("timestamp"), + "total_fee": obj.get("total_fee"), + "total_txs_size": obj.get("total_txs_size"), + "transactions_details": [TransactionDetailsModel.from_dict(_item) for _item in obj["transactions_details"]] if obj.get("transactions_details") is not None else None, + "type": obj.get("type") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/block_processing_performance_model.py b/utils/sdk/client/python/lthn/models/block_processing_performance_model.py new file mode 100644 index 00000000..57470c00 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/block_processing_performance_model.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class BlockProcessingPerformanceModel(BaseModel): + """ + BlockProcessingPerformanceModel + """ # noqa: E501 + block_processing_time_0: Optional[StrictInt] = None + block_processing_time_1: Optional[StrictInt] = None + target_calculating_time_2: Optional[StrictInt] = None + longhash_calculating_time_3: Optional[StrictInt] = None + all_txs_insert_time_5: Optional[StrictInt] = None + etc_stuff_6: Optional[StrictInt] = None + insert_time_4: Optional[StrictInt] = None + raise_block_core_event: Optional[StrictInt] = None + validate_miner_transaction_time: Optional[StrictInt] = None + collect_rangeproofs_data_from_tx_time: Optional[StrictInt] = None + verify_multiple_zc_outs_range_proofs_time: Optional[StrictInt] = None + target_calculating_enum_blocks: Optional[StrictInt] = None + target_calculating_calc: Optional[StrictInt] = None + pos_validate_ki_search: Optional[StrictInt] = None + pos_validate_get_out_keys_for_inputs: Optional[StrictInt] = None + pos_validate_zvp: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["block_processing_time_0", "block_processing_time_1", "target_calculating_time_2", "longhash_calculating_time_3", "all_txs_insert_time_5", "etc_stuff_6", "insert_time_4", "raise_block_core_event", "validate_miner_transaction_time", "collect_rangeproofs_data_from_tx_time", "verify_multiple_zc_outs_range_proofs_time", "target_calculating_enum_blocks", "target_calculating_calc", "pos_validate_ki_search", "pos_validate_get_out_keys_for_inputs", "pos_validate_zvp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BlockProcessingPerformanceModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BlockProcessingPerformanceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "block_processing_time_0": obj.get("block_processing_time_0"), + "block_processing_time_1": obj.get("block_processing_time_1"), + "target_calculating_time_2": obj.get("target_calculating_time_2"), + "longhash_calculating_time_3": obj.get("longhash_calculating_time_3"), + "all_txs_insert_time_5": obj.get("all_txs_insert_time_5"), + "etc_stuff_6": obj.get("etc_stuff_6"), + "insert_time_4": obj.get("insert_time_4"), + "raise_block_core_event": obj.get("raise_block_core_event"), + "validate_miner_transaction_time": obj.get("validate_miner_transaction_time"), + "collect_rangeproofs_data_from_tx_time": obj.get("collect_rangeproofs_data_from_tx_time"), + "verify_multiple_zc_outs_range_proofs_time": obj.get("verify_multiple_zc_outs_range_proofs_time"), + "target_calculating_enum_blocks": obj.get("target_calculating_enum_blocks"), + "target_calculating_calc": obj.get("target_calculating_calc"), + "pos_validate_ki_search": obj.get("pos_validate_ki_search"), + "pos_validate_get_out_keys_for_inputs": obj.get("pos_validate_get_out_keys_for_inputs"), + "pos_validate_zvp": obj.get("pos_validate_zvp") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/block_template_model.py b/utils/sdk/client/python/lthn/models/block_template_model.py new file mode 100644 index 00000000..b44e961d --- /dev/null +++ b/utils/sdk/client/python/lthn/models/block_template_model.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lthn.models.tx_generation_context_model import TxGenerationContextModel +from typing import Optional, Set +from typing_extensions import Self + +class BlockTemplateModel(BaseModel): + """ + BlockTemplateModel + """ # noqa: E501 + blocktemplate_blob: Optional[StrictStr] = None + difficulty: Optional[StrictStr] = None + height: Optional[StrictInt] = None + miner_tx_tgc: Optional[TxGenerationContextModel] = None + block_reward_without_fee: Optional[StrictInt] = None + block_reward: Optional[StrictInt] = None + txs_fee: Optional[StrictInt] = None + prev_hash: Optional[StrictStr] = None + seed: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["blocktemplate_blob", "difficulty", "height", "miner_tx_tgc", "block_reward_without_fee", "block_reward", "txs_fee", "prev_hash", "seed"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BlockTemplateModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of miner_tx_tgc + if self.miner_tx_tgc: + _dict['miner_tx_tgc'] = self.miner_tx_tgc.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BlockTemplateModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "blocktemplate_blob": obj.get("blocktemplate_blob"), + "difficulty": obj.get("difficulty"), + "height": obj.get("height"), + "miner_tx_tgc": TxGenerationContextModel.from_dict(obj["miner_tx_tgc"]) if obj.get("miner_tx_tgc") is not None else None, + "block_reward_without_fee": obj.get("block_reward_without_fee"), + "block_reward": obj.get("block_reward"), + "txs_fee": obj.get("txs_fee"), + "prev_hash": obj.get("prev_hash"), + "seed": obj.get("seed") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/block_template_request_model.py b/utils/sdk/client/python/lthn/models/block_template_request_model.py new file mode 100644 index 00000000..78ec384e --- /dev/null +++ b/utils/sdk/client/python/lthn/models/block_template_request_model.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lthn.models.pos_entry_model import PosEntryModel +from typing import Optional, Set +from typing_extensions import Self + +class BlockTemplateRequestModel(BaseModel): + """ + BlockTemplateRequestModel + """ # noqa: E501 + miner_address: Optional[StrictStr] = None + stakeholder_address: Optional[StrictStr] = None + ex_nonce: Optional[StrictStr] = None + pos_block: Optional[StrictBool] = None + ignore_pow_ts_check: Optional[StrictBool] = None + pe: Optional[PosEntryModel] = None + explicit_txs: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["miner_address", "stakeholder_address", "ex_nonce", "pos_block", "ignore_pow_ts_check", "pe", "explicit_txs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BlockTemplateRequestModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pe + if self.pe: + _dict['pe'] = self.pe.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BlockTemplateRequestModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "miner_address": obj.get("miner_address"), + "stakeholder_address": obj.get("stakeholder_address"), + "ex_nonce": obj.get("ex_nonce"), + "pos_block": obj.get("pos_block"), + "ignore_pow_ts_check": obj.get("ignore_pow_ts_check"), + "pe": PosEntryModel.from_dict(obj["pe"]) if obj.get("pe") is not None else None, + "explicit_txs": obj.get("explicit_txs") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/db_stat_info_model.py b/utils/sdk/client/python/lthn/models/db_stat_info_model.py new file mode 100644 index 00000000..a6882154 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/db_stat_info_model.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DbStatInfoModel(BaseModel): + """ + DbStatInfoModel + """ # noqa: E501 + tx_count: Optional[StrictInt] = None + write_tx_count: Optional[StrictInt] = None + map_size: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["tx_count", "write_tx_count", "map_size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DbStatInfoModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DbStatInfoModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tx_count": obj.get("tx_count"), + "write_tx_count": obj.get("write_tx_count"), + "map_size": obj.get("map_size") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/height_model.py b/utils/sdk/client/python/lthn/models/height_model.py new file mode 100644 index 00000000..30af14c1 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/height_model.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class HeightModel(BaseModel): + """ + HeightModel + """ # noqa: E501 + height: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["height"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HeightModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HeightModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "height": obj.get("height") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/info_model.py b/utils/sdk/client/python/lthn/models/info_model.py new file mode 100644 index 00000000..be634386 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/info_model.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from lthn.models.maintainers_info_model import MaintainersInfoModel +from lthn.models.performance_model import PerformanceModel +from typing import Optional, Set +from typing_extensions import Self + +class InfoModel(BaseModel): + """ + InfoModel + """ # noqa: E501 + height: Optional[StrictInt] = None + tx_count: Optional[StrictInt] = None + tx_pool_size: Optional[StrictInt] = None + alt_blocks_count: Optional[StrictInt] = None + outgoing_connections_count: Optional[StrictInt] = None + incoming_connections_count: Optional[StrictInt] = None + synchronized_connections_count: Optional[StrictInt] = None + white_peerlist_size: Optional[StrictInt] = None + grey_peerlist_size: Optional[StrictInt] = None + current_blocks_median: Optional[StrictInt] = None + alias_count: Optional[StrictInt] = None + current_max_allowed_block_size: Optional[StrictInt] = None + daemon_network_state: Optional[StrictStr] = None + synchronization_start_height: Optional[StrictInt] = None + max_net_seen_height: Optional[StrictInt] = None + mi: Optional[MaintainersInfoModel] = None + pos_allowed: Optional[StrictBool] = None + pos_difficulty: Optional[StrictStr] = None + pow_difficulty: Optional[StrictInt] = None + default_fee: Optional[StrictInt] = None + minimum_fee: Optional[StrictInt] = None + is_hardfork_active: Optional[List[StrictBool]] = None + net_time_delta_median: Optional[StrictInt] = None + current_network_hashrate_50: Optional[StrictInt] = None + current_network_hashrate_350: Optional[StrictInt] = None + seconds_for_10_blocks: Optional[StrictInt] = None + seconds_for_30_blocks: Optional[StrictInt] = None + transactions_cnt_per_day: Optional[List[StrictInt]] = None + transactions_volume_per_day: Optional[List[StrictInt]] = None + last_pos_timestamp: Optional[StrictInt] = None + last_pow_timestamp: Optional[StrictInt] = None + total_coins: Optional[StrictStr] = None + last_block_size: Optional[StrictInt] = None + tx_count_in_last_block: Optional[StrictInt] = None + pos_sequence_factor: Optional[Union[StrictFloat, StrictInt]] = None + pow_sequence_factor: Optional[Union[StrictFloat, StrictInt]] = None + block_reward: Optional[StrictInt] = None + last_block_total_reward: Optional[StrictInt] = None + pos_diff_total_coins_rate: Optional[StrictInt] = None + last_block_timestamp: Optional[StrictInt] = None + last_block_hash: Optional[StrictStr] = None + pos_block_ts_shift_vs_actual: Optional[StrictInt] = None + outs_stat: Optional[Dict[str, StrictInt]] = None + performance_data: Optional[PerformanceModel] = None + offers_count: Optional[StrictInt] = None + expiration_median_timestamp: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["height", "tx_count", "tx_pool_size", "alt_blocks_count", "outgoing_connections_count", "incoming_connections_count", "synchronized_connections_count", "white_peerlist_size", "grey_peerlist_size", "current_blocks_median", "alias_count", "current_max_allowed_block_size", "daemon_network_state", "synchronization_start_height", "max_net_seen_height", "mi", "pos_allowed", "pos_difficulty", "pow_difficulty", "default_fee", "minimum_fee", "is_hardfork_active", "net_time_delta_median", "current_network_hashrate_50", "current_network_hashrate_350", "seconds_for_10_blocks", "seconds_for_30_blocks", "transactions_cnt_per_day", "transactions_volume_per_day", "last_pos_timestamp", "last_pow_timestamp", "total_coins", "last_block_size", "tx_count_in_last_block", "pos_sequence_factor", "pow_sequence_factor", "block_reward", "last_block_total_reward", "pos_diff_total_coins_rate", "last_block_timestamp", "last_block_hash", "pos_block_ts_shift_vs_actual", "outs_stat", "performance_data", "offers_count", "expiration_median_timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InfoModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of mi + if self.mi: + _dict['mi'] = self.mi.to_dict() + # override the default output from pydantic by calling `to_dict()` of performance_data + if self.performance_data: + _dict['performance_data'] = self.performance_data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InfoModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "height": obj.get("height"), + "tx_count": obj.get("tx_count"), + "tx_pool_size": obj.get("tx_pool_size"), + "alt_blocks_count": obj.get("alt_blocks_count"), + "outgoing_connections_count": obj.get("outgoing_connections_count"), + "incoming_connections_count": obj.get("incoming_connections_count"), + "synchronized_connections_count": obj.get("synchronized_connections_count"), + "white_peerlist_size": obj.get("white_peerlist_size"), + "grey_peerlist_size": obj.get("grey_peerlist_size"), + "current_blocks_median": obj.get("current_blocks_median"), + "alias_count": obj.get("alias_count"), + "current_max_allowed_block_size": obj.get("current_max_allowed_block_size"), + "daemon_network_state": obj.get("daemon_network_state"), + "synchronization_start_height": obj.get("synchronization_start_height"), + "max_net_seen_height": obj.get("max_net_seen_height"), + "mi": MaintainersInfoModel.from_dict(obj["mi"]) if obj.get("mi") is not None else None, + "pos_allowed": obj.get("pos_allowed"), + "pos_difficulty": obj.get("pos_difficulty"), + "pow_difficulty": obj.get("pow_difficulty"), + "default_fee": obj.get("default_fee"), + "minimum_fee": obj.get("minimum_fee"), + "is_hardfork_active": obj.get("is_hardfork_active"), + "net_time_delta_median": obj.get("net_time_delta_median"), + "current_network_hashrate_50": obj.get("current_network_hashrate_50"), + "current_network_hashrate_350": obj.get("current_network_hashrate_350"), + "seconds_for_10_blocks": obj.get("seconds_for_10_blocks"), + "seconds_for_30_blocks": obj.get("seconds_for_30_blocks"), + "transactions_cnt_per_day": obj.get("transactions_cnt_per_day"), + "transactions_volume_per_day": obj.get("transactions_volume_per_day"), + "last_pos_timestamp": obj.get("last_pos_timestamp"), + "last_pow_timestamp": obj.get("last_pow_timestamp"), + "total_coins": obj.get("total_coins"), + "last_block_size": obj.get("last_block_size"), + "tx_count_in_last_block": obj.get("tx_count_in_last_block"), + "pos_sequence_factor": obj.get("pos_sequence_factor"), + "pow_sequence_factor": obj.get("pow_sequence_factor"), + "block_reward": obj.get("block_reward"), + "last_block_total_reward": obj.get("last_block_total_reward"), + "pos_diff_total_coins_rate": obj.get("pos_diff_total_coins_rate"), + "last_block_timestamp": obj.get("last_block_timestamp"), + "last_block_hash": obj.get("last_block_hash"), + "pos_block_ts_shift_vs_actual": obj.get("pos_block_ts_shift_vs_actual"), + "outs_stat": obj.get("outs_stat"), + "performance_data": PerformanceModel.from_dict(obj["performance_data"]) if obj.get("performance_data") is not None else None, + "offers_count": obj.get("offers_count"), + "expiration_median_timestamp": obj.get("expiration_median_timestamp") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/maintainers_info_model.py b/utils/sdk/client/python/lthn/models/maintainers_info_model.py new file mode 100644 index 00000000..4c01a614 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/maintainers_info_model.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class MaintainersInfoModel(BaseModel): + """ + MaintainersInfoModel + """ # noqa: E501 + ver_major: Optional[Annotated[int, Field(le=255, strict=True, ge=0)]] = None + ver_minor: Optional[Annotated[int, Field(le=255, strict=True, ge=0)]] = None + ver_revision: Optional[Annotated[int, Field(le=255, strict=True, ge=0)]] = None + build_no: Optional[Annotated[int, Field(le=4294967295, strict=True, ge=0)]] = None + mode: Optional[Annotated[int, Field(le=255, strict=True, ge=0)]] = None + __properties: ClassVar[List[str]] = ["ver_major", "ver_minor", "ver_revision", "build_no", "mode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MaintainersInfoModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MaintainersInfoModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ver_major": obj.get("ver_major"), + "ver_minor": obj.get("ver_minor"), + "ver_revision": obj.get("ver_revision"), + "build_no": obj.get("build_no"), + "mode": obj.get("mode") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/performance_model.py b/utils/sdk/client/python/lthn/models/performance_model.py new file mode 100644 index 00000000..6ecb87c0 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/performance_model.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from lthn.models.block_processing_performance_model import BlockProcessingPerformanceModel +from lthn.models.db_stat_info_model import DbStatInfoModel +from lthn.models.tx_pool_performance_model import TxPoolPerformanceModel +from lthn.models.tx_processing_performance_model import TxProcessingPerformanceModel +from typing import Optional, Set +from typing_extensions import Self + +class PerformanceModel(BaseModel): + """ + PerformanceModel + """ # noqa: E501 + block_processing: Optional[BlockProcessingPerformanceModel] = None + tx_processing: Optional[TxProcessingPerformanceModel] = None + tx_pool: Optional[TxPoolPerformanceModel] = None + db_stat_info: Optional[DbStatInfoModel] = None + __properties: ClassVar[List[str]] = ["block_processing", "tx_processing", "tx_pool", "db_stat_info"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerformanceModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of block_processing + if self.block_processing: + _dict['block_processing'] = self.block_processing.to_dict() + # override the default output from pydantic by calling `to_dict()` of tx_processing + if self.tx_processing: + _dict['tx_processing'] = self.tx_processing.to_dict() + # override the default output from pydantic by calling `to_dict()` of tx_pool + if self.tx_pool: + _dict['tx_pool'] = self.tx_pool.to_dict() + # override the default output from pydantic by calling `to_dict()` of db_stat_info + if self.db_stat_info: + _dict['db_stat_info'] = self.db_stat_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerformanceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "block_processing": BlockProcessingPerformanceModel.from_dict(obj["block_processing"]) if obj.get("block_processing") is not None else None, + "tx_processing": TxProcessingPerformanceModel.from_dict(obj["tx_processing"]) if obj.get("tx_processing") is not None else None, + "tx_pool": TxPoolPerformanceModel.from_dict(obj["tx_pool"]) if obj.get("tx_pool") is not None else None, + "db_stat_info": DbStatInfoModel.from_dict(obj["db_stat_info"]) if obj.get("db_stat_info") is not None else None + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/pos_entry_model.py b/utils/sdk/client/python/lthn/models/pos_entry_model.py new file mode 100644 index 00000000..114d5e68 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/pos_entry_model.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PosEntryModel(BaseModel): + """ + PosEntryModel + """ # noqa: E501 + amount: Optional[StrictInt] = None + g_index: Optional[StrictInt] = None + keyimage: Optional[StrictStr] = None + block_timestamp: Optional[StrictInt] = None + stake_unlock_time: Optional[StrictInt] = None + tx_id: Optional[StrictStr] = None + tx_out_index: Optional[StrictInt] = None + wallet_index: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["amount", "g_index", "keyimage", "block_timestamp", "stake_unlock_time", "tx_id", "tx_out_index", "wallet_index"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PosEntryModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PosEntryModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "g_index": obj.get("g_index"), + "keyimage": obj.get("keyimage"), + "block_timestamp": obj.get("block_timestamp"), + "stake_unlock_time": obj.get("stake_unlock_time"), + "tx_id": obj.get("tx_id"), + "tx_out_index": obj.get("tx_out_index"), + "wallet_index": obj.get("wallet_index") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/submit_block_request_model.py b/utils/sdk/client/python/lthn/models/submit_block_request_model.py new file mode 100644 index 00000000..68a17c67 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/submit_block_request_model.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SubmitBlockRequestModel(BaseModel): + """ + SubmitBlockRequestModel + """ # noqa: E501 + block_blob: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["block_blob"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubmitBlockRequestModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubmitBlockRequestModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "block_blob": obj.get("block_blob") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/submit_block_response_model.py b/utils/sdk/client/python/lthn/models/submit_block_response_model.py new file mode 100644 index 00000000..2fca7d85 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/submit_block_response_model.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SubmitBlockResponseModel(BaseModel): + """ + SubmitBlockResponseModel + """ # noqa: E501 + status: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubmitBlockResponseModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubmitBlockResponseModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/transaction_attachment_model.py b/utils/sdk/client/python/lthn/models/transaction_attachment_model.py new file mode 100644 index 00000000..84b11137 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/transaction_attachment_model.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TransactionAttachmentModel(BaseModel): + """ + TransactionAttachmentModel + """ # noqa: E501 + type: Optional[StrictStr] = None + short_view: Optional[StrictStr] = None + details_view: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type", "short_view", "details_view"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransactionAttachmentModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransactionAttachmentModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "short_view": obj.get("short_view"), + "details_view": obj.get("details_view") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/transaction_details_model.py b/utils/sdk/client/python/lthn/models/transaction_details_model.py new file mode 100644 index 00000000..cfd66f79 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/transaction_details_model.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lthn.models.transaction_attachment_model import TransactionAttachmentModel +from lthn.models.transaction_extra_model import TransactionExtraModel +from lthn.models.transaction_input_model import TransactionInputModel +from lthn.models.transaction_output_model import TransactionOutputModel +from typing import Optional, Set +from typing_extensions import Self + +class TransactionDetailsModel(BaseModel): + """ + TransactionDetailsModel + """ # noqa: E501 + amount: Optional[StrictInt] = None + attachments: Optional[List[TransactionAttachmentModel]] = None + blob: Optional[StrictStr] = None + blob_size: Optional[StrictInt] = None + extra: Optional[List[TransactionExtraModel]] = None + fee: Optional[StrictInt] = None + id: Optional[StrictStr] = None + ins: Optional[List[TransactionInputModel]] = None + keeper_block: Optional[StrictInt] = None + object_in_json: Optional[StrictStr] = None + outs: Optional[List[TransactionOutputModel]] = None + pub_key: Optional[StrictStr] = None + timestamp: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["amount", "attachments", "blob", "blob_size", "extra", "fee", "id", "ins", "keeper_block", "object_in_json", "outs", "pub_key", "timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransactionDetailsModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in extra (list) + _items = [] + if self.extra: + for _item_extra in self.extra: + if _item_extra: + _items.append(_item_extra.to_dict()) + _dict['extra'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in ins (list) + _items = [] + if self.ins: + for _item_ins in self.ins: + if _item_ins: + _items.append(_item_ins.to_dict()) + _dict['ins'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in outs (list) + _items = [] + if self.outs: + for _item_outs in self.outs: + if _item_outs: + _items.append(_item_outs.to_dict()) + _dict['outs'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransactionDetailsModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "attachments": [TransactionAttachmentModel.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "blob": obj.get("blob"), + "blob_size": obj.get("blob_size"), + "extra": [TransactionExtraModel.from_dict(_item) for _item in obj["extra"]] if obj.get("extra") is not None else None, + "fee": obj.get("fee"), + "id": obj.get("id"), + "ins": [TransactionInputModel.from_dict(_item) for _item in obj["ins"]] if obj.get("ins") is not None else None, + "keeper_block": obj.get("keeper_block"), + "object_in_json": obj.get("object_in_json"), + "outs": [TransactionOutputModel.from_dict(_item) for _item in obj["outs"]] if obj.get("outs") is not None else None, + "pub_key": obj.get("pub_key"), + "timestamp": obj.get("timestamp") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/transaction_extra_model.py b/utils/sdk/client/python/lthn/models/transaction_extra_model.py new file mode 100644 index 00000000..3d6e1cd6 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/transaction_extra_model.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TransactionExtraModel(BaseModel): + """ + TransactionExtraModel + """ # noqa: E501 + type: Optional[StrictStr] = None + short_view: Optional[StrictStr] = None + details_view: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type", "short_view", "details_view"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransactionExtraModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransactionExtraModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "short_view": obj.get("short_view"), + "details_view": obj.get("details_view") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/transaction_input_model.py b/utils/sdk/client/python/lthn/models/transaction_input_model.py new file mode 100644 index 00000000..1246b29b --- /dev/null +++ b/utils/sdk/client/python/lthn/models/transaction_input_model.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class TransactionInputModel(BaseModel): + """ + TransactionInputModel + """ # noqa: E501 + amount: Optional[StrictInt] = None + global_indexes: Optional[List[StrictInt]] = None + htlc_origin: Optional[StrictStr] = None + kimage_or_ms_id: Optional[StrictStr] = None + multisig_count: Optional[Annotated[int, Field(le=4294967295, strict=True, ge=0)]] = None + __properties: ClassVar[List[str]] = ["amount", "global_indexes", "htlc_origin", "kimage_or_ms_id", "multisig_count"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransactionInputModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransactionInputModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "global_indexes": obj.get("global_indexes"), + "htlc_origin": obj.get("htlc_origin"), + "kimage_or_ms_id": obj.get("kimage_or_ms_id"), + "multisig_count": obj.get("multisig_count") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/transaction_output_model.py b/utils/sdk/client/python/lthn/models/transaction_output_model.py new file mode 100644 index 00000000..fa8eeb1f --- /dev/null +++ b/utils/sdk/client/python/lthn/models/transaction_output_model.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class TransactionOutputModel(BaseModel): + """ + TransactionOutputModel + """ # noqa: E501 + amount: Optional[StrictInt] = None + global_index: Optional[StrictInt] = None + is_spent: Optional[StrictBool] = None + minimum_sigs: Optional[Annotated[int, Field(le=4294967295, strict=True, ge=0)]] = None + pub_keys: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["amount", "global_index", "is_spent", "minimum_sigs", "pub_keys"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransactionOutputModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransactionOutputModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "global_index": obj.get("global_index"), + "is_spent": obj.get("is_spent"), + "minimum_sigs": obj.get("minimum_sigs"), + "pub_keys": obj.get("pub_keys") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/tx_generation_context_model.py b/utils/sdk/client/python/lthn/models/tx_generation_context_model.py new file mode 100644 index 00000000..42542536 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/tx_generation_context_model.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TxGenerationContextModel(BaseModel): + """ + TxGenerationContextModel + """ # noqa: E501 + asset_ids: Optional[List[StrictStr]] = None + blinded_asset_ids: Optional[List[StrictStr]] = None + amount_commitments: Optional[List[StrictStr]] = None + asset_id_blinding_masks: Optional[List[StrictStr]] = None + amounts: Optional[List[StrictStr]] = None + amount_blinding_masks: Optional[List[StrictStr]] = None + pseudo_outs_blinded_asset_ids: Optional[List[StrictStr]] = None + pseudo_outs_plus_real_out_blinding_masks: Optional[List[StrictStr]] = None + real_zc_ins_asset_ids: Optional[List[StrictStr]] = None + zc_input_amounts: Optional[List[StrictInt]] = None + pseudo_out_amount_commitments_sum: Optional[StrictStr] = None + pseudo_out_amount_blinding_masks_sum: Optional[StrictStr] = None + real_in_asset_id_blinding_mask_x_amount_sum: Optional[StrictStr] = None + amount_commitments_sum: Optional[StrictStr] = None + amount_blinding_masks_sum: Optional[StrictStr] = None + asset_id_blinding_mask_x_amount_sum: Optional[StrictStr] = None + ao_asset_id: Optional[StrictStr] = None + ao_asset_id_pt: Optional[StrictStr] = None + ao_amount_commitment: Optional[StrictStr] = None + ao_amount_blinding_mask: Optional[StrictStr] = None + ao_commitment_in_outputs: Optional[StrictBool] = None + tx_key_pub: Optional[StrictStr] = None + tx_key_sec: Optional[StrictStr] = None + tx_pub_key_p: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["asset_ids", "blinded_asset_ids", "amount_commitments", "asset_id_blinding_masks", "amounts", "amount_blinding_masks", "pseudo_outs_blinded_asset_ids", "pseudo_outs_plus_real_out_blinding_masks", "real_zc_ins_asset_ids", "zc_input_amounts", "pseudo_out_amount_commitments_sum", "pseudo_out_amount_blinding_masks_sum", "real_in_asset_id_blinding_mask_x_amount_sum", "amount_commitments_sum", "amount_blinding_masks_sum", "asset_id_blinding_mask_x_amount_sum", "ao_asset_id", "ao_asset_id_pt", "ao_amount_commitment", "ao_amount_blinding_mask", "ao_commitment_in_outputs", "tx_key_pub", "tx_key_sec", "tx_pub_key_p"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TxGenerationContextModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TxGenerationContextModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "asset_ids": obj.get("asset_ids"), + "blinded_asset_ids": obj.get("blinded_asset_ids"), + "amount_commitments": obj.get("amount_commitments"), + "asset_id_blinding_masks": obj.get("asset_id_blinding_masks"), + "amounts": obj.get("amounts"), + "amount_blinding_masks": obj.get("amount_blinding_masks"), + "pseudo_outs_blinded_asset_ids": obj.get("pseudo_outs_blinded_asset_ids"), + "pseudo_outs_plus_real_out_blinding_masks": obj.get("pseudo_outs_plus_real_out_blinding_masks"), + "real_zc_ins_asset_ids": obj.get("real_zc_ins_asset_ids"), + "zc_input_amounts": obj.get("zc_input_amounts"), + "pseudo_out_amount_commitments_sum": obj.get("pseudo_out_amount_commitments_sum"), + "pseudo_out_amount_blinding_masks_sum": obj.get("pseudo_out_amount_blinding_masks_sum"), + "real_in_asset_id_blinding_mask_x_amount_sum": obj.get("real_in_asset_id_blinding_mask_x_amount_sum"), + "amount_commitments_sum": obj.get("amount_commitments_sum"), + "amount_blinding_masks_sum": obj.get("amount_blinding_masks_sum"), + "asset_id_blinding_mask_x_amount_sum": obj.get("asset_id_blinding_mask_x_amount_sum"), + "ao_asset_id": obj.get("ao_asset_id"), + "ao_asset_id_pt": obj.get("ao_asset_id_pt"), + "ao_amount_commitment": obj.get("ao_amount_commitment"), + "ao_amount_blinding_mask": obj.get("ao_amount_blinding_mask"), + "ao_commitment_in_outputs": obj.get("ao_commitment_in_outputs"), + "tx_key_pub": obj.get("tx_key_pub"), + "tx_key_sec": obj.get("tx_key_sec"), + "tx_pub_key_p": obj.get("tx_pub_key_p") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/tx_pool_performance_model.py b/utils/sdk/client/python/lthn/models/tx_pool_performance_model.py new file mode 100644 index 00000000..c5b4e3fe --- /dev/null +++ b/utils/sdk/client/python/lthn/models/tx_pool_performance_model.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TxPoolPerformanceModel(BaseModel): + """ + TxPoolPerformanceModel + """ # noqa: E501 + tx_processing_time: Optional[StrictInt] = None + check_inputs_types_supported_time: Optional[StrictInt] = None + expiration_validate_time: Optional[StrictInt] = None + validate_amount_time: Optional[StrictInt] = None + validate_alias_time: Optional[StrictInt] = None + check_keyimages_ws_ms_time: Optional[StrictInt] = None + check_inputs_time: Optional[StrictInt] = None + begin_tx_time: Optional[StrictInt] = None + update_db_time: Optional[StrictInt] = None + db_commit_time: Optional[StrictInt] = None + check_post_hf4_balance: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["tx_processing_time", "check_inputs_types_supported_time", "expiration_validate_time", "validate_amount_time", "validate_alias_time", "check_keyimages_ws_ms_time", "check_inputs_time", "begin_tx_time", "update_db_time", "db_commit_time", "check_post_hf4_balance"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TxPoolPerformanceModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TxPoolPerformanceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tx_processing_time": obj.get("tx_processing_time"), + "check_inputs_types_supported_time": obj.get("check_inputs_types_supported_time"), + "expiration_validate_time": obj.get("expiration_validate_time"), + "validate_amount_time": obj.get("validate_amount_time"), + "validate_alias_time": obj.get("validate_alias_time"), + "check_keyimages_ws_ms_time": obj.get("check_keyimages_ws_ms_time"), + "check_inputs_time": obj.get("check_inputs_time"), + "begin_tx_time": obj.get("begin_tx_time"), + "update_db_time": obj.get("update_db_time"), + "db_commit_time": obj.get("db_commit_time"), + "check_post_hf4_balance": obj.get("check_post_hf4_balance") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/tx_processing_performance_model.py b/utils/sdk/client/python/lthn/models/tx_processing_performance_model.py new file mode 100644 index 00000000..de0fea82 --- /dev/null +++ b/utils/sdk/client/python/lthn/models/tx_processing_performance_model.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TxProcessingPerformanceModel(BaseModel): + """ + TxProcessingPerformanceModel + """ # noqa: E501 + tx_check_inputs: Optional[StrictInt] = None + tx_add_one_tx: Optional[StrictInt] = None + tx_process_extra: Optional[StrictInt] = None + tx_process_attachment: Optional[StrictInt] = None + tx_process_inputs: Optional[StrictInt] = None + tx_push_global_index: Optional[StrictInt] = None + tx_check_exist: Optional[StrictInt] = None + tx_print_log: Optional[StrictInt] = None + tx_prapare_append: Optional[StrictInt] = None + tx_append: Optional[StrictInt] = None + tx_append_rl_wait: Optional[StrictInt] = None + tx_append_is_expired: Optional[StrictInt] = None + tx_store_db: Optional[StrictInt] = None + tx_check_inputs_prefix_hash: Optional[StrictInt] = None + tx_check_inputs_attachment_check: Optional[StrictInt] = None + tx_check_inputs_loop: Optional[StrictInt] = None + tx_check_inputs_loop_kimage_check: Optional[StrictInt] = None + tx_check_inputs_loop_ch_in_val_sig: Optional[StrictInt] = None + tx_check_inputs_loop_scan_outputkeys_get_item_size: Optional[StrictInt] = None + tx_check_inputs_loop_scan_outputkeys_relative_to_absolute: Optional[StrictInt] = None + tx_check_inputs_loop_scan_outputkeys_loop: Optional[StrictInt] = None + tx_check_inputs_loop_scan_outputkeys_loop_get_subitem: Optional[StrictInt] = None + tx_check_inputs_loop_scan_outputkeys_loop_find_tx: Optional[StrictInt] = None + tx_check_inputs_loop_scan_outputkeys_loop_handle_output: Optional[StrictInt] = None + tx_mixin_count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["tx_check_inputs", "tx_add_one_tx", "tx_process_extra", "tx_process_attachment", "tx_process_inputs", "tx_push_global_index", "tx_check_exist", "tx_print_log", "tx_prapare_append", "tx_append", "tx_append_rl_wait", "tx_append_is_expired", "tx_store_db", "tx_check_inputs_prefix_hash", "tx_check_inputs_attachment_check", "tx_check_inputs_loop", "tx_check_inputs_loop_kimage_check", "tx_check_inputs_loop_ch_in_val_sig", "tx_check_inputs_loop_scan_outputkeys_get_item_size", "tx_check_inputs_loop_scan_outputkeys_relative_to_absolute", "tx_check_inputs_loop_scan_outputkeys_loop", "tx_check_inputs_loop_scan_outputkeys_loop_get_subitem", "tx_check_inputs_loop_scan_outputkeys_loop_find_tx", "tx_check_inputs_loop_scan_outputkeys_loop_handle_output", "tx_mixin_count"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TxProcessingPerformanceModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TxProcessingPerformanceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tx_check_inputs": obj.get("tx_check_inputs"), + "tx_add_one_tx": obj.get("tx_add_one_tx"), + "tx_process_extra": obj.get("tx_process_extra"), + "tx_process_attachment": obj.get("tx_process_attachment"), + "tx_process_inputs": obj.get("tx_process_inputs"), + "tx_push_global_index": obj.get("tx_push_global_index"), + "tx_check_exist": obj.get("tx_check_exist"), + "tx_print_log": obj.get("tx_print_log"), + "tx_prapare_append": obj.get("tx_prapare_append"), + "tx_append": obj.get("tx_append"), + "tx_append_rl_wait": obj.get("tx_append_rl_wait"), + "tx_append_is_expired": obj.get("tx_append_is_expired"), + "tx_store_db": obj.get("tx_store_db"), + "tx_check_inputs_prefix_hash": obj.get("tx_check_inputs_prefix_hash"), + "tx_check_inputs_attachment_check": obj.get("tx_check_inputs_attachment_check"), + "tx_check_inputs_loop": obj.get("tx_check_inputs_loop"), + "tx_check_inputs_loop_kimage_check": obj.get("tx_check_inputs_loop_kimage_check"), + "tx_check_inputs_loop_ch_in_val_sig": obj.get("tx_check_inputs_loop_ch_in_val_sig"), + "tx_check_inputs_loop_scan_outputkeys_get_item_size": obj.get("tx_check_inputs_loop_scan_outputkeys_get_item_size"), + "tx_check_inputs_loop_scan_outputkeys_relative_to_absolute": obj.get("tx_check_inputs_loop_scan_outputkeys_relative_to_absolute"), + "tx_check_inputs_loop_scan_outputkeys_loop": obj.get("tx_check_inputs_loop_scan_outputkeys_loop"), + "tx_check_inputs_loop_scan_outputkeys_loop_get_subitem": obj.get("tx_check_inputs_loop_scan_outputkeys_loop_get_subitem"), + "tx_check_inputs_loop_scan_outputkeys_loop_find_tx": obj.get("tx_check_inputs_loop_scan_outputkeys_loop_find_tx"), + "tx_check_inputs_loop_scan_outputkeys_loop_handle_output": obj.get("tx_check_inputs_loop_scan_outputkeys_loop_handle_output"), + "tx_mixin_count": obj.get("tx_mixin_count") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/models/version_model.py b/utils/sdk/client/python/lthn/models/version_model.py new file mode 100644 index 00000000..48e53c3b --- /dev/null +++ b/utils/sdk/client/python/lthn/models/version_model.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VersionModel(BaseModel): + """ + VersionModel + """ # noqa: E501 + version: Optional[StrictStr] = None + version_long: Optional[StrictStr] = None + major: Optional[StrictStr] = None + minor: Optional[StrictStr] = None + revision: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["version", "version_long", "major", "minor", "revision"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VersionModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VersionModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "version": obj.get("version"), + "version_long": obj.get("version_long"), + "major": obj.get("major"), + "minor": obj.get("minor"), + "revision": obj.get("revision") + }) + return _obj + + diff --git a/utils/sdk/client/python/lthn/py.typed b/utils/sdk/client/python/lthn/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/utils/sdk/client/python/lthn/rest.py b/utils/sdk/client/python/lthn/rest.py new file mode 100644 index 00000000..5a0a972a --- /dev/null +++ b/utils/sdk/client/python/lthn/rest.py @@ -0,0 +1,258 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl + +import urllib3 + +from lthn.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _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. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` parameter directly in the body to support + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/utils/sdk/client/python/pyproject.toml b/utils/sdk/client/python/pyproject.toml new file mode 100644 index 00000000..2704cbd7 --- /dev/null +++ b/utils/sdk/client/python/pyproject.toml @@ -0,0 +1,95 @@ +[project] +name = "lthn" +version = "1.0.0" +description = "Lethean Blockchain API" +authors = [ + {name = "Lethean",email = "team@openapitools.org"}, +] +license = { text = "EUPL-1.2" } +readme = "README.md" +keywords = ["OpenAPI", "OpenAPI-Generator", "Lethean Blockchain API"] +requires-python = ">=3.9" + +dependencies = [ + "urllib3 (>=2.1.0,<3.0.0)", + "python-dateutil (>=2.8.2)", + "pydantic (>=2)", + "typing-extensions (>=4.7.1)", +] + +[project.urls] +Repository = "https://github.com/letheanVPN/blockchain" + +[tool.poetry] +requires-poetry = ">=2.0" + +[tool.poetry.group.dev.dependencies] +pytest = ">= 7.2.1" +pytest-cov = ">= 2.8.1" +tox = ">= 3.9.0" +flake8 = ">= 4.0.0" +types-python-dateutil = ">= 2.8.19.14" +mypy = ">= 1.5" + + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "lthn", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +extra_checks = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "lthn.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/utils/sdk/client/python/requirements.txt b/utils/sdk/client/python/requirements.txt new file mode 100644 index 00000000..6cbb2b98 --- /dev/null +++ b/utils/sdk/client/python/requirements.txt @@ -0,0 +1,4 @@ +urllib3 >= 2.1.0, < 3.0.0 +python_dateutil >= 2.8.2 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/utils/sdk/client/python/setup.cfg b/utils/sdk/client/python/setup.cfg new file mode 100644 index 00000000..11433ee8 --- /dev/null +++ b/utils/sdk/client/python/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/utils/sdk/client/python/setup.py b/utils/sdk/client/python/setup.py new file mode 100644 index 00000000..a9dc6eaa --- /dev/null +++ b/utils/sdk/client/python/setup.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "lthn" +VERSION = "1.0.0" +PYTHON_REQUIRES = ">= 3.9" +REQUIRES = [ + "urllib3 >= 2.1.0, < 3.0.0", + "python-dateutil >= 2.8.2", + "pydantic >= 2", + "typing-extensions >= 4.7.1", +] + +setup( + name=NAME, + version=VERSION, + description="Lethean Blockchain API", + author="Lethean", + author_email="team@openapitools.org", + url="https://github.com/letheanVPN/blockchain", + keywords=["OpenAPI", "OpenAPI-Generator", "Lethean Blockchain API"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + license="EUPL-1.2", + long_description_content_type='text/markdown', + long_description="""\ + OpenAPI for Lethean Blockchain + """, # noqa: E501 + package_data={"lthn": ["py.typed"]}, +) \ No newline at end of file diff --git a/utils/sdk/client/python/test-requirements.txt b/utils/sdk/client/python/test-requirements.txt new file mode 100644 index 00000000..e98555c1 --- /dev/null +++ b/utils/sdk/client/python/test-requirements.txt @@ -0,0 +1,6 @@ +pytest >= 7.2.1 +pytest-cov >= 2.8.1 +tox >= 3.9.0 +flake8 >= 4.0.0 +types-python-dateutil >= 2.8.19.14 +mypy >= 1.5 diff --git a/utils/sdk/client/python/test/__init__.py b/utils/sdk/client/python/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/utils/sdk/client/python/test/test_block_api.py b/utils/sdk/client/python/test/test_block_api.py new file mode 100644 index 00000000..43c36cdf --- /dev/null +++ b/utils/sdk/client/python/test/test_block_api.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.api.block_api import BlockApi + + +class TestBlockApi(unittest.TestCase): + """BlockApi unit test stubs""" + + def setUp(self) -> None: + self.api = BlockApi() + + def tearDown(self) -> None: + pass + + def test_create_block_template(self) -> None: + """Test case for create_block_template + + Create a block template for mining + """ + pass + + def test_get_block(self) -> None: + """Test case for get_block + + Get a block by its hash or height (ID) + """ + pass + + def test_get_blocks(self) -> None: + """Test case for get_blocks + + Get one or more blocks, with optional pagination. + """ + pass + + def test_get_height(self) -> None: + """Test case for get_height + + Get the current blockchain height + """ + pass + + def test_submit_block(self) -> None: + """Test case for submit_block + + Submit a new block to the network + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_block_details_model.py b/utils/sdk/client/python/test/test_block_details_model.py new file mode 100644 index 00000000..71916b8a --- /dev/null +++ b/utils/sdk/client/python/test/test_block_details_model.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.block_details_model import BlockDetailsModel + +class TestBlockDetailsModel(unittest.TestCase): + """BlockDetailsModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BlockDetailsModel: + """Test BlockDetailsModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `BlockDetailsModel` + """ + model = BlockDetailsModel() + if include_optional: + return BlockDetailsModel( + actual_timestamp = 56, + already_generated_coins = '', + base_reward = 56, + blob = '', + block_cumulative_size = 56, + block_tself_size = 56, + cumulative_diff_adjusted = '', + cumulative_diff_precise = '', + difficulty = '', + effective_fee_median = 56, + height = 56, + id = '', + is_orphan = True, + miner_text_info = '', + object_in_json = '', + penalty = 56, + pow_seed = '', + prev_id = '', + summary_reward = 56, + this_block_fee_median = 56, + timestamp = 56, + total_fee = 56, + total_txs_size = 56, + transactions_details = [ + lthn.models.transaction_details_model.TransactionDetailsModel( + amount = 56, + attachments = [ + lthn.models.transaction_attachment_model.TransactionAttachmentModel( + type = '', + short_view = '', + details_view = '', ) + ], + blob = '', + blob_size = 56, + extra = [ + lthn.models.transaction_extra_model.TransactionExtraModel( + type = '', + short_view = '', + details_view = '', ) + ], + fee = 56, + id = '', + ins = [ + lthn.models.transaction_input_model.TransactionInputModel( + amount = 56, + global_indexes = [ + 56 + ], + htlc_origin = '', + kimage_or_ms_id = '', + multisig_count = 0, ) + ], + keeper_block = 56, + object_in_json = '', + outs = [ + lthn.models.transaction_output_model.TransactionOutputModel( + amount = 56, + global_index = 56, + is_spent = True, + minimum_sigs = 0, + pub_keys = [ + '' + ], ) + ], + pub_key = '', + timestamp = 56, ) + ], + type = 0 + ) + else: + return BlockDetailsModel( + ) + """ + + def testBlockDetailsModel(self): + """Test BlockDetailsModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_block_processing_performance_model.py b/utils/sdk/client/python/test/test_block_processing_performance_model.py new file mode 100644 index 00000000..63725356 --- /dev/null +++ b/utils/sdk/client/python/test/test_block_processing_performance_model.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.block_processing_performance_model import BlockProcessingPerformanceModel + +class TestBlockProcessingPerformanceModel(unittest.TestCase): + """BlockProcessingPerformanceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BlockProcessingPerformanceModel: + """Test BlockProcessingPerformanceModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `BlockProcessingPerformanceModel` + """ + model = BlockProcessingPerformanceModel() + if include_optional: + return BlockProcessingPerformanceModel( + block_processing_time_0 = 56, + block_processing_time_1 = 56, + target_calculating_time_2 = 56, + longhash_calculating_time_3 = 56, + all_txs_insert_time_5 = 56, + etc_stuff_6 = 56, + insert_time_4 = 56, + raise_block_core_event = 56, + validate_miner_transaction_time = 56, + collect_rangeproofs_data_from_tx_time = 56, + verify_multiple_zc_outs_range_proofs_time = 56, + target_calculating_enum_blocks = 56, + target_calculating_calc = 56, + pos_validate_ki_search = 56, + pos_validate_get_out_keys_for_inputs = 56, + pos_validate_zvp = 56 + ) + else: + return BlockProcessingPerformanceModel( + ) + """ + + def testBlockProcessingPerformanceModel(self): + """Test BlockProcessingPerformanceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_block_template_model.py b/utils/sdk/client/python/test/test_block_template_model.py new file mode 100644 index 00000000..1c9e2f3d --- /dev/null +++ b/utils/sdk/client/python/test/test_block_template_model.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.block_template_model import BlockTemplateModel + +class TestBlockTemplateModel(unittest.TestCase): + """BlockTemplateModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BlockTemplateModel: + """Test BlockTemplateModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `BlockTemplateModel` + """ + model = BlockTemplateModel() + if include_optional: + return BlockTemplateModel( + blocktemplate_blob = '', + difficulty = '', + height = 56, + miner_tx_tgc = lthn.models.tx_generation_context_model.TxGenerationContextModel( + asset_ids = [ + '' + ], + blinded_asset_ids = [ + '' + ], + amount_commitments = [ + '' + ], + asset_id_blinding_masks = [ + '' + ], + amounts = [ + '' + ], + amount_blinding_masks = [ + '' + ], + pseudo_outs_blinded_asset_ids = [ + '' + ], + pseudo_outs_plus_real_out_blinding_masks = [ + '' + ], + real_zc_ins_asset_ids = [ + '' + ], + zc_input_amounts = [ + 56 + ], + pseudo_out_amount_commitments_sum = '', + pseudo_out_amount_blinding_masks_sum = '', + real_in_asset_id_blinding_mask_x_amount_sum = '', + amount_commitments_sum = '', + amount_blinding_masks_sum = '', + asset_id_blinding_mask_x_amount_sum = '', + ao_asset_id = '', + ao_asset_id_pt = '', + ao_amount_commitment = '', + ao_amount_blinding_mask = '', + ao_commitment_in_outputs = True, + tx_key_pub = '', + tx_key_sec = '', + tx_pub_key_p = '', ), + block_reward_without_fee = 56, + block_reward = 56, + txs_fee = 56, + prev_hash = '', + seed = '' + ) + else: + return BlockTemplateModel( + ) + """ + + def testBlockTemplateModel(self): + """Test BlockTemplateModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_block_template_request_model.py b/utils/sdk/client/python/test/test_block_template_request_model.py new file mode 100644 index 00000000..c594d937 --- /dev/null +++ b/utils/sdk/client/python/test/test_block_template_request_model.py @@ -0,0 +1,67 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.block_template_request_model import BlockTemplateRequestModel + +class TestBlockTemplateRequestModel(unittest.TestCase): + """BlockTemplateRequestModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BlockTemplateRequestModel: + """Test BlockTemplateRequestModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `BlockTemplateRequestModel` + """ + model = BlockTemplateRequestModel() + if include_optional: + return BlockTemplateRequestModel( + miner_address = '', + stakeholder_address = '', + ex_nonce = '', + pos_block = True, + ignore_pow_ts_check = True, + pe = lthn.models.pos_entry_model.PosEntryModel( + amount = 56, + g_index = 56, + keyimage = '', + block_timestamp = 56, + stake_unlock_time = 56, + tx_id = '', + tx_out_index = 56, + wallet_index = 56, ), + explicit_txs = [ + '' + ] + ) + else: + return BlockTemplateRequestModel( + ) + """ + + def testBlockTemplateRequestModel(self): + """Test BlockTemplateRequestModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_db_stat_info_model.py b/utils/sdk/client/python/test/test_db_stat_info_model.py new file mode 100644 index 00000000..468ff884 --- /dev/null +++ b/utils/sdk/client/python/test/test_db_stat_info_model.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.db_stat_info_model import DbStatInfoModel + +class TestDbStatInfoModel(unittest.TestCase): + """DbStatInfoModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DbStatInfoModel: + """Test DbStatInfoModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DbStatInfoModel` + """ + model = DbStatInfoModel() + if include_optional: + return DbStatInfoModel( + tx_count = 56, + write_tx_count = 56, + map_size = 56 + ) + else: + return DbStatInfoModel( + ) + """ + + def testDbStatInfoModel(self): + """Test DbStatInfoModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_height_model.py b/utils/sdk/client/python/test/test_height_model.py new file mode 100644 index 00000000..176c2dcf --- /dev/null +++ b/utils/sdk/client/python/test/test_height_model.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.height_model import HeightModel + +class TestHeightModel(unittest.TestCase): + """HeightModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> HeightModel: + """Test HeightModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `HeightModel` + """ + model = HeightModel() + if include_optional: + return HeightModel( + height = 56 + ) + else: + return HeightModel( + ) + """ + + def testHeightModel(self): + """Test HeightModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_info_api.py b/utils/sdk/client/python/test/test_info_api.py new file mode 100644 index 00000000..b778651d --- /dev/null +++ b/utils/sdk/client/python/test/test_info_api.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.api.info_api import InfoApi + + +class TestInfoApi(unittest.TestCase): + """InfoApi unit test stubs""" + + def setUp(self) -> None: + self.api = InfoApi() + + def tearDown(self) -> None: + pass + + def test_get_info(self) -> None: + """Test case for get_info + + Get detailed information about the blockchain and daemon state + """ + pass + + def test_version(self) -> None: + """Test case for version + + Get API version + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_info_model.py b/utils/sdk/client/python/test/test_info_model.py new file mode 100644 index 00000000..27500b5f --- /dev/null +++ b/utils/sdk/client/python/test/test_info_model.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.info_model import InfoModel + +class TestInfoModel(unittest.TestCase): + """InfoModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> InfoModel: + """Test InfoModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `InfoModel` + """ + model = InfoModel() + if include_optional: + return InfoModel( + height = 56, + tx_count = 56, + tx_pool_size = 56, + alt_blocks_count = 56, + outgoing_connections_count = 56, + incoming_connections_count = 56, + synchronized_connections_count = 56, + white_peerlist_size = 56, + grey_peerlist_size = 56, + current_blocks_median = 56, + alias_count = 56, + current_max_allowed_block_size = 56, + daemon_network_state = '', + synchronization_start_height = 56, + max_net_seen_height = 56, + mi = lthn.models.maintainers_info_model.MaintainersInfoModel( + ver_major = 0, + ver_minor = 0, + ver_revision = 0, + build_no = 0, + mode = 0, ), + pos_allowed = True, + pos_difficulty = '', + pow_difficulty = 56, + default_fee = 56, + minimum_fee = 56, + is_hardfork_active = [ + True + ], + net_time_delta_median = 56, + current_network_hashrate_50 = 56, + current_network_hashrate_350 = 56, + seconds_for_10_blocks = 56, + seconds_for_30_blocks = 56, + transactions_cnt_per_day = [ + 56 + ], + transactions_volume_per_day = [ + 56 + ], + last_pos_timestamp = 56, + last_pow_timestamp = 56, + total_coins = '', + last_block_size = 56, + tx_count_in_last_block = 56, + pos_sequence_factor = 1.337, + pow_sequence_factor = 1.337, + block_reward = 56, + last_block_total_reward = 56, + pos_diff_total_coins_rate = 56, + last_block_timestamp = 56, + last_block_hash = '', + pos_block_ts_shift_vs_actual = 56, + outs_stat = { + 'key' : 56 + }, + performance_data = lthn.models.performance_model.PerformanceModel( + block_processing = lthn.models.block_processing_performance_model.BlockProcessingPerformanceModel( + block_processing_time_0 = 56, + block_processing_time_1 = 56, + target_calculating_time_2 = 56, + longhash_calculating_time_3 = 56, + all_txs_insert_time_5 = 56, + etc_stuff_6 = 56, + insert_time_4 = 56, + raise_block_core_event = 56, + validate_miner_transaction_time = 56, + collect_rangeproofs_data_from_tx_time = 56, + verify_multiple_zc_outs_range_proofs_time = 56, + target_calculating_enum_blocks = 56, + target_calculating_calc = 56, + pos_validate_ki_search = 56, + pos_validate_get_out_keys_for_inputs = 56, + pos_validate_zvp = 56, ), + tx_processing = lthn.models.tx_processing_performance_model.TxProcessingPerformanceModel( + tx_check_inputs = 56, + tx_add_one_tx = 56, + tx_process_extra = 56, + tx_process_attachment = 56, + tx_process_inputs = 56, + tx_push_global_index = 56, + tx_check_exist = 56, + tx_print_log = 56, + tx_prapare_append = 56, + tx_append = 56, + tx_append_rl_wait = 56, + tx_append_is_expired = 56, + tx_store_db = 56, + tx_check_inputs_prefix_hash = 56, + tx_check_inputs_attachment_check = 56, + tx_check_inputs_loop = 56, + tx_check_inputs_loop_kimage_check = 56, + tx_check_inputs_loop_ch_in_val_sig = 56, + tx_check_inputs_loop_scan_outputkeys_get_item_size = 56, + tx_check_inputs_loop_scan_outputkeys_relative_to_absolute = 56, + tx_check_inputs_loop_scan_outputkeys_loop = 56, + tx_check_inputs_loop_scan_outputkeys_loop_get_subitem = 56, + tx_check_inputs_loop_scan_outputkeys_loop_find_tx = 56, + tx_check_inputs_loop_scan_outputkeys_loop_handle_output = 56, + tx_mixin_count = 56, ), + tx_pool = lthn.models.tx_pool_performance_model.TxPoolPerformanceModel( + tx_processing_time = 56, + check_inputs_types_supported_time = 56, + expiration_validate_time = 56, + validate_amount_time = 56, + validate_alias_time = 56, + check_keyimages_ws_ms_time = 56, + check_inputs_time = 56, + begin_tx_time = 56, + update_db_time = 56, + db_commit_time = 56, + check_post_hf4_balance = 56, ), + db_stat_info = lthn.models.db_stat_info_model.DbStatInfoModel( + tx_count = 56, + write_tx_count = 56, + map_size = 56, ), ), + offers_count = 56, + expiration_median_timestamp = 56 + ) + else: + return InfoModel( + ) + """ + + def testInfoModel(self): + """Test InfoModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_maintainers_info_model.py b/utils/sdk/client/python/test/test_maintainers_info_model.py new file mode 100644 index 00000000..285e1a22 --- /dev/null +++ b/utils/sdk/client/python/test/test_maintainers_info_model.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.maintainers_info_model import MaintainersInfoModel + +class TestMaintainersInfoModel(unittest.TestCase): + """MaintainersInfoModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MaintainersInfoModel: + """Test MaintainersInfoModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MaintainersInfoModel` + """ + model = MaintainersInfoModel() + if include_optional: + return MaintainersInfoModel( + ver_major = 0, + ver_minor = 0, + ver_revision = 0, + build_no = 0, + mode = 0 + ) + else: + return MaintainersInfoModel( + ) + """ + + def testMaintainersInfoModel(self): + """Test MaintainersInfoModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_performance_model.py b/utils/sdk/client/python/test/test_performance_model.py new file mode 100644 index 00000000..b6c37515 --- /dev/null +++ b/utils/sdk/client/python/test/test_performance_model.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.performance_model import PerformanceModel + +class TestPerformanceModel(unittest.TestCase): + """PerformanceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PerformanceModel: + """Test PerformanceModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PerformanceModel` + """ + model = PerformanceModel() + if include_optional: + return PerformanceModel( + block_processing = lthn.models.block_processing_performance_model.BlockProcessingPerformanceModel( + block_processing_time_0 = 56, + block_processing_time_1 = 56, + target_calculating_time_2 = 56, + longhash_calculating_time_3 = 56, + all_txs_insert_time_5 = 56, + etc_stuff_6 = 56, + insert_time_4 = 56, + raise_block_core_event = 56, + validate_miner_transaction_time = 56, + collect_rangeproofs_data_from_tx_time = 56, + verify_multiple_zc_outs_range_proofs_time = 56, + target_calculating_enum_blocks = 56, + target_calculating_calc = 56, + pos_validate_ki_search = 56, + pos_validate_get_out_keys_for_inputs = 56, + pos_validate_zvp = 56, ), + tx_processing = lthn.models.tx_processing_performance_model.TxProcessingPerformanceModel( + tx_check_inputs = 56, + tx_add_one_tx = 56, + tx_process_extra = 56, + tx_process_attachment = 56, + tx_process_inputs = 56, + tx_push_global_index = 56, + tx_check_exist = 56, + tx_print_log = 56, + tx_prapare_append = 56, + tx_append = 56, + tx_append_rl_wait = 56, + tx_append_is_expired = 56, + tx_store_db = 56, + tx_check_inputs_prefix_hash = 56, + tx_check_inputs_attachment_check = 56, + tx_check_inputs_loop = 56, + tx_check_inputs_loop_kimage_check = 56, + tx_check_inputs_loop_ch_in_val_sig = 56, + tx_check_inputs_loop_scan_outputkeys_get_item_size = 56, + tx_check_inputs_loop_scan_outputkeys_relative_to_absolute = 56, + tx_check_inputs_loop_scan_outputkeys_loop = 56, + tx_check_inputs_loop_scan_outputkeys_loop_get_subitem = 56, + tx_check_inputs_loop_scan_outputkeys_loop_find_tx = 56, + tx_check_inputs_loop_scan_outputkeys_loop_handle_output = 56, + tx_mixin_count = 56, ), + tx_pool = lthn.models.tx_pool_performance_model.TxPoolPerformanceModel( + tx_processing_time = 56, + check_inputs_types_supported_time = 56, + expiration_validate_time = 56, + validate_amount_time = 56, + validate_alias_time = 56, + check_keyimages_ws_ms_time = 56, + check_inputs_time = 56, + begin_tx_time = 56, + update_db_time = 56, + db_commit_time = 56, + check_post_hf4_balance = 56, ), + db_stat_info = lthn.models.db_stat_info_model.DbStatInfoModel( + tx_count = 56, + write_tx_count = 56, + map_size = 56, ) + ) + else: + return PerformanceModel( + ) + """ + + def testPerformanceModel(self): + """Test PerformanceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_pos_entry_model.py b/utils/sdk/client/python/test/test_pos_entry_model.py new file mode 100644 index 00000000..d868fb7f --- /dev/null +++ b/utils/sdk/client/python/test/test_pos_entry_model.py @@ -0,0 +1,58 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.pos_entry_model import PosEntryModel + +class TestPosEntryModel(unittest.TestCase): + """PosEntryModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PosEntryModel: + """Test PosEntryModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PosEntryModel` + """ + model = PosEntryModel() + if include_optional: + return PosEntryModel( + amount = 56, + g_index = 56, + keyimage = '', + block_timestamp = 56, + stake_unlock_time = 56, + tx_id = '', + tx_out_index = 56, + wallet_index = 56 + ) + else: + return PosEntryModel( + ) + """ + + def testPosEntryModel(self): + """Test PosEntryModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_submit_block_request_model.py b/utils/sdk/client/python/test/test_submit_block_request_model.py new file mode 100644 index 00000000..c2a3f50f --- /dev/null +++ b/utils/sdk/client/python/test/test_submit_block_request_model.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.submit_block_request_model import SubmitBlockRequestModel + +class TestSubmitBlockRequestModel(unittest.TestCase): + """SubmitBlockRequestModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SubmitBlockRequestModel: + """Test SubmitBlockRequestModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SubmitBlockRequestModel` + """ + model = SubmitBlockRequestModel() + if include_optional: + return SubmitBlockRequestModel( + block_blob = '' + ) + else: + return SubmitBlockRequestModel( + ) + """ + + def testSubmitBlockRequestModel(self): + """Test SubmitBlockRequestModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_submit_block_response_model.py b/utils/sdk/client/python/test/test_submit_block_response_model.py new file mode 100644 index 00000000..2fd18672 --- /dev/null +++ b/utils/sdk/client/python/test/test_submit_block_response_model.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.submit_block_response_model import SubmitBlockResponseModel + +class TestSubmitBlockResponseModel(unittest.TestCase): + """SubmitBlockResponseModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SubmitBlockResponseModel: + """Test SubmitBlockResponseModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SubmitBlockResponseModel` + """ + model = SubmitBlockResponseModel() + if include_optional: + return SubmitBlockResponseModel( + status = '' + ) + else: + return SubmitBlockResponseModel( + ) + """ + + def testSubmitBlockResponseModel(self): + """Test SubmitBlockResponseModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_transaction_attachment_model.py b/utils/sdk/client/python/test/test_transaction_attachment_model.py new file mode 100644 index 00000000..93c40458 --- /dev/null +++ b/utils/sdk/client/python/test/test_transaction_attachment_model.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.transaction_attachment_model import TransactionAttachmentModel + +class TestTransactionAttachmentModel(unittest.TestCase): + """TransactionAttachmentModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TransactionAttachmentModel: + """Test TransactionAttachmentModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TransactionAttachmentModel` + """ + model = TransactionAttachmentModel() + if include_optional: + return TransactionAttachmentModel( + type = '', + short_view = '', + details_view = '' + ) + else: + return TransactionAttachmentModel( + ) + """ + + def testTransactionAttachmentModel(self): + """Test TransactionAttachmentModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_transaction_details_model.py b/utils/sdk/client/python/test/test_transaction_details_model.py new file mode 100644 index 00000000..91334502 --- /dev/null +++ b/utils/sdk/client/python/test/test_transaction_details_model.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.transaction_details_model import TransactionDetailsModel + +class TestTransactionDetailsModel(unittest.TestCase): + """TransactionDetailsModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TransactionDetailsModel: + """Test TransactionDetailsModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TransactionDetailsModel` + """ + model = TransactionDetailsModel() + if include_optional: + return TransactionDetailsModel( + amount = 56, + attachments = [ + lthn.models.transaction_attachment_model.TransactionAttachmentModel( + type = '', + short_view = '', + details_view = '', ) + ], + blob = '', + blob_size = 56, + extra = [ + lthn.models.transaction_extra_model.TransactionExtraModel( + type = '', + short_view = '', + details_view = '', ) + ], + fee = 56, + id = '', + ins = [ + lthn.models.transaction_input_model.TransactionInputModel( + amount = 56, + global_indexes = [ + 56 + ], + htlc_origin = '', + kimage_or_ms_id = '', + multisig_count = 0, ) + ], + keeper_block = 56, + object_in_json = '', + outs = [ + lthn.models.transaction_output_model.TransactionOutputModel( + amount = 56, + global_index = 56, + is_spent = True, + minimum_sigs = 0, + pub_keys = [ + '' + ], ) + ], + pub_key = '', + timestamp = 56 + ) + else: + return TransactionDetailsModel( + ) + """ + + def testTransactionDetailsModel(self): + """Test TransactionDetailsModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_transaction_extra_model.py b/utils/sdk/client/python/test/test_transaction_extra_model.py new file mode 100644 index 00000000..e58a68f9 --- /dev/null +++ b/utils/sdk/client/python/test/test_transaction_extra_model.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.transaction_extra_model import TransactionExtraModel + +class TestTransactionExtraModel(unittest.TestCase): + """TransactionExtraModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TransactionExtraModel: + """Test TransactionExtraModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TransactionExtraModel` + """ + model = TransactionExtraModel() + if include_optional: + return TransactionExtraModel( + type = '', + short_view = '', + details_view = '' + ) + else: + return TransactionExtraModel( + ) + """ + + def testTransactionExtraModel(self): + """Test TransactionExtraModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_transaction_input_model.py b/utils/sdk/client/python/test/test_transaction_input_model.py new file mode 100644 index 00000000..10b7877e --- /dev/null +++ b/utils/sdk/client/python/test/test_transaction_input_model.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.transaction_input_model import TransactionInputModel + +class TestTransactionInputModel(unittest.TestCase): + """TransactionInputModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TransactionInputModel: + """Test TransactionInputModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TransactionInputModel` + """ + model = TransactionInputModel() + if include_optional: + return TransactionInputModel( + amount = 56, + global_indexes = [ + 56 + ], + htlc_origin = '', + kimage_or_ms_id = '', + multisig_count = 0 + ) + else: + return TransactionInputModel( + ) + """ + + def testTransactionInputModel(self): + """Test TransactionInputModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_transaction_output_model.py b/utils/sdk/client/python/test/test_transaction_output_model.py new file mode 100644 index 00000000..ce232eda --- /dev/null +++ b/utils/sdk/client/python/test/test_transaction_output_model.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.transaction_output_model import TransactionOutputModel + +class TestTransactionOutputModel(unittest.TestCase): + """TransactionOutputModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TransactionOutputModel: + """Test TransactionOutputModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TransactionOutputModel` + """ + model = TransactionOutputModel() + if include_optional: + return TransactionOutputModel( + amount = 56, + global_index = 56, + is_spent = True, + minimum_sigs = 0, + pub_keys = [ + '' + ] + ) + else: + return TransactionOutputModel( + ) + """ + + def testTransactionOutputModel(self): + """Test TransactionOutputModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_tx_generation_context_model.py b/utils/sdk/client/python/test/test_tx_generation_context_model.py new file mode 100644 index 00000000..9de4a0cc --- /dev/null +++ b/utils/sdk/client/python/test/test_tx_generation_context_model.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.tx_generation_context_model import TxGenerationContextModel + +class TestTxGenerationContextModel(unittest.TestCase): + """TxGenerationContextModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TxGenerationContextModel: + """Test TxGenerationContextModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TxGenerationContextModel` + """ + model = TxGenerationContextModel() + if include_optional: + return TxGenerationContextModel( + asset_ids = [ + '' + ], + blinded_asset_ids = [ + '' + ], + amount_commitments = [ + '' + ], + asset_id_blinding_masks = [ + '' + ], + amounts = [ + '' + ], + amount_blinding_masks = [ + '' + ], + pseudo_outs_blinded_asset_ids = [ + '' + ], + pseudo_outs_plus_real_out_blinding_masks = [ + '' + ], + real_zc_ins_asset_ids = [ + '' + ], + zc_input_amounts = [ + 56 + ], + pseudo_out_amount_commitments_sum = '', + pseudo_out_amount_blinding_masks_sum = '', + real_in_asset_id_blinding_mask_x_amount_sum = '', + amount_commitments_sum = '', + amount_blinding_masks_sum = '', + asset_id_blinding_mask_x_amount_sum = '', + ao_asset_id = '', + ao_asset_id_pt = '', + ao_amount_commitment = '', + ao_amount_blinding_mask = '', + ao_commitment_in_outputs = True, + tx_key_pub = '', + tx_key_sec = '', + tx_pub_key_p = '' + ) + else: + return TxGenerationContextModel( + ) + """ + + def testTxGenerationContextModel(self): + """Test TxGenerationContextModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_tx_pool_performance_model.py b/utils/sdk/client/python/test/test_tx_pool_performance_model.py new file mode 100644 index 00000000..8fc0840c --- /dev/null +++ b/utils/sdk/client/python/test/test_tx_pool_performance_model.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.tx_pool_performance_model import TxPoolPerformanceModel + +class TestTxPoolPerformanceModel(unittest.TestCase): + """TxPoolPerformanceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TxPoolPerformanceModel: + """Test TxPoolPerformanceModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TxPoolPerformanceModel` + """ + model = TxPoolPerformanceModel() + if include_optional: + return TxPoolPerformanceModel( + tx_processing_time = 56, + check_inputs_types_supported_time = 56, + expiration_validate_time = 56, + validate_amount_time = 56, + validate_alias_time = 56, + check_keyimages_ws_ms_time = 56, + check_inputs_time = 56, + begin_tx_time = 56, + update_db_time = 56, + db_commit_time = 56, + check_post_hf4_balance = 56 + ) + else: + return TxPoolPerformanceModel( + ) + """ + + def testTxPoolPerformanceModel(self): + """Test TxPoolPerformanceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_tx_processing_performance_model.py b/utils/sdk/client/python/test/test_tx_processing_performance_model.py new file mode 100644 index 00000000..d76d5306 --- /dev/null +++ b/utils/sdk/client/python/test/test_tx_processing_performance_model.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.tx_processing_performance_model import TxProcessingPerformanceModel + +class TestTxProcessingPerformanceModel(unittest.TestCase): + """TxProcessingPerformanceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TxProcessingPerformanceModel: + """Test TxProcessingPerformanceModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TxProcessingPerformanceModel` + """ + model = TxProcessingPerformanceModel() + if include_optional: + return TxProcessingPerformanceModel( + tx_check_inputs = 56, + tx_add_one_tx = 56, + tx_process_extra = 56, + tx_process_attachment = 56, + tx_process_inputs = 56, + tx_push_global_index = 56, + tx_check_exist = 56, + tx_print_log = 56, + tx_prapare_append = 56, + tx_append = 56, + tx_append_rl_wait = 56, + tx_append_is_expired = 56, + tx_store_db = 56, + tx_check_inputs_prefix_hash = 56, + tx_check_inputs_attachment_check = 56, + tx_check_inputs_loop = 56, + tx_check_inputs_loop_kimage_check = 56, + tx_check_inputs_loop_ch_in_val_sig = 56, + tx_check_inputs_loop_scan_outputkeys_get_item_size = 56, + tx_check_inputs_loop_scan_outputkeys_relative_to_absolute = 56, + tx_check_inputs_loop_scan_outputkeys_loop = 56, + tx_check_inputs_loop_scan_outputkeys_loop_get_subitem = 56, + tx_check_inputs_loop_scan_outputkeys_loop_find_tx = 56, + tx_check_inputs_loop_scan_outputkeys_loop_handle_output = 56, + tx_mixin_count = 56 + ) + else: + return TxProcessingPerformanceModel( + ) + """ + + def testTxProcessingPerformanceModel(self): + """Test TxProcessingPerformanceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/test/test_version_model.py b/utils/sdk/client/python/test/test_version_model.py new file mode 100644 index 00000000..b965135c --- /dev/null +++ b/utils/sdk/client/python/test/test_version_model.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Lethean Blockchain API + + OpenAPI for Lethean Blockchain + + The version of the OpenAPI document: 6.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lthn.models.version_model import VersionModel + +class TestVersionModel(unittest.TestCase): + """VersionModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> VersionModel: + """Test VersionModel + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `VersionModel` + """ + model = VersionModel() + if include_optional: + return VersionModel( + version = '', + version_long = '', + major = '', + minor = '', + revision = '' + ) + else: + return VersionModel( + ) + """ + + def testVersionModel(self): + """Test VersionModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/utils/sdk/client/python/tox.ini b/utils/sdk/client/python/tox.ini new file mode 100644 index 00000000..928195f7 --- /dev/null +++ b/utils/sdk/client/python/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=lthn diff --git a/utils/sdk/packages/python.json b/utils/sdk/packages/python.json index 3cb982bd..d1a623c9 100644 --- a/utils/sdk/packages/python.json +++ b/utils/sdk/packages/python.json @@ -1,7 +1,7 @@ { "additionalProperties": { - "packageName": "lthnchainsdk", - "projectName": "lthnchainsdk", - "packageUrl": "https://github.com/letheanVPN" + "packageName": "lthn", + "projectName": "lthn", + "packageUrl": "https://github.com/letheanVPN/blockchain" } } \ No newline at end of file