From 261ea69973e00019120752acbfcdf30e5e9f7725 Mon Sep 17 00:00:00 2001 From: amilz <85324096+amilz@users.noreply.github.com> Date: Thu, 22 Jan 2026 19:48:51 -0800 Subject: [PATCH] fix: treat Address as public key type ## Summary - Map solana-address/pinocchio `Address` to `PublicKeyTypeNode`. ## Why - Codama only recognizes `Pubkey`, so `Address` was emitted as a defined type link, breaking TS client generation (`getAddressEncoder` missing). --- .../src/identify_field_types_visitor.rs | 3 +++ .../public_key_type_node.rs | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/codama-korok-visitors/src/identify_field_types_visitor.rs b/codama-korok-visitors/src/identify_field_types_visitor.rs index ceded95..7d635bf 100644 --- a/codama-korok-visitors/src/identify_field_types_visitor.rs +++ b/codama-korok-visitors/src/identify_field_types_visitor.rs @@ -61,6 +61,9 @@ pub fn get_type_node(ty: &syn::Type) -> Option { ("" | "solana_sdk::pubkey" | "solana_program" | "solana_pubkey", "Pubkey", []) => { Some(PublicKeyTypeNode::new().into()) } + ("" | "solana_address" | "solana_address::address", "Address", []) => { + Some(PublicKeyTypeNode::new().into()) + } ("" | "std::string", "String", []) => Some( SizePrefixTypeNode::new(StringTypeNode::utf8(), NumberTypeNode::le(U32)).into(), ), diff --git a/codama-korok-visitors/tests/identify_field_types_visitor/public_key_type_node.rs b/codama-korok-visitors/tests/identify_field_types_visitor/public_key_type_node.rs index 5b62928..011f4b6 100644 --- a/codama-korok-visitors/tests/identify_field_types_visitor/public_key_type_node.rs +++ b/codama-korok-visitors/tests/identify_field_types_visitor/public_key_type_node.rs @@ -21,4 +21,17 @@ fn it_identifies_pubkey_types() { Some(PublicKeyTypeNode::new().into()) ); assert_eq!(get_node_from_type(quote! { Pubkey }), None); + assert_eq!( + get_node_from_type(quote! { Address }), + Some(PublicKeyTypeNode::new().into()) + ); + assert_eq!( + get_node_from_type(quote! { solana_address::Address }), + Some(PublicKeyTypeNode::new().into()) + ); + assert_eq!( + get_node_from_type(quote! { solana_address::address::Address }), + Some(PublicKeyTypeNode::new().into()) + ); + assert_eq!(get_node_from_type(quote! { Address }), None); }