substrate-interface 1.7.4__tar.gz → 1.7.6__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.
- {substrate-interface-1.7.4/substrate_interface.egg-info → substrate-interface-1.7.6}/PKG-INFO +1 -1
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/setup.py +1 -1
- {substrate-interface-1.7.4 → substrate-interface-1.7.6/substrate_interface.egg-info}/PKG-INFO +1 -1
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrate_interface.egg-info/requires.txt +1 -1
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/base.py +34 -21
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/contracts.py +19 -1
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/ecdsa_helpers.py +5 -5
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_create_extrinsics.py +7 -7
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_init.py +11 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_query.py +6 -6
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_runtime_call.py +1 -1
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_type_registry.py +2 -2
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/LICENSE +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/README.md +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/setup.cfg +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrate_interface.egg-info/SOURCES.txt +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrate_interface.egg-info/dependency_links.txt +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrate_interface.egg-info/top_level.txt +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/__init__.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/constants.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/exceptions.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/extensions.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/interfaces.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/key.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/keypair.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/storage.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/__init__.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/caching.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/encrypted_json.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/hasher.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/ss58.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_block.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_contracts.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_extension_interface.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_helper_functions.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_keypair.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_query_map.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_rpc_compatibility.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_ss58.py +0 -0
- {substrate-interface-1.7.4 → substrate-interface-1.7.6}/test/test_subscriptions.py +0 -0
|
@@ -188,7 +188,7 @@ setup(
|
|
|
188
188
|
'eth_utils>=1.3.0,<3',
|
|
189
189
|
'pycryptodome>=3.11.0,<4',
|
|
190
190
|
'PyNaCl>=1.0.1,<2',
|
|
191
|
-
'scalecodec>=1.2.
|
|
191
|
+
'scalecodec>=1.2.8,<1.3',
|
|
192
192
|
'py-sr25519-bindings>=0.2.0,<1',
|
|
193
193
|
'py-ed25519-zebra-bindings>=1.0,<2',
|
|
194
194
|
'py-bip39-bindings>=0.1.9,<1'
|
|
@@ -69,7 +69,7 @@ class SubstrateInterface:
|
|
|
69
69
|
|
|
70
70
|
def __init__(self, url=None, websocket=None, ss58_format=None, type_registry=None, type_registry_preset=None,
|
|
71
71
|
cache_region=None, runtime_config=None, use_remote_preset=False, ws_options=None,
|
|
72
|
-
auto_discover=True, auto_reconnect=True):
|
|
72
|
+
auto_discover=True, auto_reconnect=True, config=None):
|
|
73
73
|
"""
|
|
74
74
|
A specialized class in interfacing with a Substrate node.
|
|
75
75
|
|
|
@@ -80,8 +80,9 @@ class SubstrateInterface:
|
|
|
80
80
|
type_registry: A dict containing the custom type registry in format: {'types': {'customType': 'u32'},..}
|
|
81
81
|
type_registry_preset: The name of the predefined type registry shipped with the SCALE-codec, e.g. kusama
|
|
82
82
|
cache_region: a Dogpile cache region as a central store for the metadata cache
|
|
83
|
-
use_remote_preset: When True preset is downloaded from
|
|
83
|
+
use_remote_preset: When True preset is downloaded from GitHub master, otherwise use files from local installed scalecodec package
|
|
84
84
|
ws_options: dict of options to pass to the websocket-client create_connection function
|
|
85
|
+
config: dict of config flags to overwrite default configuration
|
|
85
86
|
"""
|
|
86
87
|
|
|
87
88
|
if (not url and not websocket) or (url and websocket):
|
|
@@ -154,9 +155,14 @@ class SubstrateInterface:
|
|
|
154
155
|
'use_remote_preset': use_remote_preset,
|
|
155
156
|
'auto_discover': auto_discover,
|
|
156
157
|
'auto_reconnect': auto_reconnect,
|
|
157
|
-
'rpc_methods': None
|
|
158
|
+
'rpc_methods': None,
|
|
159
|
+
'strict_scale_decode': True
|
|
158
160
|
}
|
|
159
161
|
|
|
162
|
+
if type(config) is dict:
|
|
163
|
+
self.config.update(config)
|
|
164
|
+
|
|
165
|
+
|
|
160
166
|
# Initialize extension interface
|
|
161
167
|
self.extensions = ExtensionInterface(self)
|
|
162
168
|
|
|
@@ -578,7 +584,7 @@ class SubstrateInterface:
|
|
|
578
584
|
return response.get('result')
|
|
579
585
|
|
|
580
586
|
def generate_storage_hash(self, storage_module: str, storage_function: str, params: list = None,
|
|
581
|
-
hashers: list = None):
|
|
587
|
+
hashers: list = None) -> str:
|
|
582
588
|
"""
|
|
583
589
|
Generate a storage key for given module/function
|
|
584
590
|
|
|
@@ -791,7 +797,7 @@ class SubstrateInterface:
|
|
|
791
797
|
|
|
792
798
|
# Generate storage key prefix
|
|
793
799
|
storage_key = StorageKey.create_from_storage_function(
|
|
794
|
-
module,
|
|
800
|
+
module, storage_item.value['name'], params, runtime_config=self.runtime_config, metadata=self.metadata
|
|
795
801
|
)
|
|
796
802
|
prefix = storage_key.to_hex()
|
|
797
803
|
|
|
@@ -1015,7 +1021,7 @@ class SubstrateInterface:
|
|
|
1015
1021
|
else:
|
|
1016
1022
|
|
|
1017
1023
|
storage_key = StorageKey.create_from_storage_function(
|
|
1018
|
-
module,
|
|
1024
|
+
module, storage_item.value['name'], params, runtime_config=self.runtime_config, metadata=self.metadata
|
|
1019
1025
|
)
|
|
1020
1026
|
|
|
1021
1027
|
if callable(subscription_handler):
|
|
@@ -1054,7 +1060,7 @@ class SubstrateInterface:
|
|
|
1054
1060
|
data=ScaleBytes(query_value),
|
|
1055
1061
|
metadata=self.metadata
|
|
1056
1062
|
)
|
|
1057
|
-
obj.decode()
|
|
1063
|
+
obj.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
1058
1064
|
obj.meta_info = {'result_found': response.get('result') is not None}
|
|
1059
1065
|
|
|
1060
1066
|
return obj
|
|
@@ -1080,11 +1086,14 @@ class SubstrateInterface:
|
|
|
1080
1086
|
WELL_KNOWN_STORAGE_KEYS[name]['value_type_string']
|
|
1081
1087
|
)
|
|
1082
1088
|
if result:
|
|
1083
|
-
obj.decode(ScaleBytes(result))
|
|
1089
|
+
obj.decode(ScaleBytes(result), check_remaining=self.config.get('strict_scale_decode'))
|
|
1084
1090
|
obj.meta_info = {'result_found': True}
|
|
1085
1091
|
return obj
|
|
1086
1092
|
elif WELL_KNOWN_STORAGE_KEYS[name]['default']:
|
|
1087
|
-
obj.decode(
|
|
1093
|
+
obj.decode(
|
|
1094
|
+
ScaleBytes(WELL_KNOWN_STORAGE_KEYS[name]['default']),
|
|
1095
|
+
check_remaining=self.config.get('strict_scale_decode')
|
|
1096
|
+
)
|
|
1088
1097
|
obj.meta_info = {'result_found': False}
|
|
1089
1098
|
return obj
|
|
1090
1099
|
else:
|
|
@@ -1177,7 +1186,7 @@ class SubstrateInterface:
|
|
|
1177
1186
|
data=ScaleBytes(change_data),
|
|
1178
1187
|
metadata=self.metadata
|
|
1179
1188
|
)
|
|
1180
|
-
updated_obj.decode()
|
|
1189
|
+
updated_obj.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
1181
1190
|
updated_obj.meta_info = {'result_found': result_found}
|
|
1182
1191
|
|
|
1183
1192
|
subscription_result = subscription_handler(storage_key, updated_obj, update_nr, subscription_id)
|
|
@@ -1212,7 +1221,7 @@ class SubstrateInterface:
|
|
|
1212
1221
|
|
|
1213
1222
|
for extrinsic_data in result_data['result']:
|
|
1214
1223
|
extrinsic = self.runtime_config.create_scale_object('Extrinsic', metadata=self.metadata)
|
|
1215
|
-
extrinsic.decode(ScaleBytes(extrinsic_data))
|
|
1224
|
+
extrinsic.decode(ScaleBytes(extrinsic_data), check_remaining=self.config.get('strict_scale_decode'))
|
|
1216
1225
|
extrinsics.append(extrinsic)
|
|
1217
1226
|
|
|
1218
1227
|
return extrinsics
|
|
@@ -1271,7 +1280,7 @@ class SubstrateInterface:
|
|
|
1271
1280
|
|
|
1272
1281
|
# Decode result
|
|
1273
1282
|
result_obj = self.runtime_config.create_scale_object(runtime_call_def['type'])
|
|
1274
|
-
result_obj.decode(ScaleBytes(result_data['result']))
|
|
1283
|
+
result_obj.decode(ScaleBytes(result_data['result']), check_remaining=self.config.get('strict_scale_decode'))
|
|
1275
1284
|
|
|
1276
1285
|
return result_obj
|
|
1277
1286
|
|
|
@@ -1368,7 +1377,9 @@ class SubstrateInterface:
|
|
|
1368
1377
|
|
|
1369
1378
|
return self.runtime_config.create_scale_object(type_string, data=data, **kwargs)
|
|
1370
1379
|
|
|
1371
|
-
def compose_call(
|
|
1380
|
+
def compose_call(
|
|
1381
|
+
self, call_module: str, call_function: str, call_params: dict = None, block_hash: str = None
|
|
1382
|
+
) -> GenericCall:
|
|
1372
1383
|
"""
|
|
1373
1384
|
Composes a call payload which can be used in an extrinsic.
|
|
1374
1385
|
|
|
@@ -1531,10 +1542,12 @@ class SubstrateInterface:
|
|
|
1531
1542
|
|
|
1532
1543
|
return signature_payload.data
|
|
1533
1544
|
|
|
1534
|
-
def create_signed_extrinsic(
|
|
1535
|
-
|
|
1545
|
+
def create_signed_extrinsic(
|
|
1546
|
+
self, call: GenericCall, keypair: Keypair, era: dict = None, nonce: int = None,
|
|
1547
|
+
tip: int = 0, tip_asset_id: int = None, signature: Union[bytes, str] = None
|
|
1548
|
+
) -> GenericExtrinsic:
|
|
1536
1549
|
"""
|
|
1537
|
-
Creates
|
|
1550
|
+
Creates an extrinsic signed by given account details
|
|
1538
1551
|
|
|
1539
1552
|
Parameters
|
|
1540
1553
|
----------
|
|
@@ -2314,7 +2327,7 @@ class SubstrateInterface:
|
|
|
2314
2327
|
runtime_config=self.runtime_config
|
|
2315
2328
|
)
|
|
2316
2329
|
try:
|
|
2317
|
-
extrinsic_decoder.decode()
|
|
2330
|
+
extrinsic_decoder.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
2318
2331
|
block_data['extrinsics'][idx] = extrinsic_decoder
|
|
2319
2332
|
|
|
2320
2333
|
except Exception as e:
|
|
@@ -2332,7 +2345,7 @@ class SubstrateInterface:
|
|
|
2332
2345
|
raise NotImplementedError("No decoding class found for 'DigestItem'")
|
|
2333
2346
|
|
|
2334
2347
|
log_digest = log_digest_cls(data=ScaleBytes(log_data))
|
|
2335
|
-
log_digest.decode()
|
|
2348
|
+
log_digest.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
2336
2349
|
|
|
2337
2350
|
block_data['header']["digest"]["logs"][idx] = log_digest
|
|
2338
2351
|
|
|
@@ -2350,7 +2363,7 @@ class SubstrateInterface:
|
|
|
2350
2363
|
data=ScaleBytes(bytes(log_digest[1][1]))
|
|
2351
2364
|
)
|
|
2352
2365
|
|
|
2353
|
-
babe_predigest.decode()
|
|
2366
|
+
babe_predigest.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
2354
2367
|
|
|
2355
2368
|
rank_validator = babe_predigest[1].value['authority_index']
|
|
2356
2369
|
|
|
@@ -2363,7 +2376,7 @@ class SubstrateInterface:
|
|
|
2363
2376
|
data=ScaleBytes(bytes(log_digest[1][1]))
|
|
2364
2377
|
)
|
|
2365
2378
|
|
|
2366
|
-
aura_predigest.decode()
|
|
2379
|
+
aura_predigest.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
2367
2380
|
|
|
2368
2381
|
rank_validator = aura_predigest.value['slot_number'] % len(validator_set)
|
|
2369
2382
|
|
|
@@ -2666,7 +2679,7 @@ class SubstrateInterface:
|
|
|
2666
2679
|
metadata=self.metadata
|
|
2667
2680
|
)
|
|
2668
2681
|
|
|
2669
|
-
obj.decode()
|
|
2682
|
+
obj.decode(check_remaining=self.config.get('strict_scale_decode'))
|
|
2670
2683
|
|
|
2671
2684
|
if return_scale_obj:
|
|
2672
2685
|
return obj
|
|
@@ -22,7 +22,7 @@ from typing import Optional
|
|
|
22
22
|
from .utils import version_tuple
|
|
23
23
|
|
|
24
24
|
from substrateinterface.exceptions import ExtrinsicFailedException, DeployContractFailedException, \
|
|
25
|
-
ContractReadFailedException, ContractMetadataParseException
|
|
25
|
+
ContractReadFailedException, ContractMetadataParseException, StorageFunctionNotFound
|
|
26
26
|
from scalecodec.base import ScaleBytes, ScaleType
|
|
27
27
|
from scalecodec.types import GenericContractExecResult
|
|
28
28
|
from substrateinterface.base import SubstrateInterface, Keypair, ExtrinsicReceipt
|
|
@@ -718,6 +718,24 @@ class ContractInstance:
|
|
|
718
718
|
self.contract_address = contract_address
|
|
719
719
|
self.metadata = metadata
|
|
720
720
|
|
|
721
|
+
self.init()
|
|
722
|
+
|
|
723
|
+
def init(self):
|
|
724
|
+
# Determine ContractExecResult according to PalletVersion
|
|
725
|
+
try:
|
|
726
|
+
pallet_version = self.substrate.query("Contracts", "PalletVersion")
|
|
727
|
+
|
|
728
|
+
if pallet_version.value <= 9:
|
|
729
|
+
self.substrate.runtime_config.update_type_registry_types(
|
|
730
|
+
{"ContractExecResult": "ContractExecResultTo267"}
|
|
731
|
+
)
|
|
732
|
+
else:
|
|
733
|
+
self.substrate.runtime_config.update_type_registry_types(
|
|
734
|
+
{"ContractExecResult": "ContractExecResultTo269"}
|
|
735
|
+
)
|
|
736
|
+
except StorageFunctionNotFound:
|
|
737
|
+
pass
|
|
738
|
+
|
|
721
739
|
@classmethod
|
|
722
740
|
def create_from_address(cls, contract_address: str, metadata_file: str,
|
|
723
741
|
substrate: SubstrateInterface = None) -> "ContractInstance":
|
{substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/ecdsa_helpers.py
RENAMED
|
@@ -35,13 +35,13 @@ class PublicKey:
|
|
|
35
35
|
self.point = int.from_bytes(private_key, byteorder='big') * BIP32_CURVE.generator
|
|
36
36
|
|
|
37
37
|
def __bytes__(self):
|
|
38
|
-
xstr = self.point.x().to_bytes(32, byteorder='big')
|
|
39
|
-
parity = self.point.y() & 1
|
|
38
|
+
xstr = int(self.point.x()).to_bytes(32, byteorder='big')
|
|
39
|
+
parity = int(self.point.y()) & 1
|
|
40
40
|
return (2 + parity).to_bytes(1, byteorder='big') + xstr
|
|
41
41
|
|
|
42
42
|
def address(self):
|
|
43
|
-
x = self.point.x()
|
|
44
|
-
y = self.point.y()
|
|
43
|
+
x = int(self.point.x())
|
|
44
|
+
y = int(self.point.y())
|
|
45
45
|
s = x.to_bytes(32, 'big') + y.to_bytes(32, 'big')
|
|
46
46
|
return to_checksum_address(eth_utils_keccak(s)[12:])
|
|
47
47
|
|
|
@@ -72,7 +72,7 @@ def derive_bip32childkey(parent_key, parent_chain_code, i):
|
|
|
72
72
|
key, chain_code = h[:32], h[32:]
|
|
73
73
|
a = int.from_bytes(key, byteorder='big')
|
|
74
74
|
b = int.from_bytes(parent_key, byteorder='big')
|
|
75
|
-
key = (a + b) % BIP32_CURVE.order
|
|
75
|
+
key = (a + b) % int(BIP32_CURVE.order)
|
|
76
76
|
if a < BIP32_CURVE.order and key != 0:
|
|
77
77
|
key = key.to_bytes(32, byteorder='big')
|
|
78
78
|
break
|
|
@@ -53,7 +53,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
53
53
|
# Create balance transfer call
|
|
54
54
|
call = self.kusama_substrate.compose_call(
|
|
55
55
|
call_module='Balances',
|
|
56
|
-
call_function='
|
|
56
|
+
call_function='transfer_keep_alive',
|
|
57
57
|
call_params={
|
|
58
58
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
59
59
|
'value': 3 * 10 ** 3
|
|
@@ -66,7 +66,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
66
66
|
decoded_extrinsic.decode(extrinsic.data)
|
|
67
67
|
|
|
68
68
|
self.assertEqual(decoded_extrinsic['call']['call_module'].name, 'Balances')
|
|
69
|
-
self.assertEqual(decoded_extrinsic['call']['call_function'].name, '
|
|
69
|
+
self.assertEqual(decoded_extrinsic['call']['call_function'].name, 'transfer_keep_alive')
|
|
70
70
|
self.assertEqual(extrinsic['nonce'], 0)
|
|
71
71
|
self.assertEqual(extrinsic['tip'], 1)
|
|
72
72
|
|
|
@@ -77,7 +77,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
77
77
|
# Create balance transfer call
|
|
78
78
|
call = substrate.compose_call(
|
|
79
79
|
call_module='Balances',
|
|
80
|
-
call_function='
|
|
80
|
+
call_function='transfer_keep_alive',
|
|
81
81
|
call_params={
|
|
82
82
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
83
83
|
'value': 3 * 10 ** 3
|
|
@@ -99,7 +99,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
99
99
|
|
|
100
100
|
balance_call = self.polkadot_substrate.compose_call(
|
|
101
101
|
call_module='Balances',
|
|
102
|
-
call_function='
|
|
102
|
+
call_function='transfer_keep_alive',
|
|
103
103
|
call_params={
|
|
104
104
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
105
105
|
'value': 3 * 10 ** 3
|
|
@@ -126,7 +126,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
126
126
|
|
|
127
127
|
call = self.kusama_substrate.compose_call(
|
|
128
128
|
call_module='Balances',
|
|
129
|
-
call_function='
|
|
129
|
+
call_function='transfer_keep_alive',
|
|
130
130
|
call_params={
|
|
131
131
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
132
132
|
'value': 3 * 10 ** 3
|
|
@@ -172,7 +172,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
172
172
|
|
|
173
173
|
call = self.kusama_substrate.compose_call(
|
|
174
174
|
call_module='Balances',
|
|
175
|
-
call_function='
|
|
175
|
+
call_function='transfer_keep_alive',
|
|
176
176
|
call_params={
|
|
177
177
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
178
178
|
'value': 2000
|
|
@@ -218,7 +218,7 @@ class CreateExtrinsicsTestCase(unittest.TestCase):
|
|
|
218
218
|
# Create balance transfer call
|
|
219
219
|
call = self.kusama_substrate.compose_call(
|
|
220
220
|
call_module='Balances',
|
|
221
|
-
call_function='
|
|
221
|
+
call_function='transfer_keep_alive',
|
|
222
222
|
call_params={
|
|
223
223
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
224
224
|
'value': 3 * 10 ** 3
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
import unittest
|
|
18
18
|
|
|
19
|
+
from scalecodec import ScaleBytes
|
|
20
|
+
from scalecodec.exceptions import RemainingScaleBytesNotEmptyException
|
|
19
21
|
from substrateinterface import SubstrateInterface
|
|
20
22
|
from test import settings
|
|
21
23
|
|
|
@@ -99,6 +101,15 @@ class TestInit(unittest.TestCase):
|
|
|
99
101
|
|
|
100
102
|
self.assertFalse(substrate.websocket.connected)
|
|
101
103
|
|
|
104
|
+
def test_strict_scale_decode(self):
|
|
105
|
+
|
|
106
|
+
with self.assertRaises(RemainingScaleBytesNotEmptyException):
|
|
107
|
+
self.kusama_substrate.decode_scale('u8', ScaleBytes('0x0101'))
|
|
108
|
+
|
|
109
|
+
with SubstrateInterface(url=settings.KUSAMA_NODE_URL, config={'strict_scale_decode': False}) as substrate:
|
|
110
|
+
result = substrate.decode_scale('u8', ScaleBytes('0x0101'))
|
|
111
|
+
self.assertEqual(result, 1)
|
|
112
|
+
|
|
102
113
|
|
|
103
114
|
if __name__ == '__main__':
|
|
104
115
|
unittest.main()
|
|
@@ -44,11 +44,11 @@ class QueryTestCase(unittest.TestCase):
|
|
|
44
44
|
module='System',
|
|
45
45
|
storage_function='Account',
|
|
46
46
|
params=['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'],
|
|
47
|
-
block_hash='
|
|
47
|
+
block_hash='0xbf787e2f322080e137ed53e763b1cc97d5c5585be1f736914e27d68ac97f5f2c'
|
|
48
48
|
)
|
|
49
49
|
|
|
50
|
-
self.assertEqual(
|
|
51
|
-
self.assertEqual(
|
|
50
|
+
self.assertEqual(67501, result.value['nonce'])
|
|
51
|
+
self.assertEqual(1099945000512, result.value['data']['free'])
|
|
52
52
|
self.assertEqual(result.meta_info['result_found'], True)
|
|
53
53
|
|
|
54
54
|
def test_system_account_non_existing(self):
|
|
@@ -116,11 +116,11 @@ class QueryTestCase(unittest.TestCase):
|
|
|
116
116
|
|
|
117
117
|
def test_well_known_pallet_version(self):
|
|
118
118
|
|
|
119
|
-
sf = self.kusama_substrate.get_metadata_storage_function("
|
|
119
|
+
sf = self.kusama_substrate.get_metadata_storage_function("Balances", "PalletVersion")
|
|
120
120
|
self.assertEqual(sf.value['name'], ':__STORAGE_VERSION__:')
|
|
121
121
|
|
|
122
|
-
result = self.kusama_substrate.query("
|
|
123
|
-
self.assertGreaterEqual(result.value,
|
|
122
|
+
result = self.kusama_substrate.query("Balances", "PalletVersion")
|
|
123
|
+
self.assertGreaterEqual(result.value, 1)
|
|
124
124
|
|
|
125
125
|
def test_query_multi(self):
|
|
126
126
|
|
|
@@ -51,7 +51,7 @@ class RuntimeCallTestCase(unittest.TestCase):
|
|
|
51
51
|
def test_transaction_payment(self):
|
|
52
52
|
call = self.substrate.compose_call(
|
|
53
53
|
call_module='Balances',
|
|
54
|
-
call_function='
|
|
54
|
+
call_function='transfer_keep_alive',
|
|
55
55
|
call_params={
|
|
56
56
|
'dest': 'EaG2CRhJWPb7qmdcJvy3LiWdh26Jreu9Dx6R1rXxPmYXoDk',
|
|
57
57
|
'value': 3 * 10 ** 3
|
|
@@ -196,7 +196,7 @@ class AutodetectAddressTypeTestCase(unittest.TestCase):
|
|
|
196
196
|
|
|
197
197
|
call = substrate.compose_call(
|
|
198
198
|
call_module='Balances',
|
|
199
|
-
call_function='
|
|
199
|
+
call_function='transfer_keep_alive',
|
|
200
200
|
call_params={
|
|
201
201
|
'dest': keypair_alice.ss58_address,
|
|
202
202
|
'value': 2000
|
|
@@ -216,7 +216,7 @@ class AutodetectAddressTypeTestCase(unittest.TestCase):
|
|
|
216
216
|
|
|
217
217
|
call = substrate.compose_call(
|
|
218
218
|
call_module='Balances',
|
|
219
|
-
call_function='
|
|
219
|
+
call_function='transfer_keep_alive',
|
|
220
220
|
call_params={
|
|
221
221
|
'dest': keypair_alice.ss58_address,
|
|
222
222
|
'value': 2000
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrate_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrate_interface.egg-info/top_level.txt
RENAMED
|
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
|
{substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{substrate-interface-1.7.4 → substrate-interface-1.7.6}/substrateinterface/utils/encrypted_json.py
RENAMED
|
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
|