Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete feature std-fs-io in casper-client feat-2.0 #153

Open
wants to merge 134 commits into
base: feat-track-node-2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
1d5778d
Removing wrap_help + sdk feat
gRoussac Jul 25, 2023
ba71bd9
Removing multi-thread
gRoussac Jul 25, 2023
0077f2a
schemars bug
gRoussac Jul 25, 2023
5c4db67
update
gRoussac Jul 26, 2023
475e1e9
move node to ecosystem from Fraser branch
gRoussac Jul 26, 2023
271e2f8
Update cargo
gRoussac Jul 26, 2023
bdb7107
Expose cli to sdk
gRoussac Aug 1, 2023
32b7599
Try to load pem key from string
gRoussac Aug 2, 2023
df7ac7d
Return deploys for make_transfer make_deploy
gRoussac Aug 3, 2023
0b89f95
Expose simple_args::insert_arg
gRoussac Aug 15, 2023
dc84933
Merge branch 'feat-track-node-2.0' into rustSDK
gRoussac Aug 15, 2023
7a66891
little change
gRoussac Aug 15, 2023
287bdaf
Missing flag
gRoussac Aug 15, 2023
0d71d92
Remove flag
gRoussac Aug 15, 2023
5c1999b
small change
gRoussac Aug 15, 2023
6b06a8d
Expose json args
gRoussac Aug 15, 2023
6552d8d
Add doc
gRoussac Aug 16, 2023
d9742ad
Unreachable on simple args + json args
gRoussac Aug 16, 2023
8c3adb4
Add check_exactly_one_args_type_not_empty to parse.rs
gRoussac Aug 16, 2023
b298a36
no args is valid !
gRoussac Aug 16, 2023
4b21d82
changing name
gRoussac Aug 16, 2023
e827153
ConflictingArguments to context: String
gRoussac Aug 19, 2023
57d9199
little clone on DictionaryItemIdentifierget
gRoussac Aug 24, 2023
d6d8711
Hacking parse for sdk deploy module bytes
gRoussac Aug 24, 2023
66d7856
Fix import and sdk
gRoussac Aug 27, 2023
5fc8490
parse purse identifier
gRoussac Aug 27, 2023
0db6fbe
session_bytes
gRoussac Sep 1, 2023
ba04f27
Add some clone
gRoussac Sep 3, 2023
76e5a1a
remove call rpc pretty printed to std in sdk
gRoussac Sep 7, 2023
f5e6c7e
Merge branch 'feat-track-node-2.0' of ssh://github.com:/casper-ecosys…
gRoussac Sep 8, 2023
791eb49
Update for account identifier
gRoussac Sep 8, 2023
316a525
update types to feat 2.0
gRoussac Sep 14, 2023
90aefd5
Missing dep ?
gRoussac Sep 16, 2023
35954de
revert
gRoussac Sep 16, 2023
aa0a674
Remove json-schema
gRoussac Sep 19, 2023
e91cb76
getrandom js only for sdk feature
gRoussac Sep 20, 2023
5d4c2ad
getrandom was removed
gRoussac Sep 20, 2023
d2aa514
Cargo doc
gRoussac Sep 20, 2023
834032c
Sort back use in parse.rs
gRoussac Sep 21, 2023
4855e7b
Duplicate get_maybe_secret_key
gRoussac Sep 23, 2023
c02cf9a
Update cli.rs
gRoussac Sep 28, 2023
f5f9c81
Update Cargo.toml
gRoussac Oct 4, 2023
1692fc6
Merge branch 'feat-track-node-2.0' of ssh://github.com:/casper-ecosys…
gRoussac Oct 4, 2023
cd76024
branch update
gRoussac May 3, 2024
2077bed
update types
gRoussac May 3, 2024
504521c
revert
gRoussac May 3, 2024
3dc16f9
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac May 6, 2024
9f92d25
Merge back changes for std-fs-io
gRoussac May 6, 2024
88b5902
build without feature
gRoussac May 6, 2024
37d205b
Update schemars
gRoussac May 6, 2024
9c52ec5
Expose new error and add_arg
gRoussac May 13, 2024
6e35b58
Update cargo-toml
gRoussac May 13, 2024
596374c
Revert
gRoussac May 13, 2024
79095c8
Revert
gRoussac May 13, 2024
0dd20bb
test compilation
gRoussac May 20, 2024
6439f4b
add branch ?
gRoussac May 20, 2024
ff43e5b
test
gRoussac May 20, 2024
fd8b12b
test
gRoussac May 20, 2024
3f4be03
Revert
gRoussac May 20, 2024
343396b
revert
gRoussac May 20, 2024
e6a5f5f
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac May 20, 2024
2d461af
pub entity_identifier
gRoussac May 21, 2024
6b6b04d
pub EntityOrAccount
gRoussac May 21, 2024
71a8815
add methods to GetAddressableEntityResult
gRoussac May 21, 2024
b31e4c6
small change
gRoussac May 21, 2024
7e90431
test
gRoussac May 21, 2024
8970379
test GetAddressableEntityResult
gRoussac May 21, 2024
4d91070
Wrap casper types AddressableEntity in GetAddressableEntityResult
gRoussac May 21, 2024
7c94093
wrap EntityOrAccount methods
gRoussac May 21, 2024
ed87d69
Clone values
gRoussac May 21, 2024
4ba86fa
pub
gRoussac May 21, 2024
c51e1ab
revert
gRoussac May 21, 2024
ee77564
try alias
gRoussac May 21, 2024
d035017
Clone
gRoussac May 21, 2024
b032df8
Clone
gRoussac May 21, 2024
cc075b7
Clone on QueryBalanceDetailsResult
gRoussac May 27, 2024
0fa6a68
Clone
gRoussac May 27, 2024
0aedae1
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac May 27, 2024
44b804f
Add gate to from_file in parse
gRoussac May 27, 2024
762b1e0
clone + typo
gRoussac May 27, 2024
c53562e
Clone
gRoussac May 28, 2024
d9cfe12
Expose transfer_target
gRoussac May 30, 2024
0fea6af
import
gRoussac May 31, 2024
89061c6
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac May 31, 2024
040c175
Typo
gRoussac Jun 1, 2024
53ada4e
clone
gRoussac Jun 1, 2024
ed3609d
pub pricing_mode
gRoussac Jun 2, 2024
8150634
revert
gRoussac Jun 2, 2024
a92293b
Debug
gRoussac Jun 4, 2024
2d737c7
test
gRoussac Jun 4, 2024
e1dfa42
test
gRoussac Jun 4, 2024
6563f17
test
gRoussac Jun 4, 2024
6469095
test
gRoussac Jun 4, 2024
d9c2162
test
gRoussac Jun 4, 2024
40dc374
revert
gRoussac Jun 4, 2024
07d9c44
Revert
gRoussac Jun 4, 2024
0d6a5b3
revert
gRoussac Jun 4, 2024
23f6050
test
gRoussac Jun 4, 2024
3d48e30
test
gRoussac Jun 4, 2024
5962df2
test
gRoussac Jun 4, 2024
125cd91
test
gRoussac Jun 4, 2024
3c6c36b
test
gRoussac Jun 4, 2024
32fee3b
test
gRoussac Jun 4, 2024
011be3c
testing
gRoussac Jun 4, 2024
455d75c
testing
gRoussac Jun 4, 2024
58f463d
test
gRoussac Jun 4, 2024
a05d1ab
test
gRoussac Jun 4, 2024
f23311c
revert timestamp bug
gRoussac Jun 4, 2024
4a1a59b
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Jun 11, 2024
787366d
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Jun 18, 2024
0f67e58
Typo in doc
gRoussac Jun 19, 2024
78cb47e
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Jul 9, 2024
9418f1e
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Jul 10, 2024
b4a8f43
Review fixes
gRoussac Jul 11, 2024
19621d9
Clippy
gRoussac Jul 11, 2024
abb45ff
clippy ?
gRoussac Jul 12, 2024
f90bdc5
clippy
gRoussac Jul 12, 2024
58a3013
Rework code comments
gRoussac Jul 18, 2024
49cf589
syntax avoid if/elseif/else
gRoussac Jul 18, 2024
920d94b
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Jul 18, 2024
7d56a92
Update ci-cd file as per #185
gRoussac Jul 18, 2024
f3a44f8
toolchain
gRoussac Jul 18, 2024
a9d192f
Port #185
gRoussac Jul 18, 2024
6b7c5e4
clippy
gRoussac Jul 18, 2024
fbbc20b
Change test error string
gRoussac Jul 18, 2024
bbacf8d
Tests in std-fs-io
gRoussac Jul 18, 2024
337595a
Cargo doc
gRoussac Jul 18, 2024
237cffc
Expose SpeculativeExecutionResult
gRoussac Jul 18, 2024
a782b37
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Aug 5, 2024
6a53866
test package bug
gRoussac Aug 20, 2024
cf27253
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Aug 28, 2024
ea9059d
test failing
gRoussac Sep 16, 2024
a2c3703
compile
gRoussac Oct 15, 2024
c4d504d
Merge branch 'feat-track-node-2.0' of github.com:casper-ecosystem/cas…
gRoussac Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci-casper-client-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Fmt
uses: actions-rs/cargo@v1
Expand All @@ -45,6 +46,12 @@ jobs:
command: clippy
args: --all-targets

