Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/cd-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
file: ./packages/core/package.json
field: version
value: ${{ github.event.release.tag_name }}
- uses: JS-DevTools/npm-publish@v3
with:
package: ./packages/core/package.json
access: public
token: ${{ secrets.NPM_TOKEN }}
- name: Publish package
run: yarn workspace @human-protocol/core npm publish --access public
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17 changes: 7 additions & 10 deletions .github/workflows/cd-node-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,23 @@ jobs:
run: yarn install --immutable
- name: Build core package
run: yarn build:core
- name: Change Node.js SDK version
- name: Change Node.js SDK version from release tag
uses: jossef/action-set-json-field@v2
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
file: ./packages/sdk/typescript/human-protocol-sdk/package.json
field: version
value: ${{ github.event.release.tag_name }}
- name: Change Node.js SDK version
- name: Change Node.js SDK version from workflow input
uses: jossef/action-set-json-field@v2
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
file: ./packages/sdk/typescript/human-protocol-sdk/package.json
field: version
value: ${{ github.event.inputs.release_version }}
- name: Build SDK package
run: yarn build
working-directory: ./packages/sdk/typescript/human-protocol-sdk
- uses: JS-DevTools/npm-publish@v3
name: Publish
with:
package: ./packages/sdk/typescript/human-protocol-sdk/package.json
access: public
token: ${{ secrets.NPM_TOKEN }}
run: yarn workspace @human-protocol/sdk build
- name: Publish package
run: yarn workspace @human-protocol/sdk npm publish --access public
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ yarn-error.log*

# IDE - IntelliJ
.idea/
*.iml

# OS
.DS_Store
Expand All @@ -48,4 +49,5 @@ dist
hardhat-dependency-compiler

# cache
cache
cache

1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
yarn dlx lint-staged
yarn workspaces foreach --all -p run typecheck

# Format python file changes
cd packages/sdk/python/human-protocol-sdk
Expand Down
7 changes: 7 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
echo "Running typecheck before push..."

if ! yarn workspaces foreach --all -p run typecheck; then
echo ""
echo "Typecheck failed! Please fix the errors above before pushing."
exit 1
fi
6 changes: 3 additions & 3 deletions packages/apps/dashboard/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "tsc --build --clean && rm -rf dist",
"start": "vite",
"build": "tsc --build && vite build",
"lint": "yarn typecheck && eslint . --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",
Expand All @@ -24,7 +24,7 @@
"@mui/material": "^5.15.18",
"@mui/styled-engine-sc": "6.4.0",
"@mui/system": "^5.15.14",
"@mui/x-data-grid": "^7.23.2",
"@mui/x-data-grid": "^8.5.2",
"@mui/x-date-pickers": "^7.23.6",
"@tanstack/react-query": "^5.67.2",
"@types/react-router-dom": "^5.3.3",
Expand Down Expand Up @@ -60,7 +60,7 @@
"eslint-plugin-react-refresh": "^0.4.11",
"globals": "^16.2.0",
"prettier": "^3.4.2",
"sass": "^1.85.0",
"sass": "^1.89.2",
"typescript": "^5.6.3",
"typescript-eslint": "^8.33.0",
"vite": "^6.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,20 @@ export type AddressDetailsWallet = z.infer<typeof walletSchema>;
const escrowSchema = z.object({
chainId: z.number().optional().nullable(),
address: z.string().optional().nullable(),
balance: z
.string()
.optional()
.nullable()
.transform(transformOptionalTokenAmount),
balance: z.string().optional().nullable(),
token: z.string().optional().nullable(),
factoryAddress: z.string().optional().nullable(),
totalFundedAmount: z
.string()
.optional()
.nullable()
.transform(transformOptionalTokenAmount),
amountPaid: z
.string()
.optional()
.nullable()
.transform(transformOptionalTokenAmount),
totalFundedAmount: z.string().optional().nullable(),
amountPaid: z.string().optional().nullable(),
status: z.string().optional().nullable(),
manifest: z.string().optional().nullable(),
launcher: z.string().optional().nullable(),
exchangeOracle: z.string().optional().nullable(),
recordingOracle: z.string().optional().nullable(),
reputationOracle: z.string().optional().nullable(),
finalResultsUrl: z.string().nullable(),
tokenSymbol: z.string().optional().nullable(),
tokenDecimals: z.number().optional().nullable(),
});

export type AddressDetailsEscrow = z.infer<typeof escrowSchema>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { AddressDetailsEscrow } from '../model/addressDetailsSchema';

import HmtBalance from './HmtBalance';
import TitleSectionWrapper from './TitleSectionWrapper';
import TokenAmount from './TokenAmount';

type Props = {
data: AddressDetailsEscrow;
};

