Can i get ASA-ID if i am creating asa creation transaction in grouped transaction

I am looking for anyway like i can submit asa creation transaction in grouped transacation and get its ID on sdk level to pass to next transactions in group.
lets say
txn 1 - creating ASA
txn 2 - opt-in txn for created ASA in txn1 for some other address
txn 3 - transferring the created ASA to the opted in address

You can access the asa id with the gaid opcode, but since the txns are signed ahead of time you can’t “inject” the newly created id into the actual txn. You’d have to include some sc logic to do this all in one atomic group, probably using the upcoming application txns feature

2 Likes

Why do you want to group those 3 transactions?

Grouping is to ensure that the three transactions either all happen or none happen.
This is useful with smart contracts and when you want to do an atomic transfer: Alice sends ASA to Bob and Bob sends Algos to Alice for example.
Indeed, in that case, you don’t want a malicious Bob to never send the payment in Algos to Alice. And a group transaction exactly ensures this.

But in your case, I guess you may not need at all grouping.
In which case, you can just do:

  1. first create the ASA with a single transaction
  2. then, in a group of 2 transactions, opt in and transfer

If the address receiving the ASA can be controlled by a stateful smart contract, in AVM 1.0 (currently in BetaNet only - not in TestNet/MainNet), you can do it using inner transactions. But this is most likely not useful at all in your case.

2 Likes