Add memo to pool transfer tx
This commit is contained in:
parent
39eeec8583
commit
7759cdff38
|
@ -110,6 +110,7 @@ struct CResult_____c_char transfer_pools(uint8_t coin,
|
|||
uint8_t from_pool,
|
||||
uint8_t to_pool,
|
||||
uint64_t amount,
|
||||
char *memo,
|
||||
uint32_t confirmations);
|
||||
|
||||
struct CResult_____c_char shield_taddr(uint8_t coin, uint32_t account, uint32_t confirmations);
|
||||
|
|
|
@ -424,11 +424,14 @@ pub async unsafe extern "C" fn transfer_pools(
|
|||
account: u32,
|
||||
from_pool: u8, to_pool: u8,
|
||||
amount: u64,
|
||||
memo: *mut c_char,
|
||||
confirmations: u32,
|
||||
) -> CResult<*mut c_char> {
|
||||
from_c_str!(memo);
|
||||
let res = async move {
|
||||
let tx_plan = crate::api::payment_v2::transfer_pools(coin, account, from_pool, to_pool,
|
||||
AmountOrMax::Amount(amount), confirmations).await?;
|
||||
AmountOrMax::Amount(amount),
|
||||
&memo, confirmations).await?;
|
||||
let tx_plan = serde_json::to_string(&tx_plan)?;
|
||||
Ok::<_, anyhow::Error>(tx_plan)
|
||||
};
|
||||
|
|
|
@ -150,7 +150,7 @@ pub enum AmountOrMax {
|
|||
}
|
||||
|
||||
pub async fn transfer_pools(coin: u8, account: u32, from_pool: u8, to_pool: u8, amount: AmountOrMax,
|
||||
confirmations: u32) -> anyhow::Result<TransactionPlan> {
|
||||
memo: &str, confirmations: u32) -> anyhow::Result<TransactionPlan> {
|
||||
let address = get_unified_address(coin, account, to_pool)?; // get our own unified address
|
||||
let a = match amount {
|
||||
AmountOrMax::Amount(a) => a,
|
||||
|
@ -159,7 +159,7 @@ pub async fn transfer_pools(coin: u8, account: u32, from_pool: u8, to_pool: u8,
|
|||
let recipient = RecipientMemo {
|
||||
address,
|
||||
amount: a,
|
||||
memo: Memo::from_str("Shield Transparent Balance")?,
|
||||
memo: Memo::from_str(memo)?,
|
||||
max_amount_per_note: 0,
|
||||
};
|
||||
let last_height = get_latest_height().await?;
|
||||
|
@ -173,7 +173,7 @@ pub async fn transfer_pools(coin: u8, account: u32, from_pool: u8, to_pool: u8,
|
|||
|
||||
/// Make a transaction that shields the transparent balance
|
||||
pub async fn shield_taddr(coin: u8, account: u32, confirmations: u32) -> anyhow::Result<String> {
|
||||
let tx_plan = transfer_pools(coin, account, 1, 6, AmountOrMax::Max, confirmations).await?;
|
||||
let tx_plan = transfer_pools(coin, account, 1, 6, AmountOrMax::Max, "Shield Transparent Balance", confirmations).await?;
|
||||
let tx_id = sign_and_broadcast(coin, account, &tx_plan).await?;
|
||||
log::info!("TXID: {}", tx_id);
|
||||
Ok(tx_id)
|
||||
|
|
Loading…
Reference in New Issue