Skip to main content
added 71 characters in body
Source Link

The documentationAnchor account types documentation says:

  • Interface: Type validating that the account is one of a set of given Programs

Interface: Type validating that the account is one of a set of given Programs

This just means that the given account is one of a set. For example, if your program can use either SPL Token or SPL Token 2022, then your program can specify an "interface", so that anchor checks if the program id is one of those.

  • InterfaceAccount: Account container that checks ownership on deserialization

InterfaceAccount: Account container that checks ownership on deserialization

This is the account version of "interface". Anchor will check that the account is owned by one of the programs specified in the interface. In the token example, it'll check that the account is owned by SPL Token or SPL Token 2022, and return an error if it's owned by some other program.

The documentation says:

  • Interface: Type validating that the account is one of a set of given Programs

This just means that the given account is one of a set. For example, if your program can use either SPL Token or SPL Token 2022, then your program can specify an "interface", so that anchor checks if the program id is one of those.

  • InterfaceAccount: Account container that checks ownership on deserialization

This is the account version of "interface". Anchor will check that the account is owned by one of the programs specified in the interface. In the token example, it'll check that the account is owned by SPL Token or SPL Token 2022, and return an error if it's owned by some other program.

The Anchor account types documentation says:

Interface: Type validating that the account is one of a set of given Programs

This just means that the given account is one of a set. For example, if your program can use either SPL Token or SPL Token 2022, then your program can specify an "interface", so that anchor checks if the program id is one of those.

InterfaceAccount: Account container that checks ownership on deserialization

This is the account version of "interface". Anchor will check that the account is owned by one of the programs specified in the interface. In the token example, it'll check that the account is owned by SPL Token or SPL Token 2022, and return an error if it's owned by some other program.

Source Link
Jon C
  • 19.6k
  • 7
  • 23

The documentation says:

  • Interface: Type validating that the account is one of a set of given Programs

This just means that the given account is one of a set. For example, if your program can use either SPL Token or SPL Token 2022, then your program can specify an "interface", so that anchor checks if the program id is one of those.

  • InterfaceAccount: Account container that checks ownership on deserialization

This is the account version of "interface". Anchor will check that the account is owned by one of the programs specified in the interface. In the token example, it'll check that the account is owned by SPL Token or SPL Token 2022, and return an error if it's owned by some other program.