Skip to content

Commit

Permalink
Merge pull request #2051 from CityOfZion/release/2.6.2
Browse files Browse the repository at this point in the history
release: 2.6.2
comountainclimber authored Jan 18, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents c0db706 + 74b3885 commit 5f7882a
Showing 11 changed files with 650 additions and 102 deletions.
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'
@@ -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,
@@ -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) {
@@ -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 = {}

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
@@ -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>
@@ -67,9 +102,6 @@ const ReleaseNotesModal = ({ hideModal, theme }: Props) => (
}
/>
</div>
<div className={styles.marketingImage}>
{theme === 'Light' ? <PatchLight /> : <PatchDark />}
</div>
</div>

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

type IntlWrapperProps = {
@@ -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> {
6 changes: 6 additions & 0 deletions app/core/constants.js
Original file line number Diff line number Diff line change
@@ -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'
@@ -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
52 changes: 26 additions & 26 deletions app/core/tokenList.json
Original file line number Diff line number Diff line change
@@ -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",
@@ -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",
@@ -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
}
}
}
}
396 changes: 396 additions & 0 deletions app/translations/dutch.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/translations/index.js
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import portuguese from './portuguese'
import turkish from './turkish'
import arabic from './arabic'
import russian from './russian'
import dutch from './dutch'

export default {
english,
@@ -22,4 +23,5 @@ export default {
turkish,
arabic,
russian,
dutch
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Neon",
"version": "2.6.1",
"version": "2.6.2",
"main": "./main.js",
"description": "Light wallet for NEO blockchain",
"homepage": "https://github.com/CityOfZion/neon-wallet",
@@ -87,7 +87,7 @@
"@cityofzion/neon-js": "3.11.9",
"@formatjs/intl-pluralrules": "^1.5.2",
"@ledgerhq/hw-transport-node-hid": "5.0.0",
"axios": "0.18.1",
"axios": "0.21.1",
"axios-retry": "3.1.1",
"bignumber.js": "5.0.0",
"buffer": "5.0.8",
@@ -138,7 +138,6 @@
"react-select": "2.0.0",
"react-split-pane": "0.1.68",
"react-switch": "3.0.4",
"react-syntax-highlighter": "5.8.0",
"react-tabs": "2.2.2",
"react-test-renderer": "16.1.1",
"react-tippy": "1.3.1",
73 changes: 13 additions & 60 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1366,13 +1366,12 @@ axios@0.18.0:
follow-redirects "^1.3.0"
is-buffer "^1.1.5"

axios@0.18.1:
version "0.18.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.1.tgz#ff3f0de2e7b5d180e757ad98000f1081b87bcea3"
integrity sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==
axios@0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "1.5.10"
is-buffer "^2.0.2"
follow-redirects "^1.10.0"

axobject-query@^2.0.2:
version "2.2.0"
@@ -4228,7 +4227,7 @@ debug@2.6.9, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3, debug@^2.5.1, debug@^2.6.
dependencies:
ms "2.0.0"

debug@3.1.0, debug@=3.1.0:
debug@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
@@ -5836,13 +5835,6 @@ fastparse@^1.1.2:
resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9"
integrity sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==

fault@^1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13"
integrity sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==
dependencies:
format "^0.2.0"

faye-websocket@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4"
@@ -6117,17 +6109,10 @@ fn-name@^2.0.0:
resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7"
integrity sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=

follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"

follow-redirects@^1.0.0, follow-redirects@^1.3.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==
follow-redirects@^1.0.0, follow-redirects@^1.10.0, follow-redirects@^1.3.0:
version "1.13.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==

for-in@^0.1.3:
version "0.1.8"
@@ -6167,11 +6152,6 @@ form-data@~2.3.2:
combined-stream "^1.0.6"
mime-types "^2.1.12"

format@^0.2.0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=

forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
@@ -6873,11 +6853,6 @@ highlight-words-core@^1.2.0:
resolved "https://registry.yarnpkg.com/highlight-words-core/-/highlight-words-core-1.2.2.tgz#1eff6d7d9f0a22f155042a00791237791b1eeaaa"
integrity sha512-BXUKIkUuh6cmmxzi5OIbUJxrG8OAk2MqoL1DtO3Wo9D2faJg2ph5ntyuQeLqaHJmzER6H5tllCDA9ZnNe9BVGg==

highlight.js@~9.12.0:
version "9.12.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e"
integrity sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4=

history@4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/history/-/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b"
@@ -7305,9 +7280,9 @@ inherits@2.0.3:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

ini@^1.3.4, ini@^1.3.5, ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.7"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84"
integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==

inline-style-prefixer@^3.0.6:
version "3.0.8"
@@ -7522,11 +7497,6 @@ is-buffer@^1.1.5, is-buffer@~1.1.6:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==

is-buffer@^2.0.2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623"
integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==

is-callable@^1.1.4, is-callable@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.2.tgz#c7c6715cd22d4ddb48d3e19970223aceabb080d9"
@@ -8996,14 +8966,6 @@ lowercase-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==

lowlight@~1.9.1:
version "1.9.2"
resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.9.2.tgz#0b9127e3cec2c3021b7795dd81005c709a42fdd1"
integrity sha512-Ek18ElVCf/wF/jEm1b92gTnigh94CtBNWiZ2ad+vTgW7cTmQxUY3I98BjHK68gZAJEWmybGBZgx9qv3QxLQB/Q==
dependencies:
fault "^1.0.2"
highlight.js "~9.12.0"

lru-cache@^4.0.1, lru-cache@^4.1.1:
version "4.1.5"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
@@ -11546,15 +11508,6 @@ react-switch@3.0.4:
dependencies:
prop-types "^15.6.1"

react-syntax-highlighter@5.8.0:
version "5.8.0"
resolved "https://registry.yarnpkg.com/react-syntax-highlighter/-/react-syntax-highlighter-5.8.0.tgz#a220c010fd0641751d93532509ba7159cc3a4383"
integrity sha512-+FolT9NhFBqE4SsZDelSzsYJJS/JCnQqo4+GxLrFPoML548uvr8f4Eh5nnd5o6ERKFW7ryiygOX9SPnxdnlpkg==
dependencies:
babel-runtime "^6.18.0"
highlight.js "~9.12.0"
lowlight "~1.9.1"

react-tabs@2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/react-tabs/-/react-tabs-2.2.2.tgz#2f2935da379889484751d1df47c1b639e5ee835d"

0 comments on commit 5f7882a

Please sign in to comment.