Atomic Transfer¶
Atomic Transfer are irreducible batch transactions
that allow groups of transactions to be submitted at one time.
If any of the transactions fail, then all the transactions will fail.
PyTeal uses Gtxn
operator to access transactions in an atomic transfer.
For example:
Gtxn.sender(1)
gets the sender of the second (Atomic Transfers are 0 indexed) transaction in the atomic transaction group.
List of Gtxn
operators:
Operator | Type | Notes |
---|---|---|
Gtxn.sender(n) |
TealType.bytes |
32 byte address |
Gtxn.fee(n) |
TealType.uint64 |
in microAlgos |
Gtxn.first_valid(n) |
TealType.uint64 |
round number |
Gtxn.first_valid_time(n) |
TealType.uint64 |
causes program to fail, reserved for future use |
Gtxn.last_valid(n) |
TealType.uint64 |
round number |
Gtxn.note(n) |
TealType.bytes |
|
Gtxn.lease(n) |
TealType.bytes |
|
Gtxn.receiver(n) |
TealType.bytes |
32 byte address |
Gtxn.amount(n) |
TealType.uint64 |
in microAlgos |
Gtxn.close_remainder_to(n) |
TealType.bytes |
32 byte address |
Gtxn.vote_pk(n) |
TealType.bytes |
32 byte address |
Gtxn.selection_pk(n) |
TealType.bytes |
32 byte address |
Gtxn.vote_first(n) |
TealType.uint64 |
|
Gtxn.vote_last(n) |
TealType.uint64 |
|
Gtxn.vote_key_dilution(n) |
TealType.uint64 |
|
Gtxn.type(n) |
TealType.bytes |
|
Gtxn.type_enum(n) |
TealType.uint64 |
see table below |
Gtxn.xfer_asset(n) |
TealType.uint64 |
asset ID |
Gtxn.asset_amount(n) |
TealType.uint64 |
value in Asset’s units |
Gtxn.asset_sender(n) |
TealType.bytes |
32 byte address, causes clawback of all value if sender is the Clawback |
Gtxn.asset_receiver(n) |
TealType.bytes |
32 byte address |
Gtxn.asset_close_to(n) |
TealType.bytes |
32 byte address |
Gtxn.group_index(n) |
TealType.uint64 |
position of this transaction within a transaction group |
Gtxn.tx_id(n) |
TealType.bytes |
the computed ID for this transaction, 32 bytes |
where n >= 0 && n < 16
.