Skip to content

Commit

Permalink
Merge branch 'release-candidate-0.81.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleySuira committed Dec 6, 2022
2 parents 67a85cc + f592be1 commit ac33587
Show file tree
Hide file tree
Showing 95 changed files with 3,423 additions and 2,862 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ VUE_APP_FIREBASE_MESSAGING_SENDER_ID=
VUE_APP_FIREBASE_APP_ID=
VUE_APP_FIREBASE_MEASUREMENT_ID=
VUE_APP_FIREBASE_DATABASE_URL=

VUE_APP_MAX_ERROR_LOG_SIZE=100
VUE_APP_REPORT_TARGETS=
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ jobs:
asset_name: liquality-wallet-${{ steps.get_current_tag.outputs.tag }}.zip
asset_content_type: application/zip

# Run tests against Prod mainnet
- name: Regression tests against Mainnet (PROD Agent)
uses: beemi/[email protected]
env:
CI: 'true'
DISPLAY: :99
SEED_WORDS: ${{ secrets.TEST_NET_SEED_WORDS }}
TWENTY_FOUR_SEEDS: ${{ secrets.TWENTY_FOUR_SEEDS }}
with:
args: yarn test:mainnet:prodagent:release
# # Run tests against Prod mainnet
# - name: Regression tests against Mainnet (PROD Agent)
# uses: beemi/[email protected]
# env:
# CI: 'true'
# DISPLAY: :99
# SEED_WORDS: ${{ secrets.TEST_NET_SEED_WORDS }}
# TWENTY_FOUR_SEEDS: ${{ secrets.TWENTY_FOUR_SEEDS }}
# with:
# args: yarn test:mainnet:prodagent:release
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liquality-wallet",
"version": "0.77.0",
"version": "0.81.0",
"private": true,
"author": "Liquality <[email protected]>",
"scripts": {
Expand All @@ -21,11 +21,12 @@
"test-full-regression": "node_modules/mocha/bin/mocha"
},
"dependencies": {
"@liquality/cryptoassets": "1.16.2",
"@liquality/cryptoassets": "2.1.0-next.2",
"@liquality/error-parser": "2.0.1-next.2",
"@liquality/ethereum-utils": "^1.13.12",
"@liquality/terra-networks": "^1.13.12",
"@liquality/types": "^1.13.12",
"@liquality/wallet-core": "1.31.3",
"@liquality/wallet-core": "3.0.0",
"@terra-money/terra.js": "^3.1.6",
"@testing-library/vue": "^5.8.2",
"amplitude-js": "8.18.2",
Expand All @@ -41,7 +42,6 @@
"date-fns": "2.28.0",
"ethers": "5.7.0",
"extension-port-stream": "^2.0.1",
"firebase": "^9.12.1",
"human-standard-token-abi": "^2.0.0",
"i18n-js": "^4.1.1",
"lodash-es": "^4.17.15",
Expand Down Expand Up @@ -69,18 +69,19 @@
"vuex-persist": "3.1.3"
},
"devDependencies": {
"@testing-library/jest-dom": "5.16.2",
"@testing-library/jest-dom": "5.16.5",
"@vue/cli-plugin-babel": "4.5.15",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "4.5.15",
"@vue/cli-plugin-unit-jest": "^4.5.8",
"@vue/cli-plugin-vuex": "4.5.15",
"@vue/cli-service": "4.5.15",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/test-utils": "1.3.0",
"@vue/test-utils": "1.3.3",
"babel-eslint": "^10.1.0",
"caniuse-lite": "^1.0.30001397",
"chai-match": "^1.1.1",
"copy-webpack-plugin": "6",
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
Expand Down
26 changes: 19 additions & 7 deletions src/broker/Background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { buildConfig } from '@liquality/wallet-core'
import { BG_PREFIX, handleConnection, removeConnectId, getRootURL } from './utils'
import { getChain } from '@liquality/cryptoassets'
import {
CUSTOM_ERRORS,
createInternalError,
reportLiqualityError,
DappNotConnectedError
} from '@liquality/error-parser'
import { connectRemote } from './terra-injection'
import { errorToLiqualityErrorString } from '@liquality/error-parser/dist/src/utils'

function attemptOrWarn(func, message) {
try {
Expand Down Expand Up @@ -154,8 +161,11 @@ class Background {
.dispatch(data.type, data.payload)
.then((result) => ({ result }))
.catch((error) => {
console.error(error)
return { error: error.message }
const liqualityErrorString = errorToLiqualityErrorString(error)
reportLiqualityError(error)
return {
error: liqualityErrorString
}
})
.then((response) =>
attemptOrWarn(
Expand All @@ -175,7 +185,7 @@ class Background {
break

default:
throw new Error(`Received an invalid message type: ${type}`)
throw createInternalError(CUSTOM_ERRORS.Invalid.MessageType(type))
}
}

Expand Down Expand Up @@ -247,7 +257,7 @@ class Background {
connection.postMessage({
id,
data: {
error: 'Use enable() method first'
error: new DappNotConnectedError({ dapp: origin, chain: chain }).toString()
}
})
}
Expand All @@ -260,7 +270,7 @@ class Background {
connection.postMessage({
id,
data: {
error: 'Use enable() method first'
error: new DappNotConnectedError({ dapp: origin, chain: chain }).toString()
}
})
}
Expand All @@ -278,8 +288,10 @@ class Background {
.dispatch(action, data)
.then((result) => ({ result }))
.catch((error) => {
console.error(error) /* eslint-disable-line */
return { error: error.toString() }
const liqualityErrorString = errorToLiqualityErrorString(error)
return {
error: liqualityErrorString
}
})
.then((response) => {
connection.postMessage({
Expand Down
5 changes: 3 additions & 2 deletions src/broker/Foreground.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CUSTOM_ERRORS, createInternalError } from '@liquality/error-parser'
import EventEmitter from 'events'
import { BG_PREFIX, connectToBackground, newConnectId, Deferred } from './utils'

Expand Down Expand Up @@ -60,7 +61,7 @@ class Foreground {
break

case 'REHYDRATE_STATE':
if (this.initialized) throw new Error('State has already been synchronised with Background')
if (this.initialized) throw createInternalError(CUSTOM_ERRORS.FailedAssert.RehydrateState)

this.store.replaceState(data)

Expand All @@ -78,7 +79,7 @@ class Foreground {
break

default:
throw new Error(`Received an invalid message type: ${type}`)
throw createInternalError(CUSTOM_ERRORS.Invalid.MessageType(type))
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/components/ActivityFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{ $t('components.activityFilter.dateRange') }}
</div>
<div class="date-filter-inputs h-padding form">
<date-pick v-model="dateFilters.start">
<date-pick v-model="dateFilters.start" @input="changeTrigered">
<template v-slot:default="{ toggle, inputValue, inputEvents }">
<div class="input-group" @click="toggle">
<input
Expand All @@ -37,7 +37,7 @@
</div>
</template>
</date-pick>
<date-pick v-model="dateFilters.end">
<date-pick v-model="dateFilters.end" @input="changeTrigered">
<template v-slot:default="{ toggle, inputValue, inputEvents }">
<div class="input-group" @click="toggle">
<input
Expand Down Expand Up @@ -261,6 +261,11 @@ export default {
statuses,
dates: this.dateFilters
})
},
changeTrigered() {
this.$nextTick(() => {
this.applyFilters()
})
}
}
}
Expand Down
69 changes: 69 additions & 0 deletions src/components/CopyError.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
<div class="copy-container">
<button class="copy-btn" @click="copyError">
<CopyIcon class="icon" v-if="!errorCopied" />
<CheckIcon class="icon" v-if="errorCopied" />
{{ errorCopied ? $t('common.copied') : $t('common.copyError') }}
</button>
</div>
</template>

<script>
import CopyIcon from '@/assets/icons/copy.svg'
import CheckIcon from '@/assets/icons/check-primary.svg'
import { liqualityErrorStringToJson } from '@liquality/error-parser'
export default {
props: ['translatedError', 'liqualityErrorString'],
components: {
CopyIcon,
CheckIcon
},
computed: {
jsonError() {
return {
error: liqualityErrorStringToJson(this.liqualityErrorString),
friendlyMessage: this.translatedError
}
}
},
data() {
return {
errorCopied: false
}
},
methods: {
async copyError() {
await navigator.clipboard.writeText(JSON.stringify(this.jsonError))
this.errorCopied = true
setTimeout(() => {
this.errorCopied = false
}, 4000)
}
}
}
</script>

<style lang="scss" scoped>
.copy-container {
text-align: right;
margin-left: auto;
}
.copy-btn {
display: flex;
align-items: center;
color: #9d4dfa;
background: transparent;
border: none;
cursor: pointer;
.icon {
width: 10px;
height: 10px;
font-size: 10px;
line-height: 12px;
margin-right: 5px;
}
}
</style>
17 changes: 12 additions & 5 deletions src/components/CustomFeesEIP1559.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ import { prettyFiatBalance } from '@liquality/wallet-core/dist/src/utils/coinFor
import ChevronUpIcon from '@/assets/icons/chevron_up.svg'
import ChevronDownIcon from '@/assets/icons/chevron_down.svg'
import { mapState } from 'vuex'
import {
NoTipError,
VeryLowTipError,
VeryHighTipWarning,
NoMaxFeeError,
VeryHighMaxFeeWarning
} from '@liquality/error-parser/dist/src/LiqualityErrors'
export default {
components: {
Expand Down Expand Up @@ -266,20 +273,20 @@ export default {
...mapState(['activeNetwork']),
// TODO: move erro handling to wallet-core
noTipError() {
return !this.tipFee ? 'Miner tip must be greater than 0 GWEI' : null
return !this.tipFee ? this.$tle(new NoTipError()) : null
},
veryLowTipError() {
return !this.noTipError && this.tipFee < this.fees.slow.fee.maxPriorityFeePerGas
? 'Miner tip is extremely low and the transaction could fail. Use ‘Low’.'
? this.$tle(new VeryLowTipError())
: null
},
veryHighTipWarning() {
return this.tipFee > this.fees.fast.fee.maxPriorityFeePerGas
? 'Miner tip is higher than necessary. You may pay more than needed. Use ‘High’.'
? this.$tle(new VeryHighTipWarning())
: null
},
noMaxFeeError() {
return !this.maxFee ? 'Max fee must be greater than 0 GWEI' : null
return !this.maxFee ? this.$tle(new NoMaxFeeError()) : null
},
veryLowMaxFeeError() {
return this.maxFee < this.fees.slow.fee.maxFeePerGas
Expand All @@ -288,7 +295,7 @@ export default {
},
veryHighFeeWarning() {
return this.maxFee > this.fees.fast.fee.maxFeePerGas
? `Max fee is higher than necessary ${this.fees.fast.fee.maxFeePerGas} GWEI (Base Fee plus Miner Tip). Review your maximum ‘New Fee Total’.`
? this.$tle(new VeryHighMaxFeeWarning({ maxFeePerGas: this.fees.fast.fee.maxFeePerGas }))
: null
},
slowPreset() {
Expand Down
27 changes: 23 additions & 4 deletions src/components/EthRequiredMessage.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
<template>
<div class="notification-content">
<div class="notification-text">
{{ $t('components.ethRequiredMesssage.message') }}
{{ $t(`components.ethRequiredMessage.message_${action}`, { nativeAsset }) }}
</div>
<router-link :to="accountUrl" class="btn btn-option get-eth-btn">
{{ $t('components.ethRequiredMesssage.getETH') }}
{{ $t('components.ethRequiredMessage.getETH', { nativeAsset }) }}
</router-link>
</div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getNativeAsset, getFeeAsset } from '@liquality/wallet-core/dist/src/utils/asset'
export default {
props: {
accountId: String
accountId: String,
action: {
type: String,
default: 'swap'
}
},
computed: {
...mapGetters(['accountItem', 'client', 'suggestedFeePrices']),
account() {
return this.accountItem(this.accountId)
},
accountUrl() {
return `/accounts/${this.accountId}/ETH/receive`
return `/accounts/${this.accountId}/${this.nativeAsset}/receive`
},
nativeAsset() {
return getFeeAsset(this.asset) || getNativeAsset(this.asset)
},
asset() {
if (this.account?.assets && this.account?.assets.length > 0) {
return this.account?.assets[0]
}
return null
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Head.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export default {
},
async switchNetwork(network) {
await this.changeActiveNetwork({ network })
await this.$router.replace('/wallet')
if (this.$route.name !== 'WalletAssets') {
await this.$router.replace({ name: 'WalletAssets'})
}
this.showNetworks = false
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFT/NFTAsset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default {
path: `/details/nft-asset/${this.nftAsset.token_id}`,
query: {
collection: this.nftAsset.collection?.name,
nftAsset: this.nftAsset.id,
nftAsset: this.nftAsset.token_id,
accountId: this.accountId,
source: this.$route.fullPath
}
Expand Down
Loading

0 comments on commit ac33587

Please sign in to comment.