Skip to content

Commit a2a31ef

Browse files
committed
update
1 parent b3c9854 commit a2a31ef

File tree

6 files changed

+62
-58
lines changed

6 files changed

+62
-58
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,3 @@ hex = "0.4.3"
2323
reqwest = { version = "0.11.12", features = [ "json", "rustls-tls" ], default-features = false }
2424
serde_json = "1.0.85"
2525
starknet = "0.8.0"
26-
27-
async-trait = "0.1.60"
28-
shellexpand = "3.0.0"
29-
thiserror = "1.0.40"

args/src/args.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,8 @@ Example: 0x12,0x23 0x34,0x45 - Which will be parsed as [[0x12,0x23], [0x34,0x45]
376376
#[command(visible_alias = "ped")]
377377
#[command(about = "Calculate the Pedersen hash on two field elements.")]
378378
Pedersen {
379-
#[arg(value_name = "X")]
380-
x: FieldElement,
381-
#[arg(value_name = "Y")]
382-
y: FieldElement,
379+
#[arg(help = "List of elements to compute the hash on.")]
380+
elements: Vec<FieldElement>,
383381
},
384382

385383
#[command(about = "Perform a raw JSON-RPC request.")]

args/src/opts/starknet.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient};
1010

1111
#[derive(Debug, Clone, Args)]
1212
pub struct StarknetOptions {
13-
#[arg(long)]
13+
#[arg(long = "rpc")]
1414
#[arg(value_name = "URL")]
15-
#[arg(help = "The RPC endpoint")]
1615
#[arg(env = "STARKNET_RPC_URL")]
17-
#[arg(default_value = "http://localhost:5050/rpc")]
16+
#[arg(help = "The Starknet JSON-RPC endpoint")]
17+
#[arg(default_value = "http://localhost:5050/")]
1818
pub rpc_url: Url,
1919

2020
#[arg(long)]

args/src/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rpc starknet_getStorageAt '["0x123", "0x69420", "latest"]' --raw
3030
#[arg(value_name = "URL")]
3131
#[arg(help = "The RPC endpoint")]
3232
#[arg(env = "STARKNET_RPC_URL")]
33-
#[arg(default_value = "http://localhost:5050/rpc")]
33+
#[arg(default_value = "http://localhost:5050/")]
3434
rpc_url: Url,
3535
}
3636

cli/src/main.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ async fn main() -> Result<()> {
6868
println!("{}", SimpleRika::max_felt());
6969
}
7070

