Companion macro for programs using nitrate entrypoint. It creates structs to provide an easy way to access instruction accounts, while being more efficient than using solana_program::account_info::next_account_info iterator.
Getting started
The macro is part of nitrate crate:
[!IMPORTANT] You need to use the custom
entrypoint!defined on the crate in order to use theAccountsderive macro.
Example
Annotate your instruction enum with Accounts derive:
This will create a module accounts with a struct for each variant (instruction) of the enum:
use AccountInfo;
In your instruction processor, a Context can then be created to access the accounts of an instruction:
let ctx = context?;
msg!;
License
Copyright (c) 2024 nifty-oss maintainers
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.