Method: OpenAssets::Api#send_asset
- Defined in:
- lib/openassets/api.rb
#send_asset(from, asset_id, amount, to, fees = nil, mode = 'broadcast', output_qty = 1) ⇒ Object
Creates a transaction for sending an asset from an address to another. @param from The open asset address to send the asset from. @param asset_id The asset ID identifying the asset to send. @param amount The amount of asset units to send. @param to The open asset address to send the asset to. @param fees The fess in satoshis for the transaction. @param mode ‘broadcast’ (default) for signing and broadcasting the transaction, ‘signed’ for signing the transaction without broadcasting, ‘unsigned’ for getting the raw unsigned transaction without broadcasting“”“=‘broadcast’ @return The resulting transaction.
118 119 120 121 122 123 124 |
# File 'lib/openassets/api.rb', line 118 def send_asset(from, asset_id, amount, to, fees = nil, mode = 'broadcast', output_qty = 1) colored_outputs = get_unspent_outputs([oa_address_to_address(from)]) asset_transfer_spec = OpenAssets::Transaction::TransferParameters.new(colored_outputs, to, from, amount, output_qty) tx = create_tx_builder.transfer_asset(asset_id, asset_transfer_spec, from, fees.nil? ? @config[:default_fees]: fees) tx = process_transaction(tx, mode) tx end |