2.1.1 • Published 11 months ago

@exodus/multi-account-redux v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@exodus/multi-account-redux

Selectors and utilities for managing state with the following shape:

{
  [yourStateSliceName]: {
    [walletAccount]: {
      error: null,
      loaded: true,
      data: {
        [assetName]: {}, // TxSet/UtxoCollection/etc.
      },
    },
  }
}

Install

yarn add @exodus/multi-account-redux

Usage

import { TxSet } from '@exodus/models'
import { createReduxModuleHelper } from '@exodus/multi-account-redux'

const helper = createReduxModuleHelper({
  slice: 'someAssetSourceRelatedData',
  createInitialPerAssetData: () => TxSet.EMPTY,
})

const myReduxModule = {
  id: 'someAssetSourceRelatedData',
  initialState: helper.createInitialState(),
  eventReducers: {
    someAssetSourceRelatedData: (state, data) => {
      // check source code for other utils for merging/resetting state
      return helper.setAccounts(state, data)
    },
  },
  selectorDefinitions: [...helper.selectorDefinitions, ...customSelectorDefinitions],
}
2.1.1

11 months ago

2.1.0

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago