Skip to content

Commit 5dd8800

Browse files
committed
update
1 parent 527d97a commit 5dd8800

File tree

19 files changed

+1811
-514
lines changed

19 files changed

+1811
-514
lines changed

Cargo.lock

Lines changed: 1714 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,18 @@ version = "0.1.2"
1515
rika-args = { path = "args" }
1616
rika = { path = "rika" }
1717

18-
async-trait = "0.1.60"
19-
cairo-lang-starknet = "2.5.3"
2018
chrono = "0.4.23"
2119
clap = { version = "4.1.8", features = ["derive", "env"] }
2220
clap_complete = "4.1.0"
23-
comfy-table = "6.1.4"
24-
crypto-bigint = "0.5.3"
25-
dunce = "1.0.3"
2621
eyre = "0.6.8"
2722
hex = "0.4.3"
28-
home = "0.5.4"
29-
inquire = "0.6.2"
30-
rand = "0.8.5"
3123
reqwest = { version = "0.11.12", features = [
32-
"json",
33-
"rustls-tls",
24+
"json",
25+
"rustls-tls",
3426
], default-features = false }
35-
serde = "1.0.145"
36-
serde_json = "1.0.85"
37-
shellexpand = "3.0.0"
3827
starknet = "0.8.0"
39-
starknet-keystore = { git = "https://github.com/kariy/starknet-keystore-rs" }
28+
serde_json = "1.0.85"
29+
30+
async-trait = "0.1.60"
4031
thiserror = "1.0.40"
41-
tokio = { version = "1.24.2", features = ["full"] }
42-
walkdir = "2.3.2"
32+
shellexpand = "3.0.0"

args/Cargo.toml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
reqwest = { version = "0.11.12", features = [
10-
"json",
11-
"rustls-tls",
12-
], default-features = false }
13-
clap = { version = "4.1.8", features = ["derive", "env"] }
14-
clap_complete = "4.1.0"
9+
reqwest.workspace = true
10+
clap.workspace = true
11+
clap_complete.workspace = true
12+
dunce = "1.0.3"
1513
eyre.workspace = true
16-
starknet = "0.8.0"
14+
starknet.workspace = true
15+
serde = "1.0.145"
16+
inquire = "0.6.2"
17+
hex.workspace = true
18+
serde_json.workspace = true
19+
rand = "0.8.5"
20+
starknet-keystore = { git = "https://github.com/kariy/starknet-keystore-rs" }
21+
walkdir = "2.3.2"
22+
shellexpand.workspace = true
23+
home = "0.5.4"
24+
thiserror.workspace = true

args/src/account/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
pub mod simple_account;
22

3-
use super::{account::simple_account::SimpleWallet, parser::PathParser};
3+
use super::account::simple_account::SimpleWallet;
44
use crate::opts::account::{utils::get_main_keystore_dir, WalletOptions};
55
use crate::opts::starknet::StarknetChain;
6-
use crate::rika::utils::parse_hex_or_str_as_felt;
6+
use crate::utils::canonicalize_path;
7+
use crate::utils::parse_hex_or_str_as_felt;
78

