ValueError(f'Unsupported type registry preset "{name}"')
See original GitHub issueHey Arjan, I have been struggling with passing my custom types file to the interface class. Do you know how I could pass the file or dictionary properly to the interface? 😃
Here is where I define the types dictionary and the Substrate interface class:
`custom_type_registry = { “types”: { “Address”: “MultiAddress”, “LookupSource”: “MultiAddress”, “Bid”: { “uuid”: “u32”, “market_uuid”: “Option<Vec<u8>>”, “asset_uuid”: “Option<Vec<u8>>”, “max_energy”: “u32”, “time_slot”: “Vec<u8>” }, “Offer”: { “uuid”: “u32”, “market_uuid”: “Option<Vec<u8>>”, “asset_uuid”: “Option<Vec<u8>>”, “energy_type”: “Vec<u8>”, “max_energy”: “u32”, “time_slot”: “Vec<u8>” }, “Match”: { “ids”: “u32”, “price”: “u32”, “energy”: “u32” } } }
class BlockChainInterface:
def __init__(self):
self.substrate = SubstrateInterface(
url=DEFAULT_SUBSTRATE_URL,
address_type=TEMPLATE_NODE_ADDRESS_TYPE,
type_registry=custom_type_registry,
use_remote_preset=False
)`
Here is the traceback:
Traceback (most recent call last): File "/Users/admin/Envs/d3a/bin/d3a", line 33, in <module> sys.exit(load_entry_point('d3a', 'console_scripts', 'd3a')()) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/admin/github/d3a/src/d3a/d3a_core/cli.py", line 151, in run run_simulation(setup_module_name, simulation_config, None, None, None, File "/Users/admin/github/d3a/src/d3a/d3a_core/simulation.py", line 592, in run_simulation simulation = Simulation( File "/Users/admin/github/d3a/src/d3a/d3a_core/simulation.py", line 120, in __init__ self._init(**self.initial_params, redis_job_id=redis_job_id) File "/Users/admin/github/d3a/src/d3a/d3a_core/simulation.py", line 185, in _init self.bc = BlockChainInterface() File "/Users/admin/github/d3a/src/d3a/blockchain/__init__.py", line 64, in __init__ self.substrate = SubstrateInterface( File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/substrateinterface/base.py", line 450, in __init__ self.reload_type_registry(use_remote_preset=use_remote_preset) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/substrateinterface/base.py", line 2496, in reload_type_registry type_registry_preset_dict = load_type_registry_preset(self.chain.lower()) File "/Users/admin/Envs/d3a/lib/python3.8/site-packages/scalecodec/type_registry/__init__.py", line 43, in load_type_registry_preset raise ValueError(f'Unsupported type registry preset "{name}"') ValueError: Unsupported type registry preset "local testnet"
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (7 by maintainers)
Exactly, that is missing now 😃
The struct format of
Bid
,Offer
andMatch
is incorrect, it should be formatted likeKeys