Prechádzať zdrojové kódy

refactor: re-exporting anchor-lang (#114)

Danilo Guanabara 10 mesiacov pred
rodič
commit
9a22d5cf2f

+ 0 - 5
Cargo.lock

@@ -3490,7 +3490,6 @@ dependencies = [
 name = "position"
 name = "position"
 version = "0.1.11"
 version = "0.1.11"
 dependencies = [
 dependencies = [
- "anchor-lang",
  "bolt-lang 0.1.11",
  "bolt-lang 0.1.11",
 ]
 ]
 
 
@@ -5628,7 +5627,6 @@ dependencies = [
 name = "system-apply-velocity"
 name = "system-apply-velocity"
 version = "0.1.11"
 version = "0.1.11"
 dependencies = [
 dependencies = [
- "anchor-lang",
  "anchor-spl",
  "anchor-spl",
  "bolt-lang 0.1.11",
  "bolt-lang 0.1.11",
  "position",
  "position",
@@ -5660,7 +5658,6 @@ dependencies = [
 name = "system-fly"
 name = "system-fly"
 version = "0.1.11"
 version = "0.1.11"
 dependencies = [
 dependencies = [
- "anchor-lang",
  "bolt-lang 0.1.11",
  "bolt-lang 0.1.11",
  "position",
  "position",
 ]
 ]
@@ -5669,7 +5666,6 @@ dependencies = [
 name = "system-simple-movement"
 name = "system-simple-movement"
 version = "0.1.11"
 version = "0.1.11"
 dependencies = [
 dependencies = [
- "anchor-lang",
  "bolt-lang 0.1.11",
  "bolt-lang 0.1.11",
  "bolt-types",
  "bolt-types",
  "serde",
  "serde",
@@ -6198,7 +6194,6 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
 name = "velocity"
 name = "velocity"
 version = "0.1.11"
 version = "0.1.11"
 dependencies = [
 dependencies = [
- "anchor-lang",
  "bolt-lang 0.1.11",
  "bolt-lang 0.1.11",
 ]
 ]
 
 

+ 2 - 2
crates/bolt-cli/src/templates/program/constants.rs.template

@@ -1,4 +1,4 @@
-use anchor_lang::prelude::*;
+use bolt_lang::prelude::*;
 
 
 #[constant]
 #[constant]
-pub const SEED: &str = "anchor";
+pub const SEED: &str = "bolt";

+ 1 - 1
crates/bolt-cli/src/templates/program/error.rs.template

@@ -1,4 +1,4 @@
-use anchor_lang::prelude::*;
+use bolt_lang::prelude::*;
 
 
 #[error_code]
 #[error_code]
 pub enum ErrorCode {
 pub enum ErrorCode {

+ 1 - 1
crates/bolt-cli/src/templates/program/instructions/initialize.rs.template

@@ -1,4 +1,4 @@
-use anchor_lang::prelude::*;
+use bolt_lang::prelude::*;
 
 
 #[derive(Accounts)]
 #[derive(Accounts)]
 pub struct Initialize {}
 pub struct Initialize {}

+ 1 - 1
crates/bolt-cli/src/templates/program/multiple.lib.rs.template

@@ -3,7 +3,7 @@ pub mod error;
 pub mod instructions;
 pub mod instructions;
 pub mod state;
 pub mod state;
 
 
-use anchor_lang::prelude::*;
+use bolt_lang::prelude::*;
 
 
 pub use constants::*;
 pub use constants::*;
 pub use instructions::*;
 pub use instructions::*;

+ 1 - 1
crates/bolt-cli/src/templates/program/single.lib.rs.template

@@ -1,4 +1,4 @@
-use anchor_lang::prelude::*;
+use bolt_lang::prelude::*;
 
 
 declare_id!("{program_id}");
 declare_id!("{program_id}");
 
 

+ 3 - 4
crates/bolt-cli/src/templates/workspace/Cargo.serde.toml.template

@@ -14,13 +14,12 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 
 
 [dependencies]
 [dependencies]
 bolt-lang.workspace = true
 bolt-lang.workspace = true
-anchor-lang.workspace = true
-serde = {{ version = "1.0", features = ["derive"] }}
+serde = {{ version = "1.0", features = ["derive"] }}

+ 2 - 3
crates/bolt-cli/src/templates/workspace/Cargo.toml.template

@@ -14,11 +14,10 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 [dependencies]
 [dependencies]
 bolt-lang.workspace = true
 bolt-lang.workspace = true
-anchor-lang.workspace = true

+ 1 - 6
crates/bolt-cli/src/templates/workspace/mod.rs

@@ -1,13 +1,8 @@
 use crate::VERSION;
 use crate::VERSION;
 use heck::ToSnakeCase;
 use heck::ToSnakeCase;
-pub const ANCHOR_VERSION: &str = anchor_cli::VERSION;
 
 
 pub fn workspace_manifest() -> String {
 pub fn workspace_manifest() -> String {
-    format!(
-        include_str!("workspace.toml.template"),
-        VERSION = VERSION,
-        ANCHOR_VERSION = ANCHOR_VERSION
-    )
+    format!(include_str!("workspace.toml.template"), VERSION = VERSION)
 }
 }
 
 
 pub fn package_json(jest: bool) -> String {
 pub fn package_json(jest: bool) -> String {

+ 0 - 1
crates/bolt-cli/src/templates/workspace/workspace.toml.template

@@ -8,7 +8,6 @@ resolver = "2"
 
 
 [workspace.dependencies]
 [workspace.dependencies]
 bolt-lang = "{VERSION}"
 bolt-lang = "{VERSION}"
-anchor-lang = "{ANCHOR_VERSION}"
 
 
 [profile.release]
 [profile.release]
 overflow-checks = true
 overflow-checks = true

+ 4 - 0
crates/bolt-lang/Cargo.toml

@@ -8,6 +8,10 @@ homepage = { workspace = true }
 license = { workspace = true }
 license = { workspace = true }
 edition = { workspace = true }
 edition = { workspace = true }
 
 
+[features]
+anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["anchor-lang/idl-build"]
+
 [dependencies]
 [dependencies]
 anchor-lang = { workspace = true }
 anchor-lang = { workspace = true }
 
 

+ 3 - 0
crates/bolt-lang/src/lib.rs

@@ -1,3 +1,6 @@
+pub mod prelude;
+
+pub use anchor_lang;
 pub use anchor_lang::error::ErrorCode::AccountDidNotDeserialize as AccountDidNotDeserializeErrorCode;
 pub use anchor_lang::error::ErrorCode::AccountDidNotDeserialize as AccountDidNotDeserializeErrorCode;
 pub use anchor_lang::prelude::*;
 pub use anchor_lang::prelude::*;
 pub use anchor_lang::{
 pub use anchor_lang::{

+ 2 - 0
crates/bolt-lang/src/prelude.rs

@@ -0,0 +1,2 @@
+pub use anchor_lang;
+pub use anchor_lang::prelude::*;

+ 2 - 3
examples/component-position/Cargo.toml

@@ -18,11 +18,10 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"] 
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 [dependencies]
 [dependencies]
-anchor-lang = { workspace = true }
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-lang = { path = "../../crates/bolt-lang" }

+ 2 - 3
examples/component-velocity/Cargo.toml

@@ -18,12 +18,11 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 [dependencies]
 [dependencies]
-anchor-lang = { workspace = true }
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-lang = { path = "../../crates/bolt-lang" }
 
 

+ 2 - 3
examples/system-apply-velocity/Cargo.toml

@@ -18,13 +18,12 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 [dependencies]
 [dependencies]
-anchor-lang = { workspace = true }
 anchor-spl = { workspace = true, features = ["metadata"]}
 anchor-spl = { workspace = true, features = ["metadata"]}
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-lang = { path = "../../crates/bolt-lang" }
 velocity = { path = "../component-velocity", features = ["cpi"]}
 velocity = { path = "../component-velocity", features = ["cpi"]}

+ 2 - 3
examples/system-fly/Cargo.toml

@@ -18,13 +18,12 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 [dependencies]
 [dependencies]
-anchor-lang = { workspace = true }
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-lang = { path = "../../crates/bolt-lang" }
 position = { path = "../component-position", features = ["cpi"]}
 position = { path = "../component-position", features = ["cpi"]}
 
 

+ 2 - 3
examples/system-simple-movement/Cargo.toml

@@ -18,13 +18,12 @@ no-idl = []
 no-log-ix-name = []
 no-log-ix-name = []
 cpi = ["no-entrypoint"]
 cpi = ["no-entrypoint"]
 default = []
 default = []
-idl-build = ["anchor-lang/idl-build"]
-anchor-debug = ["anchor-lang/anchor-debug"]
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-heap = []
 custom-panic = []
 custom-panic = []
 
 
 [dependencies]
 [dependencies]
-anchor-lang = { workspace = true }
 serde = { workspace = true }
 serde = { workspace = true }
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-types = { version = "0.1.6", path = "../../crates/types" }
 bolt-types = { version = "0.1.6", path = "../../crates/types" }