- name: Clippy with no features
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --no-default-features

- name: Doc
uses: actions-rs/cargo@v1
with:
Expand All @@ -55,3 +62,15 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test

- name: Test with no features
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features

- name: Build lib for Wasm with no features
uses: actions-rs/cargo@v1
with:
command: build
args: --lib --target wasm32-unknown-unknown --no-default-features
56 changes: 31 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,64 @@ repository = "https://github.com/casper-ecosystem/casper-client-rs"
license = "Apache-2.0"

[lib]
crate-type = ["cdylib", "rlib"]
jacek-casper marked this conversation as resolved.
Show resolved Hide resolved
name = "casper_client"
path = "lib/lib.rs"

[[bin]]
name = "casper-client"
path = "src/main.rs"
doc = false
required-features = [
"async-trait",
"clap",
"clap_complete",
"tokio",
"std-fs-io",
]

[features]
default = ["async-trait", "clap", "clap_complete", "tokio", "std-fs-io"]
std-fs-io = ["casper-types/std-fs-io"]

[dependencies]
async-trait = { version = "0.1.59", default-features = false, optional = true }
async-trait = { version = "0.1.74", optional = true }
base16 = "0.2.1"
casper-types = { version = "5.0.0", features = ["std"] }
clap = { version = "4", features = [
"cargo",
"deprecated",
"wrap_help",
], optional = true }
clap_complete = { version = "4", default-features = false, optional = true }
clap = { version = "4.4.10", optional = true, features = [
"cargo",
"deprecated",
] }
clap_complete = { version = "4.4.4", optional = true }
hex-buffer-serde = "0.4.0"
humantime = "2"
itertools = "0.11.0"
humantime = "2.1.0"
itertools = "0.12.0"
jsonrpc-lite = "0.6.0"
num-traits = "0.2.15"
once_cell = "1"
once_cell = "1.18.0"
rand = "0.8.5"
reqwest = { version = "0.11.13", features = ["json"] }
schemars = "0.8.13"
serde = { version = "1", default-features = false, features = ["derive"] }
reqwest = { version = "0.12.4", features = ["json"] }
schemars = "0.8.18"
serde = { version = "1.0.193", default-features = false, features = ["derive"] }
serde-map-to-array = "1.1.1"
serde_json = { version = "1", features = ["preserve_order"] }
thiserror = "1.0.34"
tokio = { version = "1.23.0", features = [
"macros",
"net",
"rt-multi-thread",
"sync",
"time",
], optional = true }
uint = "0.9.4"
serde_json = { version = "1.0.108", features = ["preserve_order"] }
thiserror = "1.0.50"
tokio = { version = "1.34.0", optional = true, features = [
"macros",
"rt",
"sync",
"time",
] }
uint = "0.9.5"

