xrpl-dev-portal icon indicating copy to clipboard operation
xrpl-dev-portal copied to clipboard

AMM Payment Flag

Open oeggert opened this issue 1 year ago • 0 comments

It's not obvious how to identify if a Payment transaction swapped with an AMM pool.

To check this, you have to look at the tx metadata and search for the AMM trustline flag to determine that a transaction interacted with it.

Following is partial metadata for a payment via AMM:

{'ModifiedNode': {'FinalFields': {'Balance': {'currency': 'USD',
                                                                                     'issuer': 'rrrrrrrrrrrrrrrrrrrrBZbvji',
                                                                                     'value': '-10010.01001001001'},
                                                                         'Flags': 16908288,
                                                                         'HighLimit': {'currency': 'USD',
                                                                                       'issuer': 'ammXRP-USD',
                                                                                       'value': '0'},
                                                                         'HighNode': '0',
                                                                         'LowLimit': {'currency': 'USD',
                                                                                      'issuer': 'gw',
                                                                                      'value': '0'},
                                                                         'LowNode': '0'},
                                                         'LedgerEntryType': 'RippleState',
                                                         'LedgerIndex': '7A699DC38D20550C7F2C3359D8AE85886AEDD8217A77A04DCB682D3EF927D60B',
                                                         'PreviousFields': {'Balance': {'currency': 'USD',
                                                                                        'issuer': 'rrrrrrrrrrrrrrrrrrrrBZbvji',
                                                                                        'value': '-10000'}},
                                                         'PreviousTxnID': '8262AD81183C3938E362379123BA28E56AB58810229987498BE24D4323445C19',
                                                         'PreviousTxnLgrSeq': 40}}]

Note Flags = 16908288. AMM trustline has a flag 131072. 16908288 & 131072 = 131072 ; i.e. this is AMM's trustline.

oeggert avatar Feb 23 '24 22:02 oeggert