{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useCallback, useEffect, useReducer } from 'react';\nimport { useEthers } from '../../hooks';\nimport { NotificationsContext } from './context';\nimport { DEFAULT_NOTIFICATIONS } from './model';\nimport { notificationReducer } from './reducer';\nimport { nanoid } from 'nanoid';\nexport function NotificationsProvider({\n  children\n}) {\n  const [notifications, dispatch] = useReducer(notificationReducer, DEFAULT_NOTIFICATIONS);\n  const {\n    chainId,\n    account\n  } = useEthers();\n  useEffect(() => {\n    if (account && chainId) {\n      dispatch({\n        type: 'ADD_NOTIFICATION',\n        chainId: chainId,\n        notification: {\n          type: 'walletConnected',\n          id: nanoid(),\n          submittedAt: Date.now(),\n          address: account\n        }\n      });\n    }\n  }, [account, chainId]);\n  const addNotification = useCallback(({\n    notification,\n    chainId\n  }) => {\n    dispatch({\n      type: 'ADD_NOTIFICATION',\n      chainId,\n      notification: Object.assign(Object.assign({}, notification), {\n        id: nanoid()\n      })\n    });\n  }, [dispatch]);\n  const removeNotification = useCallback(({\n    notificationId,\n    chainId\n  }) => {\n    dispatch({\n      type: 'REMOVE_NOTIFICATION',\n      chainId,\n      notificationId\n    });\n  }, [dispatch]);\n  return _jsx(NotificationsContext.Provider, {\n    value: {\n      addNotification,\n      notifications,\n      removeNotification\n    },\n    children: children\n  }, void 0);\n}","map":{"version":3,"sources":["../../../../../src/providers/notifications/provider.tsx"],"names":[],"mappings":";AAAA,SAAoB,WAApB,EAAiC,SAAjC,EAA4C,UAA5C,QAA8D,OAA9D;AACA,SAAS,SAAT,QAA0B,aAA1B;AACA,SAAS,oBAAT,QAAqC,WAArC;AACA,SAAiC,qBAAjC,QAAyF,SAAzF;AACA,SAAS,mBAAT,QAAoC,WAApC;AACA,SAAS,MAAT,QAAuB,QAAvB;AAMA,OAAM,SAAU,qBAAV,CAAgC;AAAE,EAAA;AAAF,CAAhC,EAAmD;AACvD,QAAM,CAAC,aAAD,EAAgB,QAAhB,IAA4B,UAAU,CAAC,mBAAD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kC,MAAA;AAAlC,KAAR;AAAgE,IAAA,QAAQ,EAAE;AAA1E,GAA9B,EAAgH,KAAA,CAAhH,CADF;AAGD","sourceRoot":"","sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useCallback, useEffect, useReducer } from 'react';\nimport { useEthers } from '../../hooks';\nimport { NotificationsContext } from './context';\nimport { DEFAULT_NOTIFICATIONS } from './model';\nimport { notificationReducer } from './reducer';\nimport { nanoid } from 'nanoid';\nexport function NotificationsProvider({ children }) {\n    const [notifications, dispatch] = useReducer(notificationReducer, DEFAULT_NOTIFICATIONS);\n    const { chainId, account } = useEthers();\n    useEffect(() => {\n        if (account && chainId) {\n            dispatch({\n                type: 'ADD_NOTIFICATION',\n                chainId: chainId,\n                notification: {\n                    type: 'walletConnected',\n                    id: nanoid(),\n                    submittedAt: Date.now(),\n                    address: account,\n                },\n            });\n        }\n    }, [account, chainId]);\n    const addNotification = useCallback(({ notification, chainId }) => {\n        dispatch({\n            type: 'ADD_NOTIFICATION',\n            chainId,\n            notification: Object.assign(Object.assign({}, notification), { id: nanoid() }),\n        });\n    }, [dispatch]);\n    const removeNotification = useCallback(({ notificationId, chainId }) => {\n        dispatch({\n            type: 'REMOVE_NOTIFICATION',\n            chainId,\n            notificationId,\n        });\n    }, [dispatch]);\n    return (_jsx(NotificationsContext.Provider, { value: { addNotification, notifications, removeNotification }, children: children }, void 0));\n}\n//# sourceMappingURL=provider.js.map"]},"metadata":{},"sourceType":"module"}