Checking the Txn.type_enum() during Optin

For safety reasons, I want my PyTeal code to check the Txn.type_enum() for ApplicationOptInTxn's made to my smart contract. In the documentation, I only see the following options:

  • TxnType.Unknown
  • TxnType.Payment
  • TxnType.KeyRegistration
  • TxnType.AssetConfig
  • TxnType.AssetTransfer
  • TxnType.AssetFreeze
  • TxnType.ApplicationCall

There is no TxnType option to check for OptIn, CloseOut, Delete, nor UpdateTransactions. Are these assumed to be ApplicationCalls?
(so I should check that Txn.type_enum() == TxnType.ApplicationCall)?

You need to use the onCompletion field, to get the application subtype.

Txn.on_completion() == OnComplete.OptIn