sign transactions from node's end

This commit is contained in:
Sergio Chouhy
2025-07-16 13:30:24 -03:00
parent f02c97e622
commit 6e48bcfd9e
8 changed files with 411 additions and 375 deletions
+41 -41
View File
@@ -42,7 +42,7 @@ pub const EXECUTE_SCENARIO_MULTIPLE_SEND: &str = "execute_scenario_multiple_send
pub const SHOW_ACCOUNT_PUBLIC_BALANCE: &str = "show_account_public_balance";
pub const SHOW_ACCOUNT_UTXO: &str = "show_account_utxo";
pub const SHOW_TRANSACTION: &str = "show_transaction";
pub const WRITE_DEPOSIT_PUBLIC_BALANCE: &str = "write_deposit_public_balance";
// pub const WRITE_DEPOSIT_PUBLIC_BALANCE: &str = "write_deposit_public_balance";
pub const WRITE_MINT_UTXO: &str = "write_mint_utxo";
pub const WRITE_MINT_UTXO_MULTIPLE_ASSETS: &str = "write_mint_utxo_multiple_assets";
pub const WRITE_SEND_UTXO_PRIVATE: &str = "write_send_utxo_private";
@@ -84,18 +84,18 @@ impl JsonHandler {
.subscenario_1()
.await
.map_err(cast_common_execution_error_into_rpc_error)?,
2 => store
.subscenario_2()
.await
.map_err(cast_common_execution_error_into_rpc_error)?,
// 2 => store
// .subscenario_2()
// .await
// .map_err(cast_common_execution_error_into_rpc_error)?,
3 => store
.subscenario_3()
.await
.map_err(cast_common_execution_error_into_rpc_error)?,
4 => store
.subscenario_4()
.await
.map_err(cast_common_execution_error_into_rpc_error)?,
// 4 => store
// .subscenario_4()
// .await
// .map_err(cast_common_execution_error_into_rpc_error)?,
5 => store
.subscenario_5()
.await
@@ -355,35 +355,35 @@ impl JsonHandler {
respond(helperstruct)
}
pub async fn process_write_deposit_public_balance(
&self,
request: Request,
) -> Result<Value, RpcErr> {
let req = WriteDepositPublicBalanceRequest::parse(Some(request.params))?;
let acc_addr_hex_dec = hex::decode(req.account_addr.clone()).map_err(|_| {
RpcError::parse_error("Failed to decode account address from hex string".to_string())
})?;
let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| {
RpcError::parse_error("Failed to parse account address from bytes".to_string())
})?;
{
let mut cover_guard = self.node_chain_store.lock().await;
cover_guard
.operate_account_deposit_public(acc_addr, req.amount as u128)
.await
.map_err(cast_common_execution_error_into_rpc_error)?;
};
let helperstruct = WriteDepositPublicBalanceResponse {
status: SUCCESS.to_string(),
};
respond(helperstruct)
}
// pub async fn process_write_deposit_public_balance(
// &self,
// request: Request,
// ) -> Result<Value, RpcErr> {
// let req = WriteDepositPublicBalanceRequest::parse(Some(request.params))?;
//
// let acc_addr_hex_dec = hex::decode(req.account_addr.clone()).map_err(|_| {
// RpcError::parse_error("Failed to decode account address from hex string".to_string())
// })?;
//
// let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| {
// RpcError::parse_error("Failed to parse account address from bytes".to_string())
// })?;
//
// {
// let mut cover_guard = self.node_chain_store.lock().await;
//
// cover_guard
// .operate_account_deposit_public(acc_addr, req.amount as u128)
// .await
// .map_err(cast_common_execution_error_into_rpc_error)?;
// };
//
// let helperstruct = WriteDepositPublicBalanceResponse {
// status: SUCCESS.to_string(),
// };
//
// respond(helperstruct)
// }
pub async fn process_write_mint_utxo(&self, request: Request) -> Result<Value, RpcErr> {
let req = WriteMintPrivateUTXORequest::parse(Some(request.params))?;
@@ -777,9 +777,9 @@ impl JsonHandler {
SHOW_ACCOUNT_PUBLIC_BALANCE => self.process_show_account_public_balance(request).await,
SHOW_ACCOUNT_UTXO => self.process_show_account_utxo_request(request).await,
SHOW_TRANSACTION => self.process_show_transaction(request).await,
WRITE_DEPOSIT_PUBLIC_BALANCE => {
self.process_write_deposit_public_balance(request).await
}
// WRITE_DEPOSIT_PUBLIC_BALANCE => {
// self.process_write_deposit_public_balance(request).await
// }
WRITE_MINT_UTXO => self.process_write_mint_utxo(request).await,
WRITE_MINT_UTXO_MULTIPLE_ASSETS => {
self.process_write_mint_utxo_multiple_assets(request).await