user6611: I want to create a script (smart-contract) utxo with a specific number of tokens (it can be an output of a transaction before) in cardano-serialization-lib - javascript. I need this utxo to be part of a future output of a transaction. How can I do this?
-- Scenario to explain better --
Imagining a scenario where we have a smart contract feeded with 1000 tokens. Then, I want to send 30 tokens for a client (when he claims these tokens). If I want to have an UTXO with only these 30 tokens, I have to create an output before that transaction (for example, when the user locks an asset, the output for the smart contract will be the asset + 30 tokens), but these tokens are not an input from the client, is "from smart contract to smart contract".

user2897: You can follow this example on how to generate a transaction using Cardano Serialization Lib.
For your specific question, focus on the following section of the code that will help you create an output with the ada value you like:
// add output to the tx
txBuilder.add_output(
    CardanoWasm.TransactionOutput.new(
    shelleyOutputAddress,
    CardanoWasm.Value.new(CardanoWasm.BigNum.from_str('1000000'))    
    ),
);

If you also like to add assets to that output, you can try this code:
  const outputAddress = CardanoWasm.Address.from_bech32(toAddress);
  
  var txOutputBuilder = CardanoWasm.TransactionOutputBuilder.new();
  txOutputBuilder = txOutputBuilder.with_address(outputAddress);
  var txOutputAmountBuilder = txOutputBuilder.next();

  const multiAsset = CardanoWasm.MultiAsset.new()

  const assets = CardanoWasm.Assets.new()
  assets.insert(
    CardanoWasm.AssetName.new(Buffer.from(assetName, "hex")), // Asset Name
    CardanoWasm.BigNum.from_str(amount) // How much to send
  );
  multiAsset.insert(
    CardanoWasm.ScriptHash.from_bytes(Buffer.from(policy, "hex")), // PolicyID
    assets
  );
  
  txOutputAmountBuilder = txOutputAmountBuilder.with_asset_and_min_required_coin(multiAsset, CardanoWasm.BigNum.from_str(params.data.genesis.alonzo.lovelacePerUTxOWord.toString()))
  const txOutput = txOutputAmountBuilder.build();

This second example is more in line with what is being used recently to create transactions and outputs in Cardano (TransactionOutputBuilder object).

6611: <p>I want to create a script (smart-contract) utxo with a specific number of tokens (it can be an output of a transaction before) in cardano-serialization-lib - javascript. I need this utxo to be part of a future output of a transaction. How can I do this?</p>
<p>-- Scenario to explain better --</p>
<p>Imagining a scenario where we have a smart contract feeded with 1000 tokens. Then, I want to send 30 tokens for a client (when he claims these tokens). If I want to have an UTXO with only these 30 tokens, I have to create an output before that transaction (for example, when the user locks an asset, the output for the smart contract will be the asset + 30 tokens), but these tokens are not an input from the client, is &quot;from smart contract to smart contract&quot;.</p>
 2897: <p>You can follow <a href="https://github.com/Emurgo/cardano-serialization-lib/blob/master/doc/getting-started/generating-transactions.md" rel="nofollow noreferrer">this example</a> on how to generate a transaction using Cardano Serialization Lib.</p>
<p>For your specific question, focus on the following section of the code that will help you create an output with the ada value you like:</p>
<pre><code>// add output to the tx
txBuilder.add_output(
    CardanoWasm.TransactionOutput.new(
    shelleyOutputAddress,
    CardanoWasm.Value.new(CardanoWasm.BigNum.from_str('1000000'))    
    ),
);
</code></pre>
<p>If you also like to add assets to that output, you can try this code:</p>
<pre><code>  const outputAddress = CardanoWasm.Address.from_bech32(toAddress);
  
  var txOutputBuilder = CardanoWasm.TransactionOutputBuilder.new();
  txOutputBuilder = txOutputBuilder.with_address(outputAddress);
  var txOutputAmountBuilder = txOutputBuilder.next();

  const multiAsset = CardanoWasm.MultiAsset.new()

  const assets = CardanoWasm.Assets.new()
  assets.insert(
    CardanoWasm.AssetName.new(Buffer.from(assetName, &quot;hex&quot;)), // Asset Name
    CardanoWasm.BigNum.from_str(amount) // How much to send
  );
  multiAsset.insert(
    CardanoWasm.ScriptHash.from_bytes(Buffer.from(policy, &quot;hex&quot;)), // PolicyID
    assets
  );
  
  txOutputAmountBuilder = txOutputAmountBuilder.with_asset_and_min_required_coin(multiAsset, CardanoWasm.BigNum.from_str(params.data.genesis.alonzo.lovelacePerUTxOWord.toString()))
  const txOutput = txOutputAmountBuilder.build();
</code></pre>
<p>This second example is more in line with what is being used recently to create transactions and outputs in Cardano (<code>TransactionOutputBuilder</code> object).</p>
