When I create a transaction group, with multiple LogicSigTransaction, sign it, then attempt to submit, I receive the following error AttributeError: 'NoneType' object has no attribute 'dictify'. If I submit these transactions as separate groups, it works fine (each group contains 1 logic sig transaction and other types of transactions in the group (e.g. payment transaction)). Wondering why I cannot submit a group with multiple logic sig transactions?
I am using the tinyman sdk which can be found here
This code probably won’t work, but this is what I am trying to do in general. all_txns is a grouped transaction that contains the logicsig signed transactions from txn_group1 and txn_group2. I group these together, then sign with the private key, then submit through the algod client.
from tinyman.v1.client import TinymanMainnetClient
address = 'input_here'
private_key = 'input_here'
client = TinymanMainnetClient(user_address=address)
ALGO = client.fetch_asset(0)
USDC = client.fetch_asset(31566704)
USDT = client.fetch_asset(312769)
pool1 = client.fetch_pool(ALGO, USDC)
pool2 = client.fetch_pool(ALGO, USDT)
quote1 = pool1.fetch_fixed_input_swap_quote(ALGO(10000)) # 0.01 ALGO
quote2 = pool2.fetch_fixed_input_swap_quote(ALGO(10000)) # 0.01 ALGO
txn_group1 = pool1.prepare_swap_transactions_from_quote(quote1) # this signs the transactions with a logicsig
txn_group2 = pool2.prepare_swap_transactions_from_quote(quote2) # this signs the transactions with a logicsig
all_txns = txn_group1.signed_transactions + txn_gruop2.signed_transactions # combine the transactions from each group into 1 group
all_txns.sign_with_private_key(address, private_key)
result = client.submit(transaction_group, wait=True)
all_txns = txn_group1.signed_transactions + txn_gruop2.signed_transactions # combine the transactions from each group into 1 group
You seem to have misspelled txn_gruop2. It should be txn_group2 .
In the line:
result = client.submit(transaction_group, wait=True)
You are referring to a transaction_group list that does not exist. It should be all_txns
Take a look at the Tinyman SDK prepare_swap_transactions function. It aggregates the 4 grouped transactions in a list and signs them using the sign_with_logicisg function.
Yes, I know that there are mistakes in this code – this is not the actual code I am running. The program is more complex than this but this example more clearly demonstrates what the issue is.
In the example, I assume that the grouped transactions are already signed (successfully) with the sign_with_logicsig function. The issue is trying to combine two of these groups into 1 big group then sending this single big group.
The problem still remains – how can I submit a group transaction that contains multiple LogicSig transactions? Is it possible? In my original comment I posted a github issue link that has the same issue, but I don’t see much information on it.
To my knowledge this issue is fixed in the JS SDK and never applied to the Python SDK.
Actually there is no issue signing with LogicSig multiple transactions in a group using the Algorand Python SDK.
Now, specifically to your use case.
It looks like you are using the TinyMan SDK (as opposed to the Algorand Python SDK) and trying to make 2 TinyMan swaps in a single group transactions.
I modified the transaction group to be able to support concatenation, to be able to perform simultaneous swaps. I want to concatenate two groups of TinyMan transactions to be able to swap simultaneously as a group… if one transaction fails then I want to other to fail as well – i.e. I don’t want to swap 1 asset if I can’t swap the other as well.
So is there no way around this? Is the approval program requiring 2 transactions from the sender? and the other 2 from the pool address both checked by the NoOp call?