polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
240 stars 116 forks source link

Unable to compute trasfer tx fee #150

Closed stolpa4 closed 3 years ago

stolpa4 commented 3 years ago

The code

from substrateinterface import SubstrateInterface
from substrateinterface import ExtrinsicReceipt

s = SubstrateInterface('wss://westend-rpc.polkadot.io')
r = ExtrinsicReceipt.create_from_extrinsic_identifier(s, '7981648-4')
fee = r.total_fee_amount

gives the following error:

Traceback (most recent call last):
  File "example.py", line 7, in <module>
    fee = r.total_fee_amount
  File ".../venv/lib/python3.8/site-packages/substrateinterface/base.py", line 3077, in total_fee_amount
    self.process_events()
  File ".../venv/lib/python3.8/site-packages/substrateinterface/base.py", line 2966, in process_events
    self.__total_fee_amount += event.value['attributes']
TypeError: unsupported operand type(s) for +=: 'int' and 'tuple'
stolpa4 commented 3 years ago

Sorry, I used the old 1.0.0 version. My bad. closing this. The solution is to update the version of substrate-interface