diff --git a/bin/drk/src/deploy.rs b/bin/drk/src/deploy.rs index 504029b79..e581a530e 100644 --- a/bin/drk/src/deploy.rs +++ b/bin/drk/src/deploy.rs @@ -136,7 +136,7 @@ impl Drk { Ok(keypair) } - /// Create a contract deployment transaction + /// Create a feeless contract deployment transaction. pub async fn deploy_contract( &self, deploy_auth: u64, @@ -157,8 +157,6 @@ impl Drk { let mut tx_builder = TransactionBuilder::new(ContractCallLeaf { call, proofs: vec![] }, vec![])?; - // TODO: Tx fees - let mut tx = tx_builder.build()?; let sigs = tx.create_sigs(&[deploy_keypair.secret])?; tx.signatures = vec![sigs]; @@ -166,7 +164,7 @@ impl Drk { Ok(tx) } - /// Create a contract redeployment lock transaction + /// Create a feeless contract redeployment lock transaction. pub async fn lock_contract(&self, deploy_auth: u64) -> Result { // Fetch the keypair let deploy_keypair = self.get_deploy_auth(deploy_auth).await?; @@ -182,8 +180,6 @@ impl Drk { let mut tx_builder = TransactionBuilder::new(ContractCallLeaf { call, proofs: vec![] }, vec![])?; - // TODO: Tx fees - let mut tx = tx_builder.build()?; let sigs = tx.create_sigs(&[deploy_keypair.secret])?; tx.signatures = vec![sigs]; diff --git a/bin/drk/src/main.rs b/bin/drk/src/main.rs index addf2737f..d93fdde82 100644 --- a/bin/drk/src/main.rs +++ b/bin/drk/src/main.rs @@ -1295,12 +1295,15 @@ async fn realmain(args: Args, ex: Arc>) -> Result<()> { }; println!("{}", base64::encode(&serialize_async(&tx).await)); + Ok(()) } Subcmd::Inspect => { let tx = parse_tx_from_stdin().await?; + println!("{tx:#?}"); + Ok(()) } @@ -1730,7 +1733,7 @@ async fn realmain(args: Args, ex: Arc>) -> Result<()> { let drk = Drk::new(args.wallet_path, args.wallet_pass, Some(args.endpoint), ex).await?; - let tx = match drk.deploy_contract(deploy_auth, wasm_bin, deploy_ix).await { + let mut tx = match drk.deploy_contract(deploy_auth, wasm_bin, deploy_ix).await { Ok(v) => v, Err(e) => { eprintln!("Error creating contract deployment tx: {}", e); @@ -1738,7 +1741,13 @@ async fn realmain(args: Args, ex: Arc>) -> Result<()> { } }; + if let Err(e) = drk.attach_fee(&mut tx).await { + eprintln!("Failed to attach the fee call to the transaction: {e:?}"); + exit(2); + }; + println!("{}", base64::encode(&serialize_async(&tx).await)); + Ok(()) } @@ -1746,7 +1755,7 @@ async fn realmain(args: Args, ex: Arc>) -> Result<()> { let drk = Drk::new(args.wallet_path, args.wallet_pass, Some(args.endpoint), ex).await?; - let tx = match drk.lock_contract(deploy_auth).await { + let mut tx = match drk.lock_contract(deploy_auth).await { Ok(v) => v, Err(e) => { eprintln!("Error creating contract lock tx: {}", e); @@ -1754,7 +1763,13 @@ async fn realmain(args: Args, ex: Arc>) -> Result<()> { } }; + if let Err(e) = drk.attach_fee(&mut tx).await { + eprintln!("Failed to attach the fee call to the transaction: {e:?}"); + exit(2); + }; + println!("{}", base64::encode(&serialize_async(&tx).await)); + Ok(()) } }, diff --git a/bin/drk/src/token.rs b/bin/drk/src/token.rs index d7fe7ba85..9915638b0 100644 --- a/bin/drk/src/token.rs +++ b/bin/drk/src/token.rs @@ -213,7 +213,7 @@ impl Drk { // Decode provided amount let amount = decode_base10(amount, BALANCE_BASE10_DECIMALS, false)?; - // Grab token ID mint authority and attribtes + // Grab token ID mint authority and attributes let token_mint_authority = self.get_token_mint_authority(&token_id).await?; let token_attrs = self.derive_token_attributes(token_mint_authority.1, token_mint_authority.2); @@ -329,7 +329,7 @@ impl Drk { /// Create a token freeze transaction. Returns the transaction object on success. pub async fn freeze_token(&self, token_id: TokenId) -> Result { - // Grab token ID mint authority and attribtes + // Grab token ID mint authority and attributes let token_mint_authority = self.get_token_mint_authority(&token_id).await?; let token_attrs = self.derive_token_attributes(token_mint_authority.1, token_mint_authority.2); diff --git a/src/contract/deployooor/src/client/deploy_v1.rs b/src/contract/deployooor/src/client/deploy_v1.rs index 9ec75e7f0..acb9b6a8f 100644 --- a/src/contract/deployooor/src/client/deploy_v1.rs +++ b/src/contract/deployooor/src/client/deploy_v1.rs @@ -18,7 +18,7 @@ use darkfi::Result; use darkfi_sdk::{crypto::Keypair, deploy::DeployParamsV1}; -use log::info; +use log::debug; pub struct DeployCallDebris { pub params: DeployParamsV1, @@ -36,7 +36,7 @@ pub struct DeployCallBuilder { impl DeployCallBuilder { pub fn build(&self) -> Result { - info!("Building Deployooor::DeployV1 contract call"); + debug!("Building Deployooor::DeployV1 contract call"); assert!(!self.wasm_bincode.is_empty()); let params = DeployParamsV1 { diff --git a/src/contract/deployooor/src/client/lock_v1.rs b/src/contract/deployooor/src/client/lock_v1.rs index 57b9e6221..e6bffaf56 100644 --- a/src/contract/deployooor/src/client/lock_v1.rs +++ b/src/contract/deployooor/src/client/lock_v1.rs @@ -18,7 +18,7 @@ use darkfi::Result; use darkfi_sdk::crypto::Keypair; -use log::info; +use log::debug; use crate::model::LockParamsV1; @@ -34,7 +34,7 @@ pub struct LockCallBuilder { impl LockCallBuilder { pub fn build(&self) -> Result { - info!("Building Deployooor::LockV1 contract call"); + debug!("Building Deployooor::LockV1 contract call"); let params = LockParamsV1 { public_key: self.deploy_keypair.public }; let debris = LockCallDebris { params };