Class: Solana::Ruby::Kit::Accounts::MaybeAccount

Inherits:
T::Struct
  • Object
show all
Defined in:
lib/solana/ruby/kit/accounts/maybe_account.rb

Overview

Represents an account that may or may not exist on-chain. Mirrors TypeScript’s discriminated union:

MaybeAccount<TData, TAddress> = <TData, TAddress> & { exists: true }
                              | { address: Address<TAddress>; exists: false }

In Ruby we use a single class with an exists flag rather than a union type, since Sorbet cannot narrow struct unions at runtime as easily.