Add TsUnsignedTransaction (wrapper type)
This commit is contained in:
parent
b61cc90ede
commit
45b2dc1e43
@ -1,11 +1,31 @@
|
|||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
use anyhow::{Error, Result};
|
use anyhow::{Error, Result};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use tsify::Tsify;
|
||||||
|
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use sp_client::bitcoin::{Amount, OutPoint, Transaction};
|
use sp_client::bitcoin::{Amount, OutPoint, Transaction};
|
||||||
use sp_client::{OwnedOutput, Recipient, SilentPaymentUnsignedTransaction, SpClient};
|
use sp_client::{OwnedOutput, Recipient, SilentPaymentUnsignedTransaction, SpClient};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Tsify)]
|
||||||
|
#[tsify(from_wasm_abi)]
|
||||||
|
pub struct TsUnsignedTransaction(SilentPaymentUnsignedTransaction);
|
||||||
|
|
||||||
|
impl TsUnsignedTransaction {
|
||||||
|
pub fn new(unsigned_tx: SilentPaymentUnsignedTransaction) -> Self {
|
||||||
|
Self(unsigned_tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_inner(&self) -> &SilentPaymentUnsignedTransaction {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn to_inner(self) -> SilentPaymentUnsignedTransaction {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn create_transaction(
|
pub fn create_transaction(
|
||||||
mandatory_inputs: Vec<OutPoint>,
|
mandatory_inputs: Vec<OutPoint>,
|
||||||
mut available_outpoints: HashMap<OutPoint, OwnedOutput>,
|
mut available_outpoints: HashMap<OutPoint, OwnedOutput>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user