diff --git a/.prettierrc b/.prettierrc index cc78523b5..da8620da0 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { "singleQuote": true, - "printWidth": 180, - "trailingComma": "es5" + "printWidth": 100, + "trailingComma": "all" } diff --git a/.travis.yml b/.travis.yml index 87c26b61f..af7fd5644 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,10 @@ cache: npm: true directories: - ~/.cache - + script: - npm run lint -- --no-fix + - npm test - npm run build before_deploy: scripts/before-deploy.sh @@ -33,3 +34,8 @@ deploy: target_branch: master on: branch: develop + - provider: script + skip_cleanup: true + script: scripts/deploy-stage.sh + on: + all_branches: true diff --git a/config.xml b/config.xml index 2a47c1ab4..13bbdbbb7 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + SuperHero SuperHero wallet diff --git a/package-lock.json b/package-lock.json index 91c9eff19..a28970508 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "superhero-wallet", - "version": "0.0.14", + "version": "0.0.15", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2605,19 +2605,18 @@ "version": "github:aeternity/aepp-raendom#9bf50b4c526e81ee6d26f3eb57c7becfba3cdd5e", "from": "github:aeternity/aepp-raendom#feature/layout-superhero", "requires": { - "@aeternity/aepp-sdk": "7.2.1", + "@aeternity/aepp-sdk": "7.1.1", "axios": "^0.19.0", "bignumber.js": "^9.0.0", "bootstrap": "^4.4.1", - "bootstrap-vue": "^2.9.0", - "core-js": "^3.6.4", - "detect-browser": "^4.8.0", - "i18n": "^0.8.6", + "bootstrap-vue": "^2.4.0", + "i18n": "^0.8.5", "lodash-es": "^4.17.15", - "vue": "^2.6.11", - "vue-i18n": "^8.16.0", - "vue-router": "^3.1.6", - "vuex": "^3.1.3" + "timers": "^0.1.1", + "vue": "^2.6.10", + "vue-i18n": "^8.15.3", + "vue-router": "^3.1.3", + "vuex": "^3.1.2" }, "dependencies": { "@aeternity/aepp-sdk": { @@ -4229,6 +4228,11 @@ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001023.tgz", "integrity": "sha512-C5TDMiYG11EOhVOA62W1p3UsJ2z4DsHtMBQtjzp3ZsUglcQn62WOUgW0y795c7A5uZ+GCEIvzkMatLIlAsbNTA==" }, + "canvas-renderer": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/canvas-renderer/-/canvas-renderer-2.1.1.tgz", + "integrity": "sha512-/V0XetN7s1Mk3NO7x2wxPZYv0pLMQtGAhecuOuKR88beiYCUle1AbCcFZNLu+4NVzi9RVHS0rXtIgzPEaKidLw==" + }, "capture-stack-trace": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", @@ -5619,7 +5623,8 @@ "core-js": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz", - "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==" + "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==", + "dev": true }, "core-js-compat": { "version": "3.6.4", @@ -11118,6 +11123,15 @@ "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-1.6.0.tgz", "integrity": "sha1-FC0RHzpuPa6PSpr9d9RYVbWpzOM=" }, + "jdenticon": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jdenticon/-/jdenticon-2.2.0.tgz", + "integrity": "sha512-WGqwpjN9pab/Sah9pGnFH5tQc3HF3WbLV/tPVbykvk5nuAkxG/zhzQYWC2owvpnS+/A0HmlSx35rtY8kyN+x7Q==", + "requires": { + "@types/node": "*", + "canvas-renderer": "~2.1.1" + } + }, "joi-browser": { "version": "13.4.0", "resolved": "https://registry.npmjs.org/joi-browser/-/joi-browser-13.4.0.tgz", @@ -18290,6 +18304,11 @@ "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, + "timers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/timers/-/timers-0.1.1.tgz", + "integrity": "sha1-hqxceMHuQZaU81pY3k/UGDz7nB4=" + }, "timers-browserify": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", diff --git a/package.json b/package.json index 5c50c6f21..db33935c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "superhero-wallet", - "version": "0.0.14", + "version": "0.0.15", "description": "Superhero wallet", "author": "SuperHero", "license": "MIT", @@ -64,6 +64,7 @@ "extensionizer": "^1.0.1", "file-saver": "^2.0.2", "ionic-plugin-deeplinks": "github:aeternity/ionic-plugin-deeplinks", + "jdenticon": "^2.2.0", "lodash-es": "^4.17.15", "node-fetch": "^2.6.0", "nyc": "^14.1.1", diff --git a/scripts/deploy-stage.sh b/scripts/deploy-stage.sh new file mode 100755 index 000000000..cc20c392f --- /dev/null +++ b/scripts/deploy-stage.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +APP_NAME=wallet + +echo "${DEPLOY_KNOWN_HOSTS_BASE64}" | base64 --decode >> ~/.ssh/known_hosts +echo "${DEPLOY_USER_KEY_BASE64}" | base64 --decode > /tmp/user-key +eval "$(ssh-agent -s)" +chmod 600 /tmp/user-key +ssh-add /tmp/user-key + +DOMAIN=`echo $TRAVIS_BRANCH | tr '[:punct:]' '-'` + +rsync -e "ssh -p 2022" -r -v dist/web/root/* root@z52da5wt.xyz:/data/$APP_NAME/$DOMAIN + +URL=$DOMAIN.$APP_NAME.z52da5wt.xyz +echo "Deployed to $URL" +curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \ + -d "{\"body\": \"Deployed to [$URL](https://$URL)\"}" \ + "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/commits/${TRAVIS_COMMIT}/comments" diff --git a/serve.json b/serve.json index 26e45055f..5cce5cc03 100644 --- a/serve.json +++ b/serve.json @@ -1,3 +1,3 @@ { - "public": "dist/web/root" - } \ No newline at end of file + "public": "dist" +} \ No newline at end of file diff --git a/src/aepp/App.vue b/src/aepp/App.vue index b6ba73665..2d7193993 100644 --- a/src/aepp/App.vue +++ b/src/aepp/App.vue @@ -7,11 +7,15 @@

{{ wallet.name }}

- +

{{ message.sig }}

{{ contractCallRes }}

-

{{ contractCallStaticRes }}

+

+ {{ contractCallStaticRes }} +

{{ sendRes }}

