From 492ce6f75d42f37d87ee65d72538b8020a90dac6 Mon Sep 17 00:00:00 2001
From: Maxwell Lasky
Date: Tue, 1 Dec 2020 11:49:04 -0500
Subject: [PATCH] release: 2.6.1 (#2029)
* feature: skip testing on tags [WIP] (#2015)
* updates config.yml
* Only publish on tags
* Updates pack and release notes whitelist
* Add back store_artifacts and remove persist to workspace
* update snapshots
* Updates mainnet node list
* Updates ReleaseNotesModal.jsx
* feature: adds dora and neotube to explorers (#2022)
* Updates explorer list
* Updates explorer.test.js
* Updates explorer.test.js
* Updates explorer.test.js
* Adds back deleted test
* Update content and styles in release notes modal
* Updates screen shot in README (#2023)
* update screen shot asset name
* feature: Updates app/core/nodes-main-net.json with new coz nodes (#2025)
* Updates app/core/nodes-main-net.json with new coz nodes
* Increase chunk size
* feature: fix balance failed "retry" load state (#2027)
* Fixes translation typo and refactors FailedPanel.jsx
* lint
* snapshots
* Revert testing changes to balancesActions.js
* revert changes to AssetBalancesPanel/index.js
* Updates balancesActions.js and tokenList.json (#2026)
* feature: add balance fetch retry logic (#2028)
* Adds RPC retry logic
* small refactor in balancesActions.js
* Fixes link in release notes
* feature: update release notes [WIP] (#2031)
* Adds release notes image asset and update release notes
* Update patch.svg
* Update release notes image assets
---
.circleci/config.yml | 37 ++-
README.md | 2 +-
.../NetworkConfigurationTooltip.test.js.snap | 4 +-
.../__snapshots__/NetworkSwitch.test.js.snap | 2 +-
.../__snapshots__/News.test.js.snap | 2 +-
.../__snapshots__/Settings.test.js.snap | 4 +-
.../__snapshots__/Sidebar.test.js.snap | 2 +-
__tests__/core/explorer.test.js | 33 ++-
app/actions/balancesActions.js | 139 +++++++----
app/actions/nodeStorageActions.js | 16 +-
app/assets/images/release-assets/github.svg | 1 -
.../images/release-assets/patch-dark.svg | 235 ++++++++++++++++++
.../images/release-assets/patch-light.svg | 230 +++++++++++++++++
app/assets/images/wallet-ss.png | Bin 0 -> 204864 bytes
app/assets/images/wallet.png | Bin 385607 -> 0 bytes
app/components/FailedPanel/FailedPanel.jsx | 36 ++-
app/components/FailedPanel/FailedPanel.scss | 12 +-
app/components/FailedPanel/index.js | 18 +-
.../ReleaseNotesModal/ReleaseNotesModal.jsx | 34 ++-
.../ReleaseNotesModal/ReleaseNotesModal.scss | 6 +-
app/containers/Home/Home.jsx | 2 +-
app/containers/Receive/index.js | 2 +-
app/containers/Send/index.js | 2 +-
app/containers/TransactionHistory/index.js | 2 +-
app/core/constants.js | 6 +-
app/core/explorer.js | 19 +-
app/core/nodes-main-net.json | 45 +---
app/core/tokenList.json | 202 ++++++++++++++-
app/translations/arabic.js | 2 +-
app/translations/chinese.js | 2 +-
app/translations/english.js | 2 +-
app/translations/french.js | 2 +-
app/translations/german.js | 2 +-
app/translations/italian.js | 2 +-
app/translations/korean.js | 2 +-
app/translations/portuguese.js | 2 +-
app/translations/russian.js | 2 +-
app/translations/turkish.js | 2 +-
app/translations/vietnamese.js | 2 +-
package.json | 2 +-
40 files changed, 957 insertions(+), 160 deletions(-)
create mode 100644 app/assets/images/release-assets/patch-dark.svg
create mode 100644 app/assets/images/release-assets/patch-light.svg
create mode 100644 app/assets/images/wallet-ss.png
delete mode 100644 app/assets/images/wallet.png
diff --git a/.circleci/config.yml b/.circleci/config.yml
index e9e2bf403..58d785527 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -34,16 +34,12 @@ jobs:
- run: yarn install --ignore-engines --frozen-lockfile --network-timeout 1000000 --network-concurrency 1
- run: yarn lint
- run: yarn flow
- - run: yarn dist
+ - run: yarn assets
- save_cache:
key: neon-wallet-dependencies-cache-{{ checksum "yarn.lock" }}
paths:
- /usr/local/share/.cache/yarn/v2
- ./node_modules
- - persist_to_workspace:
- root: *workspace_root
- paths:
- - dist/*
test:
<<: *container_config
@@ -71,6 +67,26 @@ jobs:
- run: yarn install --ignore-engines --frozen-lockfile --network-timeout 1000000 --network-concurrency 1
- run: yarn assets
- run: yarn electron-builder -w --x64
+ - store_artifacts:
+ path: dist
+ destination: build
+
+ deploy_linux:
+ <<: *container_config
+ steps:
+ - checkout
+ - restore_cache:
+ key: neon-wallet-dependencies-cache-{{ checksum "yarn.lock" }}
+ - run: apt-get -y update
+ - run: apt-get -y install libusb-1.0-0-dev icnsutils graphicsmagick libudev-dev
+ - run: yarn config delete proxy
+ - run: yarn install --ignore-engines --frozen-lockfile --network-timeout 1000000 --network-concurrency 1
+ - run: yarn lint
+ - run: yarn flow
+ - run: yarn dist
+ - store_artifacts:
+ path: dist
+ destination: build
workflows:
version: 2
@@ -81,14 +97,15 @@ workflows:
tags:
only: /v.*/
- test:
- filters:
- tags:
- only: /v.*/
requires:
- build
- deploy_win64:
- requires:
- - test
+ filters:
+ branches:
+ ignore: /.*/
+ tags:
+ only: /v.*/
+ - deploy_linux:
filters:
branches:
ignore: /.*/
diff --git a/README.md b/README.md
index e9f9cdbe9..e4bb63120 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
-
+
## Overview
diff --git a/__tests__/components/__snapshots__/NetworkConfigurationTooltip.test.js.snap b/__tests__/components/__snapshots__/NetworkConfigurationTooltip.test.js.snap
index 5db3051d4..ea6370292 100644
--- a/__tests__/components/__snapshots__/NetworkConfigurationTooltip.test.js.snap
+++ b/__tests__/components/__snapshots__/NetworkConfigurationTooltip.test.js.snap
@@ -178,10 +178,10 @@ exports[`Sidebar renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
+ "notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
- "notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
@@ -825,10 +825,10 @@ exports[`Sidebar renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
+ "notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
- "notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
diff --git a/__tests__/components/__snapshots__/NetworkSwitch.test.js.snap b/__tests__/components/__snapshots__/NetworkSwitch.test.js.snap
index 490842689..ff1f7a5f0 100644
--- a/__tests__/components/__snapshots__/NetworkSwitch.test.js.snap
+++ b/__tests__/components/__snapshots__/NetworkSwitch.test.js.snap
@@ -157,10 +157,10 @@ exports[`NetworkSwitch renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
+ "notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
- "notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
diff --git a/__tests__/components/__snapshots__/News.test.js.snap b/__tests__/components/__snapshots__/News.test.js.snap
index 910e12463..047727e34 100644
--- a/__tests__/components/__snapshots__/News.test.js.snap
+++ b/__tests__/components/__snapshots__/News.test.js.snap
@@ -175,10 +175,10 @@ exports[`News renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
+ "notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
- "notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
diff --git a/__tests__/components/__snapshots__/Settings.test.js.snap b/__tests__/components/__snapshots__/Settings.test.js.snap
index 2f5616493..a8ac8f26a 100644
--- a/__tests__/components/__snapshots__/Settings.test.js.snap
+++ b/__tests__/components/__snapshots__/Settings.test.js.snap
@@ -175,10 +175,10 @@ exports[`Settings renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
+ "notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
- "notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
@@ -1373,7 +1373,7 @@ exports[`Settings renders without crashing 1`] = `
Manage your neon wallet
- v
- 2.6.0
+ 2.6.1
{
const address = 'AQpLnwMpnhxroPM4fcYGenB2pH5cLhMDao'
describe('getExplorerTxLink tests', () => {
+ test('Dora mainnet explorer test', () => {
+ const networkId = MAIN_NETWORK_ID
+ const explorer = EXPLORERS.DORA
+ const expectedUrl = `https://dora.coz.io/transaction/0x${txId}`
+ expect(getExplorerTxLink(networkId, explorer, txId)).toEqual(expectedUrl)
+ })
+
+ test('Neotube mainnet explorer test', () => {
+ const networkId = MAIN_NETWORK_ID
+ const explorer = EXPLORERS.NEOTUBE
+ const expectedUrl = `https://neotube.io/transaction/0x${txId}`
+ expect(getExplorerTxLink(networkId, explorer, txId)).toEqual(expectedUrl)
+ })
+
test('NeoTracker mainnet explorer test', () => {
const networkId = MAIN_NETWORK_ID
const explorer = EXPLORERS.NEO_TRACKER
const expectedUrl = `https://neotracker.io/tx/${txId}`
-
expect(getExplorerTxLink(networkId, explorer, txId)).toEqual(expectedUrl)
})
@@ -81,6 +94,24 @@ describe('explorer tests', () => {
})
describe('getExplorerAddressLink tests', () => {
+ test('Neotube mainnet explorer test', () => {
+ const networkId = MAIN_NETWORK_ID
+ const explorer = EXPLORERS.NEOTUBE
+ const expectedUrl = `https://neotube.io/address/${address}`
+ expect(getExplorerAddressLink(networkId, explorer, address)).toEqual(
+ expectedUrl,
+ )
+ })
+
+ test('Dora mainnet explorer test', () => {
+ const networkId = MAIN_NETWORK_ID
+ const explorer = EXPLORERS.DORA
+ const expectedUrl = `https://dora.coz.io/address/${address}`
+ expect(getExplorerAddressLink(networkId, explorer, address)).toEqual(
+ expectedUrl,
+ )
+ })
+
test('NeoTracker mainnet explorer test', () => {
const networkId = MAIN_NETWORK_ID
const explorer = EXPLORERS.NEO_TRACKER
diff --git a/app/actions/balancesActions.js b/app/actions/balancesActions.js
index 5e67cece6..c990fff8c 100644
--- a/app/actions/balancesActions.js
+++ b/app/actions/balancesActions.js
@@ -18,7 +18,8 @@ const MAX_SCRIPT_HASH_CHUNK_SIZE = 3
type Props = {
net: string,
address: string,
- tokens: Array
,
+ tokens?: Array,
+ isRetry?: boolean,
}
let inMemoryBalances = {}
@@ -72,11 +73,16 @@ function determineIfBalanceUpdated(
})
}
-async function getBalances({ net, address }: Props) {
- const { soundEnabled, tokens } = await getSettings()
+let RETRY_COUNT = 0
+
+async function getBalances({ net, address, isRetry = false }: Props) {
+ const { soundEnabled, tokens } = (await getSettings()) || {
+ tokens: [],
+ soundEnabled: true,
+ }
const network = findNetworkByDeprecatedLabel(net)
- let endpoint = await getNode(net)
+ let endpoint = await getNode(net, isRetry)
if (!endpoint) {
endpoint = await getRPCEndpoint(net)
}
@@ -88,50 +94,85 @@ async function getBalances({ net, address }: Props) {
if (!inMemoryAddress) adressHasChanged = false
else if (inMemoryAddress !== address) adressHasChanged = true
- const chunks = tokens
- .filter(token => !token.isUserGenerated && token.networkId === network.id)
- .reduce((accum, currVal) => {
- if (!accum.length) {
- accum.push([currVal.scriptHash])
+ const chunks =
+ tokens.length &&
+ tokens
+ .filter(token => !token.isUserGenerated && token.networkId === network.id)
+ .reduce((accum, currVal) => {
+ const chunk = {
+ scriptHash: currVal.scriptHash,
+ symbol: currVal.symbol,
+ }
+ if (!accum.length) {
+ accum.push([chunk])
+ return accum
+ }
+
+ if (accum[accum.length - 1].length < MAX_SCRIPT_HASH_CHUNK_SIZE) {
+ accum[accum.length - 1].push(chunk)
+ } else {
+ accum.push([chunk])
+ }
return accum
- }
+ }, [])
+
+ let shouldRetry = false
+ const results = await Promise.all(
+ chunks.map(async chunk => {
+ // NOTE: because the RPC nodes will respond with the contract
+ // symbol name, we need to use our original token list
+ // in case two tokens have the same symbol (SWTH vs SWTH OLD)
+ const balanceResults = await api.nep5
+ .getTokenBalances(
+ endpoint,
+ chunk.map(({ scriptHash }) => scriptHash),
+ address,
+ )
+ .catch(e => Promise.reject(e))
- if (accum[accum.length - 1].length < MAX_SCRIPT_HASH_CHUNK_SIZE) {
- accum[accum.length - 1].push(currVal.scriptHash)
- } else {
- accum.push([currVal.scriptHash])
- }
- return accum
- }, [])
+ const hashBasedBalance = {}
- const promiseMap = chunks.map(chunk =>
- api.nep5.getTokenBalances(endpoint, chunk, address),
- )
- const results = await Promise.all(promiseMap)
+ chunk.forEach((token, i) => {
+ hashBasedBalance[token.symbol] = Object.values(balanceResults)[i]
+ })
+ return hashBasedBalance
+ }),
+ ).catch(() => {
+ console.error(
+ `An error occurred fetching token balances using: ${endpoint} attempting to use a new RPC node.`,
+ )
+ shouldRetry = true
+ })
+ if (shouldRetry && RETRY_COUNT < 4) {
+ RETRY_COUNT += 1
+ return getBalances({ net, address, isRetry: true })
+ }
- const parsedTokenBalances = results.reduce((accum, currBalance) => {
- Object.keys(currBalance).forEach(key => {
- const foundToken = tokens.find(token => token.symbol === key)
- if (foundToken && currBalance[key]) {
- determineIfBalanceUpdated(
+ const parsedTokenBalances =
+ results &&
+ results.reduce((accum, currBalance) => {
+ Object.keys(currBalance).forEach(key => {
+ const foundToken = tokens.find(token => token.symbol === key)
+ if (foundToken && currBalance[key]) {
+ determineIfBalanceUpdated(
+ // $FlowFixMe
+ { [foundToken.symbol]: currBalance[key] },
+ soundEnabled,
+ networkHasChanged,
+ adressHasChanged,
+ )
// $FlowFixMe
- { [foundToken.symbol]: currBalance[key] },
- soundEnabled,
- networkHasChanged,
- adressHasChanged,
- )
- // $FlowFixMe
- inMemoryBalances[foundToken.symbol] = currBalance[key]
- accum.push({
- [foundToken.scriptHash]: {
- ...foundToken,
- balance: currBalance[key],
- },
- })
- }
- })
- return accum
- }, [])
+ inMemoryBalances[foundToken.symbol] = currBalance[key]
+ accum.push({
+ [foundToken.scriptHash]: {
+ ...foundToken,
+ balance: currBalance[key],
+ },
+ })
+ }
+ })
+ return accum
+ }, [])
// Handle manually added script hashses here
const userGeneratedTokenInfo = []
@@ -162,11 +203,13 @@ async function getBalances({ net, address }: Props) {
adressHasChanged,
)
inMemoryBalances[token.symbol] = token.balance
- parsedTokenBalances.push({
- [token.scriptHash]: {
- ...token,
- },
- })
+ if (parsedTokenBalances) {
+ parsedTokenBalances.push({
+ [token.scriptHash]: {
+ ...token,
+ },
+ })
+ }
})
// asset balances
diff --git a/app/actions/nodeStorageActions.js b/app/actions/nodeStorageActions.js
index 8e16132d5..64b4201f5 100644
--- a/app/actions/nodeStorageActions.js
+++ b/app/actions/nodeStorageActions.js
@@ -122,7 +122,18 @@ export const getRPCEndpoint = async (
}
}
-export const getNode = async (net: Net): Promise => {
+const setNode = async (node: string, net: Net): Promise =>
+ setStorage(`${STORAGE_KEY}-${net}`, { node, timestamp: new Date().getTime() })
+
+export const getNode = async (
+ net: Net,
+ errorOccurred?: boolean,
+): Promise => {
+ if (errorOccurred) {
+ delete cachedRPCUrl[net]
+ await setNode('', net)
+ return ''
+ }
const storage = await getStorage(`${STORAGE_KEY}-${net}`).catch(console.error)
const nodeInStorage = get(storage, 'node')
const expiration = get(storage, 'timestamp')
@@ -132,9 +143,6 @@ export const getNode = async (net: Net): Promise => {
return nodeInStorage
}
-const setNode = async (node: string, net: Net): Promise =>
- setStorage(`${STORAGE_KEY}-${net}`, { node, timestamp: new Date().getTime() })
-
export default createActions(
ID,
({ url, net }: Props = {}) => async (): Promise => {
diff --git a/app/assets/images/release-assets/github.svg b/app/assets/images/release-assets/github.svg
index ecf1d1eb3..23b1f9f02 100644
--- a/app/assets/images/release-assets/github.svg
+++ b/app/assets/images/release-assets/github.svg
@@ -1,6 +1,5 @@