Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider support Rust type aliases for single arguments #24

Open
samuelvanderwaal opened this issue Jun 15, 2022 · 0 comments
Open

Consider support Rust type aliases for single arguments #24

samuelvanderwaal opened this issue Jun 15, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request priority: med

Comments

@samuelvanderwaal
Copy link

samuelvanderwaal commented Jun 15, 2022

For instructions with single arguments we should discuss/consider supporting Rust type aliases so something like this:

pub struct SetCollectionSizeArgs {
    pub size: u64
}

#[account(0, writable, name="collection_metadata", desc="Collection Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")]
#[account(2, name="collection_mint", desc="Mint of the Collection")]
SetCollectionSize(SetCollectionSizeArgs),

could be

type Size = u64;

#[account(0, writable, name="collection_metadata", desc="Collection Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")]
#[account(2, name="collection_mint", desc="Mint of the Collection")]
SetCollectionSize(Size),

Alternately, accept a primitive Rust type directly and generate a common-sense name, e.g. SetCollectionSizeArg:

#[account(0, writable, name="collection_metadata", desc="Collection Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")]
#[account(2, name="collection_mint", desc="Mint of the Collection")]
SetCollectionSize(u64),

Getting this down to track the issue and I will try to add more details later.

@thlorenz thlorenz added enhancement New feature or request priority: med labels Sep 19, 2022
@thlorenz thlorenz self-assigned this Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: med
Projects
None yet
Development

No branches or pull requests

2 participants