def issue_asset(source_script: nil, source_output: nil,
                    amount: nil,
                    script: nil, address: nil)
      raise ArgumentError, "Either `source_script` or `source_output` must be specified" if !source_script && !source_output
      raise ArgumentError, "Both `source_script` and `source_output` cannot be specified" if source_script && source_output
      raise ArgumentError, "Either `script` or `address` must be specified" if !script && !address
      raise ArgumentError, "Both `script` and `address` cannot be specified" if script && address
      raise ArgumentError, "Amount must be greater than zero" if !amount || amount <= 0
      if source_output && (!source_output.index || !source_output.transaction_hash)
        raise ArgumentError, "If `source_output` is specified, it must have valid `transaction_hash` and `index` attributes"
      end
      script ||= AssetAddress.parse(address).script

      # Ensure source output is a verified asset output.
      if source_output
        if source_output.is_a?(AssetTransactionOutput)
          raise ArgumentError, "Must be verified asset output to spend" if !source_output.verified?
        else
          source_output = AssetTransactionOutput.new(transaction_output: source_output, verified: true)
        end
      end

      # Set either the script or output only once.
      # All the remaining issuances must use the same script or output.
      if !self.issuing_asset_script && !self.issuing_asset_output
        self.issuing_asset_script = source_script
        self.issuing_asset_output = source_output
      else
        if self.issuing_asset_script != source_script || self.issuing_asset_output != source_output
          raise ArgumentError, "Can't issue more assets from a different source script or source output"
        end
      end
      self.issued_assets << {amount: amount, script: script}
    end
def issue_asset(source_script: nil, source_output: nil,
                    amount: nil,
                    script: nil, address: nil)
      raise ArgumentError, "Either `source_script` or `source_output` must be specified" if !source_script && !source_output
      raise ArgumentError, "Both `source_script` and `source_output` cannot be specified" if source_script && source_output
      raise ArgumentError, "Either `script` or `address` must be specified" if !script && !address
      raise ArgumentError, "Both `script` and `address` cannot be specified" if script && address
      raise ArgumentError, "Amount must be greater than zero" if !amount || amount <= 0
      if source_output && (!source_output.index || !source_output.transaction_hash)
        raise ArgumentError, "If `source_output` is specified, it must have valid `transaction_hash` and `index` attributes"
      end
      script ||= AssetAddress.parse(address).script

      # Ensure source output is a verified asset output.
      if source_output
        if source_output.is_a?(AssetTransactionOutput)
          raise ArgumentError, "Must be verified asset output to spend" if !source_output.verified?
        else
          source_output = AssetTransactionOutput.new(transaction_output: source_output, verified: true)
        end
      end

      # Set either the script or output only once.
      # All the remaining issuances must use the same script or output.
      if !self.issuing_asset_script && !self.issuing_asset_output
        self.issuing_asset_script = source_script
        self.issuing_asset_output = source_output
      else
        if self.issuing_asset_script != source_script || self.issuing_asset_output != source_output
          raise ArgumentError, "Can't issue more assets from a different source script or source output"
        end
      end
      self.issued_assets << {amount: amount, script: script}
    end
Adds an issuance of some assets.
 If `script` is specified, it is used to create an intermediate base transaction.
 If `output` is specified, it must be a valid spendable output with `transaction_id` and `index`.
   It can be regular TransactionOutput or verified AssetTransactionOutput.
 `amount` must be > 0 - number of units to be issued