Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'get_type_string' #377

Closed
arjanz opened this issue Feb 7, 2024 Discussed in #376 · 1 comment
Closed

AttributeError: 'NoneType' object has no attribute 'get_type_string' #377

arjanz opened this issue Feb 7, 2024 Discussed in #376 · 1 comment

Comments

@arjanz
Copy link
Member

arjanz commented Feb 7, 2024

Discussed in #376

Originally posted by klemendrobnic February 6, 2024
I would need help with resolving an error that occurs when im trying to use compose_call function.

from substrateinterface import SubstrateInterface

substrate = SubstrateInterface(url="wss://ws.framenode-7.s4.stg1.sora2.soramitsu.co.jp")


call = substrate.compose_call(call_module='Balances',call_function='transfer',call_params={'dest': '5CvxUr1gXDvAN8qEDPBFVdnF7QcPwNfYCQLYDDr3cCzC45Vt','value': 1 * 10**12})

I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/klemendrobnic/.local/lib/python3.10/site-packages/substrateinterface/base.py", line 1408, in compose_call
    call.encode({
  File "/home/klemendrobnic/.local/lib/python3.10/site-packages/scalecodec/base.py", line 929, in encode
    self.data = self.process_encode(self.value_serialized)
  File "/home/klemendrobnic/.local/lib/python3.10/site-packages/scalecodec/types.py", line 1652, in process_encode
    call_type_string = self.call_module['calls'].value_object.get_type_string()
AttributeError: 'NoneType' object has no attribute 'get_type_string'

When i print the call_module that is called in the process_encode method i get the object printed, however the parameter calls is not included (call_type_string = self.call_module['calls'].value_object.get_type_string()) -> the code fails here
Thanks for any suggestions

After examining the metadata of the runtime, I found out that the Balances pallet for the endpoint you provided has in fact no runtime calls at all (so call transfer couldn't be found). You can also check PolkadotJS

However, the error handler could be improved here, the current thrown exception is indeed confusing and should be something like Call function 'transfer' not found. I'll make an issue for this.

@arjanz
Copy link
Member Author

arjanz commented Feb 7, 2024

@arjanz arjanz closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant