Skip to content

Commit

Permalink
Add: testnet cfx warning, use new fc contract address
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed Apr 16, 2020
1 parent fc10b32 commit 0ada8e7
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 100 deletions.
44 changes: 22 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ workflows:
jobs:
create_release_pull_request:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- run:
Expand All @@ -107,7 +107,7 @@ jobs:
prep-deps:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- run:
Expand All @@ -126,7 +126,7 @@ jobs:

prep-build:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -145,7 +145,7 @@ jobs:

prep-build-test:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -163,7 +163,7 @@ jobs:

prep-build-storybook:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -178,7 +178,7 @@ jobs:

prep-scss:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -197,7 +197,7 @@ jobs:

test-lint:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -221,7 +221,7 @@ jobs:

test-lint-lockfile:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -232,7 +232,7 @@ jobs:

test-deps:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -243,7 +243,7 @@ jobs:

test-e2e-chrome:
docker:
- image: circleci/node:10.16.3-browsers
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -261,7 +261,7 @@ jobs:

test-e2e-firefox:
docker:
- image: circleci/node:10.16.3-browsers
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- run:
Expand All @@ -282,7 +282,7 @@ jobs:

benchmark:
docker:
- image: circleci/node:10.16.3-browsers
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -303,7 +303,7 @@ jobs:

job-publish-prerelease:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -333,7 +333,7 @@ jobs:

job-publish-release:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -351,7 +351,7 @@ jobs:

job-publish-storybook:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- add_ssh_keys:
fingerprints:
Expand All @@ -367,7 +367,7 @@ jobs:
test-unit:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -382,7 +382,7 @@ jobs:
- coverage
test-unit-global:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -392,7 +392,7 @@ jobs:
command: yarn test:unit:global
test-mozilla-lint:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -403,7 +403,7 @@ jobs:

test-integration-flat-firefox:
docker:
- image: circleci/node:10.16.3-browsers
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -419,7 +419,7 @@ jobs:
environment:
browsers: '["Chrome"]'
docker:
- image: circleci/node:10.16.3-browsers
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand All @@ -430,15 +430,15 @@ jobs:

all-tests-pass:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- run:
name: All Tests Passed
command: echo 'weew - everything passed!'

