Skip to content

Commit

Permalink
Merge pull request #22 from FinBook/vvd1h
Browse files Browse the repository at this point in the history
update package
  • Loading branch information
cliff0412 committed Mar 22, 2019
2 parents 518bb69 + 152b269 commit 287c331
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 85 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
},
"dependencies": {
"@babel/polyfill": "^7.2.5",
"@finbook/duo-contract-wrapper": "^1.3.3",
"@finbook/duo-contract-wrapper": "^1.3.6",
"@finbook/duo-market-data": "^1.0.4",
"antd": "^3.13.0",
"d3": "^5.8.0",
Expand Down
74 changes: 37 additions & 37 deletions src/ts/common/__snapshots__/wrappers.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Object {
},
},
"Vivaldi": Object {
"100C-3H": Object {
"100C-1H": Object {
"contract": "dualClassWrapper",
},
},
Expand Down Expand Up @@ -59,18 +59,18 @@ Array [
},
},
"Vivaldi": Object {
"100C-3H": Object {
"100C-1H": Object {
"aToken": Object {
"address": "0x2C4bD22588af822a95Fb9D7e972A1F1C4aE28F13",
"code": "ETH-100C-3H",
"address": "0x75Bcb8C5f50Cc05d0B82c6321f22E848FEbB5F88",
"code": "ETH-100C-1H",
},
"bToken": Object {
"address": "0x9f49bb024EB176d227d4b85A58730a5dDeEF529D",
"code": "ETH-100P-3H",
"address": "0xCfC7C9792975193a9d0E78f0350041Ceb4fa388C",
"code": "ETH-100P-1H",
},
"custodian": Object {
"address": "0x5734Fe05187857066Ed00d963D4bBBeB619797f4",
"code": "VIVALDI-100C-3H",
"address": "0x32a42AeDe34Cd0D2D76e02E0d3A3440706A9c619",
"code": "VIVALDI-100C-1H",
},
},
},
Expand Down Expand Up @@ -128,18 +128,18 @@ Array [
},
},
"Vivaldi": Object {
"100C-3H": Object {
"100C-1H": Object {
"aToken": Object {
"address": "0x2C4bD22588af822a95Fb9D7e972A1F1C4aE28F13",
"code": "ETH-100C-3H",
"address": "0x75Bcb8C5f50Cc05d0B82c6321f22E848FEbB5F88",
"code": "ETH-100C-1H",
},
"bToken": Object {
"address": "0x9f49bb024EB176d227d4b85A58730a5dDeEF529D",
"code": "ETH-100P-3H",
"address": "0xCfC7C9792975193a9d0E78f0350041Ceb4fa388C",
"code": "ETH-100P-1H",
},
"custodian": Object {
"address": "0x5734Fe05187857066Ed00d963D4bBBeB619797f4",
"code": "VIVALDI-100C-3H",
"address": "0x32a42AeDe34Cd0D2D76e02E0d3A3440706A9c619",
"code": "VIVALDI-100C-1H",
},
},
},
Expand Down Expand Up @@ -197,18 +197,18 @@ Array [
},
},
"Vivaldi": Object {
"100C-3H": Object {
"100C-1H": Object {
"aToken": Object {
"address": "0x2C4bD22588af822a95Fb9D7e972A1F1C4aE28F13",
"code": "ETH-100C-3H",
"address": "0x75Bcb8C5f50Cc05d0B82c6321f22E848FEbB5F88",
"code": "ETH-100C-1H",
},
"bToken": Object {
"address": "0x9f49bb024EB176d227d4b85A58730a5dDeEF529D",
"code": "ETH-100P-3H",
"address": "0xCfC7C9792975193a9d0E78f0350041Ceb4fa388C",
"code": "ETH-100P-1H",
},
"custodian": Object {
"address": "0x5734Fe05187857066Ed00d963D4bBBeB619797f4",
"code": "VIVALDI-100C-3H",
"address": "0x32a42AeDe34Cd0D2D76e02E0d3A3440706A9c619",
"code": "VIVALDI-100C-1H",
},
},
},
Expand All @@ -227,7 +227,7 @@ Array [
],
},
},
"0x5734Fe05187857066Ed00d963D4bBBeB619797f4",
"0x32a42AeDe34Cd0D2D76e02E0d3A3440706A9c619",
],
]
`;
Expand Down Expand Up @@ -277,18 +277,18 @@ Array [
},
},
"Vivaldi": Object {
"100C-3H": Object {
"100C-1H": Object {
"aToken": Object {
"address": "0x2C4bD22588af822a95Fb9D7e972A1F1C4aE28F13",
"code": "ETH-100C-3H",
"address": "0x75Bcb8C5f50Cc05d0B82c6321f22E848FEbB5F88",
"code": "ETH-100C-1H",
},
"bToken": Object {
"address": "0x9f49bb024EB176d227d4b85A58730a5dDeEF529D",
"code": "ETH-100P-3H",
"address": "0xCfC7C9792975193a9d0E78f0350041Ceb4fa388C",
"code": "ETH-100P-1H",
},
"custodian": Object {
"address": "0x5734Fe05187857066Ed00d963D4bBBeB619797f4",
"code": "VIVALDI-100C-3H",
"address": "0x32a42AeDe34Cd0D2D76e02E0d3A3440706A9c619",
"code": "VIVALDI-100C-1H",
},
},
},
Expand Down Expand Up @@ -357,18 +357,18 @@ Array [
},
},
"Vivaldi": Object {
"100C-3H": Object {
"100C-1H": Object {
"aToken": Object {
"address": "0x2C4bD22588af822a95Fb9D7e972A1F1C4aE28F13",
"code": "ETH-100C-3H",
"address": "0x75Bcb8C5f50Cc05d0B82c6321f22E848FEbB5F88",
"code": "ETH-100C-1H",
},
"bToken": Object {
"address": "0x9f49bb024EB176d227d4b85A58730a5dDeEF529D",
"code": "ETH-100P-3H",
"address": "0xCfC7C9792975193a9d0E78f0350041Ceb4fa388C",
"code": "ETH-100P-1H",
},
"custodian": Object {
"address": "0x5734Fe05187857066Ed00d963D4bBBeB619797f4",
"code": "VIVALDI-100C-3H",
"address": "0x32a42AeDe34Cd0D2D76e02E0d3A3440706A9c619",
"code": "VIVALDI-100C-1H",
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions src/ts/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ export const TH_BALANCE: ILocaleText = {
[LOCALE_JP]: '残高',
[LOCALE_RU]: 'Баланс'
};

export const TH_LABEL = 'Label';

export const TH_ERC20 = 'ERC20';
export const TH_TYPE: ILocaleText = {
[LOCALE_CN]: '类别',
Expand Down
13 changes: 7 additions & 6 deletions src/ts/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ export interface IEsplanadeState {
address: string;
balance: number;
};
readonly coldAddressPool: IEsplanadeAddresses;
readonly hotAddressPool: IEsplanadeAddresses;
readonly custodianPool: IEsplanadeAddresses;
readonly otherContractPool: IEsplanadeAddresses;
readonly coldAddressPool: IAddresses;
readonly hotAddressPool: IAddresses;
readonly custodianPool: IAddresses;
readonly otherContractPool: IAddresses;
readonly votingData: IVotingData;
}
export interface IEsplanadeAddresses {
export interface IAddresses {
[address: string]: {
balance: number;
index: number;
balance?: number;
label?: string;
};
}

Expand Down
53 changes: 39 additions & 14 deletions src/ts/components/Cards/AddressCard.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
import { Table } from 'antd';
import * as React from 'react';
import * as CST from 'ts/common/constants';
import { IEsplanadeAddresses, ITableRecord } from 'ts/common/types';
import { IAddresses, ITableRecord } from 'ts/common/types';
import util from 'ts/common/util';
import { esplanadeWrapper } from 'ts/common/wrappers';
import { SCard, SCardTitle, STableWrapper } from './_styled';

const { Column } = Table;

interface IProps {
addresses: IEsplanadeAddresses;
moderator: string;
addresses: IAddresses;
account: string;
title: string;
showRemove?: boolean;
isModerator?: boolean;
showBalance?: boolean;
showAction?: boolean;
showLabel?: boolean;
isHot?: boolean;
}

export default class AddressCard extends React.Component<IProps> {
public render() {
const { addresses, account, title, showRemove, moderator, isHot } = this.props;
const isModerator = account === moderator;
const {
addresses,
account,
title,
showAction,
showBalance,
showLabel,
isModerator,
isHot
} = this.props;
const dataSource: ITableRecord[] = [];
for (const address in addresses) {
const { balance, index } = addresses[address];
const { balance, index, label } = addresses[address];
dataSource.push({
key: index,
[CST.TH_ADDRESS.EN]: address,
[CST.TH_BALANCE.EN]: util.formatBalance(balance),
[CST.TH_BALANCE.EN]: util.formatBalance(balance as number),
[CST.TH_ACTION]: address,
[CST.TH_LABEL]: label,
[CST.TH_LINK]:
'https://' + (__KOVAN__ ? 'kovan.' : '') + 'etherscan.io/address/' + address
});
Expand All @@ -45,17 +56,31 @@ export default class AddressCard extends React.Component<IProps> {
>
<STableWrapper>
<Table dataSource={dataSource} pagination={false}>
{[CST.TH_ADDRESS.EN, CST.TH_BALANCE.EN].map(th => (
{
<Column
title={th}
dataIndex={th}
key={th}
title={CST.TH_ADDRESS.EN}
dataIndex={CST.TH_ADDRESS.EN}
key={CST.TH_ADDRESS.EN}
onCell={(record: ITableRecord) => ({
onClick: () => window.open(record[CST.TH_LINK])
})}
/>
))}
{showRemove ? (
}
{showBalance ? (
<Column
title={CST.TH_BALANCE.EN}
dataIndex={CST.TH_BALANCE.EN}
key={CST.TH_BALANCE.EN}
/>
) : null}
{showLabel ? (
<Column
title={CST.TH_LABEL}
dataIndex={CST.TH_LABEL}
key={CST.TH_LABEL}
/>
) : null}
{showAction ? (
<Column
title={CST.TH_ACTION}
dataIndex={CST.TH_ACTION}
Expand Down
9 changes: 6 additions & 3 deletions src/ts/components/Cards/VotingCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ describe('EsplanadeCard Test', () => {
const coldAddressPool = {
address0: {
balance: 10,
index: 0
index: 0,
label: ''
},
address1: {
balance: 20,
index: 1
index: 1,
label: ''
},
address2: {
balance: 30,
index: 2
index: 2,
label: ''
}
};
const votingData = {
Expand Down
4 changes: 2 additions & 2 deletions src/ts/components/Cards/VotingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IEsplanadeStates, IVotingData , Web3Wrapper} from '@finbook/duo-contrac
import moment from 'moment';
import * as React from 'react';
import * as CST from 'ts/common/constants';
import { IEsplanadeAddresses } from 'ts/common/types';
import { IAddresses } from 'ts/common/types';
import { esplanadeWrapper } from 'ts/common/wrappers';
import { SDivFlexCenter } from '../_styled';
import { SCard, SCardList, SCardTitle, SInput } from './_styled';
Expand All @@ -12,7 +12,7 @@ interface IProps {
states: IEsplanadeStates;
votingData: IVotingData;
account: string;
coldAddressPool: IEsplanadeAddresses;
coldAddressPool: IAddresses;
moderator: string;
candidate: string;
}
Expand Down
Loading

0 comments on commit 287c331

Please sign in to comment.