Skip to content

Commit

Permalink
Some fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvc94ch committed Apr 11, 2023
1 parent 0155393 commit adcf8fd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
9 changes: 3 additions & 6 deletions rosetta-cli/src/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ pub struct BlockIdentifierOpts {
}

impl BlockIdentifierOpts {
pub fn partial_block_identifier(&self) -> Option<PartialBlockIdentifier> {
if self.index.is_none() && self.hash.is_none() {
return None;
}
Some(PartialBlockIdentifier {
pub fn partial_block_identifier(&self) -> PartialBlockIdentifier {
PartialBlockIdentifier {
index: self.index,
hash: self.hash.clone(),
})
}
}

pub fn block_identifier(&self) -> Option<BlockIdentifier> {
Expand Down
7 changes: 2 additions & 5 deletions rosetta-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async fn main() -> Result<()> {
let req = AccountBalanceRequest {
network_identifier: config.network(),
account_identifier,
block_identifier: opts.block.partial_block_identifier(),
block_identifier: Some(opts.block.partial_block_identifier()),
currencies: None,
};
let balance = client.account_balance(&req).await?;
Expand Down Expand Up @@ -104,10 +104,7 @@ async fn main() -> Result<()> {
let res = client.block_transaction(&req).await?;
println!("{res:#?}");
} else {
let block_identifier = opts
.block
.partial_block_identifier()
.ok_or_else(|| anyhow::anyhow!("missing partial block identifier"))?;
let block_identifier = opts.block.partial_block_identifier();
let req = BlockRequest {
network_identifier,
block_identifier,
Expand Down
3 changes: 2 additions & 1 deletion rosetta-client/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl Signer {
self.master_key(algorithm)?
.derive(ChildNumber::hardened_from_u32(44))?
.derive(ChildNumber::hardened_from_u32(coin))?
.derive(ChildNumber::hardened_from_u32(account))
.derive(ChildNumber::hardened_from_u32(account))?
.derive(ChildNumber::non_hardened_from_u32(0))
}
}

Expand Down
4 changes: 4 additions & 0 deletions rosetta-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ serde_json = "1.0.94"
sled = "0.34.7"
tide = { version = "0.16.0", default-features = false, features = ["h1-server", "logger"] }
tokio = { version = "1.26.0", features = ["full"] }

[build-dependencies]
anyhow = "1.0.69"
vergen = { version = "8.1.1", features = ["build", "git", "gitcl"] }
7 changes: 7 additions & 0 deletions rosetta-server/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use anyhow::Result;
use vergen::EmitBuilder;

fn main() -> Result<()> {
EmitBuilder::builder().all_git().emit()?;
Ok(())
}
2 changes: 1 addition & 1 deletion rosetta-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async fn network_options<T: BlockchainClient>(mut req: Request<State<T>>) -> tid
version: Version {
rosetta_version: "1.4.13".into(),
node_version,
middleware_version: None,
middleware_version: Some(env!("VERGEN_GIT_DESCRIBE").into()),
metadata: None,
},
allow: None,
Expand Down

0 comments on commit adcf8fd

Please sign in to comment.