Skip to main content
2 of 2
edited title
Burger Bob
  • 1.5k
  • 4
  • 19

How do you deal with a changing account state?

Let us suppose that you want to update an account state to include a new field.

pub struct MyState {
  pub a: u8,
  pub new_field: u8
}

This means that fetching and decoding the old accounts prior to the update would no longer work the way it did before. I.e. using program.accounts.MyState.all().

So, I was wondering, how do you go about fetching and decoding both old and new accounts?

Burger Bob
  • 1.5k
  • 4
  • 19