Description

The bounties submodule is used to query the Bounties Network's hosted API. This allows developers to build on the bounties protocol while still achieve great response times and filtering abilities. A more thorough discussion of the BountiesAPI can be found in its documentation.

Usage

Each filtering action on the bounties module ends up dispatching two actions: the intended filter and the loadBounties actions. This will force the bounties module to fetch the new bounties based on the newly updated filters. In order to avoid this behavior and issue multiple actions at a time before loading, the batch action can be dispatched with a value of true. Ever filter set from that point until a subsequent batch action with the value false will only update the filter state and not produce a loadBounties.

Actions

setSort(sort, sortOrder)

Determines how the loaded bounties should be sorted. sort is an enum that can take either 'usd_price', 'bounty_created', or 'deadline'. sortOrder can be either 'ascd' or 'desc'.

resetFilter(filter)

Reset only a specific filter. This filter can be any of the following: search, stage, difficulty, address, category, platform, and sort.

resetFilters()

Reset all filters.

setSearch(search)

Update the search filter with search.

toggleStageFilter(stage)

Toggle the boolean value of stage in stageFilters.

setStageFilter(stage, isSet)

Explicitly set the value of stage to isSet in stageFilters.

allStageFilters()

Set all stage filters to true.

toggleDifficultyFilter(difficulty)

Toggle boolean value of difficulty in difficultyFilters.

setDifficultyFilter(difficulty, isSet)

Explicitly set the value of difficulty to isSet in difficultyFilters.

addCategoryFilter(category)

Add category to the categoryFilters set.

addPlatformFilter(platform)

Add platform to the platformFilters set.

addIssuerFilter(address)

Set the issuer filter to address to only load bounties issue by that address.

addFulfillerFilter(address)

Set the fulfiller filter to address to only load bounties fulfilled by that address.

removeCategoryFilter(category)

Remove category from the categoryFilters set.

removePlatformFilter(platform)

Remove category from the categoryFilters set.

toggleCategoryFilter(category)

Toggle filtering based on category.

togglePlatformFilter(platform)

Toggle filtering based on platform.

loadBounties()

Load the bounties that match the current specified filters. This does not load all matching bounties, only the first 25.

loadMoreBounties()

Load the next 25 bounties based on the current specified filters.

batch(isBatch)

Sets the batch flag in the module's state. When set, new actions issued do not reload bounties. The batch flag will have to be removed before it will load again.

resetState()

Reset filters to their initial state.

State

{
  "batch": bool,
  "loading": bool,
  "loaded": bool,
  "error": bool,
  "loadingMore": bool,
  "loadingMoreError": bool,
  "offset": bool,
  "count": number,
  "bounties": array,
  
  "search": string,
  "stageFilters": {
    "drafts": bool,
    "active": bool,
    "completed": bool,
    "expired": bool,
    "dead": bool
  },
  "difficultyFilters": {
    "beginner": bool,
    "intermediate": bool,
    "expert": bool
  },
  "addressFilter": {
    "issuer": string,
    "fulfiller": string
  },
  "categoryFilters": set,
  "platformFilters": set,
  
  "sort": string,
  "sortOrder": string
}

Selectors

bountiesSelector(state)

Retrieves bounties from the state

bountiesStateSelector(state)

Retrieves loading, loaded, error, and batch from the state

bountiesCountSelector

Retrieves the total number of bounties that matches the current filters

bountiesSortFilterSelector

Retrieves sort from the state

bountiesCategoryFiltersSelector

Retrieves categoryFilters from the state

bountiesPlatformFiltersSelector

Retrieves platformFilters from the state

anyStageFiltersSelected

Returns whether any stage filters are currently selected

anyDifficultyFiltersSelected

Returns whether any difficulty filters are currently selected