How to use the @aragon/api.events.ACCOUNTS_TRIGGER function in @aragon/api

To help you get started, we’ve selected a few @aragon/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 1Hive / time-lock-app / app / src / script.js View on Github external
(state, { event, returnValues, blockNumber }) => {
      // dont want to listen for past events for now
      // (our app state can be obtained from smart contract vars)
      if (blockNumber && blockNumber <= currentBlock) return state

      let nextState = {
        ...state,
      }

      switch (event) {
        case events.ACCOUNTS_TRIGGER:
          return updateConnectedAccount(nextState, returnValues)
        case events.SYNC_STATUS_SYNCING:
          return { ...nextState, isSyncing: true }
        case events.SYNC_STATUS_SYNCED:
          return { ...nextState, isSyncing: false }
        case 'ChangeLockDuration':
          return updateLockDuration(nextState, returnValues)
        case 'ChangeLockAmount':
          return updateLockAmount(nextState, returnValues)
        case 'ChangeSpamPenaltyFactor':
          return updateSpamPenaltyFactor(nextState, returnValues)
        case 'NewLock':
          return newLock(nextState, returnValues)
        case 'Withdrawal':
          return newWithdrawal(nextState, returnValues)
        default:
github 1Hive / token-request-app / app / src / script.js View on Github external
(state, { event, returnValues, blockNumber }) => {
      let nextState = {
        ...state,
      }

      switch (event) {
        case events.ACCOUNTS_TRIGGER:
          return updateConnectedAccount(nextState, returnValues)
        case events.SYNC_STATUS_SYNCING:
          return { ...nextState, isSyncing: true }
        case events.SYNC_STATUS_SYNCED:
          return { ...nextState, isSyncing: false }
        case 'TokenRequestCreated':
          return newTokenRequest(nextState, returnValues, settings, blockNumber)
        case 'TokenRequestRefunded':
          return requestRefunded(nextState, returnValues)
        case 'TokenRequestFinalised':
          return requestFinalised(nextState, returnValues)
        default:
          return state
      }
    },
    {