Skip to content

Commit

Permalink
Merge pull request #822 from Conflux-Chain/dev
Browse files Browse the repository at this point in the history
feat: release v2.15.0
  • Loading branch information
0x74616e67 authored Aug 1, 2022
2 parents 5d3ee1d + 93a394a commit 4e3b5cc
Show file tree
Hide file tree
Showing 41 changed files with 986 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Hi! We are really excited that you are interested in contributing to Conflux. Be

## Issue Reporting Guidelines

- Please check the existing issues and the [Conflux Bounty Site](https://bounty.conflux-chain.org) to avoid submitting duplicate issues.
- Please check the existing issues and the [Conflux Bounty Site](https://bounty.confluxnetwork.org) to avoid submitting duplicate issues.

## Pull Request Guidelines

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Source code of [Conflux Scan](https://confluxscan.io)
Conflux Scan is still in its early stages compared to [Etherscan](https://etherscan.io). So
there's a lot features and improvements waiting there. You can find bugs,
request new features, send PRs to improve the code and docs. Don't forget to
check out the [Conflux Bounty](https://bounty.conflux-chain.org) to earn reward
check out the [Conflux Bounty](https://bounty.confluxnetwork.org) to earn reward
while improving scan.

## Contributing
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@cfxjs/antd": "1.0.6",
"@cfxjs/react-ui": "2.0.0-alpha.15",
"@cfxjs/use-wallet": "0.0.18",
"@conflux-dev/conflux-address-js": "1.1.7",
"@conflux-dev/conflux-address-js": "1.3.16",
"@testing-library/jest-dom": "5.1.1",
"@testing-library/react": "10.0.1",
"@types/fontfaceobserver": "0.0.6",
Expand Down Expand Up @@ -41,7 +41,7 @@
"i18next": "19.3.4",
"i18next-browser-languagedetector": "4.0.2",
"jest-styled-components": "7.0.2",
"js-conflux-sdk": "2.0.6",
"js-conflux-sdk": "2.1.6",
"lint-staged": "10.0.8",
"lodash": "4.17.20",
"md5.js": "1.3.5",
Expand Down
16 changes: 10 additions & 6 deletions src/app/components/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ import { Card as UICard } from '@cfxjs/react-ui';
import styled from 'styled-components/macro';
import { CardProps } from '@cfxjs/react-ui/dist/card/card';
import clsx from 'clsx';
import { Spin } from '@cfxjs/antd';

export const Card = ({
children,
className,
loading = false,
...others
}: Partial<CardProps>) => {
}: Partial<CardProps> & { loading?: boolean }) => {
return (
<CardWrapper>
<UICard className={clsx('sirius-card', className)} {...others}>
{children}
</UICard>
</CardWrapper>
<Spin spinning={loading}>
<CardWrapper>
<UICard className={clsx('sirius-card', className)} {...others}>
{children}
</UICard>
</CardWrapper>
</Spin>
);
};

Expand Down
12 changes: 0 additions & 12 deletions src/app/components/FileUpload/Loadable.ts

This file was deleted.

22 changes: 18 additions & 4 deletions src/app/components/TablePanelNew/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export const TablePanel = ({
error: null,
});

const { orderBy, reverse } = useMemo(() => qs.parse(search), [search]);

const getQuery = useMemo(() => {
let defaultPagination = !pagination
? {
Expand Down Expand Up @@ -148,13 +150,14 @@ export const TablePanel = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [outerUrl, search]);

const handleTableChange = (pagination, filters, sorter) => {
const { current, pageSize } = pagination;
const handleTableChange = (pagination, _, sorter, extra) => {
const { current = 1, pageSize = 10 } = pagination;
const { skip, limit, ...others } = qs.parse(search);
const { action } = extra;

let query: Query = {
...others,
skip: String((current - 1) * pageSize) || '0',
skip: action === 'sort' ? '0' : String((current - 1) * pageSize) || '0',
limit: pageSize || '10',
};

Expand All @@ -174,6 +177,17 @@ export const TablePanel = ({
const total =
dataSource && Array.isArray(dataSource) ? dataSource.length : stateTotal;

let _columns: any = columns;
if (orderBy !== undefined) {
_columns = columns?.map(c => {
delete c.defaultSortOrder;
if (c.key === orderBy) {
c.defaultSortOrder = reverse === 'true' ? 'descend' : 'ascend';
}
return c;
});
}

return (
<Table
sortDirections={['descend', 'ascend']}
Expand All @@ -182,7 +196,7 @@ export const TablePanel = ({
})}
tableLayout={tableLayout}
scroll={scroll}
columns={columns}
columns={_columns}
rowKey={rowKey}
dataSource={dataSource || data}
showSorterTooltip={showSorterTooltip}
Expand Down
58 changes: 34 additions & 24 deletions src/app/containers/BalanceChecker/Result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,47 @@ export function Result({ radioValue, resultVisible, formData }) {
};
useEffect(() => {
initResult();
if (data?.code === 501) {
setResultData({
epoch_dt: '--',
epoch: '--',
balance: 0,
});
setLoading(false);
} else if (data?.code === 0) {
const { cfxByEpoch, cfxByDt } = data;
if (cfxByEpoch) {
setResultData({
...cfxByEpoch,
epoch_dt: formData.dt === '' ? cfxByEpoch.epoch_dt : formData.dt,
});
} else if (cfxByDt) {
setResultData({
...cfxByDt,
// @ts-ignore
epoch_dt: dayjs(formData.dt).isToday()
? formData.dt
: dayjs(formData.dt).add(1, 'day').toString(),
});
try {
const { cfxByEpoch, cfxByDt } = data || {};
if (cfxByEpoch || cfxByDt) {
if (cfxByEpoch) {
setResultData({
...cfxByEpoch,
epoch_dt: formData.dt === '' ? cfxByEpoch.epoch_dt : formData.dt,
});
} else if (cfxByDt) {
setResultData({
...cfxByDt,
// @ts-ignore
epoch_dt: dayjs(formData.dt).isToday()
? formData.dt
: dayjs(formData.dt).add(1, 'day').toString(),
});
} else {
setResultData({
epoch_dt: '--',
epoch: '--',
balance: 0,
});
}
setLoading(false);
} else {
setResultData({
epoch_dt: '--',
epoch: '--',
balance: 0,
});
}
setLoading(false);
} // eslint-disable-next-line react-hooks/exhaustive-deps
} catch (e) {
setResultData({
epoch_dt: '--',
epoch: '--',
balance: 0,
});
setLoading(false);
} // eslint-disable-next-line react-hooks/exhaustive-deps
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data]);

const TokenQuantityCard = (
Expand Down
62 changes: 32 additions & 30 deletions src/app/containers/Blocks/Dag/lib-dag.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,40 +111,42 @@ function subscribe(height, cb) {
sendNextRequest = false;
fetch('/v1/dag')
.then(e => e.json())
.then(({ list }) => {
const _epochs = list.map(epoch => {
const _epoch = {};
let [pivot, ...rest] = epoch;
const { epochNumber, ...pivotInfo } = pivot;
//data from server can be wrong
rest = rest.filter(d => d.epochNumber === epochNumber);
_epoch.epochNumber = epochNumber;
_epoch.colors = getEpochColor(epochNumber);
_epoch.points = [];
const { points, width } = layout({
n: rest.length,
d: 30,
h: height,
});
.then(({ data, code, message }) => {
if (code === 0) {
const _epochs = data.list.map(epoch => {
const _epoch = {};
let [pivot, ...rest] = epoch;
const { epochNumber, ...pivotInfo } = pivot;
//data from server can be wrong
rest = rest.filter(d => d.epochNumber === epochNumber);
_epoch.epochNumber = epochNumber;
_epoch.colors = getEpochColor(epochNumber);
_epoch.points = [];
const { points, width } = layout({
n: rest.length,
d: 30,
h: height,
});

//pivot
_epoch.points.push({
offsetX: width,
y: height / 2,
...pivotInfo,
});
rest.forEach((block, i) => {
const p = points[i];
//pivot
_epoch.points.push({
offsetX: p[0],
y: p[1],
...block,
offsetX: width,
y: height / 2,
...pivotInfo,
});
rest.forEach((block, i) => {
const p = points[i];
_epoch.points.push({
offsetX: p[0],
y: p[1],
...block,
});
});
return _epoch;
});
return _epoch;
});
sendNextRequest = true;
cb((epochs = concat(_epochs, epochs)));
sendNextRequest = true;
cb((epochs = concat(_epochs, epochs)));
}
})
.catch(() => {
sendNextRequest = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,34 @@ import {
} from 'app/components/Charts/StockChartTemplate';
import { OPEN_API_URLS } from 'utils/constants';
import { Wrapper } from './Wrapper';
import { CROSS_SPACE_ADDRESS } from 'utils/constants';
import BigNumber from 'bignumber.js';

export function Contract({ preview = false }: ChildProps) {
export function DailyCFXTransferCount({ preview = false }: ChildProps) {
const { t } = useTranslation();

const props = {
preview: preview,
name: 'contract',
title: t(translations.highcharts.crossSpace.contract.title),
subtitle: t(translations.highcharts.crossSpace.contract.subtitle),
name: 'daily-cfx-transfer-count',
title: t(translations.highcharts.crossSpace.dailyCFXTransferCount.title),
subtitle: t(
translations.highcharts.crossSpace.dailyCFXTransferCount.subtitle,
),
request: {
url: OPEN_API_URLS.contract,
query: {
address: CROSS_SPACE_ADDRESS,
limit: 10000,
},
url: OPEN_API_URLS.CrossSpaceDailyCFXTransfer,
formatter: data => {
const data1: any = [];
const data2: any = [];

data?.list?.map((d, i) => {
const t = dayjs.utc(d.statTime).valueOf();
data1.push([t, Number(d.tx)]);
data2.push([t, Number(d.cfxTransfer)]);
const t = dayjs.utc(d.day).valueOf();
data1.push([
t,
Number(new BigNumber(d.DailyCfxCountToEVM).toFixed(2)),
]);
data2.push([
t,
Number(new BigNumber(d.DailyCfxCountFromEVM).toFixed(2)),
]);
});

return [data1, data2];
Expand All @@ -40,10 +44,9 @@ export function Contract({ preview = false }: ChildProps) {
options: {
chart: {
zoomType: 'x',
type: 'line',
},
title: {
text: t(translations.highcharts.crossSpace.contract.title),
text: t(translations.highcharts.crossSpace.dailyCFXTransferCount.title),
},
subtitle: {
text: t(translations.highcharts.subtitle),
Expand All @@ -53,18 +56,26 @@ export function Contract({ preview = false }: ChildProps) {
},
yAxis: {
title: {
text: t(translations.highcharts.crossSpace.contract.yAxisTitle),
text: t(
translations.highcharts.crossSpace.dailyCFXTransferCount.yAxisTitle,
),
},
},
tooltip: {
shared: true,
},
series: [
{
type: 'line',
name: `<span>${t(
translations.highcharts.crossSpace.contract.seriesName,
translations.highcharts.crossSpace.dailyCFXTransferCount.seriesName,
)}</span>`,
},
{
type: 'line',
name: `<span>${t(
translations.highcharts.crossSpace.contract.seriesName2,
translations.highcharts.crossSpace.dailyCFXTransferCount
.seriesName2,
)}</span>`,
},
],
Expand Down
6 changes: 3 additions & 3 deletions src/app/containers/Charts/crossSpace/Loadable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DailyCFXTransfer = lazyLoad(
module => module.DailyCFXTransfer,
);

export const Contract = lazyLoad(
() => import('./Contract'),
module => module.Contract,
export const DailyCFXTransferCount = lazyLoad(
() => import('./DailyCFXTransferCount'),
module => module.DailyCFXTransferCount,
);
Loading

0 comments on commit 4e3b5cc

Please sign in to comment.