Skip to content

Parse transaction flags into map of names:booleans #1903

@mDuo13

Description

@mDuo13

xrpl.js has setTransactionFlagsToNumber() to convert flags from a map of names to an integer, and parseAccountRootFlags() for going from an AccountRoot object's flags integer to a map of booleans, but there's no helper to parse transaction flags from an integer into a map of booleans.

This is a common point of confusion for new XRPL devs, who don't know for example why, for example, this transaction has "Flags":2148007936 when there is no flag with the value 2148007936. (It's actually the combination of two flags, tfSell and tfFullyCanonicalSig.)

I suggest adding a parseTransactionFlags(transaction) method that returns a map of flag names with booleans, e.g.:

{
  "tfSell": true,
  "tfFullyCanonicalSig": true
}

I'm ambivalent about whether it should include flags with the value false (meaning, ones that are valid for this transaction type but not enabled).

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions