Skip to content

Consider support Rust type aliases for single arguments #24

@samuelvanderwaal

Description

@samuelvanderwaal

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions