Skip to content

Commit

Permalink
release: 2.6.1 (#2029)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
comountainclimber authored Dec 1, 2020
1 parent f56dc2d commit 492ce6f
Show file tree
Hide file tree
Showing 40 changed files with 957 additions and 160 deletions.
37 changes: 27 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: /.*/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</p>

<p align="center">
<img src="./app/assets/images/wallet.png">
<img src="./app/assets/images/wallet-ss.png">
</p>

## Overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/__snapshots__/News.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions __tests__/components/__snapshots__/Settings.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -1373,7 +1373,7 @@ exports[`Settings renders without crashing 1`] = `
Manage your neon wallet
</FormattedMessage>
- v
2.6.0
2.6.1
</div>
<div
className="settingsPanelHeaderItem"
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/__snapshots__/Sidebar.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,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",
Expand Down
33 changes: 32 additions & 1 deletion __tests__/core/explorer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,24 @@ describe('explorer tests', () => {
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)
})

Expand Down Expand Up @@ -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
Expand Down
139 changes: 91 additions & 48 deletions app/actions/balancesActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const MAX_SCRIPT_HASH_CHUNK_SIZE = 3
type Props = {
net: string,
address: string,
tokens: Array<TokenItemType>,
tokens?: Array<TokenItemType>,
isRetry?: boolean,
}

let inMemoryBalances = {}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 492ce6f

Please sign in to comment.