Skip to content

Commit

Permalink
Merge pull request #320 from Conflux-Chain/Version-v0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn authored Apr 7, 2021
2 parents 1683d1a + 0d2d9b8 commit 922a87d
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 54 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Current Develop Branch

## 0.6.2 Wed Apr 07 2021

- feat: use new rpc endpoint (#319)

## 0.6.1 Tue Mar 23 2021

- docs: update changelog
Expand Down
6 changes: 3 additions & 3 deletions app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ConfluxPortal",
"short_name": "ConfluxPortal",
"version": "0.6.1",
"version": "0.6.2",
"manifest_version": 2,
"author": "https://conflux-chain.org",
"description": "__MSG_appDescription__",
Expand Down Expand Up @@ -93,8 +93,8 @@
"https://confluxscan.io/*",
"https://testnet.confluxscan.io/*",
"https://conflux-chain.org/*",
"https://portal-main.confluxrpc.org/*",
"https://portal-test.confluxrpc.org/*"
"https://portal-main.confluxrpc.com/*",
"https://portal-test.confluxrpc.com/*"
],
"ids": [
"*"
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/controllers/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { TESTNET, MAINNET, LOCALHOST } from './enums'
// TODO: add main net endpoint

// const CONFLUX_MAINNET = 'http://localhost:12537/'
const CONFLUX_MAINNET = 'https://portal-main.confluxrpc.org'
const CONFLUX_TEST_NET = 'https://portal-test.confluxrpc.org'
const CONFLUX_MAINNET = 'https://portal-main.confluxrpc.com'
const CONFLUX_TEST_NET = 'https://portal-test.confluxrpc.com'

const env = process.env.METAMASK_ENV
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/lodash": "^4.17.19",
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/elliptic": "^6.5.3",
"ganache-core/lodash": "^4.17.19",
"pubnub/superagent-proxy": "^2.0.0"
"pubnub/superagent-proxy": "^2.0.0",
"netmask": "^2.0.1"
},
"dependencies": {
"@babel/runtime": "^7.5.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('NetworkController', function() {
.post('/metamask')
.reply(200)

nock('http://portal-main.confluxrpc.org')
nock('http://portal-main.confluxrpc.com')
.persist()
.post('/', req => req.method === 'cfx_getStatus')
.reply(200, { result: { chainId: '0x0' } })
Expand Down
2 changes: 2 additions & 0 deletions ui/app/pages/send/send-content/add-recipient/add-recipient.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export async function getToErrorObject(
if (!hasHexData) {
toError = REQUIRED_ERROR
}
} else if (!isValidBase32Address(to) && !toError) {
toError = INVALID_RECIPIENT_ADDRESS_ERROR
} else if (
isValidBase32Address(to) &&
!isValidBase32Address(to, network) &&
Expand Down
22 changes: 11 additions & 11 deletions ui/app/pages/send/send-content/add-recipient/ens-input.component.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import c from 'classnames'
import {
// isValidDomainName,
isValidAddress,
// isValidAddressHead,
} from '../../../../helpers/utils/util'
// import {
// isValidDomainName,
// isValidAddress,
// isValidAddressHead,
// } from '../../../../helpers/utils/util'
import { isSmartContractAddress } from '../../../../helpers/utils/transactions.util'
import { isValidBase32Address } from '../../../../../../app/scripts/cip37'

Expand Down Expand Up @@ -118,13 +118,13 @@ export default class EnsInput extends Component {
const { network } = this.props
event.clipboardData.items[0].getAsString(text => {
if (
isValidAddress(text, 'account') ||
// isValidAddress(text, 'account') ||
isValidBase32Address(text, network, 'user') ||
isValidBase32Address(text, network, 'null')
) {
this.props.onPaste(text)
} else if (
isValidAddress(text, 'contract') ||
// isValidAddress(text, 'contract') ||
isValidBase32Address(text, network, 'contract')
) {
isSmartContractAddress(text, network).then(
Expand All @@ -149,14 +149,14 @@ export default class EnsInput extends Component {

if (
onValidAddressTyped &&
// isValidAddress(input, 'account') ||
(isValidBase32Address(input, network, 'user') ||
isValidBase32Address(input, network, 'null') ||
isValidAddress(input, 'account'))
isValidBase32Address(input, network, 'null'))
) {
onValidAddressTyped(input)
} else if (
isValidBase32Address(input, network, 'contract') ||
isValidAddress(input, 'contract')
// isValidAddress(input, 'contract') ||
isValidBase32Address(input, network, 'contract')
) {
isSmartContractAddress(input, network).then(
rst => rst && onValidAddressTyped(input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { toChecksumAddress } from 'cfx-util'
import {
REQUIRED_ERROR,
INVALID_RECIPIENT_ADDRESS_ERROR,
INVALID_RECIPIENT_0X_ERROR,
// INVALID_RECIPIENT_0X_ERROR,
INVALID_RECIPIENT_CHECKSUM_ERROR,
INVALID_RECIPIENT_CONTRACT_ERROR,
// INVALID_RECIPIENT_CONTRACT_ERROR,
KNOWN_RECIPIENT_ADDRESS_ERROR,
} from '../../../send.constants'

const stubs = {
isSmartContractAddress: (to) => {
isSmartContractAddress: to => {
if (to === '0x8888888888888888888888888888888888888881') {
return true
}
Expand All @@ -27,21 +27,21 @@ const toRowUtils = proxyquire('../add-recipient.js', {
})
const { getToErrorObject, getToWarningObject } = toRowUtils

describe('add-recipient utils', function () {
describe('getToErrorObject()', function () {
it('should return a required error if to is falsy', async function () {
describe('add-recipient utils', function() {
describe('getToErrorObject()', function() {
it('should return a required error if to is falsy', async function() {
assert.deepEqual(await getToErrorObject(null), {
to: REQUIRED_ERROR,
})
})

it('should return null if to is falsy and hexData is truthy', async function () {
it('should return null if to is falsy and hexData is truthy', async function() {
assert.deepEqual(await getToErrorObject(null, undefined, true), {
to: null,
})
})

it('should return an invalid recipient error if to is truthy but invalid', async function () {
it('should return an invalid recipient error if to is truthy but invalid', async function() {
assert.deepEqual(await getToErrorObject('mockInvalidTo'), {
to: INVALID_RECIPIENT_ADDRESS_ERROR,
})
Expand All @@ -50,43 +50,43 @@ describe('add-recipient utils', function () {
})
})

it('should return null if to is valid', async function () {
it('should return null if to is valid', async function() {
assert.deepEqual(
await getToErrorObject('0x1111111111111111111111111111111111111111'),
{
to: null,
to: INVALID_RECIPIENT_ADDRESS_ERROR,
}
)
})

it('should smart contract error if to is not a smart contract', async function () {
it('should smart contract error if to is not a smart contract', async function() {
assert.deepEqual(
await getToErrorObject('0x8888888888888888888888888888888888888888'),
{
to: INVALID_RECIPIENT_CONTRACT_ERROR,
to: INVALID_RECIPIENT_ADDRESS_ERROR,
}
)
})

it('should no error if to is a smart contract', async function () {
it('should error if to is a hex smart contract', async function() {
assert.deepEqual(
await getToErrorObject('0x8888888888888888888888888888888888888881'),
{
to: null,
to: INVALID_RECIPIENT_ADDRESS_ERROR,
}
)
})

it('should return 0x error', async function () {
it('should return invalid addr error', async function() {
assert.deepEqual(
await getToErrorObject('0x2222222222222222222222222222222222222222'),
{
to: INVALID_RECIPIENT_0X_ERROR,
to: INVALID_RECIPIENT_ADDRESS_ERROR,
}
)
})

it('should return checksum error if to checksum invalid', async function () {
it.skip('should return checksum error if to checksum invalid', async function() {
assert.deepEqual(
await getToErrorObject('0x1Fa2889e80619495738B0262C6B17471F29d9Dc1'),
{
Expand All @@ -95,16 +95,16 @@ describe('add-recipient utils', function () {
)
})

it('should return no error if to a valid checksumed address', async function () {
it('should error if to a valid checksumed address', async function() {
assert.deepEqual(
await getToErrorObject('0x1Fa2889e80619495738B0262C6B17471F29d9Dc5'),
{
to: null,
to: INVALID_RECIPIENT_ADDRESS_ERROR,
}
)
})

it('should return the passed error if to is truthy but invalid if to is truthy and valid', async function () {
it('should return the passed error if to is truthy but invalid if to is truthy and valid', async function() {
assert.deepEqual(
await getToErrorObject('invalid #$ 345878', 'someExplicitError'),
{
Expand All @@ -114,8 +114,8 @@ describe('add-recipient utils', function () {
})
})

describe('getToWarningObject()', function () {
it('should return a known address recipient if to is truthy but part of state tokens', function () {
describe('getToWarningObject()', function() {
it('should return a known address recipient if to is truthy but part of state tokens', function() {
assert.deepEqual(
getToWarningObject(
'0x8888888888888888888888888888888888888888',
Expand All @@ -131,7 +131,7 @@ describe('add-recipient utils', function () {
)
})

it('should null if to is truthy part of tokens but selectedToken falsy', function () {
it('should null if to is truthy part of tokens but selectedToken falsy', function() {
assert.deepEqual(
getToWarningObject(
'0x8888888888888888888888888888888888888888',
Expand All @@ -144,7 +144,7 @@ describe('add-recipient utils', function () {
)
})

it('should return a known address recipient if to is truthy but part of contract metadata', function () {
it('should return a known address recipient if to is truthy but part of contract metadata', function() {
assert.deepEqual(
getToWarningObject(
'0x8888888888888888888888888888888888888888',
Expand All @@ -163,7 +163,7 @@ describe('add-recipient utils', function () {
)
})

it('should null if to is truthy part of contract metadata but selectedToken falsy', function () {
it('should null if to is truthy part of contract metadata but selectedToken falsy', function() {
assert.deepEqual(
getToWarningObject(
'0x8888888888888888888888888888888888888888',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ export default class AddContact extends PureComponent {
ethAddress: hexAddress,
errorIsWarning: false,
})
} else if (validHex) {
this.setState({
error: this.context.t('confluxNewAddressWarning'),
errorIsWarning: true,
})
// } else if (validHex) {
// this.setState({
// error: this.context.t('confluxNewAddressWarning'),
// })
} else {
this.setState({
error: this.context.t('invalidAddress'),
Expand Down
4 changes: 2 additions & 2 deletions ui/app/pages/settings/networks-tab/networks-tab.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ const defaultNetworksData = [
labelKey: 'mainnet',
iconColor: '#4890cc',
providerType: 'mainnet',
rpcUrl: 'http://portal-main.confluxrpc.org',
rpcUrl: 'http://portal-main.confluxrpc.com',
ticker: 'CFX',
blockExplorerUrl: 'https://confluxscan.io',
},
{
labelKey: 'testnet',
iconColor: '#FF4A8D',
providerType: 'testnet',
rpcUrl: 'http://portal-test.confluxrpc.org',
rpcUrl: 'http://portal-test.confluxrpc.com',
ticker: 'CFX',
blockExplorerUrl: 'https://testnet.confluxscan.io',
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17916,10 +17916,10 @@ neo-async@^2.5.0, neo-async@^2.6.1:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==

netmask@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/netmask/-/netmask-1.0.6.tgz#20297e89d86f6f6400f250d9f4f6b4c1945fcd35"
integrity sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU=
netmask@^1.0.6, netmask@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7"
integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==

next-tick@1, next-tick@^1.0.0:
version "1.0.0"
Expand Down

0 comments on commit 922a87d

Please sign in to comment.