AccountSet Transaction: SetFlag, ClearFlag
AccountSet Transaction: SetFlag, ClearFlag

AccountSet Transaction: SetFlag, ClearFlag

AccountSet Transaction: SetFlag, ClearFlag

Intro

Configuring different behaviour for an account by setting and clearing different flags.

Video

Topics covered

  • Setting and clearing asfRequireDest flag.
  • Setting and clearing other flags.
  • Fetching flag names using the value present in the flag field of an account.

References

Update:

flagNames package is update and there is slight change in the syntax.

flagNames(account_data.LedgerEntryType, account_data.Flags)

It takes 2 parameters. First parameter is LedgerEntryType and the second parameter is the actual flag value.

Stop using flagNames package

You could stop using flagNames package, as the flag information are now natively output from public methods. When the videos were created these information was only available by decoding the Flags value. ( But if you, for whatever reason, want to fetch flag information from the Flags field, you know you can use flagNames package. )

const data = await client.send({
    command: "account_info",
    account: "rHdkzpxr3VfabJh9tUEDv7N4DJEsA4UioT",
});

console.log(data);

Output:

{
  account_data: {
    Account: 'rHdkzpxr3VfabJh9tUEDv7N4DJEsA4UioT',
    Balance: '1990365784',
    Domain: '68747470733A2F2F7477697466657665722E636F6D',
    EmailHash: 'CD86ADAF0C695F745491B176E921F82E',
    Flags: 655360,
    LedgerEntryType: 'AccountRoot',
    OwnerCount: 2,
    PreviousTxnID: 'EEE4AF276F5DC52F5A6473B7407546A5B908A95C4E7F4BEFAE87F2C6CF7C9360',
    PreviousTxnLgrSeq: 39677303,
    Sequence: 7347274,
    index: '0BD6535749C70A8CCD226D780B5342ACE30A52B40D50263A3A37A6F3E9F04B55',
    urlgravatar: 'http://www.gravatar.com/avatar/cd86adaf0c695f745491b176e921f82e'
  },
  account_flags: {
    defaultRipple: false,
    depositAuth: false,
    disableMasterKey: false,
    disallowIncomingCheck: false,
    disallowIncomingNFTokenOffer: false,
    disallowIncomingPayChan: false,
    disallowIncomingTrustline: false,
    disallowIncomingXRP: true,
    globalFreeze: false,
    noFreeze: false,
    passwordSpent: false,
    requireAuthorization: false,
    requireDestinationTag: true
  },
  ledger_current_index: 40558110,
  validated: false
}
💡
Final tip: Make sure that you clearly know what the flag does before setting it on your account.
💠
https://xrpl-labs.com

Footer Social Icons

© XRPL Labs - https://xrpl-labs.com