Sha256: b51dcadb98d2c82622da407b8ee99d186c9ea01593432240296b22a3e109b029

Contents?: true

Size: 1.16 KB

Versions: 27

Compression:

Stored size: 1.16 KB

Contents

module BTC
  AssetTransactionBuilder
  class AssetTransactionBuilder
    
    # Interface for providing unspent asset outputs to the asset transaction builder.
    # You can use it instead of Enumerable attribute `asset_unspent_outputs` to customize which unspents to be used.
    module Provider
      # Returns an Enumerable object yielding unspent asset outputs for the given asset ID and amount.
      # Each unspent output is a BTC::AssetTransactionOutput instance with non-nil `transaction_hash`, `index`, `asset_id`, `value` attributes.
      # Additional information about outputs and fees may be used to optimize the set of unspents.
      def asset_unspent_outputs(asset_id: nil, amount: nil)
        []
      end
      
      # Creates a block-based provider:
      # atxbuilder.provider = AssetTransactionBuilder::Provider.new {|builder|  [...]  }
      def self.new(&block)
        BlockProvider.new(&block)
      end
      
      class BlockProvider # private
        include Provider
        def initialize(&block)
          @block = block
        end
        def asset_unspent_outputs(atxbuilder)
          @block.call(atxbuilder)
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
btcruby-1.8 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.7 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.6 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.5.1 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.5 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.4 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.3 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.2.2 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.2.1 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.2 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1.6 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1.5 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1.4 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1.3 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1.2 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1.1 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.1 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.0.9 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.0.8 lib/btcruby/open_assets/asset_transaction_builder/provider.rb
btcruby-1.0.7 lib/btcruby/open_assets/asset_transaction_builder/provider.rb