@@ -73,13 +77,21 @@ contract Example = }, methods: { async initClient() { - const node = await Node({ url: networks[process.env.NETWORK].NODE_URL, internalUrl: networks[process.env.NETWORK].NODE_INTERNAL_URL }); + const node = await Node({ + url: networks[process.env.NETWORK].NODE_URL, + internalUrl: networks[process.env.NETWORK].NODE_INTERNAL_URL, + }); this.client = await RpcAepp({ name: 'AEPP', nodes: [{ name: process.env.NETWORK, instance: node }], compilerUrl: networks[process.env.NETWORK].COMPILER_URL, onNetworkChange(params) { - if (this.getNetworkId() !== params.networkId) alert(`Connected network ${this.getNetworkId()} is not supported with wallet network ${params.networkId}`); + if (this.getNetworkId() !== params.networkId) + alert( + `Connected network ${this.getNetworkId()} is not supported with wallet network ${ + params.networkId + }`, + ); }, onAddressChange: async () => { this.wallet.address = await this.client.address(); @@ -89,7 +101,11 @@ contract Example = }); }, async spend() { - const spend = await this.client.spend(1000000000000000, 'ak_2ELPCWzcTdiyYuumjaV4D7kE843d1Ts27zH1Y2LBMKDbNtfq1Q', { payload: '' }); + const spend = await this.client.spend( + 1000000000000000, + 'ak_2ELPCWzcTdiyYuumjaV4D7kE843d1Ts27zH1Y2LBMKDbNtfq1Q', + { payload: '' }, + ); if (spend.hash) { this.sendRes = spend; } @@ -98,12 +114,22 @@ contract Example = const compile = (await this.client.contractCompile(this.contractCode)).bytecode; const deploy = await this.client.contractDeploy(compile, this.contractCode, []); if (type === 'statefull') { - const result = await this.client.contractCall(this.contractCode, deploy.address, 'set_bytes', ['#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']); + const result = await this.client.contractCall( + this.contractCode, + deploy.address, + 'set_bytes', + ['#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], + ); if (result.hash) { this.contractCallRes = result; } } else if (type === 'static') { - const result = await this.client.contractCall(this.contractCode, deploy.address, 'get_bytes', []); + const result = await this.client.contractCall( + this.contractCode, + deploy.address, + 'get_bytes', + [], + ); if (result.hash) { this.contractCallStaticRes = result; } diff --git a/src/background.js b/src/background.js index 663e3a22b..4e7d857f8 100644 --- a/src/background.js +++ b/src/background.js @@ -6,7 +6,13 @@ import { buildTx } from './popup/utils'; import WalletController from './wallet-controller'; import Notification from './notifications'; import rpcWallet from './lib/rpcWallet'; -import { HDWALLET_METHODS, AEX2_METHODS, NOTIFICATION_METHODS, CONNECTION_TYPES, DEFAULT_NETWORK } from './popup/utils/constants'; +import { + HDWALLET_METHODS, + AEX2_METHODS, + NOTIFICATION_METHODS, + CONNECTION_TYPES, + DEFAULT_NETWORK, +} from './popup/utils/constants'; import { popupProps } from './popup/utils/config'; import TipClaimRelay from './lib/tip-claim-relay'; import RedirectChainNames from './lib/redirect-chain-names'; @@ -63,7 +69,11 @@ if (process.env.IS_EXTENSION && require.main.i === module.id) { break; } - if (msg.from === 'content' && msg.type === 'readDom' && (msg.data.address || msg.data.chainName)) { + if ( + msg.from === 'content' && + msg.type === 'readDom' && + (msg.data.address || msg.data.chainName) + ) { const tabs = await browser.tabs.query({ active: true, currentWindow: true }); tabs.forEach(({ url }) => { if (sender.url === url && DEFAULT_NETWORK === 'Mainnet') { diff --git a/src/common/base.scss b/src/common/base.scss index f4258bf0e..ce7f7520e 100644 --- a/src/common/base.scss +++ b/src/common/base.scss @@ -65,7 +65,7 @@ p { font-size: 1.3rem; } .wrapper { - max-width: 480px; + max-width: 357px; -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0 auto; @@ -689,12 +689,6 @@ input::-moz-focus-outer { height: 50px !important; } -@-moz-document url-prefix() { - .ae-main { - width: 357px; - margin: 0 auto; - } -} .ae-identicon.base { height: 100%; width: 100%; @@ -923,3 +917,27 @@ button { text-align: center; font-weight: bold; } + +@media screen and (min-width: 780px) { + @-moz-document url-prefix() { + .ae-main { + width: 100%; + max-width: 100%; + margin: 0 auto; + } + } +} + +@media screen and (max-width: 380px) { + .ae-main { + max-width: 357px; + margin: 0 auto; + } + + @-moz-document url-prefix() { + .ae-main { + max-width: 357px; + margin: 0 auto; + } + } +} \ No newline at end of file diff --git a/src/common/extension.scss b/src/common/extension.scss index d0c0d478d..32b544fc7 100644 --- a/src/common/extension.scss +++ b/src/common/extension.scss @@ -42,7 +42,7 @@ a { .primary-title { color: $white-color; font-size: 18px; - font-weight: lighter; + font-weight: 400; margin-bottom:27px; margin-left:0 !important; } diff --git a/src/common/variables.scss b/src/common/variables.scss index 6e2ff379b..f2f6ddfb0 100644 --- a/src/common/variables.scss +++ b/src/common/variables.scss @@ -37,4 +37,7 @@ $scrollbar-color:#707075; $submenu-bg: #1B1B23; $black-color: #000; $filters-bg:#111117; +$untrusted-badge-bg: #FF5857; +$tour-bg-color: #12121b; +$tour-start-bg-color: #33343E; $font-size: 16px; \ No newline at end of file diff --git a/src/icons/edit-icon.svg b/src/icons/edit-icon.svg new file mode 100644 index 000000000..2af240c3e --- /dev/null +++ b/src/icons/edit-icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/icons/icon_128.png b/src/icons/icon_128.png index d7c8ceba8..c6aea1d0b 100644 Binary files a/src/icons/icon_128.png and b/src/icons/icon_128.png differ diff --git a/src/icons/icon_48.png b/src/icons/icon_48.png index b06341c4d..c4796a7e1 100644 Binary files a/src/icons/icon_48.png and b/src/icons/icon_48.png differ diff --git a/src/icons/tick-icon.svg b/src/icons/tick-icon.svg new file mode 100644 index 000000000..3ec5cf41d --- /dev/null +++ b/src/icons/tick-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/inject.js b/src/inject.js index 5c470383d..7caf0e7f3 100644 --- a/src/inject.js +++ b/src/inject.js @@ -50,7 +50,7 @@ window.addEventListener( sendToBackground(method, data); } }, - false + false, ); const getAddresses = () => { @@ -88,7 +88,7 @@ window.addEventListener('load', () => { sendDomData(); } }, - false + false, ); }); diff --git a/src/lib/backend.js b/src/lib/backend.js index d25bc6059..68023cf7b 100644 --- a/src/lib/backend.js +++ b/src/lib/backend.js @@ -22,7 +22,8 @@ const wrapTry = async promise => { const backendFetch = (path, ...args) => wrapTry(fetch(`${BACKEND_URL}/${path}`, ...args)); export default class Backend { - static getTipComments = async tipId => backendFetch(`comment/api/tip/${encodeURIComponent(tipId)}`); + static getTipComments = async tipId => + backendFetch(`comment/api/tip/${encodeURIComponent(tipId)}`); static async sendTipComment(tipId, text, author, signCb) { const sendComment = async postParam => @@ -91,7 +92,8 @@ export default class Backend { static cacheInvalidateTips = async () => backendFetch(`cache/invalidate/tips`); - static getCommentCountForAddress = async address => backendFetch(`comment/count/author/${address}`); + static getCommentCountForAddress = async address => + backendFetch(`comment/count/author/${address}`); static getTipPreviewUrl = previewLink => `${BACKEND_URL}${previewLink}`; diff --git a/src/lib/background-utils.js b/src/lib/background-utils.js index 82ee9b1a8..a11175093 100644 --- a/src/lib/background-utils.js +++ b/src/lib/background-utils.js @@ -1,7 +1,12 @@ import Universal from '@aeternity/aepp-sdk/es/ae/universal'; import Node from '@aeternity/aepp-sdk/es/node'; import { isEmpty } from 'lodash-es'; -import { setContractInstance, contractCall, getAddressByNameEntry, getActiveNetwork } from '../popup/utils/helper'; +import { + setContractInstance, + contractCall, + getAddressByNameEntry, + getActiveNetwork, +} from '../popup/utils/helper'; import { getState } from '../store/plugins/persistState'; let sdk; @@ -70,7 +75,8 @@ const getAddress = async name => { } }; -export const getAddressFromChainName = async names => (Array.isArray(names) ? Promise.all(names.map(async n => getAddress(n))) : getAddress(names)); +export const getAddressFromChainName = async names => + Array.isArray(names) ? Promise.all(names.map(async n => getAddress(n))) : getAddress(names); export const getTippingContractInstance = async tx => { if (tippingContract) return tippingContract; @@ -85,13 +91,21 @@ export const contractCallStatic = async ({ tx, callType }) => const { account } = await getActiveAccount(); if (typeof callType !== 'undefined' && callType === 'static' && account) { const contractInstance = await getTippingContractInstance(tx); - const call = await contractCall({ instance: contractInstance, method: tx.method, params: [...tx.params, tx.options] }); + const call = await contractCall({ + instance: contractInstance, + method: tx.method, + params: [...tx.params, tx.options], + }); if (call) { resolve(call); } else { reject(new Error('Contract call failed')); } - } else if (!controller.isLoggedIn() && typeof callType !== 'undefined' && callType === 'static') { + } else if ( + !controller.isLoggedIn() && + typeof callType !== 'undefined' && + callType === 'static' + ) { reject(new Error('You need to unlock the wallet first')); } } catch (e) { diff --git a/src/lib/initEnv.js b/src/lib/initEnv.js index 8d0ea7792..899afeaf0 100644 --- a/src/lib/initEnv.js +++ b/src/lib/initEnv.js @@ -6,5 +6,7 @@ Object.assign(process.env, { const url = new URL(window.location.href); window.RUNNING_IN_POPUP = - url.searchParams.get('id') && (window.location.pathname.includes('popup.html') || (process.env.RUNNING_IN_TESTS && window.location.pathname.includes('popup'))); + url.searchParams.get('id') && + (window.location.pathname.includes('popup.html') || + (process.env.RUNNING_IN_TESTS && window.location.pathname.includes('popup'))); window.POPUP_TYPE = url.searchParams.get('type') ? url.searchParams.get('type') : null; diff --git a/src/lib/initPolyfills.js b/src/lib/initPolyfills.js index 3dad42387..77ce7b853 100644 --- a/src/lib/initPolyfills.js +++ b/src/lib/initPolyfills.js @@ -15,11 +15,13 @@ global.browser = process.env.IS_EXTENSION return [k, v === null ? undefined : JSON.parse(v)]; }) .filter(([, value]) => value !== undefined) - .reduce((p, [k, v]) => ({ ...p, [k]: v }), {}) + .reduce((p, [k, v]) => ({ ...p, [k]: v }), {}), ); }, set(object) { - Object.entries(object).forEach(([key, value]) => localStorage.setItem(key, JSON.stringify(value))); + Object.entries(object).forEach(([key, value]) => + localStorage.setItem(key, JSON.stringify(value)), + ); return Promise.resolve(); }, remove(key) { diff --git a/src/lib/popup-connection.js b/src/lib/popup-connection.js index 6e2f7b197..e2d861510 100644 --- a/src/lib/popup-connection.js +++ b/src/lib/popup-connection.js @@ -21,7 +21,8 @@ export const PopupConnection = stampit({ } else if (msg.type === 'POPUP_INFO') { this.postMessage({ uuid: msg.uuid, res: this.aeppInfo }); } else if (typeToAction[msg.type]) { - if (this.actions[typeToAction[msg.type]]) this.actions[typeToAction[msg.type]](msg.payload ? msg.payload : false); + if (this.actions[typeToAction[msg.type]]) + this.actions[typeToAction[msg.type]](msg.payload ? msg.payload : false); this.actions.resolve(typeToAction[msg.type] !== 'deny'); } }, diff --git a/src/lib/redirect-chain-names.js b/src/lib/redirect-chain-names.js index a1c965b2e..a7f308dc4 100644 --- a/src/lib/redirect-chain-names.js +++ b/src/lib/redirect-chain-names.js @@ -1,6 +1,5 @@ import { getAddressFromChainName } from './background-utils'; - -const redirectUrl = 'https://youdonotneedacapetobeahero.com/#/'; +import { UI_URL } from '../popup/utils/constants'; export default { init() { @@ -30,7 +29,7 @@ export default { urls: ['*://*.google.com/*'], types: ['main_frame'], }, - ['blocking'] + ['blocking'], ); browser.webRequest.onBeforeRequest.addListener( @@ -46,7 +45,7 @@ export default { if (!pubKey) { throw new Error(`${host} not found`); } - const displayUrl = `${redirectUrl}user-profile/${pubKey}`; + const displayUrl = `${UI_URL}user-profile/${pubKey}`; chrome.tabs.update({ url: displayUrl }); } catch (err) { chrome.tabs.update({ url: `/redirect/index.html?error=${err.message}` }); @@ -57,7 +56,7 @@ export default { { urls: ['*://*.chain/*'], types: ['main_frame'], - } + }, ); }, }; diff --git a/src/lib/rpcWallet.js b/src/lib/rpcWallet.js index 1df7fd363..617b76093 100644 --- a/src/lib/rpcWallet.js +++ b/src/lib/rpcWallet.js @@ -16,7 +16,13 @@ import { resetTippedAmount, getContractCallInfo, } from '../popup/utils/helper'; -import { DEFAULT_NETWORK, AEX2_METHODS, NO_POPUP_AEPPS, BLACKLIST_AEPPS, MAX_AMOUNT_WITHOUT_CONFIRM } from '../popup/utils/constants'; +import { + DEFAULT_NETWORK, + AEX2_METHODS, + NO_POPUP_AEPPS, + BLACKLIST_AEPPS, + MAX_AMOUNT_WITHOUT_CONFIRM, +} from '../popup/utils/constants'; import { mockLogin } from '../popup/utils'; import { getState } from '../store/plugins/persistState'; @@ -65,12 +71,16 @@ const rpcWallet = { return Promise.resolve(true); }, async createWallet() { - this.accountKeyPairs = await Promise.all(this.subaccounts.map(async (a, index) => parseFromStorage(await this.controller.getKeypair({ activeAccount: index, account: a })))); + this.accountKeyPairs = await Promise.all( + this.subaccounts.map(async (a, index) => + parseFromStorage(await this.controller.getKeypair({ activeAccount: index, account: a })), + ), + ); this.accounts = this.accountKeyPairs.map(a => MemoryAccount({ keypair: a, - }) + }), ); const context = this; try { @@ -222,7 +232,15 @@ const rpcWallet = { info: { icons, name }, } = aepp; const { protocol } = new URL(url); - this.popups.setAeppInfo(id, { type, action: { params: action.params, method: action.method }, url, icons, name, protocol, host: extractHostName(url) }); + this.popups.setAeppInfo(id, { + type, + action: { params: action.params, method: action.method }, + url, + icons, + name, + protocol, + host: extractHostName(url), + }); } catch (e) { console.error(`showPopup: ${e}`); } @@ -230,7 +248,10 @@ const rpcWallet = { }, async addConnection(port) { - const connection = await BrowserRuntimeConnection({ connectionInfo: { id: port.sender.frameId }, port }); + const connection = await BrowserRuntimeConnection({ + connectionInfo: { id: port.sender.frameId }, + port, + }); this.sdk.addRpcClient(connection); this.sdk.shareWalletInfo(port.postMessage.bind(port)); setTimeout(() => this.sdk.shareWalletInfo(port.postMessage.bind(port)), 3000); @@ -269,7 +290,9 @@ const rpcWallet = { publicKey: payload.address, }; const newAccount = MemoryAccount({ - keypair: parseFromStorage(await this.controller.getKeypair({ activeAccount: payload.idx, account })), + keypair: parseFromStorage( + await this.controller.getKeypair({ activeAccount: payload.idx, account }), + ), }); this.sdk.addAccount(newAccount); this.activeAccount = payload.address; diff --git a/src/lib/wallet.js b/src/lib/wallet.js index 880ed0971..5abdfa5ff 100644 --- a/src/lib/wallet.js +++ b/src/lib/wallet.js @@ -40,7 +40,10 @@ export default { } const { network, current } = store.getters; - const node = await Node({ url: network[current.network].internalUrl, internalUrl: network[current.network].internalUrl }); + const node = await Node({ + url: network[current.network].internalUrl, + internalUrl: network[current.network].internalUrl, + }); const account = MemoryAccount({ keypair }); try { const sdk = await Universal({ @@ -76,7 +79,10 @@ export default { async initContractInstances() { store.commit( 'SET_TIPPING', - await store.getters.sdk.getContractInstance(TIPPING_CONTRACT, { contractAddress: store.getters.network[store.getters.current.network].tipContract, forceCodeCheck: true }) + await store.getters.sdk.getContractInstance(TIPPING_CONTRACT, { + contractAddress: store.getters.network[store.getters.current.network].tipContract, + forceCodeCheck: true, + }), ); }, }; diff --git a/src/manifest.js b/src/manifest.js index 4a1990d91..05e9dfef2 100644 --- a/src/manifest.js +++ b/src/manifest.js @@ -47,5 +47,10 @@ module.exports = (isProd, browser) => ({ js: ['other/inject.js'], }, ], - web_accessible_resources: ['inject.js', 'phishing/phishing.html', 'phishing/phishing.js', 'popup/CameraRequestPermission.html'], + web_accessible_resources: [ + 'inject.js', + 'phishing/phishing.html', + 'phishing/phishing.js', + 'popup/CameraRequestPermission.html', + ], }); diff --git a/src/notifications.js b/src/notifications.js index 020568aa7..b00441bdb 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -62,9 +62,18 @@ export default class Notification { if (tx !== 'error' && tx) { await this.client.poll(tx); const url = `${this.network.explorerUrl}/transactions/${tx}`; - await sendNoti({ title: 'Transaction ready', message: `You can explore your transaction by clicking button below`, contextMessage: url, error: false }); + await sendNoti({ + title: 'Transaction ready', + message: `You can explore your transaction by clicking button below`, + contextMessage: url, + error: false, + }); } else { - await sendNoti({ title: 'Transaction error', message: 'Transaction cannot be processed ', error: true }); + await sendNoti({ + title: 'Transaction error', + message: 'Transaction cannot be processed ', + error: true, + }); } await deleteNotification(tx); diff --git a/src/phishing/App.vue b/src/phishing/App.vue index 12c5262cc..7c63a3de8 100644 --- a/src/phishing/App.vue +++ b/src/phishing/App.vue @@ -5,21 +5,30 @@ SuperHero logo

SuperHero Phishing Detection

- This domain is currently on the SuperHero domain warning list. This means that based on information available to us, SuperHero believes this domain could currently - compromise your security and, as an added safety feature, SuperHero has restricted access to the site. To override this, please read the rest of this warning for - instructions on how to continue at your own risk. + This domain is currently on the SuperHero domain warning list. This means that based on + information available to us, SuperHero believes this domain could currently compromise + your security and, as an added safety feature, SuperHero has restricted access to the + site. To override this, please read the rest of this warning for instructions on how to + continue at your own risk.

- There are many reasons sites can appear on our warning list, and our warning list compiles from other widely used industry lists. Such reasons can include known fraud or - security risks, such as domains that test positive on the SuperHero Phishing Detector. Domains on these warning lists may include outright malicious websites and - legitimate websites that have been compromised by a malicious actor. + There are many reasons sites can appear on our warning list, and our warning list compiles + from other widely used industry lists. Such reasons can include known fraud or security + risks, such as domains that test positive on the SuperHero Phishing Detector. + Domains on these warning lists may include outright malicious websites and legitimate + websites that have been compromised by a malicious actor.

- Note that this warning list is compiled on a voluntary basis. This list may be inaccurate or incomplete. Just because a domain does not appear on this list is not an - implicit guarantee of that domain's safety. As always, your transactions are your own responsibility. If you wish to interact with any domain on our warning list, you can - do so by continuing at your own risk. + Note that this warning list is compiled on a voluntary basis. This list may be inaccurate + or incomplete. Just because a domain does not appear on this list is not an implicit + guarantee of that domain's safety. As always, your transactions are your own + responsibility. If you wish to interact with any domain on our warning list, you can do so + by continuing at your own risk. +

+

+ If you think this domain is incorrectly flagged or if a blocked legitimate website has + resolved its security issues, please file an issue.

-

If you think this domain is incorrectly flagged or if a blocked legitimate website has resolved its security issues, please file an issue.

diff --git a/src/popup/App.vue b/src/popup/App.vue index f1362474f..3928af20f 100644 --- a/src/popup/App.vue +++ b/src/popup/App.vue @@ -1,11 +1,16 @@ @@ -39,9 +50,24 @@ export default { showSidebar: false, }), computed: { - ...mapGetters(['account', 'current', 'mainLoading', 'sdk', 'isLoggedIn', 'aeppPopup', 'notifications', 'notificationsCounter', 'backedUpSeed']), + ...mapGetters([ + 'account', + 'current', + 'mainLoading', + 'sdk', + 'isLoggedIn', + 'aeppPopup', + 'notifications', + 'notificationsCounter', + 'backedUpSeed', + ]), waveBg() { - return ['/intro', '/popup-sign-tx', '/connect', '/importAccount', '/receive'].includes(this.$route.path); + return ['/intro', '/popup-sign-tx', '/connect', '/importAccount', '/receive'].includes( + this.$route.path, + ); + }, + modals() { + return this.$store.getters['modals/opened']; }, }, async created() { @@ -49,7 +75,7 @@ export default { ({ current: { language } }) => [language], ([language]) => { fetchAndSetLocale(language); - } + }, ); this.checkSdkReady(); @@ -75,17 +101,23 @@ export default { if (!this.backedUpSeed) { this.$store.commit('ADD_NOTIFICATION', { title: '', - content: `${this.$t('pages.account.youNeedTo')} ${this.$t('pages.account.backup')} ${this.$t('pages.account.yourSeedPhrase')}`, + content: `${this.$t('pages.account.youNeedTo')} ${this.$t( + 'pages.account.backup', + )} ${this.$t('pages.account.yourSeedPhrase')}`, route: '/securitySettings', }); } - if (this.notificationsCounter !== 0) this.$store.commit('SET_NOTIFICATIONS_COUNTER', this.notifications.length); + if (this.notificationsCounter !== 0) + this.$store.commit('SET_NOTIFICATIONS_COUNTER', this.notifications.length); }, methods: { async checkSdkReady() { await this.$watchUntilTruly(() => this.sdk); if (!window.RUNNING_IN_POPUP && process.env.IS_EXTENSION) { - postMessage({ type: AEX2_METHODS.INIT_RPC_WALLET, payload: { address: this.account.publicKey, network: this.current.network } }); + postMessage({ + type: AEX2_METHODS.INIT_RPC_WALLET, + payload: { address: this.account.publicKey, network: this.current.network }, + }); } this.pollData(); }, @@ -106,7 +138,7 @@ export default { @@ -116,7 +148,6 @@ export default { .ae-main { position: relative; - max-width: 357px; min-height: 600px; margin: 0 auto; @@ -125,7 +156,7 @@ export default { padding-top: 0; } &.ae-main-wave { - background-position: 100% 100% !important; + background-position: center bottom !important; background-repeat: no-repeat !important; background-image: url('../icons/background-big-wave.png') !important; } @@ -163,4 +194,9 @@ export default { opacity: 0; } } +@media screen and (max-width: 380px) { + .ae-main.ae-main-wave { + background-position: 100% 100% !important; + } +} diff --git a/src/popup/cameraPermission.js b/src/popup/cameraPermission.js index bdfecc53b..0fefdd829 100644 --- a/src/popup/cameraPermission.js +++ b/src/popup/cameraPermission.js @@ -26,7 +26,7 @@ if (navigator.userAgent.indexOf('Firefox') !== -1) { err => { alert(`The following error occurred when trying to use getUserMedia: ${err}`); window.close(); - } + }, ); } else { alert('Sorry, your browser does not support getUserMedia'); diff --git a/src/popup/locales/en.json b/src/popup/locales/en.json index ac8964c00..b69148cf6 100644 --- a/src/popup/locales/en.json +++ b/src/popup/locales/en.json @@ -10,7 +10,7 @@ }, "step_3": { "title": "What is \"Verified\" URL", - "content": "If a URL is marked as verified, it means the owner of this URL is already a fellow Superhero—and that is awesome!" + "content": "If a URL is marked as verified, it means the owner of this URL is already a fellow Superhero — and that is awesome! An AE address has been included in the URL and tips can be claimed." }, "step_4": { "title": "Claim Tip", @@ -22,15 +22,49 @@ }, "step_6": { "title": "Top Up", - "content": "You can top up your wallet by swapping ETH or BTC into AE, or by purchasing AE using your credit card. It’s very easy." + "content": "You can top up your wallet by swapping ETH or BTC into AE, by purchasing AE using your credit card or by sending AE to your SuperHero wallet address from another AE account. It’s very easy." }, "step_7": { "title": "Withdraw", - "content": "You can easily withdraw your tips by sending them out to AE wallet addresses from your accounts in exchanges or external wallets, provided that they support AE tokens. You can then exchange them for other cryptocurrencies or withdraw to your bank." + "content": "You can easily withdraw your tips by sending them out to AE wallet addresses from your accounts in exchanges or external wallets, provided that they support AE tokens." }, "step_8": { "title": "Settings", "content": "You can view your security phrase (also referred to as seedphrase or private keys) and change your language settings." + }, + "heading": "Hey superhero! Welcome onboard", + "sub-heading": "This short guide will walk you through the Superhero Wallet DApp and its features.", + "skip": "Skip", + "back": "Back", + "next": "Next", + "start": "Start", + "tutorial": "Tutorial" + }, + "badges": { + "verified": "Verfied", + "untrusted": "Untrusted" + }, + "modals": { + "transaction-failed": { + "msg": "We cannot process this transaction! Please, try again!" + }, + "required": { + "msg": "Please fill in all fields." + }, + "only-chars": { + "msg": "Allowed only letters and numbers!" + }, + "name-exist": { + "msg": "This name is already registered!" + }, + "incorrect-address": { + "msg": "Please make sure that you have entered a valid public address!" + }, + "incorrect-amount": { + "msg": "Please make sure you entered valid amount!" + }, + "insufficient-balance": { + "msg": "The requested amount cannot be spent." } }, "pages": { @@ -115,8 +149,8 @@ "heading": "Account", "accountName": "Account name", "copy": "Copy address", - "send": "Send AE", - "claim": "Claim AE", + "send": "Send Tip", + "claim": "Claim Tip", "receive": "Receive", "wholeTransaction": "Whole transaction history", "latestTransactions": "Latest transactions", @@ -559,7 +593,7 @@ "section9Content": "USERS understand and accept ​the application can be periodically modified, updated, maintained or technically supported, which could to some extent influence the use of the Wallet​, the visual representation of ​the application ​or could result in malfunction. In the latter case, if ​You as a ​USER notice any change in the funds, settings, accounts or any other information on the application, please superherowallet@protonmail.com​ for assistance.", "section10Title": "10. MODIFICATIONS", "section10Content": "The legislation and jurisdiction of Liechtenstein is applied for the issues outstanding the present ​TERMS​. The invalidity of one or more clauses/ provisions in the ​TERMS does not lead to the invalidity of the whole agreement. \n The Privacy Policy is an inseparable part of the present ​TERMS and should be considered as a complementary document with compulsory character. Unless explicitly stated otherwise in the Privacy Policy, all rules from the ​TERMS​ apply respectively.", - "section11Title": "10. FINAL PROVISIONS" + "section11Title": "11. FINAL PROVISIONS" }, "tipPage": { "back": "Back", @@ -651,7 +685,7 @@ "sent": "Sent", "received": "Received", "withdrawals": "Withdrawals", - "topups": "Topups", + "topups": "Top ups", "all": "All" }, "transactions": { diff --git a/src/popup/popup-firefox.html b/src/popup/popup-firefox.html index ff3ed7576..5ce7bd50b 100644 --- a/src/popup/popup-firefox.html +++ b/src/popup/popup-firefox.html @@ -2,7 +2,10 @@ - SuperHero + SuperHero Wallet +
diff --git a/src/popup/popup.html b/src/popup/popup.html index 4a2ce3934..f5c3d0f1a 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -10,6 +10,9 @@ <% } %> +
diff --git a/src/popup/popup.js b/src/popup/popup.js index 401b1a72f..2ec853062 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -6,6 +6,7 @@ import router from './router'; import { i18n } from './utils/i18nHelper'; import '../lib/initEnv'; import '../lib/initPolyfills'; +import registerModals from './router/modals'; Vue.prototype.$browser = global.browser; Vue.prototype.$watchUntilTruly = function watchUntilTruly(getter) { @@ -17,14 +18,17 @@ Vue.prototype.$watchUntilTruly = function watchUntilTruly(getter) { resolve(); defer(() => unwatch()); }, - { immediate: true } + { immediate: true }, ); }); }; -new Vue({ - store, - router, - i18n, - render: h => h(App), -}).$mount('#app'); +(async () => { + await registerModals(); + new Vue({ + store, + router, + i18n, + render: h => h(App), + }).$mount('#app'); +})(); diff --git a/src/popup/router/components/AccountInfo.vue b/src/popup/router/components/AccountInfo.vue index 6bd4320b2..babb57fd3 100644 --- a/src/popup/router/components/AccountInfo.vue +++ b/src/popup/router/components/AccountInfo.vue @@ -36,7 +36,7 @@ export default { copy() { this.copied = true; setTimeout(() => { - // this.copied = false; + this.copied = false; }, 3000); }, }, @@ -47,7 +47,7 @@ export default { @import '../../../common/variables'; .account-info { - padding: 10px 20px 0 20px; + padding: 20px 20px 0 20px; text-align: left; .title { @@ -61,7 +61,7 @@ export default { } .account-name { - font-weight: 500; + font-weight: 400; color: #fff; line-height: 21px; } @@ -84,7 +84,7 @@ export default { .ae-address { color: $text-color; - font-size: 10px; + font-size: 11px; letter-spacing: -0.1px; } } diff --git a/src/popup/router/components/AddressInput.vue b/src/popup/router/components/AddressInput.vue index 643571355..19320a666 100644 --- a/src/popup/router/components/AddressInput.vue +++ b/src/popup/router/components/AddressInput.vue @@ -1,17 +1,31 @@ @@ -209,7 +255,10 @@ export default { }, async fetchFee() { await this.$watchUntilTruly(() => this.sdk); - const fee = await calculateFee(this.current.token === 0 ? TX_TYPES.txSign : TX_TYPES.contractCall, { ...(await this.feeParams()) }); + const fee = await calculateFee( + this.current.token === 0 ? TX_TYPES.txSign : TX_TYPES.contractCall, + { ...(await this.feeParams()) }, + ); this.fee = fee; }, async feeParams() { @@ -227,22 +276,17 @@ export default { const amount = aeToAettos(this.form.amount); const receiver = this.form.address; if (receiver === '' || (!checkAddress(receiver) && !chekAensName(receiver))) { - this.$store.dispatch('popupAlert', { name: 'spend', type: 'incorrect_address' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'incorrect-address' }); this.loading = false; return; } if (this.form.amount <= 0) { - this.$store.dispatch('popupAlert', { name: 'spend', type: 'incorrect_amount' }); - this.loading = false; - return; - } - if (this.tokenSymbol !== 'AE' && this.form.amount % 1 !== 0) { - this.$store.dispatch('popupAlert', { name: 'spend', type: 'integer_required' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'incorrect-amount' }); this.loading = false; return; } if (this.maxValue - this.form.amount <= 0 && this.current.token === 0) { - this.$store.dispatch('popupAlert', { name: 'spend', type: 'insufficient_balance' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'insufficient-balance' }); this.loading = false; return; } @@ -250,12 +294,17 @@ export default { try { const { hash } = await this.sdk.spend(amount, receiver, { waitMined: false }); if (hash) { - await this.$store.dispatch('setPendingTx', { hash, amount: this.form.amount, time: Date.parse(new Date()), type: 'spend' }); + await this.$store.dispatch('setPendingTx', { + hash, + amount: this.form.amount, + time: Date.parse(new Date()), + type: 'spend', + }); this.$router.push('/account'); } this.loading = false; } catch (e) { - this.$store.dispatch('popupAlert', { name: 'spend', type: 'transaction_failed' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'transaction-failed' }); this.loading = false; } }, diff --git a/src/popup/router/pages/Settings.vue b/src/popup/router/pages/Settings.vue index 8780b416c..ae720a34f 100644 --- a/src/popup/router/pages/Settings.vue +++ b/src/popup/router/pages/Settings.vue @@ -34,7 +34,17 @@ export default { }; }, computed: { - ...mapGetters(['account', 'balance', 'network', 'current', 'transactions', 'subaccounts', 'wallet', 'activeAccountName', 'activeAccount']), + ...mapGetters([ + 'account', + 'balance', + 'network', + 'current', + 'transactions', + 'subaccounts', + 'wallet', + 'activeAccountName', + 'activeAccount', + ]), }, methods: { GeneralSettings() { diff --git a/src/popup/router/pages/SignTransaction.vue b/src/popup/router/pages/SignTransaction.vue index 4435be1f8..167113d33 100644 --- a/src/popup/router/pages/SignTransaction.vue +++ b/src/popup/router/pages/SignTransaction.vue @@ -12,22 +12,37 @@
- {{ $t('pages.signTransaction.unknownAccount') }} + {{ + $t('pages.signTransaction.unknownAccount') + }}
- {{ data.type == 'contractCreate' ? 'New contract' : 'AENS' }} + {{ + data.type == 'contractCreate' ? 'New contract' : 'AENS' + }}
- +
- {{ $t('pages.signTransaction.contractCall') }} + {{ + $t('pages.signTransaction.contractCall') + }} {{ txType }}
{{ amount }} {{ token }}
-
${{ convertCurrency(usdRate, amount) }}
+
+ ${{ convertCurrency(usdRate, amount) }} +
- +
{{ $t('pages.signTransaction.name') }}
@@ -35,7 +50,11 @@ {{ data.tx.name }}
- +
{{ $t('pages.signTransaction.nameSalt') }}
@@ -43,7 +62,11 @@ {{ data.tx.preclaim.salt }}
- +
{{ $t('pages.signTransaction.nameId') }}
@@ -51,7 +74,11 @@ {{ data.tx.claim.id }}
- +
{{ $t('pages.signTransaction.fee') }}
@@ -64,21 +91,28 @@
--> - +
{{ $t('pages.signTransaction.total') }}
-
{{ totalSpend }} {{ token }}
+
+ {{ totalSpend }} {{ token }} +
- +
-
@@ -86,7 +120,13 @@ import { mapGetters } from 'vuex'; import BigNumber from 'bignumber.js'; import { MAGNITUDE, TX_TYPES, calculateFee } from '../../utils/constants'; -import { convertAmountToCurrency, checkAddress, chekAensName, aettosToAe, aeToAettos } from '../../utils/helper'; +import { + convertAmountToCurrency, + checkAddress, + chekAensName, + aettosToAe, + aeToAettos, +} from '../../utils/helper'; import Button from '../components/Button'; import UserAvatar from '../components/UserAvatar'; @@ -232,7 +272,12 @@ export default { return true; }, isNameTx() { - return this.data.type === 'namePreClaim' || this.data.type === 'nameBid' || this.data.type === 'nameClaim' || this.data.type === 'nameUpdate'; + return ( + this.data.type === 'namePreClaim' || + this.data.type === 'nameBid' || + this.data.type === 'nameClaim' || + this.data.type === 'nameUpdate' + ); }, convertSelectedFee() { return BigNumber(this.selectedFee).shiftedBy(MAGNITUDE); @@ -254,7 +299,9 @@ export default { backend = 'aevm'; } try { - this.contractInstance = await this.$helpers.getContractInstance(source, { contractAddress }); + this.contractInstance = await this.$helpers.getContractInstance(source, { + contractAddress, + }); this.contractInstance.setOptions({ backend }); if (typeof options.waitMined !== 'undefined') { this.contractInstance.setOptions({ waitMined: options.waitMined }); @@ -278,15 +325,20 @@ export default { async init() { this.setReceiver(); if (this.isLedger && this.data.type !== 'txSign') { - this.$store.dispatch('popupAlert', { name: 'account', type: 'ledger_support' }).then(() => { - if (this.data.popup) { - setTimeout(() => { - window.close(); - }); - } else { - this.redirectInExtensionAfterAction(); - } - }); + this.$store + .dispatch('modals/open', { + name: 'default', + msg: 'Ledger currently cannot sign this type of transaction! ', + }) + .then(() => { + if (this.data.popup) { + setTimeout(() => { + window.close(); + }); + } else { + this.redirectInExtensionAfterAction(); + } + }); } if (this.data.tx.options && this.data.tx.options.amount) { this.data.tx.amount = this.data.tx.options.amount; @@ -334,7 +386,9 @@ export default { if (this.data.type === 'contractCreate') { this.data.tx.contract = {}; - this.data.tx.contract.bytecode = (await this.sdk.contractCompile(this.data.tx.source)).bytecode; + this.data.tx.contract.bytecode = ( + await this.sdk.contractCompile(this.data.tx.source) + ).bytecode; this.txParams = { ...this.txParams, ownerId: this.account.publicKey, @@ -349,7 +403,11 @@ export default { contractId: this.data.tx.address, callerId: this.account.publicKey, }; - await this.setContractInstance(this.data.tx.source, this.data.tx.address, this.data.tx.options); + await this.setContractInstance( + this.data.tx.source, + this.data.tx.address, + this.data.tx.options, + ); } else if (this.data.type === 'txSign') { let recipientId; if (this.data.tx.recipientId.substring(0, 3) === 'ak_') { @@ -466,9 +524,8 @@ export default { this.loading = false; this.hash = result.hash; this.$store.commit('SET_TX_QUEUE', result.hash); - const txUrl = `${this.network[this.current.network].explorerUrl}/transactions/${result.hash}`; const msg = `You have sent ${this.amount} AE`; - this.$store.dispatch('popupAlert', { name: 'spend', type: 'success_transfer', msg, data: txUrl }).then(async () => { + this.$store.dispatch('modals/open', { name: 'default', msg }).then(async () => { this.$store.commit('SET_AEPP_POPUP', false); this.redirectInExtensionAfterAction(); }); @@ -476,25 +533,31 @@ export default { }) .catch(async () => { this.$store.commit('SET_TX_QUEUE', 'error'); - this.$store.dispatch('popupAlert', { name: 'spend', type: 'transaction_failed' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'transaction-failed' }); this.loading = false; }); }, async signSpendTxLedger(amount) { - const tx = await this.sdk.spendTx({ senderId: this.account.publicKey, recipientId: this.receiver, amount, fee: this.convertSelectedFee }); + const tx = await this.sdk.spendTx({ + senderId: this.account.publicKey, + recipientId: this.receiver, + amount, + fee: this.convertSelectedFee, + }); const sign = await this.$store.dispatch('ledgerSignTransaction', { tx }); this.loading = false; if (sign.success) { - const txUrl = `${this.network[this.current.network].explorerUrl}/transactions/${sign.res.hash}`; const msg = `You have sent ${this.amount} AE`; - this.$store.dispatch('popupAlert', { name: 'spend', type: 'success_transfer', msg, data: txUrl }).then(async () => { + this.$store.dispatch('modals/open', { name: 'default', msg }).then(async () => { this.$store.commit('SET_AEPP_POPUP', false); this.redirectInExtensionAfterAction(); }); } else { - this.$store.dispatch('popupAlert', { name: 'spend', type: 'transaction_failed' }).then(() => { - this.redirectInExtensionAfterAction(); - }); + this.$store + .dispatch('modals/open', { name: 'default', type: 'transaction-failed' }) + .then(() => { + this.redirectInExtensionAfterAction(); + }); } }, async contractCallStatic(tx) { @@ -506,7 +569,11 @@ export default { if (tx.options && tx.options.amount) { options = { ...options, ...tx.options, amount: aeToAettos(this.data.tx.options.amount) }; } - const call = await this.$helpers.contractCall({ instance: this.contractInstance, method: tx.method, params: [...tx.params, options] }); + const call = await this.$helpers.contractCall({ + instance: this.contractInstance, + method: tx.method, + params: [...tx.params, options], + }); const decoded = await call.decode(); call.decoded = decoded; this.sending = true; @@ -534,9 +601,17 @@ export default { options = { ...options, fee: this.convertSelectedFee }; if (!this.contractInstance) { - await this.setContractInstance(this.data.tx.source, this.data.tx.address, this.data.tx.options); + await this.setContractInstance( + this.data.tx.source, + this.data.tx.address, + this.data.tx.options, + ); } - call = await this.$helpers.contractCall({ instance: this.contractInstance, method: this.data.tx.method, params: [...this.data.tx.params, options] }); + call = await this.$helpers.contractCall({ + instance: this.contractInstance, + method: this.data.tx.method, + params: [...this.data.tx.params, options], + }); this.$store.commit('SET_TX_QUEUE', call.hash); const decoded = await call.decode(); @@ -550,7 +625,7 @@ export default { this.$store.commit('SET_TX_QUEUE', 'error'); this.errorTx.error.message = typeof err.message !== 'undefined' ? err.message : err; this.sending = true; - this.$store.dispatch('popupAlert', { name: 'spend', type: 'transaction_failed' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'transaction-failed' }); } this.redirectInExtensionAfterAction(); }, @@ -558,15 +633,24 @@ export default { let deployed; if (this.isLedger) { const { ownerId, amount, gas, code, callData, deposit } = this.txParams; - const { tx } = await this.sdk[TX_TYPES[this.data.type]]({ ownerId, amount, gas, code, callData, deposit }); + const { tx } = await this.sdk[TX_TYPES[this.data.type]]({ + ownerId, + amount, + gas, + code, + callData, + deposit, + }); await this.$store.dispatch('ledgerSignTransaction', { tx }); } else { try { - deployed = await this.contractInstance.deploy([...this.data.tx.init], { fee: this.convertSelectedFee }); + deployed = await this.contractInstance.deploy([...this.data.tx.init], { + fee: this.convertSelectedFee, + }); this.$store.commit('SET_TX_QUEUE', deployed.transaction); } catch (err) { this.$store.commit('SET_TX_QUEUE', 'error'); - this.$store.dispatch('popupAlert', { name: 'spend', type: 'transaction_failed' }); + this.$store.dispatch('modals/open', { name: 'default', type: 'transaction-failed' }); } } @@ -579,8 +663,7 @@ export default { if (deployed) { this.deployed = deployed.address; const msg = `Contract deployed at address
${deployed.address}`; - const noRedirect = this.data.tx.contractType === 'fungibleToken' && this.data.tx.tokenRegistry; - this.$store.dispatch('popupAlert', { name: 'spend', type: 'success_deploy', msg, noRedirect, data: deployed.address }); + this.$store.dispatch('modals/open', { name: 'default', msg }); } if (this.data.tx.contractType !== 'fungibleToken') { this.redirectInExtensionAfterAction(); @@ -606,7 +689,9 @@ export default { }, async namePreclaim() { try { - const preclaim = await this.sdk.aensPreclaim(this.data.tx.name, { fee: this.convertSelectedFee }); + const preclaim = await this.sdk.aensPreclaim(this.data.tx.name, { + fee: this.convertSelectedFee, + }); this.$store.commit('SET_TX_QUEUE', preclaim.hash); const tx = { popup: false, @@ -620,7 +705,7 @@ export default { this.redirectToTxConfirm(tx); } catch (err) { this.$store.commit('SET_TX_QUEUE', 'error'); - this.$store.dispatch('popupAlert', { name: 'spend', type: 'tx_error', msg: err.message }); + this.$store.dispatch('modals/open', { name: 'default', msg: err.message }); this.$store.commit('SET_AEPP_POPUP', false); this.$router.push('/names'); } @@ -631,11 +716,14 @@ export default { await this.sdk.aensBid(this.data.tx.name, this.data.tx.BigNumberAmount); } catch (err) { this.$store.commit('SET_TX_QUEUE', 'error'); - this.$store.dispatch('popupAlert', { name: 'spend', type: 'tx_error', msg: err.message }); + this.$store.dispatch('modals/open', { name: 'default', msg: err.message }); } } else { try { - const claim = await this.data.tx.preclaim.claim({ waitMined: false, fee: this.convertSelectedFee }); + const claim = await this.data.tx.preclaim.claim({ + waitMined: false, + fee: this.convertSelectedFee, + }); this.$store.commit('SET_TX_QUEUE', claim.hash); } catch (err) { let msg = err.message; @@ -643,7 +731,7 @@ export default { msg = this.$t('pages.signTransaction.balanceError'); } this.$store.commit('SET_TX_QUEUE', 'error'); - this.$store.dispatch('popupAlert', { name: 'spend', type: 'tx_error', msg }); + this.$store.dispatch('modals/open', { name: 'default', msg }); } } this.$store.commit('SET_AEPP_POPUP', false); @@ -659,13 +747,10 @@ export default { update = await nameObject.update(this.data.tx.pointers, { extendPointers: true }); } this.$store.commit('SET_TX_QUEUE', update.hash); - await this.$store.dispatch('popupAlert', { - name: 'account', - type: 'added_success', - }); + await this.$store.dispatch('modals/open', { name: 'default', msg: 'Successfully added!' }); } catch (err) { this.$store.commit('SET_TX_QUEUE', 'error'); - this.$store.dispatch('popupAlert', { name: 'spend', type: 'tx_error', msg: err.message }); + this.$store.dispatch('modals/open', { name: 'default', msg: err.message }); } this.$store.commit('SET_AEPP_POPUP', false); this.$router.push('/names'); @@ -692,8 +777,7 @@ export default { }); this.$store.commit('SET_TX_QUEUE', call.hash); const msg = `You have sent ${this.data.tx.amount} ${this.data.tx.token}`; - const txUrl = `${this.network[this.current.network].explorerUrl}/transactions/${call.hash}`; - this.$store.dispatch('popupAlert', { name: 'spend', type: 'success_transfer', msg, data: txUrl }).then(() => { + this.$store.dispatch('modals/open', { name: 'default', msg }).then(() => { this.$store.commit('SET_AEPP_POPUP', false); this.$router.push('/account'); }); @@ -722,7 +806,9 @@ export default { return byteCode; }, async getDeployedByteCode(address) { - const res = await fetch(`https://testnet.mdw.aepps.com/middleware/contracts/transactions/address/${address}`); + const res = await fetch( + `https://testnet.mdw.aepps.com/middleware/contracts/transactions/address/${address}`, + ); const txs = await res.json(); const byteCode = txs.transactions.find(tx => tx.tx.type === 'ContractCreateTx'); return byteCode; diff --git a/src/popup/router/pages/SuccessTip.vue b/src/popup/router/pages/SuccessTip.vue index 4c5a9d29e..d1304abbe 100644 --- a/src/popup/router/pages/SuccessTip.vue +++ b/src/popup/router/pages/SuccessTip.vue @@ -7,19 +7,22 @@

- {{ $t('pages.successTip.successfullySent') }} {{ amountTip }} {{ $t('pages.appVUE.aeid') }} ({{ - getCurrencyAmount - }} - {{ currentCurrency }}) + {{ $t('pages.successTip.successfullySent') }} + {{ amountTip }} {{ $t('pages.appVUE.aeid') }} + + ({{ getCurrencyAmount }} {{ currentCurrency }}) {{ $t('pages.successTip.to') }}

{{ domain }}
- {{ $t('pages.successTip.notify') }} + {{ + $t('pages.successTip.notify') + }}