Propagating memo field when simulating token transfer

This commit is contained in:
Jędrzej Stuczyński
2023-12-08 11:19:11 +00:00
parent 26a8dec707
commit 23892fec8c
7 changed files with 14 additions and 9 deletions
@@ -376,7 +376,11 @@ where
})
}
pub async fn simulate<I, M>(&self, messages: I) -> Result<SimulateResponse, NyxdError>
pub async fn simulate<I, M>(
&self,
messages: I,
memo: impl Into<String> + Send + 'static,
) -> Result<SimulateResponse, NyxdError>
where
I: IntoIterator<Item = M> + Send,
M: Msg,
@@ -391,7 +395,7 @@ where
.map_err(|_| {
NyxdError::SerializationError("custom simulate messages".to_owned())
})?,
"simulating execution of transactions",
memo,
)
.await
}
@@ -32,6 +32,6 @@ pub async fn simulate_update_contract_settings(
vec![],
)?;
let result = client.nyxd.simulate(vec![msg]).await?;
let result = client.nyxd.simulate(vec![msg], "").await?;
guard.create_detailed_fee(result)
}
@@ -12,6 +12,7 @@ use std::str::FromStr;
pub async fn simulate_send(
address: &str,
amount: DecCoin,
memo: String,
state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> {
let guard = state.read().await;
@@ -30,7 +31,7 @@ pub async fn simulate_send(
amount,
};
let result = client.nyxd.simulate(vec![msg]).await?;
let result = client.nyxd.simulate(vec![msg], memo).await?;
guard.create_detailed_fee(result)
}
@@ -38,7 +38,7 @@ async fn simulate_mixnet_operation(
.nyxd
.wrap_contract_execute_message(mixnet_contract, &msg, funds)?;
let result = client.nyxd.simulate(vec![msg]).await?;
let result = client.nyxd.simulate(vec![msg], "").await?;
guard.create_detailed_fee(result)
}
@@ -39,7 +39,7 @@ async fn simulate_vesting_operation(
.nyxd
.wrap_contract_execute_message(vesting_contract, &msg, funds)?;
let result = client.nyxd.simulate(vec![msg]).await?;
let result = client.nyxd.simulate(vec![msg], "").await?;
guard.create_detailed_fee(result)
}
+1 -1
View File
@@ -52,7 +52,7 @@ export const SendModal = ({ onClose, hasStorybookStyles }: { onClose: () => void
if (userFees) {
await setFeeManually(userFees);
} else {
await getFee(simulateSend, { address: toAddress, amount });
await getFee(simulateSend, { address: toAddress, amount, memo });
}
setModal('send details');
} catch (e) {
+2 -2
View File
@@ -69,8 +69,8 @@ export const simulateVestingUpdateGatewayConfig = async (update: GatewayConfigUp
export const simulateWithdrawVestedCoins = async (args: any) =>
invokeWrapper<FeeDetails>('simulate_withdraw_vested_coins', args);
export const simulateSend = async ({ address, amount }: { address: string; amount: DecCoin }) =>
invokeWrapper<FeeDetails>('simulate_send', { address, amount });
export const simulateSend = async ({ address, amount }: { address: string; amount: DecCoin; memo: string }) =>
invokeWrapper<FeeDetails>('simulate_send', { address, amount, memo });
export const getCustomFees = async ({ feesAmount }: { feesAmount: DecCoin }) =>
invokeWrapper<FeeDetails>('get_custom_fees', { feesAmount });