compareTo method

  1. @override
int compareTo(
  1. AccountMeta other
)
override

Compare accounts according to the following rules.

Signer accounts go first, and within them writeable accounts go first.

Non-Signer accounts go after, and within them the writeable accounts go first.

Implementation

@override
int compareTo(AccountMeta other) {
  if (isSigner && !other.isSigner) return -1;
  if (!isSigner && other.isSigner) return 1;

  if (isWriteable && !other.isWriteable) return -1;
  if (!isWriteable && other.isWriteable) return 1;

  return 0;
}