-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Description
This works
async fn deposit(
w: &Arc<Wallet>,
secret: &Secret,
e: &Escrow,
amt: u64,
) -> Result<TransactionId, Error> {
let a = w.account()?;
let dst = PaymentDestination::from(PaymentOutput::new(e.addr.clone(), amt));
let fees = Fees::from(0i64);
let payload = None;
let payment_secret = None;
let abortable = Abortable::new();
let (sum, ids) = a
.send(
dst,
fees,
payload,
secret.clone(),
payment_secret,
&abortable,
None,
)
.await?;
info!("sum: {:?}, ids: {:?}", sum, ids);
Ok(ids[0])
}
but this doesnt
async fn deposit(
w: &Arc<Wallet>,
secret: &Secret,
e: &Escrow,
amt: u64,
) -> Result<TransactionId, Error> {
let a = w.account()?;
let r = w
.clone()
// https://github.com/kaspanet/rusty-kaspa/blob/eb71df4d284593fccd1342094c37edc8c000da85/cli/src/modules/send.rs#L28-L38
.accounts_send(AccountsSendRequest {
account_id: a.id().clone(),
wallet_secret: secret.clone(),
payment_secret: None,
destination: PaymentDestination::from(PaymentOutput::new(e.addr.clone(), amt)),
priority_fee_sompi: Fees::from(0i64),
payload: None,
})
.await;
info!("result: {:?}", r);
r?.final_transaction_id().ok_or_else(|| {
Error::Custom("Deposit transaction failed to generate a transaction ID".to_string())
})
}
It gives insufficient funds
Metadata
Metadata
Assignees
Labels
No labels