From c32cdacef237f4001b8fee58fdda1757bf642412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Thu, 22 May 2025 12:52:15 +0200 Subject: [PATCH 01/21] Refactor token validation to use PaymentCurrency enum and add support for USD decimal checks (#3362) --- .../src/common/validators/token-decimals.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/apps/job-launcher/server/src/common/validators/token-decimals.ts b/packages/apps/job-launcher/server/src/common/validators/token-decimals.ts index 44d1340c9f..94ed779493 100644 --- a/packages/apps/job-launcher/server/src/common/validators/token-decimals.ts +++ b/packages/apps/job-launcher/server/src/common/validators/token-decimals.ts @@ -7,7 +7,7 @@ import { } from 'class-validator'; import { TOKEN_ADDRESSES } from '../constants/tokens'; import { ChainId } from '@human-protocol/sdk'; -import { EscrowFundToken } from '../enums/job'; +import { PaymentCurrency } from '../enums/payment'; @ValidatorConstraint({ async: false }) export class IsValidTokenDecimalsConstraint @@ -17,12 +17,19 @@ export class IsValidTokenDecimalsConstraint const [tokenProperty] = args.constraints; const dto = args.object as Record; const chainId = dto.chainId as ChainId; - const token = dto[tokenProperty] as EscrowFundToken; + const token = dto[tokenProperty] as PaymentCurrency; if (!chainId || !token) { return false; } + // Check if the token is a fiat currency + if (token === PaymentCurrency.USD) { + if (typeof value !== 'number') return false; + const [, decimals] = value.toString().split('.'); + return !decimals || decimals.length <= 2; + } + const tokenInfo = TOKEN_ADDRESSES[chainId]?.[token]; if (!tokenInfo) { @@ -35,7 +42,7 @@ export class IsValidTokenDecimalsConstraint return false; } - const [_, decimals] = value.toString().split('.'); + const [, decimals] = value.toString().split('.'); return !decimals || decimals.length <= maxDecimals; } @@ -43,7 +50,12 @@ export class IsValidTokenDecimalsConstraint const [tokenProperty] = args.constraints; const dto = args.object as Record; const chainId = dto.chainId as ChainId; - const token = dto[tokenProperty] as EscrowFundToken; + const token = dto[tokenProperty] as PaymentCurrency; + + if (token === PaymentCurrency.USD) { + return `${args.property} must have at most 2 decimal places for USD payments.`; + } + const tokenInfo = TOKEN_ADDRESSES[chainId]?.[token]; const maxDecimals = tokenInfo?.decimals || 'unknown'; From 72b95f3be5747cd523acd157b0c51d6e17eef2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Thu, 22 May 2025 13:52:53 +0200 Subject: [PATCH 02/21] Refactor job creation to move webhook entity creation from fund to setup (#3363) --- .../server/src/modules/job/job.service.ts | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.ts index 8b3085f130..d34a6a07c5 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.ts @@ -376,6 +376,17 @@ export class JobService { jobEntity.status = JobStatus.LAUNCHED; await this.jobRepository.updateOne(jobEntity); + const oracleType = this.getOracleType(jobEntity.requestType); + const webhookEntity = new WebhookEntity(); + Object.assign(webhookEntity, { + escrowAddress: jobEntity.escrowAddress, + chainId: jobEntity.chainId, + eventType: EventType.ESCROW_CREATED, + oracleType: oracleType, + hasSignature: oracleType !== OracleType.HCAPTCHA ? true : false, + }); + await this.webhookRepository.createUnique(webhookEntity); + return jobEntity; } @@ -397,20 +408,7 @@ export class JobService { }); jobEntity.status = JobStatus.FUNDED; - await this.jobRepository.updateOne(jobEntity); - - const oracleType = this.getOracleType(jobEntity.requestType); - const webhookEntity = new WebhookEntity(); - Object.assign(webhookEntity, { - escrowAddress: jobEntity.escrowAddress, - chainId: jobEntity.chainId, - eventType: EventType.ESCROW_CREATED, - oracleType: oracleType, - hasSignature: oracleType !== OracleType.HCAPTCHA ? true : false, - }); - await this.webhookRepository.createUnique(webhookEntity); - - return jobEntity; + return this.jobRepository.updateOne(jobEntity); } public async requestToCancelJobById( From 004868230beec68e7d0f961d21cf1b1b31057c3e Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Tue, 27 May 2025 13:00:46 +0300 Subject: [PATCH 03/21] [HUMAN App] refactor: change KYC to IDV (#3368) --- .../components/governance-banner.tsx | 6 +-- .../hcaptcha-labeling.page.tsx | 4 +- ...ification.tsx => use-idv-notification.tsx} | 2 +- .../jobs-discovery/jobs-discovery.page.tsx | 6 +-- .../profile/components/buttons/index.ts | 2 +- .../components/buttons/start-idv-btn.tsx | 26 ++++++++++ .../components/buttons/start-kyc-btn.tsx | 26 ---------- .../identity-verification-control.tsx | 21 ++++++++ .../components/kyc-verification-control.tsx | 19 ------- .../profile/components/profile-actions.tsx | 4 +- .../components/wallet-connection-control.tsx | 8 +-- .../src/modules/worker/profile/hooks/index.ts | 2 +- ...-mutation.ts => use-start-idv-mutation.ts} | 6 +-- .../worker/profile/hooks/use-start-idv.ts | 50 +++++++++++++++++++ .../worker/profile/hooks/use-start-kyc.ts | 48 ------------------ .../hooks/use-worker-profile-status.tsx | 13 ++--- .../profile/services/profile.service.ts | 18 +++---- .../worker/profile/types/profile-types.ts | 7 ++- .../frontend/src/shared/i18n/en.json | 7 ++- 19 files changed, 137 insertions(+), 138 deletions(-) rename packages/apps/human-app/frontend/src/modules/worker/hooks/{use-kyc-notification.tsx => use-idv-notification.tsx} (91%) create mode 100644 packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx delete mode 100644 packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx create mode 100644 packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx delete mode 100644 packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx rename packages/apps/human-app/frontend/src/modules/worker/profile/hooks/{use-start-kyc-mutation.ts => use-start-idv-mutation.ts} (77%) create mode 100644 packages/apps/human-app/frontend/src/modules/worker/profile/hooks/use-start-idv.ts delete mode 100644 packages/apps/human-app/frontend/src/modules/worker/profile/hooks/use-start-kyc.ts diff --git a/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx b/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx index ecb939482f..19373ee981 100644 --- a/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx +++ b/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx @@ -5,13 +5,13 @@ import { useTranslation } from 'react-i18next'; import { env } from '@/shared/env'; import { useColorMode } from '@/shared/contexts/color-mode'; import { useIsMobile } from '@/shared/hooks/use-is-mobile'; -import { useWorkerKycStatus } from '@/modules/worker/profile/hooks'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { useActiveProposalQuery } from '../hooks/use-active-proposal-query'; export function GovernanceBanner() { const { t } = useTranslation(); const { data, isLoading, isError } = useActiveProposalQuery(); - const { kycApproved } = useWorkerKycStatus(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { colorPalette } = useColorMode(); const [timeRemaining, setTimeRemaining] = useState('00:00:00'); const isMobile = useIsMobile('lg'); @@ -43,7 +43,7 @@ export function GovernanceBanner() { }; }, [data?.deadline]); - if (!kycApproved || isLoading || isError || !data) { + if (!isVerificationCompleted || isLoading || isError || !data) { return null; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx index 66fce91d97..2e27f715db 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx @@ -11,6 +11,7 @@ import { Counter } from '@/shared/components/ui/counter'; import { getErrorMessageForError } from '@/shared/errors'; import { getTomorrowDate } from '@/shared/helpers/date'; import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { useHCaptchaLabelingNotifications } from '@/modules/worker/hooks/use-hcaptcha-labeling-notifications'; import { useColorMode } from '@/shared/contexts/color-mode'; import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; @@ -29,6 +30,7 @@ export function HcaptchaLabelingPage() { const { colorPalette, isDarkMode } = useColorMode(); const captchaRef = useRef(null); const { user } = useAuthenticatedUser(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { onSuccess, onError } = useHCaptchaLabelingNotifications(); const statsColor = isDarkMode ? onlyDarkModeColor.additionalTextColor @@ -79,7 +81,7 @@ export function HcaptchaLabelingPage() { solveHCaptchaMutation({ token }); }; - if (user.kyc_status !== 'approved') { + if (!isVerificationCompleted) { return ; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx similarity index 91% rename from packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx index 7abb883624..7f6663e162 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx @@ -5,7 +5,7 @@ import { import { getErrorMessageForError } from '@/shared/errors'; import type { ResponseError } from '@/shared/types/global.type'; -export function useKycErrorNotifications() { +export function useIdvErrorNotifications() { const { showNotification } = useNotification(); return (error: ResponseError) => { diff --git a/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx index b844b46d0b..4f5aefa0db 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx @@ -2,15 +2,15 @@ import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Grid'; import { Navigate } from 'react-router-dom'; import { useIsMobile } from '@/shared/hooks/use-is-mobile'; -import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { routerPaths } from '@/router/router-paths'; import { OraclesTableJobTypesSelect, OraclesTable } from './components'; export function JobsDiscoveryPage() { const isMobile = useIsMobile(); - const { user } = useAuthenticatedUser(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); - if (user.kyc_status !== 'approved') { + if (!isVerificationCompleted) { return ; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts index ebfc0e1758..bc7560332f 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts @@ -1,2 +1,2 @@ -export * from './start-kyc-btn'; +export * from './start-idv-btn'; export * from './register-address-btn'; diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx new file mode 100644 index 0000000000..68f5ad06e9 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx @@ -0,0 +1,26 @@ +import { t } from 'i18next'; +import { Button } from '@/shared/components/ui/button'; +import { useStartIdv } from '../../hooks'; + +export function StartIdvBtn() { + const { isIdvAlreadyInProgress, idvStartIsPending, startIdv } = useStartIdv(); + + if (isIdvAlreadyInProgress) { + return ( + + ); + } + + return ( + + ); +} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx deleted file mode 100644 index 88c5363ecc..0000000000 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { t } from 'i18next'; -import { Button } from '@/shared/components/ui/button'; -import { useStartKyc } from '../../hooks'; - -export function StartKycBtn() { - const { isKYCInProgress, kycStartIsPending, startKYC } = useStartKyc(); - - if (isKYCInProgress) { - return ( - - ); - } - - return ( - - ); -} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx new file mode 100644 index 0000000000..2b8b801cb6 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx @@ -0,0 +1,21 @@ +import { useTranslation } from 'react-i18next'; +import { useWorkerIdentityVerificationStatus } from '../hooks'; +import { StartIdvBtn } from './buttons'; +import { DoneLabel, ErrorLabel } from './status-labels'; + +export function IdentityVerificationControl() { + const { t } = useTranslation(); + const { status } = useWorkerIdentityVerificationStatus(); + + if (status === 'approved') { + return ( + {t('worker.profile.identityVerificationStatus')} + ); + } else if (status === 'declined') { + return ( + {t('worker.profile.identityVerificationStatus')} + ); + } + + return ; +} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx deleted file mode 100644 index 21f661e3be..0000000000 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useTranslation } from 'react-i18next'; -import { useWorkerKycStatus } from '../hooks'; -import { StartKycBtn } from './buttons'; -import { DoneLabel, ErrorLabel } from './status-labels'; - -export function KycVerificationControl() { - const { t } = useTranslation(); - const { kycApproved, kycDeclined, kycToComplete } = useWorkerKycStatus(); - - return ( - <> - {kycApproved && {t('worker.profile.kycCompleted')}} - {kycDeclined && ( - {t('worker.profile.kycDeclined')} - )} - {kycToComplete && } - - ); -} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx index 9b37cf4107..56551421f6 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx @@ -1,12 +1,12 @@ import Grid from '@mui/material/Grid'; -import { KycVerificationControl } from './kyc-verification-control'; +import { IdentityVerificationControl } from './identity-verification-control'; import { WalletConnectionControl } from './wallet-connection-control'; export function ProfileActions() { return ( - + diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx index 5159b94eba..d0268f7d7d 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx @@ -3,7 +3,7 @@ import { Grid } from '@mui/material'; import { Button } from '@/shared/components/ui/button'; import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; import { useWalletConnect } from '@/shared/contexts/wallet-connect'; -import { useWorkerKycStatus } from '../hooks'; +import { useWorkerIdentityVerificationStatus } from '../hooks'; import { DoneLabel } from './status-labels'; import { WalletConnectDone } from './wallet-connect-done'; import { RegisterAddressBtn } from './buttons'; @@ -11,7 +11,7 @@ import { RegisterAddressBtn } from './buttons'; export function WalletConnectionControl() { const { t } = useTranslation(); const { user } = useAuthenticatedUser(); - const { kycApproved } = useWorkerKycStatus(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { isConnected, openModal } = useWalletConnect(); const { wallet_address: walletAddress } = user; @@ -25,7 +25,7 @@ export function WalletConnectionControl() { ); } - if (kycApproved && isConnected) { + if (isVerificationCompleted && isConnected) { return ( @@ -36,7 +36,7 @@ export function WalletConnectionControl() { return ( - - + GitBook + Faucet + + HUMAN Website + + + + - toggleDrawer(true)} - > - - + toggleDrawer(true)} + > + + - toggleDrawer(false)} - PaperProps={{ - sx: { - width: '80%', - }, - }} - > - - - toggleDrawer(false)} /> - + toggleDrawer(false)} + PaperProps={{ + sx: { + width: '80%', + }, + }} + > + + + toggleDrawer(false)} /> + -
-
- handleClick(env.VITE_NAVBAR_LINK_GITBOOK)} - > - GitBook - -
-
- handleClick(env.VITE_NAVBAR_LINK_FAUCETS)} + + GitBook + Faucet + + HUMAN Website + +
-
- handleClick(env.VITE_NAVBAR_LINK_HUMAN_WEBSITE)} + Launch Jobs + +
- - -
-
-
- + Work & Earn + +
+ +
+ + ); }; diff --git a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx index 0b2327b214..18c3af1b8f 100644 --- a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx +++ b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx @@ -1,3 +1,5 @@ +import { Fragment } from 'react'; + import { AreaChart, Area, @@ -8,15 +10,16 @@ import { ResponsiveContainer, TooltipProps, } from 'recharts'; -import Card from '@mui/material/Card'; -import { colorPalette } from '@assets/styles/color-palette'; import Box from '@mui/material/Box'; -import { Typography } from '@mui/material'; +import Card from '@mui/material/Card'; import Stack from '@mui/material/Stack'; import ToggleButtons from '@components/DataEntry/ToggleButtons'; -import { Fragment } from 'react'; +import Typography from '@mui/material/Typography'; + +import { colorPalette } from '@assets/styles/color-palette'; import { formatDate } from '@helpers/formatDate'; import { formatNumber } from '@helpers/formatNumber'; +import { useIsMobile } from '@utils/hooks/use-breakpoints'; const CustomSmallChartTooltip = ({ payload, @@ -25,22 +28,19 @@ const CustomSmallChartTooltip = ({ if (active) { return ( - + {payload?.map((elem) => ( - + {formatDate(elem.payload.date, 'MMMM DD, YYYY')} - + {elem.value ? elem.value.toLocaleString('en-US') : ''} @@ -60,10 +60,31 @@ interface SmallGraphProps { title: string; } +const GraphSettings = ({ title }: { title: string }) => ( + + + {title} + + + +); + const SmallGraph = ({ title, graphData }: SmallGraphProps) => { + const isMobile = useIsMobile(); + return ( <> - + {!isMobile && } + { > - - + + { stroke={colorPalette.fog.main} tickFormatter={formatNumber} /> - + } /> - - - {title} - - - + {isMobile && } ); }; diff --git a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx b/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx index aee9c6aef8..39162a97e4 100644 --- a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx +++ b/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx @@ -1,17 +1,21 @@ import { FC } from 'react'; + import Link from '@mui/material/Link'; +import Typography from '@mui/material/Typography'; const NothingFound: FC = () => { return ( <> -
Nothing found :(
-
+ Nothing found :( + We couldn't find anything within this criteria.
- Please search by wallet address or escrow address. -
- -
Back Home
+ Please search by wallet address or escrow address. + + + + Back Home + ); diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts index 228cd04a4c..20a24ae2c5 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts +++ b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts @@ -22,10 +22,7 @@ export const gridSx = { overflow: 'hidden', }; -export const muiSelectSx = (mobile: { - isMobile: boolean; - mediaQuery: string; -}) => ({ +export const muiSelectSx = () => ({ backgroundColor: `${colorPalette.white}`, width: 'unset', fontSize: '16px', @@ -41,9 +38,6 @@ export const muiSelectSx = (mobile: { backgroundColor: `${colorPalette.white}`, border: 0, }, - [mobile.mediaQuery]: { - width: 'unset', - }, }); export const menuItemSx = (isSelected: boolean) => ({ @@ -66,16 +60,11 @@ export const muiTextFieldInputPropsSx = (borderColor: string) => ({ padding: '0 5px', }); -export const muiTextFieldSx = (mobile: { - isMobile: boolean; - mediaQuery: string; -}) => ({ +export const muiTextFieldSx = (isMobile: boolean) => ({ fontSize: '16px', '& .MuiOutlinedInput-root': { '& input': { - [mobile.mediaQuery]: { - padding: '12px 0px', - }, + padding: isMobile ? '12px 0px' : '16px 0px', }, '& fieldset': { border: 'none', diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx index 60b49386ca..b57d3b7b28 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx +++ b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx @@ -17,7 +17,7 @@ import { } from '@mui/material'; import { colorPalette } from '@assets/styles/color-palette'; import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; +import { useIsMobile } from '@utils/hooks/use-breakpoints'; import { NetworkIcon } from '@components/NetworkIcon'; import { useWalletSearch } from '@utils/hooks/use-wallet-search'; import { @@ -40,7 +40,7 @@ const SearchBar: FC = ({ className = '', initialInputValue = '', }) => { - const { mobile } = useBreakPoints(); + const isMobile = useIsMobile(); const { filteredNetworks, isLoading } = useFilteredNetworks(); const { filterParams, setChainId, setAddress } = useWalletSearch(); const navigate = useNavigate(); @@ -102,7 +102,9 @@ const SearchBar: FC = ({ if (isLoading) return ; const renderEmptyValue = ( - Network + + Network + ); const renderSelectedValue = ( @@ -113,7 +115,7 @@ const SearchBar: FC = ({ } />
- {mobile.isMobile || filterParams.chainId === -1 + {isMobile || filterParams.chainId === -1 ? null : filteredNetworks.find((n) => n.id === filterParams.chainId)?.name || ''} @@ -133,7 +135,7 @@ const SearchBar: FC = ({ error={!!error} helperText={error} fullWidth - sx={muiTextFieldSx(mobile)} + sx={muiTextFieldSx(isMobile)} InputProps={{ sx: muiTextFieldInputPropsSx( focus ? colorPalette.secondary.main : colorPalette.skyOpacity @@ -146,7 +148,7 @@ const SearchBar: FC = ({ value={filterParams.chainId} displayEmpty - sx={muiSelectSx(mobile)} + sx={muiSelectSx()} onChange={handleSelectChange} renderValue={() => filterParams.chainId === -1 @@ -173,9 +175,9 @@ const SearchBar: FC = ({ @@ -186,13 +188,11 @@ const SearchBar: FC = ({ type="submit" aria-label="search" sx={{ - [mobile.mediaQuery]: { - padding: '4px', - }, + p: 0.5, }} > { underline="none" sx={{ zIndex: 1, + color: 'text.primary', + '&:visited': { + color: 'text.primary', + }, }} > {abbreviateValue(value)} diff --git a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx b/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx index 8a91684560..dd8bbf8d8e 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx +++ b/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx @@ -1,56 +1,50 @@ +import { FC, PropsWithChildren } from 'react'; + import Stack from '@mui/material/Stack'; -import IconButton from '@mui/material/IconButton'; +import Box from '@mui/material/Box'; import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; import Typography from '@mui/material/Typography'; -import { colorPalette } from '@assets/styles/color-palette'; +import { SxProps } from '@mui/material'; + import CustomTooltip from '@components/CustomTooltip'; -const TitleSectionWrapper = ({ +type Props = { + title: string; + tooltip?: string; + sx?: SxProps; +}; + +const TitleSectionWrapper: FC> = ({ title, - children, tooltip, -}: { - title: string; - children: React.ReactNode; - tooltip?: { - description: string; - }; + sx, + children, }) => { return ( {tooltip ? ( - - - - - + + + {title} ) : ( - + {title} )} - {children} + + {children} + ); }; diff --git a/packages/apps/dashboard/client/src/components/SectionWrapper/index.tsx b/packages/apps/dashboard/client/src/components/SectionWrapper/index.tsx new file mode 100644 index 0000000000..df126af5fe --- /dev/null +++ b/packages/apps/dashboard/client/src/components/SectionWrapper/index.tsx @@ -0,0 +1,23 @@ +import { FC, PropsWithChildren } from 'react'; + +import Card from '@mui/material/Card'; + +const SectionWrapper: FC = ({ children }) => { + return ( + + {children} + + ); +}; + +export default SectionWrapper; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx index e1699a869a..bfaa2633be 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx @@ -8,7 +8,7 @@ export const AddressCell = ({ chainId: string; address: string; }) => ( - + value?.length ? ( - + + + ) : null; const getCategoryLabel = (category: string) => { diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx index 32b40e4831..e341f5b7ba 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx @@ -5,7 +5,7 @@ import { getNetwork } from '@utils/config/networks'; export const ChainCell = ({ chainId }: { chainId: number }) => ( { - const apiRef = useGridApiRef(); - const { columns, visibleRows } = useDataGrid(data); - const { customizedColumns, handleSortModelChange, pinnedColSx } = - useDatagridOptions<(typeof visibleRows)[number]>({ - apiRef, - columns, - isRowIdx: true, - pinnedColumnName: 'role', - }); - const { - mobile: { isMobile }, - } = useBreakPoints(); + const { columns, rows } = useDataGrid(data); + const isMobile = useIsMobile(); - const tableIsEmpty = status === 'success' && visibleRows.length === 0; + const tableIsEmpty = status === 'success' && rows.length === 0; const tableMinHeight = status === 'success' && !tableIsEmpty ? 'unset' : 300; return ( ({ + top: 4, + bottom: 0, + })} loading={status === 'pending'} - rows={visibleRows} - columns={customizedColumns} - autosizeOptions={{ - expand: true, - }} - onSortModelChange={handleSortModelChange} slots={{ noRowsOverlay() { if (status === 'error') { @@ -72,38 +66,30 @@ export const DataGridWrapper = ({ return ; }, }} - rowHeight={125} - columnHeaderHeight={72} sx={{ position: 'relative', border: 0, - marginBottom: '16px', + mb: 2, '& .MuiDataGrid-cell': { borderTop: 'none', - padding: '0 8px', + p: 2, overflow: 'visible !important', }, - '& .MuiDataGrid-row': { - borderTop: isMobile ? '15px solid rgb(255, 255, 255)' : '', - }, '& .MuiDataGrid-row:hover': { background: 'rgba(20, 6, 178, 0.04)', }, - '& .MuiDataGrid-cell:focus': { - outline: 'none', - }, - '& .MuiDataGrid-cell:focus-within': { + '& .MuiDataGrid-cell:focus, & .MuiDataGrid-cell:focus-within': { outline: 'none', }, '& .MuiDataGrid-columnSeparator--sideRight': { display: 'none', }, '& .MuiDataGrid-columnHeader': { - padding: '0 16px', + fontSize: '12px', + p: 2, overflow: 'visible !important', - }, - '& .MuiDataGrid-columnHeader:hover': { - color: 'rgb(133, 142, 198)', + textTransform: 'uppercase', + bgcolor: colorPalette.whiteSolid, }, '& .MuiDataGrid-row--borderBottom .MuiDataGrid-withBorderColor': { borderColor: 'transparent', @@ -116,6 +102,7 @@ export const DataGridWrapper = ({ }, '& .MuiDataGrid-columnHeaderTitleContainer': { overflow: 'unset', + whiteSpace: 'normal', }, '& .MuiDataGrid-columnHeader:focus': { outline: 'none', @@ -123,12 +110,10 @@ export const DataGridWrapper = ({ '& .MuiDataGrid-virtualScroller': { position: 'relative', }, - '& .MuiDataGrid-filler': { + '& .MuiDataGrid-filler, & .MuiDataGrid-cellEmpty': { display: 'none', }, - ...pinnedColSx, }} - getRowClassName={() => 'home-page-table-row'} /> ); diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/ReputationLabel.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/ReputationLabel.tsx deleted file mode 100644 index 7ace7dc2af..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/ReputationLabel.tsx +++ /dev/null @@ -1,36 +0,0 @@ -export const ReputationLabel: React.FC<{ reputation: string }> = ({ - reputation, -}) => { - switch (reputation) { - case 'High': - return ( -
- {reputation} -
- ); - case 'Medium': - return ( -
- {reputation} -
- ); - case 'Low': - return ( -
- {reputation} -
- ); - case 'Coming soon': - return ( -
- {reputation} -
- ); - default: - return ( -
- Coming soon -
- ); - } -}; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx index 56a154a708..3fb3e6b34f 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx @@ -1,6 +1,6 @@ import { Box, Typography } from '@mui/material'; import { Launch as LaunchIcon } from '@mui/icons-material'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; +import { useIsMobile } from '@utils/hooks/use-breakpoints'; import { Link } from 'react-router-dom'; import { EntityIcon } from './EntityIcon'; import { CaseConverter } from '@utils/case-converter'; @@ -30,46 +30,37 @@ const Wrapper = ({ }; export const RoleCell = ({ + rank, role, websiteUrl, name, }: { + rank: number; role: string; websiteUrl?: string; name?: string; }) => { - const { - mobile: { isMobile }, - } = useBreakPoints(); + const isMobile = useIsMobile(); const humanReadableRole = CaseConverter.convertSnakeToHumanReadable(role); + const formattedName = name ? name.split(' ')[0] : null; + return ( - - {!isMobile && } + + + {rank} + + - - {name ?? humanReadableRole} + + {formattedName ?? humanReadableRole} {websiteUrl ? : null} {name && role ? ( - + {humanReadableRole} ) : null} diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx index dfc9488530..8ce48e5d04 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx @@ -5,7 +5,7 @@ import MenuItem from '@mui/material/MenuItem'; import Box from '@mui/material/Box'; 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 { useIsMobile } from '@utils/hooks/use-breakpoints'; import { NetworkIcon } from '@components/NetworkIcon'; import CircularProgress from '@mui/material/CircularProgress'; import { useEffect } from 'react'; @@ -24,9 +24,7 @@ export const SelectNetwork = () => { } }, [chainId, filteredNetworks, setChainId]); - const { - mobile: { isMobile }, - } = useBreakPoints(); + const isMobile = useIsMobile(); const handleChange = (event: SelectChangeEvent) => { const value = Number(event.target.value); @@ -59,6 +57,11 @@ export const SelectNetwork = () => { value={chainId === -1 ? '' : chainId} label="By Network" onChange={handleChange} + sx={{ + '& #network-select svg': { + display: 'none', + }, + }} > {filteredNetworks.map((network) => ( { +import { LeaderBoardData } from '@services/api/use-leaderboard-details'; +import { useIsMobile } from '@utils/hooks/use-breakpoints'; +import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; + +// eslint-disable-next-line react-refresh/only-export-components +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +const useDataGrid = (data: LeaderBoardData) => { const { filterParams: { chainId }, } = useLeaderboardSearch(); - const { - mobile: { isMobile }, - } = useBreakPoints(); + const isMobile = useIsMobile(); + const formattedData = useMemo(() => { return data.map((row, idx) => { return { @@ -33,7 +44,7 @@ export const useDataGrid = (data: LeaderBoardData) => { }); }, [data]); - const visibleRows = useMemo(() => { + const rows = useMemo(() => { if (chainId !== -1) { return formattedData.filter((elem) => elem.chainId === chainId); } @@ -41,24 +52,17 @@ export const useDataGrid = (data: LeaderBoardData) => { return formattedData; }, [formattedData, chainId]); - const columns: GridColDef<(typeof visibleRows)[number]>[] = useMemo( + const columns: GridColDef[] = useMemo( () => [ { field: 'role', + flex: 1.5, + minWidth: isMobile ? 250 : 340, sortable: false, - flex: isMobile ? 0.8 : 1.5, - minWidth: isMobile ? 100 : 360, - headerClassName: isMobile - ? 'home-page-table-header pinned-column--header' - : 'home-page-table-header', - cellClassName: isMobile ? 'pinned-column--cell' : '', - renderHeader: () => ( - - Role - - ), + renderHeader: () => Role, renderCell: (params: GridRenderCellParams) => ( { field: 'address', sortable: false, flex: 1, - minWidth: 150, - headerClassName: 'home-page-table-header', + minWidth: isMobile ? 180 : 260, renderHeader: () => ( - - - - - - Address - + + + Address ), renderCell: (params: GridRenderCellParams) => ( @@ -91,21 +86,13 @@ export const useDataGrid = (data: LeaderBoardData) => { }, { field: 'amountStaked', + sortable: false, flex: 1, - minWidth: 130, - headerClassName: 'home-page-table-header', + minWidth: isMobile ? 130 : 260, renderHeader: () => ( - - - - - - Stake - + + + Stake ), valueFormatter: (value: string) => { @@ -119,16 +106,12 @@ export const useDataGrid = (data: LeaderBoardData) => { field: 'chainId', headerName: 'Network', flex: isMobile ? 1 : 1.5, - sortable: false, - minWidth: isMobile ? 150 : 245, - headerClassName: 'home-page-table-header', + minWidth: isMobile ? 130 : 245, renderHeader: () => { return ( <> {isMobile ? ( - - Network - + Network ) : ( )} @@ -141,25 +124,21 @@ export const useDataGrid = (data: LeaderBoardData) => { }, { field: 'category', - minWidth: 200, + sortable: false, + minWidth: isMobile ? 180 : 260, headerName: 'Category', - headerClassName: 'home-page-table-header', - renderHeader: () => ( - - Category - - ), + renderHeader: () => Category, renderCell: (params: GridRenderCellParams) => ( ), }, { field: 'fee', - minWidth: 150, + sortable: false, + minWidth: isMobile ? 100 : 130, headerName: 'Operator Fee', - headerClassName: 'home-page-table-header', renderHeader: () => ( - + Operator Fee ), @@ -180,6 +159,8 @@ export const useDataGrid = (data: LeaderBoardData) => { return { columns, - visibleRows, + rows, }; }; + +export default useDataGrid; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDatagridOptions.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDatagridOptions.tsx deleted file mode 100644 index 94386e4bdb..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDatagridOptions.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import { Typography } from '@mui/material'; -import { - GridColDef, - GridRenderCellParams, - GridSortModel, - GridCallbackDetails, - GridValidRowModel, -} from '@mui/x-data-grid'; -import { GridApiCommunity } from '@mui/x-data-grid/models/api/gridApiCommunity'; -import { useMemo, useCallback, MutableRefObject } from 'react'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; - -interface IColPossibleOptions { - isRowIdx?: boolean; - pinnedColumnName?: string; -} - -interface IProps extends IColPossibleOptions { - columns: GridColDef[]; - apiRef: MutableRefObject; -} - -export function useDatagridOptions({ - apiRef, - columns, - isRowIdx, - pinnedColumnName, -}: IProps) { - const { - mobile: { isMobile }, - } = useBreakPoints(); - - const handlePinnedColOption = useCallback( - (cols: GridColDef[]) => - cols.map((col) => - col.field === pinnedColumnName - ? { - ...col, - headerClassName: isMobile - ? 'home-page-table-header pinned-column--header' - : 'home-page-table-header', - cellClassName: isMobile ? 'pinned-column--cell' : '', - } - : col - ), - [isMobile, pinnedColumnName] - ); - - const handleRowOrderNum = useCallback( - (cols: GridColDef[]) => { - return isMobile - ? cols - : [ - { - field: 'rowIndex', - headerName: '', - width: 30, - headerClassName: 'home-page-table-header', - sortable: false, - renderCell: (params: GridRenderCellParams) => { - return ( - - {params.value + 1} - - ); - }, - }, - ...cols, - ]; - }, - [isMobile] - ); - - const handleColumnOptions = useCallback( - (cols: GridColDef[]) => { - let colsWithOptions = cols; - if (isRowIdx) { - colsWithOptions = handleRowOrderNum(colsWithOptions); - } - if (pinnedColumnName) { - colsWithOptions = handlePinnedColOption(colsWithOptions); - } - - return colsWithOptions; - }, - [handlePinnedColOption, handleRowOrderNum, isRowIdx, pinnedColumnName] - ); - - const handleSortModelChange = useCallback( - (_model: GridSortModel, details: GridCallbackDetails) => { - apiRef.current.applySorting(); - const sortedRows = details.api.getSortedRows(); - sortedRows.forEach((row, index) => { - apiRef.current.updateRows([{ ...row, rowIndex: index }]); - }); - }, - [apiRef] - ); - - const pinnedColSx = { - '& .pinned-column--header': { - position: 'sticky', - left: 0, - zIndex: 1000, - transform: 'translateZ(0)', - }, - '& .pinned-column--cell': { - position: 'sticky', - left: 0, - zIndex: 1000, - background: '#fff', - transform: 'translateZ(0)', - borderRight: isMobile ? '1px solid rgb(224, 224, 224)' : '', - }, - }; - - const customizedColumns: GridColDef[] = useMemo( - () => handleColumnOptions(columns), - [columns, handleColumnOptions] - ); - - return { - customizedColumns, - handleSortModelChange, - pinnedColSx, - }; -} diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx index 40b5a20ea5..c401e08ebc 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx @@ -1,49 +1,53 @@ -import { colorPalette } from '@assets/styles/color-palette'; -import Paper from '@mui/material/Paper'; -import TableContainer from '@mui/material/TableContainer'; -import { LeaderBoardData } from '@services/api/use-leaderboard-details'; +import { FC } from 'react'; + +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; -import SimpleBar from 'simplebar-react'; + import { SelectNetwork } from './components/SelectNetwork'; import { DataGridWrapper } from './components/DataGridWrapper'; -import { Button, Typography } from '@mui/material'; +import { LeaderBoardData } from '@services/api/use-leaderboard-details'; +import { colorPalette } from '@assets/styles/color-palette'; -export type LeaderboardCommonProps = { +type Props = { data: LeaderBoardData | undefined; status: 'success' | 'error' | 'pending'; error: unknown; + viewAllBanner?: boolean; }; -export const Leaderboard = ({ +export const Leaderboard: FC = ({ data, status, error, viewAllBanner, -}: LeaderboardCommonProps & { - viewAllBanner?: boolean; }) => { const navigate = useNavigate(); return ( - -
+ -
- - - +
+ {viewAllBanner ? ( ) : null} - +
); }; diff --git a/packages/apps/dashboard/client/src/index.css b/packages/apps/dashboard/client/src/index.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/apps/dashboard/client/src/main.tsx b/packages/apps/dashboard/client/src/main.tsx index 6d62a8b395..6ede097359 100644 --- a/packages/apps/dashboard/client/src/main.tsx +++ b/packages/apps/dashboard/client/src/main.tsx @@ -11,7 +11,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; const queryClient = new QueryClient({ defaultOptions: { mutations: { retry: 0 }, - queries: { retry: 0 }, + queries: { retry: 0, refetchOnWindowFocus: false }, }, }); diff --git a/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx b/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx index 20b9474c58..0d7236c038 100644 --- a/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx @@ -1,18 +1,21 @@ -import { useHMTPrice } from '../../services/api/use-hmt-price'; +import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -export function HMTPrice() { - const { data, status } = useHMTPrice(); +import { useHMTPrice } from '../../services/api/use-hmt-price'; + +const HMTPrice = () => { + const { data, isError, isPending, isSuccess } = useHMTPrice(); + return ( -
- - HMT Price + + HMT Price + + {isSuccess && `$${data}`} + {isPending && '...'} + {isError && 'No data'} -
- {status === 'success' && `$${data.hmtPrice}`} - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
+
); -} +}; + +export default HMTPrice; diff --git a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx b/packages/apps/dashboard/client/src/pages/Home/Holders.tsx index d72698569e..d25feb93b3 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/Holders.tsx @@ -1,20 +1,22 @@ -import { FormatNumber } from '@components/Home/FormatNumber'; +import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; + +import { FormatNumber } from '@components/Home/FormatNumber'; import { useGeneralStats } from '@services/api/use-general-stats'; -export function Holders() { - const { data, status } = useGeneralStats(); +const Holders = () => { + const { data, isSuccess, isPending, isError } = useGeneralStats(); return ( -
- - Holders + + Holders + + {isSuccess && } + {isPending && '...'} + {isError && 'No data'} -
- {status === 'success' && } - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
+
); -} +}; + +export default Holders; diff --git a/packages/apps/dashboard/client/src/pages/Home/Home.tsx b/packages/apps/dashboard/client/src/pages/Home/Home.tsx index 8082578b9f..73e16c028a 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Home.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/Home.tsx @@ -1,124 +1,127 @@ -import PageWrapper from '@components/PageWrapper'; -import SearchBar from '@components/SearchBar/SearchBar'; -import ShadowIcon from '@components/ShadowIcon'; -import Typography from '@mui/material/Typography'; +import { FC } from 'react'; + +import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; import Divider from '@mui/material/Divider'; +import Grid from '@mui/material/Unstable_Grid2'; +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import Typography from '@mui/material/Typography'; import { Link } from 'react-router-dom'; +import styled from '@mui/material/styles/styled'; + +import PageWrapper from '@components/PageWrapper'; +import SearchBar from '@components/SearchBar/SearchBar'; +import ShadowIcon from '@components/ShadowIcon'; import { Leaderboard } from './Leaderboard'; import GraphSwiper from '@components/Home/GraphSwiper'; -import { HMTPrice } from '@pages/Home/HMTPrice'; -import { TotalNumberOfTasks } from '@pages/Home/TotalNumberOfTasks'; -import { Holders } from '@pages/Home/Holders'; -import { TotalTransactions } from '@pages/Home/TotalTransactions'; +import HMTPrice from '@pages/Home/HMTPrice'; +import TotalNumberOfTasks from '@pages/Home/TotalNumberOfTasks'; +import Holders from '@pages/Home/Holders'; +import TotalTransactions from '@pages/Home/TotalTransactions'; import { LeaderboardIcon } from '@components/Icons/LeaderboardIcon'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { colorPalette } from '@assets/styles/color-palette'; import CustomTooltip from '@components/CustomTooltip'; -const Home: React.FC = () => { - const { - mobile: { isMobile }, - } = useBreakPoints(); +import { useIsMobile } from '@utils/hooks/use-breakpoints'; + +const CardWrapper = styled(Grid)(({ theme }) => ({ + display: 'flex', + background: theme.palette.white.main, + borderRadius: '16px', + padding: '24px 32px', + [theme.breakpoints.up('md')]: { + height: 300, + }, + [theme.breakpoints.down('md')]: { + height: 'auto', + }, +})); + +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +const renderViewChartsButton = (show: boolean) => { + if (show) { + return ( + + ); + } else { + return null; + } +}; + +const Home: FC = () => { + const isMobile = useIsMobile(); + return ( -
- - All HUMAN activity. In one place. - - -
-
-
-
Token
-
-
- - - -
- -
- -
-
- - - -
- -
-
-
-
- Data Overview - -
-
-
- - - -
- -
- -
-
- - - -
- -
-
-
- -
-
+ + Data Overview (All networks) + + {renderViewChartsButton(!isMobile)} +
+ + + + + + + + + + +
+ + + + {renderViewChartsButton(isMobile)} + + + { + const { data, isError, isPending, isSuccess } = useHcaptchaGeneralStats(); return ( -
- - Total Number of Tasks + + Total Number of Tasks + + {isSuccess && } + {isPending && '...'} + {isError && 'No data'} -
- {status === 'success' && } - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
+
); -} +}; + +export default TotalNumberOfTasks; diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx b/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx index 82bf49cab7..6c4ada399a 100644 --- a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx @@ -1,22 +1,22 @@ -import { FormatNumber } from '@components/Home/FormatNumber'; +import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; + +import { FormatNumber } from '@components/Home/FormatNumber'; import { useGeneralStats } from '@services/api/use-general-stats'; -export function TotalTransactions() { - const { data, status } = useGeneralStats(); +const TotalTransactions = () => { + const { data, isError, isPending, isSuccess } = useGeneralStats(); return ( -
- - Total Transactions + + Total Transactions + + {isSuccess && } + {isPending && '...'} + {isError && 'No data'} -
- {status === 'success' && ( - - )} - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
+
); -} +}; + +export default TotalTransactions; diff --git a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx index 1a2a7f2d48..60f93d1732 100644 --- a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx +++ b/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx @@ -5,7 +5,7 @@ import { Leaderboard } from '../../features/Leaderboard/index'; import { useLeaderboardDetails } from '@services/api/use-leaderboard-details'; import { LeaderboardIcon } from '@components/Icons/LeaderboardIcon'; -export const LeaderBoard = () => { +const LeaderBoard = () => { const { data, status, error } = useLeaderboardDetails(); return ( @@ -20,3 +20,5 @@ export const LeaderBoard = () => { ); }; + +export default LeaderBoard; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx index 2a774f6b9c..f258eeb751 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx @@ -1,11 +1,12 @@ -import Typography from '@mui/material/Typography'; -import Card from '@mui/material/Card'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; -import { colorPalette } from '@assets/styles/color-palette'; +import Typography from '@mui/material/Typography'; + import TitleSectionWrapper from '@components/SearchResults'; +import SectionWrapper from '@components/SectionWrapper'; +import HmtBalance from '../HmtBalance'; + import { AddressDetailsEscrowSchema } from '@services/api/use-address-details'; -import { HMTBalance } from '@pages/SearchResults/EscrowAddress/HMTBalance'; const EscrowAddress = ({ data: { @@ -24,57 +25,43 @@ const EscrowAddress = ({ data: AddressDetailsEscrowSchema; }) => { return ( - + {token} {balance !== undefined && balance !== null ? ( - - + + ) : null} {factoryAddress} - + {totalFundedAmount} HMT - + {amountPaid} HMT @@ -86,13 +73,11 @@ const EscrowAddress = ({ sx={{ padding: '3px 8px', borderRadius: '16px', - border: `1px solid ${colorPalette.secondary.light}`, + border: '1px solid', + borderColor: 'secondary.light', }} > - + {status} @@ -100,9 +85,7 @@ const EscrowAddress = ({ {launcher} @@ -111,38 +94,34 @@ const EscrowAddress = ({ {exchangeOracle} {recordingOracle} {reputationOracle} - + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/HMTBalance.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/HMTBalance.tsx deleted file mode 100644 index 839e28393a..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/HMTBalance.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { colorPalette } from '@assets/styles/color-palette'; -import Stack from '@mui/material/Stack'; -import Typography from '@mui/material/Typography'; -import { useHMTPrice } from '@services/api/use-hmt-price'; - -export const HMTBalance = ({ HMTBalance }: { HMTBalance: number }) => { - const { data, isError, isPending } = useHMTPrice(); - - if (isError) { - return N/A; - } - - if (isPending) { - return ...; - } - const HMTBalanceInDollars = HMTBalance * data.hmtPrice; - - return ( - - {HMTBalance} - - {`HMT($${HMTBalanceInDollars.toFixed(2)})`} - - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx new file mode 100644 index 0000000000..b942cac755 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx @@ -0,0 +1,52 @@ +import { FC } from 'react'; + +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; +import { NumericFormat } from 'react-number-format'; + +import { useHMTPrice } from '@services/api/use-hmt-price'; +import { useIsMobile } from '@utils/hooks/use-breakpoints'; + +type Props = { + balance?: number | null; +}; + +const HmtBalance: FC = ({ balance }) => { + const { data, isError, isPending } = useHMTPrice(); + const isMobile = useIsMobile(); + + if (isError) { + return N/A; + } + + if (isPending) { + return ...; + } + + const _balance = + Number(balance) < 1 ? Number(balance) * 1e18 : Number(balance); + const balanceInDollars = balance ? (_balance * data).toFixed(2) : 0; + + return ( + + + + + + {`HMT($${balanceInDollars})`} + + + ); +}; + +export default HmtBalance; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx new file mode 100644 index 0000000000..71c97576a8 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx @@ -0,0 +1,22 @@ +import { Typography, Stack } from '@mui/material'; + +import { useHMTPrice } from '@services/api/use-hmt-price'; + +const HmtPrice = () => { + const { data, isError, isPending, isSuccess } = useHMTPrice(); + + return ( + + + $ + + + {isError && 'N/A'} + {isPending && '...'} + {isSuccess && data} + + + ); +}; + +export default HmtPrice; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx new file mode 100644 index 0000000000..3078b19642 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx @@ -0,0 +1,57 @@ +import Typography from '@mui/material/Typography'; + +import TableBody from '@mui/material/TableBody'; +import TableContainer from '@mui/material/TableContainer'; +import Table from '@mui/material/Table'; +import TableCell from '@mui/material/TableCell'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; + +import SectionWrapper from '@components/SectionWrapper'; +import useKvstoreData from '@services/api/use-kvstore-data'; + +const KVStore = () => { + const { data } = useKvstoreData(); + + if (data?.length === 0) { + return null; + } + + return ( + + + KV Store + + + + + + Key + Value + + + + {data?.map((row) => ( + + {row.key} + {row.value} + + ))} + +
+
+
+ ); +}; + +export default KVStore; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx new file mode 100644 index 0000000000..7241d36ba9 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx @@ -0,0 +1,58 @@ +import { FC } from 'react'; + +import { Reputation } from '@services/api/use-leaderboard-details'; +import { colorPalette } from '@assets/styles/color-palette'; +import { Box, Typography } from '@mui/material'; + +type Props = { + reputation: Reputation; +}; + +type ReputationAttributes = { + title: string; + colors: { title: string; border: string }; +}; + +const reputationAttributes: Record = { + High: { + title: 'High', + colors: { + title: colorPalette.success.main, + border: colorPalette.success.light, + }, + }, + Medium: { + title: 'Medium', + colors: { + title: colorPalette.warning.main, + border: colorPalette.warning.light, + }, + }, + Low: { + title: 'Low', + colors: { + title: colorPalette.orange.main, + border: colorPalette.orange.light, + }, + }, + Unknown: { + title: 'Coming soon', + colors: { + title: colorPalette.ocean.main, + border: colorPalette.ocean.light, + }, + }, +}; + +const ReputationScore: FC = ({ reputation }) => { + const colors = reputationAttributes[reputation].colors; + return ( + + + {reputationAttributes[reputation].title} + + + ); +}; + +export default ReputationScore; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx index 24f69c717a..e1215c99c4 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx @@ -1,55 +1,74 @@ -import Card from '@mui/material/Card'; -import Typography from '@mui/material/Typography'; import Box from '@mui/material/Box'; -import { colorPalette } from '@assets/styles/color-palette'; +import Chip from '@mui/material/Chip'; +import Link from '@mui/material/Link'; +import List from '@mui/material/List'; +import ListItem from '@mui/material/ListItem'; import Stack from '@mui/material/Stack'; -import IconButton from '@mui/material/IconButton'; +import Typography from '@mui/material/Typography'; +import { Role } from '@human-protocol/sdk'; + +import SectionWrapper from '@components/SectionWrapper'; +import TitleSectionWrapper from '@components/SearchResults/TitleSectionWrapper'; +import { RoleDetailsEscrowsTable } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable'; +import KVStore from '../KVStore'; +import ReputationScore from '../ReputationScore'; +import StakeInfo from '../StakeInfo'; +import HmtBalance from '../HmtBalance'; +import HmtPrice from '../HmtPrice'; + import ReputationOracleIcon from '@assets/icons/reputation-oracle.svg'; import ExchangeOracleIcon from '@assets/icons/exchange-oracle.svg'; import JobLauncherIcon from '@assets/icons/job-launcher.svg'; import RecordingOracleIcon from '@assets/icons/recording-oracle.svg'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; + import { AddressDetailsOperator } from '@services/api/use-address-details'; -import { getNetwork } from '@utils/config/networks'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { RoleDetailsEscrowsTable } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable'; -import { Reputation } from '@services/api/use-leaderboard-details'; import { env } from '@helpers/env'; -import { FormatNumberWithDecimals } from '@components/Home/FormatNumber'; -import CustomTooltip from '@components/CustomTooltip'; -import { Role } from '@human-protocol/sdk'; +import { colorPalette } from '@assets/styles/color-palette'; interface RoleInfoProps { title: string; points: string[]; + role: string; } -const RoleInformation = ({ title, points }: RoleInfoProps) => { +const renderRoleIcon = (role: string | null) => { + if (!role) return null; + + const roleIcons = { + [Role.ReputationOracle]: , + [Role.ExchangeOracle]: , + [Role.JobLauncher]: , + [Role.RecordingOracle]: , + }; + + return roleIcons[role]; +}; + +const RoleInformation = ({ title, points, role }: RoleInfoProps) => { return ( - - {title} -
    + + {renderRoleIcon(role)} + + {title} + + {points.map((elem, idx) => ( -
  • + {elem} -
  • + ))} -
-
+ +
); }; -const RenderRoleDetailsInfo = ({ - role, -}: { - role: AddressDetailsOperator['role']; -}) => { +const renderRoleDetailsInfo = (role: string | null) => { if (!role) { return null; } @@ -94,297 +113,122 @@ const RenderRoleDetailsInfo = ({ return null; } - return ; -}; - -const renderReputationTitle = (reputation: Reputation) => { - const reputationAttributes: Record< - Reputation, - { title: string; colors: { title: string; border: string } } - > = { - High: { - title: 'High', - colors: { - title: colorPalette.success.main, - border: colorPalette.success.light, - }, - }, - Medium: { - title: 'Medium', - colors: { - title: colorPalette.warning.main, - border: colorPalette.warning.light, - }, - }, - - Low: { - title: 'Low', - colors: { - title: colorPalette.orange.main, - border: colorPalette.orange.light, - }, - }, - Unknown: { - title: 'Coming soon', - colors: { - title: colorPalette.ocean.main, - border: colorPalette.ocean.light, - }, - }, - }; - - const colors = reputationAttributes[reputation].colors; - return ( - - - {reputationAttributes[reputation].title} - - + ); }; -const renderRoleIcon = (role: AddressDetailsOperator['role']) => { - if (!role) return null; - const roleIcons = { - [Role.ReputationOracle]: , - [Role.ExchangeOracle]: , - [Role.JobLauncher]: , - [Role.RecordingOracle]: , - }; - - return roleIcons[role]; -}; - -const RoleDetails = ({ - data: { +const RoleDetails = ({ data }: { data: AddressDetailsOperator }) => { + const { + balance, role, - chainId, reputation, amountJobsProcessed, amountStaked, amountLocked, - }, -}: { - data: AddressDetailsOperator; -}) => { - const { filterParams } = useWalletSearch(); + amountWithdrawable, + url, + fee, + jobTypes, + } = data; return ( <> - - - - Overview - + + + Overview {env.VITE_HUMANPROTOCOL_CORE_ARCHITECTURE ? ( - + HUMAN Protocol core architecture ) : null} - + + + + + + - - Role - - - {renderRoleIcon(role)} - - - - - - Network - - - {getNetwork(chainId)?.name || ''} - - - + + - - - - - - - Reputation Score - - {renderReputationTitle(reputation)} - - - + {url && ( + + + {url} + + + )} + {jobTypes && jobTypes?.length > 0 && ( + - Jobs Launched - - {amountJobsProcessed} - - - - - - - + {jobTypes.map((jobType) => ( + + ))} + + + )} + {fee && ( + + {fee}% + + )} + - Stake Info - - - - {amountStaked !== undefined && amountStaked !== null ? ( - - - Tokens Staked - - - - - - - HMT - - - - ) : null} - {amountLocked !== undefined && amountLocked !== null ? ( - - - Tokens Locked - - - - - - - HMT - - - - ) : null} + {amountJobsProcessed} + - - - {filterParams.address && filterParams.chainId ? ( - - ) : null} + + + + + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx index 9a01f47b1c..babb913b9f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx @@ -1,22 +1,19 @@ -import Card from '@mui/material/Card'; +import { useEffect } from 'react'; + +import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import Box from '@mui/material/Box'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; import TableContainer from '@mui/material/TableContainer'; import Table from '@mui/material/Table'; -import { EscrowsTableBody } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody'; import TablePagination from '@mui/material/TablePagination'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { useEscrowDetails } from '@services/api/use-escrows-details'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; -import { Stack } from '@mui/material'; -export const RoleDetailsEscrowsTable = ({ - role, -}: { - role: AddressDetailsOperator['role']; -}) => { +import { EscrowsTableBody } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody'; +import SectionWrapper from '@components/SectionWrapper'; +import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; +import { useEscrowDetails } from '@services/api/use-escrows-details'; + +export const RoleDetailsEscrowsTable = ({ role }: { role: string | null }) => { const { data } = useEscrowDetails({ role }); const { pagination: { page, pageSize, lastPageIndex }, @@ -25,84 +22,70 @@ export const RoleDetailsEscrowsTable = ({ setPrevPage, } = useEscrowDetailsDto(); + useEffect(() => { + return () => { + setPageSize(10); + }; + }, [setPageSize]); + return ( - - - + + Escrows + + + - Escrows - - -
- - - - -
-
- + + + + + + + {}} + page={page} + rowsPerPage={pageSize} + onRowsPerPageChange={(event) => { + setPageSize(Number(event.target.value)); }} - > - {}} - page={page} - rowsPerPage={pageSize} - onRowsPerPageChange={(event) => { - setPageSize(Number(event.target.value)); - }} - rowsPerPageOptions={[5, 10]} - labelDisplayedRows={({ from, to }) => { - const effectiveTo = data?.results - ? from + data.results.length - 1 - : to; - return `${from}–${effectiveTo}`; - }} - component="div" - slotProps={{ - actions: { - nextButton: { - onClick: () => { - setNextPage(); - }, - disabled: - lastPageIndex !== undefined && - (page === lastPageIndex || lastPageIndex - 1 === page), + rowsPerPageOptions={[5, 10]} + labelDisplayedRows={({ from, to }) => { + const effectiveTo = data?.results + ? from + data.results.length - 1 + : to; + return `${from}–${effectiveTo}`; + }} + component="div" + slotProps={{ + actions: { + nextButton: { + onClick: () => { + setNextPage(); }, - previousButton: { - onClick: () => { - setPrevPage(); - }, + disabled: + lastPageIndex !== undefined && + (page === lastPageIndex || lastPageIndex - 1 === page), + }, + previousButton: { + onClick: () => { + setPrevPage(); }, }, - }} - /> - -
-
+ }, + }} + /> + + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx index 9c3db5f7f4..ab9d49fdf2 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx @@ -14,7 +14,6 @@ import Loader from '@components/Loader'; import { getNetwork } from '@utils/config/networks'; import { AddressDetails, - AddressDetailsWallet, useAddressDetails, } from '@services/api/use-address-details'; import { handleErrorMessage } from '@services/handle-error-message'; @@ -22,6 +21,7 @@ import RoleDetails from '@pages/SearchResults/RoleDetails/RoleDetails'; import { AxiosError } from 'axios'; import { WalletIcon } from '@components/Icons/WalletIcon'; import { EscrowAddressIcon } from '@components/Icons/EscrowAddressIcon'; +import { WalletAddressTransactionsTable } from './WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable'; const renderCurrentResultType = ( addressDetails: AddressDetails, @@ -84,16 +84,19 @@ const Results = () => { return ; } - const selectedWalletData: AddressDetailsWallet | undefined = + const showTransactions = !!data.wallet || !!data.operator; + + const walletData = data.wallet || (data.operator && data.operator.role === null ? data.operator : undefined); return ( <> {renderCurrentResultType(data, filterParams.address)} @@ -102,12 +105,19 @@ const Results = () => { {data.operator && data.operator.role ? ( ) : null} - {selectedWalletData ? : null} - {data.escrow ? : null} + {walletData ? : null} + {data.escrow && } + {showTransactions && } ); }; +enum ParamsStatus { + LOADING = 'loading', + ERROR = 'error', + SUCCESS = 'success', +} + const SearchResults = () => { const location = useLocation(); const { chainId: urlChainId, address: urlAddress } = useParams(); @@ -116,20 +126,21 @@ const SearchResults = () => { setChainId, filterParams: { chainId, address }, } = useWalletSearch(); - const [paramsStatus, setParamsStatus] = useState< - 'loading' | 'error' | 'success' - >('loading'); + + const [paramsStatus, setParamsStatus] = useState( + ParamsStatus.LOADING + ); useEffect(() => { - setParamsStatus('loading'); + setParamsStatus(ParamsStatus.LOADING); }, [location]); useEffect(() => { - if (paramsStatus === 'success') return; + if (paramsStatus === ParamsStatus.SUCCESS) return; if (urlAddress) { setAddress(urlAddress); } else { - setParamsStatus('error'); + setParamsStatus(ParamsStatus.ERROR); return; } const chainIdFromUrl = Number(urlChainId); @@ -140,7 +151,7 @@ const SearchResults = () => { ) { setChainId(chainIdFromUrl); } else { - setParamsStatus('error'); + setParamsStatus(ParamsStatus.ERROR); } }, [ address, @@ -153,8 +164,8 @@ const SearchResults = () => { ]); useEffect(() => { - if (address && chainId && paramsStatus !== 'success') { - setParamsStatus('success'); + if (address && chainId && paramsStatus !== ParamsStatus.SUCCESS) { + setParamsStatus(ParamsStatus.SUCCESS); } }, [address, chainId, paramsStatus]); @@ -162,11 +173,13 @@ const SearchResults = () => { - {paramsStatus === 'loading' && } - {paramsStatus === 'error' && ( - Something went wrong + {paramsStatus === ParamsStatus.LOADING && ( + + )} + {paramsStatus === ParamsStatus.ERROR && ( + Something went wrong )} - {paramsStatus === 'success' && } + {paramsStatus === ParamsStatus.SUCCESS && } ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx new file mode 100644 index 0000000000..2d1d293b0b --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx @@ -0,0 +1,83 @@ +import { FC } from 'react'; + +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; +import { NumericFormat } from 'react-number-format'; + +import SectionWrapper from '@components/SectionWrapper'; + +import { useIsMobile } from '@utils/hooks/use-breakpoints'; + +type Props = { + amountStaked?: number | null; + amountLocked?: number | null; + amountWithdrawable?: number | null; +}; + +const renderAmount = (amount: number | null | undefined, isMobile: boolean) => { + return ( + + + + + + HMT + + + ); +}; + +const StakeInfo: FC = ({ + amountStaked, + amountLocked, + amountWithdrawable, +}) => { + const isMobile = useIsMobile(); + if (!amountStaked && !amountLocked && !amountWithdrawable) return null; + + return ( + + + Stake Info + + + {Number.isFinite(amountStaked) && ( + + + Staked Tokens + + {renderAmount(amountStaked, isMobile)} + + )} + {Number.isFinite(amountLocked) && ( + + + Locked Tokens + + {renderAmount(amountLocked, isMobile)} + + )} + {Number.isFinite(amountWithdrawable) && ( + + + Withdrawable Tokens + + {renderAmount(amountWithdrawable, isMobile)} + + )} + + + ); +}; + +export default StakeInfo; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx index c127024544..89ac4b736a 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx @@ -1,100 +1,86 @@ -import Typography from '@mui/material/Typography'; -import Card from '@mui/material/Card'; +import { FC } from 'react'; + import Stack from '@mui/material/Stack'; -import TitleSectionWrapper from '@components/SearchResults'; -import { colorPalette } from '@assets/styles/color-palette'; -import { AddressDetailsWallet } from '@services/api/use-address-details'; -import { useHMTPrice } from '@services/api/use-hmt-price'; -import { WalletAddressTransactionsTable } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; +import Typography from '@mui/material/Typography'; import { NumericFormat } from 'react-number-format'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -const HmtPrice = () => { - const { - data: hmtPrice, - isError: isHmtPriceError, - isPending: isHmtPricePending, - } = useHMTPrice(); - - if (isHmtPriceError) { - return N/A; - } +import TitleSectionWrapper from '@components/SearchResults'; +import SectionWrapper from '@components/SectionWrapper'; +import HmtBalance from '../HmtBalance'; +import HmtPrice from '../HmtPrice'; +import KVStore from '../KVStore'; +import ReputationScore from '../ReputationScore'; +import StakeInfo from '../StakeInfo'; - if (isHmtPricePending) { - return ...; - } +import { + AddressDetailsOperator, + AddressDetailsWallet, +} from '@services/api/use-address-details'; +import { useIsMobile } from '@utils/hooks/use-breakpoints'; - return ( - - - - <>{hmtPrice.hmtPrice} - - - $ - - - - ); +type Props = { + data: AddressDetailsWallet | AddressDetailsOperator; }; -const WalletAddress = ({ - data: { balance }, -}: { - data: AddressDetailsWallet; -}) => { - const { filterParams } = useWalletSearch(); - const { mobile } = useBreakPoints(); +const WalletAddress: FC = ({ data }) => { + const { + balance, + amountStaked, + amountLocked, + reputation, + amountWithdrawable, + } = data; + const isMobile = useIsMobile(); + const isWallet = 'totalAmountReceived' in data; return ( <> - + + Overview - + + + + + + + + + {isWallet && ( + HMT - - - + + )} - - - {filterParams.address && filterParams.chainId ? ( - - ) : null} + + + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx index 62992706eb..10b3927722 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx @@ -1,13 +1,18 @@ -import Typography from '@mui/material/Typography'; -import Card from '@mui/material/Card'; -import TableContainer from '@mui/material/TableContainer'; -import Table from '@mui/material/Table'; +import { useEffect } from 'react'; + import SimpleBar from 'simplebar-react'; +import Table from '@mui/material/Table'; +import TableContainer from '@mui/material/TableContainer'; +import TableFooter from '@mui/material/TableFooter'; import TablePagination from '@mui/material/TablePagination'; +import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; + import { TransactionsTableHead } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead'; import { TransactionsTableBody } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody'; +import SectionWrapper from '@components/SectionWrapper'; + import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; -import { TableFooter } from '@mui/material'; import { useTransactionDetails } from '@services/api/use-transaction-details'; export const WalletAddressTransactionsTable = () => { @@ -19,75 +24,82 @@ export const WalletAddressTransactionsTable = () => { setPrevPage, } = useTransactionDetailsDto(); + useEffect(() => { + return () => { + setPageSize(10); + }; + }, [setPageSize]); + return ( - - + + Transactions - - - {}} - page={page} - component="td" - rowsPerPage={pageSize} - onRowsPerPageChange={(event) => { - setPageSize(Number(event.target.value)); - }} - rowsPerPageOptions={[5, 10]} - labelDisplayedRows={({ from, to }) => { - const effectiveTo = data?.results - ? from + data.results.length - 1 - : to; - return `${from}–${effectiveTo}`; - }} - slotProps={{ - actions: { - nextButton: { - onClick: () => { - setNextPage(); - }, - disabled: - lastPageIndex !== undefined && - (page === lastPageIndex || - lastPageIndex - 1 === page), +
+
+ + + + {}} + page={page} + component="td" + rowsPerPage={pageSize} + onRowsPerPageChange={(event) => { + setPageSize(Number(event.target.value)); + }} + rowsPerPageOptions={[5, 10]} + labelDisplayedRows={({ from, to }) => { + const effectiveTo = data?.results + ? from + data.results.length - 1 + : to; + return `${from}–${effectiveTo}`; + }} + slotProps={{ + actions: { + nextButton: { + onClick: () => { + setNextPage(); }, - previousButton: { - onClick: () => { - setPrevPage(); - }, + disabled: + lastPageIndex !== undefined && + (page === lastPageIndex || lastPageIndex - 1 === page), + }, + previousButton: { + onClick: () => { + setPrevPage(); }, }, - }} - /> - - -
- + }, + }} + /> + + +
-
+ ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx index 9480c5cd7d..61b1a638b9 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx @@ -1,69 +1,69 @@ -import { colorPalette } from '@assets/styles/color-palette'; import Box from '@mui/material/Box/Box'; import Typography from '@mui/material/Typography'; -import { capitalize } from '@mui/material'; -export const TransactionTableCellMethod = ({ method }: { method: string }) => { - const methodAttributes: Record< - string, - { color: { text: string; border: string } } - > = { - withdraw: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, +import { colorPalette } from '@assets/styles/color-palette'; + +const methodAttributes: Record< + string, + { color: { text: string; border: string } } +> = { + withdraw: { + color: { + text: colorPalette.error.main, + border: colorPalette.error.light, }, - cancel: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, + }, + cancel: { + color: { + text: colorPalette.error.main, + border: colorPalette.error.light, }, - stake: { - color: { - text: colorPalette.success.main, - border: colorPalette.success.light, - }, + }, + stake: { + color: { + text: colorPalette.success.main, + border: colorPalette.success.light, }, - unstake: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, + }, + unstake: { + color: { + text: colorPalette.error.main, + border: colorPalette.error.light, }, - slash: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, + }, + slash: { + color: { + text: colorPalette.error.main, + border: colorPalette.error.light, }, - stakeWithdrawn: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, + }, + stakeWithdrawn: { + color: { + text: colorPalette.error.main, + border: colorPalette.error.light, }, - withdrawFees: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, + }, + withdrawFees: { + color: { + text: colorPalette.error.main, + border: colorPalette.error.light, }, - approve: { - color: { - text: colorPalette.warning.main, - border: colorPalette.warning.light, - }, + }, + approve: { + color: { + text: colorPalette.warning.main, + border: colorPalette.warning.light, }, - complete: { - color: { - text: colorPalette.success.main, - border: colorPalette.success.light, - }, + }, + complete: { + color: { + text: colorPalette.success.main, + border: colorPalette.success.light, }, - }; + }, +}; +export const TransactionTableCellMethod = ({ method }: { method: string }) => { const currentStatusColors = methodAttributes[method]?.color || { text: colorPalette.primary.main, border: colorPalette.primary.light, @@ -71,20 +71,14 @@ export const TransactionTableCellMethod = ({ method }: { method: string }) => { return ( - - {capitalize(method)} + + {method} ); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx index 6e18d806de..e1f229a167 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx @@ -16,7 +16,7 @@ export const TransactionTableCellValue = ({ value }: { value: string }) => { return ( {formatHMTDecimals(value)} - HMT + HMT ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx index 1bc9c3a454..d5b7f153af 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx @@ -6,6 +6,7 @@ import Box from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import CircularProgress from '@mui/material/CircularProgress'; import AddCircleIcon from '@mui/icons-material/AddCircle'; +import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import RemoveCircleIcon from '@mui/icons-material/RemoveCircle'; import AbbreviateClipboard from '@components/SearchResults/AbbreviateClipboard'; import { colorPalette } from '@assets/styles/color-palette'; @@ -85,7 +86,7 @@ export const TransactionsTableBody: React.FC = () => { > - + {elem.internalTransactions.length > 0 && ( toggleRow(idx)} size="small"> {expandedRows[idx] ? ( @@ -109,11 +110,13 @@ export const TransactionsTableBody: React.FC = () => { /> - {' '} - + + + + {elem.block} @@ -140,10 +143,13 @@ export const TransactionsTableBody: React.FC = () => { /> - + + + + diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx index 24d5723e1d..1e7c35be6d 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx @@ -1,91 +1,61 @@ import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; -import { colorPalette } from '@assets/styles/color-palette'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import TableCell from '@mui/material/TableCell'; -import IconButton from '@mui/material/IconButton'; import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; + import CustomTooltip from '@components/CustomTooltip'; +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + export const TransactionsTableHead = () => { return ( - + - - - - - - - Transaction Hash - + Transaction Hash + - - - - - - Method + Method + - From + From - To + To - - - - - - Block + Block + - - - - - - Value + Value + diff --git a/packages/apps/dashboard/client/src/services/api-paths.ts b/packages/apps/dashboard/client/src/services/api-paths.ts index 656a08c685..dfa16f9f30 100644 --- a/packages/apps/dashboard/client/src/services/api-paths.ts +++ b/packages/apps/dashboard/client/src/services/api-paths.ts @@ -29,4 +29,7 @@ export const apiPaths = { enabledChains: { path: '/networks/operating', }, + kvstore: { + path: '/details/kvstore', + }, } as const; diff --git a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx b/packages/apps/dashboard/client/src/services/api/use-address-details.tsx index 258b3588cc..51a4487c6e 100644 --- a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-address-details.tsx @@ -29,6 +29,12 @@ const walletSchema = z.object({ chainId: z.number(), address: z.string(), balance: z.string().transform(transformOptionalTokenAmount), + amountStaked: z.string().transform(transformOptionalTokenAmount), + amountLocked: z.string().transform(transformOptionalTokenAmount), + amountWithdrawable: z.string().transform(transformOptionalTokenAmount), + reputation: reputationSchema, + totalAmountReceived: z.string().transform(transformOptionalTokenAmount), + payoutCount: z.number().or(z.string()), }); export type AddressDetailsWallet = z.infer; @@ -78,6 +84,10 @@ const operatorSchema = z.object({ .nullable(), amountStaked: z.string().optional().transform(transformOptionalTokenAmount), amountLocked: z.string().optional().transform(transformOptionalTokenAmount), + amountWithdrawable: z + .string() + .optional() + .transform(transformOptionalTokenAmount), lockedUntilTimestamp: z.string().optional(), reputation: reputationSchema, fee: z.number(), diff --git a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx b/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx index 78232607d3..4a1ae8629b 100644 --- a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx @@ -20,7 +20,7 @@ export function useHMTPrice() { successHMTPriceResponseSchema ); - return validResponse; + return validResponse.hmtPrice; }, queryKey: ['useHMTPrice'], }); diff --git a/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx b/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx new file mode 100644 index 0000000000..55ef3228a4 --- /dev/null +++ b/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx @@ -0,0 +1,36 @@ +import { useQuery } from '@tanstack/react-query'; + +import { apiPaths } from '@services/api-paths'; +import { httpService } from '@services/http-service'; +import { validateResponse } from '@services/validate-response'; +import { z } from 'zod'; +import { useWalletSearch } from '@utils/hooks/use-wallet-search'; + +const kvstoreDataSchema = z.array( + z.object({ + key: z.string(), + value: z.string(), + }) +); + +export type KvstoreData = z.infer; + +const useKvstoreData = () => { + const { filterParams } = useWalletSearch(); + + return useQuery({ + queryKey: ['kvstoreData', filterParams.address], + queryFn: async () => { + const { data } = await httpService.get( + `${apiPaths.kvstore.path}/${filterParams.address}`, + { params: { chain_id: filterParams.chainId || -1 } } + ); + + const validResponse = validateResponse(data, kvstoreDataSchema); + + return validResponse; + }, + }); +}; + +export default useKvstoreData; diff --git a/packages/apps/dashboard/client/src/theme.tsx b/packages/apps/dashboard/client/src/theme.tsx index 955fb4009c..d961419f4a 100644 --- a/packages/apps/dashboard/client/src/theme.tsx +++ b/packages/apps/dashboard/client/src/theme.tsx @@ -3,16 +3,17 @@ import { PaletteColorOptions, PaletteColor, } from '@mui/material/styles/createPalette'; -import { ThemeOptions } from '@mui/material'; +import { Shadows, ThemeOptions } from '@mui/material'; import { colorPalette } from '@assets/styles/color-palette'; import { CSSProperties } from 'react'; declare module '@mui/material/Typography' { interface TypographyPropsVariantOverrides { - ['Components/Button Small']: true; - ['Components/Button Large']: true; - ['Components/Chip']: true; - ['Components/Table Header']: true; + ['Button Small']: true; + ['Button Large']: true; + ['Chip']: true; + ['Table Header']: true; + ['Tooltip']: true; ['H6-Mobile']: true; body3: true; } @@ -20,20 +21,22 @@ declare module '@mui/material/Typography' { declare module '@mui/material/styles' { interface TypographyVariants { - ['Components/Button Small']: CSSProperties; - ['Components/Button Large']: CSSProperties; - ['Components/Chip']: CSSProperties; - ['Components/Table Header']: CSSProperties; + ['Button Small']: CSSProperties; + ['Button Large']: CSSProperties; + ['Chip']: CSSProperties; + ['Table Header']: CSSProperties; + ['Tooltip']: CSSProperties; ['H6-Mobile']: CSSProperties; body3: CSSProperties; } // allow configuration using `createTheme` interface TypographyVariantsOptions { - ['Components/Button Small']?: CSSProperties; - ['Components/Button Large']?: CSSProperties; - ['Components/Chip']?: CSSProperties; - ['Components/Table Header']?: CSSProperties; + ['Button Small']?: CSSProperties; + ['Button Large']?: CSSProperties; + ['Chip']?: CSSProperties; + ['Table Header']?: CSSProperties; + ['Tooltip']?: CSSProperties; ['H6-Mobile']: CSSProperties; body3?: CSSProperties; } @@ -43,12 +46,10 @@ declare module '@mui/material/styles' { interface Palette { sky: PaletteColor; white: PaletteColor; - textSecondary: PaletteColor; } interface PaletteOptions { sky?: PaletteColorOptions; white?: PaletteColorOptions; - textSecondary?: PaletteColorOptions; } } @@ -56,7 +57,6 @@ declare module '@mui/material/Button' { interface ButtonPropsColorOverrides { sky: true; white: true; - textSecondary: true; } } @@ -64,7 +64,6 @@ declare module '@mui/material/IconButton' { interface IconButtonPropsColorOverrides { sky: true; white: true; - textSecondary: true; } } @@ -72,7 +71,6 @@ declare module '@mui/material/SvgIcon' { interface SvgIconPropsColorOverrides { sky: true; white: true; - textSecondary: true; } } @@ -102,12 +100,11 @@ const theme: ThemeOptions = createTheme({ contrastText: colorPalette.sky.contrastText, }, white: { - main: '#fff', - light: '#fff', - dark: '#fff', - contrastText: '#fff', + main: '#ffffff', + light: '#ffffff', + dark: '#f6f7fe', + contrastText: '#ffffff', }, - textSecondary: colorPalette.textSecondary, }, typography: { fontFamily: 'Inter, Arial, sans-serif', @@ -120,7 +117,7 @@ const theme: ThemeOptions = createTheme({ }, h3: { fontSize: 24, - fontWeight: 500, + fontWeight: 600, '@media (max-width:600px)': { fontSize: 20, }, @@ -159,28 +156,28 @@ const theme: ThemeOptions = createTheme({ letterSpacing: '0.4px', textAlign: 'left', }, - 'Components/Button Small': { + 'Button Small': { fontSize: '13px', fontWeight: 600, lineHeight: '22px', letterSpacing: '0.1px', textAlign: 'left', }, - 'Components/Button Large': { + 'Button Large': { fontSize: '15px', fontWeight: 600, lineHeight: '26px', letterSpacing: '0.1px', textAlign: 'left', }, - 'Components/Chip': { + Chip: { fontSize: '13px', fontWeight: 400, lineHeight: '18px', letterSpacing: '0.16px', textAlign: 'left', }, - 'Components/Table Header': { + 'Table Header': { fontFamily: 'Roboto', fontSize: '14px', fontWeight: 500, @@ -188,6 +185,11 @@ const theme: ThemeOptions = createTheme({ letterSpacing: '0.17px', textAlign: 'left', }, + Tooltip: { + fontSize: 10, + fontWeight: 500, + lineHeight: '14px', + }, subtitle1: { fontSize: 12, }, @@ -197,9 +199,20 @@ const theme: ThemeOptions = createTheme({ lineHeight: '21.9px', }, caption: { - fontSize: 10, + fontSize: 12, + fontWeight: 400, + lineHeight: 5 / 3, + letterSpacing: 0.4, }, }, + shadows: [ + ...createTheme({}).shadows.map((shadow, i) => { + if (i === 2) { + return '0px 3px 1px -2px #e9ebfa, 0px 2px 2px 0px rgba(233, 235, 250, 0.50), 0px 1px 5px 0px rgba(233, 235, 250, 0.20)'; + } + return shadow; + }), + ] as Shadows, components: { MuiButton: { styleOverrides: { diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-breakpoints.tsx b/packages/apps/dashboard/client/src/utils/hooks/use-breakpoints.tsx new file mode 100644 index 0000000000..d024c42b44 --- /dev/null +++ b/packages/apps/dashboard/client/src/utils/hooks/use-breakpoints.tsx @@ -0,0 +1,54 @@ +import useMediaQuery from '@mui/material/useMediaQuery'; + +type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; + +export const breakpoints = { + xs: '(max-width: 600px)', + sm: '(min-width: 601px) and (max-width: 900px)', + md: '(min-width: 901px) and (max-width: 1200px)', + lg: '(min-width: 1201px) and (max-width: 1536px)', + xl: '(min-width: 1537px)', +} as const; + +export type BreakpointResult = { + [K in Breakpoint]: { + isActive: boolean; + mediaQuery: string; + }; +}; + +const useBreakpoints = (): BreakpointResult => { + const matchesXs = useMediaQuery(breakpoints.xs); + const matchesSm = useMediaQuery(breakpoints.sm); + const matchesMd = useMediaQuery(breakpoints.md); + const matchesLg = useMediaQuery(breakpoints.lg); + const matchesXl = useMediaQuery(breakpoints.xl); + + return { + xs: { + isActive: matchesXs, + mediaQuery: `@media ${breakpoints.xs}`, + }, + sm: { + isActive: matchesSm, + mediaQuery: `@media ${breakpoints.sm}`, + }, + md: { + isActive: matchesMd, + mediaQuery: `@media ${breakpoints.md}`, + }, + lg: { + isActive: matchesLg, + mediaQuery: `@media ${breakpoints.lg}`, + }, + xl: { + isActive: matchesXl, + mediaQuery: `@media ${breakpoints.xl}`, + }, + }; +}; + +export const useIsMobile = () => { + const { xs, sm } = useBreakpoints(); + return xs.isActive || sm.isActive; +}; diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx b/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx index abe615113f..0869e4dc69 100644 --- a/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx +++ b/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx @@ -3,35 +3,35 @@ import { create } from 'zustand'; const MINIMAL_DATE_FOR_DATE_PICKER = '2021-04-06'; -export type GraphPageChartPeriodName = '1W' | '1M' | '6M' | '1Y' | 'ALL'; +export type GraphPageChartPeriodName = '24H' | '1W' | '2W' | '1M' | 'ALL'; export type TimePeriod = { value: Dayjs; name: GraphPageChartPeriodName; }; +const oneDayAgo = dayjs().subtract(1, 'day'); const oneWeekAgo = dayjs().subtract(1, 'week'); +const twoWeeksAgo = dayjs().subtract(2, 'weeks'); const oneMonthAgo = dayjs().subtract(1, 'month'); -const sixMonthsAgo = dayjs().subtract(6, 'months'); -const oneYearAgo = dayjs().subtract(1, 'year'); export const initialAllTime = dayjs(MINIMAL_DATE_FOR_DATE_PICKER); export const TIME_PERIOD_OPTIONS: TimePeriod[] = [ { - value: oneWeekAgo, - name: '1W', + value: oneDayAgo, + name: '24H', }, { - value: oneMonthAgo, - name: '1M', + value: oneWeekAgo, + name: '1W', }, { - value: sixMonthsAgo, - name: '6M', + value: twoWeeksAgo, + name: '2W', }, { - value: oneYearAgo, - name: '1Y', + value: oneMonthAgo, + name: '1M', }, { value: initialAllTime, @@ -95,6 +95,7 @@ export const useGraphPageChartParams = create((set) => ({ dateRangeParams: { ...state.dateRangeParams, from: timePeriod.value, + to: dayjs(), }, }; }); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-is-mobile.tsx b/packages/apps/dashboard/client/src/utils/hooks/use-is-mobile.tsx deleted file mode 100644 index b0c520f018..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-is-mobile.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import useMediaQuery from '@mui/material/useMediaQuery'; - -const breakpoints = { - mobile: `(max-width: 1100px)`, -}; - -export function useBreakPoints() { - const matchesMobile = useMediaQuery(breakpoints.mobile); - return { - mobile: { - isMobile: matchesMobile, - mediaQuery: `@media ${breakpoints.mobile}`, - }, - }; -} From 759a20fec04b31137b3f2794aac595fb97486b86 Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Wed, 28 May 2025 00:18:14 +0300 Subject: [PATCH 05/21] refactor: docker setup & example env files (#3360) --- .dockerignore | 1 + .gitignore | 3 +- docker-setup/.env.compose | 21 ++ docker-setup/Makefile | 31 +++ .../docker-compose.yml | 215 ++++++++++++------ docker-setup/initdb/create-dbs.sql | 5 + package.json | 4 +- packages/apps/dashboard/client/.env.example | 46 ++-- packages/apps/dashboard/client/vite.config.ts | 2 +- packages/apps/dashboard/server/.env.example | 52 ++--- .../apps/dashboard/server/docker-compose.yml | 10 - packages/apps/faucet/client/vite.config.ts | 2 +- .../exchange-oracle/client/.env.example | 16 +- .../fortune/exchange-oracle/client/Dockerfile | 35 +++ .../exchange-oracle/client/package.json | 5 +- .../exchange-oracle/client/vite.config.ts | 2 +- .../exchange-oracle/server/.env.example | 76 ++++--- .../fortune/exchange-oracle/server/Dockerfile | 33 ++- .../fortune/exchange-oracle/server/ENV.md | 92 -------- .../fortune/exchange-oracle/server/README.md | 16 +- .../exchange-oracle/server/docker-compose.yml | 50 ---- .../exchange-oracle/server/package.json | 18 +- .../server/scripts/set-manifest-url.ts | 67 ------ .../server/scripts/setup-kv-store.ts | 152 +++++++++++++ .../exchange-oracle/server/src/app.module.ts | 7 +- .../common/config/server-config.service.ts | 4 +- .../fortune/recording-oracle/.env.example | 71 ++++-- .../apps/fortune/recording-oracle/Dockerfile | 35 +++ packages/apps/fortune/recording-oracle/ENV.md | 62 ----- .../recording-oracle/docker-compose.yml | 34 --- .../fortune/recording-oracle/package.json | 9 +- .../scripts/setup-kv-store.ts | 152 +++++++++++++ .../recording-oracle/src/app.module.ts | 7 +- .../src/common/config/env-schema.ts | 1 - .../common/config/server-config.service.ts | 8 - packages/apps/human-app/frontend/.env.example | 92 +++----- packages/apps/human-app/frontend/package.json | 2 +- packages/apps/human-app/server/.env.example | 68 +++--- packages/apps/human-app/server/ENV.md | 107 --------- .../apps/human-app/server/docker-compose.yml | 32 --- .../apps/human-app/server/src/app.module.ts | 3 +- .../apps/job-launcher/client/.env.example | 31 +-- .../apps/job-launcher/client/package.json | 2 +- .../job-launcher/client/src/vite-env.d.ts | 15 -- .../apps/job-launcher/client/vite.config.ts | 2 +- .../apps/job-launcher/server/.env.example | 139 ++++++----- packages/apps/job-launcher/server/ENV.md | 203 ----------------- packages/apps/job-launcher/server/README.md | 16 +- .../job-launcher/server/docker-compose.yml | 57 ----- .../apps/job-launcher/server/package.json | 5 +- .../server/scripts/setup-kv-store.ts | 157 +++++++++++++ .../job-launcher/server/src/app.module.ts | 7 +- .../common/config/server-config.service.ts | 4 +- .../reputation-oracle/server/.env.example | 125 +++++----- .../apps/reputation-oracle/server/README.md | 6 +- .../server/docker-compose.yml | 85 ------- .../reputation-oracle/server/package.json | 3 +- .../server/scripts/setup-kv-store.ts | 52 +++-- packages/apps/staking/.env.example | 30 +-- packages/apps/staking/package.json | 2 +- packages/apps/staking/vite.config.ts | 2 +- .../cvat/exchange-oracle/.dockerignore | 4 - .../cvat/exchange-oracle/src/.env.example | 93 ++++++++ .../cvat/recording-oracle/src/.env.example | 82 +++++++ scripts/cvat/Makefile | 18 -- scripts/cvat/env-files/.env.compose | 21 -- scripts/cvat/env-files/.env.exchange-oracle | 57 ----- scripts/cvat/env-files/.env.human-app-client | 31 --- scripts/cvat/env-files/.env.human-app-server | 13 -- scripts/cvat/env-files/.env.job-launcher | 73 ------ .../cvat/env-files/.env.job-launcher-client | 10 - scripts/cvat/env-files/.env.recording-oracle | 44 ---- scripts/cvat/env-files/.env.reputation-oracle | 55 ----- scripts/cvat/initdb/create-dbs.sql | 4 - scripts/fortune/.env.jl-server | 2 +- yarn.lock | 36 ++- 76 files changed, 1458 insertions(+), 1676 deletions(-) create mode 100644 docker-setup/.env.compose create mode 100644 docker-setup/Makefile rename scripts/cvat/docker-compose.local.yml => docker-setup/docker-compose.yml (70%) create mode 100644 docker-setup/initdb/create-dbs.sql delete mode 100644 packages/apps/dashboard/server/docker-compose.yml create mode 100644 packages/apps/fortune/exchange-oracle/client/Dockerfile delete mode 100644 packages/apps/fortune/exchange-oracle/server/ENV.md delete mode 100644 packages/apps/fortune/exchange-oracle/server/docker-compose.yml delete mode 100644 packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts create mode 100644 packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts create mode 100644 packages/apps/fortune/recording-oracle/Dockerfile delete mode 100644 packages/apps/fortune/recording-oracle/ENV.md delete mode 100644 packages/apps/fortune/recording-oracle/docker-compose.yml create mode 100644 packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts delete mode 100644 packages/apps/human-app/server/ENV.md delete mode 100644 packages/apps/human-app/server/docker-compose.yml delete mode 100644 packages/apps/job-launcher/server/ENV.md delete mode 100644 packages/apps/job-launcher/server/docker-compose.yml create mode 100644 packages/apps/job-launcher/server/scripts/setup-kv-store.ts delete mode 100644 packages/apps/reputation-oracle/server/docker-compose.yml delete mode 100644 packages/examples/cvat/exchange-oracle/.dockerignore create mode 100644 packages/examples/cvat/exchange-oracle/src/.env.example create mode 100644 packages/examples/cvat/recording-oracle/src/.env.example delete mode 100644 scripts/cvat/Makefile delete mode 100644 scripts/cvat/env-files/.env.compose delete mode 100644 scripts/cvat/env-files/.env.exchange-oracle delete mode 100644 scripts/cvat/env-files/.env.human-app-client delete mode 100644 scripts/cvat/env-files/.env.human-app-server delete mode 100644 scripts/cvat/env-files/.env.job-launcher delete mode 100644 scripts/cvat/env-files/.env.job-launcher-client delete mode 100644 scripts/cvat/env-files/.env.recording-oracle delete mode 100644 scripts/cvat/env-files/.env.reputation-oracle delete mode 100644 scripts/cvat/initdb/create-dbs.sql diff --git a/.dockerignore b/.dockerignore index d3337c5373..ada5c3325a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,7 @@ .husky audits docs +docker-setup scripts **/node_modules **/build diff --git a/.gitignore b/.gitignore index 2428824dcc..ff75977ec2 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,5 @@ hardhat-dependency-compiler cache #docker databases -docker-db \ No newline at end of file +docker-db +graph-node-db \ No newline at end of file diff --git a/docker-setup/.env.compose b/docker-setup/.env.compose new file mode 100644 index 0000000000..7252e86817 --- /dev/null +++ b/docker-setup/.env.compose @@ -0,0 +1,21 @@ +MINIO_PORT=9000 + +# NOTE: Avoid changing this since it impact KV store urls +BACKEND_APPS_INTERNAL_PORT=5000 + +REPUTATION_ORACLE_EXPOSED_PORT=5001 +HUMAN_APP_SERVER_EXPOSED_PORT=5002 +JOB_LAUNCHER_EXPOSED_PORT=5003 +EXCHANGE_ORACLE_CVAT_EXPOSED_PORT=5004 +RECORDING_ORACLE_CVAT_EXPOSED_PORT=5005 +EXCHANGE_ORACLE_FORTUNE_EXPOSED_PORT=5006 +RECORDING_ORACLE_FORTUNE_EXPOSED_PORT=5007 + +HUMAN_APP_CLIENT_EXPOSED_PORT=3001 +JOB_LAUNCHER_CLIENT_EXPOSED_PORT=3002 +FORTUNE_CLIENT_EXPOSED_PORT=3003 + +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology + +# Might be empty +SUBGRAPH_API_KEY= diff --git a/docker-setup/Makefile b/docker-setup/Makefile new file mode 100644 index 0000000000..28786f2966 --- /dev/null +++ b/docker-setup/Makefile @@ -0,0 +1,31 @@ +.PHONY: check-env-file \ + infra-up infra-stop \ + build-services services-up services-stop + +DOCKER_PARALLEL ?= 4 + +check-env-file: + @if [ ! -f "./.env.compose.local" ]; then \ + cp ./.env.compose ./.env.compose.local ; \ + fi + +infra-up: + docker-compose --env-file .env.compose.local up -d postgres redis minio minio-client + +infra-stop: + docker-compose --env-file .env.compose.local stop postgres redis minio minio-client + +build-services: + docker-compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up --no-start + +services-up: + @service_names="$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))"; \ + docker-compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up -d $$service_names + +services-stop: + @service_names="$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))"; \ + docker-compose --env-file .env.compose.local stop $$service_names + +# catch-all and noop; to avoid warnings when using MAKECMDGOALS +%: + @: diff --git a/scripts/cvat/docker-compose.local.yml b/docker-setup/docker-compose.yml similarity index 70% rename from scripts/cvat/docker-compose.local.yml rename to docker-setup/docker-compose.yml index 59db252e5b..5ecff8c246 100644 --- a/scripts/cvat/docker-compose.local.yml +++ b/docker-setup/docker-compose.yml @@ -23,8 +23,7 @@ x-hardcoded-vars: x-general-env-variables: # GENERAL VARS subgraph_api_key: &subgraph_api_key ${SUBGRAPH_API_KEY} - sendgrid_api_key: &sendgrid_api_key ${SENDGRID_API_KEY:-sendgrid-disabled} - rpc_url_polygon_amoy: &rpc_url_polygon_amoy ${RPC_URL_POLYGON_AMOY:-} + rpc_url_polygon_amoy: &rpc_url_polygon_amoy ${RPC_URL_POLYGON_AMOY:?} # POSTGRES VARS postgres_user: &postgres_user ${POSTGRES_USER:-default} postgres_password: &postgres_password ${POSTGRES_PASSWORD:-qwerty} @@ -39,16 +38,11 @@ x-general-env-variables: bucket_name_manifests: &bucket_name_manifests ${BUCKET_NAME_MANIFESTS:-manifests} bucket_name_datasets: &bucket_name_datasets ${BUCKET_NAME_DATASETS:-datasets} bucket_name_rep_o: &bucket_name_rep_o ${BUCKET_NAME_REPUTATION_ORACLE:-reputation-oracle} - bucket_name_exc_o: &bucket_name_exc_o ${BUCKET_NAME_EXCHANGE_ORACLE:-exchange-oracle} - bucket_name_rec_o: &bucket_name_rec_o ${BUCKET_NAME_RECORDING_ORACLE:-recording-oracle} - # WEB3 ADDRESSES - reputation_oracle_address: &reputation_oracle_address ${REPUTATION_ORACLE_ADDRESS:?} - exchange_oracle_address: &exchange_oracle_address ${EXCHANGE_ORACLE_ADDRESS:?} - recording_oracle_address: &recording_oracle_address ${RECORDING_ORACLE_ADDRESS:?} + bucket_name_cvat_exc_o: &bucket_name_cvat_exc_o ${BUCKET_NAME_CVAT_EXCHANGE_ORACLE:-cvat-exchange-oracle} + bucket_name_cvat_rec_o: &bucket_name_cvat_rec_o ${BUCKET_NAME_CVAT_RECORDING_ORACLE:-cvat-recording-oracle} + bucket_name_fortune: &bucket_name_fortune ${BUCKEN_NAME_FORTUNE:-fortune} # OTHER backend_apps_internal_port: &backend_apps_internal_port ${BACKEND_APPS_INTERNAL_PORT:?} - human_app_secret_key: &human_app_secret_key ${HUMAN_APP_SECRET_KEY:?} - reputation_oracle_jwt_public_key: &reputation_oracle_jwt_public_key ${REPUTATION_ORACLE_JWT_PUBLIC_KEY:?} cvat_oracle_storage_endpoint: &cvat_oracle_storage_endpoint minio:${MINIO_PORT:?} x-service-env-vars-groups: @@ -60,13 +54,11 @@ x-service-env-vars-groups: REDIS_PORT: *redis_port nodejs_app_vars: &nodejs_app_vars NODE_ENV: *node_env - WEB3_ENV: *web3_env + SUBGRAPH_API_KEY: *subgraph_api_key RPC_URL_POLYGON_AMOY: *rpc_url_polygon_amoy - SENDGRID_API_KEY: *sendgrid_api_key + cvat_oracle_vars: &cvat_oracle_vars SUBGRAPH_API_KEY: *subgraph_api_key - HCAPTCHA_SITE_KEY: ${HCAPTCHA_SITE_KEY:-10000000-ffff-ffff-ffff-000000000001} - HCAPTCHA_SECRET: ${HCAPTCHA_SECRET:-0x0000000000000000000000000000000000000000} - HCAPTCHA_API_KEY: ${HCAPTCHA_API_KEY:-test} + POLYGON_AMOY_RPC_API_URL: *rpc_url_polygon_amoy nodejs_app_postgres_vars: &nodejs_app_postgres_vars <<: *postgres_auth_vars POSTGRES_HOST: *postgres_host @@ -188,8 +180,9 @@ services: BUCKET_MANIFESTS: *bucket_name_manifests BUCKET_DATASETS: *bucket_name_datasets BUCKET_REPUTATION_ORACLE: *bucket_name_rep_o - BUCKET_EXCHANGE_ORACLE: *bucket_name_exc_o - BUCKET_RECORDING_ORACLE: *bucket_name_rec_o + BUCKET_CVAT_EXCHANGE_ORACLE: *bucket_name_cvat_exc_o + BUCKET_CVAT_RECORDING_ORACLE: *bucket_name_cvat_rec_o + BUCKET_FORTUNE: *bucket_name_fortune entrypoint: > /bin/sh -c " mc alias set myminio http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD @@ -206,11 +199,14 @@ services: mc mb myminio/$$BUCKET_REPUTATION_ORACLE; mc anonymous set public myminio/$$BUCKET_REPUTATION_ORACLE; - mc mb myminio/$$BUCKET_EXCHANGE_ORACLE; - mc anonymous set public myminio/$$BUCKET_EXCHANGE_ORACLE; + mc mb myminio/$$BUCKET_CVAT_EXCHANGE_ORACLE; + mc anonymous set public myminio/$$BUCKET_CVAT_EXCHANGE_ORACLE; + + mc mb myminio/$$BUCKET_CVAT_RECORDING_ORACLE; + mc anonymous set public myminio/$$BUCKET_CVAT_RECORDING_ORACLE; - mc mb myminio/$$BUCKET_RECORDING_ORACLE; - mc anonymous set public myminio/$$BUCKET_RECORDING_ORACLE; + mc mb myminio/$$BUCKET_FORTUNE; + mc anonymous set public myminio/$$BUCKET_FORTUNE; " reputation-oracle: @@ -228,7 +224,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/reputation-oracle/server/Dockerfile expose: - *backend_apps_internal_port @@ -237,19 +233,18 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${REPUTATION_ORACLE_PORT:-5001} - env_file: ./.env.reputation-oracle.local + published: ${REPUTATION_ORACLE_EXPOSED_PORT:?} environment: <<: [*nodejs_app_vars, *nodejs_app_postgres_vars, *nodejs_app_s3_vars] HOST: *all_interfaces_ip PORT: *backend_apps_internal_port POSTGRES_DATABASE: reputation-oracle S3_BUCKET: *bucket_name_rep_o - HUMAN_APP_SECRET_KEY: *human_app_secret_key # It is accessed by user, not from container # so put here exposed port, not internal - FE_URL: http://localhost:${HUMAN_APP_CLIENT_PORT:?} - JWT_PUBLIC_KEY: *reputation_oracle_jwt_public_key + FE_URL: http://localhost:${HUMAN_APP_CLIENT_EXPOSED_PORT:?} + # User for KV store setup + SERVER_URL: http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?} human-app-server: container_name: human-app-server @@ -262,7 +257,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/human-app/server/Dockerfile expose: - *backend_apps_internal_port @@ -271,17 +266,14 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${HUMAN_APP_SERVER_PORT:-5002} - env_file: ./.env.human-app-server.local + published: ${HUMAN_APP_SERVER_EXPOSED_PORT:?} environment: <<: [*nodejs_app_vars, *redis_app_vars] HOST: *all_interfaces_ip PORT: *backend_apps_internal_port REDIS_DB: 1 + REPUTATION_ORACLE_URL: http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?} RPC_URL: *rpc_url_polygon_amoy - HUMAN_APP_SECRET_KEY: *human_app_secret_key - REPUTATION_ORACLE_URL: "http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?}" - REPUTATION_ORACLE_ADDRESS: *reputation_oracle_address human-app-client: container_name: human-app-client @@ -294,7 +286,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/human-app/frontend/Dockerfile expose: - *frontend_default_port @@ -303,11 +295,11 @@ services: ports: - name: server_port target: *frontend_default_port - published: ${HUMAN_APP_CLIENT_PORT:?} + published: ${HUMAN_APP_CLIENT_EXPOSED_PORT:?} environment: PORT: *frontend_default_port - exchange-oracle: + exchange-oracle-cvat: container_name: exchange-oracle-cvat image: human-protocol/exchange-oracle-cvat pull_policy: build @@ -324,7 +316,7 @@ services: logging: <<: *default-logging build: - context: ../../packages/examples/cvat/exchange-oracle + context: ../packages/examples/cvat/exchange-oracle dockerfile: ./Dockerfile expose: - *backend_apps_internal_port @@ -336,29 +328,26 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${EXCHANGE_ORACLE_PORT:-5003} - env_file: ./.env.exchange-oracle.local + published: ${EXCHANGE_ORACLE_CVAT_EXPOSED_PORT:?} environment: HOST: *all_interfaces_ip PORT: *backend_apps_internal_port <<: [ + *cvat_oracle_vars, *cvat_oracle_postgres_vars, *redis_app_vars, *cvat_oracle_storage_connection_vars, *cvat_connection_vars ] REDIS_DB: 2 - PG_DB: exchange-oracle - POLYGON_AMOY_RPC_API_URL: *rpc_url_polygon_amoy - POLYGON_AMOY_ADDR: *exchange_oracle_address - STORAGE_BUCKET_NAME: *bucket_name_exc_o - HUMAN_APP_JWT_KEY: *reputation_oracle_jwt_public_key + PG_DB: exchange-oracle-cvat + STORAGE_BUCKET_NAME: *bucket_name_cvat_exc_o CVAT_INCOMING_WEBHOOKS_URL: "http://exchange-oracle.app:${BACKEND_APPS_INTERNAL_PORT:?}/cvat-webhook" - LOCALHOST_RECORDING_ORACLE_URL: "http://recording-oracle:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_JOB_LAUNCHER_URL: "http://job-launcher:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_RECORDING_ORACLE_ADDRESS: *recording_oracle_address + ENABLE_CUSTOM_CLOUD_HOST: yes + # User for KV store setup + SERVER_URL: http://exchange-oracle-cvat:${BACKEND_APPS_INTERNAL_PORT:?} - recording-oracle: + recording-oracle-cvat: container_name: recording-oracle-cvat image: human-protocol/recording-oracle-cvat pull_policy: build @@ -373,7 +362,7 @@ services: logging: <<: *default-logging build: - context: ../../packages/examples/cvat/recording-oracle + context: ../packages/examples/cvat/recording-oracle dockerfile: ./Dockerfile expose: - *backend_apps_internal_port @@ -383,30 +372,22 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${RECORDING_ORACLE_PORT:-5004} - env_file: ./.env.recording-oracle.local + published: ${RECORDING_ORACLE_CVAT_EXPOSED_PORT:?} environment: HOST: *all_interfaces_ip PORT: *backend_apps_internal_port <<: [ + *cvat_oracle_vars, *cvat_oracle_postgres_vars, *cvat_oracle_storage_connection_vars, *cvat_connection_vars ] - PG_DB: recording-oracle - POLYGON_AMOY_RPC_API_URL: *rpc_url_polygon_amoy - POLYGON_AMOY_ADDR: *recording_oracle_address - STORAGE_RESULTS_BUCKET_NAME: *bucket_name_rec_o + PG_DB: recording-oracle-cvat + STORAGE_RESULTS_BUCKET_NAME: *bucket_name_cvat_rec_o STORAGE_USE_PATH_STYLE: "true" - EXCHANGE_ORACLE_STORAGE_PROVIDER: *cvat_oracle_storage_provider - EXCHANGE_ORACLE_STORAGE_ENDPOINT_URL: *cvat_oracle_storage_endpoint - EXCHANGE_ORACLE_STORAGE_ACCESS_KEY: *minio_services_access_key - EXCHANGE_ORACLE_STORAGE_SECRET_KEY: *minio_services_secret_key - EXCHANGE_ORACLE_STORAGE_RESULTS_BUCKET_NAME: *bucket_name_exc_o - EXCHANGE_ORACLE_STORAGE_USE_SSL: 'false' - LOCALHOST_EXCHANGE_ORACLE_URL: "http://exchange-oracle:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_REPUTATION_ORACLE_URL: "http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_EXCHANGE_ORACLE_ADDRESS: *exchange_oracle_address + ENABLE_CUSTOM_CLOUD_HOST: "yes" + # User for KV store setup + SERVER_URL: http://recording-oracle-cvat:${BACKEND_APPS_INTERNAL_PORT:?} job-launcher: container_name: job-launcher @@ -423,7 +404,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/job-launcher/server/Dockerfile expose: - *backend_apps_internal_port @@ -432,19 +413,16 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${JOB_LAUNCHER_PORT:-5005} - env_file: ./.env.job-launcher.local + published: ${JOB_LAUNCHER_EXPOSED_PORT:?} environment: <<: [*nodejs_app_vars, *nodejs_app_postgres_vars, *nodejs_app_s3_vars] HOST: *all_interfaces_ip PORT: *backend_apps_internal_port POSTGRES_DATABASE: job-launcher S3_BUCKET: *bucket_name_manifests - REPUTATION_ORACLES: *reputation_oracle_address - REPUTATION_ORACLE_ADDRESS: *reputation_oracle_address - CVAT_EXCHANGE_ORACLE_ADDRESS: *exchange_oracle_address - CVAT_RECORDING_ORACLE_ADDRESS: *recording_oracle_address - FE_URL: http://localhost:${JOB_LAUNCHER_CLIENT_PORT:?} + FE_URL: http://localhost:${JOB_LAUNCHER_CLIENT_EXPOSED_PORT:?} + # User for KV store setup + SERVER_URL: http://job-launcher:${BACKEND_APPS_INTERNAL_PORT:?} job-launcher-client: container_name: job-launcher-client @@ -457,7 +435,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/job-launcher/client/Dockerfile expose: - *frontend_default_port @@ -466,10 +444,99 @@ services: ports: - name: server_port target: *frontend_default_port - published: ${JOB_LAUNCHER_CLIENT_PORT:?} + published: ${JOB_LAUNCHER_CLIENT_EXPOSED_PORT:?} + environment: + PORT: *frontend_default_port + + exchange-oracle-fortune: + container_name: exchange-oracle-fortune + image: human-protocol/exchange-oracle-fortune + pull_policy: build + depends_on: + postgres: + condition: service_healthy + minio: + condition: service_healthy + minio-client: + condition: service_completed_successfully + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/apps/fortune/exchange-oracle/server/Dockerfile + expose: + - *backend_apps_internal_port + networks: + - human_protocol + ports: + - name: server_port + target: *backend_apps_internal_port + published: ${EXCHANGE_ORACLE_FORTUNE_EXPOSED_PORT:?} + environment: + <<: [*nodejs_app_vars, *nodejs_app_postgres_vars, *nodejs_app_s3_vars] + HOST: *all_interfaces_ip + PORT: *backend_apps_internal_port + POSTGRES_DATABASE: exchange-oracle-fortune + S3_BUCKET: *bucket_name_fortune + # User for KV store setup + SERVER_URL: http://exchange-oracle-fortune:${BACKEND_APPS_INTERNAL_PORT:?} + + fortune-client: + container_name: fortune-client + image: human-protocol/fortune-client + pull_policy: build + depends_on: + exchange-oracle-fortune: + condition: service_started + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/apps/fortune/exchange-oracle/client/Dockerfile + expose: + - *frontend_default_port + networks: + - human_protocol + ports: + - name: server_port + target: *frontend_default_port + published: ${FORTUNE_CLIENT_EXPOSED_PORT:?} environment: PORT: *frontend_default_port + recording-oracle-fortune: + container_name: recording-oracle-fortune + image: human-protocol/recording-oracle-fortune + pull_policy: build + depends_on: + minio: + condition: service_healthy + minio-client: + condition: service_completed_successfully + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/apps/fortune/recording-oracle/Dockerfile + expose: + - *backend_apps_internal_port + networks: + - human_protocol + ports: + - name: server_port + target: *backend_apps_internal_port + published: ${RECORDING_ORACLE_FORTUNE_EXPOSED_PORT:?} + environment: + <<: [*nodejs_app_vars, *nodejs_app_s3_vars] + HOST: *all_interfaces_ip + PORT: *backend_apps_internal_port + S3_BUCKET: *bucket_name_fortune + # User for KV store setup + SERVER_URL: http://recording-oracle-fortune:${BACKEND_APPS_INTERNAL_PORT:?} + volumes: # When init for the first time postgres requires empty directory # that is exclusive to its user, so providing a separate volume diff --git a/docker-setup/initdb/create-dbs.sql b/docker-setup/initdb/create-dbs.sql new file mode 100644 index 0000000000..da24368f29 --- /dev/null +++ b/docker-setup/initdb/create-dbs.sql @@ -0,0 +1,5 @@ +CREATE DATABASE "reputation-oracle"; +CREATE DATABASE "job-launcher"; +CREATE DATABASE "exchange-oracle-cvat"; +CREATE DATABASE "recording-oracle-cvat"; +CREATE DATABASE "exchange-oracle-fortune"; diff --git a/package.json b/package.json index 4bb0c41bee..d92d51468a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "lint": "yarn workspaces foreach --all -p run lint", "build:core": "yarn workspace @human-protocol/core build", "build:sdk": "yarn workspace @human-protocol/sdk build", - "build:libs": "yarn build:core && yarn build:sdk" + "build:libs": "yarn build:core && yarn build:sdk", + "docker:infra-up": "make -C ./docker-setup check-env-file infra-up", + "docker:stop": "make -C ./docker-setup services-stop" }, "workspaces": [ "packages/**" diff --git a/packages/apps/dashboard/client/.env.example b/packages/apps/dashboard/client/.env.example index 62ebf481d3..7308b99ba5 100644 --- a/packages/apps/dashboard/client/.env.example +++ b/packages/apps/dashboard/client/.env.example @@ -1,22 +1,26 @@ -# link to api -VITE_API_URL= -# links to navbar items -VITE_NAVBAR_LINK_GITBOOK= -VITE_NAVBAR_LINK_FAUCETS= -VITE_NAVBAR_LINK_HUMAN_WEBSITE= -VITE_NAVBAR_LINK_LAUNCH_JOBS= -VITE_NAVBAR_LINK_WORK_AND_EARN= -# link to button on 'Role details' page -VITE_HUMANPROTOCOL_CORE_ARCHITECTURE= -# links to footer socials -VITE_FOOTER_LINK_GITHUB= -VITE_FOOTER_LINK_DISCORD= -VITE_FOOTER_LINK_X= -VITE_FOOTER_LINK_TELEGRAM= -VITE_FOOTER_LINK_LINKEDIN= -# other footer links -VITE_FOOTER_LINK_TERMS_OF_SERVICE= -VITE_FOOTER_LINK_PRIVACY_POLICY= -VITE_FOOTER_LINK_HUMAN_PROTOCOL= +# General +VITE_API_URL=http://0.0.0.0:5006 +VITE_ENABLED_CHAIN_IDS=97,80002,11155111 + +# Links to navbar items +VITE_NAVBAR_LINK_GITBOOK=https://docs.humanprotocol.org/ +VITE_NAVBAR_LINK_FAUCETS=https://faucet.humanprotocol.org +VITE_NAVBAR_LINK_HUMAN_WEBSITE=https://humanprotocol.org/ +VITE_NAVBAR_LINK_LAUNCH_JOBS=https://job-launcher.humanprotocol.org/ +VITE_NAVBAR_LINK_WORK_AND_EARN=https://app.humanprotocol.org/ + +# Link to button on 'Role details' page +VITE_HUMANPROTOCOL_CORE_ARCHITECTURE=https://docs.humanprotocol.org/hub/human-tech-docs/architecture + +# Links to footer socials +VITE_FOOTER_LINK_GITHUB=https://github.com/humanprotocol/human-protocol +VITE_FOOTER_LINK_DISCORD=https://discord.com/invite/5sHfvE8y8p +VITE_FOOTER_LINK_X=https://x.com/intent/follow?screen_name=human_protocol +VITE_FOOTER_LINK_TELEGRAM=https://t.me/human_protocol_community +VITE_FOOTER_LINK_LINKEDIN=https://www.linkedin.com/company/human-protocol + +# Other footer links +VITE_FOOTER_LINK_TERMS_OF_SERVICE=https://humanprotocol.org/privacy-policy +VITE_FOOTER_LINK_PRIVACY_POLICY=https://humanprotocol.org/privacy-policy +VITE_FOOTER_LINK_HUMAN_PROTOCOL=https://humanprotocol.org/ -VITE_ENABLED_CHAIN_IDS= diff --git a/packages/apps/dashboard/client/vite.config.ts b/packages/apps/dashboard/client/vite.config.ts index accd21e3a9..9f7cc79504 100644 --- a/packages/apps/dashboard/client/vite.config.ts +++ b/packages/apps/dashboard/client/vite.config.ts @@ -36,6 +36,6 @@ export default defineConfig({ }, }, server: { - port: 3001, + port: 3004, }, }); diff --git a/packages/apps/dashboard/server/.env.example b/packages/apps/dashboard/server/.env.example index f3ac7f4f39..4d02bcd63d 100644 --- a/packages/apps/dashboard/server/.env.example +++ b/packages/apps/dashboard/server/.env.example @@ -1,36 +1,30 @@ # App -NODE_ENV=development -HOST=localhost -PORT=3000 -CORS_ENABLED= -CORS_ALLOWED_ORIGIN= -CORS_ALLOWED_HEADERS= -SUBGRAPH_API_KEY= -HMT_PRICE_SOURCE= -HMT_PRICE_SOURCE_API_KEY= -HMT_PRICE_FROM= -HMT_PRICE_TO= -HCAPTCHA_API_KEY= -HCAPTCHA_STATS_ENABLED= -NETWORK_USAGE_FILTER_MONTHS= -NETWORKS_OPERATING_CACHE_TTL= +HOST=0.0.0.0 +PORT=5006 +CORS_ENABLED=true +CORS_ALLOWED_ORIGIN=* + +# API keys +HMT_PRICE_SOURCE_API_KEY=replace_me +HCAPTCHA_API_KEY=replace_me # Redis -REDIS_HOST=localhost -REDIS_PORT=6379 -CACHE_HMT_PRICE_TTL=60 -CACHE_HMT_GENERAL_STATS_TTL=120 -HMT_PRICE_CACHE_KEY= -REPUTATION_SOURCE_URL= +REDIS_HOST=0.0.0.0 +REDIS_PORT=6380 # S3 -S3_ENDPOINT= -S3_PORT= -S3_ACCESS_KEY= -S3_SECRET_KEY= -S3_USE_SSL= -S3_BUCKET= +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=dashboard-hcaptcha-historical-stats +S3_USE_SSL=false #Web3 -WEB3_ENV= -RPC_URL_POLYGON= +WEB3_ENV=testnet +RPC_URL_POLYGON=https://rpc-amoy.polygon.technology +RPC_URL_BSC_TESTNET=https://bsc-testnet.drpc.org +RPC_URL_SEPOLIA=https://rpc.sepolia.org + +# Reputation Oracle URL +REPUTATION_SOURCE_URL=http://0.0.0.0:5001 diff --git a/packages/apps/dashboard/server/docker-compose.yml b/packages/apps/dashboard/server/docker-compose.yml deleted file mode 100644 index 6258fe800c..0000000000 --- a/packages/apps/dashboard/server/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 'dashboard-server' - -services: - redis: - image: redis:latest - container_name: dashboard-cache - ports: - - '6379:6379' - volumes: - - ./redis_data:/data \ No newline at end of file diff --git a/packages/apps/faucet/client/vite.config.ts b/packages/apps/faucet/client/vite.config.ts index 82dc93a9c0..3c407bc5d4 100644 --- a/packages/apps/faucet/client/vite.config.ts +++ b/packages/apps/faucet/client/vite.config.ts @@ -33,7 +33,7 @@ export default defineConfig(({ mode }) => { }, }, server: { - port: 3002, + port: 3006, }, }; }); diff --git a/packages/apps/fortune/exchange-oracle/client/.env.example b/packages/apps/fortune/exchange-oracle/client/.env.example index da2c159e02..1956902a37 100644 --- a/packages/apps/fortune/exchange-oracle/client/.env.example +++ b/packages/apps/fortune/exchange-oracle/client/.env.example @@ -1,11 +1,7 @@ -VITE_APP_EXCHANGE_ORACLE_SERVER_URL= +# General +VITE_APP_EXCHANGE_ORACLE_SERVER_URL=http://0.0.0.0:5006 +VITE_APP_WALLETCONNECT_PROJECT_ID=replace_me + +# Web3 VITE_APP_ENVIRONMENT=testnet -VITE_APP_RPC_URL_POLYGON= -VITE_APP_RPC_URL_BSC= -VITE_APP_RPC_URL_POLYGON_AMOY= -VITE_APP_RPC_URL_GOERLI= -VITE_APP_RPC_URL_SEPOLIA= -VITE_APP_RPC_URL_MOONBEAM= -VITE_APP_RPC_URL_BSC_TESTNET= -VITE_APP_RPC_URL_LOCALHOST=http://0.0.0.0:8545/ -VITE_APP_WALLETCONNECT_PROJECT_ID= \ No newline at end of file +VITE_APP_SUPPORTED_CHAINS=80002 \ No newline at end of file diff --git a/packages/apps/fortune/exchange-oracle/client/Dockerfile b/packages/apps/fortune/exchange-oracle/client/Dockerfile new file mode 100644 index 0000000000..b47c3f4c23 --- /dev/null +++ b/packages/apps/fortune/exchange-oracle/client/Dockerfile @@ -0,0 +1,35 @@ +# Using bullseye instead of slim because it needs Python and build tools for node-gyp +FROM node:22.14-bullseye +ARG APP_PATH=packages/apps/fortune/exchange-oracle/client + +# Create app directory +WORKDIR /usr/src/app + +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +# Some deps are referenced as "workspace:*", +# so we need to copy and build them +COPY packages/core ./packages/core +COPY packages/sdk ./packages/sdk + +RUN yarn install + +# Copy base TS config that is required to build pacakges +COPY tsconfig.base.json ./ +# Build libs +RUN yarn build:libs + +# Copy everything else +COPY ${APP_PATH} ./${APP_PATH} + +WORKDIR ./${APP_PATH} +RUN yarn build + +# Start the server using the build +CMD [ "yarn", "start:prod" ] \ No newline at end of file diff --git a/packages/apps/fortune/exchange-oracle/client/package.json b/packages/apps/fortune/exchange-oracle/client/package.json index 747202275c..e6c3b2b24d 100644 --- a/packages/apps/fortune/exchange-oracle/client/package.json +++ b/packages/apps/fortune/exchange-oracle/client/package.json @@ -6,7 +6,7 @@ "scripts": { "clean": "rm -rf dist", "lint": "eslint \"**/*.{ts,tsx}\"", - "start": "vite --port 3006", + "start": "vite", "build": "vite build", "preview": "vite preview", "start:prod": "serve -s dist", @@ -27,7 +27,10 @@ ] }, "dependencies": { + "@emotion/react": "^11.11.3", + "@emotion/styled": "^11.11.0", "@human-protocol/sdk": "workspace:^", + "@mui/icons-material": "^7.0.1", "@mui/material": "^5.16.7", "@tanstack/query-sync-storage-persister": "^5.68.0", "@tanstack/react-query": "^5.67.2", diff --git a/packages/apps/fortune/exchange-oracle/client/vite.config.ts b/packages/apps/fortune/exchange-oracle/client/vite.config.ts index 147fdcb76f..9dd2c1afd3 100644 --- a/packages/apps/fortune/exchange-oracle/client/vite.config.ts +++ b/packages/apps/fortune/exchange-oracle/client/vite.config.ts @@ -25,6 +25,6 @@ export default defineConfig({ }, }, server: { - port: 3006, + port: 3003, }, }); diff --git a/packages/apps/fortune/exchange-oracle/server/.env.example b/packages/apps/fortune/exchange-oracle/server/.env.example index 4e8005d39f..6c0f17db8b 100644 --- a/packages/apps/fortune/exchange-oracle/server/.env.example +++ b/packages/apps/fortune/exchange-oracle/server/.env.example @@ -1,43 +1,59 @@ # General -NODE_ENV=development -PORT= -CRON_SECRET= +HOST=0.0.0.0 +PORT=5006 # Database POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=operator +POSTGRES_PORT=5433 +POSTGRES_USER=default POSTGRES_PASSWORD=qwerty -POSTGRES_DATABASE=exchange-oracle -POSTGRES_SYNC=false -POSTGRES_PORT=5432 +POSTGRES_DATABASE=exchange-oracle-fortune POSTGRES_SSL=false -POSTGRES_LOGGING='all' - # S3 -S3_ENDPOINT= -S3_PORT= -S3_ACCESS_KEY= -S3_SECRET_KEY= -S3_USE_SSL= -S3_BUCKET= +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=fortune +S3_USE_SSL=false # Web3 -WEB3_ENV=localhost -WEB3_PRIVATE_KEY= -RPC_URL_POLYGON= -RPC_URL_BSC= -RPC_URL_POLYGON_AMOY= -RPC_URL_SEPOLIA= -RPC_URL_MOONBEAM= -RPC_URL_BSC_TESTNET= -RPC_URL_XLAYER= -RPC_URL_LOCALHOST= +WEB3_ENV=testnet +WEB3_PRIVATE_KEY=replace_me +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology # PGP -PGP_ENCRYPT= -PGP_PRIVATE_KEY= -PGP_PASSPHRASE= +PGP_ENCRYPT=true +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +xYYEaCsZkBYJKwYBBAHaRw8BAQdA57OtWky46JfMXjUuc0Lb7DhlfLuLYIfI +j/k/vJiuL+D+CQMI2p74jVMUUM3g8z+mhvW3+G5ajp6G3kwqlwMA5GXvbPsI +AwMt8q3dT51U0FpaeFR0vzbokC/3J2yn44MrHT5W1ZaKbWLlx5QGiAqkl9D3 +ec0AwowEEBYKAD4FgmgrGZAECwkHCAmQsDLkiO/wmn8DFQgKBBYAAgECGQEC +mwMCHgEWIQStAYPfywhyBWsDk4WwMuSI7/CafwAAjXYA/AxG1Y6vL3JJnm/0 +8BpA2X1I2mAf36tfpWh79EI1YzcSAQD2Nx6hzzl+zTk9usms4iyl0ZkA5GqR +EQQggrHIZEvKCseLBGgrGZASCisGAQQBl1UBBQEBB0Cf3IqFfpNHTpIM6QQK +z9MtsKJsoaIdoBq5o65jX+v4CQMBCAf+CQMIYLeP6Ua7BsHgqKKEO4VYdHu8 +tIoEcZkDffm5NQ3BmS1c4tYp63d4jxZmkbyw3xHj6QS3D9a7IF+/R2+rrYf1 +Y0HFz1H9TSsJnuvOCf2wiMJ4BBgWCgAqBYJoKxmQCZCwMuSI7/CafwKbDBYh +BK0Bg9/LCHIFawOThbAy5Ijv8Jp/AACRFgEA0cwrCjODyF7GleZK/SHff9xn +oRSkBzq+CCaA/eqQ/ikBALfxC5M+OM7od4w9xKBThNG2M2lC4D9enGU5+cGE +BRoN +=gvnq +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=6fD8WuRhT85mxP11PfX +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- -# Cron Job Secret -CRON_SECRET="cron-secret" \ No newline at end of file +xjMEaCsZkBYJKwYBBAHaRw8BAQdA57OtWky46JfMXjUuc0Lb7DhlfLuLYIfI +j/k/vJiuL+DNAMKMBBAWCgA+BYJoKxmQBAsJBwgJkLAy5Ijv8Jp/AxUICgQW +AAIBAhkBApsDAh4BFiEErQGD38sIcgVrA5OFsDLkiO/wmn8AAI12APwMRtWO +ry9ySZ5v9PAaQNl9SNpgH9+rX6Voe/RCNWM3EgEA9jceoc85fs05PbrJrOIs +pdGZAORqkREEIIKxyGRLygrOOARoKxmQEgorBgEEAZdVAQUBAQdAn9yKhX6T +R06SDOkECs/TLbCibKGiHaAauaOuY1/r+AkDAQgHwngEGBYKACoFgmgrGZAJ +kLAy5Ijv8Jp/ApsMFiEErQGD38sIcgVrA5OFsDLkiO/wmn8AAJEWAQDRzCsK +M4PIXsaV5kr9Id9/3GehFKQHOr4IJoD96pD+KQEAt/ELkz44zuh3jD3EoFOE +0bYzaULgP16cZTn5wYQFGg0= +=ppFH +-----END PGP PUBLIC KEY BLOCK-----" diff --git a/packages/apps/fortune/exchange-oracle/server/Dockerfile b/packages/apps/fortune/exchange-oracle/server/Dockerfile index 53a10f4234..29c97e32f6 100644 --- a/packages/apps/fortune/exchange-oracle/server/Dockerfile +++ b/packages/apps/fortune/exchange-oracle/server/Dockerfile @@ -1,18 +1,35 @@ -# Base image -FROM node:18 +FROM node:22.14-slim +ARG APP_PATH=packages/apps/fortune/exchange-oracle/server # Create app directory WORKDIR /usr/src/app -# Bundle app source -COPY . . +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +# Some deps are referenced as "workspace:*", +# so we need to copy and build them +COPY packages/core ./packages/core +COPY packages/sdk ./packages/sdk -# Install app dependencies RUN yarn install + +# Copy base TS config that is required to build pacakges +COPY tsconfig.base.json ./ +# Build libs RUN yarn build:libs +# Copy everything else +COPY ${APP_PATH} ./${APP_PATH} + +WORKDIR ./${APP_PATH} # Creates a "dist" folder with the production build -RUN yarn workspace @human-protocol/fortune-exchange-oracle-server build +RUN yarn build -# Start the server using the production build -CMD [ "node", "packages/apps/fortune/exchange-oracle/server/dist/src/main.js" ] +# Start the server using the build +CMD [ "yarn", "start:prod" ] diff --git a/packages/apps/fortune/exchange-oracle/server/ENV.md b/packages/apps/fortune/exchange-oracle/server/ENV.md deleted file mode 100644 index 3a718a5cfc..0000000000 --- a/packages/apps/fortune/exchange-oracle/server/ENV.md +++ /dev/null @@ -1,92 +0,0 @@ -# Environment Variables - -### The URL for connecting to the PostgreSQL database. -POSTGRES_URL= - -### The hostname or IP address of the PostgreSQL database server. Default: '127.0.0.1' -POSTGRES_HOST="127.0.0.1" - -### The port number on which the PostgreSQL database server is listening. Default: 5432 -POSTGRES_PORT="5432" - -### The username for authenticating with the PostgreSQL database. Default: 'operator' -POSTGRES_USER="operator" - -### The password for authenticating with the PostgreSQL database. Default: 'qwerty' -POSTGRES_PASSWORD="qwerty" - -### The name of the PostgreSQL database to connect to. Default: 'exchange-oracle' -POSTGRES_DATABASE="exchange-oracle" - -### Indicates whether to use SSL for connections to the PostgreSQL database. Default: false -POSTGRES_SSL="false" - -### The logging level for PostgreSQL operations (e.g., 'debug', 'info'). Default: 'log,info,warn,error' -POSTGRES_LOGGING="log,info,warn,error" - -### The RPC URL for the Sepolia network. -RPC_URL_SEPOLIA= - -### The RPC URL for the Polygon network. -RPC_URL_POLYGON= - -### The RPC URL for the Polygon Amoy network. -RPC_URL_POLYGON_AMOY= - -### The RPC URL for the BSC Mainnet network. -RPC_URL_BSC_MAINNET= - -### The RPC URL for the BSC Testnet network. -RPC_URL_BSC_TESTNET= - -### The RPC URL for the Localhost network. -RPC_URL_LOCALHOST= - -### Indicates whether PGP encryption should be used. Default: false -PGP_ENCRYPT="false" - -### The private key used for PGP encryption or decryption. -PGP_PRIVATE_KEY= - -### The passphrase associated with the PGP private key. -PGP_PASSPHRASE= - -### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1' -S3_ENDPOINT="127.0.0.1" - -### The port number for connecting to the S3 service. Default: 9000 -S3_PORT="9000" - -### The access key ID used to authenticate requests to the S3 service. Required -S3_ACCESS_KEY= - -### The secret access key used to authenticate requests to the S3 service. Required -S3_SECRET_KEY= - -### The name of the S3 bucket where files will be stored. Default: 'exchange' -S3_BUCKET="exchange" - -### Indicates whether to use SSL (HTTPS) for connections to the S3 service. Default: false -S3_USE_SSL="false" - -### The environment in which the server is running (e.g., 'development', 'production'). Default: 'development' -NODE_ENV="development" - -### The hostname or IP address on which the server will run. Default: 'localhost' -HOST="localhost" - -### The port number on which the server will listen for incoming connections. Default: 5000 -PORT="5000" - -### The URL of the frontend application that the server will communicate with. Default: 'http://localhost:3005' -FE_URL="http://localhost:3005" - -### The maximum number of retry attempts for certain operations. Default: 5 -MAX_RETRY_COUNT="5" - -### The environment in which the Web3 application is running. Default: 'testnet' -WEB3_ENV="testnet" - -### The private key used for signing transactions. Required -WEB3_PRIVATE_KEY= - diff --git a/packages/apps/fortune/exchange-oracle/server/README.md b/packages/apps/fortune/exchange-oracle/server/README.md index 3a4ce72618..10e135d71a 100644 --- a/packages/apps/fortune/exchange-oracle/server/README.md +++ b/packages/apps/fortune/exchange-oracle/server/README.md @@ -45,11 +45,11 @@ First of all, postgres needs to be installed, please see here - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 dev devdevdev; - /usr/bin/mc mb myminio/solution; - /usr/bin/mc anonymous set public myminio/solution; - " diff --git a/packages/apps/fortune/exchange-oracle/server/package.json b/packages/apps/fortune/exchange-oracle/server/package.json index 2f71d2c961..f808bbe57a 100644 --- a/packages/apps/fortune/exchange-oracle/server/package.json +++ b/packages/apps/fortune/exchange-oracle/server/package.json @@ -20,26 +20,37 @@ "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", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "setup:local": "ts-node ./test/setup.ts", + "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "generate-env-doc": "ts-node scripts/generate-env-doc.ts" }, "dependencies": { "@human-protocol/sdk": "workspace:*", "@nestjs/axios": "^3.1.2", "@nestjs/common": "^10.2.7", + "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.3.10", + "@nestjs/passport": "^10.0.0", + "@nestjs/platform-express": "^10.3.10", + "@nestjs/schedule": "^4.0.1", + "@nestjs/swagger": "^7.4.2", "@nestjs/terminus": "^11.0.0", "@nestjs/typeorm": "^10.0.1", + "@types/passport-jwt": "^4.0.1", "axios": "^1.3.1", + "body-parser": "^1.20.3", "class-transformer": "^0.5.1", "class-validator": "0.14.1", + "dotenv": "^16.3.2", "ethers": "~6.13.5", "joi": "^17.13.3", + "jsonwebtoken": "^9.0.2", + "minio": "7.1.3", + "passport": "^0.7.0", + "passport-jwt": "^4.0.1", "pg": "8.13.1", "reflect-metadata": "^0.2.2", "rxjs": "^7.2.0", @@ -51,9 +62,12 @@ "@nestjs/cli": "^10.3.2", "@nestjs/schematics": "^11.0.2", "@nestjs/testing": "^10.4.6", + "@types/body-parser": "^1", "@types/express": "^4.17.13", "@types/jest": "29.5.12", + "@types/jsonwebtoken": "^9.0.7", "@types/node": "22.10.5", + "@types/passport": "^0", "@types/pg": "8.11.10", "@types/supertest": "^6.0.2", "@typescript-eslint/eslint-plugin": "^5.0.0", diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts b/packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts deleted file mode 100644 index 3dc3946559..0000000000 --- a/packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts +++ /dev/null @@ -1,67 +0,0 @@ -//This script reads manifest urls from the blockchain and set them in the database in the new column manifest_url - -import { EscrowClient } from '@human-protocol/sdk'; -import * as dotenv from 'dotenv'; -import { Client } from 'pg'; -import { ethers } from 'ethers'; - -dotenv.config({ - path: '.env', -}); - -const dbConfig = { - user: process.env.POSTGRES_USER, - host: process.env.POSTGRES_HOST, - database: process.env.POSTGRES_DATABASE, - password: process.env.POSTGRES_PASSWORD, - port: +process.env.POSTGRES_PORT!, - ssl: process.env.POSTGRES_SSL == 'true', -}; - -async function createProvider() { - const provider = new ethers.JsonRpcProvider(process.env.RPC_URL); - return provider; -} - -async function updateJobsWithManifestUrls() { - const client = new Client(dbConfig); - - try { - await client.connect(); - - const provider = await createProvider(); - const escrowClient = await EscrowClient.build(provider); - - console.log('Connected to the database.'); - - const res = await client.query( - 'SELECT * FROM "hmt"."jobs" WHERE manifest_url IS NULL', - ); - const jobsWithoutManifest = res.rows; - - for (const job of jobsWithoutManifest) { - const { escrow_address: escrowAddress, id } = job; - - try { - const manifestUrl = await escrowClient.getManifestUrl(escrowAddress); - - if (manifestUrl) { - await client.query( - 'UPDATE "hmt"."jobs" SET manifest_url = $1 WHERE id = $2', - [manifestUrl, id], - ); - console.log(`Updated job ${id} with manifestUrl: ${manifestUrl}`); - } - } catch (error) { - console.error(`Failed to update job ${id}:`, error); - } - } - } catch (error) { - console.error('Failed to update manifest URLs:', error); - } finally { - await client.end(); - console.log('Disconnected from the database.'); - } -} - -updateJobsWithManifestUrls(); diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts b/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts new file mode 100644 index 0000000000..d7344a3d54 --- /dev/null +++ b/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts @@ -0,0 +1,152 @@ +import 'dotenv/config'; +import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import { Wallet, ethers } from 'ethers'; +import * as Minio from 'minio'; + +const SUPPORTED_JOB_TYPES = 'fortune'; +const ROLE = Role.ExchangeOracle; + +async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { + const { SERVER_URL = 'http://localhost:5006', FEE = '1' } = process.env; + + if (SUPPORTED_JOB_TYPES.split(',').length === 0) { + throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); + } + try { + new URL(SERVER_URL || ''); + } catch (noop) { + throw new Error('Invalid SERVER_URL'); + } + let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + if (!url.startsWith('http')) { + url = `http://${url}`; + } + + const fee = Number(FEE); + if (!Number.isInteger(fee) || fee < 1) { + throw new Error('Fee must be positive integer'); + } + + await kvStoreClient.setBulk( + [ + KVStoreKeys.role, + KVStoreKeys.fee, + KVStoreKeys.url, + KVStoreKeys.webhookUrl, + KVStoreKeys.jobTypes, + ], + [ROLE, fee.toString(), url, `${url}/webhook`, SUPPORTED_JOB_TYPES], + ); +} + +type SetupPublicKeyFileMeta = { + keyName: string; + publicKey: string; + s3Bucket: string; + s3Endpoint: string; + s3Port: string; + kvKey: string; +}; + +async function setupPublicKeyFile( + kvStoreClient: KVStoreClient, + minioClient: Minio.Client, + meta: SetupPublicKeyFileMeta, +): Promise { + const { keyName, kvKey, publicKey, s3Bucket, s3Endpoint, s3Port } = meta; + const exists = await minioClient.bucketExists(s3Bucket); + if (!exists) { + throw new Error('Bucket does not exists'); + } + + await minioClient.putObject(s3Bucket, keyName, publicKey, { + 'Content-Type': 'text/plain', + 'Cache-Control': 'no-store', + }); + /** + * Protocol is required for 'setFileUrlAndHash' + */ + const _s3Endpoint = s3Endpoint.startsWith('http') + ? s3Endpoint + : `http://${s3Endpoint}`; + const fileUrl = `${_s3Endpoint}:${s3Port}/${s3Bucket}/${keyName}`; + await kvStoreClient.setFileUrlAndHash(fileUrl, kvKey); +} + +async function setup(): Promise { + const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const kvStoreClient = await KVStoreClient.build(wallet); + + await setupCommonValues(kvStoreClient); + + const { + S3_ENDPOINT, + S3_PORT, + S3_USE_SSL, + S3_ACCESS_KEY, + S3_SECRET_KEY, + S3_BUCKET, + } = process.env; + + if ( + [S3_ENDPOINT, S3_PORT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET].some( + (value) => !value, + ) + ) { + throw new Error('Missing S3 config value'); + } + + const s3Endpoint = S3_ENDPOINT as string; + const s3Port = S3_PORT as string; + const s3AccessKey = S3_ACCESS_KEY as string; + const s3SecretKey = S3_SECRET_KEY as string; + const s3Bucket = S3_BUCKET as string; + + const minioClient = new Minio.Client({ + endPoint: s3Endpoint, + port: parseInt(s3Port, 10), + useSSL: S3_USE_SSL === 'true', + accessKey: s3AccessKey, + secretKey: s3SecretKey, + }); + + const { + PGP_ENCRYPT, + PGP_PUBLIC_KEY, + PGP_PUBLIC_KEY_FILE = 'pgp-public-key-exco', + } = process.env; + if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (!PGP_PUBLIC_KEY) { + throw new Error('PGP public key is empty'); + } + + await setupPublicKeyFile(kvStoreClient, minioClient, { + s3Endpoint, + s3Port, + s3Bucket, + publicKey: PGP_PUBLIC_KEY, + keyName: PGP_PUBLIC_KEY_FILE, + kvKey: KVStoreKeys.publicKey, + }); + } +} + +(async () => { + try { + await setup(); + process.exit(0); + } catch (error) { + console.error('Failed to setup KV', error); + process.exit(1); + } +})(); diff --git a/packages/apps/fortune/exchange-oracle/server/src/app.module.ts b/packages/apps/fortune/exchange-oracle/server/src/app.module.ts index b2bc81423f..03f66a01ae 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/app.module.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/app.module.ts @@ -51,9 +51,10 @@ import { HttpValidationPipe } from './common/pipes'; CronJobModule, UserModule, ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], validationSchema: envValidator, }), DatabaseModule, diff --git a/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts b/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts index 130dbabd19..7b140780c5 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts @@ -31,10 +31,10 @@ export class ServerConfigService { /** * The URL of the frontend application that the server will communicate with. - * Default: 'http://localhost:3005' + * Default: 'http://localhost:3003' */ get feURL(): string { - return this.configService.get('FE_URL', 'http://localhost:3006'); + return this.configService.get('FE_URL', 'http://localhost:3003'); } /** diff --git a/packages/apps/fortune/recording-oracle/.env.example b/packages/apps/fortune/recording-oracle/.env.example index ac59dac283..c2a7c1bc38 100644 --- a/packages/apps/fortune/recording-oracle/.env.example +++ b/packages/apps/fortune/recording-oracle/.env.example @@ -1,29 +1,50 @@ -#General -NODE_ENV=development -HOST=localhost -PORT=5002 -SESSION_SECRET= +# General +HOST=0.0.0.0 +PORT=5007 +# S3 +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=fortune +S3_USE_SSL=false -#Web3 -WEB3_PRIVATE_KEY= -RPC_URL_POLYGON= -RPC_URL_BSC= -RPC_URL_POLYGON_AMOY= -RPC_URL_SEPOLIA= -RPC_URL_MOONBEAM= -RPC_URL_BSC_TESTNET= -RPC_URL_LOCALHOST= +# Web3 +WEB3_PRIVATE_KEY=replace_me +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology -# S3 -S3_ENDPOINT= -S3_PORT= -S3_ACCESS_KEY= -S3_SECRET_KEY= -S3_BUCKET= -S3_USE_SSL= +# Encryption +PGP_ENCRYPT=true +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +xYYEaCsnrRYJKwYBBAHaRw8BAQdADWMKa+9YvRJV474d+BDsLv7a+aSkMMkR +FZOWJG1ePjT+CQMIZhNMm+tnPeTgihnx8ru0E3sqYcofEvRM9VrSIyrs/U+H +LsK5rsa+NV8Ui+9cKcmtCW4EJ12LNmTg1xYJsxQnn4eZQzSmlMkK5N61KyJ+ +zM0AwowEEBYKAD4FgmgrJ60ECwkHCAmQuTtXvy2rDmoDFQgKBBYAAgECGQEC +mwMCHgEWIQRhezz+qPdIIiGIyyS5O1e/LasOagAASiUBAL2ngIhlne91+Z7h +RHU0F4ENomy/e1S6w/gn/dVLfE1OAP9ZG9x1gksN1R1O9Fgq1WfGkHNJi/8U +DF7yO8H8sDw2D8eLBGgrJ60SCisGAQQBl1UBBQEBB0A9v5ubU6UB6C9yoUPc +Zqu8ZyQHa55VFR3figyExeVtRwMBCAf+CQMIU0kTC9Fq7ozgh/iv/ybvydCJ +pdU7fNuD2Ipb4ZfRVMrogkQLolOKgRd8468OSoNFuk4RnYkBsyafZmI4KGkG ++oroKa+1mThKi6ePu7GO/cJ4BBgWCgAqBYJoKyetCZC5O1e/LasOagKbDBYh +BGF7PP6o90giIYjLJLk7V78tqw5qAACsjwD+O/d9B6wJDDd2FRp3JmZPt/sJ +vyg2sQLiIXbjACHXCI4BALbO+tfsyeSxYiK0j67etKnFzoG+1ek1vukDdIf7 +tMcN +=qkIF +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=tt8Bn946gusiJm4r5wX +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- -#Encryption -PGP_ENCRYPT= -PGP_PRIVATE_KEY= -PGP_PASSPHRASE= \ No newline at end of file +xjMEaCsnrRYJKwYBBAHaRw8BAQdADWMKa+9YvRJV474d+BDsLv7a+aSkMMkR +FZOWJG1ePjTNAMKMBBAWCgA+BYJoKyetBAsJBwgJkLk7V78tqw5qAxUICgQW +AAIBAhkBApsDAh4BFiEEYXs8/qj3SCIhiMskuTtXvy2rDmoAAEolAQC9p4CI +ZZ3vdfme4UR1NBeBDaJsv3tUusP4J/3VS3xNTgD/WRvcdYJLDdUdTvRYKtVn +xpBzSYv/FAxe8jvB/LA8Ng/OOARoKyetEgorBgEEAZdVAQUBAQdAPb+bm1Ol +AegvcqFD3GarvGckB2ueVRUd34oMhMXlbUcDAQgHwngEGBYKACoFgmgrJ60J +kLk7V78tqw5qApsMFiEEYXs8/qj3SCIhiMskuTtXvy2rDmoAAKyPAP47930H +rAkMN3YVGncmZk+3+wm/KDaxAuIhduMAIdcIjgEAts761+zJ5LFiIrSPrt60 +qcXOgb7V6TW+6QN0h/u0xw0= +=Hpds +-----END PGP PUBLIC KEY BLOCK-----" diff --git a/packages/apps/fortune/recording-oracle/Dockerfile b/packages/apps/fortune/recording-oracle/Dockerfile new file mode 100644 index 0000000000..bfe85f163b --- /dev/null +++ b/packages/apps/fortune/recording-oracle/Dockerfile @@ -0,0 +1,35 @@ +FROM node:22.14-slim +ARG APP_PATH=packages/apps/fortune/recording-oracle + +# Create app directory +WORKDIR /usr/src/app + +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +# Some deps are referenced as "workspace:*", +# so we need to copy and build them +COPY packages/core ./packages/core +COPY packages/sdk ./packages/sdk + +RUN yarn install + +# Copy base TS config that is required to build pacakges +COPY tsconfig.base.json ./ +# Build libs +RUN yarn build:libs + +# Copy everything else +COPY ${APP_PATH} ./${APP_PATH} + +WORKDIR ./${APP_PATH} +# Creates a "dist" folder with the production build +RUN yarn build + +# Start the server using the build +CMD [ "yarn", "start:prod" ] diff --git a/packages/apps/fortune/recording-oracle/ENV.md b/packages/apps/fortune/recording-oracle/ENV.md deleted file mode 100644 index 705df340a2..0000000000 --- a/packages/apps/fortune/recording-oracle/ENV.md +++ /dev/null @@ -1,62 +0,0 @@ -# Environment Variables - -### The RPC URL for the Polygon network. -RPC_URL_POLYGON= - -### The RPC URL for the Polygon Amoy network. -RPC_URL_POLYGON_AMOY= - -### The RPC URL for the Sepolia network. -RPC_URL_SEPOLIA= - -### The RPC URL for the BSC Mainnet network. -RPC_URL_BSC_MAINNET= - -### The RPC URL for the BSC Testnet network. -RPC_URL_BSC_TESTNET= - -### The RPC URL for the Localhost network. -RPC_URL_LOCALHOST= - -### Indicates whether PGP encryption should be used. Default: false -PGP_ENCRYPT="false" - -### The private key used for PGP encryption or decryption. -PGP_PRIVATE_KEY= - -### The passphrase associated with the PGP private key. -PGP_PASSPHRASE= - -### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1' -S3_ENDPOINT="127.0.0.1" - -### The port number for connecting to the S3 service. Default: 9000 -S3_PORT="9000" - -### The access key ID used to authenticate requests to the S3 service. Required -S3_ACCESS_KEY= - -### The secret access key used to authenticate requests to the S3 service. Required -S3_SECRET_KEY= - -### The name of the S3 bucket where files will be stored. Default: 'recording' -S3_BUCKET="recording" - -### Indicates whether to use SSL (HTTPS) for connections to the S3 service. Default: false -S3_USE_SSL="false" - -### The environment in which the server is running (e.g., 'development', 'production'). Default: 'development' -NODE_ENV="development" - -### The hostname or IP address on which the server will run. Default: 'localhost' -HOST="localhost" - -### The port number on which the server will listen for incoming connections. Default: 5000 -PORT="5000" - -### The secret key used for session encryption and validation. Default: 'session_key' -SESSION_SECRET="session_key" - -### The private key used for signing transactions. Required -WEB3_PRIVATE_KEY= - diff --git a/packages/apps/fortune/recording-oracle/docker-compose.yml b/packages/apps/fortune/recording-oracle/docker-compose.yml deleted file mode 100644 index 329fcd6ca6..0000000000 --- a/packages/apps/fortune/recording-oracle/docker-compose.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: '3.7' - -services: - minio: - container_name: minio - image: minio/minio:RELEASE.2022-05-26T05-48-41Z - ports: - - 9001:9001 - - 9000:9000 - environment: - MINIO_ROOT_USER: dev - MINIO_ROOT_PASSWORD: devdevdev - entrypoint: 'sh' - command: - -c "minio server /data --console-address ':9001'" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 5s - timeout: 5s - retries: 3 - minio-mc: - container_name: minio-mc - image: minio/mc - depends_on: - minio: - condition: service_healthy - entrypoint: > - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 dev devdevdev; - /usr/bin/mc mb myminio/launcher; - /usr/bin/mc anonymous set public myminio/launcher; - /usr/bin/mc mb myminio/solution; - /usr/bin/mc anonymous set public myminio/solution; - " diff --git a/packages/apps/fortune/recording-oracle/package.json b/packages/apps/fortune/recording-oracle/package.json index a2a45defba..0ffebff104 100644 --- a/packages/apps/fortune/recording-oracle/package.json +++ b/packages/apps/fortune/recording-oracle/package.json @@ -18,10 +18,8 @@ "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", - "postgres": "docker compose up -d postgres", - "docker": "docker compose up -d", - "local": "docker compose down && (concurrently --hide 0 \"yarn docker\" \"yarn recording-oracle:dev\" )", "setup:local": "ts-node ./test/setup.ts", + "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "generate-env-doc": "ts-node scripts/generate-env-doc.ts" }, "dependencies": { @@ -30,11 +28,16 @@ "@nestjs/common": "^10.2.7", "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.3.10", + "@nestjs/platform-express": "^10.3.10", "@nestjs/swagger": "^7.4.2", "axios": "^1.3.1", "body-parser": "^1.20.2", + "class-transformer": "^0.5.1", "class-validator": "0.14.1", + "dotenv": "^16.3.2", "helmet": "^7.1.0", + "joi": "^17.13.3", + "minio": "7.1.3", "reflect-metadata": "^0.2.2", "rxjs": "^7.2.0" }, diff --git a/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts b/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts new file mode 100644 index 0000000000..c1ad796570 --- /dev/null +++ b/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts @@ -0,0 +1,152 @@ +import 'dotenv/config'; +import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import { Wallet, ethers } from 'ethers'; +import * as Minio from 'minio'; + +const SUPPORTED_JOB_TYPES = 'fortune'; +const ROLE = Role.RecordingOracle; + +async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { + const { SERVER_URL = 'http://localhost:5007', FEE = '1' } = process.env; + + if (SUPPORTED_JOB_TYPES.split(',').length === 0) { + throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); + } + try { + new URL(SERVER_URL || ''); + } catch (noop) { + throw new Error('Invalid SERVER_URL'); + } + let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + if (!url.startsWith('http')) { + url = `http://${url}`; + } + + const fee = Number(FEE); + if (!Number.isInteger(fee) || fee < 1) { + throw new Error('Fee must be positive integer'); + } + + await kvStoreClient.setBulk( + [ + KVStoreKeys.role, + KVStoreKeys.fee, + KVStoreKeys.url, + KVStoreKeys.webhookUrl, + KVStoreKeys.jobTypes, + ], + [ROLE, fee.toString(), url, `${url}/webhook`, SUPPORTED_JOB_TYPES], + ); +} + +type SetupPublicKeyFileMeta = { + keyName: string; + publicKey: string; + s3Bucket: string; + s3Endpoint: string; + s3Port: string; + kvKey: string; +}; + +async function setupPublicKeyFile( + kvStoreClient: KVStoreClient, + minioClient: Minio.Client, + meta: SetupPublicKeyFileMeta, +): Promise { + const { keyName, kvKey, publicKey, s3Bucket, s3Endpoint, s3Port } = meta; + const exists = await minioClient.bucketExists(s3Bucket); + if (!exists) { + throw new Error('Bucket does not exists'); + } + + await minioClient.putObject(s3Bucket, keyName, publicKey, { + 'Content-Type': 'text/plain', + 'Cache-Control': 'no-store', + }); + /** + * Protocol is required for 'setFileUrlAndHash' + */ + const _s3Endpoint = s3Endpoint.startsWith('http') + ? s3Endpoint + : `http://${s3Endpoint}`; + const fileUrl = `${_s3Endpoint}:${s3Port}/${s3Bucket}/${keyName}`; + await kvStoreClient.setFileUrlAndHash(fileUrl, kvKey); +} + +async function setup(): Promise { + const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const kvStoreClient = await KVStoreClient.build(wallet); + + await setupCommonValues(kvStoreClient); + + const { + S3_ENDPOINT, + S3_PORT, + S3_USE_SSL, + S3_ACCESS_KEY, + S3_SECRET_KEY, + S3_BUCKET, + } = process.env; + + if ( + [S3_ENDPOINT, S3_PORT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET].some( + (value) => !value, + ) + ) { + throw new Error('Missing S3 config value'); + } + + const s3Endpoint = S3_ENDPOINT as string; + const s3Port = S3_PORT as string; + const s3AccessKey = S3_ACCESS_KEY as string; + const s3SecretKey = S3_SECRET_KEY as string; + const s3Bucket = S3_BUCKET as string; + + const minioClient = new Minio.Client({ + endPoint: s3Endpoint, + port: parseInt(s3Port, 10), + useSSL: S3_USE_SSL === 'true', + accessKey: s3AccessKey, + secretKey: s3SecretKey, + }); + + const { + PGP_ENCRYPT, + PGP_PUBLIC_KEY, + PGP_PUBLIC_KEY_FILE = 'pgp-public-key-reco', + } = process.env; + if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (!PGP_PUBLIC_KEY) { + throw new Error('PGP public key is empty'); + } + + await setupPublicKeyFile(kvStoreClient, minioClient, { + s3Endpoint, + s3Port, + s3Bucket, + publicKey: PGP_PUBLIC_KEY, + keyName: PGP_PUBLIC_KEY_FILE, + kvKey: KVStoreKeys.publicKey, + }); + } +} + +(async () => { + try { + await setup(); + process.exit(0); + } catch (error) { + console.error('Failed to setup KV', error); + process.exit(1); + } +})(); diff --git a/packages/apps/fortune/recording-oracle/src/app.module.ts b/packages/apps/fortune/recording-oracle/src/app.module.ts index 9a352672b2..8646dcfc09 100644 --- a/packages/apps/fortune/recording-oracle/src/app.module.ts +++ b/packages/apps/fortune/recording-oracle/src/app.module.ts @@ -33,9 +33,10 @@ import { ExceptionFilter } from './common/exceptions/exception.filter'; ], imports: [ ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], validationSchema: envValidator, }), JobModule, diff --git a/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts b/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts index 5d73ebeeea..a2605048c3 100644 --- a/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts +++ b/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts @@ -5,7 +5,6 @@ export const envValidator = Joi.object({ NODE_ENV: Joi.string(), HOST: Joi.string(), PORT: Joi.string(), - SESSION_SECRET: Joi.string(), // Web3 WEB3_PRIVATE_KEY: Joi.string().required(), RPC_URL_POLYGON: Joi.string(), diff --git a/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts b/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts index 9de873ef72..037d70e5ac 100644 --- a/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts +++ b/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts @@ -28,12 +28,4 @@ export class ServerConfigService { get port(): number { return +this.configService.get('PORT', 5002); } - - /** - * The secret key used for session encryption and validation. - * Default: 'session_key' - */ - get sessionSecret(): string { - return this.configService.get('SESSION_SECRET', 'session_key'); - } } diff --git a/packages/apps/human-app/frontend/.env.example b/packages/apps/human-app/frontend/.env.example index a18d929d1d..66bd2c755b 100644 --- a/packages/apps/human-app/frontend/.env.example +++ b/packages/apps/human-app/frontend/.env.example @@ -1,64 +1,38 @@ -# api url -VITE_API_URL= #string -# link to privacy policy page -VITE_PRIVACY_POLICY_URL= #string -# link to terms of service -VITE_TERMS_OF_SERVICE_URL= #string -# link to help page -VITE_HUMAN_PROTOCOL_HELP_URL= #string -# email for "Contact Support" links -VITE_HUMAN_SUPPORT_EMAIL= #string -# link to human web page -VITE_HUMAN_PROTOCOL_URL= #string -# link to human web page in main page navbar -VITE_NAVBAR__LINK__PROTOCOL_URL= #string -# link to human web page section in main page navbar -VITE_NAVBAR__LINK__HOW_IT_WORK_URL= #string -# capthca site key for captcha other than labeling -VITE_H_CAPTCHA_SITE_KEY= #string -# HMT daily spent limit -VITE_HMT_DAILY_SPENT_LIMIT= #number -# daily solved captcha limit -VITE_DAILY_SOLVED_CAPTCHA_LIMIT= #number -# capthca url for captcha other than labeling -VITE_H_CAPTCHA_EXCHANGE_URL= #string -# capthca url for labeling -VITE_H_CAPTCHA_LABELING_BASE_URL= #string -# ID of project created with https://cloud.walletconnect.com/sign-in -VITE_WALLET_CONNECT_PROJECT_ID= #string -# Dapp name for wallet connect -VITE_DAPP_META_NAME= #string -# Dapp description for wallet connect -VITE_DAPP_META_DESCRIPTION= #string -# Dapp url for wallet connect -VITE_DAPP_META_URL= #string -# Dapp icons for wallet connect -VITE_DAPP_ICONS= #string => lists of icons eg.: icon1,icon2... +# General +VITE_API_URL=http://localhost:5002 +VITE_NETWORK=testnet -# This data will be use to add first oracle in the oracles table -# string -VITE_H_CAPTCHA_ORACLE_ANNOTATION_TOOL= -# string -VITE_H_CAPTCHA_ORACLE_ROLE= -# string -VITE_H_CAPTCHA_ORACLE_ADDRESS= -# job types list string -VITE_H_CAPTCHA_ORACLE_TASK_TYPES= #string => lists of job types eg.: Image labeling, BBoxes... +# Reown project id +VITE_WALLET_CONNECT_PROJECT_ID=replace_me +VITE_DAPP_ICONS=icon1,icon2 +VITE_DAPP_META_DESCRIPTION=Complete jobs, earn HMT +VITE_DAPP_META_NAME=Human App Local +VITE_DAPP_META_URL=http://localhost:3001 -# if network is equal to 'testnet' app will use first testnet chain from .src/smart-contracts/chains.ts -# and first mainnet chain for 'mainnet' -VITE_NETWORK= # mainnet|testnet -VITE_GOVERNOR_ADDRESS= -VITE_GOVERNANCE_URL= +# hCapthca +VITE_H_CAPTCHA_EXCHANGE_URL=https://foundation-yellow-exchange.hmt.ai +VITE_H_CAPTCHA_LABELING_BASE_URL=https://foundation-yellow-accounts.hmt.ai +VITE_H_CAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 +VITE_DAILY_SOLVED_CAPTCHA_LIMIT=0 +VITE_HMT_DAILY_SPENT_LIMIT=0 + +# hCaptcha annotation tool +VITE_H_CAPTCHA_ORACLE_ADDRESS=replace_me +VITE_H_CAPTCHA_ORACLE_ANNOTATION_TOOL=hcaptcha +VITE_H_CAPTCHA_ORACLE_ROLE=hcaptcha +VITE_H_CAPTCHA_ORACLE_TASK_TYPES=image_points,image_boxes -## Web3 setup -# set SC addresses according to https://human-protocol.gitbook.io/hub/human-tech-docs/architecture/components/smart-contracts/contract-addresses +# Other +VITE_HUMAN_PROTOCOL_HELP_URL=https://docs.humanprotocol.org/ +VITE_HUMAN_PROTOCOL_URL=https://humanprotocol.org/ +VITE_HUMAN_SUPPORT_EMAIL=support@local.app +VITE_NAVBAR__LINK__HOW_IT_WORK_URL=https://humanprotocol.org/ +VITE_NAVBAR__LINK__PROTOCOL_URL=https://humanprotocol.org/ +VITE_PRIVACY_POLICY_URL=http://local.app/privacy-policy/ +VITE_TERMS_OF_SERVICE_URL=http://local.app/terms-and-conditions/ -## other networks -# if you wish to add new network follow this instruction: -# - add your env-s set to .env file -# - add new env-s to validation schema in: ./src/shared/env.ts -# - include new valid env-s in: ./src/smart-contracts/contracts.ts -# - add chain data in: .src/smart-contracts/chains.ts +VITE_GOVERNOR_ADDRESS= +VITE_GOVERNANCE_URL= -# all new chains will be available in wallet-connect modal \ No newline at end of file +# Feature flags +VITE_FEATURE_FLAG_JOBS_DISCOVERY=true diff --git a/packages/apps/human-app/frontend/package.json b/packages/apps/human-app/frontend/package.json index 108b24b0e6..42c9c07bd5 100644 --- a/packages/apps/human-app/frontend/package.json +++ b/packages/apps/human-app/frontend/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "scripts": { "clean": "tsc --build --clean && rm -rf dist", - "dev": "vite", + "start": "vite", "build": "tsc --build && vite build", "start:prod": "serve -s dist", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", diff --git a/packages/apps/human-app/server/.env.example b/packages/apps/human-app/server/.env.example index 3e2e15827b..86af25dbfe 100644 --- a/packages/apps/human-app/server/.env.example +++ b/packages/apps/human-app/server/.env.example @@ -1,34 +1,36 @@ -HOST= # string, example: localhost -PORT= # number, example: 5010 -REPUTATION_ORACLE_URL= # string -REPUTATION_ORACLE_ADDRESS= # string -REDIS_HOST= # string, example: localhost -REDIS_PORT= # number, example: 6379 -RPC_URL= # string -CHAIN_IDS_ENABLED= # number array, example: 80002,80001 -HCAPTCHA_LABELING_STATS_API_URL= # string -HCAPTCHA_LABELING_VERIFY_API_URL= # string -HCAPTCHA_LABELING_API_KEY= # string -IS_AXIOS_REQUEST_LOGGING_ENABLED= #string, true if enabled, disabled otherwise -ALLOWED_HOST= #string, example 'localhost:3000' -HUMAN_APP_SECRET_KEY= # string -# CACHE TTL VALUES - in seconds -CACHE_TTL_ORACLE_DISCOVERY= # number, example: 43200 -CACHE_TTL_ORACLE_STATS= # number, example: 900 -CACHE_TTL_USER_STATS= # number, example: 86400 -CACHE_TTL_EXCHANGE_ORACLE_URL= # number: example 86400 -CACHE_TTL_HCAPTCHA_USER_STATS= # number: example 86400 -CACHE_TTL_DAILY_HMT_SPENT= # number: example 86400 -CACHE_TTL_JOB_TYPES= # number: example 86400 -# E2E TESTING -E2E_TESTING_EMAIL_ADDRESS= # string -E2E_TESTING_PASSWORD= # string -E2E_TESTING_EXCHANGE_ORACLE_URL= # string -E2E_TESTING_ESCROW_ADDRESS= # string -E2E_TESTING_ESCROW_CHAIN_ID= # number +# General +HOST=0.0.0.0 +PORT=5002 +ALLOWED_HOST=localhost:5002 + # CORS -CORS_ALLOWED_ORIGIN= # string example: http://localhost:5173 -CORS_ALLOWED_HEADERS= # string, example: 'Content-Type,Authorization,X-Requested-With,Accept,Origin' -CORS_ENABLED= # boolean, example: true -IS_CACHE_TO_RESTART= # boolean, example: false -FEATURE_FLAG_JOBS_DISCOVERY= # boolean, example: false +CORS_ALLOWED_ORIGIN=* +CORS_ALLOWED_HEADERS='Content-Type,Authorization,X-Requested-With,Accept,Origin' +CORS_ENABLED=true + +# Reputation Oracle +REPUTATION_ORACLE_URL=http://0.0.0.0:5001 +# Web3 address +REPUTATION_ORACLE_ADDRESS=replace_me +# Auth key +HUMAN_APP_SECRET_KEY=sk_example_1VwUpBMO8H0v4Pmu4TPiWFEwuMguW4PkozSban4Rfbc + +# Redis +REDIS_HOST=0.0.0.0 +REDIS_PORT=6380 +REIDS_DB=1 +# Flush DB on startup +IS_CACHE_TO_RESTART=false + +# Web3 +RPC_URL=https://rpc-amoy.polygon.technology +# Comma-separated array +CHAIN_IDS_ENABLED=80002 + +# hCaptcha +HCAPTCHA_LABELING_STATS_API_URL=disabled +HCAPTCHA_LABELING_VERIFY_API_URL=disabled +HCAPTCHA_LABELING_API_KEY=disabled + +# Feature flags +FEATURE_FLAG_JOBS_DISCOVERY=true diff --git a/packages/apps/human-app/server/ENV.md b/packages/apps/human-app/server/ENV.md deleted file mode 100644 index ae4a763e38..0000000000 --- a/packages/apps/human-app/server/ENV.md +++ /dev/null @@ -1,107 +0,0 @@ -# Environment Variables - -### The hostname or IP address on which the server will run. Default: 'localhost' -HOST="localhost" - -### The port number on which the server will listen for incoming connections. Default: 5000 -PORT="5000" - -### The URL of the reputation oracle service. Required -GIT_HASH= - -### The address of the reputation oracle service. Required -REPUTATION_ORACLE_URL= - -### Flag indicating if Axios request logging is enabled. Default: false -REPUTATION_ORACLE_ADDRESS="false" - -### The allowed host for the application. Required -IS_AXIOS_REQUEST_LOGGING_ENABLED= - -### The port number for the Redis cache server. Required -ALLOWED_HOST= - -### The hostname or IP address of the Redis cache server. Required -REDIS_PORT= - -### The DB number of the Redis cache server -REDIS_HOST= - -### The cache time-to-live (TTL) for oracle statistics. Default: 12 hours -REDIS_DB="12 hours" - -### The cache time-to-live (TTL) for user statistics. Default: 15 minutes -CACHE_TTL_ORACLE_STATS="15 minutes" - -### The cache time-to-live (TTL) for daily HMT spent data. Default: 24 hours -CACHE_TTL_USER_STATS="24 hours" - -### The cache time-to-live (TTL) for hCaptcha user statistics. Default: 12 hours -CACHE_TTL_DAILY_HMT_SPENT="12 hours" - -### The cache time-to-live (TTL) for oracle discovery. Default: 24 hours -CACHE_TTL_HCAPTCHA_USER_STATS="24 hours" - -### Number of days without updates assignments data is retained. Default: 45 days -CACHE_TTL_ORACLE_DISCOVERY="45 days" - -### The RPC URL used for communication. Required -JOB_ASSIGNMENTS_DATA_RETENTION_DAYS= - -### Flag indicating if CORS is enabled. Default: false -RPC_URL="false" - -### The allowed origin for CORS requests. Default: 'http://localhost:5173' -CORS_ENABLED="http://localhost:5173" - -### The allowed headers for CORS requests. Default: 'Content-Type,Authorization,X-Requested-With,Accept,Origin' -CORS_ALLOWED_ORIGIN="Content-Type,Authorization,X-Requested-With,Accept,Origin" - -### The cache time-to-live (TTL) for exchange oracle URLs. Default: 24 hours -CORS_ALLOWED_HEADERS="24 hours" - -### The cache time-to-live (TTL) for job types. Default: 24 hours -CACHE_TTL_EXCHANGE_ORACLE_URL="24 hours" - -### The cache time-to-live (TTL) for exchange oracle registration needed. Default: 24 hours -CACHE_TTL_JOB_TYPES="24 hours" - -### The API URL for hCaptcha labeling statistics. Required -CACHE_TTL_EXCHANGE_ORACLE_REGISTRATION_NEEDED= - -### The API URL for hCaptcha labeling verification. Required -HCAPTCHA_LABELING_STATS_API_URL= - -### The API key for hCaptcha labeling. Required -HCAPTCHA_LABELING_VERIFY_API_URL= - -### The list of enabled chain IDs. Required -HCAPTCHA_LABELING_API_KEY= - -### Flag indicating if the cache should be restarted. Default: false -CHAIN_IDS_ENABLED="false" - -### The email address for the human app. Required -IS_CACHE_TO_RESTART= - -### The secret key for Reputation Oracle. Required -HUMAN_APP_SECRET_KEY= - -### Feature flag for job discovery -MAX_EXECUTIONS_TO_SKIP= - -### The email address used for end-to-end (E2E) testing. Default: empty string -E2E_TESTING_EMAIL_ADDRESS="empty string" - -### The password used for end-to-end (E2E) testing. Default: empty string -E2E_TESTING_PASSWORD="empty string" - -### The URL of the exchange oracle service used for end-to-end (E2E) testing. Default: empty string -E2E_TESTING_EXCHANGE_ORACLE_URL="empty string" - -### The escrow address used for end-to-end (E2E) testing. Default: empty string -E2E_TESTING_ESCROW_ADDRESS="empty string" - -### The chain ID for the escrow service used for end-to-end (E2E) testing. Default: empty string -E2E_TESTING_ESCROW_CHAIN_ID="empty string" - diff --git a/packages/apps/human-app/server/docker-compose.yml b/packages/apps/human-app/server/docker-compose.yml deleted file mode 100644 index 70b3f4db38..0000000000 --- a/packages/apps/human-app/server/docker-compose.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'human-app-server' - -services: - human-app: - container_name: human-app - restart: unless-stopped - build: - context: ../../../../ - dockerfile: packages/apps/human-app/server/Dockerfile - expose: - - '${PORT}' - ports: - - '${LOCAL_PORT}:${PORT}' - environment: - NODE_ENV: ${NODE_ENV} - HOST: ${HOST} - PORT: ${PORT} - REPUTATION_ORACLE_URL: ${REPUTATION_ORACLE_URL} - REPUTATION_ORACLE_ADDRESS: ${REPUTATION_ORACLE_ADDRESS} - REDIS_PORT: ${REDIS_PORT} - REDIS_HOST: redis - CACHE_TTL_ORACLE_DISCOVERY: ${CACHE_TTL_ORACLE_DISCOVERY} - RPC_URL: ${RPC_URL} - depends_on: - - redis - redis: - image: redis:latest - container_name: human_app_cache - ports: - - '${REDIS_PORT}:6379' - volumes: - - ./redis_data:/data \ No newline at end of file diff --git a/packages/apps/human-app/server/src/app.module.ts b/packages/apps/human-app/server/src/app.module.ts index f6f3414bc2..245654afe5 100644 --- a/packages/apps/human-app/server/src/app.module.ts +++ b/packages/apps/human-app/server/src/app.module.ts @@ -52,7 +52,7 @@ const JOI_BOOLEAN_STRING_SCHEMA = Joi.string().valid('true', 'false'); @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: '.env', + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], isGlobal: true, validationSchema: Joi.object({ HOST: Joi.string().required(), @@ -81,7 +81,6 @@ const JOI_BOOLEAN_STRING_SCHEMA = Joi.string().valid('true', 'false'); .required(), HUMAN_APP_SECRET_KEY: Joi.string().required(), IS_AXIOS_REQUEST_LOGGING_ENABLED: JOI_BOOLEAN_STRING_SCHEMA, - ALLOWED_HOST: Joi.string().required(), CORS_ENABLED: JOI_BOOLEAN_STRING_SCHEMA, CORS_ALLOWED_ORIGIN: Joi.string(), CORS_ALLOWED_HEADERS: Joi.string(), diff --git a/packages/apps/job-launcher/client/.env.example b/packages/apps/job-launcher/client/.env.example index 7e3f7a2bb5..6c6209f0dc 100644 --- a/packages/apps/job-launcher/client/.env.example +++ b/packages/apps/job-launcher/client/.env.example @@ -1,20 +1,13 @@ -VITE_APP_JOB_LAUNCHER_SERVER_URL= -VITE_APP_WALLETCONNECT_PROJECT_ID= -VITE_APP_STRIPE_PUBLISHABLE_KEY= -VITE_APP_HCAPTCHA_SITE_KEY= -VITE_APP_ENVIRONMENT= -VITE_APP_SUPPORTED_CHAINS= +# General +VITE_APP_JOB_LAUNCHER_SERVER_URL=http://0.0.0.0:5003 +VITE_APP_WALLETCONNECT_PROJECT_ID=replace_me -# RPC URLS -VITE_APP_RPC_URL_MAINNET="" -VITE_APP_RPC_URL_SEPOLIA="" -VITE_APP_RPC_URL_BSC_MAINNET="" -VITE_APP_RPC_URL_BSC_TESTNET="" -VITE_APP_RPC_URL_POLYGON="" -VITE_APP_RPC_URL_POLYGON_AMOY="" -VITE_APP_RPC_URL_MOONBEAM="" -VITE_APP_RPC_URL_MOONBASE_ALPHA="" -VITE_APP_RPC_URL_AVALANCHE="" -VITE_APP_RPC_URL_AVALANCHE_TESTNET="" -VITE_APP_RPC_URL_CELO="" -VITE_APP_RPC_URL_CELO_ALFAJORES="" +# Stripe +VITE_APP_STRIPE_PUBLISHABLE_KEY=disabled + +# hCaptcha +VITE_APP_HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 + +# Web3 +VITE_APP_ENVIRONMENT=testnet +VITE_APP_SUPPORTED_CHAINS=80002 diff --git a/packages/apps/job-launcher/client/package.json b/packages/apps/job-launcher/client/package.json index 8b1b7aac3a..36bbddc8c3 100644 --- a/packages/apps/job-launcher/client/package.json +++ b/packages/apps/job-launcher/client/package.json @@ -44,7 +44,7 @@ "scripts": { "clean": "rm -rf dist", "lint": "eslint \"**/*.{ts,tsx}\"", - "start": "vite --port 3005", + "start": "vite", "build": "vite build", "preview": "vite preview", "start:prod": "serve -s dist", diff --git a/packages/apps/job-launcher/client/src/vite-env.d.ts b/packages/apps/job-launcher/client/src/vite-env.d.ts index 36339cae4f..a4d7339cd6 100644 --- a/packages/apps/job-launcher/client/src/vite-env.d.ts +++ b/packages/apps/job-launcher/client/src/vite-env.d.ts @@ -6,21 +6,6 @@ interface ImportMetaEnv { readonly VITE_APP_STRIPE_PUBLISHABLE_KEY: string; readonly VITE_APP_HCAPTCHA_SITE_KEY: string; readonly VITE_APP_ENVIRONMENT: string; - - readonly VITE_APP_RPC_URL_MAINNET: string; - readonly VITE_APP_RPC_URL_SEPOLIA: string; - readonly VITE_APP_RPC_URL_BSC_MAINNET: string; - readonly VITE_APP_RPC_URL_BSC_TESTNET: string; - readonly VITE_APP_RPC_URL_POLYGON: string; - readonly VITE_APP_RPC_URL_POLYGON_AMOY: string; - readonly VITE_APP_RPC_URL_MOONBEAM: string; - readonly VITE_APP_RPC_URL_MOONBASE_ALPHA: string; - readonly VITE_APP_RPC_URL_AVALANCHE: string; - readonly VITE_APP_RPC_URL_AVALANCHE_TESTNET: string; - readonly VITE_APP_RPC_URL_CELO: string; - readonly VITE_APP_RPC_URL_CELO_ALFAJORES: string; - readonly VITE_APP_RPC_URL_XLAYER: string; - readonly VITE_APP_RPC_URL_XLAYER_TESTNET: string; } interface ImportMeta { diff --git a/packages/apps/job-launcher/client/vite.config.ts b/packages/apps/job-launcher/client/vite.config.ts index a84bcaaa6b..07ac3961c7 100644 --- a/packages/apps/job-launcher/client/vite.config.ts +++ b/packages/apps/job-launcher/client/vite.config.ts @@ -38,6 +38,6 @@ export default defineConfig({ }, }, server: { - port: 3005, + port: 3002, }, }); diff --git a/packages/apps/job-launcher/server/.env.example b/packages/apps/job-launcher/server/.env.example index 84b6fa86f8..00453220c9 100644 --- a/packages/apps/job-launcher/server/.env.example +++ b/packages/apps/job-launcher/server/.env.example @@ -1,80 +1,101 @@ # General -NODE_ENV=development -HOST=localhost -PORT=3000 -FE_URL=http://localhost:3001 +HOST=0.0.0.0 +PORT=5003 +FE_URL=http://localhost:3002 # Database POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=operator +POSTGRES_PORT=5433 +POSTGRES_USER=default POSTGRES_PASSWORD=qwerty POSTGRES_DATABASE=job-launcher -POSTGRES_PORT=5432 POSTGRES_SSL=false -POSTGRES_LOGGING='all' + +# S3 +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=manifests +S3_USE_SSL=false # Web3 WEB3_ENV=testnet -WEB3_PRIVATE_KEY= -GAS_PRICE_MULTIPLIER=1 -PGP_PRIVATE_KEY= -PGP_ENCRYPT= -PGP_PASSPHRASE= -REPUTATION_ORACLE_ADDRESS= -CVAT_EXCHANGE_ORACLE_ADDRESS= -CVAT_RECORDING_ORACLE_ADDRESS= -AUDINO_EXCHANGE_ORACLE_ADDRESS= -AUDINO_RECORDING_ORACLE_ADDRESS= -HCAPTCHA_ORACLE_ADDRESS= -HCAPTCHA_RECORDING_ORACLE_URI= -HCAPTCHA_REPUTATION_ORACLE_URI= -HCAPTCHA_SITE_KEY= -RPC_URL_SEPOLIA= -RPC_URL_POLYGON= -RPC_URL_POLYGON_AMOY= -RPC_URL_BSC_MAINNET= -RPC_URL_BSC_TESTNET= -RPC_URL_MOONBEAM= -RPC_URL_XLAYER_TESTNET= -RPC_URL_XLAYER= -RPC_URL_LOCALHOST= +WEB3_PRIVATE_KEY=replace_me +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +REPUTATION_ORACLES=replace_me +REPUTATION_ORACLE_ADDRESS=replace_me +CVAT_EXCHANGE_ORACLE_ADDRESS=replace_me_if_needed +CVAT_RECORDING_ORACLE_ADDRESS=replace_me_if_needed +HCAPTCHA_ORACLE_ADDRESS=replace_me_if_needed +HCAPTCHA_RECORDING_ORACLE_URI=replace_me_if_needed +HCAPTCHA_REPUTATION_ORACLE_URI=replace_me_if_needed -# Auth -JWT_PRIVATE_KEY= -JWT_PUBLIC_KEY= -JWT_ACCESS_TOKEN_EXPIRES_IN=86400 -REFRESH_TOKEN_EXPIRES_IN=86400 -VERIFY_EMAIL_TOKEN_EXPIRES_IN=86400 -FORGOT_PASSWORD_TOKEN_EXPIRES_IN=86400 +# Encryption +PGP_ENCRYPT=true +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- -# APIKEY -APIKEY_ITERATIONS= -APIKEY_KEY_LENGTH= +lIYEZ4+zchYJKwYBBAHaRw8BAQdA1ql3NCl4pZANEvM3jaxoHLeh5t0PM237WLkG +hCoxjK7+BwMCBJL1H5pd3HT/JxeY7rqJs8sfBOfMbbAxRds/uLdMgGcVzjpj7htU +yzg7PHhWESAgycZmk9QpjgEQYlHl7KbZNNidG1zdCKX9GDce6W5PB7QlSm9iIExh +dW5jaGVyIDxqb2ItbGF1bmNoZXJAbG9jYWwuYXBwPoiTBBMWCgA7FiEEUlUidK34 +MNfYCc0xkWfqgp0A/m4FAmePs3ICGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcC +F4AACgkQkWfqgp0A/m7q3wD/V7G/uxy7LZOX9aW2uPcYfRInVDcyElwJza0Pcken +9qEBAJF0XBJJHkOVOyfmPv5nqAJ3DI6kRiHml+Ri3VjQp24OnIsEZ4+zchIKKwYB +BAGXVQEFAQEHQAGE7HHBGkVnFFPHpXdC/2uY+DC1vMkqTy8fzY0k2jQhAwEIB/4H +AwKFPSSA1sF9iP+Aepg/tiJFDyGqJsSKFlvj07zHjSKxeIOGcuC1llJCju70AcR5 +cQ3itvWUrDIpwI3GnHTy5k183GIIt2cRhLRnLUqIWXLliHgEGBYKACAWIQRSVSJ0 +rfgw19gJzTGRZ+qCnQD+bgUCZ4+zcgIbDAAKCRCRZ+qCnQD+bsXqAP0duGYm6z58 +mBdnv9k5Ed2wEw5hFnjcKXEQBFcMORVgdgD/RssEZjY0Vli5ofBezTOvURLAZRY2 +FryLSAroIMtuIAk= +=of7b +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=ixS5G0GE8Eh!fn +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- -# S3 -S3_ENDPOINT=localhost -S3_PORT=9000 -S3_ACCESS_KEY=access-key -S3_SECRET_KEY=secret-key -S3_BUCKET=manifests -S3_USE_SSL=false +mDMEZ4+zchYJKwYBBAHaRw8BAQdA1ql3NCl4pZANEvM3jaxoHLeh5t0PM237WLkG +hCoxjK60JUpvYiBMYXVuY2hlciA8am9iLWxhdW5jaGVyQGxvY2FsLmFwcD6IkwQT +FgoAOxYhBFJVInSt+DDX2AnNMZFn6oKdAP5uBQJnj7NyAhsDBQsJCAcCAiICBhUK +CQgLAgQWAgMBAh4HAheAAAoJEJFn6oKdAP5u6t8A/1exv7scuy2Tl/Wltrj3GH0S +J1Q3MhJcCc2tD3JHp/ahAQCRdFwSSR5DlTsn5j7+Z6gCdwyOpEYh5pfkYt1Y0Kdu +Drg4BGePs3ISCisGAQQBl1UBBQEBB0ABhOxxwRpFZxRTx6V3Qv9rmPgwtbzJKk8v +H82NJNo0IQMBCAeIeAQYFgoAIBYhBFJVInSt+DDX2AnNMZFn6oKdAP5uBQJnj7Ny +AhsMAAoJEJFn6oKdAP5uxeoA/R24ZibrPnyYF2e/2TkR3bATDmEWeNwpcRAEVww5 +FWB2AP9GywRmNjRWWLmh8F7NM69REsBlFjYWvItICuggy24gCQ== +=d9DF +-----END PGP PUBLIC KEY BLOCK-----" + +# Auth +JWT_PRIVATE_KEY="-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgjwW8ZeWIKizY9pSl +phyKfwYFp3aRHeMuV+jOKp49hX6hRANCAATeitytad5Rh0tx6AP/VHptsRvsZ+Xp +/24PICdk4nsMxZEAe76InmWdqhud13JV76Jl02DVenFEJVM5IjRk+mLG +-----END PRIVATE KEY-----" +JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3orcrWneUYdLcegD/1R6bbEb7Gfl +6f9uDyAnZOJ7DMWRAHu+iJ5lnaobnddyVe+iZdNg1XpxRCVTOSI0ZPpixg== +-----END PUBLIC KEY-----" + +# hCaptcha +HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 +HCAPTCHA_SECRET=0x0000000000000000000000000000000000000000 # Stripe -STRIPE_SECRET_KEY= -STRIPE_API_VERSION= -STRIPE_APP_NAME= -STRIPE_APP_VERSION= -STRIPE_APP_INFO_URL= +STRIPE_SECRET_KEY=disabled +STRIPE_APP_NAME=Launcher Server Local +STRIPE_APP_VERSION=1.0.0 +STRIPE_APP_INFO_URL=http://local.app # Sendgrid -SENDGRID_API_KEY= +SENDGRID_API_KEY=sendgrid-disabled # Vision -GOOGLE_PROJECT_ID= -GOOGLE_PRIVATE_KEY= -GOOGLE_CLIENT_EMAIL= -GCV_MODERATION_RESULTS_FILES_PATH= -GCV_MODERATION_RESULTS_BUCKET= +GOOGLE_PROJECT_ID=disabled +GOOGLE_PRIVATE_KEY=disabled +GOOGLE_CLIENT_EMAIL=disabled +GCV_MODERATION_RESULTS_FILES_PATH=disabled +GCV_MODERATION_RESULTS_BUCKET=disabled # Slack -SLACK_ABUSE_NOTIFICATION_WEBHOOK_URL= \ No newline at end of file +SLACK_ABUSE_NOTIFICATION_WEBHOOK_URL=disabled diff --git a/packages/apps/job-launcher/server/ENV.md b/packages/apps/job-launcher/server/ENV.md deleted file mode 100644 index 398fc7302b..0000000000 --- a/packages/apps/job-launcher/server/ENV.md +++ /dev/null @@ -1,203 +0,0 @@ -# Environment Variables - -### The private key used for signing JSON Web Tokens (JWT). Required -JWT_PRIVATE_KEY= - -### The public key used for verifying JSON Web Tokens (JWT). Required -JWT_PUBLIC_KEY= - -### The expiration time (in seconds) for access tokens. Default: 600 -JWT_ACCESS_TOKEN_EXPIRES_IN="600" - -### The expiration time (in seconds) for refresh tokens. Default: 3600 -REFRESH_TOKEN_EXPIRES_IN="3600" - -### The expiration time (in seconds) for email verification tokens. Default: 86400 -VERIFY_EMAIL_TOKEN_EXPIRES_IN="86400" - -### The expiration time (in seconds) for forgot password tokens. Default: 86400 -FORGOT_PASSWORD_TOKEN_EXPIRES_IN="86400" - -### The number of iterations used for generating API keys. Default: 1000 -APIKEY_ITERATIONS="1000" - -### The length of the API key in characters. Default: 64 -APIKEY_KEY_LENGTH="64" - -### The site key for hCaptcha, used for CAPTCHA protection. Required -HCAPTCHA_SITE_KEY= - -### The secret key for hCaptcha, used for verifying CAPTCHA responses. Required -HCAPTCHA_SECRET= - -### The URL for the hCaptcha protection service. Default: 'https://api.hcaptcha.com' -HCAPTCHA_PROTECTION_URL="https://api.hcaptcha.com" - -### The size of the job in CVAT, typically representing the number of items or tasks. Default: 10 -CVAT_JOB_SIZE="10" - -### The maximum allowed time (in seconds) for a CVAT job to be completed. Default: 300 -CVAT_MAX_TIME="300" - -### The size of validation jobs in CVAT, usually representing the number of validation items. Default: 2 -CVAT_VAL_SIZE="2" - -### The multiplier for the size of skeleton jobs in CVAT, used to scale the job size for skeleton tasks. Default: 6 -CVAT_SKELETONS_JOB_SIZE_MULTIPLIER="6" - -### The URL for connecting to the PostgreSQL database. -POSTGRES_URL= - -### The hostname or IP address of the PostgreSQL database server. Default: '127.0.0.1' -POSTGRES_HOST="127.0.0.1" - -### The port number on which the PostgreSQL database server is listening. Default: 5432 -POSTGRES_PORT="5432" - -### The username for authenticating with the PostgreSQL database. Default: 'operator' -POSTGRES_USER="operator" - -### The password for authenticating with the PostgreSQL database. Default: 'qwerty' -POSTGRES_PASSWORD="qwerty" - -### The name of the PostgreSQL database to connect to. Default: 'job-launcher' -POSTGRES_DATABASE="job-launcher" - -### Indicates whether to use SSL for connections to the PostgreSQL database. Default: false -POSTGRES_SSL="false" - -### The logging level for PostgreSQL operations (e.g., 'debug', 'info'). Default: 'log,info,warn,error' -POSTGRES_LOGGING="log,info,warn,error" - -### The RPC URL for the Sepolia network. -RPC_URL_SEPOLIA= - -### The RPC URL for the Polygon network. -RPC_URL_POLYGON= - -### The RPC URL for the Polygon Amoy network. -RPC_URL_POLYGON_AMOY= - -### The RPC URL for the BSC Mainnet network. -RPC_URL_BSC_MAINNET= - -### The RPC URL for the BSC Testnet network. -RPC_URL_BSC_TESTNET= - -### The RPC URL for the Localhost network. -RPC_URL_LOCALHOST= - -### Indicates whether PGP encryption should be used. Default: false -PGP_ENCRYPT="false" - -### The private key used for PGP encryption or decryption. -PGP_PRIVATE_KEY= - -### The passphrase associated with the PGP private key. -PGP_PASSPHRASE= - -### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1' -S3_ENDPOINT="127.0.0.1" - -### The port number for connecting to the S3 service. Default: 9000 -S3_PORT="9000" - -### The access key ID used to authenticate requests to the S3 service. Required -S3_ACCESS_KEY= - -### The secret access key used to authenticate requests to the S3 service. Required -S3_SECRET_KEY= - -### The name of the S3 bucket where files will be stored. Default: 'launcher' -S3_BUCKET="launcher" - -### Indicates whether to use SSL (HTTPS) for connections to the S3 service. Default: false -S3_USE_SSL="false" - -### The API key used for authenticating requests to the SendGrid API. Required -SENDGRID_API_KEY= - -### The email address that will be used as the sender's address in emails sent via SendGrid. Default: 'job-launcher@hmt.ai' -SENDGRID_FROM_EMAIL="job-launcher@hmt.ai" - -### The name that will be used as the sender's name in emails sent via SendGrid. Default: 'Human Protocol Job Launcher' -SENDGRID_FROM_NAME="Human Protocol Job Launcher" - -### The environment in which the server is running (e.g., 'development', 'production'). Default: 'development' -NODE_ENV="development" - -### The hostname or IP address on which the server will run. Default: 'localhost' -HOST="localhost" - -### The port number on which the server will listen for incoming connections. Default: 5000 -PORT="5000" - -### The URL of the frontend application that the server will communicate with. Default: 'http://localhost:3005' -FE_URL="http://localhost:3005" - -### The maximum number of retry attempts for certain operations. Default: 5 -MAX_RETRY_COUNT="5" - -### The minimum transaction fee in USD. Default: 0.01 -MINIMUM_FEE_USD="0.01" - -### The time (in seconds) for which rate information will be cached. Default: 30 -RATE_CACHE_TIME="30" - -### The API key for accessing CoinGecko data. -COINGECKO_API_KEY= - -### The amount to charge abusive users. -ABUSE_AMOUNT= - -### The secret key used for authenticating requests to the Stripe API. Required -STRIPE_SECRET_KEY= - -### The version of the Stripe API to use for requests. Default: '2022-11-15' -STRIPE_API_VERSION="2022-11-15" - -### The name of the application interacting with the Stripe API. Default: 'Fortune' -STRIPE_APP_NAME="Fortune" - -### The version of the application interacting with the Stripe API. Default: '0.0.1' -STRIPE_APP_VERSION="0.0.1" - -### The URL of the application's information page. Default: 'https://hmt.ai' -STRIPE_APP_INFO_URL="https://hmt.ai" - -### The environment in which the Web3 application is running. Default: 'testnet' -WEB3_ENV="testnet" - -### The private key used for signing transactions. Required -WEB3_PRIVATE_KEY= - -### Multiplier for gas price adjustments. Default: 1 -GAS_PRICE_MULTIPLIER="1" - -### Address of the reputation oracle contract. Required -REPUTATION_ORACLE_ADDRESS= - -### List of reputation oracle addresses, typically comma-separated. Required -REPUTATION_ORACLES= - -### Address of the CVAT exchange oracle contract. Required -CVAT_EXCHANGE_ORACLE_ADDRESS= - -### Address of the CVAT recording oracle contract. Required -CVAT_RECORDING_ORACLE_ADDRESS= - -### Address of the Audino exchange oracle contract. Required -AUDINO_EXCHANGE_ORACLE_ADDRESS= - -### Address of the Audino recording oracle contract. Required -AUDINO_RECORDING_ORACLE_ADDRESS= - -### Address of the hCaptcha oracle contract. Required -HCAPTCHA_ORACLE_ADDRESS= - -### URI for the hCaptcha recording oracle service. Required -HCAPTCHA_RECORDING_ORACLE_URI= - -### URI for the hCaptcha reputation oracle service. Required -HCAPTCHA_REPUTATION_ORACLE_URI= - diff --git a/packages/apps/job-launcher/server/README.md b/packages/apps/job-launcher/server/README.md index c9a5b013ca..116445661c 100644 --- a/packages/apps/job-launcher/server/README.md +++ b/packages/apps/job-launcher/server/README.md @@ -57,12 +57,12 @@ yarn migration:run ``` ### Set up the database with Docker - -To run with docker, you need to enter the following command, which raises the container with postgres and runs the migrations: +To run with docker, you need to enter the following command, which raises necessary infra containers: ```bash -yarn docker:db:up +yarn workspace human-protocol docker:infra-up ``` +After that you can run migration. ## 🚀 Usage @@ -111,16 +111,6 @@ $ yarn migration:run $ yarn migration:show ``` -### Docker - -```bash -# Up a postgres container and run migrations -$ docker:db:up - -# Down postgres container -$ docker:db:down -``` - ## 📚 Documentation For detailed information about the Exchange Oracle, please refer to the [Human Protocol Tech Docs](https://human-protocol.gitbook.io/hub/human-tech-docs/architecture/components/job-launcher). diff --git a/packages/apps/job-launcher/server/docker-compose.yml b/packages/apps/job-launcher/server/docker-compose.yml deleted file mode 100644 index a8c9a7b86b..0000000000 --- a/packages/apps/job-launcher/server/docker-compose.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: '3.8' -services: - postgres: - container_name: postgres - image: postgres:latest - restart: always - logging: - options: - max-size: 10m - max-file: "3" - ports: - - 5432:5432 - # volumes: - # - ./db:/var/lib/postgresql/data - environment: - POSTGRES_DB: ${POSTGRES_DATABASE} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_USER: ${POSTGRES_USER} - minio: - container_name: minio - image: minio/minio:RELEASE.2022-05-26T05-48-41Z - ports: - - 9001:9001 - - 9000:9000 - entrypoint: 'sh' - command: - -c "minio server /data --console-address ':9001'" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 5s - timeout: 5s - retries: 3 - minio-mc: - container_name: minio-mc - image: minio/mc - depends_on: - minio: - condition: service_healthy - entrypoint: > - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 minioadmin minioadmin; - /usr/bin/mc mb myminio/manifests; - /usr/bin/mc anonymous set public myminio/manifests; - " - # job-launcher: - # container_name: job-launcher - # restart: unless-stopped - # build: - # context: ../../../../ - # dockerfile: packages/apps/job-launcher/server/Dockerfile - # expose: - # - '${PORT}' - # ports: - # - '${LOCAL_PORT}:${PORT}' - # env_file: - # - path: ./.env.development - # required: true # default diff --git a/packages/apps/job-launcher/server/package.json b/packages/apps/job-launcher/server/package.json index 11f11e9a82..76da90322b 100644 --- a/packages/apps/job-launcher/server/package.json +++ b/packages/apps/job-launcher/server/package.json @@ -18,9 +18,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 postgres && yarn migration:run", - "docker:db:down": "docker compose down", "setup:local": "ts-node ./test/setup.ts", + "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "lint": "eslint \"{src,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", @@ -54,9 +53,11 @@ "class-transformer": "^0.5.1", "class-validator": "0.14.1", "decimal.js": "^10.4.3", + "dotenv": "^16.3.2", "helmet": "^7.1.0", "joi": "^17.13.3", "json-stable-stringify": "^1.2.1", + "minio": "7.1.3", "nestjs-minio-client": "^2.2.0", "node-cache": "^5.1.2", "passport": "^0.7.0", diff --git a/packages/apps/job-launcher/server/scripts/setup-kv-store.ts b/packages/apps/job-launcher/server/scripts/setup-kv-store.ts new file mode 100644 index 0000000000..2312158bfa --- /dev/null +++ b/packages/apps/job-launcher/server/scripts/setup-kv-store.ts @@ -0,0 +1,157 @@ +import 'dotenv/config'; +import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import { Wallet, ethers } from 'ethers'; +import * as Minio from 'minio'; + +const DEFAULT_SUPPORTED_JOB_TYPES = + 'fortune,image_boxes,image_boxes_from_points,image_points,image_polygons,image_skeletons_from_boxes'; +const ROLE = Role.JobLauncher; + +async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { + const { + SUPPORTED_JOB_TYPES = DEFAULT_SUPPORTED_JOB_TYPES, + SERVER_URL = 'http://localhost:5003', + FEE = '1', + } = process.env; + + if (SUPPORTED_JOB_TYPES.split(',').length === 0) { + throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); + } + try { + new URL(SERVER_URL || ''); + } catch (_noop) { + throw new Error('Invalid SERVER_URL'); + } + let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + if (!url.startsWith('http')) { + url = `http://${url}`; + } + + const fee = Number(FEE); + if (!Number.isInteger(fee) || fee < 1) { + throw new Error('Fee must be positive integer'); + } + + await kvStoreClient.setBulk( + [ + KVStoreKeys.role, + KVStoreKeys.fee, + KVStoreKeys.url, + KVStoreKeys.webhookUrl, + KVStoreKeys.jobTypes, + ], + [ROLE, fee.toString(), url, `${url}/webhook`, SUPPORTED_JOB_TYPES], + ); +} + +type SetupPublicKeyFileMeta = { + keyName: string; + publicKey: string; + s3Bucket: string; + s3Endpoint: string; + s3Port: string; + kvKey: string; +}; + +async function setupPublicKeyFile( + kvStoreClient: KVStoreClient, + minioClient: Minio.Client, + meta: SetupPublicKeyFileMeta, +): Promise { + const { keyName, kvKey, publicKey, s3Bucket, s3Endpoint, s3Port } = meta; + const exists = await minioClient.bucketExists(s3Bucket); + if (!exists) { + throw new Error('Bucket does not exists'); + } + + await minioClient.putObject(s3Bucket, keyName, publicKey, { + 'Content-Type': 'text/plain', + 'Cache-Control': 'no-store', + }); + /** + * Protocol is required for 'setFileUrlAndHash' + */ + const _s3Endpoint = s3Endpoint.startsWith('http') + ? s3Endpoint + : `http://${s3Endpoint}`; + const fileUrl = `${_s3Endpoint}:${s3Port}/${s3Bucket}/${keyName}`; + await kvStoreClient.setFileUrlAndHash(fileUrl, kvKey); +} + +async function setup(): Promise { + const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const kvStoreClient = await KVStoreClient.build(wallet); + + await setupCommonValues(kvStoreClient); + + const { + S3_ENDPOINT, + S3_PORT, + S3_USE_SSL, + S3_ACCESS_KEY, + S3_SECRET_KEY, + S3_BUCKET, + } = process.env; + + if ( + [S3_ENDPOINT, S3_PORT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET].some( + (value) => !value, + ) + ) { + throw new Error('Missing S3 config value'); + } + + const s3Endpoint = S3_ENDPOINT as string; + const s3Port = S3_PORT as string; + const s3AccessKey = S3_ACCESS_KEY as string; + const s3SecretKey = S3_SECRET_KEY as string; + const s3Bucket = S3_BUCKET as string; + + const minioClient = new Minio.Client({ + endPoint: s3Endpoint, + port: parseInt(s3Port, 10), + useSSL: S3_USE_SSL === 'true', + accessKey: s3AccessKey, + secretKey: s3SecretKey, + }); + + const { + PGP_ENCRYPT, + PGP_PUBLIC_KEY, + PGP_PUBLIC_KEY_FILE = 'pgp-public-key', + } = process.env; + if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (!PGP_PUBLIC_KEY) { + throw new Error('PGP public key is empty'); + } + + await setupPublicKeyFile(kvStoreClient, minioClient, { + s3Endpoint, + s3Port, + s3Bucket, + publicKey: PGP_PUBLIC_KEY, + keyName: PGP_PUBLIC_KEY_FILE, + kvKey: KVStoreKeys.publicKey, + }); + } +} + +(async () => { + try { + await setup(); + process.exit(0); + } catch (error) { + console.error('Failed to setup KV', error); + process.exit(1); + } +})(); diff --git a/packages/apps/job-launcher/server/src/app.module.ts b/packages/apps/job-launcher/server/src/app.module.ts index 322ef389d1..32fcb810cc 100644 --- a/packages/apps/job-launcher/server/src/app.module.ts +++ b/packages/apps/job-launcher/server/src/app.module.ts @@ -51,9 +51,10 @@ import { TransformEnumInterceptor } from './common/interceptors/transform-enum.i imports: [ ScheduleModule.forRoot(), ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], validationSchema: envValidator, }), DatabaseModule, diff --git a/packages/apps/job-launcher/server/src/common/config/server-config.service.ts b/packages/apps/job-launcher/server/src/common/config/server-config.service.ts index 50ff98a9c3..6f26a2a109 100644 --- a/packages/apps/job-launcher/server/src/common/config/server-config.service.ts +++ b/packages/apps/job-launcher/server/src/common/config/server-config.service.ts @@ -31,10 +31,10 @@ export class ServerConfigService { /** * The URL of the frontend application that the server will communicate with. - * Default: 'http://localhost:3005' + * Default: 'http://localhost:3002' */ get feURL(): string { - return this.configService.get('FE_URL', 'http://localhost:3005'); + return this.configService.get('FE_URL', 'http://localhost:3002'); } /** diff --git a/packages/apps/reputation-oracle/server/.env.example b/packages/apps/reputation-oracle/server/.env.example index 952da47ff0..e08449b539 100644 --- a/packages/apps/reputation-oracle/server/.env.example +++ b/packages/apps/reputation-oracle/server/.env.example @@ -1,89 +1,98 @@ # General -HOST=localhost -PORT=3008 -FE_URL=http://localhost:3009 -MAX_RETRY_COUNT=5 -QUALIFICATION_MIN_VALIDITY=1 +HOST=0.0.0.0 +PORT=5001 +FE_URL=http://localhost:3001 # Database POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=operator +POSTGRES_PORT=5433 +POSTGRES_USER=default POSTGRES_PASSWORD=qwerty POSTGRES_DATABASE=reputation-oracle -POSTGRES_SYNC=false -POSTGRES_PORT=5432 POSTGRES_SSL=false -POSTGRES_LOGGING='all' + +# S3 +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=reputation-oracle +S3_USE_SSL=false # Auth -JWT_PRIVATE_KEY="-----BEGIN EC PRIVATE KEY----- -MHcCAQEEIEwNR7Y1W3ftWIpgwqCvto5idqDIz9Sfw4enT8rxj5RRoAoGCCqGSM49 -AwEHoUQDQgAEaanJgehbzgHuQ9fbhv0K0pMZ5JwrBU5wq02mlVzAFyqf50VD36z/ -s0qK3aXoFe/jlDvdLRwcHyJSfhULefS42g== ------END EC PRIVATE KEY-----" +JWT_PRIVATE_KEY="-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg9T4TcNz4sFIvOZTE +wBHX986G90H20Cryp4++7APQfu6hRANCAASQ96QPer3ose3gh+9jVRjVi6RN4R8r +5evI9eFTnucq6FlcE9GtD6UwN4WlikdakaoD8rnvqf6sO+NsGAd9CIcq +-----END PRIVATE KEY-----" JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEaanJgehbzgHuQ9fbhv0K0pMZ5Jwr -BU5wq02mlVzAFyqf50VD36z/s0qK3aXoFe/jlDvdLRwcHyJSfhULefS42g== +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkPekD3q96LHt4IfvY1UY1YukTeEf +K+XryPXhU57nKuhZXBPRrQ+lMDeFpYpHWpGqA/K576n+rDvjbBgHfQiHKg== -----END PUBLIC KEY-----" -JWT_ACCESS_TOKEN_EXPIRES_IN=1000000000 -JWT_REFRESH_TOKEN_EXPIRES_IN=1000000000 - # HCaptcha HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 -HCAPTCHA_API_KEY=test HCAPTCHA_SECRET=0x0000000000000000000000000000000000000000 +HCAPTCHA_API_KEY=replace_me_if_needed - -# S3 -S3_ENDPOINT=localhost -S3_PORT=9000 -S3_ACCESS_KEY=dev -S3_SECRET_KEY=devdevdev -S3_BUCKET=reputation -S3_USE_SSL=false +# KYC +KYC_API_KEY=disabled +KYC_API_PRIVATE_KEY=none # Email -SENDGRID_API_KEY= -EMAIL_FROM=test@example.com -EMAIL_FROM_NAME="Reputation oracle" +SENDGRID_API_KEY=disabled +EMAIL_FROM=reputation-oracle@local.app +EMAIL_FROM_NAME="Reputation Oracle Local" # Web3 WEB3_ENV=testnet -WEB3_PRIVATE_KEY= -GAS_PRICE_MULTIPLIER= -RPC_URL_SEPOLIA= -RPC_URL_POLYGON= -RPC_URL_POLYGON_AMOY= -RPC_URL_BSC_MAINNET= -RPC_URL_BSC_TESTNET= -RPC_URL_MOONBEAM= -RPC_URL_XLAYER= -RPC_URL_LOCALHOST= -RPC_URL_XLAYER_TESTNET= - -# Reputation Level -REPUTATION_LEVEL_LOW=300 -REPUTATION_LEVEL_HIGH=700 +WEB3_PRIVATE_KEY=replace_me +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology # Encryption -PGP_PRIVATE_KEY= -PGP_PASSPHRASE= -PGP_ENCRYPT= +PGP_ENCRYPT=true +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +lIYEZ4lbOhYJKwYBBAHaRw8BAQdAgyoVs1EoBCW7THMZLKJ8wVIXqINDDp0dQMoh +DXV0iTH+BwMCb6qyWpKmegj/IpdlppS+qycJNtMQ6RDaSZlMsq+UTRBEM64jxs3y +EKOI8P9sCP1qBJl1wIWCifBSmTAKcTeOIuLB4P6cljz8DSo3D4lxM7RXUmVwdXRh +dGlvbiBPcmFjbGUgKEV4YW1wbGUgcGdwIGtleSBmb3IgcmVwdXRhdGlvbiBvcmFj +bGUpIDxyZXB1dGF0aW9uLW9yYWNsZUBobXQubG9jYWw+iJMEExYKADsWIQTYqYVR +HpEWi8IdtKTm/YtkpDwV7QUCZ4lbOgIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIe +BwIXgAAKCRDm/YtkpDwV7b4pAQCmCmKS7PyC3DKwt65bo7iFEc4ZPrVC3SElktaM +sONZ5gEAzl292RHsJFlN3fhm7w5PM6eCqwkuBq7GchWFfz0oYAWciwRniVs6Egor +BgEEAZdVAQUBAQdAvuHJsFMJQJKNud0PBglT26Tq+fx2yM1+fYvrzTuqwhYDAQgH +/gcDAqscEWOQgpOz//4EYtR175elc/o1/0XqW74aSScCylvAMWa3QQ/TU7m39TiD +P45fKGJAYPXJEYCz36g+NSeLP1iZyWQAkweEZoQERWLgbpaIeAQYFgoAIBYhBNip +hVEekRaLwh20pOb9i2SkPBXtBQJniVs6AhsMAAoJEOb9i2SkPBXtDBUA/31dsyJ7 +AxylargNkQx/Q/5Ws/WaIT1zRJauE9kpO71iAP98o89Exq+rc268uXSN+2/edJ/D +Sq+xksFikJ/P/WeXBg== +=kI8h +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=avg3GJT-asd5kgk_kgx +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- -# Synaps Kyc -SYNAPS_API_KEY= -SYNAPS_WEBHOOK_SECRET= -SYNAPS_BASE_URL= -SYNAPS_STEP_DOCUMENT_ID= +mDMEZ4lbOhYJKwYBBAHaRw8BAQdAgyoVs1EoBCW7THMZLKJ8wVIXqINDDp0dQMoh +DXV0iTG0V1JlcHV0YXRpb24gT3JhY2xlIChFeGFtcGxlIHBncCBrZXkgZm9yIHJl +cHV0YXRpb24gb3JhY2xlKSA8cmVwdXRhdGlvbi1vcmFjbGVAaG10LmxvY2FsPoiT +BBMWCgA7FiEE2KmFUR6RFovCHbSk5v2LZKQ8Fe0FAmeJWzoCGwMFCwkIBwICIgIG +FQoJCAsCBBYCAwECHgcCF4AACgkQ5v2LZKQ8Fe2+KQEApgpikuz8gtwysLeuW6O4 +hRHOGT61Qt0hJZLWjLDjWeYBAM5dvdkR7CRZTd34Zu8OTzOngqsJLgauxnIVhX89 +KGAFuDgEZ4lbOhIKKwYBBAGXVQEFAQEHQL7hybBTCUCSjbndDwYJU9uk6vn8dsjN +fn2L6807qsIWAwEIB4h4BBgWCgAgFiEE2KmFUR6RFovCHbSk5v2LZKQ8Fe0FAmeJ +WzoCGwwACgkQ5v2LZKQ8Fe0MFQD/fV2zInsDHKVquA2RDH9D/laz9ZohPXNElq4T +2Sk7vWIA/3yjz0TGr6tzbry5dI37b950n8NKr7GSwWKQn8/9Z5cG +=SrHM +-----END PGP PUBLIC KEY BLOCK-----" # Slack notifications -ABUSE_SLACK_WEBHOOK_URL= -ABUSE_SLACK_OAUTH_TOKEN= -ABUSE_SLACK_SIGNING_SECRET= +ABUSE_SLACK_WEBHOOK_URL=http://disabled-for-local.app +ABUSE_SLACK_SIGNING_SECRET=disabled +ABUSE_SLACK_OAUTH_TOKEN=disabled # NDA -NDA_URL= +NDA_URL=https://humanprotocol.org # HUMAN App secret key for auth in RepO HUMAN_APP_SECRET_KEY=sk_example_1VwUpBMO8H0v4Pmu4TPiWFEwuMguW4PkozSban4Rfbc diff --git a/packages/apps/reputation-oracle/server/README.md b/packages/apps/reputation-oracle/server/README.md index 8b6523ca59..1ef93bdeb7 100644 --- a/packages/apps/reputation-oracle/server/README.md +++ b/packages/apps/reputation-oracle/server/README.md @@ -57,12 +57,12 @@ yarn migration:run ``` ### Set up the database with Docker - -To run with docker, you need to enter the following command, which raises the container with postgres and runs the migrations: +To run with docker, you need to enter the following command, which raises necessary infra containers: ```bash -yarn docker:db:up +yarn workspace human-protocol docker:infra-up ``` +After that you can run migration. ## 🚀 Usage diff --git a/packages/apps/reputation-oracle/server/docker-compose.yml b/packages/apps/reputation-oracle/server/docker-compose.yml deleted file mode 100644 index f3b01e2911..0000000000 --- a/packages/apps/reputation-oracle/server/docker-compose.yml +++ /dev/null @@ -1,85 +0,0 @@ -version: '3.8' - -services: - postgres: - container_name: postgres - image: postgres:latest - restart: always - environment: - - POSTGRES_HOST=${POSTGRES_HOST} - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DB=${POSTGRES_DATABASE} - - POSTGRES_PORT=${POSTGRES_PORT} - - POSTGRES_SYNC=${POSTGRES_SYNC} - logging: - options: - max-size: 10m - max-file: "3" - ports: - - '${POSTGRES_PORT}:${POSTGRES_PORT}' - # volumes: - # - ./db:/var/lib/postgresql/data - - minio: - container_name: minio - image: minio/minio:RELEASE.2022-05-26T05-48-41Z - ports: - - 9001:9001 - - 9000:9000 - entrypoint: 'sh' - command: - -c "minio server /data --console-address ':9001'" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 5s - timeout: 5s - retries: 3 - minio-mc: - container_name: minio-mc - image: minio/mc - depends_on: - minio: - condition: service_healthy - entrypoint: > - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 minioadmin minioadmin; - /usr/bin/mc mb myminio/reputation; - /usr/bin/mc anonymous set public myminio/reputation; - " - reputation-oracle: - container_name: reputation-oracle - restart: unless-stopped - build: - context: ../../../../ - dockerfile: packages/apps/reputation-oracle/server/Dockerfile - expose: - - '${PORT}' - ports: - - '${LOCAL_PORT}:${PORT}' - environment: - NODE_ENV: ${NODE_ENV} - HOST: ${HOST} - PORT: ${PORT} - FE_URL: ${FE_URL} - SESSION_SECRET: ${SESSION_SECRET} - POSTGRES_HOST: ${POSTGRES_HOST} - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DATABASE: ${POSTGRES_DATABASE} - POSTGRES_SSL: ${POSTGRES_SSL} - POSTGRES_SYNC: ${POSTGRES_SYNC} - POSTGRES_PORT: ${POSTGRES_PORT} - WEB3_PRIVATE_KEY: ${WEB3_PRIVATE_KEY} - JWT_SECRET: ${JWT_SECRET} - JWT_ACCESS_TOKEN_EXPIRES_IN: ${JWT_ACCESS_TOKEN_EXPIRES_IN} - JWT_REFRESH_TOKEN_EXPIRES_IN: ${JWT_REFRESH_TOKEN_EXPIRES_IN} - S3_ENDPOINT: ${S3_ENDPOINT} - S3_PORT: ${S3_PORT} - S3_ACCESS_KEY: ${S3_ACCESS_KEY} - S3_SECRET_KEY: ${S3_SECRET_KEY} - S3_BUCKET: ${S3_BUCKET} - S3_USE_SSL: ${S3_USE_SSL} - SENDGRID_API_KEY: ${SENDGRID_API_KEY} - REPUTATION_LEVEL_LOW: ${REPUTATION_LEVEL_LOW} - REPUTATION_LEVEL_HIGH: ${REPUTATION_LEVEL_HIGH} \ No newline at end of file diff --git a/packages/apps/reputation-oracle/server/package.json b/packages/apps/reputation-oracle/server/package.json index 2ebd5736bb..f4d91c2a12 100644 --- a/packages/apps/reputation-oracle/server/package.json +++ b/packages/apps/reputation-oracle/server/package.json @@ -18,9 +18,8 @@ "migration:revert": "yarn build && typeorm-ts-node-commonjs migration:revert -d typeorm-migrations-datasource.ts", "migration:run": "yarn build && typeorm-ts-node-commonjs migration:run -d typeorm-migrations-datasource.ts", "migration:show": "yarn build && typeorm-ts-node-commonjs migration:show -d typeorm-migrations-datasource.ts", - "docker:db:up": "docker compose up -d postgres && yarn migration:run", - "docker:db:down": "docker compose down postgres", "setup:local": "ts-node ./scripts/setup-kv-store.ts", + "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", diff --git a/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts b/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts index cd51e5822d..38e117cc00 100644 --- a/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts +++ b/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts @@ -3,10 +3,18 @@ import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; import { Wallet, ethers } from 'ethers'; import * as Minio from 'minio'; +const DEFAULT_SUPPORTED_JOB_TYPES = + 'fortune,image_boxes,image_boxes_from_points,image_points,image_polygons,image_skeletons_from_boxes'; +const ROLE = Role.ReputationOracle; + async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { - const { SUPPORTED_JOB_TYPES = '', SERVER_URL = '', FEE = '' } = process.env; + const { + SUPPORTED_JOB_TYPES = DEFAULT_SUPPORTED_JOB_TYPES, + SERVER_URL = 'http://localhost:5001', + FEE = '1', + } = process.env; - if (!SUPPORTED_JOB_TYPES || SUPPORTED_JOB_TYPES.split(',').length === 0) { + if (SUPPORTED_JOB_TYPES.split(',').length === 0) { throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); } try { @@ -32,13 +40,7 @@ async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { KVStoreKeys.webhookUrl, KVStoreKeys.jobTypes, ], - [ - Role.ReputationOracle, - `${fee}`, - url, - `${url}/webhook`, - SUPPORTED_JOB_TYPES, - ], + [ROLE, fee.toString(), url, `${url}/webhook`, SUPPORTED_JOB_TYPES], ); } @@ -77,7 +79,7 @@ async function setupPublicKeyFile( } async function setup(): Promise { - const { WEB3_PRIVATE_KEY, RPC_URL } = process.env; + const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; if (!WEB3_PRIVATE_KEY) { throw new Error('Private key is empty'); } @@ -108,24 +110,26 @@ async function setup(): Promise { ) { throw new Error('Missing S3 config value'); } - if (!S3_ACCESS_KEY || !S3_SECRET_KEY) { - throw new Error('S3 key is missing'); - } - if (!S3_BUCKET) { - throw new Error('S3 bucket is missing'); - } - const s3Endpoint = S3_ENDPOINT || 'localhost'; - const s3Port = S3_PORT || '9000'; + const s3Endpoint = S3_ENDPOINT as string; + const s3Port = S3_PORT as string; + const s3AccessKey = S3_ACCESS_KEY as string; + const s3SecretKey = S3_SECRET_KEY as string; + const s3Bucket = S3_BUCKET as string; + const minioClient = new Minio.Client({ endPoint: s3Endpoint, port: parseInt(s3Port, 10), useSSL: S3_USE_SSL === 'true', - accessKey: S3_ACCESS_KEY, - secretKey: S3_SECRET_KEY, + accessKey: s3AccessKey, + secretKey: s3SecretKey, }); - const { PGP_ENCRYPT, PGP_PUBLIC_KEY } = process.env; + const { + PGP_ENCRYPT, + PGP_PUBLIC_KEY, + PGP_PUBLIC_KEY_FILE = 'pgp-public-key', + } = process.env; if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { if (!PGP_PUBLIC_KEY) { throw new Error('PGP public key is empty'); @@ -133,9 +137,9 @@ async function setup(): Promise { await setupPublicKeyFile(kvStoreClient, minioClient, { s3Endpoint, s3Port, - s3Bucket: S3_BUCKET, + s3Bucket, publicKey: PGP_PUBLIC_KEY, - keyName: 'pgp-public-key', + keyName: PGP_PUBLIC_KEY_FILE, kvKey: KVStoreKeys.publicKey, }); } @@ -147,7 +151,7 @@ async function setup(): Promise { await setupPublicKeyFile(kvStoreClient, minioClient, { s3Endpoint, s3Port, - s3Bucket: S3_BUCKET, + s3Bucket, publicKey: JWT_PUBLIC_KEY, keyName: 'jwt-public-key', kvKey: 'jwt_public_key', diff --git a/packages/apps/staking/.env.example b/packages/apps/staking/.env.example index 611f637438..6108cf5bc5 100644 --- a/packages/apps/staking/.env.example +++ b/packages/apps/staking/.env.example @@ -1,15 +1,19 @@ -VITE_APP_DASHBOARD_API_URL= +# General +VITE_APP_DASHBOARD_API_URL=http://0.0.0.0:5006 VITE_APP_ENVIRONMENT=testnet VITE_APP_SUPPORTED_CHAINS=80002 -# links to header -VITE_HEADER_LINK_DASHBOARD= -# links to footer socials -VITE_FOOTER_LINK_GITHUB= -VITE_FOOTER_LINK_DISCORD= -VITE_FOOTER_LINK_X= -VITE_FOOTER_LINK_TELEGRAM= -VITE_FOOTER_LINK_LINKEDIN= -# other footer links -VITE_FOOTER_LINK_TERMS_OF_SERVICE= -VITE_FOOTER_LINK_PRIVACY_POLICY= -VITE_FOOTER_LINK_HUMAN_PROTOCOL= \ No newline at end of file + +# Links to header +VITE_HEADER_LINK_DASHBOARD=http://localhost:3004 + +# Links to footer socials +VITE_FOOTER_LINK_GITHUB=https://github.com/humanprotocol/human-protocol +VITE_FOOTER_LINK_DISCORD=https://discord.com/invite/5sHfvE8y8p +VITE_FOOTER_LINK_X=https://x.com/intent/follow?screen_name=human_protocol +VITE_FOOTER_LINK_TELEGRAM=https://t.me/human_protocol_community +VITE_FOOTER_LINK_LINKEDIN=https://www.linkedin.com/company/human-protocol + +# Other footer links +VITE_FOOTER_LINK_TERMS_OF_SERVICE=https://humanprotocol.org/privacy-policy +VITE_FOOTER_LINK_PRIVACY_POLICY=https://humanprotocol.org/privacy-policy +VITE_FOOTER_LINK_HUMAN_PROTOCOL=https://humanprotocol.org/ \ No newline at end of file diff --git a/packages/apps/staking/package.json b/packages/apps/staking/package.json index 71a7588241..f5336e073d 100644 --- a/packages/apps/staking/package.json +++ b/packages/apps/staking/package.json @@ -6,7 +6,7 @@ "scripts": { "clean": "rm -rf dist", "lint": "eslint \"**/*.{ts,tsx}\"", - "start": "vite --port 3006", + "start": "vite", "build": "vite build", "preview": "vite preview", "start:prod": "serve -s dist", diff --git a/packages/apps/staking/vite.config.ts b/packages/apps/staking/vite.config.ts index 546d38f7fe..fd034b78df 100644 --- a/packages/apps/staking/vite.config.ts +++ b/packages/apps/staking/vite.config.ts @@ -33,6 +33,6 @@ export default defineConfig({ }, }, server: { - port: 3006, + port: 3005, }, }); diff --git a/packages/examples/cvat/exchange-oracle/.dockerignore b/packages/examples/cvat/exchange-oracle/.dockerignore deleted file mode 100644 index ae6030127f..0000000000 --- a/packages/examples/cvat/exchange-oracle/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -# dockerfiles/.dockerignore - -# Exclude the .env file in the src directory -src/.env \ No newline at end of file diff --git a/packages/examples/cvat/exchange-oracle/src/.env.example b/packages/examples/cvat/exchange-oracle/src/.env.example new file mode 100644 index 0000000000..e3fa11e377 --- /dev/null +++ b/packages/examples/cvat/exchange-oracle/src/.env.example @@ -0,0 +1,93 @@ +# General +HOST=0.0.0.0 +PORT=5004 + +# Postgres config +PG_HOST=0.0.0.0 +PG_PORT=5433 +PG_USER=default +PG_PASSWORD=qwerty +PG_DB=exchange-oracle-cvat + +# Redis config +REDIS_HOST=0.0.0.0 +REDIS_PORT=6380 +REDIS_DB=2 + +# Storage Config (S3/GCS/Minio) +STORAGE_PROVIDER=aws +STORAGE_ENDPOINT_URL=minio:9000 +STORAGE_ACCESS_KEY=human-oracle +STORAGE_SECRET_KEY=human-oracle-s3-secret +STORAGE_BUCKET_NAME=cvat-exchange-oracle +STORAGE_USE_SSL=false + +# Polygon Amoy Config +POLYGON_AMOY_RPC_API_URL=https://rpc-amoy.polygon.technology +POLYGON_AMOY_PRIVATE_KEY=replace_me +POLYGON_AMOY_ADDR=replace_me + +# Cron Config +PROCESS_JOB_LAUNCHER_WEBHOOKS_INT=10 +PROCESS_RECORDING_ORACLE_WEBHOOKS_INT=10 +TRACK_COMPLETED_PROJECTS_INT=10 +TRACK_COMPLETED_TASKS_INT=10 +TRACK_COMPLETED_ESCROWS_INT=10 +TRACK_CREATING_TASKS_INT=10 +TRACK_ASSIGNMENTS_INT=10 +TRACK_ESCROW_CREATION_INT=10 +TRACK_ESCROW_VALIDATIONS_INT=10 + +# CVAT Config +CVAT_URL=http://cvat-lb:8080 +CVAT_ADMIN=human-protocol +CVAT_ADMIN_PASS=qwe123qwe123Q! +CVAT_ORG_SLUG=HumanAppLocal + +# Features +ENABLE_CUSTOM_CLOUD_HOST="yes" + +# Core +DEFAULT_ASSIGNMENT_TIME=600 + +# HUMAN App config +HUMAN_APP_JWT_KEY="-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkPekD3q96LHt4IfvY1UY1YukTeEf +K+XryPXhU57nKuhZXBPRrQ+lMDeFpYpHWpGqA/K576n+rDvjbBgHfQiHKg== +-----END PUBLIC KEY-----" + +# Encryption +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +lIYEZ4+21RYJKwYBBAHaRw8BAQdAgnSCXFMaftE221PbAvaliZTq+G5rTsAGjIpd +e8YOMBH+BwMCFUpbjvBTcm3/4iq8P/neJEdtL2uJ/OL8jNIOJ88yC7iokBzUZ+e6 +lhbmxybD+dxjuZf16iXzDjYYI2R/VnmKt4chtNqrt0X+DBx2a2DjfLQ/Y3ZhdC1l +eGNoYW5nZS1vcmFjbGVAbG9jYWwuYXBwIDxjdmF0LWV4Y2hhbmdlLW9yYWNsZUBs +b2NhbC5hcHA+iJMEExYKADsWIQSOUPmSUTqBxtsdHRxJkcIKPK7cJAUCZ4+21QIb +AwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgAAKCRBJkcIKPK7cJPhsAQCzUx0u +Sv+TkPWyn2zauMcMnffwzkTdC6v0nh3lsm6oewD/SnZVrFqIOoeBlUM57val6JwG +YyKKHt/mjISs2Dqo8wCciwRnj7bVEgorBgEEAZdVAQUBAQdAJjhRu8SX7Ryn+rYY +AkVxrBPI3GXQoWFSO/B4HopIJi0DAQgH/gcDAhXjA3yGYNM5/+uG9U29B/vFW2So +v7A4eMI+J+8/K8RObR2tTM3KEC7dXJKR9YTYqIVR10AwI4iR6XplSqjP2Un6jMlI +pSMN2l0vuJpxdzSIeAQYFgoAIBYhBI5Q+ZJROoHG2x0dHEmRwgo8rtwkBQJnj7bV +AhsMAAoJEEmRwgo8rtwkoLYBAJMZnNZqp+7uXomSguiPujFwgMobR1jXFsOASZF8 +HPLwAQD6uUWeuPdHXen+STls/0g4MI2jn2PwtAT/cpQ7tsoTDA== +=Uhu5 +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=SfR1I92e66G2OJoA +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEZ4+21RYJKwYBBAHaRw8BAQdAgnSCXFMaftE221PbAvaliZTq+G5rTsAGjIpd +e8YOMBG0P2N2YXQtZXhjaGFuZ2Utb3JhY2xlQGxvY2FsLmFwcCA8Y3ZhdC1leGNo +YW5nZS1vcmFjbGVAbG9jYWwuYXBwPoiTBBMWCgA7FiEEjlD5klE6gcbbHR0cSZHC +Cjyu3CQFAmePttUCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQSZHC +Cjyu3CT4bAEAs1MdLkr/k5D1sp9s2rjHDJ338M5E3Qur9J4d5bJuqHsA/0p2Vaxa +iDqHgZVDOe72peicBmMiih7f5oyErNg6qPMAuDgEZ4+21RIKKwYBBAGXVQEFAQEH +QCY4UbvEl+0cp/q2GAJFcawTyNxl0KFhUjvweB6KSCYtAwEIB4h4BBgWCgAgFiEE +jlD5klE6gcbbHR0cSZHCCjyu3CQFAmePttUCGwwACgkQSZHCCjyu3CSgtgEAkxmc +1mqn7u5eiZKC6I+6MXCAyhtHWNcWw4BJkXwc8vABAPq5RZ6490dd6f5JOWz/SDgw +jaOfY/C0BP9ylDu2yhMM +=YMyq +-----END PGP PUBLIC KEY BLOCK-----" +PGP_PUBLIC_KEY_URL=http://minio:9000/cvat-exchange-oracle/pgp-public-key diff --git a/packages/examples/cvat/recording-oracle/src/.env.example b/packages/examples/cvat/recording-oracle/src/.env.example new file mode 100644 index 0000000000..5ad1b49ccd --- /dev/null +++ b/packages/examples/cvat/recording-oracle/src/.env.example @@ -0,0 +1,82 @@ +# General +HOST=0.0.0.0 +PORT=5005 + +# Postgres config +PG_HOST=0.0.0.0 +PG_PORT=5433 +PG_USER=default +PG_PASSWORD=qwerty +PG_DB=recording + +# Polygon Amoy +POLYGON_AMOY_RPC_API_URL=https://rpc-amoy.polygon.technology +POLYGON_AMOY_PRIVATE_KEY=replace_me +POLYGON_AMOY_ADDR=replace_me + +# Cron jobs +PROCESS_EXCHANGE_ORACLE_WEBHOOKS_INT=10 +PROCESS_REPUTATION_ORACLE_WEBHOOKS_INT=10 + +# Storage Config (S3/GCS/Minio) +STORAGE_PROVIDER=aws +STORAGE_ENDPOINT_URL=minio:9000 +STORAGE_ACCESS_KEY=human-oracle +STORAGE_SECRET_KEY=human-oracle-s3-secret +STORAGE_BUCKET_NAME=cvat-exchange-oracle +STORAGE_USE_SSL=false +STORAGE_RESULTS_BUCKET_NAME=cvat-recording-oracle +STORAGE_USE_PATH_STYLE=true + +# Exchange Oracle Storage +STORAGE_BUCKET_NAME=cvat-exchange-oracle +EXCHANGE_ORACLE_STORAGE_PROVIDER=aws +EXCHANGE_ORACLE_STORAGE_ENDPOINT_URL=minio:9000 +EXCHANGE_ORACLE_STORAGE_ACCESS_KEY=human-oracle +EXCHANGE_ORACLE_STORAGE_SECRET_KEY=human-oracle-s3-secret +EXCHANGE_ORACLE_STORAGE_RESULTS_BUCKET_NAME=cvat-exchange-oracle +EXCHANGE_ORACLE_STORAGE_USE_SSL=false + +# CVAT Config +CVAT_URL=http://cvat-lb:8080 +CVAT_ADMIN=human-protocol +CVAT_ADMIN_PASS=qwe123qwe123Q! +CVAT_ORG_SLUG=HumanAppLocal + +# Features +ENABLE_CUSTOM_CLOUD_HOST=true + +# Encryption +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +lIYEZ4+5ghYJKwYBBAHaRw8BAQdAT3FAHszcuVoku0YlOyJrgqJf8NmnKc6qKU5N +eHznpx/+BwMCO3NOItWdTgX/JDQWQQIm+JyvWIZQjFsvXJKClXXM21hA0z1bux9a +Qx9+YAIbiwnu0YFUJMvI8cfBv3hGkiA325NmqLZ5kUzqvjxp9w92JbQtUmVjb3Jk +aW5nIE9yYWNsZSA8cmVjb3JkaW5nLW9yYWNsZUBsb2NhbC5hcHA+iJMEExYKADsW +IQSSY2XwNs+1ey1IByhZ3rDnTiC9mQUCZ4+5ggIbAwULCQgHAgIiAgYVCgkICwIE +FgIDAQIeBwIXgAAKCRBZ3rDnTiC9mZztAP46luOhfAnAaf/fNav6SPL9FdVftx4K +xvojSjYyPQmyRQEA/V5+F1boR+rQOycthh0o05TTarnNfY6Yaz3lw2+qeAuciwRn +j7mCEgorBgEEAZdVAQUBAQdATYTo/hz3TJRzFy6dYlTPi/EwL5fMZ5XAVIA4WIj+ +HmwDAQgH/gcDAi05Ryta4lXG/9+5H6+kj44u2Nxs9/84+Yaq5dxIBxl8d5cj/iub +0QvB8xUiEr3+AxofKy4U0I1hgep+1ucS0Px+fJQotwbS0t7RaUZOQa+IeAQYFgoA +IBYhBJJjZfA2z7V7LUgHKFnesOdOIL2ZBQJnj7mCAhsMAAoJEFnesOdOIL2ZnL8A +/Rf4dbJuIr4HhUCmpETEAfbrgb1VHVD+RcuJCFVUyK+ZAP96fCqI6ZBT8SsTz0gR +K08s/F2A8VTKYHyxzIftNMAHBg== +=1L/X +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=kGcW5BcuQ7H4eVsfvP1 +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEZ4+5ghYJKwYBBAHaRw8BAQdAT3FAHszcuVoku0YlOyJrgqJf8NmnKc6qKU5N +eHznpx+0LVJlY29yZGluZyBPcmFjbGUgPHJlY29yZGluZy1vcmFjbGVAbG9jYWwu +YXBwPoiTBBMWCgA7FiEEkmNl8DbPtXstSAcoWd6w504gvZkFAmePuYICGwMFCwkI +BwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQWd6w504gvZmc7QD+OpbjoXwJwGn/ +3zWr+kjy/RXVX7ceCsb6I0o2Mj0JskUBAP1efhdW6Efq0DsnLYYdKNOU02q5zX2O +mGs95cNvqngLuDgEZ4+5ghIKKwYBBAGXVQEFAQEHQE2E6P4c90yUcxcunWJUz4vx +MC+XzGeVwFSAOFiI/h5sAwEIB4h4BBgWCgAgFiEEkmNl8DbPtXstSAcoWd6w504g +vZkFAmePuYICGwwACgkQWd6w504gvZmcvwD9F/h1sm4ivgeFQKakRMQB9uuBvVUd +UP5Fy4kIVVTIr5kA/3p8KojpkFPxKxPPSBErTyz8XYDxVMpgfLHMh+00wAcG +=CYWX +-----END PGP PUBLIC KEY BLOCK-----" +PGP_PUBLIC_KEY_URL=http://minio:9000/cvat-recording-oracle/pgp-public-key diff --git a/scripts/cvat/Makefile b/scripts/cvat/Makefile deleted file mode 100644 index 03ca3c11fe..0000000000 --- a/scripts/cvat/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -.PHONY: copy-env-files - -copy-env-files: -# Copying .env file for compose itself - @cp ./env-files/.env.compose .env.compose.local -# Copying .env files for backend services - @cp ./env-files/.env.reputation-oracle ./.env.reputation-oracle.local - @cp ./env-files/.env.human-app-server .env.human-app-server.local - @cp ./env-files/.env.job-launcher ./.env.job-launcher.local - @cp ./env-files/.env.exchange-oracle ./.env.exchange-oracle.local - @cp ./env-files/.env.recording-oracle ./.env.recording-oracle.local -# Copying .env files for client apps. -# It should be placed in corresponding app folder -# because used during Docker image build process - @cp ./env-files/.env.human-app-client ../../packages/apps/human-app/frontend/.env.local - @cp ./env-files/.env.job-launcher-client ../../packages/apps/job-launcher/client/.env.local -# Restore original files - @git checkout . > /dev/null 2>&1 \ No newline at end of file diff --git a/scripts/cvat/env-files/.env.compose b/scripts/cvat/env-files/.env.compose deleted file mode 100644 index 01ac15ef8b..0000000000 --- a/scripts/cvat/env-files/.env.compose +++ /dev/null @@ -1,21 +0,0 @@ -MINIO_PORT=9000 - -BACKEND_APPS_INTERNAL_PORT=5000 -REPUTATION_ORACLE_EXPOSED_PORT=5001 -HUMAN_APP_CLIENT_PORT=3001 -JOB_LAUNCHER_CLIENT_PORT=3002 - -HUMAN_APP_SECRET_KEY=sk_local_3Hc0kWL9Y8iwyHucW636Cl7tfFZI0rAUljPEbbfDrok -REPUTATION_ORACLE_JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkPekD3q96LHt4IfvY1UY1YukTeEf -K+XryPXhU57nKuhZXBPRrQ+lMDeFpYpHWpGqA/K576n+rDvjbBgHfQiHKg== ------END PUBLIC KEY-----" - -RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology -# Oracle addresses -REPUTATION_ORACLE_ADDRESS=replace_me -EXCHANGE_ORACLE_ADDRESS=replace_me -RECORDING_ORACLE_ADDRESS=replace_me - -# Might be empty -SUBGRAPH_API_KEY= diff --git a/scripts/cvat/env-files/.env.exchange-oracle b/scripts/cvat/env-files/.env.exchange-oracle deleted file mode 100644 index 6ee37a5497..0000000000 --- a/scripts/cvat/env-files/.env.exchange-oracle +++ /dev/null @@ -1,57 +0,0 @@ -## Polygon Amoy Config -POLYGON_AMOY_PRIVATE_KEY=replace_me - -## Cron Config -## To make environment more convenient with faster updates -PROCESS_JOB_LAUNCHER_WEBHOOKS_INT=10 -PROCESS_RECORDING_ORACLE_WEBHOOKS_INT=10 -TRACK_COMPLETED_PROJECTS_INT=10 -TRACK_COMPLETED_TASKS_INT=10 -TRACK_COMPLETED_ESCROWS_INT=10 -TRACK_CREATING_TASKS_INT=10 -TRACK_ASSIGNMENTS_INT=10 -TRACK_ESCROW_CREATION_INT=100 - -## Features -ENABLE_CUSTOM_CLOUD_HOST="yes" -REQUEST_LOGGING_ENABLED="yes" -PROFILING_ENABLED="yes" - -## Core -DEFAULT_ASSIGNMENT_TIME=600 - -## PGP Keys data -PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- - -xYYEZ4+2FxYJKwYBBAHaRw8BAQdAodfgvZwd1/s2tStzumk9T+WhuirhI8AD -eEOG4jdMhdD+CQMI9hA7Uf00eCXgAmMXD7ffmZaIpOjJXd3I4GM8mvKqP2DV -Ts6iDtfTy0f/jqEdTgNoh9Q5Q6uXW3/zAXivDtc7hGaMMA6/ITQsk7tg7LtL -HM0rRXhjaGFuZ2UgT3JhY2xlIDxleGNoYW5nZS1vcmFjbGVAbG9jYWwuYXBw -PsKMBBAWCgA+BYJnj7YXBAsJBwgJkNHy48FpPLsnAxUICgQWAAIBAhkBApsD -Ah4BFiEEydMT95OC9OCzQFjL0fLjwWk8uycAALavAP9RKP8wUxhuFKxFQ7IB -SQTTAZgamwezk0KqEuy6U70UtwEAiWyjFo3Y5oTzaOABs3YTogumq3v+Kmnn -yYNl/UHyZwXHiwRnj7YXEgorBgEEAZdVAQUBAQdA0THKoGl7/bviCOOm0MZ2 -6CSyN/PbPL5j9C6m5T/90GcDAQgH/gkDCBJs91BQdiVL4PZj8WlKnyu+7sBD -p1pKRAqCxx/DDnYWGTFyW8JMgM6bcEfCIl+q5WeO35k1SXFJKUu2Wd1Cl5r1 -kp/DonyJmiRM+Lo/evbCeAQYFgoAKgWCZ4+2FwmQ0fLjwWk8uycCmwwWIQTJ -0xP3k4L04LNAWMvR8uPBaTy7JwAAVCEBAKBllZtzefLZsoE0behnwu5SCnSS -ORb+9kItQJMdBcnWAP9HcsCq3Ve6pOUXBuMWlmQ8IspXQ/oPHdQ7gEJ8+q6H -Bw== -=w1I+ ------END PGP PRIVATE KEY BLOCK-----" -PGP_PASSPHRASE=exc-o-pgp-password -PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- - -xjMEZ4+2FxYJKwYBBAHaRw8BAQdAodfgvZwd1/s2tStzumk9T+WhuirhI8AD -eEOG4jdMhdDNK0V4Y2hhbmdlIE9yYWNsZSA8ZXhjaGFuZ2Utb3JhY2xlQGxv -Y2FsLmFwcD7CjAQQFgoAPgWCZ4+2FwQLCQcICZDR8uPBaTy7JwMVCAoEFgAC -AQIZAQKbAwIeARYhBMnTE/eTgvTgs0BYy9Hy48FpPLsnAAC2rwD/USj/MFMY -bhSsRUOyAUkE0wGYGpsHs5NCqhLsulO9FLcBAIlsoxaN2OaE82jgAbN2E6IL -pqt7/ipp58mDZf1B8mcFzjgEZ4+2FxIKKwYBBAGXVQEFAQEHQNExyqBpe/27 -4gjjptDGdugksjfz2zy+Y/QupuU//dBnAwEIB8J4BBgWCgAqBYJnj7YXCZDR -8uPBaTy7JwKbDBYhBMnTE/eTgvTgs0BYy9Hy48FpPLsnAABUIQEAoGWVm3N5 -8tmygTRt6GfC7lIKdJI5Fv72Qi1Akx0FydYA/0dywKrdV7qk5RcG4xaWZDwi -yldD+g8d1DuAQnz6rocH -=AVB0 ------END PGP PUBLIC KEY BLOCK-----" -PGP_PUBLIC_KEY_URL=http://minio:9000/exchange-oracle/pgp-public-key diff --git a/scripts/cvat/env-files/.env.human-app-client b/scripts/cvat/env-files/.env.human-app-client deleted file mode 100644 index c70c0f5f49..0000000000 --- a/scripts/cvat/env-files/.env.human-app-client +++ /dev/null @@ -1,31 +0,0 @@ -VITE_API_URL=http://localhost:5002 -VITE_NETWORK=testnet -# Reown project id -VITE_WALLET_CONNECT_PROJECT_ID=replace_me -VITE_DAPP_ICONS=icon1,icon2 -VITE_DAPP_META_DESCRIPTION=Complete jobs, earn HMT -VITE_DAPP_META_NAME=Human App Local -VITE_DAPP_META_URL=http://localhost:3001 -# Keep it empty -VITE_H_CAPTCHA_EXCHANGE_URL= -# Keep it empty -VITE_H_CAPTCHA_LABELING_BASE_URL= -VITE_H_CAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 -VITE_DAILY_SOLVED_CAPTCHA_LIMIT=0 -VITE_HMT_DAILY_SPENT_LIMIT=0 -VITE_HUMAN_PROTOCOL_HELP_URL=https://docs.humanprotocol.org/ -VITE_HUMAN_PROTOCOL_URL=https://humanprotocol.org/ -VITE_HUMAN_SUPPORT_EMAIL=support@local.app -VITE_NAVBAR__LINK__HOW_IT_WORK_URL=https://humanprotocol.org/ -VITE_NAVBAR__LINK__PROTOCOL_URL=https://humanprotocol.org/ -VITE_PRIVACY_POLICY_URL=http://local.app/privacy-policy/ -VITE_TERMS_OF_SERVICE_URL=http://local.app/terms-and-conditions/ -VITE_H_CAPTCHA_ORACLE_ANNOTATION_TOOL=hcaptcha -VITE_H_CAPTCHA_ORACLE_ROLE=hcaptcha -# Keep it empty -VITE_H_CAPTCHA_ORACLE_ADDRESS= -VITE_H_CAPTCHA_ORACLE_TASK_TYPES=image_points,image_boxes -VITE_FEATURE_FLAG_JOBS_DISCOVERY=true -# Keep it empty -VITE_GOVERNOR_ADDRESS= -VITE_GOVERNANCE_URL= \ No newline at end of file diff --git a/scripts/cvat/env-files/.env.human-app-server b/scripts/cvat/env-files/.env.human-app-server deleted file mode 100644 index f87f8c2440..0000000000 --- a/scripts/cvat/env-files/.env.human-app-server +++ /dev/null @@ -1,13 +0,0 @@ -CHAIN_IDS_ENABLED=80002 -HCAPTCHA_LABELING_STATS_API_URL=disabled -HCAPTCHA_LABELING_VERIFY_API_URL=disabled -HCAPTCHA_LABELING_API_KEY=disabled -# Should be the one you will use to access human-app-server API -ALLOWED_HOST=localhost:5002 -# CORS -CORS_ALLOWED_ORIGIN=* -CORS_ALLOWED_HEADERS='Content-Type,Authorization,X-Requested-With,Accept,Origin' -CORS_ENABLED=true -IS_CACHE_TO_RESTART=false -# FEATURE FLAGS -FEATURE_FLAG_JOBS_DISCOVERY=true diff --git a/scripts/cvat/env-files/.env.job-launcher b/scripts/cvat/env-files/.env.job-launcher deleted file mode 100644 index 9ec113276b..0000000000 --- a/scripts/cvat/env-files/.env.job-launcher +++ /dev/null @@ -1,73 +0,0 @@ -# Database -POSTGRES_DATABASE=job-launcher - -# Web3 -WEB3_PRIVATE_KEY=replace_me - -GAS_PRICE_MULTIPLIER=1 - -# Encryption -PGP_ENCRYPT=true -PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- - -xYYEZ4+y/xYJKwYBBAHaRw8BAQdAlIkUUttKB25Zf/g3lf26lU15V4PcS6eM -YiqfFUeyZGn+CQMIW8oNkxnBpSfgI4VBMN4ZamblXNYjg3u6HdSvuPrSjryR -zEVPcE/QPTE+sljRLve2E4MEcGcs9c/JWxmD0Dlq7gpbctghQKkEbViwsj36 -L80lSm9iIExhdW5jaGVyIDxqb2ItbGF1bmNoZXJAbG9jYWwuYXBwPsKMBBAW -CgA+BYJnj7L/BAsJBwgJkFvOlfsfiS2NAxUICgQWAAIBAhkBApsDAh4BFiEE -nhDZweAQiTFNFnMEW86V+x+JLY0AAFrrAQDUTb30NvyMX1rvIAUdX7OnEQFu -u+IkL52ZcvH0lJBHsAEA+iDL/03LCLIDK1g1l2mBZNUudEqncB0i0rAifeli -hwLHiwRnj7L/EgorBgEEAZdVAQUBAQdASe/9TcJE/EnMLYE2K0o/ROxsRDi8 -cRtPEKSNVNLeCB4DAQgH/gkDCHtTPVsCMa9X4H1NkDo5Ijnyp74a2ZklE5l6 -coHvKRndTyT/UwxRPUo38pq3mI5U/bRCvrwFD6ehWWhlsfjm/D0Xsjj7J6jF -uKxZgW+CGwfCeAQYFgoAKgWCZ4+y/wmQW86V+x+JLY0CmwwWIQSeENnB4BCJ -MU0WcwRbzpX7H4ktjQAAZqoBAJ5Llw1V+5i9w9bOTS2NlQDSqtQAClCECEhD -z9cFhU1RAQCBG62i7Cjsy+4RXxubBqVhNWCk02JhSn+vDAYT/TeqBA== -=B2Ed ------END PGP PRIVATE KEY BLOCK-----" -PGP_PASSPHRASE=job-launcher-pgp-password -# Put it here just to easily set up KV later -PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- - -xjMEZ4+y/xYJKwYBBAHaRw8BAQdAlIkUUttKB25Zf/g3lf26lU15V4PcS6eM -YiqfFUeyZGnNJUpvYiBMYXVuY2hlciA8am9iLWxhdW5jaGVyQGxvY2FsLmFw -cD7CjAQQFgoAPgWCZ4+y/wQLCQcICZBbzpX7H4ktjQMVCAoEFgACAQIZAQKb -AwIeARYhBJ4Q2cHgEIkxTRZzBFvOlfsfiS2NAABa6wEA1E299Db8jF9a7yAF -HV+zpxEBbrviJC+dmXLx9JSQR7ABAPogy/9NywiyAytYNZdpgWTVLnRKp3Ad -ItKwIn3pYocCzjgEZ4+y/xIKKwYBBAGXVQEFAQEHQEnv/U3CRPxJzC2BNitK -P0TsbEQ4vHEbTxCkjVTS3ggeAwEIB8J4BBgWCgAqBYJnj7L/CZBbzpX7H4kt -jQKbDBYhBJ4Q2cHgEIkxTRZzBFvOlfsfiS2NAABmqgEAnkuXDVX7mL3D1s5N -LY2VANKq1AAKUIQISEPP1wWFTVEBAIEbraLsKOzL7hFfG5sGpWE1YKTTYmFK -f68MBhP9N6oE -=dNxu ------END PGP PUBLIC KEY BLOCK-----" - -HCAPTCHA_RECORDING_ORACLE_URI=disabled -HCAPTCHA_REPUTATION_ORACLE_URI=disabled - -# Auth -JWT_PRIVATE_KEY="-----BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgjwW8ZeWIKizY9pSl -phyKfwYFp3aRHeMuV+jOKp49hX6hRANCAATeitytad5Rh0tx6AP/VHptsRvsZ+Xp -/24PICdk4nsMxZEAe76InmWdqhud13JV76Jl02DVenFEJVM5IjRk+mLG ------END PRIVATE KEY-----" -JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3orcrWneUYdLcegD/1R6bbEb7Gfl -6f9uDyAnZOJ7DMWRAHu+iJ5lnaobnddyVe+iZdNg1XpxRCVTOSI0ZPpixg== ------END PUBLIC KEY-----" - -# Stripe -STRIPE_SECRET_KEY=disabled -STRIPE_APP_NAME=Launcher Server Local -STRIPE_APP_VERSION=1.0.0 -STRIPE_APP_INFO_URL=http://local.app - -# Vision -GOOGLE_PROJECT_ID=disabled -GOOGLE_PRIVATE_KEY=disabled -GOOGLE_CLIENT_EMAIL=disabled -GCV_MODERATION_RESULTS_FILES_PATH=disabled -GCV_MODERATION_RESULTS_BUCKET=disabled - -# Slack -SLACK_ABUSE_NOTIFICATION_WEBHOOK_URL=disabled diff --git a/scripts/cvat/env-files/.env.job-launcher-client b/scripts/cvat/env-files/.env.job-launcher-client deleted file mode 100644 index aaa46b98bf..0000000000 --- a/scripts/cvat/env-files/.env.job-launcher-client +++ /dev/null @@ -1,10 +0,0 @@ -VITE_APP_JOB_LAUNCHER_SERVER_URL=http://localhost:5005 -# Reown project id -VITE_APP_WALLETCONNECT_PROJECT_ID=replace_me -VITE_APP_STRIPE_PUBLISHABLE_KEY=disabled -VITE_APP_HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 -VITE_APP_HCAPTCHA_EXCHANGE_URL=disabled -VITE_APP_HCAPTCHA_LABELING_BASE_URL=disabled -VITE_APP_ENVIRONMENT=testnet -VITE_APP_RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology -VITE_APP_SUPPORTED_CHAINS=80002 diff --git a/scripts/cvat/env-files/.env.recording-oracle b/scripts/cvat/env-files/.env.recording-oracle deleted file mode 100644 index bf0805d59d..0000000000 --- a/scripts/cvat/env-files/.env.recording-oracle +++ /dev/null @@ -1,44 +0,0 @@ -# Polygon Amoy -POLYGON_AMOY_PRIVATE_KEY=replace_me - -# Cron jobs -PROCESS_EXCHANGE_ORACLE_WEBHOOKS_INT=10 -PROCESS_REPUTATION_ORACLE_WEBHOOKS_INT=10 - -# Features -ENABLE_CUSTOM_CLOUD_HOST="yes" - - -# Encryption -PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- - -xYYEZ+KclxYJKwYBBAHaRw8BAQdAQmPWFqgCHKBl5orZ14BjdEge9LL3VbyJ -kXqRRe7xJkv+CQMIk7BjanLIRJrgAkRNCk3U5RwAyZax53wbK8NfV+2i7cjY -NFkbiOK8yuq+QG0T/PoKyXFOa126gwsBTlKmyPT5/am8rTFf6k39NzCn8f7D -y80AwowEEBYKAD4FgmfinJcECwkHCAmQ0JGHkZYk1mYDFQgKBBYAAgECGQEC -mwMCHgEWIQQcpeN3tBh8ex2F8HjQkYeRliTWZgAADaMA/0wSvCfUTDYN3gzn -HDDdmqEqg+ji5NTUNjj3jVtLm+XeAP4v2KpGFWXQnCcexTf1USll9ddZC/6H -ZlcFmCuvWX/1B8eLBGfinJcSCisGAQQBl1UBBQEBB0DSGXpmTLBqiPz59qLa -Cuarsa6Q09QJKB6GSEa3Me4zSAMBCAf+CQMI+V7xRESw/5Hg2tbHs6q0oWuF -/jMu2bLAu4n+C5tw+7eZK5imqu9iocp/ZRMBAQgTp/VIUbFopHk18THVGZKE -Vh5zLxinmAP4zkMPm8SsCcJ4BBgWCgAqBYJn4pyXCZDQkYeRliTWZgKbDBYh -BByl43e0GHx7HYXweNCRh5GWJNZmAAAz0wEAgXxWZUkSDk1HfVGb77/jR562 -Kt8i8+ZdOuY7CehB7JIBAPip5C1mea5bxHrOHt/BzUC0oWcvP+U4W6K6Ccdy -/8UO -=IMpo ------END PGP PRIVATE KEY BLOCK-----" -PGP_PASSPHRASE=rec-o-pgp-password -PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- - -xjMEZ+KclxYJKwYBBAHaRw8BAQdAQmPWFqgCHKBl5orZ14BjdEge9LL3VbyJ -kXqRRe7xJkvNAMKMBBAWCgA+BYJn4pyXBAsJBwgJkNCRh5GWJNZmAxUICgQW -AAIBAhkBApsDAh4BFiEEHKXjd7QYfHsdhfB40JGHkZYk1mYAAA2jAP9MErwn -1Ew2Dd4M5xww3ZqhKoPo4uTU1DY4941bS5vl3gD+L9iqRhVl0JwnHsU39VEp -ZfXXWQv+h2ZXBZgrr1l/9QfOOARn4pyXEgorBgEEAZdVAQUBAQdA0hl6Zkyw -aoj8+fai2grmq7GukNPUCSgehkhGtzHuM0gDAQgHwngEGBYKACoFgmfinJcJ -kNCRh5GWJNZmApsMFiEEHKXjd7QYfHsdhfB40JGHkZYk1mYAADPTAQCBfFZl -SRIOTUd9UZvvv+NHnrYq3yLz5l065jsJ6EHskgEA+KnkLWZ5rlvEes4e38HN -QLShZy8/5ThboroJx3L/xQ4= -=eS/4 ------END PGP PUBLIC KEY BLOCK-----" -PGP_PUBLIC_KEY_URL=http://minio:9000/recording-oracle/pgp-public-key diff --git a/scripts/cvat/env-files/.env.reputation-oracle b/scripts/cvat/env-files/.env.reputation-oracle deleted file mode 100644 index e597c5c08e..0000000000 --- a/scripts/cvat/env-files/.env.reputation-oracle +++ /dev/null @@ -1,55 +0,0 @@ -# Auth -JWT_PRIVATE_KEY="-----BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg9T4TcNz4sFIvOZTE -wBHX986G90H20Cryp4++7APQfu6hRANCAASQ96QPer3ose3gh+9jVRjVi6RN4R8r -5evI9eFTnucq6FlcE9GtD6UwN4WlikdakaoD8rnvqf6sO+NsGAd9CIcq ------END PRIVATE KEY-----" - -# web3 -WEB3_PRIVATE_KEY=replace_me - -# Encryption -PGP_ENCRYPT=true -PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- - -xYYEZ4+FFhYJKwYBBAHaRw8BAQdA/BEzpkXk107UOpQrUro20UxYryOW4g8x -yAXIh2cH5ff+CQMI0h7UaI9LgBXgKHJF0y9LMaRyjZwkKYQa/yn5T1pfkgTn -T2piULy9a+2w8EWyve2cv8zMBtZAcno75sV0X3BbMpkf9ru8hOoWQvkv8arN -Wc01UmVwdXRhdGlvbiBPcmFjbGUgTG9jYWwgPHJlcHV0YXRpb24tb3JhY2xl -QGxvY2FsLmFwcD7CjAQQFgoAPgWCZ4+FFgQLCQcICZCe6Z27JtHYsAMVCAoE -FgACAQIZAQKbAwIeARYhBMXQP7WbhM4roaDkzZ7pnbsm0diwAACDdAEAkLuS -rUp2eLBD2MEBP96wU8FqIUGsyju5Esd+yS7VGzIBAO8hmR8QEwk/+P2lKqLg -6lgQnT0xubb7PqcNmJNoSX8Hx4sEZ4+FFhIKKwYBBAGXVQEFAQEHQJHtNaFR -30ahNwXuUoYRyIA22K3B686H+mZCF5Nfy6JDAwEIB/4JAwj2Ltq6kZ0KfuC6 -78oX1t2wh/ZYJA9hZRa+8qyizfHZ9WKe7IWEXBW8yRc4IHNL0nYFCF5w5zoc -NMHddSoQdIWhja8s5odZqA0uV1YaDHuOwngEGBYKACoFgmePhRYJkJ7pnbsm -0diwApsMFiEExdA/tZuEziuhoOTNnumduybR2LAAAFNTAQDL0L2pHyi6CPPV -fw6LtGasCu9iLT59kNj+gUabWgYVtQEApNxRcbFcYRyqmFjDDNXtyZhZB8Jj -F8tN26blow3txgI= -=68Rz ------END PGP PRIVATE KEY BLOCK-----" -PGP_PASSPHRASE=rep-o-pgp-password -# Put it here just to easily set up KV later -PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- - -xjMEZ4+FFhYJKwYBBAHaRw8BAQdA/BEzpkXk107UOpQrUro20UxYryOW4g8x -yAXIh2cH5ffNNVJlcHV0YXRpb24gT3JhY2xlIExvY2FsIDxyZXB1dGF0aW9u -LW9yYWNsZUBsb2NhbC5hcHA+wowEEBYKAD4FgmePhRYECwkHCAmQnumduybR -2LADFQgKBBYAAgECGQECmwMCHgEWIQTF0D+1m4TOK6Gg5M2e6Z27JtHYsAAA -g3QBAJC7kq1KdniwQ9jBAT/esFPBaiFBrMo7uRLHfsku1RsyAQDvIZkfEBMJ -P/j9pSqi4OpYEJ09Mbm2+z6nDZiTaEl/B844BGePhRYSCisGAQQBl1UBBQEB -B0CR7TWhUd9GoTcF7lKGEciANtitwevOh/pmQheTX8uiQwMBCAfCeAQYFgoA -KgWCZ4+FFgmQnumduybR2LACmwwWIQTF0D+1m4TOK6Gg5M2e6Z27JtHYsAAA -U1MBAMvQvakfKLoI89V/Dou0ZqwK72ItPn2Q2P6BRptaBhW1AQCk3FFxsVxh -HKqYWMMM1e3JmFkHwmMXy03bpuWjDe3GAg== -=pqBc ------END PGP PUBLIC KEY BLOCK-----" - -KYC_API_KEY=disabled -KYC_API_PRIVATE_KEY=none - -NDA_URL=https://humanprotocol.org - -ABUSE_SLACK_WEBHOOK_URL=http://disabled-for-local.app -ABUSE_SLACK_SIGNING_SECRET=disabled -ABUSE_SLACK_OAUTH_TOKEN=disabled \ No newline at end of file diff --git a/scripts/cvat/initdb/create-dbs.sql b/scripts/cvat/initdb/create-dbs.sql deleted file mode 100644 index 3b5f93e98e..0000000000 --- a/scripts/cvat/initdb/create-dbs.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE DATABASE "reputation-oracle"; -CREATE DATABASE "exchange-oracle"; -CREATE DATABASE "recording-oracle"; -CREATE DATABASE "job-launcher"; diff --git a/scripts/fortune/.env.jl-server b/scripts/fortune/.env.jl-server index f110c2637d..dbb026aa83 100644 --- a/scripts/fortune/.env.jl-server +++ b/scripts/fortune/.env.jl-server @@ -2,7 +2,7 @@ NODE_ENV=development HOST=localhost PORT=5000 -FE_URL=http://localhost:3005 +FE_URL=http://localhost:3002 SESSION_SECRET=test # Database diff --git a/yarn.lock b/yarn.lock index e10b08aa6b..387e52425f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3973,7 +3973,10 @@ __metadata: version: 0.0.0-use.local resolution: "@human-protocol/fortune-exchange-oracle-client@workspace:packages/apps/fortune/exchange-oracle/client" dependencies: + "@emotion/react": "npm:^11.11.3" + "@emotion/styled": "npm:^11.11.0" "@human-protocol/sdk": "workspace:^" + "@mui/icons-material": "npm:^7.0.1" "@mui/material": "npm:^5.16.7" "@tanstack/query-sync-storage-persister": "npm:^5.68.0" "@tanstack/react-query": "npm:^5.67.2" @@ -4011,27 +4014,42 @@ __metadata: "@nestjs/axios": "npm:^3.1.2" "@nestjs/cli": "npm:^10.3.2" "@nestjs/common": "npm:^10.2.7" + "@nestjs/config": "npm:^3.1.1" "@nestjs/core": "npm:^10.3.10" + "@nestjs/passport": "npm:^10.0.0" + "@nestjs/platform-express": "npm:^10.3.10" + "@nestjs/schedule": "npm:^4.0.1" "@nestjs/schematics": "npm:^11.0.2" + "@nestjs/swagger": "npm:^7.4.2" "@nestjs/terminus": "npm:^11.0.0" "@nestjs/testing": "npm:^10.4.6" "@nestjs/typeorm": "npm:^10.0.1" + "@types/body-parser": "npm:^1" "@types/express": "npm:^4.17.13" "@types/jest": "npm:29.5.12" + "@types/jsonwebtoken": "npm:^9.0.7" "@types/node": "npm:22.10.5" + "@types/passport": "npm:^0" + "@types/passport-jwt": "npm:^4.0.1" "@types/pg": "npm:8.11.10" "@types/supertest": "npm:^6.0.2" "@typescript-eslint/eslint-plugin": "npm:^5.0.0" "@typescript-eslint/parser": "npm:^5.0.0" axios: "npm:^1.3.1" + body-parser: "npm:^1.20.3" class-transformer: "npm:^0.5.1" class-validator: "npm:0.14.1" + dotenv: "npm:^16.3.2" eslint: "npm:^8.55.0" eslint-config-prettier: "npm:^9.1.0" eslint-plugin-prettier: "npm:^5.2.1" ethers: "npm:~6.13.5" jest: "npm:29.7.0" joi: "npm:^17.13.3" + jsonwebtoken: "npm:^9.0.2" + minio: "npm:7.1.3" + passport: "npm:^0.7.0" + passport-jwt: "npm:^4.0.1" pg: "npm:8.13.1" prettier: "npm:^3.4.2" reflect-metadata: "npm:^0.2.2" @@ -4057,6 +4075,7 @@ __metadata: "@nestjs/common": "npm:^10.2.7" "@nestjs/config": "npm:^3.1.1" "@nestjs/core": "npm:^10.3.10" + "@nestjs/platform-express": "npm:^10.3.10" "@nestjs/schematics": "npm:^11.0.2" "@nestjs/swagger": "npm:^7.4.2" "@nestjs/testing": "npm:^10.4.6" @@ -4064,10 +4083,14 @@ __metadata: "@types/node": "npm:^22.15.16" axios: "npm:^1.3.1" body-parser: "npm:^1.20.2" + class-transformer: "npm:^0.5.1" class-validator: "npm:0.14.1" + dotenv: "npm:^16.3.2" eslint: "npm:^8.55.0" helmet: "npm:^7.1.0" jest: "npm:^29.7.0" + joi: "npm:^17.13.3" + minio: "npm:7.1.3" prettier: "npm:^3.4.2" reflect-metadata: "npm:^0.2.2" rxjs: "npm:^7.2.0" @@ -4301,6 +4324,7 @@ __metadata: class-transformer: "npm:^0.5.1" class-validator: "npm:0.14.1" decimal.js: "npm:^10.4.3" + dotenv: "npm:^16.3.2" eslint: "npm:^8.55.0" eslint-config-prettier: "npm:^9.1.0" eslint-plugin-prettier: "npm:^5.2.1" @@ -4308,6 +4332,7 @@ __metadata: jest: "npm:29.7.0" joi: "npm:^17.13.3" json-stable-stringify: "npm:^1.2.1" + minio: "npm:7.1.3" nestjs-minio-client: "npm:^2.2.0" node-cache: "npm:^5.1.2" passport: "npm:^0.7.0" @@ -9336,7 +9361,7 @@ __metadata: languageName: node linkType: hard -"@types/body-parser@npm:*": +"@types/body-parser@npm:*, @types/body-parser@npm:^1": version: 1.19.5 resolution: "@types/body-parser@npm:1.19.5" dependencies: @@ -9882,6 +9907,15 @@ __metadata: languageName: node linkType: hard +"@types/passport@npm:^0": + version: 0.4.7 + resolution: "@types/passport@npm:0.4.7" + dependencies: + "@types/express": "npm:*" + checksum: 10c0/58ca21800b7910385961b7a3dc9071fc9db6223242b96ff88d16c9d004ce7173524e7c17c63363595565af3f85ad932ee301efc8cc3e378bea172eebc9e07703 + languageName: node + linkType: hard + "@types/pbkdf2@npm:^3.0.0": version: 3.1.2 resolution: "@types/pbkdf2@npm:3.1.2" From 7aebb1b017db1c9ebd955f0575a4d0eb5a0f7300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Thu, 29 May 2025 13:50:08 +0200 Subject: [PATCH 06/21] refactor: implement caching for public key retrieval in JwtHttpStrategy (#3371) --- .../src/common/guards/strategy/jwt.http.ts | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts b/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts index b7df3e905d..7f948fddc8 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts @@ -14,6 +14,11 @@ import { AuthError, ValidationError } from '../../errors'; @Injectable() export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { + // In-memory cache for public keys with expiration + private publicKeyCache: Map = + new Map(); + private cacheTTL = 24 * 60 * 60 * 1000; // 1 day + constructor(private readonly web3Service: Web3Service) { super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), @@ -26,15 +31,31 @@ export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { try { const payload = jwt.decode(rawJwtToken); const chainId = this.web3Service.getValidChains()[0]; - const signer = this.web3Service.getSigner(chainId); - - const url = await this.getFileUrlAndVerifyHash( - signer, - chainId, - (payload as any).reputation_network, - JWT_KVSTORE_KEY, - ); - const publicKey = await StorageClient.downloadFileFromUrl(url); + const address = (payload as any).reputation_network; + const cacheKey = `${chainId}-${address}`; + + const cached = this.publicKeyCache.get(cacheKey); + + let publicKey: string | undefined; + if (cached && cached.expires > Date.now()) { + publicKey = cached.value; + } else { + const signer = this.web3Service.getSigner(chainId); + const url = await this.getFileUrlAndVerifyHash( + signer, + chainId, + address, + JWT_KVSTORE_KEY, + ); + publicKey = (await StorageClient.downloadFileFromUrl( + url, + )) as string; + + this.publicKeyCache.set(cacheKey, { + value: publicKey, + expires: Date.now() + this.cacheTTL, + }); + } done(null, publicKey); } catch (error) { From 69c6b11f7c3dca686180fa986c14524277ca4c2a Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Fri, 30 May 2025 13:40:49 +0300 Subject: [PATCH 07/21] [Job Launcher] feat: remove audio duration and job bounty for Audino (#3372) --- .../Jobs/Create/AudinoJobRequestForm.tsx | 32 ------------------- .../src/components/Jobs/Create/helpers.ts | 1 - .../src/components/Jobs/Create/schema.ts | 12 +------ .../job-launcher/client/src/services/job.ts | 1 - .../job-launcher/client/src/types/index.ts | 2 -- .../server/src/modules/job/job.dto.ts | 5 --- .../server/src/modules/manifest/fixtures.ts | 3 +- .../src/modules/manifest/manifest.dto.ts | 3 -- .../modules/manifest/manifest.service.spec.ts | 9 ------ .../src/modules/manifest/manifest.service.ts | 18 ++--------- 10 files changed, 4 insertions(+), 82 deletions(-) diff --git a/packages/apps/job-launcher/client/src/components/Jobs/Create/AudinoJobRequestForm.tsx b/packages/apps/job-launcher/client/src/components/Jobs/Create/AudinoJobRequestForm.tsx index f726f6357a..df5705cff3 100644 --- a/packages/apps/job-launcher/client/src/components/Jobs/Create/AudinoJobRequestForm.tsx +++ b/packages/apps/job-launcher/client/src/components/Jobs/Create/AudinoJobRequestForm.tsx @@ -88,7 +88,6 @@ export const AudinoJobRequestForm = () => { gtPath, userGuide, accuracyTarget, - audioDuration, segmentDuration, }: ReturnType) => { updateJobRequest({ @@ -116,7 +115,6 @@ export const AudinoJobRequestForm = () => { }, userGuide, accuracyTarget, - audioDuration, segmentDuration, }, }); @@ -599,36 +597,6 @@ export const AudinoJobRequestForm = () => { - - - - setFieldValue('audioDuration', e.target.value) - } - onBlur={handleBlur} - placeholder="Audio duration" - label="Audio duration (seconds)" - error={ - touched.audioDuration && Boolean(errors.audioDuration) - } - helperText={errors.audioDuration} - InputProps={{ - endAdornment: ( - - - - - - ), - }} - /> - - { - return schema.max( - audioDuration * 1000, - 'Segment duration should not exceed audio duration', - ); - }), + .max(3600000, 'Segment duration must be less than or equal to 3600000'), // one hour in ms }); diff --git a/packages/apps/job-launcher/client/src/services/job.ts b/packages/apps/job-launcher/client/src/services/job.ts index 44025fa127..39e9ced548 100644 --- a/packages/apps/job-launcher/client/src/services/job.ts +++ b/packages/apps/job-launcher/client/src/services/job.ts @@ -88,7 +88,6 @@ export const createAudinoJob = async ( userGuide: data.userGuide, type: data.type, qualifications: data.qualifications, - audioDuration: Number(data.audioDuration), segmentDuration: Number(data.segmentDuration), }; diff --git a/packages/apps/job-launcher/client/src/types/index.ts b/packages/apps/job-launcher/client/src/types/index.ts index f8ba948d89..58f1c01343 100644 --- a/packages/apps/job-launcher/client/src/types/index.ts +++ b/packages/apps/job-launcher/client/src/types/index.ts @@ -73,7 +73,6 @@ export type CreateAudinoJobRequest = { groundTruth: AudinoDataSource; userGuide: string; type: AudinoJobType; - audioDuration: number; segmentDuration: number; }; @@ -284,7 +283,6 @@ export type AudinoRequest = { groundTruth: AudinoDataSource; userGuide: string; accuracyTarget: number; - audioDuration: number; segmentDuration: number; }; diff --git a/packages/apps/job-launcher/server/src/modules/job/job.dto.ts b/packages/apps/job-launcher/server/src/modules/job/job.dto.ts index d46f9db8ae..4533cbb615 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.dto.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.dto.ts @@ -247,11 +247,6 @@ export class JobAudinoDto extends JobDto { @IsEnumCaseInsensitive(AudinoJobType) public type: AudinoJobType; - @ApiProperty({ name: 'audio_duration' }) - @IsNumber() - @IsPositive() - public audioDuration: number; - @ApiProperty({ name: 'segment_duration' }) @IsNumber() @IsPositive() diff --git a/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts b/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts index 8ff0012edf..524b950191 100644 --- a/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts +++ b/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts @@ -97,8 +97,7 @@ export function createJobAudinoDto( path: faker.system.filePath(), }, labels: [{ name: faker.lorem.word() }], - audioDuration: faker.number.int({ min: 100, max: 1000 }), - segmentDuration: faker.number.int({ min: 10, max: 100 }), + segmentDuration: faker.number.int({ min: 10, max: 3600000 }), requesterDescription: faker.lorem.sentence(), userGuide: faker.internet.url(), qualifications: [faker.lorem.word()], diff --git a/packages/apps/job-launcher/server/src/modules/manifest/manifest.dto.ts b/packages/apps/job-launcher/server/src/modules/manifest/manifest.dto.ts index c4ab89f9a1..096d21fcc0 100644 --- a/packages/apps/job-launcher/server/src/modules/manifest/manifest.dto.ts +++ b/packages/apps/job-launcher/server/src/modules/manifest/manifest.dto.ts @@ -198,9 +198,6 @@ export class AudinoManifestDto { @ValidateNested() @Type(() => AudinoValidation) public validation: AudinoValidation; - - @IsString() - public job_bounty: string; } export class RestrictedAudience { diff --git a/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts b/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts index 970468cedf..619a12ae74 100644 --- a/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts @@ -8,7 +8,6 @@ import { faker } from '@faker-js/faker'; import { createMock } from '@golevelup/ts-jest'; import { Encryption } from '@human-protocol/sdk'; import { Test } from '@nestjs/testing'; -import { ethers } from 'ethers'; import { AuthConfigService } from '../../common/config/auth-config.service'; import { CvatConfigService } from '../../common/config/cvat-config.service'; import { PGPConfigService } from '../../common/config/pgp-config.service'; @@ -314,13 +313,6 @@ describe('ManifestService', () => { mockTokenFundDecimals, ); - const totalSegments = Math.ceil( - (mockDto.audioDuration * 1000) / mockDto.segmentDuration, - ); - const jobBounty = - ethers.parseUnits(mockTokenFundAmount.toString(), 'ether') / - BigInt(totalSegments); - expect(result).toEqual({ annotation: { description: mockDto.requesterDescription, @@ -334,7 +326,6 @@ describe('ManifestService', () => { data_url: generateBucketUrl(mockDto.data.dataset, mockRequestType) .href, }, - job_bounty: ethers.formatEther(jobBounty), validation: { gt_url: generateBucketUrl(mockDto.groundTruth, mockRequestType) .href, diff --git a/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.ts b/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.ts index 3e7e9176d1..61836dde66 100644 --- a/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.ts +++ b/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.ts @@ -118,11 +118,7 @@ export class ManifestService { ); case AudinoJobType.AUDIO_TRANSCRIPTION: - return this.createAudinoManifest( - dto as JobAudinoDto, - requestType, - fundAmount, - ); + return this.createAudinoManifest(dto as JobAudinoDto, requestType); default: throw new ValidationError(ErrorJob.InvalidRequestType); @@ -330,16 +326,7 @@ export class ManifestService { private async createAudinoManifest( dto: JobAudinoDto, requestType: AudinoJobType, - tokenFundAmount: number, - ): Promise { - const totalSegments = Math.ceil( - (dto.audioDuration * 1000) / dto.segmentDuration, - ); - - const jobBounty = - ethers.parseUnits(tokenFundAmount.toString(), 'ether') / - BigInt(totalSegments); - + ): Promise { return { annotation: { description: dto.requesterDescription, @@ -352,7 +339,6 @@ export class ManifestService { data: { data_url: generateBucketUrl(dto.data.dataset, requestType).href, }, - job_bounty: ethers.formatEther(jobBounty), validation: { gt_url: generateBucketUrl(dto.groundTruth, requestType).href, min_quality: dto.minQuality, From c6f6bfb40841a704e6bbd5a9b9748e2634f71533 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Mon, 2 Jun 2025 13:48:14 +0300 Subject: [PATCH 08/21] Make boxes thinner (#3374) --- .../examples/cvat/exchange-oracle/src/handlers/job_creation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/examples/cvat/exchange-oracle/src/handlers/job_creation.py b/packages/examples/cvat/exchange-oracle/src/handlers/job_creation.py index 96949a1e23..64645992f4 100644 --- a/packages/examples/cvat/exchange-oracle/src/handlers/job_creation.py +++ b/packages/examples/cvat/exchange-oracle/src/handlers/job_creation.py @@ -2611,7 +2611,7 @@ def _draw_roi_bbox(self, roi_image: np.ndarray, bbox: dm.Bbox) -> np.ndarray: tuple(map(int, (roi_cx - bbox.w / 2, roi_cy - bbox.h / 2))), tuple(map(int, (roi_cx + bbox.w / 2, roi_cy + bbox.h / 2))), self.roi_embedded_bbox_color, - 2, # TODO: maybe improve line thickness + 1, cv2.LINE_4, ) From 9fa7dd17ded4901c232a2cab9df3d6041dc0512a Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Mon, 2 Jun 2025 16:12:25 +0300 Subject: [PATCH 09/21] refactor: docker setup for local web3; dev env with local web3 (#3370) --- .dockerignore | 3 + .gitignore | 8 +- docker-setup/Makefile | 16 +- docker-setup/Makefile.dev | 23 ++ docker-setup/docker-compose.dev.yml | 229 ++++++++++++++++++ package.json | 7 +- .../apps/dashboard/server/src/app.module.ts | 7 +- .../fortune/exchange-oracle/client/Dockerfile | 2 +- .../exchange-oracle/server/.env.example | 1 + .../fortune/exchange-oracle/server/Dockerfile | 2 +- .../exchange-oracle/server/package.json | 2 +- .../server/scripts/setup-kv-store.ts | 37 ++- .../server/scripts/setup-staking.ts | 39 +++ .../exchange-oracle/server/src/app.module.ts | 2 +- .../exchange-oracle/server/test/setup.ts | 71 ------ .../fortune/recording-oracle/.env.example | 1 + .../apps/fortune/recording-oracle/Dockerfile | 2 +- .../fortune/recording-oracle/package.json | 2 +- .../scripts/setup-kv-store.ts | 37 ++- .../recording-oracle/scripts/setup-staking.ts | 39 +++ .../recording-oracle/src/app.module.ts | 2 +- .../fortune/recording-oracle/test/setup.ts | 65 ----- packages/apps/human-app/frontend/Dockerfile | 2 +- packages/apps/human-app/server/Dockerfile | 2 +- .../apps/human-app/server/src/app.module.ts | 5 +- packages/apps/job-launcher/client/Dockerfile | 2 +- .../apps/job-launcher/server/.env.example | 1 + packages/apps/job-launcher/server/Dockerfile | 2 +- .../apps/job-launcher/server/package.json | 2 +- .../server/scripts/setup-kv-store.ts | 37 ++- .../server/scripts/setup-staking.ts | 39 +++ .../job-launcher/server/src/app.module.ts | 2 +- .../apps/job-launcher/server/test/setup.ts | 92 ------- .../reputation-oracle/server/.env.example | 1 + .../apps/reputation-oracle/server/Dockerfile | 2 +- .../reputation-oracle/server/package.json | 2 +- .../server/scripts/setup-kv-store.ts | 49 +++- .../server/scripts/setup-staking.ts | 39 +++ .../server/src/app.module.ts | 2 +- .../server/src/utils/environment.ts | 9 +- packages/core/Dockerfile.local | 29 +++ packages/core/package.json | 2 + packages/core/scripts/local-healthcheck.sh | 45 ++++ .../exchange-oracle/docker-compose.dev.yml | 2 +- .../exchange-oracle/docker-compose.test.yml | 2 +- .../examples/cvat/recording-oracle/README.MD | 6 +- .../recording-oracle/docker-compose.test.yml | 11 +- .../dockerfiles/blockchain-node.Dockerfile | 4 +- .../human-protocol-sdk/example/local-node.ts | 83 +++++++ .../human-protocol-sdk/package.json | 1 + .../human-protocol-sdk/src/utils.ts | 3 +- packages/sdk/typescript/subgraph/README.md | 49 ++-- .../typescript/subgraph/docker-compose.yml | 46 ---- .../typescript/subgraph/local-graph-status.sh | 38 +++ packages/sdk/typescript/subgraph/package.json | 6 +- scripts/Makefile | 102 -------- scripts/README.md | 25 -- scripts/fortune-all-local.sh | 141 +++++++++++ scripts/fortune/.env.exco-server | 28 --- scripts/fortune/.env.jl-client | 7 - scripts/fortune/.env.jl-server | 76 ------ scripts/fortune/.env.rec-oracle | 18 -- scripts/fortune/.env.rep-oracle | 68 ------ scripts/fortune/docker-compose.yml | 89 ------- scripts/fortune/initdb/create-dbs.sql | 4 - scripts/web3/.gitignore | 1 - scripts/web3/docker-compose.yml | 60 ----- yarn.lock | 1 + 68 files changed, 969 insertions(+), 865 deletions(-) create mode 100644 docker-setup/Makefile.dev create mode 100644 docker-setup/docker-compose.dev.yml create mode 100644 packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts delete mode 100644 packages/apps/fortune/exchange-oracle/server/test/setup.ts create mode 100644 packages/apps/fortune/recording-oracle/scripts/setup-staking.ts delete mode 100644 packages/apps/fortune/recording-oracle/test/setup.ts create mode 100644 packages/apps/job-launcher/server/scripts/setup-staking.ts delete mode 100644 packages/apps/job-launcher/server/test/setup.ts create mode 100644 packages/apps/reputation-oracle/server/scripts/setup-staking.ts create mode 100644 packages/core/Dockerfile.local create mode 100755 packages/core/scripts/local-healthcheck.sh create mode 100644 packages/sdk/typescript/human-protocol-sdk/example/local-node.ts delete mode 100644 packages/sdk/typescript/subgraph/docker-compose.yml create mode 100755 packages/sdk/typescript/subgraph/local-graph-status.sh delete mode 100644 scripts/Makefile delete mode 100644 scripts/README.md create mode 100755 scripts/fortune-all-local.sh delete mode 100644 scripts/fortune/.env.exco-server delete mode 100644 scripts/fortune/.env.jl-client delete mode 100644 scripts/fortune/.env.jl-server delete mode 100644 scripts/fortune/.env.rec-oracle delete mode 100644 scripts/fortune/.env.rep-oracle delete mode 100644 scripts/fortune/docker-compose.yml delete mode 100644 scripts/fortune/initdb/create-dbs.sql delete mode 100644 scripts/web3/.gitignore delete mode 100644 scripts/web3/docker-compose.yml diff --git a/.dockerignore b/.dockerignore index ada5c3325a..1087f90813 100644 --- a/.dockerignore +++ b/.dockerignore @@ -23,3 +23,6 @@ scripts .dockerignore **/Dockerfile* **/docker-compose* + +# Local .env files +**/.env.local diff --git a/.gitignore b/.gitignore index ff75977ec2..70399e1fe6 100644 --- a/.gitignore +++ b/.gitignore @@ -47,9 +47,5 @@ dist *.tsbuildinfo hardhat-dependency-compiler -#cache -cache - -#docker databases -docker-db -graph-node-db \ No newline at end of file +# cache +cache \ No newline at end of file diff --git a/docker-setup/Makefile b/docker-setup/Makefile index 28786f2966..365895d059 100644 --- a/docker-setup/Makefile +++ b/docker-setup/Makefile @@ -9,22 +9,22 @@ check-env-file: cp ./.env.compose ./.env.compose.local ; \ fi -infra-up: - docker-compose --env-file .env.compose.local up -d postgres redis minio minio-client +infra-up: check-env-file + @docker compose --env-file .env.compose.local up -d postgres redis minio minio-client infra-stop: - docker-compose --env-file .env.compose.local stop postgres redis minio minio-client + @docker compose --env-file .env.compose.local stop postgres redis minio minio-client -build-services: - docker-compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up --no-start +build-services: check-env-file + @docker compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up --no-start -services-up: +services-up: check-env-file @service_names="$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))"; \ - docker-compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up -d $$service_names + docker compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up -d $$service_names services-stop: @service_names="$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))"; \ - docker-compose --env-file .env.compose.local stop $$service_names + docker compose --env-file .env.compose.local stop $$service_names # catch-all and noop; to avoid warnings when using MAKECMDGOALS %: diff --git a/docker-setup/Makefile.dev b/docker-setup/Makefile.dev new file mode 100644 index 0000000000..567f633f0c --- /dev/null +++ b/docker-setup/Makefile.dev @@ -0,0 +1,23 @@ +.PHONY: web3-up web3-down \ + infra-up infra-stop infra-down + +web3-up: + @docker compose -f docker-compose.dev.yml up -d blockchain-node ipfs graph-node-db graph-node + +web3-down: +# also remove volumes to get the clean start after + @docker compose -f docker-compose.dev.yml down -v blockchain-node ipfs graph-node-db graph-node + +infra-up: + @docker compose -f docker-compose.dev.yml up -d postgres minio minio-client + +infra-stop: + @docker compose -f docker-compose.dev.yml stop postgres minio minio-client + +infra-down: +# also remove volumes to get the clean start after + @docker compose -f docker-compose.dev.yml down -v postgres minio minio-client + +# catch-all and noop; to avoid warnings when using MAKECMDGOALS +%: + @: diff --git a/docker-setup/docker-compose.dev.yml b/docker-setup/docker-compose.dev.yml new file mode 100644 index 0000000000..b329016fb9 --- /dev/null +++ b/docker-setup/docker-compose.dev.yml @@ -0,0 +1,229 @@ +name: human-protocol-local-dev + +x-service-default-config: + restart: &default-restart unless-stopped + logging: &default-logging + options: + max-size: 10m + max-file: 3 + +x-hardcoded-vars: + graph_db_user: &graph_db_user graph-node + graph_db_passwrod: &graph_db_passwrod let-me-in + graph_db_name: &graph_db_name graph-node + +x-general-env-variables: + postgres_user: &postgres_user ${POSTGRES_USER:-default} + postgres_password: &postgres_password ${POSTGRES_PASSWORD:-qwerty} + # MINIO VARS + minio_port: &minio_port ${MINIO_PORT:-9000} + minio_console_port: &minio_console_port ${MINIO_CONSOLE_PORT:-9001} + minio_root_user: &minio_root_user ${MINIO_ROOT_USER:-minioadmin} + minio_root_password: &minio_root_password ${MINIO_ROOT_PASSWORD:-minioadmin} + minio_services_access_key: &minio_services_access_key ${MINIO_SERVICES_ACCESS_KEY:-human-oracle} + minio_services_secret_key: &minio_services_secret_key ${MINIO_SERVICES_SECRET_KEY:-human-oracle-s3-secret} + # BUCKET NAMES + bucket_name_manifests: &bucket_name_manifests ${BUCKET_NAME_MANIFESTS:-manifests} + bucket_name_datasets: &bucket_name_datasets ${BUCKET_NAME_DATASETS:-datasets} + bucket_name_rep_o: &bucket_name_rep_o ${BUCKET_NAME_REPUTATION_ORACLE:-reputation-oracle} + bucket_name_fortune: &bucket_name_fortune ${BUCKEN_NAME_FORTUNE:-fortune} + +services: + blockchain-node: + container_name: hp-dev-blockchain-node + image: human-protocol/hardhat-blockchain-node + pull_policy: build + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/core/Dockerfile.local + healthcheck: + test: yarn local:readiness + interval: 15s + timeout: 30s + retries: 0 + networks: + - human_protocol_web3 + ports: + - name: node-port + target: 8545 + published: ${BLOCKCHAIN_NODE_PORT:-8545} + + ipfs: + container_name: hp-dev-ipfs + image: ipfs/kubo:v0.14.0 + restart: *default-restart + logging: + <<: *default-logging + healthcheck: + test: ["CMD-SHELL", "ipfs id > /dev/null"] + interval: 10s + timeout: 5s + retries: 3 + networks: + - human_protocol_web3 + ports: + - name: ipfs-port + target: 5001 + published: ${IPFS_PORT:-5010} + volumes: + - ipfs-data:/data/ipfs:Z + + graph-node-db: + container_name: hp-dev-graph-node-db + image: postgres:latest + restart: *default-restart + logging: + <<: *default-logging + networks: + - human_protocol_web3 + command: + [ + "postgres", + "-cshared_preload_libraries=pg_stat_statements", + "-cmax_connections=200" + ] + healthcheck: + test: ["CMD", "pg_isready"] + interval: 10s + timeout: 5s + retries: 5 + volumes: + - graph-node-db-data:/var/lib/postgresql/data:Z + environment: + POSTGRES_USER: *graph_db_user + POSTGRES_PASSWORD: *graph_db_passwrod + POSTGRES_DB: *graph_db_name + POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" + + graph-node: + container_name: hp-dev-graph-node + # In case of issues on Mac M1 rebuild the image for it locally + # https://github.com/graphprotocol/graph-node/blob/master/docker/README.md#running-graph-node-on-an-macbook-m1 + image: graphprotocol/graph-node + restart: *default-restart + logging: + <<: *default-logging + networks: + - human_protocol_web3 + ports: + - '8000:8000' + - '8001:8001' + - '8020:8020' + - '8030:8030' + - '8040:8040' + depends_on: + - blockchain-node + - ipfs + - graph-node-db + environment: + postgres_host: graph-node-db + postgres_user: *graph_db_user + postgres_pass: *graph_db_passwrod + postgres_db: *graph_db_name + ipfs: ipfs:5001 + ethereum: localhost:http://blockchain-node:8545 + GRAPH_LOG: info + healthcheck: + test: ["CMD-SHELL", "nc -z localhost 8000 || exit 1"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 10s + + postgres: + container_name: hp-dev-postgres + image: postgres:16 + restart: *default-restart + logging: + <<: *default-logging + ports: + - name: instance_port + target: 5432 + # default 5432 is used by CVAT installation + published: ${POSTGRES_PORT:-5433} + volumes: + - ./initdb:/docker-entrypoint-initdb.d + - postgres-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: *postgres_user + POSTGRES_PASSWORD: *postgres_password + healthcheck: + test: ["CMD", "pg_isready"] + interval: 10s + timeout: 5s + retries: 5 + + minio: + container_name: hp-dev-minio + image: minio/minio:RELEASE.2024-12-18T13-15-44Z + restart: *default-restart + logging: + <<: *default-logging + entrypoint: 'sh' + ports: + - name: instance_port + target: 9000 + published: *minio_port + - name: console_port + target: 9001 + published: *minio_console_port + volumes: + - minio-data:/data + environment: + MINIO_ROOT_USER: *minio_root_user + MINIO_ROOT_PASSWORD: *minio_root_password + command: + -c "minio server /data --console-address ':9001'" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 5s + timeout: 5s + retries: 3 + + minio-client: + container_name: hp-dev-minio-client + image: minio/mc:RELEASE.2024-11-21T17-21-54Z + depends_on: + minio: + condition: service_healthy + environment: + MINIO_ROOT_USER: *minio_root_user + MINIO_ROOT_PASSWORD: *minio_root_password + SERVICES_ACCESS_KEY: *minio_services_access_key + SERVICES_SECRET_KEY: *minio_services_secret_key + BUCKET_MANIFESTS: *bucket_name_manifests + BUCKET_DATASETS: *bucket_name_datasets + BUCKET_REPUTATION_ORACLE: *bucket_name_rep_o + BUCKET_FORTUNE: *bucket_name_fortune + entrypoint: > + /bin/sh -c " + mc alias set myminio http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD + + mc admin user add myminio $$SERVICES_ACCESS_KEY $$SERVICES_SECRET_KEY + mc admin policy attach myminio readwrite --user=$$SERVICES_ACCESS_KEY + + mc mb myminio/$$BUCKET_MANIFESTS; + mc anonymous set public myminio/$$BUCKET_MANIFESTS; + + mc mb myminio/$$BUCKET_DATASETS; + mc anonymous set public myminio/$$BUCKET_DATASETS; + + mc mb myminio/$$BUCKET_REPUTATION_ORACLE; + mc anonymous set public myminio/$$BUCKET_REPUTATION_ORACLE; + + mc mb myminio/$$BUCKET_FORTUNE; + mc anonymous set public myminio/$$BUCKET_FORTUNE; + " + +volumes: + ipfs-data: + graph-node-db-data: + postgres-data: + minio-data: + +networks: + human_protocol_web3: + name: human-protocol-web3 diff --git a/package.json b/package.json index d92d51468a..e101aba252 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,11 @@ "build:core": "yarn workspace @human-protocol/core build", "build:sdk": "yarn workspace @human-protocol/sdk build", "build:libs": "yarn build:core && yarn build:sdk", - "docker:infra-up": "make -C ./docker-setup check-env-file infra-up", - "docker:stop": "make -C ./docker-setup services-stop" + "docker:infra-up": "make -C ./docker-setup -f Makefile.dev infra-up", + "docker:infra-stop": "make -C ./docker-setup -f Makefile.dev infra-stop", + "docker:infra-down": "make -C ./docker-setup -f Makefile.dev infra-down", + "docker:web3-up": "make -C ./docker-setup -f Makefile.dev web3-up", + "docker:web3-down": "make -C ./docker-setup -f Makefile.dev web3-down" }, "workspaces": [ "packages/**" diff --git a/packages/apps/dashboard/server/src/app.module.ts b/packages/apps/dashboard/server/src/app.module.ts index 0f973c696c..6a9b8b9fb1 100644 --- a/packages/apps/dashboard/server/src/app.module.ts +++ b/packages/apps/dashboard/server/src/app.module.ts @@ -15,9 +15,10 @@ import { NetworksModule } from './modules/networks/networks.module'; @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], isGlobal: true, validationSchema: Joi.object({ HOST: Joi.string().required(), diff --git a/packages/apps/fortune/exchange-oracle/client/Dockerfile b/packages/apps/fortune/exchange-oracle/client/Dockerfile index b47c3f4c23..46f448db16 100644 --- a/packages/apps/fortune/exchange-oracle/client/Dockerfile +++ b/packages/apps/fortune/exchange-oracle/client/Dockerfile @@ -20,7 +20,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/fortune/exchange-oracle/server/.env.example b/packages/apps/fortune/exchange-oracle/server/.env.example index 6c0f17db8b..90f7f08c99 100644 --- a/packages/apps/fortune/exchange-oracle/server/.env.example +++ b/packages/apps/fortune/exchange-oracle/server/.env.example @@ -22,6 +22,7 @@ S3_USE_SSL=false WEB3_ENV=testnet WEB3_PRIVATE_KEY=replace_me RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +RPC_URL_LOCALHOST=http://0.0.0.0:8545 # PGP PGP_ENCRYPT=true diff --git a/packages/apps/fortune/exchange-oracle/server/Dockerfile b/packages/apps/fortune/exchange-oracle/server/Dockerfile index 29c97e32f6..2be71aa6b6 100644 --- a/packages/apps/fortune/exchange-oracle/server/Dockerfile +++ b/packages/apps/fortune/exchange-oracle/server/Dockerfile @@ -19,7 +19,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/fortune/exchange-oracle/server/package.json b/packages/apps/fortune/exchange-oracle/server/package.json index f808bbe57a..52e07a4a4a 100644 --- a/packages/apps/fortune/exchange-oracle/server/package.json +++ b/packages/apps/fortune/exchange-oracle/server/package.json @@ -23,7 +23,7 @@ "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "setup:local": "ts-node ./test/setup.ts", + "setup:local": "ts-node ./scripts/setup-staking.ts && LOCAL=true yarn setup:kvstore", "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "generate-env-doc": "ts-node scripts/generate-env-doc.ts" }, diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts b/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts index d7344a3d54..8a96dfc4c9 100644 --- a/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts +++ b/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts @@ -1,23 +1,37 @@ -import 'dotenv/config'; import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import * as dotenv from 'dotenv'; import { Wallet, ethers } from 'ethers'; import * as Minio from 'minio'; +const isLocalEnv = process.env.LOCAL === 'true'; + +let ENV_FILE_PATH = '.env'; +if (isLocalEnv) { + ENV_FILE_PATH += '.local'; +} +dotenv.config({ path: ENV_FILE_PATH }); + +const RPC_URL = isLocalEnv + ? process.env.RPC_URL_LOCALHOST + : process.env.RPC_URL_POLYGON_AMOY; + const SUPPORTED_JOB_TYPES = 'fortune'; const ROLE = Role.ExchangeOracle; async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { - const { SERVER_URL = 'http://localhost:5006', FEE = '1' } = process.env; + const { SERVER_URL, HOST, PORT, FEE = '1' } = process.env; if (SUPPORTED_JOB_TYPES.split(',').length === 0) { throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); } + + const serverUrl = SERVER_URL || `http://${HOST}:${PORT}`; try { - new URL(SERVER_URL || ''); - } catch (noop) { + new URL(serverUrl); + } catch (_noop) { throw new Error('Invalid SERVER_URL'); } - let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + let url = serverUrl.endsWith('/') ? serverUrl.slice(0, -1) : serverUrl; if (!url.startsWith('http')) { url = `http://${url}`; } @@ -74,14 +88,15 @@ async function setupPublicKeyFile( } async function setup(): Promise { - const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; - if (!WEB3_PRIVATE_KEY) { - throw new Error('Private key is empty'); - } if (!RPC_URL) { throw new Error('RPC url is empty'); } + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + const provider = new ethers.JsonRpcProvider(RPC_URL); const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); @@ -125,7 +140,7 @@ async function setup(): Promise { PGP_PUBLIC_KEY, PGP_PUBLIC_KEY_FILE = 'pgp-public-key-exco', } = process.env; - if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (PGP_ENCRYPT === 'true') { if (!PGP_PUBLIC_KEY) { throw new Error('PGP public key is empty'); } @@ -146,7 +161,7 @@ async function setup(): Promise { await setup(); process.exit(0); } catch (error) { - console.error('Failed to setup KV', error); + console.error('Failed to setup KV.', error); process.exit(1); } })(); diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts b/packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts new file mode 100644 index 0000000000..8d266da004 --- /dev/null +++ b/packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts @@ -0,0 +1,39 @@ +import { + ChainId, + NetworkData, + NETWORKS, + StakingClient, +} from '@human-protocol/sdk'; +import { HMToken__factory } from '@human-protocol/core/typechain-types'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; + +dotenv.config({ path: '.env.local' }); + +const RPC_URL = process.env.RPC_URL_LOCALHOST || 'http://0.0.0.0:8545'; + +export async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const { hmtAddress: hmtTokenAddress, stakingAddress } = NETWORKS[ + ChainId.LOCALHOST + ] as NetworkData; + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); + const hmtTx = await hmtContract.approve(stakingAddress, 1); + await hmtTx.wait(); + + const stakingClient = await StakingClient.build(wallet); + await stakingClient.stake(BigInt(1)); +} + +setup(); diff --git a/packages/apps/fortune/exchange-oracle/server/src/app.module.ts b/packages/apps/fortune/exchange-oracle/server/src/app.module.ts index 03f66a01ae..93f9f3f51f 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/app.module.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/app.module.ts @@ -54,7 +54,7 @@ import { HttpValidationPipe } from './common/pipes'; /** * First value found takes precendece */ - envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], validationSchema: envValidator, }), DatabaseModule, diff --git a/packages/apps/fortune/exchange-oracle/server/test/setup.ts b/packages/apps/fortune/exchange-oracle/server/test/setup.ts deleted file mode 100644 index 3792cdf6b3..0000000000 --- a/packages/apps/fortune/exchange-oracle/server/test/setup.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; -import { Wallet, ethers } from 'ethers'; -import * as dotenv from 'dotenv'; -import * as Minio from 'minio'; -dotenv.config({ path: '.env.local' }); - -export async function setup(): Promise { - const privateKey = process.env.WEB3_PRIVATE_KEY; - if (!privateKey) { - throw new Error('Private key is empty'); - } - const provider = new ethers.JsonRpcProvider('http://0.0.0.0:8545'); - const wallet = new Wallet(privateKey, provider); - - const kvStoreClient = await KVStoreClient.build(wallet); - await kvStoreClient.setBulk( - [ - KVStoreKeys.role, - KVStoreKeys.fee, - KVStoreKeys.webhookUrl, - KVStoreKeys.url, - KVStoreKeys.jobTypes, - ], - [ - Role.ExchangeOracle, - '1', - 'http://localhost:5001/webhook', - 'http://localhost:5001', - 'FORTUNE', - ], - { nonce: 0 }, - ); - if (process.env.PGP_ENCRYPT && process.env.PGP_ENCRYPT === 'true') { - if (!process.env.PGP_PUBLIC_KEY) { - throw new Error('PGP public key is empty'); - } - const minioClient = new Minio.Client({ - endPoint: process.env.S3_ENDPOINT || 'localhost', - port: parseInt(process.env.S3_PORT || '9000', 10), - useSSL: process.env.S3_USE_SSL === 'true', - accessKey: process.env.S3_ACCESS_KEY || 'access-key', - secretKey: process.env.S3_SECRET_KEY || 'secret-key', - }); - const bucket = process.env.S3_BUCKET || 'bucket'; - const fileName = 'exo-pgp-public-key.txt'; - const exists = await minioClient.bucketExists(bucket); - if (!exists) { - throw new Error('Bucket does not exists'); - } - try { - await minioClient.putObject( - bucket, - fileName, - process.env.PGP_PUBLIC_KEY, - { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-store', - }, - ); - await kvStoreClient.setFileUrlAndHash( - `http://localhost:9000/bucket/${fileName}`, - KVStoreKeys.publicKey, - { nonce: 1 }, - ); - } catch (e) { - console.log(e); - } - } -} - -setup(); diff --git a/packages/apps/fortune/recording-oracle/.env.example b/packages/apps/fortune/recording-oracle/.env.example index c2a7c1bc38..8705bc4911 100644 --- a/packages/apps/fortune/recording-oracle/.env.example +++ b/packages/apps/fortune/recording-oracle/.env.example @@ -13,6 +13,7 @@ S3_USE_SSL=false # Web3 WEB3_PRIVATE_KEY=replace_me RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +RPC_URL_LOCALHOST=http://0.0.0.0:8545 # Encryption PGP_ENCRYPT=true diff --git a/packages/apps/fortune/recording-oracle/Dockerfile b/packages/apps/fortune/recording-oracle/Dockerfile index bfe85f163b..2467774a14 100644 --- a/packages/apps/fortune/recording-oracle/Dockerfile +++ b/packages/apps/fortune/recording-oracle/Dockerfile @@ -19,7 +19,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/fortune/recording-oracle/package.json b/packages/apps/fortune/recording-oracle/package.json index 0ffebff104..8d18412b67 100644 --- a/packages/apps/fortune/recording-oracle/package.json +++ b/packages/apps/fortune/recording-oracle/package.json @@ -18,7 +18,7 @@ "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", - "setup:local": "ts-node ./test/setup.ts", + "setup:local": "ts-node ./scripts/setup-staking.ts && LOCAL=true yarn setup:kvstore", "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "generate-env-doc": "ts-node scripts/generate-env-doc.ts" }, diff --git a/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts b/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts index c1ad796570..99a865bd08 100644 --- a/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts +++ b/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts @@ -1,23 +1,37 @@ -import 'dotenv/config'; import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import * as dotenv from 'dotenv'; import { Wallet, ethers } from 'ethers'; import * as Minio from 'minio'; +const isLocalEnv = process.env.LOCAL === 'true'; + +let ENV_FILE_PATH = '.env'; +if (isLocalEnv) { + ENV_FILE_PATH += '.local'; +} +dotenv.config({ path: ENV_FILE_PATH }); + +const RPC_URL = isLocalEnv + ? process.env.RPC_URL_LOCALHOST + : process.env.RPC_URL_POLYGON_AMOY; + const SUPPORTED_JOB_TYPES = 'fortune'; const ROLE = Role.RecordingOracle; async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { - const { SERVER_URL = 'http://localhost:5007', FEE = '1' } = process.env; + const { SERVER_URL, HOST, PORT, FEE = '1' } = process.env; if (SUPPORTED_JOB_TYPES.split(',').length === 0) { throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); } + + const serverUrl = SERVER_URL || `http://${HOST}:${PORT}`; try { - new URL(SERVER_URL || ''); - } catch (noop) { + new URL(serverUrl); + } catch (_noop) { throw new Error('Invalid SERVER_URL'); } - let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + let url = serverUrl.endsWith('/') ? serverUrl.slice(0, -1) : serverUrl; if (!url.startsWith('http')) { url = `http://${url}`; } @@ -74,14 +88,15 @@ async function setupPublicKeyFile( } async function setup(): Promise { - const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; - if (!WEB3_PRIVATE_KEY) { - throw new Error('Private key is empty'); - } if (!RPC_URL) { throw new Error('RPC url is empty'); } + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + const provider = new ethers.JsonRpcProvider(RPC_URL); const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); @@ -125,7 +140,7 @@ async function setup(): Promise { PGP_PUBLIC_KEY, PGP_PUBLIC_KEY_FILE = 'pgp-public-key-reco', } = process.env; - if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (PGP_ENCRYPT === 'true') { if (!PGP_PUBLIC_KEY) { throw new Error('PGP public key is empty'); } @@ -146,7 +161,7 @@ async function setup(): Promise { await setup(); process.exit(0); } catch (error) { - console.error('Failed to setup KV', error); + console.error('Failed to setup KV.', error); process.exit(1); } })(); diff --git a/packages/apps/fortune/recording-oracle/scripts/setup-staking.ts b/packages/apps/fortune/recording-oracle/scripts/setup-staking.ts new file mode 100644 index 0000000000..8d266da004 --- /dev/null +++ b/packages/apps/fortune/recording-oracle/scripts/setup-staking.ts @@ -0,0 +1,39 @@ +import { + ChainId, + NetworkData, + NETWORKS, + StakingClient, +} from '@human-protocol/sdk'; +import { HMToken__factory } from '@human-protocol/core/typechain-types'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; + +dotenv.config({ path: '.env.local' }); + +const RPC_URL = process.env.RPC_URL_LOCALHOST || 'http://0.0.0.0:8545'; + +export async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const { hmtAddress: hmtTokenAddress, stakingAddress } = NETWORKS[ + ChainId.LOCALHOST + ] as NetworkData; + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); + const hmtTx = await hmtContract.approve(stakingAddress, 1); + await hmtTx.wait(); + + const stakingClient = await StakingClient.build(wallet); + await stakingClient.stake(BigInt(1)); +} + +setup(); diff --git a/packages/apps/fortune/recording-oracle/src/app.module.ts b/packages/apps/fortune/recording-oracle/src/app.module.ts index 8646dcfc09..68951d8b53 100644 --- a/packages/apps/fortune/recording-oracle/src/app.module.ts +++ b/packages/apps/fortune/recording-oracle/src/app.module.ts @@ -36,7 +36,7 @@ import { ExceptionFilter } from './common/exceptions/exception.filter'; /** * First value found takes precendece */ - envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], validationSchema: envValidator, }), JobModule, diff --git a/packages/apps/fortune/recording-oracle/test/setup.ts b/packages/apps/fortune/recording-oracle/test/setup.ts deleted file mode 100644 index 6c9e5348be..0000000000 --- a/packages/apps/fortune/recording-oracle/test/setup.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; -import { Wallet, ethers } from 'ethers'; -import * as dotenv from 'dotenv'; -import * as Minio from 'minio'; -dotenv.config({ path: '.env.local' }); - -export async function setup(): Promise { - const privateKey = process.env.WEB3_PRIVATE_KEY; - if (!privateKey) { - throw new Error('Private key is empty'); - } - const provider = new ethers.JsonRpcProvider('http://0.0.0.0:8545'); - const wallet = new Wallet(privateKey, provider); - - const kvStoreClient = await KVStoreClient.build(wallet); - await kvStoreClient.setBulk( - [KVStoreKeys.role, KVStoreKeys.fee, KVStoreKeys.webhookUrl], - [Role.RecordingOracle, '1', 'http://localhost:5002/webhook'], - { - nonce: 0, - }, - ); - - if (process.env.PGP_ENCRYPT && process.env.PGP_ENCRYPT === 'true') { - if (!process.env.PGP_PUBLIC_KEY) { - throw new Error('PGP public key is empty'); - } - const minioClient = new Minio.Client({ - endPoint: process.env.S3_ENDPOINT || 'localhost', - port: parseInt(process.env.S3_PORT || '9000', 10), - useSSL: process.env.S3_USE_SSL === 'true', - accessKey: process.env.S3_ACCESS_KEY || 'access-key', - secretKey: process.env.S3_SECRET_KEY || 'secret-key', - }); - const bucket = process.env.S3_BUCKET || 'bucket'; - const fileName = 'reco-pgp-public-key.txt'; - const exists = await minioClient.bucketExists(bucket); - if (!exists) { - throw new Error('Bucket does not exists'); - } - try { - await minioClient.putObject( - bucket, - fileName, - process.env.PGP_PUBLIC_KEY, - { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-store', - }, - ); - await kvStoreClient.setFileUrlAndHash( - `http://localhost:9000/bucket/${fileName}`, - KVStoreKeys.publicKey, - { - nonce: 1, - }, - ); - } catch (e) { - // eslint-disable-next-line no-console - console.log(e); - } - } -} - -setup(); diff --git a/packages/apps/human-app/frontend/Dockerfile b/packages/apps/human-app/frontend/Dockerfile index a00aea0d4f..7bb315121b 100644 --- a/packages/apps/human-app/frontend/Dockerfile +++ b/packages/apps/human-app/frontend/Dockerfile @@ -20,7 +20,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/human-app/server/Dockerfile b/packages/apps/human-app/server/Dockerfile index 0ea9aba025..c04bf24b04 100644 --- a/packages/apps/human-app/server/Dockerfile +++ b/packages/apps/human-app/server/Dockerfile @@ -19,7 +19,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/human-app/server/src/app.module.ts b/packages/apps/human-app/server/src/app.module.ts index 245654afe5..37292b384a 100644 --- a/packages/apps/human-app/server/src/app.module.ts +++ b/packages/apps/human-app/server/src/app.module.ts @@ -52,7 +52,10 @@ const JOI_BOOLEAN_STRING_SCHEMA = Joi.string().valid('true', 'false'); @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], isGlobal: true, validationSchema: Joi.object({ HOST: Joi.string().required(), diff --git a/packages/apps/job-launcher/client/Dockerfile b/packages/apps/job-launcher/client/Dockerfile index 6161f685f3..6229e58442 100644 --- a/packages/apps/job-launcher/client/Dockerfile +++ b/packages/apps/job-launcher/client/Dockerfile @@ -20,7 +20,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/job-launcher/server/.env.example b/packages/apps/job-launcher/server/.env.example index 00453220c9..73585bf6e8 100644 --- a/packages/apps/job-launcher/server/.env.example +++ b/packages/apps/job-launcher/server/.env.example @@ -23,6 +23,7 @@ S3_USE_SSL=false WEB3_ENV=testnet WEB3_PRIVATE_KEY=replace_me RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +RPC_URL_LOCALHOST=http://0.0.0.0:8545 REPUTATION_ORACLES=replace_me REPUTATION_ORACLE_ADDRESS=replace_me CVAT_EXCHANGE_ORACLE_ADDRESS=replace_me_if_needed diff --git a/packages/apps/job-launcher/server/Dockerfile b/packages/apps/job-launcher/server/Dockerfile index a9843df1f4..72663d1e27 100644 --- a/packages/apps/job-launcher/server/Dockerfile +++ b/packages/apps/job-launcher/server/Dockerfile @@ -19,7 +19,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/job-launcher/server/package.json b/packages/apps/job-launcher/server/package.json index 76da90322b..45917b536c 100644 --- a/packages/apps/job-launcher/server/package.json +++ b/packages/apps/job-launcher/server/package.json @@ -18,7 +18,7 @@ "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", - "setup:local": "ts-node ./test/setup.ts", + "setup:local": "ts-node ./scripts/setup-staking.ts && LOCAL=true yarn setup:kvstore", "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "lint": "eslint \"{src,test}/**/*.ts\" --fix", "test": "jest", diff --git a/packages/apps/job-launcher/server/scripts/setup-kv-store.ts b/packages/apps/job-launcher/server/scripts/setup-kv-store.ts index 2312158bfa..c2e0a89434 100644 --- a/packages/apps/job-launcher/server/scripts/setup-kv-store.ts +++ b/packages/apps/job-launcher/server/scripts/setup-kv-store.ts @@ -1,8 +1,20 @@ -import 'dotenv/config'; import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import * as dotenv from 'dotenv'; import { Wallet, ethers } from 'ethers'; import * as Minio from 'minio'; +const isLocalEnv = process.env.LOCAL === 'true'; + +let ENV_FILE_PATH = '.env'; +if (isLocalEnv) { + ENV_FILE_PATH += '.local'; +} +dotenv.config({ path: ENV_FILE_PATH }); + +const RPC_URL = isLocalEnv + ? process.env.RPC_URL_LOCALHOST + : process.env.RPC_URL_POLYGON_AMOY; + const DEFAULT_SUPPORTED_JOB_TYPES = 'fortune,image_boxes,image_boxes_from_points,image_points,image_polygons,image_skeletons_from_boxes'; const ROLE = Role.JobLauncher; @@ -10,19 +22,23 @@ const ROLE = Role.JobLauncher; async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { const { SUPPORTED_JOB_TYPES = DEFAULT_SUPPORTED_JOB_TYPES, - SERVER_URL = 'http://localhost:5003', + SERVER_URL, + HOST, + PORT, FEE = '1', } = process.env; if (SUPPORTED_JOB_TYPES.split(',').length === 0) { throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); } + + const serverUrl = SERVER_URL || `http://${HOST}:${PORT}`; try { - new URL(SERVER_URL || ''); + new URL(serverUrl); } catch (_noop) { throw new Error('Invalid SERVER_URL'); } - let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + let url = serverUrl.endsWith('/') ? serverUrl.slice(0, -1) : serverUrl; if (!url.startsWith('http')) { url = `http://${url}`; } @@ -79,14 +95,15 @@ async function setupPublicKeyFile( } async function setup(): Promise { - const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; - if (!WEB3_PRIVATE_KEY) { - throw new Error('Private key is empty'); - } if (!RPC_URL) { throw new Error('RPC url is empty'); } + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + const provider = new ethers.JsonRpcProvider(RPC_URL); const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); @@ -130,7 +147,7 @@ async function setup(): Promise { PGP_PUBLIC_KEY, PGP_PUBLIC_KEY_FILE = 'pgp-public-key', } = process.env; - if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (PGP_ENCRYPT === 'true') { if (!PGP_PUBLIC_KEY) { throw new Error('PGP public key is empty'); } @@ -151,7 +168,7 @@ async function setup(): Promise { await setup(); process.exit(0); } catch (error) { - console.error('Failed to setup KV', error); + console.error('Failed to setup KV.', error); process.exit(1); } })(); diff --git a/packages/apps/job-launcher/server/scripts/setup-staking.ts b/packages/apps/job-launcher/server/scripts/setup-staking.ts new file mode 100644 index 0000000000..8d266da004 --- /dev/null +++ b/packages/apps/job-launcher/server/scripts/setup-staking.ts @@ -0,0 +1,39 @@ +import { + ChainId, + NetworkData, + NETWORKS, + StakingClient, +} from '@human-protocol/sdk'; +import { HMToken__factory } from '@human-protocol/core/typechain-types'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; + +dotenv.config({ path: '.env.local' }); + +const RPC_URL = process.env.RPC_URL_LOCALHOST || 'http://0.0.0.0:8545'; + +export async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const { hmtAddress: hmtTokenAddress, stakingAddress } = NETWORKS[ + ChainId.LOCALHOST + ] as NetworkData; + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); + const hmtTx = await hmtContract.approve(stakingAddress, 1); + await hmtTx.wait(); + + const stakingClient = await StakingClient.build(wallet); + await stakingClient.stake(BigInt(1)); +} + +setup(); diff --git a/packages/apps/job-launcher/server/src/app.module.ts b/packages/apps/job-launcher/server/src/app.module.ts index 32fcb810cc..03fcb7b581 100644 --- a/packages/apps/job-launcher/server/src/app.module.ts +++ b/packages/apps/job-launcher/server/src/app.module.ts @@ -54,7 +54,7 @@ import { TransformEnumInterceptor } from './common/interceptors/transform-enum.i /** * First value found takes precendece */ - envFilePath: [`.env.${process.env.NODE_ENV}`, '.env'], + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], validationSchema: envValidator, }), DatabaseModule, diff --git a/packages/apps/job-launcher/server/test/setup.ts b/packages/apps/job-launcher/server/test/setup.ts deleted file mode 100644 index 05d8861d22..0000000000 --- a/packages/apps/job-launcher/server/test/setup.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - StakingClient, - KVStoreClient, - KVStoreKeys, - Role, -} from '@human-protocol/sdk'; -import { Wallet, ethers } from 'ethers'; -import { HMToken__factory } from '@human-protocol/core/typechain-types'; -import * as dotenv from 'dotenv'; -import * as Minio from 'minio'; -dotenv.config({ path: '.env.local' }); - -export async function setup(): Promise { - const privateKey = process.env.WEB3_PRIVATE_KEY; - if (!privateKey) { - throw new Error('Private key is empty'); - } - const provider = new ethers.JsonRpcProvider('http://0.0.0.0:8545'); - const hmtTokenAddress = '0x5FbDB2315678afecb367f032d93F642f64180aa3'; - const stakingAddress = '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512'; - const wallet = new Wallet(privateKey, provider); - - const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); - await ( - await hmtContract.approve(stakingAddress, 1, { - nonce: 0, - }) - ).wait(); - - const stakingClient = await StakingClient.build(wallet); - await stakingClient.stake(BigInt(1), { - nonce: 1, - }); - const kvStoreClient = await KVStoreClient.build(wallet); - - await kvStoreClient.setBulk( - [ - KVStoreKeys.role, - KVStoreKeys.fee, - KVStoreKeys.webhookUrl, - KVStoreKeys.url, - KVStoreKeys.jobTypes, - ], - [ - Role.JobLauncher, - '1', - 'http://localhost:5000/webhook', - 'http://localhost:5000', - 'type1, type2', - ], - { nonce: 2 }, - ); - - if (process.env.PGP_ENCRYPT && process.env.PGP_ENCRYPT === 'true') { - if (!process.env.PGP_PUBLIC_KEY) { - throw new Error('PGP public key is empty'); - } - const minioClient = new Minio.Client({ - endPoint: process.env.S3_ENDPOINT || 'localhost', - port: parseInt(process.env.S3_PORT || '9000', 10), - useSSL: process.env.S3_USE_SSL === 'true', - accessKey: process.env.S3_ACCESS_KEY || 'access-key', - secretKey: process.env.S3_SECRET_KEY || 'secret-key', - }); - const bucket = process.env.S3_BUCKET || 'bucket'; - const fileName = 'jl-pgp-public-key.txt'; - const exists = await minioClient.bucketExists(bucket); - if (!exists) { - throw new Error('Bucket does not exists'); - } - try { - await minioClient.putObject( - bucket, - fileName, - process.env.PGP_PUBLIC_KEY, - { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-store', - }, - ); - await kvStoreClient.setFileUrlAndHash( - `http://localhost:9000/bucket/${fileName}`, - KVStoreKeys.publicKey, - { nonce: 3 }, - ); - } catch (e) { - console.log(e); - } - } -} - -setup(); diff --git a/packages/apps/reputation-oracle/server/.env.example b/packages/apps/reputation-oracle/server/.env.example index e08449b539..c3c6a028ce 100644 --- a/packages/apps/reputation-oracle/server/.env.example +++ b/packages/apps/reputation-oracle/server/.env.example @@ -48,6 +48,7 @@ EMAIL_FROM_NAME="Reputation Oracle Local" WEB3_ENV=testnet WEB3_PRIVATE_KEY=replace_me RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +RPC_URL_LOCALHOST=http://0.0.0.0:8545 # Encryption PGP_ENCRYPT=true diff --git a/packages/apps/reputation-oracle/server/Dockerfile b/packages/apps/reputation-oracle/server/Dockerfile index 075c163e0e..dff82f8a3e 100644 --- a/packages/apps/reputation-oracle/server/Dockerfile +++ b/packages/apps/reputation-oracle/server/Dockerfile @@ -19,7 +19,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/reputation-oracle/server/package.json b/packages/apps/reputation-oracle/server/package.json index f4d91c2a12..966238f64d 100644 --- a/packages/apps/reputation-oracle/server/package.json +++ b/packages/apps/reputation-oracle/server/package.json @@ -18,7 +18,7 @@ "migration:revert": "yarn build && typeorm-ts-node-commonjs migration:revert -d typeorm-migrations-datasource.ts", "migration:run": "yarn build && typeorm-ts-node-commonjs migration:run -d typeorm-migrations-datasource.ts", "migration:show": "yarn build && typeorm-ts-node-commonjs migration:show -d typeorm-migrations-datasource.ts", - "setup:local": "ts-node ./scripts/setup-kv-store.ts", + "setup:local": "ts-node ./scripts/setup-staking.ts && LOCAL=true yarn setup:kvstore", "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", diff --git a/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts b/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts index 38e117cc00..e64b8aaf7f 100644 --- a/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts +++ b/packages/apps/reputation-oracle/server/scripts/setup-kv-store.ts @@ -1,8 +1,20 @@ -import 'dotenv/config'; import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import * as dotenv from 'dotenv'; import { Wallet, ethers } from 'ethers'; import * as Minio from 'minio'; +const isLocalEnv = process.env.LOCAL === 'true'; + +let ENV_FILE_PATH = '.env'; +if (isLocalEnv) { + ENV_FILE_PATH += '.local'; +} +dotenv.config({ path: ENV_FILE_PATH }); + +const RPC_URL = isLocalEnv + ? process.env.RPC_URL_LOCALHOST + : process.env.RPC_URL_POLYGON_AMOY; + const DEFAULT_SUPPORTED_JOB_TYPES = 'fortune,image_boxes,image_boxes_from_points,image_points,image_polygons,image_skeletons_from_boxes'; const ROLE = Role.ReputationOracle; @@ -10,19 +22,23 @@ const ROLE = Role.ReputationOracle; async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { const { SUPPORTED_JOB_TYPES = DEFAULT_SUPPORTED_JOB_TYPES, - SERVER_URL = 'http://localhost:5001', + SERVER_URL, + HOST, + PORT, FEE = '1', } = process.env; if (SUPPORTED_JOB_TYPES.split(',').length === 0) { throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); } + + const serverUrl = SERVER_URL || `http://${HOST}:${PORT}`; try { - new URL(SERVER_URL || ''); + new URL(serverUrl); } catch (noop) { throw new Error('Invalid SERVER_URL'); } - let url = SERVER_URL.endsWith('/') ? SERVER_URL.slice(0, -1) : SERVER_URL; + let url = serverUrl.endsWith('/') ? serverUrl.slice(0, -1) : serverUrl; if (!url.startsWith('http')) { url = `http://${url}`; } @@ -79,14 +95,15 @@ async function setupPublicKeyFile( } async function setup(): Promise { - const { WEB3_PRIVATE_KEY, RPC_URL_POLYGON_AMOY: RPC_URL } = process.env; - if (!WEB3_PRIVATE_KEY) { - throw new Error('Private key is empty'); - } if (!RPC_URL) { throw new Error('RPC url is empty'); } + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + const provider = new ethers.JsonRpcProvider(RPC_URL); const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); @@ -94,6 +111,18 @@ async function setup(): Promise { await setupCommonValues(kvStoreClient); + if (isLocalEnv) { + const { ACTIVE_ORACLE_ADDRESSES } = process.env; + if (ACTIVE_ORACLE_ADDRESSES) { + const oracleAddresses = ACTIVE_ORACLE_ADDRESSES.split(',') + .map((addr) => addr.trim()) + .filter(Boolean); + for (const address of oracleAddresses) { + await kvStoreClient.set(address, 'active'); + } + } + } + const { S3_ENDPOINT, S3_PORT, @@ -130,7 +159,7 @@ async function setup(): Promise { PGP_PUBLIC_KEY, PGP_PUBLIC_KEY_FILE = 'pgp-public-key', } = process.env; - if (PGP_ENCRYPT && PGP_ENCRYPT === 'true') { + if (PGP_ENCRYPT === 'true') { if (!PGP_PUBLIC_KEY) { throw new Error('PGP public key is empty'); } @@ -163,7 +192,7 @@ async function setup(): Promise { await setup(); process.exit(0); } catch (error) { - console.error('Failed to setup KV', error); + console.error('Failed to setup KV.', error); process.exit(1); } })(); diff --git a/packages/apps/reputation-oracle/server/scripts/setup-staking.ts b/packages/apps/reputation-oracle/server/scripts/setup-staking.ts new file mode 100644 index 0000000000..8d266da004 --- /dev/null +++ b/packages/apps/reputation-oracle/server/scripts/setup-staking.ts @@ -0,0 +1,39 @@ +import { + ChainId, + NetworkData, + NETWORKS, + StakingClient, +} from '@human-protocol/sdk'; +import { HMToken__factory } from '@human-protocol/core/typechain-types'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; + +dotenv.config({ path: '.env.local' }); + +const RPC_URL = process.env.RPC_URL_LOCALHOST || 'http://0.0.0.0:8545'; + +export async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const { hmtAddress: hmtTokenAddress, stakingAddress } = NETWORKS[ + ChainId.LOCALHOST + ] as NetworkData; + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); + const hmtTx = await hmtContract.approve(stakingAddress, 1); + await hmtTx.wait(); + + const stakingClient = await StakingClient.build(wallet); + await stakingClient.stake(BigInt(1)); +} + +setup(); diff --git a/packages/apps/reputation-oracle/server/src/app.module.ts b/packages/apps/reputation-oracle/server/src/app.module.ts index eef8a16222..87b88ef05d 100644 --- a/packages/apps/reputation-oracle/server/src/app.module.ts +++ b/packages/apps/reputation-oracle/server/src/app.module.ts @@ -73,7 +73,7 @@ import Environment from './utils/environment'; /** * First value found takes precendece */ - envFilePath: [`.env.${Environment.name}`, '.env'], + envFilePath: [`.env.${Environment.name}`, '.env.local', '.env'], validationSchema: envValidator, }), EnvConfigModule, diff --git a/packages/apps/reputation-oracle/server/src/utils/environment.ts b/packages/apps/reputation-oracle/server/src/utils/environment.ts index b28db18424..05d5c87255 100644 --- a/packages/apps/reputation-oracle/server/src/utils/environment.ts +++ b/packages/apps/reputation-oracle/server/src/utils/environment.ts @@ -1,4 +1,5 @@ enum EnvironmentName { + LOCAL = 'local', DEVELOPMENT = 'development', TEST = 'test', STAGING = 'staging', @@ -10,9 +11,11 @@ class Environment { process.env.NODE_ENV || EnvironmentName.DEVELOPMENT; static isDevelopment(): boolean { - return [EnvironmentName.DEVELOPMENT, EnvironmentName.TEST].includes( - Environment.name as EnvironmentName, - ); + return [ + EnvironmentName.DEVELOPMENT, + EnvironmentName.TEST, + EnvironmentName.LOCAL, + ].includes(Environment.name as EnvironmentName); } static isTest(): boolean { diff --git a/packages/core/Dockerfile.local b/packages/core/Dockerfile.local new file mode 100644 index 0000000000..b0d52e02dc --- /dev/null +++ b/packages/core/Dockerfile.local @@ -0,0 +1,29 @@ +FROM node:22.14-slim +ARG APP_PATH=packages/core + +# curl is needed for healthcheck +RUN apt-get update && apt-get install -y curl + +WORKDIR /usr/src/app + +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +RUN yarn install + +# Copy base TS config that is required to build package +COPY tsconfig.base.json ./ +# Copy package itself +COPY packages/core ./packages/core + +WORKDIR ./${APP_PATH} + +RUN yarn build + +EXPOSE 8545 +CMD yarn local diff --git a/packages/core/package.json b/packages/core/package.json index 1d41ca699f..e86c6d50f4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -18,6 +18,8 @@ "test": "hardhat test", "test:coverage": "hardhat coverage", "local": "concurrently --hide 0 \"hardhat node --hostname 0.0.0.0\" \"yarn deploy:local\"", + "local:liveness": "sh ./scripts/local-healthcheck.sh liveness", + "local:readiness": "sh ./scripts/local-healthcheck.sh readiness", "deploy": "hardhat run scripts/deploy.ts", "deploy:local": "yarn deploy --network localhost", "deploy:proxy": "hardhat run scripts/deploy-proxies.ts", diff --git a/packages/core/scripts/local-healthcheck.sh b/packages/core/scripts/local-healthcheck.sh new file mode 100755 index 0000000000..7b38b75058 --- /dev/null +++ b/packages/core/scripts/local-healthcheck.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +PORT="${PORT:-8545}" +RPC_URL="http://localhost:$PORT" + +liveness() { + echo "Waiting for $RPC_URL to respond with its version" + while true + do + RESPONSE_BODY=$(curl -s -X POST "$RPC_URL" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}') + RPC_VERSION=$(echo "$RESPONSE_BODY" | grep -o '"result":"[^"]*"' | awk -F'"' '{print $4}') + + if [ -n "$RPC_VERSION" ]; then + echo "RPC is live: $RPC_VERSION" + break + fi + + echo "Waiting..." + sleep 2 + done +} + +# Using a magic nubmer of 23 here because this is a block number when local node is ready to use +READINESS_BLOCK_NUMBER=23 + +readiness() { + echo "Waiting for $RPC_URL to reach the desired block #$READINESS_BLOCK_NUMBER" + while true + do + RESPONSE_BODY=$(curl -s -X POST "$RPC_URL" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}') + BLOCK_NUMBER_HEX=$(echo "$RESPONSE_BODY" | grep -o '"result":"[^"]*"' | awk -F'"' '{print $4}') + BLOCK_NUMBER=$((BLOCK_NUMBER_HEX)) + + if [ "$BLOCK_NUMBER" -ge $READINESS_BLOCK_NUMBER ]; then + echo "RPC is ready" + break + fi + + echo "Waiting..." + sleep 2 + done +} + +# Call the function passed as the first argument +"$@" diff --git a/packages/examples/cvat/exchange-oracle/docker-compose.dev.yml b/packages/examples/cvat/exchange-oracle/docker-compose.dev.yml index cce17d493e..065297be48 100644 --- a/packages/examples/cvat/exchange-oracle/docker-compose.dev.yml +++ b/packages/examples/cvat/exchange-oracle/docker-compose.dev.yml @@ -59,7 +59,7 @@ services: minio-mc: container_name: minio-mc - image: minio/mc + image: minio/mc:RELEASE.2022-06-10T22-29-12Z depends_on: minio: condition: service_healthy diff --git a/packages/examples/cvat/exchange-oracle/docker-compose.test.yml b/packages/examples/cvat/exchange-oracle/docker-compose.test.yml index b0008b65e7..f6a1ad6e3d 100644 --- a/packages/examples/cvat/exchange-oracle/docker-compose.test.yml +++ b/packages/examples/cvat/exchange-oracle/docker-compose.test.yml @@ -50,7 +50,7 @@ services: minio-mc: container_name: minio-mc - image: minio/mc + image: minio/mc:RELEASE.2022-06-10T22-29-12Z depends_on: minio: condition: service_healthy diff --git a/packages/examples/cvat/recording-oracle/README.MD b/packages/examples/cvat/recording-oracle/README.MD index c7c4e6ad1a..55faf0c916 100644 --- a/packages/examples/cvat/recording-oracle/README.MD +++ b/packages/examples/cvat/recording-oracle/README.MD @@ -19,14 +19,14 @@ For deployment it is required to have PostgreSQL(v14.4) ### Run the oracle locally: ``` -docker-compose -f docker-compose.dev.yml up -d +docker compose -f docker-compose.dev.yml up -d ./bin/start_dev.sh ``` or ``` -docker-compose -f docker-compose.dev.yml up -d +docker compose -f docker-compose.dev.yml up -d ./bin/start_debug.sh ``` @@ -70,5 +70,5 @@ Available at `/docs` route To run tests ``` -docker-compose -f docker-compose.test.yml up --build test --attach test --exit-code-from test +docker compose -f docker-compose.test.yml up --build test --attach test --exit-code-from test ``` diff --git a/packages/examples/cvat/recording-oracle/docker-compose.test.yml b/packages/examples/cvat/recording-oracle/docker-compose.test.yml index 1afd482cee..78864bc313 100644 --- a/packages/examples/cvat/recording-oracle/docker-compose.test.yml +++ b/packages/examples/cvat/recording-oracle/docker-compose.test.yml @@ -14,13 +14,12 @@ services: blockchain-node: build: context: ../../../../ - dockerfile: packages/examples/cvat/recording-oracle/dockerfiles/blockchain-node.Dockerfile + dockerfile: packages/core/Dockerfile.local healthcheck: - # Using a magic nubmer of 23 here because this is a block number when blockchain-node container is ready to use - test: if [ $(( $(wget -q --post-data='{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -O- http://localhost:8545 | grep -o '"result":"[^"]*"' | awk -F'"' '{print $4}' ) )) -ge 23 ]; then exit 0; else exit 1; fi + test: yarn local:readiness interval: 15s - timeout: 5s - retries: 5 + timeout: 30s + retries: 0 networks: - test-network @@ -46,7 +45,7 @@ services: minio-mc: container_name: minio-mc - image: minio/mc + image: minio/mc:RELEASE.2022-06-10T22-29-12Z depends_on: minio: condition: service_healthy diff --git a/packages/examples/cvat/recording-oracle/dockerfiles/blockchain-node.Dockerfile b/packages/examples/cvat/recording-oracle/dockerfiles/blockchain-node.Dockerfile index e56d03e5c9..a12cd5271c 100644 --- a/packages/examples/cvat/recording-oracle/dockerfiles/blockchain-node.Dockerfile +++ b/packages/examples/cvat/recording-oracle/dockerfiles/blockchain-node.Dockerfile @@ -1,8 +1,8 @@ # TODO: make this shared and part of local setup FROM node:22.14-slim -# wget is needed for healthcheck -RUN apt-get update && apt-get install -y wget +# curl is needed for healthcheck +RUN apt-get update && apt-get install -y curl WORKDIR /usr/src/app diff --git a/packages/sdk/typescript/human-protocol-sdk/example/local-node.ts b/packages/sdk/typescript/human-protocol-sdk/example/local-node.ts new file mode 100644 index 0000000000..74e3ea049d --- /dev/null +++ b/packages/sdk/typescript/human-protocol-sdk/example/local-node.ts @@ -0,0 +1,83 @@ +import { Wallet, ethers } from 'ethers'; +import { setTimeout } from 'timers/promises'; + +import { ChainId } from '../src/enums'; +import { KVStoreClient, KVStoreUtils } from '../src/kvstore'; + +const LOCALHOST_RPC_URL = 'http://localhost:8545'; + +/** + * Default is last signer account of local hardhat node. + */ +const PRIVATE_KEY = + process.env.PRIVATE_KEY || + '0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e'; + +const CREATED_AT_KV_KEY = 'created_at'; +const UPDATED_AT_KV_KEY = 'last_touched_at'; +const TOUCHED_TIMES_KV_KEY = 'touches_count'; + +const run = async () => { + const provider = new ethers.JsonRpcProvider(LOCALHOST_RPC_URL); + const wallet = new Wallet(PRIVATE_KEY, provider); + + const walletAddress = wallet.address; + console.log(`Wallet address: ${walletAddress}`); + + const kvStoreClient = await KVStoreClient.build(wallet); + const currentDate = new Date().toISOString(); + + const existingKeys = await KVStoreUtils.getKVStoreData( + ChainId.LOCALHOST, + walletAddress + ); + + if (existingKeys.length === 0) { + console.log('No KV data; initializing'); + await kvStoreClient.setBulk( + [CREATED_AT_KV_KEY, TOUCHED_TIMES_KV_KEY], + [currentDate, '0'] + ); + } else { + console.log('KV data found; updating'); + const touchedTimesData = existingKeys.find( + (d) => d.key === TOUCHED_TIMES_KV_KEY + ) || { value: '0' }; + + let touchedTimes = Number(touchedTimesData.value); + + if (!Number.isSafeInteger(touchedTimes)) { + touchedTimes = 0; + } + touchedTimes += 1; + + await kvStoreClient.setBulk( + [UPDATED_AT_KV_KEY, TOUCHED_TIMES_KV_KEY], + [currentDate, touchedTimes.toString()] + ); + } + + console.log('Finished setting values in KV store. Wait and read'); + /** + * Usually data is indexed almost immediately on local subgraph, + * but there might be a delay if machine is slow or loaded, + * so adding small delay here as well just in case. + */ + await setTimeout(1000 * 2); + + const kvData = await KVStoreUtils.getKVStoreData( + ChainId.LOCALHOST, + walletAddress + ); + console.log('Final KV store data:', kvData); +}; + +(async () => { + try { + await run(); + process.exit(0); + } catch (error) { + console.log('Failed', error); + process.exit(1); + } +})(); diff --git a/packages/sdk/typescript/human-protocol-sdk/package.json b/packages/sdk/typescript/human-protocol-sdk/package.json index 8c5060ab0f..c1a59d5d76 100644 --- a/packages/sdk/typescript/human-protocol-sdk/package.json +++ b/packages/sdk/typescript/human-protocol-sdk/package.json @@ -52,6 +52,7 @@ "devDependencies": { "eslint": "^8.55.0", "prettier": "^3.4.2", + "ts-node": "^10.9.2", "typedoc": "^0.28.4", "typedoc-plugin-markdown": "^4.2.3", "typescript": "^5.8.3" diff --git a/packages/sdk/typescript/human-protocol-sdk/src/utils.ts b/packages/sdk/typescript/human-protocol-sdk/src/utils.ts index 4cff1453ed..c687293e3c 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/utils.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/utils.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { ethers } from 'ethers'; +import { ChainId } from './enums'; import { ContractExecutionError, EthereumError, @@ -66,7 +67,7 @@ export const getSubgraphUrl = (networkData: NetworkData) => { SUBGRAPH_API_KEY_PLACEHOLDER, process.env.SUBGRAPH_API_KEY ); - } else { + } else if (networkData.chainId !== ChainId.LOCALHOST) { // eslint-disable-next-line no-console console.warn(WarnSubgraphApiKeyNotProvided); } diff --git a/packages/sdk/typescript/subgraph/README.md b/packages/sdk/typescript/subgraph/README.md index f41e99f4ed..5d0357cc2b 100644 --- a/packages/sdk/typescript/subgraph/README.md +++ b/packages/sdk/typescript/subgraph/README.md @@ -26,9 +26,42 @@ To get more information about how the graph works : Package installation ``` -yarn install +yarn install && yarn workspace human-protocol build:core ``` +## Development +### Tests + +To run tests next commands should be executed: + +```bash +NETWORK=polygon yarn generate + +yarn codegen + +yarn build + +yarn test +``` + +### e2e test using local node +You can e2e test subgraph changes by running blockchain and graph node locally. To do so, first you will need to run necessary infra in Docker: +```bash +yarn workspace human-protocol docker:web3-up +``` +> In case you already have such infra running and want a clean start w/o previous data - run `yarn workspace human-protocol docker:web3-down` first + +After you have the infra running: +```bash +# Generate artifacts for running subgraph on localhost +NETWORK=localhost yarn generate +# Create graph for localhost +yarn create-local +# Deploy the graph +yarn deploy-local +``` +After that subgraph should be available on `http://0.0.0.0:8000/subgraphs/name/humanprotocol/localhost` + ## 🏊 Deploying graphs for live networks 1. Generate & deploy on matic @@ -49,20 +82,6 @@ You can access it on `http://localhost:8020/` The deployment of the graph on each network is automatically triggered by the github CI when mofications are made on the subgraph. -### Tests - -To run tests next commands should be executed: - -```bash -NETWORK=polygon yarn generate - -yarn codegen - -yarn build - -yarn test -``` - ### Supported networks Following networks are supported : diff --git a/packages/sdk/typescript/subgraph/docker-compose.yml b/packages/sdk/typescript/subgraph/docker-compose.yml deleted file mode 100644 index 4a95d4a5f8..0000000000 --- a/packages/sdk/typescript/subgraph/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: '3' -services: - graph-node: - hostname: graph-node - image: graphprotocol/graph-node - ports: - - 8000:8000 - - 8001:8001 - - 8020:8020 - - 8030:8030 - - 8040:8040 - depends_on: - - ipfs - - postgres - # extra_hosts: - # - host.docker.internal:host-gateway - environment: - postgres_host: postgres - postgres_user: graph-node - postgres_pass: let-me-in - postgres_db: graph-node - ipfs: 'ipfs:5001' - ethereum: 'localhost:http://host.docker.internal:8545' - GRAPH_LOG: info - ipfs: - hostname: ipfs - image: ipfs/kubo:v0.14.0 - ports: - - 5010:5001 - postgres: - hostname: postgres - image: postgres:14 - ports: - - 5435:5432 - command: - [ - "postgres", - "-cshared_preload_libraries=pg_stat_statements", - "-cmax_connections=200" - ] - environment: - POSTGRES_USER: graph-node - POSTGRES_PASSWORD: let-me-in - POSTGRES_DB: graph-node - PGDATA: "/var/lib/postgresql/data" - POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" \ No newline at end of file diff --git a/packages/sdk/typescript/subgraph/local-graph-status.sh b/packages/sdk/typescript/subgraph/local-graph-status.sh new file mode 100755 index 0000000000..4025b2cfa7 --- /dev/null +++ b/packages/sdk/typescript/subgraph/local-graph-status.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +GRAPHQL_URL="http://localhost:8030/graphql" + + +node_health() { + RESPONSE_BODY=$(curl -s -X POST "$GRAPHQL_URL" -H 'Content-Type: application/json' --data '{"query": "{ version { version } }"}') + VERSION=$(echo "$RESPONSE_BODY" | grep -o '"version":"[^"]*"' | awk -F'"' '{print $4}') + + if [ -n "$VERSION" ]; then + echo "Graph node is healthy. Version is $VERSION" + exit 0 + else + echo "Graph node is not healthy" + exit 1 + fi +} + +subgraph_health() { + if [ -z "$SUBGRAPH_NAME" ]; then + echo "Error: SUBGRAPH_NAME environment variable is not set" + exit 1 + fi + + RESPONSE_BODY=$(curl -s -X POST "$GRAPHQL_URL" -H 'Content-Type: application/json' --data "{ \"query\": \"{indexingStatusForCurrentVersion(subgraphName: \\\"$SUBGRAPH_NAME\\\") { health } }\" }") + STATUS=$(echo "$RESPONSE_BODY" | grep -o '"health":"[^"]*"' | awk -F'"' '{print $4}') + + if [[ "$STATUS" == "healthy" ]]; then + echo "Subgraph is healthy" + exit 0 + else + echo "Subgraph is not healthy: $STATUS" + exit 1 + fi +} + +# Call the function passed as the first argument +"$@" diff --git a/packages/sdk/typescript/subgraph/package.json b/packages/sdk/typescript/subgraph/package.json index 422205b212..9978300489 100644 --- a/packages/sdk/typescript/subgraph/package.json +++ b/packages/sdk/typescript/subgraph/package.json @@ -18,11 +18,11 @@ "create-local": "graph create --node http://localhost:8020/ humanprotocol/localhost", "remove-local": "graph remove --node http://localhost:8020/ humanprotocol/localhost", "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5010 humanprotocol/localhost -l 0", + "health-local:node": "sh ./local-graph-status.sh node_health", + "health-local:subgraph": "SUBGRAPH_NAME=humanprotocol/localhost sh ./local-graph-status.sh subgraph_health", "lint": "eslint .", "lint:fix": "eslint . --fix", - "format": "prettier --write '**/*.{ts,json,graphql}'", - "local:node:up": "sleep 3 && docker compose up -d && NETWORK=localhost yarn generate && sleep 10 && yarn create-local && yarn deploy-local", - "local:node:down": "docker compose down" + "format": "prettier --write '**/*.{ts,json,graphql}'" }, "repository": { "type": "git", diff --git a/scripts/Makefile b/scripts/Makefile deleted file mode 100644 index d8c6d6f6bd..0000000000 --- a/scripts/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -.PHONY: check-file fortune - -check-core-folders: - @if [ ! -d "../packages/core/abis/legacy" ] || [ ! -d "../packages/core/typechain-types" ]; then \ - yarn workspace human-protocol build:libs; \ - fi - -create-env-files: - @if [ ! -f "../packages/apps/job-launcher/server/.env.local" ]; then \ - cp ./fortune/.env.jl-server ../packages/apps/job-launcher/server/.env.local ; \ - fi - - @if [ ! -f "../packages/apps/job-launcher/client/.env.local" ]; then \ - cp ./fortune/.env.jl-client ../packages/apps/job-launcher/client/.env.local ; \ - fi - - @if [ ! -f "../packages/apps/fortune/exchange-oracle/server/.env.local" ]; then \ - cp ./fortune/.env.exco-server ../packages/apps/fortune/exchange-oracle/server/.env.local ; \ - fi - - @if [ ! -f "../packages/apps/fortune/recording-oracle/.env.local" ]; then \ - cp ./fortune/.env.rec-oracle ../packages/apps/fortune/recording-oracle/.env.local ; \ - fi - - @if [ ! -f "../packages/apps/reputation-oracle/server/.env.local" ]; then \ - cp ./fortune/.env.rep-oracle ../packages/apps/reputation-oracle/server/.env.local ; \ - fi - -hardhat-node: - yarn workspace @human-protocol/core local - -subgraph: - docker compose -f ./fortune/docker-compose.yml up -d graph-node - NETWORK=localhost yarn workspace @human-protocol/subgraph generate - @while [ $$(docker inspect --format='{{.State.Health.Status}}' graph-node) != "healthy" ]; do \ - sleep 2; \ - done; \ - echo "Container is healthy." - yarn workspace @human-protocol/subgraph create-local - yarn workspace @human-protocol/subgraph deploy-local - -minio: - docker compose -f ./fortune/docker-compose.yml up -d minio-mc - -database: - docker compose -f ./fortune/docker-compose.yml up -d postgres - -job-launcher-server: rpc-health-check - yarn workspace @human-protocol/job-launcher-server setup:local - NODE_ENV=local yarn workspace @human-protocol/job-launcher-server migration:run - NODE_ENV=local yarn workspace @human-protocol/job-launcher-server start:dev - -job-launcher-client: - NODE_ENV=local yarn workspace @human-protocol/job-launcher-client start - -fortune-exchange-oracle: rpc-health-check - yarn workspace @human-protocol/fortune-exchange-oracle-server setup:local - NODE_ENV=local yarn workspace @human-protocol/fortune-exchange-oracle-server migration:run - NODE_ENV=local yarn workspace @human-protocol/fortune-exchange-oracle-server start:dev - -fortune-recording-oracle: rpc-health-check - yarn workspace @human-protocol/fortune-recording-oracle setup:local - NODE_ENV=local yarn workspace @human-protocol/fortune-recording-oracle start:dev - -reputation-oracle: rpc-health-check - yarn workspace @human-protocol/reputation-oracle setup:local - NODE_ENV=local yarn workspace @human-protocol/reputation-oracle migration:run - NODE_ENV=local yarn workspace @human-protocol/reputation-oracle start:dev - -rpc-health-check: - @until curl -s -X POST "http://localhost:8545" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' | grep -q "result"; do \ - sleep 2; \ - done - -fortune: check-core-folders minio - @echo "RUNNING FORTUNE..." - @trap 'echo "STOPPING FORTUNE.."; kill -9 $$PID_HARDHAT $$PID_JL_CLIENT $$PID_JL_SERVER $$PID_EXO $$PID_RECO $$PID_REPO; docker compose -f ./fortune/docker-compose.yml down; exit 0' SIGINT ERR; \ - $(MAKE) hardhat-node & PID_HARDHAT=$$!; \ - $(MAKE) job-launcher-client & PID_JL_CLIENT=$$!; \ - $(MAKE) job-launcher-server & PID_JL_SERVER=$$!; \ - $(MAKE) fortune-exchange-oracle & PID_EXO=$$!; \ - $(MAKE) fortune-recording-oracle & PID_RECO=$$!; \ - $(MAKE) reputation-oracle & PID_REPO=$$!; \ - $(MAKE) subgraph & \ - wait - -web3-subgraph: - docker compose -f ./web3/docker-compose.yml up -d graph-node - NETWORK=localhost yarn workspace @human-protocol/subgraph generate - @while [ $$(docker inspect --format='{{.State.Health.Status}}' graph-node) != "healthy" ]; do \ - sleep 2; \ - done; \ - echo "Container is healthy." - yarn workspace @human-protocol/subgraph create-local - yarn workspace @human-protocol/subgraph deploy-local - -web3: check-core-folders - @echo "RUNNING WEB3..." - @trap 'echo "STOPPING WEB3.."; kill -9 $$PID_HARDHAT; docker compose -f ./web3/docker-compose.yml down; exit 0' SIGINT ERR; \ - $(MAKE) hardhat-node & PID_HARDHAT=$$!; \ - $(MAKE) web3-subgraph & \ - wait diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index 3d48a5e42c..0000000000 --- a/scripts/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# LOCAL ENVIRONMENT SETUP SCRIPTS - -## Fortune - -### Command: `make fortune` - -Previous steps: -- Run `make create-env-files` -- Edit `../packages/apps/job-launcher/server/.env.local`: - - Set a working key for `SENDGRID_API_KEY`. - - Set a working key for `STRIPE_SECRET_KEY` in case Stripe is needed. -- Edit `../packages/apps/job-launcher/client/.env.local`: - - Set a working key for `VITE_APP_STRIPE_PUBLISHABLE_KEY` in case Stripe is needed. - - -This command runs the following services: -- Hardhat node: port 8545 -- Subgraph node: http://localhost:8000/subgraphs/name/humanprotocol/localhost -- Postgres database: port 5432 -- IPFS: port 5010 -- Minio bucket: http://localhost:9001 (user: access-key, password: secret-key) -- Job Launcher Client: http://localhost:3005 -- Job Launcher Server: http://localhost:5000/swagger - - diff --git a/scripts/fortune-all-local.sh b/scripts/fortune-all-local.sh new file mode 100755 index 0000000000..55b568b37e --- /dev/null +++ b/scripts/fortune-all-local.sh @@ -0,0 +1,141 @@ +#!/bin/sh +set +x + +check_core_folders() { + SCRIPT_PATH="$0" + PROJECT_ROOT=$(cd "$(dirname "$SCRIPT_PATH")" && cd .. && pwd) + CORE_DIR="$PROJECT_ROOT/packages/core" + + if [ ! -d "$CORE_DIR/abis/legacy" ] || [ ! -d "$CORE_DIR/typechain-types" ]; then + echo "Libs are not built, building..." + yarn workspace human-protocol build:libs; + fi +} + +deploy_subgraph() { + echo "Waiting for graph node to be healthy..." + retries=0 + while ! yarn workspace @human-protocol/subgraph health-local:node + do + ((retries++)) + if [ "$retries" -ge 10 ]; then + exit 1 + fi + sleep 2; + done; + + echo "Deploying subgraph..." + + NETWORK=localhost yarn workspace @human-protocol/subgraph generate + yarn workspace @human-protocol/subgraph create-local + yarn workspace @human-protocol/subgraph deploy-local +} + +setup_oracles() { + echo "Setting up oracles..." + # It's important to run these commands sequentially + # to successfully execute all parallel blockchain transactions + # that might conflict on same nonce value + echo "Setup JL" && yarn workspace @human-protocol/job-launcher-server setup:local + echo "Setup RepO" && yarn workspace @human-protocol/reputation-oracle setup:local + echo "Setup ExcO" && yarn workspace @human-protocol/fortune-exchange-oracle-server setup:local + echo "Setup RecO" && yarn workspace @human-protocol/fortune-recording-oracle setup:local + + echo "Oracles successfully set up" +} + +run_jl_server() { + NODE_ENV=local yarn workspace @human-protocol/job-launcher-server migration:run + NODE_ENV=local yarn workspace @human-protocol/job-launcher-server start:dev +} + +run_jl_client() { + NODE_ENV=local yarn workspace @human-protocol/job-launcher-client start +} + +run_reputation_oracle() { + NODE_ENV=local yarn workspace @human-protocol/reputation-oracle migration:run + NODE_ENV=local yarn workspace @human-protocol/reputation-oracle start:dev +} + +run_fortune_exchange_oracle() { + NODE_ENV=local yarn workspace @human-protocol/fortune-exchange-oracle-server migration:run + NODE_ENV=local yarn workspace @human-protocol/fortune-exchange-oracle-server start:dev +} + +run_fortune_recording_oracle() { + NODE_ENV=local yarn workspace @human-protocol/fortune-recording-oracle start:dev +} + +full_run() { + check_core_folders + + echo "Running Fortune w/ deps locally" + + # Run web3 infra + yarn workspace human-protocol docker:web3-up + + deploy_subgraph + + # Run services infra + yarn workspace human-protocol docker:infra-up + + setup_oracles + + # Run services + run_jl_client & + PID_JL_CLIENT=$! + + run_jl_server & + PID_JL_SERVER=$! + + run_reputation_oracle & + PID_REPO=$! + + run_fortune_exchange_oracle & + PID_EXO=$! + + run_fortune_recording_oracle & + PID_RECO=$! + + echo "Running..." +} + +shutdown() { + # Ignore subsequent Ctrl+C to properly shutdown + trap '' SIGINT + echo "\nShutting down Fortune w/ deps" + + PIDS="$PID_JL_CLIENT $PID_JL_SERVER $PID_REPO $PID_EXO $PID_RECO" + # Graceful shutdown + for PID in $PIDS + do + kill -SIGINT "$PID" 2>/dev/null + done + + echo "Waiting for apps graceful shutdown" + # Wait for a while + sleep 5 + + # After waiting kill any still alive + for PID in $PIDS + do + if kill -0 "$PID" 2>/dev/null; then + kill -SIGKILL "$PID" + fi + done + + echo "Shutting down docker deps" + yarn workspace human-protocol docker:web3-down || true + yarn workspace human-protocol docker:infra-down || true + + echo "Shutdown finished" + exit 0 +} + +trap shutdown SIGINT ERR + +full_run + +# wait for Ctrl+C +wait diff --git a/scripts/fortune/.env.exco-server b/scripts/fortune/.env.exco-server deleted file mode 100644 index 2c44b1fc02..0000000000 --- a/scripts/fortune/.env.exco-server +++ /dev/null @@ -1,28 +0,0 @@ -# General -NODE_ENV=development -PORT=5001 -CRON_SECRET=secret - -# Database -POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=default -POSTGRES_PASSWORD=qwerty -POSTGRES_DATABASE=exchange-oracle -POSTGRES_PORT=5432 -POSTGRES_SSL=false -POSTGRES_LOGGING='all' - -# S3 -S3_ENDPOINT=localhost -S3_PORT=9000 -S3_ACCESS_KEY=access-key -S3_SECRET_KEY=secret-key -S3_BUCKET=bucket -S3_USE_SSL=false - -WEB3_ENV=localhost -WEB3_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a #0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC - -PGP_ENCRYPT=false -# PGP_PRIVATE_KEY= -# PGP_PASSPHRASE= diff --git a/scripts/fortune/.env.jl-client b/scripts/fortune/.env.jl-client deleted file mode 100644 index 86ae686f30..0000000000 --- a/scripts/fortune/.env.jl-client +++ /dev/null @@ -1,7 +0,0 @@ -VITE_APP_JOB_LAUNCHER_SERVER_URL=http://localhost:5000/ -VITE_APP_WALLETCONNECT_PROJECT_ID=68415bedd1597a33e8e83cc53e52071b -VITE_APP_STRIPE_PUBLISHABLE_KEY=pk_test_GvCQRGFcSwDzNE9wBSaH6MbBzk6yUntQp5GSGjDU7VzMpkJpVq32kYx52EBP9t4Gin5UQ9nYwprq7ZRNPTQG4gvdUuTwYEGy7rp -VITE_APP_HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 -VITE_APP_HCAPTCHA_EXCHANGE_URL=https://foundation-yellow-exchange.hmt.ai -VITE_APP_HCAPTCHA_LABELING_BASE_URL=https://foundation-yellow-accounts.hmt.ai -VITE_APP_ENVIRONMENT=localhost \ No newline at end of file diff --git a/scripts/fortune/.env.jl-server b/scripts/fortune/.env.jl-server deleted file mode 100644 index dbb026aa83..0000000000 --- a/scripts/fortune/.env.jl-server +++ /dev/null @@ -1,76 +0,0 @@ -# General -NODE_ENV=development -HOST=localhost -PORT=5000 -FE_URL=http://localhost:3002 -SESSION_SECRET=test - -# Database -POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=default -POSTGRES_PASSWORD=qwerty -POSTGRES_DATABASE=job-launcher -POSTGRES_DB=job-launcher -POSTGRES_PORT=5432 -POSTGRES_SSL=false -POSTGRES_LOGGING='all' - -# Web3 -WEB3_ENV=localhost -WEB3_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d #0x70997970C51812dc3A010C7d01b50e0d17dc79C8 -GAS_PRICE_MULTIPLIER=1 -# PGP_PRIVATE_KEY= -PGP_ENCRYPT=false -# PGP_PASSPHRASE= -CVAT_EXCHANGE_ORACLE_ADDRESS=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC -CVAT_RECORDING_ORACLE_ADDRESS=0x90F79bf6EB2c4f870365E785982E1f101E93b906 -REPUTATION_ORACLE_ADDRESS=0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 -HCAPTCHA_RECORDING_ORACLE_URI=a -HCAPTCHA_REPUTATION_ORACLE_URI=a -HCAPTCHA_ORACLE_ADDRESS=a -HCAPTCHA_SITE_KEY=a - -# Auth -HASH_SECRET=a328af3fc1dad15342cc3d68936008fa -JWT_PRIVATE_KEY="-----BEGIN EC PARAMETERS----- -BggqhkjOPQMBBw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MHcCAQEEID2jVcOtjupW4yqNTz70nvmt1GSvqET5G7lpC0Gp31LFoAoGCCqGSM49 -AwEHoUQDQgAEUznVCoagfRCuMA3TfG51xWShNrMJt86lkzfAep9bfBxbaCBbUhJ1 -s9+9eeLMG/nUMAaGxWeOwJ92L/KvzN6RFw== ------END EC PRIVATE KEY-----" -JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUznVCoagfRCuMA3TfG51xWShNrMJ -t86lkzfAep9bfBxbaCBbUhJ1s9+9eeLMG/nUMAaGxWeOwJ92L/KvzN6RFw== ------END PUBLIC KEY-----" -JWT_ACCESS_TOKEN_EXPIRES_IN=600 -JWT_REFRESH_TOKEN_EXPIRES_IN=3600 - -# APIKEY -# APIKEY_ITERATIONS= -# APIKEY_KEY_LENGTH= - -# S3 -S3_ENDPOINT=localhost -S3_PORT=9000 -S3_ACCESS_KEY=access-key -S3_SECRET_KEY=secret-key -S3_BUCKET=bucket -S3_USE_SSL=false - -MINIO_ROOT_USER=access-key -MINIO_ROOT_PASSWORD=secrets-key - -# Stripe -STRIPE_SECRET_KEY=sk_test_GvCQRGFcSwDzNE9wBSaH6MbBzk6yUntQp5GSGjDU7VzMpkJpVq32kYx52EBP9t4Gin5UQ9nYwprq7ZRNPTQG4gvdUuTwYEGy7rp -STRIPE_API_VERSION=2022-11-15 -STRIPE_APP_NAME=Staging Launcher Server -STRIPE_APP_VERSION=1.0.0 -STRIPE_APP_INFO_URL=https://github.com/humanprotocol/human-protocol/tree/main/packages/apps/job-launcher/server - -#Sendgrid -SENDGRID_API_KEY=sendgrid-disabled - -#Cron jobs secret -CRON_SECRET=secret \ No newline at end of file diff --git a/scripts/fortune/.env.rec-oracle b/scripts/fortune/.env.rec-oracle deleted file mode 100644 index b75f2f6047..0000000000 --- a/scripts/fortune/.env.rec-oracle +++ /dev/null @@ -1,18 +0,0 @@ -# General -NODE_ENV=development -PORT=5002 -SESSION_SECRET=secret - -# S3 -S3_ENDPOINT=localhost -S3_PORT=9000 -S3_ACCESS_KEY=access-key -S3_SECRET_KEY=secret-key -S3_BUCKET=bucket -S3_USE_SSL=false - -WEB3_PRIVATE_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 #0x90F79bf6EB2c4f870365E785982E1f101E93b906 - -PGP_ENCRYPT=false -# PGP_PRIVATE_KEY= -# PGP_PASSPHRASE= diff --git a/scripts/fortune/.env.rep-oracle b/scripts/fortune/.env.rep-oracle deleted file mode 100644 index 28866f5c7e..0000000000 --- a/scripts/fortune/.env.rep-oracle +++ /dev/null @@ -1,68 +0,0 @@ -# General -NODE_ENV=development -HOST=localhost -PORT=5003 -SESSION_SECRET=test -MAX_RETRY_COUNT=5 -CRON_SECRET=secret - -# Database -POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=default -POSTGRES_PASSWORD=qwerty -POSTGRES_DATABASE=reputation-oracle -POSTGRES_DB=reputation-oracle -POSTGRES_PORT=5432 -POSTGRES_SSL=false -POSTGRES_LOGGING='all' - -# Auth -HASH_SECRET=a328af3fc1dad15342cc3d68936008fa -JWT_PRIVATE_KEY="-----BEGIN EC PARAMETERS----- -BggqhkjOPQMBBw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIHGJVym8HlDFqIq7VWYSzfVG2/sW5qLrihq2g6ssRLQ0oAoGCCqGSM49 -AwEHoUQDQgAEmxypAnb2RpdFhhOfY4JpfKG1SlH7pDsp3Y6apiRBPO7DXgmBrwY3 -cljrl3cdbeEgkp5SSYBGSdoGDsce8NnQdA== ------END EC PRIVATE KEY-----" -JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmxypAnb2RpdFhhOfY4JpfKG1SlH7 -pDsp3Y6apiRBPO7DXgmBrwY3cljrl3cdbeEgkp5SSYBGSdoGDsce8NnQdA== ------END PUBLIC KEY-----" -JWT_ACCESS_TOKEN_EXPIRES_IN=600 -JWT_REFRESH_TOKEN_EXPIRES_IN=3600 - -# S3 -S3_ENDPOINT=localhost -S3_PORT=9000 -S3_ACCESS_KEY=access-key -S3_SECRET_KEY=secret-key -S3_BUCKET=bucket -S3_USE_SSL=false - -# Sendgrid -SENDGRID_API_KEY=sendgrid-disabled -SENDGRID_FROM_EMAIL=reputation-oracle@hmt.ai -SENDGRID_FROM_NAME="Human Protocol Reputation Oracle" - -# Web3 -WEB3_ENV=localhost -WEB3_PRIVATE_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a #0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 -GAS_PRICE_MULTIPLIER=1 - -# Reputation Level -REPUTATION_LEVEL_LOW=300 -REPUTATION_LEVEL_HIGH=700 - -# Encryption -# ENCRYPTION_PRIVATE_KEY= -# ENCRYPTION_PASSPHRASE= -PGP_ENCRYPT=false - -# Synaps Kyc -SYNAPS_API_KEY=synaps-disabled -SYNAPS_WEBHOOK_SECRET=test - -HCAPTCHA_SITE_KEY=test -HCAPTCHA_SECRET=test \ No newline at end of file diff --git a/scripts/fortune/docker-compose.yml b/scripts/fortune/docker-compose.yml deleted file mode 100644 index a53d8b0157..0000000000 --- a/scripts/fortune/docker-compose.yml +++ /dev/null @@ -1,89 +0,0 @@ -services: - postgres: - container_name: postgres - image: postgres:latest - restart: always - logging: - options: - max-size: 10m - max-file: "3" - ports: - - 5432:5432 - command: - [ - "postgres", - "-cshared_preload_libraries=pg_stat_statements", - "-cmax_connections=200" - ] - environment: - POSTGRES_HOST: 0.0.0.0 - POSTGRES_USER: default - POSTGRES_PASSWORD: qwerty - POSTGRES_PORT: 5432 - POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" - volumes: - - ./initdb:/docker-entrypoint-initdb.d - - ./docker-db:/var/lib/postgresql/data - minio: - container_name: minio - image: minio/minio:RELEASE.2022-05-26T05-48-41Z - ports: - - 9001:9001 - - 9000:9000 - entrypoint: 'sh' - command: - -c "mkdir -p /data/bucket && minio server /data --console-address ':9001'" - environment: - MINIO_ROOT_USER: access-key - MINIO_ROOT_PASSWORD: secret-key - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 5s - timeout: 5s - retries: 3 - minio-mc: - container_name: minio-mc - image: minio/mc - depends_on: - minio: - condition: service_healthy - entrypoint: > - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 access-key secret-key; - /usr/bin/mc mb myminio/bucket; - /usr/bin/mc anonymous set public myminio/bucket; - " - graph-node: - container_name: graph-node - hostname: graph-node - image: graphprotocol/graph-node - healthcheck: - test: ["CMD-SHELL", "nc -z localhost 8000 || exit 1"] - interval: 5s - timeout: 5s - retries: 10 - start_period: 10s - ports: - - 8000:8000 - - 8001:8001 - - 8020:8020 - - 8030:8030 - - 8040:8040 - depends_on: - - ipfs - - postgres - extra_hosts: - - host.docker.internal:host-gateway - environment: - postgres_host: postgres - postgres_user: default - postgres_pass: qwerty - postgres_db: graph-node - ipfs: 'ipfs:5001' - ethereum: 'localhost:http://host.docker.internal:8545' - GRAPH_LOG: info - ipfs: - hostname: ipfs - image: ipfs/kubo:v0.14.0 - ports: - - 5010:5001 diff --git a/scripts/fortune/initdb/create-dbs.sql b/scripts/fortune/initdb/create-dbs.sql deleted file mode 100644 index d941350a68..0000000000 --- a/scripts/fortune/initdb/create-dbs.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE DATABASE "job-launcher"; -CREATE DATABASE "graph-node"; -CREATE DATABASE "exchange-oracle"; -CREATE DATABASE "reputation-oracle"; \ No newline at end of file diff --git a/scripts/web3/.gitignore b/scripts/web3/.gitignore deleted file mode 100644 index 70512312f3..0000000000 --- a/scripts/web3/.gitignore +++ /dev/null @@ -1 +0,0 @@ -graph-node-db diff --git a/scripts/web3/docker-compose.yml b/scripts/web3/docker-compose.yml deleted file mode 100644 index 97068ac3f5..0000000000 --- a/scripts/web3/docker-compose.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: '3.8' -name: human-protocol -services: - graph-node-db: - container_name: graph-node-db - image: postgres:latest - restart: always - logging: - options: - max-size: 10m - max-file: "3" - ports: - - 5433:5432 - command: - [ - "postgres", - "-cshared_preload_libraries=pg_stat_statements", - "-cmax_connections=200" - ] - environment: - POSTGRES_USER: user - POSTGRES_PASSWORD: password - POSTGRES_DB: graph-node - POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" - volumes: - - ./graph-node-db:/var/lib/postgresql/data - graph-node: - container_name: graph-node - hostname: graph-node - image: graphprotocol/graph-node - healthcheck: - test: ["CMD-SHELL", "nc -z localhost 8000 || exit 1"] - interval: 5s - timeout: 5s - retries: 10 - start_period: 10s - ports: - - 8000:8000 - - 8001:8001 - - 8020:8020 - - 8030:8030 - - 8040:8040 - depends_on: - - ipfs - - graph-node-db - extra_hosts: - - host.docker.internal:host-gateway - environment: - postgres_host: graph-node-db - postgres_user: user - postgres_pass: password - postgres_db: graph-node - ipfs: 'ipfs:5001' - ethereum: 'localhost:http://host.docker.internal:8545' - GRAPH_LOG: info - ipfs: - hostname: ipfs - image: ipfs/kubo:v0.14.0 - ports: - - 5010:5001 \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 387e52425f..cdce5887c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4446,6 +4446,7 @@ __metadata: openpgp: "npm:^5.11.2" prettier: "npm:^3.4.2" secp256k1: "npm:^5.0.1" + ts-node: "npm:^10.9.2" typedoc: "npm:^0.28.4" typedoc-plugin-markdown: "npm:^4.2.3" typescript: "npm:^5.8.3" From 1fbd6f8bff7d9fcdd65e5fe82259bfb7964fd647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Tue, 3 Jun 2025 08:10:48 +0200 Subject: [PATCH 10/21] [Job Launcher][Server] JobService tests (#3373) * - Created tests for JobService - Added checks for `stripeCustomerId` in JobService to ensure proper handling of users without a Stripe account. - Updated PaymentService to throw errors when `stripeCustomerId` is not present. - Modified UserEntity to allow `stripeCustomerId` to be nullable. - Created migration to enforce non-null constraints on certain fields in the Job entity. - Refactored fixtures for jobs and users to accommodate changes in the structure and ensure proper testing. - Enhanced test cases in PaymentService and ManifestService to reflect the new logic and structure. --- .../server/src/common/interfaces/job.ts | 6 +- ...48612934037-removeNullableFromJobEntity.ts | 61 + .../src/modules/cron-job/cron-job.service.ts | 5 +- .../server/src/modules/job/fixtures.ts | 161 ++ .../server/src/modules/job/job.entity.ts | 12 +- .../src/modules/job/job.service.spec.ts | 1823 +++++++++++++++-- .../server/src/modules/job/job.service.ts | 19 +- .../server/src/modules/manifest/fixtures.ts | 156 +- .../modules/manifest/manifest.service.spec.ts | 6 +- .../modules/payment/payment.service.spec.ts | 10 +- .../src/modules/payment/payment.service.ts | 19 +- .../server/src/modules/user/fixtures.ts | 21 + .../server/src/modules/user/user.entity.ts | 6 +- .../server/test/fixtures/storage.ts | 16 + .../job-launcher/server/test/fixtures/web3.ts | 18 + 15 files changed, 2098 insertions(+), 241 deletions(-) create mode 100644 packages/apps/job-launcher/server/src/database/migrations/1748612934037-removeNullableFromJobEntity.ts create mode 100644 packages/apps/job-launcher/server/src/modules/job/fixtures.ts create mode 100644 packages/apps/job-launcher/server/src/modules/user/fixtures.ts create mode 100644 packages/apps/job-launcher/server/test/fixtures/storage.ts create mode 100644 packages/apps/job-launcher/server/test/fixtures/web3.ts diff --git a/packages/apps/job-launcher/server/src/common/interfaces/job.ts b/packages/apps/job-launcher/server/src/common/interfaces/job.ts index feaedde155..856891207e 100644 --- a/packages/apps/job-launcher/server/src/common/interfaces/job.ts +++ b/packages/apps/job-launcher/server/src/common/interfaces/job.ts @@ -6,11 +6,11 @@ export interface IJob extends IBase { chainId: number; fee: number; fundAmount: number; - escrowAddress: string; + escrowAddress: string | null; manifestUrl: string; manifestHash: string; status: JobStatus; - failedReason?: string; - retriesCount?: number; + failedReason: string | null; + retriesCount: number; waitUntil: Date; } diff --git a/packages/apps/job-launcher/server/src/database/migrations/1748612934037-removeNullableFromJobEntity.ts b/packages/apps/job-launcher/server/src/database/migrations/1748612934037-removeNullableFromJobEntity.ts new file mode 100644 index 0000000000..1463a83345 --- /dev/null +++ b/packages/apps/job-launcher/server/src/database/migrations/1748612934037-removeNullableFromJobEntity.ts @@ -0,0 +1,61 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class RemoveNullableFromJobEntity1748612934037 + implements MigrationInterface +{ + name = 'RemoveNullableFromJobEntity1748612934037'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + DROP INDEX "hmt"."IDX_59f6c552b618c432f019500e7c" + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "chain_id" + SET NOT NULL + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "reputation_oracle" + SET NOT NULL + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "exchange_oracle" + SET NOT NULL + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "recording_oracle" + SET NOT NULL + `); + await queryRunner.query(` + CREATE UNIQUE INDEX "IDX_59f6c552b618c432f019500e7c" ON "hmt"."jobs" ("chain_id", "escrow_address") + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + DROP INDEX "hmt"."IDX_59f6c552b618c432f019500e7c" + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "recording_oracle" DROP NOT NULL + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "exchange_oracle" DROP NOT NULL + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "reputation_oracle" DROP NOT NULL + `); + await queryRunner.query(` + ALTER TABLE "hmt"."jobs" + ALTER COLUMN "chain_id" DROP NOT NULL + `); + await queryRunner.query(` + CREATE UNIQUE INDEX "IDX_59f6c552b618c432f019500e7c" ON "hmt"."jobs" ("chain_id", "escrow_address") + `); + } +} diff --git a/packages/apps/job-launcher/server/src/modules/cron-job/cron-job.service.ts b/packages/apps/job-launcher/server/src/modules/cron-job/cron-job.service.ts index 482d5bc904..abfc46cea1 100644 --- a/packages/apps/job-launcher/server/src/modules/cron-job/cron-job.service.ts +++ b/packages/apps/job-launcher/server/src/modules/cron-job/cron-job.service.ts @@ -265,10 +265,11 @@ export class CronJobService { for (const jobEntity of jobEntities) { try { if ( - await this.jobService.isEscrowFunded( + jobEntity.escrowAddress && + (await this.jobService.isEscrowFunded( jobEntity.chainId, jobEntity.escrowAddress, - ) + )) ) { const { amountRefunded } = await this.jobService.processEscrowCancellation(jobEntity); diff --git a/packages/apps/job-launcher/server/src/modules/job/fixtures.ts b/packages/apps/job-launcher/server/src/modules/job/fixtures.ts new file mode 100644 index 0000000000..16089a658c --- /dev/null +++ b/packages/apps/job-launcher/server/src/modules/job/fixtures.ts @@ -0,0 +1,161 @@ +import { faker } from '@faker-js/faker'; +import { ChainId } from '@human-protocol/sdk'; +import { + getMockedProvider, + getMockedRegion, +} from '../../../test/fixtures/storage'; +import { + AudinoJobType, + CvatJobType, + EscrowFundToken, + FortuneJobType, + JobCaptchaShapeType, +} from '../../common/enums/job'; +import { PaymentCurrency } from '../../common/enums/payment'; +import { + JobAudinoDto, + JobCaptchaDto, + JobCvatDto, + JobFortuneDto, +} from './job.dto'; +import { JobEntity } from './job.entity'; +import { JobStatus } from '../../common/enums/job'; + +export const createFortuneJobDto = (overrides = {}): JobFortuneDto => ({ + chainId: ChainId.POLYGON_AMOY, + submissionsRequired: faker.number.int({ min: 1, max: 10 }), + requesterTitle: faker.lorem.words(3), + requesterDescription: faker.lorem.sentence(), + paymentAmount: faker.number.float({ min: 1, max: 100, fractionDigits: 6 }), + paymentCurrency: faker.helpers.arrayElement(Object.values(PaymentCurrency)), + escrowFundToken: faker.helpers.arrayElement(Object.values(EscrowFundToken)), + exchangeOracle: faker.finance.ethereumAddress(), + recordingOracle: faker.finance.ethereumAddress(), + reputationOracle: faker.finance.ethereumAddress(), + ...overrides, +}); + +export const createCvatJobDto = (overrides = {}): JobCvatDto => ({ + chainId: ChainId.POLYGON_AMOY, + data: { + dataset: { + provider: getMockedProvider(), + region: getMockedRegion(), + bucketName: faker.lorem.word(), + path: faker.system.filePath(), + }, + }, + labels: [{ name: faker.lorem.word(), nodes: [faker.string.uuid()] }], + requesterDescription: faker.lorem.sentence(), + userGuide: faker.internet.url(), + minQuality: faker.number.float({ min: 0.1, max: 1 }), + groundTruth: { + provider: getMockedProvider(), + region: getMockedRegion(), + bucketName: faker.lorem.word(), + path: faker.system.filePath(), + }, + type: faker.helpers.arrayElement(Object.values(CvatJobType)), + paymentCurrency: faker.helpers.arrayElement(Object.values(PaymentCurrency)), + paymentAmount: faker.number.int({ min: 1, max: 1000 }), + escrowFundToken: faker.helpers.arrayElement(Object.values(EscrowFundToken)), + exchangeOracle: faker.finance.ethereumAddress(), + recordingOracle: faker.finance.ethereumAddress(), + reputationOracle: faker.finance.ethereumAddress(), + ...overrides, +}); + +export const createAudinoJobDto = (overrides = {}): JobAudinoDto => ({ + chainId: ChainId.POLYGON_AMOY, + data: { + dataset: { + provider: getMockedProvider(), + region: getMockedRegion(), + bucketName: faker.lorem.word(), + path: faker.system.filePath(), + }, + }, + groundTruth: { + provider: getMockedProvider(), + region: getMockedRegion(), + bucketName: faker.lorem.word(), + path: faker.system.filePath(), + }, + labels: [{ name: faker.lorem.word() }], + segmentDuration: faker.number.int({ min: 10, max: 100 }), + requesterDescription: faker.lorem.sentence(), + userGuide: faker.internet.url(), + qualifications: [faker.lorem.word()], + minQuality: faker.number.int({ min: 1, max: 100 }), + type: AudinoJobType.AUDIO_TRANSCRIPTION, + paymentCurrency: faker.helpers.arrayElement(Object.values(PaymentCurrency)), + paymentAmount: faker.number.int({ min: 1, max: 1000 }), + escrowFundToken: faker.helpers.arrayElement(Object.values(EscrowFundToken)), + exchangeOracle: faker.finance.ethereumAddress(), + recordingOracle: faker.finance.ethereumAddress(), + reputationOracle: faker.finance.ethereumAddress(), + ...overrides, +}); + +export const createCaptchaJobDto = (overrides = {}): JobCaptchaDto => ({ + chainId: ChainId.POLYGON_AMOY, + data: { + provider: getMockedProvider(), + region: getMockedRegion(), + bucketName: faker.lorem.word(), + path: faker.system.filePath(), + }, + accuracyTarget: faker.number.float({ min: 0.1, max: 1, fractionDigits: 4 }), + minRequests: faker.number.int({ min: 1, max: 5 }), + maxRequests: faker.number.int({ min: 6, max: 10 }), + annotations: { + typeOfJob: faker.helpers.arrayElement(Object.values(JobCaptchaShapeType)), + labelingPrompt: faker.lorem.sentence(), + groundTruths: faker.internet.url(), + exampleImages: [faker.internet.url(), faker.internet.url()], + taskBidPrice: faker.number.float({ min: 0.1, max: 10, fractionDigits: 6 }), + label: faker.lorem.word(), + }, + completionDate: faker.date.future(), + paymentCurrency: faker.helpers.arrayElement(Object.values(PaymentCurrency)), + paymentAmount: faker.number.int({ min: 1, max: 1000 }), + escrowFundToken: faker.helpers.arrayElement(Object.values(EscrowFundToken)), + exchangeOracle: faker.finance.ethereumAddress(), + recordingOracle: faker.finance.ethereumAddress(), + reputationOracle: faker.finance.ethereumAddress(), + advanced: {}, + ...overrides, +}); + +export const createJobEntity = ( + overrides: Partial = {}, +): JobEntity => { + const entity = new JobEntity(); + entity.id = faker.number.int(); + entity.chainId = ChainId.POLYGON_AMOY; + entity.reputationOracle = faker.finance.ethereumAddress(); + entity.exchangeOracle = faker.finance.ethereumAddress(); + entity.recordingOracle = faker.finance.ethereumAddress(); + entity.escrowAddress = faker.finance.ethereumAddress(); + entity.fee = faker.number.float({ min: 0.01, max: 1, fractionDigits: 6 }); + entity.fundAmount = faker.number.float({ + min: 1, + max: 1000, + fractionDigits: 6, + }); + entity.token = faker.helpers.arrayElement( + Object.values(EscrowFundToken), + ) as EscrowFundToken; + entity.manifestUrl = faker.internet.url(); + entity.manifestHash = faker.string.uuid(); + entity.failedReason = null; + entity.requestType = FortuneJobType.FORTUNE; + entity.status = faker.helpers.arrayElement(Object.values(JobStatus)); + entity.userId = faker.number.int(); + entity.payments = []; + entity.contentModerationRequests = []; + entity.retriesCount = faker.number.int({ min: 0, max: 4 }); + entity.waitUntil = faker.date.future(); + Object.assign(entity, overrides); + return entity; +}; diff --git a/packages/apps/job-launcher/server/src/modules/job/job.entity.ts b/packages/apps/job-launcher/server/src/modules/job/job.entity.ts index df4ff35d7c..3887a7670b 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.entity.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.entity.ts @@ -11,20 +11,20 @@ import { ContentModerationRequestEntity } from '../content-moderation/content-mo @Entity({ schema: NS, name: 'jobs' }) @Index(['chainId', 'escrowAddress'], { unique: true }) export class JobEntity extends BaseEntity implements IJob { - @Column({ type: 'int', nullable: true }) + @Column({ type: 'int' }) public chainId: number; - @Column({ type: 'varchar', nullable: true }) + @Column({ type: 'varchar' }) public reputationOracle: string; - @Column({ type: 'varchar', nullable: true }) + @Column({ type: 'varchar' }) public exchangeOracle: string; - @Column({ type: 'varchar', nullable: true }) + @Column({ type: 'varchar' }) public recordingOracle: string; @Column({ type: 'varchar', nullable: true }) - public escrowAddress: string; + public escrowAddress: string | null; @Column({ type: 'decimal', precision: 30, scale: 18 }) public fee: number; @@ -42,7 +42,7 @@ export class JobEntity extends BaseEntity implements IJob { public manifestHash: string; @Column({ type: 'varchar', nullable: true }) - public failedReason: string; + public failedReason: string | null; @Column({ type: 'enum', diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts index e411c44396..e1ad3c4e17 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts @@ -1,237 +1,1696 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ +jest.mock('@human-protocol/sdk'); + +import { faker } from '@faker-js/faker'; import { createMock } from '@golevelup/ts-jest'; -import { ConfigService } from '@nestjs/config'; +import { + ChainId, + EscrowClient, + EscrowUtils, + KVStoreUtils, + NETWORKS, +} from '@human-protocol/sdk'; +import { EscrowData } from '@human-protocol/sdk/dist/graphql'; import { Test } from '@nestjs/testing'; -import { PaymentCurrency } from '../../common/enums/payment'; +import { ethers, Wallet, ZeroAddress } from 'ethers'; +import { createSignerMock } from '../../../test/fixtures/web3'; +import { ServerConfigService } from '../../common/config/server-config.service'; +import { ErrorEscrow, ErrorJob } from '../../common/constants/errors'; import { - JobStatus, + AudinoJobType, + CvatJobType, EscrowFundToken, FortuneJobType, + HCaptchaJobType, + JobStatus, + JobStatusFilter, } from '../../common/enums/job'; -import { MOCK_FILE_HASH, MOCK_FILE_URL } from '../../../test/constants'; -import { PaymentService } from '../payment/payment.service'; -import { Web3Service } from '../web3/web3.service'; -import { JobFortuneDto } from './job.dto'; -import { JobEntity } from './job.entity'; -import { JobRepository } from './job.repository'; -import { WebhookRepository } from '../webhook/webhook.repository'; -import { JobService } from './job.service'; +import { PaymentCurrency } from '../../common/enums/payment'; +import { + EventType, + OracleType, + WebhookStatus, +} from '../../common/enums/webhook'; +import { + ConflictError, + NotFoundError, + ValidationError, +} from '../../common/errors'; +import { div, max, mul } from '../../common/utils/decimal'; +import { getTokenDecimals } from '../../common/utils/tokens'; +import { + createMockAudinoManifest, + createMockCvatManifest, + createMockFortuneManifest, + createMockHcaptchaManifest, +} from '../manifest/fixtures'; +import { ManifestService } from '../manifest/manifest.service'; import { PaymentRepository } from '../payment/payment.repository'; +import { PaymentService } from '../payment/payment.service'; +import { QualificationService } from '../qualification/qualification.service'; +import { RateService } from '../rate/rate.service'; import { RoutingProtocolService } from '../routing-protocol/routing-protocol.service'; import { StorageService } from '../storage/storage.service'; -import { ServerConfigService } from '../../common/config/server-config.service'; -import { RateService } from '../rate/rate.service'; -import { QualificationService } from '../qualification/qualification.service'; +import { createUser } from '../user/fixtures'; +import { Web3Service } from '../web3/web3.service'; +import { WebhookRepository } from '../webhook/webhook.repository'; +import { WhitelistEntity } from '../whitelist/whitelist.entity'; import { WhitelistService } from '../whitelist/whitelist.service'; -import { generateRandomEthAddress } from '../../../test/utils/address'; -import { mul } from '../../common/utils/decimal'; -import { ManifestService } from '../manifest/manifest.service'; +import { + createAudinoJobDto, + createCaptchaJobDto, + createCvatJobDto, + createFortuneJobDto, + createJobEntity, +} from './fixtures'; +import { + FortuneFinalResultDto, + GetJobsDto, + JobFortuneDto, + JobQuickLaunchDto, +} from './job.dto'; +import { JobRepository } from './job.repository'; +import { JobService } from './job.service'; + +const mockServerConfigService = createMock(); +const mockQualificationService = createMock(); +const mockWeb3Service = createMock(); +const mockJobRepository = createMock(); +const mockWebhookRepository = createMock(); +const mockPaymentRepository = createMock(); +const mockStorageService = createMock(); +const mockPaymentService = createMock(); +const mockRateService = createMock(); +const mockRoutingProtocolService = createMock(); +const mockManifestService = createMock(); +const mockWhitelistService = createMock(); + +const mockedEscrowClient = jest.mocked(EscrowClient); +const mockedEscrowUtils = jest.mocked(EscrowUtils); +const mockedKVStoreUtils = jest.mocked(KVStoreUtils); describe('JobService', () => { - let jobService: JobService, - paymentService: PaymentService, - jobRepository: JobRepository, - rateService: RateService, - manifestService: ManifestService; + const tokenToUsdRate = 2; + const usdToTokenRate = 0.5; + let jobService: JobService; beforeAll(async () => { - jest - .spyOn(ServerConfigService.prototype, 'minimumFeeUsd', 'get') - .mockReturnValue(0.01); - const moduleRef = await Test.createTestingModule({ providers: [ JobService, { provide: ServerConfigService, - useValue: new ServerConfigService(new ConfigService()), + useValue: mockServerConfigService, }, { provide: QualificationService, - useValue: createMock(), + useValue: mockQualificationService, }, - { provide: Web3Service, useValue: createMock() }, + { provide: Web3Service, useValue: mockWeb3Service }, { provide: RateService, - useValue: { - getRate: jest.fn().mockImplementation((from, to) => { - if (from === PaymentCurrency.USD && to !== PaymentCurrency.USD) - return Promise.resolve(2); - if (from !== PaymentCurrency.USD && to === PaymentCurrency.USD) - return Promise.resolve(0.5); - return Promise.resolve(1); - }), - }, + useValue: mockRateService, }, - { provide: JobRepository, useValue: createMock() }, + { provide: JobRepository, useValue: mockJobRepository }, { provide: WebhookRepository, - useValue: createMock(), + useValue: mockWebhookRepository, }, { provide: PaymentRepository, - useValue: createMock(), + useValue: mockPaymentRepository, }, - { provide: PaymentService, useValue: createMock() }, - { provide: StorageService, useValue: createMock() }, - { provide: WhitelistService, useValue: createMock() }, + { provide: PaymentService, useValue: mockPaymentService }, + { provide: StorageService, useValue: mockStorageService }, + { provide: WhitelistService, useValue: mockWhitelistService }, { provide: RoutingProtocolService, - useValue: createMock(), + useValue: mockRoutingProtocolService, }, { provide: ManifestService, - useValue: createMock(), + useValue: mockManifestService, }, ], }).compile(); jobService = moduleRef.get(JobService); - paymentService = moduleRef.get(PaymentService); - rateService = moduleRef.get(RateService); - jobRepository = moduleRef.get(JobRepository); - manifestService = moduleRef.get(ManifestService); + + (mockServerConfigService['minimumFeeUsd'] as any) = 0.01; + }); + + afterEach(() => { + jest.clearAllMocks(); }); describe('createJob', () => { - const userMock: any = { - id: 1, - whitlisted: true, - stripeCustomerId: 'stripeTest', - }; + const userMock = createUser({ whitelist: new WhitelistEntity() }); describe('Fortune', () => { - describe('Successful job creation', () => { - afterEach(() => { - jest.clearAllMocks(); - }); - - it('should create a Fortune job successfully paid and funded with the same currency', async () => { - const fortuneJobDto: JobFortuneDto = { - chainId: Math.ceil(Math.random() * 100), - submissionsRequired: Math.ceil(Math.random() * 10), - requesterTitle: `Title ${Math.random().toString(36).substring(7)}`, - requesterDescription: `Description ${Math.random().toString(36).substring(7)}`, - paymentAmount: Math.random() * 100, - paymentCurrency: PaymentCurrency.HMT, - escrowFundToken: EscrowFundToken.HMT, - exchangeOracle: generateRandomEthAddress(), - recordingOracle: generateRandomEthAddress(), - reputationOracle: generateRandomEthAddress(), - }; - - jest.spyOn(manifestService, 'uploadManifest').mockResolvedValueOnce({ - url: MOCK_FILE_URL, - hash: MOCK_FILE_HASH, - }); - const jobEntityMock = createMock(); - jobEntityMock.id = 1; - jest - .spyOn(jobRepository, 'createUnique') - .mockResolvedValueOnce(jobEntityMock); - - await jobService.createJob( - userMock, - FortuneJobType.FORTUNE, - fortuneJobDto, - ); - - expect(paymentService.createWithdrawalPayment).toHaveBeenCalledWith( - userMock.id, - expect.any(Number), - fortuneJobDto.paymentCurrency, - await rateService.getRate( - fortuneJobDto.paymentCurrency, - PaymentCurrency.USD, - ), - ); - expect(jobRepository.updateOne).toHaveBeenCalledWith({ - chainId: fortuneJobDto.chainId, - userId: userMock.id, - manifestUrl: MOCK_FILE_URL, - manifestHash: MOCK_FILE_HASH, - requestType: FortuneJobType.FORTUNE, - fee: expect.any(Number), - fundAmount: fortuneJobDto.paymentAmount, - status: JobStatus.MODERATION_PASSED, - waitUntil: expect.any(Date), - token: fortuneJobDto.escrowFundToken, - exchangeOracle: fortuneJobDto.exchangeOracle, - recordingOracle: fortuneJobDto.recordingOracle, - reputationOracle: fortuneJobDto.reputationOracle, - payments: expect.any(Array), - }); - }); - - it('should create a Fortune job successfully paid and funded with different currencies', async () => { - const fortuneJobDto: JobFortuneDto = { - chainId: Math.ceil(Math.random() * 100), - submissionsRequired: Math.ceil(Math.random() * 10), - requesterTitle: `Title ${Math.random().toString(36).substring(7)}`, - requesterDescription: `Description ${Math.random().toString(36).substring(7)}`, - paymentAmount: Math.random() * 100, - paymentCurrency: PaymentCurrency.USD, - escrowFundToken: EscrowFundToken.HMT, - exchangeOracle: generateRandomEthAddress(), - recordingOracle: generateRandomEthAddress(), - reputationOracle: generateRandomEthAddress(), - }; - - jest.spyOn(manifestService, 'uploadManifest').mockResolvedValueOnce({ - url: MOCK_FILE_URL, - hash: MOCK_FILE_HASH, - }); - const jobEntityMock = createMock(); - jobEntityMock.id = 2; - jest - .spyOn(jobRepository, 'createUnique') - .mockResolvedValueOnce(jobEntityMock); - - const paymentToUsdRate = await rateService.getRate( - fortuneJobDto.paymentCurrency, - PaymentCurrency.USD, - ); - - const usdToTokenRate = await rateService.getRate( - PaymentCurrency.USD, - fortuneJobDto.escrowFundToken, - ); - - await jobService.createJob( - userMock, + it('should create a Fortune job successfully paid and funded with the same currency', async () => { + const fortuneJobDto: JobFortuneDto = createFortuneJobDto({ + paymentCurrency: PaymentCurrency.HMT, + escrowFundToken: EscrowFundToken.HMT, + }); + const fundTokenDecimals = getTokenDecimals( + fortuneJobDto.chainId!, + fortuneJobDto.escrowFundToken, + ); + + const mockManifest = createMockFortuneManifest({ + submissionsRequired: fortuneJobDto.submissionsRequired, + requesterTitle: fortuneJobDto.requesterTitle, + requesterDescription: fortuneJobDto.requesterDescription, + fundAmount: fortuneJobDto.paymentAmount, + }); + mockManifestService.createManifest.mockResolvedValueOnce(mockManifest); + const mockUrl = faker.internet.url(); + const mockHash = faker.string.uuid(); + mockManifestService.uploadManifest.mockResolvedValueOnce({ + url: mockUrl, + hash: mockHash, + }); + const jobEntityMock = createJobEntity(); + mockJobRepository.updateOne.mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + mockedKVStoreUtils.get.mockResolvedValueOnce('1'); + + const result = await jobService.createJob( + userMock, + FortuneJobType.FORTUNE, + fortuneJobDto, + ); + + const paymentCurrencyFee = Number( + max( + div(mockServerConfigService.minimumFeeUsd, tokenToUsdRate), + mul(div(1, 100), fortuneJobDto.paymentAmount), + ).toFixed(18), + ); + + expect(result).toBe(jobEntityMock.id); + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + fortuneJobDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).not.toHaveBeenCalled(); + expect(mockRoutingProtocolService.validateOracles).toHaveBeenCalledWith( + fortuneJobDto.chainId, + FortuneJobType.FORTUNE, + fortuneJobDto.reputationOracle, + fortuneJobDto.exchangeOracle, + fortuneJobDto.recordingOracle, + ); + expect(mockManifestService.createManifest).toHaveBeenCalledWith( + fortuneJobDto, + FortuneJobType.FORTUNE, + fortuneJobDto.paymentAmount, + fundTokenDecimals, + ); + expect(mockManifestService.uploadManifest).toHaveBeenCalledWith( + fortuneJobDto.chainId, + mockManifest, + [ + fortuneJobDto.exchangeOracle, + fortuneJobDto.reputationOracle, + fortuneJobDto.recordingOracle, + ], + ); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + fortuneJobDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: fortuneJobDto.chainId, + userId: userMock.id, + manifestUrl: mockUrl, + manifestHash: mockHash, + requestType: FortuneJobType.FORTUNE, + fee: Number( + mul( + mul(paymentCurrencyFee, tokenToUsdRate), + usdToTokenRate, + ).toFixed(fundTokenDecimals), + ), + fundAmount: fortuneJobDto.paymentAmount, + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: fortuneJobDto.escrowFundToken, + exchangeOracle: fortuneJobDto.exchangeOracle, + recordingOracle: fortuneJobDto.recordingOracle, + reputationOracle: fortuneJobDto.reputationOracle, + payments: expect.any(Array), + }); + }); + + it('should create a Fortune job successfully paid and funded with different currencies', async () => { + const fortuneJobDto: JobFortuneDto = createFortuneJobDto({ + paymentCurrency: PaymentCurrency.USD, + escrowFundToken: EscrowFundToken.HMT, + }); + + const fundTokenDecimals = getTokenDecimals( + fortuneJobDto.chainId!, + fortuneJobDto.escrowFundToken, + ); + + const mockManifest = createMockFortuneManifest({ + submissionsRequired: fortuneJobDto.submissionsRequired, + requesterTitle: fortuneJobDto.requesterTitle, + requesterDescription: fortuneJobDto.requesterDescription, + fundAmount: fortuneJobDto.paymentAmount, + }); + mockManifestService.createManifest.mockResolvedValueOnce(mockManifest); + const mockUrl = faker.internet.url(); + const mockHash = faker.string.uuid(); + mockManifestService.uploadManifest.mockResolvedValueOnce({ + url: mockUrl, + hash: mockHash, + }); + const jobEntityMock = createJobEntity(); + mockJobRepository.updateOne.mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + mockedKVStoreUtils.get.mockResolvedValueOnce('1'); + + const result = await jobService.createJob( + userMock, + FortuneJobType.FORTUNE, + fortuneJobDto, + ); + + const paymentCurrencyFee = Number( + max( + div(mockServerConfigService.minimumFeeUsd, tokenToUsdRate), + mul(div(1, 100), fortuneJobDto.paymentAmount), + ).toFixed(18), + ); + + expect(result).toBe(jobEntityMock.id); + + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + fortuneJobDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).not.toHaveBeenCalled(); + expect(mockRoutingProtocolService.validateOracles).toHaveBeenCalledWith( + fortuneJobDto.chainId, + FortuneJobType.FORTUNE, + fortuneJobDto.reputationOracle, + fortuneJobDto.exchangeOracle, + fortuneJobDto.recordingOracle, + ); + expect(mockManifestService.createManifest).toHaveBeenCalledWith( + fortuneJobDto, + FortuneJobType.FORTUNE, + Number(fortuneJobDto.paymentAmount.toFixed(6)), + fundTokenDecimals, + ); + expect(mockManifestService.uploadManifest).toHaveBeenCalledWith( + fortuneJobDto.chainId, + mockManifest, + [ + fortuneJobDto.exchangeOracle, + fortuneJobDto.reputationOracle, + fortuneJobDto.recordingOracle, + ], + ); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + fortuneJobDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: fortuneJobDto.chainId, + userId: userMock.id, + manifestUrl: mockUrl, + manifestHash: mockHash, + requestType: FortuneJobType.FORTUNE, + fee: Number( + mul( + mul(paymentCurrencyFee, tokenToUsdRate), + usdToTokenRate, + ).toFixed(fundTokenDecimals), + ), + fundAmount: Number( + mul( + mul(fortuneJobDto.paymentAmount, tokenToUsdRate), + usdToTokenRate, + ).toFixed(6), + ), + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: fortuneJobDto.escrowFundToken, + exchangeOracle: fortuneJobDto.exchangeOracle, + recordingOracle: fortuneJobDto.recordingOracle, + reputationOracle: fortuneJobDto.reputationOracle, + payments: expect.any(Array), + }); + }); + + it('should select the right oracles when no oracle addresses provided', async () => { + const fortuneJobDto: JobFortuneDto = createFortuneJobDto({ + paymentCurrency: EscrowFundToken.HMT, + escrowFundToken: EscrowFundToken.HMT, + exchangeOracle: null, + recordingOracle: null, + reputationOracle: null, + }); + + const fundTokenDecimals = getTokenDecimals( + fortuneJobDto.chainId!, + fortuneJobDto.escrowFundToken, + ); + + const mockManifest = createMockFortuneManifest({ + submissionsRequired: fortuneJobDto.submissionsRequired, + requesterTitle: fortuneJobDto.requesterTitle, + requesterDescription: fortuneJobDto.requesterDescription, + fundAmount: fortuneJobDto.paymentAmount, + }); + mockManifestService.createManifest.mockResolvedValueOnce(mockManifest); + const mockUrl = faker.internet.url(); + const mockHash = faker.string.uuid(); + mockManifestService.uploadManifest.mockResolvedValueOnce({ + url: mockUrl, + hash: mockHash, + }); + const jobEntityMock = createJobEntity(); + mockJobRepository.updateOne.mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + const mockOracles = { + recordingOracle: faker.finance.ethereumAddress(), + exchangeOracle: faker.finance.ethereumAddress(), + reputationOracle: faker.finance.ethereumAddress(), + }; + mockRoutingProtocolService.selectOracles.mockResolvedValueOnce({ + recordingOracle: mockOracles.recordingOracle, + exchangeOracle: mockOracles.exchangeOracle, + reputationOracle: mockOracles.reputationOracle, + }); + mockedKVStoreUtils.get.mockResolvedValueOnce('1'); + + const result = await jobService.createJob( + userMock, + FortuneJobType.FORTUNE, + fortuneJobDto, + ); + const paymentCurrencyFee = Number( + max( + div(mockServerConfigService.minimumFeeUsd, tokenToUsdRate), + mul(div(1, 100), fortuneJobDto.paymentAmount), + ).toFixed(18), + ); + + expect(result).toBe(jobEntityMock.id); + + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + fortuneJobDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).toHaveBeenCalledWith( + fortuneJobDto.chainId, + FortuneJobType.FORTUNE, + ); + expect( + mockRoutingProtocolService.validateOracles, + ).not.toHaveBeenCalled(); + expect(mockManifestService.createManifest).toHaveBeenCalledWith( + fortuneJobDto, + FortuneJobType.FORTUNE, + fortuneJobDto.paymentAmount, + fundTokenDecimals, + ); + expect(mockManifestService.uploadManifest).toHaveBeenCalledWith( + fortuneJobDto.chainId, + mockManifest, + [ + mockOracles.exchangeOracle, + mockOracles.reputationOracle, + mockOracles.recordingOracle, + ], + ); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + fortuneJobDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: fortuneJobDto.chainId, + userId: userMock.id, + manifestUrl: mockUrl, + manifestHash: mockHash, + requestType: FortuneJobType.FORTUNE, + fee: Number( + mul( + mul(paymentCurrencyFee, tokenToUsdRate), + usdToTokenRate, + ).toFixed(fundTokenDecimals), + ), + fundAmount: fortuneJobDto.paymentAmount, + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: fortuneJobDto.escrowFundToken, + exchangeOracle: mockOracles.exchangeOracle, + recordingOracle: mockOracles.recordingOracle, + reputationOracle: mockOracles.reputationOracle, + payments: expect.any(Array), + }); + }); + + it('should throw if user is not whitelisted and has no payment method', async () => { + mockWhitelistService.isUserWhitelisted.mockResolvedValueOnce(false); + const fortuneJobDto: JobFortuneDto = createFortuneJobDto(); + await expect( + jobService.createJob( + createUser({ stripeCustomerId: null }), FortuneJobType.FORTUNE, fortuneJobDto, - ); - - expect(paymentService.createWithdrawalPayment).toHaveBeenCalledWith( - userMock.id, - expect.any(Number), - fortuneJobDto.paymentCurrency, - paymentToUsdRate, - ); - expect(jobRepository.updateOne).toHaveBeenCalledWith({ - chainId: fortuneJobDto.chainId, - userId: userMock.id, - manifestUrl: MOCK_FILE_URL, - manifestHash: MOCK_FILE_HASH, - requestType: FortuneJobType.FORTUNE, - fee: expect.any(Number), - fundAmount: Number( - mul( - mul(fortuneJobDto.paymentAmount, paymentToUsdRate), - usdToTokenRate, - ).toFixed(6), - ), - status: JobStatus.MODERATION_PASSED, - waitUntil: expect.any(Date), - token: fortuneJobDto.escrowFundToken, - exchangeOracle: fortuneJobDto.exchangeOracle, - recordingOracle: fortuneJobDto.recordingOracle, - reputationOracle: fortuneJobDto.reputationOracle, - payments: expect.any(Array), - }); + ), + ).rejects.toThrow(new ValidationError(ErrorJob.NotActiveCard)); + }); + + it('should re-throw errors from validateChainId', async () => { + const randomError = new Error(faker.lorem.word()); + mockWeb3Service.validateChainId.mockImplementationOnce(() => { + throw randomError; }); + const dto = createFortuneJobDto(); + await expect( + jobService.createJob(createUser(), FortuneJobType.FORTUNE, dto), + ).rejects.toThrow(randomError); }); }); + + describe('CVAT', () => { + it('should create a CVAT job', async () => { + const cvatJobDto = createCvatJobDto(); + const fundTokenDecimals = getTokenDecimals( + cvatJobDto.chainId!, + cvatJobDto.escrowFundToken, + ); + + const mockManifest = createMockCvatManifest(); + mockManifestService.createManifest.mockResolvedValueOnce(mockManifest); + const mockUrl = faker.internet.url(); + const mockHash = faker.string.uuid(); + mockManifestService.uploadManifest.mockResolvedValueOnce({ + url: mockUrl, + hash: mockHash, + }); + const jobEntityMock = createJobEntity(); + mockJobRepository.createUnique = jest + .fn() + .mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + + await jobService.createJob(userMock, cvatJobDto.type, cvatJobDto); + + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + cvatJobDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).not.toHaveBeenCalled(); + expect(mockRoutingProtocolService.validateOracles).toHaveBeenCalledWith( + cvatJobDto.chainId, + cvatJobDto.type, + cvatJobDto.reputationOracle, + cvatJobDto.exchangeOracle, + cvatJobDto.recordingOracle, + ); + expect(mockManifestService.createManifest).toHaveBeenCalledWith( + cvatJobDto, + cvatJobDto.type, + cvatJobDto.paymentAmount, + fundTokenDecimals, + ); + expect(mockManifestService.uploadManifest).toHaveBeenCalledWith( + cvatJobDto.chainId, + mockManifest, + [ + cvatJobDto.exchangeOracle, + cvatJobDto.reputationOracle, + cvatJobDto.recordingOracle, + ], + ); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + cvatJobDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: cvatJobDto.chainId, + userId: userMock.id, + manifestUrl: mockUrl, + manifestHash: mockHash, + requestType: cvatJobDto.type, + fee: expect.any(Number), + fundAmount: Number( + mul( + mul(cvatJobDto.paymentAmount, tokenToUsdRate), + usdToTokenRate, + ).toFixed(6), + ), + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: cvatJobDto.escrowFundToken, + exchangeOracle: cvatJobDto.exchangeOracle, + recordingOracle: cvatJobDto.recordingOracle, + reputationOracle: cvatJobDto.reputationOracle, + payments: expect.any(Array), + }); + }); + }); + + describe('Audino', () => { + it('should create an Audino job', async () => { + const audinoJobDto = createAudinoJobDto(); + const fundTokenDecimals = getTokenDecimals( + audinoJobDto.chainId!, + audinoJobDto.escrowFundToken, + ); + + const mockManifest = createMockAudinoManifest(); + mockManifestService.createManifest.mockResolvedValueOnce(mockManifest); + const mockUrl = faker.internet.url(); + const mockHash = faker.string.uuid(); + mockManifestService.uploadManifest.mockResolvedValueOnce({ + url: mockUrl, + hash: mockHash, + }); + const jobEntityMock = createJobEntity(); + mockJobRepository.createUnique = jest + .fn() + .mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + + await jobService.createJob( + userMock, + AudinoJobType.AUDIO_TRANSCRIPTION, + audinoJobDto, + ); + + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + audinoJobDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).not.toHaveBeenCalled(); + expect(mockRoutingProtocolService.validateOracles).toHaveBeenCalledWith( + audinoJobDto.chainId, + audinoJobDto.type, + audinoJobDto.reputationOracle, + audinoJobDto.exchangeOracle, + audinoJobDto.recordingOracle, + ); + expect(mockManifestService.createManifest).toHaveBeenCalledWith( + audinoJobDto, + audinoJobDto.type, + audinoJobDto.paymentAmount, + fundTokenDecimals, + ); + expect(mockManifestService.uploadManifest).toHaveBeenCalledWith( + audinoJobDto.chainId, + mockManifest, + [ + audinoJobDto.exchangeOracle, + audinoJobDto.reputationOracle, + audinoJobDto.recordingOracle, + ], + ); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + audinoJobDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: audinoJobDto.chainId, + userId: userMock.id, + manifestUrl: mockUrl, + manifestHash: mockHash, + requestType: audinoJobDto.type, + fee: expect.any(Number), + fundAmount: Number( + mul( + mul(audinoJobDto.paymentAmount, tokenToUsdRate), + usdToTokenRate, + ).toFixed(6), + ), + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: audinoJobDto.escrowFundToken, + exchangeOracle: audinoJobDto.exchangeOracle, + recordingOracle: audinoJobDto.recordingOracle, + reputationOracle: audinoJobDto.reputationOracle, + payments: expect.any(Array), + }); + }); + }); + + describe('HCaptcha', () => { + it('should create an HCaptcha job', async () => { + const captchaJobDto = createCaptchaJobDto(); + const fundTokenDecimals = getTokenDecimals( + captchaJobDto.chainId!, + captchaJobDto.escrowFundToken, + ); + + const mockManifest = createMockHcaptchaManifest(); + mockManifestService.createManifest.mockResolvedValueOnce(mockManifest); + const mockUrl = faker.internet.url(); + const mockHash = faker.string.uuid(); + mockManifestService.uploadManifest.mockResolvedValueOnce({ + url: mockUrl, + hash: mockHash, + }); + const jobEntityMock = createJobEntity(); + mockJobRepository.createUnique = jest + .fn() + .mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + + await jobService.createJob( + userMock, + HCaptchaJobType.HCAPTCHA, + captchaJobDto, + ); + + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + captchaJobDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).not.toHaveBeenCalled(); + expect(mockRoutingProtocolService.validateOracles).toHaveBeenCalledWith( + captchaJobDto.chainId, + HCaptchaJobType.HCAPTCHA, + captchaJobDto.reputationOracle, + captchaJobDto.exchangeOracle, + captchaJobDto.recordingOracle, + ); + expect(mockManifestService.createManifest).toHaveBeenCalledWith( + captchaJobDto, + HCaptchaJobType.HCAPTCHA, + captchaJobDto.paymentAmount, + fundTokenDecimals, + ); + expect(mockManifestService.uploadManifest).toHaveBeenCalledWith( + captchaJobDto.chainId, + mockManifest, + [ + captchaJobDto.exchangeOracle, + captchaJobDto.reputationOracle, + captchaJobDto.recordingOracle, + ], + ); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + captchaJobDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: captchaJobDto.chainId, + userId: userMock.id, + manifestUrl: mockUrl, + manifestHash: mockHash, + requestType: HCaptchaJobType.HCAPTCHA, + fee: expect.any(Number), + fundAmount: Number( + mul( + mul(captchaJobDto.paymentAmount, tokenToUsdRate), + usdToTokenRate, + ).toFixed(6), + ), + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: captchaJobDto.escrowFundToken, + exchangeOracle: captchaJobDto.exchangeOracle, + recordingOracle: captchaJobDto.recordingOracle, + reputationOracle: captchaJobDto.reputationOracle, + payments: expect.any(Array), + }); + }); + }); + + describe('JobQuickLaunchDto', () => { + it('should create a job with quick launch dto', async () => { + const jobQuickLaunchDto = new JobQuickLaunchDto(); + jobQuickLaunchDto.chainId = 1; + jobQuickLaunchDto.manifestUrl = faker.internet.url(); + jobQuickLaunchDto.manifestHash = faker.string.uuid(); + jobQuickLaunchDto.requestType = FortuneJobType.FORTUNE; + jobQuickLaunchDto.paymentCurrency = PaymentCurrency.HMT; + jobQuickLaunchDto.paymentAmount = faker.number.float({ + min: 1, + max: 100, + fractionDigits: 6, + }); + jobQuickLaunchDto.escrowFundToken = EscrowFundToken.HMT; + jobQuickLaunchDto.exchangeOracle = faker.finance.ethereumAddress(); + jobQuickLaunchDto.recordingOracle = faker.finance.ethereumAddress(); + jobQuickLaunchDto.reputationOracle = faker.finance.ethereumAddress(); + + const jobEntityMock = createJobEntity(); + mockJobRepository.createUnique = jest + .fn() + .mockResolvedValueOnce(jobEntityMock); + mockRateService.getRate + .mockResolvedValueOnce(tokenToUsdRate) + .mockResolvedValueOnce(usdToTokenRate); + + await jobService.createJob( + userMock, + FortuneJobType.FORTUNE, + jobQuickLaunchDto, + ); + + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + jobQuickLaunchDto.chainId, + ); + expect(mockRoutingProtocolService.selectOracles).not.toHaveBeenCalled(); + expect(mockRoutingProtocolService.validateOracles).toHaveBeenCalledWith( + jobQuickLaunchDto.chainId, + FortuneJobType.FORTUNE, + jobQuickLaunchDto.reputationOracle, + jobQuickLaunchDto.exchangeOracle, + jobQuickLaunchDto.recordingOracle, + ); + expect(mockManifestService.createManifest).not.toHaveBeenCalled(); + expect(mockManifestService.uploadManifest).not.toHaveBeenCalled(); + expect(mockPaymentService.createWithdrawalPayment).toHaveBeenCalledWith( + userMock.id, + expect.any(Number), + jobQuickLaunchDto.paymentCurrency, + tokenToUsdRate, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + chainId: jobQuickLaunchDto.chainId, + userId: userMock.id, + manifestUrl: jobQuickLaunchDto.manifestUrl, + manifestHash: jobQuickLaunchDto.manifestHash, + requestType: FortuneJobType.FORTUNE, + fee: expect.any(Number), + fundAmount: Number( + mul( + mul(jobQuickLaunchDto.paymentAmount, tokenToUsdRate), + usdToTokenRate, + ).toFixed(6), + ), + status: JobStatus.MODERATION_PASSED, + waitUntil: expect.any(Date), + token: jobQuickLaunchDto.escrowFundToken, + exchangeOracle: jobQuickLaunchDto.exchangeOracle, + recordingOracle: jobQuickLaunchDto.recordingOracle, + reputationOracle: jobQuickLaunchDto.reputationOracle, + payments: expect.any(Array), + }); + }); + }); + }); + + describe('createEscrow', () => { + it('should create an escrow and update job entity', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.MODERATION_PASSED, + token: EscrowFundToken.HMT, + escrowAddress: null, + }); + + const escrowAddress = faker.finance.ethereumAddress(); + mockedEscrowClient.build.mockResolvedValueOnce({ + createEscrow: jest.fn().mockResolvedValueOnce(escrowAddress), + } as unknown as EscrowClient); + + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + + const result = await jobService.createEscrow(jobEntity); + + expect(mockWeb3Service.getSigner).toHaveBeenCalledWith(jobEntity.chainId); + expect(mockWeb3Service.calculateGasPrice).toHaveBeenCalledWith( + jobEntity.chainId, + ); + expect(result.status).toBe(JobStatus.CREATED); + expect(result.escrowAddress).toBe(escrowAddress); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntity, + status: JobStatus.CREATED, + escrowAddress, + }); + }); + + it('should throw if escrow address is not returned', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.MODERATION_PASSED, + token: EscrowFundToken.HMT, + escrowAddress: null, + }); + + mockedEscrowClient.build.mockResolvedValueOnce({ + createEscrow: jest.fn().mockResolvedValueOnce(undefined), + } as unknown as EscrowClient); + + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + + await expect(jobService.createEscrow(jobEntity)).rejects.toThrow( + new ConflictError(ErrorEscrow.NotCreated), + ); + }); + }); + + describe('setupEscrow', () => { + it('should setup escrow and update job status', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.FUNDED, + }); + + const escrowClientMock = { + setup: jest.fn().mockResolvedValueOnce(undefined), + }; + mockedEscrowClient.build.mockResolvedValueOnce( + escrowClientMock as unknown as EscrowClient, + ); + + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + mockedKVStoreUtils.get.mockImplementation(async (_chainId, address) => { + switch (address) { + case jobEntity.reputationOracle: + return '1'; + case jobEntity.recordingOracle: + return '2'; + case jobEntity.exchangeOracle: + return '3'; + default: + return ''; + } + }); + + const result = await jobService.setupEscrow(jobEntity); + + expect(mockWeb3Service.getSigner).toHaveBeenCalledWith(jobEntity.chainId); + expect(mockWeb3Service.calculateGasPrice).toHaveBeenCalledWith( + jobEntity.chainId, + ); + expect(escrowClientMock.setup).toHaveBeenCalledWith( + jobEntity.escrowAddress, + { + reputationOracle: jobEntity.reputationOracle, + reputationOracleFee: 1n, + recordingOracle: jobEntity.recordingOracle, + recordingOracleFee: 2n, + exchangeOracle: jobEntity.exchangeOracle, + exchangeOracleFee: 3n, + manifestUrl: jobEntity.manifestUrl, + manifestHash: jobEntity.manifestHash, + }, + { gasPrice: 1n }, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntity, + status: JobStatus.LAUNCHED, + }); + expect(result.status).toBe(JobStatus.LAUNCHED); + expect(mockWebhookRepository.createUnique).toHaveBeenCalledWith({ + escrowAddress: jobEntity.escrowAddress, + chainId: jobEntity.chainId, + eventType: EventType.ESCROW_CREATED, + oracleType: jobEntity.requestType, + hasSignature: true, + status: WebhookStatus.PENDING, + retriesCount: 0, + waitUntil: expect.any(Date), + }); + }); + + it('should throw if escrowClient setup fails', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.FUNDED, + }); + + const signer = createSignerMock() as unknown as Wallet; + mockWeb3Service.getSigner.mockReturnValueOnce(signer); + + const escrowClientMock = { + setup: jest.fn().mockRejectedValueOnce(new Error('Network error')), + }; + mockedEscrowClient.build.mockResolvedValueOnce( + escrowClientMock as unknown as EscrowClient, + ); + + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + mockedKVStoreUtils.get.mockResolvedValue('1'); + + await expect(jobService.setupEscrow(jobEntity)).rejects.toThrow( + 'Network error', + ); + }); + }); + + describe('fundEscrow', () => { + it('should fund escrow with the correct amount and update status', async () => { + const jobEntityMock = createJobEntity({ + status: JobStatus.PAID, + token: EscrowFundToken.HMT, + }); + mockedKVStoreUtils.get.mockResolvedValue('1'); + mockedEscrowClient.build.mockResolvedValueOnce({ + fund: jest.fn().mockResolvedValue(undefined), + } as unknown as EscrowClient); + + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + + await jobService.fundEscrow(jobEntityMock); + + expect(mockWeb3Service.getSigner).toHaveBeenCalledWith( + jobEntityMock.chainId, + ); + expect(mockWeb3Service.calculateGasPrice).toHaveBeenCalledWith( + jobEntityMock.chainId, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntityMock, + status: JobStatus.FUNDED, + }); + }); + + it('should throw if escrowClient fund fails', async () => { + const jobEntityMock = createJobEntity({ + status: JobStatus.PAID, + token: EscrowFundToken.HMT, + }); + + mockWeb3Service.getSigner.mockReturnValueOnce( + createSignerMock() as unknown as Wallet, + ); + mockedEscrowClient.build.mockResolvedValueOnce({ + fund: jest.fn().mockRejectedValue(new Error('Network error')), + } as unknown as EscrowClient); + + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + + await expect(jobService.fundEscrow(jobEntityMock)).rejects.toThrow( + 'Network error', + ); + }); + }); + + describe('requestToCancelJobById', () => { + it('should request to cancel job by id', async () => { + const jobEntityMock = createJobEntity({ status: JobStatus.LAUNCHED }); + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + jobEntityMock, + ); + await expect( + jobService.requestToCancelJobById( + jobEntityMock.userId, + jobEntityMock.id, + ), + ).resolves.toBeUndefined(); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntityMock, + status: JobStatus.TO_CANCEL, + retriesCount: 0, + }); + }); + it('should throw an error if job not found', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce(null); + await expect( + jobService.requestToCancelJobById( + faker.number.int(), + faker.number.int(), + ), + ).rejects.toThrow(new NotFoundError(ErrorJob.NotFound)); + }); + it('should throw an error if job status is invalid', async () => { + const jobEntityMock = createJobEntity({ status: JobStatus.COMPLETED }); + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + jobEntityMock, + ); + await expect( + jobService.requestToCancelJobById( + jobEntityMock.userId, + jobEntityMock.id, + ), + ).rejects.toThrow( + new ValidationError(ErrorJob.InvalidStatusCancellation), + ); + }); + }); + + describe('requestToCancelJobByAddress', () => { + it('should request to cancel job by address', async () => { + const jobEntityMock = createJobEntity({ status: JobStatus.LAUNCHED }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntityMock, + ); + await expect( + jobService.requestToCancelJobByAddress( + jobEntityMock.userId, + ChainId.POLYGON_AMOY, + jobEntityMock.escrowAddress!, + ), + ).resolves.toBeUndefined(); + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + ChainId.POLYGON_AMOY, + ); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntityMock, + status: JobStatus.TO_CANCEL, + retriesCount: 0, + }); + }); + it('should throw an error if job not found', async () => { + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + null, + ); + await expect( + jobService.requestToCancelJobByAddress( + faker.number.int(), + faker.number.int(), + faker.finance.ethereumAddress(), + ), + ).rejects.toThrow(new NotFoundError(ErrorJob.NotFound)); + }); + it('should throw an error if job status is invalid', async () => { + const jobEntityMock = createJobEntity({ status: JobStatus.COMPLETED }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntityMock, + ); + await expect( + jobService.requestToCancelJobByAddress( + jobEntityMock.userId, + ChainId.POLYGON_AMOY, + jobEntityMock.escrowAddress!, + ), + ).rejects.toThrow( + new ValidationError(ErrorJob.InvalidStatusCancellation), + ); + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + ChainId.POLYGON_AMOY, + ); + }); + }); + + describe('getJobsByStatus', () => { + it('should return jobs by status', async () => { + const jobStatus = JobStatus.LAUNCHED; + const jobEntityMock = createJobEntity({ status: jobStatus }); + const getJobsDto: GetJobsDto = { + status: JobStatusFilter.LAUNCHED, + page: 1, + pageSize: 10, + skip: 10, + }; + mockJobRepository.fetchFiltered.mockResolvedValueOnce({ + entities: [jobEntityMock], + itemCount: 1, + }); + const result = await jobService.getJobsByStatus( + getJobsDto, + jobEntityMock.userId, + ); + expect(mockWeb3Service.validateChainId).not.toHaveBeenCalled(); + expect(mockJobRepository.fetchFiltered).toHaveBeenCalledWith( + getJobsDto, + jobEntityMock.userId, + ); + expect(result).toEqual({ + page: getJobsDto.page, + pageSize: getJobsDto.pageSize, + totalPages: 1, + totalResults: 1, + results: [ + { + jobId: jobEntityMock.id, + escrowAddress: jobEntityMock.escrowAddress, + network: NETWORKS[jobEntityMock.chainId as ChainId]!.title, + fundAmount: jobEntityMock.fundAmount, + currency: jobEntityMock.token, + status: jobStatus, + }, + ], + }); + }); + + it('should validate chainId if specified', async () => { + const jobStatus = JobStatus.LAUNCHED; + const jobEntityMock = createJobEntity({ status: jobStatus }); + const getJobsDto: GetJobsDto = { + status: JobStatusFilter.LAUNCHED, + chainId: [ChainId.POLYGON_AMOY], + page: 1, + pageSize: 10, + skip: 10, + }; + mockJobRepository.fetchFiltered.mockResolvedValueOnce({ + entities: [jobEntityMock], + itemCount: 1, + }); + const result = await jobService.getJobsByStatus( + getJobsDto, + jobEntityMock.userId, + ); + expect(mockWeb3Service.validateChainId).toHaveBeenCalledWith( + getJobsDto.chainId![0], + ); + expect(mockJobRepository.fetchFiltered).toHaveBeenCalledWith( + getJobsDto, + jobEntityMock.userId, + ); + expect(result).toEqual({ + page: getJobsDto.page, + pageSize: getJobsDto.pageSize, + totalPages: 1, + totalResults: 1, + results: [ + { + jobId: jobEntityMock.id, + escrowAddress: jobEntityMock.escrowAddress, + network: NETWORKS[jobEntityMock.chainId as ChainId]!.title, + fundAmount: jobEntityMock.fundAmount, + currency: jobEntityMock.token, + status: jobStatus, + }, + ], + }); + }); + }); + + describe('getResult', () => { + const userId = faker.number.int(); + const jobId = faker.number.int(); + const url = faker.internet.url(); + + beforeEach(() => { + (EscrowClient.build as any).mockImplementationOnce(() => ({ + getResultsUrl: jest.fn().mockResolvedValueOnce(url), + })); + }); + + it('should download and return the fortune result', async () => { + const jobEntityMock = createJobEntity(); + + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + jobEntityMock, + ); + + const fortuneResult: FortuneFinalResultDto[] = [ + { + workerAddress: faker.finance.ethereumAddress(), + solution: 'good', + }, + { + workerAddress: faker.finance.ethereumAddress(), + solution: 'bad', + error: 'wrong answer', + }, + ]; + + mockStorageService.downloadJsonLikeData.mockResolvedValueOnce( + fortuneResult, + ); + + const result = await jobService.getResult(userId, jobId); + + expect(mockStorageService.downloadJsonLikeData).toHaveBeenCalledWith(url); + expect(mockStorageService.downloadJsonLikeData).toHaveBeenCalledTimes(1); + expect(result).toEqual(fortuneResult); + }); + + it('should download and return the image binary result', async () => { + const jobEntityMock = createJobEntity({ + requestType: CvatJobType.IMAGE_BOXES, + }); + + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + jobEntityMock, + ); + + const result = await jobService.getResult(userId, jobId); + + expect(result).toEqual(url); + }); + + it('should throw a NotFoundError if the result is not found', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + createJobEntity(), + ); + + mockStorageService.downloadJsonLikeData.mockResolvedValueOnce([]); + + await expect(jobService.getResult(userId, jobId)).rejects.toThrow( + new NotFoundError(ErrorJob.ResultNotFound), + ); + expect(mockStorageService.downloadJsonLikeData).toHaveBeenCalledWith(url); + expect(mockStorageService.downloadJsonLikeData).toHaveBeenCalledTimes(1); + }); + + it('should throw a ValidationError if the result is not valid', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + createJobEntity(), + ); + + const fortuneResult: any[] = [ + { + wrongAddress: faker.finance.ethereumAddress(), + solution: 1, + }, + { + wrongAddress: faker.finance.ethereumAddress(), + solution: 1, + error: 1, + }, + ]; + + (EscrowClient.build as any).mockImplementation(() => ({ + getResultsUrl: jest.fn().mockResolvedValue(url), + })); + mockStorageService.downloadJsonLikeData.mockResolvedValueOnce( + fortuneResult, + ); + + await expect(jobService.getResult(userId, jobId)).rejects.toThrow( + new ValidationError(ErrorJob.ResultValidationFailed), + ); + + expect(mockStorageService.downloadJsonLikeData).toHaveBeenCalledWith(url); + expect(mockStorageService.downloadJsonLikeData).toHaveBeenCalledTimes(1); + }); + }); + + describe('downloadJobResults', () => { + it('should download job results', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + createJobEntity({ + requestType: CvatJobType.IMAGE_BOXES, + }), + ); + const sampleFile = Buffer.from('test-file-contents'); + mockStorageService.downloadFile.mockResolvedValueOnce(sampleFile); + const result = await jobService.downloadJobResults( + faker.number.int(), + faker.number.int(), + ); + + expect(result).toHaveProperty('filename'); + expect(result.contents).toEqual(sampleFile); + }); + + it('should throw an error if job not found', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce(null); + await expect( + jobService.downloadJobResults(faker.number.int(), faker.number.int()), + ).rejects.toThrow(new NotFoundError(ErrorJob.NotFound)); + }); + + it('should throw an error if job type is invalid', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce( + createJobEntity({ + requestType: FortuneJobType.FORTUNE, + }), + ); + await expect( + jobService.downloadJobResults(faker.number.int(), faker.number.int()), + ).rejects.toThrow(new ValidationError(ErrorJob.InvalidRequestType)); + }); + }); + + describe('handleProcessJobFailure', () => { + beforeAll(() => { + (mockServerConfigService as any).maxRetryCount = 5; + }); + + it('should increase job failure count', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.LAUNCHED, + retriesCount: 0, + }); + const reason = faker.lorem.sentence(); + await expect( + jobService.handleProcessJobFailure(jobEntity, reason), + ).resolves.toBeUndefined(); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntity, + status: JobStatus.LAUNCHED, + failedReason: null, + retriesCount: 1, + }); + }); + + it('should handle job failure and update job status', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.LAUNCHED, + retriesCount: 5, + }); + const reason = faker.lorem.sentence(); + await expect( + jobService.handleProcessJobFailure(jobEntity, reason), + ).resolves.toBeUndefined(); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntity, + status: JobStatus.FAILED, + failedReason: reason, + retriesCount: jobEntity.retriesCount, + }); + }); + }); + + describe('getOracleType', () => { + it.each(Object.values(FortuneJobType))( + 'should return OracleType.FORTUNE for Fortune job type %s', + (jobType) => { + expect(jobService.getOracleType(jobType)).toBe(OracleType.FORTUNE); + }, + ); + + it.each(Object.values(CvatJobType))( + 'should return OracleType.CVAT for CVAT job type %s', + (jobType) => { + expect(jobService.getOracleType(jobType)).toBe(OracleType.CVAT); + }, + ); + + it.each(Object.values(AudinoJobType))( + 'should return OracleType.AUDINO for Audino job type %s', + (jobType) => { + expect(jobService.getOracleType(jobType)).toBe(OracleType.AUDINO); + }, + ); + + it.each(Object.values(HCaptchaJobType))( + 'should return OracleType.HCAPTCHA for HCaptcha job type %s', + (jobType) => { + expect(jobService.getOracleType(jobType)).toBe(OracleType.HCAPTCHA); + }, + ); + }); + + describe('processEscrowCancellation', () => { + it('should process escrow cancellation', async () => { + const jobEntity = createJobEntity(); + mockWeb3Service.calculateGasPrice.mockResolvedValueOnce(1n); + mockedEscrowClient.build.mockResolvedValue({ + getStatus: jest.fn().mockResolvedValue('Active'), + getBalance: jest.fn().mockResolvedValue(100n), + cancel: jest + .fn() + .mockResolvedValue({ txHash: '0x', amountRefunded: 100n }), + } as unknown as EscrowClient); + + const result = await jobService.processEscrowCancellation(jobEntity); + expect(result).toHaveProperty('txHash'); + }); + }); + + describe('escrowFailedWebhook', () => { + it('should handle escrow failed webhook', async () => { + const jobEntity = createJobEntity({ status: JobStatus.LAUNCHED }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntity, + ); + const reason = faker.lorem.sentence(); + await expect( + jobService.escrowFailedWebhook({ + eventType: EventType.ESCROW_FAILED, + chainId: 1, + escrowAddress: '0x', + eventData: { reason: reason }, + }), + ).resolves.toBeUndefined(); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntity, + status: JobStatus.FAILED, + failedReason: reason, + }); + }); + + it('should throw an error if job not found', async () => { + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + null, + ); + await expect( + jobService.escrowFailedWebhook({ + eventType: EventType.ESCROW_FAILED, + chainId: 1, + escrowAddress: '0x', + eventData: { reason: faker.lorem.sentence() }, + }), + ).rejects.toThrow(new NotFoundError(ErrorJob.NotFound)); + }); + + it('should throw an error if job is not in LAUNCHED status', async () => { + const jobEntity = createJobEntity({ status: JobStatus.COMPLETED }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntity, + ); + await expect( + jobService.escrowFailedWebhook({ + eventType: EventType.ESCROW_FAILED, + chainId: 1, + escrowAddress: '0x', + eventData: { reason: faker.lorem.sentence() }, + }), + ).rejects.toThrow(new ValidationError(ErrorJob.NotLaunched)); + }); + + it('should throw an error if event data is missing', async () => { + const jobEntity = createJobEntity({ status: JobStatus.LAUNCHED }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntity, + ); + await expect( + jobService.escrowFailedWebhook({ + eventType: EventType.ESCROW_FAILED, + chainId: 1, + escrowAddress: '0x', + }), + ).rejects.toThrow( + new ValidationError('Event data is required but was not provided.'), + ); + }); + + it('should throw an error if event data is missing reason', async () => { + const jobEntity = createJobEntity({ status: JobStatus.LAUNCHED }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntity, + ); + await expect( + jobService.escrowFailedWebhook({ + eventType: EventType.ESCROW_FAILED, + chainId: 1, + escrowAddress: '0x', + eventData: {}, + }), + ).rejects.toThrow( + new ValidationError('Reason is undefined in event data.'), + ); + }); + }); + + describe('getDetails', () => { + it('should return job details with escrow address successfully', async () => { + const jobEntity = createJobEntity(); + + const fundTokenDecimals = getTokenDecimals( + jobEntity.chainId, + jobEntity.token as EscrowFundToken, + ); + + const manifestMock = createMockFortuneManifest({ + fundAmount: jobEntity.fundAmount, + }); + + const getEscrowData = { + token: faker.finance.ethereumAddress(), + totalFundedAmount: ethers.parseUnits( + jobEntity.fundAmount.toString(), + fundTokenDecimals, + ), + balance: 0, + amountPaid: 0, + exchangeOracle: jobEntity.exchangeOracle, + recordingOracle: jobEntity.recordingOracle, + reputationOracle: jobEntity.reputationOracle, + } as unknown as EscrowData; + + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce(jobEntity); + mockedEscrowUtils.getEscrow.mockResolvedValueOnce(getEscrowData); + mockManifestService.downloadManifest.mockResolvedValueOnce(manifestMock); + const signer = createSignerMock() as unknown as Wallet; + mockWeb3Service.getSigner.mockReturnValueOnce(signer); + + const result = await jobService.getDetails( + faker.number.int(), + faker.number.int(), + ); + + expect(result).toStrictEqual({ + details: { + escrowAddress: jobEntity.escrowAddress, + manifestUrl: jobEntity.manifestUrl, + manifestHash: jobEntity.manifestHash, + status: jobEntity.status, + failedReason: jobEntity.failedReason, + balance: getEscrowData.balance, + paidOut: getEscrowData.amountPaid, + currency: jobEntity.token, + }, + manifest: { + title: manifestMock.requesterTitle, + description: manifestMock.requesterDescription, + submissionsRequired: manifestMock.submissionsRequired, + fundAmount: jobEntity.fundAmount, + requestType: manifestMock.requestType, + chainId: jobEntity.chainId, + exchangeOracleAddress: jobEntity.exchangeOracle, + recordingOracleAddress: jobEntity.recordingOracle, + reputationOracleAddress: jobEntity.reputationOracle, + requesterAddress: signer.address, + tokenAddress: getEscrowData.token, + }, + }); + }); + + it('should return job details without escrow address successfully', async () => { + const jobEntity = createJobEntity({ escrowAddress: null }); + + const manifestMock = createMockFortuneManifest({ + fundAmount: jobEntity.fundAmount, + }); + + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce(jobEntity); + mockManifestService.downloadManifest.mockResolvedValueOnce(manifestMock); + const signer = createSignerMock() as unknown as Wallet; + mockWeb3Service.getSigner.mockReturnValueOnce(signer); + + const result = await jobService.getDetails( + faker.number.int(), + faker.number.int(), + ); + expect(mockedEscrowUtils.getEscrow).not.toHaveBeenCalled(); + expect(result).toStrictEqual({ + details: { + escrowAddress: ZeroAddress, + manifestUrl: jobEntity.manifestUrl, + manifestHash: jobEntity.manifestHash, + status: jobEntity.status, + failedReason: jobEntity.failedReason, + balance: 0, + paidOut: 0, + }, + manifest: { + title: manifestMock.requesterTitle, + description: manifestMock.requesterDescription, + submissionsRequired: manifestMock.submissionsRequired, + fundAmount: 0, + requestType: manifestMock.requestType, + chainId: jobEntity.chainId, + exchangeOracleAddress: ZeroAddress, + recordingOracleAddress: ZeroAddress, + reputationOracleAddress: ZeroAddress, + requesterAddress: signer.address, + tokenAddress: ZeroAddress, + }, + }); + }); + + it('should throw not found exception when job not found', async () => { + mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce(null); + + await expect( + jobService.getDetails(faker.number.int(), faker.number.int()), + ).rejects.toThrow(new NotFoundError(ErrorJob.NotFound)); + }); + }); + + describe('completeJob', () => { + it('should complete a job', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.LAUNCHED, + }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntity, + ); + await expect( + jobService.completeJob({ + chainId: ChainId.POLYGON_AMOY, + escrowAddress: faker.finance.ethereumAddress(), + eventType: EventType.ESCROW_COMPLETED, + }), + ).resolves.toBeUndefined(); + expect(mockJobRepository.updateOne).toHaveBeenCalledWith({ + ...jobEntity, + status: JobStatus.COMPLETED, + }); + }); + + it('should throw an error if job not found', async () => { + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + null, + ); + await expect( + jobService.completeJob({ + chainId: ChainId.POLYGON_AMOY, + escrowAddress: faker.finance.ethereumAddress(), + eventType: EventType.ESCROW_COMPLETED, + }), + ).rejects.toThrow(new NotFoundError(ErrorJob.NotFound)); + }); + + it('should throw an error if job is not in LAUNCHED or PARTIAL status', async () => { + const jobEntity = createJobEntity({ + status: JobStatus.CANCELED, + }); + mockJobRepository.findOneByChainIdAndEscrowAddress.mockResolvedValueOnce( + jobEntity, + ); + await expect( + jobService.completeJob({ + chainId: ChainId.POLYGON_AMOY, + escrowAddress: faker.finance.ethereumAddress(), + eventType: EventType.ESCROW_COMPLETED, + }), + ).rejects.toThrow(new ValidationError(ErrorJob.InvalidStatusCompletion)); + }); + }); + + describe('isEscrowFunded', () => { + it('should check if escrow is funded', async () => { + mockedEscrowClient.build.mockResolvedValue({ + getBalance: jest + .fn() + .mockResolvedValue(BigInt(faker.number.int({ min: 1, max: 1000 }))), + } as unknown as EscrowClient); + const result = await jobService.isEscrowFunded( + faker.number.int(), + faker.finance.ethereumAddress(), + ); + expect(result).toBe(true); + }); + + it('should return false if escrow was not funded', async () => { + mockedEscrowClient.build.mockResolvedValue({ + getBalance: jest.fn().mockResolvedValue(0n), + } as unknown as EscrowClient); + const result = await jobService.isEscrowFunded( + faker.number.int(), + faker.finance.ethereumAddress(), + ); + expect(result).toBe(false); + }); + + it('should return false if escrowAddress is not provided', async () => { + const result = await jobService.isEscrowFunded(faker.number.int(), ''); + expect(result).toBe(false); + }); }); }); diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.ts index d34a6a07c5..93d0e9f284 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.ts @@ -146,6 +146,7 @@ export class JobService { const whitelisted = await this.whitelistService.isUserWhitelisted(user.id); if (!whitelisted) { if ( + !user.stripeCustomerId || !(await this.paymentService.getDefaultPaymentMethod( user.stripeCustomerId, )) @@ -369,7 +370,7 @@ export class JobService { manifestHash: jobEntity.manifestHash, }; - await escrowClient.setup(jobEntity.escrowAddress, escrowConfig, { + await escrowClient.setup(jobEntity.escrowAddress!, escrowConfig, { gasPrice: await this.web3Service.calculateGasPrice(jobEntity.chainId), }); @@ -403,7 +404,7 @@ export class JobService { jobEntity.fundAmount.toString(), token.decimals, ); - await escrowClient.fund(jobEntity.escrowAddress, weiAmount, { + await escrowClient.fund(jobEntity.escrowAddress!, weiAmount, { gasPrice: await this.web3Service.calculateGasPrice(jobEntity.chainId), }); @@ -520,7 +521,7 @@ export class JobService { const jobs = entities.map((job) => { return { jobId: job.id, - escrowAddress: job.escrowAddress, + escrowAddress: job.escrowAddress ?? undefined, network: NETWORKS[job.chainId as ChainId]!.title, fundAmount: job.fundAmount, currency: job.token as EscrowFundToken, @@ -606,14 +607,10 @@ export class JobService { userId, ); - if (!jobEntity) { + if (!jobEntity || !jobEntity.escrowAddress) { throw new NotFoundError(ErrorJob.NotFound); } - if (!jobEntity.escrowAddress) { - throw new NotFoundError(ErrorJob.ResultNotFound); - } - if (jobEntity.requestType === FortuneJobType.FORTUNE) { throw new ValidationError(ErrorJob.InvalidRequestType); } @@ -671,7 +668,7 @@ export class JobService { const signer = this.web3Service.getSigner(chainId); const escrowClient = await EscrowClient.build(signer); - const escrowStatus = await escrowClient.getStatus(escrowAddress); + const escrowStatus = await escrowClient.getStatus(escrowAddress!); if ( escrowStatus === EscrowStatus.Complete || escrowStatus === EscrowStatus.Paid || @@ -680,12 +677,12 @@ export class JobService { throw new ConflictError(ErrorEscrow.InvalidStatusCancellation); } - const balance = await escrowClient.getBalance(escrowAddress); + const balance = await escrowClient.getBalance(escrowAddress!); if (balance === 0n) { throw new ConflictError(ErrorEscrow.InvalidBalanceCancellation); } - return escrowClient.cancel(escrowAddress, { + return escrowClient.cancel(escrowAddress!, { gasPrice: await this.web3Service.calculateGasPrice(chainId), }); } diff --git a/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts b/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts index 524b950191..9b405e0c48 100644 --- a/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts +++ b/packages/apps/job-launcher/server/src/modules/manifest/fixtures.ts @@ -1,17 +1,28 @@ import { faker } from '@faker-js/faker'; -import { JobCvatDto, JobAudinoDto, JobCaptchaDto } from '../job/job.dto'; -import { AWSRegions, StorageProviders } from '../../common/enums/storage'; import { ChainId } from '@human-protocol/sdk'; -import { PaymentCurrency } from '../../common/enums/payment'; +import { AuthConfigService } from '../../common/config/auth-config.service'; +import { CvatConfigService } from '../../common/config/cvat-config.service'; +import { Web3ConfigService } from '../../common/config/web3-config.service'; import { AudinoJobType, CvatJobType, EscrowFundToken, + JobCaptchaRequestType, JobCaptchaShapeType, } from '../../common/enums/job'; -import { CvatConfigService } from '../../common/config/cvat-config.service'; -import { AuthConfigService } from '../../common/config/auth-config.service'; -import { Web3ConfigService } from '../../common/config/web3-config.service'; +import { PaymentCurrency } from '../../common/enums/payment'; +import { JobAudinoDto, JobCaptchaDto, JobCvatDto } from '../job/job.dto'; +import { + getMockedProvider, + getMockedRegion, +} from '../../../test/fixtures/storage'; +import { + AudinoManifestDto, + CvatManifestDto, + FortuneManifestDto, + HCaptchaManifestDto, +} from './manifest.dto'; +import { FortuneJobType } from '../../common/enums/job'; export const mockCvatConfigService: Omit = { jobSize: faker.number.int({ min: 1, max: 1000 }), @@ -35,18 +46,6 @@ export const mockWeb3ConfigService: Omit< hCaptchaRecordingOracleURI: faker.internet.url(), }; -export function getMockedProvider(): StorageProviders { - return faker.helpers.arrayElement( - Object.values(StorageProviders).filter( - (provider) => provider !== StorageProviders.LOCAL, - ), - ); -} - -export function getMockedRegion(): AWSRegions { - return faker.helpers.arrayElement(Object.values(AWSRegions)); -} - export function createJobCvatDto( overrides: Partial = {}, ): JobCvatDto { @@ -139,3 +138,124 @@ export function createJobCaptchaDto( ...overrides, }; } + +export function createMockFortuneManifest( + overrides: Partial = {}, +): FortuneManifestDto { + return { + submissionsRequired: faker.number.int({ min: 1, max: 100 }), + requesterTitle: faker.lorem.sentence(), + requesterDescription: faker.lorem.sentence(), + fundAmount: faker.number.int({ min: 1, max: 100000 }), + requestType: FortuneJobType.FORTUNE, + ...overrides, + }; +} + +export function createMockCvatManifest( + overrides: Partial = {}, +): CvatManifestDto { + return { + data: { + data_url: faker.internet.url(), + points_url: faker.datatype.boolean() ? faker.internet.url() : undefined, + boxes_url: faker.datatype.boolean() ? faker.internet.url() : undefined, + }, + annotation: { + labels: [ + { + name: faker.lorem.word(), + nodes: [faker.lorem.word(), faker.lorem.word()], + joints: [faker.lorem.word()], + }, + ], + description: faker.lorem.sentence(), + user_guide: faker.internet.url(), + type: CvatJobType.IMAGE_BOXES, + job_size: faker.number.int({ min: 1, max: 100 }), + qualifications: [faker.lorem.word()], + }, + validation: { + min_quality: faker.number.float({ min: 0.1, max: 1 }), + val_size: faker.number.int({ min: 1, max: 100 }), + gt_url: faker.internet.url(), + }, + job_bounty: faker.finance.amount(), + ...overrides, + }; +} + +export function createMockAudinoManifest( + overrides: Partial = {}, +): AudinoManifestDto { + return { + data: { + data_url: faker.internet.url(), + }, + annotation: { + labels: [{ name: faker.lorem.word() }], + description: faker.lorem.sentence(), + user_guide: faker.internet.url(), + type: AudinoJobType.AUDIO_TRANSCRIPTION, + segment_duration: faker.number.int({ min: 10, max: 360000 }), + qualifications: [faker.lorem.word()], + }, + validation: { + min_quality: faker.number.float({ min: 0.1, max: 1 }), + gt_url: faker.internet.url(), + }, + ...overrides, + }; +} + +export function createMockHcaptchaManifest( + overrides: Partial = {}, +): HCaptchaManifestDto { + return { + job_mode: faker.lorem.word(), + request_type: faker.helpers.arrayElement( + Object.values(JobCaptchaRequestType), + ), + request_config: { + shape_type: faker.helpers.arrayElement( + Object.values(JobCaptchaShapeType), + ), + min_shapes_per_image: faker.number.int({ min: 1, max: 5 }), + max_shapes_per_image: faker.number.int({ min: 6, max: 10 }), + min_points: faker.number.int({ min: 1, max: 5 }), + max_points: faker.number.int({ min: 6, max: 10 }), + minimum_selection_area_per_shape: faker.number.int({ min: 1, max: 100 }), + multiple_choice_max_choices: faker.number.int({ min: 1, max: 5 }), + multiple_choice_min_choices: faker.number.int({ min: 1, max: 5 }), + answer_type: faker.lorem.word(), + overlap_threshold: faker.number.float({ min: 0, max: 1 }), + max_length: faker.number.int({ min: 1, max: 100 }), + min_length: faker.number.int({ min: 1, max: 100 }), + }, + requester_accuracy_target: faker.number.float({ min: 0.1, max: 1 }), + requester_max_repeats: faker.number.int({ min: 1, max: 10 }), + requester_min_repeats: faker.number.int({ min: 1, max: 10 }), + requester_question_example: [faker.internet.url()], + requester_question: { en: faker.lorem.sentence() }, + taskdata_uri: faker.internet.url(), + job_total_tasks: faker.number.int({ min: 1, max: 1000 }), + task_bid_price: faker.number.float({ min: 0.01, max: 10 }), + groundtruth_uri: faker.internet.url(), + public_results: faker.datatype.boolean(), + oracle_stake: faker.number.int({ min: 1, max: 100 }), + repo_uri: faker.internet.url(), + ro_uri: faker.internet.url(), + restricted_audience: {}, + requester_restricted_answer_set: {}, + taskdata: [ + { + task_key: faker.string.uuid(), + datapoint_uri: faker.internet.url(), + datapoint_hash: faker.string.uuid(), + datapoint_text: { en: faker.lorem.sentence() }, + }, + ], + qualifications: [faker.lorem.word()], + ...overrides, + }; +} diff --git a/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts b/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts index 619a12ae74..0ae790de59 100644 --- a/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/manifest/manifest.service.spec.ts @@ -51,14 +51,16 @@ import { createJobAudinoDto, createJobCaptchaDto, createJobCvatDto, - getMockedProvider, - getMockedRegion, mockAuthConfigService, mockCvatConfigService, mockWeb3ConfigService, } from './fixtures'; import { FortuneManifestDto } from './manifest.dto'; import { ManifestService } from './manifest.service'; +import { + getMockedProvider, + getMockedRegion, +} from '../../../test/fixtures/storage'; describe('ManifestService', () => { let manifestService: ManifestService; diff --git a/packages/apps/job-launcher/server/src/modules/payment/payment.service.spec.ts b/packages/apps/job-launcher/server/src/modules/payment/payment.service.spec.ts index 4f1d74d264..2a7a83146a 100644 --- a/packages/apps/job-launcher/server/src/modules/payment/payment.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/payment/payment.service.spec.ts @@ -256,10 +256,7 @@ describe('PaymentService', () => { const user = { id: 1, - paymentInfo: { - customerId: 'test', - paymentMethodId: 'test', - }, + stripeCustomerId: 'cus_123', }; const paymentIntent = { @@ -300,10 +297,7 @@ describe('PaymentService', () => { const user = { id: 1, - paymentInfo: { - customerId: 'test', - paymentMethodId: 'test', - }, + stripeCustomerId: 'cus_123', }; const paymentIntent = { diff --git a/packages/apps/job-launcher/server/src/modules/payment/payment.service.ts b/packages/apps/job-launcher/server/src/modules/payment/payment.service.ts index db4c2bd3f7..0809be590b 100644 --- a/packages/apps/job-launcher/server/src/modules/payment/payment.service.ts +++ b/packages/apps/job-launcher/server/src/modules/payment/payment.service.ts @@ -80,7 +80,7 @@ export class PaymentService { // Creates a new Stripe customer if the user does not already have one. // It then initiates a SetupIntent to link a payment method (card) to the customer. let setupIntent: Stripe.Response; - let customerId: string = user.stripeCustomerId; + let customerId = user.stripeCustomerId; if (!user.stripeCustomerId) { try { @@ -101,7 +101,7 @@ export class PaymentService { automatic_payment_methods: { enabled: true, }, - customer: customerId, + customer: customerId ?? undefined, }); } catch (error) { this.logger.log(error.message, PaymentService.name); @@ -163,6 +163,10 @@ export class PaymentService { const { amount, currency, paymentMethodId } = dto; const amountInCents = Math.ceil(mul(amount, 100)); + if (!user.stripeCustomerId) { + throw new NotFoundError(ErrorPayment.CustomerNotFound); + } + const invoice = await this.createInvoice( user.stripeCustomerId, amountInCents, @@ -453,8 +457,7 @@ export class PaymentService { const currency = PaymentCurrency.USD; const user = await this.userRepository.findById(job.userId); - if (!user) { - this.logger.log(ErrorPayment.CustomerNotFound, PaymentService.name); + if (!user || !user.stripeCustomerId) { throw new NotFoundError(ErrorPayment.CustomerNotFound); } @@ -571,6 +574,7 @@ export class PaymentService { // Check if the payment method is the default one and in use for the user if ( + user.stripeCustomerId && paymentMethod.id === (await this.getDefaultPaymentMethod(user.stripeCustomerId)) && (await this.isPaymentMethodInUse(user.id)) @@ -657,6 +661,9 @@ export class PaymentService { } async changeDefaultPaymentMethod(user: UserEntity, cardId: string) { + if (!user.stripeCustomerId) { + throw new NotFoundError(ErrorPayment.CustomerNotFound); + } // Update the user's default payment method in Stripe return this.stripe.customers.update(user.stripeCustomerId, { invoice_settings: { default_payment_method: cardId }, @@ -705,8 +712,8 @@ export class PaymentService { status: payment.status, transaction: payment.transaction, createdAt: payment.createdAt.toISOString(), - jobId: payment.job ? payment.jobId : undefined, - escrowAddress: payment.job ? payment.job.escrowAddress : undefined, + jobId: payment.jobId ?? undefined, + escrowAddress: payment.job?.escrowAddress ?? undefined, }; }); diff --git a/packages/apps/job-launcher/server/src/modules/user/fixtures.ts b/packages/apps/job-launcher/server/src/modules/user/fixtures.ts new file mode 100644 index 0000000000..06b69d59f2 --- /dev/null +++ b/packages/apps/job-launcher/server/src/modules/user/fixtures.ts @@ -0,0 +1,21 @@ +import { faker } from '@faker-js/faker'; +import { UserStatus, UserType } from '../../common/enums/user'; +import { UserEntity } from './user.entity'; + +export const createUser = (overrides: Partial = {}): UserEntity => { + const user = new UserEntity(); + user.id = faker.number.int(); + user.email = faker.internet.email(); + user.password = faker.internet.password(); + user.type = faker.helpers.arrayElement(Object.values(UserType)); + user.status = faker.helpers.arrayElement(Object.values(UserStatus)); + user.stripeCustomerId = faker.string.uuid(); + user.jobs = []; + user.payments = []; + user.apiKey = null; + user.whitelist = null; + user.createdAt = faker.date.recent(); + user.updatedAt = new Date(); + Object.assign(user, overrides); + return user; +}; diff --git a/packages/apps/job-launcher/server/src/modules/user/user.entity.ts b/packages/apps/job-launcher/server/src/modules/user/user.entity.ts index f67be393be..c63f108411 100644 --- a/packages/apps/job-launcher/server/src/modules/user/user.entity.ts +++ b/packages/apps/job-launcher/server/src/modules/user/user.entity.ts @@ -29,7 +29,7 @@ export class UserEntity extends BaseEntity implements IUser { public status: UserStatus; @Column({ type: 'varchar', nullable: true, unique: true }) - public stripeCustomerId: string; + public stripeCustomerId: string | null; @OneToMany(() => JobEntity, (job) => job.user) public jobs: JobEntity[]; @@ -40,10 +40,10 @@ export class UserEntity extends BaseEntity implements IUser { @OneToOne(() => ApiKeyEntity, (apiKey) => apiKey.user, { nullable: true, }) - public apiKey: ApiKeyEntity; + public apiKey: ApiKeyEntity | null; @OneToOne(() => WhitelistEntity, (whitelist) => whitelist.user, { nullable: true, }) - public whitelist: WhitelistEntity; + public whitelist: WhitelistEntity | null; } diff --git a/packages/apps/job-launcher/server/test/fixtures/storage.ts b/packages/apps/job-launcher/server/test/fixtures/storage.ts new file mode 100644 index 0000000000..a4b1a328f1 --- /dev/null +++ b/packages/apps/job-launcher/server/test/fixtures/storage.ts @@ -0,0 +1,16 @@ +import { faker } from '@faker-js/faker'; +import { AWSRegions, StorageProviders } from '../../src/common/enums/storage'; + +const PROVIDERS = Object.values(StorageProviders).filter( + (provider) => provider !== StorageProviders.LOCAL, +); + +const REGIONS = Object.values(AWSRegions); + +export function getMockedProvider(): StorageProviders { + return faker.helpers.arrayElement(PROVIDERS); +} + +export function getMockedRegion(): AWSRegions { + return faker.helpers.arrayElement(REGIONS); +} diff --git a/packages/apps/job-launcher/server/test/fixtures/web3.ts b/packages/apps/job-launcher/server/test/fixtures/web3.ts new file mode 100644 index 0000000000..6ac5909e8d --- /dev/null +++ b/packages/apps/job-launcher/server/test/fixtures/web3.ts @@ -0,0 +1,18 @@ +import { Wallet } from 'ethers'; + +export type SignerMock = jest.Mocked> & { + __transactionResponse: { + wait: jest.Mock; + }; +}; + +export function createSignerMock(): SignerMock { + const transactionResponse = { + wait: jest.fn(), + }; + + return { + sendTransaction: jest.fn().mockResolvedValue(transactionResponse), + __transactionResponse: transactionResponse, + }; +} From 5728ddf799375cb22fef9c07ee22eb286856ebbb Mon Sep 17 00:00:00 2001 From: KirillKirill Date: Tue, 3 Jun 2025 17:55:56 +0300 Subject: [PATCH 11/21] [Dashboard] - Refactor linter (#3375) * refacor: using modern flat eslint config, add some rules, change a pattern for import paths * fix: lint * fix: install dependencies * refactor: sort and order imports * feat: add lint-staged * refactor: eslint config and ts config per feedback * fix: replace with tseslint.config * bump eslint --- packages/apps/dashboard/client/.eslintrc.cjs | 19 - .../apps/dashboard/client/eslint.config.js | 99 +++++ packages/apps/dashboard/client/package.json | 19 +- packages/apps/dashboard/client/src/App.tsx | 8 +- .../components/Breadcrumbs/Breadcrumbs.tsx | 7 +- .../src/components/Charts/AreaChart.tsx | 31 +- .../components/Charts/CustomChartTooltip.tsx | 16 +- .../src/components/Charts/CustomXAxisTick.tsx | 5 +- .../src/components/Charts/ToggleCharts.tsx | 5 +- .../src/components/Clipboard/Clipboard.tsx | 7 +- .../src/components/DataEntry/DatePicker.tsx | 10 +- .../components/DataEntry/ToggleButtons.tsx | 9 +- .../client/src/components/Footer/Footer.tsx | 14 +- .../client/src/components/Header/Header.tsx | 16 +- .../src/components/Home/GraphSwiper.tsx | 13 +- .../client/src/components/Home/SmallGraph.tsx | 18 +- .../src/components/Icons/AvalancheIcon.tsx | 3 +- .../Icons/BinanceSmartChainIcon.tsx | 3 +- .../client/src/components/Icons/CeloIcon.tsx | 3 +- .../src/components/Icons/DiscordIcon.tsx | 1 + .../components/Icons/EscrowAddressIcon.tsx | 3 +- .../src/components/Icons/EthereumIcon.tsx | 3 +- .../components/Icons/ExchangeOracleIcon.tsx | 3 +- .../client/src/components/Icons/HumanIcon.tsx | 3 +- .../src/components/Icons/JobLauncher.tsx | 3 +- .../src/components/Icons/LeaderboardIcon.tsx | 3 +- .../src/components/Icons/LogoBlockIcon.tsx | 3 +- .../components/Icons/LogoBlockIconMobile.tsx | 3 +- .../components/Icons/MoonbaseAlphaIcon.tsx | 3 +- .../src/components/Icons/MoonbeamIcon.tsx | 3 +- .../src/components/Icons/PolygonIcon.tsx | 3 +- .../src/components/Icons/RecordingOracle.tsx | 3 +- .../src/components/Icons/ReputationOracle.tsx | 3 +- .../src/components/Icons/WalletIcon.tsx | 3 +- .../src/components/Icons/XLayerIcon.tsx | 3 +- .../client/src/components/Loader/index.tsx | 2 +- .../src/components/NetworkIcon/index.tsx | 18 +- .../components/NothingFound/NothingFound.tsx | 2 +- .../components/PageWrapper/PageWrapper.tsx | 6 +- .../components/SearchBar/SearchBar.styles.ts | 2 +- .../src/components/SearchBar/SearchBar.tsx | 24 +- .../SearchResults/AbbreviateClipboard.tsx | 16 +- .../SearchResults/TitleSectionWrapper.tsx | 8 +- .../src/components/ShadowIcon/ShadowIcon.tsx | 1 + .../Leaderboard/components/AddressCell.tsx | 3 +- .../Leaderboard/components/ChainCell.tsx | 5 +- .../components/DataGridWrapper.tsx | 10 +- .../Leaderboard/components/EntityIcon.tsx | 11 +- .../Leaderboard/components/RoleCell.tsx | 10 +- .../Leaderboard/components/SelectNetwork.tsx | 20 +- .../Leaderboard/hooks/useDataGrid.tsx | 16 +- .../client/src/features/Leaderboard/index.tsx | 7 +- packages/apps/dashboard/client/src/main.tsx | 13 +- .../client/src/pages/Graph/Graph.tsx | 12 +- .../client/src/pages/Home/Holders.tsx | 4 +- .../dashboard/client/src/pages/Home/Home.tsx | 30 +- .../client/src/pages/Home/Leaderboard.tsx | 3 +- .../src/pages/Home/TotalNumberOfTasks.tsx | 4 +- .../src/pages/Home/TotalTransactions.tsx | 4 +- .../client/src/pages/Leaderboard/index.tsx | 11 +- .../EscrowAddress/EscrowAddress.tsx | 7 +- .../pages/SearchResults/HmtBalance/index.tsx | 4 +- .../pages/SearchResults/HmtPrice/index.tsx | 2 +- .../src/pages/SearchResults/KVStore/index.tsx | 10 +- .../SearchResults/ReputationScore/index.tsx | 5 +- .../SearchResults/RoleDetails/RoleDetails.tsx | 28 +- .../RoleDetailsEscrowsTable.tsx | 14 +- .../tableComponents/EscrowsTableBody.tsx | 23 +- .../EscrowsTableBodyContainer.tsx | 2 +- .../src/pages/SearchResults/SearchResults.tsx | 39 +- .../pages/SearchResults/StakeInfo/index.tsx | 5 +- .../WalletAddress/WalletAddress.tsx | 15 +- .../WalletAddressTransactionsTable.tsx | 13 +- .../cells/TransactionTableCellMethod.tsx | 2 +- .../cells/TransactionTableCellValue.tsx | 5 +- .../tableComponents/TransactionsTableBody.tsx | 31 +- .../TransactionsTableBodyContainer.tsx | 2 +- .../tableComponents/TransactionsTableHead.tsx | 8 +- .../src/services/api/use-address-details.tsx | 11 +- .../src/services/api/use-escrows-details.tsx | 12 +- .../src/services/api/use-general-stats.tsx | 6 +- .../api/use-graph-page-chart-data.tsx | 15 +- .../api/use-hcaptcha-general-stats.tsx | 6 +- .../client/src/services/api/use-hmt-price.tsx | 6 +- .../src/services/api/use-kvstore-data.tsx | 10 +- .../services/api/use-leaderboard-details.tsx | 9 +- .../services/api/use-transaction-details.tsx | 10 +- .../client/src/services/global.type.ts | 2 +- .../client/src/services/http-service.ts | 1 + .../client/src/services/validate-response.ts | 2 +- packages/apps/dashboard/client/src/theme.tsx | 11 +- .../client/src/utils/config/networks.ts | 3 +- .../src/utils/hooks/use-filtered-networks.ts | 10 +- packages/apps/dashboard/client/tsconfig.json | 19 +- packages/apps/dashboard/client/vite.config.ts | 15 +- yarn.lock | 416 +++++++++++++++++- 96 files changed, 974 insertions(+), 398 deletions(-) delete mode 100644 packages/apps/dashboard/client/.eslintrc.cjs create mode 100644 packages/apps/dashboard/client/eslint.config.js diff --git a/packages/apps/dashboard/client/.eslintrc.cjs b/packages/apps/dashboard/client/.eslintrc.cjs deleted file mode 100644 index 071a19765f..0000000000 --- a/packages/apps/dashboard/client/.eslintrc.cjs +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - 'plugin:react-hooks/recommended', - ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], - rules: { - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, -}; diff --git a/packages/apps/dashboard/client/eslint.config.js b/packages/apps/dashboard/client/eslint.config.js new file mode 100644 index 0000000000..dcf3e17b34 --- /dev/null +++ b/packages/apps/dashboard/client/eslint.config.js @@ -0,0 +1,99 @@ +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import reactPlugin from 'eslint-plugin-react'; +import reactHooksPlugin from 'eslint-plugin-react-hooks'; +import prettierPlugin from 'eslint-plugin-prettier'; +import importPlugin from 'eslint-plugin-import'; +import globals from 'globals'; + +export default tseslint.config( + { + ignores: ['dist/', 'tsconfig.json'], + }, + eslint.configs.recommended, + tseslint.configs.recommended, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + ecmaVersion: 2022, + sourceType: 'module', + parser: tseslint.parser, + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + projectService: true, + }, + globals: { + ...globals.browser, + ...globals.es2022, + }, + }, + plugins: { + react: reactPlugin, + 'react-hooks': reactHooksPlugin, + prettier: prettierPlugin, + import: importPlugin, + }, + settings: { + react: { + version: 'detect', + }, + 'import/resolver': { + typescript: { + alwaysTryTypes: true, + }, + }, + }, + rules: { + 'react/prop-types': 'off', + 'react/display-name': 'off', + 'react/react-in-jsx-scope': 'off', + 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/rules-of-hooks': 'error', + 'import/order': [ + 'error', + { + 'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], + 'pathGroups': [ + { + 'pattern': 'react', + 'group': 'external', + 'position': 'before' + } + ], + 'pathGroupsExcludedImportTypes': ['react'], + 'newlines-between': 'always', + 'alphabetize': { + 'order': 'asc', + 'caseInsensitive': true + } + } + ], + 'import/no-duplicates': 'error', + 'import/no-unresolved': 'error', + '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }], + '@typescript-eslint/no-explicit-any': 'error', + 'no-console': ['error', { allow: ['warn', 'error'] }], + quotes: [ + 'error', + 'single', + { + avoidEscape: true, + }, + ], + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'lodash', + message: + 'Please import only specific modules from lodash to reduce bundle size. Instead of import {compact} from `lodash`, import compact from lodash/compact', + }, + ], + }, + ], + }, + } +); diff --git a/packages/apps/dashboard/client/package.json b/packages/apps/dashboard/client/package.json index 90e9fa80b2..d8349972ea 100644 --- a/packages/apps/dashboard/client/package.json +++ b/packages/apps/dashboard/client/package.json @@ -9,7 +9,8 @@ "clean": "tsc --build --clean && rm -rf dist", "start": "vite", "build": "tsc --build && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "lint": "eslint . --report-unused-disable-directives --max-warnings 0", + "lint:fix": "eslint . --fix", "preview": "vite preview", "vercel-build": "yarn workspace human-protocol build:libs && yarn build", "test": "exit 0" @@ -44,18 +45,30 @@ "zustand": "^4.5.4" }, "devDependencies": { + "@eslint/js": "^9.27.0", "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", "@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/parser": "^7.2.0", "@vitejs/plugin-react": "^4.2.1", - "eslint": "^8.57.0", - "eslint-plugin-react-hooks": "^5.1.0", + "eslint": "^9.27.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.4.0", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.11", + "globals": "^16.2.0", "prettier": "^3.4.2", "sass": "^1.85.0", "typescript": "^5.6.3", + "typescript-eslint": "^8.33.0", "vite": "^6.2.4", "vite-plugin-svgr": "^4.2.0" + }, + "lint-staged": { + "*.{ts,tsx}": [ + "prettier --write", + "eslint --fix" + ] } } diff --git a/packages/apps/dashboard/client/src/App.tsx b/packages/apps/dashboard/client/src/App.tsx index fd00554e6d..c78a2f31b6 100644 --- a/packages/apps/dashboard/client/src/App.tsx +++ b/packages/apps/dashboard/client/src/App.tsx @@ -2,10 +2,10 @@ import { FC } from 'react'; import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; -import Graph from '@pages/Graph'; -import Home from '@pages/Home'; -import LeaderBoard from '@pages/Leaderboard'; -import SearchResults from '@pages/SearchResults'; +import Graph from '@/pages/Graph'; +import Home from '@/pages/Home'; +import LeaderBoard from '@/pages/Leaderboard'; +import SearchResults from '@/pages/SearchResults'; const App: FC = () => { return ( diff --git a/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx b/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx index 8505e7439c..2858ae7b4d 100644 --- a/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx +++ b/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx @@ -1,11 +1,10 @@ import { FC } from 'react'; -import { Link as RouterLink } from 'react-router-dom'; -import Link from '@mui/material/Link'; +import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import Box from '@mui/material/Box'; +import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; - -import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; +import { Link as RouterLink } from 'react-router-dom'; const Breadcrumbs: FC<{ title?: string }> = ({ title }) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx b/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx index 990e9cabbe..456135b49d 100644 --- a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx @@ -1,3 +1,9 @@ +import { useEffect, useRef, useState } from 'react'; + +import { Typography } from '@mui/material'; +import Card from '@mui/material/Card'; +import Stack from '@mui/material/Stack'; +import dayjs, { Dayjs } from 'dayjs'; import { CartesianGrid, Tooltip, @@ -7,26 +13,23 @@ import { Area, ResponsiveContainer, } from 'recharts'; -import CustomChartTooltip from './CustomChartTooltip'; -import { useEffect, useRef, useState } from 'react'; -import Card from '@mui/material/Card'; -import { Typography } from '@mui/material'; -import Stack from '@mui/material/Stack'; -import { colorPalette } from '@assets/styles/color-palette'; -import CustomXAxisTick from '@components/Charts/CustomXAxisTick'; -import DatePicker from '@components/DataEntry/DatePicker'; -import ToggleButtons from '@components/DataEntry/ToggleButtons'; -import dayjs, { Dayjs } from 'dayjs'; -import ToggleCharts from '@components/Charts/ToggleCharts'; -import { formatNumber } from '@helpers/formatNumber'; + +import { colorPalette } from '@/assets/styles/color-palette'; +import CustomXAxisTick from '@/components/Charts/CustomXAxisTick'; +import ToggleCharts from '@/components/Charts/ToggleCharts'; +import DatePicker from '@/components/DataEntry/DatePicker'; +import ToggleButtons from '@/components/DataEntry/ToggleButtons'; +import { formatNumber } from '@/helpers/formatNumber'; import { GraphPageChartData, useGraphPageChartData, -} from '@services/api/use-graph-page-chart-data'; +} from '@/services/api/use-graph-page-chart-data'; import { initialAllTime, useGraphPageChartParams, -} from '@utils/hooks/use-graph-page-chart-params'; +} from '@/utils/hooks/use-graph-page-chart-params'; + +import CustomChartTooltip from './CustomChartTooltip'; export type GraphPageChartDataConfigObject = Partial< Record diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx b/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx index ccca5b6c96..d27479a7ef 100644 --- a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx @@ -1,13 +1,15 @@ -import { TooltipProps } from 'recharts'; -import Card from '@mui/material/Card'; -import Box from '@mui/material/Box'; +import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; import { Grid, Typography } from '@mui/material'; +import Box from '@mui/material/Box'; +import Card from '@mui/material/Card'; import Stack from '@mui/material/Stack'; -import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; -import { colorPalette } from '@assets/styles/color-palette'; -import { formatDate } from '@helpers/formatDate'; -import { GraphPageChartDataConfigObject } from '@components/Charts/AreaChart'; import { NumericFormat } from 'react-number-format'; +import { TooltipProps } from 'recharts'; + +import { colorPalette } from '@/assets/styles/color-palette'; +import { GraphPageChartDataConfigObject } from '@/components/Charts/AreaChart'; +import { formatDate } from '@/helpers/formatDate'; + const renderTitle = (title: string) => { const currentTitle: GraphPageChartDataConfigObject = { diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx b/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx index 364f711fe6..46fc03a3f8 100644 --- a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx @@ -1,7 +1,8 @@ -import { colorPalette } from '@assets/styles/color-palette'; // @ts-expect-error -- import error, but this type work property import { ContentRenderer } from 'recharts'; -import { formatDate } from '@helpers/formatDate'; + +import { colorPalette } from '@/assets/styles/color-palette'; +import { formatDate } from '@/helpers/formatDate'; const CustomXAxisTick = ({ x, y, payload }: ContentRenderer) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx b/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx index bb040ec562..58d2196304 100644 --- a/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx @@ -1,7 +1,8 @@ import { FormControlLabel, FormGroup, Typography } from '@mui/material'; -import Stack from '@mui/material/Stack'; import Checkbox from '@mui/material/Checkbox'; -import { FormatNumber } from '@components/Home/FormatNumber'; +import Stack from '@mui/material/Stack'; + +import { FormatNumber } from '@/components/Home/FormatNumber'; interface ToggleChartsProps { handleChange: (event: React.ChangeEvent) => void; diff --git a/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx b/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx index 967c27340e..7601d81cf3 100644 --- a/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx +++ b/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx @@ -1,11 +1,12 @@ import { useState } from 'react'; +import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import Card from '@mui/material/Card'; +import IconButton from '@mui/material/IconButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import IconButton from '@mui/material/IconButton'; -import ContentCopyIcon from '@mui/icons-material/ContentCopy'; -import CustomTooltip from '@components/CustomTooltip'; + +import CustomTooltip from '@/components/CustomTooltip'; interface ClipboardProps { value: string; diff --git a/packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx b/packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx index a53e3d65f1..a2394d1781 100644 --- a/packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx +++ b/packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx @@ -1,3 +1,6 @@ +import { Dispatch, SetStateAction, useState } from 'react'; + +import Typography from '@mui/material/Typography'; import { DatePickerProps, LocalizationProvider, @@ -5,15 +8,14 @@ import { } from '@mui/x-date-pickers'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { DatePicker as DatePickerMui } from '@mui/x-date-pickers/DatePicker'; -import type { Dayjs } from 'dayjs'; -import { Dispatch, SetStateAction, useState } from 'react'; -import Typography from '@mui/material/Typography'; import { BaseSingleInputFieldProps, DateValidationError, FieldSection, } from '@mui/x-date-pickers/models'; -import { colorPalette } from '@assets/styles/color-palette'; +import type { Dayjs } from 'dayjs'; + +import { colorPalette } from '@/assets/styles/color-palette'; interface CustomDateFieldProps extends UseDateFieldProps, diff --git a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx b/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx index 88da0dd274..5383d14c25 100644 --- a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx +++ b/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx @@ -1,13 +1,14 @@ -import ToggleButton from '@mui/material/ToggleButton'; -import Typography from '@mui/material/Typography'; import { styled } from '@mui/material'; +import ToggleButton from '@mui/material/ToggleButton'; import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; +import Typography from '@mui/material/Typography'; +import dayjs from 'dayjs'; + import { TIME_PERIOD_OPTIONS, TimePeriod, useGraphPageChartParams, -} from '@utils/hooks/use-graph-page-chart-params'; -import dayjs from 'dayjs'; +} from '@/utils/hooks/use-graph-page-chart-params'; export const StyledToggleButtonGroup = styled(ToggleButtonGroup)( ({ theme }) => ({ diff --git a/packages/apps/dashboard/client/src/components/Footer/Footer.tsx b/packages/apps/dashboard/client/src/components/Footer/Footer.tsx index 31e4281a67..a649b59936 100644 --- a/packages/apps/dashboard/client/src/components/Footer/Footer.tsx +++ b/packages/apps/dashboard/client/src/components/Footer/Footer.tsx @@ -1,16 +1,16 @@ import { FC } from 'react'; +import GitHubIcon from '@mui/icons-material/GitHub'; +import LinkedInIcon from '@mui/icons-material/LinkedIn'; +import TelegramIcon from '@mui/icons-material/Telegram'; +import TwitterIcon from '@mui/icons-material/Twitter'; +import { IconButton, styled } from '@mui/material'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; -import { IconButton, styled } from '@mui/material'; 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 '@components/Icons/DiscordIcon'; -import { env } from '@helpers/env'; +import DiscordIcon from '@/components/Icons/DiscordIcon'; +import { env } from '@/helpers/env'; const StyledLink = styled(Link)(({ theme }) => ({ textDecoration: 'none', diff --git a/packages/apps/dashboard/client/src/components/Header/Header.tsx b/packages/apps/dashboard/client/src/components/Header/Header.tsx index b323190c2d..1d0197b81f 100644 --- a/packages/apps/dashboard/client/src/components/Header/Header.tsx +++ b/packages/apps/dashboard/client/src/components/Header/Header.tsx @@ -1,20 +1,20 @@ import { FC, useState } from 'react'; +import CloseIcon from '@mui/icons-material/Close'; +import MenuIcon from '@mui/icons-material/Menu'; +import { Link as MuiLink } from '@mui/material'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; -import IconButton from '@mui/material/IconButton'; -import { Link as MuiLink } from '@mui/material'; -import CloseIcon from '@mui/icons-material/Close'; -import MenuIcon from '@mui/icons-material/Menu'; import Drawer from '@mui/material/Drawer'; -import Toolbar from '@mui/material/Toolbar'; +import IconButton from '@mui/material/IconButton'; import styled from '@mui/material/styles/styled'; +import Toolbar from '@mui/material/Toolbar'; import { Link } from 'react-router-dom'; -import { LogoBlockIcon } from '@components/Icons/LogoBlockIcon'; -import { LogoBlockIconMobile } from '@components/Icons/LogoBlockIconMobile'; -import { env } from '@helpers/env'; +import { LogoBlockIcon } from '@/components/Icons/LogoBlockIcon'; +import { LogoBlockIconMobile } from '@/components/Icons/LogoBlockIconMobile'; +import { env } from '@/helpers/env'; const NavLink = styled(MuiLink)(({ theme }) => ({ color: theme.palette.primary.main, diff --git a/packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx b/packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx index 88efa002bd..cb42b9e8f5 100644 --- a/packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx +++ b/packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx @@ -1,11 +1,13 @@ +import { useEffect } from 'react'; + import { Navigation } from 'swiper/modules'; import { Swiper, SwiperSlide } from 'swiper/react'; -import SmallGraph from '@components/Home/SmallGraph'; + +import SmallGraph from '@/components/Home/SmallGraph'; import 'swiper/css'; import 'swiper/css/navigation'; -import { useGraphPageChartData } from '@services/api/use-graph-page-chart-data'; -import { useGraphPageChartParams } from '@utils/hooks/use-graph-page-chart-params'; -import { useEffect } from 'react'; +import { useGraphPageChartData } from '@/services/api/use-graph-page-chart-data'; +import { useGraphPageChartParams } from '@/utils/hooks/use-graph-page-chart-params'; const GraphSwiper = () => { const { data } = useGraphPageChartData(); @@ -13,8 +15,7 @@ const GraphSwiper = () => { useEffect(() => { revertToInitialParams(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [revertToInitialParams]); const transactionHistoryData = (data || []).map( ({ totalTransactionCount, date }) => ({ diff --git a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx index 18c3af1b8f..c5484fcba4 100644 --- a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx +++ b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx @@ -1,5 +1,9 @@ import { Fragment } from 'react'; +import Box from '@mui/material/Box'; +import Card from '@mui/material/Card'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; import { AreaChart, Area, @@ -10,16 +14,12 @@ import { ResponsiveContainer, TooltipProps, } from 'recharts'; -import Box from '@mui/material/Box'; -import Card from '@mui/material/Card'; -import Stack from '@mui/material/Stack'; -import ToggleButtons from '@components/DataEntry/ToggleButtons'; -import Typography from '@mui/material/Typography'; -import { colorPalette } from '@assets/styles/color-palette'; -import { formatDate } from '@helpers/formatDate'; -import { formatNumber } from '@helpers/formatNumber'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; +import { colorPalette } from '@/assets/styles/color-palette'; +import ToggleButtons from '@/components/DataEntry/ToggleButtons'; +import { formatDate } from '@/helpers/formatDate'; +import { formatNumber } from '@/helpers/formatNumber'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; const CustomSmallChartTooltip = ({ payload, diff --git a/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx index 2a1473418b..83d1eae24a 100644 --- a/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const AvalancheIcon: FC = (props) => { return ( = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx index 08d77b3a59..19e30cba4d 100644 --- a/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const CeloIcon: FC = (props) => { return ( = (props) => { diff --git a/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx index a8c8776d97..754095c5b6 100644 --- a/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const EscrowAddressIcon: FC = (props) => { return ( = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx index e6b53725ee..be1d4c4bfd 100644 --- a/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const ExchangeOracleIcon: FC = (props) => { return ( = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/JobLauncher.tsx b/packages/apps/dashboard/client/src/components/Icons/JobLauncher.tsx index 650028aa2b..74cd5261e8 100644 --- a/packages/apps/dashboard/client/src/components/Icons/JobLauncher.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/JobLauncher.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const JobLauncher: FC = (props) => { return ( = (props) => { return ( = (props) => { return ( = (props) => { return ( = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx index 085f24f1d2..b2de436954 100644 --- a/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const MoonbeamIcon: FC = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx index 26ef262294..9233ed8930 100644 --- a/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const PolygonIcon: FC = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/RecordingOracle.tsx b/packages/apps/dashboard/client/src/components/Icons/RecordingOracle.tsx index 9c02b7cfef..5fe3b28eb0 100644 --- a/packages/apps/dashboard/client/src/components/Icons/RecordingOracle.tsx +++ b/packages/apps/dashboard/client/src/components/Icons/RecordingOracle.tsx @@ -1,6 +1,7 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + export const RecordingOracle: FC = (props) => { return ( = (props) => { return ( = (props) => { return ( = (props) => { return ( { const icon = (() => { diff --git a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx b/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx index 39162a97e4..724fe89541 100644 --- a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx +++ b/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx @@ -8,7 +8,7 @@ const NothingFound: FC = () => { <> Nothing found :( - We couldn't find anything within this criteria. + We couldn't find anything within this criteria.
Please search by wallet address or escrow address.
diff --git a/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx b/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx index 9ae5b905a8..d5061f2ad1 100644 --- a/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx +++ b/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx @@ -1,7 +1,9 @@ import { FC, PropsWithChildren } from 'react'; + import clsx from 'clsx'; -import Header from '@components/Header'; -import Footer from '@components/Footer'; + +import Footer from '@/components/Footer'; +import Header from '@/components/Header'; const PageWrapper: FC< PropsWithChildren<{ diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts index 20a24ae2c5..3812d346f4 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts +++ b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts @@ -1,4 +1,4 @@ -import { colorPalette } from '@assets/styles/color-palette'; +import { colorPalette } from '@/assets/styles/color-palette'; export const endAdornmentInputAdornmentSx = { display: 'flex', diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx index b57d3b7b28..b9d0fb2881 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx +++ b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx @@ -1,9 +1,7 @@ import { FC, useCallback, useEffect, useState } from 'react'; -import clsx from 'clsx'; -import { useNavigate } from 'react-router-dom'; -import IconButton from '@mui/material/IconButton'; -import SearchIcon from '@mui/icons-material/Search'; + import CloseIcon from '@mui/icons-material/Close'; +import SearchIcon from '@mui/icons-material/Search'; import { InputAdornment, TextField, @@ -15,11 +13,18 @@ import { Tooltip, CircularProgress, } from '@mui/material'; -import { colorPalette } from '@assets/styles/color-palette'; -import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; -import { NetworkIcon } from '@components/NetworkIcon'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; +import IconButton from '@mui/material/IconButton'; +import clsx from 'clsx'; +import { useNavigate } from 'react-router-dom'; + +import { colorPalette } from '@/assets/styles/color-palette'; +import { NetworkIcon } from '@/components/NetworkIcon'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import { useFilteredNetworks } from '@/utils/hooks/use-filtered-networks'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; + +import { isValidEVMAddress } from '../../helpers/isValidEVMAddress'; + import { endAdornmentInputAdornmentSx, startAdornmentInputAdornmentSx, @@ -29,7 +34,6 @@ import { muiTextFieldSx, gridSx, } from './SearchBar.styles'; -import { isValidEVMAddress } from '../../helpers/isValidEVMAddress'; interface SearchBarProps { className?: string; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx b/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx index 3ca2e6ce56..e158a4bd15 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx +++ b/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx @@ -1,13 +1,15 @@ -import Stack from '@mui/material/Stack'; -import Typography from '@mui/material/Typography'; -import abbreviateValue from '@helpers/abbreviateValue'; -import IconButton from '@mui/material/IconButton'; +import { useState } from 'react'; + import ContentCopyIcon from '@mui/icons-material/ContentCopy'; -import { colorPalette } from '@assets/styles/color-palette'; import { Link } from '@mui/material'; +import IconButton from '@mui/material/IconButton'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; -import { useState } from 'react'; -import CustomTooltip from '@components/CustomTooltip'; + +import { colorPalette } from '@/assets/styles/color-palette'; +import CustomTooltip from '@/components/CustomTooltip'; +import abbreviateValue from '@/helpers/abbreviateValue'; interface AbbreviateClipboardProps { value: string; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx b/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx index dd8bbf8d8e..a7c49b216a 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx +++ b/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx @@ -1,12 +1,12 @@ import { FC, PropsWithChildren } from 'react'; -import Stack from '@mui/material/Stack'; -import Box from '@mui/material/Box'; import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import Typography from '@mui/material/Typography'; import { SxProps } from '@mui/material'; +import Box from '@mui/material/Box'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; -import CustomTooltip from '@components/CustomTooltip'; +import CustomTooltip from '@/components/CustomTooltip'; type Props = { title: string; diff --git a/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx b/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx index a01fb875a4..cf79aebfe8 100644 --- a/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx +++ b/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx @@ -1,4 +1,5 @@ import { FC } from 'react'; + import clsx from 'clsx'; const ShadowIcon: FC<{ diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx index bfaa2633be..8901834946 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx @@ -1,6 +1,7 @@ -import AbbreviateClipboard from '@components/SearchResults/AbbreviateClipboard'; import { Box } from '@mui/material'; +import AbbreviateClipboard from '@/components/SearchResults/AbbreviateClipboard'; + export const AddressCell = ({ chainId, address, diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx index e341f5b7ba..9da3ec67f6 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx @@ -1,6 +1,7 @@ import { Typography } from '@mui/material'; -import { NetworkIcon } from '@components/NetworkIcon'; -import { getNetwork } from '@utils/config/networks'; + +import { NetworkIcon } from '@/components/NetworkIcon'; +import { getNetwork } from '@/utils/config/networks'; export const ChainCell = ({ chainId }: { chainId: number }) => ( = ({ role }) => { switch (role) { case Role.JobLauncher: diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx index 3fb3e6b34f..e2db9ec66b 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx @@ -1,9 +1,13 @@ -import { Box, Typography } from '@mui/material'; import { Launch as LaunchIcon } from '@mui/icons-material'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; +import { Box, Typography } from '@mui/material'; import { Link } from 'react-router-dom'; + +import { CaseConverter } from '@/utils/case-converter'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; + + import { EntityIcon } from './EntityIcon'; -import { CaseConverter } from '@utils/case-converter'; + const Wrapper = ({ children, diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx index 8ce48e5d04..0ff63569cd 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx @@ -1,14 +1,18 @@ -import Select, { SelectChangeEvent } from '@mui/material/Select'; +import { useEffect } from 'react'; + +import Box from '@mui/material/Box'; +import CircularProgress from '@mui/material/CircularProgress'; import FormControl from '@mui/material/FormControl'; import InputLabel from '@mui/material/InputLabel'; import MenuItem from '@mui/material/MenuItem'; -import Box from '@mui/material/Box'; -import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; -import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; -import { NetworkIcon } from '@components/NetworkIcon'; -import CircularProgress from '@mui/material/CircularProgress'; -import { useEffect } from 'react'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; + +import { NetworkIcon } from '@/components/NetworkIcon'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import { useFilteredNetworks } from '@/utils/hooks/use-filtered-networks'; +import { useLeaderboardSearch } from '@/utils/hooks/use-leaderboard-search'; + + export const SelectNetwork = () => { const { diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx index 6480ae130b..01117644a2 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx @@ -1,22 +1,22 @@ import { useMemo } from 'react'; -import { Box, Typography } from '@mui/material'; import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import { Box, Typography } from '@mui/material'; import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid'; -import CustomTooltip from '@components/CustomTooltip'; -import { RoleCell } from '../components/RoleCell'; +import CustomTooltip from '@/components/CustomTooltip'; +import { LeaderBoardData } from '@/services/api/use-leaderboard-details'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import { useLeaderboardSearch } from '@/utils/hooks/use-leaderboard-search'; + import { AddressCell } from '../components/AddressCell'; +import { CategoryCell } from '../components/CategoryCell'; import { ChainCell } from '../components/ChainCell'; +import { RoleCell } from '../components/RoleCell'; import { SelectNetwork } from '../components/SelectNetwork'; import { TextCell } from '../components/TextCell'; -import { CategoryCell } from '../components/CategoryCell'; -import { LeaderBoardData } from '@services/api/use-leaderboard-details'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; -import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; -// eslint-disable-next-line react-refresh/only-export-components const InfoTooltip = ({ title }: { title: string }) => ( { const { revertToInitialParams } = useGraphPageChartParams(); useEffect(() => { revertToInitialParams(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [revertToInitialParams]); return ( diff --git a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx b/packages/apps/dashboard/client/src/pages/Home/Holders.tsx index d25feb93b3..0fc3d025f8 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/Holders.tsx @@ -1,8 +1,8 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@components/Home/FormatNumber'; -import { useGeneralStats } from '@services/api/use-general-stats'; +import { FormatNumber } from '@/components/Home/FormatNumber'; +import { useGeneralStats } from '@/services/api/use-general-stats'; const Holders = () => { const { data, isSuccess, isPending, isError } = useGeneralStats(); diff --git a/packages/apps/dashboard/client/src/pages/Home/Home.tsx b/packages/apps/dashboard/client/src/pages/Home/Home.tsx index 73e16c028a..c595560a32 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Home.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/Home.tsx @@ -1,27 +1,27 @@ import { FC } from 'react'; +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Divider from '@mui/material/Divider'; -import Grid from '@mui/material/Unstable_Grid2'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import styled from '@mui/material/styles/styled'; import Typography from '@mui/material/Typography'; +import Grid from '@mui/material/Unstable_Grid2'; import { Link } from 'react-router-dom'; -import styled from '@mui/material/styles/styled'; -import PageWrapper from '@components/PageWrapper'; -import SearchBar from '@components/SearchBar/SearchBar'; -import ShadowIcon from '@components/ShadowIcon'; -import { Leaderboard } from './Leaderboard'; -import GraphSwiper from '@components/Home/GraphSwiper'; -import HMTPrice from '@pages/Home/HMTPrice'; -import TotalNumberOfTasks from '@pages/Home/TotalNumberOfTasks'; -import Holders from '@pages/Home/Holders'; -import TotalTransactions from '@pages/Home/TotalTransactions'; -import { LeaderboardIcon } from '@components/Icons/LeaderboardIcon'; -import CustomTooltip from '@components/CustomTooltip'; +import CustomTooltip from '@/components/CustomTooltip'; +import GraphSwiper from '@/components/Home/GraphSwiper'; +import { LeaderboardIcon } from '@/components/Icons/LeaderboardIcon'; +import PageWrapper from '@/components/PageWrapper'; +import SearchBar from '@/components/SearchBar/SearchBar'; +import ShadowIcon from '@/components/ShadowIcon'; +import HMTPrice from '@/pages/Home/HMTPrice'; +import Holders from '@/pages/Home/Holders'; +import TotalNumberOfTasks from '@/pages/Home/TotalNumberOfTasks'; +import TotalTransactions from '@/pages/Home/TotalTransactions'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; +import { Leaderboard } from './Leaderboard'; const CardWrapper = styled(Grid)(({ theme }) => ({ display: 'flex', diff --git a/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx b/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx index 532e9788ff..8666c6bbdd 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx @@ -1,4 +1,5 @@ -import { useLeaderboardDetails } from '@services/api/use-leaderboard-details'; +import { useLeaderboardDetails } from '@/services/api/use-leaderboard-details'; + import { Leaderboard as LeaderboardFeature } from '../../features/Leaderboard'; export const Leaderboard = () => { diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx b/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx index 3e4c90922e..83783a3a35 100644 --- a/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx @@ -1,8 +1,8 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@components/Home/FormatNumber'; -import { useHcaptchaGeneralStats } from '@services/api/use-hcaptcha-general-stats'; +import { FormatNumber } from '@/components/Home/FormatNumber'; +import { useHcaptchaGeneralStats } from '@/services/api/use-hcaptcha-general-stats'; const TotalNumberOfTasks = () => { const { data, isError, isPending, isSuccess } = useHcaptchaGeneralStats(); diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx b/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx index 6c4ada399a..3e2959c3ed 100644 --- a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx @@ -1,8 +1,8 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@components/Home/FormatNumber'; -import { useGeneralStats } from '@services/api/use-general-stats'; +import { FormatNumber } from '@/components/Home/FormatNumber'; +import { useGeneralStats } from '@/services/api/use-general-stats'; const TotalTransactions = () => { const { data, isError, isPending, isSuccess } = useGeneralStats(); diff --git a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx index 60f93d1732..b32decf434 100644 --- a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx +++ b/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx @@ -1,9 +1,10 @@ -import Breadcrumbs from '@components/Breadcrumbs'; -import PageWrapper from '@components/PageWrapper'; -import ShadowIcon from '@components/ShadowIcon'; +import Breadcrumbs from '@/components/Breadcrumbs'; +import { LeaderboardIcon } from '@/components/Icons/LeaderboardIcon'; +import PageWrapper from '@/components/PageWrapper'; +import ShadowIcon from '@/components/ShadowIcon'; +import { useLeaderboardDetails } from '@/services/api/use-leaderboard-details'; + import { Leaderboard } from '../../features/Leaderboard/index'; -import { useLeaderboardDetails } from '@services/api/use-leaderboard-details'; -import { LeaderboardIcon } from '@components/Icons/LeaderboardIcon'; const LeaderBoard = () => { const { data, status, error } = useLeaderboardDetails(); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx index f258eeb751..922a2c92a5 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx @@ -2,11 +2,12 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import TitleSectionWrapper from '@components/SearchResults'; -import SectionWrapper from '@components/SectionWrapper'; +import TitleSectionWrapper from '@/components/SearchResults'; +import SectionWrapper from '@/components/SectionWrapper'; +import { AddressDetailsEscrowSchema } from '@/services/api/use-address-details'; + import HmtBalance from '../HmtBalance'; -import { AddressDetailsEscrowSchema } from '@services/api/use-address-details'; const EscrowAddress = ({ data: { diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx index b942cac755..00c25526e7 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx @@ -4,8 +4,8 @@ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { NumericFormat } from 'react-number-format'; -import { useHMTPrice } from '@services/api/use-hmt-price'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; +import { useHMTPrice } from '@/services/api/use-hmt-price'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; type Props = { balance?: number | null; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx index 71c97576a8..f32c458493 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/HmtPrice/index.tsx @@ -1,6 +1,6 @@ import { Typography, Stack } from '@mui/material'; -import { useHMTPrice } from '@services/api/use-hmt-price'; +import { useHMTPrice } from '@/services/api/use-hmt-price'; const HmtPrice = () => { const { data, isError, isPending, isSuccess } = useHMTPrice(); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx index 3078b19642..bb16776c85 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx @@ -1,14 +1,14 @@ -import Typography from '@mui/material/Typography'; -import TableBody from '@mui/material/TableBody'; -import TableContainer from '@mui/material/TableContainer'; import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; -import SectionWrapper from '@components/SectionWrapper'; -import useKvstoreData from '@services/api/use-kvstore-data'; +import SectionWrapper from '@/components/SectionWrapper'; +import useKvstoreData from '@/services/api/use-kvstore-data'; const KVStore = () => { const { data } = useKvstoreData(); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx index 7241d36ba9..5761903f3f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx @@ -1,9 +1,10 @@ import { FC } from 'react'; -import { Reputation } from '@services/api/use-leaderboard-details'; -import { colorPalette } from '@assets/styles/color-palette'; import { Box, Typography } from '@mui/material'; +import { colorPalette } from '@/assets/styles/color-palette'; +import { Reputation } from '@/services/api/use-leaderboard-details'; + type Props = { reputation: Reputation; }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx index e1215c99c4..3dc0530a4a 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx @@ -1,3 +1,4 @@ +import { Role } from '@human-protocol/sdk'; import Box from '@mui/material/Box'; import Chip from '@mui/material/Chip'; import Link from '@mui/material/Link'; @@ -5,25 +6,24 @@ import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { Role } from '@human-protocol/sdk'; -import SectionWrapper from '@components/SectionWrapper'; -import TitleSectionWrapper from '@components/SearchResults/TitleSectionWrapper'; -import { RoleDetailsEscrowsTable } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable'; +import ExchangeOracleIcon from '@/assets/icons/exchange-oracle.svg'; +import JobLauncherIcon from '@/assets/icons/job-launcher.svg'; +import RecordingOracleIcon from '@/assets/icons/recording-oracle.svg'; +import ReputationOracleIcon from '@/assets/icons/reputation-oracle.svg'; +import { colorPalette } from '@/assets/styles/color-palette'; +import TitleSectionWrapper from '@/components/SearchResults/TitleSectionWrapper'; +import SectionWrapper from '@/components/SectionWrapper'; +import { env } from '@/helpers/env'; +import { RoleDetailsEscrowsTable } from '@/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable'; +import { AddressDetailsOperator } from '@/services/api/use-address-details'; + +import HmtBalance from '../HmtBalance'; +import HmtPrice from '../HmtPrice'; import KVStore from '../KVStore'; import ReputationScore from '../ReputationScore'; import StakeInfo from '../StakeInfo'; -import HmtBalance from '../HmtBalance'; -import HmtPrice from '../HmtPrice'; - -import ReputationOracleIcon from '@assets/icons/reputation-oracle.svg'; -import ExchangeOracleIcon from '@assets/icons/exchange-oracle.svg'; -import JobLauncherIcon from '@assets/icons/job-launcher.svg'; -import RecordingOracleIcon from '@assets/icons/recording-oracle.svg'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; -import { env } from '@helpers/env'; -import { colorPalette } from '@assets/styles/color-palette'; interface RoleInfoProps { title: string; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx index babb913b9f..3364163f08 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx @@ -1,17 +1,17 @@ import { useEffect } from 'react'; import Stack from '@mui/material/Stack'; -import Typography from '@mui/material/Typography'; -import TableContainer from '@mui/material/TableContainer'; import Table from '@mui/material/Table'; -import TablePagination from '@mui/material/TablePagination'; +import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; +import TablePagination from '@mui/material/TablePagination'; import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; -import { EscrowsTableBody } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody'; -import SectionWrapper from '@components/SectionWrapper'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { useEscrowDetails } from '@services/api/use-escrows-details'; +import SectionWrapper from '@/components/SectionWrapper'; +import { EscrowsTableBody } from '@/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody'; +import { useEscrowDetails } from '@/services/api/use-escrows-details'; +import { useEscrowDetailsDto } from '@/utils/hooks/use-escrows-details-dto'; export const RoleDetailsEscrowsTable = ({ role }: { role: string | null }) => { const { data } = useEscrowDetails({ role }); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx index 153f8c0c76..2fb9f4a4f8 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx @@ -1,16 +1,19 @@ -import TableCell from '@mui/material/TableCell'; -import MuiTableBody from '@mui/material/TableBody'; import { useEffect } from 'react'; -import { handleErrorMessage } from '@services/handle-error-message'; -import CircularProgress from '@mui/material/CircularProgress'; -import { EscrowsTableBodyContainer } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer'; -import { useEscrowDetails } from '@services/api/use-escrows-details'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { useNavigate } from 'react-router-dom'; + import { Stack, TableRow } from '@mui/material'; +import CircularProgress from '@mui/material/CircularProgress'; import Link from '@mui/material/Link'; +import MuiTableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import { useNavigate } from 'react-router-dom'; + +import { EscrowsTableBodyContainer } from '@/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer'; +import { AddressDetailsOperator } from '@/services/api/use-address-details'; +import { useEscrowDetails } from '@/services/api/use-escrows-details'; +import { handleErrorMessage } from '@/services/handle-error-message'; +import { useEscrowDetailsDto } from '@/utils/hooks/use-escrows-details-dto'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; + export const EscrowsTableBody = ({ role, diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx index 764084e4cd..9b00b73d4f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx @@ -1,5 +1,5 @@ -import MuiTableBody from '@mui/material/TableBody'; import { Grid } from '@mui/material'; +import MuiTableBody from '@mui/material/TableBody'; export const EscrowsTableBodyContainer = ({ children, diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx index ab9d49fdf2..707cdf8870 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx @@ -1,26 +1,29 @@ -import PageWrapper from '@components/PageWrapper'; -import Stack from '@mui/material/Stack'; -import ShadowIcon from '@components/ShadowIcon'; -import Clipboard from '@components/Clipboard'; import { useEffect, useState } from 'react'; + +import Stack from '@mui/material/Stack'; +import { AxiosError } from 'axios'; import { useLocation, useParams } from 'react-router-dom'; -import EscrowAddress from '@pages/SearchResults/EscrowAddress'; -import WalletAddress from '@pages/SearchResults/WalletAddress'; -import NothingFound from '@components/NothingFound'; -import Breadcrumbs from '@components/Breadcrumbs'; -import SearchBar from '@components/SearchBar/SearchBar'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import Loader from '@components/Loader'; -import { getNetwork } from '@utils/config/networks'; + +import Breadcrumbs from '@/components/Breadcrumbs'; +import Clipboard from '@/components/Clipboard'; +import { EscrowAddressIcon } from '@/components/Icons/EscrowAddressIcon'; +import { WalletIcon } from '@/components/Icons/WalletIcon'; +import Loader from '@/components/Loader'; +import NothingFound from '@/components/NothingFound'; +import PageWrapper from '@/components/PageWrapper'; +import SearchBar from '@/components/SearchBar/SearchBar'; +import ShadowIcon from '@/components/ShadowIcon'; +import EscrowAddress from '@/pages/SearchResults/EscrowAddress'; +import RoleDetails from '@/pages/SearchResults/RoleDetails/RoleDetails'; +import WalletAddress from '@/pages/SearchResults/WalletAddress'; import { AddressDetails, useAddressDetails, -} from '@services/api/use-address-details'; -import { handleErrorMessage } from '@services/handle-error-message'; -import RoleDetails from '@pages/SearchResults/RoleDetails/RoleDetails'; -import { AxiosError } from 'axios'; -import { WalletIcon } from '@components/Icons/WalletIcon'; -import { EscrowAddressIcon } from '@components/Icons/EscrowAddressIcon'; +} from '@/services/api/use-address-details'; +import { handleErrorMessage } from '@/services/handle-error-message'; +import { getNetwork } from '@/utils/config/networks'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; + import { WalletAddressTransactionsTable } from './WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable'; const renderCurrentResultType = ( diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx index 2d1d293b0b..23702ac62b 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx @@ -4,9 +4,8 @@ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { NumericFormat } from 'react-number-format'; -import SectionWrapper from '@components/SectionWrapper'; - -import { useIsMobile } from '@utils/hooks/use-breakpoints'; +import SectionWrapper from '@/components/SectionWrapper'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; type Props = { amountStaked?: number | null; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx index 89ac4b736a..7259ffea74 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx @@ -4,19 +4,20 @@ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { NumericFormat } from 'react-number-format'; -import TitleSectionWrapper from '@components/SearchResults'; -import SectionWrapper from '@components/SectionWrapper'; +import TitleSectionWrapper from '@/components/SearchResults'; +import SectionWrapper from '@/components/SectionWrapper'; +import { + AddressDetailsOperator, + AddressDetailsWallet, +} from '@/services/api/use-address-details'; +import { useIsMobile } from '@/utils/hooks/use-breakpoints'; + import HmtBalance from '../HmtBalance'; import HmtPrice from '../HmtPrice'; import KVStore from '../KVStore'; import ReputationScore from '../ReputationScore'; import StakeInfo from '../StakeInfo'; -import { - AddressDetailsOperator, - AddressDetailsWallet, -} from '@services/api/use-address-details'; -import { useIsMobile } from '@utils/hooks/use-breakpoints'; type Props = { data: AddressDetailsWallet | AddressDetailsOperator; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx index 10b3927722..5a88d704c6 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx @@ -1,19 +1,18 @@ import { useEffect } from 'react'; -import SimpleBar from 'simplebar-react'; import Table from '@mui/material/Table'; import TableContainer from '@mui/material/TableContainer'; import TableFooter from '@mui/material/TableFooter'; import TablePagination from '@mui/material/TablePagination'; import TableRow from '@mui/material/TableRow'; import Typography from '@mui/material/Typography'; +import SimpleBar from 'simplebar-react'; -import { TransactionsTableHead } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead'; -import { TransactionsTableBody } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody'; -import SectionWrapper from '@components/SectionWrapper'; - -import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; -import { useTransactionDetails } from '@services/api/use-transaction-details'; +import SectionWrapper from '@/components/SectionWrapper'; +import { TransactionsTableBody } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody'; +import { TransactionsTableHead } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead'; +import { useTransactionDetails } from '@/services/api/use-transaction-details'; +import { useTransactionDetailsDto } from '@/utils/hooks/use-transactions-details-dto'; export const WalletAddressTransactionsTable = () => { const { data } = useTransactionDetails(); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx index 61b1a638b9..fa4c0fb96f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx @@ -1,7 +1,7 @@ import Box from '@mui/material/Box/Box'; import Typography from '@mui/material/Typography'; -import { colorPalette } from '@assets/styles/color-palette'; +import { colorPalette } from '@/assets/styles/color-palette'; const methodAttributes: Record< string, diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx index e1f229a167..ba4573a6bb 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx @@ -1,6 +1,7 @@ -import { formatHMTDecimals } from '@helpers/formatHMTDecimals'; import Typography from '@mui/material/Typography'; -import { useHMTPrice } from '@services/api/use-hmt-price'; + +import { formatHMTDecimals } from '@/helpers/formatHMTDecimals'; +import { useHMTPrice } from '@/services/api/use-hmt-price'; export const TransactionTableCellValue = ({ value }: { value: string }) => { const { isError, isPending } = useHMTPrice(); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx index d5b7f153af..d18d563748 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx @@ -1,23 +1,24 @@ import React, { useEffect, useState } from 'react'; -import TableRow from '@mui/material/TableRow'; -import TableCell from '@mui/material/TableCell'; -import MuiTableBody from '@mui/material/TableBody'; -import Box from '@mui/material/Box'; -import IconButton from '@mui/material/IconButton'; -import CircularProgress from '@mui/material/CircularProgress'; + import AddCircleIcon from '@mui/icons-material/AddCircle'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import RemoveCircleIcon from '@mui/icons-material/RemoveCircle'; -import AbbreviateClipboard from '@components/SearchResults/AbbreviateClipboard'; -import { colorPalette } from '@assets/styles/color-palette'; +import Box from '@mui/material/Box'; +import CircularProgress from '@mui/material/CircularProgress'; +import IconButton from '@mui/material/IconButton'; +import MuiTableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableRow from '@mui/material/TableRow'; -import { TransactionTableCellMethod } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod'; -import { TransactionTableCellValue } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue'; -import { useTransactionDetails } from '@services/api/use-transaction-details'; -import { TransactionsTableBodyContainer } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer'; -import { handleErrorMessage } from '@services/handle-error-message'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; +import { colorPalette } from '@/assets/styles/color-palette'; +import AbbreviateClipboard from '@/components/SearchResults/AbbreviateClipboard'; +import { TransactionTableCellMethod } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod'; +import { TransactionTableCellValue } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue'; +import { TransactionsTableBodyContainer } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer'; +import { useTransactionDetails } from '@/services/api/use-transaction-details'; +import { handleErrorMessage } from '@/services/handle-error-message'; +import { useTransactionDetailsDto } from '@/utils/hooks/use-transactions-details-dto'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; export const TransactionsTableBody: React.FC = () => { const { data, isPending, isError, error } = useTransactionDetails(); diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx index 04d9275011..ea5a84943b 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx @@ -1,5 +1,5 @@ -import MuiTableBody from '@mui/material/TableBody'; import { Grid } from '@mui/material'; +import MuiTableBody from '@mui/material/TableBody'; export const TransactionsTableBodyContainer = ({ children, diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx index 1e7c35be6d..a79db1170f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx @@ -1,11 +1,11 @@ -import Typography from '@mui/material/Typography'; +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; import Stack from '@mui/material/Stack'; +import TableCell from '@mui/material/TableCell'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; -import TableCell from '@mui/material/TableCell'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import Typography from '@mui/material/Typography'; -import CustomTooltip from '@components/CustomTooltip'; +import CustomTooltip from '@/components/CustomTooltip'; const InfoTooltip = ({ title }: { title: string }) => ( diff --git a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx b/packages/apps/dashboard/client/src/services/api/use-address-details.tsx index 51a4487c6e..b708093de2 100644 --- a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-address-details.tsx @@ -1,11 +1,14 @@ +import { Role } from '@human-protocol/sdk'; import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { reputationSchema } from '@/services/api/use-leaderboard-details'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; + import { apiPaths } from '../api-paths'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; +import { httpService } from '../http-service'; import { validateResponse } from '../validate-response'; -import { reputationSchema } from '@services/api/use-leaderboard-details'; -import { Role } from '@human-protocol/sdk'; + const transformOptionalTokenAmount = ( value: string | undefined | null, diff --git a/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx b/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx index f724d3cea8..8a0ac01e07 100644 --- a/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx @@ -1,11 +1,13 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { AddressDetailsOperator } from '@/services/api/use-address-details'; +import { validateResponse } from '@/services/validate-response'; +import { useEscrowDetailsDto } from '@/utils/hooks/use-escrows-details-dto'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; + import { apiPaths } from '../api-paths'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { validateResponse } from '@services/validate-response'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; +import { httpService } from '../http-service'; const escrowDetailsSuccessResponseSchema = z.object({ chainId: z.number(), diff --git a/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx b/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx index 244e21cde8..e087a7a97e 100644 --- a/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx @@ -1,8 +1,10 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { validateResponse } from '@/services/validate-response'; + import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; +import { httpService } from '../http-service'; const successGeneralStatsResponseSchema = z.object({ totalHolders: z.number(), diff --git a/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx b/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx index b08cd17b31..63032aaf65 100644 --- a/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx @@ -1,12 +1,15 @@ +import { useMemo } from 'react'; + import { useQuery, keepPreviousData } from '@tanstack/react-query'; +import dayjs from 'dayjs'; +import { useDebounce } from 'use-debounce'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { validateResponse } from '@/services/validate-response'; +import { useGraphPageChartParams } from '@/utils/hooks/use-graph-page-chart-params'; + import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; -import { useGraphPageChartParams } from '@utils/hooks/use-graph-page-chart-params'; -import { useDebounce } from 'use-debounce'; -import { useMemo } from 'react'; -import dayjs from 'dayjs'; +import { httpService } from '../http-service'; const hmtDailyStatSchemaResponseSchema = z.object({ from: z.string().optional(), diff --git a/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx b/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx index 64d9e27aeb..e6256c24fe 100644 --- a/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx @@ -1,8 +1,10 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { validateResponse } from '@/services/validate-response'; + import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; +import { httpService } from '../http-service'; const successHcaptchaGeneralStatsResponseSchema = z.object({ solved: z.number(), diff --git a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx b/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx index 4a1ae8629b..c3427cdeeb 100644 --- a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx @@ -1,8 +1,10 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { validateResponse } from '@/services/validate-response'; + import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; +import { httpService } from '../http-service'; const successHMTPriceResponseSchema = z.object({ hmtPrice: z.number(), diff --git a/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx b/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx index 55ef3228a4..bbc26e77f0 100644 --- a/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx @@ -1,10 +1,10 @@ import { useQuery } from '@tanstack/react-query'; - -import { apiPaths } from '@services/api-paths'; -import { httpService } from '@services/http-service'; -import { validateResponse } from '@services/validate-response'; import { z } from 'zod'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; + +import { apiPaths } from '@/services/api-paths'; +import { httpService } from '@/services/http-service'; +import { validateResponse } from '@/services/validate-response'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; const kvstoreDataSchema = z.array( z.object({ diff --git a/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx b/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx index 39390eea7c..37919661ba 100644 --- a/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx @@ -1,9 +1,11 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { validateResponse } from '@/services/validate-response'; +import { useLeaderboardSearch } from '@/utils/hooks/use-leaderboard-search'; + import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; -import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; +import { httpService } from '../http-service'; export const reputationSchema = z.unknown().transform((value) => { try { @@ -13,6 +15,7 @@ export const reputationSchema = z.unknown().transform((value) => { return knownReputation; } catch (error) { + console.error(error); return 'Unknown'; } }); diff --git a/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx b/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx index a5d06bb1fd..b4f2fe453c 100644 --- a/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx @@ -1,10 +1,12 @@ import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { httpService } from '../http-service'; + +import { validateResponse } from '@/services/validate-response'; +import { useTransactionDetailsDto } from '@/utils/hooks/use-transactions-details-dto'; +import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; + import { apiPaths } from '../api-paths'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; -import { validateResponse } from '@services/validate-response'; +import { httpService } from '../http-service'; const internalTransactionSchema = z.object({ from: z.string(), diff --git a/packages/apps/dashboard/client/src/services/global.type.ts b/packages/apps/dashboard/client/src/services/global.type.ts index 0555a1e485..8046969074 100644 --- a/packages/apps/dashboard/client/src/services/global.type.ts +++ b/packages/apps/dashboard/client/src/services/global.type.ts @@ -1,5 +1,5 @@ -import type { ZodError } from 'zod'; import type { AxiosError } from 'axios'; +import type { ZodError } from 'zod'; export type ResponseError = AxiosError | Error | ZodError | null; diff --git a/packages/apps/dashboard/client/src/services/http-service.ts b/packages/apps/dashboard/client/src/services/http-service.ts index 3795426495..92fbd08e36 100644 --- a/packages/apps/dashboard/client/src/services/http-service.ts +++ b/packages/apps/dashboard/client/src/services/http-service.ts @@ -1,4 +1,5 @@ import axios from 'axios'; + import { env } from '../helpers/env'; export const httpService = axios.create({ diff --git a/packages/apps/dashboard/client/src/services/validate-response.ts b/packages/apps/dashboard/client/src/services/validate-response.ts index a1c2b642a3..d91f29b073 100644 --- a/packages/apps/dashboard/client/src/services/validate-response.ts +++ b/packages/apps/dashboard/client/src/services/validate-response.ts @@ -12,7 +12,7 @@ export const validateResponse = ( console.error('Unexpected response'); if (error instanceof ZodError) { error.issues.forEach((issue) => { - console.log(issue); + console.error(issue); }); } console.error(error); diff --git a/packages/apps/dashboard/client/src/theme.tsx b/packages/apps/dashboard/client/src/theme.tsx index d961419f4a..33447e4e9c 100644 --- a/packages/apps/dashboard/client/src/theme.tsx +++ b/packages/apps/dashboard/client/src/theme.tsx @@ -1,11 +1,14 @@ +import { CSSProperties } from 'react'; + +import { Shadows, ThemeOptions } from '@mui/material'; import { createTheme } from '@mui/material/styles'; import { PaletteColorOptions, PaletteColor, } from '@mui/material/styles/createPalette'; -import { Shadows, ThemeOptions } from '@mui/material'; -import { colorPalette } from '@assets/styles/color-palette'; -import { CSSProperties } from 'react'; + +import { colorPalette } from '@/assets/styles/color-palette'; + declare module '@mui/material/Typography' { interface TypographyPropsVariantOverrides { @@ -311,7 +314,7 @@ const theme: ThemeOptions = createTheme({ whiteSpace: 'nowrap', color: colorPalette.fog.main, justifySelf: 'end', - marginBottom: `17px`, + marginBottom: '17px', position: 'relative', right: '-38px', }, diff --git a/packages/apps/dashboard/client/src/utils/config/networks.ts b/packages/apps/dashboard/client/src/utils/config/networks.ts index bb1839642d..05d80ebb58 100644 --- a/packages/apps/dashboard/client/src/utils/config/networks.ts +++ b/packages/apps/dashboard/client/src/utils/config/networks.ts @@ -1,6 +1,7 @@ import type { Chain } from 'viem/chains'; import * as chains from 'viem/chains'; -import { env } from '@helpers/env'; + +import { env } from '@/helpers/env'; //TODO: temporal fix. Should be fetched from API. https://github.com/humanprotocol/human-protocol/issues/2855 const ENABLED_CHAIN_IDS = env.VITE_ENABLED_CHAIN_IDS; diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts b/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts index 752b65b58b..3cc624434e 100644 --- a/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts +++ b/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts @@ -1,9 +1,11 @@ +import { useMemo } from 'react'; + 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'; -import { useMemo } from 'react'; + +import { apiPaths } from '@/services/api-paths'; +import { httpService } from '@/services/http-service'; +import { networks as allNetworks } from '@/utils/config/networks'; const enabledChainsSchema = z.array(z.number()); diff --git a/packages/apps/dashboard/client/tsconfig.json b/packages/apps/dashboard/client/tsconfig.json index f6331c83d6..e3e56d6ef4 100644 --- a/packages/apps/dashboard/client/tsconfig.json +++ b/packages/apps/dashboard/client/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "ES2020", + "target": "ES2022", "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": ["ES2022", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, @@ -21,15 +21,12 @@ "noFallthroughCasesInSwitch": true, "baseUrl": "./", "paths": { - "@components/*": ["src/components/*"], - "@helpers/*": ["src/helpers/*"], - "@assets/*": ["src/assets/*"], - "@pages/*": ["src/pages/*"], - "@api/*": ["src/api/*"], - "@utils/*": ["src/utils/*"], - "@services/*": ["src/services/*"] + "@/*": ["src/*"] } }, - "include": ["src"], - "exclude": ["./vite.config.ts"] + "include": [ + "src", + "vite.config.ts" + ], + "exclude": ["node_modules"] } diff --git a/packages/apps/dashboard/client/vite.config.ts b/packages/apps/dashboard/client/vite.config.ts index 9f7cc79504..7ff2b356c4 100644 --- a/packages/apps/dashboard/client/vite.config.ts +++ b/packages/apps/dashboard/client/vite.config.ts @@ -1,8 +1,9 @@ -import { defineConfig } from 'vite'; -import react from '@vitejs/plugin-react'; import * as path from 'path'; -import svgr from 'vite-plugin-svgr'; + +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; +import svgr from 'vite-plugin-svgr'; // https://vitejs.dev/config/ export default defineConfig({ @@ -18,13 +19,7 @@ export default defineConfig({ ], resolve: { alias: { - '@components': path.resolve(__dirname, './src/components'), - '@helpers': path.resolve(__dirname, './src/helpers'), - '@assets': path.resolve(__dirname, './src/assets'), - '@pages': path.resolve(__dirname, './src/pages'), - '@api': path.resolve(__dirname, './src/api'), - '@utils': path.resolve(__dirname, './src/utils'), - '@services': path.resolve(__dirname, './src/services'), + '@': path.resolve(__dirname, './src'), }, }, optimizeDeps: { diff --git a/yarn.lock b/yarn.lock index cdce5887c4..e092f6ed77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2698,13 +2698,40 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.10.0, @eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.5.1, @eslint-community/regexpp@npm:^4.6.1": +"@eslint-community/regexpp@npm:^4.10.0, @eslint-community/regexpp@npm:^4.12.1, @eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.5.1, @eslint-community/regexpp@npm:^4.6.1": version: 4.12.1 resolution: "@eslint-community/regexpp@npm:4.12.1" checksum: 10c0/a03d98c246bcb9109aec2c08e4d10c8d010256538dcb3f56610191607214523d4fb1b00aa81df830b6dffb74c5fa0be03642513a289c567949d3e550ca11cdf6 languageName: node linkType: hard +"@eslint/config-array@npm:^0.20.0": + version: 0.20.0 + resolution: "@eslint/config-array@npm:0.20.0" + dependencies: + "@eslint/object-schema": "npm:^2.1.6" + debug: "npm:^4.3.1" + minimatch: "npm:^3.1.2" + checksum: 10c0/94bc5d0abb96dc5295ff559925242ff75a54eacfb3576677e95917e42f7175e1c4b87bf039aa2a872f949b4852ad9724bf2f7529aaea6b98f28bb3fca7f1d659 + languageName: node + linkType: hard + +"@eslint/config-helpers@npm:^0.2.1": + version: 0.2.2 + resolution: "@eslint/config-helpers@npm:0.2.2" + checksum: 10c0/98f7cefe484bb754674585d9e73cf1414a3ab4fd0783c385465288d13eb1a8d8e7d7b0611259fc52b76b396c11a13517be5036d1f48eeb877f6f0a6b9c4f03ad + languageName: node + linkType: hard + +"@eslint/core@npm:^0.14.0": + version: 0.14.0 + resolution: "@eslint/core@npm:0.14.0" + dependencies: + "@types/json-schema": "npm:^7.0.15" + checksum: 10c0/259f279445834ba2d2cbcc18e9d43202a4011fde22f29d5fb802181d66e0f6f0bd1f6b4b4b46663451f545d35134498231bd5e656e18d9034a457824b92b7741 + languageName: node + linkType: hard + "@eslint/eslintrc@npm:^2.1.4": version: 2.1.4 resolution: "@eslint/eslintrc@npm:2.1.4" @@ -2722,6 +2749,23 @@ __metadata: languageName: node linkType: hard +"@eslint/eslintrc@npm:^3.3.1": + version: 3.3.1 + resolution: "@eslint/eslintrc@npm:3.3.1" + dependencies: + ajv: "npm:^6.12.4" + debug: "npm:^4.3.2" + espree: "npm:^10.0.1" + globals: "npm:^14.0.0" + ignore: "npm:^5.2.0" + import-fresh: "npm:^3.2.1" + js-yaml: "npm:^4.1.0" + minimatch: "npm:^3.1.2" + strip-json-comments: "npm:^3.1.1" + checksum: 10c0/b0e63f3bc5cce4555f791a4e487bf999173fcf27c65e1ab6e7d63634d8a43b33c3693e79f192cbff486d7df1be8ebb2bd2edc6e70ddd486cbfa84a359a3e3b41 + languageName: node + linkType: hard + "@eslint/js@npm:8.57.1": version: 8.57.1 resolution: "@eslint/js@npm:8.57.1" @@ -2729,6 +2773,30 @@ __metadata: languageName: node linkType: hard +"@eslint/js@npm:9.28.0, @eslint/js@npm:^9.27.0": + version: 9.28.0 + resolution: "@eslint/js@npm:9.28.0" + checksum: 10c0/5a6759542490dd9f778993edfbc8d2f55168fd0f7336ceed20fe3870c65499d72fc0bca8d1ae00ea246b0923ea4cba2e0758a8a5507a3506ddcf41c92282abb8 + languageName: node + linkType: hard + +"@eslint/object-schema@npm:^2.1.6": + version: 2.1.6 + resolution: "@eslint/object-schema@npm:2.1.6" + checksum: 10c0/b8cdb7edea5bc5f6a96173f8d768d3554a628327af536da2fc6967a93b040f2557114d98dbcdbf389d5a7b290985ad6a9ce5babc547f36fc1fde42e674d11a56 + languageName: node + linkType: hard + +"@eslint/plugin-kit@npm:^0.3.1": + version: 0.3.1 + resolution: "@eslint/plugin-kit@npm:0.3.1" + dependencies: + "@eslint/core": "npm:^0.14.0" + levn: "npm:^0.4.1" + checksum: 10c0/a75f0b5d38430318a551b83e27bee570747eb50beeb76b03f64b0e78c2c27ef3d284cfda3443134df028db3251719bc0850c105f778122f6ad762d5270ec8063 + languageName: node + linkType: hard + "@ethereumjs/common@npm:^3.2.0": version: 3.2.0 resolution: "@ethereumjs/common@npm:3.2.0" @@ -3832,6 +3900,7 @@ __metadata: dependencies: "@emotion/react": "npm:^11.11.4" "@emotion/styled": "npm:^11.11.5" + "@eslint/js": "npm:^9.27.0" "@human-protocol/sdk": "workspace:*" "@mui/icons-material": "npm:^7.0.1" "@mui/material": "npm:^5.15.18" @@ -3850,9 +3919,13 @@ __metadata: axios: "npm:^1.7.2" clsx: "npm:^2.1.1" dayjs: "npm:^1.11.11" - eslint: "npm:^8.57.0" - eslint-plugin-react-hooks: "npm:^5.1.0" + eslint: "npm:^9.27.0" + eslint-plugin-import: "npm:^2.31.0" + eslint-plugin-prettier: "npm:^5.4.0" + eslint-plugin-react: "npm:^7.37.5" + eslint-plugin-react-hooks: "npm:^5.2.0" eslint-plugin-react-refresh: "npm:^0.4.11" + globals: "npm:^16.2.0" prettier: "npm:^3.4.2" react: "npm:^18.2.0" react-dom: "npm:^18.2.0" @@ -3864,6 +3937,7 @@ __metadata: styled-components: "npm:^6.1.11" swiper: "npm:^11.1.3" typescript: "npm:^5.6.3" + typescript-eslint: "npm:^8.33.0" use-debounce: "npm:^10.0.2" vite: "npm:^6.2.4" vite-plugin-node-polyfills: "npm:^0.23.0" @@ -4506,6 +4580,23 @@ __metadata: languageName: unknown linkType: soft +"@humanfs/core@npm:^0.19.1": + version: 0.19.1 + resolution: "@humanfs/core@npm:0.19.1" + checksum: 10c0/aa4e0152171c07879b458d0e8a704b8c3a89a8c0541726c6b65b81e84fd8b7564b5d6c633feadc6598307d34564bd53294b533491424e8e313d7ab6c7bc5dc67 + languageName: node + linkType: hard + +"@humanfs/node@npm:^0.16.6": + version: 0.16.6 + resolution: "@humanfs/node@npm:0.16.6" + dependencies: + "@humanfs/core": "npm:^0.19.1" + "@humanwhocodes/retry": "npm:^0.3.0" + checksum: 10c0/8356359c9f60108ec204cbd249ecd0356667359b2524886b357617c4a7c3b6aace0fd5a369f63747b926a762a88f8a25bc066fa1778508d110195ce7686243e1 + languageName: node + linkType: hard + "@humanwhocodes/config-array@npm:^0.13.0": version: 0.13.0 resolution: "@humanwhocodes/config-array@npm:0.13.0" @@ -4531,6 +4622,20 @@ __metadata: languageName: node linkType: hard +"@humanwhocodes/retry@npm:^0.3.0": + version: 0.3.1 + resolution: "@humanwhocodes/retry@npm:0.3.1" + checksum: 10c0/f0da1282dfb45e8120480b9e2e275e2ac9bbe1cf016d046fdad8e27cc1285c45bb9e711681237944445157b430093412b4446c1ab3fc4bb037861b5904101d3b + languageName: node + linkType: hard + +"@humanwhocodes/retry@npm:^0.4.2": + version: 0.4.3 + resolution: "@humanwhocodes/retry@npm:0.4.3" + checksum: 10c0/3775bb30087d4440b3f7406d5a057777d90e4b9f435af488a4923ef249e93615fb78565a85f173a186a076c7706a81d0d57d563a2624e4de2c5c9c66c486ce42 + languageName: node + linkType: hard + "@inquirer/checkbox@npm:^4.1.5": version: 4.1.5 resolution: "@inquirer/checkbox@npm:4.1.5" @@ -7204,6 +7309,13 @@ __metadata: languageName: node linkType: hard +"@pkgr/core@npm:^0.2.4": + version: 0.2.7 + resolution: "@pkgr/core@npm:0.2.7" + checksum: 10c0/951f5ebf2feb6e9dbc202d937f1a364d60f2bf0e3e53594251bcc1d9d2ed0df0a919c49ba162a9499fce73cf46ebe4d7959a8dfbac03511dbe79b69f5fedb804 + languageName: node + linkType: hard + "@pnpm/config.env-replace@npm:^1.1.0": version: 1.1.0 resolution: "@pnpm/config.env-replace@npm:1.1.0" @@ -9717,7 +9829,7 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": +"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.15, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" checksum: 10c0/a996a745e6c5d60292f36731dd41341339d4eeed8180bb09226e5c8d23759067692b1d88e5d91d72ee83dfc00d3aca8e7bd43ea120516c17922cbcb7c3e252db @@ -10235,6 +10347,27 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/eslint-plugin@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.33.0" + dependencies: + "@eslint-community/regexpp": "npm:^4.10.0" + "@typescript-eslint/scope-manager": "npm:8.33.0" + "@typescript-eslint/type-utils": "npm:8.33.0" + "@typescript-eslint/utils": "npm:8.33.0" + "@typescript-eslint/visitor-keys": "npm:8.33.0" + graphemer: "npm:^1.4.0" + ignore: "npm:^7.0.0" + natural-compare: "npm:^1.4.0" + ts-api-utils: "npm:^2.1.0" + peerDependencies: + "@typescript-eslint/parser": ^8.33.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/fdfbba2134bb8aa8effb3686a9ffe0a5d9916b41ccdf4339976e0205734f802fca2631939f892ccedd20eee104d8cd0e691720728baeeee17c0f40d7bfe4205d + languageName: node + linkType: hard + "@typescript-eslint/eslint-plugin@npm:^5.0.0, @typescript-eslint/eslint-plugin@npm:^5.5.0": version: 5.62.0 resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" @@ -10318,6 +10451,22 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/parser@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/parser@npm:8.33.0" + dependencies: + "@typescript-eslint/scope-manager": "npm:8.33.0" + "@typescript-eslint/types": "npm:8.33.0" + "@typescript-eslint/typescript-estree": "npm:8.33.0" + "@typescript-eslint/visitor-keys": "npm:8.33.0" + debug: "npm:^4.3.4" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/3f6aa8476d912a749a4f3e6ae6cbf90a881f1892efb7b3c88f6654fa03e770d8da511d0298615b0eda880b3811e157ed60e47e6a21aa309cbf912e2d5d79d73c + languageName: node + linkType: hard + "@typescript-eslint/parser@npm:^5.0.0, @typescript-eslint/parser@npm:^5.5.0": version: 5.62.0 resolution: "@typescript-eslint/parser@npm:5.62.0" @@ -10371,6 +10520,17 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/project-service@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/project-service@npm:8.33.0" + dependencies: + "@typescript-eslint/tsconfig-utils": "npm:^8.33.0" + "@typescript-eslint/types": "npm:^8.33.0" + debug: "npm:^4.3.4" + checksum: 10c0/a863d9e3be5ffb53c9d57b25b7a35149dae01afd942dd7fc36bd72a4230676ae12d0f37a789cddaf1baf71e3b35f09436bebbd081336e667b4181b48d0afe8f5 + languageName: node + linkType: hard + "@typescript-eslint/scope-manager@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/scope-manager@npm:5.62.0" @@ -10411,6 +10571,25 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/scope-manager@npm:8.33.0" + dependencies: + "@typescript-eslint/types": "npm:8.33.0" + "@typescript-eslint/visitor-keys": "npm:8.33.0" + checksum: 10c0/eb259add242ce40642e7272b414c92ae9407d97cb304981f17f0de0846d5c4ab47d41816ef13da3d3976fe0b7a74df291525be27e4fe4f0ab5d35e86d340faa0 + languageName: node + linkType: hard + +"@typescript-eslint/tsconfig-utils@npm:8.33.0, @typescript-eslint/tsconfig-utils@npm:^8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/tsconfig-utils@npm:8.33.0" + peerDependencies: + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/6e9a8e73e65b925f908f31e00be4f1b8d7e89f45d97fa703f468115943c297fc2cc6f9daa0c12b9607f39186f033ac244515f11710df7e1df8302c815ed57389 + languageName: node + linkType: hard + "@typescript-eslint/type-utils@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/type-utils@npm:5.62.0" @@ -10462,6 +10641,21 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/type-utils@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/type-utils@npm:8.33.0" + dependencies: + "@typescript-eslint/typescript-estree": "npm:8.33.0" + "@typescript-eslint/utils": "npm:8.33.0" + debug: "npm:^4.3.4" + ts-api-utils: "npm:^2.1.0" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/4a81c654ba17e8a50e48249f781cb91cddb990044affda7315d9b259aabd638232c9a98ff5f4d45ea3b258098060864026b746fce93ad6b4dcde5e492d93c855 + languageName: node + linkType: hard + "@typescript-eslint/types@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/types@npm:5.62.0" @@ -10490,6 +10684,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:8.33.0, @typescript-eslint/types@npm:^8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/types@npm:8.33.0" + checksum: 10c0/348b64eb408719d7711a433fc9716e0c2aab8b3f3676f5a1cc2e00269044132282cf655deb6d0dd9817544116909513de3b709005352d186949d1014fad1a3cb + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" @@ -10564,6 +10765,26 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/typescript-estree@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.33.0" + dependencies: + "@typescript-eslint/project-service": "npm:8.33.0" + "@typescript-eslint/tsconfig-utils": "npm:8.33.0" + "@typescript-eslint/types": "npm:8.33.0" + "@typescript-eslint/visitor-keys": "npm:8.33.0" + debug: "npm:^4.3.4" + fast-glob: "npm:^3.3.2" + is-glob: "npm:^4.0.3" + minimatch: "npm:^9.0.4" + semver: "npm:^7.6.0" + ts-api-utils: "npm:^2.1.0" + peerDependencies: + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/677b12b2e5780ffaef508bddbf8712fe2c3413f3d14fd8fd0cfbe22952a81c6642b3cc26984cf27fdfc3dd2457ae5f8aa04437d3b0ae32987a1895f9648ca7b2 + languageName: node + linkType: hard + "@typescript-eslint/utils@npm:5.62.0, @typescript-eslint/utils@npm:^5.10.0, @typescript-eslint/utils@npm:^5.58.0, @typescript-eslint/utils@npm:^5.62.0": version: 5.62.0 resolution: "@typescript-eslint/utils@npm:5.62.0" @@ -10613,6 +10834,21 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/utils@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/utils@npm:8.33.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.7.0" + "@typescript-eslint/scope-manager": "npm:8.33.0" + "@typescript-eslint/types": "npm:8.33.0" + "@typescript-eslint/typescript-estree": "npm:8.33.0" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/a0adb9e13d8f8d8f86ae2e905f3305ad60732e760364b291de66a857a551485d37c23e923299078a47f75d3cca643e1f2aefa010a0beb4cb0d08d0507c1038e1 + languageName: node + linkType: hard + "@typescript-eslint/utils@npm:^8.18.1": version: 8.32.0 resolution: "@typescript-eslint/utils@npm:8.32.0" @@ -10668,6 +10904,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:8.33.0": + version: 8.33.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.33.0" + dependencies: + "@typescript-eslint/types": "npm:8.33.0" + eslint-visitor-keys: "npm:^4.2.0" + checksum: 10c0/41660f241e78314f69d251792f369ef1eeeab3b40fe4ab11b794d402c95bcb82b61d3e91763e7ab9b0f22011a7ac9c8f9dfd91734d61c9f4eaf4f7660555b53b + languageName: node + linkType: hard + "@ungap/structured-clone@npm:^1.2.0": version: 1.3.0 resolution: "@ungap/structured-clone@npm:1.3.0" @@ -15972,7 +16218,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-import@npm:^2.25.3, eslint-plugin-import@npm:^2.29.0, eslint-plugin-import@npm:^2.29.1": +"eslint-plugin-import@npm:^2.25.3, eslint-plugin-import@npm:^2.29.0, eslint-plugin-import@npm:^2.29.1, eslint-plugin-import@npm:^2.31.0": version: 2.31.0 resolution: "eslint-plugin-import@npm:2.31.0" dependencies: @@ -16096,6 +16342,26 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-prettier@npm:^5.4.0": + version: 5.4.1 + resolution: "eslint-plugin-prettier@npm:5.4.1" + dependencies: + prettier-linter-helpers: "npm:^1.0.0" + synckit: "npm:^0.11.7" + peerDependencies: + "@types/eslint": ">=8.0.0" + eslint: ">=8.0.0" + eslint-config-prettier: ">= 7.0.0 <10.0.0 || >=10.1.0" + prettier: ">=3.0.0" + peerDependenciesMeta: + "@types/eslint": + optional: true + eslint-config-prettier: + optional: true + checksum: 10c0/bdd9e9473bf3f995521558eb5e2ee70dd4f06cb8b9a6192523cfed76511924fad31ec9af9807cd99f693dc59085e0a1db8a1d3ccc283e98ab30eb32cc7469649 + languageName: node + linkType: hard + "eslint-plugin-react-hooks@npm:^4.3.0, eslint-plugin-react-hooks@npm:^4.6.0": version: 4.6.2 resolution: "eslint-plugin-react-hooks@npm:4.6.2" @@ -16105,7 +16371,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react-hooks@npm:^5.1.0": +"eslint-plugin-react-hooks@npm:^5.1.0, eslint-plugin-react-hooks@npm:^5.2.0": version: 5.2.0 resolution: "eslint-plugin-react-hooks@npm:5.2.0" peerDependencies: @@ -16123,7 +16389,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react@npm:^7.27.1, eslint-plugin-react@npm:^7.34.0, eslint-plugin-react@npm:^7.34.3": +"eslint-plugin-react@npm:^7.27.1, eslint-plugin-react@npm:^7.34.0, eslint-plugin-react@npm:^7.34.3, eslint-plugin-react@npm:^7.37.5": version: 7.37.5 resolution: "eslint-plugin-react@npm:7.37.5" dependencies: @@ -16246,6 +16512,16 @@ __metadata: languageName: node linkType: hard +"eslint-scope@npm:^8.3.0": + version: 8.3.0 + resolution: "eslint-scope@npm:8.3.0" + dependencies: + esrecurse: "npm:^4.3.0" + estraverse: "npm:^5.2.0" + checksum: 10c0/23bf54345573201fdf06d29efa345ab508b355492f6c6cc9e2b9f6d02b896f369b6dd5315205be94b8853809776c4d13353b85c6b531997b164ff6c3328ecf5b + languageName: node + linkType: hard + "eslint-visitor-keys@npm:^2.1.0": version: 2.1.0 resolution: "eslint-visitor-keys@npm:2.1.0" @@ -16315,6 +16591,67 @@ __metadata: languageName: node linkType: hard +"eslint@npm:^9.27.0": + version: 9.28.0 + resolution: "eslint@npm:9.28.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.2.0" + "@eslint-community/regexpp": "npm:^4.12.1" + "@eslint/config-array": "npm:^0.20.0" + "@eslint/config-helpers": "npm:^0.2.1" + "@eslint/core": "npm:^0.14.0" + "@eslint/eslintrc": "npm:^3.3.1" + "@eslint/js": "npm:9.28.0" + "@eslint/plugin-kit": "npm:^0.3.1" + "@humanfs/node": "npm:^0.16.6" + "@humanwhocodes/module-importer": "npm:^1.0.1" + "@humanwhocodes/retry": "npm:^0.4.2" + "@types/estree": "npm:^1.0.6" + "@types/json-schema": "npm:^7.0.15" + ajv: "npm:^6.12.4" + chalk: "npm:^4.0.0" + cross-spawn: "npm:^7.0.6" + debug: "npm:^4.3.2" + escape-string-regexp: "npm:^4.0.0" + eslint-scope: "npm:^8.3.0" + eslint-visitor-keys: "npm:^4.2.0" + espree: "npm:^10.3.0" + esquery: "npm:^1.5.0" + esutils: "npm:^2.0.2" + fast-deep-equal: "npm:^3.1.3" + file-entry-cache: "npm:^8.0.0" + find-up: "npm:^5.0.0" + glob-parent: "npm:^6.0.2" + ignore: "npm:^5.2.0" + imurmurhash: "npm:^0.1.4" + is-glob: "npm:^4.0.0" + json-stable-stringify-without-jsonify: "npm:^1.0.1" + lodash.merge: "npm:^4.6.2" + minimatch: "npm:^3.1.2" + natural-compare: "npm:^1.4.0" + optionator: "npm:^0.9.3" + peerDependencies: + jiti: "*" + peerDependenciesMeta: + jiti: + optional: true + bin: + eslint: bin/eslint.js + checksum: 10c0/513ea7e69d88a0905d4ed35cef3a8f31ebce7ca9f2cdbda3474495c63ad6831d52357aad65094be7a144d6e51850980ced7d25efb807e8ab06a427241f7cd730 + languageName: node + linkType: hard + +"espree@npm:^10.0.1, espree@npm:^10.3.0": + version: 10.3.0 + resolution: "espree@npm:10.3.0" + dependencies: + acorn: "npm:^8.14.0" + acorn-jsx: "npm:^5.3.2" + eslint-visitor-keys: "npm:^4.2.0" + checksum: 10c0/272beeaca70d0a1a047d61baff64db04664a33d7cfb5d144f84bc8a5c6194c6c8ebe9cc594093ca53add88baa23e59b01e69e8a0160ab32eac570482e165c462 + languageName: node + linkType: hard + "espree@npm:^9.6.0, espree@npm:^9.6.1": version: 9.6.1 resolution: "espree@npm:9.6.1" @@ -17054,6 +17391,15 @@ __metadata: languageName: node linkType: hard +"file-entry-cache@npm:^8.0.0": + version: 8.0.0 + resolution: "file-entry-cache@npm:8.0.0" + dependencies: + flat-cache: "npm:^4.0.0" + checksum: 10c0/9e2b5938b1cd9b6d7e3612bdc533afd4ac17b2fc646569e9a8abbf2eb48e5eb8e316bc38815a3ef6a1b456f4107f0d0f055a614ca613e75db6bf9ff4d72c1638 + languageName: node + linkType: hard + "file-saver@npm:^2.0.5": version: 2.0.5 resolution: "file-saver@npm:2.0.5" @@ -17181,6 +17527,16 @@ __metadata: languageName: node linkType: hard +"flat-cache@npm:^4.0.0": + version: 4.0.1 + resolution: "flat-cache@npm:4.0.1" + dependencies: + flatted: "npm:^3.2.9" + keyv: "npm:^4.5.4" + checksum: 10c0/2c59d93e9faa2523e4fda6b4ada749bed432cfa28c8e251f33b25795e426a1c6dbada777afb1f74fcfff33934fdbdea921ee738fcc33e71adc9d6eca984a1cfc + languageName: node + linkType: hard + "flat@npm:^5.0.2": version: 5.0.2 resolution: "flat@npm:5.0.2" @@ -17826,6 +18182,20 @@ __metadata: languageName: node linkType: hard +"globals@npm:^14.0.0": + version: 14.0.0 + resolution: "globals@npm:14.0.0" + checksum: 10c0/b96ff42620c9231ad468d4c58ff42afee7777ee1c963013ff8aabe095a451d0ceeb8dcd8ef4cbd64d2538cef45f787a78ba3a9574f4a634438963e334471302d + languageName: node + linkType: hard + +"globals@npm:^16.2.0": + version: 16.2.0 + resolution: "globals@npm:16.2.0" + checksum: 10c0/c2b3ea163faa6f8a38076b471b12f4bda891f7df7f7d2e8294fb4801d735a51a73431bf4c1696c5bf5dbca5e0a0db894698acfcbd3068730c6b12eef185dea25 + languageName: node + linkType: hard + "globalthis@npm:^1.0.4": version: 1.0.4 resolution: "globalthis@npm:1.0.4" @@ -18660,6 +19030,13 @@ __metadata: languageName: node linkType: hard +"ignore@npm:^7.0.0": + version: 7.0.5 + resolution: "ignore@npm:7.0.5" + checksum: 10c0/ae00db89fe873064a093b8999fe4cc284b13ef2a178636211842cceb650b9c3e390d3339191acb145d81ed5379d2074840cf0c33a20bdbd6f32821f79eb4ad5d + languageName: node + linkType: hard + "imask@npm:^7.6.1": version: 7.6.1 resolution: "imask@npm:7.6.1" @@ -20566,7 +20943,7 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^4.5.3": +"keyv@npm:^4.5.3, keyv@npm:^4.5.4": version: 4.5.4 resolution: "keyv@npm:4.5.4" dependencies: @@ -26548,6 +26925,15 @@ __metadata: languageName: node linkType: hard +"synckit@npm:^0.11.7": + version: 0.11.8 + resolution: "synckit@npm:0.11.8" + dependencies: + "@pkgr/core": "npm:^0.2.4" + checksum: 10c0/a1de5131ee527512afcaafceb2399b2f3e63678e56b831e1cb2dc7019c972a8b654703a3b94ef4166868f87eb984ea252b467c9d9e486b018ec2e6a55c24dfd8 + languageName: node + linkType: hard + "table-layout@npm:^1.0.2": version: 1.0.2 resolution: "table-layout@npm:1.0.2" @@ -27456,6 +27842,20 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^8.33.0": + version: 8.33.0 + resolution: "typescript-eslint@npm:8.33.0" + dependencies: + "@typescript-eslint/eslint-plugin": "npm:8.33.0" + "@typescript-eslint/parser": "npm:8.33.0" + "@typescript-eslint/utils": "npm:8.33.0" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 10c0/a07b87ed2e4ff71edfc641f0073192e7eb8a169adb3ee99a05370310d73698e92814e56cec760d13f9a180687ac3dd3ba9536461ec9a110ad2543f60950e8c8d + languageName: node + linkType: hard + "typescript@npm:5.7.2": version: 5.7.2 resolution: "typescript@npm:5.7.2" From 7e56787e56313db57ac138a9a2e6e7a7f3cc288f Mon Sep 17 00:00:00 2001 From: KirillKirill Date: Fri, 6 Jun 2025 18:15:05 +0300 Subject: [PATCH 12/21] [Dashboard] - Refactor theme (#3382) * refactor: replace colorPalette with theme.palette * minor fix * refactor: typography, add style overrides for Chip, Button and Table Header, minor fixes, cleanup of theme * feat: placeholder for dark mode and related features * refactor: reputation score uses chip component --- .../client/src/assets/styles/_const.scss | 15 +- .../client/src/assets/styles/_search.scss | 68 +- .../client/src/assets/styles/color-palette.ts | 63 -- .../src/components/Charts/AreaChart.tsx | 30 +- .../components/Charts/CustomChartTooltip.tsx | 19 +- .../src/components/Charts/CustomXAxisTick.tsx | 6 +- .../src/components/DataEntry/DatePicker.tsx | 5 +- .../components/DataEntry/ToggleButtons.tsx | 14 +- .../client/src/components/Home/SmallGraph.tsx | 17 +- .../src/components/Icons/DarkModeIcon.tsx | 14 + .../src/components/Icons/LightModeIcon.tsx | 14 + .../components/SearchBar/SearchBar.styles.ts | 23 +- .../src/components/SearchBar/SearchBar.tsx | 31 +- .../SearchResults/AbbreviateClipboard.tsx | 5 +- .../src/components/ThemeModeSwitch/index.tsx | 18 + .../components/DataGridWrapper.tsx | 3 +- .../client/src/features/Leaderboard/index.tsx | 20 +- packages/apps/dashboard/client/src/main.tsx | 9 +- .../dashboard/client/src/pages/Home/Home.tsx | 2 +- .../EscrowAddress/EscrowAddress.tsx | 16 +- .../SearchResults/ReputationScore/index.tsx | 77 +- .../SearchResults/RoleDetails/RoleDetails.tsx | 31 +- .../src/pages/SearchResults/SearchResults.tsx | 2 +- .../cells/TransactionTableCellMethod.tsx | 66 +- .../tableComponents/TransactionsTableBody.tsx | 7 +- .../tableComponents/TransactionsTableHead.tsx | 17 +- .../client/src/providers/ThemeProvider.tsx | 74 ++ packages/apps/dashboard/client/src/theme.tsx | 724 +++++++++++------- 28 files changed, 748 insertions(+), 642 deletions(-) delete mode 100644 packages/apps/dashboard/client/src/assets/styles/color-palette.ts create mode 100644 packages/apps/dashboard/client/src/components/Icons/DarkModeIcon.tsx create mode 100644 packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx create mode 100644 packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx create mode 100644 packages/apps/dashboard/client/src/providers/ThemeProvider.tsx diff --git a/packages/apps/dashboard/client/src/assets/styles/_const.scss b/packages/apps/dashboard/client/src/assets/styles/_const.scss index 8290739e30..2f3774c914 100644 --- a/packages/apps/dashboard/client/src/assets/styles/_const.scss +++ b/packages/apps/dashboard/client/src/assets/styles/_const.scss @@ -1,18 +1,5 @@ $maWhite: #F6F7FE; $primary: #320A8D; $white: #fff; -$sky: #858EC6; -$skyOpacity: #DADEF0CC; $secondary: #6309FF; -$lilacSachet: #AEB4D9; -$ghostWhite: #F9FAFF; -$whiteSolid: #F6F5FC; -$groundwaterOpacity: #1406B20A; -$medium: #FFB300; -$mediumBorder: #FFD54F; -$low: #ED6C02; -$lowBorder: #ED6C0280; -$high: #0AD397; -$highBorder: #2E7D3280; -$soon: #304FFE; -$soonBorder: #8C9EFF; \ No newline at end of file +$skyOpacity: #DADEF0CC; \ No newline at end of file diff --git a/packages/apps/dashboard/client/src/assets/styles/_search.scss b/packages/apps/dashboard/client/src/assets/styles/_search.scss index 014fe3047c..c687f453c0 100644 --- a/packages/apps/dashboard/client/src/assets/styles/_search.scss +++ b/packages/apps/dashboard/client/src/assets/styles/_search.scss @@ -1,11 +1,11 @@ -.search, .search-white{ +.search { position: relative; width: 920px; max-width: 100%; - border: 1px solid #DADEF0CC; + border: 1px solid; + border-color: $skyOpacity; border-radius: 13px; - #search-bar{ width: 100%; border-radius: 8px; @@ -21,66 +21,4 @@ } } - - .search-close{ - cursor: pointer; - } - - .search-button{ - background-color: $secondary; - border-radius: 8px; - svg{ - font-size: 32px; - } - &:hover{ - background-color: $primary; - } - } -} - -.search-results-bar { - display: block; - -} - -.search-white{ - width: 500px; - max-width: 25%; - - .search-button{ - padding: 4px; - background: #1406B214; - svg{ - font-size: 24px; - } - &:hover{ - background-color: $secondary; - svg{ - color: $white; - } - } - } - - #search-bar{ - padding: 8px 0; - - } - @media (max-width: 1150px) { - max-width: 20%; - } - - @media (max-width: 1280px) { - max-width: 100%; - - #search-bar{ - padding: 12px 0; - } - } -} - -@media (max-width: 1280px) { - - .search-white{ - padding: 8px 0; - } } diff --git a/packages/apps/dashboard/client/src/assets/styles/color-palette.ts b/packages/apps/dashboard/client/src/assets/styles/color-palette.ts deleted file mode 100644 index ed67fcb013..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/color-palette.ts +++ /dev/null @@ -1,63 +0,0 @@ -export const colorPalette = { - white: '#F9FAFF', - whiteBackground: '#FFF', - whiteSolid: '#F6F5FC', - skyOpacity: '#DADEF0CC', - link: '#0000EE', - linkHover: '#1406B2', - linkVisited: '#551A8B', - primary: { - main: '#320a8d', - light: '#320a8d', - }, - secondary: { - main: '#6309ff', - light: '#1406B280', - dark: '#14062b', - }, - info: { - main: '#eeeeee', - light: '#f5f5f5', - dark: '#bdbdbd', - }, - success: { - main: '#0AD397', - light: '#2E7D3280', - }, - warning: { - main: '#FFB300', - light: '#FFD54F', - }, - error: { - main: '#FFB300', - light: '#F20D5F', - }, - fog: { - main: '#858EC6', - light: '#CBCFE6', - dark: '#E5E7F3', - }, - overlay: { - light: '#1406B20A', - }, - sky: { - main: '#858ec6', - light: '#858ec6', - dark: '#858ec6', - contrastText: '#858ec6', - }, - ocean: { - main: '#304FFE', - light: '#8C9EFF', - dark: '#03A9F4', - }, - orange: { - main: '#ED6C02', - light: '#ED6C0280', - }, - table: { - main: '#FFFFFF01', - selected: '#1406B21F', - secondary: '#1406B20A', - }, -} as const; diff --git a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx b/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx index 456135b49d..36f5fa95b1 100644 --- a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from 'react'; -import { Typography } from '@mui/material'; +import { Typography, useTheme } from '@mui/material'; import Card from '@mui/material/Card'; import Stack from '@mui/material/Stack'; import dayjs, { Dayjs } from 'dayjs'; @@ -14,7 +14,6 @@ import { ResponsiveContainer, } from 'recharts'; -import { colorPalette } from '@/assets/styles/color-palette'; import CustomXAxisTick from '@/components/Charts/CustomXAxisTick'; import ToggleCharts from '@/components/Charts/ToggleCharts'; import DatePicker from '@/components/DataEntry/DatePicker'; @@ -83,6 +82,7 @@ export const AreaChart = ({ changeDateOnScroll?: boolean; }) => { const { data } = useGraphPageChartData(); + const theme = useTheme(); const chartData = data || []; const { setFromDate, @@ -302,14 +302,14 @@ export const AreaChart = ({ tick={{ dx: -10 }} tickSize={0} axisLine={false} - stroke={colorPalette.fog.main} + stroke={theme.palette.fog.main} /> } height={50} - stroke={colorPalette.fog.dark} + stroke={theme.palette.fog.dark} tickSize={20} dataKey="date" tickMargin={10} @@ -319,7 +319,7 @@ export const AreaChart = ({ @@ -328,7 +328,7 @@ export const AreaChart = ({ @@ -337,7 +337,7 @@ export const AreaChart = ({ @@ -346,7 +346,7 @@ export const AreaChart = ({ @@ -355,7 +355,7 @@ export const AreaChart = ({ @@ -367,7 +367,7 @@ export const AreaChart = ({ py: 3, mt: 3, ml: { xs: 0, xl: 6 }, - backgroundColor: colorPalette.overlay.light, + backgroundColor: theme.palette.overlay, boxShadow: 'none', borderRadius: '16px', }} @@ -382,31 +382,31 @@ export const AreaChart = ({ isAreaChart: true, name: 'totalTransactionAmount', amount: `${Number(sum.totalTransactionAmount.toFixed())}`, - color: colorPalette.primary.main, + color: theme.palette.primary.main, }, { title: 'Transactions Count', name: 'totalTransactionCount', amount: sum.totalTransactionCount, - color: colorPalette.secondary.main, + color: theme.palette.secondary.main, }, { title: 'Number of Tasks', name: 'solved', amount: sum.solved, - color: colorPalette.ocean.dark, + color: theme.palette.ocean.dark, }, { title: 'Unique Receivers', name: 'dailyUniqueReceivers', amount: sum.dailyUniqueReceivers, - color: colorPalette.error.light, + color: theme.palette.error.light, }, { title: 'Unique Senders', name: 'dailyUniqueSenders', amount: sum.dailyUniqueSenders, - color: colorPalette.success.main, + color: theme.palette.success.main, }, ]} /> diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx b/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx index d27479a7ef..43e186ae67 100644 --- a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx @@ -6,11 +6,9 @@ import Stack from '@mui/material/Stack'; import { NumericFormat } from 'react-number-format'; import { TooltipProps } from 'recharts'; -import { colorPalette } from '@/assets/styles/color-palette'; import { GraphPageChartDataConfigObject } from '@/components/Charts/AreaChart'; import { formatDate } from '@/helpers/formatDate'; - const renderTitle = (title: string) => { const currentTitle: GraphPageChartDataConfigObject = { totalTransactionAmount: 'Transfer Amount', @@ -31,20 +29,13 @@ const CustomChartTooltip = ({ return ( - - + + {formatDate(label, 'MMMM DD, YYYY')} {payload?.map((elem) => ( @@ -64,7 +55,7 @@ const CustomChartTooltip = ({ fontSize: '12px', }} /> - + {renderTitle(elem.name ?? '')}
diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx b/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx index 46fc03a3f8..3cdcc81b5b 100644 --- a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx +++ b/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx @@ -1,16 +1,18 @@ +import { useTheme } from '@mui/material'; // @ts-expect-error -- import error, but this type work property import { ContentRenderer } from 'recharts'; -import { colorPalette } from '@/assets/styles/color-palette'; import { formatDate } from '@/helpers/formatDate'; const CustomXAxisTick = ({ x, y, payload }: ContentRenderer) => { + const theme = useTheme(); + return ( , BaseSingleInputFieldProps< @@ -43,7 +41,8 @@ const CustomDateField = ({ aria-label={ariaLabel} onClick={() => setOpen((prevState) => !prevState)} sx={{ - borderBottom: `1px solid ${colorPalette.primary.main}`, + borderBottom: '1px solid', + borderColor: 'primary.main', lineHeight: 2.5, '&:hover': { cursor: 'pointer', diff --git a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx b/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx index 5383d14c25..29c523d3d9 100644 --- a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx +++ b/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx @@ -1,7 +1,7 @@ import { styled } from '@mui/material'; +import Button from '@mui/material/Button'; import ToggleButton from '@mui/material/ToggleButton'; import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; -import Typography from '@mui/material/Typography'; import dayjs from 'dayjs'; import { @@ -16,6 +16,7 @@ export const StyledToggleButtonGroup = styled(ToggleButtonGroup)( '.MuiToggleButtonGroup-grouped': { border: 'none', borderRadius: 4, + minWidth: 'unset', width: 47, height: 30, color: theme.palette.primary.main, @@ -43,15 +44,14 @@ const ToggleButtons = () => { exclusive > {TIME_PERIOD_OPTIONS.map((elem) => ( - setTimePeriod(elem)} selected={checkIfSelected(elem)} value={elem.name} sx={{ - '.MuiTypography-root': { - wordBreak: 'normal', - }, '&.Mui-selected': { backgroundColor: 'primary.main', color: 'white.main', @@ -61,8 +61,8 @@ const ToggleButtons = () => { }, }} > - {elem.name} - + {elem.name} + ))} ); diff --git a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx index c5484fcba4..ba5b9cd44e 100644 --- a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx +++ b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx @@ -1,5 +1,6 @@ import { Fragment } from 'react'; +import { useTheme } from '@mui/material'; import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import Stack from '@mui/material/Stack'; @@ -15,7 +16,6 @@ import { TooltipProps, } from 'recharts'; -import { colorPalette } from '@/assets/styles/color-palette'; import ToggleButtons from '@/components/DataEntry/ToggleButtons'; import { formatDate } from '@/helpers/formatDate'; import { formatNumber } from '@/helpers/formatNumber'; @@ -30,14 +30,15 @@ const CustomSmallChartTooltip = ({ {payload?.map((elem) => ( - + {formatDate(elem.payload.date, 'MMMM DD, YYYY')} @@ -67,7 +68,6 @@ const GraphSettings = ({ title }: { title: string }) => ( alignItems="center" mt={{ xs: 1.5, md: 0 }} mb={{ xs: 0, md: 2 }} - mr={{ xs: 0, md: 4 }} gap={2} flexWrap="wrap" > @@ -80,6 +80,7 @@ const GraphSettings = ({ title }: { title: string }) => ( const SmallGraph = ({ title, graphData }: SmallGraphProps) => { const isMobile = useIsMobile(); + const theme = useTheme(); return ( <> @@ -107,7 +108,7 @@ const SmallGraph = ({ title, graphData }: SmallGraphProps) => { axisLine={false} interval="preserveStartEnd" dataKey="date" - stroke={colorPalette.fog.main} + stroke={theme.palette.fog.main} tickFormatter={(value) => formatDate(value, 'DD MMMM')} tick={{ dy: 10 }} tickSize={0} @@ -121,11 +122,11 @@ const SmallGraph = ({ title, graphData }: SmallGraphProps) => { dataKey="value" tick={{ dx: -10 }} tickSize={0} - stroke={colorPalette.fog.main} + stroke={theme.palette.fog.main} tickFormatter={formatNumber} /> @@ -133,7 +134,7 @@ const SmallGraph = ({ title, graphData }: SmallGraphProps) => { diff --git a/packages/apps/dashboard/client/src/components/Icons/DarkModeIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/DarkModeIcon.tsx new file mode 100644 index 0000000000..8dcd939273 --- /dev/null +++ b/packages/apps/dashboard/client/src/components/Icons/DarkModeIcon.tsx @@ -0,0 +1,14 @@ +import { FC } from 'react'; + +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +export const DarkModeIcon: FC = (props) => { + return ( + + + + ); +}; diff --git a/packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx new file mode 100644 index 0000000000..eae0b2bd2e --- /dev/null +++ b/packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx @@ -0,0 +1,14 @@ +import { FC } from 'react'; + +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +export const LightModeIcon: FC = (props) => { + return ( + + + + ); +}; diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts index 3812d346f4..b9555739e1 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts +++ b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts @@ -1,4 +1,4 @@ -import { colorPalette } from '@/assets/styles/color-palette'; +import { Theme } from '@mui/material/styles'; export const endAdornmentInputAdornmentSx = { display: 'flex', @@ -7,11 +7,11 @@ export const endAdornmentInputAdornmentSx = { gap: '0.7rem', }; -export const startAdornmentInputAdornmentSx = { +export const startAdornmentInputAdornmentSx = (theme: Theme) => ({ height: '100%', - backgroundColor: `${colorPalette.white}`, + backgroundColor: theme.palette.white.contrastText, marginLeft: '1rem', -}; +}); export const gridSx = { display: 'flex', @@ -22,8 +22,8 @@ export const gridSx = { overflow: 'hidden', }; -export const muiSelectSx = () => ({ - backgroundColor: `${colorPalette.white}`, +export const muiSelectSx = (theme: Theme) => ({ + backgroundColor: theme.palette.white.contrastText, width: 'unset', fontSize: '16px', boxShadow: 'none', @@ -35,7 +35,7 @@ export const muiSelectSx = () => ({ '& .MuiSelect-select': { padding: 0, paddingRight: '24px', - backgroundColor: `${colorPalette.white}`, + backgroundColor: theme.palette.white.contrastText, border: 0, }, }); @@ -46,15 +46,18 @@ export const menuItemSx = (isSelected: boolean) => ({ backgroundColor: isSelected ? 'rgba(50, 10, 141, 0.08)' : 'inherit', }); -export const muiTextFieldInputPropsSx = (borderColor: string) => ({ +export const muiTextFieldInputPropsSx = ( + theme: Theme, + borderColor: string +) => ({ width: '100%', height: '100%', borderRadius: '10px', border: `1px solid ${borderColor}`, - backgroundColor: `${colorPalette.white}`, + backgroundColor: theme.palette.white.contrastText, fontSize: 'inherit', 'input::placeholder': { - color: `${colorPalette.sky.main}`, + color: theme.palette.sky.main, opacity: 1, }, padding: '0 5px', diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx index b9d0fb2881..c8f5f325e6 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx +++ b/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx @@ -10,14 +10,14 @@ import { Grid, MenuItem, Box, - Tooltip, CircularProgress, + useTheme, } from '@mui/material'; import IconButton from '@mui/material/IconButton'; import clsx from 'clsx'; import { useNavigate } from 'react-router-dom'; -import { colorPalette } from '@/assets/styles/color-palette'; +import CustomTooltip from '@/components/CustomTooltip'; import { NetworkIcon } from '@/components/NetworkIcon'; import { useIsMobile } from '@/utils/hooks/use-breakpoints'; import { useFilteredNetworks } from '@/utils/hooks/use-filtered-networks'; @@ -51,6 +51,7 @@ const SearchBar: FC = ({ const [inputValue, setInputValue] = useState(initialInputValue); const [error, setError] = useState(null); const [focus, setFocus] = useState(false); + const theme = useTheme(); useEffect(() => { setInputValue(filterParams.address); @@ -142,17 +143,18 @@ const SearchBar: FC = ({ sx={muiTextFieldSx(isMobile)} InputProps={{ sx: muiTextFieldInputPropsSx( - focus ? colorPalette.secondary.main : colorPalette.skyOpacity + theme, + focus ? theme.palette.secondary.main : theme.palette.sky.dark ), startAdornment: ( value={filterParams.chainId} displayEmpty - sx={muiSelectSx()} + sx={muiSelectSx(theme)} onChange={handleSelectChange} renderValue={() => filterParams.chainId === -1 @@ -180,30 +182,31 @@ const SearchBar: FC = ({ - + - + ), }} diff --git a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx b/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx index e158a4bd15..599916f2a0 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx +++ b/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx @@ -7,7 +7,6 @@ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; -import { colorPalette } from '@/assets/styles/color-palette'; import CustomTooltip from '@/components/CustomTooltip'; import abbreviateValue from '@/helpers/abbreviateValue'; @@ -24,7 +23,7 @@ const AbbreviateClipboard = ({ value, link }: AbbreviateClipboardProps) => { sx={{ whiteSpace: 'nowrap', textDecoration: 'inherit', - color: colorPalette.link, + color: 'link.main', }} > {link ? ( @@ -72,7 +71,7 @@ const AbbreviateClipboard = ({ value, link }: AbbreviateClipboardProps) => { diff --git a/packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx b/packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx new file mode 100644 index 0000000000..ebcaaab1f0 --- /dev/null +++ b/packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx @@ -0,0 +1,18 @@ +import { FC } from 'react'; + +import { IconButton, useTheme } from '@mui/material'; + +import { DarkModeIcon } from '@/components/Icons/DarkModeIcon'; +import { LightModeIcon } from '@/components/Icons/LightModeIcon'; + +const ThemeModeSwitch: FC = () => { + const { isDarkMode, toggleColorMode } = useTheme(); + + return ( + + {isDarkMode ? : } + + ); +}; + +export default ThemeModeSwitch; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx index 741f506a9b..16ce2f550d 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx @@ -1,7 +1,6 @@ import { Box, Typography } from '@mui/material'; import { DataGrid } from '@mui/x-data-grid'; -import { colorPalette } from '@/assets/styles/color-palette'; import Loader from '@/components/Loader'; import { LeaderBoardData } from '@/services/api/use-leaderboard-details'; import { handleErrorMessage } from '@/services/handle-error-message'; @@ -89,7 +88,7 @@ export const DataGridWrapper = ({ p: 2, overflow: 'visible !important', textTransform: 'uppercase', - bgcolor: colorPalette.whiteSolid, + bgcolor: 'white.light', }, '& .MuiDataGrid-row--borderBottom .MuiDataGrid-withBorderColor': { borderColor: 'transparent', diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx index 8ed529d23c..75e42c0460 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx +++ b/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx @@ -2,10 +2,8 @@ import { FC } from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; -import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; -import { colorPalette } from '@/assets/styles/color-palette'; import { LeaderBoardData } from '@/services/api/use-leaderboard-details'; import { DataGridWrapper } from './components/DataGridWrapper'; @@ -38,29 +36,23 @@ export const Leaderboard: FC = ({ padding="10px" mb={2.5} width="270px" - bgcolor={colorPalette.whiteSolid} + bgcolor="white.light" > {viewAllBanner ? ( ) : null} diff --git a/packages/apps/dashboard/client/src/main.tsx b/packages/apps/dashboard/client/src/main.tsx index f3a7cc1a93..0474e89a76 100644 --- a/packages/apps/dashboard/client/src/main.tsx +++ b/packages/apps/dashboard/client/src/main.tsx @@ -1,13 +1,11 @@ import React from 'react'; -import CssBaseline from '@mui/material/CssBaseline'; -import { ThemeProvider } from '@mui/material/styles'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import ReactDOM from 'react-dom/client'; -import App from './App'; -import theme from './theme'; +import ThemeProvider from '@/providers/ThemeProvider'; +import App from './App'; import '@/assets/styles/main.scss'; import 'simplebar-react/dist/simplebar.min.css'; @@ -19,8 +17,7 @@ const queryClient = new QueryClient({ }); ReactDOM.createRoot(document.getElementById('root')!).render( - - + diff --git a/packages/apps/dashboard/client/src/pages/Home/Home.tsx b/packages/apps/dashboard/client/src/pages/Home/Home.tsx index c595560a32..5b60eae7b8 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Home.tsx +++ b/packages/apps/dashboard/client/src/pages/Home/Home.tsx @@ -67,7 +67,7 @@ const Home: FC = () => { return ( - + All HUMAN activity. In one place. diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx index 922a2c92a5..73c77b5a1f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx @@ -1,4 +1,4 @@ -import Box from '@mui/material/Box'; +import Chip from '@mui/material/Chip'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; @@ -8,7 +8,6 @@ import { AddressDetailsEscrowSchema } from '@/services/api/use-address-details'; import HmtBalance from '../HmtBalance'; - const EscrowAddress = ({ data: { token, @@ -70,18 +69,7 @@ const EscrowAddress = ({ - - - {status} - - + = { - High: { - title: 'High', - colors: { - title: colorPalette.success.main, - border: colorPalette.success.light, +export const ReputationScore = ({ reputation }: Props) => { + const theme = useTheme(); + + const reputationAttributes: Record = { + High: { + title: 'High', + colors: { + title: theme.palette.success.main, + border: theme.palette.success.light, + }, }, - }, - Medium: { - title: 'Medium', - colors: { - title: colorPalette.warning.main, - border: colorPalette.warning.light, + Medium: { + title: 'Medium', + colors: { + title: theme.palette.warning.main, + border: theme.palette.warning.light, + }, }, - }, - Low: { - title: 'Low', - colors: { - title: colorPalette.orange.main, - border: colorPalette.orange.light, + Low: { + title: 'Low', + colors: { + title: theme.palette.orange.main, + border: theme.palette.orange.light, + }, }, - }, - Unknown: { - title: 'Coming soon', - colors: { - title: colorPalette.ocean.main, - border: colorPalette.ocean.light, + Unknown: { + title: 'Coming soon', + colors: { + title: theme.palette.ocean.main, + border: theme.palette.ocean.light, + }, }, - }, -}; + }; -const ReputationScore: FC = ({ reputation }) => { const colors = reputationAttributes[reputation].colors; + return ( - - - {reputationAttributes[reputation].title} - - + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx index 3dc0530a4a..cb2d6edd12 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx @@ -11,7 +11,6 @@ import ExchangeOracleIcon from '@/assets/icons/exchange-oracle.svg'; import JobLauncherIcon from '@/assets/icons/job-launcher.svg'; import RecordingOracleIcon from '@/assets/icons/recording-oracle.svg'; import ReputationOracleIcon from '@/assets/icons/reputation-oracle.svg'; -import { colorPalette } from '@/assets/styles/color-palette'; import TitleSectionWrapper from '@/components/SearchResults/TitleSectionWrapper'; import SectionWrapper from '@/components/SectionWrapper'; import { env } from '@/helpers/env'; @@ -24,7 +23,6 @@ import KVStore from '../KVStore'; import ReputationScore from '../ReputationScore'; import StakeInfo from '../StakeInfo'; - interface RoleInfoProps { title: string; points: string[]; @@ -141,26 +139,21 @@ const RoleDetails = ({ data }: { data: AddressDetailsOperator }) => { Overview - {env.VITE_HUMANPROTOCOL_CORE_ARCHITECTURE ? ( - - - HUMAN Protocol core architecture - - - ) : null} + sx={{ + bgcolor: 'overlay', + color: 'ocean.main', + cursor: 'pointer', + width: 'fit-content', + }} + /> + )} diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx index 707cdf8870..14ab19de83 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx @@ -175,7 +175,7 @@ const SearchResults = () => { return ( - + {paramsStatus === ParamsStatus.LOADING && ( )} diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx index fa4c0fb96f..e2e39fb818 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx @@ -1,7 +1,15 @@ import Box from '@mui/material/Box/Box'; +import { useTheme } from '@mui/material/styles'; import Typography from '@mui/material/Typography'; -import { colorPalette } from '@/assets/styles/color-palette'; +type PaletteColorKey = + | 'primary' + | 'secondary' + | 'error' + | 'warning' + | 'info' + | 'success'; +type PaletteShadeKey = 'main' | 'light' | 'dark'; const methodAttributes: Record< string, @@ -9,64 +17,73 @@ const methodAttributes: Record< > = { withdraw: { color: { - text: colorPalette.error.main, - border: colorPalette.error.light, + text: 'error.main', + border: 'error.light', }, }, cancel: { color: { - text: colorPalette.error.main, - border: colorPalette.error.light, + text: 'error.main', + border: 'error.light', }, }, stake: { color: { - text: colorPalette.success.main, - border: colorPalette.success.light, + text: 'success.main', + border: 'success.light', }, }, unstake: { color: { - text: colorPalette.error.main, - border: colorPalette.error.light, + text: 'error.main', + border: 'error.light', }, }, slash: { color: { - text: colorPalette.error.main, - border: colorPalette.error.light, + text: 'error.main', + border: 'error.light', }, }, stakeWithdrawn: { color: { - text: colorPalette.error.main, - border: colorPalette.error.light, + text: 'error.main', + border: 'error.light', }, }, withdrawFees: { color: { - text: colorPalette.error.main, - border: colorPalette.error.light, + text: 'error.main', + border: 'error.light', }, }, approve: { color: { - text: colorPalette.warning.main, - border: colorPalette.warning.light, + text: 'warning.main', + border: 'warning.light', }, }, complete: { color: { - text: colorPalette.success.main, - border: colorPalette.success.light, + text: 'success.main', + border: 'success.light', }, }, }; export const TransactionTableCellMethod = ({ method }: { method: string }) => { + const theme = useTheme(); const currentStatusColors = methodAttributes[method]?.color || { - text: colorPalette.primary.main, - border: colorPalette.primary.light, + text: 'primary.main', + border: 'primary.light', + }; + + const getColorFromTheme = (colorString: string) => { + const [color, shade] = colorString.split('.') as [ + PaletteColorKey, + PaletteShadeKey, + ]; + return theme.palette[color][shade]; }; return ( @@ -75,9 +92,12 @@ export const TransactionTableCellMethod = ({ method }: { method: string }) => { px={1.5} py={1} borderRadius={8} - border={`1px solid ${currentStatusColors.border}`} + border={`1px solid ${getColorFromTheme(currentStatusColors.border)}`} > - + {method} diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx index d18d563748..cd1c80535a 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx @@ -10,7 +10,6 @@ import MuiTableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableRow from '@mui/material/TableRow'; -import { colorPalette } from '@/assets/styles/color-palette'; import AbbreviateClipboard from '@/components/SearchResults/AbbreviateClipboard'; import { TransactionTableCellMethod } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod'; import { TransactionTableCellValue } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue'; @@ -81,8 +80,8 @@ export const TransactionsTableBody: React.FC = () => { key={idx} sx={{ backgroundColor: expandedRows[idx] - ? colorPalette.table.selected - : colorPalette.table.main, + ? 'table.selected' + : 'table.main', }} > @@ -128,7 +127,7 @@ export const TransactionsTableBody: React.FC = () => { { - Transaction Hash + Transaction Hash - Method + Method - - From - - - To - + From + To - Block + Block - Value + Value diff --git a/packages/apps/dashboard/client/src/providers/ThemeProvider.tsx b/packages/apps/dashboard/client/src/providers/ThemeProvider.tsx new file mode 100644 index 0000000000..41b3005a65 --- /dev/null +++ b/packages/apps/dashboard/client/src/providers/ThemeProvider.tsx @@ -0,0 +1,74 @@ +import { + FC, + PropsWithChildren, + useCallback, + useEffect, + useMemo, + useState, +} from 'react'; + +import { + CssBaseline, + PaletteMode, + ThemeProvider as MuiThemeProvider, +} from '@mui/material'; + +import { createAppTheme } from '../theme'; + +const THEME_STORAGE_KEY = 'dashboard-app-theme-mode'; +const RELEASE_DARK_MODE = false; // TODO: remove this once we release the dark mode + +const ThemeProvider: FC = ({ children }) => { + const [mode, setMode] = useState(() => { + if (!RELEASE_DARK_MODE) return 'light'; + + const savedMode = localStorage.getItem(THEME_STORAGE_KEY) as PaletteMode; + if (savedMode) return savedMode; + + if ( + window.matchMedia && + window.matchMedia('(prefers-color-scheme: dark)').matches + ) { + return 'dark'; + } + return 'light'; + }); + + useEffect(() => { + const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + const handleChange = (e: MediaQueryListEvent) => { + setMode(e.matches ? 'dark' : 'light'); + }; + + mediaQuery.addEventListener('change', handleChange); + return () => mediaQuery.removeEventListener('change', handleChange); + }, []); + + useEffect(() => { + localStorage.setItem(THEME_STORAGE_KEY, mode); + }, [mode]); + + const toggleColorMode = useCallback(() => { + setMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light')); + }, []); + + const theme = useMemo(() => createAppTheme(mode), [mode]); + + const extendedTheme = useMemo( + () => ({ + ...theme, + isDarkMode: mode === 'dark', + toggleColorMode, + }), + [theme, mode, toggleColorMode] + ); + + return ( + + + {children} + + ); +}; + +export default ThemeProvider; diff --git a/packages/apps/dashboard/client/src/theme.tsx b/packages/apps/dashboard/client/src/theme.tsx index 33447e4e9c..55d021e695 100644 --- a/packages/apps/dashboard/client/src/theme.tsx +++ b/packages/apps/dashboard/client/src/theme.tsx @@ -1,58 +1,71 @@ import { CSSProperties } from 'react'; -import { Shadows, ThemeOptions } from '@mui/material'; +import { Shadows } from '@mui/material'; import { createTheme } from '@mui/material/styles'; import { PaletteColorOptions, PaletteColor, } from '@mui/material/styles/createPalette'; -import { colorPalette } from '@/assets/styles/color-palette'; - - declare module '@mui/material/Typography' { interface TypographyPropsVariantOverrides { - ['Button Small']: true; - ['Button Large']: true; - ['Chip']: true; - ['Table Header']: true; - ['Tooltip']: true; - ['H6-Mobile']: true; + tooltip: true; body3: true; } } declare module '@mui/material/styles' { + interface Theme { + toggleColorMode: () => void; + isDarkMode: boolean; + } + interface ThemeOptions { + toggleColorMode?: () => void; + isDarkMode?: boolean; + } interface TypographyVariants { - ['Button Small']: CSSProperties; - ['Button Large']: CSSProperties; - ['Chip']: CSSProperties; - ['Table Header']: CSSProperties; - ['Tooltip']: CSSProperties; - ['H6-Mobile']: CSSProperties; + tooltip: CSSProperties; body3: CSSProperties; } - - // allow configuration using `createTheme` interface TypographyVariantsOptions { - ['Button Small']?: CSSProperties; - ['Button Large']?: CSSProperties; - ['Chip']?: CSSProperties; - ['Table Header']?: CSSProperties; - ['Tooltip']?: CSSProperties; - ['H6-Mobile']: CSSProperties; + tooltip?: CSSProperties; body3?: CSSProperties; } -} - -declare module '@mui/material/styles' { interface Palette { sky: PaletteColor; white: PaletteColor; + fog: PaletteColor; + ocean: PaletteColor; + orange: PaletteColor; + overlay: string; + link: { + main: string; + hover: string; + visited: string; + }; + table: { + main: string; + selected: string; + secondary: string; + }; } interface PaletteOptions { sky?: PaletteColorOptions; white?: PaletteColorOptions; + fog?: PaletteColorOptions; + ocean?: PaletteColorOptions; + orange?: PaletteColorOptions; + overlay?: string; + link?: { + main: string; + hover: string; + visited: string; + }; + table?: { + main: string; + selected: string; + secondary: string; + }; } } @@ -60,6 +73,7 @@ declare module '@mui/material/Button' { interface ButtonPropsColorOverrides { sky: true; white: true; + fog: true; } } @@ -67,6 +81,7 @@ declare module '@mui/material/IconButton' { interface IconButtonPropsColorOverrides { sky: true; white: true; + fog: true; } } @@ -74,305 +89,430 @@ declare module '@mui/material/SvgIcon' { interface SvgIconPropsColorOverrides { sky: true; white: true; + fog: true; } } -const theme: ThemeOptions = createTheme({ - palette: { - primary: { - main: colorPalette.primary.main, - light: colorPalette.primary.light, - }, - info: { - main: colorPalette.info.main, - light: colorPalette.info.light, - dark: colorPalette.info.dark, - }, - secondary: { - main: colorPalette.secondary.main, - light: colorPalette.secondary.light, - }, - text: { - primary: colorPalette.primary.main, - secondary: colorPalette.fog.main, - }, - sky: { - main: colorPalette.sky.main, - light: colorPalette.sky.light, - dark: colorPalette.sky.dark, - contrastText: colorPalette.sky.contrastText, - }, - white: { - main: '#ffffff', - light: '#ffffff', - dark: '#f6f7fe', - contrastText: '#ffffff', - }, - }, - typography: { - fontFamily: 'Inter, Arial, sans-serif', - h1: { - fontSize: 32, - }, - h2: { - fontSize: 34, - fontWeight: 600, - }, - h3: { - fontSize: 24, - fontWeight: 600, - '@media (max-width:600px)': { - fontSize: 20, +export const createAppTheme = (mode: 'light' | 'dark') => { + return createTheme({ + palette: { + mode, + ...(mode === 'light' + ? { + primary: { + main: '#320a8d', + light: '#320a8d', + }, + secondary: { + main: '#6309ff', + light: '#1406B280', + dark: '#14062b', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + sky: { + main: '#858ec6', + light: '#858ec6', + dark: '#dadef0cc', + contrastText: '#858ec6', + }, + white: { + main: '#ffffff', + light: '#f6f5fc', + dark: '#f6f7fe', + contrastText: '#f9faff', + }, + success: { + main: '#0ad397', + light: '#2e7d3280', + }, + warning: { + main: '#ffb300', + light: '#ffd54f', + }, + error: { + main: '#ffb300', + light: '#f20d5f', + }, + orange: { + main: '#ed6c02', + light: '#ed6c0280', + }, + ocean: { + main: '#304ffe', + light: '#8c9eff', + dark: '#03a9f4', + }, + fog: { + main: '#858ec6', + light: '#cbcfe6', + dark: '#e5e7f3', + }, + link: { + main: '#0000ee', + hover: '#1406b2', + visited: '#551a8b', + }, + table: { + main: '#ffffff01', + selected: '#1406b21f', + secondary: '#1406b20a', + }, + overlay: '#1406b20a', + } + : { + primary: { + main: '#320a8d', + light: '#320a8d', + }, + secondary: { + main: '#6309ff', + light: '#1406B280', + dark: '#14062b', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + sky: { + main: '#858ec6', + light: '#858ec6', + dark: '#dadef0cc', + contrastText: '#858ec6', + }, + white: { + main: '#ffffff', + light: '#f6f5fc', + dark: '#f6f7fe', + contrastText: '#f9faff', + }, + success: { + main: '#0ad397', + light: '#2e7d3280', + }, + warning: { + main: '#ffb300', + light: '#ffd54f', + }, + error: { + main: '#ffb300', + light: '#f20d5f', + }, + orange: { + main: '#ed6c02', + light: '#ed6c0280', + }, + ocean: { + main: '#304ffe', + light: '#8c9eff', + dark: '#03a9f4', + }, + fog: { + main: '#858ec6', + light: '#cbcfe6', + dark: '#e5e7f3', + }, + link: { + main: '#0000ee', + hover: '#1406b2', + visited: '#551a8b', + }, + table: { + main: '#ffffff01', + selected: '#1406b21f', + secondary: '#1406b20a', + }, + overlay: '#1406b20a', + }), + }, + typography: { + fontFamily: 'Inter, Arial, sans-serif', + h1: { + fontSize: 32, }, - }, - h4: { - fontSize: 20, - fontWeight: 500, - }, - h5: { - fontSize: 18, - fontWeight: 600, - }, - h6: { - fontSize: 20, - fontWeight: 500, - }, - 'H6-Mobile': { - fontSize: '20px', - fontWeight: 500, - lineHeight: '32px', - letterSpacing: '0.15px', - textAlign: 'left', - }, - body1: { - fontSize: 16, - fontWeight: 400, - }, - body2: { - fontSize: 14, - fontWeight: 500, - }, - body3: { - fontSize: '12px', - fontWeight: 400, - lineHeight: '19.92px', - letterSpacing: '0.4px', - textAlign: 'left', - }, - 'Button Small': { - fontSize: '13px', - fontWeight: 600, - lineHeight: '22px', - letterSpacing: '0.1px', - textAlign: 'left', - }, - 'Button Large': { - fontSize: '15px', - fontWeight: 600, - lineHeight: '26px', - letterSpacing: '0.1px', - textAlign: 'left', - }, - Chip: { - fontSize: '13px', - fontWeight: 400, - lineHeight: '18px', - letterSpacing: '0.16px', - textAlign: 'left', - }, - 'Table Header': { - fontFamily: 'Roboto', - fontSize: '14px', - fontWeight: 500, - lineHeight: '24px', - letterSpacing: '0.17px', - textAlign: 'left', - }, - Tooltip: { - fontSize: 10, - fontWeight: 500, - lineHeight: '14px', - }, - subtitle1: { - fontSize: 12, - }, - subtitle2: { - fontSize: 14, - fontWeight: 600, - lineHeight: '21.9px', - }, - caption: { - fontSize: 12, - fontWeight: 400, - lineHeight: 5 / 3, - letterSpacing: 0.4, - }, - }, - shadows: [ - ...createTheme({}).shadows.map((shadow, i) => { - if (i === 2) { - return '0px 3px 1px -2px #e9ebfa, 0px 2px 2px 0px rgba(233, 235, 250, 0.50), 0px 1px 5px 0px rgba(233, 235, 250, 0.20)'; - } - return shadow; - }), - ] as Shadows, - components: { - MuiButton: { - styleOverrides: { - root: { - fontWeight: 600, - textTransform: 'none', - }, + h2: { + fontSize: 34, + fontWeight: 600, }, - }, - MuiToolbar: { - styleOverrides: { - root: { - '@media (min-width:1280px)': { - paddingX: 56, - }, + h3: { + fontSize: 24, + fontWeight: 600, + lineHeight: '150%', + '@media (max-width:900px)': { + fontSize: 20, + fontWeight: 500, + lineHeight: '160%', + letterSpacing: '0.15px', }, }, - }, - MuiTooltip: { - styleOverrides: { - tooltip: { - backgroundColor: colorPalette.secondary.main, - color: colorPalette.whiteSolid, - }, - arrow: { - color: colorPalette.secondary.main, - }, + h4: { + fontSize: 20, + fontWeight: 500, }, - }, - MuiIconButton: { - styleOverrides: { - sizeMedium: { - color: colorPalette.primary.main, - }, + h5: { + fontSize: 18, + fontWeight: 600, + lineHeight: '160%', + letterSpacing: '0.15px', + }, + h6: { + fontSize: 20, + fontWeight: 500, + }, + body1: { + fontSize: 16, + fontWeight: 400, + lineHeight: '150%', + letterSpacing: '0.15px', + }, + body2: { + fontSize: 14, + fontWeight: 400, + lineHeight: '20px', + letterSpacing: '0.17px', + }, + body3: { + fontSize: '12px', + fontWeight: 400, + lineHeight: '19.92px', + letterSpacing: '0.4px', + }, + subtitle1: { + fontSize: 16, + fontWeight: 400, + lineHeight: '175%', + letterSpacing: '0.15px', + }, + subtitle2: { + fontSize: 14, + fontWeight: 600, + lineHeight: '21.9px', + letterSpacing: '0.1px', + }, + caption: { + fontSize: 12, + fontWeight: 400, + lineHeight: 5 / 3, + letterSpacing: 0.4, + }, + tooltip: { + fontSize: 10, + fontWeight: 500, + lineHeight: '14px', }, }, - MuiSelect: { - styleOverrides: { - root: { - borderRadius: 4, - borderWidth: 2, - color: colorPalette.primary.main, - '& .MuiOutlinedInput-notchedOutline': { - borderColor: colorPalette.primary.main, - borderWidth: 2, + shadows: [ + ...createTheme({}).shadows.map((shadow, i) => { + if (i === 2) { + return '0px 3px 1px -2px #e9ebfa, 0px 2px 2px 0px rgba(233, 235, 250, 0.50), 0px 1px 5px 0px rgba(233, 235, 250, 0.20)'; + } + return shadow; + }), + ] as Shadows, + components: { + MuiButton: { + styleOverrides: { + root: { + fontWeight: 600, + letterSpacing: '0.1px', + textTransform: 'none', }, - '&:hover .MuiOutlinedInput-notchedOutline': { - borderColor: colorPalette.primary.main, + sizeSmall: { + padding: '4px 10px', + fontSize: '13px', + lineHeight: '22px', }, - '&.Mui-focused .MuiOutlinedInput-notchedOutline': { - borderColor: colorPalette.primary.main, + sizeMedium: { + padding: '6px 16px', + fontSize: '14px', + lineHeight: '24px', }, - '& .MuiSvgIcon-root': { - color: colorPalette.primary.main, + sizeLarge: { + padding: '8px 22px', + fontSize: '15px', + lineHeight: '26px', }, }, }, - }, - MuiTypography: { - styleOverrides: { - root: { - wordBreak: 'break-word', + MuiChip: { + styleOverrides: { + root: { + padding: '4px', + borderRadius: 16, + }, + label: { + fontFamily: 'Roboto', + padding: '3px 6px', + fontSize: '13px', + lineHeight: '18px', + letterSpacing: '0.16px', + fontWeight: 400, + }, }, }, - }, - MuiOutlinedInput: { - styleOverrides: { - root: { - backgroundColor: colorPalette.white, + MuiTooltip: { + styleOverrides: { + tooltip: ({ theme }) => ({ + backgroundColor: theme.palette.secondary.main, + color: theme.palette.white.light, + }), + arrow: ({ theme }) => ({ + color: theme.palette.secondary.main, + }), }, }, - }, - MuiMenuItem: { - styleOverrides: { - root: { - '&:hover': { - backgroundColor: '#1406B207', - }, + MuiIconButton: { + styleOverrides: { + sizeMedium: ({ theme }) => ({ + color: theme.palette.primary.main, + }), }, }, - }, - MuiTablePagination: { - styleOverrides: { - toolbar: { - '@media (max-width: 440px)': { - display: 'grid', - gridTemplateColumns: '1fr 3fr 2fr', - gridTemplateRows: 'auto auto', - gridAutoFlow: 'row', - }, + MuiSelect: { + styleOverrides: { + root: ({ theme }) => ({ + borderRadius: 4, + borderWidth: 2, + color: theme.palette.primary.main, + '& .MuiOutlinedInput-notchedOutline': { + borderColor: theme.palette.primary.main, + borderWidth: 2, + }, + '&:hover .MuiOutlinedInput-notchedOutline': { + borderColor: theme.palette.primary.main, + }, + '&.Mui-focused .MuiOutlinedInput-notchedOutline': { + borderColor: theme.palette.primary.main, + }, + '& .MuiSvgIcon-root': { + color: theme.palette.primary.main, + }, + }), }, - selectLabel: { - '@media (max-width: 440px)': { - gridColumn: '2 / 3', - gridRow: '1', - whiteSpace: 'nowrap', - color: colorPalette.fog.main, - justifySelf: 'end', - marginBottom: '17px', - position: 'relative', - right: '-38px', - }, - '&:focus': { - background: 'inherit', + }, + MuiTypography: { + styleOverrides: { + root: { + wordBreak: 'break-word', }, }, - input: { - '@media (max-width: 440px)': { - gridColumn: '3 / 3', - gridRow: '1', - marginRight: '8px', - width: '48px', - justifySelf: 'flex-end', - }, + }, + MuiOutlinedInput: { + styleOverrides: { + root: ({ theme }) => ({ + backgroundColor: theme.palette.white.contrastText, + }), }, - select: { - '&:focus': { - background: 'inherit', + }, + MuiMenuItem: { + styleOverrides: { + root: { + '&:hover': { + backgroundColor: '#1406B207', + }, }, }, - displayedRows: { - '@media (max-width: 440px)': { - gridColumn: '2 / 3', - gridRow: '2', - justifySelf: 'end', - position: 'relative', - right: '-12px', + }, + MuiTableHead: { + styleOverrides: { + root: { + '& .MuiTableCell-root': { + fontFamily: 'Roboto', + fontSize: '14px', + fontWeight: 500, + lineHeight: '24px', + letterSpacing: '0.17px', + }, }, }, - actions: { - '@media (max-width: 440px)': { - gridColumn: '3 / 3', - gridRow: '2', - justifySelf: 'end', - marginLeft: 0, - minWidth: '90px', + }, + MuiTablePagination: { + styleOverrides: { + toolbar: { + '@media (max-width: 440px)': { + display: 'grid', + gridTemplateColumns: '1fr 3fr 2fr', + gridTemplateRows: 'auto auto', + gridAutoFlow: 'row', + }, }, - button: { - marginLeft: '5px', + selectLabel: ({ theme }) => ({ + '@media (max-width: 440px)': { + gridColumn: '2 / 3', + gridRow: '1', + whiteSpace: 'nowrap', + color: theme.palette.fog.main, + justifySelf: 'end', + marginBottom: '17px', + position: 'relative', + right: '-38px', + }, + '&:focus': { + background: 'inherit', + }, + }), + input: { + '@media (max-width: 440px)': { + gridColumn: '3 / 3', + gridRow: '1', + marginRight: '8px', + width: '48px', + justifySelf: 'flex-end', + }, }, - }, - }, - }, - MuiLink: { - styleOverrides: { - root: { - color: colorPalette.link, - '&:hover': { - color: `${colorPalette.linkHover}!important`, + select: { + '&:focus': { + background: 'inherit', + }, }, - '&:visited': { - color: colorPalette.linkVisited, + displayedRows: { + '@media (max-width: 440px)': { + gridColumn: '2 / 3', + gridRow: '2', + justifySelf: 'end', + position: 'relative', + right: '-12px', + }, }, + actions: { + '@media (max-width: 440px)': { + gridColumn: '3 / 3', + gridRow: '2', + justifySelf: 'end', + marginLeft: 0, + minWidth: '90px', + }, + button: { + marginLeft: '5px', + }, + }, + }, + }, + MuiLink: { + styleOverrides: { + root: ({ theme }) => ({ + color: theme.palette.link.main, + '&:hover': { + color: theme.palette.link.hover, + }, + '&:visited': { + color: theme.palette.link.visited, + }, + }), }, }, }, - }, -}); - -export default theme; + }); +}; From 606bec1cf36eaaa4670df3fd5ecc1f911d8c6d4d Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Fri, 13 Jun 2025 12:09:04 +0300 Subject: [PATCH 13/21] [Reputation Oracle] refactor: use module ref for factory method (#3390) --- .../escrow-completion.service.ts | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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 d0a4cdd285..a61c4f351f 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 @@ -7,6 +7,7 @@ import { OperatorUtils, } from '@human-protocol/sdk'; import { Injectable } from '@nestjs/common'; +import { ModuleRef } from '@nestjs/core'; import crypto from 'crypto'; import { ethers } from 'ethers'; @@ -60,12 +61,7 @@ export class EscrowCompletionService { private readonly storageService: StorageService, private readonly outgoingWebhookService: OutgoingWebhookService, private readonly reputationService: ReputationService, - private readonly audinoResultsProcessor: AudinoResultsProcessor, - private readonly cvatResultsProcessor: CvatResultsProcessor, - private readonly fortuneResultsProcessor: FortuneResultsProcessor, - private readonly audinoPayoutsCalculator: AudinoPayoutsCalculator, - private readonly cvatPayoutsCalculator: CvatPayoutsCalculator, - private readonly fortunePayoutsCalculator: FortunePayoutsCalculator, + private readonly moduleRef: ModuleRef, ) {} async createEscrowCompletion( @@ -441,15 +437,15 @@ export class EscrowCompletionService { jobRequestType: JobRequestType, ): EscrowResultsProcessor { if (manifestUtils.isFortuneJobType(jobRequestType)) { - return this.fortuneResultsProcessor; + return this.moduleRef.get(FortuneResultsProcessor); } if (manifestUtils.isCvatJobType(jobRequestType)) { - return this.cvatResultsProcessor; + return this.moduleRef.get(CvatResultsProcessor); } if (manifestUtils.isAudinoJobType(jobRequestType)) { - return this.audinoResultsProcessor; + return this.moduleRef.get(AudinoResultsProcessor); } throw new Error( @@ -461,15 +457,15 @@ export class EscrowCompletionService { jobRequestType: JobRequestType, ): EscrowPayoutsCalculator { if (manifestUtils.isFortuneJobType(jobRequestType)) { - return this.fortunePayoutsCalculator; + return this.moduleRef.get(FortunePayoutsCalculator); } if (manifestUtils.isCvatJobType(jobRequestType)) { - return this.cvatPayoutsCalculator; + return this.moduleRef.get(CvatPayoutsCalculator); } if (manifestUtils.isAudinoJobType(jobRequestType)) { - return this.audinoPayoutsCalculator; + return this.moduleRef.get(AudinoPayoutsCalculator); } throw new Error( From 0dd061291920a2a24ab06d8160e8c9a401596b85 Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Fri, 13 Jun 2025 14:28:00 +0300 Subject: [PATCH 14/21] [Reputation Oracle] fix: logger mock (#3393) --- .../apps/reputation-oracle/server/src/logger/__mocks__/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apps/reputation-oracle/server/src/logger/__mocks__/index.ts b/packages/apps/reputation-oracle/server/src/logger/__mocks__/index.ts index fffaf78cd1..f4017058d8 100644 --- a/packages/apps/reputation-oracle/server/src/logger/__mocks__/index.ts +++ b/packages/apps/reputation-oracle/server/src/logger/__mocks__/index.ts @@ -1,7 +1,7 @@ import { Logger } from '../types'; const logger: Logger = { - child: jest.fn(() => logger), + child: () => logger, info: jest.fn(), debug: jest.fn(), error: jest.fn(), From 9da418b6962e251427442717195921599d2815f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Fri, 13 Jun 2025 16:53:29 +0200 Subject: [PATCH 15/21] [SDK] Improve transactions filters (#3384) --- docs/sdk/python/human_protocol_sdk.filter.md | 11 +- ...tocol_sdk.transaction.transaction_utils.md | 3 + .../base/classes/BaseEthersClient.md | 14 +- .../encryption/classes/Encryption.md | 24 +-- .../encryption/classes/EncryptionUtils.md | 18 +- .../typescript/enums/enumerations/ChainId.md | 18 +- .../enums/enumerations/OperatorCategory.md | 6 +- .../enums/enumerations/OrderDirection.md | 6 +- .../typescript/escrow/classes/EscrowClient.md | 90 +++++----- .../typescript/escrow/classes/EscrowUtils.md | 32 ++-- docs/sdk/typescript/graphql/types/README.md | 1 - .../types/type-aliases/DailyEscrowData.md | 28 ++- .../types/type-aliases/DailyHMTData.md | 24 ++- .../types/type-aliases/DailyPaymentData.md | 20 ++- .../types/type-aliases/DailyTaskData.md | 16 +- .../types/type-aliases/DailyWorkerData.md | 12 +- .../graphql/types/type-aliases/EscrowData.md | 80 ++++++++- .../types/type-aliases/EscrowStatistics.md | 12 +- .../type-aliases/EscrowStatisticsData.md | 44 ++++- .../types/type-aliases/EventDayData.md | 76 ++++++++- .../graphql/types/type-aliases/HMTHolder.md | 12 +- .../types/type-aliases/HMTHolderData.md | 12 +- .../types/type-aliases/HMTStatistics.md | 16 +- .../types/type-aliases/HMTStatisticsData.md | 28 ++- .../graphql/types/type-aliases/IMData.md | 4 +- .../types/type-aliases/IMDataEntity.md | 12 +- .../graphql/types/type-aliases/KVStoreData.md | 28 ++- .../types/type-aliases/PaymentStatistics.md | 8 +- .../graphql/types/type-aliases/PayoutData.md | 33 ---- .../type-aliases/RewardAddedEventData.md | 20 ++- .../graphql/types/type-aliases/StatusEvent.md | 20 ++- .../types/type-aliases/TaskStatistics.md | 8 +- .../types/type-aliases/WorkerStatistics.md | 8 +- docs/sdk/typescript/interfaces/README.md | 1 + .../interfaces/interfaces/IEscrow.md | 161 ++++++++++++++++++ .../interfaces/interfaces/IEscrowConfig.md | 18 +- .../interfaces/interfaces/IEscrowsFilter.md | 26 +-- .../interfaces/IHMTHoldersParams.md | 10 +- .../interfaces/interfaces/IKVStore.md | 6 +- .../interfaces/interfaces/IKeyPair.md | 10 +- .../interfaces/interfaces/IOperator.md | 46 ++--- .../interfaces/IOperatorSubgraph.md | 44 ++--- .../interfaces/interfaces/IOperatorsFilter.md | 16 +- .../interfaces/interfaces/IPagination.md | 8 +- .../interfaces/interfaces/IPayoutFilter.md | 18 +- .../interfaces/IReputationNetwork.md | 8 +- .../interfaces/IReputationNetworkSubgraph.md | 8 +- .../interfaces/interfaces/IReward.md | 6 +- .../interfaces/IStatisticsFilter.md | 12 +- .../interfaces/IStatusEventFilter.md | 18 +- .../interfaces/interfaces/ITransaction.md | 24 +-- .../interfaces/ITransactionsFilter.md | 46 +++-- .../interfaces/interfaces/IWorker.md | 10 +- .../interfaces/interfaces/IWorkersFilter.md | 14 +- .../interfaces/InternalTransaction.md | 16 +- .../interfaces/interfaces/StakerInfo.md | 10 +- .../kvstore/classes/KVStoreClient.md | 38 ++--- .../kvstore/classes/KVStoreUtils.md | 16 +- .../operator/classes/OperatorUtils.md | 18 +- .../staking/classes/StakingClient.md | 54 +++--- .../statistics/classes/StatisticsClient.md | 26 +-- .../storage/classes/StorageClient.md | 20 +-- .../transaction/classes/TransactionUtils.md | 39 ++++- .../types/enumerations/EscrowStatus.md | 14 +- .../types/type-aliases/EscrowCancel.md | 12 +- .../types/type-aliases/EscrowWithdraw.md | 16 +- .../types/type-aliases/NetworkData.md | 48 +++++- .../typescript/types/type-aliases/Payout.md | 24 ++- .../types/type-aliases/StorageCredentials.md | 20 ++- .../types/type-aliases/StorageParams.md | 28 ++- .../type-aliases/TransactionLikeWithNonce.md | 4 +- .../types/type-aliases/UploadFile.md | 16 +- .../src/modules/job/job.service.spec.ts | 4 +- .../human_protocol_sdk/filter.py | 15 ++ .../human_protocol_sdk/gql/transaction.py | 9 + .../transaction/transaction_utils.py | 6 + .../transaction/test_transaction_utils.py | 6 + .../human-protocol-sdk/src/escrow.ts | 19 +-- .../src/graphql/queries/transaction.ts | 19 ++- .../human-protocol-sdk/src/graphql/types.ts | 8 - .../human-protocol-sdk/src/interfaces.ts | 25 +++ .../human-protocol-sdk/src/transaction.ts | 30 +++- .../test/transaction.test.ts | 120 +++++++++++++ 83 files changed, 1399 insertions(+), 535 deletions(-) delete mode 100644 docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md create mode 100644 docs/sdk/typescript/interfaces/interfaces/IEscrow.md diff --git a/docs/sdk/python/human_protocol_sdk.filter.md b/docs/sdk/python/human_protocol_sdk.filter.md index ae0d301983..a4b2004a2d 100644 --- a/docs/sdk/python/human_protocol_sdk.filter.md +++ b/docs/sdk/python/human_protocol_sdk.filter.md @@ -96,13 +96,13 @@ Initializes a filter for status events. * **skip** (`int`) – Optional number of events to skip. Default is 0. * **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Optional order direction. Default is DESC. -### *class* human_protocol_sdk.filter.TransactionFilter(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, first=10, skip=0, order_direction=OrderDirection.DESC) +### *class* human_protocol_sdk.filter.TransactionFilter(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, method=None, escrow=None, token=None, first=10, skip=0, order_direction=OrderDirection.DESC) Bases: `object` A class used to filter transactions. -#### \_\_init_\_(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, first=10, skip=0, order_direction=OrderDirection.DESC) +#### \_\_init_\_(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, method=None, escrow=None, token=None, first=10, skip=0, order_direction=OrderDirection.DESC) Initializes a TransactionsFilter instance. @@ -114,19 +114,22 @@ Initializes a TransactionsFilter instance. * **end_date** (`Optional`[`datetime`]) – End date for filtering transactions * **start_block** (`Optional`[`int`]) – Start block number for filtering transactions * **end_block** (`Optional`[`int`]) – End block number for filtering transactions + * **method** (`Optional`[`str`]) – Method name to filter transactions + * **escrow** (`Optional`[`str`]) – Escrow address to filter transactions + * **token** (`Optional`[`str`]) – Token address to filter transactions * **first** (`int`) – Number of items per page * **skip** (`int`) – Page number to retrieve * **order** – Order of results, “asc” or “desc” * **Raises:** **ValueError** – If start_date is after end_date -### *class* human_protocol_sdk.filter.WorkerFilter(chain_id, worker_address=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0) +### *class* human_protocol_sdk.filter.WorkerFilter(chain_id, worker_address=None, order_by='payoutCount', order_direction=OrderDirection.DESC, first=10, skip=0) Bases: `object` A class used to filter workers. -#### \_\_init_\_(chain_id, worker_address=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0) +#### \_\_init_\_(chain_id, worker_address=None, order_by='payoutCount', order_direction=OrderDirection.DESC, first=10, skip=0) Initializes a WorkerFilter instance. diff --git a/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md b/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md index 7b31e4ea65..b982ca0071 100644 --- a/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md +++ b/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md @@ -71,6 +71,7 @@ Get an array of transactions based on the specified filter parameters. * **Parameters:** **filter** ([`TransactionFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter)) – Object containing all the necessary parameters to filter + (chain_id, from_address, to_address, start_date, end_date, start_block, end_block, method, escrow, token, first, skip, order_direction) * **Return type:** `List`[[`TransactionData`](#human_protocol_sdk.transaction.transaction_utils.TransactionData)] * **Returns:** @@ -86,6 +87,8 @@ Get an array of transactions based on the specified filter parameters. chain_id=ChainId.POLYGON_AMOY, from_address="0x1234567890123456789012345678901234567890", to_address="0x0987654321098765432109876543210987654321", + method="transfer", + escrow="0x0987654321098765432109876543210987654321", start_date=datetime.datetime(2023, 5, 8), end_date=datetime.datetime(2023, 6, 8), ) diff --git a/docs/sdk/typescript/base/classes/BaseEthersClient.md b/docs/sdk/typescript/base/classes/BaseEthersClient.md index a0277ae359..5c2cee8710 100644 --- a/docs/sdk/typescript/base/classes/BaseEthersClient.md +++ b/docs/sdk/typescript/base/classes/BaseEthersClient.md @@ -6,7 +6,7 @@ # Class: `abstract` BaseEthersClient -Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10) +Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10) ## Introduction @@ -20,11 +20,11 @@ This class is used as a base class for other clients making on-chain calls. ## Constructors -### new BaseEthersClient() +### Constructor -> **new BaseEthersClient**(`runner`, `networkData`): [`BaseEthersClient`](BaseEthersClient.md) +> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient` -Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) +Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) **BaseClient constructor** @@ -44,7 +44,7 @@ The network information required to connect to the contracts #### Returns -[`BaseEthersClient`](BaseEthersClient.md) +`BaseEthersClient` ## Properties @@ -52,7 +52,7 @@ The network information required to connect to the contracts > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -60,4 +60,4 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/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 822c353959..855fb08e3a 100644 --- a/docs/sdk/typescript/encryption/classes/Encryption.md +++ b/docs/sdk/typescript/encryption/classes/Encryption.md @@ -6,7 +6,7 @@ # Class: Encryption -Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58) +Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58) ## Introduction @@ -49,11 +49,11 @@ const encryption = await Encryption.build(privateKey, passphrase); ## Constructors -### new Encryption() +### Constructor -> **new Encryption**(`privateKey`): [`Encryption`](Encryption.md) +> **new Encryption**(`privateKey`): `Encryption` -Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66) +Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66) Constructor for the Encryption class. @@ -67,15 +67,15 @@ The private key. #### Returns -[`Encryption`](Encryption.md) +`Encryption` ## Methods ### decrypt() -> **decrypt**(`message`, `publicKey`?): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> +> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194) +Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194) This function decrypts messages using the private key. In addition, the public key can be added for signature verification. @@ -129,7 +129,7 @@ const resultMessage = await encryption.decrypt('message'); > **sign**(`message`): `Promise`\<`string`\> -Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251) +Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251) This function signs a message using the private key used to initialize the client. @@ -165,7 +165,7 @@ const resultMessage = await encryption.sign('message'); > **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\> -Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142) +Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142) This function signs and encrypts a message using the private key used to initialize the client and the specified public keys. @@ -230,9 +230,9 @@ const resultMessage = await encryption.signAndEncrypt('message', publicKeys); ### build() -> `static` **build**(`privateKeyArmored`, `passphrase`?): `Promise`\<[`Encryption`](Encryption.md)\> +> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\> -Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77) +Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77) Builds an Encryption instance by decrypting the private key from an encrypted private key and passphrase. @@ -252,6 +252,6 @@ Optional: The passphrase for the private key. #### Returns -`Promise`\<[`Encryption`](Encryption.md)\> +`Promise`\<`Encryption`\> - The Encryption instance. diff --git a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md index 8d1127cea6..5d6ccebad6 100644 --- a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md +++ b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md @@ -6,7 +6,7 @@ # Class: EncryptionUtils -Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290) +Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290) ## Introduction @@ -34,13 +34,13 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai'); ## Constructors -### new EncryptionUtils() +### Constructor -> **new EncryptionUtils**(): [`EncryptionUtils`](EncryptionUtils.md) +> **new EncryptionUtils**(): `EncryptionUtils` #### Returns -[`EncryptionUtils`](EncryptionUtils.md) +`EncryptionUtils` ## Methods @@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai'); > `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\> -Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444) +Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444) This function encrypts a message using the specified public keys. @@ -111,7 +111,7 @@ const result = await EncryptionUtils.encrypt('message', publicKeys); > `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\> -Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382) +Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382) This function generates a key pair for encryption and decryption. @@ -158,7 +158,7 @@ const result = await EncryptionUtils.generateKeyPair(name, email, passphrase); > `static` **getSignedData**(`message`): `Promise`\<`string`\> -Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351) +Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351) This function gets signed data from a signed message. @@ -190,7 +190,7 @@ const signedData = await EncryptionUtils.getSignedData('message'); > `static` **isEncrypted**(`message`): `boolean` -Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494) +Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494) Verifies if a message appears to be encrypted with OpenPGP. @@ -238,7 +238,7 @@ if (isEncrypted) { > `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\> -Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318) +Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318) This function verifies the signature of a signed message using the public key. diff --git a/docs/sdk/typescript/enums/enumerations/ChainId.md b/docs/sdk/typescript/enums/enumerations/ChainId.md index 5627a76ac9..a2235c354d 100644 --- a/docs/sdk/typescript/enums/enumerations/ChainId.md +++ b/docs/sdk/typescript/enums/enumerations/ChainId.md @@ -6,7 +6,7 @@ # Enumeration: ChainId -Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1) +Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/1f > **ALL**: `-1` -Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) +Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) *** @@ -22,7 +22,7 @@ Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/1f > **BSC\_MAINNET**: `56` -Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) +Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) *** @@ -30,7 +30,7 @@ Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/1f > **BSC\_TESTNET**: `97` -Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) +Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) *** @@ -38,7 +38,7 @@ Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/1f > **LOCALHOST**: `1338` -Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) +Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) *** @@ -46,7 +46,7 @@ Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/1f > **MAINNET**: `1` -Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) +Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) *** @@ -54,7 +54,7 @@ Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/1f > **POLYGON**: `137` -Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) +Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) *** @@ -62,7 +62,7 @@ Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/1f > **POLYGON\_AMOY**: `80002` -Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) +Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) *** @@ -70,4 +70,4 @@ Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/1f > **SEPOLIA**: `11155111` -Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) +Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) diff --git a/docs/sdk/typescript/enums/enumerations/OperatorCategory.md b/docs/sdk/typescript/enums/enumerations/OperatorCategory.md index 3d5d13af20..23cb8e00be 100644 --- a/docs/sdk/typescript/enums/enumerations/OperatorCategory.md +++ b/docs/sdk/typescript/enums/enumerations/OperatorCategory.md @@ -6,7 +6,7 @@ # Enumeration: OperatorCategory -Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) +Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/1 > **MACHINE\_LEARNING**: `"machine_learning"` -Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) +Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) *** @@ -22,4 +22,4 @@ Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/1 > **MARKET\_MAKING**: `"market_making"` -Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) +Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) diff --git a/docs/sdk/typescript/enums/enumerations/OrderDirection.md b/docs/sdk/typescript/enums/enumerations/OrderDirection.md index e980964850..db020df8cf 100644 --- a/docs/sdk/typescript/enums/enumerations/OrderDirection.md +++ b/docs/sdk/typescript/enums/enumerations/OrderDirection.md @@ -6,7 +6,7 @@ # Enumeration: OrderDirection -Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) +Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/1 > **ASC**: `"asc"` -Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) +Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) *** @@ -22,4 +22,4 @@ Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/1 > **DESC**: `"desc"` -Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) +Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) diff --git a/docs/sdk/typescript/escrow/classes/EscrowClient.md b/docs/sdk/typescript/escrow/classes/EscrowClient.md index 445e354d15..d948de813e 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowClient.md +++ b/docs/sdk/typescript/escrow/classes/EscrowClient.md @@ -6,7 +6,7 @@ # Class: EscrowClient -Defined in: [escrow.ts:141](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L141) +Defined in: [escrow.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L142) ## Introduction @@ -82,11 +82,11 @@ const escrowClient = await EscrowClient.build(provider); ## Constructors -### new EscrowClient() +### Constructor -> **new EscrowClient**(`runner`, `networkData`): [`EscrowClient`](EscrowClient.md) +> **new EscrowClient**(`runner`, `networkData`): `EscrowClient` -Defined in: [escrow.ts:150](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L150) +Defined in: [escrow.ts:151](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L151) **EscrowClient constructor** @@ -106,11 +106,11 @@ The network information required to connect to the Escrow contract #### Returns -[`EscrowClient`](EscrowClient.md) +`EscrowClient` #### Overrides -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructors) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructor) ## Properties @@ -118,11 +118,11 @@ The network information required to connect to the Escrow contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata) *** @@ -130,19 +130,19 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner) ## Methods ### addTrustedHandlers() -> **addTrustedHandlers**(`escrowAddress`, `trustedHandlers`, `txOptions`?): `Promise`\<`void`\> +> **addTrustedHandlers**(`escrowAddress`, `trustedHandlers`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:778](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L778) +Defined in: [escrow.ts:779](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L779) This function adds an array of addresses to the trusted handlers list. @@ -195,9 +195,9 @@ await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309 ### bulkPayOut() -> **bulkPayOut**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions`?): `Promise`\<`void`\> +> **bulkPayOut**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:611](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L611) +Defined in: [escrow.ts:612](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L612) This function pays out the amounts specified to the workers and sets the URL of the final results file. @@ -285,9 +285,9 @@ await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', reci ### cancel() -> **cancel**(`escrowAddress`, `txOptions`?): `Promise`\<[`EscrowCancel`](../../types/type-aliases/EscrowCancel.md)\> +> **cancel**(`escrowAddress`, `txOptions?`): `Promise`\<[`EscrowCancel`](../../types/type-aliases/EscrowCancel.md)\> -Defined in: [escrow.ts:692](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L692) +Defined in: [escrow.ts:693](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L693) This function cancels the specified escrow and sends the balance to the canceler. @@ -333,9 +333,9 @@ await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); ### complete() -> **complete**(`escrowAddress`, `txOptions`?): `Promise`\<`void`\> +> **complete**(`escrowAddress`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:550](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L550) +Defined in: [escrow.ts:551](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L551) This function sets the status of an escrow to completed. @@ -381,9 +381,9 @@ await escrowClient.complete('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); ### createBulkPayoutTransaction() -> **createBulkPayoutTransaction**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions`?): `Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> +> **createBulkPayoutTransaction**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions?`): `Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> -Defined in: [escrow.ts:947](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L947) +Defined in: [escrow.ts:948](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L948) Creates a prepared transaction for bulk payout without immediately sending it. @@ -475,9 +475,9 @@ console.log('Tx hash:', ethers.keccak256(signedTransaction)); ### createEscrow() -> **createEscrow**(`tokenAddress`, `trustedHandlers`, `jobRequesterId`, `txOptions`?): `Promise`\<`string`\> +> **createEscrow**(`tokenAddress`, `trustedHandlers`, `jobRequesterId`, `txOptions?`): `Promise`\<`string`\> -Defined in: [escrow.ts:230](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L230) +Defined in: [escrow.ts:231](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L231) This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers. @@ -538,9 +538,9 @@ const escrowAddress = await escrowClient.createEscrow(tokenAddress, trustedHandl ### fund() -> **fund**(`escrowAddress`, `amount`, `txOptions`?): `Promise`\<`void`\> +> **fund**(`escrowAddress`, `amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:421](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L421) +Defined in: [escrow.ts:422](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L422) This function adds funds of the chosen token to the escrow. @@ -593,7 +593,7 @@ await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount); > **getBalance**(`escrowAddress`): `Promise`\<`bigint`\> -Defined in: [escrow.ts:1092](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1092) +Defined in: [escrow.ts:1093](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1093) This function returns the balance for a specified escrow address. @@ -631,7 +631,7 @@ const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e > **getExchangeOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1478](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1478) +Defined in: [escrow.ts:1479](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1479) This function returns the exchange oracle address for a given escrow. @@ -669,7 +669,7 @@ const oracleAddress = await escrowClient.getExchangeOracleAddress('0x62dD51230A3 > **getFactoryAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1516](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1516) +Defined in: [escrow.ts:1517](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1517) This function returns the escrow factory address for a given escrow. @@ -707,7 +707,7 @@ const factoryAddress = await escrowClient.getFactoryAddress('0x62dD51230A30401C4 > **getIntermediateResultsUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1250](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1250) +Defined in: [escrow.ts:1251](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1251) This function returns the intermediate results file URL. @@ -745,7 +745,7 @@ const intermediateResultsUrl = await escrowClient.getIntermediateResultsUrl('0x6 > **getJobLauncherAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1402](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1402) +Defined in: [escrow.ts:1403](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1403) This function returns the job launcher address for a given escrow. @@ -783,7 +783,7 @@ const jobLauncherAddress = await escrowClient.getJobLauncherAddress('0x62dD51230 > **getManifestHash**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1136](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1136) +Defined in: [escrow.ts:1137](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1137) This function returns the manifest file hash. @@ -821,7 +821,7 @@ const manifestHash = await escrowClient.getManifestHash('0x62dD51230A30401C455c8 > **getManifestUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1174](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1174) +Defined in: [escrow.ts:1175](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1175) This function returns the manifest file URL. @@ -859,7 +859,7 @@ const manifestUrl = await escrowClient.getManifestUrl('0x62dD51230A30401C455c839 > **getRecordingOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1364](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1364) +Defined in: [escrow.ts:1365](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1365) This function returns the recording oracle address for a given escrow. @@ -897,7 +897,7 @@ const oracleAddress = await escrowClient.getRecordingOracleAddress('0x62dD51230A > **getReputationOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1440](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1440) +Defined in: [escrow.ts:1441](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1441) This function returns the reputation oracle address for a given escrow. @@ -935,7 +935,7 @@ const oracleAddress = await escrowClient.getReputationOracleAddress('0x62dD51230 > **getResultsUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1212](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1212) +Defined in: [escrow.ts:1213](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1213) This function returns the results file URL. @@ -973,7 +973,7 @@ const resultsUrl = await escrowClient.getResultsUrl('0x62dD51230A30401C455c8398d > **getStatus**(`escrowAddress`): `Promise`\<[`EscrowStatus`](../../types/enumerations/EscrowStatus.md)\> -Defined in: [escrow.ts:1326](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1326) +Defined in: [escrow.ts:1327](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1327) This function returns the current status of the escrow. @@ -1011,7 +1011,7 @@ const status = await escrowClient.getStatus('0x62dD51230A30401C455c8398d06F85e4E > **getTokenAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1288](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1288) +Defined in: [escrow.ts:1289](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1289) This function returns the token address used for funding the escrow. @@ -1047,9 +1047,9 @@ const tokenAddress = await escrowClient.getTokenAddress('0x62dD51230A30401C455c8 ### setup() -> **setup**(`escrowAddress`, `escrowConfig`, `txOptions`?): `Promise`\<`void`\> +> **setup**(`escrowAddress`, `escrowConfig`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:311](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L311) +Defined in: [escrow.ts:312](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L312) This function sets up the parameters of the escrow. @@ -1112,9 +1112,9 @@ await escrowClient.setup(escrowAddress, escrowConfig); ### storeResults() -> **storeResults**(`escrowAddress`, `url`, `hash`, `txOptions`?): `Promise`\<`void`\> +> **storeResults**(`escrowAddress`, `url`, `hash`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:486](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L486) +Defined in: [escrow.ts:487](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L487) This function stores the results URL and hash. @@ -1172,9 +1172,9 @@ await escrowClient.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'h ### withdraw() -> **withdraw**(`escrowAddress`, `tokenAddress`, `txOptions`?): `Promise`\<[`EscrowWithdraw`](../../types/type-aliases/EscrowWithdraw.md)\> +> **withdraw**(`escrowAddress`, `tokenAddress`, `txOptions?`): `Promise`\<[`EscrowWithdraw`](../../types/type-aliases/EscrowWithdraw.md)\> -Defined in: [escrow.ts:844](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L844) +Defined in: [escrow.ts:845](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L845) This function withdraws additional tokens in the escrow to the canceler. @@ -1229,9 +1229,9 @@ await escrowClient.withdraw( ### build() -> `static` **build**(`runner`): `Promise`\<[`EscrowClient`](EscrowClient.md)\> +> `static` **build**(`runner`): `Promise`\<`EscrowClient`\> -Defined in: [escrow.ts:168](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L168) +Defined in: [escrow.ts:169](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L169) Creates an instance of EscrowClient from a Runner. @@ -1245,7 +1245,7 @@ The Runner object to interact with the Ethereum network #### Returns -`Promise`\<[`EscrowClient`](EscrowClient.md)\> +`Promise`\<`EscrowClient`\> An instance of EscrowClient diff --git a/docs/sdk/typescript/escrow/classes/EscrowUtils.md b/docs/sdk/typescript/escrow/classes/EscrowUtils.md index 7622cb9120..e87c7fb10f 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowUtils.md +++ b/docs/sdk/typescript/escrow/classes/EscrowUtils.md @@ -6,7 +6,7 @@ # Class: EscrowUtils -Defined in: [escrow.ts:1565](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1565) +Defined in: [escrow.ts:1566](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1566) ## Introduction @@ -40,21 +40,21 @@ const escrowAddresses = new EscrowUtils.getEscrows({ ## Constructors -### new EscrowUtils() +### Constructor -> **new EscrowUtils**(): [`EscrowUtils`](EscrowUtils.md) +> **new EscrowUtils**(): `EscrowUtils` #### Returns -[`EscrowUtils`](EscrowUtils.md) +`EscrowUtils` ## Methods ### getEscrow() -> `static` **getEscrow**(`chainId`, `escrowAddress`): `Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)\> +> `static` **getEscrow**(`chainId`, `escrowAddress`): `Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)\> -Defined in: [escrow.ts:1780](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1780) +Defined in: [escrow.ts:1779](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1779) This function returns the escrow data for a given address. @@ -76,7 +76,7 @@ enum ChainId { ``` ```ts -type EscrowData = { +interface IEscrow { id: string; address: string; amountPaid: string; @@ -115,7 +115,7 @@ Address of the escrow #### Returns -`Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)\> +`Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)\> Escrow data @@ -124,16 +124,16 @@ Escrow data ```ts import { ChainId, EscrowUtils } from '@human-protocol/sdk'; -const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890"); +const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890"); ``` *** ### getEscrows() -> `static` **getEscrows**(`filter`): `Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)[]\> +> `static` **getEscrows**(`filter`): `Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)[]\> -Defined in: [escrow.ts:1662](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1662) +Defined in: [escrow.ts:1663](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1663) This function returns an array of escrows based on the specified filter parameters. @@ -188,7 +188,7 @@ enum EscrowStatus { ``` ```ts -type EscrowData = { +interface IEscrow { id: string; address: string; amountPaid: string; @@ -221,7 +221,7 @@ Filter parameters. #### Returns -`Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)[]\> +`Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)[]\> List of escrows that match the filter. @@ -236,7 +236,7 @@ const filters: IEscrowsFilter = { to: new Date(2023, 5, 8), chainId: ChainId.POLYGON_AMOY }; -const escrowDatas = await EscrowUtils.getEscrows(filters); +const escrows = await EscrowUtils.getEscrows(filters); ``` *** @@ -245,7 +245,7 @@ const escrowDatas = await EscrowUtils.getEscrows(filters); > `static` **getPayouts**(`filter`): `Promise`\<[`Payout`](../../types/type-aliases/Payout.md)[]\> -Defined in: [escrow.ts:1950](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1950) +Defined in: [escrow.ts:1949](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1949) This function returns the payouts for a given set of networks. @@ -289,7 +289,7 @@ console.log(payouts); > `static` **getStatusEvents**(`filter`): `Promise`\<[`StatusEvent`](../../graphql/types/type-aliases/StatusEvent.md)[]\> -Defined in: [escrow.ts:1859](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1859) +Defined in: [escrow.ts:1858](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1858) This function returns the status events for a given set of networks within an optional date range. diff --git a/docs/sdk/typescript/graphql/types/README.md b/docs/sdk/typescript/graphql/types/README.md index 7b33bd7937..627806191d 100644 --- a/docs/sdk/typescript/graphql/types/README.md +++ b/docs/sdk/typescript/graphql/types/README.md @@ -25,7 +25,6 @@ - [IMDataEntity](type-aliases/IMDataEntity.md) - [KVStoreData](type-aliases/KVStoreData.md) - [PaymentStatistics](type-aliases/PaymentStatistics.md) -- [PayoutData](type-aliases/PayoutData.md) - [RewardAddedEventData](type-aliases/RewardAddedEventData.md) - [StatusEvent](type-aliases/StatusEvent.md) - [TaskStatistics](type-aliases/TaskStatistics.md) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md index d1338d66b5..75da5e7f98 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md @@ -6,32 +6,54 @@ # Type Alias: DailyEscrowData -> **DailyEscrowData**: `object` +> **DailyEscrowData** = `object` -Defined in: [graphql/types.ts:83](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L83) +Defined in: [graphql/types.ts:75](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L75) -## Type declaration +## Properties ### escrowsCancelled > **escrowsCancelled**: `number` +Defined in: [graphql/types.ts:81](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L81) + +*** + ### escrowsPaid > **escrowsPaid**: `number` +Defined in: [graphql/types.ts:80](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L80) + +*** + ### escrowsPending > **escrowsPending**: `number` +Defined in: [graphql/types.ts:78](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L78) + +*** + ### escrowsSolved > **escrowsSolved**: `number` +Defined in: [graphql/types.ts:79](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L79) + +*** + ### escrowsTotal > **escrowsTotal**: `number` +Defined in: [graphql/types.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L77) + +*** + ### timestamp > **timestamp**: `Date` + +Defined in: [graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md index 9244bdd1ec..22f2825128 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md @@ -6,28 +6,46 @@ # Type Alias: DailyHMTData -> **DailyHMTData**: `object` +> **DailyHMTData** = `object` -Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) +Defined in: [graphql/types.ts:119](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L119) -## Type declaration +## Properties ### dailyUniqueReceivers > **dailyUniqueReceivers**: `number` +Defined in: [graphql/types.ts:124](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L124) + +*** + ### dailyUniqueSenders > **dailyUniqueSenders**: `number` +Defined in: [graphql/types.ts:123](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L123) + +*** + ### timestamp > **timestamp**: `Date` +Defined in: [graphql/types.ts:120](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L120) + +*** + ### totalTransactionAmount > **totalTransactionAmount**: `bigint` +Defined in: [graphql/types.ts:121](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L121) + +*** + ### totalTransactionCount > **totalTransactionCount**: `number` + +Defined in: [graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md index 5407a1faf6..ee51349400 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md @@ -6,24 +6,38 @@ # Type Alias: DailyPaymentData -> **DailyPaymentData**: `object` +> **DailyPaymentData** = `object` -Defined in: [graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) +Defined in: [graphql/types.ts:98](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L98) -## Type declaration +## Properties ### averageAmountPerWorker > **averageAmountPerWorker**: `bigint` +Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) + +*** + ### timestamp > **timestamp**: `Date` +Defined in: [graphql/types.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L99) + +*** + ### totalAmountPaid > **totalAmountPaid**: `bigint` +Defined in: [graphql/types.ts:100](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L100) + +*** + ### totalCount > **totalCount**: `number` + +Defined in: [graphql/types.ts:101](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L101) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md index 32d8aac1c6..100ce35d4b 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md @@ -6,20 +6,30 @@ # Type Alias: DailyTaskData -> **DailyTaskData**: `object` +> **DailyTaskData** = `object` -Defined in: [graphql/types.ts:148](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L148) +Defined in: [graphql/types.ts:140](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L140) -## Type declaration +## Properties ### tasksSolved > **tasksSolved**: `number` +Defined in: [graphql/types.ts:143](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L143) + +*** + ### tasksTotal > **tasksTotal**: `number` +Defined in: [graphql/types.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L142) + +*** + ### timestamp > **timestamp**: `Date` + +Defined in: [graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md index decaf5e782..3390a14065 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md @@ -6,16 +6,22 @@ # Type Alias: DailyWorkerData -> **DailyWorkerData**: `object` +> **DailyWorkerData** = `object` -Defined in: [graphql/types.ts:97](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L97) +Defined in: [graphql/types.ts:89](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L89) -## Type declaration +## Properties ### activeWorkers > **activeWorkers**: `number` +Defined in: [graphql/types.ts:91](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L91) + +*** + ### timestamp > **timestamp**: `Date` + +Defined in: [graphql/types.ts:90](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L90) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md index 1b73e121ee..d6e4907525 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md @@ -6,84 +6,158 @@ # Type Alias: EscrowData -> **EscrowData**: `object` +> **EscrowData** = `object` -Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) +Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L5) + +*** + ### amountPaid > **amountPaid**: `string` +Defined in: [graphql/types.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L6) + +*** + ### balance > **balance**: `string` +Defined in: [graphql/types.ts:7](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L7) + +*** + ### chainId > **chainId**: `number` +Defined in: [graphql/types.ts:22](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L22) + +*** + ### count > **count**: `string` +Defined in: [graphql/types.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L8) + +*** + ### createdAt > **createdAt**: `string` +Defined in: [graphql/types.ts:21](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L21) + +*** + ### exchangeOracle? > `optional` **exchangeOracle**: `string` +Defined in: [graphql/types.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L17) + +*** + ### factoryAddress > **factoryAddress**: `string` +Defined in: [graphql/types.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L9) + +*** + ### finalResultsUrl? > `optional` **finalResultsUrl**: `string` +Defined in: [graphql/types.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L10) + +*** + ### id > **id**: `string` +Defined in: [graphql/types.ts:4](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L4) + +*** + ### intermediateResultsUrl? > `optional` **intermediateResultsUrl**: `string` +Defined in: [graphql/types.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L11) + +*** + ### launcher > **launcher**: `string` +Defined in: [graphql/types.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L12) + +*** + ### manifestHash? > `optional` **manifestHash**: `string` +Defined in: [graphql/types.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L13) + +*** + ### manifestUrl? > `optional` **manifestUrl**: `string` +Defined in: [graphql/types.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L14) + +*** + ### recordingOracle? > `optional` **recordingOracle**: `string` +Defined in: [graphql/types.ts:15](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L15) + +*** + ### reputationOracle? > `optional` **reputationOracle**: `string` +Defined in: [graphql/types.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L16) + +*** + ### status > **status**: `string` +Defined in: [graphql/types.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L18) + +*** + ### token > **token**: `string` +Defined in: [graphql/types.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L19) + +*** + ### totalFundedAmount > **totalFundedAmount**: `string` + +Defined in: [graphql/types.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L20) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md index 6e6c5426c3..969d34f7db 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md @@ -6,16 +6,22 @@ # Type Alias: EscrowStatistics -> **EscrowStatistics**: `object` +> **EscrowStatistics** = `object` -Defined in: [graphql/types.ts:92](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L92) +Defined in: [graphql/types.ts:84](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L84) -## Type declaration +## Properties ### dailyEscrowsData > **dailyEscrowsData**: [`DailyEscrowData`](DailyEscrowData.md)[] +Defined in: [graphql/types.ts:86](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L86) + +*** + ### totalEscrows > **totalEscrows**: `number` + +Defined in: [graphql/types.ts:85](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L85) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md index d11549fd67..13cf87b529 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md @@ -6,48 +6,86 @@ # Type Alias: EscrowStatisticsData -> **EscrowStatisticsData**: `object` +> **EscrowStatisticsData** = `object` -Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) +Defined in: [graphql/types.ts:34](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L34) -## Type declaration +## Properties ### bulkPayoutEventCount > **bulkPayoutEventCount**: `string` +Defined in: [graphql/types.ts:37](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L37) + +*** + ### cancelledStatusEventCount > **cancelledStatusEventCount**: `string` +Defined in: [graphql/types.ts:39](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L39) + +*** + ### completedStatusEventCount > **completedStatusEventCount**: `string` +Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) + +*** + ### fundEventCount > **fundEventCount**: `string` +Defined in: [graphql/types.ts:35](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L35) + +*** + ### paidStatusEventCount > **paidStatusEventCount**: `string` +Defined in: [graphql/types.ts:41](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L41) + +*** + ### partialStatusEventCount > **partialStatusEventCount**: `string` +Defined in: [graphql/types.ts:40](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L40) + +*** + ### pendingStatusEventCount > **pendingStatusEventCount**: `string` +Defined in: [graphql/types.ts:38](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L38) + +*** + ### storeResultsEventCount > **storeResultsEventCount**: `string` +Defined in: [graphql/types.ts:36](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L36) + +*** + ### totalEscrowCount > **totalEscrowCount**: `string` +Defined in: [graphql/types.ts:44](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L44) + +*** + ### totalEventCount > **totalEventCount**: `string` + +Defined in: [graphql/types.ts:43](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L43) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md index 1bdd057e5f..e14a280224 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md @@ -6,80 +6,150 @@ # Type Alias: EventDayData -> **EventDayData**: `object` +> **EventDayData** = `object` -Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) +Defined in: [graphql/types.ts:47](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L47) -## Type declaration +## Properties ### dailyBulkPayoutEventCount > **dailyBulkPayoutEventCount**: `string` +Defined in: [graphql/types.ts:51](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L51) + +*** + ### dailyCancelledStatusEventCount > **dailyCancelledStatusEventCount**: `string` +Defined in: [graphql/types.ts:53](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L53) + +*** + ### dailyCompletedStatusEventCount > **dailyCompletedStatusEventCount**: `string` +Defined in: [graphql/types.ts:56](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L56) + +*** + ### dailyEscrowCount > **dailyEscrowCount**: `string` +Defined in: [graphql/types.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L58) + +*** + ### dailyFundEventCount > **dailyFundEventCount**: `string` +Defined in: [graphql/types.ts:49](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L49) + +*** + ### dailyHMTTransferAmount > **dailyHMTTransferAmount**: `string` +Defined in: [graphql/types.ts:63](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L63) + +*** + ### dailyHMTTransferCount > **dailyHMTTransferCount**: `string` +Defined in: [graphql/types.ts:62](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L62) + +*** + ### dailyPaidStatusEventCount > **dailyPaidStatusEventCount**: `string` +Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) + +*** + ### dailyPartialStatusEventCount > **dailyPartialStatusEventCount**: `string` +Defined in: [graphql/types.ts:54](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L54) + +*** + ### dailyPayoutAmount > **dailyPayoutAmount**: `string` +Defined in: [graphql/types.ts:61](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L61) + +*** + ### dailyPayoutCount > **dailyPayoutCount**: `string` +Defined in: [graphql/types.ts:60](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L60) + +*** + ### dailyPendingStatusEventCount > **dailyPendingStatusEventCount**: `string` +Defined in: [graphql/types.ts:52](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L52) + +*** + ### dailyStoreResultsEventCount > **dailyStoreResultsEventCount**: `string` +Defined in: [graphql/types.ts:50](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L50) + +*** + ### dailyTotalEventCount > **dailyTotalEventCount**: `string` +Defined in: [graphql/types.ts:57](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L57) + +*** + ### dailyUniqueReceivers > **dailyUniqueReceivers**: `string` +Defined in: [graphql/types.ts:65](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L65) + +*** + ### dailyUniqueSenders > **dailyUniqueSenders**: `string` +Defined in: [graphql/types.ts:64](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L64) + +*** + ### dailyWorkerCount > **dailyWorkerCount**: `string` +Defined in: [graphql/types.ts:59](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L59) + +*** + ### timestamp > **timestamp**: `string` + +Defined in: [graphql/types.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L48) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md index 3c2354fba4..956c4ef778 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md @@ -6,16 +6,22 @@ # Type Alias: HMTHolder -> **HMTHolder**: `object` +> **HMTHolder** = `object` -Defined in: [graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) +Defined in: [graphql/types.ts:114](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L114) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:115](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L115) + +*** + ### balance > **balance**: `bigint` + +Defined in: [graphql/types.ts:116](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L116) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md index 7a2407ca15..ae4e0cde6c 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md @@ -6,16 +6,22 @@ # Type Alias: HMTHolderData -> **HMTHolderData**: `object` +> **HMTHolderData** = `object` -Defined in: [graphql/types.ts:117](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L117) +Defined in: [graphql/types.ts:109](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L109) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:110](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L110) + +*** + ### balance > **balance**: `string` + +Defined in: [graphql/types.ts:111](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L111) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md index e8e3e7364e..d5f3b2b4f6 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md @@ -6,20 +6,30 @@ # Type Alias: HMTStatistics -> **HMTStatistics**: `object` +> **HMTStatistics** = `object` -Defined in: [graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) +Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) -## Type declaration +## Properties ### totalHolders > **totalHolders**: `number` +Defined in: [graphql/types.ts:130](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L130) + +*** + ### totalTransferAmount > **totalTransferAmount**: `bigint` +Defined in: [graphql/types.ts:128](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L128) + +*** + ### totalTransferCount > **totalTransferCount**: `number` + +Defined in: [graphql/types.ts:129](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L129) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md index d1401b9486..ef3dd747a4 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md @@ -6,32 +6,54 @@ # Type Alias: HMTStatisticsData -> **HMTStatisticsData**: `object` +> **HMTStatisticsData** = `object` -Defined in: [graphql/types.ts:33](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L33) +Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) -## Type declaration +## Properties ### holders > **holders**: `string` +Defined in: [graphql/types.ts:31](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L31) + +*** + ### totalApprovalEventCount > **totalApprovalEventCount**: `string` +Defined in: [graphql/types.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L28) + +*** + ### totalBulkApprovalEventCount > **totalBulkApprovalEventCount**: `string` +Defined in: [graphql/types.ts:29](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L29) + +*** + ### totalBulkTransferEventCount > **totalBulkTransferEventCount**: `string` +Defined in: [graphql/types.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L27) + +*** + ### totalTransferEventCount > **totalTransferEventCount**: `string` +Defined in: [graphql/types.ts:26](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L26) + +*** + ### totalValueTransfered > **totalValueTransfered**: `string` + +Defined in: [graphql/types.ts:30](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L30) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md index 9fe78a572b..7374817876 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md @@ -6,6 +6,6 @@ # Type Alias: IMData -> **IMData**: `Record`\<`string`, [`IMDataEntity`](IMDataEntity.md)\> +> **IMData** = `Record`\<`string`, [`IMDataEntity`](IMDataEntity.md)\> -Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) +Defined in: [graphql/types.ts:138](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L138) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md index 04813d3002..c64e874906 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md @@ -6,16 +6,22 @@ # Type Alias: IMDataEntity -> **IMDataEntity**: `object` +> **IMDataEntity** = `object` -Defined in: [graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) +Defined in: [graphql/types.ts:133](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L133) -## Type declaration +## Properties ### served > **served**: `number` +Defined in: [graphql/types.ts:134](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L134) + +*** + ### solved > **solved**: `number` + +Defined in: [graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md index bf4a21515f..169a975703 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md @@ -6,32 +6,54 @@ # Type Alias: KVStoreData -> **KVStoreData**: `object` +> **KVStoreData** = `object` -Defined in: [graphql/types.ts:165](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L165) +Defined in: [graphql/types.ts:157](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L157) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:159](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L159) + +*** + ### block > **block**: `number` +Defined in: [graphql/types.ts:163](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L163) + +*** + ### id > **id**: `string` +Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) + +*** + ### key > **key**: `string` +Defined in: [graphql/types.ts:160](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L160) + +*** + ### timestamp > **timestamp**: `Date` +Defined in: [graphql/types.ts:162](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L162) + +*** + ### value > **value**: `string` + +Defined in: [graphql/types.ts:161](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L161) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md index 183cb8fc7b..f24190adfb 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md @@ -6,12 +6,14 @@ # Type Alias: PaymentStatistics -> **PaymentStatistics**: `object` +> **PaymentStatistics** = `object` -Defined in: [graphql/types.ts:113](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L113) +Defined in: [graphql/types.ts:105](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L105) -## Type declaration +## Properties ### dailyPaymentsData > **dailyPaymentsData**: [`DailyPaymentData`](DailyPaymentData.md)[] + +Defined in: [graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md b/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md deleted file mode 100644 index 411724cd7c..0000000000 --- a/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md +++ /dev/null @@ -1,33 +0,0 @@ -[**@human-protocol/sdk**](../../../README.md) - -*** - -[@human-protocol/sdk](../../../modules.md) / [graphql/types](../README.md) / PayoutData - -# Type Alias: PayoutData - -> **PayoutData**: `object` - -Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) - -## Type declaration - -### amount - -> **amount**: `string` - -### createdAt - -> **createdAt**: `string` - -### escrowAddress - -> **escrowAddress**: `string` - -### id - -> **id**: `string` - -### recipient - -> **recipient**: `string` diff --git a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md index 1c754efa3c..07a3e39b38 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md @@ -6,24 +6,38 @@ # Type Alias: RewardAddedEventData -> **RewardAddedEventData**: `object` +> **RewardAddedEventData** = `object` -Defined in: [graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) +Defined in: [graphql/types.ts:68](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L68) -## Type declaration +## Properties ### amount > **amount**: `string` +Defined in: [graphql/types.ts:72](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L72) + +*** + ### escrowAddress > **escrowAddress**: `string` +Defined in: [graphql/types.ts:69](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L69) + +*** + ### slasher > **slasher**: `string` +Defined in: [graphql/types.ts:71](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L71) + +*** + ### staker > **staker**: `string` + +Defined in: [graphql/types.ts:70](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L70) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md index 05c2380ae1..d072664578 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md @@ -6,24 +6,38 @@ # Type Alias: StatusEvent -> **StatusEvent**: `object` +> **StatusEvent** = `object` -Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) +Defined in: [graphql/types.ts:150](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L150) -## Type declaration +## Properties ### chainId > **chainId**: [`ChainId`](../../../enums/enumerations/ChainId.md) +Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) + +*** + ### escrowAddress > **escrowAddress**: `string` +Defined in: [graphql/types.ts:152](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L152) + +*** + ### status > **status**: `string` +Defined in: [graphql/types.ts:153](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L153) + +*** + ### timestamp > **timestamp**: `number` + +Defined in: [graphql/types.ts:151](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L151) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md index 1e57acbfdd..6cb0d9045f 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md @@ -6,12 +6,14 @@ # Type Alias: TaskStatistics -> **TaskStatistics**: `object` +> **TaskStatistics** = `object` -Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) +Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) -## Type declaration +## Properties ### dailyTasksData > **dailyTasksData**: [`DailyTaskData`](DailyTaskData.md)[] + +Defined in: [graphql/types.ts:147](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L147) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md index 60ffd457ee..b513430b69 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md @@ -6,12 +6,14 @@ # Type Alias: WorkerStatistics -> **WorkerStatistics**: `object` +> **WorkerStatistics** = `object` -Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) +Defined in: [graphql/types.ts:94](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L94) -## Type declaration +## Properties ### dailyWorkersData > **dailyWorkersData**: [`DailyWorkerData`](DailyWorkerData.md)[] + +Defined in: [graphql/types.ts:95](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L95) diff --git a/docs/sdk/typescript/interfaces/README.md b/docs/sdk/typescript/interfaces/README.md index efff08ad39..e7046c38a1 100644 --- a/docs/sdk/typescript/interfaces/README.md +++ b/docs/sdk/typescript/interfaces/README.md @@ -8,6 +8,7 @@ ## Interfaces +- [IEscrow](interfaces/IEscrow.md) - [IEscrowConfig](interfaces/IEscrowConfig.md) - [IEscrowsFilter](interfaces/IEscrowsFilter.md) - [IHMTHoldersParams](interfaces/IHMTHoldersParams.md) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrow.md b/docs/sdk/typescript/interfaces/interfaces/IEscrow.md new file mode 100644 index 0000000000..c361265476 --- /dev/null +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrow.md @@ -0,0 +1,161 @@ +[**@human-protocol/sdk**](../../README.md) + +*** + +[@human-protocol/sdk](../../modules.md) / [interfaces](../README.md) / IEscrow + +# Interface: IEscrow + +Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L67) + +## Properties + +### address + +> **address**: `string` + +Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) + +*** + +### amountPaid + +> **amountPaid**: `string` + +Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) + +*** + +### balance + +> **balance**: `string` + +Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) + +*** + +### chainId + +> **chainId**: `number` + +Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) + +*** + +### count + +> **count**: `string` + +Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) + +*** + +### createdAt + +> **createdAt**: `string` + +Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) + +*** + +### exchangeOracle? + +> `optional` **exchangeOracle**: `string` + +Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) + +*** + +### factoryAddress + +> **factoryAddress**: `string` + +Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) + +*** + +### finalResultsUrl? + +> `optional` **finalResultsUrl**: `string` + +Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) + +*** + +### id + +> **id**: `string` + +Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) + +*** + +### intermediateResultsUrl? + +> `optional` **intermediateResultsUrl**: `string` + +Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) + +*** + +### launcher + +> **launcher**: `string` + +Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) + +*** + +### manifestHash? + +> `optional` **manifestHash**: `string` + +Defined in: [interfaces.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L77) + +*** + +### manifestUrl? + +> `optional` **manifestUrl**: `string` + +Defined in: [interfaces.ts:78](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L78) + +*** + +### recordingOracle? + +> `optional` **recordingOracle**: `string` + +Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L79) + +*** + +### reputationOracle? + +> `optional` **reputationOracle**: `string` + +Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) + +*** + +### status + +> **status**: `string` + +Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) + +*** + +### token + +> **token**: `string` + +Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) + +*** + +### totalFundedAmount + +> **totalFundedAmount**: `string` + +Defined in: [interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md index 0683a22619..bbbb91352b 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md @@ -6,7 +6,7 @@ # Interface: IEscrowConfig -Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L79) +Defined in: [interfaces.ts:101](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L101) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/b > **exchangeOracle**: `string` -Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) +Defined in: [interfaces.ts:104](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L104) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/b > **exchangeOracleFee**: `bigint` -Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) +Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/b > **manifestHash**: `string` -Defined in: [interfaces.ts:87](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L87) +Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:87](https://github.com/humanprotocol/human-protocol/b > **manifestUrl**: `string` -Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) +Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/b > **recordingOracle**: `string` -Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) +Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L102) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/b > **recordingOracleFee**: `bigint` -Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) +Defined in: [interfaces.ts:105](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L105) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/b > **reputationOracle**: `string` -Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) +Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) *** @@ -70,4 +70,4 @@ Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/b > **reputationOracleFee**: `bigint` -Defined in: [interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) +Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L106) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md index add8356780..bd3aa19368 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md @@ -6,7 +6,7 @@ # Interface: IEscrowsFilter -Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L67) +Defined in: [interfaces.ts:89](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L89) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) +Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/b > `optional` **exchangeOracle**: `string` -Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) +Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) +Defined in: [interfaces.ts:96](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L96) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/b > `optional` **jobRequesterId**: `string` -Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) +Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/b > `optional` **launcher**: `string` -Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) +Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L90) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -82,7 +82,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **recordingOracle**: `string` -Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) +Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) *** @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationOracle**: `string` -Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) +Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) *** @@ -98,7 +98,7 @@ Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/b > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **status**: [`EscrowStatus`](../../types/enumerations/EscrowStatus.md) -Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) +Defined in: [interfaces.ts:95](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L95) *** @@ -118,4 +118,4 @@ Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/b > `optional` **to**: `Date` -Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) +Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L97) diff --git a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md index 20e651e721..95de18560e 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md +++ b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md @@ -6,7 +6,7 @@ # Interface: IHMTHoldersParams -Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L102) +Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/ > `optional` **address**: `string` -Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) +Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md index d7afd90199..e8d435da4c 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md @@ -6,7 +6,7 @@ # Interface: IKVStore -Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) +Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/ > **key**: `string` -Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) +Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) *** @@ -22,4 +22,4 @@ Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:116](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L116) +Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) diff --git a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md index 66e2c69336..f6a52e5065 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md @@ -6,7 +6,7 @@ # Interface: IKeyPair -Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L90) +Defined in: [interfaces.ts:112](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L112) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/b > **passphrase**: `string` -Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) +Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/b > **privateKey**: `string` -Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) +Defined in: [interfaces.ts:113](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L113) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/b > **publicKey**: `string` -Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) +Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/b > `optional` **revocationCertificate**: `string` -Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) +Defined in: [interfaces.ts:116](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L116) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperator.md b/docs/sdk/typescript/interfaces/interfaces/IOperator.md index 79945ef14c..eee52ffe6e 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperator.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperator.md @@ -6,7 +6,7 @@ # Interface: IOperator -Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L9) +Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L9) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/bl > **address**: `string` -Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/b > **amountJobsProcessed**: `bigint` -Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/b > **amountLocked**: `bigint` -Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/b > **amountSlashed**: `bigint` -Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/b > **amountStaked**: `bigint` -Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/b > **amountWithdrawn**: `bigint` -Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/b > `optional` **category**: `string` -Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) +Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) +Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/b > `optional` **fee**: `bigint` -Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) *** @@ -94,7 +94,7 @@ Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/b > `optional` **jobTypes**: `string`[] -Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) +Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) *** @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/b > **lockedUntilTimestamp**: `bigint` -Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) *** @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/b > `optional` **name**: `string` -Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) +Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) *** @@ -118,7 +118,7 @@ Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/b > `optional` **publicKey**: `string` -Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) *** @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationInstructions**: `string` -Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationNeeded**: `boolean` -Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) *** @@ -142,7 +142,7 @@ Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationNetworks**: `string`[] -Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) +Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) *** @@ -150,7 +150,7 @@ Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/b > **reward**: `bigint` -Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) *** @@ -158,7 +158,7 @@ Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/b > `optional` **role**: `string` -Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) *** @@ -166,7 +166,7 @@ Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/b > `optional` **url**: `string` -Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) *** @@ -174,7 +174,7 @@ Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/b > `optional` **webhookUrl**: `string` -Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) *** @@ -182,4 +182,4 @@ Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/b > `optional` **website**: `string` -Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md index b27a089c01..b50afecc2b 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md @@ -6,7 +6,7 @@ # Interface: IOperatorSubgraph -Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) +Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/b > **amountJobsProcessed**: `bigint` -Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) #### Inherited from @@ -42,7 +42,7 @@ Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/b > **amountLocked**: `bigint` -Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) #### Inherited from @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/b > **amountSlashed**: `bigint` -Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/b > **amountStaked**: `bigint` -Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) #### Inherited from @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/b > **amountWithdrawn**: `bigint` -Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) #### Inherited from @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/b > `optional` **category**: `string` -Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) +Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) #### Inherited from @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/b > `optional` **fee**: `bigint` -Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) #### Inherited from @@ -114,7 +114,7 @@ Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) #### Inherited from @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/b > `optional` **jobTypes**: `string` -Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L36) +Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L36) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/b > **lockedUntilTimestamp**: `bigint` -Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) #### Inherited from @@ -146,7 +146,7 @@ Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/b > `optional` **name**: `string` -Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) +Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) #### Inherited from @@ -158,7 +158,7 @@ Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/b > `optional` **publicKey**: `string` -Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) #### Inherited from @@ -170,7 +170,7 @@ Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationInstructions**: `string` -Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) #### Inherited from @@ -182,7 +182,7 @@ Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationNeeded**: `boolean` -Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) #### Inherited from @@ -194,7 +194,7 @@ Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationNetworks**: `object`[] -Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L37) +Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L37) #### address @@ -206,7 +206,7 @@ Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/b > **reward**: `bigint` -Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) #### Inherited from @@ -218,7 +218,7 @@ Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/b > `optional` **role**: `string` -Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) #### Inherited from @@ -230,7 +230,7 @@ Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/b > `optional` **url**: `string` -Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) #### Inherited from @@ -242,7 +242,7 @@ Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/b > `optional` **webhookUrl**: `string` -Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) #### Inherited from @@ -254,7 +254,7 @@ Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/b > `optional` **website**: `string` -Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md index 90e83d1034..9cad3993bf 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md @@ -6,7 +6,7 @@ # Interface: IOperatorsFilter -Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) +Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L41) +Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L41) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **minAmountStaked**: `number` -Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L43) +Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L43) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/b > `optional` **orderBy**: `string` -Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) +Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **roles**: `string`[] -Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L42) +Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L42) *** @@ -74,7 +74,7 @@ Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/b > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IPagination.md b/docs/sdk/typescript/interfaces/interfaces/IPagination.md index 18e9db9eb6..cbff72609c 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPagination.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPagination.md @@ -6,7 +6,7 @@ # Interface: IPagination -Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L178) ## Extended by @@ -25,7 +25,7 @@ Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) *** @@ -33,7 +33,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) *** @@ -41,4 +41,4 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) diff --git a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md index d324186adb..b8609ddbfc 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md @@ -6,7 +6,7 @@ # Interface: IPayoutFilter -Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L106) +Defined in: [interfaces.ts:128](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L128) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) +Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/ > `optional` **escrowAddress**: `string` -Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) +Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:110](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L110) +Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:110](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **recipient**: `string` -Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) +Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) *** @@ -74,7 +74,7 @@ Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -86,4 +86,4 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:111](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L111) +Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md index a78f347469..a907470928 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md @@ -6,7 +6,7 @@ # Interface: IReputationNetwork -Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L47) +Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L47) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) +Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) +Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) *** @@ -30,4 +30,4 @@ Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/b > **operators**: [`IOperator`](IOperator.md)[] -Defined in: [interfaces.ts:50](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L50) +Defined in: [interfaces.ts:50](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L50) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md index 79bb41371a..1ca46144f5 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md @@ -6,7 +6,7 @@ # Interface: IReputationNetworkSubgraph -Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L53) +Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L53) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) +Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) +Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) #### Inherited from @@ -42,4 +42,4 @@ Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/b > **operators**: [`IOperatorSubgraph`](IOperatorSubgraph.md)[] -Defined in: [interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) +Defined in: [interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReward.md b/docs/sdk/typescript/interfaces/interfaces/IReward.md index dbf06c2f1f..386e3a0d46 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReward.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReward.md @@ -6,7 +6,7 @@ # Interface: IReward -Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L4) +Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L4) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/bl > **amount**: `bigint` -Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) +Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) *** @@ -22,4 +22,4 @@ Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/bl > **escrowAddress**: `string` -Defined in: [interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L5) +Defined in: [interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/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 85c8c655a6..a6b5a5d26d 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md @@ -6,7 +6,7 @@ # Interface: IStatisticsFilter -Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L97) +Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) +Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -62,4 +62,4 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:99](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L99) +Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) diff --git a/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md b/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md index d57093ca0d..8092a8f477 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md @@ -6,7 +6,7 @@ # Interface: IStatusEventFilter -Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L166) +Defined in: [interfaces.ts:191](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L191) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L167) +Defined in: [interfaces.ts:192](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L192) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L169) +Defined in: [interfaces.ts:194](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L194) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/ > `optional` **launcher**: `string` -Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L171) +Defined in: [interfaces.ts:196](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L196) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **statuses**: [`EscrowStatus`](../../types/enumerations/EscrowStatus.md)[] -Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L168) +Defined in: [interfaces.ts:193](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L193) *** @@ -86,4 +86,4 @@ Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L170) +Defined in: [interfaces.ts:195](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L195) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md index b3408ebfb9..2c01e15619 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md @@ -6,7 +6,7 @@ # Interface: ITransaction -Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) +Defined in: [interfaces.ts:151](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L151) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/ > **block**: `bigint` -Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) +Defined in: [interfaces.ts:152](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L152) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) +Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L160) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/ > **from**: `string` -Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) +Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/ > **internalTransactions**: [`InternalTransaction`](InternalTransaction.md)[] -Defined in: [interfaces.ts:140](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L140) +Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L162) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:140](https://github.com/humanprotocol/human-protocol/ > **method**: `string` -Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) +Defined in: [interfaces.ts:158](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L158) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/ > `optional` **receiver**: `string` -Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) +Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L159) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/ > **timestamp**: `bigint` -Defined in: [interfaces.ts:134](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L134) +Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:134](https://github.com/humanprotocol/human-protocol/ > **to**: `string` -Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) +Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:139](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L139) +Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L161) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:139](https://github.com/humanprotocol/human-protocol/ > **txHash**: `string` -Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) +Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -94,4 +94,4 @@ Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:135](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L135) +Defined in: [interfaces.ts:157](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L157) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md index 3fa146d5b4..74571f4b3a 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md @@ -6,7 +6,7 @@ # Interface: ITransactionsFilter -Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) +Defined in: [interfaces.ts:165](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L165) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) +Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L166) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/ > `optional` **endBlock**: `number` -Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) +Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L168) *** @@ -34,7 +34,15 @@ Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/ > `optional` **endDate**: `Date` -Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) +Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L170) + +*** + +### escrow? + +> `optional` **escrow**: `string` + +Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L174) *** @@ -42,7 +50,7 @@ Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -54,7 +62,15 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **fromAddress**: `string` -Defined in: [interfaces.ts:149](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L149) +Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L171) + +*** + +### method? + +> `optional` **method**: `string` + +Defined in: [interfaces.ts:173](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L173) *** @@ -62,7 +78,7 @@ Defined in: [interfaces.ts:149](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -74,7 +90,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -86,7 +102,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **startBlock**: `number` -Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) +Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L167) *** @@ -94,7 +110,7 @@ Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/ > `optional` **startDate**: `Date` -Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) +Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L169) *** @@ -102,4 +118,12 @@ Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/ > `optional` **toAddress**: `string` -Defined in: [interfaces.ts:150](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L150) +Defined in: [interfaces.ts:172](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L172) + +*** + +### token? + +> `optional` **token**: `string` + +Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L175) diff --git a/docs/sdk/typescript/interfaces/interfaces/IWorker.md b/docs/sdk/typescript/interfaces/interfaces/IWorker.md index 11a8fa9ba5..ca168bcd39 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IWorker.md +++ b/docs/sdk/typescript/interfaces/interfaces/IWorker.md @@ -6,7 +6,7 @@ # Interface: IWorker -Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L174) +Defined in: [interfaces.ts:199](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L199) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/ > **address**: `string` -Defined in: [interfaces.ts:176](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L176) +Defined in: [interfaces.ts:201](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L201) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:176](https://github.com/humanprotocol/human-protocol/ > **id**: `string` -Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L175) +Defined in: [interfaces.ts:200](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L200) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/ > **payoutCount**: `number` -Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L178) +Defined in: [interfaces.ts:203](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L203) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/ > **totalAmountReceived**: `number` -Defined in: [interfaces.ts:177](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L177) +Defined in: [interfaces.ts:202](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L202) diff --git a/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md b/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md index 14a31aaf66..6d63ea1a04 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md @@ -6,7 +6,7 @@ # Interface: IWorkersFilter -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:206](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L206) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **address**: `string` -Defined in: [interfaces.ts:183](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L183) +Defined in: [interfaces.ts:208](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L208) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:183](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:182](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L182) +Defined in: [interfaces.ts:207](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L207) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:182](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **orderBy**: `string` -Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L184) +Defined in: [interfaces.ts:209](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L209) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md index 8775833e43..a60cfced52 100644 --- a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md @@ -6,7 +6,7 @@ # Interface: InternalTransaction -Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) +Defined in: [interfaces.ts:141](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L141) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) +Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/ > **from**: `string` -Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) +Defined in: [interfaces.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L142) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/ > **method**: `string` -Defined in: [interfaces.ts:123](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L123) +Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:123](https://github.com/humanprotocol/human-protocol/ > `optional` **receiver**: `string` -Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) +Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/ > **to**: `string` -Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) +Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:126](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L126) +Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) *** @@ -62,4 +62,4 @@ Defined in: [interfaces.ts:126](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:122](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L122) +Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) diff --git a/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md b/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md index e0fd825cf4..fd9d424bfa 100644 --- a/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md +++ b/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md @@ -6,7 +6,7 @@ # Interface: StakerInfo -Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L159) +Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L184) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/ > **lockedAmount**: `bigint` -Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L161) +Defined in: [interfaces.ts:186](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L186) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/ > **lockedUntil**: `bigint` -Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L162) +Defined in: [interfaces.ts:187](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L187) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/ > **stakedAmount**: `bigint` -Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L160) +Defined in: [interfaces.ts:185](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L185) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/ > **withdrawableAmount**: `bigint` -Defined in: [interfaces.ts:163](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L163) +Defined in: [interfaces.ts:188](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L188) diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md index 5e7a7d8eef..d8af8e21db 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md @@ -6,7 +6,7 @@ # Class: KVStoreClient -Defined in: [kvstore.ts:99](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L99) +Defined in: [kvstore.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L99) ## Introduction @@ -82,11 +82,11 @@ const kvstoreClient = await KVStoreClient.build(provider); ## Constructors -### new KVStoreClient() +### Constructor -> **new KVStoreClient**(`runner`, `networkData`): [`KVStoreClient`](KVStoreClient.md) +> **new KVStoreClient**(`runner`, `networkData`): `KVStoreClient` -Defined in: [kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) +Defined in: [kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) **KVStoreClient constructor** @@ -106,11 +106,11 @@ The network information required to connect to the KVStore contract #### Returns -[`KVStoreClient`](KVStoreClient.md) +`KVStoreClient` #### Overrides -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructors) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructor) ## Properties @@ -118,11 +118,11 @@ The network information required to connect to the KVStore contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata) *** @@ -130,19 +130,19 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner) ## Methods ### set() -> **set**(`key`, `value`, `txOptions`?): `Promise`\<`void`\> +> **set**(`key`, `value`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) +Defined in: [kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) This function sets a key-value pair associated with the address that submits the transaction. @@ -194,9 +194,9 @@ await kvstoreClient.set('Role', 'RecordingOracle'); ### setBulk() -> **setBulk**(`keys`, `values`, `txOptions`?): `Promise`\<`void`\> +> **setBulk**(`keys`, `values`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) +Defined in: [kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) This function sets key-value pairs in bulk associated with the address that submits the transaction. @@ -250,9 +250,9 @@ await kvstoreClient.setBulk(keys, values); ### setFileUrlAndHash() -> **setFileUrlAndHash**(`url`, `urlKey`, `txOptions`?): `Promise`\<`void`\> +> **setFileUrlAndHash**(`url`, `urlKey`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) +Defined in: [kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) Sets a URL value for the address that submits the transaction, and its hash. @@ -303,9 +303,9 @@ await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url'); ### build() -> `static` **build**(`runner`): `Promise`\<[`KVStoreClient`](KVStoreClient.md)\> +> `static` **build**(`runner`): `Promise`\<`KVStoreClient`\> -Defined in: [kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) +Defined in: [kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) Creates an instance of KVStoreClient from a runner. @@ -319,7 +319,7 @@ The Runner object to interact with the Ethereum network #### Returns -`Promise`\<[`KVStoreClient`](KVStoreClient.md)\> +`Promise`\<`KVStoreClient`\> - An instance of KVStoreClient diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md index b2256eac5b..1b45a8f82d 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md @@ -6,7 +6,7 @@ # Class: KVStoreUtils -Defined in: [kvstore.ts:318](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L318) +Defined in: [kvstore.ts:318](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L318) ## Introduction @@ -41,13 +41,13 @@ const KVStoreAddresses = await KVStoreUtils.getKVStoreData( ## Constructors -### new KVStoreUtils() +### Constructor -> **new KVStoreUtils**(): [`KVStoreUtils`](KVStoreUtils.md) +> **new KVStoreUtils**(): `KVStoreUtils` #### Returns -[`KVStoreUtils`](KVStoreUtils.md) +`KVStoreUtils` ## Methods @@ -55,7 +55,7 @@ const KVStoreAddresses = await KVStoreUtils.getKVStoreData( > `static` **get**(`chainId`, `address`, `key`): `Promise`\<`string`\> -Defined in: [kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) +Defined in: [kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) Gets the value of a key-value pair in the KVStore using the subgraph. @@ -116,7 +116,7 @@ console.log(value); > `static` **getFileUrlAndVerifyHash**(`chainId`, `address`, `urlKey`): `Promise`\<`string`\> -Defined in: [kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) +Defined in: [kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) Gets the URL value of the given entity, and verifies its hash. @@ -164,7 +164,7 @@ console.log(url); > `static` **getKVStoreData**(`chainId`, `address`): `Promise`\<[`IKVStore`](../../interfaces/interfaces/IKVStore.md)[]\> -Defined in: [kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) +Defined in: [kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) This function returns the KVStore data for a given address. @@ -211,7 +211,7 @@ console.log(kvStoreData); > `static` **getPublicKey**(`chainId`, `address`): `Promise`\<`string`\> -Defined in: [kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) +Defined in: [kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) Gets the public key of the given entity, and verifies its hash. diff --git a/docs/sdk/typescript/operator/classes/OperatorUtils.md b/docs/sdk/typescript/operator/classes/OperatorUtils.md index 9e675b0bd4..2562895980 100644 --- a/docs/sdk/typescript/operator/classes/OperatorUtils.md +++ b/docs/sdk/typescript/operator/classes/OperatorUtils.md @@ -6,17 +6,17 @@ # Class: OperatorUtils -Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L27) +Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L27) ## Constructors -### new OperatorUtils() +### Constructor -> **new OperatorUtils**(): [`OperatorUtils`](OperatorUtils.md) +> **new OperatorUtils**(): `OperatorUtils` #### Returns -[`OperatorUtils`](OperatorUtils.md) +`OperatorUtils` ## Methods @@ -24,7 +24,7 @@ Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blo > `static` **getOperator**(`chainId`, `address`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)\> -Defined in: [operator.ts:43](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L43) +Defined in: [operator.ts:43](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L43) This function returns the operator data for the given address. @@ -62,7 +62,7 @@ const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51 > `static` **getOperators**(`filter`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> -Defined in: [operator.ts:109](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L109) +Defined in: [operator.ts:109](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L109) This function returns all the operator details of the protocol. @@ -95,9 +95,9 @@ const operators = await OperatorUtils.getOperators(filter); ### getReputationNetworkOperators() -> `static` **getReputationNetworkOperators**(`chainId`, `address`, `role`?): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> +> `static` **getReputationNetworkOperators**(`chainId`, `address`, `role?`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> -Defined in: [operator.ts:190](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L190) +Defined in: [operator.ts:190](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L190) Retrieves the reputation network operators of the specified address. @@ -141,7 +141,7 @@ const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLY > `static` **getRewards**(`chainId`, `slasherAddress`): `Promise`\<[`IReward`](../../interfaces/interfaces/IReward.md)[]\> -Defined in: [operator.ts:244](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L244) +Defined in: [operator.ts:244](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L244) This function returns information about the rewards for a given slasher address. diff --git a/docs/sdk/typescript/staking/classes/StakingClient.md b/docs/sdk/typescript/staking/classes/StakingClient.md index bd9b92b82e..a28c8816cc 100644 --- a/docs/sdk/typescript/staking/classes/StakingClient.md +++ b/docs/sdk/typescript/staking/classes/StakingClient.md @@ -6,7 +6,7 @@ # Class: StakingClient -Defined in: [staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) +Defined in: [staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) ## Introduction @@ -82,11 +82,11 @@ const stakingClient = await StakingClient.build(provider); ## Constructors -### new StakingClient() +### Constructor -> **new StakingClient**(`runner`, `networkData`): [`StakingClient`](StakingClient.md) +> **new StakingClient**(`runner`, `networkData`): `StakingClient` -Defined in: [staking.ts:108](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L108) +Defined in: [staking.ts:108](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L108) **StakingClient constructor** @@ -106,11 +106,11 @@ The network information required to connect to the Staking contract #### Returns -[`StakingClient`](StakingClient.md) +`StakingClient` #### Overrides -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructors) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructor) ## Properties @@ -118,7 +118,7 @@ The network information required to connect to the Staking contract > **escrowFactoryContract**: `EscrowFactory` -Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L100) +Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L100) *** @@ -126,11 +126,11 @@ Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blo > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata) *** @@ -138,11 +138,11 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner) *** @@ -150,7 +150,7 @@ Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1f > **stakingContract**: `Staking` -Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) +Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) *** @@ -158,15 +158,15 @@ Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob > **tokenContract**: `HMToken` -Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) +Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) ## Methods ### approveStake() -> **approveStake**(`amount`, `txOptions`?): `Promise`\<`void`\> +> **approveStake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) +Defined in: [staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) This function approves the staking contract to transfer a specified amount of tokens when the user stakes. It increases the allowance for the staking contract. @@ -213,7 +213,7 @@ await stakingClient.approveStake(amount); > **getStakerInfo**(`stakerAddress`): `Promise`\<[`StakerInfo`](../../interfaces/interfaces/StakerInfo.md)\> -Defined in: [staking.ts:435](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L435) +Defined in: [staking.ts:435](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L435) Retrieves comprehensive staking information for a staker. @@ -247,9 +247,9 @@ console.log(stakingInfo.tokensStaked); ### slash() -> **slash**(`slasher`, `staker`, `escrowAddress`, `amount`, `txOptions`?): `Promise`\<`void`\> +> **slash**(`slasher`, `staker`, `escrowAddress`, `amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:373](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L373) +Defined in: [staking.ts:373](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L373) This function reduces the allocated amount by a staker in an escrow and transfers those tokens to the reward pool. This allows the slasher to claim them later. @@ -312,9 +312,9 @@ await stakingClient.slash('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd ### stake() -> **stake**(`amount`, `txOptions`?): `Promise`\<`void`\> +> **stake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:247](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L247) +Defined in: [staking.ts:247](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L247) This function stakes a specified amount of tokens on a specific network. @@ -362,9 +362,9 @@ await stakingClient.stake(amount); ### unstake() -> **unstake**(`amount`, `txOptions`?): `Promise`\<`void`\> +> **unstake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:291](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L291) +Defined in: [staking.ts:291](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L291) This function unstakes tokens from staking contract. The unstaked tokens stay locked for a period of time. @@ -411,9 +411,9 @@ await stakingClient.unstake(amount); ### withdraw() -> **withdraw**(`txOptions`?): `Promise`\<`void`\> +> **withdraw**(`txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:336](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L336) +Defined in: [staking.ts:336](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L336) This function withdraws unstaked and non-locked tokens from staking contract to the user wallet. @@ -453,9 +453,9 @@ await stakingClient.withdraw(); ### build() -> `static` **build**(`runner`): `Promise`\<[`StakingClient`](StakingClient.md)\> +> `static` **build**(`runner`): `Promise`\<`StakingClient`\> -Defined in: [staking.ts:136](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L136) +Defined in: [staking.ts:136](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L136) Creates an instance of StakingClient from a Runner. @@ -469,7 +469,7 @@ The Runner object to interact with the Ethereum network #### Returns -`Promise`\<[`StakingClient`](StakingClient.md)\> +`Promise`\<`StakingClient`\> - An instance of StakingClient diff --git a/docs/sdk/typescript/statistics/classes/StatisticsClient.md b/docs/sdk/typescript/statistics/classes/StatisticsClient.md index 3dd493b5e5..a34e90ffc5 100644 --- a/docs/sdk/typescript/statistics/classes/StatisticsClient.md +++ b/docs/sdk/typescript/statistics/classes/StatisticsClient.md @@ -6,7 +6,7 @@ # Class: StatisticsClient -Defined in: [statistics.ts:58](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L58) +Defined in: [statistics.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L58) ## Introduction @@ -41,11 +41,11 @@ const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]); ## Constructors -### new StatisticsClient() +### Constructor -> **new StatisticsClient**(`networkData`): [`StatisticsClient`](StatisticsClient.md) +> **new StatisticsClient**(`networkData`): `StatisticsClient` -Defined in: [statistics.ts:67](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L67) +Defined in: [statistics.ts:67](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L67) **StatisticsClient constructor** @@ -59,7 +59,7 @@ The network information required to connect to the Statistics contract #### Returns -[`StatisticsClient`](StatisticsClient.md) +`StatisticsClient` ## Properties @@ -67,7 +67,7 @@ The network information required to connect to the Statistics contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L59) +Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L59) *** @@ -75,7 +75,7 @@ Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/b > **subgraphUrl**: `string` -Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L60) +Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L60) ## Methods @@ -83,7 +83,7 @@ Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/b > **getEscrowStatistics**(`filter`): `Promise`\<[`EscrowStatistics`](../../graphql/types/type-aliases/EscrowStatistics.md)\> -Defined in: [statistics.ts:120](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L120) +Defined in: [statistics.ts:120](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L120) This function returns the statistical data of escrows. @@ -149,7 +149,7 @@ const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({ > **getHMTDailyData**(`filter`): `Promise`\<[`DailyHMTData`](../../graphql/types/type-aliases/DailyHMTData.md)[]\> -Defined in: [statistics.ts:478](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L478) +Defined in: [statistics.ts:478](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L478) This function returns the statistical data of HMToken day by day. @@ -214,7 +214,7 @@ console.log('HMT statistics from 5/8 - 6/8:', hmtStatisticsRange); > **getHMTHolders**(`params`): `Promise`\<[`HMTHolder`](../../graphql/types/type-aliases/HMTHolder.md)[]\> -Defined in: [statistics.ts:407](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L407) +Defined in: [statistics.ts:407](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L407) This function returns the holders of the HMToken with optional filters and ordering. @@ -257,7 +257,7 @@ console.log('HMT holders:', hmtHolders.map((h) => ({ > **getHMTStatistics**(): `Promise`\<[`HMTStatistics`](../../graphql/types/type-aliases/HMTStatistics.md)\> -Defined in: [statistics.ts:364](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L364) +Defined in: [statistics.ts:364](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L364) This function returns the statistical data of HMToken. @@ -296,7 +296,7 @@ console.log('HMT statistics:', { > **getPaymentStatistics**(`filter`): `Promise`\<[`PaymentStatistics`](../../graphql/types/type-aliases/PaymentStatistics.md)\> -Defined in: [statistics.ts:300](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L300) +Defined in: [statistics.ts:300](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L300) This function returns the statistical data of payments. @@ -380,7 +380,7 @@ console.log( > **getWorkerStatistics**(`filter`): `Promise`\<[`WorkerStatistics`](../../graphql/types/type-aliases/WorkerStatistics.md)\> -Defined in: [statistics.ts:204](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L204) +Defined in: [statistics.ts:204](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L204) This function returns the statistical data of workers. diff --git a/docs/sdk/typescript/storage/classes/StorageClient.md b/docs/sdk/typescript/storage/classes/StorageClient.md index 6204af8592..d1eb61046e 100644 --- a/docs/sdk/typescript/storage/classes/StorageClient.md +++ b/docs/sdk/typescript/storage/classes/StorageClient.md @@ -6,7 +6,7 @@ # Class: ~~StorageClient~~ -Defined in: [storage.ts:63](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L63) +Defined in: [storage.ts:63](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L63) ## Deprecated @@ -57,11 +57,11 @@ const storageClient = new StorageClient(params, credentials); ## Constructors -### new StorageClient() +### Constructor -> **new StorageClient**(`params`, `credentials`?): [`StorageClient`](StorageClient.md) +> **new StorageClient**(`params`, `credentials?`): `StorageClient` -Defined in: [storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) +Defined in: [storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) **Storage client constructor** @@ -81,7 +81,7 @@ Optional. Cloud storage access data. If credentials are not provided - use anony #### Returns -[`StorageClient`](StorageClient.md) +`StorageClient` ## Methods @@ -89,7 +89,7 @@ Optional. Cloud storage access data. If credentials are not provided - use anony > **bucketExists**(`bucket`): `Promise`\<`boolean`\> -Defined in: [storage.ts:262](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L262) +Defined in: [storage.ts:262](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L262) This function checks if a bucket exists. @@ -133,7 +133,7 @@ const exists = await storageClient.bucketExists('bucket-name'); > **downloadFiles**(`keys`, `bucket`): `Promise`\<`any`[]\> -Defined in: [storage.ts:112](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L112) +Defined in: [storage.ts:112](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L112) This function downloads files from a bucket. @@ -181,7 +181,7 @@ const files = await storageClient.downloadFiles(keys, 'bucket-name'); > **listObjects**(`bucket`): `Promise`\<`string`[]\> -Defined in: [storage.ts:292](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L292) +Defined in: [storage.ts:292](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L292) This function lists all file names contained in the bucket. @@ -225,7 +225,7 @@ const fileNames = await storageClient.listObjects('bucket-name'); > **uploadFiles**(`files`, `bucket`): `Promise`\<[`UploadFile`](../../types/type-aliases/UploadFile.md)[]\> -Defined in: [storage.ts:198](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L198) +Defined in: [storage.ts:198](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L198) This function uploads files to a bucket. @@ -278,7 +278,7 @@ const uploadedFiles = await storageClient.uploadFiles(files, 'bucket-name'); > `static` **downloadFileFromUrl**(`url`): `Promise`\<`any`\> -Defined in: [storage.ts:146](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L146) +Defined in: [storage.ts:146](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L146) This function downloads files from a URL. diff --git a/docs/sdk/typescript/transaction/classes/TransactionUtils.md b/docs/sdk/typescript/transaction/classes/TransactionUtils.md index e6031b2f4d..9b8e4e17f7 100644 --- a/docs/sdk/typescript/transaction/classes/TransactionUtils.md +++ b/docs/sdk/typescript/transaction/classes/TransactionUtils.md @@ -6,17 +6,17 @@ # Class: TransactionUtils -Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L18) +Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L18) ## Constructors -### new TransactionUtils() +### Constructor -> **new TransactionUtils**(): [`TransactionUtils`](TransactionUtils.md) +> **new TransactionUtils**(): `TransactionUtils` #### Returns -[`TransactionUtils`](TransactionUtils.md) +`TransactionUtils` ## Methods @@ -24,10 +24,26 @@ Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/ > `static` **getTransaction**(`chainId`, `hash`): `Promise`\<[`ITransaction`](../../interfaces/interfaces/ITransaction.md)\> -Defined in: [transaction.ts:34](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L34) +Defined in: [transaction.ts:50](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L50) This function returns the transaction data for the given hash. +```ts +type ITransaction = { + block: bigint; + txHash: string; + from: string; + to: string; + timestamp: bigint; + value: string; + method: string; + receiver?: string; + escrow?: string; + token?: string; + internalTransactions: InternalTransaction[]; +}; +``` + #### Parameters ##### chainId @@ -62,7 +78,7 @@ const transaction = await TransactionUtils.getTransaction(ChainId.POLYGON, '0x62 > `static` **getTransactions**(`filter`): `Promise`\<[`ITransaction`](../../interfaces/interfaces/ITransaction.md)[]\> -Defined in: [transaction.ts:109](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L109) +Defined in: [transaction.ts:132](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L132) This function returns all transaction details based on the provided filter. @@ -75,6 +91,9 @@ interface ITransactionsFilter { chainId: ChainId; // List of chain IDs to query. fromAddress?: string; // (Optional) The address from which transactions are sent. toAddress?: string; // (Optional) The address to which transactions are sent. + method?: string; // (Optional) The method of the transaction to filter by. + escrow?: string; // (Optional) The escrow address to filter transactions. + token?: string; // (Optional) The token address to filter transactions. startDate?: Date; // (Optional) The start date to filter transactions (inclusive). endDate?: Date; // (Optional) The end date to filter transactions (inclusive). startBlock?: number; // (Optional) The start block number to filter transactions (inclusive). @@ -87,13 +106,17 @@ interface ITransactionsFilter { ```ts type ITransaction = { - block: number; + block: bigint; txHash: string; from: string; to: string; - timestamp: number; + timestamp: bigint; value: string; method: string; + receiver?: string; + escrow?: string; + token?: string; + internalTransactions: InternalTransaction[]; }; ``` diff --git a/docs/sdk/typescript/types/enumerations/EscrowStatus.md b/docs/sdk/typescript/types/enumerations/EscrowStatus.md index d0e0362ce2..b0c9743037 100644 --- a/docs/sdk/typescript/types/enumerations/EscrowStatus.md +++ b/docs/sdk/typescript/types/enumerations/EscrowStatus.md @@ -6,7 +6,7 @@ # Enumeration: EscrowStatus -Defined in: [types.ts:8](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L8) +Defined in: [types.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L8) Enum for escrow statuses. @@ -16,7 +16,7 @@ Enum for escrow statuses. > **Cancelled**: `5` -Defined in: [types.ts:32](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) +Defined in: [types.ts:32](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) Escrow is cancelled. @@ -26,7 +26,7 @@ Escrow is cancelled. > **Complete**: `4` -Defined in: [types.ts:28](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) +Defined in: [types.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) Escrow is finished. @@ -36,7 +36,7 @@ Escrow is finished. > **Launched**: `0` -Defined in: [types.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) +Defined in: [types.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) Escrow is launched. @@ -46,7 +46,7 @@ Escrow is launched. > **Paid**: `3` -Defined in: [types.ts:24](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) +Defined in: [types.ts:24](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) Escrow is fully paid. @@ -56,7 +56,7 @@ Escrow is fully paid. > **Partial**: `2` -Defined in: [types.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) +Defined in: [types.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) Escrow is partially paid out. @@ -66,6 +66,6 @@ Escrow is partially paid out. > **Pending**: `1` -Defined in: [types.ts:16](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) +Defined in: [types.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) Escrow is funded, and waiting for the results to be submitted. diff --git a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md index 8d4fd28d84..fdf82242e1 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md @@ -6,22 +6,28 @@ # Type Alias: EscrowCancel -> **EscrowCancel**: `object` +> **EscrowCancel** = `object` -Defined in: [types.ts:145](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) +Defined in: [types.ts:145](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) Represents the response data for an escrow cancellation. -## Type declaration +## Properties ### amountRefunded > **amountRefunded**: `bigint` +Defined in: [types.ts:153](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L153) + The amount refunded in the escrow cancellation. +*** + ### txHash > **txHash**: `string` +Defined in: [types.ts:149](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L149) + The hash of the transaction associated with the escrow cancellation. diff --git a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md index cc8658ac8c..c3ba28c27b 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md @@ -6,28 +6,38 @@ # Type Alias: EscrowWithdraw -> **EscrowWithdraw**: `object` +> **EscrowWithdraw** = `object` -Defined in: [types.ts:159](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) +Defined in: [types.ts:159](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) Represents the response data for an escrow withdrawal. -## Type declaration +## Properties ### amountWithdrawn > **amountWithdrawn**: `bigint` +Defined in: [types.ts:171](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L171) + The amount withdrawn from the escrow. +*** + ### tokenAddress > **tokenAddress**: `string` +Defined in: [types.ts:167](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L167) + The address of the token used for the withdrawal. +*** + ### txHash > **txHash**: `string` +Defined in: [types.ts:163](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L163) + The hash of the transaction associated with the escrow withdrawal. diff --git a/docs/sdk/typescript/types/type-aliases/NetworkData.md b/docs/sdk/typescript/types/type-aliases/NetworkData.md index 159e72044f..622def3e8d 100644 --- a/docs/sdk/typescript/types/type-aliases/NetworkData.md +++ b/docs/sdk/typescript/types/type-aliases/NetworkData.md @@ -6,76 +6,118 @@ # Type Alias: NetworkData -> **NetworkData**: `object` +> **NetworkData** = `object` -Defined in: [types.ts:95](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) +Defined in: [types.ts:95](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) Network data -## Type declaration +## Properties ### chainId > **chainId**: `number` +Defined in: [types.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L99) + Network chain id +*** + ### factoryAddress > **factoryAddress**: `string` +Defined in: [types.ts:115](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L115) + Escrow Factory contract address +*** + ### hmtAddress > **hmtAddress**: `string` +Defined in: [types.ts:111](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L111) + HMT Token contract address +*** + ### kvstoreAddress > **kvstoreAddress**: `string` +Defined in: [types.ts:123](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L123) + KVStore contract address +*** + ### oldFactoryAddress > **oldFactoryAddress**: `string` +Defined in: [types.ts:139](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L139) + Old Escrow Factory contract address +*** + ### oldSubgraphUrl > **oldSubgraphUrl**: `string` +Defined in: [types.ts:135](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L135) + Old subgraph URL +*** + ### scanUrl > **scanUrl**: `string` +Defined in: [types.ts:107](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L107) + Network scanner URL +*** + ### stakingAddress > **stakingAddress**: `string` +Defined in: [types.ts:119](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L119) + Staking contract address +*** + ### subgraphUrl > **subgraphUrl**: `string` +Defined in: [types.ts:127](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L127) + Subgraph URL +*** + ### subgraphUrlApiKey > **subgraphUrlApiKey**: `string` +Defined in: [types.ts:131](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L131) + Subgraph URL API key +*** + ### title > **title**: `string` +Defined in: [types.ts:103](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L103) + Network title diff --git a/docs/sdk/typescript/types/type-aliases/Payout.md b/docs/sdk/typescript/types/type-aliases/Payout.md index 66df79f1a1..e29fd2e6ce 100644 --- a/docs/sdk/typescript/types/type-aliases/Payout.md +++ b/docs/sdk/typescript/types/type-aliases/Payout.md @@ -6,40 +6,58 @@ # Type Alias: Payout -> **Payout**: `object` +> **Payout** = `object` -Defined in: [types.ts:177](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L177) +Defined in: [types.ts:177](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L177) Represents a payout from an escrow. -## Type declaration +## Properties ### amount > **amount**: `bigint` +Defined in: [types.ts:193](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L193) + The amount paid to the recipient. +*** + ### createdAt > **createdAt**: `number` +Defined in: [types.ts:197](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L197) + The timestamp when the payout was created (in UNIX format). +*** + ### escrowAddress > **escrowAddress**: `string` +Defined in: [types.ts:185](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L185) + The address of the escrow associated with the payout. +*** + ### id > **id**: `string` +Defined in: [types.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L181) + Unique identifier of the payout. +*** + ### recipient > **recipient**: `string` +Defined in: [types.ts:189](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L189) + The address of the recipient who received the payout. diff --git a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md index ad1b794aec..9f006d87ca 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md +++ b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md @@ -6,26 +6,32 @@ # Type Alias: ~~StorageCredentials~~ -> `readonly` **StorageCredentials**: `object` +> `readonly` **StorageCredentials** = `object` -Defined in: [types.ts:40](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) +Defined in: [types.ts:40](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) AWS/GCP cloud storage access data -## Type declaration +## Deprecated + +StorageClient is deprecated. Use Minio.Client directly. + +## Properties ### ~~accessKey~~ > **accessKey**: `string` +Defined in: [types.ts:44](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L44) + Access Key +*** + ### ~~secretKey~~ > **secretKey**: `string` -Secret Key - -## Deprecated +Defined in: [types.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L48) -StorageClient is deprecated. Use Minio.Client directly. +Secret Key diff --git a/docs/sdk/typescript/types/type-aliases/StorageParams.md b/docs/sdk/typescript/types/type-aliases/StorageParams.md index d86df41951..4b14589239 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageParams.md +++ b/docs/sdk/typescript/types/type-aliases/StorageParams.md @@ -6,36 +6,50 @@ # Type Alias: ~~StorageParams~~ -> **StorageParams**: `object` +> **StorageParams** = `object` -Defined in: [types.ts:54](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) +Defined in: [types.ts:54](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) -## Type declaration +## Deprecated + +StorageClient is deprecated. Use Minio.Client directly. + +## Properties ### ~~endPoint~~ > **endPoint**: `string` +Defined in: [types.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L58) + Request endPoint +*** + ### ~~port?~~ > `optional` **port**: `number` +Defined in: [types.ts:70](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L70) + TCP/IP port number. Default value set to 80 for HTTP and 443 for HTTPs +*** + ### ~~region?~~ > `optional` **region**: `string` +Defined in: [types.ts:66](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L66) + Region +*** + ### ~~useSSL~~ > **useSSL**: `boolean` -Enable secure (HTTPS) access. Default value set to false +Defined in: [types.ts:62](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L62) -## Deprecated - -StorageClient is deprecated. Use Minio.Client directly. +Enable secure (HTTPS) access. Default value set to false diff --git a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md index ed7f7a1bd4..c4595f6266 100644 --- a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md +++ b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md @@ -6,9 +6,9 @@ # Type Alias: TransactionLikeWithNonce -> **TransactionLikeWithNonce**: `TransactionLike` & `object` +> **TransactionLikeWithNonce** = `TransactionLike` & `object` -Defined in: [types.ts:200](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L200) +Defined in: [types.ts:200](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L200) ## Type declaration diff --git a/docs/sdk/typescript/types/type-aliases/UploadFile.md b/docs/sdk/typescript/types/type-aliases/UploadFile.md index 29759d4af4..7830ecf6c3 100644 --- a/docs/sdk/typescript/types/type-aliases/UploadFile.md +++ b/docs/sdk/typescript/types/type-aliases/UploadFile.md @@ -6,28 +6,38 @@ # Type Alias: UploadFile -> `readonly` **UploadFile**: `object` +> `readonly` **UploadFile** = `object` -Defined in: [types.ts:77](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) +Defined in: [types.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) Upload file data -## Type declaration +## Properties ### hash > **hash**: `string` +Defined in: [types.ts:89](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L89) + Hash of uploaded object key +*** + ### key > **key**: `string` +Defined in: [types.ts:81](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L81) + Uploaded object key +*** + ### url > **url**: `string` +Defined in: [types.ts:85](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L85) + Uploaded object URL diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts index e1ad3c4e17..ea98af8fcb 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts @@ -7,10 +7,10 @@ import { ChainId, EscrowClient, EscrowUtils, + IEscrow, KVStoreUtils, NETWORKS, } from '@human-protocol/sdk'; -import { EscrowData } from '@human-protocol/sdk/dist/graphql'; import { Test } from '@nestjs/testing'; import { ethers, Wallet, ZeroAddress } from 'ethers'; import { createSignerMock } from '../../../test/fixtures/web3'; @@ -1520,7 +1520,7 @@ describe('JobService', () => { exchangeOracle: jobEntity.exchangeOracle, recordingOracle: jobEntity.recordingOracle, reputationOracle: jobEntity.reputationOracle, - } as unknown as EscrowData; + } as unknown as IEscrow; mockJobRepository.findOneByIdAndUserId.mockResolvedValueOnce(jobEntity); mockedEscrowUtils.getEscrow.mockResolvedValueOnce(getEscrowData); diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/filter.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/filter.py index 326c271f02..fb5cc4c483 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/filter.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/filter.py @@ -157,6 +157,9 @@ def __init__( end_date: Optional[datetime] = None, start_block: Optional[int] = None, end_block: Optional[int] = None, + method: Optional[str] = None, + escrow: Optional[str] = None, + token: Optional[str] = None, first: int = 10, skip: int = 0, order_direction: OrderDirection = OrderDirection.DESC, @@ -171,6 +174,9 @@ def __init__( :param end_date: End date for filtering transactions :param start_block: Start block number for filtering transactions :param end_block: End block number for filtering transactions + :param method: Method name to filter transactions + :param escrow: Escrow address to filter transactions + :param token: Token address to filter transactions :param first: Number of items per page :param skip: Page number to retrieve :param order: Order of results, "asc" or "desc" @@ -184,6 +190,12 @@ def __init__( if to_address and not Web3.is_address(to_address): raise ValueError(f"Invalid to_address: {to_address}") + if escrow and not Web3.is_address(escrow): + raise ValueError(f"Invalid escrow address: {escrow}") + + if token and not Web3.is_address(token): + raise ValueError(f"Invalid token address: {token}") + if start_date and end_date and start_date > end_date: raise ValueError( f"Invalid date range: start_date must be earlier than end_date" @@ -210,6 +222,9 @@ def __init__( self.end_date = end_date self.start_block = start_block self.end_block = end_block + self.method = method + self.escrow = escrow + self.token = token self.first = min(first, 1000) self.skip = skip self.order_direction = order_direction diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/transaction.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/transaction.py index 84ab386a74..ef637424b2 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/transaction.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/transaction.py @@ -33,6 +33,9 @@ def get_transactions_query(filter: TransactionFilter) -> str: end_block = filter.end_block from_address = filter.from_address to_address = filter.to_address + method = filter.method + escrow = filter.escrow + token = filter.token address_condition = ( f""" @@ -54,6 +57,9 @@ def get_transactions_query(filter: TransactionFilter) -> str: {f'{{ timestamp_lte: $endDate }},' if end_date else ''} {f'{{ block_gte: $startBlock }},' if start_block else ''} {f'{{ block_lte: $endBlock }},' if end_block else ''} + {f'{{ method: $method }},' if method else ''} + {f'{{ escrow: $escrow }},' if escrow else ''} + {f'{{ token: $token }}' if token else ''} ] }} """ @@ -66,6 +72,9 @@ def get_transactions_query(filter: TransactionFilter) -> str: $endDate: Int $startBlock: Int $endBlock: Int + $method: String + $escrow: String + $token: String $orderDirection: String $first: Int $skip: Int diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/transaction/transaction_utils.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/transaction/transaction_utils.py index 4cb1085a9c..54b561fc3c 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/transaction/transaction_utils.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/transaction/transaction_utils.py @@ -170,6 +170,7 @@ def get_transactions(filter: TransactionFilter) -> List[TransactionData]: """Get an array of transactions based on the specified filter parameters. :param filter: Object containing all the necessary parameters to filter + (chain_id, from_address, to_address, start_date, end_date, start_block, end_block, method, escrow, token, first, skip, order_direction) :return: List of transactions @@ -185,6 +186,8 @@ def get_transactions(filter: TransactionFilter) -> List[TransactionData]: chain_id=ChainId.POLYGON_AMOY, from_address="0x1234567890123456789012345678901234567890", to_address="0x0987654321098765432109876543210987654321", + method="transfer", + escrow="0x0987654321098765432109876543210987654321", start_date=datetime.datetime(2023, 5, 8), end_date=datetime.datetime(2023, 6, 8), ) @@ -213,6 +216,9 @@ def get_transactions(filter: TransactionFilter) -> List[TransactionData]: ), "startBlock": filter.start_block if filter.start_block else None, "endBlock": filter.end_block if filter.end_block else None, + "method": filter.method if filter.method else None, + "escrow": (filter.escrow.lower() if filter.escrow else None), + "token": (filter.token.lower() if filter.token else None), "first": filter.first, "skip": filter.skip, "orderDirection": filter.order_direction.value, diff --git a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/transaction/test_transaction_utils.py b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/transaction/test_transaction_utils.py index a2e4c3ca19..77c812c759 100644 --- a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/transaction/test_transaction_utils.py +++ b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/transaction/test_transaction_utils.py @@ -78,6 +78,9 @@ def test_get_transactions(self): "first": 10, "skip": 0, "orderDirection": "desc", + "escrow": None, + "token": None, + "method": None, }, ) self.assertEqual(len(transactions), 2) @@ -110,6 +113,9 @@ def test_get_transactions_empty_response(self): "first": 10, "skip": 0, "orderDirection": "desc", + "escrow": None, + "token": None, + "method": None, }, ) self.assertEqual(len(transactions), 0) diff --git a/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts b/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts index 46474bdf6b..c583fbb8bd 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts @@ -49,6 +49,7 @@ import { StatusEvent, } from './graphql'; import { + IEscrow, IEscrowConfig, IEscrowsFilter, IPayoutFilter, @@ -1618,7 +1619,7 @@ export class EscrowUtils { * ``` * * ```ts - * type EscrowData = { + * interface IEscrow { * id: string; * address: string; * amountPaid: string; @@ -1643,7 +1644,7 @@ export class EscrowUtils { * * * @param {IEscrowsFilter} filter Filter parameters. - * @returns {EscrowData[]} List of escrows that match the filter. + * @returns {IEscrow[]} List of escrows that match the filter. * * **Code example** * @@ -1656,12 +1657,10 @@ export class EscrowUtils { * to: new Date(2023, 5, 8), * chainId: ChainId.POLYGON_AMOY * }; - * const escrowDatas = await EscrowUtils.getEscrows(filters); + * const escrows = await EscrowUtils.getEscrows(filters); * ``` */ - public static async getEscrows( - filter: IEscrowsFilter - ): Promise { + public static async getEscrows(filter: IEscrowsFilter): Promise { if (filter.launcher && !ethers.isAddress(filter.launcher)) { throw ErrorInvalidAddress; } @@ -1741,7 +1740,7 @@ export class EscrowUtils { * ``` * * ```ts - * type EscrowData = { + * interface IEscrow { * id: string; * address: string; * amountPaid: string; @@ -1767,20 +1766,20 @@ export class EscrowUtils { * * @param {ChainId} chainId Network in which the escrow has been deployed * @param {string} escrowAddress Address of the escrow - * @returns {EscrowData} Escrow data + * @returns {IEscrow} Escrow data * * **Code example** * * ```ts * import { ChainId, EscrowUtils } from '@human-protocol/sdk'; * - * const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890"); + * const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890"); * ``` */ public static async getEscrow( chainId: ChainId, escrowAddress: string - ): Promise { + ): Promise { const networkData = NETWORKS[chainId]; if (!networkData) { diff --git a/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/transaction.ts b/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/transaction.ts index a10533c7fc..f54aea95a3 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/transaction.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/transaction.ts @@ -27,8 +27,17 @@ const TRANSACTION_FRAGMENT = gql` `; export const GET_TRANSACTIONS_QUERY = (filter: ITransactionsFilter) => { - const { startDate, endDate, startBlock, endBlock, fromAddress, toAddress } = - filter; + const { + startDate, + endDate, + startBlock, + endBlock, + fromAddress, + toAddress, + method, + escrow, + token, + } = filter; const addressCondition = fromAddress === toAddress ? ` @@ -48,6 +57,9 @@ export const GET_TRANSACTIONS_QUERY = (filter: ITransactionsFilter) => { ${endDate ? `{timestamp_lte: $endDate},` : ''} ${startBlock ? `{block_gte: $startBlock},` : ''} ${endBlock ? `{block_lte: $endBlock},` : ''} + ${method ? `{ method: $method },` : ''} + ${escrow ? `{ escrow: $escrow },` : ''} + ${token ? `{ token: $token },` : ''} ] } `; @@ -60,6 +72,9 @@ export const GET_TRANSACTIONS_QUERY = (filter: ITransactionsFilter) => { $endDate: Int $startBlock: Int $endBlock: Int + $method: String + $escrow: String + $token: String $orderDirection: String $first: Int $skip: Int diff --git a/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts b/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts index ebbd7cdf98..a5bbffeeed 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts @@ -22,14 +22,6 @@ export type EscrowData = { chainId: number; }; -export type PayoutData = { - id: string; - escrowAddress: string; - recipient: string; - amount: string; - createdAt: string; -}; - export type HMTStatisticsData = { totalTransferEventCount: string; totalBulkTransferEventCount: string; diff --git a/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts b/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts index aadcb6afb2..b33deac1cc 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts @@ -64,6 +64,28 @@ export interface IOperator { registrationInstructions?: string; } +export interface IEscrow { + id: string; + address: string; + amountPaid: string; + balance: string; + count: string; + factoryAddress: string; + finalResultsUrl?: string; + intermediateResultsUrl?: string; + launcher: string; + manifestHash?: string; + manifestUrl?: string; + recordingOracle?: string; + reputationOracle?: string; + exchangeOracle?: string; + status: string; + token: string; + totalFundedAmount: string; + createdAt: string; + chainId: number; +} + export interface IEscrowsFilter extends IPagination { launcher?: string; reputationOracle?: string; @@ -148,6 +170,9 @@ export interface ITransactionsFilter extends IPagination { endDate?: Date; fromAddress?: string; toAddress?: string; + method?: string; + escrow?: string; + token?: string; } export interface IPagination { diff --git a/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts b/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts index 37397c7914..073e0a9f46 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts @@ -19,6 +19,22 @@ export class TransactionUtils { /** * This function returns the transaction data for the given hash. * + * ```ts + * type ITransaction = { + * block: bigint; + * txHash: string; + * from: string; + * to: string; + * timestamp: bigint; + * value: string; + * method: string; + * receiver?: string; + * escrow?: string; + * token?: string; + * internalTransactions: InternalTransaction[]; + * }; + * ``` + * * @param {ChainId} chainId The chain ID. * @param {string} hash The transaction hash. * @returns {Promise} Returns the transaction details. @@ -65,6 +81,9 @@ export class TransactionUtils { * chainId: ChainId; // List of chain IDs to query. * fromAddress?: string; // (Optional) The address from which transactions are sent. * toAddress?: string; // (Optional) The address to which transactions are sent. + * method?: string; // (Optional) The method of the transaction to filter by. + * escrow?: string; // (Optional) The escrow address to filter transactions. + * token?: string; // (Optional) The token address to filter transactions. * startDate?: Date; // (Optional) The start date to filter transactions (inclusive). * endDate?: Date; // (Optional) The end date to filter transactions (inclusive). * startBlock?: number; // (Optional) The start block number to filter transactions (inclusive). @@ -77,13 +96,17 @@ export class TransactionUtils { * * ```ts * type ITransaction = { - * block: number; + * block: bigint; * txHash: string; * from: string; * to: string; - * timestamp: number; + * timestamp: bigint; * value: string; * method: string; + * receiver?: string; + * escrow?: string; + * token?: string; + * internalTransactions: InternalTransaction[]; * }; * ``` * @@ -137,6 +160,9 @@ export class TransactionUtils { endDate: filter.endDate ? getUnixTimestamp(filter.endDate) : undefined, startBlock: filter.startBlock ? filter.startBlock : undefined, endBlock: filter.endBlock ? filter.endBlock : undefined, + method: filter.method ? filter.method : undefined, + escrow: filter.escrow ? filter.escrow : undefined, + token: filter.token ? filter.token : undefined, orderDirection: orderDirection, first: first, skip: skip, diff --git a/packages/sdk/typescript/human-protocol-sdk/test/transaction.test.ts b/packages/sdk/typescript/human-protocol-sdk/test/transaction.test.ts index 3af3444d6b..6b1486e3bd 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/transaction.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/transaction.test.ts @@ -120,6 +120,9 @@ describe('TransactionUtils', () => { endDate: undefined, startBlock: undefined, endBlock: undefined, + method: undefined, + escrow: undefined, + receiver: undefined, orderDirection: OrderDirection.DESC, first: 10, skip: 0, @@ -152,6 +155,9 @@ describe('TransactionUtils', () => { endDate: Math.floor(filter.endDate!.getTime() / 1000), startBlock: undefined, endBlock: undefined, + method: undefined, + escrow: undefined, + receiver: undefined, orderDirection: OrderDirection.DESC, first: 10, skip: 0, @@ -183,6 +189,9 @@ describe('TransactionUtils', () => { endDate: undefined, startBlock: undefined, endBlock: undefined, + method: undefined, + escrow: undefined, + receiver: undefined, orderDirection: OrderDirection.DESC, first: 10, skip: 0, @@ -191,6 +200,108 @@ describe('TransactionUtils', () => { expect(result).toEqual([mockTransaction, mockTransaction]); }); + test('should return an array of transactions filtered by method', async () => { + const gqlFetchSpy = vi.spyOn(gqlFetch, 'default').mockResolvedValueOnce({ + transactions: [mockTransaction], + }); + const filter: ITransactionsFilter = { + chainId: ChainId.LOCALHOST, + method: 'transfer', + first: 10, + skip: 0, + }; + + const result = await TransactionUtils.getTransactions(filter); + + expect(gqlFetchSpy).toHaveBeenCalledWith( + NETWORKS[ChainId.LOCALHOST]?.subgraphUrl, + expect.anything(), + { + fromAddress: undefined, + toAddress: undefined, + startDate: undefined, + endDate: undefined, + startBlock: undefined, + endBlock: undefined, + method: 'transfer', + escrow: undefined, + receiver: undefined, + orderDirection: OrderDirection.DESC, + first: 10, + skip: 0, + } + ); + expect(result).toEqual([mockTransaction]); + }); + + test('should return an array of transactions filtered by escrow', async () => { + const gqlFetchSpy = vi.spyOn(gqlFetch, 'default').mockResolvedValueOnce({ + transactions: [mockTransaction], + }); + const filter: ITransactionsFilter = { + chainId: ChainId.LOCALHOST, + escrow: '0x1234567890123456789012345678901234567890', + first: 10, + skip: 0, + }; + + const result = await TransactionUtils.getTransactions(filter); + + expect(gqlFetchSpy).toHaveBeenCalledWith( + NETWORKS[ChainId.LOCALHOST]?.subgraphUrl, + expect.anything(), + { + fromAddress: undefined, + toAddress: undefined, + startDate: undefined, + endDate: undefined, + startBlock: undefined, + endBlock: undefined, + method: undefined, + escrow: '0x1234567890123456789012345678901234567890', + receiver: undefined, + orderDirection: OrderDirection.DESC, + first: 10, + skip: 0, + } + ); + expect(result).toEqual([mockTransaction]); + }); + + test('should return an array of transactions filtered by token', async () => { + const gqlFetchSpy = vi.spyOn(gqlFetch, 'default').mockResolvedValueOnce({ + transactions: [mockTransaction], + }); + const filter: ITransactionsFilter = { + chainId: ChainId.LOCALHOST, + token: '0x1234567890123456789012345678901234567890', + first: 10, + skip: 0, + }; + + const result = await TransactionUtils.getTransactions(filter); + + expect(gqlFetchSpy).toHaveBeenCalledWith( + NETWORKS[ChainId.LOCALHOST]?.subgraphUrl, + expect.anything(), + { + fromAddress: undefined, + toAddress: undefined, + startDate: undefined, + endDate: undefined, + startBlock: undefined, + endBlock: undefined, + method: undefined, + escrow: undefined, + token: '0x1234567890123456789012345678901234567890', + orderDirection: OrderDirection.DESC, + first: 10, + skip: 0, + } + ); + expect(result).toEqual([mockTransaction]); + }); + test('should throw an error if both date and block filters are used', async () => { const filter: ITransactionsFilter = { chainId: ChainId.LOCALHOST, @@ -242,6 +353,9 @@ describe('TransactionUtils', () => { endDate: undefined, startBlock: undefined, endBlock: undefined, + method: undefined, + escrow: undefined, + receiver: undefined, orderDirection: OrderDirection.DESC, first: 10, skip: 10, @@ -272,6 +386,9 @@ describe('TransactionUtils', () => { endDate: undefined, startBlock: undefined, endBlock: undefined, + method: undefined, + escrow: undefined, + receiver: undefined, orderDirection: OrderDirection.DESC, first: 1000, skip: 10, @@ -305,6 +422,9 @@ describe('TransactionUtils', () => { endDate: Math.floor(filter.endDate!.getTime() / 1000), startBlock: undefined, endBlock: undefined, + method: undefined, + escrow: undefined, + receiver: undefined, orderDirection: OrderDirection.DESC, first: 5, skip: 5, From 420abe5f75bd424ac5b0cd363e1c629560ce5da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Mon, 16 Jun 2025 09:26:34 +0200 Subject: [PATCH 16/21] [Subgraph][SDK] Fix subgraph bulkpayout problems (#3391) Co-authored-by: portuu3 --- .github/workflows/cd-subgraph.yaml | 23 ++++---- docs/sdk/python/human_protocol_sdk.md | 6 ++ docs/sdk/python/human_protocol_sdk.worker.md | 13 +++++ .../human_protocol_sdk.worker.worker_utils.md | 50 +++++++++++++++++ docs/sdk/python/index.md | 2 + .../base/classes/BaseEthersClient.md | 8 +-- .../encryption/classes/Encryption.md | 12 ++-- .../encryption/classes/EncryptionUtils.md | 12 ++-- .../typescript/enums/enumerations/ChainId.md | 18 +++--- .../enums/enumerations/OperatorCategory.md | 6 +- .../enums/enumerations/OrderDirection.md | 6 +- .../typescript/escrow/classes/EscrowClient.md | 54 +++++++++--------- .../typescript/escrow/classes/EscrowUtils.md | 10 ++-- .../types/type-aliases/DailyEscrowData.md | 14 ++--- .../types/type-aliases/DailyHMTData.md | 12 ++-- .../types/type-aliases/DailyPaymentData.md | 10 ++-- .../types/type-aliases/DailyTaskData.md | 8 +-- .../types/type-aliases/DailyWorkerData.md | 6 +- .../graphql/types/type-aliases/EscrowData.md | 40 ++++++------- .../types/type-aliases/EscrowStatistics.md | 6 +- .../type-aliases/EscrowStatisticsData.md | 22 ++++---- .../types/type-aliases/EventDayData.md | 52 ++++++++--------- .../graphql/types/type-aliases/HMTHolder.md | 6 +- .../types/type-aliases/HMTHolderData.md | 6 +- .../types/type-aliases/HMTStatistics.md | 8 +-- .../types/type-aliases/HMTStatisticsData.md | 14 ++--- .../graphql/types/type-aliases/IMData.md | 2 +- .../types/type-aliases/IMDataEntity.md | 6 +- .../graphql/types/type-aliases/KVStoreData.md | 14 ++--- .../types/type-aliases/PaymentStatistics.md | 4 +- .../type-aliases/RewardAddedEventData.md | 10 ++-- .../graphql/types/type-aliases/StatusEvent.md | 10 ++-- .../types/type-aliases/TaskStatistics.md | 4 +- .../types/type-aliases/WorkerStatistics.md | 4 +- .../interfaces/interfaces/IEscrow.md | 40 ++++++------- .../interfaces/interfaces/IEscrowConfig.md | 18 +++--- .../interfaces/interfaces/IEscrowsFilter.md | 26 ++++----- .../interfaces/IHMTHoldersParams.md | 10 ++-- .../interfaces/interfaces/IKVStore.md | 6 +- .../interfaces/interfaces/IKeyPair.md | 10 ++-- .../interfaces/interfaces/IOperator.md | 46 +++++++-------- .../interfaces/IOperatorSubgraph.md | 44 +++++++-------- .../interfaces/interfaces/IOperatorsFilter.md | 16 +++--- .../interfaces/interfaces/IPagination.md | 8 +-- .../interfaces/interfaces/IPayoutFilter.md | 18 +++--- .../interfaces/IReputationNetwork.md | 8 +-- .../interfaces/IReputationNetworkSubgraph.md | 8 +-- .../interfaces/interfaces/IReward.md | 6 +- .../interfaces/IStatisticsFilter.md | 12 ++-- .../interfaces/IStatusEventFilter.md | 18 +++--- .../interfaces/interfaces/ITransaction.md | 24 ++++---- .../interfaces/ITransactionsFilter.md | 28 +++++----- .../interfaces/interfaces/IWorker.md | 14 ++--- .../interfaces/interfaces/IWorkersFilter.md | 14 ++--- .../interfaces/InternalTransaction.md | 16 +++--- .../interfaces/interfaces/StakerInfo.md | 10 ++-- .../kvstore/classes/KVStoreClient.md | 16 +++--- .../kvstore/classes/KVStoreUtils.md | 10 ++-- .../operator/classes/OperatorUtils.md | 10 ++-- .../staking/classes/StakingClient.md | 28 +++++----- .../statistics/classes/StatisticsClient.md | 20 +++---- .../storage/classes/StorageClient.md | 14 ++--- .../transaction/classes/TransactionUtils.md | 6 +- .../types/enumerations/EscrowStatus.md | 14 ++--- .../types/type-aliases/EscrowCancel.md | 6 +- .../types/type-aliases/EscrowWithdraw.md | 8 +-- .../types/type-aliases/NetworkData.md | 24 ++++---- .../typescript/types/type-aliases/Payout.md | 12 ++-- .../types/type-aliases/StorageCredentials.md | 6 +- .../types/type-aliases/StorageParams.md | 10 ++-- .../type-aliases/TransactionLikeWithNonce.md | 2 +- .../types/type-aliases/UploadFile.md | 8 +-- .../WalletAddress/WalletAddress.tsx | 5 +- .../src/services/api/use-address-details.tsx | 3 +- .../src/modules/details/details.service.ts | 4 +- .../src/modules/details/dto/wallet.dto.ts | 2 +- .../docs/human_protocol_sdk.rst | 1 + .../docs/human_protocol_sdk.worker.rst | 15 +++++ ...human_protocol_sdk.worker.worker_utils.rst | 7 +++ .../human_protocol_sdk/constants.py | 12 ++-- .../human_protocol_sdk/gql/statistics.py | 2 +- .../human_protocol_sdk/gql/worker.py | 2 +- .../statistics/statistics_client.py | 6 +- .../human_protocol_sdk/worker/worker_utils.py | 4 +- .../statistics/test_statistics_client.py | 2 +- .../worker/test_worker_utils.py | 10 ++-- .../human-protocol-sdk/src/constants.ts | 12 ++-- .../src/graphql/queries/statistics.ts | 2 +- .../src/graphql/queries/worker.ts | 4 +- .../human-protocol-sdk/src/graphql/types.ts | 2 +- .../human-protocol-sdk/src/interfaces.ts | 2 +- .../human-protocol-sdk/src/statistics.ts | 4 +- .../human-protocol-sdk/src/worker.ts | 2 +- .../test/statistics.test.ts | 2 +- .../human-protocol-sdk/test/worker.test.ts | 10 ++-- .../sdk/typescript/subgraph/schema.graphql | 4 +- .../subgraph/src/mapping/EscrowTemplate.ts | 56 ++++++++----------- .../subgraph/src/mapping/HMTokenTemplate.ts | 4 +- .../subgraph/src/mapping/utils/dayUpdates.ts | 2 +- .../sdk/typescript/subgraph/template.yaml | 2 +- .../typescript/subgraph/tests/hmt/hmt.test.ts | 2 +- 101 files changed, 670 insertions(+), 587 deletions(-) create mode 100644 docs/sdk/python/human_protocol_sdk.worker.md create mode 100644 docs/sdk/python/human_protocol_sdk.worker.worker_utils.md create mode 100644 packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.rst create mode 100644 packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.worker_utils.rst diff --git a/.github/workflows/cd-subgraph.yaml b/.github/workflows/cd-subgraph.yaml index 4abd139dad..9a61753575 100644 --- a/.github/workflows/cd-subgraph.yaml +++ b/.github/workflows/cd-subgraph.yaml @@ -1,5 +1,4 @@ name: Subgraph deployment - on: workflow_dispatch: inputs: @@ -53,23 +52,21 @@ jobs: - name: Build core package if: steps.filter_networks.outputs.continue == 'true' run: yarn build:core - - name: Install Graph CLI - if: steps.filter_networks.outputs.continue == 'true' - run: yarn global add @graphprotocol/graph-cli@0.71.2 - - name: Authenticate Graph CLI - if: steps.filter_networks.outputs.continue == 'true' - run: graph auth --studio ${API_KEY} - env: - API_KEY: ${{ secrets.HP_GRAPH_API_KEY }} - name: Generate and build Subgraph if: steps.filter_networks.outputs.continue == 'true' run: yarn generate && yarn build working-directory: ./packages/sdk/typescript/subgraph env: NETWORK: ${{ matrix.network.name }} - - name: Deploy Subgraph + - name: Authenticate & Deploy if: steps.filter_networks.outputs.continue == 'true' - run: graph deploy --studio ${NETWORK} -l ${{ github.event.inputs.label }} - working-directory: ./packages/sdk/typescript/subgraph env: - NETWORK: ${{ matrix.network.name }} + API_KEY: ${{ secrets.HP_GRAPH_API_KEY }} + NETWORK: ${{ matrix.network.name }} + LABEL: ${{ github.event.inputs.label }} + working-directory: ./packages/sdk/typescript/subgraph + run: | + yarn dlx @graphprotocol/graph-cli@0.71.2 \ + auth --studio "$API_KEY" + yarn dlx @graphprotocol/graph-cli@0.71.2 \ + deploy --studio ${NETWORK} -l ${LABEL} \ No newline at end of file diff --git a/docs/sdk/python/human_protocol_sdk.md b/docs/sdk/python/human_protocol_sdk.md index 7f19d62801..839f0f93e0 100644 --- a/docs/sdk/python/human_protocol_sdk.md +++ b/docs/sdk/python/human_protocol_sdk.md @@ -114,6 +114,12 @@ * [`TransactionData`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionData) * [`TransactionUtils`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionUtils) * [`TransactionUtilsError`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionUtilsError) +* [human_protocol_sdk.worker package](human_protocol_sdk.worker.md) + * [Submodules](human_protocol_sdk.worker.md#submodules) + * [human_protocol_sdk.worker.worker_utils module](human_protocol_sdk.worker.worker_utils.md) + * [`WorkerData`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData) + * [`WorkerUtils`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils) + * [`WorkerUtilsError`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtilsError) ## Submodules diff --git a/docs/sdk/python/human_protocol_sdk.worker.md b/docs/sdk/python/human_protocol_sdk.worker.md new file mode 100644 index 0000000000..e62f9a998c --- /dev/null +++ b/docs/sdk/python/human_protocol_sdk.worker.md @@ -0,0 +1,13 @@ +# human_protocol_sdk.worker package + +This module enables to obtain worker information from subgraph. + +## Submodules + +* [human_protocol_sdk.worker.worker_utils module](human_protocol_sdk.worker.worker_utils.md) + * [`WorkerData`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData) + * [`WorkerData.__init__()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData.__init__) + * [`WorkerUtils`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils) + * [`WorkerUtils.get_worker()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils.get_worker) + * [`WorkerUtils.get_workers()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils.get_workers) + * [`WorkerUtilsError`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtilsError) diff --git a/docs/sdk/python/human_protocol_sdk.worker.worker_utils.md b/docs/sdk/python/human_protocol_sdk.worker.worker_utils.md new file mode 100644 index 0000000000..91dea1a87c --- /dev/null +++ b/docs/sdk/python/human_protocol_sdk.worker.worker_utils.md @@ -0,0 +1,50 @@ +# human_protocol_sdk.worker.worker_utils module + +### *class* human_protocol_sdk.worker.worker_utils.WorkerData(id, address, total_amount_received, payout_count) + +Bases: `object` + +#### \_\_init_\_(id, address, total_amount_received, payout_count) + +Initializes a WorkerData instance. + +* **Parameters:** + * **id** (`str`) – Worker ID + * **address** (`str`) – Worker address + * **total_amount_received** (`int`) – Total amount received by the worker + * **payout_count** (`int`) – Number of payouts received by the worker + +### *class* human_protocol_sdk.worker.worker_utils.WorkerUtils + +Bases: `object` + +A utility class that provides additional worker-related functionalities. + +#### *static* get_worker(chain_id, worker_address) + +Gets the worker details. + +* **Parameters:** + * **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the worker exists + * **worker_address** (`str`) – Address of the worker +* **Return type:** + `Optional`[[`WorkerData`](#human_protocol_sdk.worker.worker_utils.WorkerData)] +* **Returns:** + Worker data if exists, otherwise None + +#### *static* get_workers(filter) + +Get workers data of the protocol. + +* **Parameters:** + **filter** ([`WorkerFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.WorkerFilter)) – Worker filter +* **Return type:** + `List`[[`WorkerData`](#human_protocol_sdk.worker.worker_utils.WorkerData)] +* **Returns:** + List of workers data + +### *exception* human_protocol_sdk.worker.worker_utils.WorkerUtilsError + +Bases: `Exception` + +Raised when an error occurs when getting data from subgraph. diff --git a/docs/sdk/python/index.md b/docs/sdk/python/index.md index 75b6eaeb1e..012cbdd460 100644 --- a/docs/sdk/python/index.md +++ b/docs/sdk/python/index.md @@ -42,6 +42,8 @@ pip install human-protocol-sdk[agreement] * [Submodules](human_protocol_sdk.storage.md#submodules) * [human_protocol_sdk.transaction package](human_protocol_sdk.transaction.md) * [Submodules](human_protocol_sdk.transaction.md#submodules) + * [human_protocol_sdk.worker package](human_protocol_sdk.worker.md) + * [Submodules](human_protocol_sdk.worker.md#submodules) * [Submodules](human_protocol_sdk.md#submodules) * [human_protocol_sdk.constants module](human_protocol_sdk.constants.md) * [`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId) diff --git a/docs/sdk/typescript/base/classes/BaseEthersClient.md b/docs/sdk/typescript/base/classes/BaseEthersClient.md index 5c2cee8710..f1ab048696 100644 --- a/docs/sdk/typescript/base/classes/BaseEthersClient.md +++ b/docs/sdk/typescript/base/classes/BaseEthersClient.md @@ -6,7 +6,7 @@ # Class: `abstract` BaseEthersClient -Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10) +Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10) ## Introduction @@ -24,7 +24,7 @@ This class is used as a base class for other clients making on-chain calls. > **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient` -Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) +Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) **BaseClient constructor** @@ -52,7 +52,7 @@ The network information required to connect to the contracts > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -60,4 +60,4 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3 > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/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 855fb08e3a..ecf46779f5 100644 --- a/docs/sdk/typescript/encryption/classes/Encryption.md +++ b/docs/sdk/typescript/encryption/classes/Encryption.md @@ -6,7 +6,7 @@ # Class: Encryption -Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58) +Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58) ## Introduction @@ -53,7 +53,7 @@ const encryption = await Encryption.build(privateKey, passphrase); > **new Encryption**(`privateKey`): `Encryption` -Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66) +Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66) Constructor for the Encryption class. @@ -75,7 +75,7 @@ The private key. > **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194) +Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194) This function decrypts messages using the private key. In addition, the public key can be added for signature verification. @@ -129,7 +129,7 @@ const resultMessage = await encryption.decrypt('message'); > **sign**(`message`): `Promise`\<`string`\> -Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251) +Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251) This function signs a message using the private key used to initialize the client. @@ -165,7 +165,7 @@ const resultMessage = await encryption.sign('message'); > **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\> -Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142) +Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142) This function signs and encrypts a message using the private key used to initialize the client and the specified public keys. @@ -232,7 +232,7 @@ const resultMessage = await encryption.signAndEncrypt('message', publicKeys); > `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\> -Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77) +Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77) Builds an Encryption instance by decrypting the private key from an encrypted private key and passphrase. diff --git a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md index 5d6ccebad6..7c56fe6d8f 100644 --- a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md +++ b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md @@ -6,7 +6,7 @@ # Class: EncryptionUtils -Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290) +Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290) ## Introduction @@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai'); > `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\> -Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444) +Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444) This function encrypts a message using the specified public keys. @@ -111,7 +111,7 @@ const result = await EncryptionUtils.encrypt('message', publicKeys); > `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\> -Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382) +Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382) This function generates a key pair for encryption and decryption. @@ -158,7 +158,7 @@ const result = await EncryptionUtils.generateKeyPair(name, email, passphrase); > `static` **getSignedData**(`message`): `Promise`\<`string`\> -Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351) +Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351) This function gets signed data from a signed message. @@ -190,7 +190,7 @@ const signedData = await EncryptionUtils.getSignedData('message'); > `static` **isEncrypted**(`message`): `boolean` -Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494) +Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494) Verifies if a message appears to be encrypted with OpenPGP. @@ -238,7 +238,7 @@ if (isEncrypted) { > `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\> -Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318) +Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318) This function verifies the signature of a signed message using the public key. diff --git a/docs/sdk/typescript/enums/enumerations/ChainId.md b/docs/sdk/typescript/enums/enumerations/ChainId.md index a2235c354d..bb3a336000 100644 --- a/docs/sdk/typescript/enums/enumerations/ChainId.md +++ b/docs/sdk/typescript/enums/enumerations/ChainId.md @@ -6,7 +6,7 @@ # Enumeration: ChainId -Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1) +Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/a3 > **ALL**: `-1` -Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) +Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) *** @@ -22,7 +22,7 @@ Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/a3 > **BSC\_MAINNET**: `56` -Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) +Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) *** @@ -30,7 +30,7 @@ Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3 > **BSC\_TESTNET**: `97` -Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) +Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) *** @@ -38,7 +38,7 @@ Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3 > **LOCALHOST**: `1338` -Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) +Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) *** @@ -46,7 +46,7 @@ Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3 > **MAINNET**: `1` -Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) +Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) *** @@ -54,7 +54,7 @@ Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/a3 > **POLYGON**: `137` -Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) +Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) *** @@ -62,7 +62,7 @@ Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/a3 > **POLYGON\_AMOY**: `80002` -Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) +Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) *** @@ -70,4 +70,4 @@ Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3 > **SEPOLIA**: `11155111` -Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) +Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) diff --git a/docs/sdk/typescript/enums/enumerations/OperatorCategory.md b/docs/sdk/typescript/enums/enumerations/OperatorCategory.md index 23cb8e00be..fe073231a7 100644 --- a/docs/sdk/typescript/enums/enumerations/OperatorCategory.md +++ b/docs/sdk/typescript/enums/enumerations/OperatorCategory.md @@ -6,7 +6,7 @@ # Enumeration: OperatorCategory -Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) +Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/a > **MACHINE\_LEARNING**: `"machine_learning"` -Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) +Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) *** @@ -22,4 +22,4 @@ Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/a > **MARKET\_MAKING**: `"market_making"` -Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) +Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) diff --git a/docs/sdk/typescript/enums/enumerations/OrderDirection.md b/docs/sdk/typescript/enums/enumerations/OrderDirection.md index db020df8cf..44edbc1f67 100644 --- a/docs/sdk/typescript/enums/enumerations/OrderDirection.md +++ b/docs/sdk/typescript/enums/enumerations/OrderDirection.md @@ -6,7 +6,7 @@ # Enumeration: OrderDirection -Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) +Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/a > **ASC**: `"asc"` -Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) +Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) *** @@ -22,4 +22,4 @@ Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/a > **DESC**: `"desc"` -Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) +Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) diff --git a/docs/sdk/typescript/escrow/classes/EscrowClient.md b/docs/sdk/typescript/escrow/classes/EscrowClient.md index d948de813e..7963dd8ec6 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowClient.md +++ b/docs/sdk/typescript/escrow/classes/EscrowClient.md @@ -6,7 +6,7 @@ # Class: EscrowClient -Defined in: [escrow.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L142) +Defined in: [escrow.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L142) ## Introduction @@ -86,7 +86,7 @@ const escrowClient = await EscrowClient.build(provider); > **new EscrowClient**(`runner`, `networkData`): `EscrowClient` -Defined in: [escrow.ts:151](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L151) +Defined in: [escrow.ts:151](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L151) **EscrowClient constructor** @@ -118,7 +118,7 @@ The network information required to connect to the Escrow contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from @@ -130,7 +130,7 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3 > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from @@ -142,7 +142,7 @@ Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3 > **addTrustedHandlers**(`escrowAddress`, `trustedHandlers`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:779](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L779) +Defined in: [escrow.ts:779](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L779) This function adds an array of addresses to the trusted handlers list. @@ -197,7 +197,7 @@ await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309 > **bulkPayOut**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:612](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L612) +Defined in: [escrow.ts:612](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L612) This function pays out the amounts specified to the workers and sets the URL of the final results file. @@ -287,7 +287,7 @@ await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', reci > **cancel**(`escrowAddress`, `txOptions?`): `Promise`\<[`EscrowCancel`](../../types/type-aliases/EscrowCancel.md)\> -Defined in: [escrow.ts:693](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L693) +Defined in: [escrow.ts:693](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L693) This function cancels the specified escrow and sends the balance to the canceler. @@ -335,7 +335,7 @@ await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); > **complete**(`escrowAddress`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:551](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L551) +Defined in: [escrow.ts:551](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L551) This function sets the status of an escrow to completed. @@ -383,7 +383,7 @@ await escrowClient.complete('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); > **createBulkPayoutTransaction**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions?`): `Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> -Defined in: [escrow.ts:948](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L948) +Defined in: [escrow.ts:948](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L948) Creates a prepared transaction for bulk payout without immediately sending it. @@ -477,7 +477,7 @@ console.log('Tx hash:', ethers.keccak256(signedTransaction)); > **createEscrow**(`tokenAddress`, `trustedHandlers`, `jobRequesterId`, `txOptions?`): `Promise`\<`string`\> -Defined in: [escrow.ts:231](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L231) +Defined in: [escrow.ts:231](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L231) This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers. @@ -540,7 +540,7 @@ const escrowAddress = await escrowClient.createEscrow(tokenAddress, trustedHandl > **fund**(`escrowAddress`, `amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:422](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L422) +Defined in: [escrow.ts:422](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L422) This function adds funds of the chosen token to the escrow. @@ -593,7 +593,7 @@ await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount); > **getBalance**(`escrowAddress`): `Promise`\<`bigint`\> -Defined in: [escrow.ts:1093](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1093) +Defined in: [escrow.ts:1093](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1093) This function returns the balance for a specified escrow address. @@ -631,7 +631,7 @@ const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e > **getExchangeOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1479](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1479) +Defined in: [escrow.ts:1479](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1479) This function returns the exchange oracle address for a given escrow. @@ -669,7 +669,7 @@ const oracleAddress = await escrowClient.getExchangeOracleAddress('0x62dD51230A3 > **getFactoryAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1517](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1517) +Defined in: [escrow.ts:1517](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1517) This function returns the escrow factory address for a given escrow. @@ -707,7 +707,7 @@ const factoryAddress = await escrowClient.getFactoryAddress('0x62dD51230A30401C4 > **getIntermediateResultsUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1251](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1251) +Defined in: [escrow.ts:1251](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1251) This function returns the intermediate results file URL. @@ -745,7 +745,7 @@ const intermediateResultsUrl = await escrowClient.getIntermediateResultsUrl('0x6 > **getJobLauncherAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1403](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1403) +Defined in: [escrow.ts:1403](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1403) This function returns the job launcher address for a given escrow. @@ -783,7 +783,7 @@ const jobLauncherAddress = await escrowClient.getJobLauncherAddress('0x62dD51230 > **getManifestHash**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1137](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1137) +Defined in: [escrow.ts:1137](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1137) This function returns the manifest file hash. @@ -821,7 +821,7 @@ const manifestHash = await escrowClient.getManifestHash('0x62dD51230A30401C455c8 > **getManifestUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1175](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1175) +Defined in: [escrow.ts:1175](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1175) This function returns the manifest file URL. @@ -859,7 +859,7 @@ const manifestUrl = await escrowClient.getManifestUrl('0x62dD51230A30401C455c839 > **getRecordingOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1365](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1365) +Defined in: [escrow.ts:1365](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1365) This function returns the recording oracle address for a given escrow. @@ -897,7 +897,7 @@ const oracleAddress = await escrowClient.getRecordingOracleAddress('0x62dD51230A > **getReputationOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1441](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1441) +Defined in: [escrow.ts:1441](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1441) This function returns the reputation oracle address for a given escrow. @@ -935,7 +935,7 @@ const oracleAddress = await escrowClient.getReputationOracleAddress('0x62dD51230 > **getResultsUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1213](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1213) +Defined in: [escrow.ts:1213](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1213) This function returns the results file URL. @@ -973,7 +973,7 @@ const resultsUrl = await escrowClient.getResultsUrl('0x62dD51230A30401C455c8398d > **getStatus**(`escrowAddress`): `Promise`\<[`EscrowStatus`](../../types/enumerations/EscrowStatus.md)\> -Defined in: [escrow.ts:1327](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1327) +Defined in: [escrow.ts:1327](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1327) This function returns the current status of the escrow. @@ -1011,7 +1011,7 @@ const status = await escrowClient.getStatus('0x62dD51230A30401C455c8398d06F85e4E > **getTokenAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1289](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1289) +Defined in: [escrow.ts:1289](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1289) This function returns the token address used for funding the escrow. @@ -1049,7 +1049,7 @@ const tokenAddress = await escrowClient.getTokenAddress('0x62dD51230A30401C455c8 > **setup**(`escrowAddress`, `escrowConfig`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:312](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L312) +Defined in: [escrow.ts:312](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L312) This function sets up the parameters of the escrow. @@ -1114,7 +1114,7 @@ await escrowClient.setup(escrowAddress, escrowConfig); > **storeResults**(`escrowAddress`, `url`, `hash`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:487](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L487) +Defined in: [escrow.ts:487](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L487) This function stores the results URL and hash. @@ -1174,7 +1174,7 @@ await escrowClient.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'h > **withdraw**(`escrowAddress`, `tokenAddress`, `txOptions?`): `Promise`\<[`EscrowWithdraw`](../../types/type-aliases/EscrowWithdraw.md)\> -Defined in: [escrow.ts:845](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L845) +Defined in: [escrow.ts:845](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L845) This function withdraws additional tokens in the escrow to the canceler. @@ -1231,7 +1231,7 @@ await escrowClient.withdraw( > `static` **build**(`runner`): `Promise`\<`EscrowClient`\> -Defined in: [escrow.ts:169](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L169) +Defined in: [escrow.ts:169](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L169) Creates an instance of EscrowClient from a Runner. diff --git a/docs/sdk/typescript/escrow/classes/EscrowUtils.md b/docs/sdk/typescript/escrow/classes/EscrowUtils.md index e87c7fb10f..e683ad1f73 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowUtils.md +++ b/docs/sdk/typescript/escrow/classes/EscrowUtils.md @@ -6,7 +6,7 @@ # Class: EscrowUtils -Defined in: [escrow.ts:1566](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1566) +Defined in: [escrow.ts:1566](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1566) ## Introduction @@ -54,7 +54,7 @@ const escrowAddresses = new EscrowUtils.getEscrows({ > `static` **getEscrow**(`chainId`, `escrowAddress`): `Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)\> -Defined in: [escrow.ts:1779](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1779) +Defined in: [escrow.ts:1779](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1779) This function returns the escrow data for a given address. @@ -133,7 +133,7 @@ const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x12345678901234 > `static` **getEscrows**(`filter`): `Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)[]\> -Defined in: [escrow.ts:1663](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1663) +Defined in: [escrow.ts:1663](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1663) This function returns an array of escrows based on the specified filter parameters. @@ -245,7 +245,7 @@ const escrows = await EscrowUtils.getEscrows(filters); > `static` **getPayouts**(`filter`): `Promise`\<[`Payout`](../../types/type-aliases/Payout.md)[]\> -Defined in: [escrow.ts:1949](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1949) +Defined in: [escrow.ts:1949](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1949) This function returns the payouts for a given set of networks. @@ -289,7 +289,7 @@ console.log(payouts); > `static` **getStatusEvents**(`filter`): `Promise`\<[`StatusEvent`](../../graphql/types/type-aliases/StatusEvent.md)[]\> -Defined in: [escrow.ts:1858](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1858) +Defined in: [escrow.ts:1858](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1858) This function returns the status events for a given set of networks within an optional date range. diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md index 75da5e7f98..e756468529 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md @@ -8,7 +8,7 @@ > **DailyEscrowData** = `object` -Defined in: [graphql/types.ts:75](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L75) +Defined in: [graphql/types.ts:75](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L75) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:75](https://github.com/humanprotocol/human-protoco > **escrowsCancelled**: `number` -Defined in: [graphql/types.ts:81](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L81) +Defined in: [graphql/types.ts:81](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L81) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:81](https://github.com/humanprotocol/human-protoco > **escrowsPaid**: `number` -Defined in: [graphql/types.ts:80](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L80) +Defined in: [graphql/types.ts:80](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L80) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:80](https://github.com/humanprotocol/human-protoco > **escrowsPending**: `number` -Defined in: [graphql/types.ts:78](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L78) +Defined in: [graphql/types.ts:78](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L78) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:78](https://github.com/humanprotocol/human-protoco > **escrowsSolved**: `number` -Defined in: [graphql/types.ts:79](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L79) +Defined in: [graphql/types.ts:79](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L79) *** @@ -48,7 +48,7 @@ Defined in: [graphql/types.ts:79](https://github.com/humanprotocol/human-protoco > **escrowsTotal**: `number` -Defined in: [graphql/types.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L77) +Defined in: [graphql/types.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L77) *** @@ -56,4 +56,4 @@ Defined in: [graphql/types.ts:77](https://github.com/humanprotocol/human-protoco > **timestamp**: `Date` -Defined in: [graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) +Defined in: [graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md index 22f2825128..00b8281cee 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md @@ -8,7 +8,7 @@ > **DailyHMTData** = `object` -Defined in: [graphql/types.ts:119](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L119) +Defined in: [graphql/types.ts:119](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L119) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:119](https://github.com/humanprotocol/human-protoc > **dailyUniqueReceivers**: `number` -Defined in: [graphql/types.ts:124](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L124) +Defined in: [graphql/types.ts:124](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L124) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:124](https://github.com/humanprotocol/human-protoc > **dailyUniqueSenders**: `number` -Defined in: [graphql/types.ts:123](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L123) +Defined in: [graphql/types.ts:123](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L123) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:123](https://github.com/humanprotocol/human-protoc > **timestamp**: `Date` -Defined in: [graphql/types.ts:120](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L120) +Defined in: [graphql/types.ts:120](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L120) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:120](https://github.com/humanprotocol/human-protoc > **totalTransactionAmount**: `bigint` -Defined in: [graphql/types.ts:121](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L121) +Defined in: [graphql/types.ts:121](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L121) *** @@ -48,4 +48,4 @@ Defined in: [graphql/types.ts:121](https://github.com/humanprotocol/human-protoc > **totalTransactionCount**: `number` -Defined in: [graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) +Defined in: [graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md index ee51349400..579d949a7c 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md @@ -8,7 +8,7 @@ > **DailyPaymentData** = `object` -Defined in: [graphql/types.ts:98](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L98) +Defined in: [graphql/types.ts:98](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L98) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:98](https://github.com/humanprotocol/human-protoco > **averageAmountPerWorker**: `bigint` -Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) +Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protoc > **timestamp**: `Date` -Defined in: [graphql/types.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L99) +Defined in: [graphql/types.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L99) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:99](https://github.com/humanprotocol/human-protoco > **totalAmountPaid**: `bigint` -Defined in: [graphql/types.ts:100](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L100) +Defined in: [graphql/types.ts:100](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L100) *** @@ -40,4 +40,4 @@ Defined in: [graphql/types.ts:100](https://github.com/humanprotocol/human-protoc > **totalCount**: `number` -Defined in: [graphql/types.ts:101](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L101) +Defined in: [graphql/types.ts:101](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L101) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md index 100ce35d4b..64c00976cd 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md @@ -8,7 +8,7 @@ > **DailyTaskData** = `object` -Defined in: [graphql/types.ts:140](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L140) +Defined in: [graphql/types.ts:140](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L140) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:140](https://github.com/humanprotocol/human-protoc > **tasksSolved**: `number` -Defined in: [graphql/types.ts:143](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L143) +Defined in: [graphql/types.ts:143](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L143) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:143](https://github.com/humanprotocol/human-protoc > **tasksTotal**: `number` -Defined in: [graphql/types.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L142) +Defined in: [graphql/types.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L142) *** @@ -32,4 +32,4 @@ Defined in: [graphql/types.ts:142](https://github.com/humanprotocol/human-protoc > **timestamp**: `Date` -Defined in: [graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) +Defined in: [graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md index 3390a14065..5afd7db4fb 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md @@ -8,7 +8,7 @@ > **DailyWorkerData** = `object` -Defined in: [graphql/types.ts:89](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L89) +Defined in: [graphql/types.ts:89](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L89) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:89](https://github.com/humanprotocol/human-protoco > **activeWorkers**: `number` -Defined in: [graphql/types.ts:91](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L91) +Defined in: [graphql/types.ts:91](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L91) *** @@ -24,4 +24,4 @@ Defined in: [graphql/types.ts:91](https://github.com/humanprotocol/human-protoco > **timestamp**: `Date` -Defined in: [graphql/types.ts:90](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L90) +Defined in: [graphql/types.ts:90](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L90) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md index d6e4907525..f2db4f6a50 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md @@ -8,7 +8,7 @@ > **EscrowData** = `object` -Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) +Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol > **address**: `string` -Defined in: [graphql/types.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L5) +Defined in: [graphql/types.ts:5](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L5) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:5](https://github.com/humanprotocol/human-protocol > **amountPaid**: `string` -Defined in: [graphql/types.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L6) +Defined in: [graphql/types.ts:6](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L6) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:6](https://github.com/humanprotocol/human-protocol > **balance**: `string` -Defined in: [graphql/types.ts:7](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L7) +Defined in: [graphql/types.ts:7](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L7) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:7](https://github.com/humanprotocol/human-protocol > **chainId**: `number` -Defined in: [graphql/types.ts:22](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L22) +Defined in: [graphql/types.ts:22](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L22) *** @@ -48,7 +48,7 @@ Defined in: [graphql/types.ts:22](https://github.com/humanprotocol/human-protoco > **count**: `string` -Defined in: [graphql/types.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L8) +Defined in: [graphql/types.ts:8](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L8) *** @@ -56,7 +56,7 @@ Defined in: [graphql/types.ts:8](https://github.com/humanprotocol/human-protocol > **createdAt**: `string` -Defined in: [graphql/types.ts:21](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L21) +Defined in: [graphql/types.ts:21](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L21) *** @@ -64,7 +64,7 @@ Defined in: [graphql/types.ts:21](https://github.com/humanprotocol/human-protoco > `optional` **exchangeOracle**: `string` -Defined in: [graphql/types.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L17) +Defined in: [graphql/types.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L17) *** @@ -72,7 +72,7 @@ Defined in: [graphql/types.ts:17](https://github.com/humanprotocol/human-protoco > **factoryAddress**: `string` -Defined in: [graphql/types.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L9) +Defined in: [graphql/types.ts:9](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L9) *** @@ -80,7 +80,7 @@ Defined in: [graphql/types.ts:9](https://github.com/humanprotocol/human-protocol > `optional` **finalResultsUrl**: `string` -Defined in: [graphql/types.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L10) +Defined in: [graphql/types.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L10) *** @@ -88,7 +88,7 @@ Defined in: [graphql/types.ts:10](https://github.com/humanprotocol/human-protoco > **id**: `string` -Defined in: [graphql/types.ts:4](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L4) +Defined in: [graphql/types.ts:4](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L4) *** @@ -96,7 +96,7 @@ Defined in: [graphql/types.ts:4](https://github.com/humanprotocol/human-protocol > `optional` **intermediateResultsUrl**: `string` -Defined in: [graphql/types.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L11) +Defined in: [graphql/types.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L11) *** @@ -104,7 +104,7 @@ Defined in: [graphql/types.ts:11](https://github.com/humanprotocol/human-protoco > **launcher**: `string` -Defined in: [graphql/types.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L12) +Defined in: [graphql/types.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L12) *** @@ -112,7 +112,7 @@ Defined in: [graphql/types.ts:12](https://github.com/humanprotocol/human-protoco > `optional` **manifestHash**: `string` -Defined in: [graphql/types.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L13) +Defined in: [graphql/types.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L13) *** @@ -120,7 +120,7 @@ Defined in: [graphql/types.ts:13](https://github.com/humanprotocol/human-protoco > `optional` **manifestUrl**: `string` -Defined in: [graphql/types.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L14) +Defined in: [graphql/types.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L14) *** @@ -128,7 +128,7 @@ Defined in: [graphql/types.ts:14](https://github.com/humanprotocol/human-protoco > `optional` **recordingOracle**: `string` -Defined in: [graphql/types.ts:15](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L15) +Defined in: [graphql/types.ts:15](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L15) *** @@ -136,7 +136,7 @@ Defined in: [graphql/types.ts:15](https://github.com/humanprotocol/human-protoco > `optional` **reputationOracle**: `string` -Defined in: [graphql/types.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L16) +Defined in: [graphql/types.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L16) *** @@ -144,7 +144,7 @@ Defined in: [graphql/types.ts:16](https://github.com/humanprotocol/human-protoco > **status**: `string` -Defined in: [graphql/types.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L18) +Defined in: [graphql/types.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L18) *** @@ -152,7 +152,7 @@ Defined in: [graphql/types.ts:18](https://github.com/humanprotocol/human-protoco > **token**: `string` -Defined in: [graphql/types.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L19) +Defined in: [graphql/types.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L19) *** @@ -160,4 +160,4 @@ Defined in: [graphql/types.ts:19](https://github.com/humanprotocol/human-protoco > **totalFundedAmount**: `string` -Defined in: [graphql/types.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L20) +Defined in: [graphql/types.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L20) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md index 969d34f7db..ec1bd885db 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md @@ -8,7 +8,7 @@ > **EscrowStatistics** = `object` -Defined in: [graphql/types.ts:84](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L84) +Defined in: [graphql/types.ts:84](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L84) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:84](https://github.com/humanprotocol/human-protoco > **dailyEscrowsData**: [`DailyEscrowData`](DailyEscrowData.md)[] -Defined in: [graphql/types.ts:86](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L86) +Defined in: [graphql/types.ts:86](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L86) *** @@ -24,4 +24,4 @@ Defined in: [graphql/types.ts:86](https://github.com/humanprotocol/human-protoco > **totalEscrows**: `number` -Defined in: [graphql/types.ts:85](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L85) +Defined in: [graphql/types.ts:85](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L85) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md index 13cf87b529..eaea901611 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md @@ -8,7 +8,7 @@ > **EscrowStatisticsData** = `object` -Defined in: [graphql/types.ts:34](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L34) +Defined in: [graphql/types.ts:34](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L34) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:34](https://github.com/humanprotocol/human-protoco > **bulkPayoutEventCount**: `string` -Defined in: [graphql/types.ts:37](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L37) +Defined in: [graphql/types.ts:37](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L37) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:37](https://github.com/humanprotocol/human-protoco > **cancelledStatusEventCount**: `string` -Defined in: [graphql/types.ts:39](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L39) +Defined in: [graphql/types.ts:39](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L39) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:39](https://github.com/humanprotocol/human-protoco > **completedStatusEventCount**: `string` -Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) +Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protoco > **fundEventCount**: `string` -Defined in: [graphql/types.ts:35](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L35) +Defined in: [graphql/types.ts:35](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L35) *** @@ -48,7 +48,7 @@ Defined in: [graphql/types.ts:35](https://github.com/humanprotocol/human-protoco > **paidStatusEventCount**: `string` -Defined in: [graphql/types.ts:41](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L41) +Defined in: [graphql/types.ts:41](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L41) *** @@ -56,7 +56,7 @@ Defined in: [graphql/types.ts:41](https://github.com/humanprotocol/human-protoco > **partialStatusEventCount**: `string` -Defined in: [graphql/types.ts:40](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L40) +Defined in: [graphql/types.ts:40](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L40) *** @@ -64,7 +64,7 @@ Defined in: [graphql/types.ts:40](https://github.com/humanprotocol/human-protoco > **pendingStatusEventCount**: `string` -Defined in: [graphql/types.ts:38](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L38) +Defined in: [graphql/types.ts:38](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L38) *** @@ -72,7 +72,7 @@ Defined in: [graphql/types.ts:38](https://github.com/humanprotocol/human-protoco > **storeResultsEventCount**: `string` -Defined in: [graphql/types.ts:36](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L36) +Defined in: [graphql/types.ts:36](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L36) *** @@ -80,7 +80,7 @@ Defined in: [graphql/types.ts:36](https://github.com/humanprotocol/human-protoco > **totalEscrowCount**: `string` -Defined in: [graphql/types.ts:44](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L44) +Defined in: [graphql/types.ts:44](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L44) *** @@ -88,4 +88,4 @@ Defined in: [graphql/types.ts:44](https://github.com/humanprotocol/human-protoco > **totalEventCount**: `string` -Defined in: [graphql/types.ts:43](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L43) +Defined in: [graphql/types.ts:43](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L43) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md index e14a280224..75206a67ad 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md @@ -8,7 +8,7 @@ > **EventDayData** = `object` -Defined in: [graphql/types.ts:47](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L47) +Defined in: [graphql/types.ts:47](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L47) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:47](https://github.com/humanprotocol/human-protoco > **dailyBulkPayoutEventCount**: `string` -Defined in: [graphql/types.ts:51](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L51) +Defined in: [graphql/types.ts:51](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L51) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:51](https://github.com/humanprotocol/human-protoco > **dailyCancelledStatusEventCount**: `string` -Defined in: [graphql/types.ts:53](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L53) +Defined in: [graphql/types.ts:53](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L53) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:53](https://github.com/humanprotocol/human-protoco > **dailyCompletedStatusEventCount**: `string` -Defined in: [graphql/types.ts:56](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L56) +Defined in: [graphql/types.ts:56](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L56) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:56](https://github.com/humanprotocol/human-protoco > **dailyEscrowCount**: `string` -Defined in: [graphql/types.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L58) +Defined in: [graphql/types.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L58) *** @@ -48,7 +48,15 @@ Defined in: [graphql/types.ts:58](https://github.com/humanprotocol/human-protoco > **dailyFundEventCount**: `string` -Defined in: [graphql/types.ts:49](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L49) +Defined in: [graphql/types.ts:49](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L49) + +*** + +### dailyHMTPayoutAmount + +> **dailyHMTPayoutAmount**: `string` + +Defined in: [graphql/types.ts:61](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L61) *** @@ -56,7 +64,7 @@ Defined in: [graphql/types.ts:49](https://github.com/humanprotocol/human-protoco > **dailyHMTTransferAmount**: `string` -Defined in: [graphql/types.ts:63](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L63) +Defined in: [graphql/types.ts:63](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L63) *** @@ -64,7 +72,7 @@ Defined in: [graphql/types.ts:63](https://github.com/humanprotocol/human-protoco > **dailyHMTTransferCount**: `string` -Defined in: [graphql/types.ts:62](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L62) +Defined in: [graphql/types.ts:62](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L62) *** @@ -72,7 +80,7 @@ Defined in: [graphql/types.ts:62](https://github.com/humanprotocol/human-protoco > **dailyPaidStatusEventCount**: `string` -Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) +Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) *** @@ -80,15 +88,7 @@ Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protoco > **dailyPartialStatusEventCount**: `string` -Defined in: [graphql/types.ts:54](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L54) - -*** - -### dailyPayoutAmount - -> **dailyPayoutAmount**: `string` - -Defined in: [graphql/types.ts:61](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L61) +Defined in: [graphql/types.ts:54](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L54) *** @@ -96,7 +96,7 @@ Defined in: [graphql/types.ts:61](https://github.com/humanprotocol/human-protoco > **dailyPayoutCount**: `string` -Defined in: [graphql/types.ts:60](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L60) +Defined in: [graphql/types.ts:60](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L60) *** @@ -104,7 +104,7 @@ Defined in: [graphql/types.ts:60](https://github.com/humanprotocol/human-protoco > **dailyPendingStatusEventCount**: `string` -Defined in: [graphql/types.ts:52](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L52) +Defined in: [graphql/types.ts:52](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L52) *** @@ -112,7 +112,7 @@ Defined in: [graphql/types.ts:52](https://github.com/humanprotocol/human-protoco > **dailyStoreResultsEventCount**: `string` -Defined in: [graphql/types.ts:50](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L50) +Defined in: [graphql/types.ts:50](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L50) *** @@ -120,7 +120,7 @@ Defined in: [graphql/types.ts:50](https://github.com/humanprotocol/human-protoco > **dailyTotalEventCount**: `string` -Defined in: [graphql/types.ts:57](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L57) +Defined in: [graphql/types.ts:57](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L57) *** @@ -128,7 +128,7 @@ Defined in: [graphql/types.ts:57](https://github.com/humanprotocol/human-protoco > **dailyUniqueReceivers**: `string` -Defined in: [graphql/types.ts:65](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L65) +Defined in: [graphql/types.ts:65](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L65) *** @@ -136,7 +136,7 @@ Defined in: [graphql/types.ts:65](https://github.com/humanprotocol/human-protoco > **dailyUniqueSenders**: `string` -Defined in: [graphql/types.ts:64](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L64) +Defined in: [graphql/types.ts:64](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L64) *** @@ -144,7 +144,7 @@ Defined in: [graphql/types.ts:64](https://github.com/humanprotocol/human-protoco > **dailyWorkerCount**: `string` -Defined in: [graphql/types.ts:59](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L59) +Defined in: [graphql/types.ts:59](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L59) *** @@ -152,4 +152,4 @@ Defined in: [graphql/types.ts:59](https://github.com/humanprotocol/human-protoco > **timestamp**: `string` -Defined in: [graphql/types.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L48) +Defined in: [graphql/types.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L48) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md index 956c4ef778..c071ee89e1 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md @@ -8,7 +8,7 @@ > **HMTHolder** = `object` -Defined in: [graphql/types.ts:114](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L114) +Defined in: [graphql/types.ts:114](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L114) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:114](https://github.com/humanprotocol/human-protoc > **address**: `string` -Defined in: [graphql/types.ts:115](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L115) +Defined in: [graphql/types.ts:115](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L115) *** @@ -24,4 +24,4 @@ Defined in: [graphql/types.ts:115](https://github.com/humanprotocol/human-protoc > **balance**: `bigint` -Defined in: [graphql/types.ts:116](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L116) +Defined in: [graphql/types.ts:116](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L116) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md index ae4e0cde6c..ee55c1590c 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md @@ -8,7 +8,7 @@ > **HMTHolderData** = `object` -Defined in: [graphql/types.ts:109](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L109) +Defined in: [graphql/types.ts:109](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L109) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:109](https://github.com/humanprotocol/human-protoc > **address**: `string` -Defined in: [graphql/types.ts:110](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L110) +Defined in: [graphql/types.ts:110](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L110) *** @@ -24,4 +24,4 @@ Defined in: [graphql/types.ts:110](https://github.com/humanprotocol/human-protoc > **balance**: `string` -Defined in: [graphql/types.ts:111](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L111) +Defined in: [graphql/types.ts:111](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L111) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md index d5f3b2b4f6..f55590cbf4 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md @@ -8,7 +8,7 @@ > **HMTStatistics** = `object` -Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) +Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protoc > **totalHolders**: `number` -Defined in: [graphql/types.ts:130](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L130) +Defined in: [graphql/types.ts:130](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L130) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:130](https://github.com/humanprotocol/human-protoc > **totalTransferAmount**: `bigint` -Defined in: [graphql/types.ts:128](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L128) +Defined in: [graphql/types.ts:128](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L128) *** @@ -32,4 +32,4 @@ Defined in: [graphql/types.ts:128](https://github.com/humanprotocol/human-protoc > **totalTransferCount**: `number` -Defined in: [graphql/types.ts:129](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L129) +Defined in: [graphql/types.ts:129](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L129) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md index ef3dd747a4..2a17ef82dd 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md @@ -8,7 +8,7 @@ > **HMTStatisticsData** = `object` -Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) +Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protoco > **holders**: `string` -Defined in: [graphql/types.ts:31](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L31) +Defined in: [graphql/types.ts:31](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L31) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:31](https://github.com/humanprotocol/human-protoco > **totalApprovalEventCount**: `string` -Defined in: [graphql/types.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L28) +Defined in: [graphql/types.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L28) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:28](https://github.com/humanprotocol/human-protoco > **totalBulkApprovalEventCount**: `string` -Defined in: [graphql/types.ts:29](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L29) +Defined in: [graphql/types.ts:29](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L29) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:29](https://github.com/humanprotocol/human-protoco > **totalBulkTransferEventCount**: `string` -Defined in: [graphql/types.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L27) +Defined in: [graphql/types.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L27) *** @@ -48,7 +48,7 @@ Defined in: [graphql/types.ts:27](https://github.com/humanprotocol/human-protoco > **totalTransferEventCount**: `string` -Defined in: [graphql/types.ts:26](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L26) +Defined in: [graphql/types.ts:26](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L26) *** @@ -56,4 +56,4 @@ Defined in: [graphql/types.ts:26](https://github.com/humanprotocol/human-protoco > **totalValueTransfered**: `string` -Defined in: [graphql/types.ts:30](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L30) +Defined in: [graphql/types.ts:30](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L30) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md index 7374817876..37ddf93d0d 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md @@ -8,4 +8,4 @@ > **IMData** = `Record`\<`string`, [`IMDataEntity`](IMDataEntity.md)\> -Defined in: [graphql/types.ts:138](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L138) +Defined in: [graphql/types.ts:138](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L138) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md index c64e874906..96725b9155 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md @@ -8,7 +8,7 @@ > **IMDataEntity** = `object` -Defined in: [graphql/types.ts:133](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L133) +Defined in: [graphql/types.ts:133](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L133) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:133](https://github.com/humanprotocol/human-protoc > **served**: `number` -Defined in: [graphql/types.ts:134](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L134) +Defined in: [graphql/types.ts:134](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L134) *** @@ -24,4 +24,4 @@ Defined in: [graphql/types.ts:134](https://github.com/humanprotocol/human-protoc > **solved**: `number` -Defined in: [graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) +Defined in: [graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md index 169a975703..8780ce7efd 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md @@ -8,7 +8,7 @@ > **KVStoreData** = `object` -Defined in: [graphql/types.ts:157](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L157) +Defined in: [graphql/types.ts:157](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L157) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:157](https://github.com/humanprotocol/human-protoc > **address**: `string` -Defined in: [graphql/types.ts:159](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L159) +Defined in: [graphql/types.ts:159](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L159) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:159](https://github.com/humanprotocol/human-protoc > **block**: `number` -Defined in: [graphql/types.ts:163](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L163) +Defined in: [graphql/types.ts:163](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L163) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:163](https://github.com/humanprotocol/human-protoc > **id**: `string` -Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) +Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) *** @@ -40,7 +40,7 @@ Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protoc > **key**: `string` -Defined in: [graphql/types.ts:160](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L160) +Defined in: [graphql/types.ts:160](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L160) *** @@ -48,7 +48,7 @@ Defined in: [graphql/types.ts:160](https://github.com/humanprotocol/human-protoc > **timestamp**: `Date` -Defined in: [graphql/types.ts:162](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L162) +Defined in: [graphql/types.ts:162](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L162) *** @@ -56,4 +56,4 @@ Defined in: [graphql/types.ts:162](https://github.com/humanprotocol/human-protoc > **value**: `string` -Defined in: [graphql/types.ts:161](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L161) +Defined in: [graphql/types.ts:161](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L161) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md index f24190adfb..64b2e63133 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md @@ -8,7 +8,7 @@ > **PaymentStatistics** = `object` -Defined in: [graphql/types.ts:105](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L105) +Defined in: [graphql/types.ts:105](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L105) ## Properties @@ -16,4 +16,4 @@ Defined in: [graphql/types.ts:105](https://github.com/humanprotocol/human-protoc > **dailyPaymentsData**: [`DailyPaymentData`](DailyPaymentData.md)[] -Defined in: [graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) +Defined in: [graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md index 07a3e39b38..abb41fb55f 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md @@ -8,7 +8,7 @@ > **RewardAddedEventData** = `object` -Defined in: [graphql/types.ts:68](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L68) +Defined in: [graphql/types.ts:68](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L68) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:68](https://github.com/humanprotocol/human-protoco > **amount**: `string` -Defined in: [graphql/types.ts:72](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L72) +Defined in: [graphql/types.ts:72](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L72) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:72](https://github.com/humanprotocol/human-protoco > **escrowAddress**: `string` -Defined in: [graphql/types.ts:69](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L69) +Defined in: [graphql/types.ts:69](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L69) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:69](https://github.com/humanprotocol/human-protoco > **slasher**: `string` -Defined in: [graphql/types.ts:71](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L71) +Defined in: [graphql/types.ts:71](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L71) *** @@ -40,4 +40,4 @@ Defined in: [graphql/types.ts:71](https://github.com/humanprotocol/human-protoco > **staker**: `string` -Defined in: [graphql/types.ts:70](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L70) +Defined in: [graphql/types.ts:70](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L70) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md index d072664578..52ab27fbf9 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md @@ -8,7 +8,7 @@ > **StatusEvent** = `object` -Defined in: [graphql/types.ts:150](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L150) +Defined in: [graphql/types.ts:150](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L150) ## Properties @@ -16,7 +16,7 @@ Defined in: [graphql/types.ts:150](https://github.com/humanprotocol/human-protoc > **chainId**: [`ChainId`](../../../enums/enumerations/ChainId.md) -Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) +Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) *** @@ -24,7 +24,7 @@ Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protoc > **escrowAddress**: `string` -Defined in: [graphql/types.ts:152](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L152) +Defined in: [graphql/types.ts:152](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L152) *** @@ -32,7 +32,7 @@ Defined in: [graphql/types.ts:152](https://github.com/humanprotocol/human-protoc > **status**: `string` -Defined in: [graphql/types.ts:153](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L153) +Defined in: [graphql/types.ts:153](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L153) *** @@ -40,4 +40,4 @@ Defined in: [graphql/types.ts:153](https://github.com/humanprotocol/human-protoc > **timestamp**: `number` -Defined in: [graphql/types.ts:151](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L151) +Defined in: [graphql/types.ts:151](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L151) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md index 6cb0d9045f..74d99dda6a 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md @@ -8,7 +8,7 @@ > **TaskStatistics** = `object` -Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) +Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) ## Properties @@ -16,4 +16,4 @@ Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protoc > **dailyTasksData**: [`DailyTaskData`](DailyTaskData.md)[] -Defined in: [graphql/types.ts:147](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L147) +Defined in: [graphql/types.ts:147](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L147) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md index b513430b69..bcf440fac5 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md @@ -8,7 +8,7 @@ > **WorkerStatistics** = `object` -Defined in: [graphql/types.ts:94](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L94) +Defined in: [graphql/types.ts:94](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L94) ## Properties @@ -16,4 +16,4 @@ Defined in: [graphql/types.ts:94](https://github.com/humanprotocol/human-protoco > **dailyWorkersData**: [`DailyWorkerData`](DailyWorkerData.md)[] -Defined in: [graphql/types.ts:95](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L95) +Defined in: [graphql/types.ts:95](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L95) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrow.md b/docs/sdk/typescript/interfaces/interfaces/IEscrow.md index c361265476..6406bbc853 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrow.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrow.md @@ -6,7 +6,7 @@ # Interface: IEscrow -Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L67) +Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L67) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) +Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/b > **amountPaid**: `string` -Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) +Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/b > **balance**: `string` -Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) +Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/b > **chainId**: `number` -Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) +Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/b > **count**: `string` -Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) +Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/b > **createdAt**: `string` -Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) +Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/b > `optional` **exchangeOracle**: `string` -Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) +Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/b > **factoryAddress**: `string` -Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) +Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/b > `optional` **finalResultsUrl**: `string` -Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) +Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) +Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) *** @@ -94,7 +94,7 @@ Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/b > `optional` **intermediateResultsUrl**: `string` -Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) +Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) *** @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/b > **launcher**: `string` -Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) +Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) *** @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/b > `optional` **manifestHash**: `string` -Defined in: [interfaces.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L77) +Defined in: [interfaces.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L77) *** @@ -118,7 +118,7 @@ Defined in: [interfaces.ts:77](https://github.com/humanprotocol/human-protocol/b > `optional` **manifestUrl**: `string` -Defined in: [interfaces.ts:78](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L78) +Defined in: [interfaces.ts:78](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L78) *** @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:78](https://github.com/humanprotocol/human-protocol/b > `optional` **recordingOracle**: `string` -Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L79) +Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L79) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationOracle**: `string` -Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) +Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) *** @@ -142,7 +142,7 @@ Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/b > **status**: `string` -Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) +Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) *** @@ -150,7 +150,7 @@ Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/b > **token**: `string` -Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) +Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) *** @@ -158,4 +158,4 @@ Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/b > **totalFundedAmount**: `string` -Defined in: [interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) +Defined in: [interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md index bbbb91352b..d31f5f0eff 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md @@ -6,7 +6,7 @@ # Interface: IEscrowConfig -Defined in: [interfaces.ts:101](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L101) +Defined in: [interfaces.ts:101](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L101) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:101](https://github.com/humanprotocol/human-protocol/ > **exchangeOracle**: `string` -Defined in: [interfaces.ts:104](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L104) +Defined in: [interfaces.ts:104](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L104) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:104](https://github.com/humanprotocol/human-protocol/ > **exchangeOracleFee**: `bigint` -Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) +Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/ > **manifestHash**: `string` -Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) +Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/ > **manifestUrl**: `string` -Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) +Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/ > **recordingOracle**: `string` -Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L102) +Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L102) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/ > **recordingOracleFee**: `bigint` -Defined in: [interfaces.ts:105](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L105) +Defined in: [interfaces.ts:105](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L105) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:105](https://github.com/humanprotocol/human-protocol/ > **reputationOracle**: `string` -Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) +Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) *** @@ -70,4 +70,4 @@ Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/ > **reputationOracleFee**: `bigint` -Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L106) +Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L106) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md index bd3aa19368..0bef7e56bf 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md @@ -6,7 +6,7 @@ # Interface: IEscrowsFilter -Defined in: [interfaces.ts:89](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L89) +Defined in: [interfaces.ts:89](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L89) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:89](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) +Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/b > `optional` **exchangeOracle**: `string` -Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) +Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:96](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L96) +Defined in: [interfaces.ts:96](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L96) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:96](https://github.com/humanprotocol/human-protocol/b > `optional` **jobRequesterId**: `string` -Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) +Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/b > `optional` **launcher**: `string` -Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L90) +Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L90) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -82,7 +82,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **recordingOracle**: `string` -Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) +Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) *** @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationOracle**: `string` -Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) +Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) *** @@ -98,7 +98,7 @@ Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/b > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/ > `optional` **status**: [`EscrowStatus`](../../types/enumerations/EscrowStatus.md) -Defined in: [interfaces.ts:95](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L95) +Defined in: [interfaces.ts:95](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L95) *** @@ -118,4 +118,4 @@ Defined in: [interfaces.ts:95](https://github.com/humanprotocol/human-protocol/b > `optional` **to**: `Date` -Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L97) +Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L97) diff --git a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md index 95de18560e..9c4097219f 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md +++ b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md @@ -6,7 +6,7 @@ # Interface: IHMTHoldersParams -Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) +Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/ > `optional` **address**: `string` -Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) +Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md index e8d435da4c..65d7fb2001 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md @@ -6,7 +6,7 @@ # Interface: IKVStore -Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) +Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/ > **key**: `string` -Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) +Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) *** @@ -22,4 +22,4 @@ Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) +Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) diff --git a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md index f6a52e5065..fe1c0e7104 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md @@ -6,7 +6,7 @@ # Interface: IKeyPair -Defined in: [interfaces.ts:112](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L112) +Defined in: [interfaces.ts:112](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L112) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:112](https://github.com/humanprotocol/human-protocol/ > **passphrase**: `string` -Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) +Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/ > **privateKey**: `string` -Defined in: [interfaces.ts:113](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L113) +Defined in: [interfaces.ts:113](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L113) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:113](https://github.com/humanprotocol/human-protocol/ > **publicKey**: `string` -Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) +Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/ > `optional` **revocationCertificate**: `string` -Defined in: [interfaces.ts:116](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L116) +Defined in: [interfaces.ts:116](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L116) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperator.md b/docs/sdk/typescript/interfaces/interfaces/IOperator.md index eee52ffe6e..66175a367e 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperator.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperator.md @@ -6,7 +6,7 @@ # Interface: IOperator -Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L9) +Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L9) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/bl > **address**: `string` -Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/b > **amountJobsProcessed**: `bigint` -Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/b > **amountLocked**: `bigint` -Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/b > **amountSlashed**: `bigint` -Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/b > **amountStaked**: `bigint` -Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/b > **amountWithdrawn**: `bigint` -Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/b > `optional` **category**: `string` -Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) +Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) +Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/b > `optional` **fee**: `bigint` -Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) *** @@ -94,7 +94,7 @@ Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/b > `optional` **jobTypes**: `string`[] -Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) +Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) *** @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/b > **lockedUntilTimestamp**: `bigint` -Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) *** @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/b > `optional` **name**: `string` -Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) +Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) *** @@ -118,7 +118,7 @@ Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/b > `optional` **publicKey**: `string` -Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) *** @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationInstructions**: `string` -Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationNeeded**: `boolean` -Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) *** @@ -142,7 +142,7 @@ Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationNetworks**: `string`[] -Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) +Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) *** @@ -150,7 +150,7 @@ Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/b > **reward**: `bigint` -Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) *** @@ -158,7 +158,7 @@ Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/b > `optional` **role**: `string` -Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) *** @@ -166,7 +166,7 @@ Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/b > `optional` **url**: `string` -Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) *** @@ -174,7 +174,7 @@ Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/b > `optional` **webhookUrl**: `string` -Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) *** @@ -182,4 +182,4 @@ Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/b > `optional` **website**: `string` -Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md index b50afecc2b..a3dc14f782 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md @@ -6,7 +6,7 @@ # Interface: IOperatorSubgraph -Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) +Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/b > **amountJobsProcessed**: `bigint` -Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) #### Inherited from @@ -42,7 +42,7 @@ Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/b > **amountLocked**: `bigint` -Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) #### Inherited from @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/b > **amountSlashed**: `bigint` -Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/b > **amountStaked**: `bigint` -Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) #### Inherited from @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/b > **amountWithdrawn**: `bigint` -Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) #### Inherited from @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/b > `optional` **category**: `string` -Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) +Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) #### Inherited from @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/b > `optional` **fee**: `bigint` -Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) #### Inherited from @@ -114,7 +114,7 @@ Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) #### Inherited from @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/b > `optional` **jobTypes**: `string` -Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L36) +Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L36) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/b > **lockedUntilTimestamp**: `bigint` -Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) #### Inherited from @@ -146,7 +146,7 @@ Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/b > `optional` **name**: `string` -Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) +Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) #### Inherited from @@ -158,7 +158,7 @@ Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/b > `optional` **publicKey**: `string` -Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) #### Inherited from @@ -170,7 +170,7 @@ Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationInstructions**: `string` -Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) #### Inherited from @@ -182,7 +182,7 @@ Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationNeeded**: `boolean` -Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) #### Inherited from @@ -194,7 +194,7 @@ Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationNetworks**: `object`[] -Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L37) +Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L37) #### address @@ -206,7 +206,7 @@ Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/b > **reward**: `bigint` -Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) #### Inherited from @@ -218,7 +218,7 @@ Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/b > `optional` **role**: `string` -Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) #### Inherited from @@ -230,7 +230,7 @@ Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/b > `optional` **url**: `string` -Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) #### Inherited from @@ -242,7 +242,7 @@ Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/b > `optional` **webhookUrl**: `string` -Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) #### Inherited from @@ -254,7 +254,7 @@ Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/b > `optional` **website**: `string` -Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md index 9cad3993bf..4cd03b92c6 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md @@ -6,7 +6,7 @@ # Interface: IOperatorsFilter -Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) +Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L41) +Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L41) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **minAmountStaked**: `number` -Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L43) +Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L43) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/b > `optional` **orderBy**: `string` -Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) +Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **roles**: `string`[] -Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L42) +Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L42) *** @@ -74,7 +74,7 @@ Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/b > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IPagination.md b/docs/sdk/typescript/interfaces/interfaces/IPagination.md index cbff72609c..75baa60993 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPagination.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPagination.md @@ -6,7 +6,7 @@ # Interface: IPagination -Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L178) +Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L178) ## Extended by @@ -25,7 +25,7 @@ Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) *** @@ -33,7 +33,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) *** @@ -41,4 +41,4 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) diff --git a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md index b8609ddbfc..42e26b2ae7 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md @@ -6,7 +6,7 @@ # Interface: IPayoutFilter -Defined in: [interfaces.ts:128](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L128) +Defined in: [interfaces.ts:128](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L128) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:128](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) +Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/ > `optional` **escrowAddress**: `string` -Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) +Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) +Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **recipient**: `string` -Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) +Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) *** @@ -74,7 +74,7 @@ Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -86,4 +86,4 @@ Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) +Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md index a907470928..5d52f9d6ed 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md @@ -6,7 +6,7 @@ # Interface: IReputationNetwork -Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L47) +Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L47) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) +Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) +Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) *** @@ -30,4 +30,4 @@ Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/b > **operators**: [`IOperator`](IOperator.md)[] -Defined in: [interfaces.ts:50](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L50) +Defined in: [interfaces.ts:50](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L50) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md index 1ca46144f5..00e8cb3037 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md @@ -6,7 +6,7 @@ # Interface: IReputationNetworkSubgraph -Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L53) +Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L53) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) +Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) +Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) #### Inherited from @@ -42,4 +42,4 @@ Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/b > **operators**: [`IOperatorSubgraph`](IOperatorSubgraph.md)[] -Defined in: [interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) +Defined in: [interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReward.md b/docs/sdk/typescript/interfaces/interfaces/IReward.md index 386e3a0d46..72428ebceb 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReward.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReward.md @@ -6,7 +6,7 @@ # Interface: IReward -Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L4) +Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L4) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/bl > **amount**: `bigint` -Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) +Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) *** @@ -22,4 +22,4 @@ Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/bl > **escrowAddress**: `string` -Defined in: [interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L5) +Defined in: [interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/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 a6b5a5d26d..ba7080d45c 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md @@ -6,7 +6,7 @@ # Interface: IStatisticsFilter -Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) +Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) +Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -62,4 +62,4 @@ Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) +Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) diff --git a/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md b/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md index 8092a8f477..ded6770a37 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md @@ -6,7 +6,7 @@ # Interface: IStatusEventFilter -Defined in: [interfaces.ts:191](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L191) +Defined in: [interfaces.ts:191](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L191) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:191](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:192](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L192) +Defined in: [interfaces.ts:192](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L192) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:192](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:194](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L194) +Defined in: [interfaces.ts:194](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L194) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:194](https://github.com/humanprotocol/human-protocol/ > `optional` **launcher**: `string` -Defined in: [interfaces.ts:196](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L196) +Defined in: [interfaces.ts:196](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L196) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:196](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/ > `optional` **statuses**: [`EscrowStatus`](../../types/enumerations/EscrowStatus.md)[] -Defined in: [interfaces.ts:193](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L193) +Defined in: [interfaces.ts:193](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L193) *** @@ -86,4 +86,4 @@ Defined in: [interfaces.ts:193](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:195](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L195) +Defined in: [interfaces.ts:195](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L195) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md index 2c01e15619..f4c9e9b5ba 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md @@ -6,7 +6,7 @@ # Interface: ITransaction -Defined in: [interfaces.ts:151](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L151) +Defined in: [interfaces.ts:151](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L151) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:151](https://github.com/humanprotocol/human-protocol/ > **block**: `bigint` -Defined in: [interfaces.ts:152](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L152) +Defined in: [interfaces.ts:152](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L152) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:152](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L160) +Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L160) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/ > **from**: `string` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > **internalTransactions**: [`InternalTransaction`](InternalTransaction.md)[] -Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L162) +Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L162) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/ > **method**: `string` -Defined in: [interfaces.ts:158](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L158) +Defined in: [interfaces.ts:158](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L158) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:158](https://github.com/humanprotocol/human-protocol/ > `optional` **receiver**: `string` -Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L159) +Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L159) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/ > **timestamp**: `bigint` -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > **to**: `string` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L161) +Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L161) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/ > **txHash**: `string` -Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -94,4 +94,4 @@ Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:157](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L157) +Defined in: [interfaces.ts:157](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L157) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md index 74571f4b3a..48c918b5b7 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md @@ -6,7 +6,7 @@ # Interface: ITransactionsFilter -Defined in: [interfaces.ts:165](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L165) +Defined in: [interfaces.ts:165](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L165) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:165](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L166) +Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L166) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/ > `optional` **endBlock**: `number` -Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L168) +Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L168) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/ > `optional` **endDate**: `Date` -Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L170) +Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L170) *** @@ -42,7 +42,7 @@ Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L174) +Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L174) *** @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **fromAddress**: `string` -Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L171) +Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L171) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/ > `optional` **method**: `string` -Defined in: [interfaces.ts:173](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L173) +Defined in: [interfaces.ts:173](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L173) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:173](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/ > `optional` **startBlock**: `number` -Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L167) +Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L167) *** @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/ > `optional` **startDate**: `Date` -Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L169) +Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L169) *** @@ -118,7 +118,7 @@ Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/ > `optional` **toAddress**: `string` -Defined in: [interfaces.ts:172](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L172) +Defined in: [interfaces.ts:172](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L172) *** @@ -126,4 +126,4 @@ Defined in: [interfaces.ts:172](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L175) +Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L175) diff --git a/docs/sdk/typescript/interfaces/interfaces/IWorker.md b/docs/sdk/typescript/interfaces/interfaces/IWorker.md index ca168bcd39..e089425555 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IWorker.md +++ b/docs/sdk/typescript/interfaces/interfaces/IWorker.md @@ -6,7 +6,7 @@ # Interface: IWorker -Defined in: [interfaces.ts:199](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L199) +Defined in: [interfaces.ts:199](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L199) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:199](https://github.com/humanprotocol/human-protocol/ > **address**: `string` -Defined in: [interfaces.ts:201](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L201) +Defined in: [interfaces.ts:201](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L201) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:201](https://github.com/humanprotocol/human-protocol/ > **id**: `string` -Defined in: [interfaces.ts:200](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L200) +Defined in: [interfaces.ts:200](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L200) *** @@ -30,12 +30,12 @@ Defined in: [interfaces.ts:200](https://github.com/humanprotocol/human-protocol/ > **payoutCount**: `number` -Defined in: [interfaces.ts:203](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L203) +Defined in: [interfaces.ts:203](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L203) *** -### totalAmountReceived +### totalHMTAmountReceived -> **totalAmountReceived**: `number` +> **totalHMTAmountReceived**: `number` -Defined in: [interfaces.ts:202](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L202) +Defined in: [interfaces.ts:202](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L202) diff --git a/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md b/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md index 6d63ea1a04..ee156bb3f3 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md @@ -6,7 +6,7 @@ # Interface: IWorkersFilter -Defined in: [interfaces.ts:206](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L206) +Defined in: [interfaces.ts:206](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L206) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:206](https://github.com/humanprotocol/human-protocol/ > `optional` **address**: `string` -Defined in: [interfaces.ts:208](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L208) +Defined in: [interfaces.ts:208](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L208) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:208](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:207](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L207) +Defined in: [interfaces.ts:207](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L207) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:207](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/ > `optional` **orderBy**: `string` -Defined in: [interfaces.ts:209](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L209) +Defined in: [interfaces.ts:209](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L209) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:209](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md index a60cfced52..7aea173e31 100644 --- a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md @@ -6,7 +6,7 @@ # Interface: InternalTransaction -Defined in: [interfaces.ts:141](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L141) +Defined in: [interfaces.ts:141](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L141) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:141](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) +Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/ > **from**: `string` -Defined in: [interfaces.ts:142](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L142) +Defined in: [interfaces.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L142) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:142](https://github.com/humanprotocol/human-protocol/ > **method**: `string` -Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) +Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/ > `optional` **receiver**: `string` -Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) +Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/ > **to**: `string` -Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) +Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) +Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) *** @@ -62,4 +62,4 @@ Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) +Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) diff --git a/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md b/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md index fd9d424bfa..5b1b553d62 100644 --- a/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md +++ b/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md @@ -6,7 +6,7 @@ # Interface: StakerInfo -Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L184) +Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L184) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/ > **lockedAmount**: `bigint` -Defined in: [interfaces.ts:186](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L186) +Defined in: [interfaces.ts:186](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L186) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:186](https://github.com/humanprotocol/human-protocol/ > **lockedUntil**: `bigint` -Defined in: [interfaces.ts:187](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L187) +Defined in: [interfaces.ts:187](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L187) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:187](https://github.com/humanprotocol/human-protocol/ > **stakedAmount**: `bigint` -Defined in: [interfaces.ts:185](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L185) +Defined in: [interfaces.ts:185](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L185) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:185](https://github.com/humanprotocol/human-protocol/ > **withdrawableAmount**: `bigint` -Defined in: [interfaces.ts:188](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L188) +Defined in: [interfaces.ts:188](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L188) diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md index d8af8e21db..29a0802e56 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md @@ -6,7 +6,7 @@ # Class: KVStoreClient -Defined in: [kvstore.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L99) +Defined in: [kvstore.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L99) ## Introduction @@ -86,7 +86,7 @@ const kvstoreClient = await KVStoreClient.build(provider); > **new KVStoreClient**(`runner`, `networkData`): `KVStoreClient` -Defined in: [kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) +Defined in: [kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) **KVStoreClient constructor** @@ -118,7 +118,7 @@ The network information required to connect to the KVStore contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from @@ -130,7 +130,7 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3 > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from @@ -142,7 +142,7 @@ Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3 > **set**(`key`, `value`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) +Defined in: [kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) This function sets a key-value pair associated with the address that submits the transaction. @@ -196,7 +196,7 @@ await kvstoreClient.set('Role', 'RecordingOracle'); > **setBulk**(`keys`, `values`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) +Defined in: [kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) This function sets key-value pairs in bulk associated with the address that submits the transaction. @@ -252,7 +252,7 @@ await kvstoreClient.setBulk(keys, values); > **setFileUrlAndHash**(`url`, `urlKey`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) +Defined in: [kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) Sets a URL value for the address that submits the transaction, and its hash. @@ -305,7 +305,7 @@ await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url'); > `static` **build**(`runner`): `Promise`\<`KVStoreClient`\> -Defined in: [kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) +Defined in: [kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) Creates an instance of KVStoreClient from a runner. diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md index 1b45a8f82d..e1869bfefb 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md @@ -6,7 +6,7 @@ # Class: KVStoreUtils -Defined in: [kvstore.ts:318](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L318) +Defined in: [kvstore.ts:318](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L318) ## Introduction @@ -55,7 +55,7 @@ const KVStoreAddresses = await KVStoreUtils.getKVStoreData( > `static` **get**(`chainId`, `address`, `key`): `Promise`\<`string`\> -Defined in: [kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) +Defined in: [kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) Gets the value of a key-value pair in the KVStore using the subgraph. @@ -116,7 +116,7 @@ console.log(value); > `static` **getFileUrlAndVerifyHash**(`chainId`, `address`, `urlKey`): `Promise`\<`string`\> -Defined in: [kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) +Defined in: [kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) Gets the URL value of the given entity, and verifies its hash. @@ -164,7 +164,7 @@ console.log(url); > `static` **getKVStoreData**(`chainId`, `address`): `Promise`\<[`IKVStore`](../../interfaces/interfaces/IKVStore.md)[]\> -Defined in: [kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) +Defined in: [kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) This function returns the KVStore data for a given address. @@ -211,7 +211,7 @@ console.log(kvStoreData); > `static` **getPublicKey**(`chainId`, `address`): `Promise`\<`string`\> -Defined in: [kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) +Defined in: [kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) Gets the public key of the given entity, and verifies its hash. diff --git a/docs/sdk/typescript/operator/classes/OperatorUtils.md b/docs/sdk/typescript/operator/classes/OperatorUtils.md index 2562895980..ae01680de8 100644 --- a/docs/sdk/typescript/operator/classes/OperatorUtils.md +++ b/docs/sdk/typescript/operator/classes/OperatorUtils.md @@ -6,7 +6,7 @@ # Class: OperatorUtils -Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L27) +Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L27) ## Constructors @@ -24,7 +24,7 @@ Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blo > `static` **getOperator**(`chainId`, `address`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)\> -Defined in: [operator.ts:43](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L43) +Defined in: [operator.ts:43](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L43) This function returns the operator data for the given address. @@ -62,7 +62,7 @@ const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51 > `static` **getOperators**(`filter`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> -Defined in: [operator.ts:109](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L109) +Defined in: [operator.ts:109](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L109) This function returns all the operator details of the protocol. @@ -97,7 +97,7 @@ const operators = await OperatorUtils.getOperators(filter); > `static` **getReputationNetworkOperators**(`chainId`, `address`, `role?`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> -Defined in: [operator.ts:190](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L190) +Defined in: [operator.ts:190](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L190) Retrieves the reputation network operators of the specified address. @@ -141,7 +141,7 @@ const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLY > `static` **getRewards**(`chainId`, `slasherAddress`): `Promise`\<[`IReward`](../../interfaces/interfaces/IReward.md)[]\> -Defined in: [operator.ts:244](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L244) +Defined in: [operator.ts:244](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L244) This function returns information about the rewards for a given slasher address. diff --git a/docs/sdk/typescript/staking/classes/StakingClient.md b/docs/sdk/typescript/staking/classes/StakingClient.md index a28c8816cc..17a9fd7b36 100644 --- a/docs/sdk/typescript/staking/classes/StakingClient.md +++ b/docs/sdk/typescript/staking/classes/StakingClient.md @@ -6,7 +6,7 @@ # Class: StakingClient -Defined in: [staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) +Defined in: [staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) ## Introduction @@ -86,7 +86,7 @@ const stakingClient = await StakingClient.build(provider); > **new StakingClient**(`runner`, `networkData`): `StakingClient` -Defined in: [staking.ts:108](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L108) +Defined in: [staking.ts:108](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L108) **StakingClient constructor** @@ -118,7 +118,7 @@ The network information required to connect to the Staking contract > **escrowFactoryContract**: `EscrowFactory` -Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L100) +Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L100) *** @@ -126,7 +126,7 @@ Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blo > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from @@ -138,7 +138,7 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3 > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from @@ -150,7 +150,7 @@ Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/a3 > **stakingContract**: `Staking` -Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) +Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) *** @@ -158,7 +158,7 @@ Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob > **tokenContract**: `HMToken` -Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) +Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) ## Methods @@ -166,7 +166,7 @@ Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob > **approveStake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) +Defined in: [staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) This function approves the staking contract to transfer a specified amount of tokens when the user stakes. It increases the allowance for the staking contract. @@ -213,7 +213,7 @@ await stakingClient.approveStake(amount); > **getStakerInfo**(`stakerAddress`): `Promise`\<[`StakerInfo`](../../interfaces/interfaces/StakerInfo.md)\> -Defined in: [staking.ts:435](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L435) +Defined in: [staking.ts:435](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L435) Retrieves comprehensive staking information for a staker. @@ -249,7 +249,7 @@ console.log(stakingInfo.tokensStaked); > **slash**(`slasher`, `staker`, `escrowAddress`, `amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:373](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L373) +Defined in: [staking.ts:373](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L373) This function reduces the allocated amount by a staker in an escrow and transfers those tokens to the reward pool. This allows the slasher to claim them later. @@ -314,7 +314,7 @@ await stakingClient.slash('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd > **stake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:247](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L247) +Defined in: [staking.ts:247](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L247) This function stakes a specified amount of tokens on a specific network. @@ -364,7 +364,7 @@ await stakingClient.stake(amount); > **unstake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:291](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L291) +Defined in: [staking.ts:291](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L291) This function unstakes tokens from staking contract. The unstaked tokens stay locked for a period of time. @@ -413,7 +413,7 @@ await stakingClient.unstake(amount); > **withdraw**(`txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:336](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L336) +Defined in: [staking.ts:336](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L336) This function withdraws unstaked and non-locked tokens from staking contract to the user wallet. @@ -455,7 +455,7 @@ await stakingClient.withdraw(); > `static` **build**(`runner`): `Promise`\<`StakingClient`\> -Defined in: [staking.ts:136](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L136) +Defined in: [staking.ts:136](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L136) Creates an instance of StakingClient from a Runner. diff --git a/docs/sdk/typescript/statistics/classes/StatisticsClient.md b/docs/sdk/typescript/statistics/classes/StatisticsClient.md index a34e90ffc5..4ec52d9ef6 100644 --- a/docs/sdk/typescript/statistics/classes/StatisticsClient.md +++ b/docs/sdk/typescript/statistics/classes/StatisticsClient.md @@ -6,7 +6,7 @@ # Class: StatisticsClient -Defined in: [statistics.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L58) +Defined in: [statistics.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L58) ## Introduction @@ -45,7 +45,7 @@ const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]); > **new StatisticsClient**(`networkData`): `StatisticsClient` -Defined in: [statistics.ts:67](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L67) +Defined in: [statistics.ts:67](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L67) **StatisticsClient constructor** @@ -67,7 +67,7 @@ The network information required to connect to the Statistics contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L59) +Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L59) *** @@ -75,7 +75,7 @@ Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/b > **subgraphUrl**: `string` -Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L60) +Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L60) ## Methods @@ -83,7 +83,7 @@ Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/b > **getEscrowStatistics**(`filter`): `Promise`\<[`EscrowStatistics`](../../graphql/types/type-aliases/EscrowStatistics.md)\> -Defined in: [statistics.ts:120](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L120) +Defined in: [statistics.ts:120](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L120) This function returns the statistical data of escrows. @@ -149,7 +149,7 @@ const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({ > **getHMTDailyData**(`filter`): `Promise`\<[`DailyHMTData`](../../graphql/types/type-aliases/DailyHMTData.md)[]\> -Defined in: [statistics.ts:478](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L478) +Defined in: [statistics.ts:478](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L478) This function returns the statistical data of HMToken day by day. @@ -214,7 +214,7 @@ console.log('HMT statistics from 5/8 - 6/8:', hmtStatisticsRange); > **getHMTHolders**(`params`): `Promise`\<[`HMTHolder`](../../graphql/types/type-aliases/HMTHolder.md)[]\> -Defined in: [statistics.ts:407](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L407) +Defined in: [statistics.ts:407](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L407) This function returns the holders of the HMToken with optional filters and ordering. @@ -257,7 +257,7 @@ console.log('HMT holders:', hmtHolders.map((h) => ({ > **getHMTStatistics**(): `Promise`\<[`HMTStatistics`](../../graphql/types/type-aliases/HMTStatistics.md)\> -Defined in: [statistics.ts:364](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L364) +Defined in: [statistics.ts:364](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L364) This function returns the statistical data of HMToken. @@ -296,7 +296,7 @@ console.log('HMT statistics:', { > **getPaymentStatistics**(`filter`): `Promise`\<[`PaymentStatistics`](../../graphql/types/type-aliases/PaymentStatistics.md)\> -Defined in: [statistics.ts:300](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L300) +Defined in: [statistics.ts:300](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L300) This function returns the statistical data of payments. @@ -380,7 +380,7 @@ console.log( > **getWorkerStatistics**(`filter`): `Promise`\<[`WorkerStatistics`](../../graphql/types/type-aliases/WorkerStatistics.md)\> -Defined in: [statistics.ts:204](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L204) +Defined in: [statistics.ts:204](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L204) This function returns the statistical data of workers. diff --git a/docs/sdk/typescript/storage/classes/StorageClient.md b/docs/sdk/typescript/storage/classes/StorageClient.md index d1eb61046e..4fd294967f 100644 --- a/docs/sdk/typescript/storage/classes/StorageClient.md +++ b/docs/sdk/typescript/storage/classes/StorageClient.md @@ -6,7 +6,7 @@ # Class: ~~StorageClient~~ -Defined in: [storage.ts:63](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L63) +Defined in: [storage.ts:63](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L63) ## Deprecated @@ -61,7 +61,7 @@ const storageClient = new StorageClient(params, credentials); > **new StorageClient**(`params`, `credentials?`): `StorageClient` -Defined in: [storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) +Defined in: [storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) **Storage client constructor** @@ -89,7 +89,7 @@ Optional. Cloud storage access data. If credentials are not provided - use anony > **bucketExists**(`bucket`): `Promise`\<`boolean`\> -Defined in: [storage.ts:262](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L262) +Defined in: [storage.ts:262](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L262) This function checks if a bucket exists. @@ -133,7 +133,7 @@ const exists = await storageClient.bucketExists('bucket-name'); > **downloadFiles**(`keys`, `bucket`): `Promise`\<`any`[]\> -Defined in: [storage.ts:112](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L112) +Defined in: [storage.ts:112](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L112) This function downloads files from a bucket. @@ -181,7 +181,7 @@ const files = await storageClient.downloadFiles(keys, 'bucket-name'); > **listObjects**(`bucket`): `Promise`\<`string`[]\> -Defined in: [storage.ts:292](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L292) +Defined in: [storage.ts:292](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L292) This function lists all file names contained in the bucket. @@ -225,7 +225,7 @@ const fileNames = await storageClient.listObjects('bucket-name'); > **uploadFiles**(`files`, `bucket`): `Promise`\<[`UploadFile`](../../types/type-aliases/UploadFile.md)[]\> -Defined in: [storage.ts:198](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L198) +Defined in: [storage.ts:198](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L198) This function uploads files to a bucket. @@ -278,7 +278,7 @@ const uploadedFiles = await storageClient.uploadFiles(files, 'bucket-name'); > `static` **downloadFileFromUrl**(`url`): `Promise`\<`any`\> -Defined in: [storage.ts:146](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L146) +Defined in: [storage.ts:146](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L146) This function downloads files from a URL. diff --git a/docs/sdk/typescript/transaction/classes/TransactionUtils.md b/docs/sdk/typescript/transaction/classes/TransactionUtils.md index 9b8e4e17f7..77470e7087 100644 --- a/docs/sdk/typescript/transaction/classes/TransactionUtils.md +++ b/docs/sdk/typescript/transaction/classes/TransactionUtils.md @@ -6,7 +6,7 @@ # Class: TransactionUtils -Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L18) +Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L18) ## Constructors @@ -24,7 +24,7 @@ Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/ > `static` **getTransaction**(`chainId`, `hash`): `Promise`\<[`ITransaction`](../../interfaces/interfaces/ITransaction.md)\> -Defined in: [transaction.ts:50](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L50) +Defined in: [transaction.ts:50](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L50) This function returns the transaction data for the given hash. @@ -78,7 +78,7 @@ const transaction = await TransactionUtils.getTransaction(ChainId.POLYGON, '0x62 > `static` **getTransactions**(`filter`): `Promise`\<[`ITransaction`](../../interfaces/interfaces/ITransaction.md)[]\> -Defined in: [transaction.ts:132](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L132) +Defined in: [transaction.ts:132](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L132) This function returns all transaction details based on the provided filter. diff --git a/docs/sdk/typescript/types/enumerations/EscrowStatus.md b/docs/sdk/typescript/types/enumerations/EscrowStatus.md index b0c9743037..716cac332f 100644 --- a/docs/sdk/typescript/types/enumerations/EscrowStatus.md +++ b/docs/sdk/typescript/types/enumerations/EscrowStatus.md @@ -6,7 +6,7 @@ # Enumeration: EscrowStatus -Defined in: [types.ts:8](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L8) +Defined in: [types.ts:8](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L8) Enum for escrow statuses. @@ -16,7 +16,7 @@ Enum for escrow statuses. > **Cancelled**: `5` -Defined in: [types.ts:32](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) +Defined in: [types.ts:32](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) Escrow is cancelled. @@ -26,7 +26,7 @@ Escrow is cancelled. > **Complete**: `4` -Defined in: [types.ts:28](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) +Defined in: [types.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) Escrow is finished. @@ -36,7 +36,7 @@ Escrow is finished. > **Launched**: `0` -Defined in: [types.ts:12](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) +Defined in: [types.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) Escrow is launched. @@ -46,7 +46,7 @@ Escrow is launched. > **Paid**: `3` -Defined in: [types.ts:24](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) +Defined in: [types.ts:24](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) Escrow is fully paid. @@ -56,7 +56,7 @@ Escrow is fully paid. > **Partial**: `2` -Defined in: [types.ts:20](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) +Defined in: [types.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) Escrow is partially paid out. @@ -66,6 +66,6 @@ Escrow is partially paid out. > **Pending**: `1` -Defined in: [types.ts:16](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) +Defined in: [types.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) Escrow is funded, and waiting for the results to be submitted. diff --git a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md index fdf82242e1..8cdbec8abc 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md @@ -8,7 +8,7 @@ > **EscrowCancel** = `object` -Defined in: [types.ts:145](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) +Defined in: [types.ts:145](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) Represents the response data for an escrow cancellation. @@ -18,7 +18,7 @@ Represents the response data for an escrow cancellation. > **amountRefunded**: `bigint` -Defined in: [types.ts:153](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L153) +Defined in: [types.ts:153](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L153) The amount refunded in the escrow cancellation. @@ -28,6 +28,6 @@ The amount refunded in the escrow cancellation. > **txHash**: `string` -Defined in: [types.ts:149](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L149) +Defined in: [types.ts:149](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L149) The hash of the transaction associated with the escrow cancellation. diff --git a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md index c3ba28c27b..8706f5b8a6 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md @@ -8,7 +8,7 @@ > **EscrowWithdraw** = `object` -Defined in: [types.ts:159](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) +Defined in: [types.ts:159](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) Represents the response data for an escrow withdrawal. @@ -18,7 +18,7 @@ Represents the response data for an escrow withdrawal. > **amountWithdrawn**: `bigint` -Defined in: [types.ts:171](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L171) +Defined in: [types.ts:171](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L171) The amount withdrawn from the escrow. @@ -28,7 +28,7 @@ The amount withdrawn from the escrow. > **tokenAddress**: `string` -Defined in: [types.ts:167](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L167) +Defined in: [types.ts:167](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L167) The address of the token used for the withdrawal. @@ -38,6 +38,6 @@ The address of the token used for the withdrawal. > **txHash**: `string` -Defined in: [types.ts:163](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L163) +Defined in: [types.ts:163](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L163) The hash of the transaction associated with the escrow withdrawal. diff --git a/docs/sdk/typescript/types/type-aliases/NetworkData.md b/docs/sdk/typescript/types/type-aliases/NetworkData.md index 622def3e8d..a2276446b6 100644 --- a/docs/sdk/typescript/types/type-aliases/NetworkData.md +++ b/docs/sdk/typescript/types/type-aliases/NetworkData.md @@ -8,7 +8,7 @@ > **NetworkData** = `object` -Defined in: [types.ts:95](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) +Defined in: [types.ts:95](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) Network data @@ -18,7 +18,7 @@ Network data > **chainId**: `number` -Defined in: [types.ts:99](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L99) +Defined in: [types.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L99) Network chain id @@ -28,7 +28,7 @@ Network chain id > **factoryAddress**: `string` -Defined in: [types.ts:115](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L115) +Defined in: [types.ts:115](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L115) Escrow Factory contract address @@ -38,7 +38,7 @@ Escrow Factory contract address > **hmtAddress**: `string` -Defined in: [types.ts:111](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L111) +Defined in: [types.ts:111](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L111) HMT Token contract address @@ -48,7 +48,7 @@ HMT Token contract address > **kvstoreAddress**: `string` -Defined in: [types.ts:123](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L123) +Defined in: [types.ts:123](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L123) KVStore contract address @@ -58,7 +58,7 @@ KVStore contract address > **oldFactoryAddress**: `string` -Defined in: [types.ts:139](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L139) +Defined in: [types.ts:139](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L139) Old Escrow Factory contract address @@ -68,7 +68,7 @@ Old Escrow Factory contract address > **oldSubgraphUrl**: `string` -Defined in: [types.ts:135](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L135) +Defined in: [types.ts:135](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L135) Old subgraph URL @@ -78,7 +78,7 @@ Old subgraph URL > **scanUrl**: `string` -Defined in: [types.ts:107](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L107) +Defined in: [types.ts:107](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L107) Network scanner URL @@ -88,7 +88,7 @@ Network scanner URL > **stakingAddress**: `string` -Defined in: [types.ts:119](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L119) +Defined in: [types.ts:119](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L119) Staking contract address @@ -98,7 +98,7 @@ Staking contract address > **subgraphUrl**: `string` -Defined in: [types.ts:127](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L127) +Defined in: [types.ts:127](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L127) Subgraph URL @@ -108,7 +108,7 @@ Subgraph URL > **subgraphUrlApiKey**: `string` -Defined in: [types.ts:131](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L131) +Defined in: [types.ts:131](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L131) Subgraph URL API key @@ -118,6 +118,6 @@ Subgraph URL API key > **title**: `string` -Defined in: [types.ts:103](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L103) +Defined in: [types.ts:103](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L103) Network title diff --git a/docs/sdk/typescript/types/type-aliases/Payout.md b/docs/sdk/typescript/types/type-aliases/Payout.md index e29fd2e6ce..d366f1118f 100644 --- a/docs/sdk/typescript/types/type-aliases/Payout.md +++ b/docs/sdk/typescript/types/type-aliases/Payout.md @@ -8,7 +8,7 @@ > **Payout** = `object` -Defined in: [types.ts:177](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L177) +Defined in: [types.ts:177](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L177) Represents a payout from an escrow. @@ -18,7 +18,7 @@ Represents a payout from an escrow. > **amount**: `bigint` -Defined in: [types.ts:193](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L193) +Defined in: [types.ts:193](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L193) The amount paid to the recipient. @@ -28,7 +28,7 @@ The amount paid to the recipient. > **createdAt**: `number` -Defined in: [types.ts:197](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L197) +Defined in: [types.ts:197](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L197) The timestamp when the payout was created (in UNIX format). @@ -38,7 +38,7 @@ The timestamp when the payout was created (in UNIX format). > **escrowAddress**: `string` -Defined in: [types.ts:185](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L185) +Defined in: [types.ts:185](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L185) The address of the escrow associated with the payout. @@ -48,7 +48,7 @@ The address of the escrow associated with the payout. > **id**: `string` -Defined in: [types.ts:181](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L181) +Defined in: [types.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L181) Unique identifier of the payout. @@ -58,6 +58,6 @@ Unique identifier of the payout. > **recipient**: `string` -Defined in: [types.ts:189](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L189) +Defined in: [types.ts:189](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L189) The address of the recipient who received the payout. diff --git a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md index 9f006d87ca..c87013b209 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md +++ b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md @@ -8,7 +8,7 @@ > `readonly` **StorageCredentials** = `object` -Defined in: [types.ts:40](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) +Defined in: [types.ts:40](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) AWS/GCP cloud storage access data @@ -22,7 +22,7 @@ StorageClient is deprecated. Use Minio.Client directly. > **accessKey**: `string` -Defined in: [types.ts:44](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L44) +Defined in: [types.ts:44](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L44) Access Key @@ -32,6 +32,6 @@ Access Key > **secretKey**: `string` -Defined in: [types.ts:48](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L48) +Defined in: [types.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L48) Secret Key diff --git a/docs/sdk/typescript/types/type-aliases/StorageParams.md b/docs/sdk/typescript/types/type-aliases/StorageParams.md index 4b14589239..87f599ea09 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageParams.md +++ b/docs/sdk/typescript/types/type-aliases/StorageParams.md @@ -8,7 +8,7 @@ > **StorageParams** = `object` -Defined in: [types.ts:54](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) +Defined in: [types.ts:54](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) ## Deprecated @@ -20,7 +20,7 @@ StorageClient is deprecated. Use Minio.Client directly. > **endPoint**: `string` -Defined in: [types.ts:58](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L58) +Defined in: [types.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L58) Request endPoint @@ -30,7 +30,7 @@ Request endPoint > `optional` **port**: `number` -Defined in: [types.ts:70](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L70) +Defined in: [types.ts:70](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L70) TCP/IP port number. Default value set to 80 for HTTP and 443 for HTTPs @@ -40,7 +40,7 @@ TCP/IP port number. Default value set to 80 for HTTP and 443 for HTTPs > `optional` **region**: `string` -Defined in: [types.ts:66](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L66) +Defined in: [types.ts:66](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L66) Region @@ -50,6 +50,6 @@ Region > **useSSL**: `boolean` -Defined in: [types.ts:62](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L62) +Defined in: [types.ts:62](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L62) Enable secure (HTTPS) access. Default value set to false diff --git a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md index c4595f6266..a98655afd0 100644 --- a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md +++ b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md @@ -8,7 +8,7 @@ > **TransactionLikeWithNonce** = `TransactionLike` & `object` -Defined in: [types.ts:200](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L200) +Defined in: [types.ts:200](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L200) ## Type declaration diff --git a/docs/sdk/typescript/types/type-aliases/UploadFile.md b/docs/sdk/typescript/types/type-aliases/UploadFile.md index 7830ecf6c3..7862bb8c22 100644 --- a/docs/sdk/typescript/types/type-aliases/UploadFile.md +++ b/docs/sdk/typescript/types/type-aliases/UploadFile.md @@ -8,7 +8,7 @@ > `readonly` **UploadFile** = `object` -Defined in: [types.ts:77](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) +Defined in: [types.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) Upload file data @@ -18,7 +18,7 @@ Upload file data > **hash**: `string` -Defined in: [types.ts:89](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L89) +Defined in: [types.ts:89](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L89) Hash of uploaded object key @@ -28,7 +28,7 @@ Hash of uploaded object key > **key**: `string` -Defined in: [types.ts:81](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L81) +Defined in: [types.ts:81](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L81) Uploaded object key @@ -38,6 +38,6 @@ Uploaded object key > **url**: `string` -Defined in: [types.ts:85](https://github.com/humanprotocol/human-protocol/blob/a3c69981844e7ed43743f2459713fe069fcbb283/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L85) +Defined in: [types.ts:85](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L85) Uploaded object URL diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx index 7259ffea74..3512e50f97 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx @@ -18,7 +18,6 @@ import KVStore from '../KVStore'; import ReputationScore from '../ReputationScore'; import StakeInfo from '../StakeInfo'; - type Props = { data: AddressDetailsWallet | AddressDetailsOperator; }; @@ -32,7 +31,7 @@ const WalletAddress: FC = ({ data }) => { amountWithdrawable, } = data; const isMobile = useIsMobile(); - const isWallet = 'totalAmountReceived' in data; + const isWallet = 'totalHMTAmountReceived' in data; return ( <> @@ -59,7 +58,7 @@ const WalletAddress: FC = ({ data }) => { diff --git a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx b/packages/apps/dashboard/client/src/services/api/use-address-details.tsx index b708093de2..179bfd2641 100644 --- a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx +++ b/packages/apps/dashboard/client/src/services/api/use-address-details.tsx @@ -9,7 +9,6 @@ import { apiPaths } from '../api-paths'; import { httpService } from '../http-service'; import { validateResponse } from '../validate-response'; - const transformOptionalTokenAmount = ( value: string | undefined | null, ctx: z.RefinementCtx @@ -36,7 +35,7 @@ const walletSchema = z.object({ amountLocked: z.string().transform(transformOptionalTokenAmount), amountWithdrawable: z.string().transform(transformOptionalTokenAmount), reputation: reputationSchema, - totalAmountReceived: z.string().transform(transformOptionalTokenAmount), + totalHMTAmountReceived: z.string().transform(transformOptionalTokenAmount), payoutCount: z.number().or(z.string()), }); diff --git a/packages/apps/dashboard/server/src/modules/details/details.service.ts b/packages/apps/dashboard/server/src/modules/details/details.service.ts index 347bc759bf..361e674c10 100644 --- a/packages/apps/dashboard/server/src/modules/details/details.service.ts +++ b/packages/apps/dashboard/server/src/modules/details/details.service.ts @@ -102,8 +102,8 @@ export class DetailsService { amountWithdrawable: ethers.formatEther(stakingData.withdrawableAmount), reputation: (await this.fetchOperatorReputation(chainId, address)) .reputation, - totalAmountReceived: ethers.formatEther( - workerData?.totalAmountReceived || 0, + totalHMTAmountReceived: ethers.formatEther( + workerData?.totalHMTAmountReceived || 0, ), payoutCount: workerData?.payoutCount || 0, }); diff --git a/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts b/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts index 2864a9bc56..cb18d6fee3 100644 --- a/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts +++ b/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts @@ -34,7 +34,7 @@ export class WalletDto { @ApiProperty({ example: '2414.07007358932392' }) @Transform(({ value }) => value?.toString()) @IsString() - public totalAmountReceived?: string; + public totalHMTAmountReceived?: string; @ApiProperty({ example: 1234 }) @IsNumber() diff --git a/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.rst b/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.rst index 1e3d3d47bb..6e7277a299 100644 --- a/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.rst +++ b/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.rst @@ -21,6 +21,7 @@ Subpackages human_protocol_sdk.statistics human_protocol_sdk.storage human_protocol_sdk.transaction + human_protocol_sdk.worker Submodules ---------- diff --git a/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.rst b/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.rst new file mode 100644 index 0000000000..64b0149c33 --- /dev/null +++ b/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.rst @@ -0,0 +1,15 @@ +human\_protocol\_sdk.worker package +=================================== + +.. automodule:: human_protocol_sdk.worker + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + human_protocol_sdk.worker.worker_utils diff --git a/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.worker_utils.rst b/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.worker_utils.rst new file mode 100644 index 0000000000..c45ab7bdcc --- /dev/null +++ b/packages/sdk/python/human-protocol-sdk/docs/human_protocol_sdk.worker.worker_utils.rst @@ -0,0 +1,7 @@ +human\_protocol\_sdk.worker.worker\_utils module +================================================ + +.. automodule:: human_protocol_sdk.worker.worker_utils + :members: + :undoc-members: + :show-inheritance: 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 91a44af4f6..00b433d0ac 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 @@ -36,7 +36,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/ethereum/version/latest" ), "subgraph_url_api_key": ( - "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmawHPbwEhAvmWgHQUH9Qgx5AqrXmq1uhfj69CGv9LLzNb" + "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZEF1exsjDwjDXy1kmN3MbdZKxfkkoTj2MbEPUyhLfEG3" ), "hmt_address": "0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867", "factory_address": "0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a", @@ -52,7 +52,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/sepolia/version/latest" ), "subgraph_url_api_key": ( - "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYx4iD24iBTBgxhK95WV4u4o4QSFQFJxuvSNwwSEvCMsE" + "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeHhtntEYGdgTqHQTJu5mUXHS8JPt3RiwidLYeeEu6VpP" ), "hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33", "factory_address": "0x5987A5558d961ee674efe4A8c8eB7B1b5495D3bf", @@ -68,7 +68,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/bsc/version/latest" ), "subgraph_url_api_key": ( - "hthttps://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmai26kHVvYnn59QzGyBAfVWTQ98utfA2bJxQTMV2NeU8K" + "hthttps://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWsXVhdFuZZcXDjXrv1QLSBYcjNShazFQmNUdpAErjQqD" ), "hmt_address": "0x711Fd6ab6d65A98904522d4e3586F492B989c527", "factory_address": "0x92FD968AcBd521c232f5fB8c33b342923cC72714", @@ -84,7 +84,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest" ), "subgraph_url_api_key": ( - "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmbPzZWJMqCzdc6ZJir1Z2Va5mpLo8haGxAkfMySwfGxqs" + "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmPv7asd21BA5LZJxjDPfoL5ZJkEGMvahrdMqgNQnP5sxn" ), "hmt_address": "0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d", "factory_address": "0x2bfA592DBDaF434DDcbb893B1916120d181DAD18", @@ -102,7 +102,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/polygon/version/latest" ), "subgraph_url_api_key": ( - "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmSyLqu2injQHCrMg68Wvp6n39J5piCDQkwHGWhKBqxhvV" + "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZSsJn5TERyEfRrrbY926hLHD321ijoMynrxWxc3boRa6" ), "hmt_address": "0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF", "factory_address": "0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB", @@ -120,7 +120,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/amoy/version/latest" ), "subgraph_url_api_key": ( - "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYtZEaay5cX5XwGmoN8NpwfpFMbyqiKvtA1ub4GvavH2P" + "https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYWc4ciJbAvTvcjoBzRSTWZrf1xD8WPRqEk3xtJZUKZqY" ), "hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33", "factory_address": "0xAFf5a986A530ff839d49325A5dF69F96627E8D29", diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/statistics.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/statistics.py index 48a6c88a1f..e726402117 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/statistics.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/statistics.py @@ -41,7 +41,7 @@ dailyEscrowCount dailyWorkerCount dailyPayoutCount - dailyPayoutAmount + dailyHMTPayoutAmount dailyHMTTransferCount dailyHMTTransferAmount dailyUniqueSenders diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/worker.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/worker.py index 868248dab6..9788272612 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/worker.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/worker.py @@ -4,7 +4,7 @@ fragment WorkerFields on Worker { id address - totalAmountReceived + totalHMTAmountReceived payoutCount } """ diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/statistics/statistics_client.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/statistics/statistics_client.py index 4069f9683d..3a42205689 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/statistics/statistics_client.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/statistics/statistics_client.py @@ -476,10 +476,12 @@ def get_payment_statistics( timestamp=datetime.fromtimestamp( int(event_day_data.get("timestamp", 0)) ), - total_amount_paid=int(event_day_data.get("dailyPayoutAmount", 0)), + total_amount_paid=int( + event_day_data.get("dailyHMTPayoutAmount", 0) + ), total_count=int(event_day_data.get("dailyPayoutCount", 0)), average_amount_per_worker=( - int(event_day_data.get("dailyPayoutAmount", 0)) + int(event_day_data.get("dailyHMTPayoutAmount", 0)) / int(event_day_data.get("dailyWorkerCount")) if event_day_data.get("dailyWorkerCount", "0") != "0" else 0 diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/worker/worker_utils.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/worker/worker_utils.py index e4ce2f6930..2364d8537e 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/worker/worker_utils.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/worker/worker_utils.py @@ -89,7 +89,7 @@ def get_workers(filter: WorkerFilter) -> List[WorkerData]: WorkerData( id=worker.get("id", ""), address=worker.get("address", ""), - total_amount_received=int(worker.get("totalAmountReceived", 0)), + total_amount_received=int(worker.get("totalHMTAmountReceived", 0)), payout_count=int(worker.get("payoutCount", 0)), ) ) @@ -135,6 +135,6 @@ def get_worker(chain_id: ChainId, worker_address: str) -> Optional[WorkerData]: return WorkerData( id=worker.get("id", ""), address=worker.get("address", ""), - total_amount_received=int(worker.get("totalAmountReceived", 0)), + total_amount_received=int(worker.get("totalHMTAmountReceived", 0)), payout_count=int(worker.get("payoutCount", 0)), ) diff --git a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/statistics/test_statistics_client.py b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/statistics/test_statistics_client.py index 8d8786443b..666dc1029d 100644 --- a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/statistics/test_statistics_client.py +++ b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/statistics/test_statistics_client.py @@ -153,7 +153,7 @@ def test_get_payment_statistics(self): { "timestamp": 1, "dailyPayoutCount": "4", - "dailyPayoutAmount": "100", + "dailyHMTPayoutAmount": "100", "dailyWorkerCount": "4", }, ], diff --git a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/worker/test_worker_utils.py b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/worker/test_worker_utils.py index 206029f953..4427af4998 100644 --- a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/worker/test_worker_utils.py +++ b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/worker/test_worker_utils.py @@ -15,13 +15,13 @@ def test_get_workers(self): mock_worker_1 = { "id": "worker1", "address": "0x1234567890123456789012345678901234567890", - "totalAmountReceived": "1000", + "totalHMTAmountReceived": "1000", "payoutCount": 5, } mock_worker_2 = { "id": "worker2", "address": "0x9876543210987654321098765432109876543210", - "totalAmountReceived": "2000", + "totalHMTAmountReceived": "2000", "payoutCount": 10, } @@ -31,7 +31,7 @@ def test_get_workers(self): filter = WorkerFilter( chain_id=ChainId.POLYGON_AMOY, - order_by="totalAmountReceived", + order_by="totalHMTAmountReceived", order_direction=OrderDirection.ASC, ) @@ -44,7 +44,7 @@ def test_get_workers(self): "address": None, "first": 10, "skip": 0, - "orderBy": "totalAmountReceived", + "orderBy": "totalHMTAmountReceived", "orderDirection": "asc", }, ) @@ -91,7 +91,7 @@ def test_get_worker(self): mock_worker = { "id": "worker1", "address": "0x1234567890123456789012345678901234567890", - "totalAmountReceived": "1000", + "totalHMTAmountReceived": "1000", "payoutCount": 5, } diff --git a/packages/sdk/typescript/human-protocol-sdk/src/constants.ts b/packages/sdk/typescript/human-protocol-sdk/src/constants.ts index c743e99e0f..15bbc397ed 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/constants.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/constants.ts @@ -36,7 +36,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest', subgraphUrlApiKey: - 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmawHPbwEhAvmWgHQUH9Qgx5AqrXmq1uhfj69CGv9LLzNb', + 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZEF1exsjDwjDXy1kmN3MbdZKxfkkoTj2MbEPUyhLfEG3', oldSubgraphUrl: '', oldFactoryAddress: '', }, @@ -51,7 +51,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest', subgraphUrlApiKey: - 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYx4iD24iBTBgxhK95WV4u4o4QSFQFJxuvSNwwSEvCMsE', + 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeHhtntEYGdgTqHQTJu5mUXHS8JPt3RiwidLYeeEu6VpP', oldSubgraphUrl: '', oldFactoryAddress: '', }, @@ -66,7 +66,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest', subgraphUrlApiKey: - 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmai26kHVvYnn59QzGyBAfVWTQ98utfA2bJxQTMV2NeU8K', + 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWsXVhdFuZZcXDjXrv1QLSBYcjNShazFQmNUdpAErjQqD', oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc', oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4', }, @@ -81,7 +81,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest', subgraphUrlApiKey: - 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmbPzZWJMqCzdc6ZJir1Z2Va5mpLo8haGxAkfMySwfGxqs', + 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmPv7asd21BA5LZJxjDPfoL5ZJkEGMvahrdMqgNQnP5sxn', oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest', oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f', @@ -97,7 +97,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest', subgraphUrlApiKey: - 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmSyLqu2injQHCrMg68Wvp6n39J5piCDQkwHGWhKBqxhvV', + 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZSsJn5TERyEfRrrbY926hLHD321ijoMynrxWxc3boRa6', oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon', oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794', @@ -113,7 +113,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest', subgraphUrlApiKey: - 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYtZEaay5cX5XwGmoN8NpwfpFMbyqiKvtA1ub4GvavH2P', + 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYWc4ciJbAvTvcjoBzRSTWZrf1xD8WPRqEk3xtJZUKZqY', oldSubgraphUrl: '', oldFactoryAddress: '', }, diff --git a/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/statistics.ts b/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/statistics.ts index 6c73f4eb4b..2135d3ca7c 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/statistics.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/statistics.ts @@ -42,7 +42,7 @@ const EVENT_DAY_DATA_FRAGMENT = gql` dailyEscrowCount dailyWorkerCount dailyPayoutCount - dailyPayoutAmount + dailyHMTPayoutAmount dailyHMTTransferCount dailyHMTTransferAmount dailyUniqueSenders diff --git a/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/worker.ts b/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/worker.ts index 6a2b2cf612..5242e64988 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/worker.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/worker.ts @@ -6,7 +6,7 @@ export const GET_WORKER_QUERY = gql` worker(id: $address) { id address - totalAmountReceived + totalHMTAmountReceived payoutCount } } @@ -34,7 +34,7 @@ export const GET_WORKERS_QUERY = (filter: IWorkersFilter) => { ) { id address - totalAmountReceived + totalHMTAmountReceived payoutCount } }`; diff --git a/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts b/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts index a5bbffeeed..66ba242597 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts @@ -58,7 +58,7 @@ export type EventDayData = { dailyEscrowCount: string; dailyWorkerCount: string; dailyPayoutCount: string; - dailyPayoutAmount: string; + dailyHMTPayoutAmount: string; dailyHMTTransferCount: string; dailyHMTTransferAmount: string; dailyUniqueSenders: string; diff --git a/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts b/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts index b33deac1cc..dbf4662971 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts @@ -199,7 +199,7 @@ export interface IStatusEventFilter extends IPagination { export interface IWorker { id: string; address: string; - totalAmountReceived: number; + totalHMTAmountReceived: number; payoutCount: number; } diff --git a/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts b/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts index f54fe02d9f..b88b228836 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts @@ -319,12 +319,12 @@ export class StatisticsClient { return { dailyPaymentsData: eventDayDatas.map((eventDayData) => ({ timestamp: new Date(+eventDayData.timestamp * 1000), - totalAmountPaid: ethers.toBigInt(eventDayData.dailyPayoutAmount), + totalAmountPaid: ethers.toBigInt(eventDayData.dailyHMTPayoutAmount), totalCount: +eventDayData.dailyPayoutCount, averageAmountPerWorker: eventDayData.dailyWorkerCount === '0' ? ethers.toBigInt(0) - : ethers.toBigInt(eventDayData.dailyPayoutAmount) / + : ethers.toBigInt(eventDayData.dailyHMTPayoutAmount) / ethers.toBigInt(eventDayData.dailyWorkerCount), })), }; diff --git a/packages/sdk/typescript/human-protocol-sdk/src/worker.ts b/packages/sdk/typescript/human-protocol-sdk/src/worker.ts index 7e9e757cbb..2c85694411 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/worker.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/worker.ts @@ -65,7 +65,7 @@ export class WorkerUtils { * type IWorker = { * id: string; * address: string; - * totalAmountReceived: string; + * totalHMTAmountReceived: string; * payoutCount: number; * }; * ``` 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 ab88a6e9ed..c582a400bb 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/statistics.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/statistics.test.ts @@ -172,7 +172,7 @@ describe('StatisticsClient', () => { { timestamp: 1, dailyPayoutCount: '4', - dailyPayoutAmount: '100', + dailyHMTPayoutAmount: '100', dailyWorkerCount: '4', }, ], diff --git a/packages/sdk/typescript/human-protocol-sdk/test/worker.test.ts b/packages/sdk/typescript/human-protocol-sdk/test/worker.test.ts index 2e3ce3a721..f9a2b7d04e 100644 --- a/packages/sdk/typescript/human-protocol-sdk/test/worker.test.ts +++ b/packages/sdk/typescript/human-protocol-sdk/test/worker.test.ts @@ -22,7 +22,7 @@ describe('WorkerUtils', () => { const mockWorker: IWorker = { id: workerAddress, address: workerAddress, - totalAmountReceived: 1000, + totalHMTAmountReceived: 1000, payoutCount: 10, }; @@ -89,13 +89,13 @@ describe('WorkerUtils', () => { { id: '0x1234567890abcdef1234567890abcdef12345678', address: '0x1234567890abcdef1234567890abcdef12345678', - totalAmountReceived: 1000, + totalHMTAmountReceived: 1000, payoutCount: 10, }, { id: '0xabcdefabcdefabcdefabcdefabcdefabcdef', address: '0xabcdefabcdefabcdefabcdefabcdefabcdef', - totalAmountReceived: 2000, + totalHMTAmountReceived: 2000, payoutCount: 20, }, ]; @@ -109,7 +109,7 @@ describe('WorkerUtils', () => { chainId: ChainId.LOCALHOST, first: 10, skip: 0, - orderBy: 'totalAmountReceived', + orderBy: 'totalHMTAmountReceived', orderDirection: OrderDirection.ASC, }; @@ -122,7 +122,7 @@ describe('WorkerUtils', () => { address: undefined, first: 10, skip: 0, - orderBy: 'totalAmountReceived', + orderBy: 'totalHMTAmountReceived', orderDirection: 'asc', } ); diff --git a/packages/sdk/typescript/subgraph/schema.graphql b/packages/sdk/typescript/subgraph/schema.graphql index 324545b34c..1761efb2c4 100644 --- a/packages/sdk/typescript/subgraph/schema.graphql +++ b/packages/sdk/typescript/subgraph/schema.graphql @@ -11,7 +11,7 @@ type Holder @entity { type Worker @entity { id: Bytes! address: Bytes! - totalAmountReceived: BigInt! + totalHMTAmountReceived: BigInt! payoutCount: BigInt! } @@ -332,7 +332,7 @@ type EventDayData @entity { dailyEscrowCount: BigInt! dailyWorkerCount: BigInt! dailyPayoutCount: BigInt! - dailyPayoutAmount: BigInt! + dailyHMTPayoutAmount: BigInt! dailyHMTTransferCount: BigInt! dailyHMTTransferAmount: BigInt! dailyUniqueSenders: BigInt! diff --git a/packages/sdk/typescript/subgraph/src/mapping/EscrowTemplate.ts b/packages/sdk/typescript/subgraph/src/mapping/EscrowTemplate.ts index 3c0a66f0b7..a95556a16b 100644 --- a/packages/sdk/typescript/subgraph/src/mapping/EscrowTemplate.ts +++ b/packages/sdk/typescript/subgraph/src/mapping/EscrowTemplate.ts @@ -75,7 +75,7 @@ export function createOrLoadWorker(address: Address): Worker { if (!worker) { worker = new Worker(address); worker.address = address; - worker.totalAmountReceived = ZERO_BI; + worker.totalHMTAmountReceived = ZERO_BI; worker.payoutCount = ZERO_BI; } @@ -465,7 +465,18 @@ export function handleBulkTransferV2(event: BulkTransferV2): void { // Update escrow entity const escrowEntity = Escrow.load(dataSource.address()); - if (escrowEntity !== null) { + if (escrowEntity) { + const transaction = createTransaction( + event, + 'bulkTransfer', + event.transaction.from, + Address.fromBytes(escrowEntity.address), + null, + Address.fromBytes(escrowEntity.address), + null, + Address.fromBytes(escrowEntity.token) + ); + // If the escrow is non-HMT, track the balance data if (Address.fromBytes(escrowEntity.token) != HMT_ADDRESS) { for (let i = 0; i < event.params._recipients.length; i++) { @@ -477,7 +488,6 @@ export function handleBulkTransferV2(event: BulkTransferV2): void { // Update worker, and create payout object const worker = createOrLoadWorker(recipient); - worker.totalAmountReceived = worker.totalAmountReceived.plus(amount); worker.payoutCount = worker.payoutCount.plus(ONE_BI); worker.save(); @@ -493,8 +503,6 @@ export function handleBulkTransferV2(event: BulkTransferV2): void { const eventDayData = getEventDayData(event); eventDayData.dailyPayoutCount = eventDayData.dailyPayoutCount.plus(ONE_BI); - eventDayData.dailyPayoutAmount = - eventDayData.dailyPayoutAmount.plus(amount); const eventDayId = toEventDayId(event); const dailyWorkerId = Bytes.fromI32(eventDayId.toI32()).concat( @@ -513,34 +521,18 @@ export function handleBulkTransferV2(event: BulkTransferV2): void { eventDayData.dailyWorkerCount.plus(ONE_BI); } - const transaction = createTransaction( - event, - 'bulkTransfer', - event.transaction.from, - Address.fromBytes(escrowEntity.address), - null, - Address.fromBytes(escrowEntity.address), - null, - Address.fromBytes(escrowEntity.token) + const internalTransaction = new InternalTransaction( + event.transaction.hash + .concatI32(i) + .concatI32(event.block.timestamp.toI32()) ); - - // Create a transfer per recipient and amount - for (let i = 0; i < event.params._recipients.length; i++) { - const recipient = event.params._recipients[i]; - const amount = event.params._amounts[i]; - const internalTransaction = new InternalTransaction( - event.transaction.hash - .concatI32(i) - .concatI32(event.block.timestamp.toI32()) - ); - internalTransaction.from = Address.fromBytes(escrowEntity.address); - internalTransaction.to = recipient; - internalTransaction.value = amount; - internalTransaction.transaction = transaction.id; - internalTransaction.method = 'transfer'; - internalTransaction.escrow = Address.fromBytes(escrowEntity.address); - internalTransaction.save(); - } + internalTransaction.from = Address.fromBytes(escrowEntity.address); + internalTransaction.to = recipient; + internalTransaction.value = amount; + internalTransaction.transaction = transaction.id; + internalTransaction.method = 'transfer'; + internalTransaction.escrow = Address.fromBytes(escrowEntity.address); + internalTransaction.save(); eventDayData.save(); } diff --git a/packages/sdk/typescript/subgraph/src/mapping/HMTokenTemplate.ts b/packages/sdk/typescript/subgraph/src/mapping/HMTokenTemplate.ts index d1cc7b519b..169ac33e6a 100644 --- a/packages/sdk/typescript/subgraph/src/mapping/HMTokenTemplate.ts +++ b/packages/sdk/typescript/subgraph/src/mapping/HMTokenTemplate.ts @@ -238,7 +238,7 @@ export function handleTransfer(event: Transfer): void { // Update worker, and create payout object const worker = createOrLoadWorker(event.params._to); - worker.totalAmountReceived = worker.totalAmountReceived.plus( + worker.totalHMTAmountReceived = worker.totalHMTAmountReceived.plus( event.params._value ); worker.payoutCount = worker.payoutCount.plus(ONE_BI); @@ -254,7 +254,7 @@ export function handleTransfer(event: Transfer): void { // Update worker and payout day data eventDayData.dailyPayoutCount = eventDayData.dailyPayoutCount.plus(ONE_BI); - eventDayData.dailyPayoutAmount = eventDayData.dailyPayoutAmount.plus( + eventDayData.dailyHMTPayoutAmount = eventDayData.dailyHMTPayoutAmount.plus( event.params._value ); diff --git a/packages/sdk/typescript/subgraph/src/mapping/utils/dayUpdates.ts b/packages/sdk/typescript/subgraph/src/mapping/utils/dayUpdates.ts index 15be03ae4b..3ab99de947 100644 --- a/packages/sdk/typescript/subgraph/src/mapping/utils/dayUpdates.ts +++ b/packages/sdk/typescript/subgraph/src/mapping/utils/dayUpdates.ts @@ -25,7 +25,7 @@ export function getEventDayData(event: ethereum.Event): EventDayData { eventDayData.dailyEscrowCount = ZERO_BI; eventDayData.dailyWorkerCount = ZERO_BI; eventDayData.dailyPayoutCount = ZERO_BI; - eventDayData.dailyPayoutAmount = ZERO_BI; + eventDayData.dailyHMTPayoutAmount = ZERO_BI; eventDayData.dailyHMTTransferCount = ZERO_BI; eventDayData.dailyHMTTransferAmount = ZERO_BI; eventDayData.dailyUniqueSenders = ZERO_BI; diff --git a/packages/sdk/typescript/subgraph/template.yaml b/packages/sdk/typescript/subgraph/template.yaml index 041f01f46b..0c16513d2d 100644 --- a/packages/sdk/typescript/subgraph/template.yaml +++ b/packages/sdk/typescript/subgraph/template.yaml @@ -197,7 +197,7 @@ templates: - event: BulkTransfer(indexed uint256,address[],uint256[],bool) handler: handleBulkTransfer - event: BulkTransferV2(indexed uint256,address[],uint256[],bool,string) - handler: handleBulkTransfer + handler: handleBulkTransferV2 - event: Cancelled() handler: handleCancelled - event: Completed() diff --git a/packages/sdk/typescript/subgraph/tests/hmt/hmt.test.ts b/packages/sdk/typescript/subgraph/tests/hmt/hmt.test.ts index 81b667fdff..091d00e99d 100644 --- a/packages/sdk/typescript/subgraph/tests/hmt/hmt.test.ts +++ b/packages/sdk/typescript/subgraph/tests/hmt/hmt.test.ts @@ -301,7 +301,7 @@ describe('HMToken', () => { assert.fieldEquals( 'Worker', operatorAddressString, - 'totalAmountReceived', + 'totalHMTAmountReceived', '1' ); assert.fieldEquals('Worker', operatorAddressString, 'payoutCount', '1'); From 74380fa4580748bd6930080963d68da6a5e44449 Mon Sep 17 00:00:00 2001 From: KirillKirill Date: Wed, 18 Jun 2025 13:18:27 +0300 Subject: [PATCH 17/21] [Dashboard] Approve transaction does not transfer funds (#3395) --- .../SearchResults/AbbreviateClipboard.tsx | 1 + .../cells/TransactionTableCellMethod.tsx | 26 +++++++--------- .../cells/TransactionTableCellValue.tsx | 30 +++++++++++++++++-- .../tableComponents/TransactionsTableBody.tsx | 10 +++++-- .../tableComponents/TransactionsTableHead.tsx | 13 ++++++-- 5 files changed, 57 insertions(+), 23 deletions(-) diff --git a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx b/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx index 599916f2a0..f59a321b95 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx +++ b/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx @@ -20,6 +20,7 @@ const AbbreviateClipboard = ({ value, link }: AbbreviateClipboardProps) => { return ( { }; return ( - - - {method} - - + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx index ba4573a6bb..ee8a5ecc2f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx @@ -1,9 +1,28 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; import Typography from '@mui/material/Typography'; +import CustomTooltip from '@/components/CustomTooltip'; import { formatHMTDecimals } from '@/helpers/formatHMTDecimals'; import { useHMTPrice } from '@/services/api/use-hmt-price'; -export const TransactionTableCellValue = ({ value }: { value: string }) => { +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +export const TransactionTableCellValue = ({ + value, + method, +}: { + value: string; + method: string; +}) => { const { isError, isPending } = useHMTPrice(); if (isError) { @@ -15,9 +34,14 @@ export const TransactionTableCellValue = ({ value }: { value: string }) => { } return ( - + {formatHMTDecimals(value)} - HMT + + HMT + + {method === 'approve' && ( + + )} ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx index cd1c80535a..3edd02e454 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx @@ -120,7 +120,10 @@ export const TransactionsTableBody: React.FC = () => { {elem.block} - + {elem.internalTransactions?.map((internalTx, internalIdx) => ( @@ -153,7 +156,10 @@ export const TransactionsTableBody: React.FC = () => {
- + ))} diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx index 1d3572a9e4..5a5fbf0538 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx +++ b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx @@ -7,7 +7,16 @@ import TableRow from '@mui/material/TableRow'; import CustomTooltip from '@/components/CustomTooltip'; const InfoTooltip = ({ title }: { title: string }) => ( - + { Value - + From 46a311f25e37b934bb534416ef3ea42db2c7202c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= <50665615+flopez7@users.noreply.github.com> Date: Wed, 18 Jun 2025 16:40:21 +0200 Subject: [PATCH 18/21] [SDK][Python] Align python sdk implementation with ts (#3380) --- ...human_protocol_sdk.escrow.escrow_client.md | 433 +------ ...man_protocol_sdk.kvstore.kvstore_client.md | 118 +- docs/sdk/python/human_protocol_sdk.md | 2 +- ...man_protocol_sdk.staking.staking_client.md | 212 +--- docs/sdk/python/human_protocol_sdk.utils.md | 30 +- docs/sdk/python/index.md | 2 +- .../human_protocol_sdk/decorators.py | 17 + .../escrow/escrow_client.py | 303 ++--- .../kvstore/kvstore_client.py | 51 +- .../staking/staking_client.py | 83 +- .../human_protocol_sdk/utils.py | 90 +- .../escrow/test_escrow_client.py | 1116 +++++++---------- .../kvstore/test_kvstore_client.py | 218 ++-- .../staking/test_staking_client.py | 346 ++--- 14 files changed, 1029 insertions(+), 1992 deletions(-) create mode 100644 packages/sdk/python/human-protocol-sdk/human_protocol_sdk/decorators.py 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 86d1fd9559..2d067904ba 100644 --- a/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md +++ b/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md @@ -74,199 +74,13 @@ Initializes a Escrow instance. * **Parameters:** **web3** (`Web3`) – The Web3 object -#### add_trusted_handlers(escrow_address, handlers, tx_options=None) +#### add_trusted_handlers(\*args, \*\*kwargs) -Adds an array of addresses to the trusted handlers list. +#### bulk_payout(\*args, \*\*kwargs) -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow - * **handlers** (`List`[`str`]) – Array of trusted handler addresses - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **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 SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) +#### cancel(\*args, \*\*kwargs) - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - trusted_handlers = [ - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' - ] - escrow_client.add_trusted_handlers( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - trusted_handlers - ) - ``` - -#### bulk_payout(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, force_complete=False, tx_options=None) - -Pays out the amounts specified to the workers and sets the URL of the final results file. - -* **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 - * **force_complete** (`Optional`[`bool`]) – (Optional) Indicates if remaining balance should be transferred to the escrow creator - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **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 SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - 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' - - escrow_client.bulk_payout( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - recipients, - amounts, - results_url, - results_hash, - 1 - ) - ``` - -#### cancel(escrow_address, tx_options=None) - -Cancels the specified escrow and sends the balance to the canceler. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to cancel - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - [`EscrowCancel`](#human_protocol_sdk.escrow.escrow_client.EscrowCancel) -* **Returns:** - EscrowCancel: - An instance of the EscrowCancel class containing details of the cancellation transaction, - including the transaction hash and the amount refunded. -* **Raises:** - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If the transfer event associated with the cancellation - is not found in the transaction logs -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_cancel_data = escrow_client.cancel( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f" - ) - ``` - -#### complete(escrow_address, tx_options=None) - -Sets the status of an escrow to completed. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to complete - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **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 SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_client.complete("0x62dD51230A30401C455c8398d06F85e4EaB6309f") - ``` +#### complete(\*args, \*\*kwargs) #### create_bulk_payout_transaction(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, force_complete=False, tx_options=None) @@ -343,55 +157,7 @@ Creates a prepared transaction for bulk payout without signing or sending it. print(f"Transaction receipt: {tx_receipt}") ``` -#### create_escrow(token_address, trusted_handlers, job_requester_id, tx_options=None) - -Creates a new escrow contract. - -* **Parameters:** - * **token_address** (`str`) – Address of the token to be used in the escrow - * **trusted_handlers** (`List`[`str`]) – List of trusted handler addresses - * **job_requester_id** (`str`) – ID of the job requester - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Transaction options -* **Return type:** - `str` -* **Returns:** - Address of the created escrow contract -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - token_address = '0x1234567890abcdef1234567890abcdef12345678' - trusted_handlers = [ - '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef' - ] - job_requester_id = 'job-requester' - escrow_address = escrow_client.create_escrow( - token_address, - trusted_handlers, - job_requester_id - ) - ``` +#### create_escrow(\*args, \*\*kwargs) #### ensure_correct_bulk_payout_input(escrow_address, recipients, amounts, final_results_url, final_results_hash) @@ -410,48 +176,7 @@ Validates input parameters for bulk payout operations. * **Raises:** [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If validation fails -#### fund(escrow_address, amount, tx_options=None) - -Adds funds to the escrow. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to fund - * **amount** (`Decimal`) – Amount to be added as funds - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **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 SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - escrow_client.fund( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount - ) - ``` +#### fund(\*args, \*\*kwargs) #### get_balance(escrow_address) @@ -789,151 +514,11 @@ Gets the address of the token used to fund the escrow. ) ``` -#### setup(escrow_address, escrow_config, tx_options=None) - -Sets up the parameters of the escrow. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow contract - * **escrow_config** ([`EscrowConfig`](#human_protocol_sdk.escrow.escrow_client.EscrowConfig)) – Configuration parameters for the escrow - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Transaction options -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_address = "0x1234567890abcdef1234567890abcdef12345678" - escrow_config = EscrowConfig( - recording_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - reputation_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - exchange_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - recording_oracle_fee=100, - reputation_oracle_fee=100, - exchange_oracle_fee=100, - recording_oracle_url='https://example.com/recording', - reputation_oracle_url='https://example.com/reputation', - exchange_oracle_url='https://example.com/exchange', - manifest_url='https://example.com/manifest', - manifest_hash='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef' - ) - escrow_client.setup( - escrow_address, - escrow_config - ) - ``` -* **Return type:** - `None` - -#### store_results(escrow_address, url, hash, tx_options=None) - -Stores the results URL. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow - * **url** (`str`) – Results file URL - * **hash** (`str`) – Results file hash - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **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 SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_client.store_results( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - "http://localhost/results.json", - "b5dad76bf6772c0f07fd5e048f6e75a5f86ee079" - ) - ``` - -#### withdraw(escrow_address, token_address, tx_options=None) +#### setup(\*args, \*\*kwargs) -Withdraws additional tokens in the escrow to the canceler. +#### store_results(\*args, \*\*kwargs) -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to withdraw - * **token_address** (`str`) – Address of the token to withdraw - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - [`EscrowWithdraw`](#human_protocol_sdk.escrow.escrow_client.EscrowWithdraw) -* **Returns:** - EscrowWithdraw: - An instance of the EscrowWithdraw class containing details of the withdrawal transaction, - including the transaction hash and the token address and amount withdrawn. -* **Raises:** - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If the transfer event associated with the withdrawal - is not found in the transaction logs -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_cancel_data = escrow_client.withdraw( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - "0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" - ) - ``` +#### withdraw(\*args, \*\*kwargs) ### *exception* human_protocol_sdk.escrow.escrow_client.EscrowClientError diff --git a/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md b/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md index 4c9cc4767f..5e2028944c 100644 --- a/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md +++ b/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md @@ -63,123 +63,11 @@ Initializes a KVStore instance. * **web3** (`Web3`) – The Web3 object * **gas_limit** (`Optional`[`int`]) – (Optional) Gas limit for transactions -#### set(key, value, tx_options=None) +#### set(\*args, \*\*kwargs) -Sets the value of a key-value pair in the contract. +#### set_bulk(\*args, \*\*kwargs) -* **Parameters:** - * **key** (`str`) – The key of the key-value pair to set - * **value** (`str`) – The value of the key-value pair to set - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.kvstore import KVStoreClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - kvstore_client = KVStoreClient(w3) - kvstore_client.set('Role', 'RecordingOracle') - ``` - -#### set_bulk(keys, values, tx_options=None) - -Sets multiple key-value pairs in the contract. - -* **Parameters:** - * **keys** (`List`[`str`]) – A list of keys to set - * **values** (`List`[`str`]) – A list of values to set - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.kvstore import KVStoreClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - kvstore_client = KVStoreClient(w3) - - keys = ['Role', 'Webhook_url'] - values = ['RecordingOracle', 'http://localhost'] - kvstore_client.set_bulk(keys, values) - ``` - -#### set_file_url_and_hash(url, key='url', tx_options=None) - -Sets a URL value for the address that submits the transaction, and its hash. - -* **Parameters:** - * **url** (`str`) – URL to set - * **key** (`Optional`[`str`]) – Configurable URL key. url by default. - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**KVStoreClientError**](#human_protocol_sdk.kvstore.kvstore_client.KVStoreClientError) – If an error occurs while validating URL, or handling transaction -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.kvstore import KVStoreClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - kvstore_client = KVStoreClient(w3) - - kvstore_client.set_file_url_and_hash('http://localhost') - kvstore_client.set_file_url_and_hash('https://linkedin.com/me', 'linkedin_url') - ``` +#### set_file_url_and_hash(\*args, \*\*kwargs) ### *exception* human_protocol_sdk.kvstore.kvstore_client.KVStoreClientError diff --git a/docs/sdk/python/human_protocol_sdk.md b/docs/sdk/python/human_protocol_sdk.md index 839f0f93e0..ef2b0b539e 100644 --- a/docs/sdk/python/human_protocol_sdk.md +++ b/docs/sdk/python/human_protocol_sdk.md @@ -200,7 +200,7 @@ * [`get_hmt_balance()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_hmt_balance) * [`get_kvstore_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_kvstore_interface) * [`get_staking_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_staking_interface) - * [`handle_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_transaction) + * [`handle_error()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_error) * [`parse_transfer_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.parse_transfer_transaction) * [`validate_url()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.validate_url) * [`with_retry()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.with_retry) diff --git a/docs/sdk/python/human_protocol_sdk.staking.staking_client.md b/docs/sdk/python/human_protocol_sdk.staking.staking_client.md index e0a9fbc526..c0155d7cb5 100644 --- a/docs/sdk/python/human_protocol_sdk.staking.staking_client.md +++ b/docs/sdk/python/human_protocol_sdk.staking.staking_client.md @@ -62,45 +62,7 @@ Initializes a Staking instance * **Parameters:** **w3** (`Web3`) – Web3 instance -#### approve_stake(amount, tx_options=None) - -Approves HMT token for Staking. - -* **Parameters:** - * **amount** (`Decimal`) – Amount to approve - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - Amount must be greater than 0 -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.approve_stake(amount) - ``` +#### approve_stake(\*args, \*\*kwargs) #### get_staker_info(staker_address) @@ -129,177 +91,13 @@ Retrieves comprehensive staking information for a staker. print(staking_info['stakedAmount']) ``` -#### slash(slasher, staker, escrow_address, amount, tx_options=None) +#### slash(\*args, \*\*kwargs) -Slashes HMT token. +#### stake(\*args, \*\*kwargs) -* **Parameters:** - * **slasher** (`str`) – Address of the slasher - * **staker** (`str`) – Address of the staker - * **escrow_address** (`str`) – Address of the escrow - * **amount** (`Decimal`) – Amount to slash - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - Amount must be greater than 0 - - Amount must be less than or equal to the amount allocated to the escrow (on-chain) - - Escrow address must be valid -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.slash( - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0x62dD51230A30401C455c8398d06F85e4EaB6309f', - amount - ) - ``` - -#### stake(amount, tx_options=None) +#### unstake(\*args, \*\*kwargs) -Stakes HMT token. - -* **Parameters:** - * **amount** (`Decimal`) – Amount to stake - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - Amount must be greater than 0 - - Amount must be less than or equal to the approved amount (on-chain) - - Amount must be less than or equal to the balance of the staker (on-chain) -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.approve_stake(amount) # if it was already approved before, this is not necessary - staking_client.stake(amount) - ``` - -#### unstake(amount, tx_options=None) - -Unstakes HMT token. - -* **Parameters:** - * **amount** (`Decimal`) – Amount to unstake - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - Amount must be greater than 0 - - Amount must be less than or equal to the staked amount which is not locked / allocated (on-chain) -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.unstake(amount) - ``` - -#### withdraw(tx_options=None) - -Withdraws HMT token. - -* **Parameters:** - **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - There must be unstaked tokens which is unlocked (on-chain) -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - 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.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - staking_client.withdraw() - ``` +#### withdraw(\*args, \*\*kwargs) ### *exception* human_protocol_sdk.staking.staking_client.StakingClientError diff --git a/docs/sdk/python/human_protocol_sdk.utils.md b/docs/sdk/python/human_protocol_sdk.utils.md index 48aa0d3427..f0e73515b6 100644 --- a/docs/sdk/python/human_protocol_sdk.utils.md +++ b/docs/sdk/python/human_protocol_sdk.utils.md @@ -68,24 +68,26 @@ Retrieve the Staking interface. * **Returns:** The Staking interface of smart contract. -### human_protocol_sdk.utils.handle_transaction(w3, tx_name, tx, exception, tx_options) +### human_protocol_sdk.utils.handle_error(e, exception_class) -Executes the transaction and waits for the receipt. +Handles and translates errors raised during contract transactions. + +This function captures exceptions (especially ContractLogicError from web3.py), +extracts meaningful revert reasons if present, logs unexpected errors, and raises +a custom exception with a clear message for SDK users. * **Parameters:** - * **w3** (`Web3`) – Web3 instance - * **tx_name** (`str`) – Name of the transaction - * **tx** – Transaction object - * **exception** (`Exception`) – Exception class to raise in case of error - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters - - If provided, can include values like ‘gas’, ‘gas_price’, ‘nonce’, etc - - If ‘gas’ is not specified or is None, it will be estimated using tx.estimate_gas() -* **Returns:** - The transaction receipt -* **Validate:** - - There must be a default account + * **e** – The exception object raised during a transaction. + * **exception_class** – The custom exception class to raise (e.g., EscrowClientError). * **Raises:** - **exception** – If the transaction fails + **exception_class** – With a detailed error message, including contract revert reasons if available. +* **Example:** + try: + : tx_hash = contract.functions.someMethod(…).transact() + w3.eth.wait_for_transaction_receipt(tx_hash) + + except Exception as e: + : handle_error(e, EscrowClientError) ### human_protocol_sdk.utils.parse_transfer_transaction(hmtoken_contract, tx_receipt) diff --git a/docs/sdk/python/index.md b/docs/sdk/python/index.md index 012cbdd460..dcba33dab9 100644 --- a/docs/sdk/python/index.md +++ b/docs/sdk/python/index.md @@ -73,7 +73,7 @@ pip install human-protocol-sdk[agreement] * [`get_hmt_balance()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_hmt_balance) * [`get_kvstore_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_kvstore_interface) * [`get_staking_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_staking_interface) - * [`handle_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_transaction) + * [`handle_error()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_error) * [`parse_transfer_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.parse_transfer_transaction) * [`validate_url()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.validate_url) * [`with_retry()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.with_retry) diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/decorators.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/decorators.py new file mode 100644 index 0000000000..f153b93bd1 --- /dev/null +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/decorators.py @@ -0,0 +1,17 @@ +class RequiresSignerError(Exception): + """Raised when a signer or required middleware is missing in the Web3 instance.""" + + pass + + +def requires_signer(method): + def wrapper(self, *args, **kwargs): + if not self.w3.eth.default_account: + raise RequiresSignerError("You must add an account to Web3 instance") + if not self.w3.middleware_onion.get("SignAndSendRawMiddlewareBuilder"): + raise RequiresSignerError( + "You must add SignAndSendRawMiddlewareBuilder middleware to Web3 instance" + ) + return method(self, *args, **kwargs) + + return wrapper 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 e8c9854d27..b591fb5671 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 @@ -66,7 +66,7 @@ def get_w3_with_priv_key(priv_key: str): get_escrow_interface, get_factory_interface, get_erc20_interface, - handle_transaction, + handle_error, ) from web3 import Web3, contract from web3 import eth @@ -75,6 +75,7 @@ def get_w3_with_priv_key(priv_key: str): from eth_utils import abi from human_protocol_sdk.utils import validate_url +from human_protocol_sdk.decorators import requires_signer LOG = logging.getLogger("human_protocol_sdk.escrow") @@ -211,6 +212,7 @@ def __init__(self, web3: Web3): address=self.network["factory_address"], abi=factory_interface["abi"] ) + @requires_signer def create_escrow( self, token_address: str, @@ -272,24 +274,24 @@ def get_w3_with_priv_key(priv_key: str): if not Web3.is_address(handler): raise EscrowClientError(f"Invalid handler address: {handler}") - transaction_receipt = handle_transaction( - self.w3, - "Create Escrow", - self.factory_contract.functions.createEscrow( + try: + tx_hash = self.factory_contract.functions.createEscrow( token_address, trusted_handlers, job_requester_id - ), - EscrowClientError, - tx_options, - ) - return next( - ( - self.factory_contract.events.LaunchedV2().process_log(log) - for log in transaction_receipt["logs"] - if log["address"] == self.network["factory_address"] - ), - None, - ).args.escrow + ).transact(tx_options or {}) + receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) + event = next( + ( + self.factory_contract.events.LaunchedV2().process_log(log) + for log in receipt["logs"] + if log["address"] == self.network["factory_address"] + ), + None, + ) + return event.args.escrow if event else None + except Exception as e: + handle_error(e, EscrowClientError) + @requires_signer def setup( self, escrow_address: str, @@ -350,23 +352,26 @@ def get_w3_with_priv_key(priv_key: str): if not Web3.is_address(escrow_address): raise EscrowClientError(f"Invalid escrow address: {escrow_address}") - handle_transaction( - self.w3, - "Setup", - self._get_escrow_contract(escrow_address).functions.setup( - escrow_config.reputation_oracle_address, - escrow_config.recording_oracle_address, - escrow_config.exchange_oracle_address, - escrow_config.reputation_oracle_fee, - escrow_config.recording_oracle_fee, - escrow_config.exchange_oracle_fee, - escrow_config.manifest_url, - escrow_config.hash, - ), - EscrowClientError, - tx_options, - ) + try: + tx_hash = ( + self._get_escrow_contract(escrow_address) + .functions.setup( + escrow_config.reputation_oracle_address, + escrow_config.recording_oracle_address, + escrow_config.exchange_oracle_address, + escrow_config.reputation_oracle_fee, + escrow_config.recording_oracle_fee, + escrow_config.exchange_oracle_fee, + escrow_config.manifest_url, + escrow_config.hash, + ) + .transact(tx_options or {}) + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) + @requires_signer def fund( self, escrow_address: str, @@ -419,18 +424,18 @@ def get_w3_with_priv_key(priv_key: str): raise EscrowClientError("Amount must be positive") token_address = self.get_token_address(escrow_address) - erc20_interface = get_erc20_interface() token_contract = self.w3.eth.contract(token_address, abi=erc20_interface["abi"]) - handle_transaction( - self.w3, - "Fund", - token_contract.functions.transfer(escrow_address, amount), - EscrowClientError, - tx_options, - ) - + try: + tx_hash = token_contract.functions.transfer( + escrow_address, amount + ).transact(tx_options or {}) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) + + @requires_signer def store_results( self, escrow_address: str, @@ -486,17 +491,18 @@ def get_w3_with_priv_key(priv_key: str): raise EscrowClientError("Invalid empty hash") if not validate_url(url): raise EscrowClientError(f"Invalid URL: {url}") - if not self.w3.eth.default_account: - raise EscrowClientError("You must add an account to Web3 instance") - - handle_transaction( - self.w3, - "Store Results", - self._get_escrow_contract(escrow_address).functions.storeResults(url, hash), - EscrowClientError, - tx_options, - ) + try: + tx_hash = ( + self._get_escrow_contract(escrow_address) + .functions.storeResults(url, hash) + .transact(tx_options or {}) + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) + + @requires_signer def complete( self, escrow_address: str, tx_options: Optional[TxParams] = None ) -> None: @@ -539,14 +545,17 @@ def get_w3_with_priv_key(priv_key: str): if not Web3.is_address(escrow_address): raise EscrowClientError(f"Invalid escrow address: {escrow_address}") - handle_transaction( - self.w3, - "Complete", - self._get_escrow_contract(escrow_address).functions.complete(), - EscrowClientError, - tx_options, - ) + try: + tx_hash = ( + self._get_escrow_contract(escrow_address) + .functions.complete() + .transact(tx_options or {}) + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) + @requires_signer def bulk_payout( self, escrow_address: str, @@ -621,11 +630,8 @@ def get_w3_with_priv_key(priv_key: str): self.ensure_correct_bulk_payout_input( escrow_address, recipients, amounts, final_results_url, final_results_hash ) - - if force_complete: - handle_transaction( - self.w3, - "Bulk Payout", + try: + contract_func = ( self._get_escrow_contract(escrow_address).functions.bulkPayOut( recipients, amounts, @@ -633,20 +639,16 @@ def get_w3_with_priv_key(priv_key: str): final_results_hash, txId, force_complete, - ), - EscrowClientError, - tx_options, - ) - else: - handle_transaction( - self.w3, - "Bulk Payout", - self._get_escrow_contract(escrow_address).functions.bulkPayOut( + ) + if force_complete + else self._get_escrow_contract(escrow_address).functions.bulkPayOut( recipients, amounts, final_results_url, final_results_hash, txId - ), - EscrowClientError, - tx_options, + ) ) + tx_hash = contract_func.transact(tx_options or {}) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) def create_bulk_payout_transaction( self, @@ -818,6 +820,7 @@ def ensure_correct_bulk_payout_input( if not final_results_hash: raise EscrowClientError("Invalid empty final results hash") + @requires_signer def cancel( self, escrow_address: str, tx_options: Optional[TxParams] = None ) -> EscrowCancel: @@ -866,41 +869,42 @@ def get_w3_with_priv_key(priv_key: str): if not Web3.is_address(escrow_address): raise EscrowClientError(f"Invalid escrow address: {escrow_address}") - transaction_receipt = handle_transaction( - self.w3, - "Cancel", - self._get_escrow_contract(escrow_address).functions.cancel(), - EscrowClientError, - tx_options, - ) - - amount_transferred = None - token_address = self.get_token_address(escrow_address) - - erc20_interface = get_erc20_interface() - token_contract = self.w3.eth.contract(token_address, abi=erc20_interface["abi"]) - - for log in transaction_receipt["logs"]: - if log["address"] == token_address: - processed_log = token_contract.events.Transfer().process_log(log) - - if ( - processed_log["event"] == "Transfer" - and processed_log["args"]["from"] == escrow_address - ): - amount_transferred = processed_log["args"]["value"] - break - - if amount_transferred is None: - raise EscrowClientError("Transfer Event Not Found in Transaction Logs") + try: + tx_hash = ( + self._get_escrow_contract(escrow_address) + .functions.cancel() + .transact(tx_options or {}) + ) + receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) - escrow_cancel_data = EscrowCancel( - tx_hash=transaction_receipt["transactionHash"].hex(), - amount_refunded=amount_transferred, - ) + amount_transferred = None + token_address = self.get_token_address(escrow_address) + erc20_interface = get_erc20_interface() + token_contract = self.w3.eth.contract( + token_address, abi=erc20_interface["abi"] + ) - return escrow_cancel_data + for log in receipt["logs"]: + if log["address"] == token_address: + processed_log = token_contract.events.Transfer().process_log(log) + if ( + processed_log["event"] == "Transfer" + and processed_log["args"]["from"] == escrow_address + ): + amount_transferred = processed_log["args"]["value"] + break + + if amount_transferred is None: + raise EscrowClientError("Transfer Event Not Found in Transaction Logs") + + return EscrowCancel( + tx_hash=receipt["transactionHash"].hex(), + amount_refunded=amount_transferred, + ) + except Exception as e: + handle_error(e, EscrowClientError) + @requires_signer def add_trusted_handlers( self, escrow_address: str, @@ -957,16 +961,17 @@ def get_w3_with_priv_key(priv_key: str): if not Web3.is_address(handler): raise EscrowClientError(f"Invalid handler address: {handler}") - handle_transaction( - self.w3, - "Add Trusted Handlers", - self._get_escrow_contract(escrow_address).functions.addTrustedHandlers( - handlers - ), - EscrowClientError, - tx_options, - ) + try: + tx_hash = ( + self._get_escrow_contract(escrow_address) + .functions.addTrustedHandlers(handlers) + .transact(tx_options or {}) + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) + @requires_signer def withdraw( self, escrow_address: str, @@ -1024,40 +1029,40 @@ def get_w3_with_priv_key(priv_key: str): if not Web3.is_address(token_address): raise EscrowClientError(f"Invalid token address: {token_address}") - transaction_receipt = handle_transaction( - self.w3, - "Withdraw", - self._get_escrow_contract(escrow_address).functions.withdraw(token_address), - EscrowClientError, - tx_options, - ) - - amount_transferred = None - - erc20_interface = get_erc20_interface() - token_contract = self.w3.eth.contract(token_address, abi=erc20_interface["abi"]) - - for log in transaction_receipt["logs"]: - if log["address"] == token_address: - processed_log = token_contract.events.Transfer().process_log(log) - - if ( - processed_log["event"] == "Transfer" - and processed_log["args"]["from"] == escrow_address - ): - amount_transferred = processed_log["args"]["value"] - break - - if amount_transferred is None: - raise EscrowClientError("Transfer Event Not Found in Transaction Logs") + try: + tx_hash = ( + self._get_escrow_contract(escrow_address) + .functions.withdraw(token_address) + .transact(tx_options or {}) + ) + receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) - escrow_withdraw_data = EscrowWithdraw( - tx_hash=transaction_receipt["transactionHash"].hex(), - token_address=token_address, - amount_withdrawn=amount_transferred, - ) + amount_transferred = None + erc20_interface = get_erc20_interface() + token_contract = self.w3.eth.contract( + token_address, abi=erc20_interface["abi"] + ) - return escrow_withdraw_data + for log in receipt["logs"]: + if log["address"] == token_address: + processed_log = token_contract.events.Transfer().process_log(log) + if ( + processed_log["event"] == "Transfer" + and processed_log["args"]["from"] == escrow_address + ): + amount_transferred = processed_log["args"]["value"] + break + + if amount_transferred is None: + raise EscrowClientError("Transfer Event Not Found in Transaction Logs") + + return EscrowWithdraw( + tx_hash=receipt["transactionHash"].hex(), + token_address=token_address, + amount_withdrawn=amount_transferred, + ) + except Exception as e: + handle_error(e, EscrowClientError) def get_balance(self, escrow_address: str) -> Decimal: """ diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/kvstore/kvstore_client.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/kvstore/kvstore_client.py index 9cfac5bd49..54b366cba1 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/kvstore/kvstore_client.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/kvstore/kvstore_client.py @@ -57,10 +57,11 @@ def get_w3_with_priv_key(priv_key: str): import requests -from human_protocol_sdk.constants import NETWORKS, ChainId, KVStoreKeys +from human_protocol_sdk.constants import NETWORKS, ChainId +from human_protocol_sdk.decorators import requires_signer from human_protocol_sdk.utils import ( get_kvstore_interface, - handle_transaction, + handle_error, validate_url, ) from web3 import Web3 @@ -116,6 +117,7 @@ def __init__(self, web3: Web3, gas_limit: Optional[int] = None): ) self.gas_limit = gas_limit + @requires_signer def set(self, key: str, value: str, tx_options: Optional[TxParams] = None) -> None: """ Sets the value of a key-value pair in the contract. @@ -155,14 +157,15 @@ def get_w3_with_priv_key(priv_key: str): if not key: raise KVStoreClientError("Key cannot be empty") - handle_transaction( - self.w3, - "Set", - self.kvstore_contract.functions.set(key, value), - KVStoreClientError, - tx_options, - ) + try: + tx_hash = self.kvstore_contract.functions.set(key, value).transact( + tx_options or {} + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, KVStoreClientError) + @requires_signer def set_bulk( self, keys: List[str], values: List[str], tx_options: Optional[TxParams] = None ) -> None: @@ -211,14 +214,15 @@ def get_w3_with_priv_key(priv_key: str): if len(keys) != len(values): raise KVStoreClientError("Arrays must have the same length") - handle_transaction( - self.w3, - "Set Bulk", - self.kvstore_contract.functions.setBulk(keys, values), - KVStoreClientError, - tx_options, - ) + try: + tx_hash = self.kvstore_contract.functions.setBulk(keys, values).transact( + tx_options or {} + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, KVStoreClientError) + @requires_signer def set_file_url_and_hash( self, url: str, @@ -268,13 +272,10 @@ def get_w3_with_priv_key(priv_key: str): content = requests.get(url).text content_hash = self.w3.keccak(text=content).hex() - - handle_transaction( - self.w3, - "Set Bulk", - self.kvstore_contract.functions.setBulk( + try: + tx_hash = self.kvstore_contract.functions.setBulk( [key, key + "_hash"], [url, content_hash] - ), - KVStoreClientError, - tx_options, - ) + ).transact(tx_options or {}) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, KVStoreClientError) 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 097177953a..c9a7f2e53c 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 @@ -63,11 +63,12 @@ def get_w3_with_priv_key(priv_key: str): from web3.types import TxParams from human_protocol_sdk.constants import ChainId, NETWORKS +from human_protocol_sdk.decorators import requires_signer from human_protocol_sdk.utils import ( get_erc20_interface, get_factory_interface, get_staking_interface, - handle_transaction, + handle_error, ) LOG = logging.getLogger("human_protocol_sdk.staking") @@ -130,6 +131,7 @@ def __init__(self, w3: Web3): address=self.network["staking_address"], abi=staking_interface["abi"] ) + @requires_signer def approve_stake( self, amount: Decimal, tx_options: Optional[TxParams] = None ) -> None: @@ -173,17 +175,15 @@ def get_w3_with_priv_key(priv_key: str): if amount <= 0: raise StakingClientError("Amount to approve must be greater than 0") - - handle_transaction( - self.w3, - "Approve stake", - self.hmtoken_contract.functions.approve( + try: + tx_hash = self.hmtoken_contract.functions.approve( self.network["staking_address"], amount - ), - StakingClientError, - tx_options, - ) + ).transact(tx_options or {}) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, StakingClientError) + @requires_signer def stake(self, amount: Decimal, tx_options: Optional[TxParams] = None) -> None: """Stakes HMT token. @@ -228,15 +228,15 @@ def get_w3_with_priv_key(priv_key: str): if amount <= 0: raise StakingClientError("Amount to stake must be greater than 0") + try: + tx_hash = self.staking_contract.functions.stake(amount).transact( + tx_options or {} + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, StakingClientError) - handle_transaction( - self.w3, - "Stake HMT", - self.staking_contract.functions.stake(amount), - StakingClientError, - tx_options, - ) - + @requires_signer def unstake(self, amount: Decimal, tx_options: Optional[TxParams] = None) -> None: """Unstakes HMT token. @@ -279,15 +279,15 @@ def get_w3_with_priv_key(priv_key: str): if amount <= 0: raise StakingClientError("Amount to unstake must be greater than 0") + try: + tx_hash = self.staking_contract.functions.unstake(amount).transact( + tx_options or {} + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, StakingClientError) - handle_transaction( - self.w3, - "Unstake HMT", - self.staking_contract.functions.unstake(amount), - StakingClientError, - tx_options, - ) - + @requires_signer def withdraw(self, tx_options: Optional[TxParams] = None) -> None: """Withdraws HMT token. @@ -325,14 +325,15 @@ def get_w3_with_priv_key(priv_key: str): staking_client.withdraw() """ - handle_transaction( - self.w3, - "Withdraw HMT", - self.staking_contract.functions.withdraw(), - StakingClientError, - tx_options, - ) + try: + tx_hash = self.staking_contract.functions.withdraw().transact( + tx_options or {} + ) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, StakingClientError) + @requires_signer def slash( self, slasher: str, @@ -391,19 +392,15 @@ def get_w3_with_priv_key(priv_key: str): if amount <= 0: raise StakingClientError("Amount to slash must be greater than 0") - if not self._is_valid_escrow(escrow_address): raise StakingClientError(f"Invalid escrow address: {escrow_address}") - - handle_transaction( - self.w3, - "Slash HMT", - self.staking_contract.functions.slash( + try: + tx_hash = self.staking_contract.functions.slash( slasher, staker, escrow_address, amount - ), - StakingClientError, - tx_options, - ) + ).transact(tx_options or {}) + self.w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, StakingClientError) def get_staker_info(self, staker_address: str) -> dict: """Retrieves comprehensive staking information for a staker. diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/utils.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/utils.py index 61dfd5bed3..a099270afd 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/utils.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/utils.py @@ -220,54 +220,58 @@ def get_data_from_subgraph(network: dict, query: str, params: dict = None): ) -def handle_transaction( - w3: Web3, tx_name: str, tx, exception: Exception, tx_options: Optional[TxParams] -): - """Executes the transaction and waits for the receipt. +def handle_error(e, exception_class): + """ + Handles and translates errors raised during contract transactions. - :param w3: Web3 instance - :param tx_name: Name of the transaction - :param tx: Transaction object - :param exception: Exception class to raise in case of error - :param tx_options: (Optional) Additional transaction parameters - - If provided, can include values like 'gas', 'gas_price', 'nonce', etc - - If 'gas' is not specified or is None, it will be estimated using tx.estimate_gas() + This function captures exceptions (especially ContractLogicError from web3.py), + extracts meaningful revert reasons if present, logs unexpected errors, and raises + a custom exception with a clear message for SDK users. - :return: The transaction receipt + :param e: The exception object raised during a transaction. + :param exception_class: The custom exception class to raise (e.g., EscrowClientError). - :validate: - - There must be a default account + :raises exception_class: With a detailed error message, including contract revert reasons if available. - :raise exception: If the transaction fails + :example: + try: + tx_hash = contract.functions.someMethod(...).transact() + w3.eth.wait_for_transaction_receipt(tx_hash) + except Exception as e: + handle_error(e, EscrowClientError) """ - if not w3.eth.default_account: - raise exception("You must add an account to Web3 instance") - if not w3.middleware_onion.get("SignAndSendRawMiddlewareBuilder"): - raise exception( - "You must add SignAndSendRawMiddlewareBuilder middleware to Web3 instance" - ) - try: - if tx_options and tx_options.get("gas") is None: - tx_options["gas"] = tx.estimate_gas() - elif tx_options is None: - tx_options = {"gas": tx.estimate_gas()} - tx_hash = tx.transact(tx_options) - return w3.eth.wait_for_transaction_receipt(tx_hash) - except ContractLogicError as e: - start_index = e.args[0].find("execution reverted: ") + len( - "execution reverted: " - ) - message = e.args[0][start_index:] - raise exception(f"{tx_name} transaction failed: {message}") - except Exception as e: - logger.exception(f"Handle transaction error: {e}") - if "reverted with reason string" in e.args[0]: - start_index = e.args[0].find("'") + 1 - end_index = e.args[0].rfind("'") - message = e.args[0][start_index:end_index] - raise exception(f"{tx_name} transaction failed: {message}") - else: - raise exception(f"{tx_name} transaction failed.") + + def extract_reason(msg): + patterns = [ + r"reverted with reason string '([^']+)'", + r"execution reverted: ([^\"']+)", + r"Error: VM Exception while processing transaction: reverted with reason string '([^']+)'", + ] + for pattern in patterns: + match = re.search(pattern, msg) + if match: + return match.group(1) + return msg.strip() + + if isinstance(e, ContractLogicError): + msg = str(e) + msg = extract_reason(msg) + raise exception_class(f"Contract execution failed: {msg}") + else: + logger.exception(f"Transaction error: {e}") + msg = str(e) + # If error has a 'message' attribute or dict, try to extract it + if hasattr(e, "message"): + msg = getattr(e, "message") + elif ( + hasattr(e, "args") + and e.args + and isinstance(e.args[0], dict) + and "message" in e.args[0] + ): + msg = e.args[0]["message"] + msg = extract_reason(msg) + raise exception_class(f"Transaction failed: {msg}") def validate_url(url: str) -> bool: 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 ac0f38ae57..4fce80e892 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 @@ -1,10 +1,11 @@ -from types import SimpleNamespace import unittest from datetime import datetime from test.human_protocol_sdk.utils import DEFAULT_GAS_PAYER_PRIV -from unittest.mock import MagicMock, PropertyMock, patch, ANY +from types import SimpleNamespace +from unittest.mock import ANY, MagicMock, PropertyMock, patch from human_protocol_sdk.constants import NETWORKS, ChainId, Status +from human_protocol_sdk.decorators import RequiresSignerError from human_protocol_sdk.escrow import EscrowClient, EscrowClientError, EscrowConfig from human_protocol_sdk.filter import EscrowFilter, FilterError from web3 import Web3 @@ -335,39 +336,40 @@ def test_escrow_config_invalid_hash(self): self.assertEqual("Invalid empty manifest hash", str(cm.exception)) def test_create_escrow(self): - mock_function_create = MagicMock() - self.escrow.factory_contract.functions.createEscrow = mock_function_create escrow_address = "0x1234567890123456789012345678901234567890" token_address = "0x1234567890123456789012345678901234567890" job_requester_id = "job-requester" trusted_handlers = [self.w3.eth.default_account] - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - with patch( - "human_protocol_sdk.escrow.escrow_client.next" - ) as mock_function_next: - mock_function_next.return_value = SimpleNamespace( - args=SimpleNamespace(escrow=escrow_address) - ) - response = self.escrow.create_escrow( - token_address, trusted_handlers, job_requester_id - ) - - self.assertEqual(response, escrow_address) - mock_function_create.assert_called_once_with( - token_address, trusted_handlers, job_requester_id - ) - mock_function_next.assert_called_once() - - mock_function.assert_called_once_with( - self.w3, - "Create Escrow", - mock_function_create.return_value, - EscrowClientError, - None, - ) + mock_create = MagicMock() + mock_create.transact.return_value = "tx_hash" + self.escrow.factory_contract.functions.createEscrow = MagicMock( + return_value=mock_create + ) + mock_event = MagicMock() + mock_event.args.escrow = escrow_address + mock_events = MagicMock() + mock_events.LaunchedV2().process_log.return_value = mock_event + self.escrow.factory_contract.events = mock_events + self.escrow.network["factory_address"] = ( + "0x1234567890123456789012345678901234567890" + ) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": [{"address": self.escrow.network["factory_address"]}]} + ) + + result = self.escrow.create_escrow( + token_address, trusted_handlers, job_requester_id + ) + + self.escrow.factory_contract.functions.createEscrow.assert_called_once_with( + token_address, trusted_handlers, job_requester_id + ) + mock_create.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + self.assertEqual(result, escrow_address) def test_create_escrow_invalid_token(self): token_address = "invalid_address" @@ -400,7 +402,7 @@ def test_create_escrow_without_account(self): token_address = "0x1234567890123456789012345678901234567890" trusted_handlers = ["0x1234567890123456789012345678901234567890"] job_requester_id = "job-requester" - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.create_escrow( token_address, trusted_handlers, job_requester_id ) @@ -415,37 +417,45 @@ def test_create_escrow_with_tx_options(self): trusted_handlers = [self.w3.eth.default_account] tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - with patch( - "human_protocol_sdk.escrow.escrow_client.next" - ) as mock_function_next: - mock_function_next.return_value = SimpleNamespace( - args=SimpleNamespace(escrow=escrow_address) - ) - response = self.escrow.create_escrow( - token_address, trusted_handlers, job_requester_id, tx_options - ) - - self.assertEqual(response, escrow_address) - mock_function_create.assert_called_once_with( - token_address, trusted_handlers, job_requester_id - ) - mock_function_next.assert_called_once() - - mock_function.assert_called_once_with( - self.w3, - "Create Escrow", - mock_function_create.return_value, - EscrowClientError, - tx_options, - ) + mock_create = MagicMock() + mock_create.transact.return_value = "tx_hash" + self.escrow.factory_contract.functions.createEscrow = MagicMock( + return_value=mock_create + ) + mock_event = MagicMock() + mock_event.args.escrow = escrow_address + mock_events = MagicMock() + mock_events.LaunchedV2().process_log.return_value = mock_event + self.escrow.factory_contract.events = mock_events + self.escrow.network["factory_address"] = ( + "0x1234567890123456789012345678901234567890" + ) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": [{"address": self.escrow.network["factory_address"]}]} + ) + + result = self.escrow.create_escrow( + token_address, trusted_handlers, job_requester_id, tx_options + ) + + self.escrow.factory_contract.functions.createEscrow.assert_called_once_with( + token_address, trusted_handlers, job_requester_id + ) + mock_create.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + self.assertEqual(result, escrow_address) def test_setup(self): mock_contract = MagicMock() - mock_contract.functions.setup = MagicMock() + mock_setup = MagicMock() + mock_setup.transact.return_value = "tx_hash" + mock_contract.functions.setup = MagicMock(return_value=mock_setup) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" escrow_config = EscrowConfig( "0x1234567890123456789012345678901234567890", @@ -458,29 +468,23 @@ def test_setup(self): "test", ) - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.setup(escrow_address, escrow_config) + self.escrow.setup(escrow_address, escrow_config) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.setup.assert_called_once_with( - escrow_config.recording_oracle_address, - escrow_config.reputation_oracle_address, - escrow_config.exchange_oracle_address, - escrow_config.recording_oracle_fee, - escrow_config.reputation_oracle_fee, - escrow_config.exchange_oracle_fee, - escrow_config.manifest_url, - escrow_config.hash, - ) - mock_function.assert_called_once_with( - self.w3, - "Setup", - mock_contract.functions.setup.return_value, - EscrowClientError, - None, - ) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.setup.assert_called_once_with( + escrow_config.reputation_oracle_address, + escrow_config.recording_oracle_address, + escrow_config.exchange_oracle_address, + escrow_config.reputation_oracle_fee, + escrow_config.recording_oracle_fee, + escrow_config.exchange_oracle_fee, + escrow_config.manifest_url, + escrow_config.hash, + ) + mock_setup.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_setup_invalid_address(self): escrow_address = "test" @@ -518,7 +522,7 @@ def test_setup_without_account(self): "https://www.example.com/result", "test", ) - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.setup(escrow_address, escrow_config) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -544,7 +548,7 @@ def test_setup_invalid_status(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.setup(escrow_address, escrow_config) self.assertEqual( - "Setup transaction failed: Escrow not in Launched status state", + "Transaction failed: Escrow not in Launched status state", str(cm.exception), ) @@ -570,33 +574,18 @@ def test_setup_invalid_caller(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.setup(escrow_address, escrow_config) self.assertEqual( - "Setup transaction failed: Address calling not trusted", str(cm.exception) - ) - - def test_setup_invalid_escrow(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) - escrow_address = "0x1234567890123456789012345678901234567890" - escrow_config = EscrowConfig( - "0x1234567890123456789012345678901234567890", - "0x1234567890123456789012345678901234567890", - "0x1234567890123456789012345678901234567890", - 10, - 10, - 10, - "https://www.example.com/result", - "test", - ) - - with self.assertRaises(EscrowClientError) as cm: - self.escrow.setup(escrow_address, escrow_config) - self.assertEqual( - "Escrow address is not provided by the factory", str(cm.exception) + "Transaction failed: Address calling not trusted", str(cm.exception) ) def test_setup_with_tx_options(self): mock_contract = MagicMock() - mock_contract.functions.setup = MagicMock() + mock_setup = MagicMock() + mock_setup.transact.return_value = "tx_hash" + mock_contract.functions.setup = MagicMock(return_value=mock_setup) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" escrow_config = EscrowConfig( "0x1234567890123456789012345678901234567890", @@ -610,33 +599,47 @@ def test_setup_with_tx_options(self): ) tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_handle_transaction: - self.escrow.setup(escrow_address, escrow_config, tx_options) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Setup", - mock_contract.functions.setup.return_value, - EscrowClientError, - tx_options, - ) + self.escrow.setup(escrow_address, escrow_config, tx_options) + + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.setup.assert_called_once_with( + escrow_config.reputation_oracle_address, + escrow_config.recording_oracle_address, + escrow_config.exchange_oracle_address, + escrow_config.reputation_oracle_fee, + escrow_config.recording_oracle_fee, + escrow_config.exchange_oracle_fee, + escrow_config.manifest_url, + escrow_config.hash, + ) + mock_setup.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_fund(self): escrow_address = token_address = "0x1234567890123456789012345678901234567890" amount = 100 self.escrow.get_token_address = MagicMock(return_value=token_address) + mock_token_contract = MagicMock() + mock_transfer = MagicMock() + mock_transfer.transact.return_value = "tx_hash" + mock_token_contract.functions.transfer = MagicMock(return_value=mock_transfer) + self.escrow.w3.eth.contract = MagicMock(return_value=mock_token_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.fund(escrow_address, amount) + self.escrow.fund(escrow_address, amount) - self.escrow.get_token_address.assert_called_once_with(escrow_address) - mock_function.assert_called_once_with( - self.w3, "Fund", ANY, EscrowClientError, None - ) + self.escrow.get_token_address.assert_called_once_with(escrow_address) + mock_token_contract.functions.transfer.assert_called_once_with( + escrow_address, amount + ) + mock_transfer.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_fund_invalid_address(self): escrow_address = "invalid_address" @@ -666,7 +669,7 @@ def test_fund_without_account(self): escrowClient.get_token_address = MagicMock(return_value=token_address) - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.fund(escrow_address, amount) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -675,45 +678,49 @@ def test_fund_with_tx_options(self): self.escrow.factory_contract.functions.createEscrow = mock_function_create escrow_address = token_address = "0x1234567890123456789012345678901234567890" amount = 100 - self.escrow.get_token_address = MagicMock(return_value=token_address) tx_options = {"gas": 50000} + self.escrow.get_token_address = MagicMock(return_value=token_address) + mock_token_contract = MagicMock() + mock_transfer = MagicMock() + mock_transfer.transact.return_value = "tx_hash" + mock_token_contract.functions.transfer = MagicMock(return_value=mock_transfer) + self.escrow.w3.eth.contract = MagicMock(return_value=mock_token_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.fund(escrow_address, amount, tx_options) - - self.escrow.get_token_address.assert_called_once_with(escrow_address) - mock_function.assert_called_once_with( - self.w3, - "Fund", - ANY, - EscrowClientError, - tx_options, - ) + self.escrow.fund(escrow_address, amount, tx_options) + + self.escrow.get_token_address.assert_called_once_with(escrow_address) + mock_token_contract.functions.transfer.assert_called_once_with( + escrow_address, amount + ) + mock_transfer.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_store_results(self): mock_contract = MagicMock() - mock_contract.functions.storeResults = MagicMock() + mock_store = MagicMock() + mock_store.transact.return_value = "tx_hash" + mock_contract.functions.storeResults = MagicMock(return_value=mock_store) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" url = "https://www.example.com/result" hash = "test" - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.store_results(escrow_address, url, hash) + self.escrow.store_results(escrow_address, url, hash) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.storeResults.assert_called_once_with(url, hash) - mock_function.assert_called_once_with( - self.w3, - "Store Results", - mock_contract.functions.storeResults.return_value, - EscrowClientError, - None, - ) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.storeResults.assert_called_once_with(url, hash) + mock_store.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_store_results_invalid_address(self): escrow_address = "invalid_address" @@ -754,7 +761,7 @@ def test_store_results_without_account(self): url = "https://www.example.com/result" hash = "test" - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.store_results(escrow_address, url, hash) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -772,7 +779,7 @@ def test_store_results_invalid_status(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.store_results(escrow_address, url, hash) self.assertEqual( - "Store Results transaction failed: Escrow not in Pending or Partial status state", + "Transaction failed: Escrow not in Pending or Partial status state", str(cm.exception), ) @@ -790,52 +797,43 @@ def test_store_results_invalid_caller(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.store_results(escrow_address, url, hash) self.assertEqual( - "Store Results transaction failed: Address calling not trusted", - str(cm.exception), - ) - - def test_store_results_invalid_escrow(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) - escrow_address = "0x1234567890123456789012345678901234567890" - url = "https://www.example.com/result" - hash = "test" - - with self.assertRaises(EscrowClientError) as cm: - self.escrow.store_results(escrow_address, url, hash) - self.assertEqual( - "Escrow address is not provided by the factory", + "Transaction failed: Address calling not trusted", str(cm.exception), ) def test_store_results_with_tx_options(self): mock_contract = MagicMock() - mock_contract.functions.storeResults = MagicMock() + mock_store = MagicMock() + mock_store.transact.return_value = "tx_hash" + mock_contract.functions.storeResults = MagicMock(return_value=mock_store) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" url = "https://www.example.com/result" hash = "test" tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.store_results(escrow_address, url, hash, tx_options) - - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.storeResults.assert_called_once_with(url, hash) - mock_function.assert_called_once_with( - self.w3, - "Store Results", - mock_contract.functions.storeResults.return_value, - EscrowClientError, - tx_options, - ) + self.escrow.store_results(escrow_address, url, hash, tx_options) + + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.storeResults.assert_called_once_with(url, hash) + mock_store.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_bulk_payout(self): mock_contract = MagicMock() - mock_contract.functions.bulkPayOut = MagicMock() + mock_bulk = MagicMock() + mock_bulk.transact.return_value = "tx_hash" + mock_contract.functions.bulkPayOut = MagicMock(return_value=mock_bulk) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) self.escrow.get_balance = MagicMock(return_value=100) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" recipients = ["0x1234567890123456789012345678901234567890"] amounts = [100] @@ -843,35 +841,34 @@ def test_bulk_payout(self): final_results_hash = "test" txId = 1 - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.bulk_payout( - escrow_address, - recipients, - amounts, - final_results_url, - final_results_hash, - txId, - ) + self.escrow.bulk_payout( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + ) - 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_function.assert_called_once_with( - self.w3, - "Bulk Payout", - mock_contract.functions.bulkPayOut.return_value, - EscrowClientError, - None, - ) + 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_bulk.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_bulk_payout_with_force_complete(self): mock_contract = MagicMock() - mock_contract.functions.bulkPayOut = MagicMock() + mock_bulk = MagicMock() + mock_bulk.transact.return_value = "tx_hash" + mock_contract.functions.bulkPayOut = MagicMock(return_value=mock_bulk) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) self.escrow.get_balance = MagicMock(return_value=100) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" recipients = ["0x1234567890123456789012345678901234567890"] amounts = [100] @@ -879,30 +876,24 @@ def test_bulk_payout_with_force_complete(self): final_results_hash = "test" txId = 1 - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.bulk_payout( - escrow_address, - recipients, - amounts, - final_results_url, - final_results_hash, - txId, - True, - ) + self.escrow.bulk_payout( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + True, + ) - 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, True - ) - mock_function.assert_called_once_with( - self.w3, - "Bulk Payout", - mock_contract.functions.bulkPayOut.return_value, - EscrowClientError, - None, - ) + 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, True + ) + mock_bulk.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_bulk_payout_invalid_address(self): escrow_address = "0x1234567890123456789012345678901234567890" @@ -1110,7 +1101,7 @@ def test_bulk_payout_without_account(self): txId = 1 escrowClient.get_balance = MagicMock(return_value=100) - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.bulk_payout( escrow_address, recipients, @@ -1121,153 +1112,43 @@ def test_bulk_payout_without_account(self): ) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) - def test_bulk_payout_invalid_escrow_address(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) - 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( - "Escrow address is not provided by the factory", str(cm.exception) - ) - - def test_bulk_payout_exceed_max_value(self): + def test_bulk_payout_with_tx_options(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 'Bulk value too high'." - ) + mock_bulk = MagicMock() + mock_bulk.transact.return_value = "tx_hash" + mock_contract.functions.bulkPayOut = MagicMock(return_value=mock_bulk) 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: Bulk value too high", str(cm.exception) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} ) - - def test_bulk_payout_invalid_status(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 'Invalid status'." - ) - 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 + tx_options = {"gas": 50000} - 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: Invalid status", str(cm.exception) + self.escrow.bulk_payout( + escrow_address, + recipients, + amounts, + final_results_url, + final_results_hash, + txId, + tx_options=tx_options, ) - def test_bulk_payout_invalid_caller(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 'Address calling not trusted'." + 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 ) - 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: Address calling not trusted", - str(cm.exception), + mock_bulk.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" ) - def test_bulk_payout_with_tx_options(self): - mock_contract = MagicMock() - mock_contract.functions.bulkPayOut = MagicMock() - 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 - tx_options = {"gas": 50000} - - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.bulk_payout( - escrow_address, - recipients, - amounts, - final_results_url, - final_results_hash, - txId, - False, - tx_options, - ) - - 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_function.assert_called_once_with( - self.w3, - "Bulk Payout", - mock_contract.functions.bulkPayOut.return_value, - EscrowClientError, - tx_options, - ) - def test_create_bulk_payout_transaction(self): mock_contract = MagicMock() mock_contract.functions.bulkPayOut = MagicMock() @@ -1440,24 +1321,23 @@ def test_create_bulk_payout_transaction_empty_hash(self): def test_complete(self): mock_contract = MagicMock() - mock_contract.functions.complete = MagicMock() + mock_complete = MagicMock() + mock_complete.transact.return_value = "tx_hash" + mock_contract.functions.complete = MagicMock(return_value=mock_complete) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.complete(escrow_address) + self.escrow.complete(escrow_address) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.complete.assert_called_once_with() - mock_function.assert_called_once_with( - self.w3, - "Complete", - mock_contract.functions.complete.return_value, - EscrowClientError, - None, - ) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.complete.assert_called_once_with() + mock_complete.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_complete_invalid_address(self): escrow_address = "invalid_address" @@ -1476,7 +1356,7 @@ def test_complete_without_account(self): escrow_address = "0x1234567890123456789012345678901234567890" - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.complete(escrow_address) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -1492,7 +1372,7 @@ def test_complete_invalid_status(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.complete(escrow_address) self.assertEqual( - "Complete transaction failed: Escrow not in Paid state", str(cm.exception) + "Transaction failed: Escrow not in Paid state", str(cm.exception) ) def test_complete_invalid_caller(self): @@ -1507,102 +1387,68 @@ def test_complete_invalid_caller(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.complete(escrow_address) self.assertEqual( - "Complete transaction failed: Address calling not trusted", + "Transaction failed: Address calling not trusted", str(cm.exception), ) - def test_complete_invalid_address(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) - escrow_address = "0x1234567890123456789012345678901234567890" - - with self.assertRaises(EscrowClientError) as cm: - self.escrow.complete(escrow_address) - self.assertEqual( - "Escrow address is not provided by the factory", str(cm.exception) - ) - def test_complete_with_tx_options(self): mock_contract = MagicMock() - mock_contract.functions.complete = MagicMock() + mock_complete = MagicMock() + mock_complete.transact.return_value = "tx_hash" + mock_contract.functions.complete = MagicMock(return_value=mock_complete) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.complete(escrow_address, tx_options) - - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.complete.assert_called_once_with() - mock_function.assert_called_once_with( - self.w3, - "Complete", - mock_contract.functions.complete.return_value, - EscrowClientError, - tx_options, - ) + self.escrow.complete(escrow_address, tx_options) + + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.complete.assert_called_once_with() + mock_complete.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_cancel(self): + escrow_address = "0x1234567890123456789012345678901234567890" + token_address = "0x1234567890123456789012345678901234567891" + amount_refunded = 123 + + # Mock contract and cancel function mock_contract = MagicMock() - mock_contract.functions.cancel = MagicMock() + mock_cancel = MagicMock() + mock_cancel.transact.return_value = "tx_hash" + mock_contract.functions.cancel = MagicMock(return_value=mock_cancel) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) - escrow_address = "0xa76507AbFE3B67cB25F16DbC75a883D4190B7e46" - token_address = "0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" - self.escrow.get_token_address = MagicMock(return_value=token_address) - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - tx_hash = bytes.fromhex( - "01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529" - ) - amount_refunded = 187744067287473730 - mock_function.return_value = { - "transactionHash": tx_hash, - "logs": [ - { - "logIndex": 0, - "transactionIndex": 0, - "transactionHash": tx_hash, - "blockHash": bytes.fromhex( - "92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a" - ), - "blockNumber": 5, - "address": token_address, - "data": bytes.fromhex( - "000000000000000000000000000000000000000000000000029b003c075b5e42" - ), - "topics": [ - bytes.fromhex( - "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" - ), - bytes.fromhex( - "000000000000000000000000a76507abfe3b67cb25f16dbc75a883d4190b7e46" - ), - bytes.fromhex( - "0000000000000000000000005607acf0828e238099aa1784541a5abd7f975c76" - ), - ], - } - ], - } + # Mock token contract and Transfer event + token_contract = MagicMock() + token_contract.events.Transfer().process_log.return_value = { + "event": "Transfer", + "args": {"from": escrow_address, "value": amount_refunded}, + } + self.escrow.w3.eth.contract = MagicMock(return_value=token_contract) - escrow_cancel_data = self.escrow.cancel(escrow_address) + # Mock receipt with logs + receipt = {"transactionHash": b"tx_hash", "logs": [{"address": token_address}]} + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value=receipt + ) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.cancel.assert_called_once_with() - mock_function.assert_called_once_with( - self.w3, - "Cancel", - mock_contract.functions.cancel.return_value, - EscrowClientError, - None, - ) + result = self.escrow.cancel(escrow_address) - self.assertEqual(escrow_cancel_data.txHash, tx_hash.hex()) - self.assertEqual(escrow_cancel_data.amountRefunded, amount_refunded) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.cancel.assert_called_once_with() + mock_cancel.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + self.assertEqual(result.amountRefunded, amount_refunded) + self.assertEqual(result.txHash, receipt["transactionHash"].hex()) def test_cancel_invalid_address(self): escrow_address = "invalid_address" @@ -1621,7 +1467,7 @@ def test_cancel_without_account(self): escrow_address = "0x1234567890123456789012345678901234567890" - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.cancel(escrow_address) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -1637,7 +1483,7 @@ def test_cancel_invalid_status(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.cancel(escrow_address) self.assertEqual( - "Cancel transaction failed: Escrow in Paid status state", str(cm.exception) + "Transaction failed: Escrow in Paid status state", str(cm.exception) ) def test_cancel_invalid_caller(self): @@ -1652,106 +1498,71 @@ def test_cancel_invalid_caller(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.cancel(escrow_address) self.assertEqual( - "Cancel transaction failed: Address calling not trusted", str(cm.exception) + "Transaction failed: Address calling not trusted", str(cm.exception) ) - def test_cancel_invalid_escrow(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) + def test_cancel_with_tx_options(self): escrow_address = "0x1234567890123456789012345678901234567890" + token_address = "0x1234567890123456789012345678901234567891" + amount_refunded = 123 + tx_options = {"gas": 50000} - with self.assertRaises(EscrowClientError) as cm: - self.escrow.cancel(escrow_address) - self.assertEqual( - "Escrow address is not provided by the factory", str(cm.exception) - ) - - def test_cancel_with_tx_options(self): + # Mock contract and cancel function mock_contract = MagicMock() - mock_contract.functions.cancel = MagicMock() + mock_cancel = MagicMock() + mock_cancel.transact.return_value = "tx_hash" + mock_contract.functions.cancel = MagicMock(return_value=mock_cancel) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) - tx_options = {"gas": 50000} - - escrow_address = "0xa76507AbFE3B67cB25F16DbC75a883D4190B7e46" - token_address = "0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" - self.escrow.get_token_address = MagicMock(return_value=token_address) - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - tx_hash = bytes.fromhex( - "01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529" - ) - amount_refunded = 187744067287473730 - mock_function.return_value = { - "transactionHash": tx_hash, - "logs": [ - { - "logIndex": 0, - "transactionIndex": 0, - "transactionHash": tx_hash, - "blockHash": bytes.fromhex( - "92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a" - ), - "blockNumber": 5, - "address": token_address, - "data": bytes.fromhex( - "000000000000000000000000000000000000000000000000029b003c075b5e42" - ), - "topics": [ - bytes.fromhex( - "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" - ), - bytes.fromhex( - "000000000000000000000000a76507abfe3b67cb25f16dbc75a883d4190b7e46" - ), - bytes.fromhex( - "0000000000000000000000005607acf0828e238099aa1784541a5abd7f975c76" - ), - ], - } - ], - } + # Mock token contract and Transfer event + token_contract = MagicMock() + token_contract.events.Transfer().process_log.return_value = { + "event": "Transfer", + "args": {"from": escrow_address, "value": amount_refunded}, + } + self.escrow.w3.eth.contract = MagicMock(return_value=token_contract) - escrow_cancel_data = self.escrow.cancel(escrow_address, tx_options) + # Mock receipt with logs + receipt = {"transactionHash": b"tx_hash", "logs": [{"address": token_address}]} + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value=receipt + ) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.cancel.assert_called_once_with() - mock_function.assert_called_once_with( - self.w3, - "Cancel", - mock_contract.functions.cancel.return_value, - EscrowClientError, - tx_options, - ) + result = self.escrow.cancel(escrow_address, tx_options) - self.assertEqual(escrow_cancel_data.txHash, tx_hash.hex()) - self.assertEqual(escrow_cancel_data.amountRefunded, amount_refunded) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.cancel.assert_called_once_with() + mock_cancel.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + self.assertEqual(result.amountRefunded, amount_refunded) + self.assertEqual(result.txHash, receipt["transactionHash"].hex()) def test_add_trusted_handlers(self): mock_contract = MagicMock() - mock_contract.functions.addTrustedHandlers = MagicMock() + mock_add = MagicMock() + mock_add.transact.return_value = "tx_hash" + mock_contract.functions.addTrustedHandlers = MagicMock(return_value=mock_add) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" handlers = [ "0x1234567890123456789012345678901234567891", "0x1234567890123456789012345678901234567892", ] - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.add_trusted_handlers(escrow_address, handlers) + self.escrow.add_trusted_handlers(escrow_address, handlers) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.addTrustedHandlers.assert_called_once_with(handlers) - mock_function.assert_called_once_with( - self.w3, - "Add Trusted Handlers", - mock_contract.functions.addTrustedHandlers.return_value, - EscrowClientError, - None, - ) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.addTrustedHandlers.assert_called_once_with(handlers) + mock_add.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_add_trusted_handlers_invalid_address(self): escrow_address = "0x1234567890123456789012345678901234567890" @@ -1785,7 +1596,7 @@ def test_add_trusted_handlers_without_account(self): "0x1234567890123456789012345678901234567892", ] - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.add_trusted_handlers(escrow_address, handlers) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -1805,28 +1616,19 @@ def test_add_trusted_handlers_invalid_caller(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.add_trusted_handlers(escrow_address, handlers) self.assertEqual( - "Add Trusted Handlers transaction failed: Address calling not trusted", + "Transaction failed: Address calling not trusted", str(cm.exception), ) - def test_add_trusted_handlers_invalid_escrow(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) - escrow_address = "0x1234567890123456789012345678901234567890" - handlers = [ - "0x1234567890123456789012345678901234567891", - "0x1234567890123456789012345678901234567892", - ] - - with self.assertRaises(EscrowClientError) as cm: - self.escrow.add_trusted_handlers(escrow_address, handlers) - self.assertEqual( - "Escrow address is not provided by the factory", str(cm.exception) - ) - def test_add_trusted_handlers_with_tx_options(self): mock_contract = MagicMock() - mock_contract.functions.addTrustedHandlers = MagicMock() + mock_add = MagicMock() + mock_add.transact.return_value = "tx_hash" + mock_contract.functions.addTrustedHandlers = MagicMock(return_value=mock_add) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) escrow_address = "0x1234567890123456789012345678901234567890" handlers = [ "0x1234567890123456789012345678901234567891", @@ -1834,80 +1636,52 @@ def test_add_trusted_handlers_with_tx_options(self): ] tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - self.escrow.add_trusted_handlers(escrow_address, handlers, tx_options) - - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.addTrustedHandlers.assert_called_once_with(handlers) - mock_function.assert_called_once_with( - self.w3, - "Add Trusted Handlers", - mock_contract.functions.addTrustedHandlers.return_value, - EscrowClientError, - tx_options, - ) + self.escrow.add_trusted_handlers(escrow_address, handlers, tx_options) + + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.addTrustedHandlers.assert_called_once_with(handlers) + mock_add.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_withdraw(self): + escrow_address = "0x1234567890123456789012345678901234567890" + token_address = "0x1234567890123456789012345678901234567891" + amount_withdrawn = 123 + + # Mock contract and withdraw function mock_contract = MagicMock() - mock_contract.functions.withdraw = MagicMock() + mock_withdraw = MagicMock() + mock_withdraw.transact.return_value = "tx_hash" + mock_contract.functions.withdraw = MagicMock(return_value=mock_withdraw) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) - escrow_address = "0xa76507AbFE3B67cB25F16DbC75a883D4190B7e46" - token_address = "0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - tx_hash = bytes.fromhex( - "01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529" - ) - amount_withdrawn = 187744067287473730 - mock_function.return_value = { - "transactionHash": tx_hash, - "logs": [ - { - "logIndex": 0, - "transactionIndex": 0, - "transactionHash": tx_hash, - "blockHash": bytes.fromhex( - "92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a" - ), - "blockNumber": 5, - "address": token_address, - "data": bytes.fromhex( - "000000000000000000000000000000000000000000000000029b003c075b5e42" - ), - "topics": [ - bytes.fromhex( - "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" - ), - bytes.fromhex( - "000000000000000000000000a76507abfe3b67cb25f16dbc75a883d4190b7e46" - ), - bytes.fromhex( - "0000000000000000000000005607acf0828e238099aa1784541a5abd7f975c76" - ), - ], - } - ], - } + # Mock token contract and Transfer event + token_contract = MagicMock() + token_contract.events.Transfer().process_log.return_value = { + "event": "Transfer", + "args": {"from": escrow_address, "value": amount_withdrawn}, + } + self.escrow.w3.eth.contract = MagicMock(return_value=token_contract) - escrow_withdraw_data = self.escrow.withdraw(escrow_address, token_address) + # Mock receipt with logs + receipt = {"transactionHash": b"tx_hash", "logs": [{"address": token_address}]} + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value=receipt + ) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.withdraw.assert_called_once_with(token_address) - mock_function.assert_called_once_with( - self.w3, - "Withdraw", - mock_contract.functions.withdraw.return_value, - EscrowClientError, - None, - ) + result = self.escrow.withdraw(escrow_address, token_address) - self.assertEqual(escrow_withdraw_data.txHash, tx_hash.hex()) - self.assertEqual(escrow_withdraw_data.tokenAddress, token_address) - self.assertEqual(escrow_withdraw_data.amountWithdrawn, amount_withdrawn) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.withdraw.assert_called_once_with(token_address) + mock_withdraw.transact.assert_called_once_with({}) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + self.assertEqual(result.amountWithdrawn, amount_withdrawn) + self.assertEqual(result.tokenAddress, token_address) + self.assertEqual(result.txHash, receipt["transactionHash"].hex()) def test_withdraw_invalid_escrow_address(self): escrow_address = "invalid_address" @@ -1936,7 +1710,7 @@ def test_withdraw_without_account(self): escrow_address = "0x1234567890123456789012345678901234567890" token_address = "0x1234567890123456789012345678901234567890" - with self.assertRaises(EscrowClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: escrowClient.withdraw(escrow_address, token_address) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) @@ -1953,7 +1727,7 @@ def test_withdraw_invalid_status(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.withdraw(escrow_address, token_address) self.assertEqual( - "Withdraw transaction failed: Escrow in Paid status state", + "Transaction failed: Escrow in Paid status state", str(cm.exception), ) @@ -1970,84 +1744,48 @@ def test_withdraw_invalid_caller(self): with self.assertRaises(EscrowClientError) as cm: self.escrow.withdraw(escrow_address, token_address) self.assertEqual( - "Withdraw transaction failed: Address calling not trusted", + "Transaction failed: Address calling not trusted", str(cm.exception), ) - def test_withdraw_invalid_escrow(self): - self.escrow.factory_contract.functions.hasEscrow = MagicMock(return_value=False) + def test_withdraw_with_tx_options(self): escrow_address = "0x1234567890123456789012345678901234567890" - token_address = "0x1234567890123456789012345678901234567890" - - with self.assertRaises(EscrowClientError) as cm: - self.escrow.withdraw(escrow_address, token_address) - self.assertEqual( - "Escrow address is not provided by the factory", str(cm.exception) - ) + token_address = "0x1234567890123456789012345678901234567891" + amount_withdrawn = 123 + tx_options = {"gas": 50000} - def test_withdraw_with_tx_options(self): + # Mock contract and withdraw function mock_contract = MagicMock() - mock_contract.functions.withdraw = MagicMock() + mock_withdraw = MagicMock() + mock_withdraw.transact.return_value = "tx_hash" + mock_contract.functions.withdraw = MagicMock(return_value=mock_withdraw) self.escrow._get_escrow_contract = MagicMock(return_value=mock_contract) - tx_options = {"gas": 50000} - escrow_address = "0xa76507AbFE3B67cB25F16DbC75a883D4190B7e46" - token_address = "0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" + # Mock token contract and Transfer event + token_contract = MagicMock() + token_contract.events.Transfer().process_log.return_value = { + "event": "Transfer", + "args": {"from": escrow_address, "value": amount_withdrawn}, + } + self.escrow.w3.eth.contract = MagicMock(return_value=token_contract) - with patch( - "human_protocol_sdk.escrow.escrow_client.handle_transaction" - ) as mock_function: - tx_hash = bytes.fromhex( - "01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529" - ) - amount_withdrawn = 187744067287473730 - mock_function.return_value = { - "transactionHash": tx_hash, - "logs": [ - { - "logIndex": 0, - "transactionIndex": 0, - "transactionHash": tx_hash, - "blockHash": bytes.fromhex( - "92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a" - ), - "blockNumber": 5, - "address": token_address, - "data": bytes.fromhex( - "000000000000000000000000000000000000000000000000029b003c075b5e42" - ), - "topics": [ - bytes.fromhex( - "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" - ), - bytes.fromhex( - "000000000000000000000000a76507abfe3b67cb25f16dbc75a883d4190b7e46" - ), - bytes.fromhex( - "0000000000000000000000005607acf0828e238099aa1784541a5abd7f975c76" - ), - ], - } - ], - } + # Mock receipt with logs + receipt = {"transactionHash": b"tx_hash", "logs": [{"address": token_address}]} + self.escrow.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value=receipt + ) - escrow_withdraw_data = self.escrow.withdraw( - escrow_address, token_address, tx_options - ) + result = self.escrow.withdraw(escrow_address, token_address, tx_options) - self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) - mock_contract.functions.withdraw.assert_called_once_with(token_address) - mock_function.assert_called_once_with( - self.w3, - "Withdraw", - mock_contract.functions.withdraw.return_value, - EscrowClientError, - tx_options, - ) - - self.assertEqual(escrow_withdraw_data.txHash, tx_hash.hex()) - self.assertEqual(escrow_withdraw_data.tokenAddress, token_address) - self.assertEqual(escrow_withdraw_data.amountWithdrawn, amount_withdrawn) + self.escrow._get_escrow_contract.assert_called_once_with(escrow_address) + mock_contract.functions.withdraw.assert_called_once_with(token_address) + mock_withdraw.transact.assert_called_once_with(tx_options) + self.escrow.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + self.assertEqual(result.amountWithdrawn, amount_withdrawn) + self.assertEqual(result.tokenAddress, token_address) + self.assertEqual(result.txHash, receipt["transactionHash"].hex()) def test_get_balance(self): mock_contract = MagicMock() diff --git a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/kvstore/test_kvstore_client.py b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/kvstore/test_kvstore_client.py index f5bd6c1562..05966ffa1f 100644 --- a/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/kvstore/test_kvstore_client.py +++ b/packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/kvstore/test_kvstore_client.py @@ -1,11 +1,11 @@ import unittest -from human_protocol_sdk.constants import NETWORKS from test.human_protocol_sdk.utils import DEFAULT_GAS_PAYER_PRIV from unittest.mock import MagicMock, PropertyMock, patch from human_protocol_sdk.kvstore import KVStoreClient, KVStoreClientError -from human_protocol_sdk.constants import ChainId +from human_protocol_sdk.constants import ChainId, NETWORKS +from human_protocol_sdk.decorators import RequiresSignerError from web3 import Web3 from web3.providers.rpc import HTTPProvider from web3.middleware import SignAndSendRawMiddlewareBuilder @@ -66,24 +66,22 @@ def test_init_with_invalid_web3(self): self.assertEqual(f"Invalid Web3 Instance", str(cm.exception)) def test_set(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.set = mock_function + mock_set = MagicMock() + mock_set.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.set = MagicMock(return_value=mock_set) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) key = "key" value = "value" - with patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction: - self.kvstore.set(key, value) + self.kvstore.set(key, value) - mock_function.assert_called_once_with(key, value) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set", - mock_function.return_value, - KVStoreClientError, - None, - ) + self.kvstore.kvstore_contract.functions.set.assert_called_once_with(key, value) + mock_set.transact.assert_called_once_with({}) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_set_empty_key(self): key = "" @@ -102,50 +100,50 @@ def test_set_without_account(self): key = "key" value = "value" - with self.assertRaises(KVStoreClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: kvstore.set(key, value) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) def test_set_with_tx_options(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.set = mock_function + mock_set = MagicMock() + mock_set.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.set = MagicMock(return_value=mock_set) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) key = "key" value = "value" tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction: - self.kvstore.set(key, value, tx_options) - - mock_function.assert_called_once_with(key, value) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set", - mock_function.return_value, - KVStoreClientError, - tx_options, - ) + self.kvstore.set(key, value, tx_options) + + self.kvstore.kvstore_contract.functions.set.assert_called_once_with(key, value) + mock_set.transact.assert_called_once_with(tx_options) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_set_bulk(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.setBulk = mock_function + mock_set_bulk = MagicMock() + mock_set_bulk.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.setBulk = MagicMock( + return_value=mock_set_bulk + ) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) keys = ["key1", "key2", "key3"] values = ["value1", "value2", "value3"] - with patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction: - self.kvstore.set_bulk(keys, values) + self.kvstore.set_bulk(keys, values) - mock_function.assert_called_once_with(keys, values) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set Bulk", - mock_function.return_value, - KVStoreClientError, - None, - ) + self.kvstore.kvstore_contract.functions.setBulk.assert_called_once_with( + keys, values + ) + mock_set_bulk.transact.assert_called_once_with({}) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_set_bulk_empty_key(self): keys = ["key1", "", "key3"] @@ -178,92 +176,87 @@ def test_set_bulk_without_account(self): keys = ["key1", "key2", "key3"] values = ["value1", "", "value3"] - with self.assertRaises(KVStoreClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: kvstore.set_bulk(keys, values) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) def test_set_bulk_with_tx_options(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.setBulk = mock_function + mock_set_bulk = MagicMock() + mock_set_bulk.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.setBulk = MagicMock( + return_value=mock_set_bulk + ) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) keys = ["key1", "key2", "key3"] values = ["value1", "value2", "value3"] tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction: - self.kvstore.set_bulk(keys, values, tx_options) - - mock_function.assert_called_once_with(keys, values) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set Bulk", - mock_function.return_value, - KVStoreClientError, - tx_options, - ) + self.kvstore.set_bulk(keys, values, tx_options) - def test_set_file_url_and_hash(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.setBulk = mock_function + self.kvstore.kvstore_contract.functions.setBulk.assert_called_once_with( + keys, values + ) + mock_set_bulk.transact.assert_called_once_with(tx_options) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) + def test_set_file_url_and_hash(self): url = "https://example.com" content = "example" content_hash = self.w3.keccak(text=content).hex() - with ( - patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction, - patch("requests.get") as mock_get, - ): + mock_set_bulk = MagicMock() + mock_set_bulk.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.setBulk = MagicMock( + return_value=mock_set_bulk + ) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + with patch("requests.get") as mock_get: mock_response = mock_get.return_value mock_response.text = content self.kvstore.set_file_url_and_hash(url) - mock_function.assert_called_once_with( + self.kvstore.kvstore_contract.functions.setBulk.assert_called_once_with( ["url", "url_hash"], [url, content_hash] ) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set Bulk", - mock_function.return_value, - KVStoreClientError, - None, + mock_set_bulk.transact.assert_called_once_with({}) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" ) def test_set_file_url_and_hash_with_key(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.setBulk = mock_function - url = "https://example.com" content = "example" content_hash = self.w3.keccak(text=content).hex() - with ( - patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction, - patch("requests.get") as mock_get, - ): + mock_set_bulk = MagicMock() + mock_set_bulk.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.setBulk = MagicMock( + return_value=mock_set_bulk + ) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + with patch("requests.get") as mock_get: mock_response = mock_get.return_value mock_response.text = content self.kvstore.set_file_url_and_hash(url, "linkedin_url") - mock_function.assert_called_once_with( + self.kvstore.kvstore_contract.functions.setBulk.assert_called_once_with( ["linkedin_url", "linkedin_url_hash"], [url, content_hash] ) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set Bulk", - mock_function.return_value, - KVStoreClientError, - None, - ) + mock_set_bulk.transact.assert_called_once_with({}) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with def test_set_file_url_and_hash_invalid_url(self): invalid_url = "example.com" @@ -280,40 +273,37 @@ def test_set_file_url_and_hash_without_account(self): kvstore = KVStoreClient(w3) url = "https://example.com" - with self.assertRaises(KVStoreClientError) as cm: + with self.assertRaises(RequiresSignerError) as cm: kvstore.set_file_url_and_hash(url) self.assertEqual("You must add an account to Web3 instance", str(cm.exception)) def test_set_file_url_and_hash_with_tx_options(self): - mock_function = MagicMock() - self.kvstore.kvstore_contract.functions.setBulk = mock_function - url = "https://example.com" content = "example" content_hash = self.w3.keccak(text=content).hex() tx_options = {"gas": 50000} - with ( - patch( - "human_protocol_sdk.kvstore.kvstore_client.handle_transaction" - ) as mock_handle_transaction, - patch("requests.get") as mock_get, - ): + mock_set_bulk = MagicMock() + mock_set_bulk.transact.return_value = "tx_hash" + self.kvstore.kvstore_contract.functions.setBulk = MagicMock( + return_value=mock_set_bulk + ) + self.kvstore.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + with patch("requests.get") as mock_get: mock_response = mock_get.return_value mock_response.text = content self.kvstore.set_file_url_and_hash(url, tx_options=tx_options) - mock_function.assert_called_once_with( + self.kvstore.kvstore_contract.functions.setBulk.assert_called_once_with( ["url", "url_hash"], [url, content_hash] ) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Set Bulk", - mock_function.return_value, - KVStoreClientError, - tx_options, + mock_set_bulk.transact.assert_called_once_with(tx_options) + self.kvstore.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" ) 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 a1ad3cfa0a..5302dddd79 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 @@ -74,24 +74,24 @@ def test_init_with_invalid_web3(self): self.assertEqual(f"Invalid Web3 Instance", str(cm.exception)) def test_approve_stake(self): - mock_function = MagicMock() - self.staking_client.hmtoken_contract.functions.approve = mock_function - - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.approve_stake(100) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Approve stake", - mock_function.return_value, - StakingClientError, - None, - ) - mock_function.assert_called_once_with( - NETWORKS[ChainId.LOCALHOST]["staking_address"], 100 - ) + mock_approve = MagicMock() + mock_approve.transact.return_value = "tx_hash" + self.staking_client.hmtoken_contract.functions.approve = MagicMock( + return_value=mock_approve + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + self.staking_client.approve_stake(100) + + self.staking_client.hmtoken_contract.functions.approve.assert_called_once_with( + NETWORKS[ChainId.LOCALHOST]["staking_address"], 100 + ) + mock_approve.transact.assert_called_once_with({}) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_approve_stake_invalid_amount(self): with self.assertRaises(StakingClientError) as cm: @@ -99,43 +99,45 @@ def test_approve_stake_invalid_amount(self): self.assertEqual("Amount to approve must be greater than 0", str(cm.exception)) def test_approve_stake_with_tx_options(self): - mock_function = MagicMock() - self.staking_client.hmtoken_contract.functions.approve = mock_function + mock_approve = MagicMock() + mock_approve.transact.return_value = "tx_hash" + self.staking_client.hmtoken_contract.functions.approve = MagicMock( + return_value=mock_approve + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.approve_stake(100, tx_options) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Approve stake", - mock_function.return_value, - StakingClientError, - tx_options, - ) - mock_function.assert_called_once_with( - NETWORKS[ChainId.LOCALHOST]["staking_address"], 100 - ) + self.staking_client.approve_stake(100, tx_options) + + self.staking_client.hmtoken_contract.functions.approve.assert_called_once_with( + NETWORKS[ChainId.LOCALHOST]["staking_address"], 100 + ) + mock_approve.transact.assert_called_once_with(tx_options) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_stake(self): - mock_function = MagicMock() - self.staking_client.staking_contract.functions.stake = mock_function - - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.stake(100) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Stake HMT", - mock_function.return_value, - StakingClientError, - None, - ) - mock_function.assert_called_once_with(100) + mock_stake = MagicMock() + mock_stake.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.stake = MagicMock( + return_value=mock_stake + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + self.staking_client.stake(100) + + self.staking_client.staking_contract.functions.stake.assert_called_once_with( + 100 + ) + mock_stake.transact.assert_called_once_with({}) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_stake_invalid_amount(self): with self.assertRaises(StakingClientError) as cm: @@ -143,41 +145,45 @@ def test_stake_invalid_amount(self): self.assertEqual("Amount to stake must be greater than 0", str(cm.exception)) def test_stake_with_tx_options(self): - mock_function = MagicMock() - self.staking_client.staking_contract.functions.stake = mock_function + mock_stake = MagicMock() + mock_stake.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.stake = MagicMock( + return_value=mock_stake + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.stake(100, tx_options) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Stake HMT", - mock_function.return_value, - StakingClientError, - tx_options, - ) - mock_function.assert_called_once_with(100) + self.staking_client.stake(100, tx_options) + + self.staking_client.staking_contract.functions.stake.assert_called_once_with( + 100 + ) + mock_stake.transact.assert_called_once_with(tx_options) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_unstake(self): - mock_function = MagicMock() - self.staking_client.staking_contract.functions.unstake = mock_function - - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.unstake(100) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Unstake HMT", - mock_function.return_value, - StakingClientError, - None, - ) - mock_function.assert_called_once_with(100) + mock_unstake = MagicMock() + mock_unstake.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.unstake = MagicMock( + return_value=mock_unstake + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + self.staking_client.unstake(100) + + self.staking_client.staking_contract.functions.unstake.assert_called_once_with( + 100 + ) + mock_unstake.transact.assert_called_once_with({}) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_unstake_invalid_amount(self): with self.assertRaises(StakingClientError) as cm: @@ -185,60 +191,62 @@ def test_unstake_invalid_amount(self): self.assertEqual("Amount to unstake must be greater than 0", str(cm.exception)) def test_unstake_with_tx_options(self): - mock_function = MagicMock() - self.staking_client.staking_contract.functions.unstake = mock_function + mock_unstake = MagicMock() + mock_unstake.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.unstake = MagicMock( + return_value=mock_unstake + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.unstake(100, tx_options) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Unstake HMT", - mock_function.return_value, - StakingClientError, - tx_options, - ) - mock_function.assert_called_once_with(100) + self.staking_client.unstake(100, tx_options) + + self.staking_client.staking_contract.functions.unstake.assert_called_once_with( + 100 + ) + mock_unstake.transact.assert_called_once_with(tx_options) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_withdraw(self): - mock_function = MagicMock() - self.staking_client.staking_contract.functions.withdraw = mock_function - - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.withdraw() - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Withdraw HMT", - mock_function.return_value, - StakingClientError, - None, - ) - mock_function.assert_called_once() + mock_withdraw = MagicMock() + mock_withdraw.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.withdraw = MagicMock( + return_value=mock_withdraw + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) + + self.staking_client.withdraw() + + self.staking_client.staking_contract.functions.withdraw.assert_called_once_with() + mock_withdraw.transact.assert_called_once_with({}) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_withdraw_with_tx_options(self): - mock_function = MagicMock() - self.staking_client.staking_contract.functions.withdraw = mock_function + mock_withdraw = MagicMock() + mock_withdraw.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.withdraw = MagicMock( + return_value=mock_withdraw + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.withdraw(tx_options) - - mock_handle_transaction.assert_called_once_with( - self.w3, - "Withdraw HMT", - mock_function.return_value, - StakingClientError, - tx_options, - ) - mock_function.assert_called_once() + self.staking_client.withdraw(tx_options) + + self.staking_client.staking_contract.functions.withdraw.assert_called_once_with() + mock_withdraw.transact.assert_called_once_with(tx_options) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_slash(self): slasher = "SLASHER" @@ -246,27 +254,29 @@ def test_slash(self): escrow_address = "escrow1" self.staking_client._is_valid_escrow = MagicMock(return_value=True) - mock_function = MagicMock() - self.staking_client.staking_contract.functions.slash = mock_function + mock_slash = MagicMock() + mock_slash.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.slash = MagicMock( + return_value=mock_slash + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.slash( - slasher=slasher, - staker=staker, - escrow_address=escrow_address, - amount=50, - ) + self.staking_client.slash( + slasher=slasher, + staker=staker, + escrow_address=escrow_address, + amount=50, + ) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Slash HMT", - mock_function.return_value, - StakingClientError, - None, - ) - mock_function.assert_called_once_with(slasher, staker, escrow_address, 50) + self.staking_client.staking_contract.functions.slash.assert_called_once_with( + slasher, staker, escrow_address, 50 + ) + mock_slash.transact.assert_called_once_with({}) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_slash_invalid_amount(self): slasher = "SLASHER" @@ -298,29 +308,31 @@ def test_slash_with_tx_options(self): escrow_address = "escrow1" self.staking_client._is_valid_escrow = MagicMock(return_value=True) - mock_function = MagicMock() - self.staking_client.staking_contract.functions.slash = mock_function + mock_slash = MagicMock() + mock_slash.transact.return_value = "tx_hash" + self.staking_client.staking_contract.functions.slash = MagicMock( + return_value=mock_slash + ) + self.staking_client.w3.eth.wait_for_transaction_receipt = MagicMock( + return_value={"logs": []} + ) tx_options = {"gas": 50000} - with patch( - "human_protocol_sdk.staking.staking_client.handle_transaction" - ) as mock_handle_transaction: - self.staking_client.slash( - slasher=slasher, - staker=staker, - escrow_address=escrow_address, - amount=50, - tx_options=tx_options, - ) + self.staking_client.slash( + slasher=slasher, + staker=staker, + escrow_address=escrow_address, + amount=50, + tx_options=tx_options, + ) - mock_handle_transaction.assert_called_once_with( - self.w3, - "Slash HMT", - mock_function.return_value, - StakingClientError, - tx_options, - ) - mock_function.assert_called_once_with(slasher, staker, escrow_address, 50) + self.staking_client.staking_contract.functions.slash.assert_called_once_with( + slasher, staker, escrow_address, 50 + ) + mock_slash.transact.assert_called_once_with(tx_options) + self.staking_client.w3.eth.wait_for_transaction_receipt.assert_called_once_with( + "tx_hash" + ) def test_get_staker_info(self): staker_address = "0x1234567890123456789012345678901234567890" From 04e1aff8e35427fd2dde2e938d18fffe896f0c9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:55:19 +0200 Subject: [PATCH 19/21] chore(deps): bump actions/dependency-review-action from 4.7.0 to 4.7.1 (#3355) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci-dependency-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-dependency-review.yaml b/.github/workflows/ci-dependency-review.yaml index 11f1509fae..79a3c2feeb 100644 --- a/.github/workflows/ci-dependency-review.yaml +++ b/.github/workflows/ci-dependency-review.yaml @@ -14,6 +14,6 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - name: Dependency Review - uses: actions/dependency-review-action@v4.7.0 + uses: actions/dependency-review-action@v4.7.1 with: show-openssf-scorecard: false From 9dd69572796407e59a03802f8aa56e5944d1c099 Mon Sep 17 00:00:00 2001 From: Dmitry Nechay Date: Mon, 23 Jun 2025 17:16:46 +0300 Subject: [PATCH 20/21] feat: full support for Audino (#3408) --- .../worker/services/oracles.service.ts | 18 ++--------- .../src/common/utils/jwt-token.model.ts | 2 +- .../h-captcha/spec/h-captcha.fixtures.ts | 1 + .../model/oracle-discovery.model.ts | 10 +++---- .../oracle-discovery.controller.ts | 30 +++++++++++++++++-- .../oracle-discovery.service.ts | 3 +- .../spec/oracle-discovery.controller.spec.ts | 10 +++++-- .../spec/oracle-discovery.fixture.ts | 4 +++ .../src/components/Jobs/Create/CreateJob.tsx | 2 +- .../server/src/common/types/manifest.ts | 1 - .../server/src/modules/abuse/abuse.service.ts | 2 +- .../audino-payouts-calculator.ts | 19 +++++------- .../cvat-payouts-calculator.ts | 2 +- .../fortune-payouts-calculator.ts | 2 +- 14 files changed, 62 insertions(+), 44 deletions(-) diff --git a/packages/apps/human-app/frontend/src/modules/worker/services/oracles.service.ts b/packages/apps/human-app/frontend/src/modules/worker/services/oracles.service.ts index bbc7632a36..807a76950e 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/services/oracles.service.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/services/oracles.service.ts @@ -11,6 +11,7 @@ const OracleSchema = z.object({ address: z.string(), chainId: z.number(), role: z.string(), + name: z.string(), url: z.string(), jobTypes: z.array(z.string()), registrationNeeded: z.boolean().optional().nullable(), @@ -23,21 +24,6 @@ export type Oracle = OracleBase & { name: string; }; -const OracleNameToUrls = { - CVAT: [ - 'https://stg-exchange-oracle.humanprotocol.org', - 'https://exchange-oracle.humanprotocol.org', - ], - Fortune: ['https://stg-fortune-exchange-oracle-server.humanprotocol.org'], -} as const; - -const oracleUrlToNameMap = new Map(); -for (const [oracleName, oracleUrls] of Object.entries(OracleNameToUrls)) { - for (const oracleUrl of oracleUrls) { - oracleUrlToNameMap.set(oracleUrl, oracleName); - } -} - const isTestnet = env.VITE_NETWORK === 'testnet'; const H_CAPTCHA_ORACLE: Oracle = { @@ -80,7 +66,7 @@ async function getOracles(selectedJobTypes: string[]) { oracles = oracles.concat( results.map((oracle: OracleBase) => ({ ...oracle, - name: oracleUrlToNameMap.get(oracle.url) ?? '', + name: oracle.name ? oracle.name.split(' ')[0] : '', })) ); } diff --git a/packages/apps/human-app/server/src/common/utils/jwt-token.model.ts b/packages/apps/human-app/server/src/common/utils/jwt-token.model.ts index c330d54fd6..bad884b4b6 100644 --- a/packages/apps/human-app/server/src/common/utils/jwt-token.model.ts +++ b/packages/apps/human-app/server/src/common/utils/jwt-token.model.ts @@ -12,7 +12,7 @@ export class JwtUserData { @AutoMap() reputation_network: string; @AutoMap() - qualifications?: string[]; + qualifications: string[]; @AutoMap() site_key: string; @AutoMap() diff --git a/packages/apps/human-app/server/src/modules/h-captcha/spec/h-captcha.fixtures.ts b/packages/apps/human-app/server/src/modules/h-captcha/spec/h-captcha.fixtures.ts index 5476814b38..5696a6d2cd 100644 --- a/packages/apps/human-app/server/src/modules/h-captcha/spec/h-captcha.fixtures.ts +++ b/packages/apps/human-app/server/src/modules/h-captcha/spec/h-captcha.fixtures.ts @@ -74,6 +74,7 @@ export const jwtUserDataFixture: JwtUserData = { wallet_address: POLYGON_WALLET_ADDR, email: EMAIL, kyc_status: 'approved', + qualifications: [], site_key: H_CAPTCHA_SITE_KEY, reputation_network: REPUTATION_NETWORK, iat: IAT, diff --git a/packages/apps/human-app/server/src/modules/oracle-discovery/model/oracle-discovery.model.ts b/packages/apps/human-app/server/src/modules/oracle-discovery/model/oracle-discovery.model.ts index a306dc0b3c..e7269b49f0 100644 --- a/packages/apps/human-app/server/src/modules/oracle-discovery/model/oracle-discovery.model.ts +++ b/packages/apps/human-app/server/src/modules/oracle-discovery/model/oracle-discovery.model.ts @@ -72,11 +72,11 @@ export class DiscoveredOracle implements IOperator { @ApiPropertyOptional({ description: 'Website of the operator' }) website?: string; - @ApiPropertyOptional({ description: 'URL of the oracle operator' }) + @ApiProperty({ description: 'URL of the oracle operator' }) url: string; - @ApiPropertyOptional({ description: 'Role of the oracle operator' }) - role?: string; + @ApiProperty({ description: 'Role of the oracle operator' }) + role: string; @ApiPropertyOptional({ type: [String], @@ -98,8 +98,8 @@ export class DiscoveredOracle implements IOperator { }) reputationNetworks?: string[]; - @ApiPropertyOptional({ description: 'Name of the operator' }) - name?: string; + @ApiProperty({ description: 'Name of the operator' }) + name: string; @ApiPropertyOptional({ description: 'Category of the operator' }) category?: string; diff --git a/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.controller.ts b/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.controller.ts index 9e442a620d..2e315ad0b1 100644 --- a/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.controller.ts +++ b/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.controller.ts @@ -7,7 +7,12 @@ import { UsePipes, ValidationPipe, } from '@nestjs/common'; -import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger'; +import { + ApiBearerAuth, + ApiOkResponse, + ApiOperation, + ApiTags, +} from '@nestjs/swagger'; import { OracleDiscoveryService } from './oracle-discovery.service'; import { GetOraclesCommand, @@ -17,6 +22,8 @@ import { import { InjectMapper } from '@automapper/nestjs'; import { Mapper } from '@automapper/core'; import { EnvironmentConfigService } from '../../common/config/environment-config.service'; +import { JwtPayload } from '../../common/config/params-decorators'; +import { JwtUserData } from '../../common/utils/jwt-token.model'; @Controller() export class OracleDiscoveryController { @@ -25,7 +32,9 @@ export class OracleDiscoveryController { private readonly environmentConfigService: EnvironmentConfigService, @InjectMapper() private readonly mapper: Mapper, ) {} + @ApiTags('Oracle-Discovery') + @ApiBearerAuth() @Get('/oracles') @ApiOperation({ summary: 'Oracles discovery' }) @ApiOkResponse({ @@ -34,6 +43,7 @@ export class OracleDiscoveryController { }) @UsePipes(new ValidationPipe()) public async getOracles( + @JwtPayload() jwtPayload: JwtUserData, @Query() query: GetOraclesQuery, ): Promise { if (!this.environmentConfigService.jobsDiscoveryFlag) { @@ -43,6 +53,22 @@ export class OracleDiscoveryController { ); } const command = this.mapper.map(query, GetOraclesQuery, GetOraclesCommand); - return await this.oracleDiscoveryService.getOracles(command); + const oracles = await this.oracleDiscoveryService.getOracles(command); + + const isAudinoAvailableForUser = + jwtPayload.qualifications.includes('audino'); + + /** + * TODO: remove filtering logic when Audino available for everyone + */ + return oracles.filter((oracle) => { + const isAudinoOracle = oracle.jobTypes.includes('audio_transcription'); + + if (isAudinoOracle) { + return isAudinoAvailableForUser; + } else { + return true; + } + }); } } diff --git a/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.service.ts b/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.service.ts index 3508b1ceea..898acc2612 100644 --- a/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.service.ts +++ b/packages/apps/human-app/server/src/modules/oracle-discovery/oracle-discovery.service.ts @@ -90,6 +90,7 @@ export class OracleDiscoveryService { new DiscoveredOracle({ id: exchangeOracle.id, address: exchangeOracle.address, + name: exchangeOracle.name, role: exchangeOracle.role, url: exchangeOracle.url, jobTypes: exchangeOracle.jobTypes, @@ -128,7 +129,7 @@ export class OracleDiscoveryService { operator: IOperator, possibleJobTypes: string[], ): operator is DiscoveredOracle { - if (!operator.url) { + if (!operator.url || !operator.name || !operator.role) { return false; } diff --git a/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.controller.spec.ts b/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.controller.spec.ts index 58df22e460..973ad32b76 100644 --- a/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.controller.spec.ts +++ b/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.controller.spec.ts @@ -63,8 +63,10 @@ describe('OracleDiscoveryController', () => { const dtoFixture = { selected_job_types: ['job-type-1', 'job-type-2'], } as GetOraclesQuery; - const result: DiscoveredOracle[] = - await controller.getOracles(dtoFixture); + const result: DiscoveredOracle[] = await controller.getOracles( + { qualifications: [] } as any, + dtoFixture, + ); const expectedResponse = generateOracleDiscoveryResponseBody(); expect(serviceMock.getOracles).toHaveBeenCalled(); expect(result).toEqual(expectedResponse); @@ -77,7 +79,9 @@ describe('OracleDiscoveryController', () => { (configServiceMock as any).jobsDiscoveryFlag = false; - await expect(controller.getOracles(dtoFixture)).rejects.toThrow( + await expect( + controller.getOracles({ qualifications: [] } as any, dtoFixture), + ).rejects.toThrow( new HttpException( 'Oracles discovery is disabled', HttpStatus.FORBIDDEN, diff --git a/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.fixture.ts b/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.fixture.ts index 3a621629a3..61aa375ee6 100644 --- a/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.fixture.ts +++ b/packages/apps/human-app/server/src/modules/oracle-discovery/spec/oracle-discovery.fixture.ts @@ -9,6 +9,7 @@ export const response1: DiscoveredOracle = { address: '0xd06eac24a0c47c776Ce6826A93162c4AfC029047', chainId: ChainId.POLYGON_AMOY, role: 'role1', + name: 'oracle1', url: 'common-url', jobTypes: ['job-type-3'], retriesCount: 0, @@ -29,6 +30,7 @@ export const response2: DiscoveredOracle = { address: '0xd10c3402155c058D78e4D5fB5f50E125F06eb39d', chainId: ChainId.POLYGON_AMOY, role: 'role2', + name: 'oracle2', url: '', jobTypes: ['job-type-1', 'job-type-3', 'job-type-4'], retriesCount: 0, @@ -49,6 +51,7 @@ export const response3: DiscoveredOracle = { address: '0xd83422155c058D78e4D5fB5f50E125F06eb39d', chainId: ChainId.POLYGON_AMOY, role: 'role3', + name: 'oracle3', url: 'common-url', jobTypes: ['job-type-2'], retriesCount: 0, @@ -69,6 +72,7 @@ export const response4: DiscoveredOracle = { address: '0xd83422155c058D78e4D5fB5f50E125F06eb39d', chainId: ChainId.BSC_TESTNET, role: 'role3', + name: 'oracle4', url: 'common-url', jobTypes: ['job-type-1', 'job-type-3', 'job-type-4'], retriesCount: 0, diff --git a/packages/apps/job-launcher/client/src/components/Jobs/Create/CreateJob.tsx b/packages/apps/job-launcher/client/src/components/Jobs/Create/CreateJob.tsx index a019830c0b..9907c08ee1 100644 --- a/packages/apps/job-launcher/client/src/components/Jobs/Create/CreateJob.tsx +++ b/packages/apps/job-launcher/client/src/components/Jobs/Create/CreateJob.tsx @@ -69,7 +69,7 @@ export const CreateJob = () => { {/* {!IS_MAINNET && ( hCaptcha )} */} - {!IS_MAINNET && Audino} + Audino { @@ -40,24 +38,23 @@ export class AudinoPayoutsCalculator implements EscrowPayoutsCalculator { const annotations = await this.storageService.downloadJsonLikeData( - `${intermediateResultsUrl}/${AUDINO_RESULTS_ANNOTATIONS_FILENAME}`, + `${intermediateResultsUrl}/${AUDINO_VALIDATION_META_FILENAME}`, ); if (annotations.jobs.length === 0 || annotations.results.length === 0) { throw new Error('Invalid annotation meta'); } - const jobBountyValue = ethers.parseUnits(manifest.job_bounty, 18); - const workersBounties = new Map(); + const escrowData = await EscrowUtils.getEscrow(chainId, escrowAddress); + const jobBountyValue = + BigInt(escrowData.totalFundedAmount) / BigInt(annotations.jobs.length); + const workersBounties = new Map(); for (const job of annotations.jobs) { const jobFinalResult = annotations.results.find( (result) => result.id === job.final_result_id, ); - if ( - jobFinalResult - // && jobFinalResult.annotation_quality >= manifest.validation.min_quality - ) { + if (jobFinalResult) { const workerAddress = jobFinalResult.annotator_wallet_address; const currentWorkerBounty = workersBounties.get(workerAddress) || 0n; diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/cvat-payouts-calculator.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/cvat-payouts-calculator.ts index 3131c5a147..87f3c1f36b 100644 --- a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/cvat-payouts-calculator.ts +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/cvat-payouts-calculator.ts @@ -48,7 +48,7 @@ export class CvatPayoutsCalculator implements EscrowPayoutsCalculator { } const jobBountyValue = ethers.parseUnits(manifest.job_bounty, 18); - const workersBounties = new Map(); + const workersBounties = new Map(); for (const job of annotations.jobs) { const jobFinalResult = annotations.results.find( diff --git a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/fortune-payouts-calculator.ts b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/fortune-payouts-calculator.ts index ffeb96261c..e94e823dab 100644 --- a/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/fortune-payouts-calculator.ts +++ b/packages/apps/reputation-oracle/server/src/modules/escrow-completion/payouts-calculation/fortune-payouts-calculator.ts @@ -35,7 +35,7 @@ export class FortunePayoutsCalculator implements EscrowPayoutsCalculator { .map((item) => item.workerAddress); const payoutAmount = - BigInt(ethers.parseUnits(manifest.fundAmount.toString(), 'ether')) / + ethers.parseUnits(manifest.fundAmount.toString(), 18) / BigInt(recipients.length); return recipients.map((recipient) => ({ From 9f869bd8399e2226b9241d4b5ca66cc3e9334afe Mon Sep 17 00:00:00 2001 From: KirillKirill Date: Tue, 24 Jun 2025 12:48:00 +0300 Subject: [PATCH 21/21] [Dashboard] - Refactor Project Structure (#3392) --- .husky/pre-commit | 1 + packages/apps/dashboard/client/.gitignore | 1 + packages/apps/dashboard/client/index.html | 2 +- packages/apps/dashboard/client/package.json | 10 +- .../{src/assets/styles => public}/favicon.ico | Bin .../apps/dashboard/client/public/vite.svg | 1 - packages/apps/dashboard/client/src/App.tsx | 24 --- .../dashboard/client/src/app/AppRoutes.tsx | 26 +++ .../dashboard/client/src/app/config/routes.ts | 6 + .../client/src/{main.tsx => app/index.tsx} | 9 +- .../src/{ => app}/providers/ThemeProvider.tsx | 2 +- .../src/{assets => app}/styles/_const.scss | 0 .../styles/_graph-swipper.scss | 0 .../{assets => app}/styles/_home-page.scss | 0 .../{assets => app}/styles/_page-wrapper.scss | 0 .../src/{assets => app}/styles/_search.scss | 0 .../{assets => app}/styles/_shadow-icon.scss | 0 .../src/{assets => app}/styles/main.scss | 0 .../apps/dashboard/client/src/assets/bing.png | Bin 1363 -> 0 bytes .../dashboard/client/src/assets/bitfinex.png | Bin 844 -> 0 bytes .../dashboard/client/src/assets/coinlist.png | Bin 783 -> 0 bytes .../dashboard/client/src/assets/ethereum.png | Bin 809 -> 0 bytes .../dashboard/client/src/assets/exchange.png | Bin 988 -> 0 bytes .../apps/dashboard/client/src/assets/gate.png | Bin 919 -> 0 bytes .../dashboard/client/src/assets/human.png | Bin 538 -> 0 bytes .../client/src/assets/icons/binance.svg | 33 ---- .../client/src/assets/icons/celo.svg | 11 -- .../client/src/assets/icons/discord.svg | 3 - .../client/src/assets/icons/ethereum.svg | 72 -------- .../src/assets/icons/exchange-oracle.svg | 4 - .../src/assets/icons/excluded/escrow.svg | 56 ------- .../src/assets/icons/excluded/wallet.svg | 51 ------ .../client/src/assets/icons/human-app.svg | 4 - .../client/src/assets/icons/job-launcher.svg | 4 - .../client/src/assets/icons/moonbeam.svg | 85 ---------- .../dashboard/client/src/assets/icons/okx.svg | 49 ------ .../client/src/assets/icons/polygon.svg | 32 ---- .../src/assets/icons/recording-oracle.svg | 9 - .../src/assets/icons/reputation-oracle.svg | 15 -- .../client/src/assets/icons/xlayer.svg | 68 -------- .../dashboard/client/src/assets/lbank.png | Bin 598 -> 0 bytes .../client/src/assets/logo-mobile.png | Bin 1758 -> 0 bytes .../apps/dashboard/client/src/assets/logo.png | Bin 2856 -> 0 bytes .../client/src/assets/probitGlobal.png | Bin 979 -> 0 bytes .../dashboard/client/src/assets/recording.png | Bin 631 -> 0 bytes .../client/src/assets/reputation.png | Bin 1006 -> 0 bytes .../src/components/Breadcrumbs/index.ts | 1 - .../components/Charts/CustomChartTooltip.tsx | 86 ---------- .../client/src/components/Charts/index.ts | 4 - .../client/src/components/Clipboard/index.ts | 1 - .../src/components/CustomTooltip/index.tsx | 1 - .../client/src/components/DataEntry/index.ts | 2 - .../client/src/components/Footer/index.ts | 1 - .../client/src/components/Header/index.ts | 1 - .../src/components/Home/FormatNumber.tsx | 33 ---- .../client/src/components/Home/index.ts | 2 - .../src/components/Icons/AvalancheIcon.tsx | 34 ---- .../client/src/components/Icons/CeloIcon.tsx | 31 ---- .../components/Icons/MoonbaseAlphaIcon.tsx | 72 -------- .../src/components/Icons/MoonbeamIcon.tsx | 16 -- .../src/components/Icons/XLayerIcon.tsx | 79 --------- .../src/components/NetworkIcon/index.tsx | 45 ----- .../src/components/NothingFound/index.ts | 1 - .../src/components/PageWrapper/index.ts | 1 - .../src/components/SearchResults/index.ts | 1 - .../client/src/components/ShadowIcon/index.ts | 1 - .../Leaderboard/components/AddressCell.tsx | 18 -- .../Leaderboard/components/ChainCell.tsx | 20 --- .../Leaderboard/components/EntityIcon.tsx | 22 --- .../src/features/graph/api/useChartData.ts | 113 +++++++++++++ .../client/src/features/graph/index.ts | 1 + .../graph/lib}/formatDate.ts | 4 +- .../graph/lib}/formatNumber.ts | 4 +- .../graph/model/hcaptchaDailyStatsSchema.ts | 18 ++ .../graph/model/hmtDailyStatsSchema.ts | 29 ++++ .../graph/store/useChartParamsStore.ts} | 4 +- .../graph/ui}/AreaChart.tsx | 59 ++++--- .../src/features/graph/ui/ChartTooltip.tsx | 85 ++++++++++ .../graph/ui}/CustomXAxisTick.tsx | 2 +- .../graph/ui}/GraphSwiper.tsx | 19 ++- .../Home => features/graph/ui}/SmallGraph.tsx | 73 +++++---- .../graph/ui}/ToggleButtons.tsx | 7 +- .../graph/ui}/ToggleCharts.tsx | 10 +- .../src/features/home/api/useGeneralStats.ts | 22 +++ .../home/api/useHcaptchaGeneralStats.ts | 25 +++ .../src/features/home/model/generalStats.ts | 8 + .../home/model/hcaptchaGeneralStats.ts | 9 + .../home/ui/HmtPrice.tsx} | 8 +- .../Home => features/home/ui}/Holders.tsx | 7 +- .../home/ui}/TotalNumberOfTasks.tsx | 7 +- .../home/ui}/TotalTransactions.tsx | 7 +- .../leaderboard/api/useLeaderboardDetails.ts | 28 ++++ .../client/src/features/leaderboard/index.ts | 1 + .../leaderboard/model/leaderboardSchema.ts | 48 ++++++ .../store/useLeaderboardFiltersStore.ts | 15 ++ .../features/leaderboard/ui/AddressCell.tsx | 22 +++ .../ui}/CategoryCell.tsx | 33 ++-- .../src/features/leaderboard/ui/ChainCell.tsx | 29 ++++ .../ui}/DataGridWrapper.tsx | 29 ++-- .../ui/Leaderboard.tsx} | 24 ++- .../ui}/RoleCell.tsx | 43 ++--- .../ui}/SelectNetwork.tsx | 20 +-- .../ui}/TextCell.tsx | 12 +- .../hooks => leaderboard/ui}/useDataGrid.tsx | 30 ++-- .../searchResults/api/useAddressDetails.ts | 29 ++++ .../searchResults/api/useEscrowDetails.ts | 79 +++++++++ .../searchResults/api/useKvStoreData.ts | 26 +++ .../api/useTransactionDetails.ts | 78 +++++++++ .../searchResults/hooks/usePagination.ts | 66 ++++++++ .../src/features/searchResults/index.ts | 1 + .../model/addressDetailsSchema.ts} | 34 +--- .../model/escrowDetailsSchema.ts | 21 +++ .../searchResults/model/kvStoreDataSchema.ts | 10 ++ .../model/transactionDetailsSchema.ts | 36 ++++ .../searchResults/ui}/Clipboard.tsx | 10 +- .../searchResults/ui}/EscrowAddress.tsx | 24 +-- .../searchResults/ui/HmtBalance.tsx} | 15 +- .../searchResults/ui/HmtPrice.tsx} | 4 +- .../searchResults/ui/KvStore.tsx} | 10 +- .../searchResults/ui}/NothingFound.tsx | 4 +- .../searchResults/ui/OperatorAddress.tsx} | 53 +++--- .../ui/OperatorEscrows/EscrowsTable.tsx | 82 ++++++++++ .../ui/OperatorEscrows/EscrowsTableBody.tsx | 72 ++++++++ .../EscrowsTableBodyContainer.tsx | 12 +- .../searchResults/ui/ReputationScore.tsx} | 2 +- .../searchResults/ui}/SearchResults.tsx | 154 ++++++++---------- .../searchResults/ui/StakeInfo.tsx} | 10 +- .../searchResults/ui/TablePagination.tsx | 92 +++++++++++ .../searchResults/ui}/TitleSectionWrapper.tsx | 2 +- .../searchResults/ui}/WalletAddress.tsx | 25 ++- .../TransactionsTableBody.tsx | 55 +++---- .../TransactionsTableBodyContainer.tsx | 10 +- .../TransactionsTableCellMethod.tsx} | 4 +- .../TransactionsTableCellValue.tsx} | 14 +- .../TransactionsTableHead.tsx | 6 +- .../ui/WalletTransactionsTable.tsx | 90 ++++++++++ .../client/src/helpers/abbreviateValue.ts | 12 -- .../dashboard/client/src/helpers/index.ts | 1 - .../client/src/helpers/isValidEVMAddress.ts | 4 - .../dashboard/client/src/pages/Graph/index.ts | 1 - .../client/src/pages/Home/Leaderboard.tsx | 16 -- .../dashboard/client/src/pages/Home/index.ts | 1 - .../client/src/pages/Leaderboard/index.tsx | 25 --- .../SearchResults/EscrowAddress/index.ts | 1 - .../RoleDetailsEscrowsTable.tsx | 91 ----------- .../tableComponents/EscrowsTableBody.tsx | 103 ------------ .../pages/SearchResults/RoleDetails/index.ts | 1 - .../WalletAddressTransactionsTable.tsx | 104 ------------ .../SearchResults/WalletAddress/index.ts | 1 - .../client/src/pages/SearchResults/index.ts | 1 - .../dashboard/client/src/pages/graph/index.ts | 1 + .../Graph.tsx => graph/ui/GraphPage.tsx} | 10 +- .../dashboard/client/src/pages/home/index.ts | 1 + .../{Home/Home.tsx => home/ui/HomePage.tsx} | 33 ++-- .../client/src/pages/leaderboard/index.ts | 1 + .../pages/leaderboard/ui/LeaderboardPage.tsx | 21 +++ .../client/src/pages/searchResults/index.ts | 1 + .../searchResults/ui/SearchResultsPage.tsx | 15 ++ .../src/services/api/use-escrows-details.tsx | 100 ------------ .../src/services/api/use-general-stats.tsx | 30 ---- .../api/use-graph-page-chart-data.tsx | 150 ----------------- .../api/use-hcaptcha-general-stats.tsx | 33 ---- .../client/src/services/api/use-hmt-price.tsx | 29 ---- .../src/services/api/use-kvstore-data.tsx | 36 ---- .../services/api/use-leaderboard-details.tsx | 81 --------- .../services/api/use-transaction-details.tsx | 107 ------------ .../client/src/services/http-service.ts | 7 - .../api-paths.ts => shared/api/apiPaths.ts} | 4 +- .../client/src/shared/api/httpClient.ts | 9 + .../api/useFilteredNetworks.ts} | 13 +- .../client/src/shared/api/useHmtPrice.ts | 28 ++++ .../src/{helpers => shared/config}/env.ts | 0 .../hooks/useBreakpoints.tsx} | 0 .../src/shared/lib/abbreviateAddress.ts | 12 ++ .../shared/lib/convertSnakeToHumanReadable.ts | 8 + .../lib/formatHmtDecimals.ts} | 4 +- .../lib/handleErrorMessage.ts} | 6 +- .../src/shared/lib/isValidEvmAddress.ts | 6 + .../{utils/config => shared/lib}/networks.ts | 2 +- .../lib/validateResponse.ts} | 4 +- .../src/shared/store/useGlobalFiltersStore.ts | 21 +++ .../{services => shared/types}/global.type.ts | 0 .../ui/AbbreviateClipboard/index.tsx} | 8 +- .../ui/Breadcrumbs/index.tsx} | 0 .../ui/CustomTooltip/index.tsx} | 0 .../ui/DatePicker/index.tsx} | 6 +- .../client/src/shared/ui/EntityIcon/index.tsx | 24 +++ .../src/shared/ui/FormattedNumber/index.tsx | 22 +++ .../ui}/Loader/index.tsx | 0 .../src/shared/ui/NetworkIcon/index.tsx | 26 +++ .../ui/SearchBar/index.tsx} | 58 +++---- .../ui/SearchBar/styles.ts} | 0 .../ui}/SectionWrapper/index.tsx | 0 .../ui/ShadowIcon/index.tsx} | 0 .../ui/icons}/BinanceSmartChainIcon.tsx | 2 +- .../ui/icons}/DarkModeIcon.tsx | 4 +- .../Icons => shared/ui/icons}/DiscordIcon.tsx | 0 .../ui/icons}/EscrowAddressIcon.tsx | 4 +- .../ui/icons}/EthereumIcon.tsx | 2 +- .../ui/icons}/ExchangeOracleIcon.tsx | 4 +- .../Icons => shared/ui/icons}/HumanIcon.tsx | 2 +- .../ui/icons/JobLauncherIcon.tsx} | 4 +- .../ui/icons}/LeaderboardIcon.tsx | 4 +- .../ui/icons}/LightModeIcon.tsx | 4 +- .../ui/icons}/LogoBlockIcon.tsx | 4 +- .../ui/icons}/LogoBlockIconMobile.tsx | 4 +- .../Icons => shared/ui/icons}/PolygonIcon.tsx | 2 +- .../ui/icons/RecordingOracleIcon.tsx} | 4 +- .../ui/icons/ReputationOracleIcon.tsx} | 4 +- .../Icons => shared/ui/icons}/WalletIcon.tsx | 4 +- .../{theme.tsx => shared/ui/theme/index.tsx} | 142 +--------------- .../client/src/shared/ui/theme/palette.ts | 139 ++++++++++++++++ .../client/src/utils/case-converter.ts | 8 - .../utils/hooks/use-escrows-details-dto.ts | 97 ----------- .../src/utils/hooks/use-leaderboard-search.ts | 22 --- .../hooks/use-transactions-details-dto.ts | 99 ----------- .../src/utils/hooks/use-wallet-search.ts | 33 ---- .../client/src/widgets/footer/index.ts | 1 + .../Footer => widgets/footer/ui}/Footer.tsx | 4 +- .../client/src/widgets/header/index.ts | 1 + .../Header => widgets/header/ui}/Header.tsx | 6 +- .../header/ui/ThemeModeSwitch.tsx} | 4 +- .../client/src/widgets/page-wrapper/index.ts | 1 + .../page-wrapper/ui}/PageWrapper.tsx | 4 +- packages/apps/dashboard/client/tsconfig.json | 4 +- packages/apps/dashboard/client/vite.config.ts | 5 - yarn.lock | 1 - 227 files changed, 2044 insertions(+), 2894 deletions(-) rename packages/apps/dashboard/client/{src/assets/styles => public}/favicon.ico (100%) delete mode 100644 packages/apps/dashboard/client/public/vite.svg delete mode 100644 packages/apps/dashboard/client/src/App.tsx create mode 100644 packages/apps/dashboard/client/src/app/AppRoutes.tsx create mode 100644 packages/apps/dashboard/client/src/app/config/routes.ts rename packages/apps/dashboard/client/src/{main.tsx => app/index.tsx} (80%) rename packages/apps/dashboard/client/src/{ => app}/providers/ThemeProvider.tsx (97%) rename packages/apps/dashboard/client/src/{assets => app}/styles/_const.scss (100%) rename packages/apps/dashboard/client/src/{assets => app}/styles/_graph-swipper.scss (100%) rename packages/apps/dashboard/client/src/{assets => app}/styles/_home-page.scss (100%) rename packages/apps/dashboard/client/src/{assets => app}/styles/_page-wrapper.scss (100%) rename packages/apps/dashboard/client/src/{assets => app}/styles/_search.scss (100%) rename packages/apps/dashboard/client/src/{assets => app}/styles/_shadow-icon.scss (100%) rename packages/apps/dashboard/client/src/{assets => app}/styles/main.scss (100%) delete mode 100644 packages/apps/dashboard/client/src/assets/bing.png delete mode 100644 packages/apps/dashboard/client/src/assets/bitfinex.png delete mode 100644 packages/apps/dashboard/client/src/assets/coinlist.png delete mode 100644 packages/apps/dashboard/client/src/assets/ethereum.png delete mode 100644 packages/apps/dashboard/client/src/assets/exchange.png delete mode 100644 packages/apps/dashboard/client/src/assets/gate.png delete mode 100644 packages/apps/dashboard/client/src/assets/human.png delete mode 100644 packages/apps/dashboard/client/src/assets/icons/binance.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/celo.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/discord.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/ethereum.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/human-app.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/job-launcher.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/moonbeam.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/okx.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/polygon.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg delete mode 100644 packages/apps/dashboard/client/src/assets/icons/xlayer.svg delete mode 100644 packages/apps/dashboard/client/src/assets/lbank.png delete mode 100644 packages/apps/dashboard/client/src/assets/logo-mobile.png delete mode 100644 packages/apps/dashboard/client/src/assets/logo.png delete mode 100644 packages/apps/dashboard/client/src/assets/probitGlobal.png delete mode 100644 packages/apps/dashboard/client/src/assets/recording.png delete mode 100644 packages/apps/dashboard/client/src/assets/reputation.png delete mode 100644 packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx delete mode 100644 packages/apps/dashboard/client/src/components/Charts/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/Clipboard/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx delete mode 100644 packages/apps/dashboard/client/src/components/DataEntry/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/Footer/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/Header/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx delete mode 100644 packages/apps/dashboard/client/src/components/Home/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx delete mode 100644 packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx delete mode 100644 packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx delete mode 100644 packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx delete mode 100644 packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx delete mode 100644 packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx delete mode 100644 packages/apps/dashboard/client/src/components/NothingFound/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/PageWrapper/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/SearchResults/index.ts delete mode 100644 packages/apps/dashboard/client/src/components/ShadowIcon/index.ts delete mode 100644 packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx delete mode 100644 packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx delete mode 100644 packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx create mode 100644 packages/apps/dashboard/client/src/features/graph/api/useChartData.ts create mode 100644 packages/apps/dashboard/client/src/features/graph/index.ts rename packages/apps/dashboard/client/src/{helpers => features/graph/lib}/formatDate.ts (52%) rename packages/apps/dashboard/client/src/{helpers => features/graph/lib}/formatNumber.ts (72%) create mode 100644 packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts create mode 100644 packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts rename packages/apps/dashboard/client/src/{utils/hooks/use-graph-page-chart-params.tsx => features/graph/store/useChartParamsStore.ts} (96%) rename packages/apps/dashboard/client/src/{components/Charts => features/graph/ui}/AreaChart.tsx (90%) create mode 100644 packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx rename packages/apps/dashboard/client/src/{components/Charts => features/graph/ui}/CustomXAxisTick.tsx (91%) rename packages/apps/dashboard/client/src/{components/Home => features/graph/ui}/GraphSwiper.tsx (81%) rename packages/apps/dashboard/client/src/{components/Home => features/graph/ui}/SmallGraph.tsx (70%) rename packages/apps/dashboard/client/src/{components/DataEntry => features/graph/ui}/ToggleButtons.tsx (93%) rename packages/apps/dashboard/client/src/{components/Charts => features/graph/ui}/ToggleCharts.tsx (90%) create mode 100644 packages/apps/dashboard/client/src/features/home/api/useGeneralStats.ts create mode 100644 packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts create mode 100644 packages/apps/dashboard/client/src/features/home/model/generalStats.ts create mode 100644 packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts rename packages/apps/dashboard/client/src/{pages/Home/HMTPrice.tsx => features/home/ui/HmtPrice.tsx} (69%) rename packages/apps/dashboard/client/src/{pages/Home => features/home/ui}/Holders.tsx (70%) rename packages/apps/dashboard/client/src/{pages/Home => features/home/ui}/TotalNumberOfTasks.tsx (71%) rename packages/apps/dashboard/client/src/{pages/Home => features/home/ui}/TotalTransactions.tsx (71%) create mode 100644 packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts create mode 100644 packages/apps/dashboard/client/src/features/leaderboard/index.ts create mode 100644 packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts create mode 100644 packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts create mode 100644 packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx rename packages/apps/dashboard/client/src/features/{Leaderboard/components => leaderboard/ui}/CategoryCell.tsx (75%) create mode 100644 packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx rename packages/apps/dashboard/client/src/features/{Leaderboard/components => leaderboard/ui}/DataGridWrapper.tsx (84%) rename packages/apps/dashboard/client/src/features/{Leaderboard/index.tsx => leaderboard/ui/Leaderboard.tsx} (66%) rename packages/apps/dashboard/client/src/features/{Leaderboard/components => leaderboard/ui}/RoleCell.tsx (72%) rename packages/apps/dashboard/client/src/features/{Leaderboard/components => leaderboard/ui}/SelectNetwork.tsx (83%) rename packages/apps/dashboard/client/src/features/{Leaderboard/components => leaderboard/ui}/TextCell.tsx (52%) rename packages/apps/dashboard/client/src/features/{Leaderboard/hooks => leaderboard/ui}/useDataGrid.tsx (83%) create mode 100644 packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/index.ts rename packages/apps/dashboard/client/src/{services/api/use-address-details.tsx => features/searchResults/model/addressDetailsSchema.ts} (74%) create mode 100644 packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts create mode 100644 packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts rename packages/apps/dashboard/client/src/{components/Clipboard => features/searchResults/ui}/Clipboard.tsx (89%) rename packages/apps/dashboard/client/src/{pages/SearchResults/EscrowAddress => features/searchResults/ui}/EscrowAddress.tsx (90%) rename packages/apps/dashboard/client/src/{pages/SearchResults/HmtBalance/index.tsx => features/searchResults/ui/HmtBalance.tsx} (68%) rename packages/apps/dashboard/client/src/{pages/SearchResults/HmtPrice/index.tsx => features/searchResults/ui/HmtPrice.tsx} (76%) rename packages/apps/dashboard/client/src/{pages/SearchResults/KVStore/index.tsx => features/searchResults/ui/KvStore.tsx} (82%) rename packages/apps/dashboard/client/src/{components/NothingFound => features/searchResults/ui}/NothingFound.tsx (90%) rename packages/apps/dashboard/client/src/{pages/SearchResults/RoleDetails/RoleDetails.tsx => features/searchResults/ui/OperatorAddress.tsx} (79%) create mode 100644 packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx create mode 100644 packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx rename packages/apps/dashboard/client/src/{pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents => features/searchResults/ui/OperatorEscrows}/EscrowsTableBodyContainer.tsx (69%) rename packages/apps/dashboard/client/src/{pages/SearchResults/ReputationScore/index.tsx => features/searchResults/ui/ReputationScore.tsx} (95%) rename packages/apps/dashboard/client/src/{pages/SearchResults => features/searchResults/ui}/SearchResults.tsx (61%) rename packages/apps/dashboard/client/src/{pages/SearchResults/StakeInfo/index.tsx => features/searchResults/ui/StakeInfo.tsx} (89%) create mode 100644 packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx rename packages/apps/dashboard/client/src/{components/SearchResults => features/searchResults/ui}/TitleSectionWrapper.tsx (95%) rename packages/apps/dashboard/client/src/{pages/SearchResults/WalletAddress => features/searchResults/ui}/WalletAddress.tsx (77%) rename packages/apps/dashboard/client/src/{pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents => features/searchResults/ui/WalletTransactions}/TransactionsTableBody.tsx (71%) rename packages/apps/dashboard/client/src/{pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents => features/searchResults/ui/WalletTransactions}/TransactionsTableBodyContainer.tsx (71%) rename packages/apps/dashboard/client/src/{pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx => features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx} (93%) rename packages/apps/dashboard/client/src/{pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx => features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx} (71%) rename packages/apps/dashboard/client/src/{pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents => features/searchResults/ui/WalletTransactions}/TransactionsTableHead.tsx (92%) create mode 100644 packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx delete mode 100644 packages/apps/dashboard/client/src/helpers/abbreviateValue.ts delete mode 100644 packages/apps/dashboard/client/src/helpers/index.ts delete mode 100644 packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts delete mode 100644 packages/apps/dashboard/client/src/pages/Graph/index.ts delete mode 100644 packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx delete mode 100644 packages/apps/dashboard/client/src/pages/Home/index.ts delete mode 100644 packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts delete mode 100644 packages/apps/dashboard/client/src/pages/SearchResults/index.ts create mode 100644 packages/apps/dashboard/client/src/pages/graph/index.ts rename packages/apps/dashboard/client/src/pages/{Graph/Graph.tsx => graph/ui/GraphPage.tsx} (50%) create mode 100644 packages/apps/dashboard/client/src/pages/home/index.ts rename packages/apps/dashboard/client/src/pages/{Home/Home.tsx => home/ui/HomePage.tsx} (81%) create mode 100644 packages/apps/dashboard/client/src/pages/leaderboard/index.ts create mode 100644 packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx create mode 100644 packages/apps/dashboard/client/src/pages/searchResults/index.ts create mode 100644 packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-general-stats.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx delete mode 100644 packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx delete mode 100644 packages/apps/dashboard/client/src/services/http-service.ts rename packages/apps/dashboard/client/src/{services/api-paths.ts => shared/api/apiPaths.ts} (93%) create mode 100644 packages/apps/dashboard/client/src/shared/api/httpClient.ts rename packages/apps/dashboard/client/src/{utils/hooks/use-filtered-networks.ts => shared/api/useFilteredNetworks.ts} (67%) create mode 100644 packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts rename packages/apps/dashboard/client/src/{helpers => shared/config}/env.ts (100%) rename packages/apps/dashboard/client/src/{utils/hooks/use-breakpoints.tsx => shared/hooks/useBreakpoints.tsx} (100%) create mode 100644 packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts create mode 100644 packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts rename packages/apps/dashboard/client/src/{helpers/formatHMTDecimals.ts => shared/lib/formatHmtDecimals.ts} (87%) rename packages/apps/dashboard/client/src/{services/handle-error-message.ts => shared/lib/handleErrorMessage.ts} (76%) create mode 100644 packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts rename packages/apps/dashboard/client/src/{utils/config => shared/lib}/networks.ts (96%) rename packages/apps/dashboard/client/src/{services/validate-response.ts => shared/lib/validateResponse.ts} (82%) create mode 100644 packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts rename packages/apps/dashboard/client/src/{services => shared/types}/global.type.ts (100%) rename packages/apps/dashboard/client/src/{components/SearchResults/AbbreviateClipboard.tsx => shared/ui/AbbreviateClipboard/index.tsx} (90%) rename packages/apps/dashboard/client/src/{components/Breadcrumbs/Breadcrumbs.tsx => shared/ui/Breadcrumbs/index.tsx} (100%) rename packages/apps/dashboard/client/src/{components/CustomTooltip/CustomTooltip.tsx => shared/ui/CustomTooltip/index.tsx} (100%) rename packages/apps/dashboard/client/src/{components/DataEntry/DatePicker.tsx => shared/ui/DatePicker/index.tsx} (94%) create mode 100644 packages/apps/dashboard/client/src/shared/ui/EntityIcon/index.tsx create mode 100644 packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx rename packages/apps/dashboard/client/src/{components => shared/ui}/Loader/index.tsx (100%) create mode 100644 packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx rename packages/apps/dashboard/client/src/{components/SearchBar/SearchBar.tsx => shared/ui/SearchBar/index.tsx} (77%) rename packages/apps/dashboard/client/src/{components/SearchBar/SearchBar.styles.ts => shared/ui/SearchBar/styles.ts} (100%) rename packages/apps/dashboard/client/src/{components => shared/ui}/SectionWrapper/index.tsx (100%) rename packages/apps/dashboard/client/src/{components/ShadowIcon/ShadowIcon.tsx => shared/ui/ShadowIcon/index.tsx} (100%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/BinanceSmartChainIcon.tsx (99%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/DarkModeIcon.tsx (85%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/DiscordIcon.tsx (100%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/EscrowAddressIcon.tsx (98%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/EthereumIcon.tsx (94%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/ExchangeOracleIcon.tsx (93%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/HumanIcon.tsx (97%) rename packages/apps/dashboard/client/src/{components/Icons/JobLauncher.tsx => shared/ui/icons/JobLauncherIcon.tsx} (93%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/LeaderboardIcon.tsx (98%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/LightModeIcon.tsx (94%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/LogoBlockIcon.tsx (99%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/LogoBlockIconMobile.tsx (99%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/PolygonIcon.tsx (97%) rename packages/apps/dashboard/client/src/{components/Icons/RecordingOracle.tsx => shared/ui/icons/RecordingOracleIcon.tsx} (96%) rename packages/apps/dashboard/client/src/{components/Icons/ReputationOracle.tsx => shared/ui/icons/ReputationOracleIcon.tsx} (95%) rename packages/apps/dashboard/client/src/{components/Icons => shared/ui/icons}/WalletIcon.tsx (99%) rename packages/apps/dashboard/client/src/{theme.tsx => shared/ui/theme/index.tsx} (71%) create mode 100644 packages/apps/dashboard/client/src/shared/ui/theme/palette.ts delete mode 100644 packages/apps/dashboard/client/src/utils/case-converter.ts delete mode 100644 packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts delete mode 100644 packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts delete mode 100644 packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts delete mode 100644 packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts create mode 100644 packages/apps/dashboard/client/src/widgets/footer/index.ts rename packages/apps/dashboard/client/src/{components/Footer => widgets/footer/ui}/Footer.tsx (97%) create mode 100644 packages/apps/dashboard/client/src/widgets/header/index.ts rename packages/apps/dashboard/client/src/{components/Header => widgets/header/ui}/Header.tsx (95%) rename packages/apps/dashboard/client/src/{components/ThemeModeSwitch/index.tsx => widgets/header/ui/ThemeModeSwitch.tsx} (72%) create mode 100644 packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts rename packages/apps/dashboard/client/src/{components/PageWrapper => widgets/page-wrapper/ui}/PageWrapper.tsx (86%) diff --git a/.husky/pre-commit b/.husky/pre-commit index b1dd4d8a8e..19c3fa6e16 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,5 @@ yarn dlx lint-staged +yarn workspaces foreach --all -p run typecheck # Format python file changes cd packages/sdk/python/human-protocol-sdk diff --git a/packages/apps/dashboard/client/.gitignore b/packages/apps/dashboard/client/.gitignore index a547bf36d8..adc48a4b49 100644 --- a/packages/apps/dashboard/client/.gitignore +++ b/packages/apps/dashboard/client/.gitignore @@ -17,6 +17,7 @@ dist-ssr !.vscode/extensions.json .idea .DS_Store +.eslintcache *.suo *.ntvs* *.njsproj diff --git a/packages/apps/dashboard/client/index.html b/packages/apps/dashboard/client/index.html index c533b6ac6b..3b1a160e05 100644 --- a/packages/apps/dashboard/client/index.html +++ b/packages/apps/dashboard/client/index.html @@ -18,6 +18,6 @@
- + diff --git a/packages/apps/dashboard/client/package.json b/packages/apps/dashboard/client/package.json index d8349972ea..8e0eef6f20 100644 --- a/packages/apps/dashboard/client/package.json +++ b/packages/apps/dashboard/client/package.json @@ -9,11 +9,12 @@ "clean": "tsc --build --clean && rm -rf dist", "start": "vite", "build": "tsc --build && vite build", - "lint": "eslint . --report-unused-disable-directives --max-warnings 0", + "lint": "yarn typecheck && eslint . --report-unused-disable-directives --max-warnings 0", "lint:fix": "eslint . --fix", "preview": "vite preview", "vercel-build": "yarn workspace human-protocol build:libs && yarn build", - "test": "exit 0" + "test": "exit 0", + "typecheck": "tsc --noEmit" }, "dependencies": { "@emotion/react": "^11.11.4", @@ -62,13 +63,12 @@ "sass": "^1.85.0", "typescript": "^5.6.3", "typescript-eslint": "^8.33.0", - "vite": "^6.2.4", - "vite-plugin-svgr": "^4.2.0" + "vite": "^6.2.4" }, "lint-staged": { "*.{ts,tsx}": [ "prettier --write", - "eslint --fix" + "eslint --cache --fix" ] } } diff --git a/packages/apps/dashboard/client/src/assets/styles/favicon.ico b/packages/apps/dashboard/client/public/favicon.ico similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/favicon.ico rename to packages/apps/dashboard/client/public/favicon.ico diff --git a/packages/apps/dashboard/client/public/vite.svg b/packages/apps/dashboard/client/public/vite.svg deleted file mode 100644 index c200287f03..0000000000 --- a/packages/apps/dashboard/client/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/apps/dashboard/client/src/App.tsx b/packages/apps/dashboard/client/src/App.tsx deleted file mode 100644 index c78a2f31b6..0000000000 --- a/packages/apps/dashboard/client/src/App.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { FC } from 'react'; - -import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; - -import Graph from '@/pages/Graph'; -import Home from '@/pages/Home'; -import LeaderBoard from '@/pages/Leaderboard'; -import SearchResults from '@/pages/SearchResults'; - -const App: FC = () => { - return ( - - - } /> - } /> - } /> - } /> - Not find
} /> - - - ); -}; - -export default App; diff --git a/packages/apps/dashboard/client/src/app/AppRoutes.tsx b/packages/apps/dashboard/client/src/app/AppRoutes.tsx new file mode 100644 index 0000000000..866ee88553 --- /dev/null +++ b/packages/apps/dashboard/client/src/app/AppRoutes.tsx @@ -0,0 +1,26 @@ +import { FC } from 'react'; + +import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; + +import GraphPage from '@/pages/graph'; +import HomePage from '@/pages/home'; +import LeaderboardPage from '@/pages/leaderboard'; +import SearchResultsPage from '@/pages/searchResults'; + +import { ROUTES } from './config/routes'; + +const AppRoutes: FC = () => { + return ( + + + } /> + } /> + } /> + } /> + Not found} /> + + + ); +}; + +export default AppRoutes; diff --git a/packages/apps/dashboard/client/src/app/config/routes.ts b/packages/apps/dashboard/client/src/app/config/routes.ts new file mode 100644 index 0000000000..9990f8335a --- /dev/null +++ b/packages/apps/dashboard/client/src/app/config/routes.ts @@ -0,0 +1,6 @@ +export const ROUTES = { + HOME: '/', + LEADERBOARD: '/leaderboard', + GRAPH: '/graph', + SEARCH: '/search/:chainId/:address', +} as const; diff --git a/packages/apps/dashboard/client/src/main.tsx b/packages/apps/dashboard/client/src/app/index.tsx similarity index 80% rename from packages/apps/dashboard/client/src/main.tsx rename to packages/apps/dashboard/client/src/app/index.tsx index 0474e89a76..04a926ce42 100644 --- a/packages/apps/dashboard/client/src/main.tsx +++ b/packages/apps/dashboard/client/src/app/index.tsx @@ -3,10 +3,9 @@ import React from 'react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import ReactDOM from 'react-dom/client'; -import ThemeProvider from '@/providers/ThemeProvider'; - -import App from './App'; -import '@/assets/styles/main.scss'; +import AppRoutes from './AppRoutes'; +import ThemeProvider from './providers/ThemeProvider'; +import './styles/main.scss'; import 'simplebar-react/dist/simplebar.min.css'; const queryClient = new QueryClient({ @@ -20,7 +19,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render( - + diff --git a/packages/apps/dashboard/client/src/providers/ThemeProvider.tsx b/packages/apps/dashboard/client/src/app/providers/ThemeProvider.tsx similarity index 97% rename from packages/apps/dashboard/client/src/providers/ThemeProvider.tsx rename to packages/apps/dashboard/client/src/app/providers/ThemeProvider.tsx index 41b3005a65..82045f6af2 100644 --- a/packages/apps/dashboard/client/src/providers/ThemeProvider.tsx +++ b/packages/apps/dashboard/client/src/app/providers/ThemeProvider.tsx @@ -13,7 +13,7 @@ import { ThemeProvider as MuiThemeProvider, } from '@mui/material'; -import { createAppTheme } from '../theme'; +import { createAppTheme } from '@/shared/ui/theme'; const THEME_STORAGE_KEY = 'dashboard-app-theme-mode'; const RELEASE_DARK_MODE = false; // TODO: remove this once we release the dark mode diff --git a/packages/apps/dashboard/client/src/assets/styles/_const.scss b/packages/apps/dashboard/client/src/app/styles/_const.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/_const.scss rename to packages/apps/dashboard/client/src/app/styles/_const.scss diff --git a/packages/apps/dashboard/client/src/assets/styles/_graph-swipper.scss b/packages/apps/dashboard/client/src/app/styles/_graph-swipper.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/_graph-swipper.scss rename to packages/apps/dashboard/client/src/app/styles/_graph-swipper.scss diff --git a/packages/apps/dashboard/client/src/assets/styles/_home-page.scss b/packages/apps/dashboard/client/src/app/styles/_home-page.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/_home-page.scss rename to packages/apps/dashboard/client/src/app/styles/_home-page.scss diff --git a/packages/apps/dashboard/client/src/assets/styles/_page-wrapper.scss b/packages/apps/dashboard/client/src/app/styles/_page-wrapper.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/_page-wrapper.scss rename to packages/apps/dashboard/client/src/app/styles/_page-wrapper.scss diff --git a/packages/apps/dashboard/client/src/assets/styles/_search.scss b/packages/apps/dashboard/client/src/app/styles/_search.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/_search.scss rename to packages/apps/dashboard/client/src/app/styles/_search.scss diff --git a/packages/apps/dashboard/client/src/assets/styles/_shadow-icon.scss b/packages/apps/dashboard/client/src/app/styles/_shadow-icon.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/_shadow-icon.scss rename to packages/apps/dashboard/client/src/app/styles/_shadow-icon.scss diff --git a/packages/apps/dashboard/client/src/assets/styles/main.scss b/packages/apps/dashboard/client/src/app/styles/main.scss similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/main.scss rename to packages/apps/dashboard/client/src/app/styles/main.scss diff --git a/packages/apps/dashboard/client/src/assets/bing.png b/packages/apps/dashboard/client/src/assets/bing.png deleted file mode 100644 index c1eab49c16daa4a371f2e4d223e32126c8b0b1d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1363 zcmV-Z1+4msP)1Y^2dEBSM!OkqamZA?Ss0=~p5*Ubp-JBi?Z*Bqrh& zgbN80Xz>dS2C9e}6T?{4K!kR;U%NXq=NzAzZEIUTq8BpB&Y79B=XpP#=Y3z`f4;=M zHv0!{DU)gLh2v~8O7shfvPw^hKsquIMjv*(Xms>oTkxL@lnGq&<9DPK`y7}OS7Ii( zT;-BghLF<25n}kv!M6SX%D|f4^|A|h#DOgfnV=fDTpbHY0$XR^K(gh;=_&~$g%cPN zR#rwMmw^uw+_)pKC~MvfG&I2@0vH0>#2;GFQX^7L#L25w{GXHTr;ZK0UN7I(fGfQb zOK=EH&kU@QaCCw~Bg{z)kl*=kXh<3bHv*K6AZ?Qfx(w-$4D7R|1x&T@(6>_$@n~5Z zi+pwx9eH{8Mo zi&wVgP^okx>$O~Lnj|}6izCtCs!Cd!z5IHhC2Na4^Z2CI!yh+%d~7Ec>mxpxOi<9LOjO2$|TQpn)Q;T znW8X>8du7+^+7>%SI`TsDNXBRW>%nH2P;-Gffhcw@$)WXrXYgZ?B z3`7|JE5wP|l|_c%(bRL*02?`e}k*vu&6*t~A6>yJ#R2%R`~EL)1|zVxh&-!L2!q zYF*><*c3iJHHja7brGruQ-0q2u!f_j$FY4&51#8Q!fz)>#-#$uUm}u(7wFN&N=~bJ zXEaO=3<*Y1DBME9Yoam977%C9WE+TOjy0l4G}{Il^;Cn3si7kykDqtsNZar-1Ich{y805+UG_5UqngbtRIpyshnlcVlclOW_9J!+zS~rTuC{3!G+ND2 z$}qU{aog&DR5^c*9TQdSL>1|nAdZr%^kH2dO*$&`su+oDU4ExRl4d~7OV*R-+T>5$ zmU46*6)d@KA2@>?G!8~sHRWX+!rXQ!seNm0I)D`Oq9M_GtI7hXnj5D>&In_Ue? zL;ebR4iTR~$+@nX{gAWjBJkp{Xc6%8eDDy3Ir$xQE~!MQ&Ds*Nk%Sy;dgN!j`f`!8 z%0f7o>fp3h0Y!p5Vt6*=<0{;=lMxUcV*ljc^?MPhr7`J@mbkVA*7ajx%@yEbV~3qA zu7fUb!g#xc(CBQoJ3$@RAfur2&!yAT6E%C;rW4(NZ|)YqaE{XEO*7Pbs^7Ei;X*TdMg3$Z%@o zck4@c^wIe>gdcrS-aDr&k?wBsZ07hk>;@%3RBhRcLgqL)2mP7^{rm&wyJZ;fmz2#p zQ;l@b7CEt8m@mKVWESVa6JQ`Q0`3WfpMFx!7jeXdb-Ni(d$q6Mc(bU|GziZ5mH;7q zRJ=N&0WZr_UfY-J!7B>wdRfO`9T9`^jYL4fN&yMT>dF)wTG1$>V!I?0}=G7UX3me!40~_OyN0cMk z9(4y8bOM2tmCIs_C4xafk`~O^BFI`AyFw&Pa%{N4i*&n9)g(idYx0}rT98|Aj&l7+ zA{uh7Ko+8W_ls8__9jjUmir=6?q%kr!G95w)mA(QQ*igo~nf*{)his{}z8;$HuQAa1VLjmv|I2%@04 z))f3e@#Cua0iy4nnX57$kCJks2OgO-Gv|5dnfIMJ0(>zPgc`zMgdc?1BW(+WYColamwl`~7VE{r!Dh(lvYlfgjZAbOZ6b zyE_a9gLrXqF(jZ+DDd*~a#B?}#wOR}@vs1N<$@q!C={BuWc$g6Z(I%r*xcNNd_E7k zTn^68&VU4f8K9&;-=#*#{zEJlgY)xq_Dsyctmr#P@STA`04kLVtgNiC=flH8n4h1A zDUsjC|aydF24!pm= zAJluHP{5m;8zgSf?RK+1dI&Wd4K6M&N+nrMg=M_}^iT{PaeB|t1V21Hz}3|i>ua~$ zV7J>L8jV7?+hwF%%UTQX*=yW=9XJ==m{`-)Lf+%6kbxpCcu>nU%N3guS48>v*!r?HaQYn5) zg77DZwgx1ENIHQTJ~)$L_@r>TH&+2OKnefKO@PslKK&!0nN|3|;V%*H0`|~pJwE^d N002ovPDHLkV1jRUX(#{y diff --git a/packages/apps/dashboard/client/src/assets/ethereum.png b/packages/apps/dashboard/client/src/assets/ethereum.png deleted file mode 100644 index fcd17dba968bbc706b3173b6a3d8f9834dd9cf0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 809 zcmV+^1J?YBP)owvpbICBj&*6-h1x3-~G;a&z;f14(9cGZ_dunehY%|wkb{vTP&4I zF&7sX>Dg=++ZMYOj6k$nErY|5&1Pfw1|wG3anf9)(Zu!!LsljE9Kl$--5z>3SR#?& zuw#^dV#l(qVP`Ngy>%%W)?J1wm>A5!dQ-g&?HX1bY%#UV(5kR1!49T&8B1X6MBl_t zei=GxK{w}jdU^_% zmzRJ~31|a>7>!0aK0XEos1*-;ZnxWlUSfq>aXOt2&d<*mjmBz52T<#DI?!x37rl5H zWxbeti5P4GQ5rF)HXIJ2(P%6#L(lWP!E81^A08euu!m9F7K^28GMPXlIg7<22Y;)c zQEnIv26VbA80uL@{rpHu&=9kOgM*v#c>ILpZlO@%@sktV0Zc%h{n2Q&EWHL@xm+9Ph1jS z#j==QPU%zyqk5wn0(BFx4tceOwLcWGT(U|(>4de}eHR!RYQ@8Hx+^;E3`Xfv diff --git a/packages/apps/dashboard/client/src/assets/exchange.png b/packages/apps/dashboard/client/src/assets/exchange.png deleted file mode 100644 index d48b1b3d00723a0822e91369996be3ed8b0839aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 988 zcmV<210(#2P)-cMgq&E zOXawX!|hFG_Be9~2X|y7#KP{(xAXJOEW&?C4i2+gyG2CYCV~PY|78U`0MzII+Bc@z ziql1yQ}Vh}VzuKDNW3s;pTFwkzzXJ&6=%Q7UVZVw=n_2d$aMzGJ-3PSK{RVfP!=#b z!=F#06Sk4sLtl|-)8#B+V-9u1Hz_RRDqvxI+r3PHpdvA$vYZY9x)`hc9 zD!t6R0+GHDP$Js8F{kG`jpCwOmoR1ly`!FYb`B}!&inRj37$Uy;wHy?^QrgpW1@#r zB$7AD3m3q0cyGn2)Y#{0oSx)#bZ$?)EE1V=ilV{S!$p14=xL4fT2D6Nwe1(`Qmltz zo^g>BLBi>4c95t;NS_((GB}@iDh&iYh+byoA=}G2j=ALu?oW6qA=KJ@moW0r(g;k1 z3WQj2U8fT^2J{$(Sm{HfZ?%~!5x_J&b6vH;2JQnezTAbJmmCw&2_%RU28-p{pV8s& z;4I=<7|fUfU*tod3+aBmkXC`|VOQ9(fR<-NFf?YPYi9Fo8kp=!Au(uFLFuH#}>xU zL@I|nlHDFoW>{X>eKr%5!>Kb*Ud8Q6uIxf+h0x-~hBW$dFbl|Ww4Bohwje=^=nPlVsNDBpc$p&Zw6sVYkovUzYJ%Fkd07olvR-#|h<`$&V z5SaMQ2FxM08oBi2=4G5HX~e8hw!a9fapau}COmsAeMp{*EcS`suznq(~5kD zH%of`;m*7MIulGhLu~ou%knH$WFp)PKN*5|r8Ie_-`KzmqyusacfVJ~SfUC3VQFh8KaGpGNIv$M0ivzik0o&C?5bLPzVU(V%U;D3U1?jva< z=_iTtEW~q|q=m$f^}-|$lFV3?y7;Ae5d@2IF$Z!#HDP+9mSZrI#Iv_43`NpN%M!l! zR)H}`E`_9tF{aoDU5@0`jw(7rcc<}bTmxsEOpzgR4XeQTmN;^hxbh|$t7A3v4J{)R6M?!~ox&>>D0m~PrbA>2 zm#xX~qYO9u7K@VK>P=xFlCt`YB5<G+K?#bz~a+lHMI zE;N^+c841ta&k;bqh~*1teH63QC-|xch_DcB53|eu}6f5YYBt+Lia5T1rKq!v+ zWZvFqI?76fMH&{8ZliC9Byl_l`p~f3BaG@K@{r|$&5IFnAN7ah=)9jsBDMAz;AFW= z*3s2kjE-@ z6y#1@L3#BAZAm%Y%y|R1P$eyx#kr+J&#v@dkC3d&1|{`cPk~)$@h_OL=lijf!4M zIiYy?gr(3x=FKw0&!DFABMa`JeAR|r0s587^p72vUazpI;bI>9B&e^c|I<^3;d&%~ cI`41m3q^*Es@O5NEdT%j07*qoM6N<$f>{0L82|tP diff --git a/packages/apps/dashboard/client/src/assets/icons/binance.svg b/packages/apps/dashboard/client/src/assets/icons/binance.svg deleted file mode 100644 index ab171b13dd..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/binance.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/celo.svg b/packages/apps/dashboard/client/src/assets/icons/celo.svg deleted file mode 100644 index 6fa2e074a4..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/celo.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/discord.svg b/packages/apps/dashboard/client/src/assets/icons/discord.svg deleted file mode 100644 index 079c049929..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/discord.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/ethereum.svg b/packages/apps/dashboard/client/src/assets/icons/ethereum.svg deleted file mode 100644 index aaafc35867..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/ethereum.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg b/packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg deleted file mode 100644 index 5452044828..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg b/packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg deleted file mode 100644 index 44d5e471a0..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg b/packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg deleted file mode 100644 index f081e6fda0..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/human-app.svg b/packages/apps/dashboard/client/src/assets/icons/human-app.svg deleted file mode 100644 index 9a9290e7c2..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/human-app.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/job-launcher.svg b/packages/apps/dashboard/client/src/assets/icons/job-launcher.svg deleted file mode 100644 index 433c97afa8..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/job-launcher.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/moonbeam.svg b/packages/apps/dashboard/client/src/assets/icons/moonbeam.svg deleted file mode 100644 index 800dd14dec..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/moonbeam.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/okx.svg b/packages/apps/dashboard/client/src/assets/icons/okx.svg deleted file mode 100644 index 515c561adf..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/okx.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/polygon.svg b/packages/apps/dashboard/client/src/assets/icons/polygon.svg deleted file mode 100644 index 2dfb9ed98f..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/polygon.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg b/packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg deleted file mode 100644 index e703d0b8a3..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg b/packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg deleted file mode 100644 index 69f056ede0..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/xlayer.svg b/packages/apps/dashboard/client/src/assets/icons/xlayer.svg deleted file mode 100644 index b3c4db1cb6..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/xlayer.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/lbank.png b/packages/apps/dashboard/client/src/assets/lbank.png deleted file mode 100644 index 4ebb88b9d3998ebbf7fee7d1eb24a4398087e714..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 598 zcmV-c0;&CpP)ga?MH@!Lt-=OsY1fM{A<)BX7TH)^9iN1pb38_*vp{<$M zx9z^|tM}Se{F2%3?o5BPGqXD_@XrX5Y>^z3WJt=E@H|BlA<@tRm^ez3l}LY+XcOG# zi83CE%Su$*Uy(O-(xEu88SHKhV`(M;C%oi~NM62U|0qlIlB_aFrrCrSU6LZIdJj+c zK^ybeNZ(2(ab?essfiwhr+P8Jc?Ts6d@*9Y@JX97C|Z2WxP_+QJ}3U824X@9XvakYdrYS1cCtv^A6NGl_4|+JRouQ ziu9Gez?{0hjS(kvLw2CU1)PfbDLK$Tk-W&;bV26`4B5dsT)?NV&2#X8gzO*=>uEQ_ z92HnVy{5*)x6@bBJcwJwm1OciFjL-++A z3mng|F(yZHgv^8SFtL&BR51nqoYCI(|Ej_>!?ylTkLowjL&o-s^b7>sl1e$z054^UuG8fbMTCiewVGip;zY38>XCiURbi2|b*p+eup}-&6XdC9@Rd@mrbm^@2 zq1Y+g^ZR-B9LHYR^W58=nA$_1k=Pg;YzR3gMN?3gzsnA4ECylq(x3+zdS@@Vz zpboj%HIi+8%qpeUi7<_dT-~adqABdn!rm&&)(Mc?!tsB#_a#$Tdd(4@|EUTyDh&;ATZAXj#P8>gZ8sP+ z<+$vXSF+EX`#V2KQI=En2|t$ux#g@;t7%M>bZe{Y)z-&qxZpjo!=<%OymtMqYP*gr zj=^JRb*V}7?r+^>eh{dc;`^f?&p7%f-c$n;qtHL zN>W3#zUyz7wbm;}*IUgN;yOaJ<+h{R~XlfC%tvxoNK-v+we$w^?`RBJgIesm(K3fnn(XqjcYj}O&C`f6Ey0)i#;5W_4P{2`y*TG|AhINFC z^V-ge=qLo}p)ob+Do1#_v#<4ZA=@0LE9qNkgew>}AuXML;c9cV#5Uf(O zRSY|jsK@R-W=B41OmQsUMm$d6h2C5O9R?EzRx%y^-GWofHH<&QC72Whd1guZ@R1i* zYgSw>NAt9%)&`f(qZ5KkIpE5W?#c%WJc(!E$)o)l!gpd_Og; zkB)qp9+T=YYHm>@2_?;T$|H@$zs$0wqYSIcq~bNim>> z-q=V}#PCR>;YQ;9=>Gp6ESj9*#TbdMk+6N!-7V|kMrz@`oA1&%Kefl04CcRuEK0N0 zvU2c-haY`q89|U`*eKU)R~No-XPw zDp8_DU{K8mx{eRK=tWA?r{pn=>N_e?qD1JSeB+hoho*;AqC|Yq~}rttU=(9Z&R9GF9E6 zD0G$7cTUB@SYJzeom8xE4{dZaZSeJt)I~Y^M}$Y4$gs_(XRTHF-`=e7=rOV7NBvl3+u~JD+X4h(48bSPeofBf*rwnI0Bm8Dl5snpy5c`v$?Wa{_+gW9OIsTO3*?YH`L3$apt)kL~N z(OAhzg78{L&z5v2%qff^Jzdf});XO}PKbC(661>l3}`L-&V_BdWSAU|V?A-o&1<_T zG|^V{Y_0^)L>EoO&?Aqh$VN!r#-u;tNliC{rm|+}ZwaHD@ceJ-mO@M9?VA1(9S0#F z;&HrsbbY<}`=Q6I4(B?`YO;QZcH65|U-Vq6+O1f)mG)8vj@4x~ze2mUqc!(qRVpO6KOvuM96DG?Bd!-3-jVWy$ zA~f8kYXtP@K3&vwE1+l}%Z>?&pw|w(0)I8DHX9RG^7k>xF$F>Q=A5Y)BzDH3=Svo{;)& zHasjM!&q5r?`YEN!M%xt52vlYtc>>6L&!C?Hj%;fwlo$!Z~}s~tJGl6_5Rhnj9x1b z5W;C%Q$v4GR4V4VAD{hmHMsWQwv-F#Lo~=ddw)#VIOMyaxpD387?Z}%d(r2BN->TN zE13tuGZ$$hyAuUviua*MABBBlJTJ`y4A@1#Z{uSa`AtO!CT|fMeaToip0rZRBhIrh zdG}xphs5FG;;XGl=I={Cts5DsKe3FE>LX-2b(~MOFSNv1DqAbPkI#>I?XE1n+|B9{ zOl-)ZEfVSzx5auSWpLclq_%|c-*bD=OJMRJCqq`wcXD-4_NkSP_lCGv>9F2{{6ju% zj7cmU;W|6IR!GrC%$JHRjE8#0wGmBinhy=mwfqHYUDt!vIzNmm;t8%B!s5ZF{RFLV zCIx#Z-V}^*c%~r;Wk`n@Dx}t7Sa>M0_qQhzL0S0l7FLjVv3F~PIo-{`M?EXyT@@As zDOBsj*^8J&S$Xi2jk{zSb58LXY27_OeI6SbjHydQtCwsVUc%)NGdy%KvGF?_S=v(z zp?gWW`r<1WI<( zjAWlRt;CaK?|IY~8P9}I+*4fQs8`zuQYz*Y;`XGWU%56i$pdh0MbHyo6({Bk$hD+L zTXao;H)>$AE+=1VTCFA@*An+bmt|Eo6D74+$b^@e1(_xt*elswgjSgXxnG2eM>xYF zIvaU>N|?p)FUesM3U(u7s@HaF#setvD6OLI2_fnnKCz6s?)3SAJ8Y$EWAG-aV}%Ky z^V}5Jz?2SW+va)5;V@X-1U29_x*Vn^a;*vXRBEj1)`VOYhQ}-A^o2IT)|zHM+?N`u z5yW0-fR+3nJUE%Lk7d+C<+T|2w$P#@2j6raFa7LdV(-sO!y~sk89S*t8WOhos^oX< z#j+y4vRrr&qCbW#=NjFug-vzC8p>bLaq4$HzLR1SLN66SkTY$&P!g7Zsd`l{ViIS8 zjT{rXP!4w$U^26JjmOF45v1$z8c$FkdU$-g{ZLS5C%XmtcBD+GdC$jIS>^DPhe2nZ*iaB`|1)CS&SG`6EbH)Mc$<%6GdVj zc)>0ez^`ZGHSU)ue1mQP0RyM%V7$x%ik!j5^Tb#emiypnZ61r2|q&Xze2I-QmzKSpb%nT;qHkxlpj-0CNfPGj%rBL0Np_bRXBohVm&yV9hk9?7o1AoE(s|5#TIFOcu$FtYAP#;yiie&mz@E$ z>0rWZ=d74_N^RB+`rXSjVuX`xiBPo8d2LaGhgVoFu5M5mvpOi{=m--}VDhL2UVHBF zM>BCbXF##H588PR;Zu*Q=Y4DVx3!4Qj&%YNAcSQ@W|e7crmB%=@jZ5F4rq`DARgTR zBM&pQw~`&)bI%QTS*ZIJN1Urod9FI>vz5?m3vwHycC;&$#kzN6y{On0GN#CxA>>6y zE&OggvK)Nd#)6YFp9+cGLhba2S;g<;bq|~71oAHzdO6Xt*>&ON^ywwolnDe$7>X@F z3wCw$V2xH!K_78%2Q!#7_99Mvi9Z?(z7CV!rPGnHVd_MnOD2a4{uYzCFE!co>?N!1 z70=YU0@=)co3ToObwZd38h3P`S(!o*vMs}zVT#9Ep^g)Jq6FZrRz<~nhdgSF1`Akx zRTswRP{K=MHRnm(fy@aEFg&NbdckTX$F3+~2rZ=r@7#D7x23GuP}nQMd#=KJ9&w*W zFVZNUtCoBE!in1%stpQsH+lsm8;7fMXO<2;4hUKIG!t-xZ+3&T7l>5EVKRpj8&&Pd zObtW_E9vgE4iIXLRbKu3^zg3km?)7(9M)wDrzsg`*F3LA)oTAb_Tn+Az@Jy`vxx39 z^_bAUfMKxJr`+DW1_hJ1@9+lM5+!DWS-w2VwMTP+Yc^D(#8-?-1~n6TyBV~)+y9Fy zQDPR@plrG(XjvLmiLV>E9!jXWx3Sn%qQqAWNjZDcK)cQ~D3RHR##E~+xE-fNiMt93 zR<4QK%xbv#wa-P*B0HWng@y=u&?Sp-IeY1N}5*ytQ-IZ0s3`43W?CbP3fk#EsXyuf9;-G)DOu#_nqceh>nGqiELs|l z%}LRSiw}X5d?sDZ0|ZzdEhb0GgFB6Q`>F+YyX1;s*4!}cOO8Q|peIM5y3&eUm+DaY zy^Ebw{DSlvtlJWWO*^6y8m2u%0x2#5XK9R=Q)`fu)k;x7ArdC(vHQRn%$^?(W0e)x z&x_FMI2<}AAT}--d2fCp{ca=b>ukyyS>~`}Z6uOU#tkd<+7?U0_gjSbC9mr(WrgkBGfO?SVMd1AdT;?gC$Y`^gw4M7F3U$|qZ+-r-30 z<%<^R^*p4$VGCriMa>|c%pBm>k?IO7E}jx$Hub_E=ya~_JC^`^;v`ABx%c3Btlk(& zgG-}$umRUM#0&y;Jl1X=jct3zv6E-if#*Jp*wgo!OsM?Ufrs}RQCMJc%^IJ?G`i<4 zG+@{Mv51)vM8WbRk;kg{eU58~y$^-&+wlBR6Us`gba0>$Pq|N-7J@B1$6(=-aAm4u zuyO4v!h&zN^x$=NGoEEOQ9pVVpU9{{tXLnZkZS@spX7f938lEd6Ptf_%U4os002ovPDHLkV1j&+ Bx2XUC diff --git a/packages/apps/dashboard/client/src/assets/recording.png b/packages/apps/dashboard/client/src/assets/recording.png deleted file mode 100644 index f4daa1fff7158fa8db6711cce932422e6f0dea96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 631 zcmV--0*L*IP)6(8igv-Yj)!6~8Y$#$EcW+4X#!o%BGcvOf0Z(D0tRZ(W%8O$ldMwt%omB-y9R~|4XIF_ao z3l9Rb;X~&&UhfB|*COyv=!!XZo9>NgxT(UmtSg)POBBM= z*EvMqcUY@ss%>RbAT19t@}WD{(?*?PS?88z*3v_g8(WzaNC&>Uqxf#osVU`JA{zHv zhP;JL3TPgfo(uTM9TC~s7n+gdsc;V>nv$ti6P(Q5kt*&&9EMq)Q0T8f;~u_tLWNpp z?1Una;o>pq?N3wS1-_|fUFF7M$fHP5XB>KeL9N1!=do~2OxAkau9C?g6Y*?mT4RQE z1x9>S>mcAEq=13Dfu;7Og>t?7E;JPz3L6OFrfge@d;r;(r5kJQ#k5qs#0R!p?4q8& RNjm@l002ovPDHLkV1hoP4{m14y~$wQY2@0Jv+bOi~;^=B}?{on{{qEWOMT4{j?L(dqsN5qeF zOto$tc<|M;z1M<^W@QD)ac*DXelJWy(QHkbj{!iN7n%@Thv>0zmtFoLZK0gcTU@lp z#@ys(5`{ameo9W9IPG8D;_+%d*a@+Ap@Bp3e~qy-QKgHwCm(TLdDQfD4N4%oeujMoSz+NgdcbEwv` zGAl9R%vyB_6dVIWv+O)uJYrV7tip;`1;kpVbepX^=fCa66Exv4jU|bgmb)yf;0*8? z;P70HpsoUJ^&@X*YdeZ1LU8w@uP5m(;ejA%T(H93f@|Ct{b{f09&0aP>zau3izP9& zafUX=i`;$8p6fHGv^k-Barq&UHEgBLh~w!!o2yNz2q`@T^ii; zg-N-wLS0$QR|r-hEvo|jvKKuzH#gqDN$)WS^a0IJu{gAvpTo5jBuo&|H4~L*yT{H0 zKu;L4n=&A?-Y}zt|9Sr3&+Z9?3n-BVPhf%F1L-bEjYFsjA)-QARTU7bO%0y4K0suw ziwQ_%P*tLzm5enZ|FY1z8?xf8f&db ctBml!0RaBDLo5b7$^ZZW07*qoM6N<$f-4=zIsgCw diff --git a/packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts b/packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts deleted file mode 100644 index 3ff68ca589..0000000000 --- a/packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Breadcrumbs'; diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx b/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx deleted file mode 100644 index 43e186ae67..0000000000 --- a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; -import { Grid, Typography } from '@mui/material'; -import Box from '@mui/material/Box'; -import Card from '@mui/material/Card'; -import Stack from '@mui/material/Stack'; -import { NumericFormat } from 'react-number-format'; -import { TooltipProps } from 'recharts'; - -import { GraphPageChartDataConfigObject } from '@/components/Charts/AreaChart'; -import { formatDate } from '@/helpers/formatDate'; - -const renderTitle = (title: string) => { - const currentTitle: GraphPageChartDataConfigObject = { - totalTransactionAmount: 'Transfer Amount', - totalTransactionCount: 'Transactions Count', - solved: 'Number of Tasks', - dailyUniqueReceivers: 'Unique Receivers', - dailyUniqueSenders: 'Unique Senders', - }; - return currentTitle[title as keyof GraphPageChartDataConfigObject]; -}; - -const CustomChartTooltip = ({ - payload, - label, - active, -}: TooltipProps) => { - if (active) { - return ( - - - - {formatDate(label, 'MMMM DD, YYYY')} - - {payload?.map((elem) => ( - - - - - - {renderTitle(elem.name ?? '')} - - - - - - {' '} - {elem.name === 'totalTransactionAmount' ? 'HMT' : ''} - - - - ))} - - - ); - } - return null; -}; - -export default CustomChartTooltip; diff --git a/packages/apps/dashboard/client/src/components/Charts/index.ts b/packages/apps/dashboard/client/src/components/Charts/index.ts deleted file mode 100644 index 52e979682c..0000000000 --- a/packages/apps/dashboard/client/src/components/Charts/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './AreaChart'; -export * from './CustomChartTooltip'; -export * from './CustomXAxisTick'; -export * from './ToggleCharts'; diff --git a/packages/apps/dashboard/client/src/components/Clipboard/index.ts b/packages/apps/dashboard/client/src/components/Clipboard/index.ts deleted file mode 100644 index cea243dcd0..0000000000 --- a/packages/apps/dashboard/client/src/components/Clipboard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Clipboard'; diff --git a/packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx b/packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx deleted file mode 100644 index 781ad47b0f..0000000000 --- a/packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from './CustomTooltip'; diff --git a/packages/apps/dashboard/client/src/components/DataEntry/index.ts b/packages/apps/dashboard/client/src/components/DataEntry/index.ts deleted file mode 100644 index b2655c7380..0000000000 --- a/packages/apps/dashboard/client/src/components/DataEntry/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DatePicker'; -export * from './ToggleButtons'; diff --git a/packages/apps/dashboard/client/src/components/Footer/index.ts b/packages/apps/dashboard/client/src/components/Footer/index.ts deleted file mode 100644 index be92134c1b..0000000000 --- a/packages/apps/dashboard/client/src/components/Footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Footer'; diff --git a/packages/apps/dashboard/client/src/components/Header/index.ts b/packages/apps/dashboard/client/src/components/Header/index.ts deleted file mode 100644 index 579f1ac23f..0000000000 --- a/packages/apps/dashboard/client/src/components/Header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Header'; diff --git a/packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx b/packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx deleted file mode 100644 index c4836609fc..0000000000 --- a/packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { NumericFormat } from 'react-number-format'; - -export const FormatNumber = ({ - value, -}: { - value: number | string | undefined | null; -}) => { - return ( - - ); -}; -export const FormatNumberWithDecimals = ({ - value, -}: { - value: number | string | undefined | null; -}) => { - if (value && Number(value) < 1) { - return {value}; - } - return ( - - ); -}; diff --git a/packages/apps/dashboard/client/src/components/Home/index.ts b/packages/apps/dashboard/client/src/components/Home/index.ts deleted file mode 100644 index 7117ca0dc1..0000000000 --- a/packages/apps/dashboard/client/src/components/Home/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './SmallGraph'; -export * from './GraphSwiper'; diff --git a/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx deleted file mode 100644 index 83d1eae24a..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { FC } from 'react'; - -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; - -export const AvalancheIcon: FC = (props) => { - return ( - - - - - - - ); -}; diff --git a/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx deleted file mode 100644 index 19e30cba4d..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { FC } from 'react'; - -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; - -export const CeloIcon: FC = (props) => { - return ( - - - - - - ); -}; - -export default CeloIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx deleted file mode 100644 index 6e64c1fafb..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { FC } from 'react'; - -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; - -export const MoonbaseAlphaIcon: FC = (props) => { - return ( - - - - - - - - - - - - - - - - - - ); -}; - -export default MoonbaseAlphaIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx deleted file mode 100644 index b2de436954..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { FC } from 'react'; - -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; - -export const MoonbeamIcon: FC = (props) => { - return ( - - - - ); -}; - -export default MoonbeamIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx deleted file mode 100644 index 7e9ff61b98..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { FC } from 'react'; - -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; - -export const XLayerIcon: FC = (props) => { - return ( - - - - - - - - - - - - - - - - - - ); -}; diff --git a/packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx b/packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx deleted file mode 100644 index 176f2c13e9..0000000000 --- a/packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import CeloIcon from '@/assets/icons/celo.svg'; -import { AvalancheIcon } from '@/components/Icons/AvalancheIcon'; -import BinanceSmartChainIcon from '@/components/Icons/BinanceSmartChainIcon'; -import EthereumIcon from '@/components/Icons/EthereumIcon'; -import HumanIcon from '@/components/Icons/HumanIcon'; -import MoonbaseAlphaIcon from '@/components/Icons/MoonbaseAlphaIcon'; -import MoonbeamIcon from '@/components/Icons/MoonbeamIcon'; -import PolygonIcon from '@/components/Icons/PolygonIcon'; -import { XLayerIcon } from '@/components/Icons/XLayerIcon'; - -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 42220: - case 44787: - return ; - case 195: - case 196: - return ; - case 43113: - case 43114: - return ; - default: - return ; - } - })(); - - return <>{icon}; -}; diff --git a/packages/apps/dashboard/client/src/components/NothingFound/index.ts b/packages/apps/dashboard/client/src/components/NothingFound/index.ts deleted file mode 100644 index 3a4c58b3b9..0000000000 --- a/packages/apps/dashboard/client/src/components/NothingFound/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './NothingFound'; diff --git a/packages/apps/dashboard/client/src/components/PageWrapper/index.ts b/packages/apps/dashboard/client/src/components/PageWrapper/index.ts deleted file mode 100644 index ee1a8716a0..0000000000 --- a/packages/apps/dashboard/client/src/components/PageWrapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './PageWrapper'; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/index.ts b/packages/apps/dashboard/client/src/components/SearchResults/index.ts deleted file mode 100644 index 46e0669dbc..0000000000 --- a/packages/apps/dashboard/client/src/components/SearchResults/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './TitleSectionWrapper'; diff --git a/packages/apps/dashboard/client/src/components/ShadowIcon/index.ts b/packages/apps/dashboard/client/src/components/ShadowIcon/index.ts deleted file mode 100644 index fbddef1da6..0000000000 --- a/packages/apps/dashboard/client/src/components/ShadowIcon/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './ShadowIcon'; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx deleted file mode 100644 index 8901834946..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Box } from '@mui/material'; - -import AbbreviateClipboard from '@/components/SearchResults/AbbreviateClipboard'; - -export const AddressCell = ({ - chainId, - address, -}: { - chainId: string; - address: string; -}) => ( - - - -); diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx deleted file mode 100644 index 9da3ec67f6..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { Typography } from '@mui/material'; - -import { NetworkIcon } from '@/components/NetworkIcon'; -import { getNetwork } from '@/utils/config/networks'; - -export const ChainCell = ({ chainId }: { chainId: number }) => ( - - - {getNetwork(chainId)?.name} - -); diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx deleted file mode 100644 index 009c31990b..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Role } from '@human-protocol/sdk'; - -import { ExchangeOracleIcon } from '@/components/Icons/ExchangeOracleIcon'; -import HumanIcon from '@/components/Icons/HumanIcon'; -import { JobLauncher } from '@/components/Icons/JobLauncher'; -import { RecordingOracle } from '@/components/Icons/RecordingOracle'; -import { ReputationOracle } from '@/components/Icons/ReputationOracle'; - -export const EntityIcon: React.FC<{ role: string }> = ({ role }) => { - switch (role) { - case Role.JobLauncher: - return ; - case Role.RecordingOracle: - return ; - case Role.ReputationOracle: - return ; - case Role.ExchangeOracle: - return ; - default: - return ; - } -}; diff --git a/packages/apps/dashboard/client/src/features/graph/api/useChartData.ts b/packages/apps/dashboard/client/src/features/graph/api/useChartData.ts new file mode 100644 index 0000000000..b6e27a522d --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/api/useChartData.ts @@ -0,0 +1,113 @@ +import { useMemo } from 'react'; + +import { useQuery, keepPreviousData } from '@tanstack/react-query'; +import dayjs from 'dayjs'; +import { useDebounce } from 'use-debounce'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { + hcaptchaDailyStatsSchema, + HcaptchaDailyStats, +} from '../model/hcaptchaDailyStatsSchema'; +import { + hmtDailyStatsSchema, + HMTDailyStats, +} from '../model/hmtDailyStatsSchema'; + +export type ChartData = (HMTDailyStats & Omit)[]; + +const mergeResponses = ( + hcaptchaStatsResults: HcaptchaDailyStats[], + hmtStatsResults: HMTDailyStats[] +): ChartData => { + const allDates = Array.from( + new Set([ + ...hcaptchaStatsResults.map(({ date }) => date), + ...hmtStatsResults.map(({ date }) => date), + ]) + ).sort((a, b) => (dayjs(a).isBefore(dayjs(b)) ? -1 : 1)); + + const hcaptchaStatsResultsMap = new Map(); + const hmtStatsResultsMap = new Map(); + + hcaptchaStatsResults.forEach((entry) => { + hcaptchaStatsResultsMap.set(entry.date, entry); + }); + + hmtStatsResults.forEach((entry) => { + hmtStatsResultsMap.set(entry.date, entry); + }); + + return allDates.map((date) => { + const hmtStatsEntry: HMTDailyStats = hmtStatsResultsMap.get(date) || { + dailyUniqueReceivers: 0, + dailyUniqueSenders: 0, + date: date, + totalTransactionAmount: 0, + totalTransactionCount: 0, + }; + + const hcaptchaStatsEntry: HcaptchaDailyStats = hcaptchaStatsResultsMap.get( + date + ) || { + date: date, + solved: 0, + }; + + return { ...hmtStatsEntry, ...hcaptchaStatsEntry }; + }); +}; + +const DEBOUNCE_MS = 300; + +const useChartData = (from: dayjs.Dayjs, to: dayjs.Dayjs) => { + const queryParams = useMemo( + () => ({ + from: from.format('YYYY-MM-DD'), + to: to.format('YYYY-MM-DD'), + }), + [from, to] + ); + + const [debouncedQueryParams] = useDebounce(queryParams, DEBOUNCE_MS); + + return useQuery({ + queryFn: async () => { + const { data: hmtDailyStats } = await httpClient.get( + apiPaths.hmtDailyStats.path, + { + params: debouncedQueryParams, + } + ); + const { data: hcaptchDailyStats } = await httpClient.get( + apiPaths.hcaptchaStatsDaily.path, + { + params: debouncedQueryParams, + } + ); + + const validHmtDailyStats = validateResponse( + hmtDailyStats, + hmtDailyStatsSchema + ); + + const validHcaptchaGeneralStats = validateResponse( + hcaptchDailyStats, + hcaptchaDailyStatsSchema + ); + + return mergeResponses( + validHcaptchaGeneralStats.results, + validHmtDailyStats.results + ); + }, + staleTime: DEBOUNCE_MS, + queryKey: ['useChartData', debouncedQueryParams], + placeholderData: keepPreviousData, + }); +}; + +export default useChartData; diff --git a/packages/apps/dashboard/client/src/features/graph/index.ts b/packages/apps/dashboard/client/src/features/graph/index.ts new file mode 100644 index 0000000000..9cb08db244 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/index.ts @@ -0,0 +1 @@ +export { default } from './ui/AreaChart'; diff --git a/packages/apps/dashboard/client/src/helpers/formatDate.ts b/packages/apps/dashboard/client/src/features/graph/lib/formatDate.ts similarity index 52% rename from packages/apps/dashboard/client/src/helpers/formatDate.ts rename to packages/apps/dashboard/client/src/features/graph/lib/formatDate.ts index d2cf178433..eee127a6ab 100644 --- a/packages/apps/dashboard/client/src/helpers/formatDate.ts +++ b/packages/apps/dashboard/client/src/features/graph/lib/formatDate.ts @@ -1,5 +1,7 @@ import dayjs from 'dayjs'; -export const formatDate = (date: string, dateFormat?: string) => { +const formatDate = (date: string, dateFormat?: string) => { return dayjs(new Date(date)).format(dateFormat ?? 'dd/MM/yyyy'); }; + +export default formatDate; diff --git a/packages/apps/dashboard/client/src/helpers/formatNumber.ts b/packages/apps/dashboard/client/src/features/graph/lib/formatNumber.ts similarity index 72% rename from packages/apps/dashboard/client/src/helpers/formatNumber.ts rename to packages/apps/dashboard/client/src/features/graph/lib/formatNumber.ts index 029a6ae604..c4a391b9d8 100644 --- a/packages/apps/dashboard/client/src/helpers/formatNumber.ts +++ b/packages/apps/dashboard/client/src/features/graph/lib/formatNumber.ts @@ -1,4 +1,4 @@ -export const formatNumber = (number: number) => { +const formatNumber = (number: number) => { if (number >= 1000000) { return `${(number / 1000000).toFixed()} M`; } @@ -9,3 +9,5 @@ export const formatNumber = (number: number) => { return `${number.toString()}`; }; + +export default formatNumber; diff --git a/packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts b/packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts new file mode 100644 index 0000000000..6b8d16a1ac --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts @@ -0,0 +1,18 @@ +import { z } from 'zod'; + +export const hcaptchaDailyStatsSchema = z.object({ + from: z.string().optional(), + to: z.string().optional(), + results: z.array( + z.object({ + solved: z.number(), + date: z.string(), + }) + ), +}); + +export type HcaptchaDailyStatsResponse = z.infer< + typeof hcaptchaDailyStatsSchema +>; + +export type HcaptchaDailyStats = HcaptchaDailyStatsResponse['results'][number]; diff --git a/packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts b/packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts new file mode 100644 index 0000000000..5e4a86629a --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts @@ -0,0 +1,29 @@ +import { z } from 'zod'; + +export const hmtDailyStatsSchema = z.object({ + from: z.string().optional(), + to: z.string().optional(), + results: z.array( + z.object({ + totalTransactionAmount: z.string().transform((value, ctx) => { + const valueAsNumber = Number(value); + if (Number.isNaN(valueAsNumber)) { + ctx.addIssue({ + path: ['totalTransactionAmount'], + code: z.ZodIssueCode.custom, + }); + } + + return valueAsNumber / 10 ** 18; + }), + totalTransactionCount: z.number(), + dailyUniqueSenders: z.number(), + dailyUniqueReceivers: z.number(), + date: z.string(), + }) + ), +}); + +export type HMTDailyStatsResponse = z.output; + +export type HMTDailyStats = HMTDailyStatsResponse['results'][number]; diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx b/packages/apps/dashboard/client/src/features/graph/store/useChartParamsStore.ts similarity index 96% rename from packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx rename to packages/apps/dashboard/client/src/features/graph/store/useChartParamsStore.ts index 0869e4dc69..7755ed615d 100644 --- a/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx +++ b/packages/apps/dashboard/client/src/features/graph/store/useChartParamsStore.ts @@ -58,7 +58,7 @@ const INITIAL_RANGE_PARAMS = { to: dayjs(), }; -export const useGraphPageChartParams = create((set) => ({ +const useChartParamsStore = create((set) => ({ dateRangeParams: INITIAL_RANGE_PARAMS, selectedTimePeriod: '1W', setFromDate: (fromDate: Dayjs | null) => { @@ -116,3 +116,5 @@ export const useGraphPageChartParams = create((set) => ({ })); }, })); + +export default useChartParamsStore; diff --git a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx b/packages/apps/dashboard/client/src/features/graph/ui/AreaChart.tsx similarity index 90% rename from packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/AreaChart.tsx index 36f5fa95b1..73a297367d 100644 --- a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/AreaChart.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; +import { FC, useEffect, useRef, useState } from 'react'; import { Typography, useTheme } from '@mui/material'; import Card from '@mui/material/Card'; @@ -14,34 +14,35 @@ import { ResponsiveContainer, } from 'recharts'; -import CustomXAxisTick from '@/components/Charts/CustomXAxisTick'; -import ToggleCharts from '@/components/Charts/ToggleCharts'; -import DatePicker from '@/components/DataEntry/DatePicker'; -import ToggleButtons from '@/components/DataEntry/ToggleButtons'; -import { formatNumber } from '@/helpers/formatNumber'; -import { - GraphPageChartData, - useGraphPageChartData, -} from '@/services/api/use-graph-page-chart-data'; -import { +import DatePicker from '@/shared/ui/DatePicker'; + +import useChartData, { ChartData } from '../api/useChartData'; +import formatNumber from '../lib/formatNumber'; +import useChartParamsStore, { initialAllTime, - useGraphPageChartParams, -} from '@/utils/hooks/use-graph-page-chart-params'; +} from '../store/useChartParamsStore'; -import CustomChartTooltip from './CustomChartTooltip'; +import ChartTooltip from './ChartTooltip'; +import CustomXAxisTick from './CustomXAxisTick'; +import ToggleButtons from './ToggleButtons'; +import ToggleCharts from './ToggleCharts'; -export type GraphPageChartDataConfigObject = Partial< - Record +export type ChartDataConfigObject = Partial< + Record >; -const CHECKED_CHARTS_DEFAULT_STATE: GraphPageChartDataConfigObject = { +type AreaChartProps = { + changeDateOnScroll?: boolean; +}; + +const CHECKED_CHARTS_DEFAULT_STATE: ChartDataConfigObject = { totalTransactionAmount: true, totalTransactionCount: true, solved: true, dailyUniqueReceivers: true, dailyUniqueSenders: true, }; -const HOVERED_CHARTS_DEFAULT_STATE: GraphPageChartDataConfigObject = { +const HOVERED_CHARTS_DEFAULT_STATE: ChartDataConfigObject = { totalTransactionAmount: false, totalTransactionCount: false, solved: false, @@ -50,12 +51,12 @@ const HOVERED_CHARTS_DEFAULT_STATE: GraphPageChartDataConfigObject = { }; type SumOfNumericChartDataProperties = Record< - keyof Omit, + keyof Omit, number >; const sumNumericProperties = ( - chartData: GraphPageChartData + chartData: ChartData ): SumOfNumericChartDataProperties => { return chartData.reduce( (acc, chartEntry) => { @@ -76,20 +77,16 @@ const sumNumericProperties = ( ); }; -export const AreaChart = ({ - changeDateOnScroll = false, -}: { - changeDateOnScroll?: boolean; -}) => { - const { data } = useGraphPageChartData(); - const theme = useTheme(); - const chartData = data || []; +const AreaChart: FC = ({ changeDateOnScroll = false }) => { const { setFromDate, setToDate, clearTimePeriod, dateRangeParams: { from, to }, - } = useGraphPageChartParams(); + } = useChartParamsStore(); + const { data } = useChartData(from, to); + const theme = useTheme(); + const chartData = data || []; const sum = sumNumericProperties(chartData); const [checkedCharts, setCheckedCharts] = useState( CHECKED_CHARTS_DEFAULT_STATE @@ -314,7 +311,7 @@ export const AreaChart = ({ dataKey="date" tickMargin={10} /> - } /> + } /> {checkedCharts.totalTransactionAmount && ( ); }; + +export default AreaChart; diff --git a/packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx b/packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx new file mode 100644 index 0000000000..a1c474da5b --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx @@ -0,0 +1,85 @@ +import { FC } from 'react'; + +import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; +import { Grid, Typography } from '@mui/material'; +import Box from '@mui/material/Box'; +import Card from '@mui/material/Card'; +import Stack from '@mui/material/Stack'; +import { TooltipProps } from 'recharts'; + +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import formatDate from '../lib/formatDate'; + +import { ChartDataConfigObject } from './AreaChart'; + +const renderTitle = (title: string) => { + const currentTitle: ChartDataConfigObject = { + totalTransactionAmount: 'Transfer Amount', + totalTransactionCount: 'Transactions Count', + solved: 'Number of Tasks', + dailyUniqueReceivers: 'Unique Receivers', + dailyUniqueSenders: 'Unique Senders', + }; + return currentTitle[title as keyof ChartDataConfigObject]; +}; + +const ChartTooltip: FC> = ({ + payload, + label, + active, +}) => { + if (!active) return null; + + return ( + + + + {formatDate(label, 'MMMM DD, YYYY')} + + {payload?.map((elem) => ( + + + + + + {renderTitle(elem.name ?? '')} + + + + + + {' '} + {elem.name === 'totalTransactionAmount' ? 'HMT' : ''} + + + + ))} + + + ); +}; + +export default ChartTooltip; diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx b/packages/apps/dashboard/client/src/features/graph/ui/CustomXAxisTick.tsx similarity index 91% rename from packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/CustomXAxisTick.tsx index 3cdcc81b5b..7d351507c6 100644 --- a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/CustomXAxisTick.tsx @@ -2,7 +2,7 @@ import { useTheme } from '@mui/material'; // @ts-expect-error -- import error, but this type work property import { ContentRenderer } from 'recharts'; -import { formatDate } from '@/helpers/formatDate'; +import formatDate from '../lib/formatDate'; const CustomXAxisTick = ({ x, y, payload }: ContentRenderer) => { const theme = useTheme(); diff --git a/packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx b/packages/apps/dashboard/client/src/features/graph/ui/GraphSwiper.tsx similarity index 81% rename from packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/GraphSwiper.tsx index cb42b9e8f5..67775b3f45 100644 --- a/packages/apps/dashboard/client/src/components/Home/GraphSwiper.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/GraphSwiper.tsx @@ -1,17 +1,22 @@ -import { useEffect } from 'react'; +import { FC, useEffect } from 'react'; import { Navigation } from 'swiper/modules'; import { Swiper, SwiperSlide } from 'swiper/react'; -import SmallGraph from '@/components/Home/SmallGraph'; import 'swiper/css'; import 'swiper/css/navigation'; -import { useGraphPageChartData } from '@/services/api/use-graph-page-chart-data'; -import { useGraphPageChartParams } from '@/utils/hooks/use-graph-page-chart-params'; -const GraphSwiper = () => { - const { data } = useGraphPageChartData(); - const { revertToInitialParams } = useGraphPageChartParams(); +import useChartData from '../api/useChartData'; +import useChartParamsStore from '../store/useChartParamsStore'; + +import SmallGraph from './SmallGraph'; + +const GraphSwiper: FC = () => { + const { + revertToInitialParams, + dateRangeParams: { from, to }, + } = useChartParamsStore(); + const { data } = useChartData(from, to); useEffect(() => { revertToInitialParams(); diff --git a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx b/packages/apps/dashboard/client/src/features/graph/ui/SmallGraph.tsx similarity index 70% rename from packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/SmallGraph.tsx index ba5b9cd44e..f03d15b7d0 100644 --- a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/SmallGraph.tsx @@ -1,4 +1,4 @@ -import { Fragment } from 'react'; +import { FC, Fragment } from 'react'; import { useTheme } from '@mui/material'; import Box from '@mui/material/Box'; @@ -16,50 +16,51 @@ import { TooltipProps, } from 'recharts'; -import ToggleButtons from '@/components/DataEntry/ToggleButtons'; -import { formatDate } from '@/helpers/formatDate'; -import { formatNumber } from '@/helpers/formatNumber'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; -const CustomSmallChartTooltip = ({ +import formatDate from '../lib/formatDate'; +import formatNumber from '../lib/formatNumber'; + +import ToggleButtons from './ToggleButtons'; + +const CustomSmallChartTooltip: FC> = ({ payload, active, -}: TooltipProps) => { - if (active) { - return ( - - - {payload?.map((elem) => ( - - - {formatDate(elem.payload.date, 'MMMM DD, YYYY')} - - - {elem.value ? elem.value.toLocaleString('en-US') : ''} - - - ))} - - - ); - } - return null; +}) => { + if (!active) return null; + + return ( + + + {payload?.map((elem) => ( + + + {formatDate(elem.payload.date, 'MMMM DD, YYYY')} + + + {elem.value ? elem.value.toLocaleString('en-US') : ''} + + + ))} + + + ); }; -interface SmallGraphProps { +type SmallGraphProps = { graphData: { date: string; value: number; }[]; title: string; -} +}; const GraphSettings = ({ title }: { title: string }) => ( ( ); -const SmallGraph = ({ title, graphData }: SmallGraphProps) => { +const SmallGraph: FC = ({ title, graphData }) => { const isMobile = useIsMobile(); const theme = useTheme(); diff --git a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx b/packages/apps/dashboard/client/src/features/graph/ui/ToggleButtons.tsx similarity index 93% rename from packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/ToggleButtons.tsx index 29c523d3d9..9ef5a320b4 100644 --- a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/ToggleButtons.tsx @@ -4,11 +4,10 @@ import ToggleButton from '@mui/material/ToggleButton'; import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; import dayjs from 'dayjs'; -import { +import useChartParamsStore, { TIME_PERIOD_OPTIONS, TimePeriod, - useGraphPageChartParams, -} from '@/utils/hooks/use-graph-page-chart-params'; +} from '../store/useChartParamsStore'; export const StyledToggleButtonGroup = styled(ToggleButtonGroup)( ({ theme }) => ({ @@ -26,7 +25,7 @@ export const StyledToggleButtonGroup = styled(ToggleButtonGroup)( const ToggleButtons = () => { const { setTimePeriod, selectedTimePeriod, dateRangeParams } = - useGraphPageChartParams(); + useChartParamsStore(); const checkIfSelected = (element: TimePeriod) => { if (element.name !== 'ALL') { diff --git a/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx b/packages/apps/dashboard/client/src/features/graph/ui/ToggleCharts.tsx similarity index 90% rename from packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/ToggleCharts.tsx index 58d2196304..b699b14f8d 100644 --- a/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/ToggleCharts.tsx @@ -1,8 +1,10 @@ +import { FC } from 'react'; + import { FormControlLabel, FormGroup, Typography } from '@mui/material'; import Checkbox from '@mui/material/Checkbox'; import Stack from '@mui/material/Stack'; -import { FormatNumber } from '@/components/Home/FormatNumber'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; interface ToggleChartsProps { handleChange: (event: React.ChangeEvent) => void; @@ -17,12 +19,12 @@ interface ToggleChartsProps { }[]; } -const ToggleCharts = ({ +const ToggleCharts: FC = ({ handleChange, chartOptions, onMouseLeave, onMouseEnter, -}: ToggleChartsProps) => { +}) => { return ( {elem.title} - {elem.amount ? : 0} + {elem.amount ? : 0} {elem.name === 'totalTransactionAmount' && elem.isAreaChart && ( { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get(apiPaths.generalStats.path); + + const validResponse = validateResponse(data, generalStatsResponseSchema); + + return validResponse; + }, + queryKey: ['useGeneralStats'], + }); +}; + +export default useGeneralStats; diff --git a/packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts b/packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts new file mode 100644 index 0000000000..afd902db3f --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts @@ -0,0 +1,25 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { hcaptchaGeneralStatsResponseSchema } from '../model/hcaptchaGeneralStats'; + +const useHcaptchaGeneralStats = () => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get(apiPaths.hcaptchaGeneralStats.path); + + const validResponse = validateResponse( + data, + hcaptchaGeneralStatsResponseSchema + ); + + return validResponse; + }, + queryKey: ['useHcaptchaGeneralStats'], + }); +}; + +export default useHcaptchaGeneralStats; diff --git a/packages/apps/dashboard/client/src/features/home/model/generalStats.ts b/packages/apps/dashboard/client/src/features/home/model/generalStats.ts new file mode 100644 index 0000000000..367015e609 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/model/generalStats.ts @@ -0,0 +1,8 @@ +import { z } from 'zod'; + +export const generalStatsResponseSchema = z.object({ + totalHolders: z.number(), + totalTransactions: z.number(), +}); + +export type GeneralStats = z.infer; diff --git a/packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts b/packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts new file mode 100644 index 0000000000..28e0722769 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts @@ -0,0 +1,9 @@ +import { z } from 'zod'; + +export const hcaptchaGeneralStatsResponseSchema = z.object({ + solved: z.number(), +}); + +export type HcaptchaGeneralStats = z.infer< + typeof hcaptchaGeneralStatsResponseSchema +>; diff --git a/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx b/packages/apps/dashboard/client/src/features/home/ui/HmtPrice.tsx similarity index 69% rename from packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx rename to packages/apps/dashboard/client/src/features/home/ui/HmtPrice.tsx index 0d7236c038..5adbc00b5f 100644 --- a/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx +++ b/packages/apps/dashboard/client/src/features/home/ui/HmtPrice.tsx @@ -1,10 +1,10 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { useHMTPrice } from '../../services/api/use-hmt-price'; +import useHmtPrice from '@/shared/api/useHmtPrice'; -const HMTPrice = () => { - const { data, isError, isPending, isSuccess } = useHMTPrice(); +const HmtPrice = () => { + const { data, isError, isPending, isSuccess } = useHmtPrice(); return ( @@ -18,4 +18,4 @@ const HMTPrice = () => { ); }; -export default HMTPrice; +export default HmtPrice; diff --git a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx b/packages/apps/dashboard/client/src/features/home/ui/Holders.tsx similarity index 70% rename from packages/apps/dashboard/client/src/pages/Home/Holders.tsx rename to packages/apps/dashboard/client/src/features/home/ui/Holders.tsx index 0fc3d025f8..ed62824cce 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx +++ b/packages/apps/dashboard/client/src/features/home/ui/Holders.tsx @@ -1,8 +1,9 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@/components/Home/FormatNumber'; -import { useGeneralStats } from '@/services/api/use-general-stats'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import useGeneralStats from '../api/useGeneralStats'; const Holders = () => { const { data, isSuccess, isPending, isError } = useGeneralStats(); @@ -11,7 +12,7 @@ const Holders = () => { Holders - {isSuccess && } + {isSuccess && } {isPending && '...'} {isError && 'No data'} diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx b/packages/apps/dashboard/client/src/features/home/ui/TotalNumberOfTasks.tsx similarity index 71% rename from packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx rename to packages/apps/dashboard/client/src/features/home/ui/TotalNumberOfTasks.tsx index 83783a3a35..715d56712c 100644 --- a/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx +++ b/packages/apps/dashboard/client/src/features/home/ui/TotalNumberOfTasks.tsx @@ -1,8 +1,9 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@/components/Home/FormatNumber'; -import { useHcaptchaGeneralStats } from '@/services/api/use-hcaptcha-general-stats'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import useHcaptchaGeneralStats from '../api/useHcaptchaGeneralStats'; const TotalNumberOfTasks = () => { const { data, isError, isPending, isSuccess } = useHcaptchaGeneralStats(); @@ -11,7 +12,7 @@ const TotalNumberOfTasks = () => { Total Number of Tasks - {isSuccess && } + {isSuccess && } {isPending && '...'} {isError && 'No data'} diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx b/packages/apps/dashboard/client/src/features/home/ui/TotalTransactions.tsx similarity index 71% rename from packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx rename to packages/apps/dashboard/client/src/features/home/ui/TotalTransactions.tsx index 3e2959c3ed..5bd9a31a0c 100644 --- a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx +++ b/packages/apps/dashboard/client/src/features/home/ui/TotalTransactions.tsx @@ -1,8 +1,9 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@/components/Home/FormatNumber'; -import { useGeneralStats } from '@/services/api/use-general-stats'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import useGeneralStats from '../api/useGeneralStats'; const TotalTransactions = () => { const { data, isError, isPending, isSuccess } = useGeneralStats(); @@ -11,7 +12,7 @@ const TotalTransactions = () => { Total Transactions - {isSuccess && } + {isSuccess && } {isPending && '...'} {isError && 'No data'} diff --git a/packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts b/packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts new file mode 100644 index 0000000000..6c2e3a4457 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts @@ -0,0 +1,28 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { leaderboardResponseSchema } from '../model/leaderboardSchema'; + +const useLeaderboardDetails = (chainId: number, first?: number) => { + return useQuery({ + queryFn: async () => { + if (chainId === -1) { + return []; + } + + const { data } = await httpClient.get(apiPaths.leaderboardDetails.path, { + params: { chainId, first }, + }); + + const validResponse = validateResponse(data, leaderboardResponseSchema); + + return validResponse; + }, + queryKey: ['useLeaderboardDetails', chainId, first], + }); +}; + +export default useLeaderboardDetails; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/index.ts b/packages/apps/dashboard/client/src/features/leaderboard/index.ts new file mode 100644 index 0000000000..9959a98e9f --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/index.ts @@ -0,0 +1 @@ +export { default } from './ui/Leaderboard'; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts b/packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts new file mode 100644 index 0000000000..03bb6609f7 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts @@ -0,0 +1,48 @@ +import { z } from 'zod'; + +export const reputationSchema = z.unknown().transform((value) => { + try { + const knownReputation = z + .union([z.literal('Low'), z.literal('Medium'), z.literal('High')]) + .parse(value); + + return knownReputation; + } catch (error) { + console.error(error); + return 'Unknown'; + } +}); + +export type Reputation = z.infer; + +const leaderboardEntity = z.object({ + address: z.string(), + role: z.string(), + amountStaked: z + .string() + .transform((value, ctx) => { + const valueAsNumber = Number(value); + + if (Number.isNaN(valueAsNumber)) { + ctx.addIssue({ + path: ['amountStaked'], + code: z.ZodIssueCode.custom, + }); + } + + return valueAsNumber / 10 ** 18; + }) + .nullable(), + reputation: reputationSchema, + fee: z.number().nullable(), + jobTypes: z.array(z.string()).nullable(), + url: z.string().nullable(), + website: z.string().nullable(), + chainId: z.number(), + name: z.string().nullable(), + category: z.string().nullable(), +}); + +export const leaderboardResponseSchema = z.array(leaderboardEntity); +export type LeaderboardEntity = z.infer; +export type LeaderboardData = z.infer; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts b/packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts new file mode 100644 index 0000000000..7b8d2b28c5 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts @@ -0,0 +1,15 @@ +import { create } from 'zustand'; + +type LeaderboardFiltersStore = { + chainId: number; + setChainId: (chainId: number) => void; +}; + +const useLeaderboardFiltersStore = create((set) => ({ + chainId: -1, + setChainId: (chainId) => { + set({ chainId }); + }, +})); + +export default useLeaderboardFiltersStore; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx new file mode 100644 index 0000000000..f2935aa8fa --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx @@ -0,0 +1,22 @@ +import { FC } from 'react'; + +import { ChainId } from '@human-protocol/sdk'; +import Box from '@mui/material/Box'; + +import AbbreviateClipboard from '@/shared/ui/AbbreviateClipboard'; + +type Props = { + chainId: ChainId; + address: string; +}; + +const AddressCell: FC = ({ chainId, address }) => ( + + + +); + +export default AddressCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/CategoryCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/CategoryCell.tsx similarity index 75% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/CategoryCell.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/CategoryCell.tsx index 92392ed41f..aff8549534 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/CategoryCell.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/CategoryCell.tsx @@ -1,19 +1,11 @@ -import { Chip, Box } from '@mui/material'; +import { FC } from 'react'; -interface CategoryCellProps { - value?: string; -} +import Box from '@mui/material/Box'; +import Chip from '@mui/material/Chip'; -export const CategoryCell = ({ value }: CategoryCellProps) => - value?.length ? ( - - - - ) : null; +type CategoryCellProps = { + value?: string; +}; const getCategoryLabel = (category: string) => { switch (category) { @@ -36,3 +28,16 @@ const getCategoryColor = (category: string) => { return 'default'; } }; + +const CategoryCell: FC = ({ value }) => + value?.length ? ( + + + + ) : null; + +export default CategoryCell; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx new file mode 100644 index 0000000000..028b9dcaf2 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx @@ -0,0 +1,29 @@ +import { FC } from 'react'; + +import { ChainId } from '@human-protocol/sdk'; +import Typography from '@mui/material/Typography'; + +import { getNetwork } from '@/shared/lib/networks'; +import { NetworkIcon } from '@/shared/ui/NetworkIcon'; + +type Props = { + chainId: ChainId; +}; + +const ChainCell: FC = ({ chainId }) => ( + + + {getNetwork(chainId)?.name} + +); + +export default ChainCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/DataGridWrapper.tsx similarity index 84% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/DataGridWrapper.tsx index 16ce2f550d..bc71c3b905 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/DataGridWrapper.tsx @@ -1,22 +1,23 @@ -import { Box, Typography } from '@mui/material'; +import { FC } from 'react'; + +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; import { DataGrid } from '@mui/x-data-grid'; -import Loader from '@/components/Loader'; -import { LeaderBoardData } from '@/services/api/use-leaderboard-details'; -import { handleErrorMessage } from '@/services/handle-error-message'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import Loader from '@/shared/ui/Loader'; -import useDataGrid from '../hooks/useDataGrid'; +import { LeaderboardData } from '../model/leaderboardSchema'; +import useDataGrid from '../ui/useDataGrid'; -export const DataGridWrapper = ({ - data = [], - status, - error, -}: { - data: LeaderBoardData | undefined; +type Props = { + data: LeaderboardData | undefined; status: 'success' | 'error' | 'pending'; error: unknown; -}) => { +}; + +const DataGridWrapper: FC = ({ data = [], status, error }) => { const { columns, rows } = useDataGrid(data); const isMobile = useIsMobile(); @@ -117,3 +118,5 @@ export const DataGridWrapper = ({ ); }; + +export default DataGridWrapper; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/Leaderboard.tsx similarity index 66% rename from packages/apps/dashboard/client/src/features/Leaderboard/index.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/Leaderboard.tsx index 75e42c0460..baea7f9a8b 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/Leaderboard.tsx @@ -4,25 +4,22 @@ import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import { useNavigate } from 'react-router-dom'; -import { LeaderBoardData } from '@/services/api/use-leaderboard-details'; +import useLeaderboardDetails from '../api/useLeaderboardDetails'; +import useLeaderboardFiltersStore from '../store/useLeaderboardFiltersStore'; -import { DataGridWrapper } from './components/DataGridWrapper'; -import { SelectNetwork } from './components/SelectNetwork'; +import DataGridWrapper from './DataGridWrapper'; +import SelectNetwork from './SelectNetwork'; type Props = { - data: LeaderBoardData | undefined; - status: 'success' | 'error' | 'pending'; - error: unknown; viewAllBanner?: boolean; + first?: number; }; -export const Leaderboard: FC = ({ - data, - status, - error, - viewAllBanner, -}) => { +const Leaderboard: FC = ({ viewAllBanner, first }) => { const navigate = useNavigate(); + const { chainId } = useLeaderboardFiltersStore(); + const { data, status, error } = useLeaderboardDetails(chainId, first); + return ( = ({ fullWidth sx={{ borderColor: 'primary.main', - cursor: 'pointer', }} onClick={() => navigate('/leaderboard')} > @@ -58,3 +54,5 @@ export const Leaderboard: FC = ({ ); }; + +export default Leaderboard; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/RoleCell.tsx similarity index 72% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/RoleCell.tsx index e2db9ec66b..f65a2a7da4 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/RoleCell.tsx @@ -1,18 +1,29 @@ +import { FC, PropsWithChildren } from 'react'; + import { Launch as LaunchIcon } from '@mui/icons-material'; -import { Box, Typography } from '@mui/material'; +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; import { Link } from 'react-router-dom'; -import { CaseConverter } from '@/utils/case-converter'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; - +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import convertSnakeToHumanReadable from '@/shared/lib/convertSnakeToHumanReadable'; +import EntityIcon from '@/shared/ui/EntityIcon'; -import { EntityIcon } from './EntityIcon'; +type WrapperProps = { + websiteUrl?: string; +}; +type Props = { + rank: number; + role: string; + websiteUrl?: string; + name?: string; +}; -const Wrapper = ({ - children, +const Wrapper: FC> = ({ websiteUrl, -}: React.PropsWithChildren<{ websiteUrl?: string }>) => { + children, +}) => { return websiteUrl ? ( { +const RoleCell: FC = ({ rank, role, websiteUrl, name }) => { const isMobile = useIsMobile(); - const humanReadableRole = CaseConverter.convertSnakeToHumanReadable(role); + const humanReadableRole = convertSnakeToHumanReadable(role); const formattedName = name ? name.split(' ')[0] : null; return ( @@ -74,3 +75,5 @@ export const RoleCell = ({ ); }; + +export default RoleCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/SelectNetwork.tsx similarity index 83% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/SelectNetwork.tsx index 0ff63569cd..555c9a8b3a 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/SelectNetwork.tsx @@ -7,20 +7,16 @@ import InputLabel from '@mui/material/InputLabel'; import MenuItem from '@mui/material/MenuItem'; import Select, { SelectChangeEvent } from '@mui/material/Select'; -import { NetworkIcon } from '@/components/NetworkIcon'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; -import { useFilteredNetworks } from '@/utils/hooks/use-filtered-networks'; -import { useLeaderboardSearch } from '@/utils/hooks/use-leaderboard-search'; +import useFilteredNetworks from '@/shared/api/useFilteredNetworks'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import { NetworkIcon } from '@/shared/ui/NetworkIcon'; +import useLeaderboardFiltersStore from '../store/useLeaderboardFiltersStore'; - -export const SelectNetwork = () => { - const { - setChainId, - filterParams: { chainId }, - } = useLeaderboardSearch(); - +const SelectNetwork = () => { + const { chainId, setChainId } = useLeaderboardFiltersStore(); const { filteredNetworks, isLoading } = useFilteredNetworks(); + const isMobile = useIsMobile(); useEffect(() => { if (chainId === -1 && filteredNetworks.length > 0) { @@ -28,8 +24,6 @@ export const SelectNetwork = () => { } }, [chainId, filteredNetworks, setChainId]); - const isMobile = useIsMobile(); - const handleChange = (event: SelectChangeEvent) => { const value = Number(event.target.value); setChainId(value); diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/TextCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/TextCell.tsx similarity index 52% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/TextCell.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/TextCell.tsx index 0daad03b1a..a3f78f9ebf 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/TextCell.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/TextCell.tsx @@ -1,10 +1,12 @@ -import { Typography } from '@mui/material'; +import { FC } from 'react'; -interface TextCellProps { +import Typography from '@mui/material/Typography'; + +type TextCellProps = { value: string; -} +}; -export const TextCell = ({ value }: TextCellProps) => ( +const TextCell: FC = ({ value }) => ( ( {value} ); + +export default TextCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/useDataGrid.tsx similarity index 83% rename from packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/useDataGrid.tsx index 01117644a2..f2e2f630f2 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/useDataGrid.tsx @@ -1,21 +1,22 @@ import { useMemo } from 'react'; import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import { Box, Typography } from '@mui/material'; +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid'; -import CustomTooltip from '@/components/CustomTooltip'; -import { LeaderBoardData } from '@/services/api/use-leaderboard-details'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; -import { useLeaderboardSearch } from '@/utils/hooks/use-leaderboard-search'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; -import { AddressCell } from '../components/AddressCell'; -import { CategoryCell } from '../components/CategoryCell'; -import { ChainCell } from '../components/ChainCell'; -import { RoleCell } from '../components/RoleCell'; -import { SelectNetwork } from '../components/SelectNetwork'; -import { TextCell } from '../components/TextCell'; +import { LeaderboardData } from '../model/leaderboardSchema'; +import useLeaderboardFiltersStore from '../store/useLeaderboardFiltersStore'; +import AddressCell from './AddressCell'; +import CategoryCell from './CategoryCell'; +import ChainCell from './ChainCell'; +import RoleCell from './RoleCell'; +import SelectNetwork from './SelectNetwork'; +import TextCell from './TextCell'; const InfoTooltip = ({ title }: { title: string }) => ( @@ -27,11 +28,8 @@ const InfoTooltip = ({ title }: { title: string }) => ( ); -const useDataGrid = (data: LeaderBoardData) => { - const { - filterParams: { chainId }, - } = useLeaderboardSearch(); - +const useDataGrid = (data: LeaderboardData) => { + const { chainId } = useLeaderboardFiltersStore(); const isMobile = useIsMobile(); const formattedData = useMemo(() => { diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts new file mode 100644 index 0000000000..547adb1331 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts @@ -0,0 +1,29 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { addressDetailsResponseSchema } from '../model/addressDetailsSchema'; + +const useAddressDetails = (chainId: number, address: string) => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.addressDetails.path}/${address}`, + { params: { chainId: chainId || -1 } } + ); + + const validResponse = validateResponse( + data, + addressDetailsResponseSchema + ); + + return validResponse; + }, + queryKey: ['useAddressDetails', address, chainId], + enabled: !!chainId && !!address, + }); +}; + +export default useAddressDetails; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts new file mode 100644 index 0000000000..2c946b1b69 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts @@ -0,0 +1,79 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { paginatedEscrowDetailsSchema } from '../model/escrowDetailsSchema'; + +type Props = { + role: string | null; + chainId: number; + address: string; + page: number; + lastPageIndex: number | undefined; + setLastPageIndex: (lastPageIndex: number | undefined) => void; + params: { + skip: number; + first: number; + }; +}; + +const useEscrowDetails = ({ + role, + chainId, + address, + page, + lastPageIndex, + setLastPageIndex, + params, +}: Props) => { + const dto = { + chainId, + role, + skip: params.skip, + first: params.first, + }; + + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.escrowDetails.path}/${address}`, + { params: dto } + ); + + const validResponse = validateResponse( + data, + paginatedEscrowDetailsSchema + ); + + // check if last page + if (lastPageIndex === undefined) { + const { data: lastPageCheckData } = await httpClient.get( + `${apiPaths.escrowDetails.path}/${address}`, + { + params: { + ...dto, + skip: dto.skip + validResponse.results.length, + first: 1, + }, + } + ); + const validLastPageCheckData = validateResponse( + lastPageCheckData, + paginatedEscrowDetailsSchema + ); + + if (validLastPageCheckData.results.length === 0) { + setLastPageIndex(page + 1); + } + } + + return validResponse; + }, + queryKey: ['useEscrowDetails', address, dto], + enabled: !!chainId && !!address, + }); +}; + +export default useEscrowDetails; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts new file mode 100644 index 0000000000..056bb530ee --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts @@ -0,0 +1,26 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { kvstoreDataSchema } from '../model/kvStoreDataSchema'; + +const useKvstoreData = (chainId: number, address: string) => { + return useQuery({ + queryKey: ['kvstoreData', address], + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.kvstore.path}/${address}`, + { params: { chain_id: chainId || -1 } } + ); + + const validResponse = validateResponse(data, kvstoreDataSchema); + + return validResponse; + }, + enabled: !!chainId && !!address, + }); +}; + +export default useKvstoreData; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts new file mode 100644 index 0000000000..eee96a4a69 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts @@ -0,0 +1,78 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { paginatedTransactionDetailsSchema } from '../model/transactionDetailsSchema'; + +type Props = { + chainId: number; + address: string; + page: number; + lastPageIndex: number | undefined; + setLastPageIndex: (lastPageIndex: number | undefined) => void; + params: { + skip: number; + first: number; + }; +}; + +const useTransactionDetails = ({ + chainId, + address, + page, + lastPageIndex, + setLastPageIndex, + params, +}: Props) => { + const dto = { + chainId, + skip: params.skip, + first: params.first, + }; + + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.transactionDetails.path}/${address}`, + { + params: dto, + } + ); + + const validResponse = validateResponse( + data, + paginatedTransactionDetailsSchema + ); + + // check if last page + if (lastPageIndex === undefined) { + const { data: lastPageCheckData } = await httpClient.get( + `${apiPaths.transactionDetails.path}/${address}`, + { + params: { + ...dto, + skip: dto.skip + validResponse.results.length, + first: 1, + }, + } + ); + const validLastPageCheckData = validateResponse( + lastPageCheckData, + paginatedTransactionDetailsSchema + ); + + if (validLastPageCheckData.results.length === 0) { + setLastPageIndex(page + 1); + } + } + + return validResponse; + }, + queryKey: ['useTransactionDetails', address, dto], + enabled: !!chainId && !!address, + }); +}; + +export default useTransactionDetails; diff --git a/packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts b/packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts new file mode 100644 index 0000000000..342dc03695 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts @@ -0,0 +1,66 @@ +import { useCallback, useState } from 'react'; + +type PaginationState = { + params: { + first: number; + skip: number; + }; + pagination: { + page: number; + pageSize: number; + lastPageIndex?: number; + }; + setNextPage: () => void; + setPrevPage: () => void; + setPageSize: (pageSize: number) => void; + setLastPageIndex: (lastPageIndex: number | undefined) => void; +}; + +const INITIAL_PAGE_SIZE = 10; + +const usePagination = (): PaginationState => { + const [page, setPage] = useState(0); + const [pageSize, setPageSize] = useState(INITIAL_PAGE_SIZE); + const [lastPageIndex, setLastPageIndex] = useState(); + + const skip = page * pageSize; + + const setNextPage = useCallback(() => { + setPage((prev) => prev + 1); + }, []); + + const setPrevPage = useCallback(() => { + setPage((prev) => Math.max(0, prev - 1)); + }, []); + + const handleSetPageSize = useCallback((newPageSize: number) => { + setPageSize(newPageSize); + setPage(0); + setLastPageIndex(undefined); + }, []); + + const handleSetLastPageIndex = useCallback( + (newLastPageIndex: number | undefined) => { + setLastPageIndex(newLastPageIndex); + }, + [] + ); + + return { + params: { + first: pageSize, + skip, + }, + pagination: { + page, + pageSize, + lastPageIndex, + }, + setNextPage, + setPrevPage, + setPageSize: handleSetPageSize, + setLastPageIndex: handleSetLastPageIndex, + }; +}; + +export default usePagination; diff --git a/packages/apps/dashboard/client/src/features/searchResults/index.ts b/packages/apps/dashboard/client/src/features/searchResults/index.ts new file mode 100644 index 0000000000..5d2cfb86b4 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/index.ts @@ -0,0 +1 @@ +export { default } from './ui/SearchResults'; diff --git a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx b/packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts similarity index 74% rename from packages/apps/dashboard/client/src/services/api/use-address-details.tsx rename to packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts index 179bfd2641..42d7f3881d 100644 --- a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts @@ -1,13 +1,7 @@ import { Role } from '@human-protocol/sdk'; -import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { reputationSchema } from '@/services/api/use-leaderboard-details'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; -import { validateResponse } from '../validate-response'; +import { reputationSchema } from '@/features/leaderboard/model/leaderboardSchema'; const transformOptionalTokenAmount = ( value: string | undefined | null, @@ -70,7 +64,7 @@ const escrowSchema = z.object({ finalResultsUrl: z.string().nullable(), }); -export type AddressDetailsEscrowSchema = z.infer; +export type AddressDetailsEscrow = z.infer; const operatorSchema = z.object({ chainId: z.number(), @@ -101,32 +95,10 @@ const operatorSchema = z.object({ export type AddressDetailsOperator = z.infer; -const addressDetailsResponseSchema = z.object({ +export const addressDetailsResponseSchema = z.object({ wallet: z.optional(walletSchema), escrow: z.optional(escrowSchema), operator: z.optional(operatorSchema), }); export type AddressDetails = z.infer; - -export function useAddressDetails() { - const { filterParams } = useWalletSearch(); - - return useQuery({ - queryFn: async () => { - const address = filterParams.address || '0x0'; - const { data } = await httpService.get( - `${apiPaths.addressDetails.path}/${address}`, - { params: { chainId: filterParams.chainId || -1 } } - ); - - const validResponse = validateResponse( - data, - addressDetailsResponseSchema - ); - - return validResponse; - }, - queryKey: ['useAddressDetails', filterParams.address, filterParams.chainId], - }); -} diff --git a/packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts b/packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts new file mode 100644 index 0000000000..2299f070b5 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts @@ -0,0 +1,21 @@ +import { z } from 'zod'; + +const escrowDetailsSchema = z.object({ + chainId: z.number(), + address: z.string(), + status: z.string(), +}); + +export type EscrowDetails = z.infer; + +export const paginatedEscrowDetailsSchema = z.object({ + address: z.string(), + chainId: z.number(), + first: z.number(), + skip: z.number(), + results: z.array(escrowDetailsSchema), +}); + +export type PaginatedEscrowDetails = z.infer< + typeof paginatedEscrowDetailsSchema +>; diff --git a/packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts b/packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts new file mode 100644 index 0000000000..35c8f60378 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts @@ -0,0 +1,10 @@ +import { z } from 'zod'; + +export const kvstoreDataSchema = z.array( + z.object({ + key: z.string(), + value: z.string(), + }) +); + +export type KvstoreData = z.infer; diff --git a/packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts b/packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts new file mode 100644 index 0000000000..810967e0f2 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts @@ -0,0 +1,36 @@ +import { z } from 'zod'; + +const internalTransactionSchema = z.object({ + from: z.string(), + to: z.string(), + value: z.string(), + method: z.string(), + receiver: z.string().nullable(), + escrow: z.string().nullable(), + token: z.string().nullable(), +}); + +const transactionDetailsSchema = z.object({ + txHash: z.string(), + method: z.string(), + from: z.string(), + to: z.string(), + receiver: z.string().nullable(), + block: z.number(), + value: z.string(), + internalTransactions: z.array(internalTransactionSchema), +}); + +export type TransactionDetails = z.infer; + +export const paginatedTransactionDetailsSchema = z.object({ + address: z.string(), + chainId: z.number(), + first: z.number(), + skip: z.number(), + results: z.array(transactionDetailsSchema), +}); + +export type PaginatedTransactionDetails = z.infer< + typeof paginatedTransactionDetailsSchema +>; diff --git a/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/Clipboard.tsx similarity index 89% rename from packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/Clipboard.tsx index 7601d81cf3..7d4c256570 100644 --- a/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/Clipboard.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { FC, useState } from 'react'; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import Card from '@mui/material/Card'; @@ -6,13 +6,13 @@ import IconButton from '@mui/material/IconButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import CustomTooltip from '@/components/CustomTooltip'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; -interface ClipboardProps { +type ClipboardProps = { value: string; -} +}; -const Clipboard = ({ value }: ClipboardProps) => { +const Clipboard: FC = ({ value }) => { const [tooltipOpen, setTooltipOpen] = useState(false); return ( diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/EscrowAddress.tsx similarity index 90% rename from packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/EscrowAddress.tsx index 73c77b5a1f..8801d5d77a 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/EscrowAddress.tsx @@ -1,15 +1,22 @@ +import { FC } from 'react'; + import Chip from '@mui/material/Chip'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import TitleSectionWrapper from '@/components/SearchResults'; -import SectionWrapper from '@/components/SectionWrapper'; -import { AddressDetailsEscrowSchema } from '@/services/api/use-address-details'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import { AddressDetailsEscrow } from '../model/addressDetailsSchema'; -import HmtBalance from '../HmtBalance'; +import HmtBalance from './HmtBalance'; +import TitleSectionWrapper from './TitleSectionWrapper'; + +type Props = { + data: AddressDetailsEscrow; +}; -const EscrowAddress = ({ - data: { +const EscrowAddress: FC = ({ data }) => { + const { token, balance, factoryAddress, @@ -20,10 +27,7 @@ const EscrowAddress = ({ exchangeOracle, recordingOracle, reputationOracle, - }, -}: { - data: AddressDetailsEscrowSchema; -}) => { + } = data; return ( diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/HmtBalance.tsx similarity index 68% rename from packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/HmtBalance.tsx index 00c25526e7..aa4f482b53 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/HmtBalance/index.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/HmtBalance.tsx @@ -2,17 +2,17 @@ import { FC } from 'react'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { NumericFormat } from 'react-number-format'; -import { useHMTPrice } from '@/services/api/use-hmt-price'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import useHmtPrice from '@/shared/api/useHmtPrice'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; type Props = { balance?: number | null; }; const HmtBalance: FC = ({ balance }) => { - const { data, isError, isPending } = useHMTPrice(); + const { data, isError, isPending } = useHmtPrice(); const isMobile = useIsMobile(); if (isError) { @@ -30,12 +30,7 @@ const HmtBalance: FC = ({ balance }) => { return ( - + { - const { data, isError, isPending, isSuccess } = useHMTPrice(); + const { data, isError, isPending, isSuccess } = useHmtPrice(); return ( diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/KvStore.tsx similarity index 82% rename from packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/KvStore.tsx index bb16776c85..ea51fc7548 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/KVStore/index.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/KvStore.tsx @@ -1,4 +1,3 @@ - import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; @@ -7,11 +6,14 @@ import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import Typography from '@mui/material/Typography'; -import SectionWrapper from '@/components/SectionWrapper'; -import useKvstoreData from '@/services/api/use-kvstore-data'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import useKvstoreData from '../api/useKvStoreData'; const KVStore = () => { - const { data } = useKvstoreData(); + const { chainId, address } = useGlobalFiltersStore(); + const { data } = useKvstoreData(chainId, address); if (data?.length === 0) { return null; diff --git a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/NothingFound.tsx similarity index 90% rename from packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/NothingFound.tsx index 724fe89541..0eb637f207 100644 --- a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/NothingFound.tsx @@ -1,9 +1,7 @@ -import { FC } from 'react'; - import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; -const NothingFound: FC = () => { +const NothingFound = () => { return ( <> Nothing found :( diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorAddress.tsx similarity index 79% rename from packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/OperatorAddress.tsx index cb2d6edd12..9f47bdbbc8 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorAddress.tsx @@ -1,3 +1,5 @@ +import { FC } from 'react'; + import { Role } from '@human-protocol/sdk'; import Box from '@mui/material/Box'; import Chip from '@mui/material/Chip'; @@ -7,45 +9,30 @@ import ListItem from '@mui/material/ListItem'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import ExchangeOracleIcon from '@/assets/icons/exchange-oracle.svg'; -import JobLauncherIcon from '@/assets/icons/job-launcher.svg'; -import RecordingOracleIcon from '@/assets/icons/recording-oracle.svg'; -import ReputationOracleIcon from '@/assets/icons/reputation-oracle.svg'; -import TitleSectionWrapper from '@/components/SearchResults/TitleSectionWrapper'; -import SectionWrapper from '@/components/SectionWrapper'; -import { env } from '@/helpers/env'; -import { RoleDetailsEscrowsTable } from '@/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable'; -import { AddressDetailsOperator } from '@/services/api/use-address-details'; +import { env } from '@/shared/config/env'; +import EntityIcon from '@/shared/ui/EntityIcon'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import { AddressDetailsOperator } from '../model/addressDetailsSchema'; -import HmtBalance from '../HmtBalance'; -import HmtPrice from '../HmtPrice'; -import KVStore from '../KVStore'; -import ReputationScore from '../ReputationScore'; -import StakeInfo from '../StakeInfo'; +import HmtBalance from './HmtBalance'; +import HmtPrice from './HmtPrice'; +import KVStore from './KvStore'; +import EscrowsTable from './OperatorEscrows/EscrowsTable'; +import ReputationScore from './ReputationScore'; +import StakeInfo from './StakeInfo'; +import TitleSectionWrapper from './TitleSectionWrapper'; -interface RoleInfoProps { +type RoleInfoProps = { title: string; points: string[]; role: string; -} - -const renderRoleIcon = (role: string | null) => { - if (!role) return null; - - const roleIcons = { - [Role.ReputationOracle]: , - [Role.ExchangeOracle]: , - [Role.JobLauncher]: , - [Role.RecordingOracle]: , - }; - - return roleIcons[role]; }; -const RoleInformation = ({ title, points, role }: RoleInfoProps) => { +const RoleInformation: FC = ({ title, points, role }) => { return ( - {renderRoleIcon(role)} + {title} @@ -120,7 +107,7 @@ const renderRoleDetailsInfo = (role: string | null) => { ); }; -const RoleDetails = ({ data }: { data: AddressDetailsOperator }) => { +const OperatorAddress = ({ data }: { data: AddressDetailsOperator }) => { const { balance, role, @@ -221,8 +208,8 @@ const RoleDetails = ({ data }: { data: AddressDetailsOperator }) => { amountWithdrawable={amountWithdrawable} /> - + ); }; -export default RoleDetails; +export default OperatorAddress; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx new file mode 100644 index 0000000000..02c973e230 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx @@ -0,0 +1,82 @@ +import { FC } from 'react'; + +import Table from '@mui/material/Table'; +import TableContainer from '@mui/material/TableContainer'; +import TableFooter from '@mui/material/TableFooter'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import useEscrowDetails from '../../api/useEscrowDetails'; +import usePagination from '../../hooks/usePagination'; +import TablePagination from '../TablePagination'; + +import EscrowsTableBody from './EscrowsTableBody'; + +type Props = { + role: string | null; +}; + +const EscrowsTable: FC = ({ role }) => { + const { chainId, address } = useGlobalFiltersStore(); + const { + pagination: { page, pageSize, lastPageIndex }, + params, + setPageSize, + setNextPage, + setPrevPage, + setLastPageIndex, + } = usePagination(); + const { data, isLoading, error } = useEscrowDetails({ + role, + chainId, + address, + page, + lastPageIndex, + params, + setLastPageIndex, + }); + + return ( + + + Escrows + + + + + + + + + + + + +
+
+
+ ); +}; + +export default EscrowsTable; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx new file mode 100644 index 0000000000..34cbef9bdd --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx @@ -0,0 +1,72 @@ +import { FC } from 'react'; + +import { TableRow } from '@mui/material'; +import CircularProgress from '@mui/material/CircularProgress'; +import Link from '@mui/material/Link'; +import MuiTableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; + +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; + +import { PaginatedEscrowDetails } from '../../model/escrowDetailsSchema'; + +import EscrowsTableBodyContainer from './EscrowsTableBodyContainer'; + +type Props = { + data: PaginatedEscrowDetails | undefined; + isLoading: boolean; + error: Error | null; +}; + +const EscrowsTableBody: FC = ({ data, isLoading, error }) => { + const { chainId } = useGlobalFiltersStore(); + + if (isLoading) { + return ( + + + + ); + } + + if (error) { + return ( + +
{handleErrorMessage(error)}
+
+ ); + } + + if (!data?.results.length) { + return ( + +
No escrows launched yet
+
+ ); + } + + return ( + + {data.results.map((elem, idx) => ( + + + + {elem.address} + + + + ))} + + ); +}; + +export default EscrowsTableBody; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBodyContainer.tsx similarity index 69% rename from packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBodyContainer.tsx index 9b00b73d4f..fe7f2c329e 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBodyContainer.tsx @@ -1,11 +1,9 @@ -import { Grid } from '@mui/material'; +import { FC, PropsWithChildren } from 'react'; + +import Grid from '@mui/material/Grid'; import MuiTableBody from '@mui/material/TableBody'; -export const EscrowsTableBodyContainer = ({ - children, -}: { - children: JSX.Element; -}) => { +const EscrowsTableBodyContainer: FC = ({ children }) => { return ( ); }; + +export default EscrowsTableBodyContainer; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/ReputationScore.tsx similarity index 95% rename from packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/ReputationScore.tsx index 2f2c6f0b8b..6dc9a20c09 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/ReputationScore/index.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/ReputationScore.tsx @@ -11,7 +11,7 @@ type ReputationAttributes = { colors: { title: string; border: string }; }; -export const ReputationScore = ({ reputation }: Props) => { +const ReputationScore = ({ reputation }: Props) => { const theme = useTheme(); const reputationAttributes: Record = { diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/SearchResults.tsx similarity index 61% rename from packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/SearchResults.tsx index 14ab19de83..e9b30182a3 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/SearchResults.tsx @@ -1,30 +1,32 @@ import { useEffect, useState } from 'react'; -import Stack from '@mui/material/Stack'; +import { Stack } from '@mui/material'; import { AxiosError } from 'axios'; import { useLocation, useParams } from 'react-router-dom'; -import Breadcrumbs from '@/components/Breadcrumbs'; -import Clipboard from '@/components/Clipboard'; -import { EscrowAddressIcon } from '@/components/Icons/EscrowAddressIcon'; -import { WalletIcon } from '@/components/Icons/WalletIcon'; -import Loader from '@/components/Loader'; -import NothingFound from '@/components/NothingFound'; -import PageWrapper from '@/components/PageWrapper'; -import SearchBar from '@/components/SearchBar/SearchBar'; -import ShadowIcon from '@/components/ShadowIcon'; -import EscrowAddress from '@/pages/SearchResults/EscrowAddress'; -import RoleDetails from '@/pages/SearchResults/RoleDetails/RoleDetails'; -import WalletAddress from '@/pages/SearchResults/WalletAddress'; -import { - AddressDetails, - useAddressDetails, -} from '@/services/api/use-address-details'; -import { handleErrorMessage } from '@/services/handle-error-message'; -import { getNetwork } from '@/utils/config/networks'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - -import { WalletAddressTransactionsTable } from './WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable'; +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import { getNetwork } from '@/shared/lib/networks'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import EscrowAddressIcon from '@/shared/ui/icons/EscrowAddressIcon'; +import WalletIcon from '@/shared/ui/icons/WalletIcon'; +import Loader from '@/shared/ui/Loader'; +import ShadowIcon from '@/shared/ui/ShadowIcon'; + +import useAddressDetails from '../api/useAddressDetails'; +import { AddressDetails } from '../model/addressDetailsSchema'; + +import Clipboard from './Clipboard'; +import EscrowAddress from './EscrowAddress'; +import NothingFound from './NothingFound'; +import OperatorAddress from './OperatorAddress'; +import WalletAddress from './WalletAddress'; +import WalletTransactionsTable from './WalletTransactionsTable'; + +enum ParamsStatus { + LOADING = 'loading', + ERROR = 'error', + SUCCESS = 'success', +} const renderCurrentResultType = ( addressDetails: AddressDetails, @@ -75,64 +77,14 @@ const ResultError = ({ error }: { error: unknown }) => { return {handleErrorMessage(error)}; }; -const Results = () => { - const { data, status, error } = useAddressDetails(); - const { filterParams } = useWalletSearch(); - - if (status === 'pending' && !data) { - return ; - } - - if (status === 'error') { - return ; - } - - const showTransactions = !!data.wallet || !!data.operator; - - const walletData = - data.wallet || - (data.operator && data.operator.role === null ? data.operator : undefined); - - return ( - <> - - {renderCurrentResultType(data, filterParams.address)} - - - {data.operator && data.operator.role ? ( - - ) : null} - {walletData ? : null} - {data.escrow && } - {showTransactions && } - - ); -}; - -enum ParamsStatus { - LOADING = 'loading', - ERROR = 'error', - SUCCESS = 'success', -} - const SearchResults = () => { - const location = useLocation(); - const { chainId: urlChainId, address: urlAddress } = useParams(); - const { - setAddress, - setChainId, - filterParams: { chainId, address }, - } = useWalletSearch(); - const [paramsStatus, setParamsStatus] = useState( ParamsStatus.LOADING ); + const location = useLocation(); + const { chainId: urlChainId, address: urlAddress } = useParams(); + const { address, chainId, setAddress, setChainId } = useGlobalFiltersStore(); + const { data, status, error } = useAddressDetails(chainId, address); useEffect(() => { setParamsStatus(ParamsStatus.LOADING); @@ -172,18 +124,46 @@ const SearchResults = () => { } }, [address, chainId, paramsStatus]); + if ( + paramsStatus === ParamsStatus.LOADING || + (status === 'pending' && !data) + ) { + return ; + } + + if (paramsStatus === ParamsStatus.ERROR) { + return Something went wrong; + } + + if (status === 'error') { + return ; + } + + const showTransactions = !!data.wallet || !!data.operator; + + const walletData = + data.wallet || + (data.operator && data.operator.role === null ? data.operator : undefined); + return ( - - - - {paramsStatus === ParamsStatus.LOADING && ( - - )} - {paramsStatus === ParamsStatus.ERROR && ( - Something went wrong - )} - {paramsStatus === ParamsStatus.SUCCESS && } - + <> + + {renderCurrentResultType(data, address)} + + + {data.operator && data.operator.role ? ( + + ) : null} + {walletData ? : null} + {data.escrow && } + {showTransactions && } + ); }; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/StakeInfo.tsx similarity index 89% rename from packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/StakeInfo.tsx index 23702ac62b..449d26c9ea 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/StakeInfo/index.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/StakeInfo.tsx @@ -2,10 +2,10 @@ import { FC } from 'react'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { NumericFormat } from 'react-number-format'; -import SectionWrapper from '@/components/SectionWrapper'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; type Props = { amountStaked?: number | null; @@ -17,10 +17,8 @@ const renderAmount = (amount: number | null | undefined, isMobile: boolean) => { return ( - diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx new file mode 100644 index 0000000000..a0611b80ee --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx @@ -0,0 +1,92 @@ +import { FC, useEffect } from 'react'; + +import { TablePagination as MuiTablePagination } from '@mui/material'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; + +type Props = { + page: number; + pageSize: number; + resultsLength: number; + lastPageIndex: number | undefined; + isDataLoading: boolean | undefined; + setPageSize: (pageSize: number) => void; + setNextPage: () => void; + setPrevPage: () => void; + setLastPageIndex: (lastPageIndex: number | undefined) => void; +}; + +const TablePagination: FC = ({ + page, + pageSize, + resultsLength, + lastPageIndex, + isDataLoading, + setPageSize, + setNextPage, + setPrevPage, + setLastPageIndex, +}) => { + const { chainId, address } = useGlobalFiltersStore(); + + useEffect(() => { + if ( + resultsLength !== undefined && + resultsLength === 0 && + page > 0 && + !isDataLoading + ) { + setLastPageIndex(page); + setPrevPage(); + } + }, [resultsLength, page, setLastPageIndex, setPrevPage, isDataLoading]); + + useEffect(() => { + setLastPageIndex(undefined); + }, [address, chainId, setLastPageIndex]); + + useEffect(() => { + return () => { + setPageSize(10); + }; + }, [setPageSize]); + + return ( + {}} + page={page} + component="td" + rowsPerPage={pageSize} + onRowsPerPageChange={(event) => { + setPageSize(Number(event.target.value)); + }} + rowsPerPageOptions={[5, 10]} + labelDisplayedRows={({ from, to }) => { + const effectiveTo = resultsLength ? from + resultsLength - 1 : to; + return `${from}–${effectiveTo}`; + }} + slotProps={{ + actions: { + nextButton: { + onClick: () => { + setNextPage(); + }, + disabled: + lastPageIndex !== undefined && + (page === lastPageIndex || lastPageIndex - 1 === page), + }, + previousButton: { + onClick: () => { + setPrevPage(); + }, + }, + }, + }} + /> + ); +}; + +export default TablePagination; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/TitleSectionWrapper.tsx similarity index 95% rename from packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/TitleSectionWrapper.tsx index a7c49b216a..3eacd67706 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/TitleSectionWrapper.tsx @@ -6,7 +6,7 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import CustomTooltip from '@/components/CustomTooltip'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; type Props = { title: string; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx similarity index 77% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx index 3512e50f97..5275c53c20 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx @@ -2,21 +2,22 @@ import { FC } from 'react'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { NumericFormat } from 'react-number-format'; -import TitleSectionWrapper from '@/components/SearchResults'; -import SectionWrapper from '@/components/SectionWrapper'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + import { AddressDetailsOperator, AddressDetailsWallet, -} from '@/services/api/use-address-details'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; +} from '../model/addressDetailsSchema'; -import HmtBalance from '../HmtBalance'; -import HmtPrice from '../HmtPrice'; -import KVStore from '../KVStore'; -import ReputationScore from '../ReputationScore'; -import StakeInfo from '../StakeInfo'; +import HmtBalance from './HmtBalance'; +import HmtPrice from './HmtPrice'; +import KVStore from './KvStore'; +import ReputationScore from './ReputationScore'; +import StakeInfo from './StakeInfo'; +import TitleSectionWrapper from './TitleSectionWrapper'; type Props = { data: AddressDetailsWallet | AddressDetailsOperator; @@ -56,10 +57,8 @@ const WalletAddress: FC = ({ data }) => { tooltip="Total amount earned by participating in jobs" > - diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBody.tsx similarity index 71% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBody.tsx index 3edd02e454..d2122d76cb 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBody.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import { FC, useState } from 'react'; import AddCircleIcon from '@mui/icons-material/AddCircle'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; @@ -10,35 +10,22 @@ import MuiTableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableRow from '@mui/material/TableRow'; -import AbbreviateClipboard from '@/components/SearchResults/AbbreviateClipboard'; -import { TransactionTableCellMethod } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod'; -import { TransactionTableCellValue } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue'; -import { TransactionsTableBodyContainer } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer'; -import { useTransactionDetails } from '@/services/api/use-transaction-details'; -import { handleErrorMessage } from '@/services/handle-error-message'; -import { useTransactionDetailsDto } from '@/utils/hooks/use-transactions-details-dto'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import AbbreviateClipboard from '@/shared/ui/AbbreviateClipboard'; -export const TransactionsTableBody: React.FC = () => { - const { data, isPending, isError, error } = useTransactionDetails(); - const { filterParams } = useWalletSearch(); - const { - setLastPageIndex, - setPrevPage, - pagination: { page }, - } = useTransactionDetailsDto(); +import { PaginatedTransactionDetails } from '../../model/transactionDetailsSchema'; - useEffect(() => { - if (data?.results.length === 0) { - setLastPageIndex(page); - setPrevPage(); - } - }, [data?.results, page, setLastPageIndex, setPrevPage]); +import TransactionsTableBodyContainer from './TransactionsTableBodyContainer'; +import TransactionsTableCellMethod from './TransactionsTableCellMethod'; +import TransactionsTableCellValue from './TransactionsTableCellValue'; - useEffect(() => { - setLastPageIndex(undefined); - }, [filterParams.address, filterParams.chainId, setLastPageIndex]); +type Props = { + data: PaginatedTransactionDetails | undefined; + isLoading: boolean; + error: Error | null; +}; +const TransactionsTableBody: FC = ({ data, isLoading, error }) => { const [expandedRows, setExpandedRows] = useState>({}); const toggleRow = (idx: number) => { @@ -48,7 +35,7 @@ export const TransactionsTableBody: React.FC = () => { })); }; - if (isPending) { + if (isLoading) { return ( @@ -56,7 +43,7 @@ export const TransactionsTableBody: React.FC = () => { ); } - if (isError) { + if (error) { return (
{handleErrorMessage(error)}
@@ -64,7 +51,7 @@ export const TransactionsTableBody: React.FC = () => { ); } - if (!data.results.length) { + if (!data?.results.length) { return (
No data
@@ -101,7 +88,7 @@ export const TransactionsTableBody: React.FC = () => {
- + { {elem.block} - @@ -137,7 +124,7 @@ export const TransactionsTableBody: React.FC = () => { > - + { - @@ -168,3 +155,5 @@ export const TransactionsTableBody: React.FC = () => { ); }; + +export default TransactionsTableBody; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBodyContainer.tsx similarity index 71% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBodyContainer.tsx index ea5a84943b..133bb36a0f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBodyContainer.tsx @@ -1,10 +1,10 @@ -import { Grid } from '@mui/material'; +import { FC, PropsWithChildren } from 'react'; + +import Grid from '@mui/material/Grid'; import MuiTableBody from '@mui/material/TableBody'; -export const TransactionsTableBodyContainer = ({ +const TransactionsTableBodyContainer: FC = ({ children, -}: { - children: JSX.Element; }) => { return ( @@ -26,3 +26,5 @@ export const TransactionsTableBodyContainer = ({ ); }; + +export default TransactionsTableBodyContainer; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx similarity index 93% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx index 72d63b90a9..ac8d85d7ec 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx @@ -70,7 +70,7 @@ const methodAttributes: Record< }, }; -export const TransactionTableCellMethod = ({ method }: { method: string }) => { +const TransactionsTableCellMethod = ({ method }: { method: string }) => { const theme = useTheme(); const currentStatusColors = methodAttributes[method]?.color || { text: 'primary.main', @@ -97,3 +97,5 @@ export const TransactionTableCellMethod = ({ method }: { method: string }) => { /> ); }; + +export default TransactionsTableCellMethod; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx similarity index 71% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx index ee8a5ecc2f..4c031b002c 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx @@ -1,9 +1,9 @@ import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; import Typography from '@mui/material/Typography'; -import CustomTooltip from '@/components/CustomTooltip'; -import { formatHMTDecimals } from '@/helpers/formatHMTDecimals'; -import { useHMTPrice } from '@/services/api/use-hmt-price'; +import useHmtPrice from '@/shared/api/useHmtPrice'; +import formatHmtDecimals from '@/shared/lib/formatHmtDecimals'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; const InfoTooltip = ({ title }: { title: string }) => ( @@ -16,14 +16,14 @@ const InfoTooltip = ({ title }: { title: string }) => ( ); -export const TransactionTableCellValue = ({ +const TransactionsTableCellValue = ({ value, method, }: { value: string; method: string; }) => { - const { isError, isPending } = useHMTPrice(); + const { isError, isPending } = useHmtPrice(); if (isError) { return N/A; @@ -35,7 +35,7 @@ export const TransactionTableCellValue = ({ return ( - {formatHMTDecimals(value)} + {formatHmtDecimals(value)} HMT @@ -45,3 +45,5 @@ export const TransactionTableCellValue = ({ ); }; + +export default TransactionsTableCellValue; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableHead.tsx similarity index 92% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableHead.tsx index 5a5fbf0538..060380626b 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableHead.tsx @@ -4,7 +4,7 @@ import TableCell from '@mui/material/TableCell'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; -import CustomTooltip from '@/components/CustomTooltip'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; const InfoTooltip = ({ title }: { title: string }) => ( ( ); -export const TransactionsTableHead = () => { +const TransactionsTableHead = () => { return ( { ); }; + +export default TransactionsTableHead; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx new file mode 100644 index 0000000000..2dbe0da623 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx @@ -0,0 +1,90 @@ +import Table from '@mui/material/Table'; +import TableContainer from '@mui/material/TableContainer'; +import TableFooter from '@mui/material/TableFooter'; +import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; +import SimpleBar from 'simplebar-react'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import useTransactionDetails from '../api/useTransactionDetails'; +import usePagination from '../hooks/usePagination'; + +import TablePagination from './TablePagination'; +import TransactionsTableBody from './WalletTransactions/TransactionsTableBody'; +import TransactionsTableHead from './WalletTransactions/TransactionsTableHead'; + +const WalletTransactionsTable = () => { + const { chainId, address } = useGlobalFiltersStore(); + const { + pagination: { page, pageSize, lastPageIndex }, + params, + setPageSize, + setNextPage, + setPrevPage, + setLastPageIndex, + } = usePagination(); + const { data, isLoading, error } = useTransactionDetails({ + chainId, + address, + page, + lastPageIndex, + setLastPageIndex, + params, + }); + + return ( + + + Transactions + + + + + + +
+
+ + + + + + +
+
+
+ ); +}; + +export default WalletTransactionsTable; diff --git a/packages/apps/dashboard/client/src/helpers/abbreviateValue.ts b/packages/apps/dashboard/client/src/helpers/abbreviateValue.ts deleted file mode 100644 index 45feadaf9d..0000000000 --- a/packages/apps/dashboard/client/src/helpers/abbreviateValue.ts +++ /dev/null @@ -1,12 +0,0 @@ -const abbreviateValue = (value: string | null) => { - if (value) { - const first3Letters = value.slice(0, 5); - const last5Letters = value.slice(-5); - - return `${first3Letters}...${last5Letters}`; - } - - return null; -}; - -export default abbreviateValue; diff --git a/packages/apps/dashboard/client/src/helpers/index.ts b/packages/apps/dashboard/client/src/helpers/index.ts deleted file mode 100644 index f2f42df6a9..0000000000 --- a/packages/apps/dashboard/client/src/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'src/helpers/abbreviateValue'; diff --git a/packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts b/packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts deleted file mode 100644 index 8b4e86d412..0000000000 --- a/packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const isValidEVMAddress = (input: string): boolean => { - const evmRegex = /^0x[a-fA-F0-9]{40}$/; - return evmRegex.test(input); -}; diff --git a/packages/apps/dashboard/client/src/pages/Graph/index.ts b/packages/apps/dashboard/client/src/pages/Graph/index.ts deleted file mode 100644 index 8c491e7e8c..0000000000 --- a/packages/apps/dashboard/client/src/pages/Graph/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Graph'; diff --git a/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx b/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx deleted file mode 100644 index 8666c6bbdd..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { useLeaderboardDetails } from '@/services/api/use-leaderboard-details'; - -import { Leaderboard as LeaderboardFeature } from '../../features/Leaderboard'; - -export const Leaderboard = () => { - const { data, status, error } = useLeaderboardDetails(4); - - return ( - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/Home/index.ts b/packages/apps/dashboard/client/src/pages/Home/index.ts deleted file mode 100644 index 41e08eefd0..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Home'; diff --git a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx deleted file mode 100644 index b32decf434..0000000000 --- a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import Breadcrumbs from '@/components/Breadcrumbs'; -import { LeaderboardIcon } from '@/components/Icons/LeaderboardIcon'; -import PageWrapper from '@/components/PageWrapper'; -import ShadowIcon from '@/components/ShadowIcon'; -import { useLeaderboardDetails } from '@/services/api/use-leaderboard-details'; - -import { Leaderboard } from '../../features/Leaderboard/index'; - -const LeaderBoard = () => { - const { data, status, error } = useLeaderboardDetails(); - - return ( - - - } - /> - - - ); -}; - -export default LeaderBoard; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts deleted file mode 100644 index b7ba591a2c..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './EscrowAddress'; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx deleted file mode 100644 index 3364163f08..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { useEffect } from 'react'; - -import Stack from '@mui/material/Stack'; -import Table from '@mui/material/Table'; -import TableContainer from '@mui/material/TableContainer'; -import TableHead from '@mui/material/TableHead'; -import TablePagination from '@mui/material/TablePagination'; -import TableRow from '@mui/material/TableRow'; -import Typography from '@mui/material/Typography'; - -import SectionWrapper from '@/components/SectionWrapper'; -import { EscrowsTableBody } from '@/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody'; -import { useEscrowDetails } from '@/services/api/use-escrows-details'; -import { useEscrowDetailsDto } from '@/utils/hooks/use-escrows-details-dto'; - -export const RoleDetailsEscrowsTable = ({ role }: { role: string | null }) => { - const { data } = useEscrowDetails({ role }); - const { - pagination: { page, pageSize, lastPageIndex }, - setPageSize, - setNextPage, - setPrevPage, - } = useEscrowDetailsDto(); - - useEffect(() => { - return () => { - setPageSize(10); - }; - }, [setPageSize]); - - return ( - - - Escrows - - - - - - - -
-
- - {}} - page={page} - rowsPerPage={pageSize} - onRowsPerPageChange={(event) => { - setPageSize(Number(event.target.value)); - }} - rowsPerPageOptions={[5, 10]} - labelDisplayedRows={({ from, to }) => { - const effectiveTo = data?.results - ? from + data.results.length - 1 - : to; - return `${from}–${effectiveTo}`; - }} - component="div" - slotProps={{ - actions: { - nextButton: { - onClick: () => { - setNextPage(); - }, - disabled: - lastPageIndex !== undefined && - (page === lastPageIndex || lastPageIndex - 1 === page), - }, - previousButton: { - onClick: () => { - setPrevPage(); - }, - }, - }, - }} - /> - -
- ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx deleted file mode 100644 index 2fb9f4a4f8..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { useEffect } from 'react'; - -import { Stack, TableRow } from '@mui/material'; -import CircularProgress from '@mui/material/CircularProgress'; -import Link from '@mui/material/Link'; -import MuiTableBody from '@mui/material/TableBody'; -import TableCell from '@mui/material/TableCell'; -import { useNavigate } from 'react-router-dom'; - -import { EscrowsTableBodyContainer } from '@/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer'; -import { AddressDetailsOperator } from '@/services/api/use-address-details'; -import { useEscrowDetails } from '@/services/api/use-escrows-details'; -import { handleErrorMessage } from '@/services/handle-error-message'; -import { useEscrowDetailsDto } from '@/utils/hooks/use-escrows-details-dto'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - - -export const EscrowsTableBody = ({ - role, -}: { - role: AddressDetailsOperator['role']; -}) => { - const navigate = useNavigate(); - const { filterParams } = useWalletSearch(); - const { data, isPending, isError, error } = useEscrowDetails({ role }); - const { - setLastPageIndex, - setPrevPage, - pagination: { page }, - } = useEscrowDetailsDto(); - - useEffect(() => { - if (data?.results.length === 0) { - setLastPageIndex(page); - setPrevPage(); - } - }, [data?.results, page, setLastPageIndex, setPrevPage]); - - useEffect(() => { - setLastPageIndex(undefined); - }, [filterParams.address, filterParams.chainId, setLastPageIndex]); - - if (isPending) { - return ( - - - - ); - } - - if (isError) { - return ( - -
{handleErrorMessage(error)}
-
- ); - } - - if (!data.results.length) { - return ( - -
No escrows launched yet
-
- ); - } - - return ( - - {data.results.map((elem, idx) => ( - - - { - e.stopPropagation(); - e.preventDefault(); - navigate(`/search/${filterParams.chainId}/${elem.address}`); - }} - > - - {elem.address} - - - - - ))} - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts deleted file mode 100644 index 6c3987e4fa..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './RoleDetails'; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx deleted file mode 100644 index 5a88d704c6..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { useEffect } from 'react'; - -import Table from '@mui/material/Table'; -import TableContainer from '@mui/material/TableContainer'; -import TableFooter from '@mui/material/TableFooter'; -import TablePagination from '@mui/material/TablePagination'; -import TableRow from '@mui/material/TableRow'; -import Typography from '@mui/material/Typography'; -import SimpleBar from 'simplebar-react'; - -import SectionWrapper from '@/components/SectionWrapper'; -import { TransactionsTableBody } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody'; -import { TransactionsTableHead } from '@/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead'; -import { useTransactionDetails } from '@/services/api/use-transaction-details'; -import { useTransactionDetailsDto } from '@/utils/hooks/use-transactions-details-dto'; - -export const WalletAddressTransactionsTable = () => { - const { data } = useTransactionDetails(); - const { - pagination: { page, pageSize, lastPageIndex }, - setPageSize, - setNextPage, - setPrevPage, - } = useTransactionDetailsDto(); - - useEffect(() => { - return () => { - setPageSize(10); - }; - }, [setPageSize]); - - return ( - - - Transactions - - - - - - -
-
- - - - {}} - page={page} - component="td" - rowsPerPage={pageSize} - onRowsPerPageChange={(event) => { - setPageSize(Number(event.target.value)); - }} - rowsPerPageOptions={[5, 10]} - labelDisplayedRows={({ from, to }) => { - const effectiveTo = data?.results - ? from + data.results.length - 1 - : to; - return `${from}–${effectiveTo}`; - }} - slotProps={{ - actions: { - nextButton: { - onClick: () => { - setNextPage(); - }, - disabled: - lastPageIndex !== undefined && - (page === lastPageIndex || lastPageIndex - 1 === page), - }, - previousButton: { - onClick: () => { - setPrevPage(); - }, - }, - }, - }} - /> - - -
-
-
- ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts deleted file mode 100644 index f9385021f9..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './WalletAddress'; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/index.ts deleted file mode 100644 index 43ac09d5da..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './SearchResults'; diff --git a/packages/apps/dashboard/client/src/pages/graph/index.ts b/packages/apps/dashboard/client/src/pages/graph/index.ts new file mode 100644 index 0000000000..375e4a10e9 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/graph/index.ts @@ -0,0 +1 @@ +export { default } from './ui/GraphPage'; diff --git a/packages/apps/dashboard/client/src/pages/Graph/Graph.tsx b/packages/apps/dashboard/client/src/pages/graph/ui/GraphPage.tsx similarity index 50% rename from packages/apps/dashboard/client/src/pages/Graph/Graph.tsx rename to packages/apps/dashboard/client/src/pages/graph/ui/GraphPage.tsx index 39335560e4..fb598362b4 100644 --- a/packages/apps/dashboard/client/src/pages/Graph/Graph.tsx +++ b/packages/apps/dashboard/client/src/pages/graph/ui/GraphPage.tsx @@ -1,12 +1,12 @@ import { useEffect } from 'react'; -import Breadcrumbs from '@/components/Breadcrumbs'; -import { AreaChart } from '@/components/Charts'; -import PageWrapper from '@/components/PageWrapper'; -import { useGraphPageChartParams } from '@/utils/hooks/use-graph-page-chart-params'; +import AreaChart from '@/features/graph'; +import useChartParamsStore from '@/features/graph/store/useChartParamsStore'; +import Breadcrumbs from '@/shared/ui/Breadcrumbs'; +import PageWrapper from '@/widgets/page-wrapper'; const Graph = () => { - const { revertToInitialParams } = useGraphPageChartParams(); + const { revertToInitialParams } = useChartParamsStore(); useEffect(() => { revertToInitialParams(); diff --git a/packages/apps/dashboard/client/src/pages/home/index.ts b/packages/apps/dashboard/client/src/pages/home/index.ts new file mode 100644 index 0000000000..6648d3e441 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/home/index.ts @@ -0,0 +1 @@ +export { default } from './ui/HomePage'; diff --git a/packages/apps/dashboard/client/src/pages/Home/Home.tsx b/packages/apps/dashboard/client/src/pages/home/ui/HomePage.tsx similarity index 81% rename from packages/apps/dashboard/client/src/pages/Home/Home.tsx rename to packages/apps/dashboard/client/src/pages/home/ui/HomePage.tsx index 5b60eae7b8..a92bd05c73 100644 --- a/packages/apps/dashboard/client/src/pages/Home/Home.tsx +++ b/packages/apps/dashboard/client/src/pages/home/ui/HomePage.tsx @@ -9,19 +9,18 @@ import Typography from '@mui/material/Typography'; import Grid from '@mui/material/Unstable_Grid2'; import { Link } from 'react-router-dom'; -import CustomTooltip from '@/components/CustomTooltip'; -import GraphSwiper from '@/components/Home/GraphSwiper'; -import { LeaderboardIcon } from '@/components/Icons/LeaderboardIcon'; -import PageWrapper from '@/components/PageWrapper'; -import SearchBar from '@/components/SearchBar/SearchBar'; -import ShadowIcon from '@/components/ShadowIcon'; -import HMTPrice from '@/pages/Home/HMTPrice'; -import Holders from '@/pages/Home/Holders'; -import TotalNumberOfTasks from '@/pages/Home/TotalNumberOfTasks'; -import TotalTransactions from '@/pages/Home/TotalTransactions'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; - -import { Leaderboard } from './Leaderboard'; +import GraphSwiper from '@/features/graph/ui/GraphSwiper'; +import HmtPrice from '@/features/home/ui/HmtPrice'; +import Holders from '@/features/home/ui/Holders'; +import TotalNumberOfTasks from '@/features/home/ui/TotalNumberOfTasks'; +import TotalTransactions from '@/features/home/ui/TotalTransactions'; +import Leaderboard from '@/features/leaderboard'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; +import LeaderboardIcon from '@/shared/ui/icons/LeaderboardIcon'; +import SearchBar from '@/shared/ui/SearchBar'; +import ShadowIcon from '@/shared/ui/ShadowIcon'; +import PageWrapper from '@/widgets/page-wrapper'; const CardWrapper = styled(Grid)(({ theme }) => ({ display: 'flex', @@ -62,7 +61,7 @@ const renderViewChartsButton = (show: boolean) => { } }; -const Home: FC = () => { +const HomePage: FC = () => { const isMobile = useIsMobile(); return ( @@ -77,7 +76,7 @@ const Home: FC = () => { Token - + @@ -127,9 +126,9 @@ const Home: FC = () => { title="Leaderboard" img={} /> - + ); }; -export default Home; +export default HomePage; diff --git a/packages/apps/dashboard/client/src/pages/leaderboard/index.ts b/packages/apps/dashboard/client/src/pages/leaderboard/index.ts new file mode 100644 index 0000000000..1ffb7778d2 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/leaderboard/index.ts @@ -0,0 +1 @@ +export { default } from './ui/LeaderboardPage'; diff --git a/packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx b/packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx new file mode 100644 index 0000000000..c50eb67e7f --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx @@ -0,0 +1,21 @@ +import Leaderboard from '@/features/leaderboard'; +import Breadcrumbs from '@/shared/ui/Breadcrumbs'; +import LeaderboardIcon from '@/shared/ui/icons/LeaderboardIcon'; +import ShadowIcon from '@/shared/ui/ShadowIcon'; +import PageWrapper from '@/widgets/page-wrapper'; + +const LeaderboardPage = () => { + return ( + + + } + /> + + + ); +}; + +export default LeaderboardPage; diff --git a/packages/apps/dashboard/client/src/pages/searchResults/index.ts b/packages/apps/dashboard/client/src/pages/searchResults/index.ts new file mode 100644 index 0000000000..6d66d62fbc --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/searchResults/index.ts @@ -0,0 +1 @@ +export { default } from './ui/SearchResultsPage'; diff --git a/packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx b/packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx new file mode 100644 index 0000000000..02ae0f5ffc --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx @@ -0,0 +1,15 @@ +import SearchResults from '@/features/searchResults'; +import Breadcrumbs from '@/shared/ui/Breadcrumbs'; +import SearchBar from '@/shared/ui/SearchBar'; +import PageWrapper from '@/widgets/page-wrapper'; + +const SearchResultsPage = () => { + return ( + + + + + + ); +}; +export default SearchResultsPage; diff --git a/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx b/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx deleted file mode 100644 index 8a0ac01e07..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { AddressDetailsOperator } from '@/services/api/use-address-details'; -import { validateResponse } from '@/services/validate-response'; -import { useEscrowDetailsDto } from '@/utils/hooks/use-escrows-details-dto'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -const escrowDetailsSuccessResponseSchema = z.object({ - chainId: z.number(), - address: z.string(), - status: z.string(), -}); - -export type TransactionDetails = z.infer< - typeof escrowDetailsSuccessResponseSchema ->; - -const paginatedEscrowsDetailsSuccessResponseSchema = z.object({ - address: z.string(), - chainId: z.number(), - first: z.number(), - skip: z.number(), - results: z.array(escrowDetailsSuccessResponseSchema), -}); - -export type PaginatedEscrowDetails = z.infer< - typeof paginatedEscrowsDetailsSuccessResponseSchema ->; - -export interface PaginatedEscrowsDetailsDto { - skip: number; - first: number; - chainId: number; - role: AddressDetailsOperator['role']; -} - -export function useEscrowDetails({ - role, -}: { - role: AddressDetailsOperator['role']; -}) { - const { filterParams } = useWalletSearch(); - const { - setLastPageIndex, - pagination: { page, lastPageIndex }, - params, - } = useEscrowDetailsDto(); - - const dto: PaginatedEscrowsDetailsDto = { - chainId: filterParams.chainId, - skip: params.skip, - first: params.first, - role, - }; - - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get( - `${apiPaths.escrowDetails.path}/${filterParams.address}`, - { - params: dto, - } - ); - - const validResponse = validateResponse( - data, - paginatedEscrowsDetailsSuccessResponseSchema - ); - - // check if last page - if (lastPageIndex === undefined) { - const { data: lastPageCheckData } = await httpService.get( - `${apiPaths.escrowDetails.path}/${filterParams.address}`, - { - params: { - ...dto, - skip: dto.skip + validResponse.results.length, - first: 1, - }, - } - ); - const validLastPageCheckData = validateResponse( - lastPageCheckData, - paginatedEscrowsDetailsSuccessResponseSchema - ); - - if (validLastPageCheckData.results.length === 0) { - setLastPageIndex(page + 1); - } - } - - return validResponse; - }, - queryKey: ['useEscrowDetails', filterParams.address, dto], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx b/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx deleted file mode 100644 index e087a7a97e..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { validateResponse } from '@/services/validate-response'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -const successGeneralStatsResponseSchema = z.object({ - totalHolders: z.number(), - totalTransactions: z.number(), -}); - -export type GeneralStats = z.infer; - -export function useGeneralStats() { - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get(apiPaths.generalStats.path); - - const validResponse = validateResponse( - data, - successGeneralStatsResponseSchema - ); - - return validResponse; - }, - queryKey: ['useGeneralStats'], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx b/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx deleted file mode 100644 index 63032aaf65..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx +++ /dev/null @@ -1,150 +0,0 @@ -import { useMemo } from 'react'; - -import { useQuery, keepPreviousData } from '@tanstack/react-query'; -import dayjs from 'dayjs'; -import { useDebounce } from 'use-debounce'; -import { z } from 'zod'; - -import { validateResponse } from '@/services/validate-response'; -import { useGraphPageChartParams } from '@/utils/hooks/use-graph-page-chart-params'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -const hmtDailyStatSchemaResponseSchema = z.object({ - from: z.string().optional(), - to: z.string().optional(), - results: z.array( - z.object({ - totalTransactionAmount: z.string().transform((value, ctx) => { - const valueAsNumber = Number(value); - if (Number.isNaN(valueAsNumber)) { - ctx.addIssue({ - path: ['totalTransactionAmount'], - code: z.ZodIssueCode.custom, - }); - } - - return valueAsNumber / 10 ** 18; - }), - totalTransactionCount: z.number(), - dailyUniqueSenders: z.number(), - dailyUniqueReceivers: z.number(), - date: z.string(), - }) - ), -}); - -export type HMTDailyStatsResponse = z.output< - typeof hmtDailyStatSchemaResponseSchema ->; -export type HMTDailyStat = HMTDailyStatsResponse['results'][number]; - -const hcaptchaDailyStatsResponseSchema = z.object({ - from: z.string().optional(), - to: z.string().optional(), - results: z.array( - z.object({ - solved: z.number(), - date: z.string(), - }) - ), -}); - -export type HcaptchaDailyStatsResponse = z.infer< - typeof hcaptchaDailyStatsResponseSchema ->; -export type HcaptchaDailyStat = HcaptchaDailyStatsResponse['results'][number]; - -export type GraphPageChartData = (HMTDailyStat & - Omit)[]; - -const mergeResponses = ( - hcaptchaStatsResults: HcaptchaDailyStat[], - hmtStatsResults: HMTDailyStat[] -): GraphPageChartData => { - const allDates = Array.from( - new Set([ - ...hcaptchaStatsResults.map(({ date }) => date), - ...hmtStatsResults.map(({ date }) => date), - ]) - ).sort((a, b) => (dayjs(a).isBefore(dayjs(b)) ? -1 : 1)); - - const hcaptchaStatsResultsMap = new Map(); - const hmtStatsResultsMap = new Map(); - - hcaptchaStatsResults.forEach((entry) => { - hcaptchaStatsResultsMap.set(entry.date, entry); - }); - - hmtStatsResults.forEach((entry) => { - hmtStatsResultsMap.set(entry.date, entry); - }); - return allDates.map((date) => { - const hmtStatsEntry: HMTDailyStat = hmtStatsResultsMap.get(date) || { - dailyUniqueReceivers: 0, - dailyUniqueSenders: 0, - date: date, - totalTransactionAmount: 0, - totalTransactionCount: 0, - }; - - const hcaptchaStatsEntry: HcaptchaDailyStat = hcaptchaStatsResultsMap.get( - date - ) || { - date: date, - solved: 0, - }; - return { ...hmtStatsEntry, ...hcaptchaStatsEntry }; - }); -}; - -const DEBOUNCE_MS = 300; - -export function useGraphPageChartData() { - const { dateRangeParams } = useGraphPageChartParams(); - const queryParams = useMemo( - () => ({ - from: dateRangeParams.from.format('YYYY-MM-DD'), - to: dateRangeParams.to.format('YYYY-MM-DD'), - }), - [dateRangeParams.from, dateRangeParams.to] - ); - - const [debouncedQueryParams] = useDebounce(queryParams, DEBOUNCE_MS); - - return useQuery({ - queryFn: async () => { - const { data: hmtDailyStats } = await httpService.get( - apiPaths.hmtDailyStats.path, - { - params: debouncedQueryParams, - } - ); - const { data: hcaptchDailyStats } = await httpService.get( - apiPaths.hcaptchaStatsDaily.path, - { - params: debouncedQueryParams, - } - ); - - const validHmtDailyStats = validateResponse( - hmtDailyStats, - hmtDailyStatSchemaResponseSchema - ); - - const validHcaptchaGeneralStats = validateResponse( - hcaptchDailyStats, - hcaptchaDailyStatsResponseSchema - ); - - return mergeResponses( - validHcaptchaGeneralStats.results, - validHmtDailyStats.results - ); - }, - staleTime: DEBOUNCE_MS, - queryKey: ['useGraphPageChartData', debouncedQueryParams], - placeholderData: keepPreviousData, - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx b/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx deleted file mode 100644 index e6256c24fe..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { validateResponse } from '@/services/validate-response'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -const successHcaptchaGeneralStatsResponseSchema = z.object({ - solved: z.number(), -}); - -export type HcaptchaGeneralStats = z.infer< - typeof successHcaptchaGeneralStatsResponseSchema ->; - -export function useHcaptchaGeneralStats() { - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get( - apiPaths.hcaptchaGeneralStats.path - ); - - const validResponse = validateResponse( - data, - successHcaptchaGeneralStatsResponseSchema - ); - - return validResponse; - }, - queryKey: ['useHcaptchaGeneralStats'], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx b/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx deleted file mode 100644 index c3427cdeeb..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { validateResponse } from '@/services/validate-response'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -const successHMTPriceResponseSchema = z.object({ - hmtPrice: z.number(), -}); - -export type HMTPrice = z.infer; - -export function useHMTPrice() { - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get(apiPaths.statsHmtPrice.path); - - const validResponse = validateResponse( - data, - successHMTPriceResponseSchema - ); - - return validResponse.hmtPrice; - }, - queryKey: ['useHMTPrice'], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx b/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx deleted file mode 100644 index bbc26e77f0..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-kvstore-data.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { apiPaths } from '@/services/api-paths'; -import { httpService } from '@/services/http-service'; -import { validateResponse } from '@/services/validate-response'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - -const kvstoreDataSchema = z.array( - z.object({ - key: z.string(), - value: z.string(), - }) -); - -export type KvstoreData = z.infer; - -const useKvstoreData = () => { - const { filterParams } = useWalletSearch(); - - return useQuery({ - queryKey: ['kvstoreData', filterParams.address], - queryFn: async () => { - const { data } = await httpService.get( - `${apiPaths.kvstore.path}/${filterParams.address}`, - { params: { chain_id: filterParams.chainId || -1 } } - ); - - const validResponse = validateResponse(data, kvstoreDataSchema); - - return validResponse; - }, - }); -}; - -export default useKvstoreData; diff --git a/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx b/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx deleted file mode 100644 index 37919661ba..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { validateResponse } from '@/services/validate-response'; -import { useLeaderboardSearch } from '@/utils/hooks/use-leaderboard-search'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -export const reputationSchema = z.unknown().transform((value) => { - try { - const knownReputation = z - .union([z.literal('Low'), z.literal('Medium'), z.literal('High')]) - .parse(value); - - return knownReputation; - } catch (error) { - console.error(error); - return 'Unknown'; - } -}); - -export type Reputation = z.infer; - -const leaderBoardEntity = z.object({ - address: z.string(), - role: z.string(), - amountStaked: z - .string() - .transform((value, ctx) => { - const valueAsNumber = Number(value); - - if (Number.isNaN(valueAsNumber)) { - ctx.addIssue({ - path: ['amountStaked'], - code: z.ZodIssueCode.custom, - }); - } - - return valueAsNumber / 10 ** 18; - }) - .nullable(), - reputation: reputationSchema, - fee: z.number().nullable(), - jobTypes: z.array(z.string()).nullable(), - url: z.string().nullable(), - website: z.string().nullable(), - chainId: z.number(), - name: z.string().nullable(), - category: z.string().nullable(), -}); - -export const leaderBoardSuccessResponseSchema = z.array(leaderBoardEntity); -export type LeaderBoardEntity = z.infer; -export type LeaderBoardData = z.infer; - -export function useLeaderboardDetails(first?: number) { - const { - filterParams: { chainId }, - } = useLeaderboardSearch(); - - return useQuery({ - queryFn: async () => { - if (chainId === -1) { - return []; - } - - const { data } = await httpService.get(apiPaths.leaderboardDetails.path, { - params: { chainId, first }, - }); - - const validResponse = validateResponse( - data, - leaderBoardSuccessResponseSchema - ); - - return validResponse; - }, - queryKey: ['useLeaderboardDetails', chainId, first], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx b/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx deleted file mode 100644 index b4f2fe453c..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; - -import { validateResponse } from '@/services/validate-response'; -import { useTransactionDetailsDto } from '@/utils/hooks/use-transactions-details-dto'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - -import { apiPaths } from '../api-paths'; -import { httpService } from '../http-service'; - -const internalTransactionSchema = z.object({ - from: z.string(), - to: z.string(), - value: z.string(), - method: z.string(), - receiver: z.string().nullable(), - escrow: z.string().nullable(), - token: z.string().nullable(), -}); -const transactionDetailsSuccessResponseSchema = z.object({ - txHash: z.string(), - method: z.string(), - from: z.string(), - to: z.string(), - receiver: z.string().nullable(), - block: z.number(), - value: z.string(), - internalTransactions: z.array(internalTransactionSchema), -}); - -export type TransactionDetails = z.infer< - typeof transactionDetailsSuccessResponseSchema ->; - -const paginatedTransactionDetailsSuccessResponseSchema = z.object({ - address: z.string(), - chainId: z.number(), - first: z.number(), - skip: z.number(), - results: z.array(transactionDetailsSuccessResponseSchema), -}); - -export type PaginatedTransactionDetails = z.infer< - typeof paginatedTransactionDetailsSuccessResponseSchema ->; - -export interface PaginatedTransactionDetailsDto { - skip: number; - first: number; - chainId: number; -} - -export function useTransactionDetails() { - const { filterParams } = useWalletSearch(); - const { - params, - pagination: { lastPageIndex, page }, - setLastPageIndex, - } = useTransactionDetailsDto(); - - const dto: PaginatedTransactionDetailsDto = { - chainId: filterParams.chainId, - skip: params.skip, - first: params.first, - }; - - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get( - `${apiPaths.transactionDetails.path}/${filterParams.address}`, - { - params: dto, - } - ); - - const validResponse = validateResponse( - data, - paginatedTransactionDetailsSuccessResponseSchema - ); - - // check if last page - if (lastPageIndex === undefined) { - const { data: lastPageCheckData } = await httpService.get( - `${apiPaths.transactionDetails.path}/${filterParams.address}`, - { - params: { - ...dto, - skip: dto.skip + validResponse.results.length, - first: 1, - }, - } - ); - const validLastPageCheckData = validateResponse( - lastPageCheckData, - paginatedTransactionDetailsSuccessResponseSchema - ); - - if (validLastPageCheckData.results.length === 0) { - setLastPageIndex(page + 1); - } - } - - return validResponse; - }, - queryKey: ['useTransactionDetails', filterParams.address, dto], - }); -} diff --git a/packages/apps/dashboard/client/src/services/http-service.ts b/packages/apps/dashboard/client/src/services/http-service.ts deleted file mode 100644 index 92fbd08e36..0000000000 --- a/packages/apps/dashboard/client/src/services/http-service.ts +++ /dev/null @@ -1,7 +0,0 @@ -import axios from 'axios'; - -import { env } from '../helpers/env'; - -export const httpService = axios.create({ - baseURL: env.VITE_API_URL, -}); diff --git a/packages/apps/dashboard/client/src/services/api-paths.ts b/packages/apps/dashboard/client/src/shared/api/apiPaths.ts similarity index 93% rename from packages/apps/dashboard/client/src/services/api-paths.ts rename to packages/apps/dashboard/client/src/shared/api/apiPaths.ts index dfa16f9f30..8bff832b59 100644 --- a/packages/apps/dashboard/client/src/services/api-paths.ts +++ b/packages/apps/dashboard/client/src/shared/api/apiPaths.ts @@ -1,4 +1,4 @@ -export const apiPaths = { +const apiPaths = { hcaptchaGeneralStats: { path: '/stats/hcaptcha/general', }, @@ -33,3 +33,5 @@ export const apiPaths = { path: '/details/kvstore', }, } as const; + +export default apiPaths; diff --git a/packages/apps/dashboard/client/src/shared/api/httpClient.ts b/packages/apps/dashboard/client/src/shared/api/httpClient.ts new file mode 100644 index 0000000000..0a222e29e8 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/api/httpClient.ts @@ -0,0 +1,9 @@ +import axios from 'axios'; + +import { env } from '@/shared/config/env'; + +const httpClient = axios.create({ + baseURL: env.VITE_API_URL, +}); + +export default httpClient; diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts b/packages/apps/dashboard/client/src/shared/api/useFilteredNetworks.ts similarity index 67% rename from packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts rename to packages/apps/dashboard/client/src/shared/api/useFilteredNetworks.ts index 3cc624434e..861b903ca0 100644 --- a/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts +++ b/packages/apps/dashboard/client/src/shared/api/useFilteredNetworks.ts @@ -3,13 +3,14 @@ import { useMemo } from 'react'; import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { apiPaths } from '@/services/api-paths'; -import { httpService } from '@/services/http-service'; -import { networks as allNetworks } from '@/utils/config/networks'; +import { networks as allNetworks } from '@/shared/lib/networks'; + +import apiPaths from './apiPaths'; +import httpClient from './httpClient'; const enabledChainsSchema = z.array(z.number()); -export const useFilteredNetworks = () => { +const useFilteredNetworks = () => { const { data: enabledChains, isLoading, @@ -17,7 +18,7 @@ export const useFilteredNetworks = () => { } = useQuery({ queryKey: ['enabledChains'], queryFn: async () => { - const response = await httpService.get(apiPaths.enabledChains.path); + const response = await httpClient.get(apiPaths.enabledChains.path); return enabledChainsSchema.parse(response.data); }, }); @@ -30,3 +31,5 @@ export const useFilteredNetworks = () => { return { filteredNetworks, isLoading, error }; }; + +export default useFilteredNetworks; diff --git a/packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts b/packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts new file mode 100644 index 0000000000..ad74d8cf2a --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts @@ -0,0 +1,28 @@ +import { useQuery } from '@tanstack/react-query'; +import { z } from 'zod'; + +import validateResponse from '@/shared/lib/validateResponse'; + +import apiPaths from './apiPaths'; +import httpClient from './httpClient'; + +const hmtPriceResponseSchema = z.object({ + hmtPrice: z.number(), +}); + +export type HmtPrice = z.infer; + +const useHmtPrice = () => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get(apiPaths.statsHmtPrice.path); + + const validResponse = validateResponse(data, hmtPriceResponseSchema); + + return validResponse.hmtPrice; + }, + queryKey: ['useHmtPrice'], + }); +}; + +export default useHmtPrice; diff --git a/packages/apps/dashboard/client/src/helpers/env.ts b/packages/apps/dashboard/client/src/shared/config/env.ts similarity index 100% rename from packages/apps/dashboard/client/src/helpers/env.ts rename to packages/apps/dashboard/client/src/shared/config/env.ts diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-breakpoints.tsx b/packages/apps/dashboard/client/src/shared/hooks/useBreakpoints.tsx similarity index 100% rename from packages/apps/dashboard/client/src/utils/hooks/use-breakpoints.tsx rename to packages/apps/dashboard/client/src/shared/hooks/useBreakpoints.tsx diff --git a/packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts b/packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts new file mode 100644 index 0000000000..39cfa892b0 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts @@ -0,0 +1,12 @@ +const abbreviateAddress = (address: string | null) => { + if (address) { + const first3Letters = address.slice(0, 5); + const last5Letters = address.slice(-5); + + return `${first3Letters}...${last5Letters}`; + } + + return null; +}; + +export default abbreviateAddress; diff --git a/packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts b/packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts new file mode 100644 index 0000000000..ea4b8843ed --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts @@ -0,0 +1,8 @@ +const convertSnakeToHumanReadable = (string: string) => { + return string + .split('_') + .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(' '); +}; + +export default convertSnakeToHumanReadable; diff --git a/packages/apps/dashboard/client/src/helpers/formatHMTDecimals.ts b/packages/apps/dashboard/client/src/shared/lib/formatHmtDecimals.ts similarity index 87% rename from packages/apps/dashboard/client/src/helpers/formatHMTDecimals.ts rename to packages/apps/dashboard/client/src/shared/lib/formatHmtDecimals.ts index 8a6adfd05b..c0610ad83b 100644 --- a/packages/apps/dashboard/client/src/helpers/formatHMTDecimals.ts +++ b/packages/apps/dashboard/client/src/shared/lib/formatHmtDecimals.ts @@ -1,6 +1,6 @@ import { formatEther } from 'ethers'; -export const formatHMTDecimals = (value: string) => { +const formatHmtDecimals = (value: string) => { const formattedValue = Number(formatEther(value)); if (Number.isInteger(formattedValue)) { @@ -22,3 +22,5 @@ export const formatHMTDecimals = (value: string) => { ? formattedValue.toFixed(4) : formattedValue.toString(); }; + +export default formatHmtDecimals; diff --git a/packages/apps/dashboard/client/src/services/handle-error-message.ts b/packages/apps/dashboard/client/src/shared/lib/handleErrorMessage.ts similarity index 76% rename from packages/apps/dashboard/client/src/services/handle-error-message.ts rename to packages/apps/dashboard/client/src/shared/lib/handleErrorMessage.ts index 4e69c870ac..ff81428b80 100644 --- a/packages/apps/dashboard/client/src/services/handle-error-message.ts +++ b/packages/apps/dashboard/client/src/shared/lib/handleErrorMessage.ts @@ -1,7 +1,7 @@ import { AxiosError } from 'axios'; import { ZodError } from 'zod'; -export function handleErrorMessage(unknownError: unknown): string { +const handleErrorMessage = (unknownError: unknown): string => { if (unknownError instanceof AxiosError) { return unknownError.message; } @@ -15,4 +15,6 @@ export function handleErrorMessage(unknownError: unknown): string { } return 'Something went wrong'; -} +}; + +export default handleErrorMessage; diff --git a/packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts b/packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts new file mode 100644 index 0000000000..375c45011b --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts @@ -0,0 +1,6 @@ +const isValidEVMAddress = (input: string): boolean => { + const evmRegex = /^0x[a-fA-F0-9]{40}$/; + return evmRegex.test(input); +}; + +export default isValidEVMAddress; diff --git a/packages/apps/dashboard/client/src/utils/config/networks.ts b/packages/apps/dashboard/client/src/shared/lib/networks.ts similarity index 96% rename from packages/apps/dashboard/client/src/utils/config/networks.ts rename to packages/apps/dashboard/client/src/shared/lib/networks.ts index 05d80ebb58..68d850c418 100644 --- a/packages/apps/dashboard/client/src/utils/config/networks.ts +++ b/packages/apps/dashboard/client/src/shared/lib/networks.ts @@ -1,7 +1,7 @@ import type { Chain } from 'viem/chains'; import * as chains from 'viem/chains'; -import { env } from '@/helpers/env'; +import { env } from '@/shared/config/env'; //TODO: temporal fix. Should be fetched from API. https://github.com/humanprotocol/human-protocol/issues/2855 const ENABLED_CHAIN_IDS = env.VITE_ENABLED_CHAIN_IDS; diff --git a/packages/apps/dashboard/client/src/services/validate-response.ts b/packages/apps/dashboard/client/src/shared/lib/validateResponse.ts similarity index 82% rename from packages/apps/dashboard/client/src/services/validate-response.ts rename to packages/apps/dashboard/client/src/shared/lib/validateResponse.ts index d91f29b073..d2c74bed9c 100644 --- a/packages/apps/dashboard/client/src/services/validate-response.ts +++ b/packages/apps/dashboard/client/src/shared/lib/validateResponse.ts @@ -1,6 +1,6 @@ import { ZodError, type z } from 'zod'; -export const validateResponse = ( +const validateResponse = ( object: unknown, zodObject: T ): z.infer => { @@ -19,3 +19,5 @@ export const validateResponse = ( throw error; } }; + +export default validateResponse; diff --git a/packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts b/packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts new file mode 100644 index 0000000000..0bfeef257c --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts @@ -0,0 +1,21 @@ +import { create } from 'zustand'; + +type GlobalFiltersStore = { + address: string; + chainId: number; + setAddress: (address: string) => void; + setChainId: (chainId: number) => void; +}; + +const useGlobalFiltersStore = create((set) => ({ + address: '', + chainId: -1, + setAddress: (address) => { + set({ address }); + }, + setChainId: (chainId) => { + set({ chainId }); + }, +})); + +export default useGlobalFiltersStore; diff --git a/packages/apps/dashboard/client/src/services/global.type.ts b/packages/apps/dashboard/client/src/shared/types/global.type.ts similarity index 100% rename from packages/apps/dashboard/client/src/services/global.type.ts rename to packages/apps/dashboard/client/src/shared/types/global.type.ts diff --git a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx b/packages/apps/dashboard/client/src/shared/ui/AbbreviateClipboard/index.tsx similarity index 90% rename from packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx rename to packages/apps/dashboard/client/src/shared/ui/AbbreviateClipboard/index.tsx index f59a321b95..83c1e14638 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/AbbreviateClipboard/index.tsx @@ -7,8 +7,8 @@ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; -import CustomTooltip from '@/components/CustomTooltip'; -import abbreviateValue from '@/helpers/abbreviateValue'; +import abbreviateAddress from '@/shared/lib/abbreviateAddress'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; interface AbbreviateClipboardProps { value: string; @@ -49,11 +49,11 @@ const AbbreviateClipboard = ({ value, link }: AbbreviateClipboardProps) => { }, }} > - {abbreviateValue(value)} + {abbreviateAddress(value)} ) : ( - <>{abbreviateValue(value)} + <>{abbreviateAddress(value)} )}
, 'open' | 'onOpen' | 'onClose'>; } -const CustomDaterPicker = ({ props }: CustomDatePickerProps) => { - const [open, setOpen] = useState(false); +const CustomDatePicker = ({ props }: CustomDatePickerProps) => { + const [open, setOpen] = useState(false); return ( { return ( - = ({ role }) => { + switch (role) { + case Role.JobLauncher: + return ; + case Role.RecordingOracle: + return ; + case Role.ReputationOracle: + return ; + case Role.ExchangeOracle: + return ; + default: + return ; + } +}; + +export default EntityIcon; diff --git a/packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx b/packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx new file mode 100644 index 0000000000..43f4a848dd --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx @@ -0,0 +1,22 @@ +import { FC } from 'react'; + +import { NumericFormat } from 'react-number-format'; + +type Props = { + value: number | string | undefined | null; + decimalScale?: number; +}; + +const FormattedNumber: FC = ({ value, decimalScale = 9 }) => { + return ( + + ); +}; + +export default FormattedNumber; diff --git a/packages/apps/dashboard/client/src/components/Loader/index.tsx b/packages/apps/dashboard/client/src/shared/ui/Loader/index.tsx similarity index 100% rename from packages/apps/dashboard/client/src/components/Loader/index.tsx rename to packages/apps/dashboard/client/src/shared/ui/Loader/index.tsx diff --git a/packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx b/packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx new file mode 100644 index 0000000000..5126ad866e --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx @@ -0,0 +1,26 @@ +import { ChainId } from '@human-protocol/sdk'; + +import BinanceSmartChainIcon from '@/shared/ui/icons/BinanceSmartChainIcon'; +import EthereumIcon from '@/shared/ui/icons/EthereumIcon'; +import HumanIcon from '@/shared/ui/icons/HumanIcon'; +import PolygonIcon from '@/shared/ui/icons/PolygonIcon'; + +export const NetworkIcon = ({ chainId }: { chainId: ChainId }) => { + const icon = (() => { + switch (chainId) { + case 1: + case 11155111: + return ; + case 56: + case 97: + return ; + case 137: + case 80002: + return ; + default: + return ; + } + })(); + + return <>{icon}; +}; diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx b/packages/apps/dashboard/client/src/shared/ui/SearchBar/index.tsx similarity index 77% rename from packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx rename to packages/apps/dashboard/client/src/shared/ui/SearchBar/index.tsx index c8f5f325e6..939908955f 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/SearchBar/index.tsx @@ -17,13 +17,12 @@ import IconButton from '@mui/material/IconButton'; import clsx from 'clsx'; import { useNavigate } from 'react-router-dom'; -import CustomTooltip from '@/components/CustomTooltip'; -import { NetworkIcon } from '@/components/NetworkIcon'; -import { useIsMobile } from '@/utils/hooks/use-breakpoints'; -import { useFilteredNetworks } from '@/utils/hooks/use-filtered-networks'; -import { useWalletSearch } from '@/utils/hooks/use-wallet-search'; - -import { isValidEVMAddress } from '../../helpers/isValidEVMAddress'; +import useFilteredNetworks from '@/shared/api/useFilteredNetworks'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import isValidEvmAddress from '@/shared/lib/isValidEvmAddress'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; +import { NetworkIcon } from '@/shared/ui/NetworkIcon'; import { endAdornmentInputAdornmentSx, @@ -33,12 +32,12 @@ import { muiTextFieldInputPropsSx, muiTextFieldSx, gridSx, -} from './SearchBar.styles'; +} from './styles'; -interface SearchBarProps { +type SearchBarProps = { className?: string; initialInputValue?: string; -} +}; const SearchBar: FC = ({ className = '', @@ -46,7 +45,7 @@ const SearchBar: FC = ({ }) => { const isMobile = useIsMobile(); const { filteredNetworks, isLoading } = useFilteredNetworks(); - const { filterParams, setChainId, setAddress } = useWalletSearch(); + const { address, chainId, setChainId, setAddress } = useGlobalFiltersStore(); const navigate = useNavigate(); const [inputValue, setInputValue] = useState(initialInputValue); const [error, setError] = useState(null); @@ -54,34 +53,30 @@ const SearchBar: FC = ({ const theme = useTheme(); useEffect(() => { - setInputValue(filterParams.address); - }, [filterParams.address]); + setInputValue(address); + }, [address]); useEffect(() => { - if ( - !isLoading && - filteredNetworks.length > 0 && - filterParams.chainId === -1 - ) { + if (!isLoading && filteredNetworks.length > 0 && chainId === -1) { setChainId(filteredNetworks[0].id); } - }, [filteredNetworks, isLoading, filterParams.chainId, setChainId]); + }, [filteredNetworks, isLoading, chainId, setChainId]); const navigateToAddress = useCallback(() => { - if (!isValidEVMAddress(inputValue)) { + if (!isValidEvmAddress(inputValue)) { setError('Invalid EVM address.'); return; } setAddress(inputValue); - navigate(`/search/${filterParams.chainId}/${inputValue}`); - }, [inputValue, filterParams.chainId, navigate, setAddress]); + navigate(`/search/${chainId}/${inputValue}`); + }, [inputValue, chainId, navigate, setAddress]); const handleInputChange = (event: React.ChangeEvent) => { const value = event.target.value; setInputValue(value); - if (isValidEVMAddress(value)) { + if (isValidEvmAddress(value)) { setError(null); } else if (value.length > 0) { setError('Invalid EVM address. Must start with 0x and be 42 characters.'); @@ -115,15 +110,12 @@ const SearchBar: FC = ({ const renderSelectedValue = ( n.id === filterParams.chainId)?.id || -1 - } + chainId={filteredNetworks.find((n) => n.id === chainId)?.id || -1} />
- {isMobile || filterParams.chainId === -1 + {isMobile || chainId === -1 ? null - : filteredNetworks.find((n) => n.id === filterParams.chainId)?.name || - ''} + : filteredNetworks.find((n) => n.id === chainId)?.name || ''}
); @@ -152,21 +144,19 @@ const SearchBar: FC = ({ sx={startAdornmentInputAdornmentSx(theme)} > - value={filterParams.chainId} + value={chainId} displayEmpty sx={muiSelectSx(theme)} onChange={handleSelectChange} renderValue={() => - filterParams.chainId === -1 - ? renderEmptyValue - : renderSelectedValue + chainId === -1 ? renderEmptyValue : renderSelectedValue } > {filteredNetworks.map((network) => ( diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts b/packages/apps/dashboard/client/src/shared/ui/SearchBar/styles.ts similarity index 100% rename from packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts rename to packages/apps/dashboard/client/src/shared/ui/SearchBar/styles.ts diff --git a/packages/apps/dashboard/client/src/components/SectionWrapper/index.tsx b/packages/apps/dashboard/client/src/shared/ui/SectionWrapper/index.tsx similarity index 100% rename from packages/apps/dashboard/client/src/components/SectionWrapper/index.tsx rename to packages/apps/dashboard/client/src/shared/ui/SectionWrapper/index.tsx diff --git a/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/ShadowIcon/index.tsx similarity index 100% rename from packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/ShadowIcon/index.tsx diff --git a/packages/apps/dashboard/client/src/components/Icons/BinanceSmartChainIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/BinanceSmartChainIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/BinanceSmartChainIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/BinanceSmartChainIcon.tsx index 4986041821..4e99f7ee6a 100644 --- a/packages/apps/dashboard/client/src/components/Icons/BinanceSmartChainIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/BinanceSmartChainIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const BinanceSmartChainIcon: FC = (props) => { +const BinanceSmartChainIcon: FC = (props) => { return ( = (props) => { +const DarkModeIcon: FC = (props) => { return ( = (props) => { ); }; + +export default DarkModeIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/DiscordIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/DiscordIcon.tsx similarity index 100% rename from packages/apps/dashboard/client/src/components/Icons/DiscordIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/DiscordIcon.tsx diff --git a/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/EscrowAddressIcon.tsx similarity index 98% rename from packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/EscrowAddressIcon.tsx index 754095c5b6..fe065f746d 100644 --- a/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/EscrowAddressIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const EscrowAddressIcon: FC = (props) => { +const EscrowAddressIcon: FC = (props) => { return ( = (props) => { ); }; + +export default EscrowAddressIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/EthereumIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/EthereumIcon.tsx similarity index 94% rename from packages/apps/dashboard/client/src/components/Icons/EthereumIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/EthereumIcon.tsx index 5166d0b871..61e39522cf 100644 --- a/packages/apps/dashboard/client/src/components/Icons/EthereumIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/EthereumIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const EthereumIcon: FC = (props) => { +const EthereumIcon: FC = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/ExchangeOracleIcon.tsx similarity index 93% rename from packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/ExchangeOracleIcon.tsx index be1d4c4bfd..f4fd72d70d 100644 --- a/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/ExchangeOracleIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const ExchangeOracleIcon: FC = (props) => { +const ExchangeOracleIcon: FC = (props) => { return ( = (props) => { ); }; + +export default ExchangeOracleIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/HumanIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/HumanIcon.tsx similarity index 97% rename from packages/apps/dashboard/client/src/components/Icons/HumanIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/HumanIcon.tsx index cfcc3ab87c..90581b56c1 100644 --- a/packages/apps/dashboard/client/src/components/Icons/HumanIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/HumanIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const HumanIcon: FC = (props) => { +const HumanIcon: FC = (props) => { return ( = (props) => { +const JobLauncherIcon: FC = (props) => { return ( = (props) => { ); }; + +export default JobLauncherIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LeaderboardIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LeaderboardIcon.tsx similarity index 98% rename from packages/apps/dashboard/client/src/components/Icons/LeaderboardIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LeaderboardIcon.tsx index b975b6d247..585a217543 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LeaderboardIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LeaderboardIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const LeaderboardIcon: FC = (props) => { +const LeaderboardIcon: FC = (props) => { return ( = (props) => { ); }; + +export default LeaderboardIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LightModeIcon.tsx similarity index 94% rename from packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LightModeIcon.tsx index eae0b2bd2e..5e8866c7f8 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LightModeIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LightModeIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const LightModeIcon: FC = (props) => { +const LightModeIcon: FC = (props) => { return ( = (props) => { ); }; + +export default LightModeIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/LogoBlockIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIcon.tsx index 82d9a19225..ea6291608a 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const LogoBlockIcon: FC = (props) => { +const LogoBlockIcon: FC = (props) => { return ( = (props) => { ); }; + +export default LogoBlockIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIconMobile.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIconMobile.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/LogoBlockIconMobile.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIconMobile.tsx index 48f12c2a4e..1fdf5e9d2c 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIconMobile.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIconMobile.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const LogoBlockIconMobile: FC = (props) => { +const LogoBlockIconMobile: FC = (props) => { return ( = (props) => { ); }; + +export default LogoBlockIconMobile; diff --git a/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/PolygonIcon.tsx similarity index 97% rename from packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/PolygonIcon.tsx index 9233ed8930..0eb1c1ef40 100644 --- a/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/PolygonIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const PolygonIcon: FC = (props) => { +const PolygonIcon: FC = (props) => { return ( = (props) => { +const RecordingOracleIcon: FC = (props) => { return ( = (props) => { ); }; + +export default RecordingOracleIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/ReputationOracle.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/ReputationOracleIcon.tsx similarity index 95% rename from packages/apps/dashboard/client/src/components/Icons/ReputationOracle.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/ReputationOracleIcon.tsx index 6a0bfee79c..67639b7fca 100644 --- a/packages/apps/dashboard/client/src/components/Icons/ReputationOracle.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/ReputationOracleIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const ReputationOracle: FC = (props) => { +const ReputationOracleIcon: FC = (props) => { return ( = (props) => { ); }; + +export default ReputationOracleIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/WalletIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/WalletIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/WalletIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/WalletIcon.tsx index 00a4435de9..d8f159c4fa 100644 --- a/packages/apps/dashboard/client/src/components/Icons/WalletIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/WalletIcon.tsx @@ -2,7 +2,7 @@ import { FC } from 'react'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -export const WalletIcon: FC = (props) => { +const WalletIcon: FC = (props) => { return ( = (props) => { ); }; + +export default WalletIcon; diff --git a/packages/apps/dashboard/client/src/theme.tsx b/packages/apps/dashboard/client/src/shared/ui/theme/index.tsx similarity index 71% rename from packages/apps/dashboard/client/src/theme.tsx rename to packages/apps/dashboard/client/src/shared/ui/theme/index.tsx index 55d021e695..56307ab400 100644 --- a/packages/apps/dashboard/client/src/theme.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/theme/index.tsx @@ -7,6 +7,8 @@ import { PaletteColor, } from '@mui/material/styles/createPalette'; +import { lightPalette, darkPalette } from './palette'; + declare module '@mui/material/Typography' { interface TypographyPropsVariantOverrides { tooltip: true; @@ -97,145 +99,7 @@ export const createAppTheme = (mode: 'light' | 'dark') => { return createTheme({ palette: { mode, - ...(mode === 'light' - ? { - primary: { - main: '#320a8d', - light: '#320a8d', - }, - secondary: { - main: '#6309ff', - light: '#1406B280', - dark: '#14062b', - }, - text: { - primary: '#320a8d', - secondary: '#858ec6', - }, - info: { - main: '#eeeeee', - light: '#f5f5f5', - dark: '#bdbdbd', - }, - sky: { - main: '#858ec6', - light: '#858ec6', - dark: '#dadef0cc', - contrastText: '#858ec6', - }, - white: { - main: '#ffffff', - light: '#f6f5fc', - dark: '#f6f7fe', - contrastText: '#f9faff', - }, - success: { - main: '#0ad397', - light: '#2e7d3280', - }, - warning: { - main: '#ffb300', - light: '#ffd54f', - }, - error: { - main: '#ffb300', - light: '#f20d5f', - }, - orange: { - main: '#ed6c02', - light: '#ed6c0280', - }, - ocean: { - main: '#304ffe', - light: '#8c9eff', - dark: '#03a9f4', - }, - fog: { - main: '#858ec6', - light: '#cbcfe6', - dark: '#e5e7f3', - }, - link: { - main: '#0000ee', - hover: '#1406b2', - visited: '#551a8b', - }, - table: { - main: '#ffffff01', - selected: '#1406b21f', - secondary: '#1406b20a', - }, - overlay: '#1406b20a', - } - : { - primary: { - main: '#320a8d', - light: '#320a8d', - }, - secondary: { - main: '#6309ff', - light: '#1406B280', - dark: '#14062b', - }, - text: { - primary: '#320a8d', - secondary: '#858ec6', - }, - info: { - main: '#eeeeee', - light: '#f5f5f5', - dark: '#bdbdbd', - }, - sky: { - main: '#858ec6', - light: '#858ec6', - dark: '#dadef0cc', - contrastText: '#858ec6', - }, - white: { - main: '#ffffff', - light: '#f6f5fc', - dark: '#f6f7fe', - contrastText: '#f9faff', - }, - success: { - main: '#0ad397', - light: '#2e7d3280', - }, - warning: { - main: '#ffb300', - light: '#ffd54f', - }, - error: { - main: '#ffb300', - light: '#f20d5f', - }, - orange: { - main: '#ed6c02', - light: '#ed6c0280', - }, - ocean: { - main: '#304ffe', - light: '#8c9eff', - dark: '#03a9f4', - }, - fog: { - main: '#858ec6', - light: '#cbcfe6', - dark: '#e5e7f3', - }, - link: { - main: '#0000ee', - hover: '#1406b2', - visited: '#551a8b', - }, - table: { - main: '#ffffff01', - selected: '#1406b21f', - secondary: '#1406b20a', - }, - overlay: '#1406b20a', - }), + ...(mode === 'light' ? lightPalette : darkPalette), }, typography: { fontFamily: 'Inter, Arial, sans-serif', diff --git a/packages/apps/dashboard/client/src/shared/ui/theme/palette.ts b/packages/apps/dashboard/client/src/shared/ui/theme/palette.ts new file mode 100644 index 0000000000..7790326b36 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/theme/palette.ts @@ -0,0 +1,139 @@ +export const lightPalette = { + primary: { + main: '#320a8d', + light: '#320a8d', + }, + secondary: { + main: '#6309ff', + light: '#1406B280', + dark: '#14062b', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + sky: { + main: '#858ec6', + light: '#858ec6', + dark: '#dadef0cc', + contrastText: '#858ec6', + }, + white: { + main: '#ffffff', + light: '#f6f5fc', + dark: '#f6f7fe', + contrastText: '#f9faff', + }, + success: { + main: '#0ad397', + light: '#2e7d3280', + }, + warning: { + main: '#ffb300', + light: '#ffd54f', + }, + error: { + main: '#ffb300', + light: '#f20d5f', + }, + orange: { + main: '#ed6c02', + light: '#ed6c0280', + }, + ocean: { + main: '#304ffe', + light: '#8c9eff', + dark: '#03a9f4', + }, + fog: { + main: '#858ec6', + light: '#cbcfe6', + dark: '#e5e7f3', + }, + link: { + main: '#0000ee', + hover: '#1406b2', + visited: '#551a8b', + }, + table: { + main: '#ffffff01', + selected: '#1406b21f', + secondary: '#1406b20a', + }, + overlay: '#1406b20a', +}; + +export const darkPalette = { + primary: { + main: '#320a8d', + light: '#320a8d', + }, + secondary: { + main: '#6309ff', + light: '#1406B280', + dark: '#14062b', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + sky: { + main: '#858ec6', + light: '#858ec6', + dark: '#dadef0cc', + contrastText: '#858ec6', + }, + white: { + main: '#ffffff', + light: '#f6f5fc', + dark: '#f6f7fe', + contrastText: '#f9faff', + }, + success: { + main: '#0ad397', + light: '#2e7d3280', + }, + warning: { + main: '#ffb300', + light: '#ffd54f', + }, + error: { + main: '#ffb300', + light: '#f20d5f', + }, + orange: { + main: '#ed6c02', + light: '#ed6c0280', + }, + ocean: { + main: '#304ffe', + light: '#8c9eff', + dark: '#03a9f4', + }, + fog: { + main: '#858ec6', + light: '#cbcfe6', + dark: '#e5e7f3', + }, + link: { + main: '#0000ee', + hover: '#1406b2', + visited: '#551a8b', + }, + table: { + main: '#ffffff01', + selected: '#1406b21f', + secondary: '#1406b20a', + }, + overlay: '#1406b20a', +}; diff --git a/packages/apps/dashboard/client/src/utils/case-converter.ts b/packages/apps/dashboard/client/src/utils/case-converter.ts deleted file mode 100644 index d17b45eaf0..0000000000 --- a/packages/apps/dashboard/client/src/utils/case-converter.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class CaseConverter { - static convertSnakeToHumanReadable(string: string): string { - return string - .split('_') - .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) - .join(' '); - } -} diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts b/packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts deleted file mode 100644 index deabad31bf..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { create } from 'zustand'; - -export interface EscrowDetailsDto { - params: { - first: number; - skip: number; - }; - pagination: { - page: number; - pageSize: number; - lastPageIndex?: number; - }; - setNextPage: () => void; - setPrevPage: () => void; - setPageSize: (pageSize: number) => void; - setLastPageIndex: (lastPageIndex: number | undefined) => void; -} - -const INITIAL_PAGE_SIZE = 10; - -export const useEscrowDetailsDto = create((set) => ({ - params: { - first: INITIAL_PAGE_SIZE, - skip: 0, - }, - pagination: { - page: 0, - pageSize: INITIAL_PAGE_SIZE, - lastPage: false, - }, - setNextPage() { - set((state) => { - const nextPage = state.pagination.page + 1; - const newSkip = nextPage * state.params.first; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: nextPage, - }, - }; - }); - }, - setPrevPage() { - set((state) => { - const prevPage = - state.pagination.page === 0 ? 0 : state.pagination.page - 1; - const offSetPages = prevPage === 0 ? 0 : state.pagination.page - 1; - const newSkip = state.params.first * offSetPages; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: prevPage, - }, - }; - }); - }, - setPageSize(pageSize: number) { - set((state) => { - return { - ...state, - pagination: { - lastPage: false, - page: 0, - pageSize: pageSize, - }, - params: { - ...state.params, - first: pageSize, - skip: 0, - }, - }; - }); - }, - setLastPageIndex(lastPageIndex: number | undefined) { - set((state) => { - return { - ...state, - pagination: { - ...state.pagination, - lastPageIndex, - }, - }; - }); - }, -})); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts b/packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts deleted file mode 100644 index f470ac22b9..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { create } from 'zustand'; - -export interface LeaderboardSearchStore { - filterParams: { - chainId: number; - }; - setChainId: (chainId: number) => void; -} - -export const useLeaderboardSearch = create((set) => ({ - filterParams: { - chainId: -1, - }, - setChainId: (chainId) => { - set((state) => ({ - filterParams: { - ...state.filterParams, - chainId, - }, - })); - }, -})); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts b/packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts deleted file mode 100644 index ce4219c922..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { create } from 'zustand'; - -export interface TransactionDetailsDto { - params: { - first: number; - skip: number; - }; - pagination: { - page: number; - pageSize: number; - lastPageIndex?: number; - }; - setNextPage: () => void; - setPrevPage: () => void; - setPageSize: (pageSize: number) => void; - setLastPageIndex: (lastPageIndex: number | undefined) => void; -} - -const INITIAL_PAGE_SIZE = 10; - -export const useTransactionDetailsDto = create( - (set) => ({ - params: { - first: INITIAL_PAGE_SIZE, - skip: 0, - }, - pagination: { - page: 0, - pageSize: INITIAL_PAGE_SIZE, - lastPage: false, - }, - setNextPage() { - set((state) => { - const nextPage = state.pagination.page + 1; - const newSkip = nextPage * state.params.first; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: nextPage, - }, - }; - }); - }, - setPrevPage() { - set((state) => { - const prevPage = - state.pagination.page === 0 ? 0 : state.pagination.page - 1; - const offSetPages = prevPage === 0 ? 0 : state.pagination.page - 1; - const newSkip = state.params.first * offSetPages; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: prevPage, - }, - }; - }); - }, - setPageSize(pageSize: number) { - set((state) => { - return { - ...state, - pagination: { - lastPage: false, - page: 0, - pageSize: pageSize, - }, - params: { - ...state.params, - first: pageSize, - skip: 0, - }, - }; - }); - }, - setLastPageIndex(lastPageIndex: number | undefined) { - set((state) => { - return { - ...state, - pagination: { - ...state.pagination, - lastPageIndex, - }, - }; - }); - }, - }) -); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts b/packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts deleted file mode 100644 index 6ff0ec5092..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { create } from 'zustand'; - -export interface WalletSearchStore { - filterParams: { - address: string; - chainId: number; - }; - setAddress: (address: string) => void; - setChainId: (chainId: number) => void; -} - -export const useWalletSearch = create((set) => ({ - filterParams: { - address: '', - chainId: -1, - }, - setAddress: (address) => { - set((state) => ({ - filterParams: { - ...state.filterParams, - address, - }, - })); - }, - setChainId: (chainId) => { - set((state) => ({ - filterParams: { - ...state.filterParams, - chainId, - }, - })); - }, -})); diff --git a/packages/apps/dashboard/client/src/widgets/footer/index.ts b/packages/apps/dashboard/client/src/widgets/footer/index.ts new file mode 100644 index 0000000000..95b6a1947f --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/footer/index.ts @@ -0,0 +1 @@ +export { default } from './ui/Footer'; diff --git a/packages/apps/dashboard/client/src/components/Footer/Footer.tsx b/packages/apps/dashboard/client/src/widgets/footer/ui/Footer.tsx similarity index 97% rename from packages/apps/dashboard/client/src/components/Footer/Footer.tsx rename to packages/apps/dashboard/client/src/widgets/footer/ui/Footer.tsx index a649b59936..1695d72ed0 100644 --- a/packages/apps/dashboard/client/src/components/Footer/Footer.tsx +++ b/packages/apps/dashboard/client/src/widgets/footer/ui/Footer.tsx @@ -9,8 +9,8 @@ import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; -import DiscordIcon from '@/components/Icons/DiscordIcon'; -import { env } from '@/helpers/env'; +import { env } from '@/shared/config/env'; +import DiscordIcon from '@/shared/ui/icons/DiscordIcon'; const StyledLink = styled(Link)(({ theme }) => ({ textDecoration: 'none', diff --git a/packages/apps/dashboard/client/src/widgets/header/index.ts b/packages/apps/dashboard/client/src/widgets/header/index.ts new file mode 100644 index 0000000000..529d6ba12a --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/header/index.ts @@ -0,0 +1 @@ +export { default } from './ui/Header'; diff --git a/packages/apps/dashboard/client/src/components/Header/Header.tsx b/packages/apps/dashboard/client/src/widgets/header/ui/Header.tsx similarity index 95% rename from packages/apps/dashboard/client/src/components/Header/Header.tsx rename to packages/apps/dashboard/client/src/widgets/header/ui/Header.tsx index 1d0197b81f..8b2703c8e4 100644 --- a/packages/apps/dashboard/client/src/components/Header/Header.tsx +++ b/packages/apps/dashboard/client/src/widgets/header/ui/Header.tsx @@ -12,9 +12,9 @@ import styled from '@mui/material/styles/styled'; import Toolbar from '@mui/material/Toolbar'; import { Link } from 'react-router-dom'; -import { LogoBlockIcon } from '@/components/Icons/LogoBlockIcon'; -import { LogoBlockIconMobile } from '@/components/Icons/LogoBlockIconMobile'; -import { env } from '@/helpers/env'; +import { env } from '@/shared/config/env'; +import LogoBlockIcon from '@/shared/ui/icons/LogoBlockIcon'; +import LogoBlockIconMobile from '@/shared/ui/icons/LogoBlockIconMobile'; const NavLink = styled(MuiLink)(({ theme }) => ({ color: theme.palette.primary.main, diff --git a/packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx b/packages/apps/dashboard/client/src/widgets/header/ui/ThemeModeSwitch.tsx similarity index 72% rename from packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx rename to packages/apps/dashboard/client/src/widgets/header/ui/ThemeModeSwitch.tsx index ebcaaab1f0..7be9bd599c 100644 --- a/packages/apps/dashboard/client/src/components/ThemeModeSwitch/index.tsx +++ b/packages/apps/dashboard/client/src/widgets/header/ui/ThemeModeSwitch.tsx @@ -2,8 +2,8 @@ import { FC } from 'react'; import { IconButton, useTheme } from '@mui/material'; -import { DarkModeIcon } from '@/components/Icons/DarkModeIcon'; -import { LightModeIcon } from '@/components/Icons/LightModeIcon'; +import DarkModeIcon from '@/shared/ui/icons/DarkModeIcon'; +import LightModeIcon from '@/shared/ui/icons/LightModeIcon'; const ThemeModeSwitch: FC = () => { const { isDarkMode, toggleColorMode } = useTheme(); diff --git a/packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts b/packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts new file mode 100644 index 0000000000..e80355c905 --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts @@ -0,0 +1 @@ +export { default } from './ui/PageWrapper'; diff --git a/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx b/packages/apps/dashboard/client/src/widgets/page-wrapper/ui/PageWrapper.tsx similarity index 86% rename from packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx rename to packages/apps/dashboard/client/src/widgets/page-wrapper/ui/PageWrapper.tsx index d5061f2ad1..e4096036c4 100644 --- a/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx +++ b/packages/apps/dashboard/client/src/widgets/page-wrapper/ui/PageWrapper.tsx @@ -2,8 +2,8 @@ import { FC, PropsWithChildren } from 'react'; import clsx from 'clsx'; -import Footer from '@/components/Footer'; -import Header from '@/components/Header'; +import Footer from '@/widgets/footer'; +import Header from '@/widgets/header'; const PageWrapper: FC< PropsWithChildren<{ diff --git a/packages/apps/dashboard/client/tsconfig.json b/packages/apps/dashboard/client/tsconfig.json index e3e56d6ef4..6b867f9387 100644 --- a/packages/apps/dashboard/client/tsconfig.json +++ b/packages/apps/dashboard/client/tsconfig.json @@ -3,7 +3,7 @@ "target": "ES2022", "useDefineForClassFields": true, "lib": ["ES2022", "DOM", "DOM.Iterable"], - "module": "ESNext", + "module": "ES2022", "skipLibCheck": true, /* Bundler mode */ @@ -12,7 +12,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx", + "jsx": "preserve", /* Linting */ "strict": true, diff --git a/packages/apps/dashboard/client/vite.config.ts b/packages/apps/dashboard/client/vite.config.ts index 7ff2b356c4..1d90c510e5 100644 --- a/packages/apps/dashboard/client/vite.config.ts +++ b/packages/apps/dashboard/client/vite.config.ts @@ -3,16 +3,11 @@ import * as path from 'path'; import react from '@vitejs/plugin-react'; import { defineConfig } from 'vite'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; -import svgr from 'vite-plugin-svgr'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ react(), - svgr({ - include: '**/*.svg', - exclude: 'src/assets/icons/excluded/**/*.svg', - }), nodePolyfills({ protocolImports: true, }), diff --git a/yarn.lock b/yarn.lock index e092f6ed77..e663727004 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3941,7 +3941,6 @@ __metadata: use-debounce: "npm:^10.0.2" vite: "npm:^6.2.4" vite-plugin-node-polyfills: "npm:^0.23.0" - vite-plugin-svgr: "npm:^4.2.0" zod: "npm:^3.23.8" zustand: "npm:^4.5.4" languageName: unknown