Skip to content

Commit

Permalink
fix: input validation
Browse files Browse the repository at this point in the history
  • Loading branch information
SupernaviX committed Dec 13, 2024
1 parent 6efb1f8 commit bf7ffc1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions wasm/simple-tx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ impl InputExpr for CoinSelectionInput {
fn send_ada(_: Config<()>, req: Params<TransferRequest>) -> WorkerResult<NewTx> {
let mut tx = TxBuilder::new();

// TODO: return an error if this address is invalid
let from_address = Address::from_bech32(&req.from_address).unwrap();
let to_address = Address::from_bech32(&req.to_address).unwrap();
let from_address = Address::from_bech32(&req.from_address).map_err(|_| BuildError::MalformedAddress)?;
let to_address = Address::from_bech32(&req.to_address).map_err(|_| BuildError::MalformedAddress)?;

let address_source = UtxoSource::Search(UtxoPattern {
address: Some(AddressPattern {
Expand Down

0 comments on commit bf7ffc1

Please sign in to comment.