Jelajahi Sumber

idl: Rename crate name to `anchor-lang-idl` (#2908)

acheron 1 tahun lalu
induk
melakukan
f74ea64ca6

+ 14 - 14
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"

+ 1 - 1
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"

+ 1 - 1
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;

+ 3 - 3
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,

+ 1 - 1
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};

+ 1 - 1
idl/Cargo.toml

@@ -1,5 +1,5 @@
 [package]
-name = "anchor-idl"
+name = "anchor-lang-idl"
 version = "0.1.0"
 authors = ["Anchor Maintainers <accounts@200ms.io>"]
 repository = "https://github.com/coral-xyz/anchor"

+ 3 - 3
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"

+ 1 - 1
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"

+ 1 - 1
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,
 };

+ 1 - 1
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};

+ 1 - 1
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};

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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};
 

+ 1 - 1
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};

+ 1 - 1
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,

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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, *};