Skip to content

Commit

Permalink
Add SDK call conversion for nomic/PayToFeePool
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Feb 14, 2024
1 parent 9688a9b commit f8abc1a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,24 @@ impl ConvertSdkTx for InnerApp {
Ok(PaidCall { payer, paid })
}

"nomic/PayToFeePool" => {
let msg = msg
.value
.as_object()
.ok_or_else(|| Error::App("Invalid message value".to_string()))?;

let amount: u64 = msg["amount"]
.as_str()
.ok_or_else(|| Error::App("Invalid amount".to_string()))?
.parse()
.map_err(|e: std::num::ParseIntError| Error::App(e.to_string()))?;

let payer = build_call!(self.bitcoin.transfer_to_fee_pool(amount.into()));
let paid = build_call!(self.app_noop());

Ok(PaidCall { payer, paid })
}

_ => Err(Error::App("Unsupported message type".into())),
}
}
Expand Down

0 comments on commit f8abc1a

Please sign in to comment.