-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
135 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
authors.workspace = true | ||
description.workspace = true | ||
edition.workspace = true | ||
name = "rika-ops" | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
eyre.workspace = true | ||
rika-args.workspace = true | ||
starknet.workspace = true | ||
thiserror.workspace = true | ||
tokio = { version = "1.37.0", features = [ "full" ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod transaction; | ||
mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use eyre::Result; | ||
use rika_args::{ | ||
commands::transaction::{ReceiptArgs, TxArgs, TxCountArgs, TxStatusArgs}, | ||
fmt::Pretty, | ||
}; | ||
use starknet::providers::Provider; | ||
|
||
use crate::utils; | ||
|
||
pub fn get(args: TxArgs) -> Result<()> { | ||
let TxArgs { | ||
hash, | ||
display, | ||
starknet, | ||
} = args; | ||
|
||
let provider = starknet.provider(); | ||
let result = utils::block_on(provider.get_transaction_by_hash(hash))?; | ||
display.display(result)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn count(args: TxCountArgs) -> Result<()> { | ||
let TxCountArgs { block_id, starknet } = args; | ||
|
||
let provider = starknet.provider(); | ||
let count = utils::block_on(provider.get_block_transaction_count(block_id))?; | ||
println!("{count}"); | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn status(args: TxStatusArgs) -> Result<()> { | ||
let TxStatusArgs { hash, starknet } = args; | ||
|
||
let provider = starknet.provider(); | ||
let status = utils::block_on(provider.get_transaction_status(hash))?; | ||
println!("{}", status.prettify()); | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn receipt(args: ReceiptArgs) -> Result<()> { | ||
let ReceiptArgs { | ||
hash, | ||
display, | ||
starknet, | ||
} = args; | ||
|
||
let provider = starknet.provider(); | ||
let receipt = utils::block_on(provider.get_transaction_receipt(hash))?; | ||
display.display(receipt)?; | ||
|
||
Ok(()) | ||
} |
File renamed without changes.