coveralls-upload:
docker:
- image: circleci/node:10.16.3
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
Expand Down
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"cfxTestWarning": {
"message": "Currently, the CFX are test-net tokens, and the amount in your wallet will be nulled when the test-net resets or upgrades."
},
"migrateSai": {
"message": "A message from Maker: The new Multi-Collateral Dai token has been released. Your old tokens are now called Sai. Please upgrade your Sai tokens to the new Dai."
},
Expand Down
3 changes: 3 additions & 0 deletions app/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"cfxTestWarning": {
"message": "目前CFX是测试币,仅具有测试功能,并会在网络升级重启时清零。"
},
"chartOnlyAvailableEth": {
"message": "聊天功能仅对Conflux网络开放。(其实Conflux还不支持该功能)"
},
Expand Down
3 changes: 3 additions & 0 deletions app/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"cfxTestWarning": {
"message": "目前CFX是測試幣,僅具有測試功能,並會在網絡升級重啟時清零。"
},
"chartOnlyAvailableEth": {
"message": "圖表僅適用於Conflux測試網路。"
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@material-ui/core": "1.0.0",
"@sentry/browser": "^5.11.1",
"@sentry/integrations": "^5.11.1",
"@yqrashawn/cfx-contract-metadata": "^0.0.3",
"@yqrashawn/cfx-contract-metadata": "^0.0.4",
"@yqrashawn/cfx-json-rpc-middleware": "^4.4.3",
"@yqrashawn/conflux-portal-inpage-provider": "^4.0.8",
"@zxing/library": "^0.8.0",
Expand Down Expand Up @@ -209,7 +209,7 @@
"browserify-transform-tools": "^1.7.0",
"chai": "^4.1.0",
"chalk": "^2.4.2",
"chromedriver": "^81.0.0",
"chromedriver": "^79.0.0",
"concurrently": "^4.1.1",
"coveralls": "^3.0.0",
"css-loader": "^2.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { PRIMARY, SECONDARY } from '../../../helpers/constants/common'
import Tooltip from '../../ui/tooltip-v2'

export default class TransactionViewBalance extends PureComponent {
static contextTypes = {
t: PropTypes.func.isRequired,
}

static contextTypes = {
t: PropTypes.func,
metricsEvent: PropTypes.func,
Expand All @@ -32,6 +36,7 @@ export default class TransactionViewBalance extends PureComponent {

renderBalance () {
const { selectedToken, balance, balanceIsCached, showFiat } = this.props
const { t } = this.context

return selectedToken ? (
<div className="transaction-view-balance__balance">
Expand All @@ -48,7 +53,14 @@ export default class TransactionViewBalance extends PureComponent {
disabled={!balanceIsCached}
>
<div className="transaction-view-balance__balance">
<div className="transaction-view-balance__primary-container">
<div
className="transaction-view-balance__primary-container"
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}
>
<UserPreferencedCurrencyDisplay
className={classnames(
'transaction-view-balance__primary-balance',
Expand All @@ -61,6 +73,24 @@ export default class TransactionViewBalance extends PureComponent {
ethNumberOfDecimals={4}
hideTitle
/>
<Tooltip position="bottom" title={t('cfxTestWarning')}>
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<i
className="fa fa-info-circle"
style={{
marginLeft: '6px',
fontSize: '80%',
color: '#fbdc5e',
}}
/>
</div>
</Tooltip>
{balanceIsCached ? (
<span className="transaction-view-balance__cached-star">*</span>
) : null}
Expand Down
33 changes: 32 additions & 1 deletion ui/app/components/ui/balance/balance.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import Identicon from '../identicon'
import UserPreferencedCurrencyDisplay from '../../app/user-preferenced-currency-display'
import { PRIMARY, SECONDARY } from '../../../helpers/constants/common'
import { formatBalance } from '../../../helpers/utils/util'
import Tooltip from '../tooltip-v2'

export default class Balance extends PureComponent {
static contextTypes = {
t: PropTypes.func.isRequired,
}

static propTypes = {
account: PropTypes.object,
assetImages: PropTypes.object,
Expand All @@ -24,6 +29,7 @@ export default class Balance extends PureComponent {

renderBalance () {
const { account, nativeCurrency, needsParse, showFiat } = this.props
const { t } = this.context
const balanceValue = account && account.balance
const formattedBalance = balanceValue
? formatBalance(balanceValue, 6, needsParse, nativeCurrency)
Expand All @@ -38,13 +44,38 @@ export default class Balance extends PureComponent {
}

return (
<div className="flex-column balance-display">
<div
className="flex-column balance-display"
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}
>
<UserPreferencedCurrencyDisplay
className="token-amount"
value={balanceValue}
type={PRIMARY}
ethNumberOfDecimals={4}
/>
<Tooltip position="bottom" title={t('cfxTestWarning')}>
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<i
className="fa fa-info-circle"
style={{
marginLeft: '6px',
fontSize: '80%',
color: '#fbdc5e',
}}
/>
</div>
</Tooltip>
{showFiat && (
<UserPreferencedCurrencyDisplay
value={balanceValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('add-recipient utils', function () {
it('should return a known address recipient if to is truthy but part of contract metadata', function () {
assert.deepEqual(
getToWarningObject(
'0xD29C3302edfF23bF425Ba6e0Ba6E17dA16FB287C',
'0x869FB578d12E7d83A26D599F0F0be8c2b925Ff00',
undefined,
[{ address: '0xabc123' }],
{ address: '0xabc123' }
Expand All @@ -149,7 +149,7 @@ describe('add-recipient utils', function () {
it('should null if to is truthy part of contract metadata but selectedToken falsy', function () {
assert.deepEqual(
getToWarningObject(
'0xD29C3302edfF23bF425Ba6e0Ba6E17dA16FB287C',
'0x869FB578d12E7d83A26D599F0F0be8c2b925Ff00',
undefined,
[{ address: '0xabc123' }],
{ address: '0xabc123' }
Expand Down
4 changes: 2 additions & 2 deletions ui/app/pages/send/tests/send-component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,12 @@ describe('Send Component', function () {
wrapper.setProps({ address: '0x888', decimals: 18, symbol: '888' })
const instance = wrapper.instance()
instance.onRecipientInputChange(
'0xD29C3302edfF23bF425Ba6e0Ba6E17dA16FB287C'
'0x869FB578d12E7d83A26D599F0F0be8c2b925Ff00'
)

clock.tick(1001)
assert.deepEqual(instance.state, {
query: '0xD29C3302edfF23bF425Ba6e0Ba6E17dA16FB287C',
query: '0x869FB578d12E7d83A26D599F0F0be8c2b925Ff00',
toError: null,
toWarning: 'knownAddressRecipient',
})
Expand Down
Loading

0 comments on commit 0ada8e7

Please sign in to comment.