Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 2.6.1 #2051

Merged
merged 20 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1ef6bc2
feature: skip testing on tags [WIP] (#2015)
comountainclimber Nov 11, 2020
8ba34c0
Updates mainnet node list
comountainclimber Nov 12, 2020
34986f3
Merge pull request #2020 from CityOfZion/feature/update-node-list
comountainclimber Nov 13, 2020
d05ab4b
Updates ReleaseNotesModal.jsx
comountainclimber Nov 14, 2020
dbb6c43
Merge pull request #2021 from CityOfZion/feature/adds-patch-release-n…
comountainclimber Nov 15, 2020
a52f324
feature: adds dora and neotube to explorers (#2022)
comountainclimber Nov 15, 2020
ee2cdeb
Updates screen shot in README (#2023)
comountainclimber Nov 18, 2020
11f45a1
update screen shot asset name
comountainclimber Nov 18, 2020
6c040f4
feature: Updates app/core/nodes-main-net.json with new coz nodes (#2025)
comountainclimber Nov 24, 2020
6befd56
feature: fix balance failed "retry" load state (#2027)
comountainclimber Nov 29, 2020
930dfe8
Updates balancesActions.js and tokenList.json (#2026)
comountainclimber Nov 29, 2020
b3c7a27
feature: add balance fetch retry logic (#2028)
comountainclimber Nov 29, 2020
c0db706
Merges release resolves conflicts
comountainclimber Dec 1, 2020
72d1f13
Removes react-syntax-highlighter (#2035)
comountainclimber Dec 5, 2020
5fa01db
build(deps): bump axios from 0.18.1 to 0.21.1 (#2043)
dependabot[bot] Jan 12, 2021
6c428fd
build(deps): bump ini from 1.3.5 to 1.3.7 (#2037)
dependabot[bot] Jan 12, 2021
3fa13db
feature: handles integer return type for SWTH contract + reduces netw…
comountainclimber Jan 13, 2021
eeefd3c
New language: Introducing Dutch for Neon (#2049)
Woodehh Jan 18, 2021
aa623f2
bump version in pack
comountainclimber Jan 18, 2021
74b3885
Update release notes
comountainclimber Jan 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 86 additions & 1 deletion __tests__/components/__snapshots__/Settings.test.js.snap

Large diffs are not rendered by default.

77 changes: 68 additions & 9 deletions app/actions/balancesActions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { api } from '@cityofzion/neon-js'
import { api, u, rpc, sc, wallet } from '@cityofzion/neon-js'
import { extend, isEmpty, get } from 'lodash-es'
import { createActions } from 'spunky'
import { Howl } from 'howler'
Expand All @@ -13,7 +13,12 @@ import { COIN_DECIMAL_LENGTH } from '../core/formatters'
import { toBigNumber } from '../core/math'
import { findNetworkByDeprecatedLabel } from '../core/networks'

const MAX_SCRIPT_HASH_CHUNK_SIZE = 3
const { reverseHex, hexstring2str } = u
const { Query } = rpc
const { ScriptBuilder } = sc
const { getScriptHashFromAddress } = wallet

const MAX_SCRIPT_HASH_CHUNK_SIZE = 20

type Props = {
net: string,
Expand Down Expand Up @@ -73,6 +78,62 @@ function determineIfBalanceUpdated(
})
}

const parseDecimals = VMOutput => {
if (VMOutput === '') return 0
return parseInt(VMOutput, 10)
}

const parseHexNum = hex => (hex ? parseInt(reverseHex(hex), 16) : 0)

function NumberParser(item, decimals) {
switch (item.type) {
case 'Integer':
return new u.Fixed8(item.value).div(100000000)
case 'ByteArray':
// eslint-disable-next-line
return parseHexNum(item.value) / Math.pow(10, decimals)
default:
throw new Error(`Received invalid type ${item.type}`)
}
}

const getTokenBalances = (url, scriptHashArray, address) => {
const addrScriptHash = reverseHex(getScriptHashFromAddress(address))
const sb = new ScriptBuilder()

scriptHashArray.forEach(scriptHash => {
sb.emitAppCall(scriptHash, 'symbol')
.emitAppCall(scriptHash, 'decimals')
.emitAppCall(scriptHash, 'balanceOf', [addrScriptHash])
})
return Query.invokeScript(sb.str, false)
.execute(url)
.then(res => {
const tokenList = {}
if (
res &&
res.result &&
res.result.stack &&
res.result.stack.length >= 3
) {
for (let i = 0; i < res.result.stack.length; i += 3) {
try {
const symbol = hexstring2str(res.result.stack[i].value)
const decimals = parseDecimals(res.result.stack[i + 1].value)
tokenList[symbol] = NumberParser(res.result.stack[i + 2], decimals)
} catch (e) {
throw e
}
}
}
return tokenList
})
.catch(err => {
console.error({ err })
throw err
})
}

let RETRY_COUNT = 0

async function getBalances({ net, address, isRetry = false }: Props) {
Expand Down Expand Up @@ -122,13 +183,11 @@ async function getBalances({ net, address, isRetry = false }: Props) {
// 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))
const balanceResults = await getTokenBalances(
endpoint,
chunk.map(({ scriptHash }) => scriptHash),
address,
).catch(e => Promise.reject(e))

const hashBasedBalance = {}

Expand Down
14 changes: 14 additions & 0 deletions app/assets/flags/dutch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 35 additions & 3 deletions app/components/Modals/ReleaseNotesModal/ReleaseNotesModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,41 @@ const ReleaseNotesModal = ({ hideModal, theme }: Props) => (
)}
>
<div className={styles.releaseNotesContents}>
<div className={styles.release}>
<div className={styles.releaseContent}>
<small className={styles.date}>Jan 18th 2021 </small>
<h3>Patch v2.6.2</h3>

<p>
In this update you will find the following minor improvements:
<br />
<br />
<li>Fixes bug related to SWTH contract</li>
<li>
Adds dutch translation{' '}
<span aria-label="party" role="img">
🇳🇱🎉
</span>{' '}
</li>
<li>Performance enhancements</li>
<br />
View full details of this release on GitHub
<br />
</p>

<Github
onClick={() =>
electron.shell.openExternal(
'https://github.com/CityOfZion/neon-wallet/releases/tag/v2.6.2',
)
}
/>
</div>
<div className={styles.marketingImage}>
{theme === 'Light' ? <PatchLight /> : <PatchDark />}
</div>
</div>

<div className={styles.release}>
<div className={styles.releaseContent}>
<small className={styles.date}>Dec 1st 2020 </small>
Expand All @@ -67,9 +102,6 @@ const ReleaseNotesModal = ({ hideModal, theme }: Props) => (
}
/>
</div>
<div className={styles.marketingImage}>
{theme === 'Light' ? <PatchLight /> : <PatchDark />}
</div>
</div>

<div className={styles.release}>
Expand Down
2 changes: 2 additions & 0 deletions app/components/Root/IntlWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
turkish,
arabic,
russian,
dutch,
} = translations

type IntlWrapperProps = {
Expand All @@ -40,6 +41,7 @@ const tranlationsMappings = {
[LANGUAGES.TURKISH.value]: turkish,
[LANGUAGES.ARABIC.value]: arabic,
[LANGUAGES.RUSSIAN.value]: russian,
[LANGUAGES.DUTCH.value]: dutch,
}

class IntlWrapper extends React.Component<IntlWrapperProps> {
Expand Down
6 changes: 6 additions & 0 deletions app/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Vietnam from '../assets/flags/vietnam.svg'
import Korea from '../assets/flags/south-korea.svg'
import UnitedArabEmirates from '../assets/flags/united-arab-emirates.svg'
import Russia from '../assets/flags/russia.svg'
import Dutch from '../assets/flags/dutch.svg'

export const NEON_WALLET_RELEASE_LINK =
'https://github.com/CityOfZion/neon-wallet/releases'
Expand Down Expand Up @@ -102,6 +103,11 @@ export const LANGUAGES = {
value: 'RUSSIAN',
renderFlag: () => <Russia alt="Русский" />,
},
DUTCH: {
label: 'Nederlands',
value: 'DUTCH',
renderFlag: () => <Dutch alt="Nederlands" />,
},
}

export const DEFAULT_LANGUAGE = LANGUAGES.ENGLISH.value
Expand Down
52 changes: 26 additions & 26 deletions app/core/tokenList.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@
}
}
},
"SWTH V2": {
"symbol": "SWTH (OLD)",
"companyName": "Switcheo",
"type": "NEP5",
"networks": {
"1": {
"name": "Switcheo Legacy V2",
"hash": "ab38352559b8b203bde5fddfa0b07d8b2525e132",
"decimals": 8,
"totalSupply": 1000000000
}
}
},
"CGL": {
"symbol": "CGL",
"companyName": "CrazyGladiator",
Expand Down Expand Up @@ -842,32 +855,6 @@
}
}
},
"SWTH V2": {
"symbol": "SWTH (OLD)",
"companyName": "Switcheo",
"type": "NEP5",
"networks": {
"1": {
"name": "Switcheo Legacy V2",
"hash": "ab38352559b8b203bde5fddfa0b07d8b2525e132",
"decimals": 8,
"totalSupply": 1000000000
}
}
},
"SWTH V3": {
"symbol": "SWTH",
"companyName": "Switcheo",
"type": "NEP5",
"networks": {
"1": {
"name": "Switcheo V3",
"hash": "3e09e602eeeb401a2fec8e8ea137d59aae54a139",
"decimals": 8,
"totalSupply": 1000000000
}
}
},
"THOR": {
"symbol": "THOR",
"companyName": "Thor Token",
Expand Down Expand Up @@ -1058,5 +1045,18 @@
},
"image":
"https://rawgit.com/CityOfZion/neo-tokens/master/assets/png/zpt.png"
},
"SWTH V3": {
"symbol": "SWTH",
"companyName": "Switcheo",
"type": "NEP5",
"networks": {
"1": {
"name": "Switcheo V3",
"hash": "3e09e602eeeb401a2fec8e8ea137d59aae54a139",
"decimals": 8,
"totalSupply": 1000000000
}
}
}
}
Loading