From f74ea64ca69c3c78040bcd992e407eb4f36adcd6 Mon Sep 17 00:00:00 2001 From: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:56:53 +0200 Subject: [PATCH] idl: Rename crate name to `anchor-lang-idl` (#2908) --- Cargo.lock | 28 +++++++++---------- cli/Cargo.toml | 2 +- cli/src/config.rs | 2 +- cli/src/lib.rs | 6 ++-- cli/src/rust_template.rs | 2 +- idl/Cargo.toml | 2 +- lang/Cargo.toml | 6 ++-- lang/attribute/program/Cargo.toml | 2 +- .../program/src/declare_program/common.rs | 2 +- .../program/src/declare_program/mod.rs | 2 +- .../src/declare_program/mods/accounts.rs | 2 +- .../src/declare_program/mods/client.rs | 2 +- .../src/declare_program/mods/constants.rs | 2 +- .../program/src/declare_program/mods/cpi.rs | 2 +- .../src/declare_program/mods/events.rs | 2 +- .../src/declare_program/mods/internal.rs | 2 +- .../program/src/declare_program/mods/types.rs | 2 +- .../program/src/declare_program/mods/utils.rs | 2 +- lang/src/idl.rs | 2 +- 19 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6021c147d6..be944b19a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,7 +170,7 @@ dependencies = [ name = "anchor-attribute-program" version = "0.29.0" dependencies = [ - "anchor-idl", + "anchor-lang-idl", "anchor-syn", "anyhow", "bs58 0.5.0", @@ -186,8 +186,8 @@ name = "anchor-cli" version = "0.29.0" dependencies = [ "anchor-client", - "anchor-idl", "anchor-lang", + "anchor-lang-idl", "anyhow", "base64 0.21.7", "bincode", @@ -263,17 +263,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "anchor-idl" -version = "0.1.0" -dependencies = [ - "anchor-syn", - "anyhow", - "regex", - "serde", - "serde_json", -] - [[package]] name = "anchor-lang" version = "0.29.0" @@ -287,7 +276,7 @@ dependencies = [ "anchor-derive-accounts", "anchor-derive-serde", "anchor-derive-space", - "anchor-idl", + "anchor-lang-idl", "arrayref", "base64 0.21.7", "bincode", @@ -298,6 +287,17 @@ dependencies = [ "thiserror", ] +[[package]] +name = "anchor-lang-idl" +version = "0.1.0" +dependencies = [ + "anchor-syn", + "anyhow", + "regex", + "serde", + "serde_json", +] + [[package]] name = "anchor-spl" version = "0.29.0" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 213adf2ad6..c1ca91c4fd 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -17,7 +17,7 @@ dev = [] [dependencies] anchor-client = { path = "../client", version = "0.29.0" } -anchor-idl = { path = "../idl", features = ["build"], version = "0.1.0" } +anchor-lang-idl = { path = "../idl", features = ["build"], version = "0.1.0" } anchor-lang = { path = "../lang", version = "0.29.0" } anyhow = "1.0.32" base64 = "0.21" diff --git a/cli/src/config.rs b/cli/src/config.rs index 1d8e2fcf1e..767c4c30dc 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -1,6 +1,6 @@ use crate::is_hidden; use anchor_client::Cluster; -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use anyhow::{anyhow, bail, Context, Error, Result}; use clap::{Parser, ValueEnum}; use dirs::home_dir; diff --git a/cli/src/lib.rs b/cli/src/lib.rs index c3a1a72eca..7ccb868c4c 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -6,9 +6,9 @@ use crate::config::{ DEFAULT_LEDGER_PATH, SHUTDOWN_WAIT, STARTUP_WAIT, }; use anchor_client::Cluster; -use anchor_idl::types::{Idl, IdlArrayLen, IdlDefinedFields, IdlType, IdlTypeDefTy}; use anchor_lang::idl::{IdlAccount, IdlInstruction, ERASED_AUTHORITY}; use anchor_lang::{AccountDeserialize, AnchorDeserialize, AnchorSerialize}; +use anchor_lang_idl::types::{Idl, IdlArrayLen, IdlDefinedFields, IdlType, IdlTypeDefTy}; use anyhow::{anyhow, Context, Result}; use checks::{check_anchor_version, check_overflow}; use clap::Parser; @@ -2609,7 +2609,7 @@ fn idl_build( .path } }; - let idl = anchor_idl::build::build_idl( + let idl = anchor_lang_idl::build::build_idl( program_path, cfg.features.resolution, cfg.features.skip_lint || skip_lint, @@ -2655,7 +2655,7 @@ in `{path}`."# )); } - anchor_idl::build::build_idl( + anchor_lang_idl::build::build_idl( std::env::current_dir()?, cfg.features.resolution, cfg.features.skip_lint || skip_lint, diff --git a/cli/src/rust_template.rs b/cli/src/rust_template.rs index 010dc095d2..9e00a1ffe9 100644 --- a/cli/src/rust_template.rs +++ b/cli/src/rust_template.rs @@ -2,7 +2,7 @@ use crate::{ config::ProgramWorkspace, create_files, override_or_create_files, solidity_template, Files, VERSION, }; -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use anyhow::Result; use clap::{Parser, ValueEnum}; use heck::{ToLowerCamelCase, ToPascalCase, ToSnakeCase}; diff --git a/idl/Cargo.toml b/idl/Cargo.toml index c93c3501de..664e5a8cfa 100644 --- a/idl/Cargo.toml +++ b/idl/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "anchor-idl" +name = "anchor-lang-idl" version = "0.1.0" authors = ["Anchor Maintainers "] repository = "https://github.com/coral-xyz/anchor" diff --git a/lang/Cargo.toml b/lang/Cargo.toml index 14d330d16c..c12bb5e2ef 100644 --- a/lang/Cargo.toml +++ b/lang/Cargo.toml @@ -33,7 +33,7 @@ idl-build = [ "anchor-attribute-program/idl-build", "anchor-derive-accounts/idl-build", "anchor-derive-serde/idl-build", - "anchor-idl/build", + "anchor-lang-idl/build", ] init-if-needed = ["anchor-derive-accounts/init-if-needed"] interface-instructions = ["anchor-attribute-program/interface-instructions"] @@ -49,8 +49,8 @@ anchor-derive-accounts = { path = "./derive/accounts", version = "0.29.0" } anchor-derive-serde = { path = "./derive/serde", version = "0.29.0" } anchor-derive-space = { path = "./derive/space", version = "0.29.0" } -# `anchor-idl` should only be included with `idl-build` feature -anchor-idl = { path = "../idl", version = "0.1.0", optional = true } +# `anchor-lang-idl` should only be included with `idl-build` feature +anchor-lang-idl = { path = "../idl", version = "0.1.0", optional = true } arrayref = "0.3" base64 = "0.21" diff --git a/lang/attribute/program/Cargo.toml b/lang/attribute/program/Cargo.toml index 9fa5849b45..7395a10ceb 100644 --- a/lang/attribute/program/Cargo.toml +++ b/lang/attribute/program/Cargo.toml @@ -17,7 +17,7 @@ idl-build = ["anchor-syn/idl-build"] interface-instructions = ["anchor-syn/interface-instructions"] [dependencies] -anchor-idl = { path = "../../../idl", version = "0.1.0" } +anchor-lang-idl = { path = "../../../idl", version = "0.1.0" } anchor-syn = { path = "../../syn", version = "0.29.0" } anyhow = "1" bs58 = "0.5" diff --git a/lang/attribute/program/src/declare_program/common.rs b/lang/attribute/program/src/declare_program/common.rs index c75cef357b..e276a4fe09 100644 --- a/lang/attribute/program/src/declare_program/common.rs +++ b/lang/attribute/program/src/declare_program/common.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::{ +use anchor_lang_idl::types::{ Idl, IdlArrayLen, IdlDefinedFields, IdlField, IdlGenericArg, IdlRepr, IdlSerialization, IdlType, IdlTypeDef, IdlTypeDefGeneric, IdlTypeDefTy, }; diff --git a/lang/attribute/program/src/declare_program/mod.rs b/lang/attribute/program/src/declare_program/mod.rs index a8fdf19d5a..d414c0596e 100644 --- a/lang/attribute/program/src/declare_program/mod.rs +++ b/lang/attribute/program/src/declare_program/mod.rs @@ -1,7 +1,7 @@ mod common; mod mods; -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use anyhow::anyhow; use quote::{quote, ToTokens}; use syn::parse::{Parse, ParseStream}; diff --git a/lang/attribute/program/src/declare_program/mods/accounts.rs b/lang/attribute/program/src/declare_program/mods/accounts.rs index ba9f849820..e55de414ae 100644 --- a/lang/attribute/program/src/declare_program/mods/accounts.rs +++ b/lang/attribute/program/src/declare_program/mods/accounts.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::{Idl, IdlSerialization}; +use anchor_lang_idl::types::{Idl, IdlSerialization}; use quote::{format_ident, quote}; use super::common::{convert_idl_type_def_to_ts, gen_discriminator, get_canonical_program_id}; diff --git a/lang/attribute/program/src/declare_program/mods/client.rs b/lang/attribute/program/src/declare_program/mods/client.rs index 7c9a08ca72..0312750584 100644 --- a/lang/attribute/program/src/declare_program/mods/client.rs +++ b/lang/attribute/program/src/declare_program/mods/client.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use quote::quote; use super::common::gen_accounts_common; diff --git a/lang/attribute/program/src/declare_program/mods/constants.rs b/lang/attribute/program/src/declare_program/mods/constants.rs index cbde4b92dd..4cb6ec0ed3 100644 --- a/lang/attribute/program/src/declare_program/mods/constants.rs +++ b/lang/attribute/program/src/declare_program/mods/constants.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::{Idl, IdlType}; +use anchor_lang_idl::types::{Idl, IdlType}; use quote::{format_ident, quote, ToTokens}; use super::common::convert_idl_type_to_str; diff --git a/lang/attribute/program/src/declare_program/mods/cpi.rs b/lang/attribute/program/src/declare_program/mods/cpi.rs index 180c1b8879..50452fe738 100644 --- a/lang/attribute/program/src/declare_program/mods/cpi.rs +++ b/lang/attribute/program/src/declare_program/mods/cpi.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use heck::CamelCase; use quote::{format_ident, quote}; diff --git a/lang/attribute/program/src/declare_program/mods/events.rs b/lang/attribute/program/src/declare_program/mods/events.rs index f2c4ca4cff..bdd51abfe5 100644 --- a/lang/attribute/program/src/declare_program/mods/events.rs +++ b/lang/attribute/program/src/declare_program/mods/events.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use quote::{format_ident, quote}; use super::common::{convert_idl_type_def_to_ts, gen_discriminator}; diff --git a/lang/attribute/program/src/declare_program/mods/internal.rs b/lang/attribute/program/src/declare_program/mods/internal.rs index 46020c20eb..c47cebc205 100644 --- a/lang/attribute/program/src/declare_program/mods/internal.rs +++ b/lang/attribute/program/src/declare_program/mods/internal.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::{Idl, IdlInstructionAccountItem}; +use anchor_lang_idl::types::{Idl, IdlInstructionAccountItem}; use anchor_syn::{ codegen::accounts::{__client_accounts, __cpi_client_accounts}, parser::accounts, diff --git a/lang/attribute/program/src/declare_program/mods/types.rs b/lang/attribute/program/src/declare_program/mods/types.rs index 441454c87e..85449e75ba 100644 --- a/lang/attribute/program/src/declare_program/mods/types.rs +++ b/lang/attribute/program/src/declare_program/mods/types.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use quote::quote; use super::common::convert_idl_type_def_to_ts; diff --git a/lang/attribute/program/src/declare_program/mods/utils.rs b/lang/attribute/program/src/declare_program/mods/utils.rs index a73502f39e..414fc5c8f4 100644 --- a/lang/attribute/program/src/declare_program/mods/utils.rs +++ b/lang/attribute/program/src/declare_program/mods/utils.rs @@ -1,4 +1,4 @@ -use anchor_idl::types::Idl; +use anchor_lang_idl::types::Idl; use quote::{format_ident, quote}; use super::common::gen_discriminator; diff --git a/lang/src/idl.rs b/lang/src/idl.rs index d653960e18..0f974c546a 100644 --- a/lang/src/idl.rs +++ b/lang/src/idl.rs @@ -80,4 +80,4 @@ impl IdlAccount { } #[cfg(feature = "idl-build")] -pub use anchor_idl::{build::IdlBuild, *}; +pub use anchor_lang_idl::{build::IdlBuild, *};