client.rs 740 B

1234567891011121314151617181920212223242526272829303132
  1. use anchor_syn::idl::types::Idl;
  2. use quote::quote;
  3. use super::common::gen_accounts_common;
  4. pub fn gen_client_mod(idl: &Idl) -> proc_macro2::TokenStream {
  5. let client_args_mod = gen_client_args_mod();
  6. let client_accounts_mod = gen_client_accounts_mod(idl);
  7. quote! {
  8. /// Off-chain client helpers.
  9. pub mod client {
  10. use super::*;
  11. #client_args_mod
  12. #client_accounts_mod
  13. }
  14. }
  15. }
  16. fn gen_client_args_mod() -> proc_macro2::TokenStream {
  17. quote! {
  18. /// Client args.
  19. pub mod args {
  20. pub use super::internal::args::*;
  21. }
  22. }
  23. }
  24. fn gen_client_accounts_mod(idl: &Idl) -> proc_macro2::TokenStream {
  25. gen_accounts_common(idl, "client")
  26. }