Ok(LoadWalletResult {
name,
warning: None,
})
}
fn sign_raw_transaction_with_wallet(
&self,
tx: String,
_utxos: Option<Vec<SignRawTransactionInput>>,
sighash_type: Option<()>,
) -> Result<Value, jsonrpc_core::Error> {
assert_eq!(sighash_type, None, "sighash_type param not supported");
let mut transaction: Transaction = deserialize(&hex::decode(tx).unwrap()).unwrap();
for input in &mut transaction.input {
if input.witness.is_empty() {
input.witness = Witness::from_slice(&[&[0; 64]]);
}
}
Ok(
serde_json::to_value(SignRawTransactionResult {
hex: hex::decode(transaction.raw_hex()).unwrap(),
complete: true,
errors: None,
})
.unwrap(),
)
}
fn send_raw_transaction(&self, tx: String) -> Result<String, jsonrpc_core::Error> {
let tx: Transaction = deserialize(&hex::decode(tx).unwrap()).unwrap();
self.state.lock().unwrap().mempool.push(tx.clone());
Ok(tx.txid().to_string())