Skip to content

Commit

Permalink
refactor: re-exporting anchor-lang (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
notdanilo authored Dec 6, 2024
1 parent 2420d0e commit 9a22d5c
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 40 deletions.
5 changes: 0 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/bolt-cli/src/templates/program/constants.rs.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anchor_lang::prelude::*;
use bolt_lang::prelude::*;

#[constant]
pub const SEED: &str = "anchor";
pub const SEED: &str = "bolt";
2 changes: 1 addition & 1 deletion crates/bolt-cli/src/templates/program/error.rs.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anchor_lang::prelude::*;
use bolt_lang::prelude::*;

#[error_code]
pub enum ErrorCode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anchor_lang::prelude::*;
use bolt_lang::prelude::*;

#[derive(Accounts)]
pub struct Initialize {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod error;
pub mod instructions;
pub mod state;

use anchor_lang::prelude::*;
use bolt_lang::prelude::*;

pub use constants::*;
pub use instructions::*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anchor_lang::prelude::*;
use bolt_lang::prelude::*;

declare_id!("{program_id}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []


[dependencies]
bolt-lang.workspace = true
anchor-lang.workspace = true
serde = {{ version = "1.0", features = ["derive"] }}
serde = {{ version = "1.0", features = ["derive"] }}
5 changes: 2 additions & 3 deletions crates/bolt-cli/src/templates/workspace/Cargo.toml.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []

[dependencies]
bolt-lang.workspace = true
anchor-lang.workspace = true
7 changes: 1 addition & 6 deletions crates/bolt-cli/src/templates/workspace/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use crate::VERSION;
use heck::ToSnakeCase;
pub const ANCHOR_VERSION: &str = anchor_cli::VERSION;

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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ resolver = "2"

[workspace.dependencies]
bolt-lang = "{VERSION}"
anchor-lang = "{ANCHOR_VERSION}"

[profile.release]
overflow-checks = true
Expand Down
4 changes: 4 additions & 0 deletions crates/bolt-lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[features]
anchor-debug = ["anchor-lang/anchor-debug"]
idl-build = ["anchor-lang/idl-build"]

[dependencies]
anchor-lang = { workspace = true }

Expand Down
3 changes: 3 additions & 0 deletions crates/bolt-lang/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub mod prelude;

pub use anchor_lang;
pub use anchor_lang::error::ErrorCode::AccountDidNotDeserialize as AccountDidNotDeserializeErrorCode;
pub use anchor_lang::prelude::*;
pub use anchor_lang::{
Expand Down
2 changes: 2 additions & 0 deletions crates/bolt-lang/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub use anchor_lang;
pub use anchor_lang::prelude::*;
5 changes: 2 additions & 3 deletions examples/component-position/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []

[dependencies]
anchor-lang = { workspace = true }
bolt-lang = { path = "../../crates/bolt-lang" }
5 changes: 2 additions & 3 deletions examples/component-velocity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []

[dependencies]
anchor-lang = { workspace = true }
bolt-lang = { path = "../../crates/bolt-lang" }

5 changes: 2 additions & 3 deletions examples/system-apply-velocity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []

[dependencies]
anchor-lang = { workspace = true }
anchor-spl = { workspace = true, features = ["metadata"]}
bolt-lang = { path = "../../crates/bolt-lang" }
velocity = { path = "../component-velocity", features = ["cpi"]}
Expand Down
5 changes: 2 additions & 3 deletions examples/system-fly/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []

[dependencies]
anchor-lang = { workspace = true }
bolt-lang = { path = "../../crates/bolt-lang" }
position = { path = "../component-position", features = ["cpi"]}

Expand Down
5 changes: 2 additions & 3 deletions examples/system-simple-movement/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
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-panic = []

[dependencies]
anchor-lang = { workspace = true }
serde = { workspace = true }
bolt-lang = { path = "../../crates/bolt-lang" }
bolt-types = { version = "0.1.6", path = "../../crates/types" }

0 comments on commit 9a22d5c

Please sign in to comment.