├── .browserslistrc ├── .editorconfig ├── .electron-builder.config.js ├── .electron-vendors.cache.json ├── .env.example ├── .eslintrc.json ├── .gitattributes ├── .github ├── actions │ └── release-notes │ │ ├── action.yml │ │ └── main.js ├── renovate.json └── workflows │ ├── lint.yml │ ├── release.yml │ ├── tests.yml │ ├── typechecking.yml │ └── update-electron-vendors.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .nano-staged.mjs ├── .prettierignore ├── .storybook ├── main.js ├── preview-head.html ├── preview.jsx └── public │ └── index.html ├── .vscode ├── tasks.json └── tscwatch.sh ├── LICENSE ├── README.md ├── buildResources ├── .gitkeep ├── icon.icns └── icon.png ├── commitlint.config.js ├── package.json ├── packages ├── main │ ├── src │ │ ├── index.ts │ │ ├── mainWindow.ts │ │ ├── security-restrictions.ts │ │ ├── services │ │ │ ├── haveno.ts │ │ │ └── store.ts │ │ ├── types │ │ │ ├── haveno.ts │ │ │ ├── index.ts │ │ │ ├── ipc.ts │ │ │ └── store.ts │ │ └── utils │ │ │ └── password.ts │ ├── tests │ │ └── unit.spec.ts │ ├── tsconfig.json │ ├── vite.config.js │ └── vitest.coverage.config.js ├── preload │ ├── contracts.d.ts │ ├── src │ │ ├── exposeInMainWorld.ts │ │ ├── haveno.ts │ │ ├── index.ts │ │ ├── nodeCrypto.ts │ │ ├── store.ts │ │ ├── types │ │ │ └── index.ts │ │ └── versions.ts │ ├── tests │ │ └── unit.spec.ts │ ├── tsconfig.json │ ├── vite.config.js │ └── vitest.coverage.config.js └── renderer │ ├── .eslintrc.json │ ├── assets │ ├── account.svg │ ├── arrow-down.svg │ ├── arrow-north.svg │ ├── arrow-up.svg │ ├── arrow-west.svg │ ├── btc.svg │ ├── check-circle.svg │ ├── circle-plus.svg │ ├── cog.svg │ ├── ellipsis.svg │ ├── eth.svg │ ├── eur.svg │ ├── fonts │ │ └── Inter-Variable.ttf │ ├── logo-icon.svg │ ├── logo-white.svg │ ├── logo.svg │ ├── markets.svg │ ├── monero.svg │ ├── notification.svg │ ├── notifications.svg │ ├── offers.svg │ ├── setting-cloud.svg │ ├── setting-server.svg │ ├── trades.svg │ ├── unknown.svg │ └── xmr-logo-1.svg │ ├── index.html │ ├── src │ ├── Routes.tsx │ ├── components │ │ ├── atoms │ │ │ ├── AmountChange │ │ │ │ └── AmountChange.tsx │ │ │ ├── AppProviders │ │ │ │ ├── IntlProvider.tsx │ │ │ │ ├── QueryClientProvider.tsx │ │ │ │ ├── ThemeProvider.tsx │ │ │ │ └── index.tsx │ │ │ ├── Buttons │ │ │ │ ├── Button.stories.tsx │ │ │ │ ├── Button.test.tsx │ │ │ │ ├── Button.tsx │ │ │ │ ├── TextButton.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── Button.test.tsx.snap │ │ │ │ │ └── Buttons.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── CircleIcon │ │ │ │ ├── CircleIcon.stories.tsx │ │ │ │ ├── CircleIcon.test.tsx │ │ │ │ ├── CircleIcon.tsx │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CircleIcon.test.tsx.snap │ │ │ ├── ConnectionProgress │ │ │ │ ├── ConnectionProgress.stories.tsx │ │ │ │ ├── ConnectionProgress.test.tsx │ │ │ │ ├── ConnectionProgress.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── ConnectionProgress.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── Currency │ │ │ │ ├── Currency.stories.tsx │ │ │ │ ├── Currency.test.tsx │ │ │ │ ├── Currency.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── Currency.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── DetailItem │ │ │ │ ├── DetailItem.stories.tsx │ │ │ │ ├── DetailItem.test.tsx │ │ │ │ ├── DetailItem.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── DetailItem.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── DetailItemCard │ │ │ │ ├── DetailItemCard.stories.tsx │ │ │ │ ├── DetailItemCard.tsx │ │ │ │ └── index.tsx │ │ │ ├── Header │ │ │ │ ├── Header.stories.tsx │ │ │ │ ├── HeaderWithLogo.test.tsx │ │ │ │ ├── HeaderWithLogo.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── HeaderWithLogo.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── Link │ │ │ │ ├── Link.stories.tsx │ │ │ │ ├── Link.test.tsx │ │ │ │ ├── Link.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── Link.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── Modal │ │ │ │ ├── Modal.stories.tsx │ │ │ │ ├── Modal.tsx │ │ │ │ └── index.ts │ │ │ ├── MoneroNodeListItem │ │ │ │ ├── MoneroNodeListItem.stories.tsx │ │ │ │ ├── MoneroNodeListItem.test.tsx │ │ │ │ ├── MoneroNodeListItem.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MoneroNodeListItem.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── PasswordInput │ │ │ │ ├── PasswordInput.stories.tsx │ │ │ │ ├── PasswordInput.test.tsx │ │ │ │ ├── PasswordInput.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── PasswordInput.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── ProtectedRoute │ │ │ │ ├── ProtectedRoute.test.tsx │ │ │ │ ├── ProtectedRoute.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── ProtectedRoute.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── Select │ │ │ │ ├── Select.stories.tsx │ │ │ │ ├── Select.test.tsx │ │ │ │ ├── Select.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── Select.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── SyncStatus │ │ │ │ ├── SyncStatus.stories.tsx │ │ │ │ ├── SyncStatus.test.tsx │ │ │ │ ├── SyncStatus.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── SyncStatus.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── Tabs │ │ │ │ ├── Tabs.stories.tsx │ │ │ │ ├── Tabs.tsx │ │ │ │ └── index.ts │ │ │ ├── TextInput │ │ │ │ ├── TextInput.stories.tsx │ │ │ │ ├── TextInput.test.tsx │ │ │ │ ├── TextInput.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── TextInput.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── ToggleButton │ │ │ │ ├── ToggleButton.stories.tsx │ │ │ │ ├── ToggleButton.test.tsx │ │ │ │ ├── ToggleButton.tsx │ │ │ │ └── __snapshots__ │ │ │ │ │ └── ToggleButton.test.tsx.snap │ │ │ └── Typography │ │ │ │ ├── Anchor.tsx │ │ │ │ ├── BodyText.stories.tsx │ │ │ │ ├── Heading.stories.tsx │ │ │ │ ├── Heading.tsx │ │ │ │ ├── InfoText.stories.tsx │ │ │ │ ├── LabelText.stories.tsx │ │ │ │ ├── Text.tsx │ │ │ │ ├── Typography.test.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ └── Typography.test.tsx.snap │ │ │ │ └── index.ts │ │ ├── molecules │ │ │ ├── AddressCard │ │ │ │ ├── AddressCard.stories.tsx │ │ │ │ ├── AddressCard.test.tsx │ │ │ │ ├── AddressCard.tsx │ │ │ │ ├── AddressCardSkeleton.stories.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── AddressCard.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── NodeConnectSwitch │ │ │ │ ├── NodeConnectSwitch.stories.tsx │ │ │ │ ├── NodeConnectSwitch.style.tsx │ │ │ │ ├── NodeConnectSwitch.test.tsx │ │ │ │ ├── NodeConnectSwitch.tsx │ │ │ │ ├── NodeConnectSwitchMethod.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── NodeConnectSwitch.test.tsx.snap │ │ │ │ └── index.tsx │ │ │ ├── PaymentMethodCard │ │ │ │ ├── AddPaymentMethodButton.test.tsx │ │ │ │ ├── AddPaymentMethodButton.tsx │ │ │ │ ├── PaymentMethodCard.stories.tsx │ │ │ │ ├── PaymentMethodCard.test.tsx │ │ │ │ ├── PaymentMethodCard.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── AddPaymentMethodButton.test.tsx.snap │ │ │ │ │ └── PaymentMethodCard.test.tsx.snap │ │ │ │ ├── _constants.ts │ │ │ │ ├── _types.ts │ │ │ │ └── index.ts │ │ │ ├── ReadyToUse │ │ │ │ ├── ReadyToUse.stories.tsx │ │ │ │ ├── ReadyToUse.test.tsx │ │ │ │ ├── ReadyToUse.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── ReadyToUse.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── SecondarySidebar │ │ │ │ ├── SecondarySidebar.stories.tsx │ │ │ │ ├── SecondarySidebar.test.tsx │ │ │ │ ├── SecondarySidebar.tsx │ │ │ │ ├── SecondarySidebarItem.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── SecondarySidebar.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── Table │ │ │ │ ├── EditableTable.stories.tsx │ │ │ │ ├── Table.stories.tsx │ │ │ │ ├── Table.style.tsx │ │ │ │ ├── Table.test.tsx │ │ │ │ ├── Table.tsx │ │ │ │ ├── TableBody.tsx │ │ │ │ ├── TableFooter.tsx │ │ │ │ ├── TableHeader.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── Table.test.tsx.snap │ │ │ │ ├── _types.tsx │ │ │ │ ├── _utils.ts │ │ │ │ ├── cells │ │ │ │ │ ├── CheckboxCell.stories.tsx │ │ │ │ │ ├── CheckboxCell.tsx │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ └── use-table-context │ │ │ │ │ └── index.tsx │ │ │ ├── WalletBalance │ │ │ │ ├── WalletBalance.stories.tsx │ │ │ │ ├── WalletBalance.test.tsx │ │ │ │ ├── WalletBalance.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── WalletBalance.test.tsx.snap │ │ │ │ └── index.ts │ │ │ └── WalletTransactions │ │ │ │ ├── WalletTransactions.stories.tsx │ │ │ │ ├── WalletTransactions.tsx │ │ │ │ ├── WalletTransactionsCells.tsx │ │ │ │ ├── WalletTransactionsRowExpanded.tsx │ │ │ │ ├── _types.ts │ │ │ │ └── index.ts │ │ ├── organisms │ │ │ ├── AccountSidebar │ │ │ │ ├── AccountSidebar.stories.tsx │ │ │ │ ├── AccountSidebar.test.tsx │ │ │ │ ├── AccountSidebar.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── AccountSidebar.test.tsx.snap │ │ │ │ ├── _constants.ts │ │ │ │ ├── _hooks.ts │ │ │ │ └── index.ts │ │ │ ├── AddNode │ │ │ │ ├── AddNode.stories.tsx │ │ │ │ ├── AddNode.test.tsx │ │ │ │ ├── AddNode.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── AddNode.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── AddPaymentMethod │ │ │ │ ├── AddPaymentMethod.stories.tsx │ │ │ │ ├── AddPaymentMethod.test.tsx │ │ │ │ ├── AddPaymentMethod.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── AddPaymentMethod.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── ChangePassword │ │ │ │ ├── ChangePassword.stories.tsx │ │ │ │ ├── ChangePassword.tsx │ │ │ │ ├── _hooks.ts │ │ │ │ ├── _types.ts │ │ │ │ └── index.ts │ │ │ ├── MarketOffersFilterAccountsForm │ │ │ │ ├── MarketOffersFilterAccountsForm.stories.tsx │ │ │ │ ├── MarketOffersFilterAccountsForm.tsx │ │ │ │ └── index.ts │ │ │ ├── MarketOffersFilterAmountForm │ │ │ │ ├── MarketOffersFilterAmountForm.stories.tsx │ │ │ │ ├── MarketOffersFilterAmountForm.tsx │ │ │ │ └── index.ts │ │ │ ├── MarketOffersFilterBar │ │ │ │ ├── MarketOffersFilterBar.stories.tsx │ │ │ │ ├── MarketOffersFilterBar.tsx │ │ │ │ ├── MarketOffersFilterButton.tsx │ │ │ │ ├── _hooks.ts │ │ │ │ ├── hooks │ │ │ │ │ ├── index.tsx │ │ │ │ │ ├── useMarketOffersAccountModal.tsx │ │ │ │ │ ├── useMarketOffersAmountModal.tsx │ │ │ │ │ ├── useMarketOffersPairModal.tsx │ │ │ │ │ └── useMarketOffersPaymentMethods.tsx │ │ │ │ └── index.ts │ │ │ ├── MarketOffersFilterPaymentMethods │ │ │ │ ├── MarketOffersFilterPaymentMethods.tsx │ │ │ │ └── index.ts │ │ │ ├── MarketOffersPaymentMethodsTable │ │ │ │ ├── MarketOffersPaymentMethodsTable.stories.tsx │ │ │ │ ├── MarketOffersPaymentMethodsTable.test.tsx │ │ │ │ ├── MarketOffersPaymentMethodsTable.tsx │ │ │ │ ├── MarketOffersPaymentMethodsTableCells.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MarketOffersPaymentMethodsTable.test.tsx.snap │ │ │ │ ├── _types.ts │ │ │ │ └── index.ts │ │ │ ├── MarketOffersTable │ │ │ │ ├── MarketOffersTable.stories.tsx │ │ │ │ ├── MarketOffersTable.test.tsx │ │ │ │ ├── MarketOffersTable.tsx │ │ │ │ ├── MarketOffersTableCell.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MarketOffersTable.test.tsx.snap │ │ │ │ ├── _types.ts │ │ │ │ └── index.ts │ │ │ ├── MarketOffersTradingPair │ │ │ │ ├── MarketOffersTradingPair.tsx │ │ │ │ └── index.ts │ │ │ ├── MarketOffersTradingPairTable │ │ │ │ ├── MarketOffersTradingPairTable.stories.tsx │ │ │ │ ├── MarketOffersTradingPairTable.test.tsx │ │ │ │ ├── MarketOffersTradingPairTable.tsx │ │ │ │ ├── MarketOffersTradingPairTableCells.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MarketOffersTradingPairTable.test.tsx.snap │ │ │ │ ├── _types.ts │ │ │ │ ├── _utils.ts │ │ │ │ └── index.ts │ │ │ ├── MarketsOffers │ │ │ │ ├── MarketsOffers.stories.tsx │ │ │ │ ├── MarketsOffers.tsx │ │ │ │ ├── _utils.ts │ │ │ │ └── index.ts │ │ │ ├── MoneroBalance │ │ │ │ ├── MoneroBalance.stories.tsx │ │ │ │ ├── MoneroBalance.test.tsx │ │ │ │ ├── MoneroBalance.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MoneroBalance.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── MyWalletMoneroBalance │ │ │ │ ├── MyWalletMeneroBalance.tsx │ │ │ │ ├── MyWalletMeneroBalanceSkeleton.tsx │ │ │ │ ├── MyWalletMoneroBalance.stories.tsx │ │ │ │ ├── MyWalletMoneroBalance.test.tsx │ │ │ │ ├── MyWalletMoneroBalanceSkeleton.stories.tsx │ │ │ │ ├── MyWalletMoneroBalanceSkeleton.test.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── MyWalletMoneroBalance.test.tsx.snap │ │ │ │ │ └── MyWalletMoneroBalanceSkeleton.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── MyWalletPrimaryAddress │ │ │ │ ├── MyWalletPrimaryAddress.test.tsx │ │ │ │ ├── MyWalletPrimaryAddress.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MyWalletPrimaryAddress.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── MyWalletReceive │ │ │ │ ├── MyWalletReceive.stories.tsx │ │ │ │ ├── MyWalletReceive.tsx │ │ │ │ ├── _utils.ts │ │ │ │ └── index.ts │ │ │ ├── MyWalletSendForm │ │ │ │ ├── MyWalletSendForm.stories.tsx │ │ │ │ ├── MyWalletSendForm.tsx │ │ │ │ ├── _hooks.ts │ │ │ │ └── index.ts │ │ │ ├── MyWalletTransactions │ │ │ │ ├── MyWalletTransactions.test.tsx │ │ │ │ ├── MyWalletTransactions.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── MyWalletTransactions.test.tsx.snap │ │ │ │ └── _utils.ts │ │ │ ├── Navbar │ │ │ │ ├── Navbar.stories.tsx │ │ │ │ ├── Navbar.test.tsx │ │ │ │ ├── Navbar.tsx │ │ │ │ ├── _NavLink.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── Navbar.test.tsx.snap │ │ │ │ ├── _constants.tsx │ │ │ │ └── index.ts │ │ │ ├── PaymentMethodList │ │ │ │ ├── PaymentMethodList.stories.tsx │ │ │ │ ├── PaymentMethodList.tsx │ │ │ │ └── index.ts │ │ │ ├── SelectMoneroNode │ │ │ │ ├── SelectMoneroNode.stories.tsx │ │ │ │ ├── SelectMoneroNode.tsx │ │ │ │ └── index.ts │ │ │ ├── SetPassword │ │ │ │ ├── SetPassword.stories.tsx │ │ │ │ ├── SetPassword.test.tsx │ │ │ │ ├── SetPassword.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── SetPassword.test.tsx.snap │ │ │ │ └── index.ts │ │ │ ├── SetPrimaryFiat │ │ │ │ ├── SetPrimaryFiat.stories.tsx │ │ │ │ ├── SetPrimaryFiat.tsx │ │ │ │ └── index.ts │ │ │ ├── Sidebar │ │ │ │ ├── _NavLink.tsx │ │ │ │ └── __snapshots__ │ │ │ │ │ └── Sidebar.test.tsx.snap │ │ │ └── WalletManagement │ │ │ │ ├── SeedPhrase.tsx │ │ │ │ ├── WalletManagement.stories.tsx │ │ │ │ ├── WalletManagement.test.tsx │ │ │ │ ├── WalletManagement.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ └── WalletManagement.test.tsx.snap │ │ │ │ └── index.ts │ │ └── templates │ │ │ ├── AccountLayout │ │ │ └── index.tsx │ │ │ ├── CenteredLayout │ │ │ └── index.tsx │ │ │ └── NavbarLayout │ │ │ └── index.tsx │ ├── constants │ │ ├── currencies.ts │ │ ├── haveno-daemon.ts │ │ ├── lang │ │ │ ├── LangKeys.ts │ │ │ ├── en.ts │ │ │ ├── es.ts │ │ │ └── index.ts │ │ ├── modals.ts │ │ ├── notifications.ts │ │ ├── payment-methods.ts │ │ ├── query-keys.ts │ │ ├── routes.ts │ │ └── sync-status.ts │ ├── hooks │ │ ├── haveno │ │ │ ├── useAddMoneroNode.ts │ │ │ ├── useAddress.ts │ │ │ ├── useBalances.ts │ │ │ ├── useCreateAccount.ts │ │ │ ├── useDownloadBackup.ts │ │ │ ├── useGetMoneroConnection.ts │ │ │ ├── useHavenoClient.ts │ │ │ ├── useHavenoVersion.ts │ │ │ ├── useIsMoneroNodeRunning.ts │ │ │ ├── useMarketPairs.ts │ │ │ ├── useMarketsOffers.ts │ │ │ ├── useMoneroConnections.ts │ │ │ ├── useMoneroNodeSettings.ts │ │ │ ├── useMyOffers.ts │ │ │ ├── usePaymentAccounts.ts │ │ │ ├── usePaymentMethods.ts │ │ │ ├── usePrice.ts │ │ │ ├── usePrices.ts │ │ │ ├── useRestoreBackup.ts │ │ │ ├── useSaveLocalMoneroNode.ts │ │ │ ├── useSetCryptoPaymentAccount.ts │ │ │ ├── useSetDownloadQRCode.ts │ │ │ ├── useSetMoneroConnection.ts │ │ │ ├── useSetOffer.ts │ │ │ ├── useSetXmrNewSubaddress.ts │ │ │ ├── useSetXmrSend.ts │ │ │ ├── useStartMoneroNode.ts │ │ │ ├── useStopMoneroNode.ts │ │ │ ├── useSyncStatus.ts │ │ │ ├── useValidatePassword.ts │ │ │ ├── useXmrPrimaryAddress.ts │ │ │ ├── useXmrSeed.ts │ │ │ └── useXmrTxs.ts │ │ ├── misc │ │ │ └── useNavLinkActive.ts │ │ ├── session │ │ │ ├── useAuth.ts │ │ │ └── useLogin.ts │ │ └── storage │ │ │ ├── useAccountInfo.ts │ │ │ ├── useChangePassword.ts │ │ │ ├── useCreateAccount.ts │ │ │ ├── useIsLocalNodeSelected.ts │ │ │ ├── usePreferences.ts │ │ │ ├── useSaveRemoteNode.ts │ │ │ └── useSetPrimaryFiat.ts │ ├── index.tsx │ ├── pages │ │ ├── Account │ │ │ ├── AccountBackup.tsx │ │ │ ├── AddPaymentAccount.tsx │ │ │ ├── PaymentAccounts.tsx │ │ │ ├── PaymentMethods.tsx │ │ │ ├── Security.tsx │ │ │ ├── Settings │ │ │ │ ├── LocalNode.tsx │ │ │ │ ├── RemoteNode.tsx │ │ │ │ ├── Settings.tsx │ │ │ │ ├── StartStopDaemon.tsx │ │ │ │ ├── _hooks.ts │ │ │ │ ├── _types.ts │ │ │ │ ├── _utils.ts │ │ │ │ └── index.ts │ │ │ ├── Wallet.tsx │ │ │ └── index.ts │ │ ├── Home │ │ │ ├── Home.stories.tsx │ │ │ ├── Home.tsx │ │ │ └── index.ts │ │ ├── Login │ │ │ ├── Login.stories.tsx │ │ │ ├── Login.test.tsx │ │ │ ├── Login.tsx │ │ │ ├── __snapshots__ │ │ │ │ └── Login.test.tsx.snap │ │ │ ├── _constants.ts │ │ │ └── index.ts │ │ ├── Markets │ │ │ ├── MarketsOffers.tsx │ │ │ ├── MarketsTransactions.tsx │ │ │ └── index.ts │ │ ├── MyWallet │ │ │ ├── MyWallet.stories.tsx │ │ │ ├── MyWallet.tsx │ │ │ └── index.ts │ │ └── Onboarding │ │ │ ├── ConnectingMonero.stories.tsx │ │ │ ├── ConnectingMonero.tsx │ │ │ ├── CreateAccount.stories.tsx │ │ │ ├── CreateAccount.tsx │ │ │ ├── Welcome.stories.tsx │ │ │ ├── Welcome.tsx │ │ │ ├── _constants.ts │ │ │ └── index.ts │ ├── state │ │ ├── .gitkeep │ │ └── offersFilter.ts │ ├── theme │ │ ├── global-styles.ts │ │ ├── index.ts │ │ └── override.ts │ ├── types │ │ └── index.ts │ └── utils │ │ ├── getIpcError.ts │ │ ├── math.ts │ │ ├── misc.ts │ │ ├── paymentAccount.ts │ │ └── session.ts │ ├── tests │ └── .gitkeep │ ├── tsconfig.json │ ├── types │ └── .gitkeep │ ├── vite.config.js │ └── vitest.config.ts ├── scripts ├── license.js ├── update-electron-vendors.js └── watch.js ├── tests ├── e2e.spec.ts ├── global-setup.ts └── setup-tests.ts ├── types └── env.d.ts ├── vitest.config.js └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | Chrome 98 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # https://github.com/jokeyrhyme/standard-editorconfig 4 | 5 | # top-most EditorConfig file 6 | root = true 7 | 8 | # defaults 9 | [*] 10 | charset = utf-8 11 | end_of_line = lf 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | indent_size = 2 15 | indent_style = space 16 | 17 | [*.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /.electron-vendors.cache.json: -------------------------------------------------------------------------------- 1 | { 2 | "chrome": "98", 3 | "node": "16" 4 | } 5 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | VITE_HAVENO_URL=http://127.0.0.1:8080 2 | VITE_HAVENO_PASSWORD=daemon-password 3 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "es2021": true, 5 | "node": true, 6 | "browser": false 7 | }, 8 | "extends": [ 9 | "eslint:recommended", 10 | "plugin:@typescript-eslint/recommended", 11 | "plugin:prettier/recommended", 12 | "plugin:import/recommended", 13 | "plugin:import/typescript" 14 | ], 15 | "parser": "@typescript-eslint/parser", 16 | "parserOptions": { 17 | "ecmaVersion": 12, 18 | "sourceType": "module" 19 | }, 20 | "plugins": ["@typescript-eslint", "import"], 21 | "ignorePatterns": ["node_modules/**", "**/dist/**"], 22 | "rules": { 23 | "@typescript-eslint/no-unused-vars": "error", 24 | "@typescript-eslint/no-var-requires": "off", 25 | "@typescript-eslint/consistent-type-imports": "error", 26 | "@typescript-eslint/ban-ts-comment": "off", 27 | "import/no-named-as-default": "off", 28 | "prettier/prettier": "error", 29 | "import/newline-after-import": ["error", { "count": 1 }], 30 | "import/order": "error" 31 | }, 32 | "settings": { 33 | "import/resolver": { 34 | "node": { 35 | "extensions": [".js", ".jsx", ".ts", ".tsx"] 36 | }, 37 | "typescript": { 38 | "project": [ 39 | "packages/main/tsconfig.json", 40 | "packages/preload/tsconfig.json" 41 | ] 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | .github/actions/**/*.js linguist-detectable=false 2 | scripts/*.js linguist-detectable=false 3 | *.config.js linguist-detectable=false 4 | -------------------------------------------------------------------------------- /.github/actions/release-notes/action.yml: -------------------------------------------------------------------------------- 1 | name: "Release Notes" 2 | description: "Return release notes based on Git Commits" 3 | inputs: 4 | from: 5 | description: "Commit from which start log" 6 | required: true 7 | to: 8 | description: "Commit to which end log" 9 | required: true 10 | include-commit-body: 11 | description: "Should the commit body be in notes" 12 | required: false 13 | default: "false" 14 | include-abbreviated-commit: 15 | description: "Should the commit sha be in notes" 16 | required: false 17 | default: "true" 18 | outputs: 19 | release-note: # id of output 20 | description: "Release notes" 21 | runs: 22 | using: "node12" 23 | main: "main.js" 24 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base", 4 | ":semanticCommits", 5 | ":automergeTypes", 6 | ":disableDependencyDashboard" 7 | ], 8 | "labels": ["dependencies"], 9 | "baseBranches": ["master"], 10 | "bumpVersion": "patch", 11 | "patch": { 12 | "automerge": true 13 | }, 14 | "minor": { 15 | "automerge": true 16 | }, 17 | "packageRules": [ 18 | { 19 | "packageNames": ["node", "npm"], 20 | "enabled": false 21 | }, 22 | { 23 | "depTypeList": ["devDependencies"], 24 | "semanticCommitType": "build" 25 | }, 26 | { 27 | "matchSourceUrlPrefixes": ["https://github.com/vitejs/vite/"], 28 | "groupName": "Vite monorepo packages", 29 | "automerge": false 30 | }, 31 | { 32 | "matchPackagePatterns": ["^@typescript-eslint", "^eslint"], 33 | "automerge": true, 34 | "groupName": "eslint" 35 | }, 36 | { 37 | "matchPackageNames": ["electron"], 38 | "separateMajorMinor": false 39 | } 40 | ], 41 | "rangeStrategy": "pin" 42 | } 43 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Linters 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - develop 7 | paths: 8 | - "**.js" 9 | - "**.ts" 10 | - ".github/workflows/lint.yml" 11 | pull_request: 12 | paths: 13 | - "**.js" 14 | - "**.ts" 15 | - "package-lock.json" 16 | - ".github/workflows/lint.yml" 17 | 18 | defaults: 19 | run: 20 | shell: "bash" 21 | 22 | jobs: 23 | eslint: 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - uses: actions/checkout@v2 28 | - uses: actions/setup-node@v2 29 | with: 30 | node-version: 16 # Need for npm >=7.7 31 | cache: "yarn" 32 | 33 | # TODO: Install not all dependencies, but only those required for this workflow 34 | - name: Install dependencies 35 | run: yarn install --frozen-lockfile 36 | 37 | - run: yarn lint 38 | -------------------------------------------------------------------------------- /.github/workflows/typechecking.yml: -------------------------------------------------------------------------------- 1 | name: Typechecking 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - develop 7 | paths: 8 | - "**.ts" 9 | - "**/tsconfig.json" 10 | - "yarn.lock" 11 | - ".github/workflows/typechecking.yml" 12 | pull_request: 13 | paths: 14 | - "**.ts" 15 | - "**/tsconfig.json" 16 | - "yarn.lock" 17 | - ".github/workflows/typechecking.yml" 18 | 19 | defaults: 20 | run: 21 | shell: "bash" 22 | 23 | jobs: 24 | typescript: 25 | runs-on: ubuntu-latest 26 | 27 | steps: 28 | - uses: actions/checkout@v2 29 | - uses: actions/setup-node@v2 30 | with: 31 | node-version: 16 # Need for npm >=7.7 32 | cache: "yarn" 33 | 34 | # TODO: Install not all dependencies, but only those required for this workflow 35 | - name: Install dependencies 36 | run: yarn install --frozen-lockfile 37 | 38 | - run: yarn typecheck 39 | -------------------------------------------------------------------------------- /.github/workflows/update-electron-vendors.yml: -------------------------------------------------------------------------------- 1 | name: Update Electon vendors versions 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - develop 7 | paths: 8 | - "yarn.lock" 9 | 10 | concurrency: 11 | group: update-electron-vendors-${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | defaults: 15 | run: 16 | shell: "bash" 17 | 18 | jobs: 19 | node-chrome: 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | - uses: actions/setup-node@v2 25 | with: 26 | node-version: 16 # Need for npm >=7.7 27 | cache: "yarn" 28 | 29 | # TODO: Install not all dependencies, but only those required for this workflow 30 | - name: Install dependencies 31 | run: yarn install --frozen-lockfile 32 | 33 | - run: node ./scripts/update-electron-vendors.js 34 | 35 | - name: Create Pull Request 36 | uses: peter-evans/create-pull-request@v3 37 | with: 38 | delete-branch: true 39 | commit-message: Update electron vendors 40 | branch: autoupdates/electron-vendors 41 | title: Update electron vendors 42 | body: Updated versions of electron vendors in `.electron-vendors.cache.json` and `.browserslistrc` files 43 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn nano-staged 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.lock 3 | buildResources 4 | packages/main/dist 5 | packages/preload/dist 6 | packages/renderer/dist 7 | packages/main/coverage 8 | packages/preload/coverage 9 | packages/renderer/coverage 10 | dist/ 11 | -------------------------------------------------------------------------------- /.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /.storybook/preview.jsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { AppProviders } from "@atoms/AppProviders"; 18 | 19 | export const parameters = { 20 | actions: { argTypesRegex: "^on[A-Z].*" }, 21 | controls: { 22 | matchers: { 23 | color: /(background|color)$/i, 24 | date: /Date$/, 25 | }, 26 | }, 27 | }; 28 | 29 | export const decorators = [(Story) => {Story()}]; 30 | -------------------------------------------------------------------------------- /.storybook/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | Haveno :: Storybook 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "TS Watch", 6 | "type": "process", 7 | "command": "./.vscode/tscwatch.sh", 8 | "isBackground": true, 9 | "group": { 10 | "kind": "build", 11 | "isDefault": true 12 | }, 13 | "presentation": { 14 | "reveal": "never", 15 | "echo": false, 16 | "focus": false, 17 | "panel": "shared" 18 | }, 19 | "problemMatcher": "$tsc-watch", 20 | "runOptions": { 21 | "runOn": "folderOpen" 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /.vscode/tscwatch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./node_modules/.bin/tsc --watch --noEmit --project packages/main & 3 | P1=$! 4 | ./node_modules/.bin/tsc --watch --noEmit --project packages/preload & 5 | P2=$! 6 | ./node_modules/.bin/tsc --watch --noEmit --project packages/renderer & 7 | P3=$! 8 | wait $P1 $P2 $P3 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Haveno User Interface 2 | 3 | ## Development 4 | 5 | ### Prerequisites 6 | 7 | 1. Node 16.x 8 | 2. yarn 1.x 9 | 3. Run user1-daemon-local and envoy proxy by following [these instructions](https://github.com/haveno-dex/haveno-ts#run-tests) 10 | 11 | ### Install dependencies 12 | 13 | ```sh 14 | yarn 15 | ``` 16 | 17 | ### Configure environment variables 18 | 19 | Copy [.env.example](./.env.example) to a file called `.env` and point the environment variables to the envoy proxy. 20 | 21 | ### Start the app in watch mode 22 | 23 | ```sh 24 | yarn watch 25 | ``` 26 | 27 | ### Tests 28 | 29 | ```sh 30 | yarn test 31 | ``` 32 | 33 | ### Storybook 34 | 35 | ```sh 36 | yarn storybook 37 | ``` 38 | 39 | ### App Data Folder 40 | 41 | The UI's data folder can be cleared to reset the UI state, located at: 42 | 43 | - Mac: ~/Library/Application Support/haveno-ui/ 44 | - Linux: ~/.local/share/haveno-ui/ 45 | - Windows: ~\AppData\Roaming\haveno-ui\ -------------------------------------------------------------------------------- /buildResources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/buildResources/.gitkeep -------------------------------------------------------------------------------- /buildResources/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/buildResources/icon.icns -------------------------------------------------------------------------------- /buildResources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/buildResources/icon.png -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | module.exports = { 18 | extends: ["@commitlint/config-conventional"], 19 | }; 20 | -------------------------------------------------------------------------------- /packages/main/src/types/haveno.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export interface DownloadBackupInput { 18 | bytes: ArrayBuffer; 19 | } 20 | -------------------------------------------------------------------------------- /packages/main/src/types/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./ipc"; 18 | export * from "./store"; 19 | export * from "./haveno"; 20 | -------------------------------------------------------------------------------- /packages/main/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "esnext", 5 | "sourceMap": false, 6 | "moduleResolution": "Node", 7 | "skipLibCheck": true, 8 | "strict": true, 9 | "isolatedModules": true, 10 | "allowSyntheticDefaultImports": true, 11 | "types": ["node", "vite-plugin-svgr/client"], 12 | 13 | "baseUrl": ".", 14 | "paths": { 15 | "@src/*": ["./src/*"], 16 | "@services/*": ["./src/services/*"], 17 | "@types/*": ["./src/types/*"] 18 | } 19 | }, 20 | "include": ["src/**/*.ts", "../../types/**/*.d.ts"], 21 | "exclude": ["**/*.spec.ts", "**/*.test.ts"] 22 | } 23 | -------------------------------------------------------------------------------- /packages/main/vitest.coverage.config.js: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | /** 18 | * Config for global end-to-end tests 19 | * placed in project root tests folder 20 | * @type {import('vite').UserConfig} 21 | * @see https://vitest.dev/config/ 22 | */ 23 | const config = { 24 | test: { 25 | include: ["./src/**/*.{test,spec}.{ts,tsx}"], 26 | coverage: { 27 | reporter: ["html"], 28 | }, 29 | }, 30 | }; 31 | 32 | export default config; 33 | -------------------------------------------------------------------------------- /packages/preload/contracts.d.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | /* eslint-disable @typescript-eslint/consistent-type-imports */ 18 | 19 | interface Exposed { 20 | readonly nodeCrypto: Readonly; 21 | readonly versions: Readonly; 22 | readonly electronStore: Readonly; 23 | readonly haveno: Readonly; 24 | } 25 | 26 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 27 | interface Window extends Exposed {} 28 | -------------------------------------------------------------------------------- /packages/preload/src/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | /** 18 | * @module preload 19 | */ 20 | 21 | import "./nodeCrypto"; 22 | import "./versions"; 23 | import "./store"; 24 | import "./haveno"; 25 | -------------------------------------------------------------------------------- /packages/preload/src/nodeCrypto.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { type BinaryLike, createHash } from "crypto"; 18 | import { exposeInMainWorld } from "./exposeInMainWorld"; 19 | 20 | function sha256sum(data: BinaryLike) { 21 | return createHash("sha256").update(data).digest("hex"); 22 | } 23 | 24 | // Export for types in contracts.d.ts 25 | export const nodeCrypto = { sha256sum } as const; 26 | 27 | exposeInMainWorld("nodeCrypto", nodeCrypto); 28 | -------------------------------------------------------------------------------- /packages/preload/src/types/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "../../../main/src/types"; 18 | -------------------------------------------------------------------------------- /packages/preload/src/versions.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { exposeInMainWorld } from "./exposeInMainWorld"; 18 | 19 | // Export for types in contracts.d.ts 20 | export const versions = process.versions; 21 | 22 | exposeInMainWorld("versions", versions); 23 | -------------------------------------------------------------------------------- /packages/preload/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "esnext", 5 | "sourceMap": false, 6 | "moduleResolution": "Node", 7 | "skipLibCheck": true, 8 | "strict": true, 9 | "isolatedModules": true, 10 | 11 | "types": ["node"], 12 | 13 | "baseUrl": "." 14 | }, 15 | "include": ["src/**/*.ts", "contracts.d.ts", "../../types/**/*.d.ts"], 16 | "exclude": ["**/*.spec.ts", "**/*.test.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /packages/preload/vitest.coverage.config.js: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | /** 18 | * Config for global end-to-end tests 19 | * placed in project root tests folder 20 | * @type {import('vite').UserConfig} 21 | * @see https://vitest.dev/config/ 22 | */ 23 | const config = { 24 | test: { 25 | include: ["./src/**/*.{test,spec}.{ts,tsx}"], 26 | coverage: { 27 | reporter: ["html"], 28 | }, 29 | }, 30 | }; 31 | 32 | export default config; 33 | -------------------------------------------------------------------------------- /packages/renderer/assets/account.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/arrow-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/arrow-north.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/arrow-up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/arrow-west.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/check-circle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/circle-plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/ellipsis.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/eth.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/renderer/assets/eur.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/renderer/assets/fonts/Inter-Variable.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/packages/renderer/assets/fonts/Inter-Variable.ttf -------------------------------------------------------------------------------- /packages/renderer/assets/logo-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/renderer/assets/logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /packages/renderer/assets/markets.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/monero.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/renderer/assets/notification.svg: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /packages/renderer/assets/notifications.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/setting-cloud.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/renderer/assets/setting-server.svg: -------------------------------------------------------------------------------- 1 | 2 | server 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/renderer/assets/trades.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/renderer/assets/unknown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/renderer/assets/xmr-logo-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/renderer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | Haveno 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/AppProviders/QueryClientProvider.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { QueryClient, QueryClientProvider as QCProvider } from "react-query"; 18 | import type { FC } from "react"; 19 | 20 | const queryClient = new QueryClient({ 21 | defaultOptions: { 22 | queries: { 23 | refetchOnWindowFocus: false, 24 | staleTime: 60 * 1000, // 60 sec 25 | }, 26 | }, 27 | }); 28 | 29 | export const QueryClientProvider: FC = ({ children }) => ( 30 | {children} 31 | ); 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/AppProviders/ThemeProvider.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { MantineProvider, Global } from "@mantine/core"; 18 | import type { FC } from "react"; 19 | import { themeOverride, globalStyles } from "@src/theme"; 20 | 21 | export const ThemeProvider: FC = ({ children }) => { 22 | return ( 23 | 24 | 25 | {children} 26 | 27 | ); 28 | }; 29 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Buttons/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Button"; 18 | export * from "./TextButton"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/CircleIcon/CircleIcon.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { CircleIcon } from "./CircleIcon"; 20 | import { ReactComponent as ArrowNorth } from "@assets/arrow-north.svg"; 21 | 22 | describe("atoms::CircleIcon", () => { 23 | it("renders without exploding", () => { 24 | const { asFragment } = render( 25 | 26 | 27 | 28 | ); 29 | expect(asFragment()).toMatchSnapshot(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/CircleIcon/__snapshots__/CircleIcon.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::CircleIcon > renders without exploding 1`] = ` 4 | 5 |
8 | 15 | 19 | 20 |
21 |
22 | `; 23 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/ConnectionProgress/ConnectionProgress.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { ConnectionProgress } from "."; 20 | import { AppProviders } from "@atoms/AppProviders"; 21 | 22 | describe("atoms::ConnectionProgress", () => { 23 | it("renders without exploding", () => { 24 | const { asFragment } = render( 25 | 26 | 27 | 28 | ); 29 | expect(asFragment()).toMatchSnapshot(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/ConnectionProgress/__snapshots__/ConnectionProgress.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::ConnectionProgress > renders without exploding 1`] = ` 4 | 5 |
8 |
11 | Connecting to Monero Network 12 |
13 |
16 |
19 |
20 |
21 | 22 | `; 23 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/ConnectionProgress/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./ConnectionProgress"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Currency/__snapshots__/Currency.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::Currency > renders currency value 1`] = ` 4 | 5 | USD 10.00 6 | 7 | `; 8 | 9 | exports[`atoms::Currency > renders decimal value 1`] = ` 10 | 11 | 10.12345678 12 | 13 | `; 14 | 15 | exports[`atoms::Currency > renders without exploding 1`] = ` 16 | 17 | 10.00 18 | 19 | `; 20 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Currency/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Currency"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/DetailItem/__snapshots__/DetailItem.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::DetailItem > renders without exploding 1`] = ` 4 | 5 |
8 |
11 | Label 12 |
13 |
16 | Content 17 |
18 |
19 |
20 | `; 21 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/DetailItem/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./DetailItem"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/DetailItemCard/index.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./DetailItemCard"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Header/Header.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { Stack } from "@mantine/core"; 18 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 19 | import { HeaderWithLogo } from "."; 20 | 21 | export default { 22 | title: "atoms/Header", 23 | component: HeaderWithLogo, 24 | } as ComponentMeta; 25 | 26 | const Template: ComponentStory = () => { 27 | return ( 28 | 29 | 30 | 31 | ); 32 | }; 33 | 34 | export const Default = Template.bind({}); 35 | Default.args = {}; 36 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Header/HeaderWithLogo.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { HeaderWithLogo } from "."; 20 | import { AppProviders } from "@atoms/AppProviders"; 21 | 22 | describe("atoms::HeaderWithLogo", () => { 23 | it("renders without exploding", () => { 24 | const { asFragment } = render( 25 | 26 | 27 | 28 | ); 29 | expect(asFragment()).toMatchSnapshot(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Header/HeaderWithLogo.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { Box } from "@mantine/core"; 18 | import Logo from "@assets/logo.svg"; 19 | 20 | export function HeaderWithLogo() { 21 | return ( 22 | 27 | Haveno 28 | 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Header/__snapshots__/HeaderWithLogo.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::HeaderWithLogo > renders without exploding 1`] = ` 4 | 5 |
8 | Haveno 13 |
14 |
15 | `; 16 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Header/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./HeaderWithLogo"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Link/Link.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { Link } from "."; 20 | import { AppProviders } from "@atoms/AppProviders"; 21 | 22 | describe("atoms::Link", () => { 23 | it("renders without exploding", () => { 24 | const { asFragment } = render( 25 | 26 | Click me 27 | 28 | ); 29 | expect(asFragment()).toMatchSnapshot(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Link/__snapshots__/Link.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::Link > renders without exploding 1`] = ` 4 | 5 | 8 | 11 | Click me 12 | 13 | 14 | 15 | `; 16 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Link/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Link"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Modal/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Modal"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/MoneroNodeListItem/__snapshots__/MoneroNodeListItem.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::MoneroNodeListItem > renders without exploding 1`] = ` 4 | 5 | 22 | 39 | 40 | `; 41 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/MoneroNodeListItem/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MoneroNodeListItem"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/PasswordInput/PasswordInput.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { PasswordInput } from "."; 20 | 21 | describe("atoms::PasswordInput", () => { 22 | it("renders without exploding", () => { 23 | const { asFragment } = render( 24 | 25 | ); 26 | expect(asFragment()).toMatchSnapshot(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/PasswordInput/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./PasswordInput"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/ProtectedRoute/__snapshots__/ProtectedRoute.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::ProtectedRoute > renders children if auth session exists 1`] = ` 4 | 5 |
6 | Protected content 7 |
8 |
9 | `; 10 | 11 | exports[`atoms::ProtectedRoute > skips rendering children and redirects to login if auth session can't be retrieved 1`] = ``; 12 | 13 | exports[`atoms::ProtectedRoute > skips rendering children and redirects to login if no auth session exists 1`] = ``; 14 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/ProtectedRoute/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./ProtectedRoute"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Select/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Select"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/SyncStatus/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./SyncStatus"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Tabs/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Tabs"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/TextInput/TextInput.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { TextInput } from "."; 20 | 21 | describe("atoms::TextInput", () => { 22 | it("renders without exploding", () => { 23 | const { asFragment } = render( 24 | 30 | ); 31 | expect(asFragment()).toMatchSnapshot(); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/TextInput/__snapshots__/TextInput.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`atoms::TextInput > renders without exploding 1`] = ` 4 | 5 |
8 | 15 |
18 | 25 |
26 |
27 |
28 | `; 29 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/TextInput/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./TextInput"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/ToggleButton/ToggleButton.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { ToggleButton } from "./ToggleButton"; 19 | 20 | export default { 21 | title: "atoms/ToggleButton", 22 | component: ToggleButton, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = (args) => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | 31 | Default.args = { 32 | labels: ["Sell XMR", "Buy XMR"], 33 | }; 34 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Typography/Anchor.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { Anchor as MAnchor, createStyles } from "@mantine/core"; 18 | import type { AnchorProps as MAnchorProps } from "@mantine/core"; 19 | 20 | export function Anchor(props: MAnchorProps<"a">) { 21 | const { classes, cx } = useStyles(); 22 | 23 | return ; 24 | } 25 | 26 | const useStyles = createStyles((theme) => ({ 27 | anchor: { 28 | color: theme.colors.blue[6], 29 | }, 30 | })); 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/atoms/Typography/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Heading"; 18 | export * from "./Text"; 19 | export * from "./Anchor"; 20 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/AddressCard/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./AddressCard"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/NodeConnectSwitch/index.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./NodeConnectSwitch"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/PaymentMethodCard/__snapshots__/AddPaymentMethodButton.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`molecules::AddPaymentMethodButton > renders without exploding 1`] = ` 4 | 5 | 23 | 24 | `; 25 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/PaymentMethodCard/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | // TODO @subir: move this to @constants/currencies 18 | export type SupportedCurrencies = "BTC" | "ETH" | "EUR"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/PaymentMethodCard/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./AddPaymentMethodButton"; 18 | export * from "./PaymentMethodCard"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/ReadyToUse/__snapshots__/ReadyToUse.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`molecules::ReadyToUse > renders without exploding 1`] = ` 4 | 5 |
8 |

11 | Haveno is ready for use. 12 |

13 |
16 | You’ve succesfully set up Haveno. Please note that to be able to trade, you need to deposit Monero in your Haveno wallet and set up a payment account. 17 |
18 |
21 |
24 | 38 |
39 |
40 | 41 | `; 42 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/ReadyToUse/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./ReadyToUse"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/SecondarySidebar/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./SecondarySidebar"; 18 | export * from "./SecondarySidebarItem"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/Table/__snapshots__/Table.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1 2 | 3 | exports[`molecules::Table > renders without exploding. 1`] = ` 4 | 5 | 8 | 9 | 10 | 16 | 17 | 18 | 24 | 30 | 31 | 32 | 33 | 34 | 39 | 44 | 45 | 46 |
14 | Name 15 |
22 | First Name 23 | 28 | Last Name 29 |
37 | Ahmed 38 | 42 | Subir 43 |
47 |
48 | `; 49 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/Table/_utils.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export const updateTableCell = ( 18 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 19 | data: Array, 20 | rowIndex: number, 21 | columnId: string, 22 | value: unknown 23 | ) => { 24 | return data.map((row, index) => { 25 | if (index === rowIndex) { 26 | return { 27 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 28 | ...data[rowIndex]!, 29 | [columnId]: value, 30 | }; 31 | } 32 | return row; 33 | }); 34 | }; 35 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/Table/cells/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./CheckboxCell"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/Table/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./_types"; 18 | export * from "./Table"; 19 | export * from "./cells"; 20 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/WalletBalance/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./WalletBalance"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/WalletTransactions/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export enum WalletTransactionType { 18 | Sent = "Sent", 19 | Received = "Received", 20 | } 21 | 22 | export interface TWalletTransaction { 23 | type: WalletTransactionType; 24 | timestamp: number | Date; 25 | 26 | amount: number; 27 | amountCurrency: string; 28 | 29 | foreignAmount?: number; 30 | foreignAmountCurrency?: string; 31 | 32 | transactionId: string; 33 | 34 | destinationAddresses?: Array; 35 | incomingAddresses?: Array; 36 | 37 | fee: number; 38 | height: number; 39 | } 40 | -------------------------------------------------------------------------------- /packages/renderer/src/components/molecules/WalletTransactions/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./WalletTransactions"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AccountSidebar/AccountSidebar.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { AccountSidebar } from "./AccountSidebar"; 19 | 20 | export default { 21 | title: "organisms/AccountSidebar", 22 | component: AccountSidebar, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AccountSidebar/AccountSidebar.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { AccountSidebar } from "./AccountSidebar"; 20 | import { AppProviders } from "@atoms/AppProviders"; 21 | 22 | describe("molecules::AccountSidebar", () => { 23 | it("renders without exploding", () => { 24 | const { asFragment } = render( 25 | 26 | 27 | 28 | ); 29 | expect(asFragment()).toMatchSnapshot(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AccountSidebar/_constants.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export const WIDTH = 210; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AccountSidebar/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./AccountSidebar"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AddNode/AddNode.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { AddNode } from "."; 19 | 20 | export default { 21 | title: "organisms/Add Node", 22 | component: AddNode, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = (args) => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = { 31 | isLoading: false, 32 | onSubmit: (values) => console.log(values), 33 | showTitle: true, 34 | }; 35 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AddNode/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./AddNode"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AddPaymentMethod/AddPaymentMethod.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { AddPaymentMethod } from "."; 19 | 20 | export default { 21 | title: "organisms/Add Payment Method", 22 | component: AddPaymentMethod, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AddPaymentMethod/AddPaymentMethod.test.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { describe, expect, it } from "vitest"; 18 | import { render } from "@testing-library/react"; 19 | import { AddPaymentMethod } from "."; 20 | 21 | describe("organisms::AddPaymentMethod", () => { 22 | it("renders without exploding", () => { 23 | const { asFragment } = render(); 24 | expect(asFragment()).toMatchSnapshot(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/AddPaymentMethod/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./AddPaymentMethod"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/ChangePassword/ChangePassword.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { ChangePassword } from "."; 19 | 20 | export default { 21 | title: "organisms/Change Password", 22 | component: ChangePassword, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/ChangePassword/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export interface ChangePasswordFormValues { 18 | currentPassword: string; 19 | newPassword: string; 20 | confirmPassword: string; 21 | } 22 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/ChangePassword/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./ChangePassword"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersFilterAccountsForm/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersFilterAccountsForm"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersFilterAmountForm/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersFilterAmountForm"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersFilterBar/MarketOffersFilterBar.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { MarketOffersFilterBar } from "."; 19 | 20 | export default { 21 | title: "organisms/MarketOffersFilterBar", 22 | component: MarketOffersFilterBar, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersFilterBar/hooks/index.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./useMarketOffersPairModal"; 18 | export * from "./useMarketOffersPaymentMethods"; 19 | export * from "./useMarketOffersAccountModal"; 20 | export * from "./useMarketOffersAmountModal"; 21 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersFilterBar/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersFilterBar"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersFilterPaymentMethods/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersFilterPaymentMethods"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersPaymentMethodsTable/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export interface TMarketOfferPaymentMethod { 18 | methodChecked?: boolean; 19 | methodName: string; 20 | methodKey: string; 21 | rateTradeLimit: number; 22 | rateTradeLimitCurrency: string; 23 | info: string; 24 | } 25 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersPaymentMethodsTable/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersPaymentMethodsTable"; 18 | export type { TMarketOfferPaymentMethod } from "./_types"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersTable/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export interface MarketOffer { 18 | price: number; 19 | priceComparison: number; 20 | priceCurrency: string; 21 | amount: number; 22 | amountCurrency: string; 23 | cost: number; 24 | costCurrency: string; 25 | paymentMethod: string; 26 | accountAge: number; 27 | accountTrades: number; 28 | } 29 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersTable/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersTable"; 18 | export * from "./_types"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersTradingPair/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersTradingPair"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersTradingPairTable/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { createTable } from "@tanstack/react-table"; 18 | 19 | export interface TMarketOffersTradingPair { 20 | fromPair: string; 21 | toPair: string; 22 | lastPrice: number; 23 | lastPriceCurrency: string; 24 | dayChangeRate: number; 25 | dayChangeVolume: number; 26 | } 27 | 28 | export const marketTradingPairTable = 29 | createTable().setRowType(); 30 | 31 | export type TMarketTradingPairTable = typeof marketTradingPairTable.generics; 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersTradingPairTable/_utils.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { TMarketOffersTradingPair } from "./_types"; 18 | 19 | export const pairColumnAccessor = (row: TMarketOffersTradingPair): string => 20 | `${row.fromPair}/${row.toPair}`; 21 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketOffersTradingPairTable/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketOffersTradingPairTable"; 18 | export type { 19 | TMarketOffersTradingPair, 20 | TMarketTradingPairTable, 21 | } from "./_types"; 22 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketsOffers/MarketsOffers.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { MarketsOffers } from "./MarketsOffers"; 19 | 20 | export default { 21 | title: "organisms/MarketsOffers", 22 | component: MarketsOffers, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | 31 | Default.args = {}; 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MarketsOffers/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketsOffers"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MoneroBalance/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MoneroBalance"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletMoneroBalance/MyWalletMoneroBalance.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { MyWalletMoneroBalance } from "./MyWalletMeneroBalance"; 19 | 20 | export default { 21 | title: "organisms/MyWalletMoneroBalance", 22 | component: MyWalletMoneroBalance, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | 31 | Default.args = {}; 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletMoneroBalance/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MyWalletMeneroBalance"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletPrimaryAddress/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MyWalletPrimaryAddress"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletReceive/MyWalletReceive.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { MyWalletReceive } from "./MyWalletReceive"; 19 | 20 | export default { 21 | title: "organisms/MyWalletReceive", 22 | component: MyWalletReceive, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletReceive/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MyWalletReceive"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletSendForm/MyWalletSendForm.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { MyWalletSendForm } from "./MyWalletSendForm"; 19 | 20 | export default { 21 | title: "organisms/MyWalletSendForm", 22 | component: MyWalletSendForm, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletSendForm/_hooks.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import * as Joi from "joi"; 18 | 19 | export interface MyWalletSendFormValues { 20 | amount: string; 21 | address: string; 22 | paymentId: string; 23 | } 24 | 25 | export function useMyWalletSendFormValidation() { 26 | return Joi.object({ 27 | amount: Joi.number().required(), 28 | address: Joi.string().required(), 29 | paymentId: Joi.string().optional().empty(""), 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/MyWalletSendForm/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MyWalletSendForm"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/Navbar/Navbar.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { Stack } from "@mantine/core"; 18 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 19 | import { Navbar } from "."; 20 | 21 | export default { 22 | title: "organisms/Navbar", 23 | component: Navbar, 24 | } as ComponentMeta; 25 | 26 | const Template: ComponentStory = () => { 27 | return ( 28 | 29 | 30 | 31 | ); 32 | }; 33 | 34 | export const Default = Template.bind({}); 35 | 36 | Default.args = {}; 37 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/Navbar/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Navbar"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/PaymentMethodList/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./PaymentMethodList"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/SelectMoneroNode/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./SelectMoneroNode"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/SetPassword/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./SetPassword"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/SetPrimaryFiat/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./SetPrimaryFiat"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/WalletManagement/WalletManagement.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { WalletManagement } from "."; 19 | 20 | export default { 21 | title: "organisms/Wallet Management", 22 | component: WalletManagement, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/components/organisms/WalletManagement/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./WalletManagement"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/constants/haveno-daemon.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export const HAVENO_DAEMON_URL = 18 | import.meta.env.VITE_HAVENO_URL ?? "http://localhost:8080"; 19 | export const HAVENO_DAEMON_PASSWORD = 20 | import.meta.env.VITE_HAVENO_PASSWORD ?? "apitest"; 21 | -------------------------------------------------------------------------------- /packages/renderer/src/constants/lang/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./LangKeys"; 18 | import en from "./en"; 19 | import es from "./es"; 20 | 21 | export const SupportedLocales = { 22 | EN: "en", 23 | ES: "es", 24 | }; 25 | 26 | export const LangPack = { 27 | [SupportedLocales.EN]: en, 28 | [SupportedLocales.ES]: es, 29 | }; 30 | -------------------------------------------------------------------------------- /packages/renderer/src/constants/modals.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export enum Modals { 18 | QRCodeAddress = "QRCodeAddress", 19 | } 20 | -------------------------------------------------------------------------------- /packages/renderer/src/constants/notifications.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export enum Notifications { 18 | AccountRestoring = "AccountRestoring", 19 | MoneroRestartAfterRestoring = "MoneroRestartAfterRestoring", 20 | } 21 | -------------------------------------------------------------------------------- /packages/renderer/src/constants/sync-status.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export enum SyncStatus { 18 | Full = "Fully Synced", 19 | InProgress = "Syncing", 20 | NotSynced = "Not Synced", 21 | } 22 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useAddress.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | import { QueryKeys } from "@constants/query-keys"; 20 | 21 | export function useAddress() { 22 | const client = useHavenoClient(); 23 | return useQuery(QueryKeys.PrimaryAddress, async () => 24 | client.getXmrPrimaryAddress() 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useCreateAccount.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useMutation } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | 20 | interface Variables { 21 | password: string; 22 | } 23 | 24 | export function useCreateAccount() { 25 | const client = useHavenoClient(); 26 | return useMutation(async (variables: Variables) => 27 | client.createAccount(variables.password) 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useGetMoneroConnection.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | import { QueryKeys } from "@constants/query-keys"; 20 | 21 | export function useGetMoneroConnection() { 22 | const client = useHavenoClient(); 23 | return useQuery(QueryKeys.MoneroConnection, async () => 24 | client.getMoneroConnection() 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useHavenoClient.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useRef } from "react"; 18 | import { HavenoClient } from "haveno-ts"; 19 | import { 20 | HAVENO_DAEMON_PASSWORD, 21 | HAVENO_DAEMON_URL, 22 | } from "@constants/haveno-daemon"; 23 | 24 | let havenoClient: HavenoClient; 25 | 26 | export function useHavenoClient() { 27 | const client = useRef(havenoClient); 28 | if (!client.current) { 29 | client.current = havenoClient = new HavenoClient( 30 | HAVENO_DAEMON_URL, 31 | HAVENO_DAEMON_PASSWORD 32 | ); 33 | } 34 | return client.current; 35 | } 36 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useHavenoVersion.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | import { QueryKeys } from "@constants/query-keys"; 20 | 21 | export function useHavenoVersion() { 22 | const client = useHavenoClient(); 23 | return useQuery(QueryKeys.HavenoVersion, async () => client.getVersion()); 24 | } 25 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useMoneroNodeSettings.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import type { MoneroNodeSettings } from "haveno-ts"; 19 | import { useHavenoClient } from "./useHavenoClient"; 20 | import { QueryKeys } from "@constants/query-keys"; 21 | 22 | export function useMoneroNodeSettings() { 23 | const client = useHavenoClient(); 24 | return useQuery( 25 | QueryKeys.MoneroNodeSettings, 26 | async () => client.getMoneroNodeSettings() 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/usePrices.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import type { MarketPriceInfo } from "haveno-ts"; 19 | import { useHavenoClient } from "./useHavenoClient"; 20 | import { QueryKeys } from "@constants/query-keys"; 21 | 22 | export function usePrices() { 23 | const client = useHavenoClient(); 24 | return useQuery, Error>( 25 | QueryKeys.Prices, 26 | async () => { 27 | const prices = await client.getPrices(); 28 | return prices.map((price) => price.toObject()); 29 | } 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useSetDownloadQRCode.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useMutation } from "react-query"; 18 | 19 | export function useSetDownloadQRCode() { 20 | return useMutation(async (code: string) => { 21 | await window.haveno.downloadQRCode(code); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useSetXmrNewSubaddress.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useMutation } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | 20 | export function useSetXmrNewSubaddress() { 21 | const client = useHavenoClient(); 22 | 23 | return useMutation(async () => { 24 | return client.getXmrNewSubaddress(); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useStopMoneroNode.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useMutation, useQueryClient } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | import { QueryKeys } from "@constants/query-keys"; 20 | 21 | export function useStopMoneroNode() { 22 | const queryClient = useQueryClient(); 23 | const client = useHavenoClient(); 24 | 25 | return useMutation(async () => client.stopMoneroNode(), { 26 | onSuccess: () => { 27 | queryClient.invalidateQueries(QueryKeys.MoneroNodeIsRunning); 28 | }, 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useSyncStatus.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { QueryKeys } from "@constants/query-keys"; 19 | import { SyncStatus } from "@constants/sync-status"; 20 | // import { useHavenoClient } from "./useHavenoClient"; 21 | 22 | export function useSyncStatus() { 23 | // const client = useHavenoClient(); 24 | return useQuery( 25 | QueryKeys.SyncStatus, 26 | async () => { 27 | // TODO: this is a stub 28 | return SyncStatus.NotSynced; 29 | }, 30 | { 31 | staleTime: 10_000, 32 | } 33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useXmrPrimaryAddress.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | import { QueryKeys } from "@constants/query-keys"; 20 | 21 | export const useXmrPrimaryAddress = () => { 22 | const client = useHavenoClient(); 23 | 24 | return useQuery(QueryKeys.XmrPrimaryAddress, async () => 25 | client.getXmrPrimaryAddress() 26 | ); 27 | }; 28 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useXmrSeed.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { useHavenoClient } from "./useHavenoClient"; 19 | import { QueryKeys } from "@constants/query-keys"; 20 | 21 | export function useXmrSeed() { 22 | const client = useHavenoClient(); 23 | return useQuery(QueryKeys.XmrSeed, async () => { 24 | return client.getXmrSeed(); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/haveno/useXmrTxs.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import type { XmrTx } from "haveno-ts"; 19 | import { useHavenoClient } from "./useHavenoClient"; 20 | import { QueryKeys } from "@constants/query-keys"; 21 | 22 | export const useXmrTxs = () => { 23 | const client = useHavenoClient(); 24 | 25 | return useQuery>(QueryKeys.XmrTxs, async () => { 26 | const txs = await client.getXmrTxs(); 27 | 28 | return txs?.map((tx) => tx.toObject()); 29 | }); 30 | }; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/session/useAuth.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { QueryKeys } from "@constants/query-keys"; 19 | import { validateSession } from "@utils/session"; 20 | 21 | export function useAuth() { 22 | return useQuery( 23 | QueryKeys.AuthSession, 24 | async () => { 25 | if (await validateSession()) { 26 | return true; 27 | } 28 | return false; 29 | }, 30 | { 31 | staleTime: 60000, 32 | retry: false, 33 | } 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/session/useLogin.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useMutation } from "react-query"; 18 | import { createSession } from "@src/utils/session"; 19 | 20 | interface Variables { 21 | password: string; 22 | } 23 | 24 | export function useLogin() { 25 | return useMutation(async (variables: Variables) => { 26 | const authToken = await window.electronStore.verifyPassword( 27 | variables.password 28 | ); 29 | if (!authToken) { 30 | throw new Error("Invalid password"); 31 | } 32 | createSession(authToken); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/storage/useAccountInfo.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { QueryKeys } from "@constants/query-keys"; 19 | import type { AccountInfoDto } from "@src/types"; 20 | 21 | export function useAccountInfo() { 22 | return useQuery( 23 | QueryKeys.StorageAccountInfo, 24 | async () => window.electronStore.getAccountInfo() 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/storage/useIsLocalNodeSelected.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useEffect, useState } from "react"; 18 | import { usePreferences } from "./usePreferences"; 19 | 20 | export function useIsLocalNodeSelected() { 21 | const [data, setData] = useState(false); 22 | const { data: preferences, ...rest } = usePreferences(); 23 | useEffect(() => { 24 | setData(!preferences?.selectedNode); 25 | }, [preferences]); 26 | return { data, ...rest }; 27 | } 28 | -------------------------------------------------------------------------------- /packages/renderer/src/hooks/storage/usePreferences.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useQuery } from "react-query"; 18 | import { QueryKeys } from "@constants/query-keys"; 19 | import type { IPreferences } from "@src/types"; 20 | 21 | export function usePreferences() { 22 | return useQuery(QueryKeys.StoragePreferences, async () => 23 | window.electronStore.getPreferences() 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /packages/renderer/src/index.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { StrictMode } from "react"; 18 | import ReactDOM from "react-dom"; 19 | import { AppRoutes } from "./Routes"; 20 | import { AppProviders } from "@atoms/AppProviders"; 21 | 22 | ReactDOM.render( 23 | 24 | 25 | 26 | 27 | , 28 | document.getElementById("app") 29 | ); 30 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/AddPaymentAccount.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { AddPaymentMethod as AddPaymentMethodOrganism } from "@organisms/AddPaymentMethod"; 18 | import { AccountLayout } from "@templates/AccountLayout"; 19 | 20 | export function AddPaymentAccount() { 21 | return ( 22 | 23 | 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/PaymentAccounts.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useNavigate } from "react-router-dom"; 18 | import { ROUTES } from "@constants/routes"; 19 | import { PaymentMethodList } from "@organisms/PaymentMethodList"; 20 | import { AccountLayout } from "@templates/AccountLayout"; 21 | 22 | export function PaymentAccounts() { 23 | const navigate = useNavigate(); 24 | return ( 25 | 26 | navigate(ROUTES.AddPaymentAccount)} /> 27 | 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/PaymentMethods.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { useNavigate } from "react-router-dom"; 18 | import { PaymentMethodList } from "@organisms/PaymentMethodList"; 19 | import { NavbarLayout } from "@templates/NavbarLayout"; 20 | import { ROUTES } from "@constants/routes"; 21 | 22 | export function PaymentMethods() { 23 | const navigate = useNavigate(); 24 | 25 | return ( 26 | 27 | navigate(ROUTES.AddPaymentAccount)} /> 28 | 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/Settings/_hooks.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import Joi from "joi"; 18 | import type { LocalSettingsFormValues } from "./_types"; 19 | 20 | export function useLocalSettingsValidation() { 21 | return Joi.object({ 22 | blockchainLocation: Joi.string().empty("").uri({ relativeOnly: true }), 23 | startupFlags: Joi.string().empty(""), 24 | bootstrapUrl: Joi.string().allow("").uri({ allowRelative: false }), 25 | port: Joi.number().allow("").port(), 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/Settings/_types.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export interface LocalSettingsFormValues { 18 | blockchainLocation: string; 19 | startupFlags: string; 20 | bootstrapUrl: string; 21 | port: string; 22 | } 23 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/Settings/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Settings"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Account/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./AddPaymentAccount"; 18 | export * from "./PaymentMethods"; 19 | export * from "./Settings"; 20 | export * from "./PaymentAccounts"; 21 | export * from "./Security"; 22 | export * from "./Wallet"; 23 | export * from "./AccountBackup"; 24 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Home/Home.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { Home } from "."; 19 | 20 | export default { 21 | title: "pages/Home", 22 | component: Home, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Home/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Home"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Login/Login.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { Login } from "."; 19 | 20 | export default { 21 | title: "pages/Login", 22 | component: Login, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Login/_constants.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export const CONTENT_MAX_WIDTH = 470; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Login/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./Login"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Markets/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MarketsOffers"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/MyWallet/MyWallet.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import { Stack } from "@mantine/core"; 18 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 19 | import { MyWallet } from "./MyWallet"; 20 | 21 | export default { 22 | title: "pages/MyWallet", 23 | component: MyWallet, 24 | } as ComponentMeta; 25 | 26 | const Template: ComponentStory = () => { 27 | return ( 28 | 29 | 30 | 31 | ); 32 | }; 33 | 34 | export const Default = Template.bind({}); 35 | 36 | Default.args = {}; 37 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/MyWallet/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./MyWallet"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Onboarding/ConnectingMonero.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { ConnectingMonero } from "."; 19 | 20 | export default { 21 | title: "pages/Onboarding/Connecting Monero", 22 | component: ConnectingMonero, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Onboarding/CreateAccount.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { CreateAccount } from "."; 19 | 20 | export default { 21 | title: "pages/Onboarding/Create Account", 22 | component: CreateAccount, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Onboarding/Welcome.stories.tsx: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { ComponentStory, ComponentMeta } from "@storybook/react"; 18 | import { Welcome } from "."; 19 | 20 | export default { 21 | title: "pages/Onboarding/Welcome", 22 | component: Welcome, 23 | } as ComponentMeta; 24 | 25 | const Template: ComponentStory = () => { 26 | return ; 27 | }; 28 | 29 | export const Default = Template.bind({}); 30 | Default.args = {}; 31 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Onboarding/_constants.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export const CONTENT_MAX_WIDTH = 470; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/pages/Onboarding/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./ConnectingMonero"; 18 | export * from "./CreateAccount"; 19 | export * from "./Welcome"; 20 | -------------------------------------------------------------------------------- /packages/renderer/src/state/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/packages/renderer/src/state/.gitkeep -------------------------------------------------------------------------------- /packages/renderer/src/theme/global-styles.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | import type { CSSObject } from "@emotion/react"; 18 | import InterFont from "@assets/fonts/Inter-Variable.ttf"; 19 | 20 | export const globalStyles: CSSObject = { 21 | "@font-face": { 22 | fontFamily: "Inter", 23 | src: `url('${InterFont}')`, 24 | fontWeight: "100 800", 25 | fontStyle: "normal italic", 26 | }, 27 | "*, *::before, *::after": { 28 | boxSizing: "border-box", 29 | }, 30 | body: { 31 | margin: 0, 32 | padding: 0, 33 | }, 34 | "#app": { 35 | display: "flex", 36 | minHeight: "100vh", 37 | }, 38 | }; 39 | -------------------------------------------------------------------------------- /packages/renderer/src/theme/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "./global-styles"; 18 | export * from "./override"; 19 | -------------------------------------------------------------------------------- /packages/renderer/src/types/index.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export * from "../../../main/src/types/store"; 18 | -------------------------------------------------------------------------------- /packages/renderer/src/utils/getIpcError.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | const REGEX = /\[\[(.+)\]\]/; 18 | 19 | export function getIpcError(err: Error, fallback?: string) { 20 | const message = err?.message; 21 | if (message && REGEX.test(message)) { 22 | const matches = message.match(REGEX); 23 | if (matches && matches[1] && matches[1].length) { 24 | return matches[1]; 25 | } 26 | const index = message.lastIndexOf("Error:"); 27 | return index !== -1 28 | ? message.slice(index + 6) 29 | : fallback ?? "Something went wrong"; 30 | } 31 | return fallback ?? "Something went wrong"; 32 | } 33 | -------------------------------------------------------------------------------- /packages/renderer/src/utils/math.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export const fractionToPercent = (value: number) => { 18 | return value * 100; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/renderer/src/utils/session.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | const SESSION_KEY = "AUTH_TOKEN"; 18 | 19 | export async function createSession(authToken: string) { 20 | window.sessionStorage.setItem(SESSION_KEY, authToken); 21 | } 22 | 23 | export async function validateSession(): Promise { 24 | const token = window.sessionStorage.getItem(SESSION_KEY); 25 | if (!token) { 26 | return false; 27 | } 28 | return window.electronStore.verifyAuthToken(token); 29 | } 30 | 31 | export async function deleteSession() { 32 | window.sessionStorage.removeItem(SESSION_KEY); 33 | } 34 | -------------------------------------------------------------------------------- /packages/renderer/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/packages/renderer/tests/.gitkeep -------------------------------------------------------------------------------- /packages/renderer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "esnext", 5 | "sourceMap": false, 6 | "moduleResolution": "Node", 7 | "skipLibCheck": true, 8 | "strict": true, 9 | "isolatedModules": true, 10 | "types": ["node", "vite-plugin-svgr/client"], 11 | "jsx": "react-jsx", 12 | "allowSyntheticDefaultImports": true, 13 | "esModuleInterop": true, 14 | "baseUrl": "./src", 15 | "paths": { 16 | "@assets/*": ["../assets/*"], 17 | "@atoms/*": ["components/atoms/*"], 18 | "@constants/*": ["constants/*"], 19 | "@hooks/*": ["hooks/*"], 20 | "@molecules/*": ["components/molecules/*"], 21 | "@organisms/*": ["components/organisms/*"], 22 | "@pages/*": ["pages/*"], 23 | "@src/*": ["./*"], 24 | "@templates/*": ["components/templates/*"], 25 | "@utils/*": ["utils/*"] 26 | }, 27 | "lib": ["ESNext", "dom", "dom.iterable"] 28 | }, 29 | 30 | "include": [ 31 | "src/**/*.ts", 32 | "src/**/*.tsx", 33 | "types/**/*.d.ts", 34 | "../../types/**/*.d.ts", 35 | "../preload/contracts.d.ts", 36 | "../../tests/setup-tests.ts", 37 | "../../tests/global-setup.ts" 38 | ], 39 | "exclude": ["**/*.spec.ts", "**/*.test.ts"] 40 | } 41 | -------------------------------------------------------------------------------- /packages/renderer/types/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haveno-dex/haveno-ui/1cd1ecfe6b65ece5462383de6ebf4b51cb92b830/packages/renderer/types/.gitkeep -------------------------------------------------------------------------------- /tests/global-setup.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | export default function () { 18 | process.env.TZ = "UTC"; 19 | } 20 | -------------------------------------------------------------------------------- /tests/setup-tests.ts: -------------------------------------------------------------------------------- 1 | // ============================================================================= 2 | // Copyright 2022 Haveno 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // ============================================================================= 16 | 17 | /* eslint-disable @typescript-eslint/no-namespace,@typescript-eslint/no-explicit-any */ 18 | import { expect } from "vitest"; 19 | import matchers from "@testing-library/jest-dom/matchers"; 20 | import type { TestingLibraryMatchers } from "@testing-library/jest-dom/matchers"; 21 | 22 | declare global { 23 | namespace Vi { 24 | interface JestAssertion 25 | extends jest.Matchers, 26 | TestingLibraryMatchers {} 27 | } 28 | } 29 | 30 | expect.extend(matchers); 31 | --------------------------------------------------------------------------------