Skip to content

Commit

Permalink
Fixes, screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
nxmad committed May 12, 2021
1 parent fa3f8bb commit 607dc55
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 73 deletions.
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/liberton.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

Binary file added screenshots/common-interface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/create-account.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/transfer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/logo.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $la-font-path: "/fonts/line-awesome";
"layout/footer";

// Views
@import "views/welcome",
@import "views/create",
"views/home",
"views/receive",
"views/deployment";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
.welcome {
.create {
width: 100%;
flex-direction: column;

&__heading {
margin-top: 0;
font-weight: 500;
}

&__warning {
margin-bottom: 1rem;
border-style: solid;
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
}
},
"home": {
"select_wallet": "Select wallet",
"tabs": {
"messages": "Messages",
"transactions": "Transactions"
Expand Down
15 changes: 8 additions & 7 deletions src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
},
"create": {
"account_name": "Account name",
"words_count": "{n} words",
"phrase": "This is your seed phrase",
"heading": "Don't you have an account yet?",
"phrase_alert": "Warning! Losing or compromising your seed phrase will result in losing access to your account and all your funds",
"account_name": "Название аккаунта",
"words_count": "{n} слов(а)",
"phrase": "Ваша фраза",
"heading": "Создание аккаунта",
"phrase_alert": "Внимание! Утрата или утечка вашей мастер-фразы приведет к потере аккаунта и всех ваших средств",
"buttons": {
"generate": "Generate new",
"restore": "Restore from seed phrase"
"generate": "Сгенерировать еще раз",
"restore": "Восстановить из фразы"
}
},
"receive": {
Expand Down Expand Up @@ -57,6 +57,7 @@
}
},
"home": {
"select_wallet": "Выберите кошелек",
"tabs": {
"messages": "Сообщения",
"transactions": "Транзакции"
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import store from './store'
import App from './App.vue'
import { Quasar } from 'quasar'
import { createApp } from 'vue'
import TonClient from './utils/ton'
import extension from 'extensionizer'
import { router } from './utils/router'
import { Quasar, QSelect, QIcon } from 'quasar'
import iconSet from 'quasar/icon-set/line-awesome'
import { i18n, loadLocaleMessages, setI18nLanguage } from './utils/i18n'

Expand Down
18 changes: 15 additions & 3 deletions src/store/accounts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { v4 } from 'uuid'
import { ton } from '@utils/ton'
import { i18n } from '@utils/i18n'
import { toSHA256 } from '@utils/convert'
import WrongPasswordException from '../utils/exceptions/WrongPasswordException'

export default {
Expand Down Expand Up @@ -35,7 +36,7 @@ export default {
...account.xprv
})

if (!ton.isHex(result.slice(4))) {
if (!ton.isASCII(result)) {
throw new WrongPasswordException()
}

Expand All @@ -44,21 +45,32 @@ export default {
},

actions: {
async create ({ commit, getters, dispatch }, { xprv, name, password }) {
async create ({ commit, getters, dispatch }, { xprv, phrase, name, password }) {
const id = v4()

commit('push', {
id,
data: {
phraseHash: await toSHA256(phrase),
passwordHash: await toSHA256(password),
name: name || i18n.global.t('global.account') + ' #' + (getters.count + 1),
xprv: await ton.encrypt({
password,
data: xprv
}),
phrase: await ton.encrypt({
password,
data: phrase
})
}
})

dispatch('wallets/create', { accountId: id, xprv, password }, { root: true })
commit('select', id)

await dispatch('wallets/create', {
password,
account: id
}, { root: true })
}
}
}
27 changes: 9 additions & 18 deletions src/store/wallets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { v4 } from 'uuid'
import { ton } from '@utils/ton'
import { i18n } from '@utils/i18n'
import { toSHA256 } from '@utils/convert'
import WrongPasswordException from '../utils/exceptions/WrongPasswordException'

export default {
Expand Down Expand Up @@ -61,10 +62,10 @@ export default {
},

actions: {
async create ({ commit, getters, rootState, rootGetters }, { name, password }) {
const accountId = rootState.accounts.selectedId
const index = getters.forAccount(accountId).length
async create ({ commit, getters, rootState, rootGetters }, { name, password, account }) {
const accountId = account || rootState.accounts.selectedId

const index = getters.forAccount(accountId).length
const xprv = await rootGetters['accounts/getPrivateKey']({
password,
id: accountId
Expand All @@ -74,34 +75,24 @@ export default {
xprv, index
})

const id = v4()

commit('push', {
id: v4(),
id,
data: {
index,
accountId,
public: keys.public,
passwordHash: await toSHA256(password),
secret: await ton.encrypt({
password,
data: keys.secret
}),
name: name || i18n.global.t('global.wallet') + ' #' + (index + 1)
}
})
},

async update ({ getters, rootState }, { network = null, account = null, id }) {
const wallet = getters.getWallet({
id,
account: account || getters.current.id
})

const currentNetwork = rootState.settings.network

if (!wallet.networks[currentNetwork]) {
wallet.networks[currentNetwork] = {}
}

Object.assign(wallet.networks[currentNetwork], await ton.accountShort(wallet.data.public))
commit('select', id)
}
}
}
6 changes: 6 additions & 0 deletions src/utils/extension.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import extension from 'extensionizer'

extension.browserAction.onClicked.addListener(function (tab) {
if (extension.extension.getExtensionTabs().length) {
return false
}

extension.tabs.create({
url: extension.extension.getBackgroundPage().location.href,
})
Expand Down
15 changes: 11 additions & 4 deletions src/utils/queries/accountActivity.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
export default `query ($address: String!) {
transactions (filter: {
account_addr: {
eq: $address
transactions (
filter: {
account_addr: {
eq: $address
}
}
}) {
orderBy: [{
path: "lt"
direction: DESC
}]
) {
id
aborted
status
Expand Down
4 changes: 4 additions & 0 deletions src/utils/ton/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export class TonWrapper {
return /[0-9A-Fa-f]{6}/g.test(str)
}

isASCII (str) {
return /^[\x00-\x7F]*$/.test(str)
}

async getDefaultPayload (data) {
if (! data.comment) {
return ''
Expand Down
17 changes: 9 additions & 8 deletions src/views/create-account.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div class="welcome">
<h1 class="heading">{{ $t('create.heading') }}</h1>
<div class="create">
<h5 class="create__heading">{{ $t('create.heading') }}</h5>

<div class="welcome__phrase-container">
<div class="welcome__phrase-header">
<div class="create__phrase-container">
<div class="create__phrase-header">
<q-select dense
filled
emit-value
Expand Down Expand Up @@ -32,17 +32,17 @@
<q-btn color="white" text-color="black" class="on-right" @click="generate">
<q-icon name="las la-redo-alt" class="on-left" /> {{ $t('create.buttons.generate') }}
</q-btn>
<a href="#" class="welcome__generate" @click.prevent="generate">{{ }}</a>
<a href="#" class="create__generate" @click.prevent="generate">{{ }}</a>
</div>

<div class="welcome__phrase" v-if="mode === 'generate'">
<div class="create__phrase" v-if="mode === 'generate'">
{{ createOptions.phrase }}
</div>

<q-input square dense filled v-model="createOptions.phrase" class="q-mb-md" v-else
:label="$t('create.phrase')"></q-input>

<q-banner class="welcome__warning">
<q-banner class="create__warning">
<q-icon name="las la-exclamation-circle" /> {{ $t('create.phrase_alert') }}
</q-banner>

Expand Down Expand Up @@ -131,9 +131,10 @@
xprv,
name: createOptions.name,
password: password.value,
phrase: createOptions.phrase,
})
await r.push('/' + locale)
await r.push('/')
}
/*
Expand Down
2 changes: 1 addition & 1 deletion src/views/home.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="home__default-message" v-if="! wallet.id">
{{ $t('home.you_need_to_select_wallet') }}
{{ $t('home.select_wallet') }}
</div>

<template v-else-if="deployment">
Expand Down

0 comments on commit 607dc55

Please sign in to comment.