Skip to content

Commit

Permalink
Remove sway_types::{JsonABI, Function, Property} in favour of `fuel…
Browse files Browse the repository at this point in the history
…s_types` (FuelLabs#1337)

See FuelLabs/fuels-rs#219 for context.
  • Loading branch information
mitchmindtree authored May 7, 2022
1 parent d1db317 commit 460d7af
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 36 deletions.
33 changes: 32 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion forc-pkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ description = "Building, locking, fetching and updating Sway projects as Forc pa
[dependencies]
anyhow = "1"
forc-util = { version = "0.12.1", path = "../forc-util" }
fuels-types = "0.10"
git2 = "0.14"
petgraph = { version = "0.6", features = ["serde-1"] }
semver = { version = "1.0", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_ignored = "0.1"
sway-core = { version = "0.12.1", path = "../sway-core" }
sway-types = { version = "0.12.1", path = "../sway-types" }
sway-utils = { version = "0.12.1", path = "../sway-utils" }
toml = "0.5"
url = { version = "2.2", features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use forc_util::{
find_file_name, git_checkouts_directory, kebab_to_snake_case, print_on_failure,
print_on_success, print_on_success_library, println_yellow_err,
};
use fuels_types::JsonABI;
use petgraph::{self, visit::EdgeRef, Directed, Direction};
use serde::{Deserialize, Serialize};
use std::{
Expand All @@ -19,7 +20,6 @@ use sway_core::{
source_map::SourceMap, BytecodeCompilationResult, CompileAstResult, CompileError, NamespaceRef,
NamespaceWrapper, TreeType, TypedParseTree,
};
use sway_types::JsonABI;
use sway_utils::constants;
use url::Url;

Expand Down
1 change: 1 addition & 0 deletions sway-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ either = "1.6"
fuel-asm = "0.4"
fuel-crypto = "0.4"
fuel-vm = "0.8"
fuels-types = "0.10"
generational-arena = "0.2"
hex = { version = "0.4", optional = true }
itertools = "0.10"
Expand Down
3 changes: 2 additions & 1 deletion sway-core/src/parse_tree/declaration/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use crate::{
CodeBlock, Rule,
};

use sway_types::{ident::Ident, span::Span, Function, Property};
use fuels_types::{Function, Property};
use sway_types::{ident::Ident, span::Span};

use pest::iterators::Pair;

Expand Down
5 changes: 2 additions & 3 deletions sway-core/src/semantic_analysis/ast_node/declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ use crate::{
error::*, parse_tree::*, semantic_analysis::TypeCheckedStorageReassignment, type_engine::*,
Ident, NamespaceRef, NamespaceWrapper,
};

use sway_types::{Property, Span};

use derivative::Derivative;
use fuels_types::Property;
use std::hash::{Hash, Hasher};
use sway_types::Span;

mod function;
mod storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ use crate::{
type_engine::*,
Ident, TypeParameter,
};

use sway_types::{Function, Property, Span};

use fuels_types::{Function, Property};
use sha2::{Digest, Sha256};
use sway_types::Span;

mod function_parameter;
pub use function_parameter::*;
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/type_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ mod integer_bits;
mod type_info;
mod unresolved_type_check;
pub use engine::*;
use fuels_types::Property;
pub use integer_bits::*;
use sway_types::Property;
pub use type_info::*;
pub(crate) use unresolved_type_check::UnresolvedTypeCheck;

Expand Down
25 changes: 0 additions & 25 deletions sway-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,28 +339,3 @@ impl Context {
}
}
}

/// Fuel/Sway ABI representation in JSON, originally
/// specified here: `<https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md>`
/// This type is used by the compiler and the tooling around it convert
/// an ABI representation into native Rust structs and vice-versa.
pub type JsonABI = Vec<Function>;

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Function {
#[serde(rename = "type")]
pub type_field: String,
pub inputs: Vec<Property>,
pub name: String,
pub outputs: Vec<Property>,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Property {
pub name: String,
#[serde(rename = "type")]
pub type_field: String,
pub components: Option<Vec<Property>>, // Used for custom types
}

0 comments on commit 460d7af

Please sign in to comment.