@@ -185,10 +185,10 @@ export async function fetchHistory(ncId, count, after) {
185
185
export function * requestHistoryNanoContract ( { payload } ) {
186
186
const { address, ncId, after } = payload ;
187
187
const count = NANO_CONTRACT_TX_HISTORY_SIZE ;
188
-
189
188
const ncEntryKey = formatNanoContractRegistryEntry ( address , ncId ) ;
190
- const allNcs = STORE . getItem ( nanoContractKey . registeredContracts ) || { } ;
191
- if ( ! allNcs [ ncEntryKey ] ) {
189
+ const storage = STORE . getStorage ( ) ;
190
+
191
+ if ( ! storage . isNanoContractRegistered ( ncEntryKey ) ) {
192
192
yield put ( nanoContractHistoryFailure ( failureMessage . notRegistered ) ) ;
193
193
}
194
194
@@ -197,11 +197,10 @@ export function* requestHistoryNanoContract({ payload }) {
197
197
const { history, next } = yield call ( fetchHistory , ncId , count , after ) ;
198
198
199
199
// load into store
200
- const allNcs = STORE . getItem ( nanoContractKey . registeredContracts ) || { } ;
201
- const currentNc = allNcs [ ncEntryKey ] ;
202
- const historyLoaded = currentNc . history || [ ] ;
203
- currentNc . history = [ ...historyLoaded , ...history ] ;
204
- STORE . setItem ( nanoContractKey . registeredContracts , allNcs )
200
+ const ncData = storage . getNanoContract ( ncEntryKey ) ;
201
+ const loadedHistory = ncData . history || [ ] ;
202
+ ncData . history = [ ...loadedHistory , ...history ] ;
203
+ storage . registerNanoContract ( ncEntryKey , ncData ) ;
205
204
206
205
// create an opportunity to load into redux
207
206
yield put ( nanoContractHistoryLoad ( {
0 commit comments