From a8044f2c4ad2e5812acaf39c8e48508c7e38e2b3 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 26 Dec 2024 18:39:08 +0300 Subject: [PATCH 01/28] Fix missing image_quality config, remove unused configs (#2962) --- packages/examples/cvat/exchange-oracle/src/.env.template | 2 +- packages/examples/cvat/exchange-oracle/src/core/config.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/examples/cvat/exchange-oracle/src/.env.template b/packages/examples/cvat/exchange-oracle/src/.env.template index 65a0e3966f..b4a0d5afc9 100644 --- a/packages/examples/cvat/exchange-oracle/src/.env.template +++ b/packages/examples/cvat/exchange-oracle/src/.env.template @@ -69,7 +69,7 @@ CVAT_ADMIN_USER_ID= CVAT_INCOMING_WEBHOOKS_URL= CVAT_WEBHOOK_SECRET= CVAT_ORG_SLUG= -CVAT_TASK_SEGMENT_SIZE= +CVAT_IMAGE_QUALITY= CVAT_MAX_JOBS_PER_TASK= CVAT_TASK_CREATION_CHECK_INTERVAL= CVAT_MAX_VALIDATION_CHECKS= diff --git a/packages/examples/cvat/exchange-oracle/src/core/config.py b/packages/examples/cvat/exchange-oracle/src/core/config.py index 951d51f2f9..393e3aa600 100644 --- a/packages/examples/cvat/exchange-oracle/src/core/config.py +++ b/packages/examples/cvat/exchange-oracle/src/core/config.py @@ -163,9 +163,7 @@ class CvatConfig: admin_pass = getenv("CVAT_ADMIN_PASS", "admin") org_slug = getenv("CVAT_ORG_SLUG", "") - job_overlap = int(getenv("CVAT_JOB_OVERLAP", 0)) - task_segment_size = int(getenv("CVAT_TASK_SEGMENT_SIZE", 150)) - default_image_quality = int(getenv("CVAT_DEFAULT_IMAGE_QUALITY", 70)) + image_quality = int(getenv("CVAT_IMAGE_QUALITY", 70)) max_jobs_per_task = int(getenv("CVAT_MAX_JOBS_PER_TASK", 1000)) task_creation_check_interval = int(getenv("CVAT_TASK_CREATION_CHECK_INTERVAL", 5)) From 1c751989f83081b9d6d0997b35474ab05b156066 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 27 Dec 2024 17:19:45 +0300 Subject: [PATCH 02/28] Fix invalid total job count computation (#2963) --- .../src/handlers/process_intermediate_results.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py b/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py index 7d090dd6b5..f97534dae1 100644 --- a/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py +++ b/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py @@ -526,7 +526,7 @@ def _check_warmup_annotation_speed(self): rejected_jobs = validation_result.rejected_jobs current_iteration = self.task.iteration + 1 - total_jobs_count = len(validation_result.job_results) + total_jobs_count = len(self.annotation_meta.jobs) completed_jobs_count = total_jobs_count - len(rejected_jobs) current_progress = completed_jobs_count / (total_jobs_count or 1) * 100 if ( @@ -539,7 +539,7 @@ def _check_warmup_annotation_speed(self): f"Escrow validation failed for escrow_address={self.task.escrow_address}:" f" progress is too slow. Min required {Config.validation.min_warmup_progress:.2f}%" f" after the first {Config.validation.warmup_iterations} iterations," - f" got {current_progress:2f} after the {current_iteration} iteration." + f" got {current_progress:.2f} after the {current_iteration} iteration." " Annotation will be stopped for a manual review." ) raise TooSlowAnnotationError( From d4d0b98f18021ae355a9f57976bed0ec17aacce8 Mon Sep 17 00:00:00 2001 From: adrian-oleskiewicz Date: Fri, 3 Jan 2025 11:33:29 +0100 Subject: [PATCH 03/28] [Human App] refactor: frontend files structure (#2933) --- .../frontend/src/api/fetch-refresh-token.ts | 4 +- .../human-app/frontend/src/api/fetcher.ts | 4 +- .../use-access-token-refresh.ts | 6 +- .../use-prepare-signature.ts} | 0 .../frontend/src/api/services/enums.ts | 3 - .../api/{services => utils}/test.schema.ts | 0 .../api/{services => utils}/test.service.ts | 0 .../data-entry/input-masks/input-masks.ts | 9 -- packages/apps/human-app/frontend/src/main.tsx | 18 +-- .../components}/wallet-connect-modal.tsx | 8 +- .../auth-web3/context}/web3-auth-context.tsx | 6 +- .../auth-web3/hooks}/use-connected-wallet.tsx | 2 +- .../auth-web3/hooks}/use-web3-auth.tsx | 2 +- .../hooks}/use-web3-authenticated-user.tsx | 2 +- .../providers}/require-wallet-connect.tsx | 6 +- .../providers}/require-web3-auth.tsx | 6 +- .../auth/components}/expiration-modal.tsx | 12 +- .../auth/context}/auth-context.tsx | 6 +- .../{auth => modules/auth/hooks}/use-auth.ts | 2 +- .../auth/hooks}/use-authenticated-user.tsx | 2 +- .../auth/providers}/require-auth.tsx | 6 +- .../homepage/components/chat.tsx | 2 +- .../choose-sign-up-account-type.tsx | 14 +- .../homepage/components/home-container.tsx | 4 +- .../homepage/components/welcome.tsx | 16 +-- .../homepage/components/worker-signin.tsx | 2 +- .../homepage/hooks/use-operator-signin.tsx} | 10 +- .../homepage/views}/home.page.tsx | 14 +- .../profile/profile-disable-button.tsx | 10 +- .../profile/profile-enable-button.tsx | 2 +- .../add-keys/edit-existing-keys-form.tsx | 23 +-- .../add-keys/edit-pending-keys-form.tsx | 17 ++- .../sign-up/add-keys/existing-keys-form.tsx | 12 +- .../sign-up/add-keys/existing-keys.tsx | 20 +-- .../sign-up/add-keys/pending-keys-form.tsx | 12 +- .../components}/sign-up/add-keys/sort-form.ts | 4 +- .../components}/sign-up/add-stake/buttons.tsx | 2 +- .../sign-up/add-stake/stake-form.tsx | 10 +- .../hooks/use-add-stake-mutation-state.ts | 19 +++ .../operator/hooks/use-add-stake.ts} | 36 ++--- .../operator/hooks/use-disable-operator.ts} | 6 +- .../operator/hooks/use-edit-existing-keys.ts} | 10 +- .../operator/hooks/use-get-keys.ts} | 8 +- .../operator/hooks/use-get-stacked-amount.ts} | 6 +- .../operator/hooks/use-get-stats.ts} | 2 +- .../hooks/use-human-token-decimals.ts} | 6 +- .../operator/hooks/use-web3-signin.ts} | 8 +- .../operator/hooks/use-web3-signup.ts} | 4 +- .../operator/views}/profile/profile.page.tsx | 21 +-- .../operator/views/sign-up}/add-keys.page.tsx | 27 ++-- .../views/sign-up}/add-stake.page.tsx | 24 ++-- .../views}/sign-up/connect-wallet.page.tsx | 10 +- .../edit-existing-keys-success.page.tsx | 20 ++- .../views/sign-up/set-up-operator.page.tsx} | 8 +- .../modal-example/modal-example.tsx | 0 .../table-example/table-example.tsx | 10 ++ .../table-example/table-search-form.tsx | 4 +- .../table-example/table-service.tsx | 0 .../components}/table-example/table.tsx | 14 +- .../playground/views}/playground.page.tsx | 4 +- .../smart-contracts/EthKVStore/config.ts | 0 .../EthKVStore/eth-kv-store-get-keys.ts | 8 +- .../EthKVStore/eth-kv-store-get-kyc-data.ts | 12 +- .../EthKVStore/eth-kv-store-set-bulk.ts | 8 +- .../HMToken/hm-token-allowance.ts | 6 +- .../HMToken/hm-token-approve.ts | 6 +- .../HMToken/hm-token-decimals.ts | 6 +- .../Staking/staking-get-staked-tokens.ts | 6 +- .../smart-contracts/Staking/staking-stake.ts | 6 +- .../smart-contracts/abi/EthKVStore.json | 0 .../smart-contracts/abi/HMToken.json | 0 .../smart-contracts/abi/Staking.json | 0 .../{ => modules}/smart-contracts/chains.ts | 2 +- .../smart-contracts/check-network.ts | 2 +- .../smart-contracts/contracts.ts | 0 .../smart-contracts/get-contract-address.ts | 4 +- .../smart-contracts/get-network-name.ts | 5 +- .../smart-contracts/json-rpc-error.ts | 0 .../{ => modules}/smart-contracts/types.ts | 0 .../user-stats-accordion.tsx | 8 +- .../hcaptcha-labeling/user-stats-details.tsx | 8 +- .../hcaptcha-labeling/user-stats-drawer.tsx | 10 +- .../oracles-table-job-types-select.tsx | 6 +- .../jobs-discovery}/oracles-table-mobile.tsx | 20 +-- .../jobs-discovery}/oracles-table.tsx | 24 ++-- .../available-jobs-job-type-filter.tsx | 4 +- .../desktop/available-jobs-network-filter.tsx | 6 +- .../available-jobs-reward-amount-sort.tsx | 4 +- .../desktop/available-jobs-table.tsx | 34 ++--- .../available-jobs-assign-job-button.tsx | 6 +- .../mobile/available-jobs-drawer-mobile.tsx | 12 +- .../available-jobs-job-type-filter-mobile.tsx | 4 +- .../available-jobs-network-filter-mobile.tsx | 6 +- ...ailable-jobs-reward-amount-sort-mobile.tsx | 6 +- .../mobile/available-jobs-table-mobile.tsx | 32 ++--- .../jobs}/escrow-address-search-form.tsx | 6 +- .../worker/components/jobs}/evm-address.tsx | 6 +- .../components/jobs}/jobs-tab-panel.tsx | 0 .../jobs}/my-jobs-table-actions.tsx | 11 +- .../desktop/my-jobs-expires-at-sort.tsx | 4 +- .../desktop/my-jobs-job-type-filter.tsx | 4 +- .../desktop/my-jobs-network-filter.tsx | 6 +- .../desktop/my-jobs-reward-amount-sort.tsx | 4 +- .../my-jobs/desktop/my-jobs-status-filter.tsx | 6 +- .../jobs}/my-jobs/desktop/my-jobs-table.tsx | 38 ++--- .../my-jobs/mobile/my-jobs-drawer-mobile.tsx | 10 +- .../mobile/my-jobs-expires-at-sort-mobile.tsx | 6 +- .../mobile/my-jobs-job-type-filter-mobile.tsx | 4 +- .../mobile/my-jobs-network-filter-mobile.tsx | 6 +- .../my-jobs-reward-amount-sort-mobile.tsx | 6 +- .../mobile/my-jobs-status-filter-mobile.tsx | 6 +- .../my-jobs/mobile/my-jobs-table-mobile.tsx | 38 ++--- .../worker/components/jobs}/reject-button.tsx | 4 +- .../worker/components/jobs}/reward-amount.tsx | 0 .../worker/components/jobs}/sorting.tsx | 6 +- .../worker/components/jobs}/status-chip.tsx | 8 +- .../jobs}/text-header-with-icon.tsx | 2 +- .../worker/components}/profile/done-label.tsx | 2 +- .../components}/profile/error-label.tsx | 0 .../components}/profile/profile-actions.tsx | 28 ++-- .../components}/profile/profile-data.tsx | 8 +- .../profile/profile-email-notifications.tsx | 2 +- .../components}/profile/profile.page.tsx | 12 +- .../profile/register-address-btn.tsx | 6 +- .../components}/profile/start-kyc-btn.tsx | 8 +- .../profile/wallet-connect-done.tsx | 12 +- .../worker}/hooks/use-get-all-networks.ts | 2 +- .../hooks/use-get-oracles-notifications.tsx | 2 +- .../use-hcaptcha-labeling-notifications.tsx | 2 +- .../hooks/use-job-types-oracles-table.tsx | 0 .../worker}/hooks/use-jobs-filter-store.tsx | 2 +- .../worker}/hooks/use-jobs-notifications.tsx | 2 +- .../worker}/hooks/use-kyc-notification.tsx | 2 +- .../worker}/hooks/use-location-state.tsx | 0 .../hooks/use-my-jobs-filter-store.tsx | 2 +- .../use-protected-layout-notifications.tsx | 2 +- .../use-register-address-notifications.tsx | 2 +- .../hooks}/use-register-address-on-chain.ts | 12 +- .../worker/hooks}/use-register-address.ts | 8 +- .../worker/services}/available-jobs-data.ts | 4 +- .../worker/services}/daily-hmt-spent.ts | 0 .../worker/services}/email-verification.ts | 0 .../services}/enable-hcaptcha-labeling.ts | 2 +- .../worker/services}/get-kyc-session-id.ts | 4 +- .../get-on-chain-registered-address.ts | 8 +- .../get-registration-in-exchange-oracles.ts | 0 .../worker/services}/get-signed-address.ts | 0 .../worker/services}/get-ui-config.ts | 0 .../worker/services}/hcaptcha-user-stats.ts | 0 .../available-jobs-table-service-mock.ts | 0 .../mocks}/my-jobs-table-service-mock.ts | 0 .../worker/services}/my-jobs-data.ts | 4 +- .../worker/services}/oracles.ts | 2 +- .../worker/services}/refresh-tasks.ts | 0 .../registration-in-exchange-oracles.ts | 0 .../worker/services}/reject-task.ts | 0 .../services}/resend-email-verification.ts | 2 +- .../worker/services}/reset-password.ts | 0 .../worker/services}/send-reset-link.ts | 0 .../worker/services}/sign-in/schema.ts | 0 .../worker/services}/sign-in/sign-in.ts | 2 +- .../worker/services}/sign-in/types.ts | 0 .../worker/services}/sign-up.ts | 0 .../worker/services}/solve-hcaptcha.ts | 0 .../worker/services/use-assign-job.ts} | 0 .../worker/utils}/get-chip-status-color.ts | 4 +- .../email-verification.page.tsx | 16 +-- .../email-verification/verify-email.page.tsx | 25 ++-- .../hcaptcha-labeling/enable-labeler.page.tsx | 18 +-- .../hcaptcha-labeling.page.tsx | 23 +-- .../jobs-discovery/jobs-discovery.page.tsx | 14 +- .../worker/views}/jobs/jobs.page.tsx | 32 ++--- .../views/protected}/protected.page.tsx | 0 .../views}/registration/registration.page.tsx | 10 +- .../reset-password-success.page.tsx | 8 +- .../reset-password/reset-password.page.tsx | 16 +-- .../send-reset-link-success.page.tsx | 22 +-- .../send-reset-link/send-reset-link.page.tsx | 18 +-- .../worker/views/sign}/sign-in.page.tsx | 22 +-- .../worker/views/sign}/sign-up.page.tsx | 20 +-- .../table-example/table-example.tsx | 10 -- .../profile/register-address-on-chain-btn.tsx | 111 --------------- .../human-app/frontend/src/router/router.tsx | 22 +-- .../human-app/frontend/src/router/routes.tsx | 56 ++++---- .../components/data-entry/checkbox.tsx | 2 +- .../components/data-entry/form-example.tsx | 14 +- .../input-masks/human-currency-input-mask.tsx | 0 .../data-entry/input-masks/index.ts | 9 ++ .../input-masks/percents-input-mask.tsx | 0 .../components/data-entry/input.tsx | 8 +- .../components/data-entry/multi-select.tsx | 2 +- .../data-entry/password/password.tsx | 4 +- .../components/data-entry/radio-button.tsx | 0 .../components/data-entry/select.tsx | 4 +- .../components/data-entry/slider.tsx | 0 .../src/{ => shared}/components/h-captcha.tsx | 2 +- .../drawer-menu-items-operator.tsx | 6 +- .../drawer-menu-items-worker.tsx | 12 +- .../{ => shared}/components/layout/footer.tsx | 8 +- .../layout/protected/drawer-navigation.tsx | 16 +-- .../protected/layout-notification-context.tsx | 2 +- .../components/layout/protected/layout.tsx | 18 +-- .../components/layout/protected/navbar.tsx | 12 +- .../layout/protected/page-header.tsx | 4 +- .../components/layout/unprotected/layout.tsx | 8 +- .../components/layout/unprotected/navbar.tsx | 17 ++- .../src/{ => shared}/components/ui/alert.tsx | 4 +- .../src/{ => shared}/components/ui/button.tsx | 0 .../src/{ => shared}/components/ui/chip.tsx | 2 +- .../src/{ => shared}/components/ui/chips.tsx | 2 +- .../components/ui/connect-wallet-btn.tsx | 6 +- .../{ => shared}/components/ui/counter.tsx | 2 +- .../components/ui/dark-mode-switch.tsx | 4 +- .../components/ui/empty-placeholder.tsx | 2 +- .../src/{ => shared}/components/ui/icons.tsx | 2 +- .../{ => shared}/components/ui/list-item.tsx | 0 .../src/{ => shared}/components/ui/loader.tsx | 2 +- .../{ => shared}/components/ui/mail-to.tsx | 0 .../components/ui/modal/display-modal.tsx | 0 .../components/ui/modal/modal-content.tsx | 6 +- .../components/ui/modal/modal-header.test.tsx | 2 +- .../components/ui/modal/modal-header.tsx | 0 .../components/ui/modal/modal.store.ts | 0 .../components/ui/modal/modal.tsx | 0 .../{ => shared}/components/ui/no-records.tsx | 2 +- .../components/ui/optional-text.tsx | 2 +- .../shared/components/ui/page-card-error.tsx | 98 +++++++++++++ .../shared/components/ui/page-card-loader.tsx | 131 ++++++++++++++++++ .../{ => shared}/components/ui/page-card.tsx | 108 +-------------- .../components/ui/profile-list-item.tsx | 8 +- .../components/ui/success-label.tsx | 2 +- .../components/ui/table-button.tsx | 4 +- .../components/ui/table/table-header-cell.tsx | 4 +- .../table/table-header-menu.tsx/filtering.tsx | 2 +- .../table/table-header-menu.tsx/sorting.tsx | 2 +- .../ui/table/table-query-context.tsx | 0 .../components/ui/table/table-query-hook.ts | 2 +- .../components/ui/top-notification.tsx | 6 +- .../{ => shared}/components/ui/ui-example.tsx | 16 +-- .../human-app/frontend/src/shared/consts.ts | 2 +- .../contexts/background-color-store.tsx | 2 +- .../browser-auth-provider.ts | 2 +- .../contexts/color-mode-context.tsx | 10 +- .../{ => shared}/contexts/homepage-state.tsx | 0 .../contexts/jwt-expiration-check.tsx | 6 +- .../contexts/registered-oracles.tsx | 0 .../{ => shared}/contexts/wallet-connect.tsx | 4 +- .../shared/helpers/default-error-message.ts | 2 +- .../shared/helpers/json-rpc-error-handler.ts | 2 +- .../hooks/use-background-store.tsx | 4 +- .../src/{ => shared}/hooks/use-color-mode.tsx | 4 +- .../src/{ => shared}/hooks/use-count-down.tsx | 0 .../hooks/use-handle-main-nav-icon-click.tsx | 6 +- .../hooks/use-is-hcaptcha-labeling-page.ts | 0 .../src/{ => shared}/hooks/use-is-mobile.tsx | 0 .../hooks/use-reset-mutation-errors.tsx | 0 .../{ => shared}/hooks/use-wallet-connect.tsx | 2 +- .../{ => shared}/hooks/use-web3-provider.tsx | 2 +- .../frontend/src/{ => shared}/i18n/en.json | 0 .../frontend/src/{ => shared}/i18n/i18n.ts | 2 +- .../src/{ => shared}/styles/breakpoints.ts | 0 .../src/{ => shared}/styles/color-palette.ts | 0 .../styles/create-table-dark-mode.tsx | 2 +- .../{ => shared}/styles/dark-color-palette.ts | 2 +- .../src/{ => shared}/styles/dark-theme.ts | 6 +- .../frontend/src/{ => shared}/styles/theme.ts | 4 +- .../src/{ => shared}/styles/typography.ts | 2 +- .../src/shared/types/browser-auth-provider.ts | 6 +- .../frontend/src/shared/types/global.type.ts | 2 +- .../src/test-utils/render-with-wrapper.tsx | 16 --- 270 files changed, 1113 insertions(+), 1104 deletions(-) rename packages/apps/human-app/frontend/src/api/{services/common => hooks}/use-access-token-refresh.ts (90%) rename packages/apps/human-app/frontend/src/api/{services/common/prepare-signature.ts => hooks/use-prepare-signature.ts} (100%) delete mode 100644 packages/apps/human-app/frontend/src/api/services/enums.ts rename packages/apps/human-app/frontend/src/api/{services => utils}/test.schema.ts (100%) rename packages/apps/human-app/frontend/src/api/{services => utils}/test.service.ts (100%) delete mode 100644 packages/apps/human-app/frontend/src/components/data-entry/input-masks/input-masks.ts rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/components}/wallet-connect-modal.tsx (88%) rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/context}/web3-auth-context.tsx (94%) rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/hooks}/use-connected-wallet.tsx (77%) rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/hooks}/use-web3-auth.tsx (72%) rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/hooks}/use-web3-authenticated-user.tsx (77%) rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/providers}/require-wallet-connect.tsx (76%) rename packages/apps/human-app/frontend/src/{auth-web3 => modules/auth-web3/providers}/require-web3-auth.tsx (75%) rename packages/apps/human-app/frontend/src/{auth => modules/auth/components}/expiration-modal.tsx (81%) rename packages/apps/human-app/frontend/src/{auth => modules/auth/context}/auth-context.tsx (94%) rename packages/apps/human-app/frontend/src/{auth => modules/auth/hooks}/use-auth.ts (74%) rename packages/apps/human-app/frontend/src/{auth => modules/auth/hooks}/use-authenticated-user.tsx (78%) rename packages/apps/human-app/frontend/src/{auth => modules/auth/providers}/require-auth.tsx (76%) rename packages/apps/human-app/frontend/src/{pages => modules}/homepage/components/chat.tsx (97%) rename packages/apps/human-app/frontend/src/{pages => modules}/homepage/components/choose-sign-up-account-type.tsx (92%) rename packages/apps/human-app/frontend/src/{pages => modules}/homepage/components/home-container.tsx (83%) rename packages/apps/human-app/frontend/src/{pages => modules}/homepage/components/welcome.tsx (87%) rename packages/apps/human-app/frontend/src/{pages => modules}/homepage/components/worker-signin.tsx (87%) rename packages/apps/human-app/frontend/src/{pages/homepage/components/operator-signin.tsx => modules/homepage/hooks/use-operator-signin.tsx} (85%) rename packages/apps/human-app/frontend/src/{pages/homepage => modules/homepage/views}/home.page.tsx (78%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/profile/profile-disable-button.tsx (78%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/profile/profile-enable-button.tsx (79%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-keys/edit-existing-keys-form.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-keys/edit-pending-keys-form.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-keys/existing-keys-form.tsx (82%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-keys/existing-keys.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-keys/pending-keys-form.tsx (77%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-keys/sort-form.ts (70%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-stake/buttons.tsx (94%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/components}/sign-up/add-stake/stake-form.tsx (89%) create mode 100644 packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake-mutation-state.ts rename packages/apps/human-app/frontend/src/{api/services/operator/add-stake.ts => modules/operator/hooks/use-add-stake.ts} (71%) rename packages/apps/human-app/frontend/src/{api/services/operator/disable-operator.ts => modules/operator/hooks/use-disable-operator.ts} (78%) rename packages/apps/human-app/frontend/src/{api/services/operator/edit-existing-keys.ts => modules/operator/hooks/use-edit-existing-keys.ts} (92%) rename packages/apps/human-app/frontend/src/{api/services/operator/get-keys.ts => modules/operator/hooks/use-get-keys.ts} (78%) rename packages/apps/human-app/frontend/src/{api/services/operator/get-stacked-amount.ts => modules/operator/hooks/use-get-stacked-amount.ts} (79%) rename packages/apps/human-app/frontend/src/{api/services/operator/get-stats.ts => modules/operator/hooks/use-get-stats.ts} (94%) rename packages/apps/human-app/frontend/src/{api/services/operator/human-token-decimals.ts => modules/operator/hooks/use-human-token-decimals.ts} (66%) rename packages/apps/human-app/frontend/src/{api/services/operator/web3-signin.ts => modules/operator/hooks/use-web3-signin.ts} (83%) rename packages/apps/human-app/frontend/src/{api/services/operator/web3-signup.ts => modules/operator/hooks/use-web3-signup.ts} (88%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/views}/profile/profile.page.tsx (88%) rename packages/apps/human-app/frontend/src/{pages/operator/sign-up/add-keys => modules/operator/views/sign-up}/add-keys.page.tsx (70%) rename packages/apps/human-app/frontend/src/{pages/operator/sign-up/add-stake => modules/operator/views/sign-up}/add-stake.page.tsx (77%) rename packages/apps/human-app/frontend/src/{pages/operator => modules/operator/views}/sign-up/connect-wallet.page.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/operator/sign-up/add-keys => modules/operator/views/sign-up}/edit-existing-keys-success.page.tsx (77%) rename packages/apps/human-app/frontend/src/{pages/operator/sign-up/set-up-operator.tsx => modules/operator/views/sign-up/set-up-operator.page.tsx} (78%) rename packages/apps/human-app/frontend/src/{pages/playground => modules/playground/components}/modal-example/modal-example.tsx (100%) create mode 100644 packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-example.tsx rename packages/apps/human-app/frontend/src/{pages/playground => modules/playground/components}/table-example/table-search-form.tsx (91%) rename packages/apps/human-app/frontend/src/{pages/playground => modules/playground/components}/table-example/table-service.tsx (100%) rename packages/apps/human-app/frontend/src/{pages/playground => modules/playground/components}/table-example/table.tsx (78%) rename packages/apps/human-app/frontend/src/{pages/playground => modules/playground/views}/playground.page.tsx (65%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/EthKVStore/config.ts (100%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts (78%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts (64%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts (72%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/HMToken/hm-token-allowance.ts (69%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/HMToken/hm-token-approve.ts (74%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/HMToken/hm-token-decimals.ts (66%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/Staking/staking-get-staked-tokens.ts (67%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/Staking/staking-stake.ts (74%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/abi/EthKVStore.json (100%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/abi/HMToken.json (100%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/abi/Staking.json (100%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/chains.ts (98%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/check-network.ts (87%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/contracts.ts (100%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/get-contract-address.ts (65%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/get-network-name.ts (76%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/json-rpc-error.ts (100%) rename packages/apps/human-app/frontend/src/{ => modules}/smart-contracts/types.ts (100%) rename packages/apps/human-app/frontend/src/{pages/worker/hcaptcha-labeling => modules/worker/components}/hcaptcha-labeling/user-stats-accordion.tsx (85%) rename packages/apps/human-app/frontend/src/{pages/worker/hcaptcha-labeling => modules/worker/components}/hcaptcha-labeling/user-stats-details.tsx (93%) rename packages/apps/human-app/frontend/src/{pages/worker/hcaptcha-labeling => modules/worker/components}/hcaptcha-labeling/user-stats-drawer.tsx (85%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs-discovery/components/oracles-table => modules/worker/components/jobs-discovery}/oracles-table-job-types-select.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs-discovery/components/oracles-table => modules/worker/components/jobs-discovery}/oracles-table-mobile.tsx (74%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs-discovery/components/oracles-table => modules/worker/components/jobs-discovery}/oracles-table.tsx (80%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/desktop/available-jobs-job-type-filter.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/desktop/available-jobs-network-filter.tsx (74%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/desktop/available-jobs-reward-amount-sort.tsx (85%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/desktop/available-jobs-table.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/mobile/available-jobs-assign-job-button.tsx (80%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/mobile/available-jobs-drawer-mobile.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx (83%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/mobile/available-jobs-network-filter-mobile.tsx (76%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx (85%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/available-jobs/mobile/available-jobs-table-mobile.tsx (80%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/escrow-address-search-form.tsx (92%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/evm-address.tsx (79%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/jobs-tab-panel.tsx (100%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs-table-actions.tsx (78%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/desktop/my-jobs-expires-at-sort.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/desktop/my-jobs-job-type-filter.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/desktop/my-jobs-network-filter.tsx (73%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/desktop/my-jobs-reward-amount-sort.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/desktop/my-jobs-status-filter.tsx (72%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/desktop/my-jobs-table.tsx (83%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-drawer-mobile.tsx (89%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx (82%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-network-filter-mobile.tsx (75%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-status-filter-mobile.tsx (73%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/my-jobs/mobile/my-jobs-table-mobile.tsx (82%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/reject-button.tsx (78%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/reward-amount.tsx (100%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/sorting.tsx (92%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/status-chip.tsx (68%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/components => modules/worker/components/jobs}/text-header-with-icon.tsx (90%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/done-label.tsx (88%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/error-label.tsx (100%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/profile-actions.tsx (74%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/profile-data.tsx (82%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/profile-email-notifications.tsx (90%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/profile.page.tsx (73%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/register-address-btn.tsx (63%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/start-kyc-btn.tsx (82%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/components}/profile/wallet-connect-done.tsx (79%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-get-all-networks.ts (81%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-get-oracles-notifications.tsx (83%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-hcaptcha-labeling-notifications.tsx (88%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-job-types-oracles-table.tsx (100%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-jobs-filter-store.tsx (97%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-jobs-notifications.tsx (87%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-kyc-notification.tsx (78%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-location-state.tsx (100%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-my-jobs-filter-store.tsx (96%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-protected-layout-notifications.tsx (70%) rename packages/apps/human-app/frontend/src/{ => modules/worker}/hooks/use-register-address-notifications.tsx (83%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/hooks}/use-register-address-on-chain.ts (75%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/hooks}/use-register-address.ts (88%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/available-jobs-data.ts (93%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/daily-hmt-spent.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/email-verification.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/enable-hcaptcha-labeling.ts (93%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/get-kyc-session-id.ts (88%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/get-on-chain-registered-address.ts (76%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/get-registration-in-exchange-oracles.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/get-signed-address.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/get-ui-config.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/hcaptcha-user-stats.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services/mocks}/available-jobs-table-service-mock.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services/mocks}/my-jobs-table-service-mock.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/my-jobs-data.ts (93%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/oracles.ts (96%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/refresh-tasks.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/registration-in-exchange-oracles.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/reject-task.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/resend-email-verification.ts (97%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/reset-password.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/send-reset-link.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/sign-in/schema.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/sign-in/sign-in.ts (94%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/sign-in/types.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/sign-up.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker => modules/worker/services}/solve-hcaptcha.ts (100%) rename packages/apps/human-app/frontend/src/{api/services/worker/assign-job.ts => modules/worker/services/use-assign-job.ts} (100%) rename packages/apps/human-app/frontend/src/{pages/worker/jobs/helpers => modules/worker/utils}/get-chip-status-color.ts (80%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/email-verification/email-verification.page.tsx (79%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/email-verification/verify-email.page.tsx (83%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/hcaptcha-labeling/enable-labeler.page.tsx (79%) rename packages/apps/human-app/frontend/src/{pages/worker/hcaptcha-labeling => modules/worker/views}/hcaptcha-labeling/hcaptcha-labeling.page.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/jobs-discovery/jobs-discovery.page.tsx (69%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/jobs/jobs.page.tsx (80%) rename packages/apps/human-app/frontend/src/{pages => modules/worker/views/protected}/protected.page.tsx (100%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/registration/registration.page.tsx (93%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/reset-password/reset-password-success.page.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/reset-password/reset-password.page.tsx (84%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/send-reset-link/send-reset-link-success.page.tsx (82%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views}/send-reset-link/send-reset-link.page.tsx (81%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views/sign}/sign-in.page.tsx (80%) rename packages/apps/human-app/frontend/src/{pages/worker => modules/worker/views/sign}/sign-up.page.tsx (85%) delete mode 100644 packages/apps/human-app/frontend/src/pages/playground/table-example/table-example.tsx delete mode 100644 packages/apps/human-app/frontend/src/pages/worker/profile/register-address-on-chain-btn.tsx rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/checkbox.tsx (95%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/form-example.tsx (90%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/input-masks/human-currency-input-mask.tsx (100%) create mode 100644 packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/index.ts rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/input-masks/percents-input-mask.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/input.tsx (90%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/multi-select.tsx (98%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/password/password.tsx (92%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/radio-button.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/select.tsx (94%) rename packages/apps/human-app/frontend/src/{ => shared}/components/data-entry/slider.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/h-captcha.tsx (96%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx (79%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx (81%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/footer.tsx (93%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/protected/drawer-navigation.tsx (94%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/protected/layout-notification-context.tsx (80%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/protected/layout.tsx (89%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/protected/navbar.tsx (86%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/protected/page-header.tsx (92%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/unprotected/layout.tsx (83%) rename packages/apps/human-app/frontend/src/{ => shared}/components/layout/unprotected/navbar.tsx (89%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/alert.tsx (92%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/button.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/chip.tsx (92%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/chips.tsx (86%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/connect-wallet-btn.tsx (74%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/counter.tsx (91%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/dark-mode-switch.tsx (78%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/empty-placeholder.tsx (84%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/icons.tsx (98%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/list-item.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/loader.tsx (87%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/mail-to.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/modal/display-modal.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/modal/modal-content.tsx (68%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/modal/modal-header.test.tsx (94%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/modal/modal-header.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/modal/modal.store.ts (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/modal/modal.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/no-records.tsx (84%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/optional-text.tsx (78%) create mode 100644 packages/apps/human-app/frontend/src/shared/components/ui/page-card-error.tsx create mode 100644 packages/apps/human-app/frontend/src/shared/components/ui/page-card-loader.tsx rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/page-card.tsx (73%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/profile-list-item.tsx (90%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/success-label.tsx (87%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/table-button.tsx (77%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/table/table-header-cell.tsx (90%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/table/table-header-menu.tsx/filtering.tsx (97%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/table/table-header-menu.tsx/sorting.tsx (95%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/table/table-query-context.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/table/table-query-hook.ts (54%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/top-notification.tsx (87%) rename packages/apps/human-app/frontend/src/{ => shared}/components/ui/ui-example.tsx (92%) rename packages/apps/human-app/frontend/src/{ => shared}/contexts/background-color-store.tsx (96%) rename packages/apps/human-app/frontend/src/shared/{helpers => contexts}/browser-auth-provider.ts (96%) rename packages/apps/human-app/frontend/src/{ => shared}/contexts/color-mode-context.tsx (88%) rename packages/apps/human-app/frontend/src/{ => shared}/contexts/homepage-state.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/contexts/jwt-expiration-check.tsx (86%) rename packages/apps/human-app/frontend/src/{ => shared}/contexts/registered-oracles.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/contexts/wallet-connect.tsx (96%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-background-store.tsx (64%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-color-mode.tsx (62%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-count-down.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-handle-main-nav-icon-click.tsx (75%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-is-hcaptcha-labeling-page.ts (100%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-is-mobile.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-reset-mutation-errors.tsx (100%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-wallet-connect.tsx (76%) rename packages/apps/human-app/frontend/src/{ => shared}/hooks/use-web3-provider.tsx (93%) rename packages/apps/human-app/frontend/src/{ => shared}/i18n/en.json (100%) rename packages/apps/human-app/frontend/src/{ => shared}/i18n/i18n.ts (94%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/breakpoints.ts (100%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/color-palette.ts (100%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/create-table-dark-mode.tsx (94%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/dark-color-palette.ts (95%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/dark-theme.ts (95%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/theme.ts (96%) rename packages/apps/human-app/frontend/src/{ => shared}/styles/typography.ts (98%) delete mode 100644 packages/apps/human-app/frontend/src/test-utils/render-with-wrapper.tsx diff --git a/packages/apps/human-app/frontend/src/api/fetch-refresh-token.ts b/packages/apps/human-app/frontend/src/api/fetch-refresh-token.ts index b0a4c33c58..77226af471 100644 --- a/packages/apps/human-app/frontend/src/api/fetch-refresh-token.ts +++ b/packages/apps/human-app/frontend/src/api/fetch-refresh-token.ts @@ -1,6 +1,6 @@ import { apiPaths } from '@/api/api-paths'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; -import { signInSuccessResponseSchema } from '@/api/services/worker/sign-in/schema'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; +import { signInSuccessResponseSchema } from '@/modules/worker/services/sign-in/schema'; export const fetchTokenRefresh = async (baseUrl: string) => { const response = await fetch( diff --git a/packages/apps/human-app/frontend/src/api/fetcher.ts b/packages/apps/human-app/frontend/src/api/fetcher.ts index 73bb6d41bb..ee28d118f9 100644 --- a/packages/apps/human-app/frontend/src/api/fetcher.ts +++ b/packages/apps/human-app/frontend/src/api/fetcher.ts @@ -1,9 +1,9 @@ import merge from 'lodash/merge'; import { ZodError, type ZodType, type ZodTypeDef } from 'zod'; import type { ResponseError } from '@/shared/types/global.type'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; import { env } from '@/shared/env'; -import { type SignInSuccessResponse } from '@/api/services/worker/sign-in/types'; +import { type SignInSuccessResponse } from '@/modules/worker/services/sign-in/types'; import { normalizeBaseUrl } from '@/shared/helpers/normalize-base-url'; import { fetchTokenRefresh } from './fetch-refresh-token'; diff --git a/packages/apps/human-app/frontend/src/api/services/common/use-access-token-refresh.ts b/packages/apps/human-app/frontend/src/api/hooks/use-access-token-refresh.ts similarity index 90% rename from packages/apps/human-app/frontend/src/api/services/common/use-access-token-refresh.ts rename to packages/apps/human-app/frontend/src/api/hooks/use-access-token-refresh.ts index 054e59a0d9..3532d0070e 100644 --- a/packages/apps/human-app/frontend/src/api/services/common/use-access-token-refresh.ts +++ b/packages/apps/human-app/frontend/src/api/hooks/use-access-token-refresh.ts @@ -1,9 +1,9 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useNavigate } from 'react-router-dom'; -import { useAuth } from '@/auth/use-auth'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; import type { AuthType } from '@/shared/types/browser-auth-provider'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; import { routerPaths } from '@/router/router-paths'; import { refreshToken } from '@/api/fetcher'; diff --git a/packages/apps/human-app/frontend/src/api/services/common/prepare-signature.ts b/packages/apps/human-app/frontend/src/api/hooks/use-prepare-signature.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/common/prepare-signature.ts rename to packages/apps/human-app/frontend/src/api/hooks/use-prepare-signature.ts diff --git a/packages/apps/human-app/frontend/src/api/services/enums.ts b/packages/apps/human-app/frontend/src/api/services/enums.ts deleted file mode 100644 index deb82a5fd4..0000000000 --- a/packages/apps/human-app/frontend/src/api/services/enums.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { z } from 'zod'; - -export const testType = z.enum(['TYPE']); diff --git a/packages/apps/human-app/frontend/src/api/services/test.schema.ts b/packages/apps/human-app/frontend/src/api/utils/test.schema.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/test.schema.ts rename to packages/apps/human-app/frontend/src/api/utils/test.schema.ts diff --git a/packages/apps/human-app/frontend/src/api/services/test.service.ts b/packages/apps/human-app/frontend/src/api/utils/test.service.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/test.service.ts rename to packages/apps/human-app/frontend/src/api/utils/test.service.ts diff --git a/packages/apps/human-app/frontend/src/components/data-entry/input-masks/input-masks.ts b/packages/apps/human-app/frontend/src/components/data-entry/input-masks/input-masks.ts deleted file mode 100644 index 8a2af068a2..0000000000 --- a/packages/apps/human-app/frontend/src/components/data-entry/input-masks/input-masks.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { HumanCurrencyInputMask } from '@/components/data-entry/input-masks/human-currency-input-mask'; -import { PercentsInputMask } from '@/components/data-entry/input-masks/percents-input-mask'; - -export const InputMasks = { - HumanCurrencyInputMask, - PercentsInputMask, -}; - -export type InputMask = keyof typeof InputMasks; diff --git a/packages/apps/human-app/frontend/src/main.tsx b/packages/apps/human-app/frontend/src/main.tsx index 4c75c8bfda..eb6a5bd69d 100644 --- a/packages/apps/human-app/frontend/src/main.tsx +++ b/packages/apps/human-app/frontend/src/main.tsx @@ -2,23 +2,23 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; -import '@/i18n/i18n'; +import '@/shared/i18n/i18n'; import CssBaseline from '@mui/material/CssBaseline'; import { BrowserRouter } from 'react-router-dom'; -import { DisplayModal } from '@/components/ui/modal/display-modal'; -import { AuthProvider } from '@/auth/auth-context'; +import { DisplayModal } from '@/shared/components/ui/modal/display-modal'; +import { AuthProvider } from '@/modules/auth/context/auth-context'; import { Router } from '@/router/router'; import '@fontsource/inter'; import '@fontsource/inter/400.css'; import '@fontsource/inter/500.css'; import '@fontsource/inter/600.css'; import '@fontsource/inter/800.css'; -import { WalletConnectProvider } from '@/contexts/wallet-connect'; -import { Web3AuthProvider } from '@/auth-web3/web3-auth-context'; -import { JWTExpirationCheck } from '@/contexts/jwt-expiration-check'; -import { ColorModeProvider } from '@/contexts/color-mode-context'; -import { HomePageStateProvider } from '@/contexts/homepage-state'; -import { RegisteredOraclesProvider } from '@/contexts/registered-oracles'; +import { WalletConnectProvider } from '@/shared/contexts/wallet-connect'; +import { Web3AuthProvider } from '@/modules/auth-web3/context/web3-auth-context'; +import { JWTExpirationCheck } from '@/shared/contexts/jwt-expiration-check'; +import { ColorModeProvider } from '@/shared/contexts/color-mode-context'; +import { HomePageStateProvider } from '@/shared/contexts/homepage-state'; +import { RegisteredOraclesProvider } from '@/shared/contexts/registered-oracles'; const root = document.getElementById('root'); if (!root) throw Error('root element is undefined'); diff --git a/packages/apps/human-app/frontend/src/auth-web3/wallet-connect-modal.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/components/wallet-connect-modal.tsx similarity index 88% rename from packages/apps/human-app/frontend/src/auth-web3/wallet-connect-modal.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/components/wallet-connect-modal.tsx index 0b95fc472f..89ac0c446e 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/wallet-connect-modal.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/components/wallet-connect-modal.tsx @@ -3,11 +3,11 @@ import { Grid, Typography } from '@mui/material'; import { Trans } from 'react-i18next'; import { Link } from 'react-router-dom'; import { useEffect } from 'react'; -import { Button } from '@/components/ui/button'; -import { ConnectWalletBtn } from '@/components/ui/connect-wallet-btn'; -import { useModalStore } from '@/components/ui/modal/modal.store'; +import { Button } from '@/shared/components/ui/button'; +import { ConnectWalletBtn } from '@/shared/components/ui/connect-wallet-btn'; +import { useModalStore } from '@/shared/components/ui/modal/modal.store'; import { env } from '@/shared/env'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; export function WalletConnectModal() { const { closeModal } = useModalStore(); diff --git a/packages/apps/human-app/frontend/src/auth-web3/web3-auth-context.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/context/web3-auth-context.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/auth-web3/web3-auth-context.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/context/web3-auth-context.tsx index 731453f24a..4523312646 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/web3-auth-context.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/context/web3-auth-context.tsx @@ -3,9 +3,9 @@ import { useState, createContext, useEffect } from 'react'; import { jwtDecode } from 'jwt-decode'; import { z } from 'zod'; import { useQueryClient } from '@tanstack/react-query'; -import type { SignInSuccessResponse } from '@/api/services/worker/sign-in/types'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; -import { useModalStore } from '@/components/ui/modal/modal.store'; +import type { SignInSuccessResponse } from '@/modules/worker/services/sign-in/types'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; +import { useModalStore } from '@/shared/components/ui/modal/modal.store'; const web3userDataSchema = z.object({ userId: z.number(), diff --git a/packages/apps/human-app/frontend/src/auth-web3/use-connected-wallet.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-connected-wallet.tsx similarity index 77% rename from packages/apps/human-app/frontend/src/auth-web3/use-connected-wallet.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-connected-wallet.tsx index 1cbf452ebe..cecc1ce0cb 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/use-connected-wallet.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-connected-wallet.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { AuthWeb3Context } from '@/auth-web3/require-wallet-connect'; +import { AuthWeb3Context } from '@/modules/auth-web3/providers/require-wallet-connect'; export const useConnectedWallet = () => { const context = useContext(AuthWeb3Context); diff --git a/packages/apps/human-app/frontend/src/auth-web3/use-web3-auth.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-web3-auth.tsx similarity index 72% rename from packages/apps/human-app/frontend/src/auth-web3/use-web3-auth.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-web3-auth.tsx index 5ec39935eb..ec1e6ddc07 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/use-web3-auth.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-web3-auth.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { Web3AuthContext } from '@/auth-web3/web3-auth-context'; +import { Web3AuthContext } from '@/modules/auth-web3/context/web3-auth-context'; export function useWeb3Auth() { const context = useContext(Web3AuthContext); diff --git a/packages/apps/human-app/frontend/src/auth-web3/use-web3-authenticated-user.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-web3-authenticated-user.tsx similarity index 77% rename from packages/apps/human-app/frontend/src/auth-web3/use-web3-authenticated-user.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-web3-authenticated-user.tsx index d5609ea59a..d8365b7312 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/use-web3-authenticated-user.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/hooks/use-web3-authenticated-user.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { Web3AuthenticatedUserContext } from '@/auth-web3/require-web3-auth'; +import { Web3AuthenticatedUserContext } from '@/modules/auth-web3/providers/require-web3-auth'; export function useWeb3AuthenticatedUser() { const context = useContext(Web3AuthenticatedUserContext); diff --git a/packages/apps/human-app/frontend/src/auth-web3/require-wallet-connect.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/providers/require-wallet-connect.tsx similarity index 76% rename from packages/apps/human-app/frontend/src/auth-web3/require-wallet-connect.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/providers/require-wallet-connect.tsx index 55ebd84f27..0327362c89 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/require-wallet-connect.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/providers/require-wallet-connect.tsx @@ -1,9 +1,9 @@ import { useLocation, Navigate } from 'react-router-dom'; import { createContext } from 'react'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import type { WalletConnectContextConnectedAccount } from '@/contexts/wallet-connect'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import type { WalletConnectContextConnectedAccount } from '@/shared/contexts/wallet-connect'; import { routerPaths } from '@/router/router-paths'; -import { PageCardLoader } from '@/components/ui/page-card'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; export const AuthWeb3Context = createContext(null); diff --git a/packages/apps/human-app/frontend/src/auth-web3/require-web3-auth.tsx b/packages/apps/human-app/frontend/src/modules/auth-web3/providers/require-web3-auth.tsx similarity index 75% rename from packages/apps/human-app/frontend/src/auth-web3/require-web3-auth.tsx rename to packages/apps/human-app/frontend/src/modules/auth-web3/providers/require-web3-auth.tsx index 83957b8a4b..f083554017 100644 --- a/packages/apps/human-app/frontend/src/auth-web3/require-web3-auth.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth-web3/providers/require-web3-auth.tsx @@ -1,9 +1,9 @@ import { useLocation, Navigate } from 'react-router-dom'; import { createContext } from 'react'; import { routerPaths } from '@/router/router-paths'; -import type { Web3AuthenticatedUserContextType } from '@/auth-web3/web3-auth-context'; -import { PageCardLoader } from '@/components/ui/page-card'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; +import type { Web3AuthenticatedUserContextType } from '@/modules/auth-web3/context/web3-auth-context'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; export const Web3AuthenticatedUserContext = createContext(null); diff --git a/packages/apps/human-app/frontend/src/auth/expiration-modal.tsx b/packages/apps/human-app/frontend/src/modules/auth/components/expiration-modal.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/auth/expiration-modal.tsx rename to packages/apps/human-app/frontend/src/modules/auth/components/expiration-modal.tsx index e7df13543d..9e871a1ca1 100644 --- a/packages/apps/human-app/frontend/src/auth/expiration-modal.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth/components/expiration-modal.tsx @@ -1,13 +1,13 @@ import { t } from 'i18next'; import { Grid, Typography } from '@mui/material'; import { useNavigate } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; -import { useModalStore } from '@/components/ui/modal/modal.store'; +import { Button } from '@/shared/components/ui/button'; +import { useModalStore } from '@/shared/components/ui/modal/modal.store'; import { routerPaths } from '@/router/router-paths'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; -import { breakpoints } from '@/styles/breakpoints'; -import { useAuth } from '@/auth/use-auth'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; export function ExpirationModal() { const { signOut } = useAuth(); diff --git a/packages/apps/human-app/frontend/src/auth/auth-context.tsx b/packages/apps/human-app/frontend/src/modules/auth/context/auth-context.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/auth/auth-context.tsx rename to packages/apps/human-app/frontend/src/modules/auth/context/auth-context.tsx index 8b62bd39d4..58dd3897d9 100644 --- a/packages/apps/human-app/frontend/src/auth/auth-context.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth/context/auth-context.tsx @@ -3,9 +3,9 @@ import { useState, createContext, useEffect } from 'react'; import { jwtDecode } from 'jwt-decode'; import { z } from 'zod'; import { useQueryClient } from '@tanstack/react-query'; -import type { SignInSuccessResponse } from '@/api/services/worker/sign-in/types'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; -import { useModalStore } from '@/components/ui/modal/modal.store'; +import type { SignInSuccessResponse } from '@/modules/worker/services/sign-in/types'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; +import { useModalStore } from '@/shared/components/ui/modal/modal.store'; const extendableUserDataSchema = z.object({ site_key: z.string().optional().nullable(), diff --git a/packages/apps/human-app/frontend/src/auth/use-auth.ts b/packages/apps/human-app/frontend/src/modules/auth/hooks/use-auth.ts similarity index 74% rename from packages/apps/human-app/frontend/src/auth/use-auth.ts rename to packages/apps/human-app/frontend/src/modules/auth/hooks/use-auth.ts index e3b25488bf..8ae17c52ab 100644 --- a/packages/apps/human-app/frontend/src/auth/use-auth.ts +++ b/packages/apps/human-app/frontend/src/modules/auth/hooks/use-auth.ts @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { AuthContext } from '@/auth/auth-context'; +import { AuthContext } from '@/modules/auth/context/auth-context'; export function useAuth() { const context = useContext(AuthContext); diff --git a/packages/apps/human-app/frontend/src/auth/use-authenticated-user.tsx b/packages/apps/human-app/frontend/src/modules/auth/hooks/use-authenticated-user.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/auth/use-authenticated-user.tsx rename to packages/apps/human-app/frontend/src/modules/auth/hooks/use-authenticated-user.tsx index 1062be6830..d82256c95c 100644 --- a/packages/apps/human-app/frontend/src/auth/use-authenticated-user.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth/hooks/use-authenticated-user.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { AuthenticatedUserContext } from '@/auth/require-auth'; +import { AuthenticatedUserContext } from '@/modules/auth/providers/require-auth'; export function useAuthenticatedUser() { const context = useContext(AuthenticatedUserContext); diff --git a/packages/apps/human-app/frontend/src/auth/require-auth.tsx b/packages/apps/human-app/frontend/src/modules/auth/providers/require-auth.tsx similarity index 76% rename from packages/apps/human-app/frontend/src/auth/require-auth.tsx rename to packages/apps/human-app/frontend/src/modules/auth/providers/require-auth.tsx index f4d42d2419..decf428974 100644 --- a/packages/apps/human-app/frontend/src/auth/require-auth.tsx +++ b/packages/apps/human-app/frontend/src/modules/auth/providers/require-auth.tsx @@ -1,9 +1,9 @@ import { useLocation, Navigate } from 'react-router-dom'; import { createContext } from 'react'; -import { useAuth } from '@/auth/use-auth'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; import { routerPaths } from '@/router/router-paths'; -import type { AuthenticatedUserContextType } from '@/auth/auth-context'; -import { PageCardLoader } from '@/components/ui/page-card'; +import type { AuthenticatedUserContextType } from '@/modules/auth/context/auth-context'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; export const AuthenticatedUserContext = createContext(null); diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/chat.tsx b/packages/apps/human-app/frontend/src/modules/homepage/components/chat.tsx similarity index 97% rename from packages/apps/human-app/frontend/src/pages/homepage/components/chat.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/components/chat.tsx index 9cd5722b5e..8e84d93fba 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/chat.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/components/chat.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { useIsMobile } from '@/hooks/use-is-mobile'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; export function Chat({ displayChatIcon = true, diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/choose-sign-up-account-type.tsx b/packages/apps/human-app/frontend/src/modules/homepage/components/choose-sign-up-account-type.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/pages/homepage/components/choose-sign-up-account-type.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/components/choose-sign-up-account-type.tsx index 54ed1e0ac6..79a4ae364c 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/choose-sign-up-account-type.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/components/choose-sign-up-account-type.tsx @@ -1,14 +1,14 @@ import { Grid, List, ListItemText, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; -import { useIsMobile } from '@/hooks/use-is-mobile'; +import { Button } from '@/shared/components/ui/button'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; import { routerPaths } from '@/router/router-paths'; -import { PageCard } from '@/components/ui/page-card'; -import type { HomePageStageType } from '@/pages/homepage/home.page'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useHomePageState } from '@/contexts/homepage-state'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { PageCard } from '@/shared/components/ui/page-card'; +import type { HomePageStageType } from '@/modules/homepage/views/home.page'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useHomePageState } from '@/shared/contexts/homepage-state'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; interface ChooseSignUpAccountType { setStage: (step: HomePageStageType) => void; diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/home-container.tsx b/packages/apps/human-app/frontend/src/modules/homepage/components/home-container.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/pages/homepage/components/home-container.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/components/home-container.tsx index 65807fc5b3..7921f64edd 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/home-container.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/components/home-container.tsx @@ -1,7 +1,7 @@ import { Container } from '@mui/material'; import { useEffect } from 'react'; -import { useBackgroundColorStore } from '@/hooks/use-background-store'; -import { useHomePageState } from '@/contexts/homepage-state'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; +import { useHomePageState } from '@/shared/contexts/homepage-state'; import { Welcome } from './welcome'; import { ChooseSignUpAccountType } from './choose-sign-up-account-type'; diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/welcome.tsx b/packages/apps/human-app/frontend/src/modules/homepage/components/welcome.tsx similarity index 87% rename from packages/apps/human-app/frontend/src/pages/homepage/components/welcome.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/components/welcome.tsx index e69d127d10..e1294de4bb 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/welcome.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/components/welcome.tsx @@ -6,14 +6,14 @@ import { HomepageUserIcon, HomepageWorkIcon, MobileHomeIcons, -} from '@/components/ui/icons'; -import { Button } from '@/components/ui/button'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { OperatorSignIn } from '@/pages/homepage/components/operator-signin'; -import { WorkerSignIn } from '@/pages/homepage/components/worker-signin'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useHomePageState } from '@/contexts/homepage-state'; -import { useBackgroundColorStore } from '@/hooks/use-background-store'; +} from '@/shared/components/ui/icons'; +import { Button } from '@/shared/components/ui/button'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { OperatorSignIn } from '@/modules/homepage/hooks/use-operator-signin'; +import { WorkerSignIn } from '@/modules/homepage/components/worker-signin'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useHomePageState } from '@/shared/contexts/homepage-state'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; export function Welcome() { const { colorPalette, isDarkMode } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx b/packages/apps/human-app/frontend/src/modules/homepage/components/worker-signin.tsx similarity index 87% rename from packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/components/worker-signin.tsx index 1bf95ace9a..780c25cb38 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/worker-signin.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/components/worker-signin.tsx @@ -1,6 +1,6 @@ import { t } from 'i18next'; import { Link } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; import { routerPaths } from '@/router/router-paths'; export function WorkerSignIn() { diff --git a/packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx b/packages/apps/human-app/frontend/src/modules/homepage/hooks/use-operator-signin.tsx similarity index 85% rename from packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/hooks/use-operator-signin.tsx index 8f019034a2..f0b57cf170 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/components/operator-signin.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/hooks/use-operator-signin.tsx @@ -2,13 +2,13 @@ import { t } from 'i18next'; import { useEffect, useRef } from 'react'; import { Link } from 'react-router-dom'; import Snackbar from '@mui/material/Snackbar'; -import { Button } from '@/components/ui/button'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import { useWeb3SignIn } from '@/api/services/operator/web3-signin'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; +import { Button } from '@/shared/components/ui/button'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import { useWeb3SignIn } from '@/modules/operator/hooks/use-web3-signin'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; import { routerPaths } from '@/router/router-paths'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { PrepareSignatureType } from '@/api/services/common/prepare-signature'; +import { PrepareSignatureType } from '@/api/hooks/use-prepare-signature'; export function OperatorSignIn() { const { isConnected, openModal, address } = useWalletConnect(); diff --git a/packages/apps/human-app/frontend/src/pages/homepage/home.page.tsx b/packages/apps/human-app/frontend/src/modules/homepage/views/home.page.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/pages/homepage/home.page.tsx rename to packages/apps/human-app/frontend/src/modules/homepage/views/home.page.tsx index 0b101f6391..a3a69c973a 100644 --- a/packages/apps/human-app/frontend/src/pages/homepage/home.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/homepage/views/home.page.tsx @@ -2,14 +2,14 @@ import Box from '@mui/material/Box'; import { Paper } from '@mui/material'; import { Navigate } from 'react-router-dom'; import { t } from 'i18next'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; -import { useAuth } from '@/auth/use-auth'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; import { routerPaths } from '@/router/router-paths'; -import { Button } from '@/components/ui/button'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useHomePageState } from '@/contexts/homepage-state'; -import { HomeContainer } from './components/home-container'; +import { Button } from '@/shared/components/ui/button'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useHomePageState } from '@/shared/contexts/homepage-state'; +import { HomeContainer } from '@/modules/homepage/components/home-container'; export type HomePageStageType = 'welcome' | 'chooseSignUpAccountType'; diff --git a/packages/apps/human-app/frontend/src/pages/operator/profile/profile-disable-button.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/profile/profile-disable-button.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/pages/operator/profile/profile-disable-button.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/profile/profile-disable-button.tsx index 76515041cf..df192984ac 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/profile/profile-disable-button.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/profile/profile-disable-button.tsx @@ -1,13 +1,13 @@ import { t } from 'i18next'; import { Typography } from '@mui/material'; -import { useDisableWeb3Operator } from '@/api/services/operator/disable-operator'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; -import { Button } from '@/components/ui/button'; -import type { SignatureData } from '@/api/services/common/prepare-signature'; +import { useDisableWeb3Operator } from '@/modules/operator/hooks/use-disable-operator'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import { Button } from '@/shared/components/ui/button'; +import type { SignatureData } from '@/api/hooks/use-prepare-signature'; import { PrepareSignatureType, usePrepareSignature, -} from '@/api/services/common/prepare-signature'; +} from '@/api/hooks/use-prepare-signature'; export function ProfileDisableButton() { const { address, signMessage } = useConnectedWallet(); diff --git a/packages/apps/human-app/frontend/src/pages/operator/profile/profile-enable-button.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/profile/profile-enable-button.tsx similarity index 79% rename from packages/apps/human-app/frontend/src/pages/operator/profile/profile-enable-button.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/profile/profile-enable-button.tsx index 8024ba1331..b8ed244ac5 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/profile/profile-enable-button.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/profile/profile-enable-button.tsx @@ -1,5 +1,5 @@ import { t } from 'i18next'; -import { Button } from '@/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; export function ProfileEnableButton() { // TODO add operator activation diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-existing-keys-form.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/edit-existing-keys-form.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-existing-keys-form.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/edit-existing-keys-form.tsx index 85466884b6..fef821c938 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-existing-keys-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/edit-existing-keys-form.tsx @@ -1,20 +1,23 @@ import { Grid, Typography } from '@mui/material'; import { t } from 'i18next'; import { useFormState } from 'react-hook-form'; -import type { CustomButtonProps } from '@/components/ui/button'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/data-entry/input'; -import type { EthKVStoreKeyValues } from '@/smart-contracts/EthKVStore/config'; -import { EthKVStoreKeys, Role } from '@/smart-contracts/EthKVStore/config'; -import { Select } from '@/components/data-entry/select'; -import { MultiSelect } from '@/components/data-entry/multi-select'; +import type { CustomButtonProps } from '@/shared/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; +import { Input } from '@/shared/components/data-entry/input'; +import type { EthKVStoreKeyValues } from '@/modules/smart-contracts/EthKVStore/config'; +import { + EthKVStoreKeys, + Role, +} from '@/modules/smart-contracts/EthKVStore/config'; +import { Select } from '@/shared/components/data-entry/select'; +import { MultiSelect } from '@/shared/components/data-entry/multi-select'; import { JOB_TYPES } from '@/shared/consts'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; import { order, sortFormKeys, -} from '@/pages/operator/sign-up/add-keys/sort-form'; -import { useColorMode } from '@/hooks/use-color-mode'; +} from '@/modules/operator/components/sign-up/add-keys/sort-form'; const OPTIONS = [Role.ExchangeOracle, Role.JobLauncher, Role.RecordingOracle]; diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-pending-keys-form.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/edit-pending-keys-form.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-pending-keys-form.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/edit-pending-keys-form.tsx index 067bd355ec..704b71c7c8 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-pending-keys-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/edit-pending-keys-form.tsx @@ -1,16 +1,19 @@ import { Grid, Typography } from '@mui/material'; import { t } from 'i18next'; -import { Input } from '@/components/data-entry/input'; -import type { EthKVStoreKeyValues } from '@/smart-contracts/EthKVStore/config'; -import { EthKVStoreKeys, Role } from '@/smart-contracts/EthKVStore/config'; -import { Select } from '@/components/data-entry/select'; -import { MultiSelect } from '@/components/data-entry/multi-select'; +import { Input } from '@/shared/components/data-entry/input'; +import type { EthKVStoreKeyValues } from '@/modules/smart-contracts/EthKVStore/config'; +import { + EthKVStoreKeys, + Role, +} from '@/modules/smart-contracts/EthKVStore/config'; +import { Select } from '@/shared/components/data-entry/select'; +import { MultiSelect } from '@/shared/components/data-entry/multi-select'; import { JOB_TYPES } from '@/shared/consts'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; import { order, sortFormKeys, -} from '@/pages/operator/sign-up/add-keys/sort-form'; +} from '@/modules/operator/components/sign-up/add-keys/sort-form'; const OPTIONS = [Role.ExchangeOracle, Role.JobLauncher, Role.RecordingOracle]; diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/existing-keys-form.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/existing-keys-form.tsx similarity index 82% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/existing-keys-form.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/existing-keys-form.tsx index b7844a0cd0..bb4e3a2e06 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/existing-keys-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/existing-keys-form.tsx @@ -3,15 +3,15 @@ import { Grid } from '@mui/material'; import { zodResolver } from '@hookform/resolvers/zod'; import type { UseFormReturn } from 'react-hook-form'; import { FormProvider, useForm } from 'react-hook-form'; -import type { EditEthKVStoreValuesMutationData } from '@/api/services/operator/edit-existing-keys'; +import type { EditEthKVStoreValuesMutationData } from '@/modules/operator/hooks/use-edit-existing-keys'; import { getEditEthKVStoreValuesMutationSchema, useEditExistingKeysMutation, -} from '@/api/services/operator/edit-existing-keys'; -import { ExistingKeys } from '@/pages/operator/sign-up/add-keys/existing-keys'; -import { EditExistingKeysForm } from '@/pages/operator/sign-up/add-keys/edit-existing-keys-form'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; +} from '@/modules/operator/hooks/use-edit-existing-keys'; +import { ExistingKeys } from '@/modules/operator/components/sign-up/add-keys/existing-keys'; +import { EditExistingKeysForm } from '@/modules/operator/components/sign-up/add-keys/edit-existing-keys-form'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; export type UseFormResult = UseFormReturn< GetEthKVStoreValuesSuccessResponse, diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/existing-keys.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/existing-keys.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/existing-keys.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/existing-keys.tsx index cd86fc0fb9..8eb715e501 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/existing-keys.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/existing-keys.tsx @@ -3,19 +3,19 @@ import { Grid, Typography } from '@mui/material'; import { t } from 'i18next'; import ModeEditIcon from '@mui/icons-material/ModeEdit'; import { useFormContext } from 'react-hook-form'; -import { Button } from '@/components/ui/button'; -import type { EthKVStoreKeyValues } from '@/smart-contracts/EthKVStore/config'; -import { EthKVStoreKeys } from '@/smart-contracts/EthKVStore/config'; -import { OptionalText } from '@/components/ui/optional-text'; -import { EmptyPlaceholder } from '@/components/ui/empty-placeholder'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; -import { Chips } from '@/components/ui/chips'; -import { Chip } from '@/components/ui/chip'; +import { Button } from '@/shared/components/ui/button'; +import type { EthKVStoreKeyValues } from '@/modules/smart-contracts/EthKVStore/config'; +import { EthKVStoreKeys } from '@/modules/smart-contracts/EthKVStore/config'; +import { OptionalText } from '@/shared/components/ui/optional-text'; +import { EmptyPlaceholder } from '@/shared/components/ui/empty-placeholder'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; +import { Chips } from '@/shared/components/ui/chips'; +import { Chip } from '@/shared/components/ui/chip'; import { order, sortFormKeys, -} from '@/pages/operator/sign-up/add-keys/sort-form'; -import { useColorMode } from '@/hooks/use-color-mode'; +} from '@/modules/operator/components/sign-up/add-keys/sort-form'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; const existingKeysConfig: Record< EthKVStoreKeyValues, diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/pending-keys-form.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/pending-keys-form.tsx similarity index 77% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/pending-keys-form.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/pending-keys-form.tsx index 5a214ca97d..697fb84cb8 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/pending-keys-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/pending-keys-form.tsx @@ -1,15 +1,15 @@ import { t } from 'i18next'; import { zodResolver } from '@hookform/resolvers/zod'; import { FormProvider, useForm } from 'react-hook-form'; -import type { EditEthKVStoreValuesMutationData } from '@/api/services/operator/edit-existing-keys'; +import type { EditEthKVStoreValuesMutationData } from '@/modules/operator/hooks/use-edit-existing-keys'; import { setEthKVStoreValuesMutationSchema, useEditExistingKeysMutation, -} from '@/api/services/operator/edit-existing-keys'; -import { Button } from '@/components/ui/button'; -import { EditPendingKeysForm } from '@/pages/operator/sign-up/add-keys/edit-pending-keys-form'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; +} from '@/modules/operator/hooks/use-edit-existing-keys'; +import { Button } from '@/shared/components/ui/button'; +import { EditPendingKeysForm } from '@/modules/operator/components/sign-up/add-keys/edit-pending-keys-form'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; export function PendingKeysForm({ keysData, diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/sort-form.ts b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/sort-form.ts similarity index 70% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/sort-form.ts rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/sort-form.ts index f769d14ba0..1e05ad1ff1 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/sort-form.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-keys/sort-form.ts @@ -1,5 +1,5 @@ -import type { EthKVStoreKeyValues } from '@/smart-contracts/EthKVStore/config'; -import { EthKVStoreKeys } from '@/smart-contracts/EthKVStore/config'; +import type { EthKVStoreKeyValues } from '@/modules/smart-contracts/EthKVStore/config'; +import { EthKVStoreKeys } from '@/modules/smart-contracts/EthKVStore/config'; export const sortFormKeys = ( keys: EthKVStoreKeyValues[], diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/buttons.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-stake/buttons.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/buttons.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-stake/buttons.tsx index f07290b24c..9849f41820 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/buttons.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-stake/buttons.tsx @@ -2,7 +2,7 @@ import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import { t } from 'i18next'; import { Link } from 'react-router-dom'; -import { breakpoints } from '@/styles/breakpoints'; +import { breakpoints } from '@/shared/styles/breakpoints'; import { routerPaths } from '@/router/router-paths'; export function Buttons({ diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/stake-form.tsx b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-stake/stake-form.tsx similarity index 89% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/stake-form.tsx rename to packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-stake/stake-form.tsx index 2c3985d5c2..660d2001fb 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/stake-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/components/sign-up/add-stake/stake-form.tsx @@ -9,12 +9,12 @@ import { addStakeAmountCallArgumentsSchema, useAddStakeMutation, type AddStakeCallArguments, -} from '@/api/services/operator/add-stake'; -import { breakpoints } from '@/styles/breakpoints'; -import { Input } from '@/components/data-entry/input'; +} from '@/modules/operator/hooks/use-add-stake'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { Input } from '@/shared/components/data-entry/input'; import { routerPaths } from '@/router/router-paths'; -import { Button } from '@/components/ui/button'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; +import { Button } from '@/shared/components/ui/button'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; export function StakeForm({ decimals, diff --git a/packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake-mutation-state.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake-mutation-state.ts new file mode 100644 index 0000000000..ec007fc25d --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake-mutation-state.ts @@ -0,0 +1,19 @@ +import last from 'lodash/last'; +import { useMutationState } from '@tanstack/react-query'; +import type { MutationState } from '@tanstack/react-query'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import type { ResponseError } from '@/shared/types/global.type'; +import { type AddStakeCallArguments } from '@/modules/operator/hooks/use-add-stake'; + +export function useAddStakeMutationState() { + const { address } = useConnectedWallet(); + + const state = useMutationState({ + filters: { mutationKey: ['addStake', address] }, + select: (mutation) => mutation.state, + }); + + return last(state) as + | MutationState + | undefined; +} diff --git a/packages/apps/human-app/frontend/src/api/services/operator/add-stake.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake.ts similarity index 71% rename from packages/apps/human-app/frontend/src/api/services/operator/add-stake.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake.ts index 4b95b42f3b..703e477371 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/add-stake.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-add-stake.ts @@ -1,23 +1,16 @@ import { z } from 'zod'; -import last from 'lodash/last'; -import type { MutationState } from '@tanstack/react-query'; -import { - useMutation, - useMutationState, - useQueryClient, -} from '@tanstack/react-query'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; import { t } from 'i18next'; import { useNavigate } from 'react-router-dom'; import { ethers } from 'ethers'; -import { stakingStake } from '@/smart-contracts/Staking/staking-stake'; -import type { ResponseError } from '@/shared/types/global.type'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; -import { hmTokenApprove } from '@/smart-contracts/HMToken/hm-token-approve'; -import type { ContractCallArguments } from '@/smart-contracts/types'; +import { stakingStake } from '@/modules/smart-contracts/Staking/staking-stake'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; +import { hmTokenApprove } from '@/modules/smart-contracts/HMToken/hm-token-approve'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; import { routerPaths } from '@/router/router-paths'; -import { hmTokenAllowance } from '@/smart-contracts/HMToken/hm-token-allowance'; -import { useHMTokenDecimals } from '@/api/services/operator/human-token-decimals'; +import { hmTokenAllowance } from '@/modules/smart-contracts/HMToken/hm-token-allowance'; +import { useHMTokenDecimals } from '@/modules/operator/hooks/use-human-token-decimals'; type AmountValidation = z.ZodEffects< z.ZodEffects, @@ -123,16 +116,3 @@ export function useAddStakeMutation() { mutationKey: ['addStake', address], }); } - -export function useAddStakeMutationState() { - const { address } = useConnectedWallet(); - - const state = useMutationState({ - filters: { mutationKey: ['addStake', address] }, - select: (mutation) => mutation.state, - }); - - return last(state) as - | MutationState - | undefined; -} diff --git a/packages/apps/human-app/frontend/src/api/services/operator/disable-operator.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-disable-operator.ts similarity index 78% rename from packages/apps/human-app/frontend/src/api/services/operator/disable-operator.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-disable-operator.ts index 1dff53b170..421c9aa88e 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/disable-operator.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-disable-operator.ts @@ -1,9 +1,9 @@ import { useMutation } from '@tanstack/react-query'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; -import { useAccessTokenRefresh } from '@/api/services/common/use-access-token-refresh'; -import { useWeb3AuthenticatedUser } from '@/auth-web3/use-web3-authenticated-user'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import { useAccessTokenRefresh } from '@/api/hooks/use-access-token-refresh'; +import { useWeb3AuthenticatedUser } from '@/modules/auth-web3/hooks/use-web3-authenticated-user'; export function useDisableWeb3Operator() { const { address, chainId } = useConnectedWallet(); diff --git a/packages/apps/human-app/frontend/src/api/services/operator/edit-existing-keys.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-edit-existing-keys.ts similarity index 92% rename from packages/apps/human-app/frontend/src/api/services/operator/edit-existing-keys.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-edit-existing-keys.ts index 13315e0589..6ff6679d2b 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/edit-existing-keys.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-edit-existing-keys.ts @@ -9,15 +9,15 @@ import type { JsonRpcSigner } from 'ethers'; import { z, ZodError } from 'zod'; import { t } from 'i18next'; import { routerPaths } from '@/router/router-paths'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; import { EthKVStoreKeys, JobType, Role, -} from '@/smart-contracts/EthKVStore/config'; -import { ethKvStoreSetBulk } from '@/smart-contracts/EthKVStore/eth-kv-store-set-bulk'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; +} from '@/modules/smart-contracts/EthKVStore/config'; +import { ethKvStoreSetBulk } from '@/modules/smart-contracts/EthKVStore/eth-kv-store-set-bulk'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; import { isArray } from '@/shared/helpers/is-array'; import { urlDomainSchema } from '@/shared/helpers/url-domain-validation'; diff --git a/packages/apps/human-app/frontend/src/api/services/operator/get-keys.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-keys.ts similarity index 78% rename from packages/apps/human-app/frontend/src/api/services/operator/get-keys.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-keys.ts index 27701b4090..47eab661c0 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/get-keys.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-keys.ts @@ -1,9 +1,9 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; -import { ethKVStoreGetKeys } from '@/smart-contracts/EthKVStore/eth-kv-store-get-keys'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; -import { EthKVStoreKeys } from '@/smart-contracts/EthKVStore/config'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import { ethKVStoreGetKeys } from '@/modules/smart-contracts/EthKVStore/eth-kv-store-get-keys'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; +import { EthKVStoreKeys } from '@/modules/smart-contracts/EthKVStore/config'; export const getEthKVStoreValuesSuccessSchema = z.object({ [EthKVStoreKeys.PublicKey]: z.string().optional(), diff --git a/packages/apps/human-app/frontend/src/api/services/operator/get-stacked-amount.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-stacked-amount.ts similarity index 79% rename from packages/apps/human-app/frontend/src/api/services/operator/get-stacked-amount.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-stacked-amount.ts index dd1c58ee34..2d7aa5fa73 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/get-stacked-amount.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-stacked-amount.ts @@ -1,9 +1,9 @@ import { useQuery } from '@tanstack/react-query'; import { ethers } from 'ethers'; import { t } from 'i18next'; -import { stakingGetStakedTokens } from '@/smart-contracts/Staking/staking-get-staked-tokens'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; +import { stakingGetStakedTokens } from '@/modules/smart-contracts/Staking/staking-get-staked-tokens'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; export const stakedAmountFormatter = (amount: bigint) => { const amountAsString = ethers.formatEther(amount); diff --git a/packages/apps/human-app/frontend/src/api/services/operator/get-stats.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-stats.ts similarity index 94% rename from packages/apps/human-app/frontend/src/api/services/operator/get-stats.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-stats.ts index d16db88999..64b186089d 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/get-stats.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-get-stats.ts @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; import { apiClient } from '@/api/api-client'; -import { useGetKeys } from '@/api/services/operator/get-keys'; +import { useGetKeys } from '@/modules/operator/hooks/use-get-keys'; const operatorStatsSuccessResponseSchema = z.object({ workers_total: z.number(), diff --git a/packages/apps/human-app/frontend/src/api/services/operator/human-token-decimals.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-human-token-decimals.ts similarity index 66% rename from packages/apps/human-app/frontend/src/api/services/operator/human-token-decimals.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-human-token-decimals.ts index b08239a182..21d3560603 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/human-token-decimals.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-human-token-decimals.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; -import { hmTokenDecimals } from '@/smart-contracts/HMToken/hm-token-decimals'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; +import { hmTokenDecimals } from '@/modules/smart-contracts/HMToken/hm-token-decimals'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; export function useHMTokenDecimals() { const { diff --git a/packages/apps/human-app/frontend/src/api/services/operator/web3-signin.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-web3-signin.ts similarity index 83% rename from packages/apps/human-app/frontend/src/api/services/operator/web3-signin.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-web3-signin.ts index 7b2aa4b63b..40c55669d2 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/web3-signin.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-web3-signin.ts @@ -5,11 +5,11 @@ import { useNavigate } from 'react-router-dom'; import { t } from 'i18next'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; import { routerPaths } from '@/router/router-paths'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import type { PrepareSignatureBody } from '@/api/services/common/prepare-signature'; -import { prepareSignature } from '@/api/services/common/prepare-signature'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import type { PrepareSignatureBody } from '@/api/hooks/use-prepare-signature'; +import { prepareSignature } from '@/api/hooks/use-prepare-signature'; export const web3SignInSuccessResponseSchema = z.object({ access_token: z.string(), diff --git a/packages/apps/human-app/frontend/src/api/services/operator/web3-signup.ts b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-web3-signup.ts similarity index 88% rename from packages/apps/human-app/frontend/src/api/services/operator/web3-signup.ts rename to packages/apps/human-app/frontend/src/modules/operator/hooks/use-web3-signup.ts index acb068915f..a24c5e610e 100644 --- a/packages/apps/human-app/frontend/src/api/services/operator/web3-signup.ts +++ b/packages/apps/human-app/frontend/src/modules/operator/hooks/use-web3-signup.ts @@ -2,10 +2,10 @@ import { useMutation } from '@tanstack/react-query'; import { z } from 'zod'; import { useNavigate } from 'react-router-dom'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; import { routerPaths } from '@/router/router-paths'; export const web3SignInSuccessResponseSchema = z.object({ diff --git a/packages/apps/human-app/frontend/src/pages/operator/profile/profile.page.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/profile/profile.page.tsx similarity index 88% rename from packages/apps/human-app/frontend/src/pages/operator/profile/profile.page.tsx rename to packages/apps/human-app/frontend/src/modules/operator/views/profile/profile.page.tsx index 15cc540b4e..b64e7f992b 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/profile/profile.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/profile/profile.page.tsx @@ -1,17 +1,18 @@ import { useEffect } from 'react'; import { Grid, List, Paper, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { useGetKeys } from '@/api/services/operator/get-keys'; -import { useWeb3AuthenticatedUser } from '@/auth-web3/use-web3-authenticated-user'; -import { PageCardError, PageCardLoader } from '@/components/ui/page-card'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { useGetKeys } from '@/modules/operator/hooks/use-get-keys'; +import { useWeb3AuthenticatedUser } from '@/modules/auth-web3/hooks/use-web3-authenticated-user'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { ProfileDisableButton } from '@/pages/operator/profile/profile-disable-button'; -import { ProfileListItem } from '@/components/ui/profile-list-item'; -import { useGetOperatorStats } from '@/api/services/operator/get-stats'; -import { ProfileEnableButton } from '@/pages/operator/profile/profile-enable-button'; -import { CheckmarkIcon, LockerIcon } from '@/components/ui/icons'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { ProfileDisableButton } from '@/modules/operator/components/profile/profile-disable-button'; +import { ProfileListItem } from '@/shared/components/ui/profile-list-item'; +import { useGetOperatorStats } from '@/modules/operator/hooks/use-get-stats'; +import { ProfileEnableButton } from '@/modules/operator/components/profile/profile-enable-button'; +import { CheckmarkIcon, LockerIcon } from '@/shared/components/ui/icons'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function OperatorProfilePage() { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/add-keys.page.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx similarity index 70% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/add-keys.page.tsx rename to packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx index be61603bd9..b1e5dd836e 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/add-keys.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx @@ -2,22 +2,20 @@ import { Grid } from '@mui/material'; import type { UseFormReturn } from 'react-hook-form'; import { t } from 'i18next'; import { Link } from 'react-router-dom'; -import { - PageCard, - PageCardError, - PageCardLoader, -} from '@/components/ui/page-card'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { PageCard } from '@/shared/components/ui/page-card'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { Alert } from '@/components/ui/alert'; -import type { EditEthKVStoreValuesMutationData } from '@/api/services/operator/edit-existing-keys'; -import { useEditExistingKeysMutationState } from '@/api/services/operator/edit-existing-keys'; -import type { GetEthKVStoreValuesSuccessResponse } from '@/api/services/operator/get-keys'; -import { useGetKeys } from '@/api/services/operator/get-keys'; +import type { EditEthKVStoreValuesMutationData } from '@/modules/operator/hooks/use-edit-existing-keys'; +import { useEditExistingKeysMutationState } from '@/modules/operator/hooks/use-edit-existing-keys'; +import type { GetEthKVStoreValuesSuccessResponse } from '@/modules/operator/hooks/use-get-keys'; +import { useGetKeys } from '@/modules/operator/hooks/use-get-keys'; import { jsonRpcErrorHandler } from '@/shared/helpers/json-rpc-error-handler'; -import { ExistingKeysForm } from '@/pages/operator/sign-up/add-keys/existing-keys-form'; -import { PendingKeysForm } from '@/pages/operator/sign-up/add-keys/pending-keys-form'; -import { Button } from '@/components/ui/button'; import { routerPaths } from '@/router/router-paths'; +import { ExistingKeysForm } from '@/modules/operator/components/sign-up/add-keys/existing-keys-form'; +import { PendingKeysForm } from '@/modules/operator/components/sign-up/add-keys/pending-keys-form'; +import { Button } from '@/shared/components/ui/button'; +import { Alert } from '@/shared/components/ui/alert'; export type UseFormResult = UseFormReturn< GetEthKVStoreValuesSuccessResponse, @@ -64,8 +62,7 @@ export function Form({ }) { const areSomeExistingKeys = Object.values(keysData).filter(Boolean).length; const areSomePendingKeys = Object.entries(keysData).filter( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- it's necessary - ([key, values]) => key && !values?.length + ([key, values]) => key && !values.length ).length; return ( diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/add-stake.page.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-stake.page.tsx similarity index 77% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/add-stake.page.tsx rename to packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-stake.page.tsx index 993b06ac42..9e9289e234 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-stake/add-stake.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-stake.page.tsx @@ -2,23 +2,21 @@ import Grid from '@mui/material/Grid'; import { Typography } from '@mui/material'; import { useState } from 'react'; import { t } from 'i18next'; -import { - PageCard, - PageCardError, - PageCardLoader, -} from '@/components/ui/page-card'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { PageCard } from '@/shared/components/ui/page-card'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { Buttons } from '@/pages/operator/sign-up/add-stake/buttons'; -import { StakeForm } from '@/pages/operator/sign-up/add-stake/stake-form'; -import { Alert } from '@/components/ui/alert'; +import { Buttons } from '@/modules/operator/components/sign-up/add-stake/buttons'; +import { StakeForm } from '@/modules/operator/components/sign-up/add-stake/stake-form'; +import { Alert } from '@/shared/components/ui/alert'; import { stakedAmountFormatter, useGetStakedAmount, -} from '@/api/services/operator/get-stacked-amount'; -import { useAddStakeMutationState } from '@/api/services/operator/add-stake'; -import { useHMTokenDecimals } from '@/api/services/operator/human-token-decimals'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +} from '@/modules/operator/hooks/use-get-stacked-amount'; +import { useAddStakeMutationState } from '@/modules/operator/hooks/use-add-stake-mutation-state'; +import { useHMTokenDecimals } from '@/modules/operator/hooks/use-human-token-decimals'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; export function AddStakeOperatorPage() { const { colorPalette, isDarkMode } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/connect-wallet.page.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/connect-wallet.page.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/connect-wallet.page.tsx rename to packages/apps/human-app/frontend/src/modules/operator/views/sign-up/connect-wallet.page.tsx index 5885247903..bf5ef8ca57 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/connect-wallet.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/connect-wallet.page.tsx @@ -1,12 +1,12 @@ import { Grid, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { Navigate } from 'react-router-dom'; -import { PageCard } from '@/components/ui/page-card'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import { Alert } from '@/components/ui/alert'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import { Alert } from '@/shared/components/ui/alert'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { Button } from '@/components/ui/button'; -import { useModalStore } from '@/components/ui/modal/modal.store'; +import { Button } from '@/shared/components/ui/button'; +import { useModalStore } from '@/shared/components/ui/modal/modal.store'; import { routerPaths } from '@/router/router-paths'; export function ConnectWalletOperatorPage() { diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-existing-keys-success.page.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/edit-existing-keys-success.page.tsx similarity index 77% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-existing-keys-success.page.tsx rename to packages/apps/human-app/frontend/src/modules/operator/views/sign-up/edit-existing-keys-success.page.tsx index 6fa06026e6..3ff5c2e825 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/add-keys/edit-existing-keys-success.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/edit-existing-keys-success.page.tsx @@ -1,20 +1,18 @@ import { t } from 'i18next'; import { Grid, Typography } from '@mui/material'; -import { - PageCard, - PageCardError, - PageCardLoader, -} from '@/components/ui/page-card'; -import { Button } from '@/components/ui/button'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { Button } from '@/shared/components/ui/button'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { useWeb3SignUp } from '@/api/services/operator/web3-signup'; -import { Alert } from '@/components/ui/alert'; -import type { SignatureData } from '@/api/services/common/prepare-signature'; +import { useWeb3SignUp } from '@/modules/operator/hooks/use-web3-signup'; +import type { SignatureData } from '@/api/hooks/use-prepare-signature'; import { PrepareSignatureType, usePrepareSignature, -} from '@/api/services/common/prepare-signature'; +} from '@/api/hooks/use-prepare-signature'; +import { Alert } from '@/shared/components/ui/alert'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; export function EditExistingKeysSuccessPage() { const { address, signMessage } = useConnectedWallet(); diff --git a/packages/apps/human-app/frontend/src/pages/operator/sign-up/set-up-operator.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/set-up-operator.page.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/pages/operator/sign-up/set-up-operator.tsx rename to packages/apps/human-app/frontend/src/modules/operator/views/sign-up/set-up-operator.page.tsx index dfdfd1ab2e..920b50bf3a 100644 --- a/packages/apps/human-app/frontend/src/pages/operator/sign-up/set-up-operator.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/set-up-operator.page.tsx @@ -1,11 +1,11 @@ import { Grid, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { PageCard } from '@/components/ui/page-card'; -import { Alert } from '@/components/ui/alert'; -import { Button } from '@/components/ui/button'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { Alert } from '@/shared/components/ui/alert'; +import { Button } from '@/shared/components/ui/button'; import { routerPaths } from '@/router/router-paths'; -import { useConnectedWallet } from '@/auth-web3/use-connected-wallet'; +import { useConnectedWallet } from '@/modules/auth-web3/hooks/use-connected-wallet'; export function SetUpOperatorPage() { const { t } = useTranslation(); diff --git a/packages/apps/human-app/frontend/src/pages/playground/modal-example/modal-example.tsx b/packages/apps/human-app/frontend/src/modules/playground/components/modal-example/modal-example.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/pages/playground/modal-example/modal-example.tsx rename to packages/apps/human-app/frontend/src/modules/playground/components/modal-example/modal-example.tsx diff --git a/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-example.tsx b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-example.tsx new file mode 100644 index 0000000000..595d3aa878 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-example.tsx @@ -0,0 +1,10 @@ +import { TableQueryContextProvider } from '@/shared/components/ui/table/table-query-context'; +import { Table } from '@/modules/playground/components/table-example/table'; + +export function TableExample() { + return ( + + + + ); +} diff --git a/packages/apps/human-app/frontend/src/pages/playground/table-example/table-search-form.tsx b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-search-form.tsx similarity index 91% rename from packages/apps/human-app/frontend/src/pages/playground/table-example/table-search-form.tsx rename to packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-search-form.tsx index 98b19517b9..551216976b 100644 --- a/packages/apps/human-app/frontend/src/pages/playground/table-example/table-search-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-search-form.tsx @@ -1,8 +1,8 @@ import Search from '@mui/icons-material/Search'; import InputAdornment from '@mui/material/InputAdornment'; import { FormProvider, useForm } from 'react-hook-form'; -import { Input } from '@/components/data-entry/input'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { Input } from '@/shared/components/data-entry/input'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface SearchFormProps { label: string; diff --git a/packages/apps/human-app/frontend/src/pages/playground/table-example/table-service.tsx b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-service.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/pages/playground/table-example/table-service.tsx rename to packages/apps/human-app/frontend/src/modules/playground/components/table-example/table-service.tsx diff --git a/packages/apps/human-app/frontend/src/pages/playground/table-example/table.tsx b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/pages/playground/table-example/table.tsx rename to packages/apps/human-app/frontend/src/modules/playground/components/table-example/table.tsx index 26e4446f58..f086f2ac28 100644 --- a/packages/apps/human-app/frontend/src/pages/playground/table-example/table.tsx +++ b/packages/apps/human-app/frontend/src/modules/playground/components/table-example/table.tsx @@ -4,13 +4,13 @@ import { type MRT_ColumnDef, } from 'material-react-table'; import { useQuery } from '@tanstack/react-query'; -import { TableHeaderCell } from '@/components/ui/table/table-header-cell'; -import { useTableQuery } from '@/components/ui/table/table-query-hook'; -import type { Person } from '@/pages/playground/table-example/table-service'; -import { getTableData } from '@/pages/playground/table-example/table-service'; -import { SearchForm } from '@/pages/playground/table-example/table-search-form'; -import { Sorting } from '@/components/ui/table/table-header-menu.tsx/sorting'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; +import { TableHeaderCell } from '@/shared/components/ui/table/table-header-cell'; +import { useTableQuery } from '@/shared/components/ui/table/table-query-hook'; +import type { Person } from '@/modules/playground/components/table-example/table-service'; +import { getTableData } from '@/modules/playground/components/table-example/table-service'; +import { SearchForm } from '@/modules/playground/components/table-example/table-search-form'; +import { Sorting } from '@/shared/components/ui/table/table-header-menu.tsx/sorting'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; const columns: MRT_ColumnDef[] = [ { diff --git a/packages/apps/human-app/frontend/src/pages/playground/playground.page.tsx b/packages/apps/human-app/frontend/src/modules/playground/views/playground.page.tsx similarity index 65% rename from packages/apps/human-app/frontend/src/pages/playground/playground.page.tsx rename to packages/apps/human-app/frontend/src/modules/playground/views/playground.page.tsx index f491614513..b4e76710b5 100644 --- a/packages/apps/human-app/frontend/src/pages/playground/playground.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/playground/views/playground.page.tsx @@ -1,6 +1,6 @@ import Paper from '@mui/material/Paper'; -import { FormExample } from '@/components/data-entry/form-example'; -import { UiExample } from '@/components/ui/ui-example'; +import { FormExample } from '@/shared/components/data-entry/form-example'; +import { UiExample } from '@/shared/components/ui/ui-example'; export function Playground() { return ( diff --git a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/config.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/config.ts similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/config.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/config.ts diff --git a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts similarity index 78% rename from packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts index f0a35affc2..97369c0722 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-get-keys.ts @@ -1,8 +1,8 @@ import { Contract } from 'ethers'; -import EthKVStore from '@/smart-contracts/abi/EthKVStore.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import { EthKVStoreKeys } from '@/smart-contracts/EthKVStore/config'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import EthKVStore from '@/modules/smart-contracts/abi/EthKVStore.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import { EthKVStoreKeys } from '@/modules/smart-contracts/EthKVStore/config'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function ethKVStoreGetKeys({ accountAddress, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts similarity index 64% rename from packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts index 35a9da78cc..b1c1534671 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data.ts @@ -1,11 +1,11 @@ import { Contract, ethers } from 'ethers'; -import EthKVStore from '@/smart-contracts/abi/EthKVStore.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import type { KYCKey } from '@/smart-contracts/EthKVStore/config'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import EthKVStore from '@/modules/smart-contracts/abi/EthKVStore.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import type { KYCKey } from '@/modules/smart-contracts/EthKVStore/config'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; import { env } from '@/shared/env'; -import type { ChainWithAddresses } from '@/smart-contracts/chains'; -import { MainnetChains, TestnetChains } from '@/smart-contracts/chains'; +import type { ChainWithAddresses } from '@/modules/smart-contracts/chains'; +import { MainnetChains, TestnetChains } from '@/modules/smart-contracts/chains'; export async function ethKVStoreGetKycData({ kycKey, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts similarity index 72% rename from packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts index 13442ada46..fa66068de9 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/EthKVStore/eth-kv-store-set-bulk.ts @@ -1,11 +1,11 @@ import { Contract } from 'ethers'; -import EthKVStore from '@/smart-contracts/abi/EthKVStore.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; +import EthKVStore from '@/modules/smart-contracts/abi/EthKVStore.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; import type { SetKYCPayload, SetOperatorPayload, -} from '@/smart-contracts/EthKVStore/config'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +} from '@/modules/smart-contracts/EthKVStore/config'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function ethKvStoreSetBulk({ keys, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-allowance.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-allowance.ts similarity index 69% rename from packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-allowance.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-allowance.ts index d318b5f9a8..5d45bdf21a 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-allowance.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-allowance.ts @@ -1,7 +1,7 @@ import { Contract } from 'ethers'; -import HMToken from '@/smart-contracts/abi/HMToken.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import HMToken from '@/modules/smart-contracts/abi/HMToken.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function hmTokenAllowance({ spender, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-approve.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-approve.ts similarity index 74% rename from packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-approve.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-approve.ts index ad3156d484..e11c3bc746 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-approve.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-approve.ts @@ -1,7 +1,7 @@ import { Contract } from 'ethers'; -import HMToken from '@/smart-contracts/abi/HMToken.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import HMToken from '@/modules/smart-contracts/abi/HMToken.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function hmTokenApprove({ contractAddress, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-decimals.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-decimals.ts similarity index 66% rename from packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-decimals.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-decimals.ts index a9c10bf0fa..be04a3fd01 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/HMToken/hm-token-decimals.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/HMToken/hm-token-decimals.ts @@ -1,7 +1,7 @@ import { Contract } from 'ethers'; -import HMToken from '@/smart-contracts/abi/HMToken.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import HMToken from '@/modules/smart-contracts/abi/HMToken.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function hmTokenDecimals({ contractAddress, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/Staking/staking-get-staked-tokens.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/Staking/staking-get-staked-tokens.ts similarity index 67% rename from packages/apps/human-app/frontend/src/smart-contracts/Staking/staking-get-staked-tokens.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/Staking/staking-get-staked-tokens.ts index 427c6ca8a3..3be323970e 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/Staking/staking-get-staked-tokens.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/Staking/staking-get-staked-tokens.ts @@ -1,7 +1,7 @@ import { Contract } from 'ethers'; -import Staking from '@/smart-contracts/abi/Staking.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import Staking from '@/modules/smart-contracts/abi/Staking.json'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function stakingGetStakedTokens({ contractAddress, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/Staking/staking-stake.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/Staking/staking-stake.ts similarity index 74% rename from packages/apps/human-app/frontend/src/smart-contracts/Staking/staking-stake.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/Staking/staking-stake.ts index bad8b02ead..27272dd559 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/Staking/staking-stake.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/Staking/staking-stake.ts @@ -1,7 +1,7 @@ import { Contract } from 'ethers'; -import Staking from '@/smart-contracts/abi/Staking.json'; -import type { ContractCallArguments } from '@/smart-contracts/types'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import type { ContractCallArguments } from '@/modules/smart-contracts/types'; +import Staking from '@/modules/smart-contracts/abi/Staking.json'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export async function stakingStake({ contractAddress, diff --git a/packages/apps/human-app/frontend/src/smart-contracts/abi/EthKVStore.json b/packages/apps/human-app/frontend/src/modules/smart-contracts/abi/EthKVStore.json similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/abi/EthKVStore.json rename to packages/apps/human-app/frontend/src/modules/smart-contracts/abi/EthKVStore.json diff --git a/packages/apps/human-app/frontend/src/smart-contracts/abi/HMToken.json b/packages/apps/human-app/frontend/src/modules/smart-contracts/abi/HMToken.json similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/abi/HMToken.json rename to packages/apps/human-app/frontend/src/modules/smart-contracts/abi/HMToken.json diff --git a/packages/apps/human-app/frontend/src/smart-contracts/abi/Staking.json b/packages/apps/human-app/frontend/src/modules/smart-contracts/abi/Staking.json similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/abi/Staking.json rename to packages/apps/human-app/frontend/src/modules/smart-contracts/abi/Staking.json diff --git a/packages/apps/human-app/frontend/src/smart-contracts/chains.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/chains.ts similarity index 98% rename from packages/apps/human-app/frontend/src/smart-contracts/chains.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/chains.ts index b71cdf9888..3dccd83c1e 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/chains.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/chains.ts @@ -10,7 +10,7 @@ import { MainnetContracts, TestnetContracts, type ContractsAddresses, -} from '@/smart-contracts/contracts'; +} from '@/modules/smart-contracts/contracts'; export interface Chain { explorerUrl: string; diff --git a/packages/apps/human-app/frontend/src/smart-contracts/check-network.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/check-network.ts similarity index 87% rename from packages/apps/human-app/frontend/src/smart-contracts/check-network.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/check-network.ts index 5f128225cc..aa387c1868 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/check-network.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/check-network.ts @@ -1,6 +1,6 @@ import { t } from 'i18next'; import type { Network } from 'ethers'; -import { MainnetChains, TestnetChains } from '@/smart-contracts/chains'; +import { MainnetChains, TestnetChains } from '@/modules/smart-contracts/chains'; import { env } from '@/shared/env'; export const checkNetwork = (network: Network): void => { diff --git a/packages/apps/human-app/frontend/src/smart-contracts/contracts.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/contracts.ts similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/contracts.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/contracts.ts diff --git a/packages/apps/human-app/frontend/src/smart-contracts/get-contract-address.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/get-contract-address.ts similarity index 65% rename from packages/apps/human-app/frontend/src/smart-contracts/get-contract-address.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/get-contract-address.ts index 00fe717331..ca4783d6d3 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/get-contract-address.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/get-contract-address.ts @@ -1,5 +1,5 @@ -import { MainnetChains, TestnetChains } from '@/smart-contracts/chains'; -import type { ContractsAddresses } from '@/smart-contracts/contracts'; +import { MainnetChains, TestnetChains } from '@/modules/smart-contracts/chains'; +import type { ContractsAddresses } from '@/modules/smart-contracts/contracts'; import { env } from '@/shared/env'; export const getContractAddress = ({ diff --git a/packages/apps/human-app/frontend/src/smart-contracts/get-network-name.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/get-network-name.ts similarity index 76% rename from packages/apps/human-app/frontend/src/smart-contracts/get-network-name.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/get-network-name.ts index 9905705b8d..b763154d7d 100644 --- a/packages/apps/human-app/frontend/src/smart-contracts/get-network-name.ts +++ b/packages/apps/human-app/frontend/src/modules/smart-contracts/get-network-name.ts @@ -1,4 +1,7 @@ -import { AllTestnetsChains, AllMainnetChains } from '@/smart-contracts/chains'; +import { + AllTestnetsChains, + AllMainnetChains, +} from '@/modules/smart-contracts/chains'; import { env } from '@/shared/env'; export const getNetworkName = (chainId: number): string => { diff --git a/packages/apps/human-app/frontend/src/smart-contracts/json-rpc-error.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/json-rpc-error.ts similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/json-rpc-error.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/json-rpc-error.ts diff --git a/packages/apps/human-app/frontend/src/smart-contracts/types.ts b/packages/apps/human-app/frontend/src/modules/smart-contracts/types.ts similarity index 100% rename from packages/apps/human-app/frontend/src/smart-contracts/types.ts rename to packages/apps/human-app/frontend/src/modules/smart-contracts/types.ts diff --git a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-accordion.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-accordion.tsx similarity index 85% rename from packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-accordion.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-accordion.tsx index 158f57f885..d9c40f2390 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-accordion.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-accordion.tsx @@ -6,11 +6,11 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import Grid from '@mui/material/Grid'; import { useEffect } from 'react'; import { t } from 'i18next'; -import { UserStatsDetails } from '@/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-details'; -import { useHCaptchaUserStats } from '@/api/services/worker/hcaptcha-user-stats'; -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { UserStatsDetails } from '@/modules/worker/components/hcaptcha-labeling/user-stats-details'; +import { useHCaptchaUserStats } from '@/modules/worker/services/hcaptcha-user-stats'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; const accordionWidth = { width: '284px' }; diff --git a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-details.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-details.tsx similarity index 93% rename from packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-details.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-details.tsx index 14842d9576..4fc84228e4 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-details.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-details.tsx @@ -1,9 +1,9 @@ import { Divider, Grid, Typography } from '@mui/material'; import { t } from 'i18next'; -import { RefreshIcon } from '@/components/ui/icons'; -import type { HCaptchaUserStatsSuccess } from '@/api/services/worker/hcaptcha-user-stats'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { RefreshIcon } from '@/shared/components/ui/icons'; +import type { HCaptchaUserStatsSuccess } from '@/modules/worker/services/hcaptcha-user-stats'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; export function UserStatsDetails({ stats, diff --git a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-drawer.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-drawer.tsx similarity index 85% rename from packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-drawer.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-drawer.tsx index 4ef76554b9..fda2beef6a 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-drawer.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/hcaptcha-labeling/user-stats-drawer.tsx @@ -3,11 +3,11 @@ import Drawer from '@mui/material/Drawer'; import CssBaseline from '@mui/material/CssBaseline'; import { Grid, Typography } from '@mui/material'; import { t } from 'i18next'; -import { UserStatsDetails } from '@/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-details'; -import type { HCaptchaUserStatsSuccess } from '@/api/services/worker/hcaptcha-user-stats'; -import { useHCaptchaUserStats } from '@/api/services/worker/hcaptcha-user-stats'; -import { Loader } from '@/components/ui/loader'; -import { Alert } from '@/components/ui/alert'; +import { UserStatsDetails } from '@/modules/worker/components/hcaptcha-labeling/user-stats-details'; +import type { HCaptchaUserStatsSuccess } from '@/modules/worker/services/hcaptcha-user-stats'; +import { useHCaptchaUserStats } from '@/modules/worker/services/hcaptcha-user-stats'; +import { Loader } from '@/shared/components/ui/loader'; +import { Alert } from '@/shared/components/ui/alert'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; export interface UserStatsDrawerNavigationProps { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table-job-types-select.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table-job-types-select.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table-job-types-select.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table-job-types-select.tsx index ebb188278b..ef4499bf78 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table-job-types-select.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table-job-types-select.tsx @@ -2,9 +2,9 @@ import { t } from 'i18next'; import { FormProvider, useForm } from 'react-hook-form'; import { useEffect } from 'react'; import { Grid } from '@mui/material'; -import { useJobsTypesOraclesFilter } from '@/hooks/use-job-types-oracles-table'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { MultiSelect } from '@/components/data-entry/multi-select'; +import { useJobsTypesOraclesFilter } from '@/modules/worker/hooks/use-job-types-oracles-table'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { MultiSelect } from '@/shared/components/data-entry/multi-select'; import { JOB_TYPES } from '@/shared/consts'; export function OraclesTableJobTypesSelect() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table-mobile.tsx similarity index 74% rename from packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table-mobile.tsx index 226308913b..ac26e08950 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table-mobile.tsx @@ -1,15 +1,15 @@ import { Grid, Paper, Stack, Typography } from '@mui/material'; import { t } from 'i18next'; -import { Chips } from '@/components/ui/chips'; -import { TableButton } from '@/components/ui/table-button'; -import { Loader } from '@/components/ui/loader'; -import type { OraclesDataQueryResult } from '@/pages/worker/jobs-discovery/jobs-discovery.page'; -import { EvmAddress } from '@/pages/worker/jobs/components/evm-address'; -import { ListItem } from '@/components/ui/list-item'; -import { useColorMode } from '@/hooks/use-color-mode'; -import type { JobType } from '@/smart-contracts/EthKVStore/config'; -import type { Oracle } from '@/api/services/worker/oracles'; -import { NoRecords } from '@/components/ui/no-records'; +import { Chips } from '@/shared/components/ui/chips'; +import { TableButton } from '@/shared/components/ui/table-button'; +import { Loader } from '@/shared/components/ui/loader'; +import type { OraclesDataQueryResult } from '@/modules/worker/views/jobs-discovery/jobs-discovery.page'; +import { EvmAddress } from '@/modules/worker/components/jobs/evm-address'; +import { ListItem } from '@/shared/components/ui/list-item'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import type { JobType } from '@/modules/smart-contracts/EthKVStore/config'; +import type { Oracle } from '@/modules/worker/services/oracles'; +import { NoRecords } from '@/shared/components/ui/no-records'; export function OraclesTableMobile({ selectOracle, diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table.tsx similarity index 80% rename from packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table.tsx index d6abaaa71a..216e8c8fb1 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/components/oracles-table/oracles-table.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs-discovery/oracles-table.tsx @@ -6,20 +6,20 @@ import { } from 'material-react-table'; import { Grid } from '@mui/material'; import { useNavigate } from 'react-router-dom'; -import type { Oracle } from '@/api/services/worker/oracles'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { EvmAddress } from '@/pages/worker/jobs/components/evm-address'; -import { Chips } from '@/components/ui/chips'; -import { TableButton } from '@/components/ui/table-button'; +import type { Oracle } from '@/modules/worker/services/oracles'; +import { EvmAddress } from '@/modules/worker/components/jobs/evm-address'; +import { Chips } from '@/shared/components/ui/chips'; +import { TableButton } from '@/shared/components/ui/table-button'; import { routerPaths } from '@/router/router-paths'; -import { OraclesTableMobile } from '@/pages/worker/jobs-discovery/components/oracles-table/oracles-table-mobile'; -import type { OraclesDataQueryResult } from '@/pages/worker/jobs-discovery/jobs-discovery.page'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { createTableDarkMode } from '@/styles/create-table-dark-mode'; +import type { OraclesDataQueryResult } from '@/modules/worker/views/jobs-discovery/jobs-discovery.page'; import { env } from '@/shared/env'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { type JobType } from '@/smart-contracts/EthKVStore/config'; -import { useGetRegistrationInExchangeOracles } from '@/api/services/worker/get-registration-in-exchange-oracles'; +import { useGetRegistrationInExchangeOracles } from '@/modules/worker/services/get-registration-in-exchange-oracles'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { type JobType } from '@/modules/smart-contracts/EthKVStore/config'; +import { createTableDarkMode } from '@/shared/styles/create-table-dark-mode'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { OraclesTableMobile } from '@/modules/worker/components/jobs-discovery/oracles-table-mobile'; const getColumns = ( selectOracle: (oracle: Oracle) => void diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-job-type-filter.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-job-type-filter.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-job-type-filter.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-job-type-filter.tsx index 9ec130ebfb..166cf584ff 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-job-type-filter.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-job-type-filter.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { useTranslation } from 'react-i18next'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; import { JOB_TYPES } from '@/shared/consts'; export function AvailableJobsJobTypeFilter() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-network-filter.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-network-filter.tsx similarity index 74% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-network-filter.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-network-filter.tsx index 371a26ab66..15e040fcbe 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-network-filter.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-network-filter.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ -import { useGetAllNetworks } from '@/hooks/use-get-all-networks'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; +import { useGetAllNetworks } from '@/modules/worker/hooks/use-get-all-networks'; interface AvailableJobsNetworkFilterProps { chainIdsEnabled: number[]; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-reward-amount-sort.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-reward-amount-sort.tsx similarity index 85% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-reward-amount-sort.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-reward-amount-sort.tsx index 37f6c92975..003ab5fa36 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-reward-amount-sort.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-reward-amount-sort.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { t } from 'i18next'; -import { Sorting } from '@/components/ui/table/table-header-menu.tsx/sorting'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import { Sorting } from '@/shared/components/ui/table/table-header-menu.tsx/sorting'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; export function AvailableJobsRewardAmountSort() { const { setFilterParams, filterParams } = useJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-table.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-table.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-table.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-table.tsx index 49ce10e205..a49014f658 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/desktop/available-jobs-table.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/desktop/available-jobs-table.tsx @@ -7,26 +7,26 @@ import { import { t } from 'i18next'; import { useEffect, useMemo, useState } from 'react'; import { Grid } from '@mui/material'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; import { useGetAvailableJobsData, type AvailableJob, -} from '@/api/services/worker/available-jobs-data'; -import { useAssignJobMutation } from '@/api/services/worker/assign-job'; -import { EvmAddress } from '@/pages/worker/jobs/components/evm-address'; -import { RewardAmount } from '@/pages/worker/jobs/components/reward-amount'; -import { getNetworkName } from '@/smart-contracts/get-network-name'; -import { Chip } from '@/components/ui/chip'; -import { useJobsNotifications } from '@/hooks/use-jobs-notifications'; -import { TableButton } from '@/components/ui/table-button'; -import { TableHeaderCell } from '@/components/ui/table/table-header-cell'; -import { AvailableJobsNetworkFilter } from '@/pages/worker/jobs/components/available-jobs/desktop/available-jobs-network-filter'; -import { AvailableJobsRewardAmountSort } from '@/pages/worker/jobs/components/available-jobs/desktop/available-jobs-reward-amount-sort'; -import { AvailableJobsJobTypeFilter } from '@/pages/worker/jobs/components/available-jobs/desktop/available-jobs-job-type-filter'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { createTableDarkMode } from '@/styles/create-table-dark-mode'; -import type { JobType } from '@/smart-contracts/EthKVStore/config'; -import { EscrowAddressSearchForm } from '@/pages/worker/jobs/components/escrow-address-search-form'; +} from '@/modules/worker/services/available-jobs-data'; +import { useAssignJobMutation } from '@/modules/worker/services/use-assign-job'; +import { EvmAddress } from '@/modules/worker/components/jobs/evm-address'; +import { RewardAmount } from '@/modules/worker/components/jobs/reward-amount'; +import { getNetworkName } from '@/modules/smart-contracts/get-network-name'; +import { Chip } from '@/shared/components/ui/chip'; +import { useJobsNotifications } from '@/modules/worker/hooks/use-jobs-notifications'; +import { TableButton } from '@/shared/components/ui/table-button'; +import { TableHeaderCell } from '@/shared/components/ui/table/table-header-cell'; +import { AvailableJobsNetworkFilter } from '@/modules/worker/components/jobs/available-jobs/desktop/available-jobs-network-filter'; +import { AvailableJobsRewardAmountSort } from '@/modules/worker/components/jobs/available-jobs/desktop/available-jobs-reward-amount-sort'; +import { AvailableJobsJobTypeFilter } from '@/modules/worker/components/jobs/available-jobs/desktop/available-jobs-job-type-filter'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { createTableDarkMode } from '@/shared/styles/create-table-dark-mode'; +import type { JobType } from '@/modules/smart-contracts/EthKVStore/config'; +import { EscrowAddressSearchForm } from '@/modules/worker/components/jobs/escrow-address-search-form'; interface AvailableJobsTableProps { chainIdsEnabled: number[]; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-assign-job-button.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-assign-job-button.tsx similarity index 80% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-assign-job-button.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-assign-job-button.tsx index a82bd576c3..260f3d0833 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-assign-job-button.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-assign-job-button.tsx @@ -2,9 +2,9 @@ import { t } from 'i18next'; import { type AssignJobBody, useAssignJobMutation, -} from '@/api/services/worker/assign-job'; -import { TableButton } from '@/components/ui/table-button'; -import { useJobsNotifications } from '@/hooks/use-jobs-notifications'; +} from '@/modules/worker/services/use-assign-job'; +import { TableButton } from '@/shared/components/ui/table-button'; +import { useJobsNotifications } from '@/modules/worker/hooks/use-jobs-notifications'; export function AvailableJobsAssignJobButton({ assignJobPayload, diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-drawer-mobile.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-drawer-mobile.tsx index 822d06cce8..3225cbe5bb 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-drawer-mobile.tsx @@ -5,12 +5,12 @@ import { Divider, IconButton, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import CloseIcon from '@mui/icons-material/Close'; import type { Dispatch, SetStateAction } from 'react'; -import { HumanLogoIcon } from '@/components/ui/icons'; -import { AvailableJobsNetworkFilterMobile } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-network-filter-mobile'; -import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; -import { AvailableJobsJobTypeFilterMobile } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-job-type-filter-mobile'; -import { AvailableJobsRewardAmountSortMobile } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-reward-amount-sort-mobile'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { HumanLogoIcon } from '@/shared/components/ui/icons'; +import { AvailableJobsNetworkFilterMobile } from '@/modules/worker/components/jobs/available-jobs/mobile/available-jobs-network-filter-mobile'; +import { useHandleMainNavIconClick } from '@/shared/hooks/use-handle-main-nav-icon-click'; +import { AvailableJobsJobTypeFilterMobile } from '@/modules/worker/components/jobs/available-jobs/mobile/available-jobs-job-type-filter-mobile'; +import { AvailableJobsRewardAmountSortMobile } from '@/modules/worker/components/jobs/available-jobs/mobile/available-jobs-reward-amount-sort-mobile'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface DrawerMobileProps { setIsMobileFilterDrawerOpen: Dispatch>; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx index 9b019d553d..d4ad256708 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-job-type-filter-mobile.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { useTranslation } from 'react-i18next'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; import { JOB_TYPES } from '@/shared/consts'; export function AvailableJobsJobTypeFilterMobile() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-network-filter-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-network-filter-mobile.tsx similarity index 76% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-network-filter-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-network-filter-mobile.tsx index 06c994e8ba..a521fa3f75 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-network-filter-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-network-filter-mobile.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ -import { useGetAllNetworks } from '@/hooks/use-get-all-networks'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import { useGetAllNetworks } from '@/modules/worker/hooks/use-get-all-networks'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; interface AvailableJobsNetworkFilterProps { chainIdsEnabled: number[]; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx similarity index 85% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx index fa4a7bb849..41a74c8e8d 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-reward-amount-sort-mobile.tsx @@ -1,9 +1,9 @@ /* eslint-disable camelcase */ import { t } from 'i18next'; import Typography from '@mui/material/Typography'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; -import { Sorting } from '@/pages/worker/jobs/components/sorting'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; +import { Sorting } from '@/modules/worker/components/jobs/sorting'; export function AvailableJobsRewardAmountSortMobile() { const { setFilterParams, filterParams } = useJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-table-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-table-mobile.tsx similarity index 80% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-table-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-table-mobile.tsx index c8c0429130..18300f28be 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/available-jobs/mobile/available-jobs-table-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/available-jobs/mobile/available-jobs-table-mobile.tsx @@ -2,23 +2,23 @@ import { Grid, List, Paper, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { useEffect, useState, type Dispatch, type SetStateAction } from 'react'; -import { Button } from '@/components/ui/button'; -import { FiltersButtonIcon } from '@/components/ui/icons'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; -import { Alert } from '@/components/ui/alert'; -import { getNetworkName } from '@/smart-contracts/get-network-name'; +import { Button } from '@/shared/components/ui/button'; +import { FiltersButtonIcon } from '@/shared/components/ui/icons'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; +import { Alert } from '@/shared/components/ui/alert'; +import { getNetworkName } from '@/modules/smart-contracts/get-network-name'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import type { AvailableJob } from '@/api/services/worker/available-jobs-data'; -import { useInfiniteGetAvailableJobsData } from '@/api/services/worker/available-jobs-data'; -import { Loader } from '@/components/ui/loader'; -import { EvmAddress } from '@/pages/worker/jobs/components/evm-address'; -import { Chip } from '@/components/ui/chip'; -import { RewardAmount } from '@/pages/worker/jobs/components/reward-amount'; -import { ListItem } from '@/components/ui/list-item'; -import { useColorMode } from '@/hooks/use-color-mode'; -import type { JobType } from '@/smart-contracts/EthKVStore/config'; -import { EscrowAddressSearchForm } from '@/pages/worker/jobs/components/escrow-address-search-form'; -import { AvailableJobsAssignJobButton } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-assign-job-button'; +import type { AvailableJob } from '@/modules/worker/services/available-jobs-data'; +import { useInfiniteGetAvailableJobsData } from '@/modules/worker/services/available-jobs-data'; +import { Loader } from '@/shared/components/ui/loader'; +import { EvmAddress } from '@/modules/worker/components/jobs/evm-address'; +import { Chip } from '@/shared/components/ui/chip'; +import { RewardAmount } from '@/modules/worker/components/jobs/reward-amount'; +import { ListItem } from '@/shared/components/ui/list-item'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import type { JobType } from '@/modules/smart-contracts/EthKVStore/config'; +import { EscrowAddressSearchForm } from '@/modules/worker/components/jobs/escrow-address-search-form'; +import { AvailableJobsAssignJobButton } from '@/modules/worker/components/jobs/available-jobs/mobile/available-jobs-assign-job-button'; interface AvailableJobsTableMobileProps { setIsMobileFilterDrawerOpen: Dispatch>; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/escrow-address-search-form.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/escrow-address-search-form.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/escrow-address-search-form.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/escrow-address-search-form.tsx index 47a79c8527..c910452729 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/escrow-address-search-form.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/escrow-address-search-form.tsx @@ -6,10 +6,10 @@ import { z } from 'zod'; import { useEffect } from 'react'; import Grid from '@mui/material/Grid'; import debounce from 'lodash/debounce'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { Input } from '@/components/data-entry/input'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { Input } from '@/shared/components/data-entry/input'; import { addressSchemaOrEmptyString } from '@/shared/helpers/validate-address-schema'; -import { useIsMobile } from '@/hooks/use-is-mobile'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; interface SearchFormProps { label: string; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/evm-address.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/evm-address.tsx similarity index 79% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/evm-address.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/evm-address.tsx index 228aa755cc..5fd64ba444 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/evm-address.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/evm-address.tsx @@ -1,9 +1,9 @@ import Tooltip from '@mui/material/Tooltip'; import Typography from '@mui/material/Typography'; import { shortenEscrowAddress } from '@/shared/helpers/shorten-escrow-address'; -import { breakpoints } from '@/styles/breakpoints'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function EvmAddress({ address }: { address: string }) { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/jobs-tab-panel.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/jobs-tab-panel.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/jobs-tab-panel.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/jobs-tab-panel.tsx diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs-table-actions.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs-table-actions.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx index 1989e74707..cf0e8d10ba 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs-table-actions.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx @@ -1,10 +1,13 @@ /* eslint-disable camelcase -- ...*/ import { Link, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { useRejectTaskMutation } from '@/api/services/worker/reject-task'; -import { TableButton } from '@/components/ui/table-button'; -import { RejectButton } from '@/pages/worker/jobs/components/reject-button'; -import { MyJobStatus, type MyJob } from '@/api/services/worker/my-jobs-data'; +import { useRejectTaskMutation } from '@/modules/worker/services/reject-task'; +import { TableButton } from '@/shared/components/ui/table-button'; +import { RejectButton } from '@/modules/worker/components/jobs/reject-button'; +import { + MyJobStatus, + type MyJob, +} from '@/modules/worker/services/my-jobs-data'; interface MyJobsTableRejectActionProps { job: MyJob; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-expires-at-sort.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-expires-at-sort.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-expires-at-sort.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-expires-at-sort.tsx index 7204d1a572..7ec9cb2c83 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-expires-at-sort.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-expires-at-sort.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { t } from 'i18next'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Sorting } from '@/components/ui/table/table-header-menu.tsx/sorting'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Sorting } from '@/shared/components/ui/table/table-header-menu.tsx/sorting'; export function MyJobsExpiresAtSort() { const { setFilterParams, filterParams } = useMyJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-job-type-filter.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-job-type-filter.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-job-type-filter.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-job-type-filter.tsx index fff47186e4..fd5b5293c1 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-job-type-filter.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-job-type-filter.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { useTranslation } from 'react-i18next'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; import { JOB_TYPES } from '@/shared/consts'; export function MyJobsJobTypeFilter() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-network-filter.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-network-filter.tsx similarity index 73% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-network-filter.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-network-filter.tsx index 03bcd86cda..82b4690514 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-network-filter.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-network-filter.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { useGetAllNetworks } from '@/hooks/use-get-all-networks'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { useGetAllNetworks } from '@/modules/worker/hooks/use-get-all-networks'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; interface MyJobsNetworkFilterProps { chainIdsEnabled: number[]; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-reward-amount-sort.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-reward-amount-sort.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-reward-amount-sort.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-reward-amount-sort.tsx index 51505007e5..397f697ffe 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-reward-amount-sort.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-reward-amount-sort.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { t } from 'i18next'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Sorting } from '@/components/ui/table/table-header-menu.tsx/sorting'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Sorting } from '@/shared/components/ui/table/table-header-menu.tsx/sorting'; export function MyJobsRewardAmountSort() { const { setFilterParams, filterParams } = useMyJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-status-filter.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-status-filter.tsx similarity index 72% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-status-filter.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-status-filter.tsx index a0f3d9ba43..363e0a8299 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-status-filter.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-status-filter.tsx @@ -1,7 +1,7 @@ import capitalize from 'lodash/capitalize'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { MyJobStatus } from '@/api/services/worker/my-jobs-data'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { MyJobStatus } from '@/modules/worker/services/my-jobs-data'; export function MyJobsStatusFilter() { const { setFilterParams, filterParams } = useMyJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-table.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-table.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-table.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-table.tsx index 672344ff8e..8d1d49d00b 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/desktop/my-jobs-table.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/desktop/my-jobs-table.tsx @@ -9,29 +9,29 @@ import { type MRT_ColumnDef, } from 'material-react-table'; import RefreshIcon from '@mui/icons-material/Refresh'; -import { TableHeaderCell } from '@/components/ui/table/table-header-cell'; +import { TableHeaderCell } from '@/shared/components/ui/table/table-header-cell'; import { useGetMyJobsData, type MyJob, -} from '@/api/services/worker/my-jobs-data'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { getNetworkName } from '@/smart-contracts/get-network-name'; -import { RewardAmount } from '@/pages/worker/jobs/components/reward-amount'; -import { Button } from '@/components/ui/button'; -import { Chip } from '@/components/ui/chip'; +} from '@/modules/worker/services/my-jobs-data'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { getNetworkName } from '@/modules/smart-contracts/get-network-name'; +import { RewardAmount } from '@/modules/worker/components/jobs/reward-amount'; +import { Button } from '@/shared/components/ui/button'; +import { Chip } from '@/shared/components/ui/chip'; import { formatDate } from '@/shared/helpers/format-date'; -import { EvmAddress } from '@/pages/worker/jobs/components/evm-address'; -import { MyJobsJobTypeFilter } from '@/pages/worker/jobs/components/my-jobs/desktop/my-jobs-job-type-filter'; -import { MyJobsRewardAmountSort } from '@/pages/worker/jobs/components/my-jobs/desktop/my-jobs-reward-amount-sort'; -import { MyJobsStatusFilter } from '@/pages/worker/jobs/components/my-jobs/desktop/my-jobs-status-filter'; -import { MyJobsExpiresAtSort } from '@/pages/worker/jobs/components/my-jobs/desktop/my-jobs-expires-at-sort'; -import { MyJobsNetworkFilter } from '@/pages/worker/jobs/components/my-jobs/desktop/my-jobs-network-filter'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { createTableDarkMode } from '@/styles/create-table-dark-mode'; -import type { JobType } from '@/smart-contracts/EthKVStore/config'; -import { EscrowAddressSearchForm } from '@/pages/worker/jobs/components/escrow-address-search-form'; -import { useRefreshTasksMutation } from '@/api/services/worker/refresh-tasks'; -import { StatusChip } from '@/pages/worker/jobs/components/status-chip'; +import { EvmAddress } from '@/modules/worker/components/jobs/evm-address'; +import { MyJobsJobTypeFilter } from '@/modules/worker/components/jobs/my-jobs/desktop/my-jobs-job-type-filter'; +import { MyJobsRewardAmountSort } from '@/modules/worker/components/jobs/my-jobs/desktop/my-jobs-reward-amount-sort'; +import { MyJobsStatusFilter } from '@/modules/worker/components/jobs/my-jobs/desktop/my-jobs-status-filter'; +import { MyJobsExpiresAtSort } from '@/modules/worker/components/jobs/my-jobs/desktop/my-jobs-expires-at-sort'; +import { MyJobsNetworkFilter } from '@/modules/worker/components/jobs/my-jobs/desktop/my-jobs-network-filter'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { createTableDarkMode } from '@/shared/styles/create-table-dark-mode'; +import type { JobType } from '@/modules/smart-contracts/EthKVStore/config'; +import { EscrowAddressSearchForm } from '@/modules/worker/components/jobs/escrow-address-search-form'; +import { useRefreshTasksMutation } from '@/modules/worker/services/refresh-tasks'; +import { StatusChip } from '@/modules/worker/components/jobs/status-chip'; import { MyJobsTableActions } from '../../my-jobs-table-actions'; interface MyJobsTableProps { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-drawer-mobile.tsx similarity index 89% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-drawer-mobile.tsx index 4309e49a39..1dbb9c965e 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-drawer-mobile.tsx @@ -5,11 +5,11 @@ import { Divider, IconButton, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import CloseIcon from '@mui/icons-material/Close'; import type { Dispatch, SetStateAction } from 'react'; -import { HumanLogoIcon } from '@/components/ui/icons'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { MyJobsRewardAmountSortMobile } from '@/pages/worker/jobs/components/my-jobs/mobile/my-jobs-reward-amount-sort-mobile'; -import { MyJobsExpiresAtSortMobile } from '@/pages/worker/jobs/components/my-jobs/mobile/my-jobs-expires-at-sort-mobile'; -import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; +import { HumanLogoIcon } from '@/shared/components/ui/icons'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { MyJobsRewardAmountSortMobile } from '@/modules/worker/components/jobs/my-jobs/mobile/my-jobs-reward-amount-sort-mobile'; +import { MyJobsExpiresAtSortMobile } from '@/modules/worker/components/jobs/my-jobs/mobile/my-jobs-expires-at-sort-mobile'; +import { useHandleMainNavIconClick } from '@/shared/hooks/use-handle-main-nav-icon-click'; import { MyJobsNetworkFilterMobile } from './my-jobs-network-filter-mobile'; import { MyJobsJobTypeFilterMobile } from './my-jobs-job-type-filter-mobile'; import { MyJobsStatusFilterMobile } from './my-jobs-status-filter-mobile'; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx index b100820f92..82e97beba4 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-expires-at-sort-mobile.tsx @@ -1,9 +1,9 @@ /* eslint-disable camelcase */ import Typography from '@mui/material/Typography'; import { t } from 'i18next'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Sorting } from '@/pages/worker/jobs/components/sorting'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Sorting } from '@/modules/worker/components/jobs/sorting'; export function MyJobsExpiresAtSortMobile() { const { setFilterParams, filterParams } = useMyJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx similarity index 82% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx index 510a8fc52c..3ed59dc791 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-job-type-filter-mobile.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ import { useTranslation } from 'react-i18next'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; import { JOB_TYPES } from '@/shared/consts'; export function MyJobsJobTypeFilterMobile() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-network-filter-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-network-filter-mobile.tsx similarity index 75% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-network-filter-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-network-filter-mobile.tsx index 3aafecc7fa..c1bb8ac908 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-network-filter-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-network-filter-mobile.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase --- ... */ -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { useGetAllNetworks } from '@/hooks/use-get-all-networks'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { useGetAllNetworks } from '@/modules/worker/hooks/use-get-all-networks'; interface MyJobsNetworkFilterMobileProps { chainIdsEnabled: number[]; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx index 34e5bb51e8..675c789c87 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-reward-amount-sort-mobile.tsx @@ -1,9 +1,9 @@ /* eslint-disable camelcase */ import Typography from '@mui/material/Typography'; import { t } from 'i18next'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Sorting } from '@/pages/worker/jobs/components/sorting'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Sorting } from '@/modules/worker/components/jobs/sorting'; export function MyJobsRewardAmountSortMobile() { const { setFilterParams, filterParams } = useMyJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-status-filter-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-status-filter-mobile.tsx similarity index 73% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-status-filter-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-status-filter-mobile.tsx index ebf5706735..3f82a4b3a3 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-status-filter-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-status-filter-mobile.tsx @@ -1,7 +1,7 @@ import capitalize from 'lodash/capitalize'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { Filtering } from '@/components/ui/table/table-header-menu.tsx/filtering'; -import { MyJobStatus } from '@/api/services/worker/my-jobs-data'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { Filtering } from '@/shared/components/ui/table/table-header-menu.tsx/filtering'; +import { MyJobStatus } from '@/modules/worker/services/my-jobs-data'; export function MyJobsStatusFilterMobile() { const { setFilterParams, filterParams } = useMyJobsFilterStore(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-table-mobile.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-table-mobile.tsx similarity index 82% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-table-mobile.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-table-mobile.tsx index e3f51e6f58..3fa6305ea3 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/my-jobs/mobile/my-jobs-table-mobile.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs/mobile/my-jobs-table-mobile.tsx @@ -3,27 +3,27 @@ import { Grid, List, Paper, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { useEffect, useState, type Dispatch, type SetStateAction } from 'react'; import { useParams } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; -import { FiltersButtonIcon, RefreshIcon } from '@/components/ui/icons'; +import { Button } from '@/shared/components/ui/button'; +import { FiltersButtonIcon, RefreshIcon } from '@/shared/components/ui/icons'; import { formatDate } from '@/shared/helpers/format-date'; -import { Loader } from '@/components/ui/loader'; -import { Alert } from '@/components/ui/alert'; -import { getNetworkName } from '@/smart-contracts/get-network-name'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; -import type { MyJob } from '@/api/services/worker/my-jobs-data'; -import { useInfiniteGetMyJobsData } from '@/api/services/worker/my-jobs-data'; +import { Loader } from '@/shared/components/ui/loader'; +import { Alert } from '@/shared/components/ui/alert'; +import { getNetworkName } from '@/modules/smart-contracts/get-network-name'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; +import type { MyJob } from '@/modules/worker/services/my-jobs-data'; +import { useInfiniteGetMyJobsData } from '@/modules/worker/services/my-jobs-data'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; -import { ListItem } from '@/components/ui/list-item'; -import { EvmAddress } from '@/pages/worker/jobs/components/evm-address'; -import { RewardAmount } from '@/pages/worker/jobs/components/reward-amount'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { Chip } from '@/components/ui/chip'; -import type { JobType } from '@/smart-contracts/EthKVStore/config'; -import { EscrowAddressSearchForm } from '@/pages/worker/jobs/components/escrow-address-search-form'; -import { colorPalette as lightModeColorPalette } from '@/styles/color-palette'; -import { useRefreshTasksMutation } from '@/api/services/worker/refresh-tasks'; -import { getChipStatusColor } from '@/pages/worker/jobs/helpers/get-chip-status-color'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { ListItem } from '@/shared/components/ui/list-item'; +import { EvmAddress } from '@/modules/worker/components/jobs/evm-address'; +import { RewardAmount } from '@/modules/worker/components/jobs/reward-amount'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { Chip } from '@/shared/components/ui/chip'; +import type { JobType } from '@/modules/smart-contracts/EthKVStore/config'; +import { EscrowAddressSearchForm } from '@/modules/worker/components/jobs/escrow-address-search-form'; +import { colorPalette as lightModeColorPalette } from '@/shared/styles/color-palette'; +import { useRefreshTasksMutation } from '@/modules/worker/services/refresh-tasks'; +import { getChipStatusColor } from '@/modules/worker/utils/get-chip-status-color'; import { MyJobsTableActions } from '../../my-jobs-table-actions'; interface MyJobsTableMobileProps { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/reject-button.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/reject-button.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/reject-button.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/reject-button.tsx index 023badb727..d3f78d05ea 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/reject-button.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/reject-button.tsx @@ -1,6 +1,6 @@ import CloseIcon from '@mui/icons-material/Close'; -import type { CustomButtonProps } from '@/components/ui/button'; -import { TableButton } from '@/components/ui/table-button'; +import type { CustomButtonProps } from '@/shared/components/ui/button'; +import { TableButton } from '@/shared/components/ui/table-button'; export function RejectButton(props: CustomButtonProps) { return ( diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/reward-amount.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/reward-amount.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/reward-amount.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/reward-amount.tsx diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/sorting.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/sorting.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/sorting.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/sorting.tsx index b117ff7a63..88ff53ad28 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/sorting.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/sorting.tsx @@ -4,9 +4,9 @@ import Box from '@mui/material/Box'; import ListItemButton from '@mui/material/ListItemButton'; import List from '@mui/material/List'; import { Grid } from '@mui/material'; -import { SortArrow } from '@/components/ui/icons'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { Button } from '@/components/ui/button'; +import { SortArrow } from '@/shared/components/ui/icons'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { Button } from '@/shared/components/ui/button'; interface SortingProps { fromHighestSelected: boolean; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/status-chip.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/status-chip.tsx similarity index 68% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/status-chip.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/status-chip.tsx index 9d1144234f..f83de025b1 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/status-chip.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/status-chip.tsx @@ -1,9 +1,9 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { type MyJob } from '@/api/services/worker/my-jobs-data'; -import { colorPalette as lightModeColorPalette } from '@/styles/color-palette'; -import { getChipStatusColor } from '@/pages/worker/jobs/helpers/get-chip-status-color'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { type MyJob } from '@/modules/worker/services/my-jobs-data'; +import { colorPalette as lightModeColorPalette } from '@/shared/styles/color-palette'; +import { getChipStatusColor } from '@/modules/worker/utils/get-chip-status-color'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function StatusChip({ status }: { status: MyJob['status'] }) { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/text-header-with-icon.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/text-header-with-icon.tsx similarity index 90% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/components/text-header-with-icon.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/jobs/text-header-with-icon.tsx index 711dfa2f0a..0af093146e 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/components/text-header-with-icon.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/text-header-with-icon.tsx @@ -1,5 +1,5 @@ import Grid from '@mui/material/Grid/Grid'; -import { FiltersIcon } from '@/components/ui/icons'; +import { FiltersIcon } from '@/shared/components/ui/icons'; export type IconType = 'filter'; diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/done-label.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/done-label.tsx similarity index 88% rename from packages/apps/human-app/frontend/src/pages/worker/profile/done-label.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/done-label.tsx index 7495d65899..a410132b82 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/done-label.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/done-label.tsx @@ -1,6 +1,6 @@ import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; -import { CheckmarkIcon } from '@/components/ui/icons'; +import { CheckmarkIcon } from '@/shared/components/ui/icons'; interface DoneLabelProps { children: string | React.ReactElement; diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/error-label.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/error-label.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/pages/worker/profile/error-label.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/error-label.tsx diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/profile-actions.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-actions.tsx similarity index 74% rename from packages/apps/human-app/frontend/src/pages/worker/profile/profile-actions.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-actions.tsx index dbdc33e365..7450b87851 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/profile-actions.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-actions.tsx @@ -2,18 +2,17 @@ import Grid from '@mui/material/Grid'; import { useTranslation } from 'react-i18next'; import { Navigate } from 'react-router-dom'; import { useEffect, useRef } from 'react'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import { Button } from '@/components/ui/button'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import { Button } from '@/shared/components/ui/button'; import { routerPaths } from '@/router/router-paths'; -import { WalletConnectDone } from '@/pages/worker/profile/wallet-connect-done'; -import { StartKycButton } from '@/pages/worker/profile/start-kyc-btn'; -import { RegisterAddressBtn } from '@/pages/worker/profile/register-address-btn'; -import { DoneLabel } from '@/pages/worker/profile/done-label'; -import { useRegisterAddressNotifications } from '@/hooks/use-register-address-notifications'; -import { useRegisterAddressMutation } from '@/api/services/worker/use-register-address'; +import { WalletConnectDone } from '@/modules/worker/components/profile/wallet-connect-done'; +import { StartKycButton } from '@/modules/worker/components/profile/start-kyc-btn'; +import { RegisterAddressBtn } from '@/modules/worker/components/profile/register-address-btn'; +import { DoneLabel } from '@/modules/worker/components/profile/done-label'; +import { useRegisterAddressNotifications } from '@/modules/worker/hooks/use-register-address-notifications'; +import { useRegisterAddressMutation } from '@/modules/worker/hooks/use-register-address'; import { ErrorLabel } from './error-label'; -// import { RegisterAddressOnChainButton } from '@/pages/worker/profile/register-address-on-chain-btn'; export function ProfileActions() { const { @@ -107,15 +106,6 @@ export function ProfileActions() { {kycApproved && !user.wallet_address ? ( {t('worker.profile.walletAddressMessage')} ) : null} - {/* - {kycApproved && user.wallet_address ? ( - - ) : ( - - )} - */} ); } diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/profile-data.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-data.tsx similarity index 82% rename from packages/apps/human-app/frontend/src/pages/worker/profile/profile-data.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-data.tsx index e6ccd79453..4f8c73a2ab 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/profile-data.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-data.tsx @@ -2,11 +2,11 @@ import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { Button } from '@/components/ui/button'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { Button } from '@/shared/components/ui/button'; import { routerPaths } from '@/router/router-paths'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; export function ProfileData() { const { colorPalette, isDarkMode } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/profile-email-notifications.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-email-notifications.tsx similarity index 90% rename from packages/apps/human-app/frontend/src/pages/worker/profile/profile-email-notifications.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-email-notifications.tsx index d6b0cdcd24..4a575fa43e 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/profile-email-notifications.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile-email-notifications.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; import Switch from '@mui/material/Switch'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; export function ProfileEmailNotification() { const { user } = useAuthenticatedUser(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/profile.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile.page.tsx similarity index 73% rename from packages/apps/human-app/frontend/src/pages/worker/profile/profile.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/profile.page.tsx index 03d3c18592..d907d58718 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/profile.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/profile.page.tsx @@ -1,12 +1,12 @@ import { Grid, Paper } from '@mui/material'; import { useEffect } from 'react'; import { t } from 'i18next'; -import { ProfileData } from '@/pages/worker/profile/profile-data'; -import { ProfileActions } from '@/pages/worker/profile/profile-actions'; -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; +import { ProfileData } from '@/modules/worker/components/profile/profile-data'; +import { ProfileActions } from '@/modules/worker/components/profile/profile-actions'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; export function WorkerProfilePage() { const { user } = useAuthenticatedUser(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/register-address-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/register-address-btn.tsx similarity index 63% rename from packages/apps/human-app/frontend/src/pages/worker/profile/register-address-btn.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/register-address-btn.tsx index b96fa108b8..149c3f9829 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/register-address-btn.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/register-address-btn.tsx @@ -1,7 +1,7 @@ import { t } from 'i18next'; -import { Button } from '@/components/ui/button'; -import { useRegisterAddressMutation } from '@/api/services/worker/use-register-address'; -import { useRegisterAddressNotifications } from '@/hooks/use-register-address-notifications'; +import { Button } from '@/shared/components/ui/button'; +import { useRegisterAddressMutation } from '@/modules/worker/hooks/use-register-address'; +import { useRegisterAddressNotifications } from '@/modules/worker/hooks/use-register-address-notifications'; export function RegisterAddressBtn() { const { onSuccess, onError } = useRegisterAddressNotifications(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/start-kyc-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/start-kyc-btn.tsx similarity index 82% rename from packages/apps/human-app/frontend/src/pages/worker/profile/start-kyc-btn.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/start-kyc-btn.tsx index b65b91a2d4..31fe800abd 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/start-kyc-btn.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/start-kyc-btn.tsx @@ -1,9 +1,9 @@ import { t } from 'i18next'; import { useEffect, useState } from 'react'; -import { useKycStartMutation } from '@/api/services/worker/get-kyc-session-id'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { Button } from '@/components/ui/button'; -import { useKycErrorNotifications } from '@/hooks/use-kyc-notification'; +import { useKycStartMutation } from '@/modules/worker/services/get-kyc-session-id'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { Button } from '@/shared/components/ui/button'; +import { useKycErrorNotifications } from '@/modules/worker/hooks/use-kyc-notification'; import { FetchError } from '@/api/fetcher'; export function StartKycButton() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/wallet-connect-done.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/profile/wallet-connect-done.tsx similarity index 79% rename from packages/apps/human-app/frontend/src/pages/worker/profile/wallet-connect-done.tsx rename to packages/apps/human-app/frontend/src/modules/worker/components/profile/wallet-connect-done.tsx index fe98e38c58..eefd503459 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/wallet-connect-done.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/profile/wallet-connect-done.tsx @@ -3,15 +3,15 @@ import TextField from '@mui/material/TextField'; import Typography from '@mui/material/Typography/Typography'; import { t } from 'i18next'; import styled from '@mui/material/styles/styled'; -import { CheckmarkIcon } from '@/components/ui/icons'; -import { colorPalette } from '@/styles/color-palette'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { CheckmarkIcon } from '@/shared/components/ui/icons'; +import { colorPalette } from '@/shared/styles/color-palette'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; import { darkColorPalette, onlyDarkModeColor, -} from '@/styles/dark-color-palette'; +} from '@/shared/styles/dark-color-palette'; const CustomTextField = styled(TextField)(() => ({ '& .Mui-disabled': { diff --git a/packages/apps/human-app/frontend/src/hooks/use-get-all-networks.ts b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-get-all-networks.ts similarity index 81% rename from packages/apps/human-app/frontend/src/hooks/use-get-all-networks.ts rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-get-all-networks.ts index f2a68c4cf7..61daf258dd 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-get-all-networks.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-get-all-networks.ts @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { getEnabledChainsByUiConfig } from '@/smart-contracts/chains'; +import { getEnabledChainsByUiConfig } from '@/modules/smart-contracts/chains'; export const useGetAllNetworks = (chainIdsEnabled: number[]) => { const allNetworks = useMemo(() => { diff --git a/packages/apps/human-app/frontend/src/hooks/use-get-oracles-notifications.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-get-oracles-notifications.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/hooks/use-get-oracles-notifications.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-get-oracles-notifications.tsx index 1a06629e57..8dbaf5dc6d 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-get-oracles-notifications.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-get-oracles-notifications.tsx @@ -1,4 +1,4 @@ -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; import { wait } from '@/shared/helpers/wait'; import type { ResponseError } from '@/shared/types/global.type'; diff --git a/packages/apps/human-app/frontend/src/hooks/use-hcaptcha-labeling-notifications.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-hcaptcha-labeling-notifications.tsx similarity index 88% rename from packages/apps/human-app/frontend/src/hooks/use-hcaptcha-labeling-notifications.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-hcaptcha-labeling-notifications.tsx index 547ecf5d4e..8c37d4b372 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-hcaptcha-labeling-notifications.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-hcaptcha-labeling-notifications.tsx @@ -1,5 +1,5 @@ import { t } from 'i18next'; -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; import { wait } from '@/shared/helpers/wait'; import type { ResponseError } from '@/shared/types/global.type'; diff --git a/packages/apps/human-app/frontend/src/hooks/use-job-types-oracles-table.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-job-types-oracles-table.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/hooks/use-job-types-oracles-table.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-job-types-oracles-table.tsx diff --git a/packages/apps/human-app/frontend/src/hooks/use-jobs-filter-store.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-jobs-filter-store.tsx similarity index 97% rename from packages/apps/human-app/frontend/src/hooks/use-jobs-filter-store.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-jobs-filter-store.tsx index 30c2652078..68ce87e540 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-jobs-filter-store.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-jobs-filter-store.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase -- api params*/ import { create } from 'zustand'; import type { PageSize } from '@/shared/types/entity.type'; -import { MyJobStatus } from '@/api/services/worker/my-jobs-data'; +import { MyJobStatus } from '@/modules/worker/services/my-jobs-data'; export interface JobsFilterStoreProps { filterParams: { diff --git a/packages/apps/human-app/frontend/src/hooks/use-jobs-notifications.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-jobs-notifications.tsx similarity index 87% rename from packages/apps/human-app/frontend/src/hooks/use-jobs-notifications.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-jobs-notifications.tsx index a1e5be884d..edacf70380 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-jobs-notifications.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-jobs-notifications.tsx @@ -1,5 +1,5 @@ import { t } from 'i18next'; -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; import { wait } from '@/shared/helpers/wait'; diff --git a/packages/apps/human-app/frontend/src/hooks/use-kyc-notification.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/hooks/use-kyc-notification.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx index 817e139493..d55f5d6754 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-kyc-notification.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx @@ -1,4 +1,4 @@ -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; import type { ResponseError } from '@/shared/types/global.type'; diff --git a/packages/apps/human-app/frontend/src/hooks/use-location-state.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-location-state.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/hooks/use-location-state.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-location-state.tsx diff --git a/packages/apps/human-app/frontend/src/hooks/use-my-jobs-filter-store.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-my-jobs-filter-store.tsx similarity index 96% rename from packages/apps/human-app/frontend/src/hooks/use-my-jobs-filter-store.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-my-jobs-filter-store.tsx index 35ad37e526..074439b923 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-my-jobs-filter-store.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-my-jobs-filter-store.tsx @@ -1,7 +1,7 @@ /* eslint-disable camelcase -- api params*/ import { create } from 'zustand'; import type { PageSize } from '@/shared/types/entity.type'; -import { type MyJobStatus } from '@/api/services/worker/my-jobs-data'; +import { type MyJobStatus } from '@/modules/worker/services/my-jobs-data'; export interface MyJobsFilterStoreProps { filterParams: { diff --git a/packages/apps/human-app/frontend/src/hooks/use-protected-layout-notifications.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-protected-layout-notifications.tsx similarity index 70% rename from packages/apps/human-app/frontend/src/hooks/use-protected-layout-notifications.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-protected-layout-notifications.tsx index 279b63688e..1e289e02de 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-protected-layout-notifications.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-protected-layout-notifications.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { ProtectedLayoutContext } from '@/components/layout/protected/layout-notification-context'; +import { ProtectedLayoutContext } from '@/shared/components/layout/protected/layout-notification-context'; export function useProtectedLayoutNotification() { const context = useContext(ProtectedLayoutContext); diff --git a/packages/apps/human-app/frontend/src/hooks/use-register-address-notifications.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address-notifications.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/hooks/use-register-address-notifications.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address-notifications.tsx index 9e6b6a43cc..9818e43c82 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-register-address-notifications.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address-notifications.tsx @@ -1,4 +1,4 @@ -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; import type { ResponseError } from '@/shared/types/global.type'; diff --git a/packages/apps/human-app/frontend/src/api/services/worker/use-register-address-on-chain.ts b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address-on-chain.ts similarity index 75% rename from packages/apps/human-app/frontend/src/api/services/worker/use-register-address-on-chain.ts rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address-on-chain.ts index 53567d41cf..9544a2b122 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/use-register-address-on-chain.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address-on-chain.ts @@ -1,12 +1,12 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import type { JsonRpcSigner } from 'ethers'; import { t } from 'i18next'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { ethKvStoreSetBulk } from '@/smart-contracts/EthKVStore/eth-kv-store-set-bulk'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; -import type { SignedAddressSuccess } from '@/api/services/worker/get-signed-address'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; -import { checkNetwork } from '@/smart-contracts/check-network'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { ethKvStoreSetBulk } from '@/modules/smart-contracts/EthKVStore/eth-kv-store-set-bulk'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; +import type { SignedAddressSuccess } from '@/modules/worker/services/get-signed-address'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; +import { checkNetwork } from '@/modules/smart-contracts/check-network'; async function registerAddressInKVStore({ key, diff --git a/packages/apps/human-app/frontend/src/api/services/worker/use-register-address.ts b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address.ts similarity index 88% rename from packages/apps/human-app/frontend/src/api/services/worker/use-register-address.ts rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address.ts index 86b9b0fccf..347a5cbe22 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/use-register-address.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-register-address.ts @@ -1,16 +1,16 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { z } from 'zod'; import { t } from 'i18next'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; import { PrepareSignatureType, prepareSignature, -} from '@/api/services/common/prepare-signature'; +} from '@/api/hooks/use-prepare-signature'; import type { ResponseError } from '@/shared/types/global.type'; -import { useAccessTokenRefresh } from '@/api/services/common/use-access-token-refresh'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; +import { useAccessTokenRefresh } from '@/api/hooks/use-access-token-refresh'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; const RegisterAddressSuccessSchema = z.unknown(); diff --git a/packages/apps/human-app/frontend/src/api/services/worker/available-jobs-data.ts b/packages/apps/human-app/frontend/src/modules/worker/services/available-jobs-data.ts similarity index 93% rename from packages/apps/human-app/frontend/src/api/services/worker/available-jobs-data.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/available-jobs-data.ts index d030c12e17..84825210b9 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/available-jobs-data.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/available-jobs-data.ts @@ -5,8 +5,8 @@ import { useParams } from 'react-router-dom'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; import { stringifyUrlQueryObject } from '@/shared/helpers/stringify-url-query-object'; -import type { JobsFilterStoreProps } from '@/hooks/use-jobs-filter-store'; -import { useJobsFilterStore } from '@/hooks/use-jobs-filter-store'; +import type { JobsFilterStoreProps } from '@/modules/worker/hooks/use-jobs-filter-store'; +import { useJobsFilterStore } from '@/modules/worker/hooks/use-jobs-filter-store'; import { createPaginationSchema } from '@/shared/helpers/create-pagination-schema'; const availableJobSchema = z.object({ diff --git a/packages/apps/human-app/frontend/src/api/services/worker/daily-hmt-spent.ts b/packages/apps/human-app/frontend/src/modules/worker/services/daily-hmt-spent.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/daily-hmt-spent.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/daily-hmt-spent.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/email-verification.ts b/packages/apps/human-app/frontend/src/modules/worker/services/email-verification.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/email-verification.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/email-verification.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/enable-hcaptcha-labeling.ts b/packages/apps/human-app/frontend/src/modules/worker/services/enable-hcaptcha-labeling.ts similarity index 93% rename from packages/apps/human-app/frontend/src/api/services/worker/enable-hcaptcha-labeling.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/enable-hcaptcha-labeling.ts index 7f346bd341..9dbc4abd83 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/enable-hcaptcha-labeling.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/enable-hcaptcha-labeling.ts @@ -5,7 +5,7 @@ import { z } from 'zod'; import { routerPaths } from '@/router/router-paths'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; -import { useAccessTokenRefresh } from '@/api/services/common/use-access-token-refresh'; +import { useAccessTokenRefresh } from '@/api/hooks/use-access-token-refresh'; const enableHCaptchaLabelingSuccessSchema = z.object({ site_key: z.string(), diff --git a/packages/apps/human-app/frontend/src/api/services/worker/get-kyc-session-id.ts b/packages/apps/human-app/frontend/src/modules/worker/services/get-kyc-session-id.ts similarity index 88% rename from packages/apps/human-app/frontend/src/api/services/worker/get-kyc-session-id.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/get-kyc-session-id.ts index 5ef6eeaf73..4625ad3ff7 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/get-kyc-session-id.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/get-kyc-session-id.ts @@ -1,9 +1,9 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { z } from 'zod'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; -import { useAccessTokenRefresh } from '@/api/services/common/use-access-token-refresh'; +import { useAccessTokenRefresh } from '@/api/hooks/use-access-token-refresh'; const kycStartSchema = z.object({ url: z.string(), diff --git a/packages/apps/human-app/frontend/src/api/services/worker/get-on-chain-registered-address.ts b/packages/apps/human-app/frontend/src/modules/worker/services/get-on-chain-registered-address.ts similarity index 76% rename from packages/apps/human-app/frontend/src/api/services/worker/get-on-chain-registered-address.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/get-on-chain-registered-address.ts index d083f3af66..d8e8b6e61b 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/get-on-chain-registered-address.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/get-on-chain-registered-address.ts @@ -1,10 +1,10 @@ /* eslint-disable camelcase -- ... */ import { z } from 'zod'; import { useQuery } from '@tanstack/react-query'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { ethKVStoreGetKycData } from '@/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data'; -import { getContractAddress } from '@/smart-contracts/get-contract-address'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { ethKVStoreGetKycData } from '@/modules/smart-contracts/EthKVStore/eth-kv-store-get-kyc-data'; +import { getContractAddress } from '@/modules/smart-contracts/get-contract-address'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; export interface RegisterAddressPayload { address: string; diff --git a/packages/apps/human-app/frontend/src/api/services/worker/get-registration-in-exchange-oracles.ts b/packages/apps/human-app/frontend/src/modules/worker/services/get-registration-in-exchange-oracles.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/get-registration-in-exchange-oracles.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/get-registration-in-exchange-oracles.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/get-signed-address.ts b/packages/apps/human-app/frontend/src/modules/worker/services/get-signed-address.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/get-signed-address.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/get-signed-address.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/get-ui-config.ts b/packages/apps/human-app/frontend/src/modules/worker/services/get-ui-config.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/get-ui-config.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/get-ui-config.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/hcaptcha-user-stats.ts b/packages/apps/human-app/frontend/src/modules/worker/services/hcaptcha-user-stats.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/hcaptcha-user-stats.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/hcaptcha-user-stats.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/available-jobs-table-service-mock.ts b/packages/apps/human-app/frontend/src/modules/worker/services/mocks/available-jobs-table-service-mock.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/available-jobs-table-service-mock.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/mocks/available-jobs-table-service-mock.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/my-jobs-table-service-mock.ts b/packages/apps/human-app/frontend/src/modules/worker/services/mocks/my-jobs-table-service-mock.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/my-jobs-table-service-mock.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/mocks/my-jobs-table-service-mock.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/my-jobs-data.ts b/packages/apps/human-app/frontend/src/modules/worker/services/my-jobs-data.ts similarity index 93% rename from packages/apps/human-app/frontend/src/api/services/worker/my-jobs-data.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/my-jobs-data.ts index 139541950c..17447135cf 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/my-jobs-data.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/my-jobs-data.ts @@ -6,8 +6,8 @@ import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; import { stringifyUrlQueryObject } from '@/shared/helpers/stringify-url-query-object'; import { createPaginationSchema } from '@/shared/helpers/create-pagination-schema'; -import type { MyJobsFilterStoreProps } from '@/hooks/use-my-jobs-filter-store'; -import { useMyJobsFilterStore } from '@/hooks/use-my-jobs-filter-store'; +import type { MyJobsFilterStoreProps } from '@/modules/worker/hooks/use-my-jobs-filter-store'; +import { useMyJobsFilterStore } from '@/modules/worker/hooks/use-my-jobs-filter-store'; export enum MyJobStatus { ACTIVE = 'ACTIVE', diff --git a/packages/apps/human-app/frontend/src/api/services/worker/oracles.ts b/packages/apps/human-app/frontend/src/modules/worker/services/oracles.ts similarity index 96% rename from packages/apps/human-app/frontend/src/api/services/worker/oracles.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/oracles.ts index 810b7df7fc..9d6daa94ba 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/oracles.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/oracles.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; import { useQuery } from '@tanstack/react-query'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; -import { useJobsTypesOraclesFilter } from '@/hooks/use-job-types-oracles-table'; +import { useJobsTypesOraclesFilter } from '@/modules/worker/hooks/use-job-types-oracles-table'; import { stringifyUrlQueryObject } from '@/shared/helpers/stringify-url-query-object'; import { env } from '@/shared/env'; diff --git a/packages/apps/human-app/frontend/src/api/services/worker/refresh-tasks.ts b/packages/apps/human-app/frontend/src/modules/worker/services/refresh-tasks.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/refresh-tasks.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/refresh-tasks.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/registration-in-exchange-oracles.ts b/packages/apps/human-app/frontend/src/modules/worker/services/registration-in-exchange-oracles.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/registration-in-exchange-oracles.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/registration-in-exchange-oracles.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/reject-task.ts b/packages/apps/human-app/frontend/src/modules/worker/services/reject-task.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/reject-task.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/reject-task.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/resend-email-verification.ts b/packages/apps/human-app/frontend/src/modules/worker/services/resend-email-verification.ts similarity index 97% rename from packages/apps/human-app/frontend/src/api/services/worker/resend-email-verification.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/resend-email-verification.ts index 6e7149bfc1..8bccfa7b41 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/resend-email-verification.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/resend-email-verification.ts @@ -11,7 +11,7 @@ import { t } from 'i18next'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; import type { ResponseError } from '@/shared/types/global.type'; -import { useAuth } from '@/auth/use-auth'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; export const resendEmailVerificationHcaptchaSchema = z.object({ h_captcha_token: z.string().min(1, t('validation.captcha')).default('token'), diff --git a/packages/apps/human-app/frontend/src/api/services/worker/reset-password.ts b/packages/apps/human-app/frontend/src/modules/worker/services/reset-password.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/reset-password.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/reset-password.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/send-reset-link.ts b/packages/apps/human-app/frontend/src/modules/worker/services/send-reset-link.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/send-reset-link.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/send-reset-link.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/sign-in/schema.ts b/packages/apps/human-app/frontend/src/modules/worker/services/sign-in/schema.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/sign-in/schema.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/sign-in/schema.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/sign-in/sign-in.ts b/packages/apps/human-app/frontend/src/modules/worker/services/sign-in/sign-in.ts similarity index 94% rename from packages/apps/human-app/frontend/src/api/services/worker/sign-in/sign-in.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/sign-in/sign-in.ts index c12984f8ca..2cfd14d324 100644 --- a/packages/apps/human-app/frontend/src/api/services/worker/sign-in/sign-in.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/sign-in/sign-in.ts @@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'; import { apiClient } from '@/api/api-client'; import { apiPaths } from '@/api/api-paths'; import { routerPaths } from '@/router/router-paths'; -import { useAuth } from '@/auth/use-auth'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; import { type SignInDto } from './types'; import { signInSuccessResponseSchema } from './schema'; diff --git a/packages/apps/human-app/frontend/src/api/services/worker/sign-in/types.ts b/packages/apps/human-app/frontend/src/modules/worker/services/sign-in/types.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/sign-in/types.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/sign-in/types.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/sign-up.ts b/packages/apps/human-app/frontend/src/modules/worker/services/sign-up.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/sign-up.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/sign-up.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/solve-hcaptcha.ts b/packages/apps/human-app/frontend/src/modules/worker/services/solve-hcaptcha.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/solve-hcaptcha.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/solve-hcaptcha.ts diff --git a/packages/apps/human-app/frontend/src/api/services/worker/assign-job.ts b/packages/apps/human-app/frontend/src/modules/worker/services/use-assign-job.ts similarity index 100% rename from packages/apps/human-app/frontend/src/api/services/worker/assign-job.ts rename to packages/apps/human-app/frontend/src/modules/worker/services/use-assign-job.ts diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/helpers/get-chip-status-color.ts b/packages/apps/human-app/frontend/src/modules/worker/utils/get-chip-status-color.ts similarity index 80% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/helpers/get-chip-status-color.ts rename to packages/apps/human-app/frontend/src/modules/worker/utils/get-chip-status-color.ts index 856d055f7b..435e51ce1e 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/helpers/get-chip-status-color.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/utils/get-chip-status-color.ts @@ -1,8 +1,8 @@ import { MyJobStatus, type UNKNOWN_JOB_STATUS, -} from '@/api/services/worker/my-jobs-data'; -import { type ColorPalette } from '@/styles/color-palette'; +} from '@/modules/worker/services/my-jobs-data'; +import { type ColorPalette } from '@/shared/styles/color-palette'; export function getChipStatusColor( status: MyJobStatus | typeof UNKNOWN_JOB_STATUS, diff --git a/packages/apps/human-app/frontend/src/pages/worker/email-verification/email-verification.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/email-verification/email-verification.page.tsx similarity index 79% rename from packages/apps/human-app/frontend/src/pages/worker/email-verification/email-verification.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/email-verification/email-verification.page.tsx index e57e571c9b..11936f7257 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/email-verification/email-verification.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/email-verification/email-verification.page.tsx @@ -3,16 +3,14 @@ import { t } from 'i18next'; import Typography from '@mui/material/Typography'; import { z } from 'zod'; import { Link } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; import { routerPaths } from '@/router/router-paths'; -import { useVerifyEmailQuery } from '@/api/services/worker/email-verification'; -import { SuccessLabel } from '@/components/ui/success-label'; -import { - PageCard, - PageCardError, - PageCardLoader, -} from '@/components/ui/page-card'; -import { useLocationState } from '@/hooks/use-location-state'; +import { useVerifyEmailQuery } from '@/modules/worker/services/email-verification'; +import { SuccessLabel } from '@/shared/components/ui/success-label'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { useLocationState } from '@/modules/worker/hooks/use-location-state'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; const tokenSchema = z.string().transform((value, ctx) => { diff --git a/packages/apps/human-app/frontend/src/pages/worker/email-verification/verify-email.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/email-verification/verify-email.page.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/pages/worker/email-verification/verify-email.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/email-verification/verify-email.page.tsx index f5a340788b..44fb6fabc7 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/email-verification/verify-email.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/email-verification/verify-email.page.tsx @@ -5,25 +5,26 @@ import { useNavigate } from 'react-router-dom'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; import { FormProvider, useForm } from 'react-hook-form'; -import { PageCard, PageCardLoader } from '@/components/ui/page-card'; -import { useLocationState } from '@/hooks/use-location-state'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { useLocationState } from '@/modules/worker/hooks/use-location-state'; import { env } from '@/shared/env'; -import type { ResendEmailVerificationDto } from '@/api/services/worker/resend-email-verification'; +import type { ResendEmailVerificationDto } from '@/modules/worker/services/resend-email-verification'; import { resendEmailVerificationHcaptchaSchema, useResendEmailVerificationWorkerMutation, useResendEmailVerificationWorkerMutationState, -} from '@/api/services/worker/resend-email-verification'; -import { Alert } from '@/components/ui/alert'; +} from '@/modules/worker/services/resend-email-verification'; +import { Alert } from '@/shared/components/ui/alert'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { FormCaptcha } from '@/components/h-captcha'; -import { Button } from '@/components/ui/button'; -import { useAuth } from '@/auth/use-auth'; +import { FormCaptcha } from '@/shared/components/h-captcha'; +import { Button } from '@/shared/components/ui/button'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; import { routerPaths } from '@/router/router-paths'; -import { MailTo } from '@/components/ui/mail-to'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { MailTo } from '@/shared/components/ui/mail-to'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; export function VerifyEmailWorkerPage() { const { colorPalette, isDarkMode } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/enable-labeler.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/hcaptcha-labeling/enable-labeler.page.tsx similarity index 79% rename from packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/enable-labeler.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/hcaptcha-labeling/enable-labeler.page.tsx index 7e7d52529a..d62a94b2e1 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/enable-labeler.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/hcaptcha-labeling/enable-labeler.page.tsx @@ -4,15 +4,15 @@ import { t } from 'i18next'; import Typography from '@mui/material/Typography'; import { Navigate } from 'react-router-dom'; import { useEffect } from 'react'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { useEnableHCaptchaLabelingMutation } from '@/api/services/worker/enable-hcaptcha-labeling'; -import { Button } from '@/components/ui/button'; -import { PageCardError } from '@/components/ui/page-card'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { useEnableHCaptchaLabelingMutation } from '@/modules/worker/services/enable-hcaptcha-labeling'; +import { Button } from '@/shared/components/ui/button'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { breakpoints } from '@/styles/breakpoints'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; import { routerPaths } from '@/router/router-paths'; -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; +import { useProtectedLayoutNotification } from '@/modules/worker/hooks/use-protected-layout-notifications'; export function EnableLabeler() { const isMobile = useIsMobile(); @@ -31,10 +31,6 @@ export function EnableLabeler() { return ; } - // if (user.site_key) { - // return ; - // } - if (isError) { return ; } diff --git a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/hcaptcha-labeling.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/hcaptcha-labeling/hcaptcha-labeling.page.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/hcaptcha-labeling.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/hcaptcha-labeling/hcaptcha-labeling.page.tsx index 0bd16c1a99..a7aad0eb07 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/hcaptcha-labeling/hcaptcha-labeling/hcaptcha-labeling.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/hcaptcha-labeling/hcaptcha-labeling.page.tsx @@ -4,20 +4,21 @@ import { Paper, Typography } from '@mui/material'; import { t } from 'i18next'; import { Navigate, useNavigate } from 'react-router-dom'; import { useRef } from 'react'; -import { useIsMobile } from '@/hooks/use-is-mobile'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; import { env } from '@/shared/env'; -import { breakpoints } from '@/styles/breakpoints'; -import { Counter } from '@/components/ui/counter'; -import { useHCaptchaUserStats } from '@/api/services/worker/hcaptcha-user-stats'; -import { PageCardError, PageCardLoader } from '@/components/ui/page-card'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { Counter } from '@/shared/components/ui/counter'; +import { useHCaptchaUserStats } from '@/modules/worker/services/hcaptcha-user-stats'; +import { PageCardError } from '@/shared/components/ui/page-card-error'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { useDailyHmtSpent } from '@/api/services/worker/daily-hmt-spent'; +import { useDailyHmtSpent } from '@/modules/worker/services/daily-hmt-spent'; import { getTomorrowDate } from '@/shared/helpers/counter-helpers'; -import { useSolveHCaptchaMutation } from '@/api/services/worker/solve-hcaptcha'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; -import { useHCaptchaLabelingNotifications } from '@/hooks/use-hcaptcha-labeling-notifications'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { useSolveHCaptchaMutation } from '@/modules/worker/services/solve-hcaptcha'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useHCaptchaLabelingNotifications } from '@/modules/worker/hooks/use-hcaptcha-labeling-notifications'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; import { routerPaths } from '@/router/router-paths'; export function HcaptchaLabelingPage() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/jobs-discovery.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/jobs-discovery/jobs-discovery.page.tsx similarity index 69% rename from packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/jobs-discovery.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/jobs-discovery/jobs-discovery.page.tsx index 2324994636..2ea95aa059 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs-discovery/jobs-discovery.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/jobs-discovery/jobs-discovery.page.tsx @@ -3,14 +3,14 @@ import Grid from '@mui/material/Grid'; import type { UseQueryResult } from '@tanstack/react-query'; import { Navigate } from 'react-router-dom'; import { useEffect, useRef } from 'react'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { OraclesTable } from '@/pages/worker/jobs-discovery/components/oracles-table/oracles-table'; -import { OraclesTableJobTypesSelect } from '@/pages/worker/jobs-discovery/components/oracles-table/oracles-table-job-types-select'; -import type { Oracle } from '@/api/services/worker/oracles'; -import { useGetOracles } from '@/api/services/worker/oracles'; -import { useAuthenticatedUser } from '@/auth/use-authenticated-user'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import type { Oracle } from '@/modules/worker/services/oracles'; +import { useGetOracles } from '@/modules/worker/services/oracles'; import { routerPaths } from '@/router/router-paths'; -import { useGetOraclesNotifications } from '@/hooks/use-get-oracles-notifications'; +import { useGetOraclesNotifications } from '@/modules/worker/hooks/use-get-oracles-notifications'; +import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { OraclesTableJobTypesSelect } from '@/modules/worker/components/jobs-discovery/oracles-table-job-types-select'; +import { OraclesTable } from '@/modules/worker/components/jobs-discovery/oracles-table'; export type OraclesDataQueryResult = UseQueryResult; diff --git a/packages/apps/human-app/frontend/src/pages/worker/jobs/jobs.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/jobs/jobs.page.tsx similarity index 80% rename from packages/apps/human-app/frontend/src/pages/worker/jobs/jobs.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/jobs/jobs.page.tsx index 5d470fdc4b..902b622a1f 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/jobs/jobs.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/jobs/jobs.page.tsx @@ -3,22 +3,22 @@ import React, { useEffect, useRef, useState } from 'react'; import { Box, Grid, Paper, Stack, Tab, Tabs, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; -import { TableQueryContextProvider } from '@/components/ui/table/table-query-context'; -import { Modal } from '@/components/ui/modal/modal'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { MyJobsTableMobile } from '@/pages/worker/jobs/components/my-jobs/mobile/my-jobs-table-mobile'; -import { AvailableJobsTable } from '@/pages/worker/jobs/components/available-jobs/desktop/available-jobs-table'; -import { MyJobsDrawerMobile } from '@/pages/worker/jobs/components/my-jobs/mobile/my-jobs-drawer-mobile'; -import { AvailableJobsDrawerMobile } from '@/pages/worker/jobs/components/available-jobs/mobile/available-jobs-drawer-mobile'; -import { useGetOracles } from '@/api/services/worker/oracles'; -import { useGetUiConfig } from '@/api/services/worker/get-ui-config'; -import { PageCardLoader } from '@/components/ui/page-card'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useGetOraclesNotifications } from '@/hooks/use-get-oracles-notifications'; -import { NoRecords } from '@/components/ui/no-records'; -import { AvailableJobsTableMobile } from './components/available-jobs/mobile/available-jobs-table-mobile'; -import { TabPanel } from './components/jobs-tab-panel'; -import { MyJobsTable } from './components/my-jobs/desktop/my-jobs-table'; +import { TableQueryContextProvider } from '@/shared/components/ui/table/table-query-context'; +import { Modal } from '@/shared/components/ui/modal/modal'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { MyJobsTableMobile } from '@/modules/worker/components/jobs/my-jobs/mobile/my-jobs-table-mobile'; +import { AvailableJobsTable } from '@/modules/worker/components/jobs/available-jobs/desktop/available-jobs-table'; +import { MyJobsDrawerMobile } from '@/modules/worker/components/jobs/my-jobs/mobile/my-jobs-drawer-mobile'; +import { AvailableJobsDrawerMobile } from '@/modules/worker/components/jobs/available-jobs/mobile/available-jobs-drawer-mobile'; +import { useGetOracles } from '@/modules/worker/services/oracles'; +import { useGetUiConfig } from '@/modules/worker/services/get-ui-config'; +import { PageCardLoader } from '@/shared/components/ui/page-card-loader'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useGetOraclesNotifications } from '@/modules/worker/hooks/use-get-oracles-notifications'; +import { NoRecords } from '@/shared/components/ui/no-records'; +import { AvailableJobsTableMobile } from '@/modules/worker/components/jobs/available-jobs/mobile/available-jobs-table-mobile'; +import { TabPanel } from '@/modules/worker/components/jobs/jobs-tab-panel'; +import { MyJobsTable } from '@/modules/worker/components/jobs/my-jobs/desktop/my-jobs-table'; function generateTabA11yProps(index: number) { return { diff --git a/packages/apps/human-app/frontend/src/pages/protected.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/protected/protected.page.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/pages/protected.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/protected/protected.page.tsx diff --git a/packages/apps/human-app/frontend/src/pages/worker/registration/registration.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/registration/registration.page.tsx similarity index 93% rename from packages/apps/human-app/frontend/src/pages/worker/registration/registration.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/registration/registration.page.tsx index 6409f7b2c2..0e006de11c 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/registration/registration.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/registration/registration.page.tsx @@ -4,15 +4,15 @@ import { FormProvider, useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; import { zodResolver } from '@hookform/resolvers/zod'; -import { FormCaptcha } from '@/components/h-captcha'; -import { Button } from '@/components/ui/button'; +import { FormCaptcha } from '@/shared/components/h-captcha'; +import { Button } from '@/shared/components/ui/button'; import { type RegistrationInExchangeOracleDto, registrationInExchangeOracleDtoSchema, useExchangeOracleRegistrationMutation, -} from '@/api/services/worker/registration-in-exchange-oracles'; -import { useRegisteredOracles } from '@/contexts/registered-oracles'; -import { useGetOracles } from '@/api/services/worker/oracles'; +} from '@/modules/worker/services/registration-in-exchange-oracles'; +import { useRegisteredOracles } from '@/shared/contexts/registered-oracles'; +import { useGetOracles } from '@/modules/worker/services/oracles'; import { routerPaths } from '@/router/router-paths'; export function RegistrationPage() { diff --git a/packages/apps/human-app/frontend/src/pages/worker/reset-password/reset-password-success.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/reset-password/reset-password-success.page.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/reset-password/reset-password-success.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/reset-password/reset-password-success.page.tsx index 9e00991e41..b8c5da16e7 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/reset-password/reset-password-success.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/reset-password/reset-password-success.page.tsx @@ -4,11 +4,11 @@ import { Link } from 'react-router-dom'; import Typography from '@mui/material/Typography'; import CheckCircle from '@mui/icons-material/CheckCircle'; import { useEffect } from 'react'; -import { Button } from '@/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; import { routerPaths } from '@/router/router-paths'; -import { PageCard } from '@/components/ui/page-card'; -import { useAuth } from '@/auth/use-auth'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function ResetPasswordWorkerSuccessPage() { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/reset-password/reset-password.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/reset-password/reset-password.page.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/pages/worker/reset-password/reset-password.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/reset-password/reset-password.page.tsx index f6043dc83a..a933229d70 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/reset-password/reset-password.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/reset-password/reset-password.page.tsx @@ -7,19 +7,19 @@ import { t } from 'i18next'; import omit from 'lodash/omit'; import { useLocation } from 'react-router-dom'; import queryString from 'query-string'; -import { Button } from '@/components/ui/button'; -import { Password } from '@/components/data-entry/password/password'; -import { PageCard } from '@/components/ui/page-card'; -import type { ResetPasswordDto } from '@/api/services/worker/reset-password'; +import { Button } from '@/shared/components/ui/button'; +import { Password } from '@/shared/components/data-entry/password/password'; +import { PageCard } from '@/shared/components/ui/page-card'; +import type { ResetPasswordDto } from '@/modules/worker/services/reset-password'; import { resetPasswordDtoSchema, useResetPasswordMutation, -} from '@/api/services/worker/reset-password'; -import { Alert } from '@/components/ui/alert'; +} from '@/modules/worker/services/reset-password'; +import { Alert } from '@/shared/components/ui/alert'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; import { routerPaths } from '@/router/router-paths'; -import { FormCaptcha } from '@/components/h-captcha'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; +import { FormCaptcha } from '@/shared/components/h-captcha'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; export function ResetPasswordWorkerPage() { const location = useLocation(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/send-reset-link/send-reset-link-success.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/send-reset-link/send-reset-link-success.page.tsx similarity index 82% rename from packages/apps/human-app/frontend/src/pages/worker/send-reset-link/send-reset-link-success.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/send-reset-link/send-reset-link-success.page.tsx index be4505fc6f..5fd445bce3 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/send-reset-link/send-reset-link-success.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/send-reset-link/send-reset-link-success.page.tsx @@ -4,22 +4,22 @@ import { Trans, useTranslation } from 'react-i18next'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; import { FormProvider, useForm } from 'react-hook-form'; -import { PageCard } from '@/components/ui/page-card'; -import { Button } from '@/components/ui/button'; -import { useLocationState } from '@/hooks/use-location-state'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { Button } from '@/shared/components/ui/button'; +import { useLocationState } from '@/modules/worker/hooks/use-location-state'; import { env } from '@/shared/env'; -import type { SendResetLinkHcaptcha } from '@/api/services/worker/send-reset-link'; +import type { SendResetLinkHcaptcha } from '@/modules/worker/services/send-reset-link'; import { sendResetLinkHcaptchaDtoSchema, useSendResetLinkMutation, -} from '@/api/services/worker/send-reset-link'; -import { Alert } from '@/components/ui/alert'; +} from '@/modules/worker/services/send-reset-link'; +import { Alert } from '@/shared/components/ui/alert'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { FormCaptcha } from '@/components/h-captcha'; -import { MailTo } from '@/components/ui/mail-to'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; +import { FormCaptcha } from '@/shared/components/h-captcha'; +import { MailTo } from '@/shared/components/ui/mail-to'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; export function SendResetLinkWorkerSuccessPage() { const { colorPalette, isDarkMode } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/send-reset-link/send-reset-link.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/send-reset-link/send-reset-link.page.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/pages/worker/send-reset-link/send-reset-link.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/send-reset-link/send-reset-link.page.tsx index f2aea616dd..4bf7dbb6fc 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/send-reset-link/send-reset-link.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/send-reset-link/send-reset-link.page.tsx @@ -3,20 +3,20 @@ import { FormProvider, useForm } from 'react-hook-form'; import { Grid, Typography } from '@mui/material'; import { zodResolver } from '@hookform/resolvers/zod'; import { useTranslation } from 'react-i18next'; -import { PageCard } from '@/components/ui/page-card'; -import { Input } from '@/components/data-entry/input'; -import { Button } from '@/components/ui/button'; -import type { SendResetLinkDto } from '@/api/services/worker/send-reset-link'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { Input } from '@/shared/components/data-entry/input'; +import { Button } from '@/shared/components/ui/button'; +import type { SendResetLinkDto } from '@/modules/worker/services/send-reset-link'; import { sendResetLinkDtoSchema, useSendResetLinkMutation, -} from '@/api/services/worker/send-reset-link'; -import { Alert } from '@/components/ui/alert'; +} from '@/modules/worker/services/send-reset-link'; +import { Alert } from '@/shared/components/ui/alert'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { useAuth } from '@/auth/use-auth'; -import { FormCaptcha } from '@/components/h-captcha'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; +import { FormCaptcha } from '@/shared/components/h-captcha'; import { routerPaths } from '@/router/router-paths'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; export function SendResetLinkWorkerPage() { const { t } = useTranslation(); diff --git a/packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/sign/sign-in.page.tsx similarity index 80% rename from packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/sign/sign-in.page.tsx index f242dd6138..5689266b80 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/sign-in.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/sign/sign-in.page.tsx @@ -5,20 +5,20 @@ import { useTranslation } from 'react-i18next'; import { t as i18NextT } from 'i18next'; import { Link } from 'react-router-dom'; import { useEffect } from 'react'; -import { PageCard } from '@/components/ui/page-card'; -import { Input } from '@/components/data-entry/input'; -import { Button } from '@/components/ui/button'; -import { Password } from '@/components/data-entry/password/password'; -import { useSignInMutation } from '@/api/services/worker/sign-in/sign-in'; +import { PageCard } from '@/shared/components/ui/page-card'; +import { Input } from '@/shared/components/data-entry/input'; +import { Button } from '@/shared/components/ui/button'; +import { Password } from '@/shared/components/data-entry/password/password'; +import { useSignInMutation } from '@/modules/worker/services/sign-in/sign-in'; import { FetchError } from '@/api/fetcher'; import { routerPaths } from '@/router/router-paths'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { Alert } from '@/components/ui/alert'; -import { FormCaptcha } from '@/components/h-captcha'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; -import { type SignInDto } from '@/api/services/worker/sign-in/types'; -import { signInDtoSchema } from '@/api/services/worker/sign-in/schema'; +import { Alert } from '@/shared/components/ui/alert'; +import { FormCaptcha } from '@/shared/components/h-captcha'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; +import { type SignInDto } from '@/modules/worker/services/sign-in/types'; +import { signInDtoSchema } from '@/modules/worker/services/sign-in/schema'; function formattedSignInErrorMessage(unknownError: unknown) { if (unknownError instanceof FetchError && unknownError.status === 400) { diff --git a/packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/views/sign/sign-up.page.tsx similarity index 85% rename from packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx rename to packages/apps/human-app/frontend/src/modules/worker/views/sign/sign-up.page.tsx index 27686380ca..367b9471c8 100644 --- a/packages/apps/human-app/frontend/src/pages/worker/sign-up.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/views/sign/sign-up.page.tsx @@ -7,22 +7,22 @@ import Link from '@mui/material/Link'; import { t } from 'i18next'; import omit from 'lodash/omit'; import { useEffect } from 'react'; -import type { SignUpDto } from '@/api/services/worker/sign-up'; +import type { SignUpDto } from '@/modules/worker/services/sign-up'; import { signUpDtoSchema, useSignUpMutation, -} from '@/api/services/worker/sign-up'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/data-entry/input'; -import { Password } from '@/components/data-entry/password/password'; -import { PageCard } from '@/components/ui/page-card'; +} from '@/modules/worker/services/sign-up'; +import { Button } from '@/shared/components/ui/button'; +import { Input } from '@/shared/components/data-entry/input'; +import { Password } from '@/shared/components/data-entry/password/password'; +import { PageCard } from '@/shared/components/ui/page-card'; import { env } from '@/shared/env'; import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { Alert } from '@/components/ui/alert'; +import { Alert } from '@/shared/components/ui/alert'; import { FetchError } from '@/api/fetcher'; -import { FormCaptcha } from '@/components/h-captcha'; -import { useResetMutationErrors } from '@/hooks/use-reset-mutation-errors'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; +import { FormCaptcha } from '@/shared/components/h-captcha'; +import { useResetMutationErrors } from '@/shared/hooks/use-reset-mutation-errors'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; function formattedSignUpErrorMessage(unknownError: unknown) { if (unknownError instanceof FetchError && unknownError.status === 409) { diff --git a/packages/apps/human-app/frontend/src/pages/playground/table-example/table-example.tsx b/packages/apps/human-app/frontend/src/pages/playground/table-example/table-example.tsx deleted file mode 100644 index 3aac411d1b..0000000000 --- a/packages/apps/human-app/frontend/src/pages/playground/table-example/table-example.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { TableQueryContextProvider } from '@/components/ui/table/table-query-context'; -import { Table } from '@/pages/playground/table-example/table'; - -export function TableExample() { - return ( - -
- - ); -} diff --git a/packages/apps/human-app/frontend/src/pages/worker/profile/register-address-on-chain-btn.tsx b/packages/apps/human-app/frontend/src/pages/worker/profile/register-address-on-chain-btn.tsx deleted file mode 100644 index 311550b86d..0000000000 --- a/packages/apps/human-app/frontend/src/pages/worker/profile/register-address-on-chain-btn.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import { t } from 'i18next'; -import { useEffect, useRef } from 'react'; -import { Button } from '@/components/ui/button'; -import { useGetOnChainRegisteredAddress } from '@/api/services/worker/get-on-chain-registered-address'; -import { useGetSignedAddress } from '@/api/services/worker/get-signed-address'; -import { useRegisterAddressOnChainMutation } from '@/api/services/worker/use-register-address-on-chain'; -import { DoneLabel } from '@/pages/worker/profile/done-label'; -import { useProtectedLayoutNotification } from '@/hooks/use-protected-layout-notifications'; -import { defaultErrorMessage } from '@/shared/helpers/default-error-message'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; - -export function RegisterAddressOnChainButton() { - const { setTopNotification, closeNotification } = - useProtectedLayoutNotification(); - const { isConnected: isWalletConnected, openModal } = useWalletConnect(); - const modalWasOpened = useRef(false); - - const { - data: onChainRegisteredAddress, - isError: inOnChainRegisteredAddressError, - error: onChainRegisteredAddressError, - isPending: isOnChainRegisteredAddressPending, - } = useGetOnChainRegisteredAddress(); - - const { - data: signedAddress, - isError: isSignedAddressError, - error: signedAddressError, - isPending: isSignedAddressPending, - } = useGetSignedAddress(); - - const { - mutate: registerAddressOnChainMutation, - isError: isRegisterAddressOnChainError, - error: registerAddressOnChainError, - isPending: isRegisterAddressOnChainPending, - } = useRegisterAddressOnChainMutation(); - - const isPending = - isOnChainRegisteredAddressPending || - isSignedAddressPending || - isRegisterAddressOnChainPending; - - const isError = - inOnChainRegisteredAddressError || - isSignedAddressError || - isRegisterAddressOnChainError; - - const error = - onChainRegisteredAddressError ?? - signedAddressError ?? - registerAddressOnChainError; - - const isAddressSetInKVStore = - onChainRegisteredAddress === signedAddress?.value; - - useEffect(() => { - if (isError) { - setTopNotification({ - type: 'warning', - content: defaultErrorMessage(error), - }); - return; - } - closeNotification(); - // eslint-disable-next-line react-hooks/exhaustive-deps -- ... - }, [error, isError]); - - useEffect(() => { - if (isWalletConnected && modalWasOpened.current && signedAddress) { - registerAddressOnChainMutation(signedAddress); - } - }, [isWalletConnected, registerAddressOnChainMutation, signedAddress]); - - if (isPending) { - return ( - - ); - } - - if (isError) { - return ( - - ); - } - - if (isAddressSetInKVStore) { - return {t('worker.profile.kycInfoOnChainAdded')}; - } - - return ( - - ); -} diff --git a/packages/apps/human-app/frontend/src/router/router.tsx b/packages/apps/human-app/frontend/src/router/router.tsx index ddf1de7241..098ca5944e 100644 --- a/packages/apps/human-app/frontend/src/router/router.tsx +++ b/packages/apps/human-app/frontend/src/router/router.tsx @@ -1,24 +1,24 @@ import { Routes, Route, Navigate } from 'react-router-dom'; -import { Layout as LayoutProtected } from '@/components/layout/protected/layout'; -import { Layout as LayoutUnprotected } from '@/components/layout/unprotected/layout'; +import { Layout as LayoutProtected } from '@/shared/components/layout/protected/layout'; +import { Layout as LayoutUnprotected } from '@/shared/components/layout/unprotected/layout'; import { protectedRoutes, walletConnectRoutes, unprotectedRoutes, web3ProtectedRoutes, } from '@/router/routes'; -import { RequireAuth } from '@/auth/require-auth'; -import { RequireWalletConnect } from '@/auth-web3/require-wallet-connect'; -import { RequireWeb3Auth } from '@/auth-web3/require-web3-auth'; -import { DrawerNavigation } from '@/components/layout/protected/drawer-navigation'; +import { RequireAuth } from '@/modules/auth/providers/require-auth'; +import { RequireWalletConnect } from '@/modules/auth-web3/providers/require-wallet-connect'; +import { RequireWeb3Auth } from '@/modules/auth-web3/providers/require-web3-auth'; +import { DrawerNavigation } from '@/shared/components/layout/protected/drawer-navigation'; import { workerDrawerTopMenuItems, workerDrawerBottomMenuItems, -} from '@/components/layout/drawer-menu-items/drawer-menu-items-worker'; -import { operatorDrawerBottomMenuItems } from '@/components/layout/drawer-menu-items/drawer-menu-items-operator'; -import { browserAuthProvider } from '@/shared/helpers/browser-auth-provider'; -import { UserStatsDrawer } from '@/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-drawer'; -import { useAuth } from '@/auth/use-auth'; +} from '@/shared/components/layout/drawer-menu-items/drawer-menu-items-worker'; +import { operatorDrawerBottomMenuItems } from '@/shared/components/layout/drawer-menu-items/drawer-menu-items-operator'; +import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider'; +import { UserStatsDrawer } from '@/modules/worker/components/hcaptcha-labeling/user-stats-drawer'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; import { routerPaths } from './router-paths'; export function Router() { diff --git a/packages/apps/human-app/frontend/src/router/routes.tsx b/packages/apps/human-app/frontend/src/router/routes.tsx index 5ab1696d43..7a181ac507 100644 --- a/packages/apps/human-app/frontend/src/router/routes.tsx +++ b/packages/apps/human-app/frontend/src/router/routes.tsx @@ -1,33 +1,37 @@ import type { RouteProps } from 'react-router-dom'; import { t } from 'i18next'; -import { HomePage } from '@/pages/homepage/home.page'; -import { Playground } from '@/pages/playground/playground.page'; -import { ProtectedPage } from '@/pages/protected.page'; -import { SignInWorkerPage } from '@/pages/worker/sign-in.page'; -import { SignUpWorkerPage } from '@/pages/worker/sign-up.page'; -import { OperatorProfilePage } from '@/pages/operator/profile/profile.page'; -import { WorkerProfilePage } from '@/pages/worker/profile/profile.page'; -import { ConnectWalletOperatorPage } from '@/pages/operator/sign-up/connect-wallet.page'; +import { ProtectedPage } from '@/modules/worker/views/protected/protected.page'; +import { SignInWorkerPage } from '@/modules/worker/views/sign/sign-in.page'; +import { SignUpWorkerPage } from '@/modules/worker/views/sign/sign-up.page'; import { routerPaths } from '@/router/router-paths'; -import { AddStakeOperatorPage } from '@/pages/operator/sign-up/add-stake/add-stake.page'; -import { SendResetLinkWorkerSuccessPage } from '@/pages/worker/send-reset-link/send-reset-link-success.page'; -import { ResetPasswordWorkerPage } from '@/pages/worker/reset-password/reset-password.page'; -import { SendResetLinkWorkerPage } from '@/pages/worker/send-reset-link/send-reset-link.page'; -import { ResetPasswordWorkerSuccessPage } from '@/pages/worker/reset-password/reset-password-success.page'; -import { EmailVerificationWorkerPage } from '@/pages/worker/email-verification/email-verification.page'; -import { VerifyEmailWorkerPage } from '@/pages/worker/email-verification/verify-email.page'; -import { AddKeysOperatorPage } from '@/pages/operator/sign-up/add-keys/add-keys.page'; -import { EditExistingKeysSuccessPage } from '@/pages/operator/sign-up/add-keys/edit-existing-keys-success.page'; -import type { PageHeaderProps } from '@/components/layout/protected/page-header'; -import { HandIcon, ProfileIcon, WorkHeaderIcon } from '@/components/ui/icons'; -import { JobsDiscoveryPage } from '@/pages/worker/jobs-discovery/jobs-discovery.page'; -import { JobsPage } from '@/pages/worker/jobs/jobs.page'; -import { EnableLabeler } from '@/pages/worker/hcaptcha-labeling/enable-labeler.page'; -import { HcaptchaLabelingPage } from '@/pages/worker/hcaptcha-labeling/hcaptcha-labeling/hcaptcha-labeling.page'; -import { UserStatsAccordion } from '@/pages/worker/hcaptcha-labeling/hcaptcha-labeling/user-stats-accordion'; -import { SetUpOperatorPage } from '@/pages/operator/sign-up/set-up-operator'; +import { SendResetLinkWorkerSuccessPage } from '@/modules/worker/views/send-reset-link/send-reset-link-success.page'; +import { ResetPasswordWorkerPage } from '@/modules/worker/views/reset-password/reset-password.page'; +import { SendResetLinkWorkerPage } from '@/modules/worker/views/send-reset-link/send-reset-link.page'; +import { ResetPasswordWorkerSuccessPage } from '@/modules/worker/views/reset-password/reset-password-success.page'; +import { JobsDiscoveryPage } from '@/modules/worker/views/jobs-discovery/jobs-discovery.page'; +import { JobsPage } from '@/modules/worker/views/jobs/jobs.page'; +import { EnableLabeler } from '@/modules/worker/views/hcaptcha-labeling/enable-labeler.page'; +import { HcaptchaLabelingPage } from '@/modules/worker/views/hcaptcha-labeling/hcaptcha-labeling.page'; +import { UserStatsAccordion } from '@/modules/worker/components/hcaptcha-labeling/user-stats-accordion'; import { env } from '@/shared/env'; -import { RegistrationPage } from '@/pages/worker/registration/registration.page'; +import { RegistrationPage } from '@/modules/worker/views/registration/registration.page'; +import { WorkerProfilePage } from '@/modules/worker/components/profile/profile.page'; +import { + HandIcon, + ProfileIcon, + WorkHeaderIcon, +} from '@/shared/components/ui/icons'; +import type { PageHeaderProps } from '@/shared/components/layout/protected/page-header'; +import { SetUpOperatorPage } from '@/modules/operator/views/sign-up/set-up-operator.page'; +import { EditExistingKeysSuccessPage } from '@/modules/operator/views/sign-up/edit-existing-keys-success.page'; +import { AddKeysOperatorPage } from '@/modules/operator/views/sign-up/add-keys.page'; +import { VerifyEmailWorkerPage } from '@/modules/worker/views/email-verification/verify-email.page'; +import { EmailVerificationWorkerPage } from '@/modules/worker/views/email-verification/email-verification.page'; +import { AddStakeOperatorPage } from '@/modules/operator/views/sign-up/add-stake.page'; +import { ConnectWalletOperatorPage } from '@/modules/operator/views/sign-up/connect-wallet.page'; +import { OperatorProfilePage } from '@/modules/operator/views/profile/profile.page'; +import { Playground } from '@/modules/playground/views/playground.page'; +import { HomePage } from '@/modules/homepage/views/home.page'; export const unprotectedRoutes: RouteProps[] = [ { diff --git a/packages/apps/human-app/frontend/src/components/data-entry/checkbox.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/checkbox.tsx similarity index 95% rename from packages/apps/human-app/frontend/src/components/data-entry/checkbox.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/checkbox.tsx index 5a3d006997..27029d4539 100644 --- a/packages/apps/human-app/frontend/src/components/data-entry/checkbox.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/checkbox.tsx @@ -4,7 +4,7 @@ import CheckboxMui from '@mui/material/Checkbox'; import FormControlLabel from '@mui/material/FormControlLabel'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface InputProps extends Omit { name: string; diff --git a/packages/apps/human-app/frontend/src/components/data-entry/form-example.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/form-example.tsx similarity index 90% rename from packages/apps/human-app/frontend/src/components/data-entry/form-example.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/form-example.tsx index 8004e9e53e..ec9e54099c 100644 --- a/packages/apps/human-app/frontend/src/components/data-entry/form-example.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/form-example.tsx @@ -5,13 +5,13 @@ import Grid from '@mui/material/Grid'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; -import { Input } from '@/components/data-entry/input'; -import { Select } from '@/components/data-entry/select'; -import { RadioButton } from '@/components/data-entry/radio-button'; -import { Checkbox } from '@/components/data-entry/checkbox'; -import { Slider } from '@/components/data-entry/slider'; -import { MultiSelect } from '@/components/data-entry/multi-select'; -import { Password } from '@/components/data-entry/password/password'; +import { Input } from '@/shared/components/data-entry/input'; +import { Select } from '@/shared/components/data-entry/select'; +import { RadioButton } from '@/shared/components/data-entry/radio-button'; +import { Checkbox } from '@/shared/components/data-entry/checkbox'; +import { Slider } from '@/shared/components/data-entry/slider'; +import { MultiSelect } from '@/shared/components/data-entry/multi-select'; +import { Password } from '@/shared/components/data-entry/password/password'; export interface Inputs { name: string; diff --git a/packages/apps/human-app/frontend/src/components/data-entry/input-masks/human-currency-input-mask.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/human-currency-input-mask.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/data-entry/input-masks/human-currency-input-mask.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/human-currency-input-mask.tsx diff --git a/packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/index.ts b/packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/index.ts new file mode 100644 index 0000000000..b019b8a346 --- /dev/null +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/index.ts @@ -0,0 +1,9 @@ +import { HumanCurrencyInputMask } from '@/shared/components/data-entry/input-masks/human-currency-input-mask'; +import { PercentsInputMask } from '@/shared/components/data-entry/input-masks/percents-input-mask'; + +export const InputMasks = { + HumanCurrencyInputMask, + PercentsInputMask, +}; + +export type InputMask = keyof typeof InputMasks; diff --git a/packages/apps/human-app/frontend/src/components/data-entry/input-masks/percents-input-mask.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/percents-input-mask.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/data-entry/input-masks/percents-input-mask.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/input-masks/percents-input-mask.tsx diff --git a/packages/apps/human-app/frontend/src/components/data-entry/input.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/input.tsx similarity index 90% rename from packages/apps/human-app/frontend/src/components/data-entry/input.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/input.tsx index cac35a5093..7b0ab77dcd 100644 --- a/packages/apps/human-app/frontend/src/components/data-entry/input.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/input.tsx @@ -2,9 +2,11 @@ import { Controller } from 'react-hook-form'; import type { TextFieldProps } from '@mui/material/TextField'; import TextField from '@mui/material/TextField'; import { Typography } from '@mui/material'; -import type { InputMask } from '@/components/data-entry/input-masks/input-masks'; -import { InputMasks } from '@/components/data-entry/input-masks/input-masks'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { + type InputMask, + InputMasks, +} from '@/shared/components/data-entry/input-masks'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export interface InputProps extends Omit { diff --git a/packages/apps/human-app/frontend/src/components/data-entry/multi-select.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/multi-select.tsx similarity index 98% rename from packages/apps/human-app/frontend/src/components/data-entry/multi-select.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/multi-select.tsx index 3c8008df7e..b490116839 100644 --- a/packages/apps/human-app/frontend/src/components/data-entry/multi-select.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/multi-select.tsx @@ -18,7 +18,7 @@ import { Typography, } from '@mui/material'; import CancelIcon from '@mui/icons-material/Cancel'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface MultiSelectProps extends Omit { options: { label: string; value: string }[]; diff --git a/packages/apps/human-app/frontend/src/components/data-entry/password/password.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/password/password.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/components/data-entry/password/password.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/password/password.tsx index f1c1dba938..6ac372bd38 100644 --- a/packages/apps/human-app/frontend/src/components/data-entry/password/password.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/password/password.tsx @@ -3,8 +3,8 @@ import VisibilityOff from '@mui/icons-material/VisibilityOff'; import React, { useState } from 'react'; import InputAdornment from '@mui/material/InputAdornment'; import IconButton from '@mui/material/IconButton'; -import { Input, type InputProps } from '@/components/data-entry/input'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { Input, type InputProps } from '@/shared/components/data-entry/input'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; type PasswordProps = InputProps & { type?: never }; diff --git a/packages/apps/human-app/frontend/src/components/data-entry/radio-button.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/radio-button.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/data-entry/radio-button.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/radio-button.tsx diff --git a/packages/apps/human-app/frontend/src/components/data-entry/select.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/select.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/components/data-entry/select.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/select.tsx index 923a42fcf0..25ac162d62 100644 --- a/packages/apps/human-app/frontend/src/components/data-entry/select.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/data-entry/select.tsx @@ -5,8 +5,8 @@ import MenuItem from '@mui/material/MenuItem'; import { Controller } from 'react-hook-form'; import InputLabel from '@mui/material/InputLabel'; import FormHelperText from '@mui/material/FormHelperText'; -import { Chip } from '@/components/ui/chip'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { Chip } from '@/shared/components/ui/chip'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export interface OptionsProps { id: number; diff --git a/packages/apps/human-app/frontend/src/components/data-entry/slider.tsx b/packages/apps/human-app/frontend/src/shared/components/data-entry/slider.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/data-entry/slider.tsx rename to packages/apps/human-app/frontend/src/shared/components/data-entry/slider.tsx diff --git a/packages/apps/human-app/frontend/src/components/h-captcha.tsx b/packages/apps/human-app/frontend/src/shared/components/h-captcha.tsx similarity index 96% rename from packages/apps/human-app/frontend/src/components/h-captcha.tsx rename to packages/apps/human-app/frontend/src/shared/components/h-captcha.tsx index a37b778211..86a0dd528b 100644 --- a/packages/apps/human-app/frontend/src/components/h-captcha.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/h-captcha.tsx @@ -4,7 +4,7 @@ import { useFormContext } from 'react-hook-form'; import { Typography } from '@mui/material'; import { env } from '@/shared/env'; import { FetchError } from '@/api/fetcher'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface CaptchaProps { setCaptchaToken: (token: string) => void; diff --git a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx similarity index 79% rename from packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx index d6fe4a7977..484e02073f 100644 --- a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/drawer-menu-items/drawer-menu-items-operator.tsx @@ -1,8 +1,8 @@ import { t } from 'i18next'; -import type { BottomMenuItem } from '@/components/layout/protected/drawer-navigation'; -import { HelpIcon, UserOutlinedIcon } from '@/components/ui/icons'; +import type { BottomMenuItem } from '@/shared/components/layout/protected/drawer-navigation'; +import { HelpIcon, UserOutlinedIcon } from '@/shared/components/ui/icons'; import { routerPaths } from '@/router/router-paths'; -import { DarkModeSwitch } from '@/components/ui/dark-mode-switch'; +import { DarkModeSwitch } from '@/shared/components/ui/dark-mode-switch'; export const operatorDrawerBottomMenuItems: BottomMenuItem[] = [ { diff --git a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx similarity index 81% rename from packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx index adbb4147be..d741d19e36 100644 --- a/packages/apps/human-app/frontend/src/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/drawer-menu-items/drawer-menu-items-worker.tsx @@ -2,11 +2,15 @@ import { t } from 'i18next'; import type { BottomMenuItem, TopMenuItem, -} from '@/components/layout/protected/drawer-navigation'; -import { HelpIcon, UserOutlinedIcon, WorkIcon } from '@/components/ui/icons'; +} from '@/shared/components/layout/protected/drawer-navigation'; +import { + HelpIcon, + UserOutlinedIcon, + WorkIcon, +} from '@/shared/components/ui/icons'; import { routerPaths } from '@/router/router-paths'; -import { DarkModeSwitch } from '@/components/ui/dark-mode-switch'; -import type { UserData } from '@/auth/auth-context'; +import { DarkModeSwitch } from '@/shared/components/ui/dark-mode-switch'; +import type { UserData } from '@/modules/auth/context/auth-context'; export const workerDrawerTopMenuItems = ( user: UserData | null diff --git a/packages/apps/human-app/frontend/src/components/layout/footer.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/footer.tsx similarity index 93% rename from packages/apps/human-app/frontend/src/components/layout/footer.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/footer.tsx index c60d9479ae..6face23c34 100644 --- a/packages/apps/human-app/frontend/src/components/layout/footer.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/footer.tsx @@ -1,10 +1,10 @@ import { Grid, Link, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; -import { useIsMobile } from '@/hooks/use-is-mobile'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; import { env } from '@/shared/env'; -import { Chat } from '@/pages/homepage/components/chat'; -import { breakpoints } from '@/styles/breakpoints'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { Chat } from '@/modules/homepage/components/chat'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface FooterProps { displayChatIcon?: boolean; diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/protected/drawer-navigation.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/protected/drawer-navigation.tsx index 6969f1ee86..42146e832d 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/drawer-navigation.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/protected/drawer-navigation.tsx @@ -9,14 +9,14 @@ import { Stack, Typography } from '@mui/material'; import { useLocation, useNavigate } from 'react-router-dom'; import { t } from 'i18next'; import type { Dispatch, SetStateAction } from 'react'; -import { HumanLogoNavbarIcon } from '@/components/ui/icons'; -import { Button } from '@/components/ui/button'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { NAVBAR_PADDING } from '@/components/layout/protected/navbar'; -import { colorPalette } from '@/styles/color-palette'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { onlyDarkModeColor } from '@/styles/dark-color-palette'; -import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; +import { HumanLogoNavbarIcon } from '@/shared/components/ui/icons'; +import { Button } from '@/shared/components/ui/button'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { NAVBAR_PADDING } from '@/shared/components/layout/protected/navbar'; +import { colorPalette } from '@/shared/styles/color-palette'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; +import { useHandleMainNavIconClick } from '@/shared/hooks/use-handle-main-nav-icon-click'; const drawerWidth = 240; diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/layout-notification-context.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/protected/layout-notification-context.tsx similarity index 80% rename from packages/apps/human-app/frontend/src/components/layout/protected/layout-notification-context.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/protected/layout-notification-context.tsx index 57c765b9d8..b4e0efe874 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/layout-notification-context.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/protected/layout-notification-context.tsx @@ -1,5 +1,5 @@ import { createContext } from 'react'; -import type { TopNotificationType } from '@/components/ui/top-notification'; +import type { TopNotificationType } from '@/shared/components/ui/top-notification'; export interface TopNotificationPayload { content: string; diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/layout.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/protected/layout.tsx similarity index 89% rename from packages/apps/human-app/frontend/src/components/layout/protected/layout.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/protected/layout.tsx index ee77f76201..2c8c435cc7 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/layout.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/protected/layout.tsx @@ -2,15 +2,15 @@ import { Grid, styled } from '@mui/material'; import type { Dispatch, SetStateAction } from 'react'; import { useEffect, useRef, useState } from 'react'; import { Outlet } from 'react-router-dom'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { useBackgroundColorStore } from '@/hooks/use-background-store'; -import type { PageHeaderProps } from '@/components/layout/protected/page-header'; -import { PageHeader } from '@/components/layout/protected/page-header'; -import { breakpoints } from '@/styles/breakpoints'; -import { TopNotification } from '@/components/ui/top-notification'; -import type { TopNotificationPayload } from '@/components/layout/protected/layout-notification-context'; -import { ProtectedLayoutContext } from '@/components/layout/protected/layout-notification-context'; -import { useIsHCaptchaLabelingPage } from '@/hooks/use-is-hcaptcha-labeling-page'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; +import type { PageHeaderProps } from '@/shared/components/layout/protected/page-header'; +import { PageHeader } from '@/shared/components/layout/protected/page-header'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { TopNotification } from '@/shared/components/ui/top-notification'; +import type { TopNotificationPayload } from '@/shared/components/layout/protected/layout-notification-context'; +import { ProtectedLayoutContext } from '@/shared/components/layout/protected/layout-notification-context'; +import { useIsHCaptchaLabelingPage } from '@/shared/hooks/use-is-hcaptcha-labeling-page'; import { Footer } from '../footer'; import { Navbar } from './navbar'; diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/protected/navbar.tsx similarity index 86% rename from packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/protected/navbar.tsx index 324f7f45de..2ca37f27f7 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/navbar.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/protected/navbar.tsx @@ -2,12 +2,12 @@ import { Grid, IconButton, Stack } from '@mui/material'; import MenuIcon from '@mui/icons-material/Menu'; import CloseIcon from '@mui/icons-material/Close'; import { t } from 'i18next'; -import { HumanLogoIcon } from '@/components/ui/icons'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { Button } from '@/components/ui/button'; -import { useIsHCaptchaLabelingPage } from '@/hooks/use-is-hcaptcha-labeling-page'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; +import { HumanLogoIcon } from '@/shared/components/ui/icons'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { Button } from '@/shared/components/ui/button'; +import { useIsHCaptchaLabelingPage } from '@/shared/hooks/use-is-hcaptcha-labeling-page'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useHandleMainNavIconClick } from '@/shared/hooks/use-handle-main-nav-icon-click'; export const NAVBAR_PADDING = '16px'; diff --git a/packages/apps/human-app/frontend/src/components/layout/protected/page-header.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/protected/page-header.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/components/layout/protected/page-header.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/protected/page-header.tsx index effb49e826..d2609a1248 100644 --- a/packages/apps/human-app/frontend/src/components/layout/protected/page-header.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/protected/page-header.tsx @@ -1,7 +1,7 @@ import { Grid, Typography } from '@mui/material'; import React from 'react'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { breakpoints } from '@/styles/breakpoints'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { breakpoints } from '@/shared/styles/breakpoints'; export interface PageHeaderProps { headerIcon: React.ReactNode; diff --git a/packages/apps/human-app/frontend/src/components/layout/unprotected/layout.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/unprotected/layout.tsx similarity index 83% rename from packages/apps/human-app/frontend/src/components/layout/unprotected/layout.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/unprotected/layout.tsx index a4fa175699..926efddfea 100644 --- a/packages/apps/human-app/frontend/src/components/layout/unprotected/layout.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/unprotected/layout.tsx @@ -1,9 +1,9 @@ import { Container, Grid } from '@mui/material'; import { Outlet } from 'react-router-dom'; -import { useBackgroundColorStore } from '@/hooks/use-background-store'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { breakpoints } from '@/styles/breakpoints'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; import { Footer } from '../footer'; import { Navbar } from './navbar'; diff --git a/packages/apps/human-app/frontend/src/components/layout/unprotected/navbar.tsx b/packages/apps/human-app/frontend/src/shared/components/layout/unprotected/navbar.tsx similarity index 89% rename from packages/apps/human-app/frontend/src/components/layout/unprotected/navbar.tsx rename to packages/apps/human-app/frontend/src/shared/components/layout/unprotected/navbar.tsx index dacce3f749..9709223f32 100644 --- a/packages/apps/human-app/frontend/src/components/layout/unprotected/navbar.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/layout/unprotected/navbar.tsx @@ -3,14 +3,17 @@ import { Box, Drawer, Grid, IconButton } from '@mui/material'; import { useTranslation } from 'react-i18next'; import MenuIcon from '@mui/icons-material/Menu'; import { Link } from 'react-router-dom'; -import { HumanLogoIcon, HumanLogoNavbarIcon } from '@/components/ui/icons'; -import { useIsMobile } from '@/hooks/use-is-mobile'; -import { Button } from '@/components/ui/button'; -import { breakpoints } from '@/styles/breakpoints'; +import { + HumanLogoIcon, + HumanLogoNavbarIcon, +} from '@/shared/components/ui/icons'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; +import { Button } from '@/shared/components/ui/button'; +import { breakpoints } from '@/shared/styles/breakpoints'; import { env } from '@/shared/env'; -import { useHomePageState } from '@/contexts/homepage-state'; -import { DarkModeSwitch } from '@/components/ui/dark-mode-switch'; -import { useHandleMainNavIconClick } from '@/hooks/use-handle-main-nav-icon-click'; +import { useHomePageState } from '@/shared/contexts/homepage-state'; +import { DarkModeSwitch } from '@/shared/components/ui/dark-mode-switch'; +import { useHandleMainNavIconClick } from '@/shared/hooks/use-handle-main-nav-icon-click'; interface NavbarProps { withNavigation: boolean; diff --git a/packages/apps/human-app/frontend/src/components/ui/alert.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/alert.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/components/ui/alert.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/alert.tsx index d44764b714..7fdb16b2da 100644 --- a/packages/apps/human-app/frontend/src/components/ui/alert.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/alert.tsx @@ -4,8 +4,8 @@ import ErrorIcon from '@mui/icons-material/Error'; import MuiAlert from '@mui/material/Alert'; import type { AlertProps as MuiAlertProps } from '@mui/material/Alert'; import { Typography } from '@mui/material'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { darkColorPalette } from '@/styles/dark-color-palette'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { darkColorPalette } from '@/shared/styles/dark-color-palette'; const getIcon = (severity: MuiAlertProps['severity'], isDarkMode: boolean) => { switch (severity) { diff --git a/packages/apps/human-app/frontend/src/components/ui/button.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/button.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/button.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/button.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/chip.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/chip.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/components/ui/chip.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/chip.tsx index 1df6339fcb..83ae568c80 100644 --- a/packages/apps/human-app/frontend/src/components/ui/chip.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/chip.tsx @@ -1,5 +1,5 @@ import { Box, Typography } from '@mui/material'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface ChipProps { label: string | React.ReactElement; diff --git a/packages/apps/human-app/frontend/src/components/ui/chips.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/chips.tsx similarity index 86% rename from packages/apps/human-app/frontend/src/components/ui/chips.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/chips.tsx index 388a4d9018..df714a79cb 100644 --- a/packages/apps/human-app/frontend/src/components/ui/chips.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/chips.tsx @@ -1,5 +1,5 @@ import { Grid } from '@mui/material'; -import { Chip } from '@/components/ui/chip'; +import { Chip } from '@/shared/components/ui/chip'; interface ChipsProps { data: string[]; diff --git a/packages/apps/human-app/frontend/src/components/ui/connect-wallet-btn.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/connect-wallet-btn.tsx similarity index 74% rename from packages/apps/human-app/frontend/src/components/ui/connect-wallet-btn.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/connect-wallet-btn.tsx index f224aec805..3b340baadd 100644 --- a/packages/apps/human-app/frontend/src/components/ui/connect-wallet-btn.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/connect-wallet-btn.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; -import type { CustomButtonProps } from '@/components/ui/button'; -import { Button } from '@/components/ui/button'; -import { useWalletConnect } from '@/hooks/use-wallet-connect'; +import type { CustomButtonProps } from '@/shared/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; +import { useWalletConnect } from '@/shared/hooks/use-wallet-connect'; export function ConnectWalletBtn(props: CustomButtonProps) { const { openModal, isConnected } = useWalletConnect(); diff --git a/packages/apps/human-app/frontend/src/components/ui/counter.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/counter.tsx similarity index 91% rename from packages/apps/human-app/frontend/src/components/ui/counter.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/counter.tsx index 3447180568..6698ee4568 100644 --- a/packages/apps/human-app/frontend/src/components/ui/counter.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/counter.tsx @@ -1,4 +1,4 @@ -import { useCountDown } from '@/hooks/use-count-down'; +import { useCountDown } from '@/shared/hooks/use-count-down'; import { padZero } from '@/shared/helpers/counter-helpers'; export function Counter({ diff --git a/packages/apps/human-app/frontend/src/components/ui/dark-mode-switch.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/dark-mode-switch.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/components/ui/dark-mode-switch.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/dark-mode-switch.tsx index 25144f267d..cda8a7cab6 100644 --- a/packages/apps/human-app/frontend/src/components/ui/dark-mode-switch.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/dark-mode-switch.tsx @@ -1,6 +1,6 @@ import { Grid, Switch } from '@mui/material'; -import { MoonIcon, SunIcon } from '@/components/ui/icons'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { MoonIcon, SunIcon } from '@/shared/components/ui/icons'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function DarkModeSwitch() { const { switchMode, isDarkMode } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/components/ui/empty-placeholder.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/empty-placeholder.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/components/ui/empty-placeholder.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/empty-placeholder.tsx index 45e0d2e09c..4cb8e19a0e 100644 --- a/packages/apps/human-app/frontend/src/components/ui/empty-placeholder.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/empty-placeholder.tsx @@ -1,6 +1,6 @@ import Typography from '@mui/material/Typography'; import { t } from 'i18next'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function EmptyPlaceholder() { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/components/ui/icons.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/icons.tsx similarity index 98% rename from packages/apps/human-app/frontend/src/components/ui/icons.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/icons.tsx index 966f2f1a68..14d306e695 100644 --- a/packages/apps/human-app/frontend/src/components/ui/icons.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/icons.tsx @@ -36,7 +36,7 @@ import SunIconDark from '@/assets/icons-dark-mode/sun.svg'; import SunIconLight from '@/assets/icons/sun.svg'; import MoonIconDark from '@/assets/icons-dark-mode/moon.svg'; import MoonIconLight from '@/assets/icons/moon.svg'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; import WorkHeaderDark from '@/assets/icons-dark-mode/work-header.svg'; import WorkHeaderLight from '@/assets/icons/work-header.svg'; diff --git a/packages/apps/human-app/frontend/src/components/ui/list-item.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/list-item.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/list-item.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/list-item.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/loader.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/loader.tsx similarity index 87% rename from packages/apps/human-app/frontend/src/components/ui/loader.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/loader.tsx index fed34e9fbb..2f83b76aa2 100644 --- a/packages/apps/human-app/frontend/src/components/ui/loader.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/loader.tsx @@ -1,6 +1,6 @@ import type { CircularProgressProps } from '@mui/material/CircularProgress'; import CircularProgress from '@mui/material/CircularProgress'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function Loader({ ...props }: CircularProgressProps) { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/components/ui/mail-to.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/mail-to.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/mail-to.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/mail-to.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/modal/display-modal.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/modal/display-modal.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/modal/display-modal.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/modal/display-modal.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/modal/modal-content.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-content.tsx similarity index 68% rename from packages/apps/human-app/frontend/src/components/ui/modal/modal-content.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-content.tsx index 6020589fa7..d948e06e76 100644 --- a/packages/apps/human-app/frontend/src/components/ui/modal/modal-content.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-content.tsx @@ -1,7 +1,7 @@ import type { ComponentType } from 'react'; -import { ModalExample } from '@/pages/playground/modal-example/modal-example'; -import { WalletConnectModal } from '@/auth-web3/wallet-connect-modal'; -import { ExpirationModal } from '@/auth/expiration-modal'; +import { ModalExample } from '@/modules/playground/components/modal-example/modal-example'; +import { WalletConnectModal } from '@/modules/auth-web3/components/wallet-connect-modal'; +import { ExpirationModal } from '@/modules/auth/components/expiration-modal'; import type { ModalStateKeys, ModalStateUnion } from './modal.store'; import { MODAL_STATE } from './modal.store'; diff --git a/packages/apps/human-app/frontend/src/components/ui/modal/modal-header.test.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-header.test.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/components/ui/modal/modal-header.test.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-header.test.tsx index 521cbbdaea..af3ca805b7 100644 --- a/packages/apps/human-app/frontend/src/components/ui/modal/modal-header.test.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-header.test.tsx @@ -1,7 +1,7 @@ import { describe, expect, vi } from 'vitest'; import { fireEvent } from '@testing-library/react'; import { renderWithWrapper } from '@/shared/test-utils/render-with-wrapper'; -import { ModalHeader } from '@/components/ui/modal/modal-header'; +import { ModalHeader } from '@/shared/components/ui/modal/modal-header'; const mockedCloseProcessModal = vi.fn(); diff --git a/packages/apps/human-app/frontend/src/components/ui/modal/modal-header.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-header.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/modal/modal-header.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/modal/modal-header.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/modal/modal.store.ts b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal.store.ts similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/modal/modal.store.ts rename to packages/apps/human-app/frontend/src/shared/components/ui/modal/modal.store.ts diff --git a/packages/apps/human-app/frontend/src/components/ui/modal/modal.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/modal/modal.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/modal/modal.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/modal/modal.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/no-records.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/no-records.tsx similarity index 84% rename from packages/apps/human-app/frontend/src/components/ui/no-records.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/no-records.tsx index 24527d7430..fb49dc542e 100644 --- a/packages/apps/human-app/frontend/src/components/ui/no-records.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/no-records.tsx @@ -1,5 +1,5 @@ import { Grid } from '@mui/material'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function NoRecords() { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/components/ui/optional-text.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/optional-text.tsx similarity index 78% rename from packages/apps/human-app/frontend/src/components/ui/optional-text.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/optional-text.tsx index dc96ed7045..a129a8b8e2 100644 --- a/packages/apps/human-app/frontend/src/components/ui/optional-text.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/optional-text.tsx @@ -1,5 +1,5 @@ import Grid from '@mui/material/Grid'; -import { EmptyPlaceholder } from '@/components/ui/empty-placeholder'; +import { EmptyPlaceholder } from '@/shared/components/ui/empty-placeholder'; export function OptionalText({ text }: { text?: string }) { if (!text) { diff --git a/packages/apps/human-app/frontend/src/shared/components/ui/page-card-error.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/page-card-error.tsx new file mode 100644 index 0000000000..a8a9bdf030 --- /dev/null +++ b/packages/apps/human-app/frontend/src/shared/components/ui/page-card-error.tsx @@ -0,0 +1,98 @@ +import type { SxProps, Theme } from '@mui/material'; +import { Grid } from '@mui/material'; +import { useNavigate } from 'react-router-dom'; +import { useEffect } from 'react'; +import { t } from 'i18next'; +import { Button } from '@/shared/components/ui/button'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { routerPaths } from '@/router/router-paths'; +import { colorPalette as constColorPalette } from '@/shared/styles/color-palette'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; +import { Alert } from '@/shared/components/ui/alert'; +import { darkColorPalette as constDarkColorPalette } from '@/shared/styles/dark-color-palette'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; + +const commonStyles: SxProps = { + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + borderRadius: '20px', + minHeight: '70vh', + maxWidth: '1600px', + width: '100%', + background: constColorPalette.white, +}; + +const commonStylesDark: SxProps = { + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + borderRadius: '20px', + minHeight: '70vh', + maxWidth: '1600px', + width: '100%', + background: constDarkColorPalette.paper.main, + [breakpoints.mobile]: { + background: constDarkColorPalette.backgroundColor, + }, +}; + +export function PageCardError({ + errorMessage, + children, + withLayoutBackground, + cardMaxWidth = '100%', +}: + | { + errorMessage: string; + children?: never; + cardMaxWidth?: string; + withLayoutBackground?: boolean; + } + | { + errorMessage?: never; + children: React.ReactElement; + cardMaxWidth?: string; + withLayoutBackground?: boolean; + }) { + const { isDarkMode } = useColorMode(); + const navigate = useNavigate(); + const { setGrayBackground } = useBackgroundColorStore(); + const commonStyleForTheme = isDarkMode ? commonStylesDark : commonStyles; + + const sx = cardMaxWidth + ? { ...commonStyleForTheme, maxWidth: cardMaxWidth } + : commonStyleForTheme; + + useEffect(() => { + if (withLayoutBackground) { + setGrayBackground(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps -- call this effect once + }, []); + + return ( + + {children ? ( + children + ) : ( + <> + + {errorMessage} + + + + + )} + + ); +} diff --git a/packages/apps/human-app/frontend/src/shared/components/ui/page-card-loader.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/page-card-loader.tsx new file mode 100644 index 0000000000..9ff9424a91 --- /dev/null +++ b/packages/apps/human-app/frontend/src/shared/components/ui/page-card-loader.tsx @@ -0,0 +1,131 @@ +import type { SxProps, Theme } from '@mui/material'; +import { Grid } from '@mui/material'; +import { useNavigate } from 'react-router-dom'; +import { useEffect } from 'react'; +import { t } from 'i18next'; +import { Button } from '@/shared/components/ui/button'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { routerPaths } from '@/router/router-paths'; +import { colorPalette as constColorPalette } from '@/shared/styles/color-palette'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; +import { Loader } from '@/shared/components/ui/loader'; +import { Alert } from '@/shared/components/ui/alert'; +import { darkColorPalette as constDarkColorPalette } from '@/shared/styles/dark-color-palette'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; + +const commonStyles: SxProps = { + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + borderRadius: '20px', + minHeight: '70vh', + maxWidth: '1600px', + width: '100%', + background: constColorPalette.white, +}; + +const commonStylesDark: SxProps = { + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + borderRadius: '20px', + minHeight: '70vh', + maxWidth: '1600px', + width: '100%', + background: constDarkColorPalette.paper.main, + [breakpoints.mobile]: { + background: constDarkColorPalette.backgroundColor, + }, +}; + +export function PageCardLoader({ + withLayoutBackground = true, + cardMaxWidth = '100%', +}: { + cardMaxWidth?: string; + withLayoutBackground?: boolean; +}) { + const { isDarkMode } = useColorMode(); + const { setGrayBackground } = useBackgroundColorStore(); + + useEffect(() => { + if (withLayoutBackground) { + setGrayBackground(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps -- call this effect once + }, []); + + const commonStyleForTheme = isDarkMode ? commonStylesDark : commonStyles; + + const sx = cardMaxWidth + ? { + ...commonStyleForTheme, + maxWidth: cardMaxWidth, + } + : commonStyleForTheme; + + return ( + + + + ); +} +export function PageCardError({ + errorMessage, + children, + withLayoutBackground, + cardMaxWidth = '100%', +}: + | { + errorMessage: string; + children?: never; + cardMaxWidth?: string; + withLayoutBackground?: boolean; + } + | { + errorMessage?: never; + children: React.ReactElement; + cardMaxWidth?: string; + withLayoutBackground?: boolean; + }) { + const { isDarkMode } = useColorMode(); + const navigate = useNavigate(); + const { setGrayBackground } = useBackgroundColorStore(); + const commonStyleForTheme = isDarkMode ? commonStylesDark : commonStyles; + + const sx = cardMaxWidth + ? { ...commonStyleForTheme, maxWidth: cardMaxWidth } + : commonStyleForTheme; + + useEffect(() => { + if (withLayoutBackground) { + setGrayBackground(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps -- call this effect once + }, []); + + return ( + + {children ? ( + children + ) : ( + <> + + {errorMessage} + + + + + )} + + ); +} diff --git a/packages/apps/human-app/frontend/src/components/ui/page-card.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/page-card.tsx similarity index 73% rename from packages/apps/human-app/frontend/src/components/ui/page-card.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/page-card.tsx index e8cb24b2c3..36b53f435e 100644 --- a/packages/apps/human-app/frontend/src/components/ui/page-card.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/page-card.tsx @@ -4,19 +4,17 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import { useNavigate } from 'react-router-dom'; import { useEffect } from 'react'; import { t } from 'i18next'; -import { Button } from '@/components/ui/button'; -import { breakpoints } from '@/styles/breakpoints'; +import { Button } from '@/shared/components/ui/button'; +import { breakpoints } from '@/shared/styles/breakpoints'; import { routerPaths } from '@/router/router-paths'; -import { colorPalette as constColorPalette } from '@/styles/color-palette'; -import { useBackgroundColorStore } from '@/hooks/use-background-store'; -import { Loader } from '@/components/ui/loader'; -import { Alert } from '@/components/ui/alert'; +import { colorPalette as constColorPalette } from '@/shared/styles/color-palette'; +import { useBackgroundColorStore } from '@/shared/hooks/use-background-store'; import { darkColorPalette as constDarkColorPalette, onlyDarkModeColor, -} from '@/styles/dark-color-palette'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { useIsMobile } from '@/hooks/use-is-mobile'; +} from '@/shared/styles/dark-color-palette'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { useIsMobile } from '@/shared/hooks/use-is-mobile'; const IconWrapper = styled('div')(() => ({ width: '40px', @@ -280,95 +278,3 @@ export function PageCard({ ); } - -export function PageCardLoader({ - withLayoutBackground = true, - cardMaxWidth = '100%', -}: { - cardMaxWidth?: string; - withLayoutBackground?: boolean; -}) { - const { isDarkMode } = useColorMode(); - const { setGrayBackground } = useBackgroundColorStore(); - - useEffect(() => { - if (withLayoutBackground) { - setGrayBackground(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- call this effect once - }, []); - - const commonStyleForTheme = isDarkMode ? commonStylesDark : commonStyles; - - const sx = cardMaxWidth - ? { - ...commonStyleForTheme, - maxWidth: cardMaxWidth, - } - : commonStyleForTheme; - - return ( - - - - ); -} -export function PageCardError({ - errorMessage, - children, - withLayoutBackground, - cardMaxWidth = '100%', -}: - | { - errorMessage: string; - children?: never; - cardMaxWidth?: string; - withLayoutBackground?: boolean; - } - | { - errorMessage?: never; - children: React.ReactElement; - cardMaxWidth?: string; - withLayoutBackground?: boolean; - }) { - const { isDarkMode } = useColorMode(); - const navigate = useNavigate(); - const { setGrayBackground } = useBackgroundColorStore(); - const commonStyleForTheme = isDarkMode ? commonStylesDark : commonStyles; - - const sx = cardMaxWidth - ? { ...commonStyleForTheme, maxWidth: cardMaxWidth } - : commonStyleForTheme; - - useEffect(() => { - if (withLayoutBackground) { - setGrayBackground(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- call this effect once - }, []); - - return ( - - {children ? ( - children - ) : ( - <> - - {errorMessage} - - - - - )} - - ); -} diff --git a/packages/apps/human-app/frontend/src/components/ui/profile-list-item.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/profile-list-item.tsx similarity index 90% rename from packages/apps/human-app/frontend/src/components/ui/profile-list-item.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/profile-list-item.tsx index 5469ab5ef4..5cbf39b480 100644 --- a/packages/apps/human-app/frontend/src/components/ui/profile-list-item.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/profile-list-item.tsx @@ -1,9 +1,9 @@ import { ListItem, ListItemText, Stack, Typography } from '@mui/material'; import { useTranslation } from 'react-i18next'; -import { Button } from '@/components/ui/button'; -import { CheckmarkIcon, LockerIcon } from '@/components/ui/icons'; -import { Chips } from '@/components/ui/chips'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { Button } from '@/shared/components/ui/button'; +import { CheckmarkIcon, LockerIcon } from '@/shared/components/ui/icons'; +import { Chips } from '@/shared/components/ui/chips'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface ProfileListItemProps { header: string; diff --git a/packages/apps/human-app/frontend/src/components/ui/success-label.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/success-label.tsx similarity index 87% rename from packages/apps/human-app/frontend/src/components/ui/success-label.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/success-label.tsx index a79cf3d5b6..8ef8a4acef 100644 --- a/packages/apps/human-app/frontend/src/components/ui/success-label.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/success-label.tsx @@ -1,6 +1,6 @@ import Grid from '@mui/material/Grid'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function SuccessLabel({ children }: { children: string }) { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/components/ui/table-button.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/table-button.tsx similarity index 77% rename from packages/apps/human-app/frontend/src/components/ui/table-button.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/table-button.tsx index 631a5b7177..0901fc0099 100644 --- a/packages/apps/human-app/frontend/src/components/ui/table-button.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/table-button.tsx @@ -1,5 +1,5 @@ -import type { CustomButtonProps } from '@/components/ui/button'; -import { Button } from '@/components/ui/button'; +import type { CustomButtonProps } from '@/shared/components/ui/button'; +import { Button } from '@/shared/components/ui/button'; export function TableButton(props: CustomButtonProps) { return ( diff --git a/packages/apps/human-app/frontend/src/components/ui/table/table-header-cell.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-cell.tsx similarity index 90% rename from packages/apps/human-app/frontend/src/components/ui/table/table-header-cell.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-cell.tsx index 87f48a1de6..e5f001079b 100644 --- a/packages/apps/human-app/frontend/src/components/ui/table/table-header-cell.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-cell.tsx @@ -1,8 +1,8 @@ import React, { forwardRef, useState } from 'react'; import Popover from '@mui/material/Popover'; import type { TableCellBaseProps } from '@mui/material/TableCell/TableCell'; -import type { IconType } from '@/pages/worker/jobs/components/text-header-with-icon'; -import { TextHeaderWithIcon } from '@/pages/worker/jobs/components/text-header-with-icon'; +import type { IconType } from '@/modules/worker/components/jobs/text-header-with-icon'; +import { TextHeaderWithIcon } from '@/modules/worker/components/jobs/text-header-with-icon'; type CommonProps = TableCellBaseProps & { popoverContent: React.ReactElement; diff --git a/packages/apps/human-app/frontend/src/components/ui/table/table-header-menu.tsx/filtering.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-menu.tsx/filtering.tsx similarity index 97% rename from packages/apps/human-app/frontend/src/components/ui/table/table-header-menu.tsx/filtering.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-menu.tsx/filtering.tsx index c936ff2d55..9c963c14f2 100644 --- a/packages/apps/human-app/frontend/src/components/ui/table/table-header-menu.tsx/filtering.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-menu.tsx/filtering.tsx @@ -4,7 +4,7 @@ import List from '@mui/material/List'; import Divider from '@mui/material/Divider'; import ListItem from '@mui/material/ListItem'; import { t } from 'i18next'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface FilteringOption { name: string; diff --git a/packages/apps/human-app/frontend/src/components/ui/table/table-header-menu.tsx/sorting.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-menu.tsx/sorting.tsx similarity index 95% rename from packages/apps/human-app/frontend/src/components/ui/table/table-header-menu.tsx/sorting.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-menu.tsx/sorting.tsx index cf5e84b09b..eda812848a 100644 --- a/packages/apps/human-app/frontend/src/components/ui/table/table-header-menu.tsx/sorting.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-header-menu.tsx/sorting.tsx @@ -2,7 +2,7 @@ import { Divider, Typography } from '@mui/material'; import List from '@mui/material/List'; import ListItemText from '@mui/material/ListItemText'; import { t } from 'i18next'; -import { useColorMode } from '@/hooks/use-color-mode'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; interface SortingMenuProps { sortingOptions: { label: string; sortCallback: () => void }[]; diff --git a/packages/apps/human-app/frontend/src/components/ui/table/table-query-context.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-query-context.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/components/ui/table/table-query-context.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/table/table-query-context.tsx diff --git a/packages/apps/human-app/frontend/src/components/ui/table/table-query-hook.ts b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-query-hook.ts similarity index 54% rename from packages/apps/human-app/frontend/src/components/ui/table/table-query-hook.ts rename to packages/apps/human-app/frontend/src/shared/components/ui/table/table-query-hook.ts index 36352ded4c..f4cebb7d5d 100644 --- a/packages/apps/human-app/frontend/src/components/ui/table/table-query-hook.ts +++ b/packages/apps/human-app/frontend/src/shared/components/ui/table/table-query-hook.ts @@ -1,4 +1,4 @@ import { useContext } from 'react'; -import { TableQueryContext } from '@/components/ui/table/table-query-context'; +import { TableQueryContext } from '@/shared/components/ui/table/table-query-context'; export const useTableQuery = () => useContext(TableQueryContext); diff --git a/packages/apps/human-app/frontend/src/components/ui/top-notification.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/top-notification.tsx similarity index 87% rename from packages/apps/human-app/frontend/src/components/ui/top-notification.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/top-notification.tsx index ecc705b956..539099ca22 100644 --- a/packages/apps/human-app/frontend/src/components/ui/top-notification.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/top-notification.tsx @@ -3,9 +3,9 @@ import MuiAlert from '@mui/material/Alert'; import type { AlertProps as MuiAlertProps } from '@mui/material/Alert'; import { Typography } from '@mui/material'; import ErrorIcon from '@mui/icons-material/Error'; -import { breakpoints } from '@/styles/breakpoints'; -import { useColorMode } from '@/hooks/use-color-mode'; -import { colorPalette as lightColorPalette } from '@/styles/color-palette'; +import { breakpoints } from '@/shared/styles/breakpoints'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; +import { colorPalette as lightColorPalette } from '@/shared/styles/color-palette'; export type TopNotificationType = 'success' | 'warning'; diff --git a/packages/apps/human-app/frontend/src/components/ui/ui-example.tsx b/packages/apps/human-app/frontend/src/shared/components/ui/ui-example.tsx similarity index 92% rename from packages/apps/human-app/frontend/src/components/ui/ui-example.tsx rename to packages/apps/human-app/frontend/src/shared/components/ui/ui-example.tsx index 3eeef93988..c2f9639b1f 100644 --- a/packages/apps/human-app/frontend/src/components/ui/ui-example.tsx +++ b/packages/apps/human-app/frontend/src/shared/components/ui/ui-example.tsx @@ -1,9 +1,9 @@ import Grid from '@mui/material/Grid'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { Button } from '@/components/ui/button'; -import { Loader } from '@/components/ui/loader'; -import { useModalStore } from '@/components/ui/modal/modal.store'; +import { Button } from '@/shared/components/ui/button'; +import { Loader } from '@/shared/components/ui/loader'; +import { useModalStore } from '@/shared/components/ui/modal/modal.store'; import { HomepageLogoIcon, HomepageUserIcon, @@ -21,11 +21,11 @@ import { LockerIcon, FiltersButtonIcon, SortArrow, -} from '@/components/ui/icons'; -import { TableExample } from '@/pages/playground/table-example/table-example'; -import { Alert } from '@/components/ui/alert'; -import { ConnectWalletBtn } from '@/components/ui/connect-wallet-btn'; -import { useColorMode } from '@/hooks/use-color-mode'; +} from '@/shared/components/ui/icons'; +import { TableExample } from '@/modules/playground/components/table-example/table-example'; +import { Alert } from '@/shared/components/ui/alert'; +import { ConnectWalletBtn } from '@/shared/components/ui/connect-wallet-btn'; +import { useColorMode } from '@/shared/hooks/use-color-mode'; export function UiExample() { const { colorPalette } = useColorMode(); diff --git a/packages/apps/human-app/frontend/src/shared/consts.ts b/packages/apps/human-app/frontend/src/shared/consts.ts index a63036a64b..26303f2072 100644 --- a/packages/apps/human-app/frontend/src/shared/consts.ts +++ b/packages/apps/human-app/frontend/src/shared/consts.ts @@ -1,3 +1,3 @@ -import { JobType } from '@/smart-contracts/EthKVStore/config'; +import { JobType } from '@/modules/smart-contracts/EthKVStore/config'; export const JOB_TYPES = Object.values(JobType); diff --git a/packages/apps/human-app/frontend/src/contexts/background-color-store.tsx b/packages/apps/human-app/frontend/src/shared/contexts/background-color-store.tsx similarity index 96% rename from packages/apps/human-app/frontend/src/contexts/background-color-store.tsx rename to packages/apps/human-app/frontend/src/shared/contexts/background-color-store.tsx index 39b4134db2..b8b23d06c0 100644 --- a/packages/apps/human-app/frontend/src/contexts/background-color-store.tsx +++ b/packages/apps/human-app/frontend/src/shared/contexts/background-color-store.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { createContext, useCallback, useEffect, useState } from 'react'; -import type { ColorPalette } from '@/styles/color-palette'; +import type { ColorPalette } from '@/shared/styles/color-palette'; export interface BackgroundContextProps { backgroundColor: string; diff --git a/packages/apps/human-app/frontend/src/shared/helpers/browser-auth-provider.ts b/packages/apps/human-app/frontend/src/shared/contexts/browser-auth-provider.ts similarity index 96% rename from packages/apps/human-app/frontend/src/shared/helpers/browser-auth-provider.ts rename to packages/apps/human-app/frontend/src/shared/contexts/browser-auth-provider.ts index 14cd0a5d08..2e559e097c 100644 --- a/packages/apps/human-app/frontend/src/shared/helpers/browser-auth-provider.ts +++ b/packages/apps/human-app/frontend/src/shared/contexts/browser-auth-provider.ts @@ -1,5 +1,5 @@ /* eslint-disable camelcase -- ...*/ -import { type SignInSuccessResponse } from '@/api/services/worker/sign-in/types'; +import { type SignInSuccessResponse } from '@/modules/worker/services/sign-in/types'; import type { BrowserAuthProvider } from '@/shared/types/browser-auth-provider'; const accessTokenKey = btoa('access_token'); diff --git a/packages/apps/human-app/frontend/src/contexts/color-mode-context.tsx b/packages/apps/human-app/frontend/src/shared/contexts/color-mode-context.tsx similarity index 88% rename from packages/apps/human-app/frontend/src/contexts/color-mode-context.tsx rename to packages/apps/human-app/frontend/src/shared/contexts/color-mode-context.tsx index 8143aec941..6856a418d8 100644 --- a/packages/apps/human-app/frontend/src/contexts/color-mode-context.tsx +++ b/packages/apps/human-app/frontend/src/shared/contexts/color-mode-context.tsx @@ -1,11 +1,11 @@ import type { ReactNode } from 'react'; import { createContext, useEffect, useMemo, useState } from 'react'; import { ThemeProvider, createTheme } from '@mui/material'; -import { theme } from '@/styles/theme'; -import { colorPalette as defaultColorPalette } from '@/styles/color-palette'; -import { darkTheme } from '@/styles/dark-theme'; -import { darkColorPalette } from '@/styles/dark-color-palette'; -import { BackgroundProvider } from '@/contexts/background-color-store'; +import { theme } from '@/shared/styles/theme'; +import { colorPalette as defaultColorPalette } from '@/shared/styles/color-palette'; +import { darkTheme } from '@/shared/styles/dark-theme'; +import { darkColorPalette } from '@/shared/styles/dark-color-palette'; +import { BackgroundProvider } from '@/shared/contexts/background-color-store'; export interface ColorModeContextProps { isDarkMode: boolean; diff --git a/packages/apps/human-app/frontend/src/contexts/homepage-state.tsx b/packages/apps/human-app/frontend/src/shared/contexts/homepage-state.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/contexts/homepage-state.tsx rename to packages/apps/human-app/frontend/src/shared/contexts/homepage-state.tsx diff --git a/packages/apps/human-app/frontend/src/contexts/jwt-expiration-check.tsx b/packages/apps/human-app/frontend/src/shared/contexts/jwt-expiration-check.tsx similarity index 86% rename from packages/apps/human-app/frontend/src/contexts/jwt-expiration-check.tsx rename to packages/apps/human-app/frontend/src/shared/contexts/jwt-expiration-check.tsx index ecfd7d1332..3fc5aef19f 100644 --- a/packages/apps/human-app/frontend/src/contexts/jwt-expiration-check.tsx +++ b/packages/apps/human-app/frontend/src/shared/contexts/jwt-expiration-check.tsx @@ -1,9 +1,9 @@ import type React from 'react'; import { useEffect, useRef } from 'react'; import { useLocation } from 'react-router-dom'; -import { useAccessTokenRefresh } from '@/api/services/common/use-access-token-refresh'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; -import { useAuth } from '@/auth/use-auth'; +import { useAccessTokenRefresh } from '@/api/hooks/use-access-token-refresh'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; export function JWTExpirationCheck({ children, diff --git a/packages/apps/human-app/frontend/src/contexts/registered-oracles.tsx b/packages/apps/human-app/frontend/src/shared/contexts/registered-oracles.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/contexts/registered-oracles.tsx rename to packages/apps/human-app/frontend/src/shared/contexts/registered-oracles.tsx diff --git a/packages/apps/human-app/frontend/src/contexts/wallet-connect.tsx b/packages/apps/human-app/frontend/src/shared/contexts/wallet-connect.tsx similarity index 96% rename from packages/apps/human-app/frontend/src/contexts/wallet-connect.tsx rename to packages/apps/human-app/frontend/src/shared/contexts/wallet-connect.tsx index 7a972859a7..9c48095507 100644 --- a/packages/apps/human-app/frontend/src/contexts/wallet-connect.tsx +++ b/packages/apps/human-app/frontend/src/shared/contexts/wallet-connect.tsx @@ -13,8 +13,8 @@ import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'; import { polygonAmoy, polygon } from '@reown/appkit/networks'; import { env } from '@/shared/env'; import type { ResponseError } from '@/shared/types/global.type'; -import { useWeb3Provider } from '@/hooks/use-web3-provider'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import { useWeb3Provider } from '@/shared/hooks/use-web3-provider'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; const projectId = env.VITE_WALLET_CONNECT_PROJECT_ID; diff --git a/packages/apps/human-app/frontend/src/shared/helpers/default-error-message.ts b/packages/apps/human-app/frontend/src/shared/helpers/default-error-message.ts index 0697af3bd9..862da30516 100644 --- a/packages/apps/human-app/frontend/src/shared/helpers/default-error-message.ts +++ b/packages/apps/human-app/frontend/src/shared/helpers/default-error-message.ts @@ -1,6 +1,6 @@ import { t } from 'i18next'; import { FetchError } from '@/api/fetcher'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; type CustomErrorHandler = (unknownError: unknown) => string | undefined; diff --git a/packages/apps/human-app/frontend/src/shared/helpers/json-rpc-error-handler.ts b/packages/apps/human-app/frontend/src/shared/helpers/json-rpc-error-handler.ts index 271091165a..671633a5c5 100644 --- a/packages/apps/human-app/frontend/src/shared/helpers/json-rpc-error-handler.ts +++ b/packages/apps/human-app/frontend/src/shared/helpers/json-rpc-error-handler.ts @@ -1,5 +1,5 @@ import { t } from 'i18next'; -import { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export function jsonRpcErrorHandler(unknownError: unknown) { if (unknownError instanceof JsonRpcError) { diff --git a/packages/apps/human-app/frontend/src/hooks/use-background-store.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-background-store.tsx similarity index 64% rename from packages/apps/human-app/frontend/src/hooks/use-background-store.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-background-store.tsx index 358cbb35df..ae869639c8 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-background-store.tsx +++ b/packages/apps/human-app/frontend/src/shared/hooks/use-background-store.tsx @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import type { BackgroundContextProps } from '@/contexts/background-color-store'; -import { BackgroundContext } from '@/contexts/background-color-store'; +import type { BackgroundContextProps } from '@/shared/contexts/background-color-store'; +import { BackgroundContext } from '@/shared/contexts/background-color-store'; export const useBackgroundColorStore = (): BackgroundContextProps => { const context = useContext(BackgroundContext); diff --git a/packages/apps/human-app/frontend/src/hooks/use-color-mode.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-color-mode.tsx similarity index 62% rename from packages/apps/human-app/frontend/src/hooks/use-color-mode.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-color-mode.tsx index a7caa618ca..74ba1d86f5 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-color-mode.tsx +++ b/packages/apps/human-app/frontend/src/shared/hooks/use-color-mode.tsx @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import type { ColorModeContextProps } from '@/contexts/color-mode-context'; -import { ColorModeContext } from '@/contexts/color-mode-context'; +import type { ColorModeContextProps } from '@/shared/contexts/color-mode-context'; +import { ColorModeContext } from '@/shared/contexts/color-mode-context'; export const useColorMode = (): ColorModeContextProps => { const context = useContext(ColorModeContext); diff --git a/packages/apps/human-app/frontend/src/hooks/use-count-down.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-count-down.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/hooks/use-count-down.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-count-down.tsx diff --git a/packages/apps/human-app/frontend/src/hooks/use-handle-main-nav-icon-click.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-handle-main-nav-icon-click.tsx similarity index 75% rename from packages/apps/human-app/frontend/src/hooks/use-handle-main-nav-icon-click.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-handle-main-nav-icon-click.tsx index b325d62170..0c5a01f880 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-handle-main-nav-icon-click.tsx +++ b/packages/apps/human-app/frontend/src/shared/hooks/use-handle-main-nav-icon-click.tsx @@ -1,7 +1,7 @@ import { useNavigate } from 'react-router-dom'; -import { useWeb3Auth } from '@/auth-web3/use-web3-auth'; -import { useAuth } from '@/auth/use-auth'; -import { useHomePageState } from '@/contexts/homepage-state'; +import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth'; +import { useAuth } from '@/modules/auth/hooks/use-auth'; +import { useHomePageState } from '@/shared/contexts/homepage-state'; import { routerPaths } from '@/router/router-paths'; export const useHandleMainNavIconClick = () => { diff --git a/packages/apps/human-app/frontend/src/hooks/use-is-hcaptcha-labeling-page.ts b/packages/apps/human-app/frontend/src/shared/hooks/use-is-hcaptcha-labeling-page.ts similarity index 100% rename from packages/apps/human-app/frontend/src/hooks/use-is-hcaptcha-labeling-page.ts rename to packages/apps/human-app/frontend/src/shared/hooks/use-is-hcaptcha-labeling-page.ts diff --git a/packages/apps/human-app/frontend/src/hooks/use-is-mobile.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-is-mobile.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/hooks/use-is-mobile.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-is-mobile.tsx diff --git a/packages/apps/human-app/frontend/src/hooks/use-reset-mutation-errors.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-reset-mutation-errors.tsx similarity index 100% rename from packages/apps/human-app/frontend/src/hooks/use-reset-mutation-errors.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-reset-mutation-errors.tsx diff --git a/packages/apps/human-app/frontend/src/hooks/use-wallet-connect.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-wallet-connect.tsx similarity index 76% rename from packages/apps/human-app/frontend/src/hooks/use-wallet-connect.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-wallet-connect.tsx index 0c855b5849..b0a24495b8 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-wallet-connect.tsx +++ b/packages/apps/human-app/frontend/src/shared/hooks/use-wallet-connect.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import { WalletConnectContext } from '@/contexts/wallet-connect'; +import { WalletConnectContext } from '@/shared/contexts/wallet-connect'; export const useWalletConnect = () => { const context = useContext(WalletConnectContext); diff --git a/packages/apps/human-app/frontend/src/hooks/use-web3-provider.tsx b/packages/apps/human-app/frontend/src/shared/hooks/use-web3-provider.tsx similarity index 93% rename from packages/apps/human-app/frontend/src/hooks/use-web3-provider.tsx rename to packages/apps/human-app/frontend/src/shared/hooks/use-web3-provider.tsx index 2a2c191f89..b6ad2d99d2 100644 --- a/packages/apps/human-app/frontend/src/hooks/use-web3-provider.tsx +++ b/packages/apps/human-app/frontend/src/shared/hooks/use-web3-provider.tsx @@ -3,7 +3,7 @@ import type { Eip1193Provider } from 'ethers'; import { BrowserProvider } from 'ethers'; import { useEffect } from 'react'; import { useAppKitNetwork, useAppKitProvider } from '@reown/appkit/react'; -import { checkNetwork } from '@/smart-contracts/check-network'; +import { checkNetwork } from '@/modules/smart-contracts/check-network'; const getSignerAndProvider = async (walletProvider: Eip1193Provider) => { const provider = new BrowserProvider(walletProvider); diff --git a/packages/apps/human-app/frontend/src/i18n/en.json b/packages/apps/human-app/frontend/src/shared/i18n/en.json similarity index 100% rename from packages/apps/human-app/frontend/src/i18n/en.json rename to packages/apps/human-app/frontend/src/shared/i18n/en.json diff --git a/packages/apps/human-app/frontend/src/i18n/i18n.ts b/packages/apps/human-app/frontend/src/shared/i18n/i18n.ts similarity index 94% rename from packages/apps/human-app/frontend/src/i18n/i18n.ts rename to packages/apps/human-app/frontend/src/shared/i18n/i18n.ts index 41812aa5dd..bf7470395d 100644 --- a/packages/apps/human-app/frontend/src/i18n/i18n.ts +++ b/packages/apps/human-app/frontend/src/shared/i18n/i18n.ts @@ -1,6 +1,6 @@ import * as i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; -import enTranslation from '@/i18n/en.json'; +import enTranslation from '@/shared/i18n/en.json'; const resources = { en: { diff --git a/packages/apps/human-app/frontend/src/styles/breakpoints.ts b/packages/apps/human-app/frontend/src/shared/styles/breakpoints.ts similarity index 100% rename from packages/apps/human-app/frontend/src/styles/breakpoints.ts rename to packages/apps/human-app/frontend/src/shared/styles/breakpoints.ts diff --git a/packages/apps/human-app/frontend/src/styles/color-palette.ts b/packages/apps/human-app/frontend/src/shared/styles/color-palette.ts similarity index 100% rename from packages/apps/human-app/frontend/src/styles/color-palette.ts rename to packages/apps/human-app/frontend/src/shared/styles/color-palette.ts diff --git a/packages/apps/human-app/frontend/src/styles/create-table-dark-mode.tsx b/packages/apps/human-app/frontend/src/shared/styles/create-table-dark-mode.tsx similarity index 94% rename from packages/apps/human-app/frontend/src/styles/create-table-dark-mode.tsx rename to packages/apps/human-app/frontend/src/shared/styles/create-table-dark-mode.tsx index 20a0f5fc84..9c1a6da968 100644 --- a/packages/apps/human-app/frontend/src/styles/create-table-dark-mode.tsx +++ b/packages/apps/human-app/frontend/src/shared/styles/create-table-dark-mode.tsx @@ -1,7 +1,7 @@ import type { MRT_Theme } from 'material-react-table'; import ChevronLeftIcon from '@mui/icons-material/ChevronLeft'; import FirstPageIcon from '@mui/icons-material/FirstPage'; -import type { ColorPalette } from '@/styles/color-palette'; +import type { ColorPalette } from '@/shared/styles/color-palette'; export const createTableDarkMode = (colorPalette: ColorPalette) => { const mrtTheme: Partial = { diff --git a/packages/apps/human-app/frontend/src/styles/dark-color-palette.ts b/packages/apps/human-app/frontend/src/shared/styles/dark-color-palette.ts similarity index 95% rename from packages/apps/human-app/frontend/src/styles/dark-color-palette.ts rename to packages/apps/human-app/frontend/src/shared/styles/dark-color-palette.ts index c97b2cee44..5c41f9554f 100644 --- a/packages/apps/human-app/frontend/src/styles/dark-color-palette.ts +++ b/packages/apps/human-app/frontend/src/shared/styles/dark-color-palette.ts @@ -1,4 +1,4 @@ -import type { colorPalette } from '@/styles/color-palette'; +import type { colorPalette } from '@/shared/styles/color-palette'; export const darkColorPalette = { white: 'rgba(16, 7, 53, 1)', diff --git a/packages/apps/human-app/frontend/src/styles/dark-theme.ts b/packages/apps/human-app/frontend/src/shared/styles/dark-theme.ts similarity index 95% rename from packages/apps/human-app/frontend/src/styles/dark-theme.ts rename to packages/apps/human-app/frontend/src/shared/styles/dark-theme.ts index 360c19ae4e..90d88fc1c7 100644 --- a/packages/apps/human-app/frontend/src/styles/dark-theme.ts +++ b/packages/apps/human-app/frontend/src/shared/styles/dark-theme.ts @@ -2,9 +2,9 @@ import type { ThemeOptions } from '@mui/material'; import { darkColorPalette, onlyDarkModeColor, -} from '@/styles/dark-color-palette'; -import { typography } from '@/styles/typography'; -import { breakpoints } from '@/styles/breakpoints'; +} from '@/shared/styles/dark-color-palette'; +import { typography } from '@/shared/styles/typography'; +import { breakpoints } from '@/shared/styles/breakpoints'; export const darkTheme: ThemeOptions = { typography, diff --git a/packages/apps/human-app/frontend/src/styles/theme.ts b/packages/apps/human-app/frontend/src/shared/styles/theme.ts similarity index 96% rename from packages/apps/human-app/frontend/src/styles/theme.ts rename to packages/apps/human-app/frontend/src/shared/styles/theme.ts index bc994f5580..bb623fefc3 100644 --- a/packages/apps/human-app/frontend/src/styles/theme.ts +++ b/packages/apps/human-app/frontend/src/shared/styles/theme.ts @@ -1,6 +1,6 @@ import type { ThemeOptions } from '@mui/material'; -import { colorPalette } from '@/styles/color-palette'; -import { typography } from '@/styles/typography'; +import { colorPalette } from '@/shared/styles/color-palette'; +import { typography } from '@/shared/styles/typography'; export const theme: ThemeOptions = { typography, diff --git a/packages/apps/human-app/frontend/src/styles/typography.ts b/packages/apps/human-app/frontend/src/shared/styles/typography.ts similarity index 98% rename from packages/apps/human-app/frontend/src/styles/typography.ts rename to packages/apps/human-app/frontend/src/shared/styles/typography.ts index d74589cc42..6f940bcf59 100644 --- a/packages/apps/human-app/frontend/src/styles/typography.ts +++ b/packages/apps/human-app/frontend/src/shared/styles/typography.ts @@ -1,6 +1,6 @@ import type { CSSProperties } from 'react'; import type { ThemeOptions } from '@mui/material'; -import { breakpoints } from '@/styles/breakpoints'; +import { breakpoints } from '@/shared/styles/breakpoints'; declare module '@mui/material/Typography' { interface TypographyPropsVariantOverrides { diff --git a/packages/apps/human-app/frontend/src/shared/types/browser-auth-provider.ts b/packages/apps/human-app/frontend/src/shared/types/browser-auth-provider.ts index a0e069b342..61413cfe5d 100644 --- a/packages/apps/human-app/frontend/src/shared/types/browser-auth-provider.ts +++ b/packages/apps/human-app/frontend/src/shared/types/browser-auth-provider.ts @@ -1,6 +1,6 @@ -import type { SignInSuccessResponse } from '@/api/services/worker/sign-in/types'; -import type { Web3UserData } from '@/auth-web3/web3-auth-context'; -import type { UserData } from '@/auth/auth-context'; +import type { SignInSuccessResponse } from '@/modules/worker/services/sign-in/types'; +import type { Web3UserData } from '@/modules/auth-web3/context/web3-auth-context'; +import type { UserData } from '@/modules/auth/context/auth-context'; export type AuthType = 'web2' | 'web3'; type SubscriptionCallback = () => void; diff --git a/packages/apps/human-app/frontend/src/shared/types/global.type.ts b/packages/apps/human-app/frontend/src/shared/types/global.type.ts index 9c54b4adee..dd8e51b82b 100644 --- a/packages/apps/human-app/frontend/src/shared/types/global.type.ts +++ b/packages/apps/human-app/frontend/src/shared/types/global.type.ts @@ -1,6 +1,6 @@ import type { ZodError } from 'zod'; import type { FetchError } from '@/api/fetcher'; -import type { JsonRpcError } from '@/smart-contracts/json-rpc-error'; +import type { JsonRpcError } from '@/modules/smart-contracts/json-rpc-error'; export interface Children { children?: React.ReactNode; diff --git a/packages/apps/human-app/frontend/src/test-utils/render-with-wrapper.tsx b/packages/apps/human-app/frontend/src/test-utils/render-with-wrapper.tsx deleted file mode 100644 index 18ae3669ee..0000000000 --- a/packages/apps/human-app/frontend/src/test-utils/render-with-wrapper.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import type { RenderOptions } from '@testing-library/react'; -import { render } from '@testing-library/react'; -import { BrowserRouter } from 'react-router-dom'; -import type { ReactElement, ReactNode } from 'react'; - -//custom wrapper from official documentation https://testing-library.com/docs/react-testing-library/setup/ -export function renderWithWrapper( - ui: ReactElement, - options?: Omit -) { - function Wrapper({ children }: { children: ReactNode }) { - return {children}; - } - - return render(ui, { wrapper: Wrapper, ...options }); -} From 79a6cf4d63210331d8235bc52b2bee60af6bce4f Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Fri, 3 Jan 2025 15:26:15 +0300 Subject: [PATCH 04/28] [Reputation Oracle] refactor: auth module error handling (#2960) --- .../server/src/common/constants/errors.ts | 36 +-- .../server/src/common/constants/index.ts | 1 + .../server/src/common/guards/jwt.auth.ts | 6 +- .../server/src/common/utils/signature.spec.ts | 4 +- .../src/modules/auth/auth.controller.ts | 21 +- .../src/modules/auth/auth.error-filter.ts | 47 ++++ .../server/src/modules/auth/auth.errors.ts | 53 +++++ .../src/modules/auth/auth.service.spec.ts | 107 ++++----- .../server/src/modules/auth/auth.service.ts | 211 ++++++++---------- .../src/modules/auth/strategy/jwt.http.ts | 18 +- .../modules/credentials/credential.service.ts | 4 +- .../src/modules/user/user.service.spec.ts | 63 +++--- .../server/src/modules/user/user.service.ts | 48 ++-- .../server/test/constants.ts | 3 +- 14 files changed, 335 insertions(+), 287 deletions(-) create mode 100644 packages/apps/reputation-oracle/server/src/modules/auth/auth.error-filter.ts create mode 100644 packages/apps/reputation-oracle/server/src/modules/auth/auth.errors.ts diff --git a/packages/apps/reputation-oracle/server/src/common/constants/errors.ts b/packages/apps/reputation-oracle/server/src/common/constants/errors.ts index 4010ee9d7e..3b1e6437de 100644 --- a/packages/apps/reputation-oracle/server/src/common/constants/errors.ts +++ b/packages/apps/reputation-oracle/server/src/common/constants/errors.ts @@ -21,15 +21,6 @@ export enum ErrorEscrowCompletion { PaidProcessingFailed = 'Failed to process paid escrow completion', } -/** - * Represents error messages related to credential. - */ -export enum ErrorCredential { - NotFound = 'Credential not found', - NotCreated = 'Credential has not been created', - InvalidCredential = 'Invalid credential', -} - /** * Represents error messages related to results. */ @@ -68,36 +59,17 @@ export enum ErrorUser { AlreadyAssigned = 'User already has an address assigned.', NoWalletAddresRegistered = 'No wallet address registered on your account.', KycNotApproved = 'KYC not approved.', - UserNotActive = 'User not active', LabelingEnableFailed = 'Failed to enable labeling for this account.', InvalidType = 'User has invalid type.', - DuplicatedEmail = 'The email you are trying to use already exists. Please check that the email is correct or use a different email.', DuplicatedAddress = 'The address you are trying to use already exists. Please check that the address is correct or use a different address.', } /** - * Represents error messages related to auth. - */ -export enum ErrorAuth { - NotFound = 'Auth not found', - InvalidEmailOrPassword = 'Invalid email or password', - RefreshTokenHasExpired = 'Refresh token has expired', - TokenExpired = 'Token has expired', - UserNotActive = 'User not active', - InvalidSignature = 'Invalid signature', - InvalidRole = 'Invalid role in KVStore', - PasswordIsNotStrongEnough = 'Password is not strong enough. Password must be at least 8 characters long and contain 1 upper, 1 lowercase, 1 number and 1 special character. (!@#$%^&*()_+={}|\'"/`[]:;<>,.?~-])', - InvalidToken = 'Invalid token', - InvalidJobType = 'Invalid operator job type', - InvalidUrl = 'Invalid operator URL', - InvalidFee = 'Invalid operator fee', -} - -/** - * Represents error messages related to token. + * Represents error messages related to captcha. */ -export enum ErrorToken { - NotFound = 'Token not found', +export enum ErrorCapthca { + InvalidToken = 'Invalid captcha token provided', + VerificationFailed = 'Captcha verification failed', } /** diff --git a/packages/apps/reputation-oracle/server/src/common/constants/index.ts b/packages/apps/reputation-oracle/server/src/common/constants/index.ts index 4962a71126..72da9b63dd 100644 --- a/packages/apps/reputation-oracle/server/src/common/constants/index.ts +++ b/packages/apps/reputation-oracle/server/src/common/constants/index.ts @@ -5,6 +5,7 @@ export const NS = 'hmt'; export const RETRIES_COUNT_THRESHOLD = 3; export const INITIAL_REPUTATION = 0; export const JWT_PREFIX = 'bearer '; +export const JWT_STRATEGY_NAME = 'jwt-http'; export const SENDGRID_API_KEY_REGEX = /^SG\.[A-Za-z0-9-_]{22}\.[A-Za-z0-9-_]{43}$/; export const SENDGRID_API_KEY_DISABLED = 'sendgrid-disabled'; diff --git a/packages/apps/reputation-oracle/server/src/common/guards/jwt.auth.ts b/packages/apps/reputation-oracle/server/src/common/guards/jwt.auth.ts index d4475d6e46..3745ed6a06 100644 --- a/packages/apps/reputation-oracle/server/src/common/guards/jwt.auth.ts +++ b/packages/apps/reputation-oracle/server/src/common/guards/jwt.auth.ts @@ -7,9 +7,13 @@ import { import { Reflector } from '@nestjs/core'; import { AuthGuard } from '@nestjs/passport'; import { ControlledError } from '../errors/controlled'; +import { JWT_STRATEGY_NAME } from '../constants'; @Injectable() -export class JwtAuthGuard extends AuthGuard('jwt-http') implements CanActivate { +export class JwtAuthGuard + extends AuthGuard(JWT_STRATEGY_NAME) + implements CanActivate +{ constructor(private readonly reflector: Reflector) { super(); } diff --git a/packages/apps/reputation-oracle/server/src/common/utils/signature.spec.ts b/packages/apps/reputation-oracle/server/src/common/utils/signature.spec.ts index a5d2d07fea..31e868621b 100644 --- a/packages/apps/reputation-oracle/server/src/common/utils/signature.spec.ts +++ b/packages/apps/reputation-oracle/server/src/common/utils/signature.spec.ts @@ -1,6 +1,6 @@ import { verifySignature, recoverSigner, signMessage } from './signature'; import { MOCK_ADDRESS, MOCK_PRIVATE_KEY } from '../../../test/constants'; -import { ErrorAuth, ErrorSignature } from '../constants/errors'; +import { ErrorSignature } from '../constants/errors'; import { ControlledError } from '../errors/controlled'; import { HttpStatus } from '@nestjs/common'; @@ -13,7 +13,7 @@ jest.doMock('ethers', () => { return 'recovered-address'; } else { throw new ControlledError( - ErrorAuth.InvalidSignature, + ErrorSignature.InvalidSignature, HttpStatus.UNAUTHORIZED, ); } diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts index 7b1f511fe3..08bb5a58d9 100644 --- a/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts @@ -16,6 +16,7 @@ import { UseInterceptors, Logger, Ip, + UseFilters, } from '@nestjs/common'; import { Public } from '../../common/decorators'; import { UserCreateDto } from '../user/user.dto'; @@ -35,6 +36,7 @@ import { JwtAuthGuard } from '../../common/guards'; import { RequestWithUser } from '../../common/types'; import { TokenRepository } from './token.repository'; import { TokenType } from './token.entity'; +import { AuthControllerErrorsFilter } from './auth.error-filter'; @ApiTags('Auth') @ApiResponse({ @@ -54,6 +56,7 @@ import { TokenType } from './token.entity'; description: 'Unprocessable entity.', }) @Controller('/auth') +@UseFilters(AuthControllerErrorsFilter) export class AuthJwtController { private readonly logger = new Logger(AuthJwtController.name); @@ -78,11 +81,8 @@ export class AuthJwtController { status: 400, description: 'Bad Request. Invalid input parameters.', }) - public async signup( - @Body() data: UserCreateDto, - @Ip() ip: string, - ): Promise { - await this.authService.signup(data, ip); + public async signup(@Body() data: UserCreateDto): Promise { + await this.authService.signup(data); return; } @@ -107,8 +107,8 @@ export class AuthJwtController { status: 404, description: 'Not Found. Could not find the requested content.', }) - public signin(@Body() data: SignInDto, @Ip() ip: string): Promise { - return this.authService.signin(data, ip); + public signin(@Body() data: SignInDto): Promise { + return this.authService.signin(data); } @Public() @@ -227,11 +227,8 @@ export class AuthJwtController { status: 404, description: 'Not Found. Could not find the requested content.', }) - public restorePassword( - @Body() data: RestorePasswordDto, - @Ip() ip: string, - ): Promise { - return this.authService.restorePassword(data, ip); + public restorePassword(@Body() data: RestorePasswordDto): Promise { + return this.authService.restorePassword(data); } @Public() diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.error-filter.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.error-filter.ts new file mode 100644 index 0000000000..8be962b18b --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.error-filter.ts @@ -0,0 +1,47 @@ +import { + ExceptionFilter, + Catch, + ArgumentsHost, + HttpStatus, + Logger, +} from '@nestjs/common'; +import { Request, Response } from 'express'; + +import { + AuthError, + DuplicatedUserError, + InvalidOperatorSignupDataError, +} from './auth.errors'; + +type AuthControllerError = + | AuthError + | DuplicatedUserError + | InvalidOperatorSignupDataError; + +@Catch(AuthError, DuplicatedUserError, InvalidOperatorSignupDataError) +export class AuthControllerErrorsFilter implements ExceptionFilter { + private logger = new Logger(AuthControllerErrorsFilter.name); + catch(exception: AuthControllerError, host: ArgumentsHost) { + const ctx = host.switchToHttp(); + const response = ctx.getResponse(); + const request = ctx.getRequest(); + let status = HttpStatus.UNAUTHORIZED; + + let logContext: string | undefined; + if (exception instanceof DuplicatedUserError) { + status = HttpStatus.CONFLICT; + logContext = exception.email; + } else if (exception instanceof InvalidOperatorSignupDataError) { + status = HttpStatus.BAD_REQUEST; + logContext = exception.detail; + } + + this.logger.error(exception.message, exception.stack, logContext); + + return response.status(status).json({ + message: exception.message, + timestamp: new Date().toISOString(), + path: request.url, + }); + } +} diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.errors.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.errors.ts new file mode 100644 index 0000000000..edf8e651e1 --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.errors.ts @@ -0,0 +1,53 @@ +import { ErrorCapthca } from '../../common/constants/errors'; +import { BaseError } from '../../common/errors/base'; + +export enum AuthErrorMessage { + INVALID_CREDENTIALS = 'Invalid email or password', + INVALID_REFRESH_TOKEN = 'Refresh token is not valid', + REFRESH_TOKEN_EXPIRED = 'Refresh token expired', + INVALID_WEB3_SIGNATURE = 'Invalid signature', +} + +export class AuthError extends BaseError { + constructor(message: AuthErrorMessage | ErrorCapthca) { + super(message); + } +} + +export class InvalidOperatorSignupDataError extends BaseError { + constructor(public readonly detail: string) { + super('Invalid operator signup data'); + } +} + +export class InvalidOperatorRoleError extends InvalidOperatorSignupDataError { + constructor(role: string) { + super(`Invalid role: ${role}`); + } +} + +export class InvalidOperatorFeeError extends InvalidOperatorSignupDataError { + constructor(fee: string) { + super(`Invalid fee: ${fee}`); + } +} + +export class InvalidOperatorUrlError extends InvalidOperatorSignupDataError { + constructor(url: string) { + super(`Invalid url: ${url}`); + } +} + +export class InvalidOperatorJobTypesError extends InvalidOperatorSignupDataError { + constructor(url: string) { + super(`Invalid job types: ${url}`); + } +} + +export class DuplicatedUserError extends BaseError { + constructor(public readonly email: string) { + super( + 'The email you are trying to use already exists. Please check that the email is correct or use a different email.', + ); + } +} diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.spec.ts index 4bea95ef81..a026ddddbc 100644 --- a/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.spec.ts @@ -7,11 +7,7 @@ import { UserRepository } from '../user/user.repository'; import { JwtService } from '@nestjs/jwt'; import { UserService } from '../user/user.service'; import { UserEntity } from '../user/user.entity'; -import { - ErrorAuth, - ErrorSignature, - ErrorUser, -} from '../../common/constants/errors'; +import { ErrorSignature, ErrorUser } from '../../common/constants/errors'; import { MOCK_ACCESS_TOKEN, MOCK_ADDRESS, @@ -45,6 +41,15 @@ import { HCaptchaConfigService } from '../../common/config/hcaptcha-config.servi import { ControlledError } from '../../common/errors/controlled'; import { NetworkConfigService } from '../../common/config/network-config.service'; import { JobRequestType } from '../../common/enums'; +import { + AuthError, + AuthErrorMessage, + DuplicatedUserError, + InvalidOperatorFeeError, + InvalidOperatorJobTypesError, + InvalidOperatorRoleError, + InvalidOperatorUrlError, +} from './auth.errors'; jest.mock('@human-protocol/sdk', () => ({ ...jest.requireActual('@human-protocol/sdk'), @@ -54,7 +59,7 @@ jest.mock('@human-protocol/sdk', () => ({ })), }, KVStoreUtils: { - get: jest.fn(), + get: jest.fn().mockResolvedValue(''), }, })); @@ -165,10 +170,11 @@ describe('AuthService', () => { status: UserStatus.ACTIVE, }; - let getByCredentialsMock: any; + let findOneByEmailMock: any; beforeEach(() => { - getByCredentialsMock = jest.spyOn(userService, 'getByCredentials'); + findOneByEmailMock = jest.spyOn(userRepository, 'findOneByEmail'); + jest.spyOn(authService, 'auth').mockResolvedValue({ accessToken: MOCK_ACCESS_TOKEN, refreshToken: MOCK_REFRESH_TOKEN, @@ -180,14 +186,11 @@ describe('AuthService', () => { }); it('should sign in the user and return the JWT', async () => { - getByCredentialsMock.mockResolvedValue(userEntity as UserEntity); + findOneByEmailMock.mockResolvedValue(userEntity as UserEntity); const result = await authService.signin(signInDto); - expect(userService.getByCredentials).toHaveBeenCalledWith( - signInDto.email, - signInDto.password, - ); + expect(findOneByEmailMock).toHaveBeenCalledWith(signInDto.email); expect(authService.auth).toHaveBeenCalledWith(userEntity); expect(result).toStrictEqual({ accessToken: MOCK_ACCESS_TOKEN, @@ -195,17 +198,14 @@ describe('AuthService', () => { }); }); - it('should throw UnauthorizedException if user credentials are invalid', async () => { - getByCredentialsMock.mockResolvedValue(undefined); + it('should throw if user credentials are invalid', async () => { + findOneByEmailMock.mockResolvedValue(undefined); await expect(authService.signin(signInDto)).rejects.toThrow( - ErrorAuth.InvalidEmailOrPassword, + new AuthError(AuthErrorMessage.INVALID_CREDENTIALS), ); - expect(userService.getByCredentials).toHaveBeenCalledWith( - signInDto.email, - signInDto.password, - ); + expect(findOneByEmailMock).toHaveBeenCalledWith(signInDto.email); }); }); @@ -216,7 +216,8 @@ describe('AuthService', () => { hCaptchaToken: 'token', }; - const userEntity: Partial = { + const userEntity: Partial & + Pick = { id: 1, email: userCreateDto.email, password: MOCK_HASHED_PASSWORD, @@ -262,7 +263,7 @@ describe('AuthService', () => { .mockResolvedValue(userEntity as any); await expect(authService.signup(userCreateDto)).rejects.toThrow( - new ControlledError(ErrorUser.DuplicatedEmail, HttpStatus.BAD_REQUEST), + new DuplicatedUserError(userEntity.email), ); expect(userRepository.findOneByEmail).toHaveBeenCalledWith( @@ -350,16 +351,16 @@ describe('AuthService', () => { jest.clearAllMocks(); }); - it('should throw NotFound exception if user is not found', () => { + it('should exit early w/o action if user is not found', () => { findOneByEmailMock.mockResolvedValue(null); expect( authService.forgotPassword({ email: 'user@example.com', hCaptchaToken: 'token', }), - ).rejects.toThrow( - new ControlledError(ErrorUser.NotFound, HttpStatus.NO_CONTENT), - ); + ).resolves.toBeUndefined(); + + expect(sendGridService.sendEmail).not.toHaveBeenCalledWith(); }); it('should remove existing token if it exists', async () => { @@ -455,7 +456,7 @@ describe('AuthService', () => { hCaptchaToken: 'token', }), ).rejects.toThrow( - new ControlledError(ErrorAuth.InvalidToken, HttpStatus.FORBIDDEN), + new AuthError(AuthErrorMessage.INVALID_REFRESH_TOKEN), ); }); @@ -470,7 +471,7 @@ describe('AuthService', () => { hCaptchaToken: 'token', }), ).rejects.toThrow( - new ControlledError(ErrorAuth.TokenExpired, HttpStatus.FORBIDDEN), + new AuthError(AuthErrorMessage.REFRESH_TOKEN_EXPIRED), ); }); @@ -523,7 +524,7 @@ describe('AuthService', () => { expect( authService.emailVerification({ token: 'token' }), ).rejects.toThrow( - new ControlledError(ErrorAuth.NotFound, HttpStatus.FORBIDDEN), + new AuthError(AuthErrorMessage.INVALID_REFRESH_TOKEN), ); }); it('should throw an error if token is expired', () => { @@ -532,7 +533,7 @@ describe('AuthService', () => { expect( authService.emailVerification({ token: 'token' }), ).rejects.toThrow( - new ControlledError(ErrorAuth.TokenExpired, HttpStatus.FORBIDDEN), + new AuthError(AuthErrorMessage.REFRESH_TOKEN_EXPIRED), ); }); @@ -571,19 +572,19 @@ describe('AuthService', () => { jest.clearAllMocks(); }); - it('should throw an error if user is not found', () => { + it('should exit early w/o action if user is not found', () => { findOneByEmailMock.mockResolvedValue(null); expect( authService.resendEmailVerification({ email: 'user@example.com', hCaptchaToken: 'token', }), - ).rejects.toThrow( - new ControlledError(ErrorUser.NotFound, HttpStatus.NO_CONTENT), - ); + ).resolves.toBeUndefined(); + + expect(sendGridService.sendEmail).not.toHaveBeenCalledWith(); }); - it('should throw an error if user is not pending', () => { + it('should exit early w/o action if user is not pending', () => { userEntity.status = UserStatus.ACTIVE; findOneByEmailMock.mockResolvedValue(userEntity); expect( @@ -591,9 +592,9 @@ describe('AuthService', () => { email: 'user@example.com', hCaptchaToken: 'token', }), - ).rejects.toThrow( - new ControlledError(ErrorUser.NotFound, HttpStatus.NO_CONTENT), - ); + ).resolves.toBeUndefined(); + + expect(sendGridService.sendEmail).not.toHaveBeenCalledWith(); }); it('should create token and send email', async () => { @@ -803,7 +804,7 @@ describe('AuthService', () => { }); }); - it("should throw ControlledError if signature doesn't match", async () => { + it("should throw if signature doesn't match", async () => { const invalidSignature = await signMessage( 'invalid message', MOCK_PRIVATE_KEY, @@ -822,7 +823,8 @@ describe('AuthService', () => { ), ); }); - it('should throw ControlledError if role is not in KVStore', async () => { + it('should throw if role is not in KVStore', async () => { + KVStoreUtils.get = jest.fn().mockResolvedValueOnce(''); const signature = await signMessage( preSignUpDataMock, MOCK_PRIVATE_KEY, @@ -834,11 +836,9 @@ describe('AuthService', () => { type: Role.WORKER, signature: signature, }), - ).rejects.toThrow( - new ControlledError(ErrorAuth.InvalidRole, HttpStatus.BAD_REQUEST), - ); + ).rejects.toThrow(new InvalidOperatorRoleError('')); }); - it('should throw ControlledError if fee is not in KVStore', async () => { + it('should throw if fee is not in KVStore', async () => { KVStoreUtils.get = jest.fn().mockResolvedValueOnce('Job Launcher'); const signature = await signMessage( preSignUpDataMock, @@ -851,11 +851,9 @@ describe('AuthService', () => { type: Role.WORKER, signature: signature, }), - ).rejects.toThrow( - new ControlledError(ErrorAuth.InvalidFee, HttpStatus.BAD_REQUEST), - ); + ).rejects.toThrow(new InvalidOperatorFeeError('')); }); - it('should throw ControlledError if url is not in KVStore', async () => { + it('should throw if url is not in KVStore', async () => { KVStoreUtils.get = jest .fn() .mockResolvedValueOnce('Job Launcher') @@ -872,11 +870,9 @@ describe('AuthService', () => { type: Role.WORKER, signature: signature, }), - ).rejects.toThrow( - new ControlledError(ErrorAuth.InvalidUrl, HttpStatus.BAD_REQUEST), - ); + ).rejects.toThrow(new InvalidOperatorUrlError('')); }); - it('should throw ControlledError if job type is not in KVStore', async () => { + it('should throw if job type is not in KVStore', async () => { KVStoreUtils.get = jest .fn() .mockResolvedValueOnce('Job Launcher') @@ -894,12 +890,7 @@ describe('AuthService', () => { type: Role.WORKER, signature: signature, }), - ).rejects.toThrow( - new ControlledError( - ErrorAuth.InvalidJobType, - HttpStatus.BAD_REQUEST, - ), - ); + ).rejects.toThrow(new InvalidOperatorJobTypesError('')); }); }); }); diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts index 19be0f7993..69faa8e82a 100644 --- a/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts @@ -1,7 +1,7 @@ -import { HttpStatus, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; -import { ErrorAuth, ErrorUser } from '../../common/constants/errors'; +import { ErrorCapthca } from '../../common/constants/errors'; import { OperatorStatus, Role as UserRole, @@ -24,7 +24,6 @@ import { import { TokenEntity, TokenType } from './token.entity'; import { TokenRepository } from './token.repository'; import { verifySignature } from '../../common/utils/signature'; -import { createHash } from 'crypto'; import { SendGridService } from '../sendgrid/sendgrid.service'; import { SENDGRID_TEMPLATES, SERVICE_NAME } from '../../common/constants'; import { Web3Service } from '../web3/web3.service'; @@ -40,9 +39,17 @@ import { UserRepository } from '../user/user.repository'; import { AuthConfigService } from '../../common/config/auth-config.service'; import { ServerConfigService } from '../../common/config/server-config.service'; import { Web3ConfigService } from '../../common/config/web3-config.service'; -import { ControlledError } from '../../common/errors/controlled'; import { HCaptchaService } from '../../integrations/hcaptcha/hcaptcha.service'; import { SiteKeyType } from '../../common/enums'; +import { + AuthError, + AuthErrorMessage, + DuplicatedUserError, + InvalidOperatorFeeError, + InvalidOperatorJobTypesError, + InvalidOperatorRoleError, + InvalidOperatorUrlError, +} from './auth.errors'; @Injectable() export class AuthService { @@ -61,50 +68,50 @@ export class AuthService { private readonly hCaptchaService: HCaptchaService, ) {} - public async signin(data: SignInDto, ip?: string): Promise { - const userEntity = await this.userService.getByCredentials( - data.email, - data.password, - ); - + public async signin({ + email, + password, + hCaptchaToken, + }: SignInDto): Promise { + const userEntity = await this.userRepository.findOneByEmail(email); if (!userEntity) { - throw new ControlledError( - ErrorAuth.InvalidEmailOrPassword, - HttpStatus.NOT_FOUND, - ); + throw new AuthError(AuthErrorMessage.INVALID_CREDENTIALS); } - if ( - userEntity.role !== UserRole.HUMAN_APP && - (!data.hCaptchaToken || - !(await this.hCaptchaService.verifyToken({ token: data.hCaptchaToken })) - .success) - ) { - throw new ControlledError( - ErrorAuth.InvalidToken, - HttpStatus.UNAUTHORIZED, - ); + if (!UserService.checkPasswordMatchesHash(password, userEntity.password)) { + throw new AuthError(AuthErrorMessage.INVALID_CREDENTIALS); + } + + if (userEntity.role !== UserRole.HUMAN_APP) { + if (!hCaptchaToken) { + throw new AuthError(ErrorCapthca.InvalidToken); + } + + const captchaVerificationResult = await this.hCaptchaService.verifyToken({ + token: hCaptchaToken, + }); + if (!captchaVerificationResult.success) { + throw new AuthError(ErrorCapthca.VerificationFailed); + } } return this.auth(userEntity); } - public async signup(data: UserCreateDto, ip?: string): Promise { - if ( - !(await this.hCaptchaService.verifyToken({ token: data.hCaptchaToken })) - .success - ) { - throw new ControlledError( - ErrorAuth.InvalidToken, - HttpStatus.UNAUTHORIZED, - ); + public async signup(data: UserCreateDto): Promise { + if (!data.hCaptchaToken) { + throw new AuthError(ErrorCapthca.InvalidToken); + } + const captchaVerificationResult = await this.hCaptchaService.verifyToken({ + token: data.hCaptchaToken, + }); + if (!captchaVerificationResult.success) { + throw new AuthError(ErrorCapthca.VerificationFailed); } + const storedUser = await this.userRepository.findOneByEmail(data.email); if (storedUser) { - throw new ControlledError( - ErrorUser.DuplicatedEmail, - HttpStatus.BAD_REQUEST, - ); + throw new DuplicatedUserError(data.email); } const userEntity = await this.userService.create(data); @@ -141,11 +148,11 @@ export class AuthService { ); if (!tokenEntity) { - throw new ControlledError(ErrorAuth.InvalidToken, HttpStatus.FORBIDDEN); + throw new AuthError(AuthErrorMessage.INVALID_REFRESH_TOKEN); } if (new Date() > tokenEntity.expiresAt) { - throw new ControlledError(ErrorAuth.TokenExpired, HttpStatus.FORBIDDEN); + throw new AuthError(AuthErrorMessage.REFRESH_TOKEN_EXPIRED); } return this.auth(tokenEntity.user); @@ -230,20 +237,20 @@ export class AuthService { } public async forgotPassword(data: ForgotPasswordDto): Promise { - if ( - !(await this.hCaptchaService.verifyToken({ token: data.hCaptchaToken })) - .success - ) { - throw new ControlledError( - ErrorAuth.InvalidToken, - HttpStatus.UNAUTHORIZED, - ); + if (!data.hCaptchaToken) { + throw new AuthError(ErrorCapthca.InvalidToken); + } + const captchaVerificationResult = await this.hCaptchaService.verifyToken({ + token: data.hCaptchaToken, + }); + if (!captchaVerificationResult.success) { + throw new AuthError(ErrorCapthca.VerificationFailed); } const userEntity = await this.userRepository.findOneByEmail(data.email); if (!userEntity) { - throw new ControlledError(ErrorUser.NotFound, HttpStatus.NO_CONTENT); + return; } const existingToken = await this.tokenRepository.findOneByUserIdAndType( @@ -279,18 +286,15 @@ export class AuthService { }); } - public async restorePassword( - data: RestorePasswordDto, - ip?: string, - ): Promise { - if ( - !(await this.hCaptchaService.verifyToken({ token: data.hCaptchaToken })) - .success - ) { - throw new ControlledError( - ErrorAuth.InvalidToken, - HttpStatus.UNAUTHORIZED, - ); + public async restorePassword(data: RestorePasswordDto): Promise { + if (!data.hCaptchaToken) { + throw new AuthError(ErrorCapthca.InvalidToken); + } + const captchaVerificationResult = await this.hCaptchaService.verifyToken({ + token: data.hCaptchaToken, + }); + if (!captchaVerificationResult.success) { + throw new AuthError(ErrorCapthca.VerificationFailed); } const tokenEntity = await this.tokenRepository.findOneByUuidAndType( @@ -299,11 +303,11 @@ export class AuthService { ); if (!tokenEntity) { - throw new ControlledError(ErrorAuth.InvalidToken, HttpStatus.FORBIDDEN); + throw new AuthError(AuthErrorMessage.INVALID_REFRESH_TOKEN); } if (new Date() > tokenEntity.expiresAt) { - throw new ControlledError(ErrorAuth.TokenExpired, HttpStatus.FORBIDDEN); + throw new AuthError(AuthErrorMessage.REFRESH_TOKEN_EXPIRED); } await this.userService.updatePassword(tokenEntity.user, data); @@ -329,11 +333,11 @@ export class AuthService { ); if (!tokenEntity) { - throw new ControlledError(ErrorAuth.NotFound, HttpStatus.FORBIDDEN); + throw new AuthError(AuthErrorMessage.INVALID_REFRESH_TOKEN); } if (new Date() > tokenEntity.expiresAt) { - throw new ControlledError(ErrorAuth.TokenExpired, HttpStatus.FORBIDDEN); + throw new AuthError(AuthErrorMessage.REFRESH_TOKEN_EXPIRED); } tokenEntity.user.status = UserStatus.ACTIVE; @@ -343,20 +347,19 @@ export class AuthService { public async resendEmailVerification( data: ResendEmailVerificationDto, ): Promise { - if ( - !(await this.hCaptchaService.verifyToken({ token: data.hCaptchaToken })) - .success - ) { - throw new ControlledError( - ErrorAuth.InvalidToken, - HttpStatus.UNAUTHORIZED, - ); + if (!data.hCaptchaToken) { + throw new AuthError(ErrorCapthca.InvalidToken); + } + const captchaVerificationResult = await this.hCaptchaService.verifyToken({ + token: data.hCaptchaToken, + }); + if (!captchaVerificationResult.success) { + throw new AuthError(ErrorCapthca.VerificationFailed); } const userEntity = await this.userRepository.findOneByEmail(data.email); - - if (!userEntity || userEntity?.status != UserStatus.PENDING) { - throw new ControlledError(ErrorUser.NotFound, HttpStatus.NO_CONTENT); + if (!userEntity || userEntity.status !== UserStatus.PENDING) { + return; } const existingToken = await this.tokenRepository.findOneByUserIdAndType( @@ -392,16 +395,6 @@ export class AuthService { }); } - public hashToken(token: string): string { - const hash = createHash('sha256'); - hash.update(token + this.salt); - return hash.digest('hex'); - } - - public compareToken(token: string, hashedToken: string): boolean { - return this.hashToken(token) === hashedToken; - } - public async web3Signup(data: Web3SignUpDto): Promise { const preSignUpData = await this.userService.prepareSignatureBody( SignatureType.SIGNUP, @@ -413,10 +406,7 @@ export class AuthService { ]); if (!verified) { - throw new ControlledError( - ErrorAuth.InvalidSignature, - HttpStatus.UNAUTHORIZED, - ); + throw new AuthError(AuthErrorMessage.INVALID_WEB3_SIGNATURE); } let chainId: ChainId; @@ -432,39 +422,40 @@ export class AuthService { const signer = this.web3Service.getSigner(chainId); const kvstore = await KVStoreClient.build(signer); - let role: string | undefined; + let role = ''; try { role = await KVStoreUtils.get(chainId, data.address, KVStoreKeys.role); } catch {} - if ( - !role || - ![Role.JobLauncher, Role.ExchangeOracle, Role.RecordingOracle].some( - (r) => r.toLowerCase() === role.toLowerCase(), - ) - ) { - throw new ControlledError(ErrorAuth.InvalidRole, HttpStatus.BAD_REQUEST); + const validRolesValue = [ + Role.JobLauncher, + Role.ExchangeOracle, + Role.RecordingOracle, + ].map((role) => role.toLowerCase()); + + if (!validRolesValue.includes(role.toLowerCase())) { + throw new InvalidOperatorRoleError(role); } - let fee: string | undefined; + let fee = ''; try { fee = await KVStoreUtils.get(chainId, data.address, KVStoreKeys.fee); } catch {} - if (!fee || fee === '') { - throw new ControlledError(ErrorAuth.InvalidFee, HttpStatus.BAD_REQUEST); + if (!fee) { + throw new InvalidOperatorFeeError(fee); } - let url: string | undefined; + let url = ''; try { url = await KVStoreUtils.get(chainId, data.address, KVStoreKeys.url); } catch {} - if (!url || url === '') { - throw new ControlledError(ErrorAuth.InvalidUrl, HttpStatus.BAD_REQUEST); + if (!url) { + throw new InvalidOperatorUrlError(url); } - let jobTypes: string | undefined; + let jobTypes = ''; try { jobTypes = await KVStoreUtils.get( chainId, @@ -473,11 +464,8 @@ export class AuthService { ); } catch {} - if (!jobTypes || jobTypes === '') { - throw new ControlledError( - ErrorAuth.InvalidJobType, - HttpStatus.BAD_REQUEST, - ); + if (!jobTypes) { + throw new InvalidOperatorJobTypesError(jobTypes); } const userEntity = await this.userService.createWeb3User(data.address); @@ -500,10 +488,7 @@ export class AuthService { ); if (!verified) { - throw new ControlledError( - ErrorAuth.InvalidSignature, - HttpStatus.UNAUTHORIZED, - ); + throw new AuthError(AuthErrorMessage.INVALID_WEB3_SIGNATURE); } await this.userService.updateNonce(userEntity); diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/strategy/jwt.http.ts b/packages/apps/reputation-oracle/server/src/modules/auth/strategy/jwt.http.ts index 771c1d04bd..bba6c08e44 100644 --- a/packages/apps/reputation-oracle/server/src/modules/auth/strategy/jwt.http.ts +++ b/packages/apps/reputation-oracle/server/src/modules/auth/strategy/jwt.http.ts @@ -1,21 +1,24 @@ import { ExtractJwt, Strategy } from 'passport-jwt'; import { PassportStrategy } from '@nestjs/passport'; -import { HttpStatus, Injectable, Req } from '@nestjs/common'; +import { Injectable, Req, UnauthorizedException } from '@nestjs/common'; import { UserEntity } from '../../user/user.entity'; import { + JWT_STRATEGY_NAME, LOGOUT_PATH, RESEND_EMAIL_VERIFICATION_PATH, } from '../../../common/constants'; import { UserStatus } from '../../../common/enums/user'; import { UserRepository } from '../../user/user.repository'; import { AuthConfigService } from '../../../common/config/auth-config.service'; -import { ControlledError } from '../../../common/errors/controlled'; import { TokenRepository } from '../token.repository'; import { TokenType } from '../token.entity'; @Injectable() -export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { +export class JwtHttpStrategy extends PassportStrategy( + Strategy, + JWT_STRATEGY_NAME, +) { constructor( private readonly userRepository: UserRepository, private readonly tokenRepository: TokenRepository, @@ -36,7 +39,7 @@ export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { const user = await this.userRepository.findById(payload.userId); if (!user) { - throw new ControlledError('User not found', HttpStatus.UNAUTHORIZED); + throw new UnauthorizedException('User not found'); } if ( @@ -44,7 +47,7 @@ export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { request.url !== RESEND_EMAIL_VERIFICATION_PATH && request.url !== LOGOUT_PATH ) { - throw new ControlledError('User not active', HttpStatus.UNAUTHORIZED); + throw new UnauthorizedException('User not active'); } const token = await this.tokenRepository.findOneByUserIdAndType( @@ -53,10 +56,7 @@ export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { ); if (!token) { - throw new ControlledError( - 'User is not authorized', - HttpStatus.UNAUTHORIZED, - ); + throw new UnauthorizedException('User is not authorized'); } return user; diff --git a/packages/apps/reputation-oracle/server/src/modules/credentials/credential.service.ts b/packages/apps/reputation-oracle/server/src/modules/credentials/credential.service.ts index 090a0cd35a..829369808e 100644 --- a/packages/apps/reputation-oracle/server/src/modules/credentials/credential.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/credentials/credential.service.ts @@ -5,7 +5,7 @@ import { CredentialEntity } from './credential.entity'; import { CredentialStatus } from '../../common/enums/credential'; import { Web3Service } from '../web3/web3.service'; import { verifySignature } from '../../common/utils/signature'; -import { ErrorAuth } from '../../common/constants/errors'; +import { ErrorSignature } from '../../common/constants/errors'; import { ChainId, KVStoreClient } from '@human-protocol/sdk'; import { SignatureType, Web3Env } from '../../common/enums/web3'; import { Web3ConfigService } from '../../common/config/web3-config.service'; @@ -142,7 +142,7 @@ export class CredentialService { if (!verifySignature(signatureBody.contents, signature, [workerAddress])) { throw new ControlledError( - ErrorAuth.InvalidSignature, + ErrorSignature.InvalidSignature, HttpStatus.UNAUTHORIZED, ); } diff --git a/packages/apps/reputation-oracle/server/src/modules/user/user.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/user/user.service.spec.ts index 8eb07b4f08..ca10165c42 100644 --- a/packages/apps/reputation-oracle/server/src/modules/user/user.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/user/user.service.spec.ts @@ -30,7 +30,7 @@ import { HCaptchaConfigService } from '../../common/config/hcaptcha-config.servi import { HttpService } from '@nestjs/axios'; import { ControlledError } from '../../common/errors/controlled'; import { - ErrorAuth, + ErrorCapthca, ErrorOperator, ErrorSignature, ErrorUser, @@ -116,6 +116,30 @@ describe('UserService', () => { siteKeyRepository = moduleRef.get(SiteKeyRepository); }); + describe('checkPasswordMatchesHash', () => { + const password = 'password123'; + const hashedPassword = + '$2b$12$Z02o9/Ay7CT0n99icApZYORH8iJI9VGtl3mju7d0c4SdDDujhSzOa'; + + it('should return true if password matches', () => { + const result = UserService.checkPasswordMatchesHash( + password, + hashedPassword, + ); + + expect(result).toBe(true); + }); + + it('should return false if password does not match', () => { + const result = UserService.checkPasswordMatchesHash( + password, + '321drowssap', + ); + + expect(result).toBe(false); + }); + }); + describe('create', () => { it('should create a new user and return the created user entity', async () => { const dto: UserCreateDto = { @@ -141,36 +165,6 @@ describe('UserService', () => { }); }); - describe('getByCredentials', () => { - const email = 'test@example.com'; - const password = 'password123'; - const hashedPassword = - '$2b$12$Z02o9/Ay7CT0n99icApZYORH8iJI9VGtl3mju7d0c4SdDDujhSzOa'; - - const userEntity: Partial = { - id: 1, - email, - password: hashedPassword, - }; - it('should return the user entity if credentials are valid', async () => { - jest - .spyOn(userRepository, 'findOneByEmail') - .mockResolvedValue(userEntity as UserEntity); - - const result = await userService.getByCredentials(email, password); - - expect(userRepository.findOneByEmail).toHaveBeenCalledWith(email); - expect(result).toBe(userEntity); - }); - - it('should return null if credentials are invalid', async () => { - jest.spyOn(userRepository, 'findOneByEmail').mockResolvedValue(null); - const result = await userService.getByCredentials(email, password); - expect(result).toBe(null); - expect(userRepository.findOneByEmail).toHaveBeenCalledWith(email); - }); - }); - describe('getByAddress', () => { it('should return the user entity if the address exists', async () => { const address = '0x0755D4d722a4a201c1C5A4B5E614D913e7747b36'; @@ -888,7 +882,7 @@ describe('UserService', () => { expect(result).toEqual(siteKeyMock); }); - it('should fail if token is invalid', async () => { + it('should throw if captcha verification fails', async () => { const userEntity: DeepPartial = { id: 1, email: 'test@example.com', @@ -909,7 +903,10 @@ describe('UserService', () => { oracleRegistration, ), ).rejects.toThrow( - new ControlledError(ErrorAuth.InvalidToken, HttpStatus.UNAUTHORIZED), + new ControlledError( + ErrorCapthca.VerificationFailed, + HttpStatus.BAD_REQUEST, + ), ); }); }); diff --git a/packages/apps/reputation-oracle/server/src/modules/user/user.service.ts b/packages/apps/reputation-oracle/server/src/modules/user/user.service.ts index 1ab9ecd456..0a2ba26fd7 100644 --- a/packages/apps/reputation-oracle/server/src/modules/user/user.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/user/user.service.ts @@ -6,7 +6,7 @@ import { } from '@nestjs/common'; import * as bcrypt from 'bcrypt'; import { - ErrorAuth, + ErrorCapthca, ErrorOperator, ErrorUser, } from '../../common/constants/errors'; @@ -55,6 +55,13 @@ export class UserService { private readonly hCaptchaService: HCaptchaService, ) {} + static checkPasswordMatchesHash( + password: string, + passwordHash: string, + ): boolean { + return bcrypt.compareSync(password, passwordHash); + } + public async create(dto: UserCreateDto): Promise { const newUser = new UserEntity(); newUser.email = dto.email; @@ -65,19 +72,6 @@ export class UserService { return newUser; } - public async getByCredentials( - email: string, - password: string, - ): Promise { - const userEntity = await this.userRepository.findOneByEmail(email); - - if (!userEntity || !bcrypt.compareSync(password, userEntity.password)) { - return null; - } - - return userEntity; - } - public updatePassword( userEntity: UserEntity, data: ValidatePasswordDto, @@ -375,27 +369,33 @@ export class UserService { public async registrationInExchangeOracle( user: UserEntity, - data: RegistrationInExchangeOracleDto, + { hCaptchaToken, oracleAddress }: RegistrationInExchangeOracleDto, ): Promise { - if ( - !data.hCaptchaToken || - !(await this.hCaptchaService.verifyToken({ token: data.hCaptchaToken })) - .success - ) { + if (!hCaptchaToken) { + throw new ControlledError( + ErrorCapthca.InvalidToken, + HttpStatus.BAD_REQUEST, + ); + } + const captchaVerificationResult = await this.hCaptchaService.verifyToken({ + token: hCaptchaToken, + }); + if (!captchaVerificationResult.success) { throw new ControlledError( - ErrorAuth.InvalidToken, - HttpStatus.UNAUTHORIZED, + ErrorCapthca.VerificationFailed, + HttpStatus.BAD_REQUEST, ); } + const siteKey = await this.siteKeyRepository.findByUserSiteKeyAndType( user, - data.oracleAddress, + oracleAddress, SiteKeyType.REGISTRATION, ); if (siteKey) return siteKey; const newSiteKey = new SiteKeyEntity(); - newSiteKey.siteKey = data.oracleAddress; + newSiteKey.siteKey = oracleAddress; newSiteKey.type = SiteKeyType.REGISTRATION; newSiteKey.user = user; diff --git a/packages/apps/reputation-oracle/server/test/constants.ts b/packages/apps/reputation-oracle/server/test/constants.ts index 94b3342667..d67f7479dc 100644 --- a/packages/apps/reputation-oracle/server/test/constants.ts +++ b/packages/apps/reputation-oracle/server/test/constants.ts @@ -194,7 +194,8 @@ FjGp13DtiY8P2zNL5eMxGiMTp8xQJ7jC3HVZROqUOujcdLPglfE7b5n/Ao9TBwFO export const MOCK_PGP_PASSPHRASE = 'secure-passphrase'; export const MOCK_EMAIL = 'test@example.com'; export const MOCK_PASSWORD = 'password123'; -export const MOCK_HASHED_PASSWORD = 'hashedPassword'; +export const MOCK_HASHED_PASSWORD = + '$2b$12$Z02o9/Ay7CT0n99icApZYORH8iJI9VGtl3mju7d0c4SdDDujhSzOa'; export const MOCK_ACCESS_TOKEN = 'access_token'; export const MOCK_REFRESH_TOKEN = 'refresh_token'; export const MOCK_ACCESS_TOKEN_HASHED = 'access_token_hashed'; From 5ea4800f85d7281fef915702d92d433e6942a340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Wed, 8 Jan 2025 08:45:33 +0100 Subject: [PATCH 05/28] [Dashboard] Hyperlink role to oracle website (#2971) * Reenable website url for leaders tables * Open a new tab when clicking the link --- .../Leaderboard/components/RoleCell.tsx | 60 +++++++++++++++---- .../Leaderboard/hooks/useDataGrid.tsx | 2 +- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/RoleCell.tsx b/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/RoleCell.tsx index 9bc9151c44..fade268f52 100644 --- a/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/RoleCell.tsx +++ b/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/RoleCell.tsx @@ -1,26 +1,60 @@ import { Box, Typography } from '@mui/material'; import { useBreakPoints } from '@utils/hooks/use-is-mobile'; - +import { Link } from 'react-router-dom'; import { EntityIcon } from './EntityIcon'; -export const RoleCell = ({ role }: { role: string }) => { +export const RoleCell = ({ + role, + websiteUrl, +}: { + role: string; + websiteUrl?: string; +}) => { const { mobile: { isMobile }, } = useBreakPoints(); return ( - {!isMobile && } - - {role} - + {websiteUrl ? ( + + {!isMobile && } + + {role} + + + ) : ( + <> + {!isMobile && } + + {role} + + + )} ); }; diff --git a/packages/apps/dashboard/ui-2024/src/features/Leaderboard/hooks/useDataGrid.tsx b/packages/apps/dashboard/ui-2024/src/features/Leaderboard/hooks/useDataGrid.tsx index af0af375c5..e73d7e0d61 100644 --- a/packages/apps/dashboard/ui-2024/src/features/Leaderboard/hooks/useDataGrid.tsx +++ b/packages/apps/dashboard/ui-2024/src/features/Leaderboard/hooks/useDataGrid.tsx @@ -58,7 +58,7 @@ export const useDataGrid = (data: LeaderBoardData) => { ), renderCell: (params: GridRenderCellParams) => ( - + ), }, { From faad955d04b0872b13ee016f8c7e275b2d95ffce Mon Sep 17 00:00:00 2001 From: adrian-oleskiewicz Date: Wed, 8 Jan 2025 10:10:19 +0100 Subject: [PATCH 06/28] [Human App] fix: solve button width on mobile (#2970) --- .../modules/worker/components/jobs/my-jobs-table-actions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx index cf0e8d10ba..1470a87cb8 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/components/jobs/my-jobs-table-actions.tsx @@ -32,7 +32,7 @@ export function MyJobsTableActions({ job }: MyJobsTableRejectActionProps) { fullWidth target="_blank" to={job.url} - sx={{ maxWidth: '160px ' }} + sx={{ maxWidth: { xs: 'unset', sm: '160px' } }} > {t('worker.jobs.solve')} From 9b7779bb72197cf5f738fab74734fb939dd2f30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:00:15 +0100 Subject: [PATCH 07/28] [Dashboard client] Show only enabled networks (#2974) * Modify network endpoint to use available networks, not only mainnets * Show only enabled networks in Dashboard client --- .../modules/networks/network.service.spec.ts | 5 +- .../src/modules/networks/networks.service.ts | 11 +-- .../src/components/SearchBar/SearchBar.tsx | 86 ++++++++++--------- .../Leaderboard/components/SelectNetwork.tsx | 79 ++++++++--------- .../ui-2024/src/services/api-paths.ts | 3 + .../src/utils/hooks/use-filtered-networks.ts | 27 ++++++ .../src/utils/hooks/use-leaderboard-search.ts | 7 -- .../src/utils/hooks/use-wallet-search.ts | 3 +- 8 files changed, 128 insertions(+), 93 deletions(-) create mode 100644 packages/apps/dashboard/ui-2024/src/utils/hooks/use-filtered-networks.ts diff --git a/packages/apps/dashboard/server/src/modules/networks/network.service.spec.ts b/packages/apps/dashboard/server/src/modules/networks/network.service.spec.ts index 5b8e5430f0..95509e912f 100644 --- a/packages/apps/dashboard/server/src/modules/networks/network.service.spec.ts +++ b/packages/apps/dashboard/server/src/modules/networks/network.service.spec.ts @@ -9,6 +9,7 @@ import { ChainId, NETWORKS } from '@human-protocol/sdk'; import { HttpService } from '@nestjs/axios'; import { ConfigService } from '@nestjs/config'; import { NetworksService } from './networks.service'; +import { NetworkConfigService } from '../../common/config/network-config.service'; jest.mock('@human-protocol/sdk', () => ({ ...jest.requireActual('@human-protocol/sdk'), @@ -21,6 +22,7 @@ describe('NetworksService', () => { beforeAll(async () => { process.env.RPC_URL_POLYGON = 'https://testrpc.com'; + process.env.RPC_URL_BSC_MAINNET = 'https://testrpc.com'; process.env.RPC_URL_ETHEREUM = 'https://testrpc.com'; process.env.WEB3_ENV = 'mainnet'; }); @@ -44,6 +46,7 @@ describe('NetworksService', () => { networkOperatingCacheTtl: 1000, }, }, + NetworkConfigService, ConfigService, Logger, ], @@ -56,8 +59,8 @@ describe('NetworksService', () => { it('should regenerate network list when cache TTL expires', async () => { const mockNetworkList = [ ChainId.MAINNET, - ChainId.BSC_MAINNET, ChainId.POLYGON, + ChainId.BSC_MAINNET, ]; // Step 1: Initial request - populate cache diff --git a/packages/apps/dashboard/server/src/modules/networks/networks.service.ts b/packages/apps/dashboard/server/src/modules/networks/networks.service.ts index 6b5b9cb6d5..26e9fbeab2 100644 --- a/packages/apps/dashboard/server/src/modules/networks/networks.service.ts +++ b/packages/apps/dashboard/server/src/modules/networks/networks.service.ts @@ -8,7 +8,7 @@ import { MINIMUM_HMT_TRANSFERS, } from '../../common/config/env-config.service'; import { OPERATING_NETWORKS_CACHE_KEY } from '../../common/config/redis-config.service'; -import { MAINNET_CHAIN_IDS } from '../../common/utils/constants'; +import { NetworkConfigService } from '../../common/config/network-config.service'; @Injectable() export class NetworksService { @@ -16,6 +16,7 @@ export class NetworksService { constructor( @Inject(CACHE_MANAGER) private cacheManager: Cache, private readonly envConfigService: EnvironmentConfigService, + private readonly networkConfigService: NetworkConfigService, ) {} public async getOperatingNetworks(): Promise { @@ -38,8 +39,8 @@ export class NetworksService { const availableNetworks = []; - for (const chainId of Object.values(MAINNET_CHAIN_IDS)) { - const networkConfig = NETWORKS[chainId]; + for (const network of Object.values(this.networkConfigService.networks)) { + const networkConfig = NETWORKS[network.chainId]; if (!networkConfig) continue; const statisticsClient = new StatisticsClient(networkConfig); @@ -64,11 +65,11 @@ export class NetworksService { totalTransactionCount > MINIMUM_HMT_TRANSFERS; if (recentEscrowsCreated && sufficientHMTTransfers) { - availableNetworks.push(chainId); + availableNetworks.push(network.chainId); } } catch (error) { this.logger.error( - `Error processing network ${chainId}: ${error.message}`, + `Error processing network ${network.chainId}: ${error.message}`, ); } } diff --git a/packages/apps/dashboard/ui-2024/src/components/SearchBar/SearchBar.tsx b/packages/apps/dashboard/ui-2024/src/components/SearchBar/SearchBar.tsx index 6abd09b890..60b49386ca 100644 --- a/packages/apps/dashboard/ui-2024/src/components/SearchBar/SearchBar.tsx +++ b/packages/apps/dashboard/ui-2024/src/components/SearchBar/SearchBar.tsx @@ -13,9 +13,10 @@ import { MenuItem, Box, Tooltip, + CircularProgress, } from '@mui/material'; import { colorPalette } from '@assets/styles/color-palette'; -import { getNetwork, networks } from '@utils/config/networks'; +import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; import { useBreakPoints } from '@utils/hooks/use-is-mobile'; import { NetworkIcon } from '@components/NetworkIcon'; import { useWalletSearch } from '@utils/hooks/use-wallet-search'; @@ -40,32 +41,36 @@ const SearchBar: FC = ({ initialInputValue = '', }) => { const { mobile } = useBreakPoints(); - const [inputValue, setInputValue] = useState(initialInputValue); - const [selectValue, setSelectValue] = useState(''); - const [focus, setFocus] = useState(false); - const { filterParams } = useWalletSearch(); + const { filteredNetworks, isLoading } = useFilteredNetworks(); + const { filterParams, setChainId, setAddress } = useWalletSearch(); const navigate = useNavigate(); + const [inputValue, setInputValue] = useState(initialInputValue); const [error, setError] = useState(null); + const [focus, setFocus] = useState(false); - const navigateToAddress = useCallback( - (chainIdParam?: number | undefined) => { - const chainId = chainIdParam || selectValue || -1; - const address = inputValue || ''; - navigate(`/search/${chainId}/${address}`); - }, - [inputValue, selectValue, navigate] - ); + useEffect(() => { + setInputValue(filterParams.address); + }, [filterParams.address]); useEffect(() => { - const networkName = getNetwork(filterParams.chainId || -1)?.name || ''; - if (networkName) { - setSelectValue(filterParams.chainId); + if ( + !isLoading && + filteredNetworks.length > 0 && + filterParams.chainId === -1 + ) { + setChainId(filteredNetworks[0].id); } - }, [filterParams.chainId]); + }, [filteredNetworks, isLoading, filterParams.chainId, setChainId]); - useEffect(() => { - setInputValue(filterParams.address); - }, [filterParams.address]); + const navigateToAddress = useCallback(() => { + if (!isValidEVMAddress(inputValue)) { + setError('Invalid EVM address.'); + return; + } + + setAddress(inputValue); + navigate(`/search/${filterParams.chainId}/${inputValue}`); + }, [inputValue, filterParams.chainId, navigate, setAddress]); const handleInputChange = (event: React.ChangeEvent) => { const value = event.target.value; @@ -75,30 +80,27 @@ const SearchBar: FC = ({ setError(null); } else if (value.length > 0) { setError('Invalid EVM address. Must start with 0x and be 42 characters.'); + } else { + setError(null); } }; - const handleSelectChange = (event: SelectChangeEvent) => { - const chainId = Number(event.target.value); - setSelectValue(chainId); + const handleSelectChange = (event: SelectChangeEvent) => { + setChainId(Number(event.target.value)); }; const handleClearClick = () => { setInputValue(''); + setError(null); }; const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); - - if (!isValidEVMAddress(inputValue)) { - return; - } - - if (inputValue && !!inputValue.length) { - navigateToAddress(); - } + navigateToAddress(); }; + if (isLoading) return ; + const renderEmptyValue = ( Network ); @@ -106,12 +108,15 @@ const SearchBar: FC = ({ const renderSelectedValue = ( n.id === selectValue)?.id || -1} + chainId={ + filteredNetworks.find((n) => n.id === filterParams.chainId)?.id || -1 + } />
- {mobile.isMobile || !selectValue + {mobile.isMobile || filterParams.chainId === -1 ? null - : getNetwork(Number(selectValue))?.name || ''} + : filteredNetworks.find((n) => n.id === filterParams.chainId)?.name || + ''}
); @@ -126,6 +131,7 @@ const SearchBar: FC = ({ onFocus={() => setFocus(true)} onBlur={() => setFocus(false)} error={!!error} + helperText={error} fullWidth sx={muiTextFieldSx(mobile)} InputProps={{ @@ -137,20 +143,22 @@ const SearchBar: FC = ({ position="start" sx={startAdornmentInputAdornmentSx} > - - value={selectValue} + + value={filterParams.chainId} displayEmpty sx={muiSelectSx(mobile)} onChange={handleSelectChange} renderValue={() => - selectValue === null ? renderEmptyValue : renderSelectedValue + filterParams.chainId === -1 + ? renderEmptyValue + : renderSelectedValue } > - {networks.map((network) => ( + {filteredNetworks.map((network) => ( diff --git a/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/SelectNetwork.tsx b/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/SelectNetwork.tsx index 02e6739ff2..172dceb2c1 100644 --- a/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/SelectNetwork.tsx +++ b/packages/apps/dashboard/ui-2024/src/features/Leaderboard/components/SelectNetwork.tsx @@ -4,12 +4,11 @@ import InputLabel from '@mui/material/InputLabel'; import MenuItem from '@mui/material/MenuItem'; import Box from '@mui/material/Box'; import HumanIcon from '@components/Icons/HumanIcon'; -import { - leaderboardSearchSelectConfig, - useLeaderboardSearch, -} from '@utils/hooks/use-leaderboard-search'; +import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; +import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; import { useBreakPoints } from '@utils/hooks/use-is-mobile'; import { NetworkIcon } from '@components/NetworkIcon'; +import CircularProgress from '@mui/material/CircularProgress'; export const SelectNetwork = () => { const { @@ -17,17 +16,29 @@ export const SelectNetwork = () => { filterParams: { chainId }, } = useLeaderboardSearch(); + const { filteredNetworks, isLoading } = useFilteredNetworks(); const { mobile: { isMobile }, } = useBreakPoints(); const handleChange = (event: SelectChangeEvent) => { - const value = event.target.value; - if (typeof value === 'number') { - setChainId(value); - } + const value = Number(event.target.value); + setChainId(value); }; + if (isLoading) { + return ( + + + + ); + } + return ( { label="By Network" onChange={handleChange} > - {leaderboardSearchSelectConfig.map((selectItem) => { - if ('allNetworksId' in selectItem) { - return ( - - - All Networks - - ); - } - - return ( - - - - - - {selectItem.name} - - ); - })} + + + All Networks + + {filteredNetworks.map((network) => ( + + + + + {network.name} + + ))} ); }; + +export default SelectNetwork; diff --git a/packages/apps/dashboard/ui-2024/src/services/api-paths.ts b/packages/apps/dashboard/ui-2024/src/services/api-paths.ts index 0e767181bb..ac217214fe 100644 --- a/packages/apps/dashboard/ui-2024/src/services/api-paths.ts +++ b/packages/apps/dashboard/ui-2024/src/services/api-paths.ts @@ -29,4 +29,7 @@ export const apiPaths = { escrowDetails: { path: '/details/escrows', }, + enabledChains: { + path: '/networks/operating', + }, } as const; diff --git a/packages/apps/dashboard/ui-2024/src/utils/hooks/use-filtered-networks.ts b/packages/apps/dashboard/ui-2024/src/utils/hooks/use-filtered-networks.ts new file mode 100644 index 0000000000..144efb7a17 --- /dev/null +++ b/packages/apps/dashboard/ui-2024/src/utils/hooks/use-filtered-networks.ts @@ -0,0 +1,27 @@ +import { useQuery } from '@tanstack/react-query'; +import { z } from 'zod'; +import { networks as allNetworks } from '@utils/config/networks'; +import { httpService } from '@services/http-service'; +import { apiPaths } from '@services/api-paths'; + +const enabledChainsSchema = z.array(z.number()); + +export const useFilteredNetworks = () => { + const { + data: enabledChains, + isLoading, + error, + } = useQuery({ + queryKey: ['enabledChains'], + queryFn: async () => { + const response = await httpService.get(apiPaths.enabledChains.path); + return enabledChainsSchema.parse(response.data); + }, + }); + + const filteredNetworks = enabledChains + ? allNetworks.filter((network) => enabledChains.includes(network.id)) + : []; + + return { filteredNetworks, isLoading, error }; +}; diff --git a/packages/apps/dashboard/ui-2024/src/utils/hooks/use-leaderboard-search.ts b/packages/apps/dashboard/ui-2024/src/utils/hooks/use-leaderboard-search.ts index 792c2a1c77..f470ac22b9 100644 --- a/packages/apps/dashboard/ui-2024/src/utils/hooks/use-leaderboard-search.ts +++ b/packages/apps/dashboard/ui-2024/src/utils/hooks/use-leaderboard-search.ts @@ -1,11 +1,4 @@ -import { networks } from '@utils/config/networks'; import { create } from 'zustand'; -import type { Chain } from 'viem/chains'; - -export const leaderboardSearchSelectConfig: ( - | Chain - | { name: 'All Networks'; allNetworksId: -1 } -)[] = [{ name: 'All Networks', allNetworksId: -1 }, ...networks]; export interface LeaderboardSearchStore { filterParams: { diff --git a/packages/apps/dashboard/ui-2024/src/utils/hooks/use-wallet-search.ts b/packages/apps/dashboard/ui-2024/src/utils/hooks/use-wallet-search.ts index fcefb87180..6ff0ec5092 100644 --- a/packages/apps/dashboard/ui-2024/src/utils/hooks/use-wallet-search.ts +++ b/packages/apps/dashboard/ui-2024/src/utils/hooks/use-wallet-search.ts @@ -1,4 +1,3 @@ -import { networks } from '../config/networks'; import { create } from 'zustand'; export interface WalletSearchStore { @@ -13,7 +12,7 @@ export interface WalletSearchStore { export const useWalletSearch = create((set) => ({ filterParams: { address: '', - chainId: networks[0].id, + chainId: -1, }, setAddress: (address) => { set((state) => ({ From 1e87ef741d8582da18568307b835cb0153eeb1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:46:46 +0100 Subject: [PATCH 08/28] [Reputation Oracle] refactor: error handling for webhook module (#2968) --- .../server/src/common/constants/errors.ts | 13 -------- .../src/modules/auth/auth.controller.ts | 1 - .../escrow-completion.service.ts | 8 ++--- .../webhook/webhook-incoming.service.spec.ts | 11 +++---- .../webhook/webhook-incoming.service.ts | 26 +++++++-------- .../webhook/webhook-outgoing.service.spec.ts | 18 +++++----- .../webhook/webhook-outgoing.service.ts | 24 ++++++++------ .../src/modules/webhook/webhook.controller.ts | 11 ++++++- .../modules/webhook/webhook.error.filter.ts | 33 +++++++++++++++++++ .../src/modules/webhook/webhook.error.ts | 27 +++++++++++++++ 10 files changed, 114 insertions(+), 58 deletions(-) create mode 100644 packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.filter.ts create mode 100644 packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.ts diff --git a/packages/apps/reputation-oracle/server/src/common/constants/errors.ts b/packages/apps/reputation-oracle/server/src/common/constants/errors.ts index 3b1e6437de..ff28c51ade 100644 --- a/packages/apps/reputation-oracle/server/src/common/constants/errors.ts +++ b/packages/apps/reputation-oracle/server/src/common/constants/errors.ts @@ -1,16 +1,3 @@ -/** - * Represents error messages related to webhook. - */ -export enum ErrorWebhook { - NotFound = 'Webhook not found', - UrlNotFound = 'Webhook url not found', - NotCreated = 'Webhook has not been created', - InvalidEventType = 'Invalid event type', - NotSent = 'Webhook was not sent', - PendingProcessingFailed = 'Failed to process pending webhook', - PaidProcessingFailed = 'Failed to process paid webhook', -} - /** * Represents error messages related to escrow completion. */ diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts index 08bb5a58d9..9fa0ba1a90 100644 --- a/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.controller.ts @@ -15,7 +15,6 @@ import { UseGuards, UseInterceptors, Logger, - Ip, UseFilters, } from '@nestjs/common'; import { Public } from '../../common/decorators'; diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts index f251bf0024..d82b4dc8d5 100644 --- a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts @@ -17,10 +17,7 @@ import { WebhookIncomingService } from '../webhook/webhook-incoming.service'; import { PayoutService } from '../payout/payout.service'; import { ReputationService } from '../reputation/reputation.service'; import { Web3Service } from '../web3/web3.service'; -import { - ErrorEscrowCompletion, - ErrorWebhook, -} from '../../common/constants/errors'; +import { ErrorEscrowCompletion } from '../../common/constants/errors'; import { ControlledError } from '../../common/errors/controlled'; import { WebhookOutgoingService } from '../webhook/webhook-outgoing.service'; import { isDuplicatedError } from '../../common/utils/database'; @@ -206,7 +203,8 @@ export class EscrowCompletionService { for (const url of callbackUrls) { if (!url) { throw new ControlledError( - ErrorWebhook.UrlNotFound, + // This is a temporary solution during the refactoring phase. + 'Webhook url not found', HttpStatus.NOT_FOUND, ); } diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts index 3cf74c1e8a..a6e5238989 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts @@ -16,11 +16,8 @@ import { WebhookOutgoingRepository } from './webhook-outgoing.repository'; import { WebhookIncomingService } from './webhook-incoming.service'; import { WebhookIncomingEntity } from './webhook-incoming.entity'; import { IncomingWebhookDto } from './webhook.dto'; -import { ErrorWebhook } from '../../common/constants/errors'; -import { HttpStatus } from '@nestjs/common'; import { Web3ConfigService } from '../../common/config/web3-config.service'; import { ServerConfigService } from '../../common/config/server-config.service'; -import { ControlledError } from '../../common/errors/controlled'; import { ReputationService } from '../reputation/reputation.service'; import { EscrowCompletionRepository } from '../escrow-completion/escrow-completion.repository'; import { EscrowCompletionService } from '../escrow-completion/escrow-completion.service'; @@ -33,6 +30,7 @@ import { ReputationRepository } from '../reputation/reputation.repository'; import { ReputationConfigService } from '../../common/config/reputation-config.service'; import { S3ConfigService } from '../../common/config/s3-config.service'; import { PGPConfigService } from '../../common/config/pgp-config.service'; +import { IncomingWebhookError, WebhookErrorMessage } from './webhook.error'; describe('WebhookIncomingService', () => { let webhookIncomingService: WebhookIncomingService, @@ -167,9 +165,10 @@ describe('WebhookIncomingService', () => { await expect( webhookIncomingService.createIncomingWebhook(invalidDto), ).rejects.toThrow( - new ControlledError( - ErrorWebhook.InvalidEventType, - HttpStatus.BAD_REQUEST, + new IncomingWebhookError( + WebhookErrorMessage.INVALID_EVENT_TYPE, + invalidDto.chainId, + invalidDto.escrowAddress, ), ); }); diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.ts index 4923841f39..d0a51e75c6 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.ts @@ -1,18 +1,17 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ +import { Injectable, Logger } from '@nestjs/common'; import { v4 as uuidv4 } from 'uuid'; -import { HttpStatus, Injectable, Logger } from '@nestjs/common'; -import { IncomingWebhookDto } from './webhook.dto'; -import { ErrorWebhook } from '../../common/constants/errors'; -import { EventType, WebhookIncomingStatus } from '../../common/enums'; -import { BACKOFF_INTERVAL_SECONDS } from '../../common/constants'; import { ServerConfigService } from '../../common/config/server-config.service'; import { Web3ConfigService } from '../../common/config/web3-config.service'; -import { ControlledError } from '../../common/errors/controlled'; -import { WebhookIncomingEntity } from './webhook-incoming.entity'; -import { WebhookIncomingRepository } from './webhook-incoming.repository'; +import { BACKOFF_INTERVAL_SECONDS } from '../../common/constants'; +import { EventType, WebhookIncomingStatus } from '../../common/enums'; import { calculateExponentialBackoffMs } from '../../common/utils/backoff'; -import { EscrowCompletionService } from '../escrow-completion/escrow-completion.service'; import { isDuplicatedError } from '../../common/utils/database'; +import { EscrowCompletionService } from '../escrow-completion/escrow-completion.service'; +import { WebhookIncomingEntity } from './webhook-incoming.entity'; +import { WebhookIncomingRepository } from './webhook-incoming.repository'; +import { IncomingWebhookDto } from './webhook.dto'; +import { IncomingWebhookError, WebhookErrorMessage } from './webhook.error'; @Injectable() export class WebhookIncomingService { @@ -33,9 +32,10 @@ export class WebhookIncomingService { */ public async createIncomingWebhook(dto: IncomingWebhookDto): Promise { if (dto.eventType !== EventType.JOB_COMPLETED) { - throw new ControlledError( - ErrorWebhook.InvalidEventType, - HttpStatus.BAD_REQUEST, + throw new IncomingWebhookError( + WebhookErrorMessage.INVALID_EVENT_TYPE, + dto.chainId, + dto.escrowAddress, ); } @@ -92,7 +92,7 @@ export class WebhookIncomingService { await this.webhookIncomingRepository.updateOne(webhookEntity); } catch (err) { const errorId = uuidv4(); - const failureDetail = `${ErrorWebhook.PendingProcessingFailed} (Error ID: ${errorId})`; + const failureDetail = `${WebhookErrorMessage.PENDING_PROCESSING_FAILED} (Error ID: ${errorId})`; if (isDuplicatedError(err)) { // Handle duplicated error: log and mark as completed diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.spec.ts index a60915f8de..4e14fc93c9 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.spec.ts @@ -19,14 +19,13 @@ import { Web3Service } from '../web3/web3.service'; import { WebhookOutgoingRepository } from './webhook-outgoing.repository'; import { WebhookOutgoingService } from './webhook-outgoing.service'; import { WebhookOutgoingEntity } from './webhook-outgoing.entity'; -import { ErrorWebhook } from '../../common/constants/errors'; import { of } from 'rxjs'; import { HEADER_SIGNATURE_KEY } from '../../common/constants'; import { signMessage } from '../../common/utils/signature'; import { HttpStatus } from '@nestjs/common'; import { Web3ConfigService } from '../../common/config/web3-config.service'; import { ServerConfigService } from '../../common/config/server-config.service'; -import { ControlledError } from '../../common/errors/controlled'; +import { OutgoingWebhookError, WebhookErrorMessage } from './webhook.error'; describe('WebhookOutgoingService', () => { let webhookOutgoingService: WebhookOutgoingService, @@ -143,6 +142,11 @@ describe('WebhookOutgoingService', () => { escrowAddress: MOCK_ADDRESS, eventType: EventType.ESCROW_COMPLETED, }; + const webhook: any = { + hash: 'test', + url: MOCK_WEBHOOK_URL, + payload, + }; it('should successfully send a webhook', async () => { jest.spyOn(httpService as any, 'post').mockImplementation(() => { @@ -150,9 +154,7 @@ describe('WebhookOutgoingService', () => { status: HttpStatus.CREATED, }); }); - expect( - await webhookOutgoingService.sendWebhook(MOCK_WEBHOOK_URL, payload), - ).toBe(undefined); + expect(await webhookOutgoingService.sendWebhook(webhook)).toBe(undefined); const expectedBody = { chain_id: payload.chainId, @@ -177,10 +179,8 @@ describe('WebhookOutgoingService', () => { jest.spyOn(httpService as any, 'post').mockImplementation(() => { return of({}); }); - await expect( - webhookOutgoingService.sendWebhook(MOCK_WEBHOOK_URL, payload), - ).rejects.toThrow( - new ControlledError(ErrorWebhook.NotSent, HttpStatus.BAD_REQUEST), + await expect(webhookOutgoingService.sendWebhook(webhook)).rejects.toThrow( + new OutgoingWebhookError(WebhookErrorMessage.NOT_SENT, webhook.hash), ); }); }); diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.ts index 2e5a956f68..7649d8d996 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.service.ts @@ -3,7 +3,6 @@ import { v4 as uuidv4 } from 'uuid'; import * as crypto from 'crypto'; import stringify from 'json-stable-stringify'; import { HttpStatus, Injectable, Logger } from '@nestjs/common'; -import { ErrorWebhook } from '../../common/constants/errors'; import { WebhookOutgoingStatus } from '../../common/enums'; import { firstValueFrom } from 'rxjs'; import { signMessage } from '../../common/utils/signature'; @@ -15,10 +14,10 @@ import { HttpService } from '@nestjs/axios'; import { CaseConverter } from '../../common/utils/case-converter'; import { ServerConfigService } from '../../common/config/server-config.service'; import { Web3ConfigService } from '../../common/config/web3-config.service'; -import { ControlledError } from '../../common/errors/controlled'; import { WebhookOutgoingEntity } from './webhook-outgoing.entity'; import { WebhookOutgoingRepository } from './webhook-outgoing.repository'; import { calculateExponentialBackoffMs } from '../../common/utils/backoff'; +import { OutgoingWebhookError, WebhookErrorMessage } from './webhook.error'; @Injectable() export class WebhookOutgoingService { @@ -90,20 +89,27 @@ export class WebhookOutgoingService { * @param {object} payload - The data payload to send. * @throws {ControlledError} If the webhook request fails. */ - public async sendWebhook(url: string, payload: object): Promise { - const snake_case_body = CaseConverter.transformToSnakeCase(payload); + public async sendWebhook( + outgoingWebhook: WebhookOutgoingEntity, + ): Promise { + const snake_case_body = CaseConverter.transformToSnakeCase( + outgoingWebhook.payload, + ); const signedBody = await signMessage( snake_case_body, this.web3ConfigService.privateKey, ); const { status } = await firstValueFrom( - await this.httpService.post(url, snake_case_body, { + await this.httpService.post(outgoingWebhook.url, snake_case_body, { headers: { [HEADER_SIGNATURE_KEY]: signedBody }, }), ); if (status !== HttpStatus.CREATED) { - throw new ControlledError(ErrorWebhook.NotSent, HttpStatus.NOT_FOUND); + throw new OutgoingWebhookError( + WebhookErrorMessage.NOT_SENT, + outgoingWebhook.hash, + ); } } @@ -114,12 +120,10 @@ export class WebhookOutgoingService { for (const webhookEntity of webhookEntities) { try { - const { url, payload } = webhookEntity; - - await this.sendWebhook(url, payload); + await this.sendWebhook(webhookEntity); } catch (err) { const errorId = uuidv4(); - const failureDetail = `${ErrorWebhook.PendingProcessingFailed} (Error ID: ${errorId})`; + const failureDetail = `${WebhookErrorMessage.PENDING_PROCESSING_FAILED} (Error ID: ${errorId})`; this.logger.error( `Error processing pending outgoing webhook. Error ID: ${errorId}, Webhook ID: ${webhookEntity.id}, Reason: ${failureDetail}, Message: ${err.message}`, ); diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.controller.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.controller.ts index be74f93adf..b9962fc363 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.controller.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.controller.ts @@ -1,4 +1,11 @@ -import { Body, Controller, Headers, Post, UseGuards } from '@nestjs/common'; +import { + Body, + Controller, + Headers, + Post, + UseFilters, + UseGuards, +} from '@nestjs/common'; import { ApiTags, ApiOperation, @@ -12,10 +19,12 @@ import { Public } from '../../common/decorators'; import { WebhookIncomingService } from './webhook-incoming.service'; import { AuthSignatureRole } from '../../common/enums/role'; import { IncomingWebhookDto } from './webhook.dto'; +import { IncomingWebhookErrorFilter } from './webhook.error.filter'; @Public() @ApiTags('Webhook') @Controller('/webhook') +@UseFilters(IncomingWebhookErrorFilter) export class WebhookController { constructor( private readonly webhookIncomingService: WebhookIncomingService, diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.filter.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.filter.ts new file mode 100644 index 0000000000..6bf097861d --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.filter.ts @@ -0,0 +1,33 @@ +import { + ExceptionFilter, + Catch, + ArgumentsHost, + HttpStatus, + Logger, +} from '@nestjs/common'; +import { Request, Response } from 'express'; + +import { IncomingWebhookError } from './webhook.error'; + +@Catch(IncomingWebhookError) +export class IncomingWebhookErrorFilter implements ExceptionFilter { + private logger = new Logger(IncomingWebhookErrorFilter.name); + catch(exception: IncomingWebhookError, host: ArgumentsHost) { + const ctx = host.switchToHttp(); + const response = ctx.getResponse(); + const request = ctx.getRequest(); + const status = HttpStatus.BAD_REQUEST; + + this.logger.error( + exception.message, + exception.stack, + `${exception.chainId} - ${exception.address}`, + ); + + return response.status(status).json({ + message: exception.message, + timestamp: new Date().toISOString(), + path: request.url, + }); + } +} diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.ts new file mode 100644 index 0000000000..4e19ec09b3 --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook.error.ts @@ -0,0 +1,27 @@ +import { ChainId } from '@human-protocol/sdk'; +import { BaseError } from '../../common/errors/base'; + +export enum WebhookErrorMessage { + URL_NOT_FOUND = 'Webhook url not found', + INVALID_EVENT_TYPE = 'Invalid event type', + NOT_SENT = 'Webhook was not sent', + PENDING_PROCESSING_FAILED = 'Failed to process pending webhook', +} + +export class IncomingWebhookError extends BaseError { + chainId: ChainId; + address: string; + constructor(message: WebhookErrorMessage, chainId: ChainId, address: string) { + super(message); + this.chainId = chainId; + this.address = address; + } +} + +export class OutgoingWebhookError extends BaseError { + hash: string; + constructor(message: WebhookErrorMessage, hash: string) { + super(message); + this.hash = hash; + } +} From 7256ef5de2d09bb84988b026924263ba376cb60a Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Thu, 9 Jan 2025 15:12:30 +0300 Subject: [PATCH 09/28] [Reputation Oracle] feat: add support for batched payouts (#2946) --- ...human_protocol_sdk.escrow.escrow_client.md | 110 +++++- docs/sdk/python/human_protocol_sdk.escrow.md | 2 + .../base/classes/BaseEthersClient.md | 6 +- .../encryption/classes/Encryption.md | 10 +- .../encryption/classes/EncryptionUtils.md | 10 +- .../typescript/enums/enumerations/ChainId.md | 38 +- .../enums/enumerations/OrderDirection.md | 4 +- .../typescript/escrow/classes/EscrowClient.md | 135 +++++-- .../typescript/escrow/classes/EscrowUtils.md | 6 +- .../types/type-aliases/DailyEscrowData.md | 2 +- .../types/type-aliases/DailyHMTData.md | 2 +- .../types/type-aliases/DailyPaymentData.md | 2 +- .../types/type-aliases/DailyTaskData.md | 2 +- .../types/type-aliases/DailyWorkerData.md | 2 +- .../graphql/types/type-aliases/EscrowData.md | 2 +- .../types/type-aliases/EscrowStatistics.md | 2 +- .../type-aliases/EscrowStatisticsData.md | 2 +- .../types/type-aliases/EventDayData.md | 2 +- .../graphql/types/type-aliases/HMTHolder.md | 2 +- .../types/type-aliases/HMTHolderData.md | 2 +- .../types/type-aliases/HMTStatistics.md | 2 +- .../types/type-aliases/HMTStatisticsData.md | 2 +- .../graphql/types/type-aliases/IMData.md | 2 +- .../types/type-aliases/IMDataEntity.md | 2 +- .../graphql/types/type-aliases/KVStoreData.md | 2 +- .../types/type-aliases/PaymentStatistics.md | 2 +- .../graphql/types/type-aliases/PayoutData.md | 2 +- .../type-aliases/RewardAddedEventData.md | 2 +- .../graphql/types/type-aliases/StatusEvent.md | 2 +- .../types/type-aliases/TaskStatistics.md | 2 +- .../types/type-aliases/WorkerStatistics.md | 2 +- .../interfaces/interfaces/IEscrowConfig.md | 16 +- .../interfaces/interfaces/IEscrowsFilter.md | 24 +- .../interfaces/IHMTHoldersParams.md | 8 +- .../interfaces/interfaces/IKVStore.md | 4 +- .../interfaces/interfaces/IKeyPair.md | 8 +- .../interfaces/interfaces/ILeader.md | 40 +- .../interfaces/interfaces/ILeaderSubgraph.md | 38 +- .../interfaces/interfaces/ILeadersFilter.md | 4 +- .../interfaces/interfaces/IOperator.md | 12 +- .../interfaces/IOperatorSubgraph.md | 12 +- .../interfaces/interfaces/IPagination.md | 6 +- .../interfaces/interfaces/IPayoutFilter.md | 8 +- .../interfaces/IReputationNetwork.md | 6 +- .../interfaces/IReputationNetworkSubgraph.md | 6 +- .../interfaces/interfaces/IReward.md | 4 +- .../interfaces/IStatisticsFilter.md | 10 +- .../interfaces/interfaces/ITransaction.md | 22 +- .../interfaces/ITransactionsFilter.md | 20 +- .../interfaces/InternalTransaction.md | 14 +- .../kvstore/classes/KVStoreClient.md | 14 +- .../kvstore/classes/KVStoreUtils.md | 8 +- .../operator/classes/OperatorUtils.md | 8 +- .../staking/classes/StakingClient.md | 24 +- .../statistics/classes/StatisticsClient.md | 18 +- .../storage/classes/StorageClient.md | 12 +- .../transaction/classes/TransactionUtils.md | 4 +- docs/sdk/typescript/types/README.md | 1 + .../types/enumerations/EscrowStatus.md | 12 +- .../types/type-aliases/EscrowCancel.md | 2 +- .../types/type-aliases/EscrowWithdraw.md | 2 +- .../types/type-aliases/NetworkData.md | 2 +- .../types/type-aliases/StorageCredentials.md | 2 +- .../types/type-aliases/StorageParams.md | 2 +- .../type-aliases/TransactionLikeWithNonce.md | 19 + .../types/type-aliases/UploadFile.md | 2 +- .../server/docker-compose.yml | 1 + .../reputation-oracle/server/package.json | 5 +- .../server/src/common/constants/errors.ts | 1 + .../server/src/common/dto/result.ts | 24 -- .../server/src/common/enums/cron-job.ts | 1 + .../server/src/common/enums/webhook.ts | 1 + .../server/src/database/database.module.ts | 2 + .../1736357403602-escrowAwaitingPayouts.ts | 73 ++++ .../server/src/modules/auth/auth.module.ts | 4 - .../modules/credentials/credential.module.ts | 9 +- .../src/modules/cron-job/cron-job.module.ts | 3 - .../modules/cron-job/cron-job.service.spec.ts | 47 +++ .../src/modules/cron-job/cron-job.service.ts | 37 +- .../escrow-completion.module.ts | 12 +- .../escrow-completion.service.spec.ts | 343 ++++++++++++++--- .../escrow-completion.service.ts | 172 ++++++++- .../escrow-payouts-batch.entity.ts | 33 ++ .../escrow-payouts-batch.repository.ts | 22 ++ .../server/src/modules/kyc/kyc.module.ts | 10 +- .../src/modules/payout/payout.interface.ts | 20 +- .../src/modules/payout/payout.service.spec.ts | 114 +++--- .../src/modules/payout/payout.service.ts | 101 +++-- .../qualification/qualification.module.ts | 4 +- .../modules/reputation/reputation.module.ts | 10 +- .../server/src/modules/user/user.module.ts | 10 +- .../webhook/webhook-incoming.module.ts | 10 +- .../webhook/webhook-incoming.service.spec.ts | 5 + .../webhook/webhook-outgoing.module.ts | 9 +- .../server/test/constants.ts | 2 + .../sdk/python/human-protocol-sdk/example.py | 78 +++- .../human_protocol_sdk/constants.py | 3 + .../escrow/escrow_client.py | 216 +++++++++-- .../escrow/test_escrow_client.py | 214 +++++++++-- .../human-protocol-sdk/example/encrypt.ts | 1 + .../example/transactions.ts | 1 + .../human-protocol-sdk/src/constants.ts | 2 + .../human-protocol-sdk/src/decorators.ts | 2 +- .../human-protocol-sdk/src/error.ts | 5 + .../human-protocol-sdk/src/escrow.ts | 228 +++++++++--- .../human-protocol-sdk/src/types.ts | 4 + .../test/encryption.test.ts | 2 +- .../human-protocol-sdk/test/escrow.test.ts | 344 +++++++++++++++++- .../test/statistics.test.ts | 2 +- yarn.lock | 31 +- 110 files changed, 2270 insertions(+), 707 deletions(-) create mode 100644 docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md create mode 100644 packages/apps/reputation-oracle/server/src/database/migrations/1736357403602-escrowAwaitingPayouts.ts create mode 100644 packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.entity.ts create mode 100644 packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.repository.ts diff --git a/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md b/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md index aa21abc1ef..677606eacf 100644 --- a/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md +++ b/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md @@ -148,7 +148,8 @@ Pays out the amounts specified to the workers and sets the URL of the final resu from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -248,7 +249,8 @@ Sets the status of an escrow to completed. from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -263,6 +265,78 @@ Sets the status of an escrow to completed. escrow_client.complete("0x62dD51230A30401C455c8398d06F85e4EaB6309f") ``` +#### create_bulk_payout_transaction(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, tx_options=None) + +Creates a prepared transaction for bulk payout without signing or sending it. + +* **Parameters:** + * **escrow_address** (`str`) – Address of the escrow + * **recipients** (`List`[`str`]) – Array of recipient addresses + * **amounts** (`List`[`Decimal`]) – Array of amounts the recipients will receive + * **final_results_url** (`str`) – Final results file url + * **final_results_hash** (`str`) – Final results file hash + * **txId** (`Decimal`) – Serial number of the bulks + * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters +* **Return type:** + `TxParams` +* **Returns:** + A dictionary containing the prepared transaction +* **Raises:** + [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters +* **Example:** + ```python + from eth_typing import URI + from web3 import Web3 + from web3.middleware import construct_sign_and_send_raw_middleware + from web3.providers.auto import load_provider_from_uri + + from human_protocol_sdk.escrow import EscrowClient + + def get_w3_with_priv_key(priv_key: str): + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) + gas_payer = w3.eth.account.from_key(priv_key) + w3.eth.default_account = gas_payer.address + w3.middleware_onion.add( + construct_sign_and_send_raw_middleware(gas_payer), + "construct_sign_and_send_raw_middleware", + ) + return (w3, gas_payer) + + (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') + escrow_client = EscrowClient(w3) + + recipients = [ + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92267' + ] + amounts = [ + Web3.to_wei(5, 'ether'), + Web3.to_wei(10, 'ether') + ] + results_url = 'http://localhost/results.json' + results_hash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079' + + transaction = escrow_client.create_bulk_payout_transaction( + "0x62dD51230A30401C455c8398d06F85e4EaB6309f", + recipients, + amounts, + results_url, + results_hash, + 1 + ) + + print(f"Transaction: {transaction}") + + signed_transaction = w3.eth.account.sign_transaction( + transaction, private_key) + tx_hash = w3.eth.send_raw_transaction( + signed_transaction.raw_transaction) + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + print(f"Transaction sent with hash: {tx_hash.hex()}") + print(f"Transaction receipt: {tx_receipt}") + ``` + #### create_escrow(token_address, trusted_handlers, job_requester_id, tx_options=None) Creates an escrow contract that uses the token passed to pay oracle fees and reward workers. @@ -288,7 +362,8 @@ Creates an escrow contract that uses the token passed to pay oracle fees and rew from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -313,6 +388,23 @@ Creates an escrow contract that uses the token passed to pay oracle fees and rew ) ``` +#### ensure_correct_bulk_payout_input(escrow_address, recipients, amounts, final_results_url, final_results_hash) + +Validates input parameters for bulk payout operations. + +* **Parameters:** + * **escrow_address** (`str`) – Address of the escrow + * **recipients** (`List`[`str`]) – Array of recipient addresses + * **amounts** (`List`[`Decimal`]) – Array of amounts the recipients will receive + * **final_results_url** (`str`) – Final results file url + * **final_results_hash** (`str`) – Final results file hash +* **Return type:** + `None` +* **Returns:** + None +* **Raises:** + [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If validation fails + #### fund(escrow_address, amount, tx_options=None) Adds funds to the escrow. @@ -337,7 +429,8 @@ Adds funds to the escrow. from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -350,7 +443,8 @@ Adds funds to the escrow. escrow_client = EscrowClient(w3) amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - escrow_client.fund("0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount) + escrow_client.fund( + "0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount) ``` #### get_balance(escrow_address) @@ -713,7 +807,8 @@ Sets up the parameters of the escrow. from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -764,7 +859,8 @@ Stores the results url. from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( diff --git a/docs/sdk/python/human_protocol_sdk.escrow.md b/docs/sdk/python/human_protocol_sdk.escrow.md index aa29ac1288..8ee3c93e5b 100644 --- a/docs/sdk/python/human_protocol_sdk.escrow.md +++ b/docs/sdk/python/human_protocol_sdk.escrow.md @@ -16,7 +16,9 @@ obtain information from both the contracts and subgraph. * [`EscrowClient.bulk_payout()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.bulk_payout) * [`EscrowClient.cancel()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.cancel) * [`EscrowClient.complete()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.complete) + * [`EscrowClient.create_bulk_payout_transaction()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.create_bulk_payout_transaction) * [`EscrowClient.create_escrow()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.create_escrow) + * [`EscrowClient.ensure_correct_bulk_payout_input()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.ensure_correct_bulk_payout_input) * [`EscrowClient.fund()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.fund) * [`EscrowClient.get_balance()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_balance) * [`EscrowClient.get_exchange_oracle_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_exchange_oracle_address) diff --git a/docs/sdk/typescript/base/classes/BaseEthersClient.md b/docs/sdk/typescript/base/classes/BaseEthersClient.md index 5c8aea4f73..ed9d552520 100644 --- a/docs/sdk/typescript/base/classes/BaseEthersClient.md +++ b/docs/sdk/typescript/base/classes/BaseEthersClient.md @@ -44,7 +44,7 @@ The network information required to connect to the contracts #### Defined in -[base.ts:20](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) +[base.ts:20](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) ## Properties @@ -54,7 +54,7 @@ The network information required to connect to the contracts #### Defined in -[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -64,4 +64,4 @@ The network information required to connect to the contracts #### Defined in -[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) diff --git a/docs/sdk/typescript/encryption/classes/Encryption.md b/docs/sdk/typescript/encryption/classes/Encryption.md index 4f001979e7..7375f8b168 100644 --- a/docs/sdk/typescript/encryption/classes/Encryption.md +++ b/docs/sdk/typescript/encryption/classes/Encryption.md @@ -67,7 +67,7 @@ The private key. #### Defined in -[encryption.ts:62](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L62) +[encryption.ts:62](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L62) ## Methods @@ -123,7 +123,7 @@ const resultMessage = await encription.decrypt('message'); #### Defined in -[encryption.ts:190](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L190) +[encryption.ts:190](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L190) *** @@ -161,7 +161,7 @@ const resultMessage = await encription.sign('message'); #### Defined in -[encryption.ts:247](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L247) +[encryption.ts:247](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L247) *** @@ -230,7 +230,7 @@ const resultMessage = await encription.signAndEncrypt('message', publicKeys); #### Defined in -[encryption.ts:138](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L138) +[encryption.ts:138](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L138) *** @@ -262,4 +262,4 @@ Optional: The passphrase for the private key. #### Defined in -[encryption.ts:73](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L73) +[encryption.ts:73](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L73) diff --git a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md index 87c09e196a..35c01a74fc 100644 --- a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md +++ b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md @@ -103,7 +103,7 @@ const result = await EncriptionUtils.encrypt('message', publicKeys); #### Defined in -[encryption.ts:452](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L452) +[encryption.ts:452](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L452) *** @@ -164,7 +164,7 @@ const result = await EncriptionUtils.generateKeyPair(name, email, passphrase); #### Defined in -[encryption.ts:390](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L390) +[encryption.ts:390](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L390) *** @@ -198,7 +198,7 @@ const signedData = await EncriptionUtils.getSignedData('message'); #### Defined in -[encryption.ts:347](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L347) +[encryption.ts:347](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L347) *** @@ -248,7 +248,7 @@ if (isEncrypted) { #### Defined in -[encryption.ts:502](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L502) +[encryption.ts:502](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L502) *** @@ -300,4 +300,4 @@ const result = await EncriptionUtils.verify('message', publicKey); #### Defined in -[encryption.ts:314](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L314) +[encryption.ts:314](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L314) diff --git a/docs/sdk/typescript/enums/enumerations/ChainId.md b/docs/sdk/typescript/enums/enumerations/ChainId.md index 5581f1e887..3b345f6784 100644 --- a/docs/sdk/typescript/enums/enumerations/ChainId.md +++ b/docs/sdk/typescript/enums/enumerations/ChainId.md @@ -14,7 +14,7 @@ #### Defined in -[enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) +[enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) *** @@ -24,7 +24,7 @@ #### Defined in -[enums.ts:15](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L15) +[enums.ts:15](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L15) *** @@ -34,7 +34,7 @@ #### Defined in -[enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) +[enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) *** @@ -44,7 +44,7 @@ #### Defined in -[enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) +[enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) *** @@ -54,7 +54,7 @@ #### Defined in -[enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) +[enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) *** @@ -64,7 +64,7 @@ #### Defined in -[enums.ts:16](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L16) +[enums.ts:16](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L16) *** @@ -74,7 +74,7 @@ #### Defined in -[enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) +[enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) *** @@ -84,7 +84,7 @@ #### Defined in -[enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) +[enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) *** @@ -94,7 +94,7 @@ #### Defined in -[enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) +[enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) *** @@ -104,7 +104,7 @@ #### Defined in -[enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) +[enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) *** @@ -114,7 +114,7 @@ #### Defined in -[enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) +[enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) *** @@ -124,7 +124,7 @@ #### Defined in -[enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) +[enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) *** @@ -134,7 +134,7 @@ #### Defined in -[enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) +[enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) *** @@ -144,7 +144,7 @@ #### Defined in -[enums.ts:11](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L11) +[enums.ts:11](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L11) *** @@ -154,7 +154,7 @@ #### Defined in -[enums.ts:10](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L10) +[enums.ts:10](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L10) *** @@ -164,7 +164,7 @@ #### Defined in -[enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) +[enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) *** @@ -174,7 +174,7 @@ #### Defined in -[enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) +[enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) *** @@ -184,7 +184,7 @@ #### Defined in -[enums.ts:20](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L20) +[enums.ts:20](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L20) *** @@ -194,4 +194,4 @@ #### Defined in -[enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) +[enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) diff --git a/docs/sdk/typescript/enums/enumerations/OrderDirection.md b/docs/sdk/typescript/enums/enumerations/OrderDirection.md index 871fd34269..ff76084f2e 100644 --- a/docs/sdk/typescript/enums/enumerations/OrderDirection.md +++ b/docs/sdk/typescript/enums/enumerations/OrderDirection.md @@ -14,7 +14,7 @@ #### Defined in -[enums.ts:24](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L24) +[enums.ts:24](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L24) *** @@ -24,4 +24,4 @@ #### Defined in -[enums.ts:25](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L25) +[enums.ts:25](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L25) diff --git a/docs/sdk/typescript/escrow/classes/EscrowClient.md b/docs/sdk/typescript/escrow/classes/EscrowClient.md index dbaf2fb297..0dcde310fc 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowClient.md +++ b/docs/sdk/typescript/escrow/classes/EscrowClient.md @@ -110,7 +110,7 @@ The network information required to connect to the Escrow contract #### Defined in -[escrow.ts:136](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L136) +[escrow.ts:142](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L142) ## Properties @@ -124,7 +124,7 @@ The network information required to connect to the Escrow contract #### Defined in -[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -138,7 +138,7 @@ The network information required to connect to the Escrow contract #### Defined in -[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) ## Methods @@ -195,7 +195,7 @@ await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309 #### Defined in -[escrow.ts:802](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L802) +[escrow.ts:767](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L767) *** @@ -273,14 +273,14 @@ const escrowClient = await EscrowClient.build(signer); const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']; const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')]; const resultsUrl = 'http://localhost/results.json'; -const resultsHash'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'; +const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'; await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash); ``` #### Defined in -[escrow.ts:595](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L595) +[escrow.ts:601](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L601) *** @@ -330,7 +330,7 @@ await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); #### Defined in -[escrow.ts:716](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L716) +[escrow.ts:681](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L681) *** @@ -380,7 +380,90 @@ await escrowClient.complete('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); #### Defined in -[escrow.ts:536](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L536) +[escrow.ts:542](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L542) + +*** + +### createBulkPayoutTransaction() + +> **createBulkPayoutTransaction**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txOptions`?): `Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> + +Creates a prepared transaction for bulk payout without immediately sending it. + +#### Parameters + +##### escrowAddress + +`string` + +Escrow address to payout. + +##### recipients + +`string`[] + +Array of recipient addresses. + +##### amounts + +`bigint`[] + +Array of amounts the recipients will receive. + +##### finalResultsUrl + +`string` + +Final results file url. + +##### finalResultsHash + +`string` + +Final results file hash. + +##### txOptions? + +`Overrides` = `{}` + +Additional transaction parameters (optional, defaults to an empty object). + +#### Returns + +`Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> + +Returns object with raw transaction and signed transaction hash + +**Code example** + +> Only Reputation Oracle or a trusted handler can call it. + +```ts +import { ethers, Wallet, providers } from 'ethers'; +import { EscrowClient } from '@human-protocol/sdk'; + +const rpcUrl = 'YOUR_RPC_URL'; +const privateKey = 'YOUR_PRIVATE_KEY' + +const provider = new providers.JsonRpcProvider(rpcUrl); +const signer = new Wallet(privateKey, provider); +const escrowClient = await EscrowClient.build(signer); + +const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']; +const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')]; +const resultsUrl = 'http://localhost/results.json'; +const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'; + +const rawTransaction = await escrowClient.createBulkPayoutTransaction('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash); +console.log('Raw transaction:', rawTransaction); + +const signedTransaction = await signer.signTransaction(rawTransaction); +console.log('Tx hash:', ethers.keccak256(signedTransaction)); +(await signer.sendTransaction(rawTransaction)).wait(); + +#### Defined in + +[escrow.ts:934](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L934) *** @@ -445,7 +528,7 @@ const escrowAddress = await escrowClient.createEscrow(tokenAddress, trustedHandl #### Defined in -[escrow.ts:216](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L216) +[escrow.ts:222](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L222) *** @@ -500,7 +583,7 @@ await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount); #### Defined in -[escrow.ts:407](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L407) +[escrow.ts:413](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L413) *** @@ -540,7 +623,7 @@ const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e #### Defined in -[escrow.ts:950](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L950) +[escrow.ts:1076](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1076) *** @@ -580,7 +663,7 @@ const oracleAddress = await escrowClient.getExchangeOracleAddress('0x62dD51230A3 #### Defined in -[escrow.ts:1336](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1336) +[escrow.ts:1462](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1462) *** @@ -620,7 +703,7 @@ const factoryAddress = await escrowClient.getFactoryAddress('0x62dD51230A30401C4 #### Defined in -[escrow.ts:1374](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1374) +[escrow.ts:1500](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1500) *** @@ -660,7 +743,7 @@ const intemediateResultsUrl = await escrowClient.getIntermediateResultsUrl('0x62 #### Defined in -[escrow.ts:1108](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1108) +[escrow.ts:1234](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1234) *** @@ -700,7 +783,7 @@ const jobLauncherAddress = await escrowClient.getJobLauncherAddress('0x62dD51230 #### Defined in -[escrow.ts:1260](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1260) +[escrow.ts:1386](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1386) *** @@ -740,7 +823,7 @@ const manifestHash = await escrowClient.getManifestHash('0x62dD51230A30401C455c8 #### Defined in -[escrow.ts:994](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L994) +[escrow.ts:1120](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1120) *** @@ -780,7 +863,7 @@ const manifestUrl = await escrowClient.getManifestUrl('0x62dD51230A30401C455c839 #### Defined in -[escrow.ts:1032](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1032) +[escrow.ts:1158](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1158) *** @@ -820,7 +903,7 @@ const oracleAddress = await escrowClient.getRecordingOracleAddress('0x62dD51230A #### Defined in -[escrow.ts:1222](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1222) +[escrow.ts:1348](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1348) *** @@ -860,7 +943,7 @@ const oracleAddress = await escrowClient.getReputationOracleAddress('0x62dD51230 #### Defined in -[escrow.ts:1298](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1298) +[escrow.ts:1424](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1424) *** @@ -900,7 +983,7 @@ const resultsUrl = await escrowClient.getResultsUrl('0x62dD51230A30401C455c8398d #### Defined in -[escrow.ts:1070](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1070) +[escrow.ts:1196](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1196) *** @@ -940,7 +1023,7 @@ const status = await escrowClient.getStatus('0x62dD51230A30401C455c8398d06F85e4E #### Defined in -[escrow.ts:1184](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1184) +[escrow.ts:1310](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1310) *** @@ -980,7 +1063,7 @@ const tokenAddress = await escrowClient.getTokenAddress('0x62dD51230A30401C455c8 #### Defined in -[escrow.ts:1146](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1146) +[escrow.ts:1272](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1272) *** @@ -1047,7 +1130,7 @@ await escrowClient.setup(escrowAddress, escrowConfig); #### Defined in -[escrow.ts:297](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L297) +[escrow.ts:303](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L303) *** @@ -1109,7 +1192,7 @@ await storeResults.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'h #### Defined in -[escrow.ts:472](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L472) +[escrow.ts:478](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L478) *** @@ -1168,7 +1251,7 @@ await escrowClient.withdraw( #### Defined in -[escrow.ts:868](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L868) +[escrow.ts:833](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L833) *** @@ -1202,4 +1285,4 @@ Thrown if the network's chainId is not supported #### Defined in -[escrow.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L154) +[escrow.ts:160](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L160) diff --git a/docs/sdk/typescript/escrow/classes/EscrowUtils.md b/docs/sdk/typescript/escrow/classes/EscrowUtils.md index 88fbaaeafd..3b32d2d588 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowUtils.md +++ b/docs/sdk/typescript/escrow/classes/EscrowUtils.md @@ -133,7 +133,7 @@ const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890 #### Defined in -[escrow.ts:1656](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1656) +[escrow.ts:1782](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1782) *** @@ -256,7 +256,7 @@ const escrowDatas = await EscrowUtils.getEscrows(filters); #### Defined in -[escrow.ts:1530](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1530) +[escrow.ts:1656](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1656) *** @@ -385,4 +385,4 @@ import { ChainId, EscrowUtils, EscrowStatus } from '@human-protocol/sdk'; #### Defined in -[escrow.ts:1754](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1754) +[escrow.ts:1880](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1880) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md index 43f9c26d3d..a8b308e520 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md @@ -36,4 +36,4 @@ ## Defined in -[graphql/types.ts:83](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L83) +[graphql/types.ts:83](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L83) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md index a6829736ec..1864e3bd1a 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md @@ -32,4 +32,4 @@ ## Defined in -[graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) +[graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md index 58b2ee2db4..1a113588f4 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md @@ -28,4 +28,4 @@ ## Defined in -[graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) +[graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md index 251d9d7115..044ad14261 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md @@ -24,4 +24,4 @@ ## Defined in -[graphql/types.ts:148](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L148) +[graphql/types.ts:148](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L148) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md index afbcc9f9e8..dfce3ff950 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md @@ -20,4 +20,4 @@ ## Defined in -[graphql/types.ts:97](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L97) +[graphql/types.ts:97](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L97) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md index 8ec17d1f52..a67523ec8f 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md @@ -88,4 +88,4 @@ ## Defined in -[graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) +[graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md index 01132636c1..a6136729b8 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md @@ -20,4 +20,4 @@ ## Defined in -[graphql/types.ts:92](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L92) +[graphql/types.ts:92](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L92) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md index 8ea7e3d692..5f9d7392ff 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md @@ -52,4 +52,4 @@ ## Defined in -[graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) +[graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md index 4a1822bd86..2548062b7c 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md @@ -84,4 +84,4 @@ ## Defined in -[graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) +[graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md index efc6ec65ea..c20944b190 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md @@ -20,4 +20,4 @@ ## Defined in -[graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) +[graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md index bf6ec36712..4a97841995 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md @@ -20,4 +20,4 @@ ## Defined in -[graphql/types.ts:117](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L117) +[graphql/types.ts:117](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L117) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md index 8b7be95e98..b2f68da9fb 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md @@ -24,4 +24,4 @@ ## Defined in -[graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) +[graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md index 0fff5c8c8a..eafa34f351 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md @@ -36,4 +36,4 @@ ## Defined in -[graphql/types.ts:33](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L33) +[graphql/types.ts:33](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L33) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md index 9c8eb7c020..c648994983 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md @@ -10,4 +10,4 @@ ## Defined in -[graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) +[graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md index b4a5fa2959..2fe8342cd3 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md @@ -20,4 +20,4 @@ ## Defined in -[graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) +[graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md index 95e4ff56ac..4aa57ff8c3 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md @@ -36,4 +36,4 @@ ## Defined in -[graphql/types.ts:165](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L165) +[graphql/types.ts:165](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L165) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md index 667f5a8eb1..0a925ad4d8 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md @@ -16,4 +16,4 @@ ## Defined in -[graphql/types.ts:113](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L113) +[graphql/types.ts:113](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L113) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md b/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md index b920f462ed..16fed71b89 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md @@ -32,4 +32,4 @@ ## Defined in -[graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) +[graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md index 8171093bcb..0ba4032124 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md @@ -28,4 +28,4 @@ ## Defined in -[graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) +[graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md index 821b77a2df..3646aa328d 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md @@ -28,4 +28,4 @@ ## Defined in -[graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) +[graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md index d6af185f10..dc6d0312c0 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md @@ -16,4 +16,4 @@ ## Defined in -[graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) +[graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md index e21126a847..18ade2b9fc 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md @@ -16,4 +16,4 @@ ## Defined in -[graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) +[graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md index 758b2f1289..f3ad8aedf8 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) +[interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) +[interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:87](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L87) +[interfaces.ts:87](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L87) *** @@ -44,7 +44,7 @@ #### Defined in -[interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) +[interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) *** @@ -54,7 +54,7 @@ #### Defined in -[interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) +[interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) *** @@ -64,7 +64,7 @@ #### Defined in -[interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) +[interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) *** @@ -74,7 +74,7 @@ #### Defined in -[interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) +[interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) *** @@ -84,4 +84,4 @@ #### Defined in -[interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) +[interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md index 424a2c0ef3..2db53256c8 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md @@ -18,7 +18,7 @@ #### Defined in -[interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) +[interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) *** @@ -28,7 +28,7 @@ #### Defined in -[interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) +[interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) *** @@ -42,7 +42,7 @@ #### Defined in -[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -52,7 +52,7 @@ #### Defined in -[interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) +[interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) *** @@ -62,7 +62,7 @@ #### Defined in -[interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) +[interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) *** @@ -72,7 +72,7 @@ #### Defined in -[interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) +[interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) *** @@ -86,7 +86,7 @@ #### Defined in -[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -96,7 +96,7 @@ #### Defined in -[interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) +[interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) *** @@ -106,7 +106,7 @@ #### Defined in -[interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) +[interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) *** @@ -120,7 +120,7 @@ #### Defined in -[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) *** @@ -130,7 +130,7 @@ #### Defined in -[interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) +[interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) *** @@ -140,4 +140,4 @@ #### Defined in -[interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) +[interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) diff --git a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md index e3b23ff093..9847eb3d30 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md +++ b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md @@ -18,7 +18,7 @@ #### Defined in -[interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) +[interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) *** @@ -32,7 +32,7 @@ #### Defined in -[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -46,7 +46,7 @@ #### Defined in -[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -60,4 +60,4 @@ #### Defined in -[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) diff --git a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md index 71a9267bd0..18de4ec332 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) +[interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) *** @@ -24,4 +24,4 @@ #### Defined in -[interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) +[interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) diff --git a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md index a3a532a35c..44888277b5 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) +[interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) +[interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) +[interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) *** @@ -44,4 +44,4 @@ #### Defined in -[interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) +[interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) diff --git a/docs/sdk/typescript/interfaces/interfaces/ILeader.md b/docs/sdk/typescript/interfaces/interfaces/ILeader.md index f980341d8f..7f7ccb58e1 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ILeader.md +++ b/docs/sdk/typescript/interfaces/interfaces/ILeader.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +[interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +[interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +[interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) *** @@ -44,7 +44,7 @@ #### Defined in -[interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +[interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) *** @@ -54,7 +54,7 @@ #### Defined in -[interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +[interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) *** @@ -64,7 +64,7 @@ #### Defined in -[interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +[interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) *** @@ -74,7 +74,7 @@ #### Defined in -[interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) +[interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) *** @@ -84,7 +84,7 @@ #### Defined in -[interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +[interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) *** @@ -94,7 +94,7 @@ #### Defined in -[interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +[interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) *** @@ -104,7 +104,7 @@ #### Defined in -[interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) +[interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) *** @@ -114,7 +114,7 @@ #### Defined in -[interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +[interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) *** @@ -124,7 +124,7 @@ #### Defined in -[interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +[interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) *** @@ -134,7 +134,7 @@ #### Defined in -[interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +[interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) *** @@ -144,7 +144,7 @@ #### Defined in -[interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +[interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) *** @@ -154,7 +154,7 @@ #### Defined in -[interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) +[interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) *** @@ -164,7 +164,7 @@ #### Defined in -[interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +[interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) *** @@ -174,7 +174,7 @@ #### Defined in -[interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +[interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) *** @@ -184,7 +184,7 @@ #### Defined in -[interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +[interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) *** @@ -194,7 +194,7 @@ #### Defined in -[interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +[interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) *** @@ -204,4 +204,4 @@ #### Defined in -[interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +[interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) diff --git a/docs/sdk/typescript/interfaces/interfaces/ILeaderSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/ILeaderSubgraph.md index 43146503cd..cd777aa716 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ILeaderSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/ILeaderSubgraph.md @@ -22,7 +22,7 @@ #### Defined in -[interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +[interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) *** @@ -36,7 +36,7 @@ #### Defined in -[interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +[interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) *** @@ -50,7 +50,7 @@ #### Defined in -[interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +[interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) *** @@ -64,7 +64,7 @@ #### Defined in -[interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +[interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) *** @@ -78,7 +78,7 @@ #### Defined in -[interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +[interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) *** @@ -92,7 +92,7 @@ #### Defined in -[interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +[interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) *** @@ -106,7 +106,7 @@ #### Defined in -[interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +[interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) *** @@ -120,7 +120,7 @@ #### Defined in -[interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +[interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) *** @@ -130,7 +130,7 @@ #### Defined in -[interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) +[interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) *** @@ -144,7 +144,7 @@ #### Defined in -[interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +[interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) *** @@ -158,7 +158,7 @@ #### Defined in -[interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +[interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) *** @@ -172,7 +172,7 @@ #### Defined in -[interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +[interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) *** @@ -186,7 +186,7 @@ #### Defined in -[interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +[interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) *** @@ -196,7 +196,7 @@ #### Defined in -[interfaces.ts:35](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L35) +[interfaces.ts:35](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L35) *** @@ -210,7 +210,7 @@ #### Defined in -[interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +[interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) *** @@ -224,7 +224,7 @@ #### Defined in -[interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +[interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) *** @@ -238,7 +238,7 @@ #### Defined in -[interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +[interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) *** @@ -252,7 +252,7 @@ #### Defined in -[interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +[interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) *** @@ -266,4 +266,4 @@ #### Defined in -[interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +[interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) diff --git a/docs/sdk/typescript/interfaces/interfaces/ILeadersFilter.md b/docs/sdk/typescript/interfaces/interfaces/ILeadersFilter.md index e81c0fd893..b673736343 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ILeadersFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/ILeadersFilter.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:39](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L39) +[interfaces.ts:39](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L39) *** @@ -24,4 +24,4 @@ #### Defined in -[interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) +[interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperator.md b/docs/sdk/typescript/interfaces/interfaces/IOperator.md index cc6a52985e..1b5e1729f9 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperator.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperator.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) +[interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:58](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L58) +[interfaces.ts:58](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L58) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:60](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L60) +[interfaces.ts:60](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L60) *** @@ -44,7 +44,7 @@ #### Defined in -[interfaces.ts:59](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L59) +[interfaces.ts:59](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L59) *** @@ -54,7 +54,7 @@ #### Defined in -[interfaces.ts:56](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L56) +[interfaces.ts:56](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L56) *** @@ -64,4 +64,4 @@ #### Defined in -[interfaces.ts:57](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L57) +[interfaces.ts:57](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L57) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md index 664a83421e..8a329bc24c 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md @@ -22,7 +22,7 @@ #### Defined in -[interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) +[interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) *** @@ -32,7 +32,7 @@ #### Defined in -[interfaces.ts:64](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L64) +[interfaces.ts:64](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L64) *** @@ -46,7 +46,7 @@ #### Defined in -[interfaces.ts:60](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L60) +[interfaces.ts:60](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L60) *** @@ -60,7 +60,7 @@ #### Defined in -[interfaces.ts:59](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L59) +[interfaces.ts:59](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L59) *** @@ -74,7 +74,7 @@ #### Defined in -[interfaces.ts:56](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L56) +[interfaces.ts:56](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L56) *** @@ -88,4 +88,4 @@ #### Defined in -[interfaces.ts:57](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L57) +[interfaces.ts:57](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L57) diff --git a/docs/sdk/typescript/interfaces/interfaces/IPagination.md b/docs/sdk/typescript/interfaces/interfaces/IPagination.md index 4ac1dc3c53..b3411ff390 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPagination.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPagination.md @@ -21,7 +21,7 @@ #### Defined in -[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -31,7 +31,7 @@ #### Defined in -[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -41,4 +41,4 @@ #### Defined in -[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) diff --git a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md index 10aa72eb68..bdc3950f05 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) +[interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) +[interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) +[interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) *** @@ -44,4 +44,4 @@ #### Defined in -[interfaces.ts:110](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L110) +[interfaces.ts:110](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L110) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md index a79cb7d264..30e0c48b3a 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:45](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L45) +[interfaces.ts:45](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L45) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) +[interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) *** @@ -34,4 +34,4 @@ #### Defined in -[interfaces.ts:46](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L46) +[interfaces.ts:46](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L46) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md index aee9378fb6..8e7b354cb0 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md @@ -22,7 +22,7 @@ #### Defined in -[interfaces.ts:45](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L45) +[interfaces.ts:45](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L45) *** @@ -36,7 +36,7 @@ #### Defined in -[interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) +[interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) *** @@ -46,4 +46,4 @@ #### Defined in -[interfaces.ts:51](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L51) +[interfaces.ts:51](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L51) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReward.md b/docs/sdk/typescript/interfaces/interfaces/IReward.md index 3744b69802..2ec1242bd5 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReward.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReward.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) +[interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) *** @@ -24,4 +24,4 @@ #### Defined in -[interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L5) +[interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L5) diff --git a/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md index ff896e3160..529ab1c620 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md @@ -22,7 +22,7 @@ #### Defined in -[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -32,7 +32,7 @@ #### Defined in -[interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) +[interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) *** @@ -46,7 +46,7 @@ #### Defined in -[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -60,7 +60,7 @@ #### Defined in -[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) *** @@ -70,4 +70,4 @@ #### Defined in -[interfaces.ts:99](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L99) +[interfaces.ts:99](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L99) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md index 8bd621bb12..063240caf7 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) +[interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) +[interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) +[interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) *** @@ -44,7 +44,7 @@ #### Defined in -[interfaces.ts:139](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L139) +[interfaces.ts:139](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L139) *** @@ -54,7 +54,7 @@ #### Defined in -[interfaces.ts:135](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L135) +[interfaces.ts:135](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L135) *** @@ -64,7 +64,7 @@ #### Defined in -[interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) +[interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) *** @@ -74,7 +74,7 @@ #### Defined in -[interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) +[interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) *** @@ -84,7 +84,7 @@ #### Defined in -[interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) +[interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) *** @@ -94,7 +94,7 @@ #### Defined in -[interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) +[interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) *** @@ -104,7 +104,7 @@ #### Defined in -[interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) +[interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) *** @@ -114,4 +114,4 @@ #### Defined in -[interfaces.ts:134](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L134) +[interfaces.ts:134](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L134) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md index e7ab0b1be4..b61fa36d60 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md @@ -18,7 +18,7 @@ #### Defined in -[interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) +[interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) *** @@ -28,7 +28,7 @@ #### Defined in -[interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) +[interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) *** @@ -38,7 +38,7 @@ #### Defined in -[interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) +[interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) *** @@ -52,7 +52,7 @@ #### Defined in -[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +[interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -62,7 +62,7 @@ #### Defined in -[interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) +[interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) *** @@ -76,7 +76,7 @@ #### Defined in -[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +[interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -90,7 +90,7 @@ #### Defined in -[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +[interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) *** @@ -100,7 +100,7 @@ #### Defined in -[interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) +[interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) *** @@ -110,7 +110,7 @@ #### Defined in -[interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) +[interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) *** @@ -120,4 +120,4 @@ #### Defined in -[interfaces.ts:149](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L149) +[interfaces.ts:149](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L149) diff --git a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md index 34647cc879..eb168cbf6b 100644 --- a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md @@ -14,7 +14,7 @@ #### Defined in -[interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) +[interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) *** @@ -24,7 +24,7 @@ #### Defined in -[interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) +[interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) *** @@ -34,7 +34,7 @@ #### Defined in -[interfaces.ts:122](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L122) +[interfaces.ts:122](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L122) *** @@ -44,7 +44,7 @@ #### Defined in -[interfaces.ts:123](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L123) +[interfaces.ts:123](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L123) *** @@ -54,7 +54,7 @@ #### Defined in -[interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) +[interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) *** @@ -64,7 +64,7 @@ #### Defined in -[interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) +[interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) *** @@ -74,4 +74,4 @@ #### Defined in -[interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) +[interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md index 574073c60c..7f591efcc3 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md @@ -110,7 +110,7 @@ The network information required to connect to the KVStore contract #### Defined in -[kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) +[kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) ## Properties @@ -124,7 +124,7 @@ The network information required to connect to the KVStore contract #### Defined in -[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -138,7 +138,7 @@ The network information required to connect to the KVStore contract #### Defined in -[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) ## Methods @@ -194,7 +194,7 @@ await kvstoreClient.set('Role', 'RecordingOracle'); #### Defined in -[kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) +[kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) *** @@ -252,7 +252,7 @@ await kvstoreClient.set(keys, values); #### Defined in -[kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) +[kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) *** @@ -307,7 +307,7 @@ await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url); #### Defined in -[kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) +[kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) *** @@ -341,4 +341,4 @@ The Runner object to interact with the Ethereum network #### Defined in -[kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) +[kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md index 6954f0b98b..8266b843ab 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md @@ -108,7 +108,7 @@ console.log(value); #### Defined in -[kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) +[kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) *** @@ -158,7 +158,7 @@ console.log(url); #### Defined in -[kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) +[kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) *** @@ -207,7 +207,7 @@ console.log(kvStoreData); #### Defined in -[kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) +[kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) *** @@ -251,4 +251,4 @@ console.log(publicKey); #### Defined in -[kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) +[kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) diff --git a/docs/sdk/typescript/operator/classes/OperatorUtils.md b/docs/sdk/typescript/operator/classes/OperatorUtils.md index c0ac41c2fb..1c3bcdcc10 100644 --- a/docs/sdk/typescript/operator/classes/OperatorUtils.md +++ b/docs/sdk/typescript/operator/classes/OperatorUtils.md @@ -52,7 +52,7 @@ const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A #### Defined in -[operator.ts:44](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L44) +[operator.ts:44](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L44) *** @@ -89,7 +89,7 @@ const leaders = await OperatorUtils.getLeaders(filter); #### Defined in -[operator.ts:108](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L108) +[operator.ts:108](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L108) *** @@ -133,7 +133,7 @@ const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLY #### Defined in -[operator.ts:172](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L172) +[operator.ts:172](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L172) *** @@ -171,4 +171,4 @@ const rewards = await OperatorUtils.getRewards(ChainId.POLYGON_AMOY, '0x62dD5123 #### Defined in -[operator.ts:222](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L222) +[operator.ts:222](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L222) diff --git a/docs/sdk/typescript/staking/classes/StakingClient.md b/docs/sdk/typescript/staking/classes/StakingClient.md index d0c2a3ac51..b0e79f6654 100644 --- a/docs/sdk/typescript/staking/classes/StakingClient.md +++ b/docs/sdk/typescript/staking/classes/StakingClient.md @@ -110,7 +110,7 @@ The network information required to connect to the Staking contract #### Defined in -[staking.ts:107](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L107) +[staking.ts:107](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L107) ## Properties @@ -120,7 +120,7 @@ The network information required to connect to the Staking contract #### Defined in -[staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) +[staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) *** @@ -134,7 +134,7 @@ The network information required to connect to the Staking contract #### Defined in -[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +[base.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -148,7 +148,7 @@ The network information required to connect to the Staking contract #### Defined in -[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +[base.ts:11](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) *** @@ -158,7 +158,7 @@ The network information required to connect to the Staking contract #### Defined in -[staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) +[staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) *** @@ -168,7 +168,7 @@ The network information required to connect to the Staking contract #### Defined in -[staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) +[staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) ## Methods @@ -217,7 +217,7 @@ await stakingClient.approveStake(amount); #### Defined in -[staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) +[staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) *** @@ -284,7 +284,7 @@ await stakingClient.slash('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd #### Defined in -[staking.ts:377](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L377) +[staking.ts:377](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L377) *** @@ -336,7 +336,7 @@ await stakingClient.approveStake(amount); #### Defined in -[staking.ts:248](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L248) +[staking.ts:248](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L248) *** @@ -387,7 +387,7 @@ await stakingClient.unstake(amount); #### Defined in -[staking.ts:293](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L293) +[staking.ts:293](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L293) *** @@ -431,7 +431,7 @@ await stakingClient.withdraw(); #### Defined in -[staking.ts:339](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L339) +[staking.ts:339](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L339) *** @@ -465,4 +465,4 @@ The Runner object to interact with the Ethereum network #### Defined in -[staking.ts:135](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L135) +[staking.ts:135](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L135) diff --git a/docs/sdk/typescript/statistics/classes/StatisticsClient.md b/docs/sdk/typescript/statistics/classes/StatisticsClient.md index f49c11699c..848f166283 100644 --- a/docs/sdk/typescript/statistics/classes/StatisticsClient.md +++ b/docs/sdk/typescript/statistics/classes/StatisticsClient.md @@ -64,7 +64,7 @@ The network information required to connect to the Statistics contract #### Defined in -[statistics.ts:72](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L72) +[statistics.ts:72](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L72) ## Properties @@ -74,7 +74,7 @@ The network information required to connect to the Statistics contract #### Defined in -[statistics.ts:64](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L64) +[statistics.ts:64](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L64) *** @@ -84,7 +84,7 @@ The network information required to connect to the Statistics contract #### Defined in -[statistics.ts:65](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L65) +[statistics.ts:65](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L65) ## Methods @@ -152,7 +152,7 @@ const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({ #### Defined in -[statistics.ts:128](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L128) +[statistics.ts:128](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L128) *** @@ -219,7 +219,7 @@ console.log('HMT statistics from 5/8 - 6/8:', hmtStatisticsRange); #### Defined in -[statistics.ts:497](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L497) +[statistics.ts:497](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L497) *** @@ -264,7 +264,7 @@ console.log('HMT holders:', hmtHolders.map((h) => ({ #### Defined in -[statistics.ts:423](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L423) +[statistics.ts:423](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L423) *** @@ -304,7 +304,7 @@ console.log('HMT statistics:', { #### Defined in -[statistics.ts:380](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L380) +[statistics.ts:380](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L380) *** @@ -390,7 +390,7 @@ console.log( #### Defined in -[statistics.ts:314](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L314) +[statistics.ts:314](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L314) *** @@ -453,4 +453,4 @@ const workerStatisticsApril = await statisticsClient.getWorkerStatistics({ #### Defined in -[statistics.ts:215](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L215) +[statistics.ts:215](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L215) diff --git a/docs/sdk/typescript/storage/classes/StorageClient.md b/docs/sdk/typescript/storage/classes/StorageClient.md index 19625fed23..d76b124d4a 100644 --- a/docs/sdk/typescript/storage/classes/StorageClient.md +++ b/docs/sdk/typescript/storage/classes/StorageClient.md @@ -81,7 +81,7 @@ Optional. Cloud storage access data. If credentials is not provided - use an ano #### Defined in -[storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) +[storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) ## Methods @@ -127,7 +127,7 @@ const exists = await storageClient.bucketExists('bucket-name'); #### Defined in -[storage.ts:266](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L266) +[storage.ts:266](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L266) *** @@ -177,7 +177,7 @@ const files = await storageClient.downloadFiles(keys, 'bucket-name'); #### Defined in -[storage.ts:113](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L113) +[storage.ts:113](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L113) *** @@ -223,7 +223,7 @@ const fileNames = await storageClient.listObjects('bucket-name'); #### Defined in -[storage.ts:297](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L297) +[storage.ts:297](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L297) *** @@ -278,7 +278,7 @@ const uploadedFiles = await storageClient.uploadFiles(files, 'bucket-name'); #### Defined in -[storage.ts:201](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L201) +[storage.ts:201](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L201) *** @@ -312,4 +312,4 @@ const file = await storageClient.downloadFileFromUrl('http://localhost/file.json #### Defined in -[storage.ts:148](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L148) +[storage.ts:148](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L148) diff --git a/docs/sdk/typescript/transaction/classes/TransactionUtils.md b/docs/sdk/typescript/transaction/classes/TransactionUtils.md index d87190140c..1e5043f862 100644 --- a/docs/sdk/typescript/transaction/classes/TransactionUtils.md +++ b/docs/sdk/typescript/transaction/classes/TransactionUtils.md @@ -54,7 +54,7 @@ const transaction = await TransactionUtils.getTransaction(ChainId.POLYGON, '0x62 #### Defined in -[transaction.ts:34](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L34) +[transaction.ts:34](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L34) *** @@ -127,4 +127,4 @@ const transactions = await TransactionUtils.getTransactions(filter); #### Defined in -[transaction.ts:109](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L109) +[transaction.ts:109](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L109) diff --git a/docs/sdk/typescript/types/README.md b/docs/sdk/typescript/types/README.md index ed6ec3f590..a6eef85112 100644 --- a/docs/sdk/typescript/types/README.md +++ b/docs/sdk/typescript/types/README.md @@ -19,4 +19,5 @@ - [NetworkData](type-aliases/NetworkData.md) - [StorageCredentials](type-aliases/StorageCredentials.md) - [StorageParams](type-aliases/StorageParams.md) +- [TransactionLikeWithNonce](type-aliases/TransactionLikeWithNonce.md) - [UploadFile](type-aliases/UploadFile.md) diff --git a/docs/sdk/typescript/types/enumerations/EscrowStatus.md b/docs/sdk/typescript/types/enumerations/EscrowStatus.md index 846b8d4d48..df7c912cea 100644 --- a/docs/sdk/typescript/types/enumerations/EscrowStatus.md +++ b/docs/sdk/typescript/types/enumerations/EscrowStatus.md @@ -18,7 +18,7 @@ Escrow is cancelled. #### Defined in -[types.ts:30](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L30) +[types.ts:32](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) *** @@ -30,7 +30,7 @@ Escrow is finished.. #### Defined in -[types.ts:26](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L26) +[types.ts:28](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) *** @@ -42,7 +42,7 @@ Escrow is launched. #### Defined in -[types.ts:10](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L10) +[types.ts:12](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) *** @@ -54,7 +54,7 @@ Escrow is fully paid. #### Defined in -[types.ts:22](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L22) +[types.ts:24](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) *** @@ -66,7 +66,7 @@ Escrow is partially paid out. #### Defined in -[types.ts:18](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L18) +[types.ts:20](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) *** @@ -78,4 +78,4 @@ Escrow is funded, and waiting for the results to be submitted. #### Defined in -[types.ts:14](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L14) +[types.ts:16](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) diff --git a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md index b3bf362bb3..c8d5961945 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md @@ -26,4 +26,4 @@ The hash of the transaction associated with the escrow cancellation. ## Defined in -[types.ts:143](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L143) +[types.ts:145](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) diff --git a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md index 187d592176..763b0bc2fe 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md @@ -32,4 +32,4 @@ The hash of the transaction associated with the escrow withdrawal. ## Defined in -[types.ts:157](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L157) +[types.ts:159](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) diff --git a/docs/sdk/typescript/types/type-aliases/NetworkData.md b/docs/sdk/typescript/types/type-aliases/NetworkData.md index 746f2d4adf..8ba88bdfad 100644 --- a/docs/sdk/typescript/types/type-aliases/NetworkData.md +++ b/docs/sdk/typescript/types/type-aliases/NetworkData.md @@ -80,4 +80,4 @@ Network title ## Defined in -[types.ts:93](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L93) +[types.ts:95](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) diff --git a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md index d99b41f6f0..91e0522b57 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md +++ b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md @@ -30,4 +30,4 @@ StorageClient is deprecated. Use Minio.Client directly. ## Defined in -[types.ts:38](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L38) +[types.ts:40](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) diff --git a/docs/sdk/typescript/types/type-aliases/StorageParams.md b/docs/sdk/typescript/types/type-aliases/StorageParams.md index d8ca085e73..11e656b04c 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageParams.md +++ b/docs/sdk/typescript/types/type-aliases/StorageParams.md @@ -40,4 +40,4 @@ StorageClient is deprecated. Use Minio.Client directly. ## Defined in -[types.ts:52](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L52) +[types.ts:54](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) diff --git a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md new file mode 100644 index 0000000000..b79c1b414d --- /dev/null +++ b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md @@ -0,0 +1,19 @@ +[**@human-protocol/sdk**](../../README.md) + +*** + +[@human-protocol/sdk](../../modules.md) / [types](../README.md) / TransactionLikeWithNonce + +# Type Alias: TransactionLikeWithNonce + +> **TransactionLikeWithNonce**: `TransactionLike` & `object` + +## Type declaration + +### nonce + +> **nonce**: `number` + +## Defined in + +[types.ts:174](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L174) diff --git a/docs/sdk/typescript/types/type-aliases/UploadFile.md b/docs/sdk/typescript/types/type-aliases/UploadFile.md index ca33318c3e..a8b2ff7f5d 100644 --- a/docs/sdk/typescript/types/type-aliases/UploadFile.md +++ b/docs/sdk/typescript/types/type-aliases/UploadFile.md @@ -32,4 +32,4 @@ Uploaded object URL ## Defined in -[types.ts:75](https://github.com/humanprotocol/human-protocol/blob/d09ba07adfea005abceaa4b9fc19ef8d97dfa6cc/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L75) +[types.ts:77](https://github.com/humanprotocol/human-protocol/blob/90708c31f10beb8c39c0abd078b41cb6cae38b08/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) diff --git a/packages/apps/reputation-oracle/server/docker-compose.yml b/packages/apps/reputation-oracle/server/docker-compose.yml index 10d1a2ad1d..f3b01e2911 100644 --- a/packages/apps/reputation-oracle/server/docker-compose.yml +++ b/packages/apps/reputation-oracle/server/docker-compose.yml @@ -2,6 +2,7 @@ version: '3.8' services: postgres: + container_name: postgres image: postgres:latest restart: always environment: diff --git a/packages/apps/reputation-oracle/server/package.json b/packages/apps/reputation-oracle/server/package.json index 06921ce4d2..7e8010f8b4 100644 --- a/packages/apps/reputation-oracle/server/package.json +++ b/packages/apps/reputation-oracle/server/package.json @@ -17,8 +17,8 @@ "migration:revert": "yarn build && typeorm-ts-node-commonjs migration:revert -d typeorm.config.ts", "migration:run": "yarn build && typeorm-ts-node-commonjs migration:run -d typeorm.config.ts", "migration:show": "yarn build && typeorm-ts-node-commonjs migration:show -d typeorm.config.ts", - "docker:db:up": "docker compose up -d && yarn migration:run", - "docker:db:down": "docker compose down", + "docker:db:up": "docker compose up -d postgres && yarn migration:run", + "docker:db:down": "docker compose down postgres", "setup:local": "ts-node ./test/setup.ts", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", @@ -48,6 +48,7 @@ "class-validator": "^0.14.1", "helmet": "^7.1.0", "joi": "^17.13.3", + "lodash": "^4.17.21", "nestjs-minio-client": "^2.2.0", "passport": "^0.7.0", "passport-jwt": "^4.0.1", diff --git a/packages/apps/reputation-oracle/server/src/common/constants/errors.ts b/packages/apps/reputation-oracle/server/src/common/constants/errors.ts index ff28c51ade..44fc676bf0 100644 --- a/packages/apps/reputation-oracle/server/src/common/constants/errors.ts +++ b/packages/apps/reputation-oracle/server/src/common/constants/errors.ts @@ -6,6 +6,7 @@ export enum ErrorEscrowCompletion { NotCreated = 'Escrow completion has not been created', PendingProcessingFailed = 'Failed to process pending escrow completion', PaidProcessingFailed = 'Failed to process paid escrow completion', + AwaitingPayoutsProcessingFailed = 'Failed to process payouts for escrow completion', } /** diff --git a/packages/apps/reputation-oracle/server/src/common/dto/result.ts b/packages/apps/reputation-oracle/server/src/common/dto/result.ts index 71d53fc03c..ba39232cf9 100644 --- a/packages/apps/reputation-oracle/server/src/common/dto/result.ts +++ b/packages/apps/reputation-oracle/server/src/common/dto/result.ts @@ -1,29 +1,5 @@ import { SolutionError } from '../../common/enums'; -export class PayoutsDataDto { - /** - * List of recipient addresses. - */ - recipients: string[]; - - /** - * Corresponding amounts to be paid out to recipients. - */ - amounts: bigint[]; -} - -export class SaveResultDto { - /** - * URL to the stored results. - */ - url: string; - - /** - * Hash of the stored results. - */ - hash: string; -} - export class FortuneFinalResult { workerAddress: string; solution: string; diff --git a/packages/apps/reputation-oracle/server/src/common/enums/cron-job.ts b/packages/apps/reputation-oracle/server/src/common/enums/cron-job.ts index 26442edb51..59568e48b9 100644 --- a/packages/apps/reputation-oracle/server/src/common/enums/cron-job.ts +++ b/packages/apps/reputation-oracle/server/src/common/enums/cron-job.ts @@ -3,4 +3,5 @@ export enum CronJobType { ProcessPendingOutgoingWebhook = 'process-pending-outgoing-webhook', ProcessPendingEscrowCompletionTracking = 'process-pending-escrow-completion-tracking', ProcessPaidEscrowCompletionTracking = 'process-paid-escrow-completion-tracking', + ProcessAwaitingEscrowPayouts = 'process-awaiting-escrow-payouts', } diff --git a/packages/apps/reputation-oracle/server/src/common/enums/webhook.ts b/packages/apps/reputation-oracle/server/src/common/enums/webhook.ts index a4144a83a8..8843979f7a 100644 --- a/packages/apps/reputation-oracle/server/src/common/enums/webhook.ts +++ b/packages/apps/reputation-oracle/server/src/common/enums/webhook.ts @@ -17,6 +17,7 @@ export enum WebhookOutgoingStatus { export enum EscrowCompletionStatus { PENDING = 'pending', + AWAITING_PAYOUTS = 'awaiting_payouts', PAID = 'paid', COMPLETED = 'completed', FAILED = 'failed', diff --git a/packages/apps/reputation-oracle/server/src/database/database.module.ts b/packages/apps/reputation-oracle/server/src/database/database.module.ts index 269a2cee04..cc4a9269f9 100644 --- a/packages/apps/reputation-oracle/server/src/database/database.module.ts +++ b/packages/apps/reputation-oracle/server/src/database/database.module.ts @@ -22,6 +22,7 @@ import { UserQualificationEntity } from '../modules/qualification/user-qualifica import { WebhookIncomingEntity } from '../modules/webhook/webhook-incoming.entity'; import { WebhookOutgoingEntity } from '../modules/webhook/webhook-outgoing.entity'; import { EscrowCompletionEntity } from '../modules/escrow-completion/escrow-completion.entity'; +import { EscrowPayoutsBatchEntity } from '../modules/escrow-completion/escrow-payouts-batch.entity'; @Module({ imports: [ @@ -50,6 +51,7 @@ import { EscrowCompletionEntity } from '../modules/escrow-completion/escrow-comp WebhookIncomingEntity, WebhookOutgoingEntity, EscrowCompletionEntity, + EscrowPayoutsBatchEntity, ReputationEntity, CredentialEntity, CredentialValidationEntity, diff --git a/packages/apps/reputation-oracle/server/src/database/migrations/1736357403602-escrowAwaitingPayouts.ts b/packages/apps/reputation-oracle/server/src/database/migrations/1736357403602-escrowAwaitingPayouts.ts new file mode 100644 index 0000000000..bfdb332814 --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/database/migrations/1736357403602-escrowAwaitingPayouts.ts @@ -0,0 +1,73 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class EscrowAwaitingPayouts1736357403602 implements MigrationInterface { + name = 'EscrowAwaitingPayouts1736357403602'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "hmt"."escrow_payouts_batch" ("id" SERIAL NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, "escrow_completion_tracking_id" integer NOT NULL, "payouts" json NOT NULL, "payouts_hash" character varying NOT NULL, "tx_nonce" integer, CONSTRAINT "PK_6eb1d2e51d7c024fc681dfa67a7" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX "IDX_44fd0222c43ed95845dd718f2a" ON "hmt"."escrow_payouts_batch" ("escrow_completion_tracking_id", "payouts_hash") `, + ); + await queryRunner.query( + `ALTER TYPE "hmt"."escrow_completion_tracking_status_enum" RENAME TO "escrow_completion_tracking_status_enum_old"`, + ); + await queryRunner.query( + `CREATE TYPE "hmt"."escrow_completion_tracking_status_enum" AS ENUM('pending', 'awaiting_payouts', 'paid', 'completed', 'failed')`, + ); + await queryRunner.query( + `ALTER TABLE "hmt"."escrow_completion_tracking" ALTER COLUMN "status" TYPE "hmt"."escrow_completion_tracking_status_enum" USING "status"::"text"::"hmt"."escrow_completion_tracking_status_enum"`, + ); + await queryRunner.query( + `DROP TYPE "hmt"."escrow_completion_tracking_status_enum_old"`, + ); + await queryRunner.query( + `ALTER TYPE "hmt"."cron-jobs_cron_job_type_enum" RENAME TO "cron-jobs_cron_job_type_enum_old"`, + ); + await queryRunner.query( + `CREATE TYPE "hmt"."cron-jobs_cron_job_type_enum" AS ENUM('process-pending-incoming-webhook', 'process-pending-outgoing-webhook', 'process-pending-escrow-completion-tracking', 'process-paid-escrow-completion-tracking', 'process-awaiting-escrow-payouts')`, + ); + await queryRunner.query( + `ALTER TABLE "hmt"."cron-jobs" ALTER COLUMN "cron_job_type" TYPE "hmt"."cron-jobs_cron_job_type_enum" USING "cron_job_type"::"text"::"hmt"."cron-jobs_cron_job_type_enum"`, + ); + await queryRunner.query( + `DROP TYPE "hmt"."cron-jobs_cron_job_type_enum_old"`, + ); + await queryRunner.query( + `ALTER TABLE "hmt"."escrow_payouts_batch" ADD CONSTRAINT "FK_e0c93d91e0edd3becc3c84ed0a0" FOREIGN KEY ("escrow_completion_tracking_id") REFERENCES "hmt"."escrow_completion_tracking"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "hmt"."escrow_payouts_batch" DROP CONSTRAINT "FK_e0c93d91e0edd3becc3c84ed0a0"`, + ); + await queryRunner.query( + `CREATE TYPE "hmt"."cron-jobs_cron_job_type_enum_old" AS ENUM('process-pending-incoming-webhook', 'process-pending-outgoing-webhook', 'process-pending-escrow-completion-tracking', 'process-paid-escrow-completion-tracking')`, + ); + await queryRunner.query( + `ALTER TABLE "hmt"."cron-jobs" ALTER COLUMN "cron_job_type" TYPE "hmt"."cron-jobs_cron_job_type_enum_old" USING "cron_job_type"::"text"::"hmt"."cron-jobs_cron_job_type_enum_old"`, + ); + await queryRunner.query(`DROP TYPE "hmt"."cron-jobs_cron_job_type_enum"`); + await queryRunner.query( + `ALTER TYPE "hmt"."cron-jobs_cron_job_type_enum_old" RENAME TO "cron-jobs_cron_job_type_enum"`, + ); + await queryRunner.query( + `CREATE TYPE "hmt"."escrow_completion_tracking_status_enum_old" AS ENUM('pending', 'paid', 'completed', 'failed')`, + ); + await queryRunner.query( + `ALTER TABLE "hmt"."escrow_completion_tracking" ALTER COLUMN "status" TYPE "hmt"."escrow_completion_tracking_status_enum_old" USING "status"::"text"::"hmt"."escrow_completion_tracking_status_enum_old"`, + ); + await queryRunner.query( + `DROP TYPE "hmt"."escrow_completion_tracking_status_enum"`, + ); + await queryRunner.query( + `ALTER TYPE "hmt"."escrow_completion_tracking_status_enum_old" RENAME TO "escrow_completion_tracking_status_enum"`, + ); + await queryRunner.query( + `DROP INDEX "hmt"."IDX_44fd0222c43ed95845dd718f2a"`, + ); + await queryRunner.query(`DROP TABLE "hmt"."escrow_payouts_batch"`); + } +} diff --git a/packages/apps/reputation-oracle/server/src/modules/auth/auth.module.ts b/packages/apps/reputation-oracle/server/src/modules/auth/auth.module.ts index a613798a28..342c940824 100644 --- a/packages/apps/reputation-oracle/server/src/modules/auth/auth.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/auth/auth.module.ts @@ -1,15 +1,12 @@ import { Module } from '@nestjs/common'; import { JwtModule } from '@nestjs/jwt'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { UserModule } from '../user/user.module'; import { JwtHttpStrategy } from './strategy'; import { AuthService } from './auth.service'; import { AuthJwtController } from './auth.controller'; -import { TokenEntity } from './token.entity'; import { TokenRepository } from './token.repository'; import { SendGridModule } from '../sendgrid/sendgrid.module'; -import { UserEntity } from '../user/user.entity'; import { UserRepository } from '../user/user.repository'; import { Web3Module } from '../web3/web3.module'; import { AuthConfigService } from '../../common/config/auth-config.service'; @@ -28,7 +25,6 @@ import { HCaptchaModule } from '../../integrations/hcaptcha/hcaptcha.module'; }, }), }), - TypeOrmModule.forFeature([TokenEntity, UserEntity]), SendGridModule, Web3Module, HCaptchaModule, diff --git a/packages/apps/reputation-oracle/server/src/modules/credentials/credential.module.ts b/packages/apps/reputation-oracle/server/src/modules/credentials/credential.module.ts index af0274f8cf..2113180f66 100644 --- a/packages/apps/reputation-oracle/server/src/modules/credentials/credential.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/credentials/credential.module.ts @@ -1,20 +1,13 @@ import { Logger, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { ConfigModule } from '@nestjs/config'; import { CredentialService } from './credential.service'; -import { CredentialEntity } from './credential.entity'; import { CredentialRepository } from './credential.repository'; import { Web3Module } from '../web3/web3.module'; // Assuming integration with blockchain import { UserModule } from '../user/user.module'; @Module({ - imports: [ - TypeOrmModule.forFeature([CredentialEntity]), - ConfigModule, - Web3Module, - UserModule, - ], + imports: [ConfigModule, Web3Module, UserModule], providers: [Logger, CredentialService, CredentialRepository], exports: [CredentialService], }) diff --git a/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.module.ts b/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.module.ts index d73d6b8138..8307ac9b72 100644 --- a/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.module.ts @@ -2,8 +2,6 @@ import { Global, Module } from '@nestjs/common'; import { CronJobService } from './cron-job.service'; import { CronJobRepository } from './cron-job.repository'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { CronJobEntity } from './cron-job.entity'; import { ConfigModule } from '@nestjs/config'; import { EscrowCompletionModule } from '../escrow-completion/escrow-completion.module'; import { WebhookIncomingModule } from '../webhook/webhook-incoming.module'; @@ -12,7 +10,6 @@ import { WebhookOutgoingModule } from '../webhook/webhook-outgoing.module'; @Global() @Module({ imports: [ - TypeOrmModule.forFeature([CronJobEntity]), ConfigModule, WebhookIncomingModule, WebhookOutgoingModule, diff --git a/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.spec.ts index 00694e1b2e..8b697833f4 100644 --- a/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.spec.ts @@ -46,6 +46,7 @@ describe('CronJobService', () => { useValue: { processPendingEscrowCompletion: jest.fn(), processPaidEscrowCompletion: jest.fn(), + processAwaitingPayouts: jest.fn(), }, }, { @@ -298,6 +299,52 @@ describe('CronJobService', () => { }); }); + describe('processAwaitingEscrowPayouts', () => { + it('should skip processing if a cron job is already running', async () => { + jest.spyOn(service, 'isCronJobRunning').mockResolvedValue(true); + + await service.processAwaitingEscrowPayouts(); + + expect( + escrowCompletionService.processAwaitingPayouts, + ).not.toHaveBeenCalled(); + }); + + it('should process pending escrow completion and complete the cron job', async () => { + jest.spyOn(service, 'isCronJobRunning').mockResolvedValue(false); + jest + .spyOn(service, 'startCronJob') + .mockResolvedValue(new CronJobEntity()); + jest + .spyOn(service, 'completeCronJob') + .mockResolvedValue(new CronJobEntity()); + + await service.processAwaitingEscrowPayouts(); + + expect(escrowCompletionService.processAwaitingPayouts).toHaveBeenCalled(); + expect(service.startCronJob).toHaveBeenCalled(); + expect(service.completeCronJob).toHaveBeenCalled(); + }); + + it('should complete the cron job after processing', async () => { + jest.spyOn(service, 'isCronJobRunning').mockResolvedValue(false); + jest + .spyOn(service, 'startCronJob') + .mockResolvedValue(new CronJobEntity()); + jest + .spyOn(service, 'completeCronJob') + .mockResolvedValue(new CronJobEntity()); + + escrowCompletionService.processAwaitingPayouts.mockRejectedValue( + new Error('Processing error'), + ); + + await service.processAwaitingEscrowPayouts(); + + expect(service.completeCronJob).toHaveBeenCalled(); + }); + }); + describe('processPaidEscrowCompletion', () => { it('should skip processing if a cron job is already running', async () => { jest.spyOn(service, 'isCronJobRunning').mockResolvedValue(true); diff --git a/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.ts b/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.ts index 77b4d1482d..edeb1bd7b7 100644 --- a/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/cron-job/cron-job.service.ts @@ -76,12 +76,12 @@ export class CronJobService { return this.cronJobRepository.updateOne(cronJobEntity); } - @Cron('*/2 * * * *') /** * Processes all pending incoming webhooks, marking them as completed upon success. * Handles any errors by logging them and updating the webhook status. * @returns {Promise} A promise that resolves when all pending incoming webhooks have been processed. */ + @Cron('*/2 * * * *') public async processPendingIncomingWebhooks(): Promise { const isCronJobRunning = await this.isCronJobRunning( CronJobType.ProcessPendingIncomingWebhook, @@ -106,13 +106,13 @@ export class CronJobService { await this.completeCronJob(cronJob); } - @Cron('*/2 * * * *') /** * Processes pending escrow completion tracking to manage escrow lifecycle actions. * Checks escrow status and, if appropriate, saves results and initiates payouts. * Handles errors and logs detailed messages. * @returns {Promise} A promise that resolves when the operation is complete. */ + @Cron('*/2 * * * *') public async processPendingEscrowCompletion(): Promise { const isCronJobRunning = await this.isCronJobRunning( CronJobType.ProcessPendingEscrowCompletionTracking, @@ -137,12 +137,12 @@ export class CronJobService { await this.completeCronJob(cronJob); } - @Cron('*/2 * * * *') /** * Processes paid escrow completion tracking, finalizing escrow operations if completed. * Notifies oracles via callbacks, logs errors, and updates tracking status. * @returns {Promise} A promise that resolves when the paid escrow tracking has been processed. */ + @Cron('*/2 * * * *') public async processPaidEscrowCompletion(): Promise { const isCronJobRunning = await this.isCronJobRunning( CronJobType.ProcessPaidEscrowCompletionTracking, @@ -167,12 +167,12 @@ export class CronJobService { await this.completeCronJob(cronJob); } - @Cron('*/2 * * * *') /** * Processes pending outgoing webhooks, sending requests to designated URLs. * Updates each webhook's status upon success, retries or logs errors as necessary. * @returns {Promise} A promise that resolves once all pending outgoing webhooks have been processed. */ + @Cron('*/2 * * * *') public async processPendingOutgoingWebhooks(): Promise { if (await this.isCronJobRunning(CronJobType.ProcessPendingOutgoingWebhook)) return; @@ -191,4 +191,33 @@ export class CronJobService { this.logger.log('Pending outgoing webhooks STOP'); await this.completeCronJob(cronJob); } + + /** + * Runs processing of awaiting payouts for escrow completion. + * @returns {Promise} A promise that resolves when the processing is finished. + */ + @Cron('*/2 * * * *') + public async processAwaitingEscrowPayouts(): Promise { + const isCronJobRunning = await this.isCronJobRunning( + CronJobType.ProcessAwaitingEscrowPayouts, + ); + + if (isCronJobRunning) { + return; + } + + this.logger.log('Awaiting payouts escrow completion tracking START'); + const cronJob = await this.startCronJob( + CronJobType.ProcessAwaitingEscrowPayouts, + ); + + try { + await this.escrowCompletionService.processAwaitingPayouts(); + } catch (e) { + this.logger.error(e); + } + + this.logger.log('Awaiting payouts escrow completion tracking STOP'); + await this.completeCronJob(cronJob); + } } diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.module.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.module.ts index eb9198f256..7dd0b404b9 100644 --- a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.module.ts @@ -1,25 +1,27 @@ import { Logger, Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { TypeOrmModule } from '@nestjs/typeorm'; - -import { EscrowCompletionEntity } from './escrow-completion.entity'; import { EscrowCompletionRepository } from './escrow-completion.repository'; import { EscrowCompletionService } from './escrow-completion.service'; import { PayoutModule } from '../payout/payout.module'; import { ReputationModule } from '../reputation/reputation.module'; import { Web3Module } from '../web3/web3.module'; import { WebhookOutgoingModule } from '../webhook/webhook-outgoing.module'; +import { EscrowPayoutsBatchRepository } from './escrow-payouts-batch.repository'; @Module({ imports: [ - TypeOrmModule.forFeature([EscrowCompletionEntity]), ConfigModule, Web3Module, PayoutModule, ReputationModule, WebhookOutgoingModule, ], - providers: [Logger, EscrowCompletionService, EscrowCompletionRepository], + providers: [ + Logger, + EscrowCompletionService, + EscrowCompletionRepository, + EscrowPayoutsBatchRepository, + ], exports: [EscrowCompletionService], }) export class EscrowCompletionModule {} diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.spec.ts index 4971631222..52317e0556 100644 --- a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.spec.ts @@ -10,6 +10,7 @@ import { MOCK_FILE_URL, MOCK_MAX_RETRY_COUNT, MOCK_PRIVATE_KEY, + MOCK_REPUTATION_ORACLE_ADDRESS, MOCK_WEBHOOK_URL, mockConfig, } from '../../../test/constants'; @@ -25,30 +26,24 @@ import { WebhookOutgoingService } from '../webhook/webhook-outgoing.service'; import { PayoutService } from '../payout/payout.service'; import { ReputationService } from '../reputation/reputation.service'; import { DatabaseError } from '../../common/errors/database'; -import { ErrorEscrowCompletion } from '../../common/constants/errors'; import { WebhookOutgoingRepository } from '../webhook/webhook-outgoing.repository'; import { StorageService } from '../storage/storage.service'; import { ReputationRepository } from '../reputation/reputation.repository'; import { ReputationConfigService } from '../../common/config/reputation-config.service'; import { PGPConfigService } from '../../common/config/pgp-config.service'; import { S3ConfigService } from '../../common/config/s3-config.service'; +import { EscrowPayoutsBatchRepository } from './escrow-payouts-batch.repository'; jest.mock('@human-protocol/sdk', () => ({ ...jest.requireActual('@human-protocol/sdk'), - EscrowClient: { - build: jest.fn().mockImplementation(() => ({ - getJobLauncherAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - getExchangeOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - getRecordingOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - complete: jest.fn().mockResolvedValue(null), - getStatus: jest.fn(), - })), - }, OperatorUtils: { getLeader: jest.fn().mockImplementation(() => { return { webhookUrl: MOCK_WEBHOOK_URL }; }), }, + TransactionUtils: { + getTransaction: jest.fn(), + }, })); jest.mock('../../common/utils/backoff', () => ({ @@ -58,9 +53,36 @@ jest.mock('../../common/utils/backoff', () => ({ .mockReturnValue(MOCK_BACKOFF_INTERVAL_SECONDS * 1000), })); +const ESCROW_CLIENT_MOCK = { + getJobLauncherAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), + getExchangeOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), + getRecordingOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), + complete: jest.fn().mockResolvedValue(null), + getStatus: jest.fn().mockResolvedValue(EscrowStatus.Launched), + createBulkPayoutTransaction: jest.fn(), +}; + +EscrowClient.build = jest.fn().mockResolvedValue(ESCROW_CLIENT_MOCK); + +const MOCK_ADDRESS_PAYOUT = { + address: MOCK_ADDRESS, + amount: BigInt(42), +}; +const mockPayouts = [ + MOCK_ADDRESS_PAYOUT, + ...Array.from({ length: 99 }, (_value, index) => { + const _index = index + 1; + return { + address: `0x${_index}`.padEnd(42, '0'), + amount: BigInt(_index), + }; + }), +]; + describe('escrowCompletionService', () => { let escrowCompletionService: EscrowCompletionService, escrowCompletionRepository: EscrowCompletionRepository, + escrowPayoutsBatchRepository: EscrowPayoutsBatchRepository, web3ConfigService: Web3ConfigService, webhookOutgoingService: WebhookOutgoingService, reputationService: ReputationService, @@ -69,6 +91,10 @@ describe('escrowCompletionService', () => { const signerMock = { address: MOCK_ADDRESS, getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + sendTransaction: jest.fn().mockImplementation(() => ({ + wait: jest.fn(), + })), + signTransaction: jest.fn().mockResolvedValue('signed-tx'), }; const mockConfigService = { @@ -114,6 +140,10 @@ describe('escrowCompletionService', () => { provide: EscrowCompletionRepository, useValue: createMock(), }, + { + provide: EscrowPayoutsBatchRepository, + useValue: createMock(), + }, { provide: WebhookOutgoingRepository, useValue: createMock(), @@ -154,6 +184,7 @@ describe('escrowCompletionService', () => { payoutService = moduleRef.get(PayoutService); reputationService = moduleRef.get(ReputationService); escrowCompletionRepository = moduleRef.get(EscrowCompletionRepository); + escrowPayoutsBatchRepository = moduleRef.get(EscrowPayoutsBatchRepository); web3ConfigService = moduleRef.get(Web3ConfigService); jest @@ -197,7 +228,7 @@ describe('escrowCompletionService', () => { }); describe('processPendingEscrowCompletion', () => { - let processResultsMock: any, executePayoutsMock: any; + let processResultsMock: any, calculatePayoutsMock: any; let escrowCompletionEntity1: Partial, escrowCompletionEntity2: Partial; @@ -220,9 +251,7 @@ describe('escrowCompletionService', () => { retriesCount: 0, }; - EscrowClient.build = jest.fn().mockResolvedValue({ - getStatus: jest.fn().mockResolvedValue(EscrowStatus.Pending), - }); + ESCROW_CLIENT_MOCK.getStatus.mockResolvedValue(EscrowStatus.Pending); jest .spyOn(escrowCompletionRepository, 'findByStatus') @@ -237,24 +266,45 @@ describe('escrowCompletionService', () => { hash: MOCK_FILE_HASH, }); - executePayoutsMock = jest.spyOn(payoutService as any, 'executePayouts'); - executePayoutsMock.mockResolvedValue(); + calculatePayoutsMock = jest.spyOn( + payoutService as any, + 'calculatePayouts', + ); + calculatePayoutsMock.mockResolvedValue(mockPayouts); }); - it('should save results and execute payouts for all of the pending escrows completion', async () => { + it('should save results and payouts batches for all of the pending escrows completion', async () => { jest .spyOn(escrowCompletionRepository, 'findByStatus') .mockResolvedValue([escrowCompletionEntity1 as any]); - const updateOneMock = jest + const updateOneEscrowCompletionMock = jest .spyOn(escrowCompletionRepository, 'updateOne') .mockResolvedValue(escrowCompletionEntity1 as any); + const createPayoutsBatchMock = jest.spyOn( + escrowPayoutsBatchRepository, + 'createUnique', + ); + await escrowCompletionService.processPendingEscrowCompletion(); - expect(updateOneMock).toHaveBeenCalledTimes(2); expect(processResultsMock).toHaveBeenCalledTimes(1); - expect(executePayoutsMock).toHaveBeenCalledTimes(1); + expect(calculatePayoutsMock).toHaveBeenCalledTimes(1); + + expect(createPayoutsBatchMock).toHaveBeenCalledTimes(2); + expect(createPayoutsBatchMock).toHaveBeenLastCalledWith({ + escrowCompletionTrackingId: escrowCompletionEntity1.id, + payouts: [ + { + ...MOCK_ADDRESS_PAYOUT, + amount: MOCK_ADDRESS_PAYOUT.amount.toString(), + }, + ], + payoutsHash: 'fd316abc331a3eb6c858e9ec87578986f954b366', + }); + + expect(updateOneEscrowCompletionMock).toHaveBeenCalledTimes(2); }); it('should handle errors and continue processing other entities', async () => { @@ -269,11 +319,11 @@ describe('escrowCompletionService', () => { ]); jest - .spyOn(payoutService, 'executePayouts') + .spyOn(payoutService, 'calculatePayouts') .mockImplementationOnce(() => { throw new Error('Test error'); }) // Fails for escrowCompletionEntity1 - .mockResolvedValue(); // Succeeds for escrowCompletionEntity2 + .mockResolvedValue([]); // Succeeds for escrowCompletionEntity2 await escrowCompletionService.processPendingEscrowCompletion(); @@ -289,7 +339,7 @@ describe('escrowCompletionService', () => { expect(escrowCompletionRepository.updateOne).toHaveBeenCalledWith( expect.objectContaining({ id: escrowCompletionEntity2.id, - status: EscrowCompletionStatus.PAID, + status: EscrowCompletionStatus.AWAITING_PAYOUTS, retriesCount: 0, }), ); @@ -337,13 +387,11 @@ describe('escrowCompletionService', () => { expect(updateOneMock).toHaveBeenCalledTimes(1); expect(processResultsMock).toHaveBeenCalledTimes(0); - expect(executePayoutsMock).toHaveBeenCalledTimes(1); + expect(calculatePayoutsMock).toHaveBeenCalledTimes(1); }); - it('should skip executePayouts when escrowStatus is not pending', async () => { - EscrowClient.build = jest.fn().mockResolvedValue({ - getStatus: jest.fn().mockResolvedValue(EscrowStatus.Launched), - }); + it('should skip calculatePayouts when escrowStatus is not pending', async () => { + ESCROW_CLIENT_MOCK.getStatus.mockResolvedValue(EscrowStatus.Launched); jest .spyOn(escrowCompletionRepository, 'findByStatus') @@ -357,7 +405,7 @@ describe('escrowCompletionService', () => { expect(updateOneMock).toHaveBeenCalledTimes(1); expect(processResultsMock).toHaveBeenCalledTimes(0); - expect(executePayoutsMock).toHaveBeenCalledTimes(0); + expect(calculatePayoutsMock).toHaveBeenCalledTimes(0); }); }); @@ -368,6 +416,7 @@ describe('escrowCompletionService', () => { escrowCompletionEntity2: Partial; beforeEach(() => { + ESCROW_CLIENT_MOCK.getStatus.mockResolvedValue(EscrowStatus.Partial); escrowCompletionEntity1 = { id: 1, chainId: ChainId.LOCALHOST, @@ -397,17 +446,11 @@ describe('escrowCompletionService', () => { createOutgoingWebhookMock = jest .spyOn(webhookOutgoingService, 'createOutgoingWebhook') .mockResolvedValue(); - - EscrowClient.build = jest.fn().mockResolvedValue({ - getStatus: jest.fn().mockResolvedValue(EscrowStatus.Paid), - complete: jest.fn().mockResolvedValue(true), - getJobLauncherAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - getExchangeOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - getRecordingOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - }); }); - it('should assess reputation scores and create outgoing webhook for all of the paid escrows completion', async () => { + it('should assess reputation scores and create outgoing webhook for all of the partially paid escrows completion', async () => { + ESCROW_CLIENT_MOCK.getStatus.mockResolvedValueOnce(EscrowStatus.Partial); + jest .spyOn(escrowCompletionRepository, 'findByStatus') .mockResolvedValue([escrowCompletionEntity1 as any]); @@ -503,13 +546,7 @@ describe('escrowCompletionService', () => { }); it('should skip assessReputationScores when escrowStatus is not paid', async () => { - EscrowClient.build = jest.fn().mockResolvedValue({ - getStatus: jest.fn().mockResolvedValue(EscrowStatus.Launched), - complete: jest.fn().mockResolvedValue(true), - getJobLauncherAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - getExchangeOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - getRecordingOracleAddress: jest.fn().mockResolvedValue(MOCK_ADDRESS), - }); + ESCROW_CLIENT_MOCK.getStatus.mockResolvedValue(EscrowStatus.Launched); jest .spyOn(escrowCompletionRepository, 'findByStatus') @@ -526,4 +563,220 @@ describe('escrowCompletionService', () => { expect(createOutgoingWebhookMock).toHaveBeenCalledTimes(2); }); }); + + describe('processAwaitingPayouts', () => { + let escrowCompletionEntity1: Partial; + let processPayoutsBatchMock: jest.SpyInstance; + + beforeEach(() => { + escrowCompletionEntity1 = { + id: 1, + chainId: ChainId.LOCALHOST, + escrowAddress: MOCK_ADDRESS, + finalResultsUrl: MOCK_FILE_URL, + finalResultsHash: MOCK_FILE_HASH, + status: EscrowCompletionStatus.AWAITING_PAYOUTS, + waitUntil: new Date(), + retriesCount: 0, + }; + + processPayoutsBatchMock = jest + .spyOn(escrowCompletionService as any, 'processPayoutsBatch') + .mockResolvedValue(undefined); + }); + + afterAll(() => { + processPayoutsBatchMock.mockRestore(); + }); + + it('should move completion entity to status paid when all payouts finished', async () => { + jest + .spyOn(escrowCompletionRepository, 'findByStatus') + .mockResolvedValueOnce([escrowCompletionEntity1 as any]); + + jest + .spyOn(escrowPayoutsBatchRepository, 'findForEscrowCompletionTracking') + .mockResolvedValueOnce([ + { + escrowCompletionTrackingId: escrowCompletionEntity1.id, + payouts: [MOCK_ADDRESS_PAYOUT], + payoutsHash: 'test-hash', + }, + ] as any); + + const updateOneEscrowCompletionMock = jest + .spyOn(escrowCompletionRepository, 'updateOne') + .mockResolvedValue(escrowCompletionEntity1 as any); + + await escrowCompletionService.processAwaitingPayouts(); + + expect(processPayoutsBatchMock).toHaveBeenCalledTimes(1); + + expect(updateOneEscrowCompletionMock).toHaveBeenCalledTimes(1); + expect(updateOneEscrowCompletionMock).toHaveBeenCalledWith({ + ...escrowCompletionEntity1, + status: EscrowCompletionStatus.PAID, + }); + }); + + it('should handle errors and keep processing other entities', async () => { + jest + .spyOn(escrowCompletionRepository, 'findByStatus') + .mockResolvedValueOnce([escrowCompletionEntity1 as any]); + + const numBathes = 2; + jest + .spyOn(escrowPayoutsBatchRepository, 'findForEscrowCompletionTracking') + .mockResolvedValueOnce( + Array.from( + { length: numBathes }, + () => + ({ + escrowCompletionTrackingId: escrowCompletionEntity1.id, + payouts: [MOCK_ADDRESS_PAYOUT], + payoutsHash: 'test-hash', + }) as any, + ), + ); + + processPayoutsBatchMock.mockRejectedValueOnce(new Error('Failed payout')); + + const updateOneEscrowCompletionMock = jest + .spyOn(escrowCompletionRepository, 'updateOne') + .mockResolvedValue(escrowCompletionEntity1 as any); + + await escrowCompletionService.processAwaitingPayouts(); + + expect(processPayoutsBatchMock).toHaveBeenCalledTimes(2); + + expect(updateOneEscrowCompletionMock).toHaveBeenCalledTimes(1); + expect(updateOneEscrowCompletionMock).toHaveBeenCalledWith({ + ...escrowCompletionEntity1, + retriesCount: 1, + }); + }); + }); + + describe('processPayoutsBatch', () => { + const escrowCompletionEntity = { + id: 1, + chainId: ChainId.LOCALHOST, + escrowAddress: MOCK_ADDRESS, + finalResultsUrl: MOCK_FILE_URL, + finalResultsHash: MOCK_FILE_HASH, + status: EscrowCompletionStatus.AWAITING_PAYOUTS, + waitUntil: new Date(), + retriesCount: 0, + }; + const rawTransaction = { + from: MOCK_REPUTATION_ORACLE_ADDRESS, + to: MOCK_ADDRESS, + data: '0xtest-encoded-contact-data', + nonce: 0, + }; + + beforeAll(() => { + ESCROW_CLIENT_MOCK.createBulkPayoutTransaction.mockImplementation( + (...args) => { + const txOptions = args.at(-1); + return { + ...rawTransaction, + nonce: txOptions.nonce ?? rawTransaction.nonce, + }; + }, + ); + }); + + it('should correctly process payouts batch at first try', async () => { + const updateOneBatchSpy = jest.spyOn( + escrowPayoutsBatchRepository, + 'updateOne', + ); + + const payoutsBatch = { + id: 1, + payouts: [MOCK_ADDRESS_PAYOUT], + payoutsHash: 'test-payouts-hash', + txNonce: null, + }; + + await (escrowCompletionService as any).processPayoutsBatch( + escrowCompletionEntity, + { ...payoutsBatch }, + ); + + expect(updateOneBatchSpy).toHaveBeenNthCalledWith(1, { + ...payoutsBatch, + txNonce: rawTransaction.nonce, + }); + expect(signerMock.sendTransaction).toHaveBeenCalledTimes(1); + expect(signerMock.sendTransaction).toHaveBeenLastCalledWith( + rawTransaction, + ); + }); + + it('should reuse nonce if exists in batch', async () => { + const updateOneBatchSpy = jest.spyOn( + escrowPayoutsBatchRepository, + 'updateOne', + ); + + const payoutsBatch = { + id: 1, + payouts: [MOCK_ADDRESS_PAYOUT], + payoutsHash: 'test-payouts-hash', + txNonce: 15, + }; + + await (escrowCompletionService as any).processPayoutsBatch( + escrowCompletionEntity, + payoutsBatch, + ); + + expect(updateOneBatchSpy).toHaveBeenCalledWith({ + ...payoutsBatch, + }); + expect(signerMock.sendTransaction).toHaveBeenCalledTimes(1); + expect(signerMock.sendTransaction).toHaveBeenCalledWith({ + ...rawTransaction, + nonce: payoutsBatch.txNonce, + }); + }); + + it('should erase tx data when nonce already used', async () => { + const updateOneBatchSpy = jest.spyOn( + escrowPayoutsBatchRepository, + 'updateOne', + ); + const NONCE_EXPIRED_CODE = 'NONCE_EXPIRED'; + signerMock.sendTransaction.mockRejectedValueOnce({ + code: NONCE_EXPIRED_CODE, + }); + + const payoutsBatch = { + id: 1, + payouts: [MOCK_ADDRESS_PAYOUT], + payoutsHash: 'test-payouts-hash', + txNonce: 15, + }; + + let thrownError: any; + try { + await (escrowCompletionService as any).processPayoutsBatch( + escrowCompletionEntity, + { ...payoutsBatch }, + ); + } catch (error) { + thrownError = error; + } + + expect(thrownError).toBeDefined(); + expect(thrownError.code).toBe(NONCE_EXPIRED_CODE); + + expect(updateOneBatchSpy).toHaveBeenLastCalledWith({ + ...payoutsBatch, + txNonce: undefined, + }); + }); + }); }); diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts index d82b4dc8d5..2531efde45 100644 --- a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-completion.service.ts @@ -1,4 +1,8 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ +import crypto from 'crypto'; +import { ethers } from 'ethers'; +import stringify from 'json-stable-stringify'; +import _ from 'lodash'; import { v4 as uuidv4 } from 'uuid'; import { HttpStatus, Injectable, Logger } from '@nestjs/common'; import { EscrowCompletionStatus, EventType } from '../../common/enums'; @@ -6,6 +10,7 @@ import { ServerConfigService } from '../../common/config/server-config.service'; import { EscrowCompletionRepository } from './escrow-completion.repository'; import { EscrowCompletionEntity } from './escrow-completion.entity'; import { + ESCROW_BULK_PAYOUT_MAX_ITEMS, ChainId, EscrowClient, EscrowStatus, @@ -21,6 +26,9 @@ import { ErrorEscrowCompletion } from '../../common/constants/errors'; import { ControlledError } from '../../common/errors/controlled'; import { WebhookOutgoingService } from '../webhook/webhook-outgoing.service'; import { isDuplicatedError } from '../../common/utils/database'; +import { CalculatedPayout } from '../payout/payout.interface'; +import { EscrowPayoutsBatchEntity } from './escrow-payouts-batch.entity'; +import { EscrowPayoutsBatchRepository } from './escrow-payouts-batch.repository'; @Injectable() export class EscrowCompletionService { @@ -28,6 +36,7 @@ export class EscrowCompletionService { constructor( private readonly escrowCompletionRepository: EscrowCompletionRepository, + private readonly escrowPayoutsBatchRepository: EscrowPayoutsBatchRepository, private readonly web3Service: Web3Service, private readonly webhookOutgoingService: WebhookOutgoingService, private readonly payoutService: PayoutService, @@ -116,21 +125,49 @@ export class EscrowCompletionService { ); } - await this.payoutService.executePayouts( + const calculatedPayouts = await this.payoutService.calculatePayouts( escrowCompletionEntity.chainId, escrowCompletionEntity.escrowAddress, escrowCompletionEntity.finalResultsUrl, - escrowCompletionEntity.finalResultsHash, + ); + + /** + * When creating payout batches we need to guarantee deterministic result, + * so order it first. + */ + const payoutBatches = _.chunk( + _.orderBy(calculatedPayouts, 'address', 'asc'), + ESCROW_BULK_PAYOUT_MAX_ITEMS, + ); + + await Promise.all( + payoutBatches.map(async (payoutsBatch) => { + try { + await this.createEscrowPayoutsBatch( + escrowCompletionEntity.id, + payoutsBatch, + ); + } catch (error) { + if (isDuplicatedError(error)) { + /** + * Already created. Noop. + */ + return; + } + + throw error; + } + }), ); } - escrowCompletionEntity.status = EscrowCompletionStatus.PAID; + escrowCompletionEntity.status = EscrowCompletionStatus.AWAITING_PAYOUTS; await this.escrowCompletionRepository.updateOne(escrowCompletionEntity); - } catch (err) { + } catch (error) { const errorId = uuidv4(); const failureDetail = `${ErrorEscrowCompletion.PendingProcessingFailed} (Error ID: ${errorId})`; this.logger.error( - `Error processing escrow completion. Error ID: ${errorId}, Escrow completion ID: ${escrowCompletionEntity.id}, Reason: ${failureDetail}, Message: ${err.message}`, + `Error processing escrow completion. Error ID: ${errorId}, Escrow completion ID: ${escrowCompletionEntity.id}, Reason: ${failureDetail}, Message: ${error.message}`, ); await this.handleEscrowCompletionError( escrowCompletionEntity, @@ -157,7 +194,7 @@ export class EscrowCompletionService { const escrowStatus = await escrowClient.getStatus(escrowAddress); - if (escrowStatus === EscrowStatus.Paid) { + if ([EscrowStatus.Partial, EscrowStatus.Paid].includes(escrowStatus)) { await escrowClient.complete(escrowAddress, { gasPrice: await this.web3Service.calculateGasPrice(chainId), }); @@ -256,4 +293,127 @@ export class EscrowCompletionService { } } } + + public async createEscrowPayoutsBatch( + escrowCompletionId: number, + payoutsBatch: CalculatedPayout[], + ): Promise { + const formattedPayouts = payoutsBatch.map((payout) => ({ + ...payout, + amount: payout.amount.toString(), + })); + + const batchHash = crypto + .createHash('sha1') + .update(stringify(formattedPayouts)) + .digest('hex'); + + const escrowPayoutsBatchEntity = new EscrowPayoutsBatchEntity(); + escrowPayoutsBatchEntity.escrowCompletionTrackingId = escrowCompletionId; + escrowPayoutsBatchEntity.payouts = formattedPayouts; + escrowPayoutsBatchEntity.payoutsHash = batchHash; + + await this.escrowPayoutsBatchRepository.createUnique( + escrowPayoutsBatchEntity, + ); + } + + public async processAwaitingPayouts(): Promise { + const escrowCompletionEntities = + await this.escrowCompletionRepository.findByStatus( + EscrowCompletionStatus.AWAITING_PAYOUTS, + ); + + for (const escrowCompletionEntity of escrowCompletionEntities) { + try { + const payoutBatches = + await this.escrowPayoutsBatchRepository.findForEscrowCompletionTracking( + escrowCompletionEntity.id, + ); + + let hasFailedPayouts = false; + for (const payoutsBatch of payoutBatches) { + try { + await this.processPayoutsBatch( + escrowCompletionEntity, + payoutsBatch, + ); + } catch (error) { + this.logger.error( + `Failed to process payouts batch ${payoutsBatch.id}`, + error, + ); + hasFailedPayouts = true; + } + } + + if (hasFailedPayouts) { + throw new Error('Not all payouts batches succeeded'); + } else { + escrowCompletionEntity.status = EscrowCompletionStatus.PAID; + await this.escrowCompletionRepository.updateOne( + escrowCompletionEntity, + ); + } + } catch (error) { + const errorId = uuidv4(); + const failureDetail = `${ErrorEscrowCompletion.AwaitingPayoutsProcessingFailed} (Error ID: ${errorId})`; + this.logger.error( + `Error processing escrow completion. Error ID: ${errorId}, Escrow completion ID: ${escrowCompletionEntity.id}, Reason: ${failureDetail}, Message: ${error.message}`, + ); + await this.handleEscrowCompletionError( + escrowCompletionEntity, + failureDetail, + ); + continue; + } + } + } + + private async processPayoutsBatch( + escrowCompletionEntity: EscrowCompletionEntity, + payoutsBatch: EscrowPayoutsBatchEntity, + ): Promise { + const signer = this.web3Service.getSigner(escrowCompletionEntity.chainId); + const escrowClient = await EscrowClient.build(signer); + + const recipientToAmountMap = new Map(); + for (const { address, amount } of payoutsBatch.payouts) { + recipientToAmountMap.set(address, BigInt(amount)); + } + + const rawTransaction = await escrowClient.createBulkPayoutTransaction( + escrowCompletionEntity.escrowAddress, + Array.from(recipientToAmountMap.keys()), + Array.from(recipientToAmountMap.values()), + escrowCompletionEntity.finalResultsUrl, + escrowCompletionEntity.finalResultsHash, + { + gasPrice: await this.web3Service.calculateGasPrice( + escrowCompletionEntity.chainId, + ), + nonce: payoutsBatch.txNonce, + }, + ); + + if (!payoutsBatch.txNonce) { + payoutsBatch.txNonce = rawTransaction.nonce; + } + + await this.escrowPayoutsBatchRepository.updateOne(payoutsBatch); + + try { + const transactionResponse = await signer.sendTransaction(rawTransaction); + await transactionResponse.wait(); + + await this.escrowPayoutsBatchRepository.deleteOne(payoutsBatch); + } catch (error) { + if (ethers.isError(error, 'NONCE_EXPIRED')) { + delete payoutsBatch.txNonce; + await this.escrowPayoutsBatchRepository.updateOne(payoutsBatch); + } + + throw error; + } + } } diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.entity.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.entity.ts new file mode 100644 index 0000000000..120be9fb7b --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.entity.ts @@ -0,0 +1,33 @@ +import { Column, Entity, Index, ManyToOne } from 'typeorm'; + +import { NS } from '../../common/constants'; +import { BaseEntity } from '../../database/base.entity'; +import type { EscrowCompletionEntity } from './escrow-completion.entity'; + +export type EscrowPayout = { + address: string; + amount: string; +}; + +@Entity({ schema: NS, name: 'escrow_payouts_batch' }) +@Index(['escrowCompletionTrackingId', 'payoutsHash'], { unique: true }) +export class EscrowPayoutsBatchEntity extends BaseEntity { + @ManyToOne('EscrowCompletionEntity', { onDelete: 'CASCADE' }) + escrowCompletionTracking: EscrowCompletionEntity; + + @Column() + escrowCompletionTrackingId: number; + /** + * Storing it as `json` in order to store it "as-is", + * so if needed we can easilly see the original data. + * No need to query or index this field, just store. + */ + @Column({ type: 'json' }) + public payouts: EscrowPayout[]; + + @Column({ type: 'varchar' }) + public payoutsHash: string; + + @Column({ type: 'int', nullable: true }) + public txNonce?: number; +} diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.repository.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.repository.ts new file mode 100644 index 0000000000..a6491aa756 --- /dev/null +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/escrow-payouts-batch.repository.ts @@ -0,0 +1,22 @@ +import { Injectable, Logger } from '@nestjs/common'; +import { BaseRepository } from '../../database/base.repository'; +import { DataSource } from 'typeorm'; +import { EscrowPayoutsBatchEntity } from './escrow-payouts-batch.entity'; + +@Injectable() +export class EscrowPayoutsBatchRepository extends BaseRepository { + private readonly logger = new Logger(EscrowPayoutsBatchRepository.name); + constructor(private dataSource: DataSource) { + super(EscrowPayoutsBatchEntity, dataSource); + } + + public async findForEscrowCompletionTracking( + escrowCompletionTrackingId: number, + ): Promise { + return this.find({ + where: { + escrowCompletionTrackingId, + }, + }); + } +} diff --git a/packages/apps/reputation-oracle/server/src/modules/kyc/kyc.module.ts b/packages/apps/reputation-oracle/server/src/modules/kyc/kyc.module.ts index c732684055..51f6dd5f58 100644 --- a/packages/apps/reputation-oracle/server/src/modules/kyc/kyc.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/kyc/kyc.module.ts @@ -5,19 +5,11 @@ import { ConfigModule } from '@nestjs/config'; import { KycService } from './kyc.service'; import { KycController } from './kyc.controller'; import { KycRepository } from './kyc.repository'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { KycEntity } from './kyc.entity'; import { UserModule } from '../user/user.module'; import { Web3Module } from '../web3/web3.module'; @Module({ - imports: [ - UserModule, - TypeOrmModule.forFeature([KycEntity]), - ConfigModule, - HttpModule, - Web3Module, - ], + imports: [UserModule, ConfigModule, HttpModule, Web3Module], providers: [KycService, KycRepository], controllers: [KycController], exports: [KycService], diff --git a/packages/apps/reputation-oracle/server/src/modules/payout/payout.interface.ts b/packages/apps/reputation-oracle/server/src/modules/payout/payout.interface.ts index 7ccd5a95cd..096afbe53f 100644 --- a/packages/apps/reputation-oracle/server/src/modules/payout/payout.interface.ts +++ b/packages/apps/reputation-oracle/server/src/modules/payout/payout.interface.ts @@ -4,13 +4,29 @@ import { CvatManifestDto, FortuneManifestDto, } from '../../common/dto/manifest'; -import { PayoutsDataDto, SaveResultDto } from '../../common/dto/result'; + +export class SaveResultDto { + /** + * URL to the stored results. + */ + url: string; + + /** + * Hash of the stored results. + */ + hash: string; +} + +export type CalculatedPayout = { + address: string; + amount: bigint; +}; export interface RequestAction { calculatePayouts: ( manifest: FortuneManifestDto | CvatManifestDto, data: CalculatePayoutsDto, - ) => Promise; + ) => Promise; saveResults: ( chainId: ChainId, escrowAddress: string, diff --git a/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.spec.ts index 6139530ca3..d2b59abe18 100644 --- a/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.spec.ts @@ -1,3 +1,6 @@ +import { createMock } from '@golevelup/ts-jest'; +import { ConfigModule, registerAs } from '@nestjs/config'; +import { HttpStatus } from '@nestjs/common'; import { Test } from '@nestjs/testing'; import { ChainId, EscrowClient } from '@human-protocol/sdk'; import { @@ -14,19 +17,13 @@ import { MOCK_S3_USE_SSL, } from '../../../test/constants'; import { JobRequestType } from '../../common/enums'; -import { ConfigModule, registerAs } from '@nestjs/config'; import { Web3Service } from '../web3/web3.service'; import { StorageService } from '../storage/storage.service'; import { PayoutService } from './payout.service'; -import { createMock } from '@golevelup/ts-jest'; import { CvatManifestDto } from '../../common/dto/manifest'; import { ErrorManifest, ErrorResults } from '../../common/constants/errors'; -import { - CvatAnnotationMeta, - PayoutsDataDto, - SaveResultDto, -} from '../../common/dto/result'; -import { HttpStatus } from '@nestjs/common'; +import { CvatAnnotationMeta } from '../../common/dto/result'; +import { CalculatedPayout, SaveResultDto } from './payout.interface'; import { ControlledError } from '../../common/errors/controlled'; jest.mock('@human-protocol/sdk', () => ({ @@ -203,19 +200,38 @@ describe('PayoutService', () => { ), ); }); + + it('should throw an error for unsupported request types', async () => { + const mockManifest = { requestType: 'unsupportedType' }; + + jest.spyOn(EscrowClient, 'build').mockResolvedValue({ + getManifestUrl: jest.fn().mockResolvedValue(MOCK_FILE_URL), + } as any); + + jest + .spyOn(storageService, 'downloadJsonLikeData') + .mockResolvedValue(mockManifest); + + await expect( + payoutService.processResults(ChainId.LOCALHOST, MOCK_ADDRESS), + ).rejects.toThrow( + `Unsupported request type: ${mockManifest.requestType.toLowerCase()}`, + ); + }); }); - describe('executePayouts', () => { - const results: PayoutsDataDto = { - recipients: [MOCK_ADDRESS], - amounts: [1n], - }; + describe('calculatePayouts', () => { + const results: CalculatedPayout[] = [ + { + address: MOCK_ADDRESS, + amount: 1n, + }, + ]; let escrowClientMock: any; beforeEach(() => { escrowClientMock = { getManifestUrl: jest.fn().mockResolvedValue(MOCK_FILE_URL), - bulkPayOut: jest.fn().mockResolvedValue(true), }; EscrowClient.build = jest.fn().mockImplementation(() => escrowClientMock); @@ -224,7 +240,7 @@ describe('PayoutService', () => { ] = jest.fn().mockResolvedValue(results); }); - it('should successfully performs payouts for CVAT', async () => { + it('should successfully calculate payouts for CVAT', async () => { const manifest: CvatManifestDto = { data: { data_url: MOCK_FILE_URL, @@ -251,15 +267,15 @@ describe('PayoutService', () => { const escrowAddress = MOCK_ADDRESS; const chainId = ChainId.LOCALHOST; - await payoutService.executePayouts( + const payouts = await payoutService.calculatePayouts( chainId, escrowAddress, MOCK_FILE_URL, - MOCK_FILE_HASH, ); + expect(payouts).toEqual(results); + expect(escrowClientMock.getManifestUrl).toHaveBeenCalledTimes(1); - expect(escrowClientMock.bulkPayOut).toHaveBeenCalledTimes(1); }); it('should successfully performs payouts for Fortune', async () => { @@ -275,10 +291,12 @@ describe('PayoutService', () => { .spyOn(storageService, 'downloadJsonLikeData') .mockResolvedValue(manifest); - const results: PayoutsDataDto = { - recipients: [MOCK_ADDRESS], - amounts: [1n], - }; + const results: CalculatedPayout[] = [ + { + address: MOCK_ADDRESS, + amount: 1n, + }, + ]; payoutService.createPayoutSpecificActions[JobRequestType.FORTUNE][ 'calculatePayouts' @@ -287,51 +305,15 @@ describe('PayoutService', () => { const escrowAddress = MOCK_ADDRESS; const chainId = ChainId.LOCALHOST; - await payoutService.executePayouts( + const payouts = await payoutService.calculatePayouts( chainId, escrowAddress, MOCK_FILE_URL, - MOCK_FILE_HASH, - ); - - expect(escrowClientMock.getManifestUrl).toHaveBeenCalledTimes(1); - expect(escrowClientMock.bulkPayOut).toHaveBeenCalledTimes(1); - }); - - it('should throw an error if the manifest url does not exist', async () => { - EscrowClient.build = jest.fn().mockResolvedValue({ - getManifestUrl: jest.fn().mockResolvedValue(null), - }); - - const escrowAddress = MOCK_ADDRESS; - const chainId = ChainId.LOCALHOST; - - await expect( - payoutService.processResults(chainId, escrowAddress), - ).rejects.toThrow( - new ControlledError( - ErrorManifest.ManifestUrlDoesNotExist, - HttpStatus.BAD_REQUEST, - ), ); - }); - it('should throw an error for unsupported request types', async () => { - const mockManifest = { requestType: 'unsupportedType' }; + expect(payouts).toEqual(results); - jest.spyOn(EscrowClient, 'build').mockResolvedValue({ - getManifestUrl: jest.fn().mockResolvedValue(MOCK_FILE_URL), - } as any); - - jest - .spyOn(storageService, 'downloadJsonLikeData') - .mockResolvedValue(mockManifest); - - await expect( - payoutService.processResults(ChainId.LOCALHOST, MOCK_ADDRESS), - ).rejects.toThrow( - `Unsupported request type: ${mockManifest.requestType.toLowerCase()}`, - ); + expect(escrowClientMock.getManifestUrl).toHaveBeenCalledTimes(1); }); }); @@ -464,8 +446,7 @@ describe('PayoutService', () => { manifest, MOCK_FILE_URL, ); - expect(result.recipients).toEqual(expect.any(Array)); - expect(result.amounts).toEqual(expect.any(Array)); + expect(result).toEqual(expect.any(Array)); }); }); @@ -582,12 +563,7 @@ describe('PayoutService', () => { chainId, escrowAddress, ); - expect(result).toEqual({ - recipients: expect.any(Array), - amounts: expect.any(Array), - }); - expect(result.recipients.length).toEqual(1); - expect(result.amounts.length).toEqual(1); + expect(result.length).toEqual(1); }); it('should throw an error if no annotations meta found', async () => { diff --git a/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.ts b/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.ts index fd75b794ed..06a6cde07e 100644 --- a/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.ts +++ b/packages/apps/reputation-oracle/server/src/modules/payout/payout.service.ts @@ -19,10 +19,12 @@ import { import { CvatAnnotationMeta, FortuneFinalResult, - PayoutsDataDto, - SaveResultDto, } from '../../common/dto/result'; -import { RequestAction } from './payout.interface'; +import { + CalculatedPayout, + RequestAction, + SaveResultDto, +} from './payout.interface'; import { getRequestType, isValidJobRequestType } from '../../common/utils'; import { ControlledError } from '../../common/errors/controlled'; @@ -47,8 +49,6 @@ export class PayoutService { chainId: ChainId, escrowAddress: string, ): Promise { - this.logger.log('Save results START'); - const signer = this.web3Service.getSigner(chainId); const escrowClient = await EscrowClient.build(signer); @@ -76,8 +76,6 @@ export class PayoutService { const results = await saveResults(chainId, escrowAddress, manifest); - this.logger.log('Save results STOP'); - return results; } @@ -91,14 +89,11 @@ export class PayoutService { * @param hash The hash of the final results. * @returns {Promise} */ - public async executePayouts( + public async calculatePayouts( chainId: ChainId, escrowAddress: string, - url: string, - hash: string, - ): Promise { - this.logger.log('Payouts START'); - + finalResultsUrl: string, + ): Promise { const signer = this.web3Service.getSigner(chainId); const escrowClient = await EscrowClient.build(signer); @@ -127,23 +122,10 @@ export class PayoutService { const data: CalculatePayoutsDto = { chainId, escrowAddress, - finalResultsUrl: url, + finalResultsUrl, }; - const results = await calculatePayouts(manifest, data); - await escrowClient.bulkPayOut( - escrowAddress, - results.recipients, - results.amounts, - url, - hash, - true, // TODO: Temporary value; it should be made dynamic in the future when the system supports batch processing. - { - gasPrice: await this.web3Service.calculateGasPrice(chainId), - }, - ); - - this.logger.log('Payouts STOP'); + return await calculatePayouts(manifest, data); } public createPayoutSpecificActions: Record = { @@ -151,7 +133,7 @@ export class PayoutService { calculatePayouts: async ( manifest: FortuneManifestDto, data: CalculatePayoutsDto, - ): Promise => + ): Promise => this.calculatePayoutsFortune(manifest, data.finalResultsUrl), saveResults: async ( chainId: ChainId, @@ -164,7 +146,7 @@ export class PayoutService { calculatePayouts: async ( manifest: CvatManifestDto, data: CalculatePayoutsDto, - ): Promise => + ): Promise => this.calculatePayoutsCvat(manifest, data.chainId, data.escrowAddress), saveResults: async ( chainId: ChainId, @@ -175,7 +157,7 @@ export class PayoutService { calculatePayouts: async ( manifest: CvatManifestDto, data: CalculatePayoutsDto, - ): Promise => + ): Promise => this.calculatePayoutsCvat(manifest, data.chainId, data.escrowAddress), saveResults: async ( chainId: ChainId, @@ -186,7 +168,7 @@ export class PayoutService { calculatePayouts: async ( manifest: CvatManifestDto, data: CalculatePayoutsDto, - ): Promise => + ): Promise => this.calculatePayoutsCvat(manifest, data.chainId, data.escrowAddress), saveResults: async ( chainId: ChainId, @@ -197,7 +179,7 @@ export class PayoutService { calculatePayouts: async ( manifest: CvatManifestDto, data: CalculatePayoutsDto, - ): Promise => + ): Promise => this.calculatePayoutsCvat(manifest, data.chainId, data.escrowAddress), saveResults: async ( chainId: ChainId, @@ -208,7 +190,7 @@ export class PayoutService { calculatePayouts: async ( manifest: CvatManifestDto, data: CalculatePayoutsDto, - ): Promise => + ): Promise => this.calculatePayoutsCvat(manifest, data.chainId, data.escrowAddress), saveResults: async ( chainId: ChainId, @@ -301,12 +283,12 @@ export class PayoutService { * and final results. Distributes rewards proportionally to qualified recipients. * @param manifest The Fortune manifest data. * @param finalResultsUrl URL of the final results for this job. - * @returns {Promise} Recipients, amounts, and relevant storage data. + * @returns {Promise} Recipients, amounts, and relevant storage data. */ public async calculatePayoutsFortune( manifest: FortuneManifestDto, finalResultsUrl: string, - ): Promise { + ): Promise { const finalResults = (await this.storageService.downloadJsonLikeData( finalResultsUrl, )) as FortuneFinalResult[]; @@ -318,9 +300,11 @@ export class PayoutService { const payoutAmount = BigInt(ethers.parseUnits(manifest.fundAmount.toString(), 'ether')) / BigInt(recipients.length); - const amounts = new Array(recipients.length).fill(payoutAmount); - return { recipients, amounts }; + return recipients.map((recipient) => ({ + address: recipient, + amount: payoutAmount, + })); } /** @@ -329,13 +313,13 @@ export class PayoutService { * @param manifest The CVAT manifest data. * @param chainId The blockchain chain ID. * @param escrowAddress The escrow contract address. - * @returns {Promise} Recipients, amounts, and relevant storage data. + * @returns {Promise} Recipients, amounts, and relevant storage data. */ public async calculatePayoutsCvat( manifest: CvatManifestDto, chainId: ChainId, escrowAddress: string, - ): Promise { + ): Promise { const signer = this.web3Service.getSigner(chainId); const escrowClient = await EscrowClient.build(signer); @@ -364,28 +348,33 @@ export class PayoutService { ); } - const bountyValue = ethers.parseUnits(manifest.job_bounty, 18); - const accumulatedBounties = annotations.jobs.reduce((accMap, job) => { - const finalResult = annotations.results.find( + const jobBountyValue = ethers.parseUnits(manifest.job_bounty, 18); + const workersBounties = new Map(); + + for (const job of annotations.jobs) { + const jobFinalResult = annotations.results.find( (result) => result.id === job.final_result_id, ); if ( - finalResult - // && finalResult.annotation_quality >= manifest.validation.min_quality + jobFinalResult + // && jobFinalResult.annotation_quality >= manifest.validation.min_quality ) { - const existingValue = - accMap.get(finalResult.annotator_wallet_address) || 0n; - accMap.set( - finalResult.annotator_wallet_address, - existingValue + bountyValue, + const workerAddress = jobFinalResult.annotator_wallet_address; + + const currentWorkerBounty = workersBounties.get(workerAddress) || 0n; + + workersBounties.set( + workerAddress, + currentWorkerBounty + jobBountyValue, ); } - return accMap; - }, new Map()); - - const recipients = [...accumulatedBounties.keys()]; - const amounts = [...accumulatedBounties.values()]; + } - return { recipients, amounts }; + return Array.from(workersBounties.entries()).map( + ([workerAddress, bountyAmount]) => ({ + address: workerAddress, + amount: bountyAmount, + }), + ); } } diff --git a/packages/apps/reputation-oracle/server/src/modules/qualification/qualification.module.ts b/packages/apps/reputation-oracle/server/src/modules/qualification/qualification.module.ts index 33deaa959c..3f67454aa8 100644 --- a/packages/apps/reputation-oracle/server/src/modules/qualification/qualification.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/qualification/qualification.module.ts @@ -1,14 +1,12 @@ import { Logger, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { ConfigModule } from '@nestjs/config'; import { QualificationService } from './qualification.service'; -import { QualificationEntity } from './qualification.entity'; import { QualificationRepository } from './qualification.repository'; import { UserRepository } from '../user/user.repository'; import { QualificationController } from './qualification.controller'; @Module({ - imports: [TypeOrmModule.forFeature([QualificationEntity]), ConfigModule], + imports: [ConfigModule], providers: [ Logger, QualificationService, diff --git a/packages/apps/reputation-oracle/server/src/modules/reputation/reputation.module.ts b/packages/apps/reputation-oracle/server/src/modules/reputation/reputation.module.ts index e1c18b1f2f..0bd6527cb6 100644 --- a/packages/apps/reputation-oracle/server/src/modules/reputation/reputation.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/reputation/reputation.module.ts @@ -1,9 +1,7 @@ import { Logger, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { ConfigModule } from '@nestjs/config'; import { ReputationService } from './reputation.service'; -import { ReputationEntity } from './reputation.entity'; import { HttpModule } from '@nestjs/axios'; import { ReputationRepository } from './reputation.repository'; import { ReputationController } from './reputation.controller'; @@ -11,13 +9,7 @@ import { StorageModule } from '../storage/storage.module'; import { Web3Module } from '../web3/web3.module'; @Module({ - imports: [ - TypeOrmModule.forFeature([ReputationEntity]), - ConfigModule, - HttpModule, - StorageModule, - Web3Module, - ], + imports: [ConfigModule, HttpModule, StorageModule, Web3Module], controllers: [ReputationController], providers: [Logger, ReputationService, ReputationRepository], exports: [ReputationService], diff --git a/packages/apps/reputation-oracle/server/src/modules/user/user.module.ts b/packages/apps/reputation-oracle/server/src/modules/user/user.module.ts index fcf3ffb8a7..3e26900305 100644 --- a/packages/apps/reputation-oracle/server/src/modules/user/user.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/user/user.module.ts @@ -1,23 +1,15 @@ import { Logger, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { ConfigModule } from '@nestjs/config'; import { UserService } from './user.service'; -import { UserEntity } from './user.entity'; import { UserRepository } from './user.repository'; import { UserController } from './user.controller'; import { Web3Module } from '../web3/web3.module'; import { SiteKeyRepository } from './site-key.repository'; -import { SiteKeyEntity } from './site-key.entity'; import { HCaptchaModule } from '../../integrations/hcaptcha/hcaptcha.module'; @Module({ - imports: [ - TypeOrmModule.forFeature([UserEntity, SiteKeyEntity]), - ConfigModule, - Web3Module, - HCaptchaModule, - ], + imports: [ConfigModule, Web3Module, HCaptchaModule], providers: [Logger, UserService, UserRepository, SiteKeyRepository], controllers: [UserController], exports: [UserService], diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.module.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.module.ts index 0a3652ca6a..a26f584821 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.module.ts @@ -1,23 +1,15 @@ import { Logger, Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { HttpModule } from '@nestjs/axios'; import { Web3Module } from '../web3/web3.module'; import { WebhookController } from './webhook.controller'; -import { WebhookIncomingEntity } from './webhook-incoming.entity'; import { WebhookIncomingRepository } from './webhook-incoming.repository'; import { EscrowCompletionModule } from '../escrow-completion/escrow-completion.module'; import { WebhookIncomingService } from './webhook-incoming.service'; @Module({ - imports: [ - TypeOrmModule.forFeature([WebhookIncomingEntity]), - ConfigModule, - Web3Module, - HttpModule, - EscrowCompletionModule, - ], + imports: [ConfigModule, Web3Module, HttpModule, EscrowCompletionModule], controllers: [WebhookController], providers: [Logger, WebhookIncomingService, WebhookIncomingRepository], exports: [WebhookIncomingService], diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts index a6e5238989..f3754ec9e5 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-incoming.service.spec.ts @@ -31,6 +31,7 @@ import { ReputationConfigService } from '../../common/config/reputation-config.s import { S3ConfigService } from '../../common/config/s3-config.service'; import { PGPConfigService } from '../../common/config/pgp-config.service'; import { IncomingWebhookError, WebhookErrorMessage } from './webhook.error'; +import { EscrowPayoutsBatchRepository } from '../escrow-completion/escrow-payouts-batch.repository'; describe('WebhookIncomingService', () => { let webhookIncomingService: WebhookIncomingService, @@ -80,6 +81,10 @@ describe('WebhookIncomingService', () => { provide: EscrowCompletionRepository, useValue: createMock(), }, + { + provide: EscrowPayoutsBatchRepository, + useValue: createMock(), + }, { provide: WebhookOutgoingRepository, useValue: createMock(), diff --git a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.module.ts b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.module.ts index 27858fd0c1..cb82de9b2a 100644 --- a/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.module.ts +++ b/packages/apps/reputation-oracle/server/src/modules/webhook/webhook-outgoing.module.ts @@ -1,19 +1,12 @@ import { Logger, Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { HttpModule } from '@nestjs/axios'; import { Web3Module } from '../web3/web3.module'; -import { WebhookOutgoingEntity } from './webhook-outgoing.entity'; import { WebhookOutgoingRepository } from './webhook-outgoing.repository'; import { WebhookOutgoingService } from './webhook-outgoing.service'; @Module({ - imports: [ - TypeOrmModule.forFeature([WebhookOutgoingEntity]), - ConfigModule, - Web3Module, - HttpModule, - ], + imports: [ConfigModule, Web3Module, HttpModule], providers: [Logger, WebhookOutgoingService, WebhookOutgoingRepository], exports: [WebhookOutgoingService], }) diff --git a/packages/apps/reputation-oracle/server/test/constants.ts b/packages/apps/reputation-oracle/server/test/constants.ts index d67f7479dc..a2106b5c86 100644 --- a/packages/apps/reputation-oracle/server/test/constants.ts +++ b/packages/apps/reputation-oracle/server/test/constants.ts @@ -20,6 +20,8 @@ export const MOCK_EXCHANGE_ORACLE_ADDRESS = '0xCf88b3f1992458C2f5a229573c768D0E9F70C441'; export const MOCK_RECORDING_ORACLE_ADDRESS = '0xCf88b3f1992458C2f5a229573c768D0E9F70C442'; +export const MOCK_REPUTATION_ORACLE_ADDRESS = + '0xCf88b3f1992458C2f5a229573c768D0E9F70C443'; export const MOCK_MANIFEST: IFortuneManifest = { submissionsRequired: 2, requesterTitle: 'Fortune', diff --git a/packages/sdk/python/human-protocol-sdk/example.py b/packages/sdk/python/human-protocol-sdk/example.py index 161cc53991..0156e50e50 100644 --- a/packages/sdk/python/human-protocol-sdk/example.py +++ b/packages/sdk/python/human-protocol-sdk/example.py @@ -1,5 +1,6 @@ import datetime import json +from unittest.mock import MagicMock from human_protocol_sdk.constants import ChainId, Status from human_protocol_sdk.escrow import EscrowUtils @@ -130,20 +131,77 @@ def agreement_example(): print(agreement_report) +def create_bulk_payout_transaction_example(): + from web3 import Web3 + from eth_typing import URI + from human_protocol_sdk.escrow import EscrowClient + from web3.middleware import construct_sign_and_send_raw_middleware + + rpc_url = "https://polygon-amoy.g.alchemy.com/v2/LAmhWAjFXhdNfnXo5wsh890nJEgE9DZu" + private_key = "0fa18d48fe17c5339faea61064b9d1b3fd17f7cf5a6b40cd249e3ce08c9705cb" + + def get_w3_with_priv_key(priv_key: str): + w3 = Web3(Web3.HTTPProvider(URI(rpc_url))) + gas_payer = w3.eth.account.from_key(priv_key) + w3.eth.default_account = gas_payer.address + w3.middleware_onion.add( + construct_sign_and_send_raw_middleware(gas_payer), + "construct_sign_and_send_raw_middleware", + ) + return (w3, gas_payer) + + (w3, gas_payer) = get_w3_with_priv_key(private_key) + escrow_client = EscrowClient(w3) + + # Parámetros de la transacción + escrow_address = ( + "0x5235EEb56471cB0A395776988b213C2832b22d62" # Dirección del escrow + ) + # Direcciones de los destinatarios + recipients = ["0x4163766Cde8410fDDabC4C75a0E2939c55116cC7"] + amounts = [100] # Cantidades para cada destinatario + final_results_url = "https://www.example.com/result" # URL de resultados finales + final_results_hash = "test" # Hash de los resultados finales + txId = 1 # ID de la transacción + + # Enviar la transacción + try: + transaction = escrow_client.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + signed_transaction = w3.eth.account.sign_transaction(transaction, private_key) + tx_hash = w3.eth.send_raw_transaction(signed_transaction.raw_transaction) + + # Esperar a que se mine la transacción + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + print(f"Transaction sent with hash: {tx_hash.hex()}") + print(f"Transaction receipt: {tx_receipt}") + print(f"Transaction receipt: {tx_receipt['transactionHash'].hex()}") + + except Exception as e: + print("Error creating bulk payout transaction:", str(e)) + + if __name__ == "__main__": statistics_client = StatisticsClient() # Run single example while testing, and remove comments before commit - get_escrows() - get_leaders() + # get_escrows() + # get_leaders() - statistics_client = StatisticsClient(ChainId.POLYGON_AMOY) - get_hmt_holders(statistics_client) - get_escrow_statistics(statistics_client) - get_hmt_statistics(statistics_client) - get_payment_statistics(statistics_client) - get_worker_statistics(statistics_client) - get_hmt_daily_data(statistics_client) + # statistics_client = StatisticsClient(ChainId.POLYGON_AMOY) + # get_hmt_holders(statistics_client) + # get_escrow_statistics(statistics_client) + # get_hmt_statistics(statistics_client) + # get_payment_statistics(statistics_client) + # get_worker_statistics(statistics_client) + # get_hmt_daily_data(statistics_client) - agreement_example() + # agreement_example() + create_bulk_payout_transaction_example() diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py index 3242095373..e5d6d405d5 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py @@ -352,3 +352,6 @@ class KVStoreKeys(Enum): job_types = "job_types" registration_needed = "registration_needed" registration_instructions = "registration_instructions" + + +ESCROW_BULK_PAYOUT_MAX_ITEMS = 99 diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/escrow/escrow_client.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/escrow/escrow_client.py index dd043deaad..31e324fb01 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/escrow/escrow_client.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/escrow/escrow_client.py @@ -53,9 +53,14 @@ def get_w3_with_priv_key(priv_key: str): import logging import os from decimal import Decimal -from typing import List, Optional +from typing import Dict, List, Optional -from human_protocol_sdk.constants import NETWORKS, ChainId, Status +from human_protocol_sdk.constants import ( + ESCROW_BULK_PAYOUT_MAX_ITEMS, + NETWORKS, + ChainId, + Status, +) from human_protocol_sdk.utils import ( get_escrow_interface, get_factory_interface, @@ -233,7 +238,8 @@ def create_escrow( from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -310,7 +316,8 @@ def setup( from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -384,7 +391,8 @@ def fund( from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -397,7 +405,8 @@ def get_w3_with_priv_key(priv_key: str): escrow_client = EscrowClient(w3) amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - escrow_client.fund("0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount) + escrow_client.fund( + "0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount) """ if not Web3.is_address(escrow_address): @@ -447,7 +456,8 @@ def store_results( from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -506,7 +516,8 @@ def complete( from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -569,7 +580,8 @@ def bulk_payout( from human_protocol_sdk.escrow import EscrowClient def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) gas_payer = w3.eth.account.from_key(priv_key) w3.eth.default_account = gas_payer.address w3.middleware_onion.add( @@ -602,29 +614,9 @@ def get_w3_with_priv_key(priv_key: str): ) """ - if not Web3.is_address(escrow_address): - raise EscrowClientError(f"Invalid escrow address: {escrow_address}") - for recipient in recipients: - if not Web3.is_address(recipient): - raise EscrowClientError(f"Invalid recipient address: {recipient}") - if len(recipients) == 0: - raise EscrowClientError("Arrays must have any value") - if len(recipients) != len(amounts): - raise EscrowClientError("Arrays must have same length") - if 0 in amounts: - raise EscrowClientError("Amounts cannot be empty") - if any(amount < 0 for amount in amounts): - raise EscrowClientError("Amounts cannot be negative") - balance = self.get_balance(escrow_address) - total_amount = sum(amounts) - if total_amount > balance: - raise EscrowClientError( - f"Escrow does not have enough balance. Current balance: {balance}. Amounts: {total_amount}" - ) - if not validate_url(final_results_url): - raise EscrowClientError(f"Invalid final results URL: {final_results_url}") - if not final_results_hash: - raise EscrowClientError("Invalid empty final results hash") + self.ensure_correct_bulk_payout_input( + escrow_address, recipients, amounts, final_results_url, final_results_hash + ) if force_complete: handle_transaction( @@ -652,6 +644,166 @@ def get_w3_with_priv_key(priv_key: str): tx_options, ) + def create_bulk_payout_transaction( + self, + escrow_address: str, + recipients: List[str], + amounts: List[Decimal], + final_results_url: str, + final_results_hash: str, + txId: Decimal, + tx_options: Optional[TxParams] = None, + ) -> TxParams: + """Creates a prepared transaction for bulk payout without signing or sending it. + + :param escrow_address: Address of the escrow + :param recipients: Array of recipient addresses + :param amounts: Array of amounts the recipients will receive + :param final_results_url: Final results file url + :param final_results_hash: Final results file hash + :param txId: Serial number of the bulks + :param tx_options: (Optional) Additional transaction parameters + + :return: A dictionary containing the prepared transaction + + :raise EscrowClientError: If an error occurs while checking the parameters + + :example: + .. code-block:: python + + from eth_typing import URI + from web3 import Web3 + from web3.middleware import construct_sign_and_send_raw_middleware + from web3.providers.auto import load_provider_from_uri + + from human_protocol_sdk.escrow import EscrowClient + + def get_w3_with_priv_key(priv_key: str): + w3 = Web3(load_provider_from_uri( + URI("http://localhost:8545"))) + gas_payer = w3.eth.account.from_key(priv_key) + w3.eth.default_account = gas_payer.address + w3.middleware_onion.add( + construct_sign_and_send_raw_middleware(gas_payer), + "construct_sign_and_send_raw_middleware", + ) + return (w3, gas_payer) + + (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') + escrow_client = EscrowClient(w3) + + recipients = [ + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92267' + ] + amounts = [ + Web3.to_wei(5, 'ether'), + Web3.to_wei(10, 'ether') + ] + results_url = 'http://localhost/results.json' + results_hash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079' + + transaction = escrow_client.create_bulk_payout_transaction( + "0x62dD51230A30401C455c8398d06F85e4EaB6309f", + recipients, + amounts, + results_url, + results_hash, + 1 + ) + + print(f"Transaction: {transaction}") + + signed_transaction = w3.eth.account.sign_transaction( + transaction, private_key) + tx_hash = w3.eth.send_raw_transaction( + signed_transaction.raw_transaction) + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + print(f"Transaction sent with hash: {tx_hash.hex()}") + print(f"Transaction receipt: {tx_receipt}") + """ + + self.ensure_correct_bulk_payout_input( + escrow_address, recipients, amounts, final_results_url, final_results_hash + ) + + transaction = ( + self._get_escrow_contract(escrow_address) + .functions.bulkPayOut( + recipients, amounts, final_results_url, final_results_hash, txId + ) + .build_transaction(tx_options or {}) + ) + + # Add nonce if not provided + if "nonce" not in transaction: + transaction["nonce"] = self.w3.eth.get_transaction_count( + self.w3.eth.default_account + ) + + # Add estimated gas + if "gas" not in transaction: + transaction["gas"] = self.w3.eth.estimate_gas(transaction) + + # Handle gas price and EIP-1559 fee fields + if "maxFeePerGas" in transaction or "maxPriorityFeePerGas" in transaction: + # Remove `gasPrice` if EIP-1559 fields are present + transaction.pop("gasPrice", None) + else: + # Use `gasPrice` if not provided + transaction.setdefault("gasPrice", self.w3.eth.gas_price) + + # Add chain ID + transaction["chainId"] = self.w3.eth.chain_id + + return transaction + + def ensure_correct_bulk_payout_input( + self, + escrow_address: str, + recipients: List[str], + amounts: List[Decimal], + final_results_url: str, + final_results_hash: str, + ) -> None: + """Validates input parameters for bulk payout operations. + + :param escrow_address: Address of the escrow + :param recipients: Array of recipient addresses + :param amounts: Array of amounts the recipients will receive + :param final_results_url: Final results file url + :param final_results_hash: Final results file hash + + :return: None + + :raise EscrowClientError: If validation fails + """ + if not Web3.is_address(escrow_address): + raise EscrowClientError(f"Invalid escrow address: {escrow_address}") + for recipient in recipients: + if not Web3.is_address(recipient): + raise EscrowClientError(f"Invalid recipient address: {recipient}") + if len(recipients) == 0: + raise EscrowClientError("Arrays must have any value") + if len(recipients) > ESCROW_BULK_PAYOUT_MAX_ITEMS: + raise EscrowClientError("Too many recipients") + if len(recipients) != len(amounts): + raise EscrowClientError("Arrays must have same length") + if 0 in amounts: + raise EscrowClientError("Amounts cannot be empty") + if any(amount < 0 for amount in amounts): + raise EscrowClientError("Amounts cannot be negative") + balance = self.get_balance(escrow_address) + total_amount = sum(amounts) + if total_amount > balance: + raise EscrowClientError( + f"Escrow does not have enough balance. Current balance: {balance}. Amounts: {total_amount}" + ) + if not validate_url(final_results_url): + raise EscrowClientError(f"Invalid final results URL: {final_results_url}") + if not final_results_hash: + raise EscrowClientError("Invalid empty final results hash") + def cancel( self, escrow_address: str, tx_options: Optional[TxParams] = None ) -> EscrowCancel: diff --git a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/escrow/test_escrow_client.py b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/escrow/test_escrow_client.py index 458b56e891..b31e4e362f 100644 --- a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/escrow/test_escrow_client.py +++ b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/escrow/test_escrow_client.py @@ -973,6 +973,25 @@ def test_bulk_payout_empty_arrays(self): ) self.assertEqual("Arrays must have any value", str(cm.exception)) + def test_bulk_payout_exceed_max_count(self): + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = ["0x1234567890123456789012345678901234567890"] * 100 + amounts = [100] * 100 + final_results_url = "https://www.example.com/result" + final_results_hash = "test" + txId = 1 + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.bulk_payout( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual("Too many recipients", str(cm.exception)) + def test_bulk_payout_zero_amount(self): escrow_address = "0x1234567890123456789012345678901234567890" recipients = ["0x1234567890123456789012345678901234567890"] @@ -1124,34 +1143,6 @@ def test_bulk_payout_invalid_escrow_address(self): "Escrow address is not provided by the factory", str(cm.exception) ) - def test_bulk_payout_exceed_max_count(self): - mock_contract = MagicMock() - mock_contract.functions.bulkPayOut = MagicMock() - mock_contract.functions.bulkPayOut.return_value.transact.side_effect = Exception( - "Error: VM Exception while processing transaction: reverted with reason string 'Too many recipients'." - ) - self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) - self.escrow.get_balance = MagicMock(return_value=100) - escrow_address = "0x1234567890123456789012345678901234567890" - recipients = ["0x1234567890123456789012345678901234567890"] - amounts = [100] - final_results_url = "https://www.example.com/result" - final_results_hash = "test" - txId = 1 - - with self.assertRaises(EscrowClientError) as cm: - self.escrow.bulk_payout( - escrow_address, - recipients, - amounts, - final_results_url, - final_results_hash, - txId, - ) - self.assertEqual( - "Bulk Payout transaction failed: Too many recipients", str(cm.exception) - ) - def test_bulk_payout_exceed_max_value(self): mock_contract = MagicMock() mock_contract.functions.bulkPayOut = MagicMock() @@ -1276,6 +1267,173 @@ def test_bulk_payout_with_tx_options(self): tx_options, ) + def test_create_bulk_payout_transaction(self): + mock_contract = MagicMock() + mock_contract.functions.bulkPayOut = MagicMock() + mock_contract.functions.bulkPayOut.return_value.build_transaction = MagicMock( + return_value={ + "to": "0x1234567890123456789012345678901234567890", + "data": "0x1234", + } + ) + self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.get_balance = MagicMock(return_value=100) + self.w3.eth.estimate_gas = MagicMock(return_value=100) + + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = ["0x1234567890123456789012345678901234567890"] + amounts = [100] + final_results_url = "https://www.example.com/result" + final_results_hash = "test" + txId = 1 + + result = self.escrow.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + + # Verificar que el contrato y los métodos fueron llamados correctamente + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.bulkPayOut.assert_called_once_with( + recipients, amounts, final_results_url, final_results_hash, txId + ) + mock_contract.functions.bulkPayOut.return_value.build_transaction.assert_called_once() + + # Verificar que el resultado contiene los campos esperados + self.assertIn("to", result) + self.assertIn("data", result) + self.assertEqual(result["to"], "0x1234567890123456789012345678901234567890") + self.assertEqual(result["data"], "0x1234") + + def test_create_bulk_payout_transaction_invalid_escrow_address(self): + invalid_escrow_address = "invalid_address" + recipients = ["0x1234567890123456789012345678901234567890"] + amounts = [100] + final_results_url = "https://www.example.com/result" + final_results_hash = "test" + txId = 1 + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.create_bulk_payout_transaction( + invalid_escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual( + f"Invalid escrow address: {invalid_escrow_address}", str(cm.exception) + ) + + def test_create_bulk_payout_transaction_empty_recipients(self): + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = [] + amounts = [100] + final_results_url = "https://www.example.com/result" + final_results_hash = "test" + txId = 1 + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual("Arrays must have any value", str(cm.exception)) + + def test_create_bulk_payout_transaction_mismatched_lengths(self): + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = ["0x1234567890123456789012345678901234567890"] + amounts = [100, 200] + final_results_url = "https://www.example.com/result" + final_results_hash = "test" + txId = 1 + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual("Arrays must have same length", str(cm.exception)) + + def test_create_bulk_payout_transaction_insufficient_balance(self): + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = ["0x1234567890123456789012345678901234567890"] + amounts = [200] + final_results_url = "https://www.example.com/result" + final_results_hash = "test" + txId = 1 + + self.escrow.get_balance = MagicMock(return_value=100) + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual( + "Escrow does not have enough balance. Current balance: 100. Amounts: 200", + str(cm.exception), + ) + + def test_create_bulk_payout_transaction_invalid_url(self): + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = ["0x1234567890123456789012345678901234567890"] + amounts = [100] + final_results_url = "invalid_url" + final_results_hash = "test" + txId = 1 + self.escrow.get_balance = MagicMock(return_value=100) + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual( + f"Invalid final results URL: {final_results_url}", str(cm.exception) + ) + + def test_create_bulk_payout_transaction_empty_hash(self): + escrow_address = "0x1234567890123456789012345678901234567890" + recipients = ["0x1234567890123456789012345678901234567890"] + amounts = [100] + final_results_url = "https://www.example.com/result" + final_results_hash = "" + txId = 1 + self.escrow.get_balance = MagicMock(return_value=100) + + with self.assertRaises(EscrowClientError) as cm: + self.escrow.create_bulk_payout_transaction( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) + self.assertEqual("Invalid empty final results hash", str(cm.exception)) + def test_complete(self): mock_contract = MagicMock() mock_contract.functions.complete = MagicMock() diff --git a/packages/sdk/typescript/human-protocol-sdk/example/encrypt.ts b/packages/sdk/typescript/human-protocol-sdk/example/encrypt.ts index 5815c11ffd..90b0c93854 100644 --- a/packages/sdk/typescript/human-protocol-sdk/example/encrypt.ts +++ b/packages/sdk/typescript/human-protocol-sdk/example/encrypt.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { Encryption } from '../src/encryption'; const ExampleKeys = { diff --git a/packages/sdk/typescript/human-protocol-sdk/example/transactions.ts b/packages/sdk/typescript/human-protocol-sdk/example/transactions.ts index ee42f5ae5d..5d47a10f19 100644 --- a/packages/sdk/typescript/human-protocol-sdk/example/transactions.ts +++ b/packages/sdk/typescript/human-protocol-sdk/example/transactions.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { ChainId } from '../src/enums'; import { TransactionUtils } from '../src/transaction'; import * as dotenv from 'dotenv'; diff --git a/packages/sdk/typescript/human-protocol-sdk/src/constants.ts b/packages/sdk/typescript/human-protocol-sdk/src/constants.ts index 031ad21c68..b94c3429ec 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/constants.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/constants.ts @@ -320,3 +320,5 @@ export const Role = { }; export const SUBGRAPH_API_KEY_PLACEHOLDER = '[SUBGRAPH_API_KEY]'; + +export const ESCROW_BULK_PAYOUT_MAX_ITEMS = 99; diff --git a/packages/sdk/typescript/human-protocol-sdk/src/decorators.ts b/packages/sdk/typescript/human-protocol-sdk/src/decorators.ts index d5cb059f44..d6014c2f79 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/decorators.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/decorators.ts @@ -10,7 +10,7 @@ export function requiresSigner( descriptor.value = async function (this: any, ...args: any[]) { try { - !this.runner.getAddress(); + this.runner.getAddress(); } catch { throw ErrorSigner; } diff --git a/packages/sdk/typescript/human-protocol-sdk/src/error.ts b/packages/sdk/typescript/human-protocol-sdk/src/error.ts index 0d4ccd163c..80cfa555f5 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/error.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/error.ts @@ -243,6 +243,11 @@ export const ErrorRecipientCannotBeEmptyArray = new Error( 'Recipient cannot be an empty array' ); +/** + * @constant {Error} - Too many recipients. + */ +export const ErrorTooManyRecipients = new Error('Too many recipients'); + /** * @constant {Error} - Amount must be greater than zero.. */ diff --git a/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts b/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts index 4d6c631db4..e7763b648f 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts @@ -9,10 +9,14 @@ import { HMToken, HMToken__factory, } from '@human-protocol/core/typechain-types'; -import { ContractRunner, EventLog, Overrides, ethers } from 'ethers'; +import { ContractRunner, EventLog, Overrides, Signer, ethers } from 'ethers'; import gqlFetch from 'graphql-request'; import { BaseEthersClient } from './base'; -import { DEFAULT_TX_ID, NETWORKS } from './constants'; +import { + DEFAULT_TX_ID, + ESCROW_BULK_PAYOUT_MAX_ITEMS, + NETWORKS, +} from './constants'; import { requiresSigner } from './decorators'; import { ChainId, OrderDirection } from './enums'; import { @@ -33,6 +37,7 @@ import { ErrorProviderDoesNotExist, ErrorRecipientAndAmountsMustBeSameLength, ErrorRecipientCannotBeEmptyArray, + ErrorTooManyRecipients, ErrorTotalFeeMustBeLessThanHundred, ErrorTransferEventNotFoundInTransactionLogs, ErrorUnsupportedChainID, @@ -52,6 +57,7 @@ import { EscrowStatus, EscrowWithdraw, NetworkData, + TransactionLikeWithNonce, } from './types'; import { getSubgraphUrl, isValidUrl, throwError } from './utils'; @@ -586,7 +592,7 @@ export class EscrowClient extends BaseEthersClient { * const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']; * const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')]; * const resultsUrl = 'http://localhost/results.json'; - * const resultsHash'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'; + * const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'; * * await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash); * ``` @@ -601,54 +607,13 @@ export class EscrowClient extends BaseEthersClient { forceComplete = false, txOptions: Overrides = {} ): Promise { - if (!ethers.isAddress(escrowAddress)) { - throw ErrorInvalidEscrowAddressProvided; - } - - if (recipients.length === 0) { - throw ErrorRecipientCannotBeEmptyArray; - } - - if (amounts.length === 0) { - throw ErrorAmountsCannotBeEmptyArray; - } - - if (recipients.length !== amounts.length) { - throw ErrorRecipientAndAmountsMustBeSameLength; - } - - recipients.forEach((recipient) => { - if (!ethers.isAddress(recipient)) { - throw new InvalidEthereumAddressError(recipient); - } - }); - - if (!finalResultsUrl) { - throw ErrorUrlIsEmptyString; - } - - if (!isValidUrl(finalResultsUrl)) { - throw ErrorInvalidUrl; - } - - if (!finalResultsHash) { - throw ErrorHashIsEmptyString; - } - - const balance = await this.getBalance(escrowAddress); - - let totalAmount = 0n; - amounts.forEach((amount) => { - totalAmount = totalAmount + amount; - }); - - if (balance < totalAmount) { - throw ErrorEscrowDoesNotHaveEnoughBalance; - } - - if (!(await this.escrowFactoryContract.hasEscrow(escrowAddress))) { - throw ErrorEscrowAddressIsNotProvidedByFactory; - } + await this.ensureCorrectBulkPayoutInput( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ); try { const escrowContract = this.getEscrowContract(escrowAddress); @@ -927,6 +892,167 @@ export class EscrowClient extends BaseEthersClient { } } + /** + * Creates a prepared transaction for bulk payout without immediately sending it. + * @param {string} escrowAddress Escrow address to payout. + * @param {string[]} recipients Array of recipient addresses. + * @param {bigint[]} amounts Array of amounts the recipients will receive. + * @param {string} finalResultsUrl Final results file url. + * @param {string} finalResultsHash Final results file hash. + * @param {string} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false). + * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object). + * @returns Returns object with raw transaction and signed transaction hash + * + * **Code example** + * + * > Only Reputation Oracle or a trusted handler can call it. + * + * ```ts + * import { ethers, Wallet, providers } from 'ethers'; + * import { EscrowClient } from '@human-protocol/sdk'; + * + * const rpcUrl = 'YOUR_RPC_URL'; + * const privateKey = 'YOUR_PRIVATE_KEY' + * + * const provider = new providers.JsonRpcProvider(rpcUrl); + * const signer = new Wallet(privateKey, provider); + * const escrowClient = await EscrowClient.build(signer); + * + * const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']; + * const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')]; + * const resultsUrl = 'http://localhost/results.json'; + * const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'; + * + * const rawTransaction = await escrowClient.createBulkPayoutTransaction('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash); + * console.log('Raw transaction:', rawTransaction); + * + * const signedTransaction = await signer.signTransaction(rawTransaction); + * console.log('Tx hash:', ethers.keccak256(signedTransaction)); + * (await signer.sendTransaction(rawTransaction)).wait(); + */ + @requiresSigner + async createBulkPayoutTransaction( + escrowAddress: string, + recipients: string[], + amounts: bigint[], + finalResultsUrl: string, + finalResultsHash: string, + txOptions: Overrides = {} + ): Promise { + await this.ensureCorrectBulkPayoutInput( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ); + + const signer = this.runner as Signer; + try { + const escrowContract = this.getEscrowContract(escrowAddress); + + const populatedTransaction = await escrowContract[ + 'bulkPayOut(address[],uint256[],string,string,uint256)' + ].populateTransaction( + recipients, + amounts, + finalResultsUrl, + finalResultsHash, + DEFAULT_TX_ID, + txOptions + ); + + /** + * Safety-belt: explicitly set the passed nonce + * because 'populateTransaction' return value + * doesn't mention it even in library docs, + * even though it includes if from txOptions. + */ + if (typeof txOptions.nonce === 'number') { + populatedTransaction.nonce = txOptions.nonce; + } else { + populatedTransaction.nonce = await signer.getNonce(); + } + /** + * It's needed to get all necessary info for tx object + * before signing it, e.g.: + * - type + * - chainId + * - fees params + * - etc. + * + * All information is needed in order to get proper hash value + */ + const preparedTransaction = + await signer.populateTransaction(populatedTransaction); + + return preparedTransaction as TransactionLikeWithNonce; + } catch (e) { + return throwError(e); + } + } + + private async ensureCorrectBulkPayoutInput( + escrowAddress: string, + recipients: string[], + amounts: bigint[], + finalResultsUrl: string, + finalResultsHash: string + ): Promise { + if (!ethers.isAddress(escrowAddress)) { + throw ErrorInvalidEscrowAddressProvided; + } + + if (recipients.length === 0) { + throw ErrorRecipientCannotBeEmptyArray; + } + + if (recipients.length > ESCROW_BULK_PAYOUT_MAX_ITEMS) { + throw ErrorTooManyRecipients; + } + + if (amounts.length === 0) { + throw ErrorAmountsCannotBeEmptyArray; + } + + if (recipients.length !== amounts.length) { + throw ErrorRecipientAndAmountsMustBeSameLength; + } + + recipients.forEach((recipient) => { + if (!ethers.isAddress(recipient)) { + throw new InvalidEthereumAddressError(recipient); + } + }); + + if (!finalResultsUrl) { + throw ErrorUrlIsEmptyString; + } + + if (!isValidUrl(finalResultsUrl)) { + throw ErrorInvalidUrl; + } + + if (!finalResultsHash) { + throw ErrorHashIsEmptyString; + } + + const balance = await this.getBalance(escrowAddress); + + let totalAmount = 0n; + amounts.forEach((amount) => { + totalAmount = totalAmount + amount; + }); + + if (balance < totalAmount) { + throw ErrorEscrowDoesNotHaveEnoughBalance; + } + + if (!(await this.escrowFactoryContract.hasEscrow(escrowAddress))) { + throw ErrorEscrowAddressIsNotProvidedByFactory; + } + } + /** * This function returns the balance for a specified escrow address. * diff --git a/packages/sdk/typescript/human-protocol-sdk/src/types.ts b/packages/sdk/typescript/human-protocol-sdk/src/types.ts index ad029935b9..12070ffee7 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/types.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/types.ts @@ -1,3 +1,5 @@ +import { TransactionLike } from 'ethers'; + /** * Enum for escrow statuses. * @readonly @@ -168,3 +170,5 @@ export type EscrowWithdraw = { */ amountWithdrawn: bigint; }; + +export type TransactionLikeWithNonce = TransactionLike & { nonce: number }; diff --git a/packages/sdk/typescript/human-protocol-sdk/test/encryption.test.ts b/packages/sdk/typescript/human-protocol-sdk/test/encryption.test.ts index dac00cc13e..3967b8ad22 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/encryption.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/encryption.test.ts @@ -257,7 +257,7 @@ describe('Encryption', async () => { Buffer.from(JSON.stringify(BINARY_MESSAGE_CONTENT)), [KEYPAIR2.publicKey, KEYPAIR3.publicKey] ); - console.log('en', encryptedMessage); + const expectedMessageHeader = '-----BEGIN PGP MESSAGE-----\n'; const expectedMessageFooter = '-----END PGP MESSAGE-----\n'; diff --git a/packages/sdk/typescript/human-protocol-sdk/test/escrow.test.ts b/packages/sdk/typescript/human-protocol-sdk/test/escrow.test.ts index 25139998de..45be38f0bf 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/escrow.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/escrow.test.ts @@ -27,6 +27,8 @@ import { ErrorProviderDoesNotExist, ErrorRecipientAndAmountsMustBeSameLength, ErrorRecipientCannotBeEmptyArray, + ErrorSigner, + ErrorTooManyRecipients, ErrorTotalFeeMustBeLessThanHundred, ErrorUnsupportedChainID, ErrorUrlIsEmptyString, @@ -67,6 +69,9 @@ describe('EscrowClient', () => { mockSigner = { provider: mockProvider.provider, getAddress: vi.fn().mockResolvedValue(ethers.ZeroAddress), + getNonce: vi.fn().mockResolvedValue(0), + populateTransaction: vi.fn().mockImplementation((tx) => tx), + signTransaction: vi.fn(), }; mockEscrowContract = { @@ -75,7 +80,12 @@ describe('EscrowClient', () => { fund: vi.fn(), storeResults: vi.fn(), complete: vi.fn(), - 'bulkPayOut(address[],uint256[],string,string,uint256)': vi.fn(), + 'bulkPayOut(address[],uint256[],string,string,uint256)': Object.assign( + vi.fn(), + { + populateTransaction: vi.fn(), + } + ), 'bulkPayOut(address[],uint256[],string,string,uint256,bool)': vi.fn(), cancel: vi.fn(), withdraw: vi.fn(), @@ -934,6 +944,26 @@ describe('EscrowClient', () => { ).rejects.toThrow(ErrorRecipientCannotBeEmptyArray); }); + test('should throw an error if too many recipients', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = Array.from({ length: 100 }, () => ethers.ZeroAddress); + const amounts = recipients.map(() => 100n); + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + escrowClient.escrowFactoryContract.hasEscrow.mockReturnValue(true); + + await expect( + escrowClient.bulkPayOut( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorTooManyRecipients); + }); + test('should throw an error if amounts length is equal to 0', async () => { const escrowAddress = ethers.ZeroAddress; const recipients = [ethers.ZeroAddress]; @@ -1190,6 +1220,318 @@ describe('EscrowClient', () => { }); }); + describe('createBulkPayoutTransaction', () => { + beforeEach(() => { + escrowClient.escrowFactoryContract.hasEscrow.mockReturnValue(true); + }); + + test('should require signer', async () => { + const originalGetAddress = mockSigner.getAddress; + delete mockSigner.getAddress; + + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress, ethers.ZeroAddress]; + const amounts = [90n, 20n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + let thrownError; + try { + await escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ); + } catch (error) { + thrownError = error; + } + expect(thrownError).toBe(ErrorSigner); + + mockSigner.getAddress = originalGetAddress; + }); + + test('should throw an error if escrowAddress is an invalid address', async () => { + const invalidAddress = FAKE_ADDRESS; + const recipients = [ethers.ZeroAddress]; + const amounts = [100n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + invalidAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorInvalidEscrowAddressProvided); + }); + + test('should throw an error if recipients length is equal to 0', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients: string[] = []; + const amounts = [100n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorRecipientCannotBeEmptyArray); + }); + + test('should throw an error if too many recipients', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = Array.from({ length: 100 }, () => ethers.ZeroAddress); + const amounts = recipients.map(() => 100n); + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + escrowClient.escrowFactoryContract.hasEscrow.mockReturnValue(true); + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorTooManyRecipients); + }); + + test('should throw an error if amounts length is equal to 0', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress]; + const amounts: number[] = []; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorAmountsCannotBeEmptyArray); + }); + + test('should throw an error if recipients and amounts do not have the same length', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress]; + const amounts = [100n, 100n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorRecipientAndAmountsMustBeSameLength); + }); + + test('should throw an error if url is an empty string', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress]; + const amounts = [100n]; + const finalResultsUrl = ''; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorUrlIsEmptyString); + }); + + test('should throw an error if final results url is an invalid url', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress]; + const amounts = [100n]; + const finalResultsUrl = FAKE_URL; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorInvalidUrl); + }); + + test('should throw an error if hash is an empty string', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress]; + const amounts = [100n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = ''; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorHashIsEmptyString); + }); + + test('should throw an error if recipients contains invalid addresses', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [FAKE_ADDRESS]; + const amounts = [100n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(new InvalidEthereumAddressError(FAKE_ADDRESS)); + }); + + test('should throw an error if hasEscrow returns false', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress]; + const amounts = [100n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + escrowClient.escrowFactoryContract.hasEscrow.mockReturnValueOnce(false); + + await expect( + escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorEscrowAddressIsNotProvidedByFactory); + }); + + test('should throw an error if escrow does not have enough balance', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress, ethers.ZeroAddress]; + const amounts = [90n, 20n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + + escrowClient.getBalance = vi.fn().mockReturnValue(50n); + + await expect( + escrowClient.bulkPayOut( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ) + ).rejects.toThrow(ErrorEscrowDoesNotHaveEnoughBalance); + }); + + test('should create raw transaction for bulk payout with nonce of signer', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress, ethers.ZeroAddress]; + const amounts = [10n, 10n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + const signerAddress = ethers.ZeroAddress; + const encodedMethodData = '0xbulkPayOut-call-encoded-data'; + + escrowClient.escrowContract[ + 'bulkPayOut(address[],uint256[],string,string,uint256)' + ].populateTransaction.mockResolvedValueOnce({ + from: signerAddress, + to: escrowAddress, + data: encodedMethodData, + }); + + const signedTransaction = '0x123456'; + mockSigner.signTransaction.mockResolvedValueOnce(signedTransaction); + + const rawTransaction = await escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash + ); + + expect(rawTransaction).toEqual({ + from: signerAddress, + to: escrowAddress, + data: encodedMethodData, + nonce: 0, + }); + }); + + test('should create raw transaction for bulk payout with passed nonce', async () => { + const escrowAddress = ethers.ZeroAddress; + const recipients = [ethers.ZeroAddress, ethers.ZeroAddress]; + const amounts = [10n, 10n]; + const finalResultsUrl = VALID_URL; + const finalResultsHash = FAKE_HASH; + const signerAddress = ethers.ZeroAddress; + const encodedMethodData = '0xbulkPayOut-call-encoded-data'; + + escrowClient.escrowContract[ + 'bulkPayOut(address[],uint256[],string,string,uint256)' + ].populateTransaction.mockResolvedValueOnce({ + from: signerAddress, + to: escrowAddress, + data: encodedMethodData, + }); + + mockSigner.signTransaction.mockResolvedValueOnce('0x123456'); + + const nonce = 42; + const rawTransaction = await escrowClient.createBulkPayoutTransaction( + escrowAddress, + recipients, + amounts, + finalResultsUrl, + finalResultsHash, + { + nonce, + } + ); + + expect(rawTransaction).toEqual({ + from: signerAddress, + to: escrowAddress, + data: encodedMethodData, + nonce, + }); + }); + }); + describe('cancel', () => { test('should throw an error if escrowAddress is an invalid address', async () => { const invalidAddress = FAKE_ADDRESS; diff --git a/packages/sdk/typescript/human-protocol-sdk/test/statistics.test.ts b/packages/sdk/typescript/human-protocol-sdk/test/statistics.test.ts index cfa59e3d6a..f3db21d616 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/statistics.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/statistics.test.ts @@ -228,7 +228,7 @@ describe('StatisticsClient', () => { describe('getHMTStatistics', () => { test('should successfully get HMT statistics', async () => { - const gqlFetchSpy = vi.spyOn(gqlFetch, 'default').mockResolvedValueOnce({ + vi.spyOn(gqlFetch, 'default').mockResolvedValueOnce({ hmtokenStatistics: { totalValueTransfered: '100', totalTransferEventCount: '4', diff --git a/yarn.lock b/yarn.lock index da49f8a956..3462b65957 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18481,16 +18481,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -18599,7 +18590,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -18613,13 +18604,6 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -20740,7 +20724,7 @@ workerpool@^6.5.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -20758,15 +20742,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 3bc3c49c838e3a4780d753b5b76f23508ba546e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:28:06 +0100 Subject: [PATCH 10/28] chore(deps-dev): bump lint-staged from 15.2.10 to 15.3.0 (#2966) Bumps [lint-staged](https://github.com/lint-staged/lint-staged) from 15.2.10 to 15.3.0. - [Release notes](https://github.com/lint-staged/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md) - [Commits](https://github.com/lint-staged/lint-staged/compare/v15.2.10...v15.3.0) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- packages/apps/human-app/frontend/package.json | 2 +- yarn.lock | 58 ++++++++++--------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 8871815e01..b5e6883539 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "husky": "^9.1.6", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", - "lint-staged": "^15.2.7", + "lint-staged": "^15.3.0", "prettier": "^3.4.2", "ts-jest": "^29.2.5", "ts-node": "^10.9.2", diff --git a/packages/apps/human-app/frontend/package.json b/packages/apps/human-app/frontend/package.json index 5705e79a12..b28e49d680 100644 --- a/packages/apps/human-app/frontend/package.json +++ b/packages/apps/human-app/frontend/package.json @@ -68,7 +68,7 @@ "eslint-plugin-react-refresh": "^0.4.11", "husky": "^9.1.6", "jsdom": "^25.0.1", - "lint-staged": "^15.2.1", + "lint-staged": "^15.3.0", "prettier": "^3.4.2", "typescript": "^5.6.3", "vite": "^5.4.7", diff --git a/yarn.lock b/yarn.lock index 3462b65957..3008ee467d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8597,10 +8597,10 @@ chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^5.0.1, chalk@^5.3.0, chalk@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" - integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== +chalk@^5.0.1, chalk@^5.3.0, chalk@~5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.4.1.tgz#1b48bf0963ec158dce2aacf69c093ae2dd2092d8" + integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== char-regex@^1.0.2: version "1.0.2" @@ -9598,10 +9598,10 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.3.7, debug@~4.3.1, debug@~4.3.2, debug@~4.3.6: - version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" - integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.3.7, debug@~4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" + integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== dependencies: ms "^2.1.3" @@ -9619,6 +9619,13 @@ debug@^3.2.6, debug@^3.2.7: dependencies: ms "^2.1.1" +debug@~4.3.1, debug@~4.3.2: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" @@ -14358,10 +14365,10 @@ libphonenumber-js@^1.10.53: resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.11.15.tgz#0947ba02208cf6c44fdf3b07e097a98b3ec945f4" integrity sha512-M7+rtYi9l5RvMmHyjyoF3BHHUpXTYdJ0PezZGHNs0GyW1lO+K7jxlXpbdIb7a56h0nqLYdjIw+E+z0ciGaJP7g== -lilconfig@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.2.tgz#e4a7c3cb549e3a606c8dcc32e5ae1005e62c05cb" - integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow== +lilconfig@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.3.tgz#a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4" + integrity sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw== lines-and-columns@^1.1.6: version "1.2.4" @@ -14375,21 +14382,21 @@ linkify-it@^5.0.0: dependencies: uc.micro "^2.0.0" -lint-staged@^15.2.1, lint-staged@^15.2.7: - version "15.2.10" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.10.tgz#92ac222f802ba911897dcf23671da5bb80643cd2" - integrity sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg== +lint-staged@^15.3.0: + version "15.3.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.3.0.tgz#32a0b3f2f2b8825950bd3b9fb093e045353bdfa3" + integrity sha512-vHFahytLoF2enJklgtOtCtIjZrKD/LoxlaUusd5nh7dWv/dkKQJY74ndFSzxCdv7g0ueGg1ORgTSt4Y9LPZn9A== dependencies: - chalk "~5.3.0" + chalk "~5.4.1" commander "~12.1.0" - debug "~4.3.6" + debug "~4.4.0" execa "~8.0.1" - lilconfig "~3.1.2" - listr2 "~8.2.4" + lilconfig "~3.1.3" + listr2 "~8.2.5" micromatch "~4.0.8" pidtree "~0.6.0" string-argv "~0.3.2" - yaml "~2.5.0" + yaml "~2.6.1" listhen@^1.9.0: version "1.9.0" @@ -14415,7 +14422,7 @@ listhen@^1.9.0: untun "^0.1.3" uqr "^0.1.2" -listr2@~8.2.4: +listr2@~8.2.5: version "8.2.5" resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.2.5.tgz#5c9db996e1afeb05db0448196d3d5f64fec2593d" integrity sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ== @@ -20859,16 +20866,11 @@ yaml@1.10.2, yaml@^1.10.0, yaml@^1.10.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.6.1: +yaml@^2.6.1, yaml@~2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.6.1.tgz#42f2b1ba89203f374609572d5349fb8686500773" integrity sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg== -yaml@~2.5.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130" - integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== - yargs-parser@21.1.1, yargs-parser@^21.0.0, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" From 424ffede9fa68793e3513c15233324b760f8ba6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:06:03 +0100 Subject: [PATCH 11/28] chore(deps): bump wagmi from 2.12.29 to 2.14.6 (#2967) Bumps [wagmi](https://github.com/wevm/wagmi/tree/HEAD/packages/react) from 2.12.29 to 2.14.6. - [Release notes](https://github.com/wevm/wagmi/releases) - [Changelog](https://github.com/wevm/wagmi/blob/main/packages/react/CHANGELOG.md) - [Commits](https://github.com/wevm/wagmi/commits/wagmi@2.14.6/packages/react) --- updated-dependencies: - dependency-name: wagmi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../exchange-oracle/client/package.json | 2 +- packages/apps/human-app/frontend/package.json | 2 +- .../apps/job-launcher/client/package.json | 2 +- yarn.lock | 525 ++---------------- 4 files changed, 50 insertions(+), 481 deletions(-) diff --git a/packages/apps/fortune/exchange-oracle/client/package.json b/packages/apps/fortune/exchange-oracle/client/package.json index 969ea82292..094b9322bc 100644 --- a/packages/apps/fortune/exchange-oracle/client/package.json +++ b/packages/apps/fortune/exchange-oracle/client/package.json @@ -38,7 +38,7 @@ "react-router-dom": "^6.24.1", "serve": "^14.2.4", "vite-plugin-node-polyfills": "^0.22.0", - "wagmi": "^2.12.8" + "wagmi": "^2.14.6" }, "devDependencies": { "@types/react": "^18.3.12", diff --git a/packages/apps/human-app/frontend/package.json b/packages/apps/human-app/frontend/package.json index b28e49d680..07f1e58df3 100644 --- a/packages/apps/human-app/frontend/package.json +++ b/packages/apps/human-app/frontend/package.json @@ -44,7 +44,7 @@ "react-router-dom": "^6.22.0", "viem": "^2.21.44", "vite-plugin-svgr": "^4.2.0", - "wagmi": "2.12.29", + "wagmi": "2.14.6", "zod": "^3.22.4", "zustand": "^4.5.0" }, diff --git a/packages/apps/job-launcher/client/package.json b/packages/apps/job-launcher/client/package.json index fd443712a2..0bc5a8aa36 100644 --- a/packages/apps/job-launcher/client/package.json +++ b/packages/apps/job-launcher/client/package.json @@ -33,7 +33,7 @@ "swr": "^2.2.4", "typescript": "^5.6.3", "viem": "2.x", - "wagmi": "^2.12.8", + "wagmi": "^2.14.6", "web-vitals": "^4.2.2", "xml2js": "^0.6.2", "yup": "^1.2.0" diff --git a/yarn.lock b/yarn.lock index 3008ee467d..2adc54d058 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1188,7 +1188,7 @@ core-js-pure "^3.30.2" regenerator-runtime "^0.14.0" -"@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.9", "@babel/runtime@^7.18.3", "@babel/runtime@^7.19.4", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.25.0", "@babel/runtime@^7.25.6", "@babel/runtime@^7.25.7", "@babel/runtime@^7.26.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": +"@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.9", "@babel/runtime@^7.18.3", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.25.0", "@babel/runtime@^7.25.6", "@babel/runtime@^7.25.7", "@babel/runtime@^7.26.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.26.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1" integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw== @@ -1235,17 +1235,6 @@ resolved "https://registry.yarnpkg.com/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.0.tgz#9bc1cadbb9f86c446c6f579d3431c08a06a6672e" integrity sha512-JorcEwe4ud0x5BS/Ar2aQWOQoFzjq/7jcnxYXCvSMh0oRm0dQXzOA+hqLDBnOMks1LLBA7dmiLLsEBl09Yd6iQ== -"@coinbase/wallet-sdk@4.2.1": - version "4.2.1" - resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-4.2.1.tgz#040acf57dda03cb1f0c1313e7f627c4808f365ff" - integrity sha512-5bKucgWcogXpFNQdahdr7ApNe/bgVeUDHPXO+5O1XPuFctA8V8+cyF6ANLwPWvHJEMBOPsMhIeqDIVmMzHYmaw== - dependencies: - "@noble/hashes" "^1.4.0" - clsx "^1.2.1" - eventemitter3 "^5.0.1" - preact "^10.24.2" - vitest "^2.1.2" - "@coinbase/wallet-sdk@4.2.3": version "4.2.3" resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-4.2.3.tgz#a30fa0605b24bc42c37f52a62d2442bcbb7734af" @@ -1429,236 +1418,116 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== -"@esbuild/aix-ppc64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz#b57697945b50e99007b4c2521507dc613d4a648c" - integrity sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw== - "@esbuild/android-arm64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== -"@esbuild/android-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz#1add7e0af67acefd556e407f8497e81fddad79c0" - integrity sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w== - "@esbuild/android-arm@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== -"@esbuild/android-arm@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.24.0.tgz#ab7263045fa8e090833a8e3c393b60d59a789810" - integrity sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew== - "@esbuild/android-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== -"@esbuild/android-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.24.0.tgz#e8f8b196cfdfdd5aeaebbdb0110983460440e705" - integrity sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ== - "@esbuild/darwin-arm64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== -"@esbuild/darwin-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz#2d0d9414f2acbffd2d86e98253914fca603a53dd" - integrity sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw== - "@esbuild/darwin-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== -"@esbuild/darwin-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz#33087aab31a1eb64c89daf3d2cf8ce1775656107" - integrity sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA== - "@esbuild/freebsd-arm64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== -"@esbuild/freebsd-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz#bb76e5ea9e97fa3c753472f19421075d3a33e8a7" - integrity sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA== - "@esbuild/freebsd-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== -"@esbuild/freebsd-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz#e0e2ce9249fdf6ee29e5dc3d420c7007fa579b93" - integrity sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ== - "@esbuild/linux-arm64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== -"@esbuild/linux-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz#d1b2aa58085f73ecf45533c07c82d81235388e75" - integrity sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g== - "@esbuild/linux-arm@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== -"@esbuild/linux-arm@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz#8e4915df8ea3e12b690a057e77a47b1d5935ef6d" - integrity sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw== - "@esbuild/linux-ia32@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== -"@esbuild/linux-ia32@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz#8200b1110666c39ab316572324b7af63d82013fb" - integrity sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA== - "@esbuild/linux-loong64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== -"@esbuild/linux-loong64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz#6ff0c99cf647504df321d0640f0d32e557da745c" - integrity sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g== - "@esbuild/linux-mips64el@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== -"@esbuild/linux-mips64el@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz#3f720ccd4d59bfeb4c2ce276a46b77ad380fa1f3" - integrity sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA== - "@esbuild/linux-ppc64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== -"@esbuild/linux-ppc64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz#9d6b188b15c25afd2e213474bf5f31e42e3aa09e" - integrity sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ== - "@esbuild/linux-riscv64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== -"@esbuild/linux-riscv64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz#f989fdc9752dfda286c9cd87c46248e4dfecbc25" - integrity sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw== - "@esbuild/linux-s390x@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== -"@esbuild/linux-s390x@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz#29ebf87e4132ea659c1489fce63cd8509d1c7319" - integrity sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g== - "@esbuild/linux-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== -"@esbuild/linux-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz#4af48c5c0479569b1f359ffbce22d15f261c0cef" - integrity sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA== - "@esbuild/netbsd-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== -"@esbuild/netbsd-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz#1ae73d23cc044a0ebd4f198334416fb26c31366c" - integrity sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg== - -"@esbuild/openbsd-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz#5d904a4f5158c89859fd902c427f96d6a9e632e2" - integrity sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg== - "@esbuild/openbsd-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== -"@esbuild/openbsd-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz#4c8aa88c49187c601bae2971e71c6dc5e0ad1cdf" - integrity sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q== - "@esbuild/sunos-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== -"@esbuild/sunos-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz#8ddc35a0ea38575fa44eda30a5ee01ae2fa54dd4" - integrity sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA== - "@esbuild/win32-arm64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== -"@esbuild/win32-arm64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz#6e79c8543f282c4539db684a207ae0e174a9007b" - integrity sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA== - "@esbuild/win32-ia32@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== -"@esbuild/win32-ia32@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz#057af345da256b7192d18b676a02e95d0fa39103" - integrity sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw== - "@esbuild/win32-x64@0.21.5": version "0.21.5" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== -"@esbuild/win32-x64@0.24.0": - version "0.24.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz#168ab1c7e1c318b922637fad8f339d48b01e1244" - integrity sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA== - "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.1" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz#d1145bf2c20132d6400495d6df4bf59362fd9d56" @@ -2937,17 +2806,6 @@ resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.2.tgz#bfac8c7a1a149b5bbfe98f59fbfea512dfa3bad4" integrity sha512-5yb2gMI1BDm0JybZezeoX/3XhPDOtTbcFvpTXM9kxsoZjPZFh4XciqRbpD6N86HYZqWDhEaKUDuOyR0sQHEjMA== -"@metamask/sdk-communication-layer@0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.30.0.tgz#2bd252cfce3ac4260a6c8c9359732ab5e839b75e" - integrity sha512-q5nbdYkAf76MsZxi1l5MJEAyd8sY9jLRapC8a7x1Q1BNV4rzQeFeux/d0mJ/jTR2LAwbnLZs2rL226AM75oK4w== - dependencies: - bufferutil "^4.0.8" - date-fns "^2.29.3" - debug "^4.3.4" - utf-8-validate "^5.0.2" - uuid "^8.3.2" - "@metamask/sdk-communication-layer@0.31.0": version "0.31.0" resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.31.0.tgz#0acc063b62aa09d044c7aab65801712d760e53b2" @@ -2959,56 +2817,23 @@ utf-8-validate "^5.0.2" uuid "^8.3.2" -"@metamask/sdk-install-modal-web@0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.30.0.tgz#9ec634201b1b47bb30064f42ae0efba7f204bb0a" - integrity sha512-1gT533Huja9tK3cmttvcpZirRAtWJ7vnYH+lnNRKEj2xIP335Df2cOwS+zqNC4GlRCZw7A3IsTjIzlKoxBY1uQ== - dependencies: - qr-code-styling "^1.6.0-rc.1" - -"@metamask/sdk-install-modal-web@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.31.0.tgz#2d1e297d8c1bae93cb458061d86dfaf777e8bdfa" - integrity sha512-nr8AZ+ccEfC3BmzTkT2wH16wOARqVrkhAFqsxYsnaozn+BAb+Hwo/GRhaIGzYgYFj/tTD3SM0UtXd6x2gzMDQw== +"@metamask/sdk-install-modal-web@0.31.2": + version "0.31.2" + resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.31.2.tgz#bb8c92a6844a632be8525e7bb5a35924a926d6cd" + integrity sha512-KPv36kQjmTwErU8g2neuHHSgkD5+1hp4D6ERfk5Kc2r73aOYNCdG9wDGRUmFmcY2MKkeK1EuDyZfJ4FPU30fxQ== dependencies: "@paulmillr/qr" "^0.2.1" -"@metamask/sdk@0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.30.1.tgz#63126ad769566098000cc3c2cd513d18808471f3" - integrity sha512-NelEjJZsF5wVpSQELpmvXtnS9+C6HdxGQ4GB9jMRzeejphmPyKqmrIGM6XtaPrJtlpX+40AcJ2dtBQcjJVzpbQ== - dependencies: - "@metamask/onboarding" "^1.0.1" - "@metamask/providers" "16.1.0" - "@metamask/sdk-communication-layer" "0.30.0" - "@metamask/sdk-install-modal-web" "0.30.0" - bowser "^2.9.0" - cross-fetch "^4.0.0" - debug "^4.3.4" - eciesjs "^0.4.8" - eth-rpc-errors "^4.0.3" - eventemitter2 "^6.4.7" - i18next "23.11.5" - i18next-browser-languagedetector "7.1.0" - obj-multiplex "^1.0.0" - pump "^3.0.0" - qrcode-terminal-nooctal "^0.12.1" - react-native-webview "^11.26.0" - readable-stream "^3.6.2" - socket.io-client "^4.5.1" - util "^0.12.4" - uuid "^8.3.2" - -"@metamask/sdk@0.31.0": - version "0.31.0" - resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.31.0.tgz#6b539f05f4a1a7b26136c5eda361d954ee6b3937" - integrity sha512-L1TKg7NkgCJbjkJsDTC6ZEpjGdroxsFksm17eGWPmNqdPf561ujJkU3xWCUPxEvU0hI+Wz3y2GegJsNej9/jWw== +"@metamask/sdk@0.31.4": + version "0.31.4" + resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.31.4.tgz#2f9266e994ba838652925dc83e3409adfcae75ae" + integrity sha512-HLUN4IZGdyiy5YeebXmXi+ndpmrl6zslCQLdR2QHplIy4JmUL/eDyKNFiK7eBLVKXVVIDYFIb6g1iSEb+i8Kew== dependencies: "@babel/runtime" "^7.26.0" "@metamask/onboarding" "^1.0.1" "@metamask/providers" "16.1.0" "@metamask/sdk-communication-layer" "0.31.0" - "@metamask/sdk-install-modal-web" "0.31.0" + "@metamask/sdk-install-modal-web" "0.31.2" "@paulmillr/qr" "^0.2.1" bowser "^2.9.0" cross-fetch "^4.0.0" @@ -4539,18 +4364,10 @@ resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.10.4.tgz#427d5549943a9c6fce808e39ea64dbe60d4047f1" integrity sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA== -"@safe-global/safe-apps-provider@0.18.3": - version "0.18.3" - resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.18.3.tgz#805a42e24f5dde803cb96dac251a3c9e256de45b" - integrity sha512-f/0cNv3S4v7p8rowAjj0hDCg8Q8P/wBjp5twkNWeBdvd0RDr7BuRBPPk74LCqmjQ82P+1ltLlkmVFSmxTIT7XQ== - dependencies: - "@safe-global/safe-apps-sdk" "^9.1.0" - events "^3.3.0" - -"@safe-global/safe-apps-provider@0.18.4": - version "0.18.4" - resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.18.4.tgz#53df912aa20d933f6b14c5bcb0737a8cd47def57" - integrity sha512-SWYeG3gyTO6wGHMSokfHakZ9isByn2mHsM0VohIorYFFEyGGmJ89btnTm+DqDUSoQtvWAatZB7XNy6CaYMvqtg== +"@safe-global/safe-apps-provider@0.18.5": + version "0.18.5" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.18.5.tgz#745a932bda3739a8a298ae44ec6c465f6c4773b7" + integrity sha512-9v9wjBi3TwLsEJ3C2ujYoexp3pFJ0omDLH/GX91e2QB+uwCKTBYyhxFSrTQ9qzoyQd+bfsk4gjOGW87QcJhf7g== dependencies: "@safe-global/safe-apps-sdk" "^9.1.0" events "^3.3.0" @@ -6480,26 +6297,7 @@ "@vitest/utils" "1.6.0" chai "^4.3.10" -"@vitest/expect@2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-2.1.6.tgz#5a334eb9ee9287292fbe961955cafb06f7af7da6" - integrity sha512-9M1UR9CAmrhJOMoSwVnPh2rELPKhYo0m/CSgqw9PyStpxtkwhmdM6XYlXGKeYyERY1N6EIuzkQ7e3Lm1WKCoUg== - dependencies: - "@vitest/spy" "2.1.6" - "@vitest/utils" "2.1.6" - chai "^5.1.2" - tinyrainbow "^1.2.0" - -"@vitest/mocker@2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-2.1.6.tgz#d13c5a7bd0abf432e1030f68acb43f51c4b3692e" - integrity sha512-MHZp2Z+Q/A3am5oD4WSH04f9B0T7UvwEb+v5W0kCYMhtXGYbdyl2NUk1wdSMqGthmhpiThPDp/hEoVwu16+u1A== - dependencies: - "@vitest/spy" "2.1.6" - estree-walker "^3.0.3" - magic-string "^0.30.12" - -"@vitest/pretty-format@2.1.6", "@vitest/pretty-format@^2.1.6": +"@vitest/pretty-format@2.1.6": version "2.1.6" resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.6.tgz#9bc642047a3efc637b41492b1f222c43be3822e4" integrity sha512-exZyLcEnHgDMKc54TtHca4McV4sKT+NKAe9ix/yhd/qkYb/TP8HTyXRFDijV19qKqTZM0hPL4753zU/U8L/gAA== @@ -6515,14 +6313,6 @@ p-limit "^5.0.0" pathe "^1.1.1" -"@vitest/runner@2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-2.1.6.tgz#948cad2cccfe2e56be5b3f9979cf9a417ca59737" - integrity sha512-SjkRGSFyrA82m5nz7To4CkRSEVWn/rwQISHoia/DB8c6IHIhaE/UNAo+7UfeaeJRE979XceGl00LNkIz09RFsA== - dependencies: - "@vitest/utils" "2.1.6" - pathe "^1.1.2" - "@vitest/snapshot@1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.6.0.tgz#deb7e4498a5299c1198136f56e6e0f692e6af470" @@ -6532,15 +6322,6 @@ pathe "^1.1.1" pretty-format "^29.7.0" -"@vitest/snapshot@2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-2.1.6.tgz#21740449221e37f80c4a8fb3e15f100f30e7934d" - integrity sha512-5JTWHw8iS9l3v4/VSuthCndw1lN/hpPB+mlgn1BUhFbobeIUj1J1V/Bj2t2ovGEmkXLTckFjQddsxS5T6LuVWw== - dependencies: - "@vitest/pretty-format" "2.1.6" - magic-string "^0.30.12" - pathe "^1.1.2" - "@vitest/spy@1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.6.0.tgz#362cbd42ccdb03f1613798fde99799649516906d" @@ -6548,13 +6329,6 @@ dependencies: tinyspy "^2.2.0" -"@vitest/spy@2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-2.1.6.tgz#229f9d48b90b8bdd6573723bdec0699915598080" - integrity sha512-oTFObV8bd4SDdRka5O+mSh5w9irgx5IetrD5i+OsUUsk/shsBoHifwCzy45SAORzAhtNiprUVaK3hSCCzZh1jQ== - dependencies: - tinyspy "^3.0.2" - "@vitest/ui@^2.1.1": version "2.1.6" resolved "https://registry.yarnpkg.com/@vitest/ui/-/ui-2.1.6.tgz#50555594138df76d16324d17356df83f92bb62ff" @@ -6587,43 +6361,22 @@ loupe "^3.1.2" tinyrainbow "^1.2.0" -"@wagmi/connectors@5.3.7": - version "5.3.7" - resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.3.7.tgz#6a7fc28cfe773e770aa8f8d385241d153361525c" - integrity sha512-Sn/umWtA4yGZ5A2rPMufdh9f83kpeIBA7ZIV0zg3oJn60PP3iZNB/zjEmWWi/v9eOPT4sgo0R5aRm+uD+QvxRQ== - dependencies: - "@coinbase/wallet-sdk" "4.2.1" - "@metamask/sdk" "0.30.1" - "@safe-global/safe-apps-provider" "0.18.3" - "@safe-global/safe-apps-sdk" "9.1.0" - "@walletconnect/ethereum-provider" "2.17.0" - cbw-sdk "npm:@coinbase/wallet-sdk@3.9.3" - -"@wagmi/connectors@5.5.2": - version "5.5.2" - resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.5.2.tgz#88c5dc72e82da1d4d7c0290be0c131b4e4b63178" - integrity sha512-QYXDGu7ELr88R2ijkNMhVN402Vt9EXGrtHSMLq7u9pSu/N4mODZvXbvE9RWQ8PNrtCKGYLrHxI/oUGjCf1zxzQ== +"@wagmi/connectors@5.7.3": + version "5.7.3" + resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.7.3.tgz#0e6d274d4734cbfeb8ad964b63b1edcfade42c63" + integrity sha512-i7Gk5M/Fc9gMvkVHbqw2kGtXvY8POsSY798/9I5npyglVjBddxoVk3xTYmcYTB1VIa4Fi0T2gLTHpQnpLrq1CQ== dependencies: "@coinbase/wallet-sdk" "4.2.3" - "@metamask/sdk" "0.31.0" - "@safe-global/safe-apps-provider" "0.18.4" + "@metamask/sdk" "0.31.4" + "@safe-global/safe-apps-provider" "0.18.5" "@safe-global/safe-apps-sdk" "9.1.0" "@walletconnect/ethereum-provider" "2.17.0" cbw-sdk "npm:@coinbase/wallet-sdk@3.9.3" -"@wagmi/core@2.14.4": - version "2.14.4" - resolved "https://registry.yarnpkg.com/@wagmi/core/-/core-2.14.4.tgz#e46711867f3b94d6ffb908aaa46dc03acbeb0a4f" - integrity sha512-XYMvdjKJdr1GAjYDj8lBX+cFs5xC4+s5/w3VwouA2or+VW/ityOA1cL7ihHuHHVxs8N9Mmd9SFjA1+lHFQUKPw== - dependencies: - eventemitter3 "5.0.1" - mipd "0.0.7" - zustand "5.0.0" - -"@wagmi/core@2.15.1": - version "2.15.1" - resolved "https://registry.yarnpkg.com/@wagmi/core/-/core-2.15.1.tgz#1e38facf8cdc1c3e3eafc7f32ebdf0c2fd8b9743" - integrity sha512-xeSdA9FOZs+H1NG51GekfgDQ5aG8KGYUphuh+aYhsvMYtaEy6DVKmpgS13nvAzxe4rjtw0cm6RR0SA4G+paVdg== +"@wagmi/core@2.16.3": + version "2.16.3" + resolved "https://registry.yarnpkg.com/@wagmi/core/-/core-2.16.3.tgz#abbff0a19e75beaad56ffb90da772641552d49c3" + integrity sha512-SVovoWHaQ2AIkmGf+ucNijT6AHXcTMffFcLmcFF6++y21x+ge7Gkh3UoJiU91SDDv8n08eTQ9jbyia3GEgU5jQ== dependencies: eventemitter3 "5.0.1" mipd "0.0.7" @@ -7653,11 +7406,6 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -assertion-error@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-2.0.1.tgz#f641a196b335690b1070bf00b6e7593fec190bf7" - integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== - ast-types-flow@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz#0a85e1c92695769ac13a428bb653e7538bea27d6" @@ -8549,17 +8297,6 @@ chai@^4.3.10, chai@^4.5.0: pathval "^1.1.1" type-detect "^4.1.0" -chai@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/chai/-/chai-5.1.2.tgz#3afbc340b994ae3610ca519a6c70ace77ad4378d" - integrity sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw== - dependencies: - assertion-error "^2.0.1" - check-error "^2.1.1" - deep-eql "^5.0.1" - loupe "^3.1.0" - pathval "^2.0.0" - chalk-template@0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/chalk-template/-/chalk-template-0.4.0.tgz#692c034d0ed62436b9062c1707fadcd0f753204b" @@ -8629,11 +8366,6 @@ check-error@^1.0.2, check-error@^1.0.3: dependencies: get-func-name "^2.0.2" -check-error@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-2.1.1.tgz#87eb876ae71ee388fa0471fe423f494be1d96ccc" - integrity sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw== - chokidar@3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" @@ -9676,11 +9408,6 @@ deep-eql@^4.0.1, deep-eql@^4.1.3: dependencies: type-detect "^4.0.0" -deep-eql@^5.0.1: - version "5.0.2" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-5.0.2.tgz#4b756d8d770a9257300825d52a2c2cff99c3a341" - integrity sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q== - deep-extend@^0.6.0, deep-extend@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -9994,7 +9721,7 @@ ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: dependencies: safe-buffer "^5.0.1" -eciesjs@^0.4.11, eciesjs@^0.4.8: +eciesjs@^0.4.11: version "0.4.12" resolved "https://registry.yarnpkg.com/eciesjs/-/eciesjs-0.4.12.tgz#0ce482454953592e07b79b4824751f3b5c508b56" integrity sha512-DGejvMCihsRAmKRFQiL6KZDE34vWVd0gvXlykFq1aEzJy/rD65AVyAIUZKZOvgvaP9ATQRcHGEZV5DfgrgjA4w== @@ -10279,7 +10006,7 @@ es-module-lexer@1.4.1: resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.4.1.tgz#41ea21b43908fe6a287ffcbe4300f790555331f5" integrity sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w== -es-module-lexer@^1.2.1, es-module-lexer@^1.5.4: +es-module-lexer@^1.2.1: version "1.5.4" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== @@ -10483,36 +10210,6 @@ esbuild@^0.21.3: "@esbuild/win32-ia32" "0.21.5" "@esbuild/win32-x64" "0.21.5" -esbuild@^0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.24.0.tgz#f2d470596885fcb2e91c21eb3da3b3c89c0b55e7" - integrity sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ== - optionalDependencies: - "@esbuild/aix-ppc64" "0.24.0" - "@esbuild/android-arm" "0.24.0" - "@esbuild/android-arm64" "0.24.0" - "@esbuild/android-x64" "0.24.0" - "@esbuild/darwin-arm64" "0.24.0" - "@esbuild/darwin-x64" "0.24.0" - "@esbuild/freebsd-arm64" "0.24.0" - "@esbuild/freebsd-x64" "0.24.0" - "@esbuild/linux-arm" "0.24.0" - "@esbuild/linux-arm64" "0.24.0" - "@esbuild/linux-ia32" "0.24.0" - "@esbuild/linux-loong64" "0.24.0" - "@esbuild/linux-mips64el" "0.24.0" - "@esbuild/linux-ppc64" "0.24.0" - "@esbuild/linux-riscv64" "0.24.0" - "@esbuild/linux-s390x" "0.24.0" - "@esbuild/linux-x64" "0.24.0" - "@esbuild/netbsd-x64" "0.24.0" - "@esbuild/openbsd-arm64" "0.24.0" - "@esbuild/openbsd-x64" "0.24.0" - "@esbuild/sunos-x64" "0.24.0" - "@esbuild/win32-arm64" "0.24.0" - "@esbuild/win32-ia32" "0.24.0" - "@esbuild/win32-x64" "0.24.0" - escalade@^3.1.1, escalade@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" @@ -10523,11 +10220,6 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== -escape-string-regexp@2.0.0, escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" @@ -10538,6 +10230,11 @@ escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + escodegen@1.8.x: version "1.8.1" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" @@ -11141,7 +10838,7 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter2@^6.4.7, eventemitter2@^6.4.9: +eventemitter2@^6.4.9: version "6.4.9" resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.9.tgz#41f2750781b4230ed58827bc119d293471ecb125" integrity sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg== @@ -11204,11 +10901,6 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect-type@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/expect-type/-/expect-type-1.1.0.tgz#a146e414250d13dfc49eafcfd1344a4060fa4c75" - integrity sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA== - expect@^29.0.0, expect@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" @@ -12666,20 +12358,6 @@ hyperlinker@^1.0.0: resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e" integrity sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ== -i18next-browser-languagedetector@7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.1.0.tgz#01876fac51f86b78975e79b48ccb62e2313a2d7d" - integrity sha512-cr2k7u1XJJ4HTOjM9GyOMtbOA47RtUoWRAtt52z43r3AoMs2StYKyjS3URPhzHaf+mn10hY9dZWamga5WPQjhA== - dependencies: - "@babel/runtime" "^7.19.4" - -i18next@23.11.5: - version "23.11.5" - resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.11.5.tgz#d71eb717a7e65498d87d0594f2664237f9e361ef" - integrity sha512-41pvpVbW9rhZPk5xjCX2TPJi2861LEig/YRhUkY+1FQ2IQPS0bKUDYnEqY8XPPbB48h1uIwLnP9iiEfuSl20CA== - dependencies: - "@babel/runtime" "^7.23.2" - i18next@^23.8.2: version "23.16.8" resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.16.8.tgz#3ae1373d344c2393f465556f394aba5a9233b93a" @@ -12884,13 +12562,6 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -invariant@2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== - dependencies: - loose-envify "^1.0.0" - io-ts@1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-1.10.4.tgz#cd5401b138de88e4f920adbcb7026e2d1967e6e2" @@ -14697,7 +14368,7 @@ long@^5.0.0, long@^5.2.0: resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -14711,7 +14382,7 @@ loupe@^2.3.6, loupe@^2.3.7: dependencies: get-func-name "^2.0.1" -loupe@^3.1.0, loupe@^3.1.2: +loupe@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/loupe/-/loupe-3.1.2.tgz#c86e0696804a02218f2206124c45d8b15291a240" integrity sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg== @@ -14774,7 +14445,7 @@ magic-string@0.30.8: dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" -magic-string@^0.30.12, magic-string@^0.30.3, magic-string@^0.30.5: +magic-string@^0.30.3, magic-string@^0.30.5: version "0.30.14" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.14.tgz#e9bb29870b81cfc1ec3cc656552f5a7fcbf19077" integrity sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw== @@ -16343,11 +16014,6 @@ pathval@^1.1.1: resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== -pathval@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-2.0.0.tgz#7e2550b422601d4f6b8e26f1301bc8f15a741a25" - integrity sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA== - pause@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/pause/-/pause-0.0.1.tgz#1d408b3fdb76923b9543d96fb4c9dfd535d9cb5d" @@ -16575,7 +16241,7 @@ postcss@8.4.38: picocolors "^1.0.0" source-map-js "^1.2.0" -postcss@^8.4.43, postcss@^8.4.49: +postcss@^8.4.43: version "8.4.49" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.49.tgz#4ea479048ab059ab3ae61d082190fabfd994fe19" integrity sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA== @@ -16921,23 +16587,6 @@ pvutils@^1.1.3: resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== -qr-code-styling@^1.6.0-rc.1: - version "1.8.4" - resolved "https://registry.yarnpkg.com/qr-code-styling/-/qr-code-styling-1.8.4.tgz#9168f379cc8f239c184951d5c1ad8a32ad0b19f9" - integrity sha512-uxykNuvXaPDK/jGDERDIdDvvocefbHu1oxVYi6K87FUdPPAezkBdcIeFJ8XVX2HSsyLFINile5uzfOMYpGu5ZA== - dependencies: - qrcode-generator "^1.4.4" - -qrcode-generator@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/qrcode-generator/-/qrcode-generator-1.4.4.tgz#63f771224854759329a99048806a53ed278740e7" - integrity sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw== - -qrcode-terminal-nooctal@^0.12.1: - version "0.12.1" - resolved "https://registry.yarnpkg.com/qrcode-terminal-nooctal/-/qrcode-terminal-nooctal-0.12.1.tgz#45016aca0d82b2818de7af0a06d072ad671fbe2e" - integrity sha512-jy/kkD0iIMDjTucB+5T6KBsnirlhegDH47vHgrj5MejchSQmi/EAMM0xMFeePgV9CJkkAapNakpVUWYgHvtdKg== - qrcode@1.5.3, qrcode@^1.5.0: version "1.5.4" resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.5.4.tgz#5cb81d86eb57c675febb08cf007fff963405da88" @@ -17116,14 +16765,6 @@ react-native-fetch-api@^3.0.0: dependencies: p-defer "^3.0.0" -react-native-webview@^11.26.0: - version "11.26.1" - resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-11.26.1.tgz#658c09ed5162dc170b361e48c2dd26c9712879da" - integrity sha512-hC7BkxOpf+z0UKhxFSFTPAM4shQzYmZHoELa6/8a/MspcjEP7ukYKpuSUTLDywQditT8yI9idfcKvfZDKQExGw== - dependencies: - escape-string-regexp "2.0.0" - invariant "2.2.4" - react-number-format@^5.3.4, react-number-format@^5.4.0: version "5.4.2" resolved "https://registry.yarnpkg.com/react-number-format/-/react-number-format-5.4.2.tgz#aec282241f36cee31da13dc5e0f364c0fc6902ab" @@ -17653,7 +17294,7 @@ rlp@^2.2.3, rlp@^2.2.4: dependencies: bn.js "^5.2.0" -rollup@^4.20.0, rollup@^4.23.0: +rollup@^4.20.0: version "4.27.4" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.27.4.tgz#b23e4ef4fe4d0d87f5237dacf63f95a499503897" integrity sha512-RLKxqHEMjh/RGLsDxAEsaLO3mWgyoU6x9w6n1ikAzet4B3gI2/3yP6PWY2p9QzRTh6MfEIXB3MwsOY0Iv3vNrw== @@ -18389,7 +18030,7 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -std-env@^3.5.0, std-env@^3.7.0, std-env@^3.8.0: +std-env@^3.5.0, std-env@^3.7.0: version "3.8.0" resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.8.0.tgz#b56ffc1baf1a29dcc80a3bdf11d7fca7c315e7d5" integrity sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w== @@ -19058,16 +18699,11 @@ tiny-warning@^1.0.2: resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== -tinybench@^2.5.1, tinybench@^2.9.0: +tinybench@^2.5.1: version "2.9.0" resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.9.0.tgz#103c9f8ba6d7237a47ab6dd1dcff77251863426b" integrity sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg== -tinyexec@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.1.tgz#0ab0daf93b43e2c211212396bdb836b468c97c98" - integrity sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ== - tinyglobby@^0.2.10, tinyglobby@^0.2.6, tinyglobby@^0.2.9: version "0.2.10" resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.10.tgz#e712cf2dc9b95a1f5c5bbd159720e15833977a0f" @@ -19081,11 +18717,6 @@ tinypool@^0.8.3: resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.4.tgz#e217fe1270d941b39e98c625dcecebb1408c9aa8" integrity sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ== -tinypool@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-1.0.2.tgz#706193cc532f4c100f66aa00b01c42173d9051b2" - integrity sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA== - tinyrainbow@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/tinyrainbow/-/tinyrainbow-1.2.0.tgz#5c57d2fc0fb3d1afd78465c33ca885d04f02abb5" @@ -19096,11 +18727,6 @@ tinyspy@^2.2.0: resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-2.2.1.tgz#117b2342f1f38a0dbdcc73a50a454883adf861d1" integrity sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A== -tinyspy@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-3.0.2.tgz#86dd3cf3d737b15adcf17d7887c84a75201df20a" - integrity sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q== - tldts-core@^6.1.64: version "6.1.64" resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-6.1.64.tgz#0b017a7fefb92d8542b1078c793c00cc28ad9eac" @@ -20031,17 +19657,6 @@ vite-node@1.6.0: picocolors "^1.0.0" vite "^5.0.0" -vite-node@2.1.6: - version "2.1.6" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-2.1.6.tgz#d7b79c5cde56c749f619dead049944918726b91e" - integrity sha512-DBfJY0n9JUwnyLxPSSUmEePT21j8JZp/sR9n+/gBwQU6DcQOioPdb8/pibWfXForbirSagZCilseYIwaL3f95A== - dependencies: - cac "^6.7.14" - debug "^4.3.7" - es-module-lexer "^1.5.4" - pathe "^1.1.2" - vite "^5.0.0 || ^6.0.0" - vite-plugin-node-polyfills@^0.22.0: version "0.22.0" resolved "https://registry.yarnpkg.com/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.22.0.tgz#d0afcf82eb985fc02244620d7cec1ddd1c6e0864" @@ -20070,17 +19685,6 @@ vite@^5.0.0, vite@^5.4.7: optionalDependencies: fsevents "~2.3.3" -"vite@^5.0.0 || ^6.0.0": - version "6.0.1" - resolved "https://registry.yarnpkg.com/vite/-/vite-6.0.1.tgz#24c9caf24998f0598de37bed67e50ec5b9dfeaf0" - integrity sha512-Ldn6gorLGr4mCdFnmeAOLweJxZ34HjKnDm4HGo6P66IEqTxQb36VEdFJQENKxWjupNfoIjvRUnswjn1hpYEpjQ== - dependencies: - esbuild "^0.24.0" - postcss "^8.4.49" - rollup "^4.23.0" - optionalDependencies: - fsevents "~2.3.3" - vitest@^1.2.2, vitest@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.6.0.tgz#9d5ad4752a3c451be919e412c597126cffb9892f" @@ -20107,32 +19711,6 @@ vitest@^1.2.2, vitest@^1.6.0: vite-node "1.6.0" why-is-node-running "^2.2.2" -vitest@^2.1.2: - version "2.1.6" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-2.1.6.tgz#44d661c6b3f3a3a0c597143f78d27215ee4666cc" - integrity sha512-isUCkvPL30J4c5O5hgONeFRsDmlw6kzFEdLQHLezmDdKQHy8Ke/B/dgdTMEgU0vm+iZ0TjW8GuK83DiahBoKWQ== - dependencies: - "@vitest/expect" "2.1.6" - "@vitest/mocker" "2.1.6" - "@vitest/pretty-format" "^2.1.6" - "@vitest/runner" "2.1.6" - "@vitest/snapshot" "2.1.6" - "@vitest/spy" "2.1.6" - "@vitest/utils" "2.1.6" - chai "^5.1.2" - debug "^4.3.7" - expect-type "^1.1.0" - magic-string "^0.30.12" - pathe "^1.1.2" - std-env "^3.8.0" - tinybench "^2.9.0" - tinyexec "^0.3.1" - tinypool "^1.0.1" - tinyrainbow "^1.2.0" - vite "^5.0.0 || ^6.0.0" - vite-node "2.1.6" - why-is-node-running "^2.3.0" - vm-browserify@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" @@ -20162,22 +19740,13 @@ wabt@1.0.24: resolved "https://registry.yarnpkg.com/wabt/-/wabt-1.0.24.tgz#c02e0b5b4503b94feaf4a30a426ef01c1bea7c6c" integrity sha512-8l7sIOd3i5GWfTWciPL0+ff/FK/deVK2Q6FN+MPz4vfUcD78i2M/49XJTwF6aml91uIiuXJEsLKWMB2cw/mtKg== -wagmi@2.12.29: - version "2.12.29" - resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.12.29.tgz#5695df91169033833faadb3497a8ab440e682772" - integrity sha512-g8wf4oGTxtrwgbpi1NcRvidx7ZRsSMb2LB53Qk3I2Pr7s4m11y1fNYb15PfQpDIHdX7eaXM5OC6/NhVFB0diiQ== - dependencies: - "@wagmi/connectors" "5.3.7" - "@wagmi/core" "2.14.4" - use-sync-external-store "1.2.0" - -wagmi@^2.12.8: - version "2.13.2" - resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.13.2.tgz#a9e0d54efbff1927d32cebbc19bc426720da9feb" - integrity sha512-xm9vRcmDko/XYZDjYAqlx8TCa1MYMdVSM6NswQEv/E1Bg+9rfC/EK/5CyWLRkPUpEKn17kKfH/W9gAqmbQmRAw== +wagmi@2.14.6, wagmi@^2.14.6: + version "2.14.6" + resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.14.6.tgz#046db4c119f53c276c9f2d4b0034fe2ebc3ff05c" + integrity sha512-h8KDjPiXywZcKAbGttGDlZpwabZynR4lZ8eDO63tNgfxiMyhld0M5bMcB/u7XnH2xFgd0gq7PA2RVz96XMjazw== dependencies: - "@wagmi/connectors" "5.5.2" - "@wagmi/core" "2.15.1" + "@wagmi/connectors" "5.7.3" + "@wagmi/core" "2.16.3" use-sync-external-store "1.2.0" walker@^1.0.8: @@ -20679,7 +20248,7 @@ which@^1.1.1, which@^1.3.1: dependencies: isexe "^2.0.0" -why-is-node-running@^2.2.2, why-is-node-running@^2.3.0: +why-is-node-running@^2.2.2: version "2.3.0" resolved "https://registry.yarnpkg.com/why-is-node-running/-/why-is-node-running-2.3.0.tgz#a3f69a97107f494b3cdc3bdddd883a7d65cebf04" integrity sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w== From 4eabf23d3603d88ec55af2377f382c2d3a4c7c26 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Jan 2025 19:16:14 +0300 Subject: [PATCH 12/28] [CVAT] Collect GT stats per task label set (#2976) * Collect GT stats per task label set * Fix migration --- .../1e89224ad721_add_gt_labels_in_gt_stats.py | 40 ++ .../recording-oracle/src/core/gt_stats.py | 9 +- .../recording-oracle/src/cvat/api_calls.py | 21 + .../handlers/process_intermediate_results.py | 212 ++++--- .../recording-oracle/src/models/validation.py | 20 + .../src/services/validation.py | 9 +- .../services/test_validation_service.py | 555 ++++++++++++++++++ .../recording-oracle/tests/utils/helpers.py | 23 +- 8 files changed, 796 insertions(+), 93 deletions(-) create mode 100644 packages/examples/cvat/recording-oracle/alembic/versions/1e89224ad721_add_gt_labels_in_gt_stats.py diff --git a/packages/examples/cvat/recording-oracle/alembic/versions/1e89224ad721_add_gt_labels_in_gt_stats.py b/packages/examples/cvat/recording-oracle/alembic/versions/1e89224ad721_add_gt_labels_in_gt_stats.py new file mode 100644 index 0000000000..3b8351099f --- /dev/null +++ b/packages/examples/cvat/recording-oracle/alembic/versions/1e89224ad721_add_gt_labels_in_gt_stats.py @@ -0,0 +1,40 @@ +"""add_gt_labels_in_gt_stats + +Revision ID: 1e89224ad721 +Revises: 76f0bc042477 +Create Date: 2025-01-08 14:24:35.704162 + +""" + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "1e89224ad721" +down_revision = "76f0bc042477" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "gt_stats", sa.Column("label_set", sa.String(), nullable=False, server_default="") + ) + # ### end Alembic commands ### + + op.alter_column("gt_stats", "label_set", existing_server_default="", server_default=None) + + # SA / alembic doesn't find this automatically + op.drop_constraint("gt_stats_pkey", "gt_stats") + op.create_primary_key("gt_stats_pkey", "gt_stats", ["task_id", "gt_frame_name", "label_set"]) + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("gt_stats", "label_set") + # ### end Alembic commands ### + + # previous PK will be removed together with the column removal + op.create_primary_key("gt_stats_pkey", "gt_stats", ["task_id", "gt_frame_name"]) diff --git a/packages/examples/cvat/recording-oracle/src/core/gt_stats.py b/packages/examples/cvat/recording-oracle/src/core/gt_stats.py index 74c8c80647..dee96bf967 100644 --- a/packages/examples/cvat/recording-oracle/src/core/gt_stats.py +++ b/packages/examples/cvat/recording-oracle/src/core/gt_stats.py @@ -1,4 +1,4 @@ -from attrs import define +from attrs import define, field, frozen @define(kw_only=True) @@ -14,5 +14,10 @@ def rating(self) -> float: return (self.accepted_attempts + 1) / (self.total_uses + 1) -GtKey = str +@frozen(kw_only=True) +class GtKey: + filename: str + labels: frozenset[str] = field(converter=frozenset) + + GtStats = dict[GtKey, ValidationFrameStats] diff --git a/packages/examples/cvat/recording-oracle/src/cvat/api_calls.py b/packages/examples/cvat/recording-oracle/src/cvat/api_calls.py index 72d61c4a2b..0d6caebf33 100644 --- a/packages/examples/cvat/recording-oracle/src/cvat/api_calls.py +++ b/packages/examples/cvat/recording-oracle/src/cvat/api_calls.py @@ -3,6 +3,7 @@ from datetime import timedelta from http import HTTPStatus from time import sleep +from typing import cast from cvat_sdk.api_client import ApiClient, Configuration, exceptions, models from cvat_sdk.core.helpers import get_paginated_collection @@ -203,3 +204,23 @@ def get_task_data_meta(task_id: int) -> models.DataMetaRead: except exceptions.ApiException as ex: logger.exception(f"Exception when calling TaskApi.retrieve_data_meta: {ex}\n") raise + + +def get_task_labels(task_id: int) -> list[str]: + logger = logging.getLogger("app") + with get_api_client() as api_client: + try: + task, _ = api_client.tasks_api.retrieve(task_id) + project_id = task.project_id + + return [ + cast(models.ILabel, label).name + for label in get_paginated_collection( + api_client.labels_api.list_endpoint, + **({"project_id": project_id} if project_id else {"task_id": task_id}), + ) + ] + + except exceptions.ApiException as e: + logger.exception(f"Exception when calling QualityApi.list_reports: {e}\n") + raise diff --git a/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py b/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py index f97534dae1..7501e74b3b 100644 --- a/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py +++ b/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py @@ -72,6 +72,7 @@ _TaskIdToValidationLayout = dict[int, cvat_api.models.ITaskValidationLayoutRead] _TaskIdToHoneypotsMapping = dict[int, _HoneypotFrameToValFrame] _TaskIdToFrameNames = dict[int, list[str]] +_TaskIdToLabels = dict[int, list[str]] @dataclass @@ -83,6 +84,7 @@ class _ValidationResult: task_id_to_val_layout: _TaskIdToValidationLayout task_id_to_honeypots_mapping: _TaskIdToHoneypotsMapping task_id_to_frame_names: _TaskIdToFrameNames + task_id_to_labels: _TaskIdToLabels T = TypeVar("T") @@ -162,27 +164,31 @@ def _validate_jobs(self): # task honeypot with frame index matches the sequence[index] task_id_to_sequence_of_frame_names: dict[int, list[str]] = {} + task_id_to_labels: dict[int, list[str]] = {} + min_quality = manifest.validation.min_quality job_id_to_quality_report: dict[int, cvat_api.models.QualityReport] = {} for cvat_task_id in cvat_task_ids: # obtain quality report details + task_labels = cvat_api.get_task_labels(cvat_task_id) task_quality_report = cvat_api.get_task_quality_report(cvat_task_id) task_quality_report_data = cvat_api.get_quality_report_data(task_quality_report.id) task_id_to_quality_report_data[cvat_task_id] = task_quality_report_data # obtain task validation layout and define honeypots mapping task_val_layout = cvat_api.get_task_validation_layout(cvat_task_id) - honeypot_frame_to_real = { + task_honeypot_frame_to_real = { f: task_val_layout.honeypot_real_frames[idx] for idx, f in enumerate(task_val_layout.honeypot_frames) } task_id_to_val_layout[cvat_task_id] = task_val_layout - task_id_to_honeypots_mapping[cvat_task_id] = honeypot_frame_to_real + task_id_to_honeypots_mapping[cvat_task_id] = task_honeypot_frame_to_real task_id_to_sequence_of_frame_names[cvat_task_id] = [ frame.name for frame in cvat_api.get_task_data_meta(cvat_task_id).frames ] + task_id_to_labels[cvat_task_id] = task_labels # obtain quality reports for each job from the task job_id_to_quality_report.update( @@ -202,6 +208,7 @@ def _validate_jobs(self): task_frame_names = task_id_to_sequence_of_frame_names[cvat_task_id] task_honeypots = set(task_id_to_val_layout[cvat_task_id].honeypot_frames) task_honeypots_mapping = task_id_to_honeypots_mapping[cvat_task_id] + task_labels = task_id_to_labels[cvat_task_id] job_honeypots = task_honeypots & set(job_meta.job_frame_range) if not job_honeypots: @@ -212,15 +219,16 @@ def _validate_jobs(self): for honeypot in job_honeypots: val_frame = task_honeypots_mapping[honeypot] val_frame_name = task_frame_names[val_frame] + val_frame_key = GtKey(filename=val_frame_name, labels=task_labels) result = task_quality_report_data.frame_results[str(honeypot)] - self._gt_stats.setdefault(val_frame_name, ValidationFrameStats()) - self._gt_stats[val_frame_name].accumulated_quality += result.annotations.accuracy + self._gt_stats.setdefault(val_frame_key, ValidationFrameStats()) + self._gt_stats[val_frame_key].accumulated_quality += result.annotations.accuracy if result.annotations.accuracy < min_quality: - self._gt_stats[val_frame_name].failed_attempts += 1 + self._gt_stats[val_frame_key].failed_attempts += 1 else: - self._gt_stats[val_frame_name].accepted_attempts += 1 + self._gt_stats[val_frame_key].accepted_attempts += 1 # assess job quality job_quality_report = job_id_to_quality_report[cvat_job_id] @@ -245,6 +253,7 @@ def _validate_jobs(self): self._task_id_to_val_layout = task_id_to_val_layout self._task_id_to_honeypots_mapping = task_id_to_honeypots_mapping self._task_id_to_sequence_of_frame_names = task_id_to_sequence_of_frame_names + self._task_id_to_labels = task_id_to_labels def _restore_original_image_paths(self, merged_dataset: dm.Dataset) -> dm.Dataset: class RemoveCommonPrefix(dm.ItemTransform): @@ -368,6 +377,7 @@ def validate(self) -> _ValidationResult: task_id_to_val_layout=self._require_field(self._task_id_to_val_layout), task_id_to_honeypots_mapping=self._require_field(self._task_id_to_honeypots_mapping), task_id_to_frame_names=self._require_field(self._task_id_to_sequence_of_frame_names), + task_id_to_labels=self._require_field(self._task_id_to_labels), ) @@ -407,9 +417,6 @@ def __init__( rng = np.random.default_rng() self.rng = rng - def _make_gt_key(self, validation_frame_name: str) -> GtKey: - return validation_frame_name - @cached_property def _get_gt_frame_uses(self) -> dict[GtKey, int]: return {gt_key: gt_stat.total_uses for gt_key, gt_stat in self.gt_stats.items()} @@ -435,8 +442,7 @@ def _select_random_least_used( pick = set() for randval in rng.random(count): - # TODO: try to optimize item counting on each iteration - # maybe by using a bagged data structure + # TODO: optimize like in https://github.com/cvat-ai/cvat/pull/8857 if needed least_use_count = min(key(item) for item in items if item not in pick) least_used_items = [ item for item in items if key(item) == least_use_count if item not in pick @@ -445,46 +451,67 @@ def _select_random_least_used( return pick - def _get_available_gt_frames(self): + def _get_available_gt(self) -> tuple[GtStats, dict[int, set[GtKey]]]: + task_id_to_gt_keys = {} + for task_id, task_val_layout in self.validation_result.task_id_to_val_layout.items(): + # Here we assume that all the tasks with the same label set use the same GT frames + task_validation_frames = task_val_layout.validation_frames + task_frame_names = self.validation_result.task_id_to_frame_names[task_id] + task_labels = self.validation_result.task_id_to_labels[task_id] + task_gt_keys = { + GtKey(filename=task_frame_names[f], labels=task_labels) + for f in task_validation_frames + } + + # Populate missing entries for unused GT frames. + # Not all the GT frames may be present in an iteration results. + for gt_key in task_gt_keys: + if gt_key not in self.gt_stats: + self.gt_stats[gt_key] = ValidationFrameStats() + + task_id_to_gt_keys[task_id] = task_gt_keys + if max_gt_share := Config.validation.max_gt_share: - # Limit maximum used GT frames - regular_frames_count = 0 - for task_id, task_val_layout in self.validation_result.task_id_to_val_layout.items(): - # Safety check for the next operations. Here we assume - # that all the tasks use the same GT frames. - task_validation_frames = task_val_layout.validation_frames - task_frame_names = self.validation_result.task_id_to_frame_names[task_id] - task_gt_keys = { - self._make_gt_key(task_frame_names[f]) for f in task_validation_frames - } + # Limit maximum used GT frames in the dataset. This allows us to get strong + # guarantees about GT frame uses during validation, + # resulting in clear exclusion rates of complex or invalid GT. + # Count GT frames per label set to avoid situations with empty GT sets + # for some labels or tasks after limiting GT percent in the whole dataset. + # Note that different task types can have different label setups in tasks, e.g. + # - skeleton tasks have 1 point label per task + # - bbox tasks may have several labels per task + # All these cases are expected to use the same GT per label set. + for label_set_task_ids in grouped( + self.validation_result.task_id_to_labels, + key=lambda t: frozenset(self.validation_result.task_id_to_labels[t]), + ).values(): + regular_frames_count = 0 + gt_keys = None + + for task_id in label_set_task_ids: + task_gt_keys = task_id_to_gt_keys[task_id] + if gt_keys is None: + gt_keys = task_gt_keys + else: + # Assume that all the tasks with the same label set use the same GT + assert gt_keys == task_gt_keys + + task_val_layout = self.validation_result.task_id_to_val_layout[task_id] + task_frame_names = self.validation_result.task_id_to_frame_names[task_id] + task_regular_frames_count = ( + len(task_frame_names) - len(task_gt_keys) - task_val_layout.honeypot_count + ) - # Populate missing entries for unused GT frames - for gt_key in task_gt_keys: - if gt_key not in self.gt_stats: - self.gt_stats[gt_key] = ValidationFrameStats() + regular_frames_count += task_regular_frames_count - regular_frames_count += ( - len(task_frame_names) - - len(task_validation_frames) - - task_val_layout.honeypot_count - ) + assert gt_keys is not None - if len(self.manifest.annotation.labels) != 1: - # TODO: count GT frames per label set to avoid situations with empty GT sets - # for some labels or tasks. - # Note that different task types can have different label setups. - self.logger.warning( - "Tasks with multiple labels are not supported yet." - " Honeypots in tasks will not be limited" - ) - else: - total_frames_count = regular_frames_count + len(self.gt_stats) - enabled_gt_keys = {k for k, gt_stat in self.gt_stats.items() if gt_stat.enabled} + gt_frames_count = len(gt_keys) + total_frames_count = regular_frames_count + gt_frames_count + enabled_gt_keys = {k for k in gt_keys if self.gt_stats[k].enabled} current_gt_share = len(enabled_gt_keys) / (total_frames_count or 1) - max_usable_gt_share = min( - len(self.gt_stats) / (total_frames_count or 1), max_gt_share - ) - max_gt_count = min(int(max_gt_share * total_frames_count), len(self.gt_stats)) + max_usable_gt_share = min(gt_frames_count / (total_frames_count or 1), max_gt_share) + max_gt_count = min(int(max_gt_share * total_frames_count), gt_frames_count) has_updates = False if max_gt_count < len(enabled_gt_keys): # disable some validation frames, take the least used ones @@ -511,15 +538,15 @@ def _get_available_gt_frames(self): has_updates = True if has_updates: - for gt_key, gt_stat in self.gt_stats.items(): - gt_stat.enabled = gt_key in enabled_gt_keys + for gt_key in gt_keys: + self.gt_stats[gt_key].enabled = gt_key in enabled_gt_keys return { gt_key for gt_key, gt_stat in self.gt_stats.items() if gt_stat.enabled if gt_stat.rating > Config.validation.gt_ban_threshold - } + }, task_id_to_gt_keys def _check_warmup_annotation_speed(self): validation_result = self.validation_result @@ -552,17 +579,17 @@ def update_honeypots(self) -> _HoneypotUpdateResult: rejected_jobs = validation_result.rejected_jobs # Update honeypots in jobs - available_gt_frames = self._get_available_gt_frames() + all_available_gt_keys, task_id_to_gt_keys = self._get_available_gt() if self.logger.isEnabledFor(logging.DEBUG): self.logger.debug( "Escrow validation for escrow_address={}: iteration: {}" - ", available GT count: {} ({}%, banned {})" - ", remaining jobs count: {} ({}%)".format( + ", available GT count: {} ({:.4f}%, banned {})" + ", remaining jobs count: {} ({:.4f}%)".format( self.task.escrow_address, self.task.iteration, - *value_and_percent(len(available_gt_frames), len(gt_stats)), - len(gt_stats) - len(available_gt_frames), + *value_and_percent(len(all_available_gt_keys), len(gt_stats)), + len(gt_stats) - len(all_available_gt_keys), *value_and_percent(len(rejected_jobs), len(self.annotation_meta.jobs)), ), ) @@ -571,10 +598,6 @@ def update_honeypots(self) -> _HoneypotUpdateResult: self._check_warmup_annotation_speed() - if len(available_gt_frames) / len(gt_stats) < Config.validation.min_available_gt_threshold: - self.logger.debug("Not enough available GT to continue, stopping") - return _HoneypotUpdateResult(updated_gt_stats=gt_stats, can_continue_annotation=False) - gt_frame_uses = self._get_gt_frame_uses tasks_with_rejected_jobs = grouped( @@ -586,35 +609,54 @@ def update_honeypots(self) -> _HoneypotUpdateResult: if not task_rejected_jobs: continue - task_validation_layout = validation_result.task_id_to_val_layout[cvat_task_id] - task_frame_names = validation_result.task_id_to_frame_names[cvat_task_id] - - task_validation_frame_to_gt_key = { - # TODO: maybe switch to per GT case stats for GT frame stats - # e.g. per skeleton point (all skeleton points use the same GT frame names) - validation_frame: self._make_gt_key(task_frame_names[validation_frame]) - for validation_frame in task_validation_layout.validation_frames - } + task_gt_keys = task_id_to_gt_keys[cvat_task_id] + task_available_gt_keys = task_gt_keys.intersection(all_available_gt_keys) + if ( + len(task_available_gt_keys) / len(task_gt_keys) + < Config.validation.min_available_gt_threshold + ): + self.logger.warning( + f"Validation for escrow_address={self.task.escrow_address}: " + f"Too many validation frames excluded in the task {cvat_task_id} " + f"(required: {Config.validation.min_available_gt_threshold * 100:.4f}%, " + f"left: {(len(task_available_gt_keys) / len(task_gt_keys)):.4f}%), " + "stopping annotation" + ) + return _HoneypotUpdateResult( + updated_gt_stats=gt_stats, can_continue_annotation=False + ) - task_available_validation_frames = { - validation_frame - for validation_frame in task_validation_layout.validation_frames - if task_frame_names[validation_frame] in available_gt_frames - } + task_validation_layout = validation_result.task_id_to_val_layout[cvat_task_id] - if len(task_available_validation_frames) < task_validation_layout.frames_per_job_count: + if len(task_available_gt_keys) < task_validation_layout.frames_per_job_count: # TODO: value from the manifest can be different from what's in the task # because exchange oracle can use size multipliers for tasks # Need to sync these values later (maybe by removing it from the manifest) - should_complete = True - self.logger.info( + self.logger.warning( f"Validation for escrow_address={self.task.escrow_address}: " - "Too few validation frames left " + f"Too few validation frames left in the task {cvat_task_id} " f"(required: {task_validation_layout.frames_per_job_count}, " - f"left: {len(task_available_validation_frames)}) for the task({cvat_task_id}), " + f"left: {len(task_available_gt_keys)}), " "stopping annotation" ) - break + return _HoneypotUpdateResult( + updated_gt_stats=gt_stats, can_continue_annotation=False + ) + + task_frame_names = validation_result.task_id_to_frame_names[cvat_task_id] + task_labels = validation_result.task_id_to_labels[cvat_task_id] + task_validation_frame_to_gt_key = { + validation_frame: GtKey( + filename=task_frame_names[validation_frame], labels=task_labels + ) + for validation_frame in task_validation_layout.validation_frames + } + + task_available_validation_frames = [ + validation_frame + for validation_frame in task_validation_layout.validation_frames + if task_validation_frame_to_gt_key[validation_frame] in task_available_gt_keys + ] task_updated_disabled_frames = [ validation_frame @@ -707,14 +749,14 @@ def process_intermediate_results( # noqa: PLR0912 logger.debug("Task id %s, %s", getattr(task, "id", None), getattr(task, "__dict__", None)) gt_stats = { - gt_image_stat.gt_frame_name: ValidationFrameStats( - failed_attempts=gt_image_stat.failed_attempts, - accepted_attempts=gt_image_stat.accepted_attempts, - accumulated_quality=gt_image_stat.accumulated_quality, - total_uses=gt_image_stat.total_uses, - enabled=gt_image_stat.enabled, + gt_stat.gt_key: ValidationFrameStats( + failed_attempts=gt_stat.failed_attempts, + accepted_attempts=gt_stat.accepted_attempts, + accumulated_quality=gt_stat.accumulated_quality, + total_uses=gt_stat.total_uses, + enabled=gt_stat.enabled, ) - for gt_image_stat in db_service.get_task_gt_stats(session, task.id) + for gt_stat in db_service.get_task_gt_stats(session, task.id) } validator = _TaskValidator( diff --git a/packages/examples/cvat/recording-oracle/src/models/validation.py b/packages/examples/cvat/recording-oracle/src/models/validation.py index 273db23c39..120ace2c10 100644 --- a/packages/examples/cvat/recording-oracle/src/models/validation.py +++ b/packages/examples/cvat/recording-oracle/src/models/validation.py @@ -1,13 +1,20 @@ # pylint: disable=too-few-public-methods from __future__ import annotations +import json +from typing import TYPE_CHECKING + from sqlalchemy import Boolean, Column, DateTime, Enum, Float, ForeignKey, Integer, String from sqlalchemy.orm import Mapped, relationship from sqlalchemy.sql import func +from src.core.gt_stats import GtKey from src.core.types import Networks from src.db import Base +if TYPE_CHECKING: + from collections.abc import Sequence + class Task(Base): __tablename__ = "tasks" @@ -58,6 +65,7 @@ class GtStats(Base): String, ForeignKey("tasks.id", ondelete="CASCADE"), primary_key=True, nullable=False ) gt_frame_name = Column(String, primary_key=True, nullable=False) + label_set = Column(String, primary_key=True, nullable=False) failed_attempts = Column(Integer, default=0, nullable=False) accepted_attempts = Column(Integer, default=0, nullable=False) @@ -68,3 +76,15 @@ class GtStats(Base): enabled = Column(Boolean, default=True, nullable=False) task: Mapped[Task] = relationship(back_populates="gt_stats") + + @property + def gt_key(self) -> GtKey: + return GtKey(filename=self.gt_frame_name, labels=self.decode_label_set(self.label_set)) + + @staticmethod + def decode_label_set(data: str) -> Sequence[str]: + return json.loads(data) + + @staticmethod + def encode_label_set(labels: set[str]) -> str: + return json.dumps(sorted(labels)) diff --git a/packages/examples/cvat/recording-oracle/src/services/validation.py b/packages/examples/cvat/recording-oracle/src/services/validation.py index ee5428e3f2..1ccab5d30f 100644 --- a/packages/examples/cvat/recording-oracle/src/services/validation.py +++ b/packages/examples/cvat/recording-oracle/src/services/validation.py @@ -3,7 +3,7 @@ from sqlalchemy import func, update from sqlalchemy.orm import Session -from src.core.gt_stats import ValidationFrameStats +from src.core.gt_stats import GtKey, ValidationFrameStats from src.db import engine as db_engine from src.db.utils import ForUpdateParams from src.db.utils import maybe_for_update as _maybe_for_update @@ -134,7 +134,7 @@ def get_task_gt_stats( def update_gt_stats( - session: Session, task_id: str, updated_gt_stats: dict[str, ValidationFrameStats] + session: Session, task_id: str, updated_gt_stats: dict[GtKey, ValidationFrameStats] ): # Read more about upsert: # https://docs.sqlalchemy.org/en/20/orm/queryguide/dml.html#orm-upsert-statements @@ -152,14 +152,15 @@ def update_gt_stats( [ { "task_id": task_id, - "gt_frame_name": gt_frame_name, + "gt_frame_name": gt_key.filename, + "label_set": GtStats.encode_label_set(gt_key.labels), "failed_attempts": val_frame_stats.failed_attempts, "accepted_attempts": val_frame_stats.accepted_attempts, "accumulated_quality": val_frame_stats.accumulated_quality, "total_uses": val_frame_stats.total_uses, "enabled": val_frame_stats.enabled, } - for gt_frame_name, val_frame_stats in updated_gt_stats.items() + for gt_key, val_frame_stats in updated_gt_stats.items() ], ) statement = statement.on_conflict_do_update( diff --git a/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py b/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py index 269227a063..b3f7107f74 100644 --- a/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py +++ b/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py @@ -1,4 +1,5 @@ import io +import logging import math import random import unittest @@ -15,7 +16,9 @@ from datumaro.util import take_by from sqlalchemy.orm import Session +import src.models.validation as models from src.core.annotation_meta import AnnotationMeta, JobMeta +from src.core.gt_stats import GtKey from src.core.types import Networks from src.core.validation_errors import TooSlowAnnotationError from src.core.validation_results import ValidationFailure, ValidationSuccess @@ -166,6 +169,11 @@ def test_can_handle_lowered_quality_requirements_in_manifest(self, session: Sess frames=[SimpleNamespace(name=f"frame_{i}.jpg") for i in range(frame_count)], ) + mock_get_task_labels = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.cvat_api.get_task_labels") + ) + mock_get_task_labels.return_value = [label.name for label in manifest.annotation.labels] + def patched_prepare_merged_dataset(self): self._updated_merged_dataset_archive = io.BytesIO() @@ -384,6 +392,11 @@ def test_can_change_bad_honeypots_in_jobs(self, session: Session, seed: int): frames=[SimpleNamespace(name=name) for name in task_frame_names], ) + mock_get_task_labels = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.cvat_api.get_task_labels") + ) + mock_get_task_labels.return_value = [label.name for label in manifest.annotation.labels] + def patched_prepare_merged_dataset(self): self._updated_merged_dataset_archive = io.BytesIO() @@ -635,6 +648,11 @@ def test_can_stop_on_slow_annotation_after_warmup_iterations(self, session: Sess frames=[SimpleNamespace(name=f"frame_{i}.jpg") for i in range(frame_count)], ) + mock_get_task_labels = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.cvat_api.get_task_labels") + ) + mock_get_task_labels.return_value = [label.name for label in manifest.annotation.labels] + def patched_prepare_merged_dataset(self): self._updated_merged_dataset_archive = io.BytesIO() @@ -705,3 +723,540 @@ def patched_prepare_merged_dataset(self): manifest=manifest, logger=logger, ) + + def test_can_exclude_bad_gt_for_each_label_separately(self, session: Session): + escrow_address = ESCROW_ADDRESS + chain_id = Networks.localhost + + frame_count = 10 + label_count = 2 + manifest = generate_manifest( + min_quality=0.8, job_size=2, validation_frames_per_job=2, labels=[label_count] + ) + validation_frames = [2, 3, 4, 5] + + cvat_task_id1 = 1 + cvat_task_id2 = 2 + + annotator1 = WALLET_ADDRESS1 + assignment1_id = f"0x{0:040d}" + assignment2_id = f"0x{1:040d}" + + # create a validation input + with ExitStack() as common_lock_es: + logger = mock.Mock(Logger) + + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.BucketAccessInfo.parse_obj") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.dm.Dataset.import_from") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.extract_zip_archive") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.write_dir_to_zip_archive") + ) + + mock_make_cloud_client = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.make_cloud_client") + ) + mock_make_cloud_client.return_value.download_file = mock.Mock(return_value=b"") + + # All tasks have the same validation layout + mock_get_task_validation_layout = common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_validation_layout", + ) + ) + mock_get_task_validation_layout.return_value = mock.Mock( + cvat_api.models.ITaskValidationLayoutRead, + validation_frames=validation_frames, + honeypot_count=2, + honeypot_frames=[0, 1], + honeypot_real_frames=[2, 3], + frames_per_job_count=2, + ) + + # All tasks have the same frames + mock_get_task_data_meta = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.cvat_api.get_task_data_meta") + ) + mock_get_task_data_meta.return_value = mock.Mock( + cvat_api.models.IDataMetaRead, + frames=[SimpleNamespace(name=f"frame_{i}.jpg") for i in range(frame_count)], + ) + + def patched_get_task_labels(task_id: int): + return [manifest.annotation.labels[0].nodes[task_id - 1]] + + common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_labels", + patched_get_task_labels, + ) + ) + + def patched_prepare_merged_dataset(self): + self._updated_merged_dataset_archive = io.BytesIO() + + common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results._TaskValidator._prepare_merged_dataset", + patched_prepare_merged_dataset, + ) + ) + + annotation_meta = AnnotationMeta( + jobs=[ + JobMeta( + job_id=cvat_task_id1, + task_id=cvat_task_id1, + annotation_filename="", + annotator_wallet_address=annotator1, + assignment_id=assignment1_id, + start_frame=0, + stop_frame=manifest.annotation.job_size + manifest.validation.val_size, + ), + JobMeta( + job_id=cvat_task_id2, + task_id=cvat_task_id2, + annotation_filename="", + annotator_wallet_address=annotator1, + assignment_id=assignment2_id, + start_frame=0, + stop_frame=manifest.annotation.job_size + manifest.validation.val_size, + ), + ] + ) + + def patched_get_task_quality_report(task_id: int): + return mock.Mock(cvat_api.models.IQualityReport, id=task_id) + + def patched_get_quality_report_data(report_id: int): + if report_id == cvat_task_id1: + return mock.Mock( + cvat_api.QualityReportData, + frame_results={ + "0": mock.Mock(annotations=mock.Mock(accuracy=0)), + "1": mock.Mock(annotations=mock.Mock(accuracy=1)), + }, + ) + if report_id == cvat_task_id2: + return mock.Mock( + cvat_api.QualityReportData, + frame_results={ + "0": mock.Mock(annotations=mock.Mock(accuracy=1)), + "1": mock.Mock(annotations=mock.Mock(accuracy=0)), + }, + ) + + raise AssertionError + + def patched_get_jobs_quality_reports(task_id: int): + return [ + mock.Mock( + cvat_api.models.IQualityReport, + job_id=task_id, + summary=mock.Mock(accuracy=0.5), + ), + ] + + with ( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_quality_report", + side_effect=patched_get_task_quality_report, + ) as mock_get_task_quality_report, + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_quality_report_data", + patched_get_quality_report_data, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_jobs_quality_reports", + patched_get_jobs_quality_reports, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.update_task_validation_layout" + ) as mock_update_task_validation_layout, + mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0), + mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), + mock.patch("src.core.config.ValidationConfig.warmup_iterations", 0), + mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.6), + ): + vr = process_intermediate_results( + session, + escrow_address=escrow_address, + chain_id=chain_id, + meta=annotation_meta, + merged_annotations=io.BytesIO(), + manifest=manifest, + logger=logger, + ) + + assert isinstance(vr, ValidationFailure) + assert len(vr.rejected_jobs) == 2 + + mock_get_task_quality_report.assert_has_calls( + [mock.call(cvat_task_id1), mock.call(cvat_task_id2)], any_order=True + ) + + assert len(mock_update_task_validation_layout.mock_calls) == 2 + for call in mock_update_task_validation_layout.mock_calls: + if call.args[0] == cvat_task_id1: + assert call.kwargs["disabled_frames"] == [2] + elif call.args[0] == cvat_task_id2: + assert call.kwargs["disabled_frames"] == [3] + else: + raise AssertionError + + assert { + s.gt_key: (s.accepted_attempts, s.failed_attempts, s.total_uses) + for s in session.query(models.GtStats).all() + } == { + GtKey(filename="frame_2.jpg", labels=["label_0_node_0"]): (0, 1, 1), # used, failed + GtKey(filename="frame_3.jpg", labels=["label_0_node_0"]): (1, 0, 1), # used, passed + GtKey(filename="frame_4.jpg", labels=["label_0_node_0"]): (0, 0, 1), + GtKey(filename="frame_5.jpg", labels=["label_0_node_0"]): (0, 0, 1), + GtKey(filename="frame_2.jpg", labels=["label_0_node_1"]): (1, 0, 1), # used, passed + GtKey(filename="frame_3.jpg", labels=["label_0_node_1"]): (0, 1, 1), # used, failed + GtKey(filename="frame_4.jpg", labels=["label_0_node_1"]): (0, 0, 1), + GtKey(filename="frame_5.jpg", labels=["label_0_node_1"]): (0, 0, 1), + } + + def test_can_complete_if_not_enough_gt_left_in_task( + self, session: Session, caplog: pytest.LogCaptureFixture + ): + escrow_address = ESCROW_ADDRESS + chain_id = Networks.localhost + + frame_count = 10 + label_count = 2 + manifest = generate_manifest( + min_quality=0.8, job_size=2, validation_frames_per_job=2, labels=[label_count] + ) + validation_frames = [2, 3, 4] + + cvat_task_id1 = 1 + cvat_task_id2 = 2 + + annotator1 = WALLET_ADDRESS1 + assignment1_id = f"0x{0:040d}" + assignment2_id = f"0x{1:040d}" + + # create a validation input + with ExitStack() as common_lock_es: + logger = logging.getLogger() + + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.BucketAccessInfo.parse_obj") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.dm.Dataset.import_from") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.extract_zip_archive") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.write_dir_to_zip_archive") + ) + + mock_make_cloud_client = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.make_cloud_client") + ) + mock_make_cloud_client.return_value.download_file = mock.Mock(return_value=b"") + + # All tasks have the same validation layout + mock_get_task_validation_layout = common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_validation_layout", + ) + ) + mock_get_task_validation_layout.return_value = mock.Mock( + cvat_api.models.ITaskValidationLayoutRead, + validation_frames=validation_frames, + honeypot_count=2, + honeypot_frames=[0, 1], + honeypot_real_frames=[2, 3], + frames_per_job_count=2, + ) + + # All tasks have the same frames + mock_get_task_data_meta = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.cvat_api.get_task_data_meta") + ) + mock_get_task_data_meta.return_value = mock.Mock( + cvat_api.models.IDataMetaRead, + frames=[SimpleNamespace(name=f"frame_{i}.jpg") for i in range(frame_count)], + ) + + def patched_get_task_labels(task_id: int): + return [manifest.annotation.labels[0].nodes[task_id - 1]] + + common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_labels", + patched_get_task_labels, + ) + ) + + def patched_prepare_merged_dataset(self): + self._updated_merged_dataset_archive = io.BytesIO() + + common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results._TaskValidator._prepare_merged_dataset", + patched_prepare_merged_dataset, + ) + ) + + annotation_meta = AnnotationMeta( + jobs=[ + JobMeta( + job_id=cvat_task_id1, + task_id=cvat_task_id1, + annotation_filename="", + annotator_wallet_address=annotator1, + assignment_id=assignment1_id, + start_frame=0, + stop_frame=manifest.annotation.job_size + manifest.validation.val_size, + ), + JobMeta( + job_id=cvat_task_id2, + task_id=cvat_task_id2, + annotation_filename="", + annotator_wallet_address=annotator1, + assignment_id=assignment2_id, + start_frame=0, + stop_frame=manifest.annotation.job_size + manifest.validation.val_size, + ), + ] + ) + + def patched_get_task_quality_report(task_id: int): + return mock.Mock(cvat_api.models.IQualityReport, id=task_id) + + def patched_get_quality_report_data(report_id: int): + if report_id == cvat_task_id1: + return mock.Mock( + cvat_api.QualityReportData, + frame_results={ + "0": mock.Mock(annotations=mock.Mock(accuracy=0)), + "1": mock.Mock(annotations=mock.Mock(accuracy=1)), + }, + ) + if report_id == cvat_task_id2: + return mock.Mock( + cvat_api.QualityReportData, + frame_results={ + "0": mock.Mock(annotations=mock.Mock(accuracy=1)), + "1": mock.Mock(annotations=mock.Mock(accuracy=1)), + }, + ) + + raise AssertionError + + def patched_get_jobs_quality_reports(task_id: int): + return [ + mock.Mock( + cvat_api.models.IQualityReport, + job_id=task_id, + summary=mock.Mock(accuracy=1), + ), + ] + + with ( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_quality_report", + side_effect=patched_get_task_quality_report, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_quality_report_data", + patched_get_quality_report_data, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_jobs_quality_reports", + patched_get_jobs_quality_reports, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.update_task_validation_layout" + ) as mock_update_task_validation_layout, + mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0.7), + mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), + mock.patch("src.core.config.ValidationConfig.warmup_iterations", 0), + mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.6), + ): + vr = process_intermediate_results( + session, + escrow_address=escrow_address, + chain_id=chain_id, + meta=annotation_meta, + merged_annotations=io.BytesIO(), + manifest=manifest, + logger=logger, + ) + + assert isinstance(vr, ValidationSuccess) + assert any( + "Too many validation frames excluded in the task" in m for m in caplog.messages + ) + + mock_update_task_validation_layout.assert_not_called() + + def test_can_complete_if_not_enough_gt_left_in_task( + self, session: Session, caplog: pytest.LogCaptureFixture + ): + escrow_address = ESCROW_ADDRESS + chain_id = Networks.localhost + + frame_count = 10 + label_count = 2 + manifest = generate_manifest( + min_quality=0.8, job_size=2, validation_frames_per_job=2, labels=[label_count] + ) + validation_frames = [2, 3] + + cvat_task_id = 1 + + annotator1 = WALLET_ADDRESS1 + assignment1_id = f"0x{0:040d}" + + # create a validation input + with ExitStack() as common_lock_es: + logger = logging.getLogger() + + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.BucketAccessInfo.parse_obj") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.dm.Dataset.import_from") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.extract_zip_archive") + ) + common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.write_dir_to_zip_archive") + ) + + mock_make_cloud_client = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.make_cloud_client") + ) + mock_make_cloud_client.return_value.download_file = mock.Mock(return_value=b"") + + # All tasks have the same validation layout + mock_get_task_validation_layout = common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_validation_layout", + ) + ) + mock_get_task_validation_layout.return_value = mock.Mock( + cvat_api.models.ITaskValidationLayoutRead, + validation_frames=validation_frames, + honeypot_count=2, + honeypot_frames=[0, 1], + honeypot_real_frames=[2, 3], + frames_per_job_count=2, + ) + + # All tasks have the same frames + mock_get_task_data_meta = common_lock_es.enter_context( + mock.patch("src.handlers.process_intermediate_results.cvat_api.get_task_data_meta") + ) + mock_get_task_data_meta.return_value = mock.Mock( + cvat_api.models.IDataMetaRead, + frames=[SimpleNamespace(name=f"frame_{i}.jpg") for i in range(frame_count)], + ) + + def patched_get_task_labels(task_id: int): + return [manifest.annotation.labels[0].nodes[task_id - 1]] + + common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_labels", + patched_get_task_labels, + ) + ) + + def patched_prepare_merged_dataset(self): + self._updated_merged_dataset_archive = io.BytesIO() + + common_lock_es.enter_context( + mock.patch( + "src.handlers.process_intermediate_results._TaskValidator._prepare_merged_dataset", + patched_prepare_merged_dataset, + ) + ) + + annotation_meta = AnnotationMeta( + jobs=[ + JobMeta( + job_id=cvat_task_id, + task_id=cvat_task_id, + annotation_filename="", + annotator_wallet_address=annotator1, + assignment_id=assignment1_id, + start_frame=0, + stop_frame=manifest.annotation.job_size + manifest.validation.val_size, + ) + ] + ) + + def patched_get_task_quality_report(task_id: int): + return mock.Mock(cvat_api.models.IQualityReport, id=task_id) + + def patched_get_quality_report_data(report_id: int): + if report_id == cvat_task_id: + return mock.Mock( + cvat_api.QualityReportData, + frame_results={ + "0": mock.Mock(annotations=mock.Mock(accuracy=0)), + "1": mock.Mock(annotations=mock.Mock(accuracy=1)), + }, + ) + + raise AssertionError + + def patched_get_jobs_quality_reports(task_id: int): + return [ + mock.Mock( + cvat_api.models.IQualityReport, + job_id=task_id, + summary=mock.Mock(accuracy=0.5), + ), + ] + + with ( + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_task_quality_report", + side_effect=patched_get_task_quality_report, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_quality_report_data", + patched_get_quality_report_data, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.get_jobs_quality_reports", + patched_get_jobs_quality_reports, + ), + mock.patch( + "src.handlers.process_intermediate_results.cvat_api.update_task_validation_layout" + ) as mock_update_task_validation_layout, + mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0), + mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), + mock.patch("src.core.config.ValidationConfig.warmup_iterations", 0), + mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.6), + ): + vr = process_intermediate_results( + session, + escrow_address=escrow_address, + chain_id=chain_id, + meta=annotation_meta, + merged_annotations=io.BytesIO(), + manifest=manifest, + logger=logger, + ) + + assert isinstance(vr, ValidationSuccess) + assert any("Too few validation frames left in the task" in m for m in caplog.messages) + + mock_update_task_validation_layout.assert_not_called() diff --git a/packages/examples/cvat/recording-oracle/tests/utils/helpers.py b/packages/examples/cvat/recording-oracle/tests/utils/helpers.py index 5e1da94bac..22ff66fa0f 100644 --- a/packages/examples/cvat/recording-oracle/tests/utils/helpers.py +++ b/packages/examples/cvat/recording-oracle/tests/utils/helpers.py @@ -1,13 +1,32 @@ +from collections.abc import Iterable + from src.core.manifest import TaskManifest, parse_manifest def generate_manifest( - *, min_quality: float = 0.8, job_size: int = 10, validation_frames_per_job: int = 2 + *, + min_quality: float = 0.8, + job_size: int = 10, + validation_frames_per_job: int = 2, + labels: int | Iterable[int] = 1, ) -> TaskManifest: + label_definitions = [] + if isinstance(labels, int): + label_definitions.extend({"name": f"label_{i}"} for i in range(labels)) + else: + label_definitions.extend( + { + "name": f"label_{i}", + "type": "skeleton", + "nodes": [f"label_{i}_node_{j}" for j in range(label_sublabels)], + } + for i, label_sublabels in enumerate(labels) + ) + data = { "data": {"data_url": "http://localhost:9010/datasets/sample"}, "annotation": { - "labels": [{"name": "person"}], + "labels": label_definitions, "description": "", "user_guide": "", "type": "image_points", From d8bc328bbab21226ab64134563b6dffe3886f6cb Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Jan 2025 19:49:24 +0300 Subject: [PATCH 13/28] [CVAT] Auto gt ban threshold (#2978) * Collect GT stats per task label set * Fix migration * Change gt ban threshold to 1 - manifest quality * Update tests * Remove unexpected changes --- .../cvat/recording-oracle/src/.env.template | 1 - .../cvat/recording-oracle/src/core/config.py | 6 ------ .../handlers/process_intermediate_results.py | 2 +- .../services/test_validation_service.py | 20 ++++++++----------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/packages/examples/cvat/recording-oracle/src/.env.template b/packages/examples/cvat/recording-oracle/src/.env.template index 729027cc6d..6abb5d245f 100644 --- a/packages/examples/cvat/recording-oracle/src/.env.template +++ b/packages/examples/cvat/recording-oracle/src/.env.template @@ -76,7 +76,6 @@ ENABLE_CUSTOM_CLOUD_HOST= MIN_AVAILABLE_GT_THRESHOLD= MAX_USABLE_GT_SHARE= -GT_BAN_THRESHOLD= UNVERIFIABLE_ASSIGNMENTS_THRESHOLD= MAX_ESCROW_ITERATIONS= WARMUP_ITERATIONS= diff --git a/packages/examples/cvat/recording-oracle/src/core/config.py b/packages/examples/cvat/recording-oracle/src/core/config.py index 687a9cf5b1..11b9c6e8bf 100644 --- a/packages/examples/cvat/recording-oracle/src/core/config.py +++ b/packages/examples/cvat/recording-oracle/src/core/config.py @@ -174,12 +174,6 @@ class ValidationConfig: value small enough for faster convergence rate of the annotation process. """ - gt_ban_threshold = float(getenv("GT_BAN_THRESHOLD", "0.03")) - """ - The minimum allowed rating (annotation probability) per GT sample, - before it's considered bad and banned for further use. - """ - unverifiable_assignments_threshold = float(getenv("UNVERIFIABLE_ASSIGNMENTS_THRESHOLD", "0.1")) """ Deprecated. Not expected to happen in practice, kept only as a safety fallback rule. diff --git a/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py b/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py index 7501e74b3b..475c3d7e0d 100644 --- a/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py +++ b/packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py @@ -545,7 +545,7 @@ def _get_available_gt(self) -> tuple[GtStats, dict[int, set[GtKey]]]: gt_key for gt_key, gt_stat in self.gt_stats.items() if gt_stat.enabled - if gt_stat.rating > Config.validation.gt_ban_threshold + if gt_stat.rating > 1 - self.manifest.validation.min_quality }, task_id_to_gt_keys def _check_warmup_annotation_speed(self): diff --git a/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py b/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py index b3f7107f74..c203c08bc1 100644 --- a/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py +++ b/packages/examples/cvat/recording-oracle/tests/integration/services/test_validation_service.py @@ -302,7 +302,7 @@ def patched_prepare_merged_dataset(self): class TestValidationLogic: - @pytest.mark.parametrize("seed", [41]) # range(50)) + @pytest.mark.parametrize("seed", range(25)) def test_can_change_bad_honeypots_in_jobs(self, session: Session, seed: int): escrow_address = ESCROW_ADDRESS chain_id = Networks.localhost @@ -323,7 +323,7 @@ def test_can_change_bad_honeypots_in_jobs(self, session: Session, seed: int): ) manifest = generate_manifest( - min_quality=0.8, job_size=job_size, validation_frames_per_job=validation_frames_per_job + min_quality=0.65, job_size=job_size, validation_frames_per_job=validation_frames_per_job ) ( @@ -438,7 +438,6 @@ def patched_prepare_merged_dataset(self): mock.patch( "src.handlers.process_intermediate_results.cvat_api.update_task_validation_layout" ) as mock_update_task_validation_layout, - mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.35), mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0), mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), mock.patch("src.core.config.ValidationConfig.min_warmup_progress", 0), @@ -633,7 +632,7 @@ def test_can_stop_on_slow_annotation_after_warmup_iterations(self, session: Sess ) mock_get_task_validation_layout.return_value = mock.Mock( cvat_api.models.ITaskValidationLayoutRead, - validation_frames=[2, 3], + validation_frames=[2, 3, 4, 5], honeypot_count=2, honeypot_frames=[0, 1], honeypot_real_frames=[2, 3], @@ -731,7 +730,7 @@ def test_can_exclude_bad_gt_for_each_label_separately(self, session: Session): frame_count = 10 label_count = 2 manifest = generate_manifest( - min_quality=0.8, job_size=2, validation_frames_per_job=2, labels=[label_count] + min_quality=0.4, job_size=2, validation_frames_per_job=2, labels=[label_count] ) validation_frames = [2, 3, 4, 5] @@ -859,7 +858,7 @@ def patched_get_jobs_quality_reports(task_id: int): mock.Mock( cvat_api.models.IQualityReport, job_id=task_id, - summary=mock.Mock(accuracy=0.5), + summary=mock.Mock(accuracy=manifest.validation.min_quality - 0.1), ), ] @@ -882,7 +881,6 @@ def patched_get_jobs_quality_reports(task_id: int): mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0), mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), mock.patch("src.core.config.ValidationConfig.warmup_iterations", 0), - mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.6), ): vr = process_intermediate_results( session, @@ -933,7 +931,7 @@ def test_can_complete_if_not_enough_gt_left_in_task( frame_count = 10 label_count = 2 manifest = generate_manifest( - min_quality=0.8, job_size=2, validation_frames_per_job=2, labels=[label_count] + min_quality=0.4, job_size=2, validation_frames_per_job=2, labels=[label_count] ) validation_frames = [2, 3, 4] @@ -1084,7 +1082,6 @@ def patched_get_jobs_quality_reports(task_id: int): mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0.7), mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), mock.patch("src.core.config.ValidationConfig.warmup_iterations", 0), - mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.6), ): vr = process_intermediate_results( session, @@ -1112,7 +1109,7 @@ def test_can_complete_if_not_enough_gt_left_in_task( frame_count = 10 label_count = 2 manifest = generate_manifest( - min_quality=0.8, job_size=2, validation_frames_per_job=2, labels=[label_count] + min_quality=0.4, job_size=2, validation_frames_per_job=2, labels=[label_count] ) validation_frames = [2, 3] @@ -1221,7 +1218,7 @@ def patched_get_jobs_quality_reports(task_id: int): mock.Mock( cvat_api.models.IQualityReport, job_id=task_id, - summary=mock.Mock(accuracy=0.5), + summary=mock.Mock(accuracy=manifest.validation.min_quality - 0.1), ), ] @@ -1244,7 +1241,6 @@ def patched_get_jobs_quality_reports(task_id: int): mock.patch("src.core.config.ValidationConfig.min_available_gt_threshold", 0), mock.patch("src.core.config.ValidationConfig.max_gt_share", 1), mock.patch("src.core.config.ValidationConfig.warmup_iterations", 0), - mock.patch("src.core.config.ValidationConfig.gt_ban_threshold", 0.6), ): vr = process_intermediate_results( session, From 0a659cfd5c2a6c7218b31760988985a26d09600d Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Fri, 10 Jan 2025 15:57:26 +0300 Subject: [PATCH 14/28] [Human App] fix: operator signup keys form (#2988) --- .../operator/views/sign-up/add-keys.page.tsx | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx index b1e5dd836e..3ce57e5a47 100644 --- a/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/operator/views/sign-up/add-keys.page.tsx @@ -60,10 +60,21 @@ export function Form({ }: { keysData: GetEthKVStoreValuesSuccessResponse; }) { - const areSomeExistingKeys = Object.values(keysData).filter(Boolean).length; - const areSomePendingKeys = Object.entries(keysData).filter( - ([key, values]) => key && !values.length - ).length; + const hasSomeNotEmptyKeys = + Object.values(keysData).filter(Boolean).length > 0; + const hasSomePendingKeys = + Object.values(keysData).filter((value) => { + /** + * This check is necessary because TS can't infer + * "undefined" from optional object's property + */ + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (value === undefined) { + return false; + } + + return value.length === 0; + }).length > 0; return ( @@ -75,9 +86,9 @@ export function Form({ gap: '3rem', }} > - {areSomeExistingKeys ? : null} - {areSomePendingKeys ? : null} - {areSomeExistingKeys && !areSomePendingKeys ? ( + {hasSomeNotEmptyKeys ? : null} + {hasSomePendingKeys ? : null} + {hasSomeNotEmptyKeys && !hasSomePendingKeys ? ( + + ); +} + +function formatAddress(address?: string) { + if (!address) return ''; + return `${address.slice(0, 6)}…${address.slice(-4)}`; +} diff --git a/packages/apps/staking/src/components/BalanceCard/index.tsx b/packages/apps/staking/src/components/BalanceCard/index.tsx new file mode 100644 index 0000000000..cae44465b3 --- /dev/null +++ b/packages/apps/staking/src/components/BalanceCard/index.tsx @@ -0,0 +1,47 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import { Box, Paper, Typography } from '@mui/material'; +import React from 'react'; +import { useStakeContext } from '../../contexts/stake'; +import { colorPalette } from '../../assets/styles/color-palette'; +import CustomTooltip from '../CustomTooltip'; + +const BalanceCard: React.FC = () => { + const { tokenBalance } = useStakeContext(); + + return ( + + + + + + + + + Wallet Balance + + + + + {tokenBalance} HMT + + + ); +}; + +export default BalanceCard; diff --git a/packages/apps/staking/src/components/CustomTooltip/index.tsx b/packages/apps/staking/src/components/CustomTooltip/index.tsx new file mode 100644 index 0000000000..4002edbb51 --- /dev/null +++ b/packages/apps/staking/src/components/CustomTooltip/index.tsx @@ -0,0 +1,7 @@ +import { Tooltip, TooltipProps } from '@mui/material'; + +const CustomTooltip = (props: TooltipProps) => { + return ; +}; + +export default CustomTooltip; diff --git a/packages/apps/staking/src/components/Footer/Footer.tsx b/packages/apps/staking/src/components/Footer/Footer.tsx new file mode 100644 index 0000000000..cc9a7eadec --- /dev/null +++ b/packages/apps/staking/src/components/Footer/Footer.tsx @@ -0,0 +1,95 @@ +import { FC } from 'react'; +import Typography from '@mui/material/Typography'; +import TwitterIcon from '@mui/icons-material/Twitter'; +import LinkedInIcon from '@mui/icons-material/LinkedIn'; +import GitHubIcon from '@mui/icons-material/GitHub'; +import TelegramIcon from '@mui/icons-material/Telegram'; +import DiscordIcon from '../../assets/DiscordIcon'; +import { colorPalette } from '../../assets/styles/color-palette'; + +const Footer: FC = () => { + const handleClick = (url: string) => { + window.open(url, '_blank'); + }; + + return ( +
+
+
+
+ + handleClick(import.meta.env.VITE_FOOTER_LINK_PRIVACY_POLICY) + } + > + Privacy Policy + + + handleClick(import.meta.env.VITE_FOOTER_LINK_TERMS_OF_SERVICE) + } + > + Terms of Service + + + handleClick(import.meta.env.VITE_FOOTER_LINK_HUMAN_PROTOCOL) + } + > + HUMAN Protocol + +
+ + © 2021 HPF. HUMAN Protocol® is a registered trademark + +
+
+ handleClick(import.meta.env.VITE_FOOTER_LINK_GITHUB)} + /> + + handleClick(import.meta.env.VITE_FOOTER_LINK_DISCORD) + } + /> + handleClick(import.meta.env.VITE_FOOTER_LINK_X)} + /> + + handleClick(import.meta.env.VITE_FOOTER_LINK_TELEGRAM) + } + /> + + handleClick(import.meta.env.VITE_FOOTER_LINK_LINKEDIN) + } + /> +
+
+
+ ); +}; + +export default Footer; diff --git a/packages/apps/staking/src/components/Headers/DefaultHeader.tsx b/packages/apps/staking/src/components/Headers/DefaultHeader.tsx new file mode 100644 index 0000000000..0abc506166 --- /dev/null +++ b/packages/apps/staking/src/components/Headers/DefaultHeader.tsx @@ -0,0 +1,133 @@ +import { FC, useState } from 'react'; +import { + AppBar, + Box, + Link as MuiLink, + Toolbar, + IconButton, + Drawer, + Typography, +} from '@mui/material'; +import MenuIcon from '@mui/icons-material/Menu'; +import CloseIcon from '@mui/icons-material/Close'; +import { Link } from 'react-router-dom'; +import logoImg from '../../assets/logo.svg'; +import { useAccount } from 'wagmi'; +import { Account } from '../Account'; + +export const DefaultHeader: FC = () => { + const { isConnected } = useAccount(); + const [mobileMenuOpen, setMobileMenuOpen] = useState(false); + + const toggleDrawer = (open: boolean) => { + setMobileMenuOpen(open); + }; + + return ( + + + + + Staking Dashboard + + Staking Dashboard + + + + + + + Dashboard + + + HUMAN Website + + + {isConnected && } + + + toggleDrawer(true)} + > + + + + toggleDrawer(false)} + PaperProps={{ sx: { width: '75%' } }} + > + + + toggleDrawer(false)} + sx={{ color: 'primary.main' }} + > + + + + + {isConnected && ( + + + + )} + + toggleDrawer(false)} + > + Dashboard + + + toggleDrawer(false)} + > + HUMAN Website + + + + + + ); +}; + +export default DefaultHeader; diff --git a/packages/apps/staking/src/components/LockedAmountCard/index.tsx b/packages/apps/staking/src/components/LockedAmountCard/index.tsx new file mode 100644 index 0000000000..637c688d1f --- /dev/null +++ b/packages/apps/staking/src/components/LockedAmountCard/index.tsx @@ -0,0 +1,56 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import { Box, Paper, Typography } from '@mui/material'; +import React from 'react'; +import { colorPalette } from '../../assets/styles/color-palette'; +import { useStakeContext } from '../../contexts/stake'; +import CustomTooltip from '../CustomTooltip'; + +const LockedAmountCard: React.FC = () => { + const { lockedAmount, lockedUntil } = useStakeContext(); + + return ( + + + + + + + + + Locked Amount + + + + + {lockedAmount} HMT + + + {lockedUntil !== undefined && lockedUntil > 0n && ( + + Until block {lockedUntil.toString()} + + )} + + ); +}; + +export default LockedAmountCard; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/AvalancheIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/AvalancheIcon.tsx new file mode 100644 index 0000000000..2a1473418b --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/AvalancheIcon.tsx @@ -0,0 +1,33 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const AvalancheIcon: FC = (props) => { + return ( + + + + + + + ); +}; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/BinanceSmartChainIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/BinanceSmartChainIcon.tsx new file mode 100644 index 0000000000..5620a6e72d --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/BinanceSmartChainIcon.tsx @@ -0,0 +1,51 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const BinanceSmartChainIcon: FC = (props) => { + return ( + + + + + + + + + + + + + ); +}; + +export default BinanceSmartChainIcon; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/EthereumIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/EthereumIcon.tsx new file mode 100644 index 0000000000..381b049142 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/EthereumIcon.tsx @@ -0,0 +1,38 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const EthereumIcon: FC = (props) => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export default EthereumIcon; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/HumanIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/HumanIcon.tsx new file mode 100644 index 0000000000..b80c2b36d0 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/HumanIcon.tsx @@ -0,0 +1,17 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const HumanIcon: FC = (props) => { + return ( + + + + ); +}; + +export default HumanIcon; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/MoonbaseAlphaIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/MoonbaseAlphaIcon.tsx new file mode 100644 index 0000000000..7bf42a3377 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/MoonbaseAlphaIcon.tsx @@ -0,0 +1,71 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const MoonbaseAlphaIcon: FC = (props) => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export default MoonbaseAlphaIcon; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/MoonbeamIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/MoonbeamIcon.tsx new file mode 100644 index 0000000000..085f24f1d2 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/MoonbeamIcon.tsx @@ -0,0 +1,15 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const MoonbeamIcon: FC = (props) => { + return ( + + + + ); +}; + +export default MoonbeamIcon; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/PolygonIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/PolygonIcon.tsx new file mode 100644 index 0000000000..26ef262294 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/PolygonIcon.tsx @@ -0,0 +1,15 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const PolygonIcon: FC = (props) => { + return ( + + + + ); +}; + +export default PolygonIcon; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/XLayerIcon.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/XLayerIcon.tsx new file mode 100644 index 0000000000..b6b213e57d --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/Icons/XLayerIcon.tsx @@ -0,0 +1,78 @@ +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; +import { FC } from 'react'; + +export const XLayerIcon: FC = (props) => { + return ( + + + + + + + + + + + + + + + + + + ); +}; diff --git a/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/index.tsx b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/index.tsx new file mode 100644 index 0000000000..62bbfe6205 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/NetworkIcon/index.tsx @@ -0,0 +1,41 @@ +import EthereumIcon from './Icons/EthereumIcon'; +import BinanceSmartChainIcon from './Icons/BinanceSmartChainIcon'; +import PolygonIcon from './Icons/PolygonIcon'; +import MoonbeamIcon from './Icons/MoonbeamIcon'; +import MoonbaseAlphaIcon from './Icons/MoonbaseAlphaIcon'; +import { XLayerIcon } from './Icons/XLayerIcon'; +import HumanIcon from './Icons/HumanIcon'; +import { AvalancheIcon } from './Icons/AvalancheIcon'; + +export const NetworkIcon = ({ chainId }: { chainId: number }) => { + const icon = (() => { + switch (chainId) { + case 1: + case 4: + case 5: + case 11155111: + return ; + case 56: + case 97: + return ; + case 137: + case 80001: + case 80002: + return ; + case 1284: + return ; + case 1287: + return ; + case 195: + case 196: + return ; + case 43113: + case 43114: + return ; + default: + return ; + } + })(); + + return <>{icon}; +}; diff --git a/packages/apps/staking/src/components/NetworkStatus/index.tsx b/packages/apps/staking/src/components/NetworkStatus/index.tsx new file mode 100644 index 0000000000..8733d67923 --- /dev/null +++ b/packages/apps/staking/src/components/NetworkStatus/index.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import { Box, Chip, Typography, useTheme } from '@mui/material'; +import { useAccount } from 'wagmi'; +import { NetworkIcon } from './NetworkIcon'; + +const NetworkStatus: React.FC = () => { + const { chain } = useAccount(); + const theme = useTheme(); + + if (!chain) return null; + + return ( + + + + } + label={ + + {chain.name} + + } + sx={{ + backgroundColor: theme.palette.background.default, + color: theme.palette.primary.contrastText, + height: 64, + paddingRight: 2, + paddingLeft: 2, + borderRadius: '12px', + }} + /> + ); +}; + +export default NetworkStatus; diff --git a/packages/apps/staking/src/components/PageWrapper/index.tsx b/packages/apps/staking/src/components/PageWrapper/index.tsx new file mode 100644 index 0000000000..5484f2d9e5 --- /dev/null +++ b/packages/apps/staking/src/components/PageWrapper/index.tsx @@ -0,0 +1,27 @@ +import { FC, PropsWithChildren } from 'react'; +import clsx from 'clsx'; +import { DefaultHeader } from '../Headers/DefaultHeader'; +import Footer from '../Footer/Footer'; + +const PageWrapper: FC< + PropsWithChildren<{ + violetHeader?: boolean; + className?: string; + }> +> = ({ children, violetHeader, className }) => { + return ( +
+ +
+
{children}
+
+
+
+ ); +}; + +export default PageWrapper; diff --git a/packages/apps/staking/src/components/StakedAmountCard/index.tsx b/packages/apps/staking/src/components/StakedAmountCard/index.tsx new file mode 100644 index 0000000000..2407122774 --- /dev/null +++ b/packages/apps/staking/src/components/StakedAmountCard/index.tsx @@ -0,0 +1,61 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import { Box, Button, Paper, Typography } from '@mui/material'; +import React from 'react'; +import { colorPalette } from '../../assets/styles/color-palette'; +import { useStakeContext } from '../../contexts/stake'; +import CustomTooltip from '../CustomTooltip'; + +type Props = { + onStakeOpen: () => void; + onUnstakeOpen: () => void; +}; + +const StakedAmountCard: React.FC = ({ onStakeOpen, onUnstakeOpen }) => { + const { stakedAmount } = useStakeContext(); + + return ( + + + + + + + + + Staked Amount + + + + + {stakedAmount} HMT + + + + + + + + ); +}; + +export default StakedAmountCard; diff --git a/packages/apps/staking/src/components/Wallet/ConnectWallet.tsx b/packages/apps/staking/src/components/Wallet/ConnectWallet.tsx new file mode 100644 index 0000000000..a92b163600 --- /dev/null +++ b/packages/apps/staking/src/components/Wallet/ConnectWallet.tsx @@ -0,0 +1,83 @@ +import { Box, Button, Grid, Typography } from '@mui/material'; +import { useEffect, useState } from 'react'; +import { useAccount } from 'wagmi'; +import fundCryptoImg from '../../assets/fund-crypto.png'; +import WalletModal from './WalletModal'; + +export const ConnectWallet = () => { + const [walletModalOpen, setWalletModalOpen] = useState(false); + const { isConnected } = useAccount(); + + const handleClickCrypto = () => { + if (!isConnected) { + setWalletModalOpen(true); + } + }; + + useEffect(() => { + if (isConnected && walletModalOpen) { + setWalletModalOpen(false); + } + }, [isConnected]); + + return ( + <> + + + + + crypto + + Connect Your Wallet + + + + + + + setWalletModalOpen(false)} + /> + + ); +}; diff --git a/packages/apps/staking/src/components/Wallet/WalletModal.tsx b/packages/apps/staking/src/components/Wallet/WalletModal.tsx new file mode 100644 index 0000000000..f3d32161a0 --- /dev/null +++ b/packages/apps/staking/src/components/Wallet/WalletModal.tsx @@ -0,0 +1,111 @@ +import CloseIcon from '@mui/icons-material/Close'; +import { + Box, + Button, + Dialog, + IconButton, + Typography, + useTheme, +} from '@mui/material'; +import { useConnect } from 'wagmi'; +import coinbaseSvg from '../../assets/coinbase.svg'; +import metaMaskSvg from '../../assets/metamask.svg'; +import walletConnectSvg from '../../assets/walletconnect.svg'; + +const WALLET_ICONS: Record = { + metaMask: metaMaskSvg, + coinbaseWalletSDK: coinbaseSvg, + walletConnect: walletConnectSvg, +}; + +export default function WalletModal({ + open, + onClose, +}: { + open: boolean; + onClose: () => void; +}) { + const { connect, connectors, error } = useConnect(); + + const theme = useTheme(); + + return ( + + + + + Connect +
your wallet +
+ + By connecting a wallet, you agree to HUMAN Protocol Terms of Service + and consent to its Privacy Policy. + +
+ + + + + + {connectors.map((connector) => ( + + ))} + + + {error &&
{error.message}
} +
+
+
+ ); +} diff --git a/packages/apps/staking/src/components/WithdrawableAmountCard/index.tsx b/packages/apps/staking/src/components/WithdrawableAmountCard/index.tsx new file mode 100644 index 0000000000..119c7760ae --- /dev/null +++ b/packages/apps/staking/src/components/WithdrawableAmountCard/index.tsx @@ -0,0 +1,74 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import { + Box, + Button, + CircularProgress, + Paper, + Typography, +} from '@mui/material'; +import React, { useState } from 'react'; +import { colorPalette } from '../../assets/styles/color-palette'; +import { useStakeContext } from '../../contexts/stake'; +import CustomTooltip from '../CustomTooltip'; + +const WithdrawableAmountCard: React.FC = () => { + const { withdrawableAmount, handleWithdraw } = useStakeContext(); + const [loading, setLoading] = useState(false); + + const handleWithdrawClick = async () => { + setLoading(true); + try { + await handleWithdraw(); + } catch (error) { + console.error('Error during withdrawal:', error); + } finally { + setLoading(false); + } + }; + + return ( + + + + + + + + + Withdrawable Amount + + + + + {withdrawableAmount} HMT + + + + + ); +}; + +export default WithdrawableAmountCard; diff --git a/packages/apps/staking/src/components/modals/BaseModal.tsx b/packages/apps/staking/src/components/modals/BaseModal.tsx new file mode 100644 index 0000000000..e20823c06b --- /dev/null +++ b/packages/apps/staking/src/components/modals/BaseModal.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import { Modal, Box, IconButton } from '@mui/material'; +import CloseIcon from '@mui/icons-material/Close'; + +type Props = { + open: boolean; + onClose: () => void; + children: React.ReactNode; +}; + +const BaseModal: React.FC = ({ open, onClose, children }) => { + return ( + + + + + + {children} + + + ); +}; + +export default BaseModal; diff --git a/packages/apps/staking/src/components/modals/StakeModal.tsx b/packages/apps/staking/src/components/modals/StakeModal.tsx new file mode 100644 index 0000000000..575f10ef79 --- /dev/null +++ b/packages/apps/staking/src/components/modals/StakeModal.tsx @@ -0,0 +1,86 @@ +import { + Button, + CircularProgress, + InputAdornment, + TextField, + Typography, +} from '@mui/material'; +import React, { useState } from 'react'; +import { useStakeContext } from '../../contexts/stake'; +import BaseModal from './BaseModal'; + +type Props = { + open: boolean; + onClose: () => void; +}; + +const StakeModal: React.FC = ({ open, onClose }) => { + const { handleStake, tokenBalance } = useStakeContext(); + const [amount, setAmount] = useState(''); + const [loading, setLoading] = useState(false); + + const handleStakeAction = async () => { + setLoading(true); + try { + await handleStake(amount); + onClose(); + setAmount(''); + } catch (error) { + console.error('Error during staking:', error); + } finally { + setLoading(false); + } + }; + + const handleMaxClick = () => { + setAmount(tokenBalance.toString()); + }; + + return ( + + + Add Stake + + + + Available amount: {tokenBalance} HMT + + + setAmount(e.target.value)} + inputProps={{ max: tokenBalance, min: 0 }} + InputProps={{ + endAdornment: ( + + + + ), + }} + /> + + + + ); +}; + +export default StakeModal; diff --git a/packages/apps/staking/src/components/modals/UnstakeModal.tsx b/packages/apps/staking/src/components/modals/UnstakeModal.tsx new file mode 100644 index 0000000000..55b8fd1ec4 --- /dev/null +++ b/packages/apps/staking/src/components/modals/UnstakeModal.tsx @@ -0,0 +1,95 @@ +import { + Button, + CircularProgress, + InputAdornment, + TextField, + Typography, +} from '@mui/material'; +import React, { useState } from 'react'; +import { useStakeContext } from '../../contexts/stake'; +import BaseModal from './BaseModal'; + +type Props = { + open: boolean; + onClose: () => void; +}; + +const UnstakeModal: React.FC = ({ open, onClose }) => { + const { stakedAmount, lockedAmount, handleUnstake } = useStakeContext(); + const [amount, setAmount] = useState(''); + const [loading, setLoading] = useState(false); + + const availableAmount = Number(stakedAmount) - Number(lockedAmount); + + const handleInputChange = (e: React.ChangeEvent) => { + const value = e.target.value; + if (Number(value) <= availableAmount) { + setAmount(value); + } + }; + + const handleMaxClick = () => { + setAmount(availableAmount.toString()); + }; + + const handleUnstakeClick = async () => { + setLoading(true); + try { + await handleUnstake(amount); + onClose(); + setAmount(''); + } catch (error) { + console.error('Error during unstaking:', error); + } finally { + setLoading(false); + } + }; + + return ( + + + Unstake + + + + Available Amount: {availableAmount} HMT + + + + + + ), + }} + /> + + + + ); +}; + +export default UnstakeModal; diff --git a/packages/apps/staking/src/constants/chains.ts b/packages/apps/staking/src/constants/chains.ts new file mode 100644 index 0000000000..aecd68e9a9 --- /dev/null +++ b/packages/apps/staking/src/constants/chains.ts @@ -0,0 +1,63 @@ +import { ChainId } from '@human-protocol/sdk'; + +export const IS_MAINNET = + import.meta.env.VITE_APP_ENVIRONMENT.toLowerCase() === 'mainnet'; +export const IS_TESTNET = !IS_MAINNET; + +let initialSupportedChainIds: ChainId[]; +switch (import.meta.env.VITE_APP_ENVIRONMENT.toLowerCase()) { + case 'mainnet': + initialSupportedChainIds = [ChainId.POLYGON]; + break; + case 'testnet': + initialSupportedChainIds = [ + ChainId.BSC_TESTNET, + ChainId.POLYGON_AMOY, + ChainId.SEPOLIA, + ChainId.XLAYER_TESTNET, + ]; + break; + case 'localhost': + default: + initialSupportedChainIds = [ChainId.LOCALHOST]; + break; +} + +const supportedChains = + import.meta.env.VITE_APP_SUPPORTED_CHAINS?.split(',') || []; + +export const SUPPORTED_CHAIN_IDS: ChainId[] = initialSupportedChainIds.filter( + (chainId) => supportedChains.includes(chainId.toString()) +); + +if (SUPPORTED_CHAIN_IDS.length === 0) { + throw new Error( + 'No valid RPC URL provided for the supported blockchain environment' + ); +} + +export const CHAIN_ID_BY_NAME: Record = { + 'Polygon Amoy': ChainId.POLYGON_AMOY, + 'Binance Smart Chain': ChainId.BSC_MAINNET, + 'Ethereum Sepolia': ChainId.SEPOLIA, + Localhost: ChainId.LOCALHOST, +}; + +export const LOCALHOST = { + id: 1338, + name: 'Localhost', + network: 'localhost', + nativeCurrency: { + decimals: 18, + name: 'Ether', + symbol: 'ETH', + }, + rpcUrls: { + default: { + http: ['http://127.0.0.1:8545'], + }, + public: { + http: ['http://127.0.0.1:8545'], + }, + }, +}; diff --git a/packages/apps/staking/src/constants/index.tsx b/packages/apps/staking/src/constants/index.tsx new file mode 100644 index 0000000000..60a4cd3b44 --- /dev/null +++ b/packages/apps/staking/src/constants/index.tsx @@ -0,0 +1 @@ +export const HUMAN_SIGNATURE_KEY = 'human-signature'; diff --git a/packages/apps/staking/src/contexts/stake.tsx b/packages/apps/staking/src/contexts/stake.tsx new file mode 100644 index 0000000000..c7f00e5b01 --- /dev/null +++ b/packages/apps/staking/src/contexts/stake.tsx @@ -0,0 +1,24 @@ +import React, { createContext, useContext } from 'react'; +import { useStake } from '../hooks/useStake'; + +const StakeContext = createContext | undefined>( + undefined +); + +export const StakeProvider: React.FC<{ children: React.ReactNode }> = ({ + children, +}) => { + const stake = useStake(); + + return ( + {children} + ); +}; + +export const useStakeContext = () => { + const context = useContext(StakeContext); + if (!context) { + throw new Error('useStakeContext must be used within a StakeProvider'); + } + return context; +}; diff --git a/packages/apps/staking/src/hooks/useStake.ts b/packages/apps/staking/src/hooks/useStake.ts new file mode 100644 index 0000000000..ddd8e3be70 --- /dev/null +++ b/packages/apps/staking/src/hooks/useStake.ts @@ -0,0 +1,152 @@ +import HMTokenABI from '@human-protocol/core/abis/HMToken.json'; +import { + ChainId, + NETWORKS, + StakerInfo, + StakingClient, +} from '@human-protocol/sdk'; +import { ethers } from 'ethers'; +import { useEffect, useState } from 'react'; +import { useAccount, useChainId, useWalletClient } from 'wagmi'; +import { useSnackbar } from '../providers/SnackProvider'; +import { parseErrorMessage } from '../utils/string'; +import { formatAmount } from '../utils/units'; + +export const useStake = () => { + const { address } = useAccount(); + const { data: walletClient } = useWalletClient(); + const chainId = useChainId(); + const { showError, openSnackbar } = useSnackbar(); + + const [stakingClient, setStakingClient] = useState( + null + ); + const [stakingData, setStakingData] = useState(null); + const [tokenBalance, setTokenBalance] = useState(0); + + useEffect(() => { + const initStakingClient = async () => { + try { + if (walletClient && address) { + const provider = new ethers.BrowserProvider(window.ethereum); + const signer = await provider.getSigner(); + + const client = await StakingClient.build(signer); + setStakingClient(client); + + await fetchStakingData(client); + await fetchTokenBalance(provider, address, chainId); + } + } catch (error) { + showError('Invalid network'); + } + }; + + initStakingClient(); + }, [walletClient, address, chainId]); + + const fetchStakingData = async (stakingClient: StakingClient) => { + try { + const stakingInfo = await stakingClient.getStakerInfo(address!); + setStakingData(stakingInfo); + } catch (error) { + showError('Error fetching staking data'); + } + }; + + const fetchTokenBalance = async ( + provider: ethers.BrowserProvider, + address: string, + chainId: number + ) => { + try { + const tokenAddress = NETWORKS[chainId as ChainId]?.hmtAddress; + if (!tokenAddress) { + showError('Token address not found for this network'); + return; + } + + const tokenContract = new ethers.Contract( + tokenAddress, + HMTokenABI, + provider + ); + const balance = await tokenContract.balanceOf(address); + + setTokenBalance(formatAmount(balance)); + } catch (error) { + showError('Error fetching token balance'); + } + }; + + const handleStake = async (amount: string) => { + try { + if (stakingClient && amount) { + const weiAmount = ethers.parseUnits(amount, 'ether'); + await stakingClient.approveStake(weiAmount); + await stakingClient.stake(weiAmount); + await fetchStakingData(stakingClient); + await fetchTokenBalance( + new ethers.BrowserProvider(window.ethereum), + address!, + chainId + ); + openSnackbar('Stake successful', 'success'); + } + } catch (error) { + showError(parseErrorMessage(error)); + } + }; + + const handleUnstake = async (amount: string) => { + try { + if (stakingClient && amount) { + const weiAmount = ethers.parseUnits(amount, 'ether'); + await stakingClient.unstake(weiAmount); + await fetchStakingData(stakingClient); + await fetchTokenBalance( + new ethers.BrowserProvider(window.ethereum), + address!, + chainId + ); + openSnackbar('Unstake successful', 'success'); + } + } catch (error) { + showError(parseErrorMessage(error)); + } + }; + + const handleWithdraw = async () => { + try { + if (stakingClient) { + await stakingClient.withdraw(); + await fetchStakingData(stakingClient); + await fetchTokenBalance( + new ethers.BrowserProvider(window.ethereum), + address!, + chainId + ); + openSnackbar('Withdraw successful', 'success'); + } + } catch (error) { + showError(parseErrorMessage(error)); + } + }; + + return { + tokenBalance, + stakedAmount: stakingData?.stakedAmount + ? formatAmount(stakingData?.stakedAmount) + : '0', + lockedAmount: stakingData?.lockedAmount + ? formatAmount(stakingData?.lockedAmount) + : '0', + lockedUntil: stakingData?.lockedUntil, + withdrawableAmount: stakingData?.withdrawableAmount + ? formatAmount(stakingData?.withdrawableAmount) + : '0', + handleStake, + handleUnstake, + handleWithdraw, + }; +}; diff --git a/packages/apps/staking/src/index.css b/packages/apps/staking/src/index.css new file mode 100644 index 0000000000..addebdf52a --- /dev/null +++ b/packages/apps/staking/src/index.css @@ -0,0 +1,4 @@ +a { + color: #320a8d; + text-decoration: none; +} diff --git a/packages/apps/staking/src/main.tsx b/packages/apps/staking/src/main.tsx new file mode 100644 index 0000000000..c0a50bc94f --- /dev/null +++ b/packages/apps/staking/src/main.tsx @@ -0,0 +1,33 @@ +import CssBaseline from '@mui/material/CssBaseline'; +import { ThemeProvider } from '@mui/material/styles'; +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import { BrowserRouter as Router } from 'react-router-dom'; +import App from './App'; +import SnackbarProvider from './providers/SnackProvider'; +import './index.css'; +import theme from './theme'; +import { WagmiProvider } from './providers/WagmiProvider'; +import { QueryClientProvider } from './providers/QueryClientProvider'; +import './assets/styles/main.scss'; +import 'simplebar-react/dist/simplebar.min.css'; +import { StakeProvider } from './contexts/stake'; + +ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( + + + + + + + + + + + + + + + + +); diff --git a/packages/apps/staking/src/pages/Dashboard/index.tsx b/packages/apps/staking/src/pages/Dashboard/index.tsx new file mode 100644 index 0000000000..792fa0bb2e --- /dev/null +++ b/packages/apps/staking/src/pages/Dashboard/index.tsx @@ -0,0 +1,70 @@ +import React, { useState } from 'react'; +import { Box, Grid, Container, Typography } from '@mui/material'; +import BalanceCard from '../../components/BalanceCard'; +import StakedAmountCard from '../../components/StakedAmountCard'; +import LockedAmountCard from '../../components/LockedAmountCard'; +import WithdrawableAmountCard from '../../components/WithdrawableAmountCard'; +import StakeModal from '../../components/modals/StakeModal'; +import UnstakeModal from '../../components/modals/UnstakeModal'; +import PageWrapper from '../../components/PageWrapper'; +import NetworkStatus from '../../components/NetworkStatus'; + +const Dashboard: React.FC = () => { + const [stakeModalOpen, setStakeModalOpen] = useState(false); + const [unstakeModalOpen, setUnstakeModalOpen] = useState(false); + + return ( + + + + + + Staking Overview + + + + + + + + + + + setStakeModalOpen(true)} + onUnstakeOpen={() => setUnstakeModalOpen(true)} + /> + + + + + + + + + + + + + + setStakeModalOpen(false)} + /> + setUnstakeModalOpen(false)} + /> + + ); +}; + +export default Dashboard; diff --git a/packages/apps/staking/src/pages/Home/index.tsx b/packages/apps/staking/src/pages/Home/index.tsx new file mode 100644 index 0000000000..e86f7f1278 --- /dev/null +++ b/packages/apps/staking/src/pages/Home/index.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import { Box, Grid, Typography } from '@mui/material'; +import bagImg from '../../assets/bag.png'; +import humanImg from '../../assets/human.png'; +import userImg from '../../assets/user.png'; +import { DefaultHeader } from '../../components/Headers/DefaultHeader'; +import { ConnectWallet } from '../../components/Wallet/ConnectWallet'; + +const Home: React.FC = () => { + return ( + + + + + + + + bag + user + human + + + HUMAN +
+ Staking Dashboard +
+ + Stake Tokens, Contribute to HUMAN Protocol. + +
+
+ + + +
+
+
+ ); +}; + +export default Home; diff --git a/packages/apps/staking/src/providers/QueryClientProvider.tsx b/packages/apps/staking/src/providers/QueryClientProvider.tsx new file mode 100644 index 0000000000..2619587d98 --- /dev/null +++ b/packages/apps/staking/src/providers/QueryClientProvider.tsx @@ -0,0 +1,30 @@ +import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister'; +import { QueryClient } from '@tanstack/react-query'; +import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client'; +import { FC, PropsWithChildren } from 'react'; +import { deserialize, serialize } from 'wagmi'; + +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + gcTime: 1_000 * 60 * 60 * 24, // 24 hours + }, + }, +}); + +const persister = createSyncStoragePersister({ + serialize, + storage: window.localStorage, + deserialize, +}); + +export const QueryClientProvider: FC = ({ children }) => { + return ( + + {children} + + ); +}; diff --git a/packages/apps/staking/src/providers/SnackProvider.tsx b/packages/apps/staking/src/providers/SnackProvider.tsx new file mode 100644 index 0000000000..785a4e9175 --- /dev/null +++ b/packages/apps/staking/src/providers/SnackProvider.tsx @@ -0,0 +1,66 @@ +import { Alert, Snackbar } from '@mui/material'; +import React, { createContext, useContext, useState, ReactNode } from 'react'; +import { parseErrorMessage } from '../utils/string'; + +interface SnackbarContextType { + openSnackbar: ( + message: string, + severity: 'success' | 'error' | 'warning' | 'info' + ) => void; + showError: (error: any) => void; +} + +export const SnackbarContext = createContext( + undefined +); + +const SnackbarProvider = ({ children }: { children: ReactNode }) => { + const [snackbarOpen, setSnackbarOpen] = useState(false); + const [snackbarMessage, setSnackbarMessage] = useState(''); + const [snackbarSeverity, setSnackbarSeverity] = useState< + 'success' | 'error' | 'warning' | 'info' + >('success'); + + const openSnackbar = ( + message: string, + severity: 'success' | 'error' | 'warning' | 'info' + ) => { + setSnackbarMessage(message); + setSnackbarSeverity(severity); + setSnackbarOpen(true); + }; + + const showError = (error: any) => { + openSnackbar(parseErrorMessage(error), 'error'); + }; + + const handleCloseSnackbar = () => { + setSnackbarOpen(false); + }; + + return ( + + {children} + + + {snackbarMessage} + + + + ); +}; + +export const useSnackbar = (): SnackbarContextType => { + const context = useContext(SnackbarContext); + if (!context) { + throw new Error('useSnackbar must be used within a SnackbarProvider'); + } + return context; +}; + +export default SnackbarProvider; diff --git a/packages/apps/staking/src/providers/WagmiProvider.tsx b/packages/apps/staking/src/providers/WagmiProvider.tsx new file mode 100644 index 0000000000..a0d72e5061 --- /dev/null +++ b/packages/apps/staking/src/providers/WagmiProvider.tsx @@ -0,0 +1,54 @@ +import { FC, PropsWithChildren } from 'react'; +import { createConfig, http, WagmiProvider as WWagmiProvider } from 'wagmi'; +import * as wagmiChains from 'wagmi/chains'; +import { coinbaseWallet, walletConnect } from 'wagmi/connectors'; + +import { LOCALHOST } from '../constants/chains'; + +const projectId = import.meta.env.VITE_APP_WALLETCONNECT_PROJECT_ID; + +export const wagmiConfig = createConfig({ + chains: [ + wagmiChains.mainnet, + wagmiChains.sepolia, + wagmiChains.bsc, + wagmiChains.bscTestnet, + wagmiChains.polygon, + wagmiChains.polygonAmoy, + wagmiChains.moonbeam, + wagmiChains.moonbaseAlpha, + wagmiChains.avalancheFuji, + wagmiChains.avalanche, + wagmiChains.xLayer, + wagmiChains.xLayerTestnet, + LOCALHOST, + ], + connectors: [ + walletConnect({ + showQrModal: true, + projectId: projectId ?? '', + }), + coinbaseWallet({ + appName: 'human-job-launcher', + }), + ], + transports: { + [wagmiChains.mainnet.id]: http(), + [wagmiChains.sepolia.id]: http(), + [wagmiChains.bsc.id]: http(), + [wagmiChains.bscTestnet.id]: http(), + [wagmiChains.polygon.id]: http(), + [wagmiChains.polygonAmoy.id]: http(), + [wagmiChains.moonbeam.id]: http(), + [wagmiChains.moonbaseAlpha.id]: http(), + [wagmiChains.avalanche.id]: http(), + [wagmiChains.avalancheFuji.id]: http(), + [wagmiChains.xLayer.id]: http(), + [wagmiChains.xLayerTestnet.id]: http(), + [LOCALHOST.id]: http(LOCALHOST.rpcUrls.default.http[0]), + }, +}); + +export const WagmiProvider: FC = ({ children }) => { + return {children}; +}; diff --git a/packages/apps/staking/src/services/job.ts b/packages/apps/staking/src/services/job.ts new file mode 100644 index 0000000000..7861141972 --- /dev/null +++ b/packages/apps/staking/src/services/job.ts @@ -0,0 +1,18 @@ +import { WalletClient } from 'viem'; + +import { HUMAN_SIGNATURE_KEY } from '../constants'; +import api from '../utils/api'; + +export const solveJob = async (signer: WalletClient, body: any) => { + if (!signer.account) { + throw new Error('Account not found'); + } + + const signature = await signer.signMessage({ + account: signer.account, + message: JSON.stringify(body), + }); + await api.post('/job/solve', body, { + headers: { [HUMAN_SIGNATURE_KEY]: signature }, + }); +}; diff --git a/packages/apps/staking/src/theme.ts b/packages/apps/staking/src/theme.ts new file mode 100644 index 0000000000..ae150fcc8e --- /dev/null +++ b/packages/apps/staking/src/theme.ts @@ -0,0 +1,159 @@ +import { createTheme } from '@mui/material/styles'; + +const theme = createTheme({ + palette: { + primary: { + main: '#320a8d', + light: '#320a8d', + dark: '#4a148c', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + secondary: { + main: '#858ec6', + light: '#6309ff', + dark: '#00867d', + contrastText: '#000', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + success: { + main: '#0E976E', + }, + warning: { + main: '#FF9800', + }, + error: { + main: '#F20D5F', + }, + }, + typography: { + fontFamily: 'Inter', + h2: { + fontSize: '80px', + lineHeight: 1.5, + letterSpacing: '-0.5px', + fontWeight: 800, + }, + h4: { + fontSize: '34px', + fontWeight: 600, + }, + h6: { + fontSize: '20px', + lineHeight: '160%', + }, + body1: { + fontSize: '16px', + lineHeight: '28px', + }, + body2: { + fontSize: '14px', + lineHeight: '24px', + }, + }, + components: { + MuiAlert: { + styleOverrides: { + outlinedSuccess: { + color: '#320a8d', + borderColor: '#320a8d', + }, + // icon: { + // color: '#320a8d !important', + // }, + }, + }, + MuiButton: { + styleOverrides: { + root: { + textTransform: 'none', + }, + sizeLarge: { + fontSize: '15px', + fontWeight: '600', + lineHeight: '24px', + padding: '12px 24px', + }, + }, + }, + MuiCard: { + styleOverrides: { + root: { + borderRadius: '16px', + background: '#fff', + boxShadow: + '0px 1px 5px 0px rgba(233, 235, 250, 0.20), 0px 2px 2px 0px rgba(233, 235, 250, 0.50), 0px 3px 1px -2px #E9EBFA', + }, + }, + }, + MuiCardContent: { + styleOverrides: { + root: { + padding: '32px 20px 18px !important', + }, + }, + }, + MuiLink: { + styleOverrides: { + root: { + textDecoration: 'none', + }, + }, + }, + MuiOutlinedInput: { + styleOverrides: { + root: { + '&.Mui-focused .MuiOutlinedInput-notchedOutline': { + borderWidth: '1px', + }, + }, + notchedOutline: { + borderColor: '#858ec6', + }, + }, + }, + MuiSelect: { + styleOverrides: { + icon: { + color: '#320a8d', + }, + }, + }, + MuiToggleButton: { + styleOverrides: { + root: { + textTransform: 'none', + borderRadius: '8px', + border: '1px solid #320a8d', + color: '#320a8d', + fontWeight: 600, + fontSize: '14px', + '&.Mui-selected': { + background: '#320a8d', + color: '#fff', + }, + '&.Mui-selected:hover': { + background: '#320a8d', + }, + }, + }, + }, + MuiMenuItem: { + styleOverrides: { + root: { + '&.Mui-selected': { + backgroundColor: '#f9faff', + }, + }, + }, + }, + }, +}); + +export default theme; diff --git a/packages/apps/staking/src/utils/api.ts b/packages/apps/staking/src/utils/api.ts new file mode 100644 index 0000000000..75febb176c --- /dev/null +++ b/packages/apps/staking/src/utils/api.ts @@ -0,0 +1,35 @@ +import axios from 'axios'; +import { CaseConverter } from './case-converter'; + +const axiosInstance = axios.create({ + baseURL: import.meta.env.VITE_APP_DASHBOARD_SERVER_URL, +}); + +axiosInstance.interceptors.request.use( + (config) => { + if (config.data) { + config.data = CaseConverter.transformToSnakeCase(config.data); + } + + if (config.params) { + config.params = CaseConverter.transformToSnakeCase(config.params); + } + + return config; + }, + (error) => Promise.reject(error) +); + +axiosInstance.interceptors.response.use( + (response) => { + if (response.data) { + response.data = CaseConverter.transformToCamelCase(response.data); + } + return response; + }, + (error) => { + return Promise.reject(error); + } +); + +export default axiosInstance; diff --git a/packages/apps/staking/src/utils/case-converter.ts b/packages/apps/staking/src/utils/case-converter.ts new file mode 100644 index 0000000000..37a195c1e8 --- /dev/null +++ b/packages/apps/staking/src/utils/case-converter.ts @@ -0,0 +1,37 @@ +export class CaseConverter { + static transformToCamelCase(obj: any): any { + if (Array.isArray(obj)) { + return obj.map((item) => CaseConverter.transformToCamelCase(item)); + } else if (typeof obj === 'object' && obj !== null) { + return Object.keys(obj).reduce( + (acc: Record, key: string) => { + const camelCaseKey = key.replace(/_([a-z])/g, (g) => + g[1].toUpperCase() + ); + acc[camelCaseKey] = CaseConverter.transformToCamelCase(obj[key]); + return acc; + }, + {} + ); + } else { + return obj; + } + } + + static transformToSnakeCase(obj: any): any { + if (Array.isArray(obj)) { + return obj.map((item) => CaseConverter.transformToSnakeCase(item)); + } else if (typeof obj === 'object' && obj !== null) { + return Object.keys(obj).reduce( + (acc: Record, key: string) => { + const snakeCaseKey = key.replace(/([A-Z])/g, '_$1').toLowerCase(); + acc[snakeCaseKey] = CaseConverter.transformToSnakeCase(obj[key]); + return acc; + }, + {} + ); + } else { + return obj; + } + } +} diff --git a/packages/apps/staking/src/utils/string.ts b/packages/apps/staking/src/utils/string.ts new file mode 100644 index 0000000000..319d9b45b5 --- /dev/null +++ b/packages/apps/staking/src/utils/string.ts @@ -0,0 +1,21 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const parseErrorMessage = (error: any) => { + if (typeof error === 'string') { + return error; + } + + if (error.response) { + return error.response?.data?.message ?? 'Something went wrong.'; + } + + if (error.message) { + const match = error.message.match(/Contract execution error: (.+)/); + if (match && match[1]) { + return match[1].trim(); + } + + return error.message; + } + + return 'Something went wrong.'; +}; diff --git a/packages/apps/staking/src/utils/units.ts b/packages/apps/staking/src/utils/units.ts new file mode 100644 index 0000000000..1ea0babdd9 --- /dev/null +++ b/packages/apps/staking/src/utils/units.ts @@ -0,0 +1,15 @@ +import { ethers } from 'ethers'; + +export const formatAmount = (amount?: bigint, decimals: number = 8) => { + if (!amount || amount === 0n) return 0; + + const formatted = ethers.formatEther(amount); + + const [integerPart, decimalPart = ''] = formatted.split('.'); + + const truncatedDecimal = decimalPart.substring(0, decimals); + + return parseFloat( + truncatedDecimal ? `${integerPart}.${truncatedDecimal}` : integerPart + ); +}; diff --git a/packages/apps/staking/src/vite-env.d.ts b/packages/apps/staking/src/vite-env.d.ts new file mode 100644 index 0000000000..11f02fe2a0 --- /dev/null +++ b/packages/apps/staking/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/apps/staking/tsconfig.json b/packages/apps/staking/tsconfig.json new file mode 100644 index 0000000000..a7cca86670 --- /dev/null +++ b/packages/apps/staking/tsconfig.json @@ -0,0 +1,36 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "target": "es2020", + "lib": [ + "dom", + "dom.iterable", + "esnext", + "es2015.promise" + ], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + "resolveJsonModule": true, + "downlevelIteration": true, + "baseUrl": ".", + "types": [ + "node", + "jest", + "@testing-library/jest-dom" + ] + }, + "include": [ + "src", + "tests" + ] +} \ No newline at end of file diff --git a/packages/apps/staking/vite.config.ts b/packages/apps/staking/vite.config.ts new file mode 100644 index 0000000000..aa0c7cfe2b --- /dev/null +++ b/packages/apps/staking/vite.config.ts @@ -0,0 +1,39 @@ +/// +/// + +import path from 'path'; +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; +import { nodePolyfills } from 'vite-plugin-node-polyfills'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + react({ fastRefresh: false }), + nodePolyfills({ + protocolImports: true, + }), + ], + css: { + preprocessorOptions: { + scss: { + implementation: require('sass'), + }, + }, + }, + resolve: { + alias: [{ find: 'src', replacement: path.resolve(__dirname, 'src') }], + }, + optimizeDeps: { + include: ['@human-protocol/sdk'], + force: true, + }, + build: { + commonjsOptions: { + include: [/core/, /human-protocol-sdk/, /node_modules/], + }, + }, + server: { + port: 3006, + }, +}); diff --git a/packages/sdk/python/human-protocol-sdk/example.py b/packages/sdk/python/human-protocol-sdk/example.py index 739bfd95e9..eef2a0fbeb 100644 --- a/packages/sdk/python/human-protocol-sdk/example.py +++ b/packages/sdk/python/human-protocol-sdk/example.py @@ -1,6 +1,4 @@ import datetime -import json -from unittest.mock import MagicMock from human_protocol_sdk.constants import ChainId, Status from human_protocol_sdk.escrow import EscrowUtils @@ -11,7 +9,6 @@ ) from human_protocol_sdk.operator import OperatorUtils, LeaderFilter from human_protocol_sdk.agreement import agreement -from human_protocol_sdk.transaction import TransactionUtils, TransactionFilter def get_escrow_statistics(statistics_client: StatisticsClient): @@ -114,11 +111,11 @@ def get_leaders(): print(OperatorUtils.get_leader(ChainId.POLYGON_AMOY, leaders[0].address)) print( OperatorUtils.get_leaders( - LeaderFilter(chain_id=ChainId.POLYGON_AMOY, role="Job Launcher") + LeaderFilter(chain_id=ChainId.POLYGON_AMOY, roles="Job Launcher") ) ) leaders = OperatorUtils.get_leaders( - LeaderFilter(chain_id=ChainId.POLYGON_AMOY, role="Job Launcher") + LeaderFilter(chain_id=ChainId.POLYGON_AMOY, roles="Job Launcher") ) print(len(leaders)) @@ -144,77 +141,20 @@ def agreement_example(): print(agreement_report) -def create_bulk_payout_transaction_example(): - from web3 import Web3 - from eth_typing import URI - from human_protocol_sdk.escrow import EscrowClient - from web3.middleware import construct_sign_and_send_raw_middleware - - rpc_url = "https://polygon-amoy.g.alchemy.com/v2/LAmhWAjFXhdNfnXo5wsh890nJEgE9DZu" - private_key = "0fa18d48fe17c5339faea61064b9d1b3fd17f7cf5a6b40cd249e3ce08c9705cb" - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(Web3.HTTPProvider(URI(rpc_url))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.add( - construct_sign_and_send_raw_middleware(gas_payer), - "construct_sign_and_send_raw_middleware", - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key(private_key) - escrow_client = EscrowClient(w3) - - # Parámetros de la transacción - escrow_address = ( - "0x5235EEb56471cB0A395776988b213C2832b22d62" # Dirección del escrow - ) - # Direcciones de los destinatarios - recipients = ["0x4163766Cde8410fDDabC4C75a0E2939c55116cC7"] - amounts = [100] # Cantidades para cada destinatario - final_results_url = "https://www.example.com/result" # URL de resultados finales - final_results_hash = "test" # Hash de los resultados finales - txId = 1 # ID de la transacción - - # Enviar la transacción - try: - transaction = escrow_client.create_bulk_payout_transaction( - escrow_address, - recipients, - amounts, - final_results_url, - final_results_hash, - txId, - ) - signed_transaction = w3.eth.account.sign_transaction(transaction, private_key) - tx_hash = w3.eth.send_raw_transaction(signed_transaction.raw_transaction) - - # Esperar a que se mine la transacción - tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) - print(f"Transaction sent with hash: {tx_hash.hex()}") - print(f"Transaction receipt: {tx_receipt}") - print(f"Transaction receipt: {tx_receipt['transactionHash'].hex()}") - - except Exception as e: - print("Error creating bulk payout transaction:", str(e)) - - if __name__ == "__main__": statistics_client = StatisticsClient() # Run single example while testing, and remove comments before commit - # get_escrows() - # get_leaders() + get_escrows() + get_leaders() - # statistics_client = StatisticsClient(ChainId.POLYGON_AMOY) - # get_hmt_holders(statistics_client) - # get_escrow_statistics(statistics_client) - # get_hmt_statistics(statistics_client) - # get_payment_statistics(statistics_client) - # get_worker_statistics(statistics_client) - # get_hmt_daily_data(statistics_client) + statistics_client = StatisticsClient(ChainId.POLYGON_AMOY) + get_hmt_holders(statistics_client) + get_escrow_statistics(statistics_client) + get_hmt_statistics(statistics_client) + get_payment_statistics(statistics_client) + get_worker_statistics(statistics_client) + get_hmt_daily_data(statistics_client) - # agreement_example() - create_bulk_payout_transaction_example() + agreement_example() diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/staking/staking_client.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/staking/staking_client.py index f80c61d699..bace587a0e 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/staking/staking_client.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/staking/staking_client.py @@ -397,6 +397,58 @@ def get_w3_with_priv_key(priv_key: str): tx_options, ) + def get_staker_info(self, staker_address: str) -> dict: + """Retrieves comprehensive staking information for a staker. + + :param staker_address: The address of the staker + :return: A dictionary containing staker information + + :validate: + - Staker address must be valid + + :example: + .. code-block:: python + + from eth_typing import URI + from web3 import Web3 + from web3.providers.auto import load_provider_from_uri + + from human_protocol_sdk.staking import StakingClient + + w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) + staking_client = StakingClient(w3) + + staking_info = staking_client.get_staker_info('0xYourStakerAddress') + print(staking_info['stakedAmount']) + """ + if not Web3.is_address(staker_address): + raise StakingClientError(f"Invalid staker address: {staker_address}") + + try: + staker_info = self.staking_contract.functions.stakes(staker_address).call() + current_block = self.w3.eth.block_number + + tokens_withdrawable = ( + staker_info[1] + if (staker_info[2] != 0 and current_block >= staker_info[2]) + else 0 + ) + + adjusted_locked_amount = ( + 0 + if (staker_info[2] != 0 and current_block >= staker_info[2]) + else staker_info[1] + ) + + return { + "stakedAmount": staker_info[0], + "lockedAmount": adjusted_locked_amount, + "lockedUntil": 0 if adjusted_locked_amount == 0 else staker_info[2], + "withdrawableAmount": tokens_withdrawable, + } + except Exception as e: + raise StakingClientError(f"Failed to get staker info: {str(e)}") + def _is_valid_escrow(self, escrow_address: str) -> bool: """Checks if the escrow address is valid. diff --git a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/staking/test_staking_client.py b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/staking/test_staking_client.py index 2dece9c08b..c88568ed00 100644 --- a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/staking/test_staking_client.py +++ b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/staking/test_staking_client.py @@ -321,6 +321,79 @@ def test_slash_with_tx_options(self): ) mock_function.assert_called_once_with(slasher, staker, escrow_address, 50) + def test_get_staker_info(self): + staker_address = "0x1234567890123456789012345678901234567890" + staker_info = [100, 50, 1234567890] + current_block = 1234567880 + + self.staking_client.staking_contract.functions.stakes = MagicMock( + return_value=MagicMock(call=MagicMock(return_value=staker_info)) + ) + + type(self.w3.eth).block_number = PropertyMock(return_value=current_block) + + result = self.staking_client.get_staker_info(staker_address) + + self.assertEqual( + result, + { + "stakedAmount": staker_info[0], + "lockedAmount": staker_info[1], + "lockedUntil": staker_info[2], + "withdrawableAmount": 0, + }, + ) + self.staking_client.staking_contract.functions.stakes.assert_called_once_with( + staker_address + ) + + def test_get_staker_info_with_locked_amount_0_and_withdrawable_tokens(self): + staker_address = "0x1234567890123456789012345678901234567890" + staker_info = [100, 50, 1234567890] + current_block = 1234567891 + + self.staking_client.staking_contract.functions.stakes = MagicMock( + return_value=MagicMock(call=MagicMock(return_value=staker_info)) + ) + + type(self.w3.eth).block_number = PropertyMock(return_value=current_block) + + result = self.staking_client.get_staker_info(staker_address) + + self.assertEqual( + result, + { + "stakedAmount": staker_info[0], + "lockedAmount": 0, + "lockedUntil": 0, + "withdrawableAmount": staker_info[1], + }, + ) + self.staking_client.staking_contract.functions.stakes.assert_called_once_with( + staker_address + ) + + def test_get_staker_info_invalid_address(self): + invalid_address = "invalid_address" + + with self.assertRaises(StakingClientError) as cm: + self.staking_client.get_staker_info(invalid_address) + self.assertEqual( + f"Invalid staker address: {invalid_address}", str(cm.exception) + ) + + def test_get_staker_info_fails(self): + staker_address = "0x1234567890123456789012345678901234567890" + self.staking_client.staking_contract.functions.stakes = MagicMock( + side_effect=Exception("Failed to get staker info") + ) + + with self.assertRaises(StakingClientError) as cm: + self.staking_client.get_staker_info(staker_address) + self.assertEqual( + "Failed to get staker info: Failed to get staker info", str(cm.exception) + ) + if __name__ == "__main__": unittest.main(exit=True) diff --git a/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts b/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts index 331dcf8a1b..428c42fd27 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts @@ -156,3 +156,10 @@ export interface IPagination { skip?: number; orderDirection?: OrderDirection; } + +export interface StakerInfo { + stakedAmount: bigint; + lockedAmount: bigint; + lockedUntil: bigint; + withdrawableAmount: bigint; +} diff --git a/packages/sdk/typescript/human-protocol-sdk/src/staking.ts b/packages/sdk/typescript/human-protocol-sdk/src/staking.ts index 4b4c306a47..215624c0e2 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/staking.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/staking.ts @@ -23,6 +23,7 @@ import { } from './error'; import { NetworkData } from './types'; import { throwError } from './utils'; +import { StakerInfo } from './interfaces'; /** * ## Introduction @@ -410,4 +411,57 @@ export class StakingClient extends BaseEthersClient { return throwError(e); } } + + /** + * Retrieves comprehensive staking information for a staker. + * + * @param {string} stakerAddress - The address of the staker. + * @returns {Promise} + * + * **Code example** + * + * ```ts + * import { StakingClient } from '@human-protocol/sdk'; + * + * const rpcUrl = 'YOUR_RPC_URL'; + * + * const provider = new providers.JsonRpcProvider(rpcUrl); + * const stakingClient = await StakingClient.build(provider); + * + * const stakingInfo = await stakingClient.getStakerInfo('0xYourStakerAddress'); + * console.log(stakingInfo.tokensStaked); + * ``` + */ + public async getStakerInfo(stakerAddress: string): Promise { + if (!ethers.isAddress(stakerAddress)) { + throw ErrorInvalidStakerAddressProvided; + } + + try { + const stakerInfo = await this.stakingContract.stakes(stakerAddress); + const currentBlock = await this.runner.provider!.getBlockNumber(); + + const tokensWithdrawable = + stakerInfo.tokensLockedUntil !== 0n && + currentBlock >= stakerInfo.tokensLockedUntil + ? stakerInfo.tokensLocked + : 0n; + + const adjustedLockedAmount = + stakerInfo.tokensLockedUntil !== 0n && + currentBlock >= stakerInfo.tokensLockedUntil + ? 0n + : stakerInfo.tokensLocked; + + return { + stakedAmount: stakerInfo.tokensStaked, + lockedAmount: adjustedLockedAmount, + lockedUntil: + adjustedLockedAmount === 0n ? 0n : stakerInfo.tokensLockedUntil, + withdrawableAmount: tokensWithdrawable, + }; + } catch (error) { + return throwError(error); + } + } } diff --git a/packages/sdk/typescript/human-protocol-sdk/test/staking.test.ts b/packages/sdk/typescript/human-protocol-sdk/test/staking.test.ts index 2b1be0e2df..33f346aa83 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/staking.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/staking.test.ts @@ -45,6 +45,7 @@ describe('StakingClient', () => { getStaker: vi.fn(), getListOfStakers: vi.fn(), getAddress: vi.fn().mockResolvedValue(ethers.ZeroAddress), + stakes: vi.fn(), }; mockEscrowFactoryContract = { @@ -472,4 +473,79 @@ describe('StakingClient', () => { expect(slashSpy).toHaveBeenCalledTimes(1); }); }); + + describe('getStakerInfo', () => { + const stakerAddress = ethers.ZeroAddress; + + test('should return staker info with locked amount and no withdrawable tokens', async () => { + const stakerInfo = { + tokensStaked: ethers.toBigInt(FAKE_AMOUNT), + tokensLocked: ethers.toBigInt(FAKE_AMOUNT), + tokensLockedUntil: 1234567890n, + }; + const blockNumber = 1234567880n; + + mockStakingContract.stakes.mockResolvedValueOnce(stakerInfo); + mockProvider.provider.getBlockNumber = vi + .fn() + .mockResolvedValue(blockNumber); + + const result = await stakingClient.getStakerInfo(stakerAddress); + + expect(result).toEqual({ + stakedAmount: stakerInfo.tokensStaked, + lockedAmount: stakerInfo.tokensLocked, + lockedUntil: stakerInfo.tokensLockedUntil, + withdrawableAmount: 0n, + }); + expect(mockStakingContract.stakes).toHaveBeenCalledWith(stakerAddress); + expect(mockStakingContract.stakes).toHaveBeenCalledTimes(1); + expect(mockProvider.provider.getBlockNumber).toHaveBeenCalledTimes(1); + }); + + test('should return staker info with locked amount 0 and withdrawable tokens', async () => { + const stakerInfo = { + tokensStaked: ethers.toBigInt(FAKE_AMOUNT), + tokensLocked: ethers.toBigInt(FAKE_AMOUNT), + tokensLockedUntil: 1234567890n, + }; + const blockNumber = 1234567891n; + + mockStakingContract.stakes.mockResolvedValueOnce(stakerInfo); + mockProvider.provider.getBlockNumber = vi + .fn() + .mockResolvedValue(blockNumber); + + const result = await stakingClient.getStakerInfo(stakerAddress); + + expect(result).toEqual({ + stakedAmount: stakerInfo.tokensStaked, + lockedAmount: 0n, + lockedUntil: 0n, + withdrawableAmount: stakerInfo.tokensLocked, + }); + expect(mockStakingContract.stakes).toHaveBeenCalledWith(stakerAddress); + expect(mockStakingContract.stakes).toHaveBeenCalledTimes(1); + expect(mockProvider.provider.getBlockNumber).toHaveBeenCalledTimes(1); + }); + + test('should throw an error if the staker address is invalid', async () => { + const invalidAddress = 'InvalidAddress'; + + await expect(stakingClient.getStakerInfo(invalidAddress)).rejects.toThrow( + ErrorInvalidStakerAddressProvided + ); + expect(mockStakingContract.stakes).toHaveBeenCalledTimes(0); + }); + + test('should throw an error if getStaker method fails', async () => { + mockStakingContract.stakes.mockRejectedValueOnce(new Error()); + + await expect( + stakingClient.getStakerInfo(stakerAddress) + ).rejects.toThrow(); + expect(mockStakingContract.stakes).toHaveBeenCalledWith(stakerAddress); + expect(mockStakingContract.stakes).toHaveBeenCalledTimes(1); + }); + }); }); diff --git a/yarn.lock b/yarn.lock index 3dd6e70f9e..e77a6b67f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3009,6 +3009,13 @@ dependencies: "@babel/runtime" "^7.26.0" +"@mui/icons-material@^6.3.1": + version "6.4.0" + resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-6.4.0.tgz#4e1b74578b6c4987c341c9739f5f40987c44ccd1" + integrity sha512-zF0Vqt8a+Zp2Oz8P+WvJflba6lLe3PhxIz1NNqn+n4A+wKLPbkeqY8ShmKjPyiCTg0RMbPrp993oUDl9xGsDlQ== + dependencies: + "@babel/runtime" "^7.26.0" + "@mui/lab@^5.0.0-alpha.141": version "5.0.0-alpha.174" resolved "https://registry.yarnpkg.com/@mui/lab/-/lab-5.0.0-alpha.174.tgz#ca31049b7140a6717392b3b990264628c89fcf99" @@ -17416,6 +17423,17 @@ sass@^1.78.0: optionalDependencies: "@parcel/watcher" "^2.4.1" +sass@^1.83.4: + version "1.83.4" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.83.4.tgz#5ccf60f43eb61eeec300b780b8dcb85f16eec6d1" + integrity sha512-B1bozCeNQiOgDcLd33e2Cs2U60wZwjUUXzh900ZyQF5qUasvMdDZYbQ566LJu7cqR+sAHlAfO6RMkaID5s6qpA== + dependencies: + chokidar "^4.0.0" + immutable "^5.0.2" + source-map-js ">=0.6.2 <2.0.0" + optionalDependencies: + "@parcel/watcher" "^2.4.1" + sax@>=0.6.0: version "1.4.1" resolved "https://registry.yarnpkg.com/sax/-/sax-1.4.1.tgz#44cc8988377f126304d3b3fc1010c733b929ef0f"