[dev-dependencies]
tempfile = "3.7.1"
tempfile = "3.8.1"

[build-dependencies]
vergen = { version = "7", default-features = false, features = ["git"] }

[patch.crates-io]
casper-types = { git = "https://github.com/casper-network/casper-node.git", branch = "feat-2.0" }
casper-types = { version = "5.0.0", git = "https://github.com/casper-network/casper-node", branch = "rustSDK-feat-2.0" }

[package.metadata.deb]
features = ["vendored-openssl"]
Expand Down
53 changes: 37 additions & 16 deletions lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! * `maybe_block_id` - Must be a hex-encoded, 32-byte hash digest or a `u64` representing the
//! [`Block`] height or empty. If empty, the latest `Block` known on the server will be used.

/// Deploy module.
/// Functions for creating Deploys.
pub mod deploy;
mod deploy_str_params;
mod dictionary_item_str_params;
Expand All @@ -36,10 +36,12 @@ mod transaction;
mod transaction_builder_params;
mod transaction_str_params;

#[cfg(feature = "std-fs-io")]
use serde::Serialize;

#[cfg(doc)]
use casper_types::{account::AccountHash, Key};

use casper_types::{Digest, URef};

use crate::{
Expand All @@ -57,26 +59,27 @@ use crate::{
SuccessResponse,
};
#[cfg(doc)]
use crate::{Account, Block, Deploy, Error, StoredValue, Transfer};
use crate::{Account, Block, Error, StoredValue, Transfer};
#[cfg(doc)]
use casper_types::PublicKey;
#[cfg(feature = "std-fs-io")]
pub use deploy::{
make_deploy, make_transfer, put_deploy, send_deploy_file, sign_deploy_file,
speculative_put_deploy, speculative_send_deploy_file, speculative_transfer, transfer,
};
pub use deploy_str_params::DeployStrParams;
pub use dictionary_item_str_params::DictionaryItemStrParams;
pub use error::CliError;
use json_args::JsonArg;
pub use error::{CliError, FromDecStrErr};
pub use json_args::{
help as json_args_help, Error as JsonArgsError, ErrorDetails as JsonArgsErrorDetails,
help as json_args_help, Error as JsonArgsError, ErrorDetails as JsonArgsErrorDetails, JsonArg,
};
pub use payment_str_params::PaymentStrParams;
pub use session_str_params::SessionStrParams;
pub use simple_args::help as simple_args_help;
pub use simple_args::{help as simple_args_help, insert_arg};
pub use transaction::{make_transaction, put_transaction};
#[cfg(feature = "std-fs-io")]
pub use transaction::{
make_transaction, put_transaction, send_transaction_file, sign_transaction_file,
speculative_send_transaction_file,
send_transaction_file, sign_transaction_file, speculative_send_transaction_file,
};
pub use transaction_builder_params::TransactionBuilderParams;
pub use transaction_str_params::TransactionStrParams;
Expand Down Expand Up @@ -119,12 +122,12 @@ pub async fn get_transaction(
) -> Result<SuccessResponse<GetTransactionResult>, CliError> {
let rpc_id = parse::rpc_id(maybe_rpc_id);
let verbosity = parse::verbosity(verbosity_level);
let deploy_hash = parse::transaction_hash(transaction_hash)?;
let transaction_hash = parse::transaction_hash(transaction_hash)?;
crate::get_transaction(
rpc_id,
node_address,
verbosity,
deploy_hash,
transaction_hash,
finalized_approvals,
)
.await
Expand Down Expand Up @@ -378,9 +381,18 @@ pub async fn get_balance(

/// Retrieves an [`Account`] at a given [`Block`].
///
/// `public_key` is the public key as a formatted string associated with the `Account`.
///
/// For details of other parameters, see [the module docs](crate::cli#common-parameters).
///
/// # Parameters
/// - `maybe_rpc_id`: The optional RPC ID as a string slice.
/// - `node_address`: The address of the node as a string slice.
/// - `verbosity_level`: The verbosity level as a 64-bit unsigned integer.
/// - `maybe_block_id`: The optional block ID as a string slice.
/// - `account_identifier`: The account identifier as a string slice.
///
/// # Returns
/// The result containing either a successful response with the account details or a `CliError`.

pub async fn get_account(
maybe_rpc_id: &str,
node_address: &str,
Expand All @@ -406,20 +418,28 @@ pub async fn get_account(

/// Retrieves an [`EntityOrAccount`] at a given [`Block`].
///
/// `public_key` is the public key as a formatted string associated with the `Account`.
///
/// For details of other parameters, see [the module docs](crate::cli#common-parameters).
///
/// # Parameters
/// - `maybe_rpc_id`: The optional RPC ID as a string slice.
/// - `node_address`: The address of the node as a string slice.
/// - `verbosity_level`: The verbosity level as a 64-bit unsigned integer.
/// - `maybe_block_id`: The optional block ID as a string slice.
/// - `entity_identifier`: The entity identifier as a string slice.
///
/// # Returns
/// The result containing either a successful response with the entity details or a `CliError`.
pub async fn get_entity(
maybe_rpc_id: &str,
node_address: &str,
verbosity_level: u64,
maybe_block_id: &str,
account_identifier: &str,
entity_identifier: &str,
) -> Result<SuccessResponse<GetAddressableEntityResult>, CliError> {
let rpc_id = parse::rpc_id(maybe_rpc_id);
let verbosity = parse::verbosity(verbosity_level);
let maybe_block_id = parse::block_identifier(maybe_block_id)?;
let entity_identifier = parse::entity_identifier(account_identifier)?;
let entity_identifier = parse::entity_identifier(entity_identifier)?;

crate::get_entity(
rpc_id,
Expand Down Expand Up @@ -564,6 +584,7 @@ pub async fn list_rpcs(
/// When `verbosity_level` is `0`, nothing is printed. For `1`, the value is printed with long
/// string fields shortened to a string indicating the character count of the field. Greater than
/// `1` is the same as for `1` except without abbreviation of long fields.
#[cfg(feature = "std-fs-io")]
pub fn json_pretty_print<T: ?Sized + Serialize>(
value: &T,
verbosity_level: u64,
Expand Down
Loading