const EscrowAddress: FC<Props> = ({ data }) => {
const {
token,
balance,
factoryAddress,
totalFundedAmount,
Expand All @@ -27,16 +27,26 @@ const EscrowAddress: FC<Props> = ({ data }) => {
exchangeOracle,
recordingOracle,
reputationOracle,
tokenSymbol,
} = data;
const isHmt = tokenSymbol === 'HMT';
return (
<SectionWrapper>
<Stack gap={4}>
<TitleSectionWrapper title="Token">
<Typography variant="body2">{token}</Typography>
<Typography variant="body2">{tokenSymbol}</Typography>
</TitleSectionWrapper>
{balance !== undefined && balance !== null ? (
<TitleSectionWrapper title="Balance">
<HmtBalance balance={balance} />
{isHmt ? (
<HmtBalance balance={balance} />
) : (
<TokenAmount
amount={balance}
tokenSymbol={tokenSymbol}
alreadyParsed
/>
)}
</TitleSectionWrapper>
) : null}
<TitleSectionWrapper
Expand All @@ -46,30 +56,18 @@ const EscrowAddress: FC<Props> = ({ data }) => {
<Typography variant="body2">{factoryAddress}</Typography>
</TitleSectionWrapper>
<TitleSectionWrapper title="Total Funded Amount">
<Stack direction="row" whiteSpace="nowrap">
<Typography variant="body2">{totalFundedAmount}</Typography>
<Typography
component="span"
variant="body2"
ml={0.5}
color="text.secondary"
>
HMT
</Typography>
</Stack>
<TokenAmount
amount={totalFundedAmount}
tokenSymbol={tokenSymbol}
alreadyParsed
/>
</TitleSectionWrapper>
<TitleSectionWrapper title="Paid Amount">
<Stack direction="row" whiteSpace="nowrap">
<Typography variant="body2">{amountPaid}</Typography>
<Typography
component="span"
variant="body2"
ml={0.5}
color="text.secondary"
>
HMT
</Typography>
</Stack>
<TokenAmount
amount={amountPaid}
tokenSymbol={tokenSymbol}
alreadyParsed
/>
</TitleSectionWrapper>

<TitleSectionWrapper title="Status">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';

import useHmtPrice from '@/shared/api/useHmtPrice';
import { useIsMobile } from '@/shared/hooks/useBreakpoints';
import FormattedNumber from '@/shared/ui/FormattedNumber';

import TokenAmount from './TokenAmount';

type Props = {
balance?: number | null;
balance?: number | string | null;
};

const HmtBalance: FC<Props> = ({ balance }) => {
const { data, isError, isPending } = useHmtPrice();
const isMobile = useIsMobile();

if (isError) {
return <span>N/A</span>;
Expand All @@ -29,16 +28,9 @@ const HmtBalance: FC<Props> = ({ balance }) => {

return (
<Stack flexDirection="row" whiteSpace="nowrap">
<Typography variant="body2">
<FormattedNumber value={_balance} decimalScale={isMobile ? 4 : 9} />
</Typography>
<Typography
component="span"
variant="body2"
ml={0.5}
color="text.secondary"
>
{`HMT($${balanceInDollars})`}
<TokenAmount amount={_balance} alreadyParsed />
<Typography component="span" variant="body2" color="text.secondary">
{`($${balanceInDollars})`}
</Typography>
</Stack>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,21 @@ import { FC } from 'react';
import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';

import { useIsMobile } from '@/shared/hooks/useBreakpoints';
import FormattedNumber from '@/shared/ui/FormattedNumber';
import SectionWrapper from '@/shared/ui/SectionWrapper';

import TokenAmount from './TokenAmount';

type Props = {
amountStaked?: number | null;
amountLocked?: number | null;
amountWithdrawable?: number | null;
};

const renderAmount = (amount: number | null | undefined, isMobile: boolean) => {
return (
<Stack direction="row" whiteSpace="nowrap">
<Typography variant="body2">
<FormattedNumber
value={(amount || 0) * 1e18}
decimalScale={isMobile ? 4 : 9}
/>
</Typography>
<Typography
variant="body2"
color="text.secondary"
component="span"
ml={0.5}
>
HMT
</Typography>
</Stack>
);
};

const StakeInfo: FC<Props> = ({
amountStaked,
amountLocked,
amountWithdrawable,
}) => {
const isMobile = useIsMobile();
if (!amountStaked && !amountLocked && !amountWithdrawable) return null;

return (
Expand All @@ -53,23 +31,23 @@ const StakeInfo: FC<Props> = ({
<Typography variant="subtitle2" width={300}>
Staked Tokens
</Typography>
{renderAmount(amountStaked, isMobile)}
<TokenAmount amount={amountStaked} />
</Stack>
)}
{Number.isFinite(amountLocked) && (
<Stack gap={{ xs: 1, md: 0 }} direction={{ sm: 'column', md: 'row' }}>
<Typography variant="subtitle2" width={300}>
Locked Tokens
</Typography>
{renderAmount(amountLocked, isMobile)}
<TokenAmount amount={amountLocked} />
</Stack>
)}
{Number.isFinite(amountWithdrawable) && (
<Stack gap={{ xs: 1, md: 0 }} direction={{ sm: 'column', md: 'row' }}>
<Typography variant="subtitle2" width={300}>
Withdrawable Tokens
</Typography>
{renderAmount(amountWithdrawable, isMobile)}
<TokenAmount amount={amountWithdrawable} />
</Stack>
)}
</Stack>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { FC } from 'react';

import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';

import { useIsMobile } from '@/shared/hooks/useBreakpoints';
import FormattedNumber from '@/shared/ui/FormattedNumber';

type Props = {
amount: number | string | null | undefined;
tokenSymbol?: string | null | undefined;
alreadyParsed?: boolean;
};

const TokenAmount: FC<Props> = ({
amount,
tokenSymbol = 'HMT',
alreadyParsed = false,
}) => {
const isMobile = useIsMobile();

return (
<Stack direction="row" whiteSpace="nowrap">
<Typography variant="body2">
<FormattedNumber
value={(Number(amount) || 0) * (alreadyParsed ? 1 : 1e18)}
decimalScale={isMobile ? 4 : 9}
/>
</Typography>
<Typography
variant="body2"
color="text.secondary"
component="span"
ml={0.5}
>
{tokenSymbol}
</Typography>
</Stack>
);
};

export default TokenAmount;
Loading
Loading