Skip to content

Commit

Permalink
refactor: named all the sagaRegisters
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-blockchain committed Dec 31, 2018
1 parent 4f57715 commit 433bf5c
Show file tree
Hide file tree
Showing 84 changed files with 185 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { takeEvery } from 'redux-saga/effects'
import * as actionTypes from '../actionTypes'
import * as sagas from './sagas'

export default function*() {
export default function* alertsSaga () {
yield takeEvery(actionTypes.alerts.ALERTS_SHOW, sagas.handleTimer)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
LAYOUT_WALLET_HEADER_WHATSNEW_CLICKED
} from '../components/layoutWallet/actionTypes'

export default ({ api, coreSagas }) => {
const analyticsSagas = sagas({ api, coreSagas })
return function*() {
export default ({ api }) => {
const analyticsSagas = sagas({ api })
return function* analyticsSaga () {
yield takeLatest(AT.REPORT_BALANCE_STATS, analyticsSagas.reportBalanceStats)
yield takeLatest(AT.LOG_LEFT_NAV_CLICK, analyticsSagas.logLeftNavClick)
yield takeLatest(AT.LOG_LOCKBOX_SETUP, analyticsSagas.logLockboxSetup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api, coreSagas }) => {
const authSagas = sagas({ api, coreSagas })

return function*() {
return function* authSaga () {
yield takeLatest(AT.DEAUTHORIZE_BROWSER, authSagas.deauthorizeBrowser)
yield takeLatest(AT.LOGIN, authSagas.login)
yield takeLatest(AT.LOGOUT, authSagas.logout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default () => {
const activityListSagas = sagas()

return function*() {
return function* activityListSaga () {
yield takeEvery(AT.ACTIVITY_LIST_INITIALIZED, activityListSagas.initialized)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sagas from './sagas'
export default () => {
const bchTransactionsSagas = sagas()

return function*() {
return function* btcTransactionsSaga () {
yield takeEvery(
AT.BCH_TRANSACTIONS_INITIALIZED,
bchTransactionsSagas.initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sagas from './sagas'
export default () => {
const bsvTransactionsSagas = sagas()

return function*() {
return function* bsvTransactionsSaga () {
yield takeEvery(
AT.BSV_TRANSACTIONS_INITIALIZED,
bsvTransactionsSagas.initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sagas from './sagas'
export default () => {
const btcTransactionsSagas = sagas()

return function*() {
return function* btcTransactionsSaga () {
yield takeEvery(
AT.BTC_TRANSACTIONS_INITIALIZED,
btcTransactionsSagas.initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sagas from './sagas'
export default () => {
const ethTransactionsSagas = sagas()

return function*() {
return function* ethTransactionsSaga () {
yield takeEvery(
AT.ETH_TRANSACTIONS_INITIALIZED,
ethTransactionsSagas.initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ import { takeLatest } from 'redux-saga/effects'

import { actionTypes } from 'data'
import * as AT from './actionTypes'
import exchangeSagas from './exchange.sagas'
import sagas from './exchange.sagas'

export default ({ api, coreSagas, networks }) => {
const exchange = exchangeSagas({ api, coreSagas, networks })
const exchangeSagas = sagas({ api, coreSagas, networks })

return function*() {
yield takeLatest(AT.INITIALIZE, exchange.exchangeFormInitialized)
yield takeLatest(AT.CHANGE_SOURCE, exchange.changeSource)
yield takeLatest(AT.CHANGE_TARGET, exchange.changeTarget)
yield takeLatest(AT.CHANGE_AMOUNT, exchange.changeAmount)
yield takeLatest(AT.CHANGE_FIX, exchange.changeFix)
yield takeLatest(AT.CONFIRM_EXCHANGE, exchange.confirm)
yield takeLatest(AT.CLEAR_SUBSCRIPTIONS, exchange.clearSubscriptions)
yield takeLatest(AT.SWAP_BASE_AND_COUNTER, exchange.swapFieldValue)
yield takeLatest(AT.UPDATE_LIMITS, exchange.updateLimits)
return function* exchangeSaga () {
yield takeLatest(AT.INITIALIZE, exchangeSagas.exchangeFormInitialized)
yield takeLatest(AT.CHANGE_SOURCE, exchangeSagas.changeSource)
yield takeLatest(AT.CHANGE_TARGET, exchangeSagas.changeTarget)
yield takeLatest(AT.CHANGE_AMOUNT, exchangeSagas.changeAmount)
yield takeLatest(AT.CHANGE_FIX, exchangeSagas.changeFix)
yield takeLatest(AT.CONFIRM_EXCHANGE, exchangeSagas.confirm)
yield takeLatest(AT.CLEAR_SUBSCRIPTIONS, exchangeSagas.clearSubscriptions)
yield takeLatest(AT.SWAP_BASE_AND_COUNTER, exchangeSagas.swapFieldValue)
yield takeLatest(AT.UPDATE_LIMITS, exchangeSagas.updateLimits)
yield takeLatest(
actionTypes.modules.rates.PAIR_UPDATED,
exchange.onQuoteChange
exchangeSagas.onQuoteChange
)
yield takeLatest(
actionTypes.modules.rates.UPDATE_BEST_RATES,
exchange.onBestRatesChange
exchangeSagas.onBestRatesChange
)
yield takeLatest(AT.USE_MIN, exchange.useMin)
yield takeLatest(AT.USE_MAX, exchange.useMax)
yield takeLatest(AT.USE_MIN, exchangeSagas.useMin)
yield takeLatest(AT.USE_MAX, exchangeSagas.useMax)
yield takeLatest(
AT.RECHECK_LATEST_TX,
exchange.checkLatestTx.bind(null, 'ETH')
exchangeSagas.checkLatestTx.bind(null, 'ETH')
)
yield takeLatest(AT.SHOW_CONFIRMATION, exchange.showConfirmation)
yield takeLatest(AT.SHOW_CONFIRMATION, exchangeSagas.showConfirmation)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api, coreSagas }) => {
const exchangeHistorySagas = sagas({ api, coreSagas })

return function*() {
return function* exchangeHistorySaga () {
yield takeLatest(
AT.EXCHANGE_HISTORY_INITIALIZED,
exchangeHistorySagas.exchangeHistoryInitialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,62 @@ import * as AT from './actionTypes'
import sagas from './sagas'

export default ({ api, coreSagas }) => {
const exchange = sagas({ api, coreSagas })
const identityVerificationSagas = sagas({ api, coreSagas })

return function*() {
yield takeLatest(AT.VERIFY_IDENTITY, exchange.verifyIdentity)
return function* identityVerificationSaga () {
yield takeLatest(
AT.VERIFY_IDENTITY,
identityVerificationSagas.verifyIdentity
)
yield takeLatest(
AT.INITIALIZE_VERIFICATION,
exchange.initializeVerification
identityVerificationSagas.initializeVerification
)
yield takeLatest(
AT.UPDATE_SMS_STEP,
identityVerificationSagas.updateSmsStep
)
yield takeLatest(
AT.UPDATE_SMS_NUMBER,
identityVerificationSagas.updateSmsNumber
)
yield takeLatest(
AT.VERIFY_SMS_NUMBER,
identityVerificationSagas.verifySmsNumber
)
yield takeLatest(
AT.RESEND_SMS_CODE,
identityVerificationSagas.resendSmsCode
)
yield takeLatest(
AT.SAVE_PERSONAL_DATA,
identityVerificationSagas.savePersonalData
)
yield takeLatest(AT.UPDATE_SMS_STEP, exchange.updateSmsStep)
yield takeLatest(AT.UPDATE_SMS_NUMBER, exchange.updateSmsNumber)
yield takeLatest(AT.VERIFY_SMS_NUMBER, exchange.verifySmsNumber)
yield takeLatest(AT.RESEND_SMS_CODE, exchange.resendSmsCode)
yield takeLatest(AT.SAVE_PERSONAL_DATA, exchange.savePersonalData)
yield takeLatest(
AT.FETCH_SUPPORTED_COUNTRIES,
exchange.fetchSupportedCountries
identityVerificationSagas.fetchSupportedCountries
)
yield takeLatest(
AT.FETCH_SUPPORTED_DOCUMENTS,
exchange.fetchSupportedDocuments
identityVerificationSagas.fetchSupportedDocuments
)
yield takeLatest(AT.FETCH_STATES, identityVerificationSagas.fetchStates)
yield takeLatest(
AT.REGISTER_USER_CAMPAIGN,
identityVerificationSagas.registerUserCampaign
)
yield takeLatest(AT.FETCH_STATES, exchange.fetchStates)
yield takeLatest(AT.REGISTER_USER_CAMPAIGN, exchange.registerUserCampaign)
yield takeLatest(
AT.CREATE_REGISTER_USER_CAMPAIGN,
exchange.createRegisterUserCampaign
)
yield takeLatest(AT.GO_TO_PREV_STEP, exchange.goToPrevStep)
yield takeLatest(AT.GO_TO_NEXT_STEP, exchange.goToNextStep)
yield takeLatest(AT.CHECK_KYC_FLOW, exchange.checkKycFlow)
yield takeLatest(AT.SEND_DEEP_LINK, exchange.sendDeeplink)
yield takeLatest(AT.UPDATE_EMAIL, exchange.updateEmail)
yield takeLatest(AT.SEND_EMAIL_VERIFICATION, exchange.sendEmailVerification)
identityVerificationSagas.createRegisterUserCampaign
)
yield takeLatest(AT.GO_TO_PREV_STEP, identityVerificationSagas.goToPrevStep)
yield takeLatest(AT.GO_TO_NEXT_STEP, identityVerificationSagas.goToNextStep)
yield takeLatest(AT.CHECK_KYC_FLOW, identityVerificationSagas.checkKycFlow)
yield takeLatest(AT.SEND_DEEP_LINK, identityVerificationSagas.sendDeeplink)
yield takeLatest(AT.UPDATE_EMAIL, identityVerificationSagas.updateEmail)
yield takeLatest(
AT.SEND_EMAIL_VERIFICATION,
identityVerificationSagas.sendEmailVerification
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api, coreSagas, networks }) => {
const importBtcAddressSagas = sagas({ api, coreSagas, networks })

return function*() {
return function* importBtcAddressSaga () {
yield takeLatest(
AT.IMPORT_BTC_ADDRESS_SUBMIT_CLICKED,
importBtcAddressSagas.importBtcAddressSubmitClicked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api, coreSagas }) => {
const lockboxSagas = sagas({ api, coreSagas })

return function*() {
return function* lockboxSaga () {
yield takeLatest(AT.INITIALIZE_NEW_DEVICE_SETUP, function*(...args) {
yield race({
task: call(lockboxSagas.initializeNewDeviceSetup, ...args),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as AT from './actionTypes'
import sagas from './sagas'

export default () => {
const loginSagas = sagas({})
const loginSagas = sagas()

return function*() {
return function* loginSaga () {
yield takeEvery(AT.LOGIN_INITIALIZED, loginSagas.initialized)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api, networks }) => {
const manageAddressesSagas = sagas({ api, networks })

return function*() {
return function* manageAddressesSaga () {
yield takeLatest(
AT.DELETE_ADDRESS_LABEL,
manageAddressesSagas.deleteAddressLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as AT from './actionTypes'
import sagas from './sagas'
export default ({ api, coreSagas }) => {
const { syncOnfido, fetchOnfidoSDKKey } = sagas({ api, coreSagas })
return function*() {
return function* onfidoSaga () {
yield takeLatest(AT.FETCH_ONFIDO_SDK_KEY, fetchOnfidoSDKKey)
yield takeLatest(AT.SYNC_ONFIDO, syncOnfido)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ coreSagas }) => {
const priceChartSagas = sagas({ coreSagas })

return function*() {
return function* priceChartSaga () {
yield takeEvery(AT.PRICE_CHART_INITIALIZED, priceChartSagas.initialized)
yield takeEvery(AT.PRICE_CHART_COIN_CLICKED, priceChartSagas.coinClicked)
yield takeEvery(AT.PRICE_CHART_TIME_CLICKED, priceChartSagas.timeClicked)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ coreSagas }) => {
const priceTickerSagas = sagas({ coreSagas })

return function*() {
return function* priceTickerSaga () {
yield takeEvery(AT.PRICE_TICKER_INITIALIZED, priceTickerSagas.initialized)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default () => {
const refreshSagas = sagas()

return function*() {
return function* refreshSaga () {
yield takeLatest(AT.REFRESH_CLICKED, refreshSagas.refreshClicked)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ networks }) => {
const requestBchSagas = sagas({ networks })

return function*() {
return function* requestBchSaga () {
yield takeLatest(
requestAT.OPEN_LOCKBOX_APP_CLICKED,
requestBchSagas.openLockboxAppClicked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ networks }) => {
const requestBtcSagas = sagas({ networks })

return function*() {
return function* requestBtcSaga () {
yield takeLatest(
requestAT.REQUEST_BTC_FIRST_STEP_SUBMIT_CLICKED,
requestBtcSagas.firstStepSubmitClicked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ networks }) => {
const requestEthSagas = sagas({ networks })

return function*() {
return function* requestEthSaga () {
yield takeLatest(
requestAT.OPEN_LOCKBOX_APP_CLICKED,
requestEthSagas.openLockboxAppClicked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default () => {
const requestXlmSagas = sagas()

return function*() {
return function* requestXlmSaga () {
yield takeLatest(
requestAT.OPEN_LOCKBOX_APP_CLICKED,
requestXlmSagas.openLockboxAppClicked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import uploadDocuments from './uploadDocuments/sagaRegister'
import veriff from './veriff/sagaRegister'

export default ({ api, coreSagas, networks, options }) =>
function*() {
function* componentsSaga () {
yield fork(activityList())
yield fork(bchTransactions())
yield fork(btcTransactions())
Expand All @@ -55,12 +55,12 @@ export default ({ api, coreSagas, networks, options }) =>
yield fork(requestBch({ networks }))
yield fork(requestEth({ networks }))
yield fork(requestXlm())
yield fork(sendBch({ api, coreSagas }))
yield fork(sendBtc({ api, coreSagas, networks }))
yield fork(sendBsv({ api, coreSagas }))
yield fork(sendEth({ api, coreSagas }))
yield fork(sendBch({ coreSagas }))
yield fork(sendBtc({ coreSagas, networks }))
yield fork(sendBsv({ coreSagas }))
yield fork(sendEth({ coreSagas }))
yield fork(sendXlm({ coreSagas }))
yield fork(settings({ api, coreSagas }))
yield fork(settings({ coreSagas }))
yield fork(signMessage({ coreSagas }))
yield fork(swapGetStarted({ coreSagas }))
yield fork(transactionReport({ coreSagas }))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export default ({ api, coreSagas, options, networks }) => ({
requestBch: requestBch(),
requestEth: requestEth(),
requestXlm: requestXlm(),
sendBch: sendBch({ api, coreSagas }),
sendBtc: sendBtc({ api, coreSagas }),
sendBsv: sendBsv({ api, coreSagas }),
sendEth: sendEth({ api, coreSagas }),
sendBch: sendBch({ coreSagas }),
sendBtc: sendBtc({ coreSagas, networks }),
sendBsv: sendBsv({ coreSagas }),
sendEth: sendEth({ coreSagas }),
sendXlm: sendXlm({ coreSagas }),
settings: settings({ api, coreSagas }),
settings: settings({ coreSagas }),
signMessage: signMessage({ coreSagas }),
swapGetStarted: swapGetStarted({ coreSagas }),
transactionReport: transactionReport({ coreSagas }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sagas from './sagas'
export default ({ coreSagas }) => {
const sendBchSagas = sagas({ coreSagas })

return function*() {
return function* sendBchSaga () {
yield takeLatest(AT.SEND_BCH_INITIALIZED, sendBchSagas.initialized)
yield takeLatest(AT.SEND_BCH_DESTROYED, sendBchSagas.destroyed)
yield takeLatest(AT.SEND_BCH_FIRST_STEP_TO_TOGGLED, sendBchSagas.toToggled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sagas from './sagas'
export default ({ coreSagas }) => {
const sendBsvSagas = sagas({ coreSagas })

return function*() {
return function* sendBsvSaga () {
yield takeLatest(AT.SEND_BSV_INITIALIZED, sendBsvSagas.initialized)
yield takeLatest(AT.SEND_BSV_DESTROYED, sendBsvSagas.destroyed)
yield takeLatest(AT.SEND_BSV_FIRST_STEP_TO_TOGGLED, sendBsvSagas.toToggled)
Expand Down

0 comments on commit 433bf5c

Please sign in to comment.