@@ -10,7 +10,7 @@ use elements::{
1010 bitcoin:: PublicKey , pset:: PartiallySignedTransaction as Pset , Address , AddressParams , OutPoint ,
1111 Script , TxOutSecrets , TxOutWitness , Txid , WScriptHash ,
1212} ;
13- use elements:: { pset, secp256k1_zkp} ;
13+ use elements:: { pset, secp256k1_zkp, SurjectionInput } ;
1414
1515use elements:: encode:: { deserialize, serialize_hex} ;
1616use elements:: hashes:: hex:: FromHex ;
@@ -164,8 +164,8 @@ fn main() {
164164 // Add outputs
165165 // Send 5_000 worth of asset units to new address
166166 let inputs = [
167- ( btc_txout . asset , Some ( & btc_txout_secrets. sec ) ) ,
168- ( asset_txout . asset , Some ( & asset_txout_secrets. sec ) ) ,
167+ ( SurjectionInput :: from_txout_secrets ( btc_txout_secrets. sec ) ) ,
168+ ( SurjectionInput :: from_txout_secrets ( asset_txout_secrets. sec ) ) ,
169169 ] ;
170170
171171 let dest_wsh =
@@ -175,7 +175,7 @@ fn main() {
175175 let dest_blind_pk =
176176 PublicKey :: from_str ( "0212bf0ea45b733dfde8ecb5e896306c4165c666c99fc5d1ab887f71393a975cea" )
177177 . unwrap ( ) ;
178- let ( dest_asset_txout, dest_abf, dest_vbf) = TxOut :: new_not_last_confidential (
178+ let ( dest_asset_txout, dest_abf, dest_vbf, _ ) = TxOut :: new_not_last_confidential (
179179 & mut rng,
180180 & secp,
181181 dest_amt,
@@ -196,7 +196,7 @@ fn main() {
196196 let change_wsh =
197197 WScriptHash :: from_str ( "f6b43d56e004e9d0b1ec2fc3c95511d81af08420992be8dec7f86cdf8970b3e2" )
198198 . unwrap ( ) ;
199- let ( change_asset_txout, asset_change_abf, asset_change_vbf) =
199+ let ( change_asset_txout, asset_change_abf, asset_change_vbf, _ ) =
200200 TxOut :: new_not_last_confidential (
201201 & mut rng,
202202 & secp,
@@ -250,19 +250,16 @@ fn main() {
250250
251251 // For the last output we require all secrets.
252252 let inputs = [
253- ( btc_txout . asset , & btc_txout_secrets. sec ) ,
254- ( asset_txout . asset , & asset_txout_secrets. sec ) ,
253+ btc_txout_secrets. sec ,
254+ asset_txout_secrets. sec ,
255255 ] ;
256- let ( btc_change_txout, _abf, _vbf) = TxOut :: new_last_confidential (
256+ let ( btc_change_txout, _abf, _vbf, _ ) = TxOut :: new_last_confidential (
257257 & mut rng,
258258 & secp,
259259 change_amt,
260- Address :: p2wsh (
261- & Script :: new_v0_wsh ( & change_wsh) ,
262- Some ( change_blind_pk. inner ) ,
263- & PARAMS ,
264- ) ,
265260 btc_txout_secrets. sec . asset ,
261+ Script :: new_v0_wsh ( & change_wsh) ,
262+ change_blind_pk. inner ,
266263 & inputs,
267264 & output_secrets,
268265 )
0 commit comments