71-
Commands::Pedersen { x, y } => {
72-
println!("{:#x}", SimpleRika::pedersen(&x, &y)?);
71+
Commands::Pedersen { elements } => {
72+
println!("{:#x}", SimpleRika::pedersen(&elements));
7373
}
7474

7575
Commands::BlockNumber { starknet } => {
76-
let res = Rika::new(starknet.rpc_url).block_number().await?;
76+
let res = Rika::new_with_http(starknet.rpc_url).block_number().await?;
7777
println!("{res}");
7878
}
7979

8080
Commands::ChainId { starknet } => {
81-
let chain_id = Rika::new(starknet.rpc_url).chain_id().await?;
81+
let chain_id = Rika::new_with_http(starknet.rpc_url).chain_id().await?;
8282
println!("{chain_id}");
8383
}
8484

@@ -88,14 +88,14 @@ async fn main() -> Result<()> {
8888
to_json,
8989
starknet,
9090
} => {
91-
let res = Rika::new(starknet.rpc_url)
91+
let res = Rika::new_with_http(starknet.rpc_url)
9292
.get_transaction_by_hash(hash, field, to_json)
9393
.await?;
9494
println!("{res}");
9595
}
9696

9797
Commands::TransactionStatus { hash, starknet } => {
98-
let res = Rika::new(starknet.rpc_url)
98+
let res = Rika::new_with_http(starknet.rpc_url)
9999
.get_transaction_status(hash)
100100
.await?;
101101
println!("{res}");
@@ -107,7 +107,7 @@ async fn main() -> Result<()> {
107107
to_json,
108108
starknet,
109109
} => {
110-
let res = Rika::new(starknet.rpc_url)
110+
let res = Rika::new_with_http(starknet.rpc_url)
111111
.get_transaction_receipt(hash, field, to_json)
112112
.await?;
113113
println!("{res}");
@@ -120,7 +120,7 @@ async fn main() -> Result<()> {
120120
field,
121121
starknet,
122122
} => {
123-
let block = Rika::new(starknet.rpc_url)
123+
let block = Rika::new_with_http(starknet.rpc_url)
124124
.block(id, full, field, to_json)
125125
.await?;
126126
println!("{block}")
@@ -131,7 +131,7 @@ async fn main() -> Result<()> {
131131
human_readable,
132132
starknet,
133133
} => {
134-
let timestamp = Rika::new(starknet.rpc_url)
134+
let timestamp = Rika::new_with_http(starknet.rpc_url)
135135
.block(block_id, false, Some("timestamp".to_string()), false)
136136
.await?;
137137

@@ -147,7 +147,7 @@ async fn main() -> Result<()> {
147147
}
148148

149149
Commands::TransactionCount { block_id, starknet } => {
150-
let total = Rika::new(starknet.rpc_url)
150+
let total = Rika::new_with_http(starknet.rpc_url)
151151
.get_block_transaction_count(block_id)
152152
.await?;
153153

@@ -159,7 +159,7 @@ async fn main() -> Result<()> {
159159
block_id,
160160
starknet,
161161
} => {
162-
let nonce = Rika::new(starknet.rpc_url)
162+
let nonce = Rika::new_with_http(starknet.rpc_url)
163163
.get_nonce(contract_address, &block_id)
164164
.await?;
165165
println!("{nonce}");
@@ -171,7 +171,7 @@ async fn main() -> Result<()> {
171171
block_id,
172172
starknet,
173173
} => {
174-
let res = Rika::new(starknet.rpc_url)
174+
let res = Rika::new_with_http(starknet.rpc_url)
175175
.get_storage_at(contract_address, index, &block_id)
176176
.await?;
177177

@@ -190,15 +190,15 @@ async fn main() -> Result<()> {
190190
block_id,
191191
starknet,
192192
} => {
193-
let res = Rika::new(starknet.rpc_url)
193+
let res = Rika::new_with_http(starknet.rpc_url)
194194
.call(&contract_address, &function, &input, &block_id)
195195
.await?;
196196

197197
println!("{res}");
198198
}
199199

200200
Commands::StateUpdate { block_id, starknet } => {
201-
let res = Rika::new(starknet.rpc_url)
201+
let res = Rika::new_with_http(starknet.rpc_url)
202202
.get_state_update(&block_id)
203203
.await?;
204204
println!("{res}");
@@ -227,7 +227,7 @@ async fn main() -> Result<()> {
227227
block_id,
228228
starknet,
229229
} => {
230-
let res = Rika::new(starknet.rpc_url)
230+
let res = Rika::new_with_http(starknet.rpc_url)
231231
.get_class_code(hash, &block_id)
232232
.await?;
233233
println!("{res}");
@@ -238,7 +238,7 @@ async fn main() -> Result<()> {
238238
block_id,
239239
starknet,
240240
} => {
241-
let res = Rika::new(starknet.rpc_url)
241+
let res = Rika::new_with_http(starknet.rpc_url)
242242
.get_contract_code(contract_address, &block_id)
243243
.await?;
244244
println!("{res}");
@@ -249,7 +249,7 @@ async fn main() -> Result<()> {
249249
block_id,
250250
starknet,
251251
} => {
252-
let res = Rika::new(starknet.rpc_url)
252+
let res = Rika::new_with_http(starknet.rpc_url)
253253
.get_contract_class(contract_address, &block_id)
254254
.await?;
255255
println!("{res}");
@@ -275,7 +275,7 @@ async fn main() -> Result<()> {
275275
to_block,
276276
starknet,
277277
} => {
278-
let res = Rika::new(starknet.rpc_url)
278+
let res = Rika::new_with_http(starknet.rpc_url)
279279
.get_events(
280280
EventFilter {
281281
address: from,
@@ -304,7 +304,7 @@ async fn main() -> Result<()> {
304304
block_id,
305305
starknet,
306306
} => {
307-
let res = Rika::new(starknet.rpc_url)
307+
let res = Rika::new_with_http(starknet.rpc_url)
308308
.get_eth_balance(address, block_id)
309309
.await?;
310310
println!("{res}");
@@ -328,7 +328,7 @@ async fn main() -> Result<()> {
328328
}
329329

330330
Commands::Syncing { starknet } => {
331-
let res = Rika::new(starknet.rpc_url).syncing().await?;
331+
let res = Rika::new_with_http(starknet.rpc_url).syncing().await?;
332332
println!("{res}");
333333
}
334334
}

0 commit comments

Comments
 (0)