mergeWith method

AccountMeta mergeWith(
  1. AccountMeta other
)

Merges this with other by applying the following rules:

Resulting AccountMeta is writeable if either this or other is writeable signer if either this or other is signer.

The pubKeys must match or it throws a FormatException.

It returns a new AccountMeta object.

Implementation

AccountMeta mergeWith(AccountMeta other) {
  if (pubKey != other.pubKey) {
    throw const FormatException(
      'pubKeys must match, or else it does not make sense to merge',
    );
  }

  return AccountMeta(
    pubKey: pubKey,
    isWriteable: isWriteable || other.isWriteable,
    isSigner: isSigner || other.isSigner,
  );
}