89
use std::path::PathBuf;
910
use std::str::FromStr;
@@ -20,7 +21,7 @@ pub enum WalletCommands {
2021
New {
2122
#[arg(long)]
2223
#[arg(value_name = "PATH")]
23-
#[arg(value_parser(PathParser))]
24+
#[arg(value_parser = canonicalize_path)]
2425
#[arg(help = "If provided, then keypair will be written to an encrypted JSON keystore.")]
2526
path: Option<PathBuf>,
2627

@@ -60,7 +61,7 @@ pub enum WalletCommands {
6061
Sign {
6162
#[arg(short, long)]
6263
#[arg(value_name = "PATH")]
63-
#[arg(value_parser(PathParser))]
64+
#[arg(value_parser = canonicalize_path)]
6465
keystore: Option<PathBuf>,
6566

6667
#[arg(short, long)]

args/src/args.rs

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
use super::account::WalletCommands;
12
use super::parser::BlockIdParser;
23
use super::rpc::RpcArgs;
3-
use super::send::{DeployArgs, InvokeArgs, LegacyDeclareArgs};
4-
use super::{account::WalletCommands, send::DeclareArgs};
54
use crate::opts::starknet::StarknetOptions;
6-
use crate::rika::utils::parse_event_keys;
5+
use crate::utils::parse_event_keys;
76

87
use clap::{Parser, Subcommand};
98
use clap_complete::Shell;
@@ -292,14 +291,6 @@ pub enum Commands {
292291
contract: PathBuf,
293292
},
294293

295-
#[command(visible_alias = "dec")]
296-
#[command(about = "Declare a new contract class.")]
297-
Declare(DeclareArgs),
298-
299-
#[command(visible_alias = "dep")]
300-
#[command(about = "Deploy a new contract.")]
301-
Deploy(DeployArgs),
302-
303294
#[command(visible_alias = "ec")]
304295
#[command(about = "Perform ECDSA operations over the STARK-friendly elliptic curve.")]
305296
Ecdsa {
@@ -314,7 +305,7 @@ pub enum Commands {
314305
)]
315306
Events {
316307
#[arg(num_args(0..))]
317-
#[arg(help = r"The values used to filter the events.
308+
#[arg(help = r"The values used to filter the events.
318309
Example: 0x12,0x23 0x34,0x45 - Which will be parsed as [[0x12,0x23], [0x34,0x45]]")]
319310
#[arg(value_parser = parse_event_keys)]
320311
keys: Option<Vec<Vec<FieldElement>>>,
@@ -357,21 +348,13 @@ Example: 0x12,0x23 0x34,0x45 - Which will be parsed as [[0x12,0x23], [0x34,0x45]
357348
keys: Vec<FieldElement>,
358349
},
359350

360-
#[command(visible_alias = "inv")]
361-
#[command(about = "Submit a new transaction to be added to the chain.")]
362-
Invoke(InvokeArgs),
363-
364351
#[command(visible_alias = "kck")]
365352
#[command(about = "Hash abritrary data using StarkNet keccak.")]
366353
Keccak {
367354
#[arg(value_name = "DATA")]
368355
data: String,
369356
},
370357

371-
#[command(visible_alias = "ldec")]
372-
#[command(about = "Declare a new legacy contract class.")]
373-
LegacyDeclare(LegacyDeclareArgs),
374-
375358
#[command(visible_alias = "n1")]
376359
#[command(about = "Get the latest nonce associated with the address.")]
377360
Nonce {
@@ -394,9 +377,9 @@ Example: 0x12,0x23 0x34,0x45 - Which will be parsed as [[0x12,0x23], [0x34,0x45]
394377
#[command(about = "Calculate the Pedersen hash on two field elements.")]
395378
Pedersen {
396379
#[arg(value_name = "X")]
397-
x: String,
380+
x: FieldElement,
398381
#[arg(value_name = "Y")]
399-
y: String,
382+
y: FieldElement,
400383
},
401384

402385
#[command(about = "Perform a raw JSON-RPC request.")]
@@ -487,17 +470,6 @@ Example: 0x12,0x23 0x34,0x45 - Which will be parsed as [[0x12,0x23], [0x34,0x45]
487470
starknet: StarknetOptions,
488471
},
489472

490-
#[command(visible_alias = "txp")]
491-
#[command(name = "tx-pending")]
492-
#[command(
493-
about = "Get the transactions in the transaction pool, recognized by the sequencer."
494-
)]
495-
TransactionPending {
496-
#[command(flatten)]
497-
#[command(next_help_heading = "Starknet options")]
498-
starknet: StarknetOptions,
499-
},
500-
501473
#[command(visible_alias = "txs")]
502474
#[command(name = "tx-status")]
503475
#[command(about = "Get the status of a transaction.")]
@@ -577,7 +549,7 @@ pub enum EcdsaCommand {
577549

578550
#[cfg(test)]
579551
mod tests {
580-
use crate::cmd::args::Commands;
552+
use crate::args::Commands;
581553

582554
use super::Args;
583555
use clap::{CommandFactory, Parser};

args/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ pub mod args;
33
pub mod opts;
44
pub mod parser;
55
pub mod rpc;
6-
pub mod send;
6+
mod utils;

args/src/mod.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

args/src/opts/account/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub mod utils;
22

33
use self::utils::get_from_keystore;
4-
use crate::cmd::account::simple_account::SimpleWallet;
4+
use crate::account::simple_account::SimpleWallet;
55

66
use std::{path::PathBuf, str::FromStr};
77

args/src/opts/account/utils.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::cmd::account::simple_account::SimpleWallet;
1+
use crate::account::simple_account::SimpleWallet;
22

33
use std::fs;
44
use std::path::{Path, PathBuf};
@@ -39,7 +39,9 @@ pub fn find_keystore_file(
3939

4040
if path.is_dir() {
4141
let Some(account) = account else {
42-
return Err(eyre!("unable to find the keystore with unknown account address"))
42+
return Err(eyre!(
43+
"unable to find the keystore with unknown account address"
44+
));
4345
};
4446

4547
let (_, file) = walkdir::WalkDir::new(path)

args/src/opts/starknet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::cmd::parser::ChainParser;
1+
use crate::parser::ChainParser;
22

33
use std::{fmt, str::FromStr};
44

0 commit comments

Comments
 (0)