Skip to content

Commit

Permalink
Stub implementation for create_deposit_transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
nchashch committed Oct 17, 2024
1 parent 8766957 commit e9c47a2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,17 @@ impl WalletService for Arc<crate::wallet::Wallet> {
&self,
request: tonic::Request<CreateDepositTransactionRequest>,
) -> std::result::Result<tonic::Response<CreateDepositTransactionResponse>, tonic::Status> {
Err(tonic::Status::new(
tonic::Code::Unimplemented,
"not implemented",
))
let CreateDepositTransactionRequest {
sidechain_id,
address,
value_sats,
fee_sats,
} = request.into_inner();
let txid = self
.create_deposit(sidechain_id as u8, address, value_sats, fee_sats)
.map_err(|err| tonic::Status::internal(err.to_string()))?;
let txid = ConsensusHex::encode(&txid);
let response = CreateDepositTransactionResponse { txid: Some(txid) };
Ok(tonic::Response::new(response))
}
}
10 changes: 10 additions & 0 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ impl Wallet {
Ok(())
}

pub fn create_deposit(
&self,
sidechain_number: u8,
address: String,
value_sats: u64,
fee_sats: u64,
) -> Result<[u8; 32]> {
todo!();
}

pub fn get_pending_deposits(&self, sidechain_number: Option<u8>) -> Result<Vec<Deposit>> {
let with_connection = |connection: &Connection| -> Result<_> {
let mut statement = match sidechain_number {
Expand Down

0 comments on commit e9c47a2

Please sign in to comment.