Skip to content

Shank-cli generates invalid IDL for pinocchio::Address field #80

@the-ho-mang

Description

@the-ho-mang

When using pinocchio::Address in an account struct derived with ShankAccount, the generated IDL contains an unresolved custom type "Address" instead of a standard Solana-compatible type (e.g. publicKey).

Rust code

use borsh::{BorshDeserialize, BorshSerialize};
use pinocchio::Address;
use shank::ShankAccount;

#[derive(BorshDeserialize, BorshSerialize, ShankAccount)]
pub struct CounterAuthority {
    pub authority: Address,
    pub bump: u8,
    pub count: u64,
}

Generated IDL (via shank-cli)

{
  "name": "CounterAuthority",
  "type": {
    "kind": "struct",
    "fields": [
      {
        "name": "authority",
        "type": {
          "defined": "Address"
        }
      },
      {
        "name": "bump",
        "type": "u8"
      },
      {
        "name": "count",
        "type": "u64"
      }
    ]
  }
}

Then I use Codama to generate client which can not resolve this type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions