blockapi 2.11.6__tar.gz → 2.12.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {blockapi-2.11.6 → blockapi-2.12.1}/PKG-INFO +1 -1
- blockapi-2.12.1/blockapi/test/v2/api/test_chainso.py +76 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_terra.py +66 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/__init__.py +1 -0
- blockapi-2.12.1/blockapi/v2/api/chainso.py +69 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/cosmos.py +2 -2
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi.egg-info/PKG-INFO +1 -1
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi.egg-info/SOURCES.txt +2 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/setup.py +1 -1
- {blockapi-2.11.6 → blockapi-2.12.1}/LICENSE.md +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/README.md +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/services.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/test_blockapi.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/test_num.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/test_random_user_agent.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/conftest.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/covalenth/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/covalenth/test_ethereum.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/fake_sleep_provider.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/nft/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/nft/test_magic_eden.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/nft/test_opensea.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/nft/test_simple_hash.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/nft/test_unisat.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_bitaps_ltc.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_blockchain_info.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_blockchainos.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_blockchair_btc.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_blockchair_doge.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_blockchair_ltc.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_cosmos.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_ethplorer.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_haskoin.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_litecoinspace.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_multisources.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_optimistic_etherscan.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_solana.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_subscan_polkadot.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_sui.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_trezor_btc.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/api/test_trezor_zec.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_base.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_blockchain_api.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_blockchain_mapping.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_data.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_enumerate_classes.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_generic.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test/v2/test_models.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/test_data.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/utils/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/utils/address.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/utils/datetime.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/utils/num.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/utils/user_agent.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/bitaps.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/blockchain_info.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/blockchainos.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/blockchair.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/arbitrum.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/astar.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/avalanche.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/axie.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/base.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/binance_smart_chain.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/ethereum.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/fantom.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/heco.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/iotex.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/klaytn.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/moonbeam.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/palm.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/polygon.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/covalenth/rsk.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/debank.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/debank_maps.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/ethplorer.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/haskoin.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/litecoinspace.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/nft/__init__.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/nft/magic_eden.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/nft/opensea.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/nft/simple_hash.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/nft/unisat.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/optimistic_etherscan.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/solana.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/subscan.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/sui.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/terra.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/api/trezor.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/base.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/blockchain_mapping.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/coin_mapping.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/coins.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi/v2/models.py +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi.egg-info/dependency_links.txt +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi.egg-info/requires.txt +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/blockapi.egg-info/top_level.txt +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/pyproject.toml +0 -0
- {blockapi-2.11.6 → blockapi-2.12.1}/setup.cfg +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from decimal import Decimal
|
|
2
|
+
from unittest.mock import Mock
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from requests.exceptions import ReadTimeout
|
|
6
|
+
|
|
7
|
+
from blockapi.test.v2.api.conftest import read_file
|
|
8
|
+
from blockapi.test.v2.test_data import ltc_test_address
|
|
9
|
+
from blockapi.v2.api import ChainSoLitecoinApi
|
|
10
|
+
from blockapi.v2.base import ApiException
|
|
11
|
+
from blockapi.v2.models import FetchResult
|
|
12
|
+
|
|
13
|
+
URL = f'https://sochain.com/api/v3/balance/LTC/{ltc_test_address}'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_fetch_balances(requests_mock):
|
|
17
|
+
requests_mock.get(URL, text=read_file('data/chainso_balance_response.json'))
|
|
18
|
+
api = ChainSoLitecoinApi()
|
|
19
|
+
balances = api.get_balance(ltc_test_address)
|
|
20
|
+
assert len(balances) == 1
|
|
21
|
+
assert balances[0].balance == Decimal('262.99968329')
|
|
22
|
+
assert balances[0].balance_raw == Decimal('26299968329')
|
|
23
|
+
assert balances[0].coin == api.coin
|
|
24
|
+
assert requests_mock.last_request.timeout == (3.0, 10.0)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.parametrize('confirmed', ['0.00000000', '0.00000001'])
|
|
28
|
+
def test_confirmed_balance_only(requests_mock, confirmed):
|
|
29
|
+
requests_mock.get(
|
|
30
|
+
URL,
|
|
31
|
+
json={
|
|
32
|
+
'status': 'success',
|
|
33
|
+
'data': {'confirmed': confirmed, 'unconfirmed': '12.00000000'},
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
balances = ChainSoLitecoinApi().get_balance(ltc_test_address)
|
|
37
|
+
if Decimal(confirmed):
|
|
38
|
+
assert balances[0].balance == Decimal(confirmed)
|
|
39
|
+
assert balances[0].balance_raw == 1
|
|
40
|
+
else:
|
|
41
|
+
assert balances == []
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@pytest.mark.parametrize(
|
|
45
|
+
'response',
|
|
46
|
+
[
|
|
47
|
+
None,
|
|
48
|
+
{},
|
|
49
|
+
{'status': 'fail', 'data': {'confirmed': '0'}},
|
|
50
|
+
{'status': 'success', 'data': {}},
|
|
51
|
+
*[
|
|
52
|
+
{'status': 'success', 'data': {'confirmed': value}}
|
|
53
|
+
for value in [None, 'bad', 'NaN', 'Infinity', '-1', '0.000000001']
|
|
54
|
+
],
|
|
55
|
+
],
|
|
56
|
+
)
|
|
57
|
+
def test_invalid_response_is_not_zero(response):
|
|
58
|
+
with pytest.raises(ApiException):
|
|
59
|
+
ChainSoLitecoinApi().parse_balances(FetchResult(data=response))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@pytest.mark.parametrize('status', [429, 502])
|
|
63
|
+
def test_http_failure_does_not_retry_or_return_zero(requests_mock, status):
|
|
64
|
+
requests_mock.get(URL, status_code=status, json={'status': 'fail'})
|
|
65
|
+
sleep_provider = Mock()
|
|
66
|
+
api = ChainSoLitecoinApi(sleep_provider=sleep_provider)
|
|
67
|
+
with pytest.raises(ApiException):
|
|
68
|
+
api.get_balance(ltc_test_address)
|
|
69
|
+
assert requests_mock.call_count == 1
|
|
70
|
+
sleep_provider.sleep.assert_not_called()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_read_timeout_is_not_zero(requests_mock):
|
|
74
|
+
requests_mock.get(URL, exc=ReadTimeout('stalled'))
|
|
75
|
+
with pytest.raises(ApiException):
|
|
76
|
+
ChainSoLitecoinApi().get_balance(ltc_test_address)
|
|
@@ -176,6 +176,72 @@ def test_get_staking_balances(
|
|
|
176
176
|
assert luna_reward.balance == Decimal('5')
|
|
177
177
|
|
|
178
178
|
|
|
179
|
+
@pytest.mark.parametrize(
|
|
180
|
+
'has_delegations, has_unbonding, expected_staked',
|
|
181
|
+
[
|
|
182
|
+
(False, False, '0'),
|
|
183
|
+
(False, True, '25'),
|
|
184
|
+
(True, False, '100'),
|
|
185
|
+
],
|
|
186
|
+
)
|
|
187
|
+
def test_get_balance_with_null_staking_responses(
|
|
188
|
+
terra_api,
|
|
189
|
+
balances_response,
|
|
190
|
+
staking_response,
|
|
191
|
+
rewards_response,
|
|
192
|
+
requests_mock,
|
|
193
|
+
has_delegations,
|
|
194
|
+
has_unbonding,
|
|
195
|
+
expected_staked,
|
|
196
|
+
):
|
|
197
|
+
requests_mock.get(
|
|
198
|
+
f'{BASE_URL}/cosmos/bank/v1beta1/balances/{ADDRESS}',
|
|
199
|
+
json=balances_response,
|
|
200
|
+
)
|
|
201
|
+
requests_mock.get(
|
|
202
|
+
f'{BASE_URL}/cosmos/staking/v1beta1/delegations/{ADDRESS}',
|
|
203
|
+
json={
|
|
204
|
+
'delegation_responses': (
|
|
205
|
+
staking_response['delegation_responses'] if has_delegations else None
|
|
206
|
+
),
|
|
207
|
+
'pagination': {'next_key': None, 'total': str(int(has_delegations))},
|
|
208
|
+
},
|
|
209
|
+
)
|
|
210
|
+
requests_mock.get(
|
|
211
|
+
f'{BASE_URL}/cosmos/staking/v1beta1/delegators/{ADDRESS}/unbonding_delegations',
|
|
212
|
+
json={
|
|
213
|
+
'unbonding_responses': (
|
|
214
|
+
[{'entries': [{'balance': '25000000'}]}] if has_unbonding else None
|
|
215
|
+
),
|
|
216
|
+
'pagination': {'next_key': None, 'total': str(int(has_unbonding))},
|
|
217
|
+
},
|
|
218
|
+
)
|
|
219
|
+
requests_mock.get(
|
|
220
|
+
f'{BASE_URL}/cosmos/distribution/v1beta1/delegators/{ADDRESS}/rewards',
|
|
221
|
+
json=rewards_response,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
balances = terra_api.get_balance(ADDRESS)
|
|
225
|
+
|
|
226
|
+
available = {
|
|
227
|
+
b.coin.address: b.balance
|
|
228
|
+
for b in balances
|
|
229
|
+
if b.asset_type == AssetType.AVAILABLE
|
|
230
|
+
}
|
|
231
|
+
assert available == {
|
|
232
|
+
'uluna': Decimal('23068.009633'),
|
|
233
|
+
'uusd': Decimal('85.997844'),
|
|
234
|
+
}
|
|
235
|
+
staked = [b for b in balances if b.asset_type == AssetType.STAKED]
|
|
236
|
+
assert [b.balance for b in staked] == (
|
|
237
|
+
[Decimal(expected_staked)] if Decimal(expected_staked) else []
|
|
238
|
+
)
|
|
239
|
+
rewards = {
|
|
240
|
+
b.coin.address: b.balance for b in balances if b.asset_type == AssetType.REWARDS
|
|
241
|
+
}
|
|
242
|
+
assert rewards == {'uluna': Decimal('5'), 'uusd': Decimal('1')}
|
|
243
|
+
|
|
244
|
+
|
|
179
245
|
def test_resolve_ibc_denom(terra_api, ibc_denom_trace_response, requests_mock):
|
|
180
246
|
ibc_hash = '0A866A7A214C42CEF84430C8A4C7210C8C7A980548A9B9BE64316D1610A87C6C'
|
|
181
247
|
ibc_denom = f'ibc/{ibc_hash}'
|
|
@@ -7,6 +7,7 @@ from blockapi.v2.api.blockchair import (
|
|
|
7
7
|
BlockchairDogecoinApi,
|
|
8
8
|
BlockchairLitecoinApi,
|
|
9
9
|
)
|
|
10
|
+
from blockapi.v2.api.chainso import ChainSoLitecoinApi
|
|
10
11
|
from blockapi.v2.api.debank import DebankApi, DebankApp, DebankPrediction
|
|
11
12
|
from blockapi.v2.api.ethplorer import EthplorerApi
|
|
12
13
|
from blockapi.v2.api.haskoin import HaskoinApi
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from decimal import Decimal, InvalidOperation
|
|
2
|
+
|
|
3
|
+
from blockapi.v2.base import ApiException, BalanceMixin, BlockchainApi
|
|
4
|
+
from blockapi.v2.coins import COIN_LTC
|
|
5
|
+
from blockapi.v2.models import (
|
|
6
|
+
ApiOptions,
|
|
7
|
+
AssetType,
|
|
8
|
+
BalanceItem,
|
|
9
|
+
Blockchain,
|
|
10
|
+
FetchResult,
|
|
11
|
+
ParseResult,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ChainSoLitecoinApi(BlockchainApi, BalanceMixin):
|
|
16
|
+
"""Litecoin confirmed balances: https://sochain.com/docs."""
|
|
17
|
+
|
|
18
|
+
coin = COIN_LTC
|
|
19
|
+
api_options = ApiOptions(
|
|
20
|
+
blockchain=Blockchain.LITECOIN,
|
|
21
|
+
base_url='https://sochain.com',
|
|
22
|
+
rate_limit=1.0,
|
|
23
|
+
)
|
|
24
|
+
supported_requests = {
|
|
25
|
+
'get_balance': '/api/v3/balance/LTC/{address}',
|
|
26
|
+
}
|
|
27
|
+
http_timeout = (3.0, 10.0)
|
|
28
|
+
max_rate_limit_retries = 1
|
|
29
|
+
|
|
30
|
+
def fetch_balances(self, address: str) -> FetchResult:
|
|
31
|
+
return self.get_data('get_balance', address=address)
|
|
32
|
+
|
|
33
|
+
def _get_response(self, request_method, headers, params, req_args):
|
|
34
|
+
url = self._build_request_url(request_method, **req_args)
|
|
35
|
+
return self._session.get(
|
|
36
|
+
url, headers=headers, params=params, timeout=self.http_timeout
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def parse_balances(self, fetch_result: FetchResult) -> ParseResult:
|
|
40
|
+
response = fetch_result.data
|
|
41
|
+
if not isinstance(response, dict) or response.get('status') != 'success':
|
|
42
|
+
raise ApiException('SoChain balance request was not successful')
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
# SoChain returns LTC, whereas balance_raw uses litoshis.
|
|
46
|
+
balance_raw = (
|
|
47
|
+
Decimal(response['data']['confirmed']) * 10**self.coin.decimals
|
|
48
|
+
)
|
|
49
|
+
except (KeyError, TypeError, ValueError, InvalidOperation) as exc:
|
|
50
|
+
raise ApiException('Invalid SoChain confirmed balance') from exc
|
|
51
|
+
if (
|
|
52
|
+
not balance_raw.is_finite()
|
|
53
|
+
or balance_raw < 0
|
|
54
|
+
or balance_raw != balance_raw.to_integral_value()
|
|
55
|
+
):
|
|
56
|
+
raise ApiException('Invalid SoChain confirmed balance')
|
|
57
|
+
if not balance_raw:
|
|
58
|
+
return ParseResult()
|
|
59
|
+
|
|
60
|
+
return ParseResult(
|
|
61
|
+
data=[
|
|
62
|
+
BalanceItem.from_api(
|
|
63
|
+
balance_raw=balance_raw,
|
|
64
|
+
coin=self.coin,
|
|
65
|
+
asset_type=AssetType.AVAILABLE,
|
|
66
|
+
raw=response,
|
|
67
|
+
)
|
|
68
|
+
]
|
|
69
|
+
)
|
|
@@ -177,13 +177,13 @@ class CosmosApiBase(BlockchainApi, IBalance, metaclass=ABCMeta):
|
|
|
177
177
|
staked_response = self._get('get_staked_balance', address=address)
|
|
178
178
|
staked_balance = sum(
|
|
179
179
|
to_decimal(d['balance']['amount'])
|
|
180
|
-
for d in staked_response['delegation_responses']
|
|
180
|
+
for d in (staked_response['delegation_responses'] or [])
|
|
181
181
|
)
|
|
182
182
|
|
|
183
183
|
unbonding_response = self._get('get_unbonding_balance', address=address)
|
|
184
184
|
unbonding_balance = sum(
|
|
185
185
|
to_decimal(unbonding_entry['balance'])
|
|
186
|
-
for unbonding in unbonding_response['unbonding_responses']
|
|
186
|
+
for unbonding in (unbonding_response['unbonding_responses'] or [])
|
|
187
187
|
for unbonding_entry in unbonding['entries']
|
|
188
188
|
)
|
|
189
189
|
|
|
@@ -32,6 +32,7 @@ blockapi/test/v2/api/test_blockchainos.py
|
|
|
32
32
|
blockapi/test/v2/api/test_blockchair_btc.py
|
|
33
33
|
blockapi/test/v2/api/test_blockchair_doge.py
|
|
34
34
|
blockapi/test/v2/api/test_blockchair_ltc.py
|
|
35
|
+
blockapi/test/v2/api/test_chainso.py
|
|
35
36
|
blockapi/test/v2/api/test_cosmos.py
|
|
36
37
|
blockapi/test/v2/api/test_ethplorer.py
|
|
37
38
|
blockapi/test/v2/api/test_haskoin.py
|
|
@@ -67,6 +68,7 @@ blockapi/v2/api/bitaps.py
|
|
|
67
68
|
blockapi/v2/api/blockchain_info.py
|
|
68
69
|
blockapi/v2/api/blockchainos.py
|
|
69
70
|
blockapi/v2/api/blockchair.py
|
|
71
|
+
blockapi/v2/api/chainso.py
|
|
70
72
|
blockapi/v2/api/cosmos.py
|
|
71
73
|
blockapi/v2/api/debank.py
|
|
72
74
|
blockapi/v2/api/debank_maps.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|