iexbase/tron-api-python

passing an array as an argument to the contract method

ibragimHachaturyan opened this issue · 2 comments

tell me how to be, I can’t solve the problem, there is a method in the contract that takes arrays as parameters:

function_selector='pay_royaltie(address [], uint256[], uint256[])',

how do I generate transaction data correctly, i do so:

row_trans = tron.transaction_builder.trigger_smart_contract(
    contract_address=CONTRACT_TRX,
    function_selector='pay_royaltie(address [], uint256[], uint256[])',
    # fee_limit=30000,
    call_value=25000000000,
    parameters=[
        [{'type': 'address', 'value': 'TmklXhXjgXTj87trNujkWFuXtQP8sCWZZV'}],
        [{'type': 'int256', 'value': 2}],
        [{'type': 'int256', 'value': int(3)}],
    ]
)

and half tea the next mistake:

raise ValueError('Invalid parameter type provided: ' + abi['type'])
TypeError: list indices must be integers or slices, not str in transactionbuilder.py", line 563, in trigger_smart_contract

parameters accepts a list of dictionaries, not a list of lists with one dictionary

parameters=[
        {'type': 'address', 'value': 'TmklXhXjgXTj87trNujkWFuXtQP8sCWZZV'},
        {'type': 'int256', 'value': 2},
        {'type': 'int256', 'value': int(3)},
    ]

so only one value will be transferred to the contract, and I have an array of each elements