@@ -389,17 +389,14 @@ fn order_fill(#[case] seed: Seed, #[case] orders_version: OrdersVersion) {
389389 let order_fill_tx = TransactionBuilder :: new ( )
390390 . add_input ( coins_outpoint. into ( ) , InputWitness :: NoSignature ( None ) )
391391 . add_input ( fill_order_input, InputWitness :: NoSignature ( None ) )
392- . add_output ( TxOutput :: Transfer (
393- OutputValue :: TokenV1 ( token_id, filled_amount) ,
394- Destination :: AnyoneCanSpend ,
395- ) )
396392 . add_output ( TxOutput :: Transfer (
397393 OutputValue :: Coin ( coins_left) ,
398394 coins_owner_dest. clone ( ) ,
399395 ) )
396+ . add_token_transfer_output_if_non_zero ( token_id, filled_amount, Destination :: AnyoneCanSpend )
400397 . build ( ) ;
401398 let order_fill_tx_id = order_fill_tx. transaction ( ) . get_id ( ) ;
402- let coins_outpoint = UtxoOutPoint :: new ( order_fill_tx_id. into ( ) , 1 ) ;
399+ let coins_outpoint = UtxoOutPoint :: new ( order_fill_tx_id. into ( ) , 0 ) ;
403400
404401 tf. make_block_builder ( )
405402 . add_transaction ( order_fill_tx)
@@ -418,15 +415,19 @@ fn order_fill(#[case] seed: Seed, #[case] orders_version: OrdersVersion) {
418415 let fill_order_input =
419416 make_fill_order_input ( orders_version, AccountNonce :: new ( 1 ) , & order_id, fill_amount) ;
420417
421- let tx = Transaction :: new (
422- 0 ,
423- vec ! [ coins_outpoint. clone( ) . into( ) , fill_order_input] ,
424- vec ! [ TxOutput :: Transfer (
425- OutputValue :: TokenV1 ( token_id, filled_amount) ,
418+ let tx = TransactionBuilder :: new ( )
419+ . add_input (
420+ coins_outpoint. clone ( ) . into ( ) ,
421+ InputWitness :: NoSignature ( None ) ,
422+ )
423+ . add_input ( fill_order_input, InputWitness :: NoSignature ( None ) )
424+ . add_token_transfer_output_if_non_zero (
425+ token_id,
426+ filled_amount,
426427 Destination :: AnyoneCanSpend ,
427- ) ] ,
428- )
429- . unwrap ( ) ;
428+ )
429+ . build ( )
430+ . take_transaction ( ) ;
430431
431432 let coins_utxo = tf. utxo ( & coins_outpoint) . take_output ( ) ;
432433 let bad_coins_utxo = {
@@ -676,14 +677,11 @@ fn order_conclude(#[case] seed: Seed, #[case] orders_version: OrdersVersion) {
676677 let order_fill_tx = TransactionBuilder :: new ( )
677678 . add_input ( coins_outpoint. into ( ) , InputWitness :: NoSignature ( None ) )
678679 . add_input ( fill_order_input, InputWitness :: NoSignature ( None ) )
679- . add_output ( TxOutput :: Transfer (
680- OutputValue :: TokenV1 ( token_id, filled_amount) ,
681- Destination :: AnyoneCanSpend ,
682- ) )
683680 . add_output ( TxOutput :: Transfer (
684681 OutputValue :: Coin ( coins_left) ,
685682 Destination :: AnyoneCanSpend ,
686683 ) )
684+ . add_token_transfer_output_if_non_zero ( token_id, filled_amount, Destination :: AnyoneCanSpend )
687685 . build ( ) ;
688686
689687 tf. make_block_builder ( )
0 commit comments