Skip to content

Commit

Permalink
Merge pull request #231 from MickWang/master
Browse files Browse the repository at this point in the history
update version; update to support ontid 2.0 api;move Identity feature to Dapps module
  • Loading branch information
MickWang committed Jun 10, 2020
2 parents 1d9829e + 6b7bbd4 commit 47dddc9
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 30 deletions.
3 changes: 1 addition & 2 deletions .vscode/settings.json
Expand Up @@ -5,7 +5,6 @@
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext",
"javascript"
"plaintext"
]
}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@


<h1 align="center">OWallet - a comprehensive Ontology desktop wallet</h1>
<h4 align="center">Version 0.9.18</h4>
<h4 align="center">Version 0.9.22</h4>

## Introduction

Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Expand Up @@ -3,7 +3,7 @@


<h1 align="center">OWallet - 本体综合性桌面版钱包 </h1>
<h4 align="center">Version 0.9.18</h4>
<h4 align="center">Version 0.9.22</h4>

## 总体介绍

Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "owallet",
"productName": "OWallet",
"homepage": "http://ont.io",
"version": "v0.9.21",
"version": "v0.9.22",
"author": "Ontology Foundation Ltd. <devops@ont.io>",
"description": "OWallet is a comprehensive Ontology desktop wallet",
"license": "Apache-2.0",
Expand Down Expand Up @@ -101,7 +101,7 @@
"node-hid": "^0.7.7",
"node-sass": "^4.13.0",
"numeral": "^2.0.6",
"ontology-ts-sdk": "^1.1.0",
"ontology-ts-sdk": "^1.1.2",
"opn": "^5.4.0",
"popper.js": "^1.14.3",
"sass": "^1.24.4",
Expand Down
3 changes: 2 additions & 1 deletion src/common/lang/en.js
Expand Up @@ -698,7 +698,8 @@ Within their 50% share each consensus node will receive their share according to
sesameSeed: 'Sesameseed',
sesameseedDesc: 'Sesameseed voting management',
notification: 'Notification',
userPolicy: 'You will be redirected to the third party dApp. Use of the third party dApp will be subject to their User Agreement and Privacy Policy. You will be liable to the third party dApp only.'
userPolicy: 'You will be redirected to the third party dApp. Use of the third party dApp will be subject to their User Agreement and Privacy Policy. You will be liable to the third party dApp only.',
ontidMgmt: 'ONT ID management. This feature will be removed in the future. Please backup ONT ID related data'
},
sesameseed: {
stakeAmountTip: 'Stake amount for Sesameseed is 1 unit equals 1 ONT',
Expand Down
3 changes: 2 additions & 1 deletion src/common/lang/zh.js
Expand Up @@ -693,7 +693,8 @@ export default {
sesameSeed: '芝麻籽',
sesameseedDesc: 'Sesameseed voting management',
notification: '注意',
userPolicy: '您将跳转至第三方dApp页面,在第三方dApp上的使用行为将适用该第三方dApp的《用户协议》和《隐私政策》,由该第三方dApp直接并单独向您承担责任'
userPolicy: '您将跳转至第三方dApp页面,在第三方dApp上的使用行为将适用该第三方dApp的《用户协议》和《隐私政策》,由该第三方dApp直接并单独向您承担责任',
ontidMgmt: '管理ONT ID。该功能以后会被移除。请备份ONT ID相关数据。'
},
sesameseed: {
stakeAmountTip: 'Stake amount for Sesameseed is 1 unit equals 1 ONT',
Expand Down
14 changes: 14 additions & 0 deletions src/renderer/assets/ontid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/renderer/components/Dapps.vue
Expand Up @@ -79,6 +79,18 @@
<p class="dapp-content">{{$t('dapps.sesameseedDesc')}}</p>
</div>
</a-col>
<a-col :md="8" :lg="8" :xl="6">
<div
class="dapp-item"
@click="handleOntidMgmt"
>
<div class="dapp-title">
<img :src="require('../assets/ontid.svg')" alt />
<span>ONT ID</span>
</div>
<p class="dapp-content">{{$t('dapps.ontidMgmt')}}</p>
</div>
</a-col>
</a-row>
</div>
</template>
Expand Down Expand Up @@ -141,6 +153,9 @@ export default {
handleDappSesameseed() {
this.$router.push({name: 'AuthorizeLoginSesameseed'});
},
handleOntidMgmt() {
this.$router.push({name:'Identitys'})
},
formatPrice(value) {
if (isNumber(value)) {
let val = (value / 1)
Expand Down
47 changes: 31 additions & 16 deletions src/renderer/components/Identitys/Import/BasicInfo.vue
Expand Up @@ -40,7 +40,7 @@
import dbService from '../../../../core/dbService'
import {DEFAULT_SCRYPT, TEST_NET, MAIN_NET} from '../../../../core/consts'
import $ from 'jquery'
import { getRestClient, formatScryptParams } from '../../../../core/utils';
import { getRestClient, formatScryptParams, getNodeUrl } from '../../../../core/utils';
export default {
name: 'BasicInfo',
Expand Down Expand Up @@ -78,7 +78,7 @@ import { getRestClient, formatScryptParams } from '../../../../core/utils';
return true;
}
},
importIdentityForKeystore() {
async importIdentityForKeystore() {
// TODO 需要填充的逻辑部分
console.log('keystore:[' + this.keystore + ']; keystorePassword:[' + this.keystorePassword + ']')
//import identity
Expand All @@ -97,7 +97,7 @@ import { getRestClient, formatScryptParams } from '../../../../core/utils';
}
let identity = new Identity();
try {
debugger
const encryptedPrivateKeyObj = new Crypto.PrivateKey(keystore.key);
const addr = new Crypto.Address(keystore.address);
const label = keystore.label || 'Identity'
Expand All @@ -114,20 +114,35 @@ import { getRestClient, formatScryptParams } from '../../../../core/utils';
this.$store.dispatch('hideLoadingModals')
return;
}
const tx = OntidContract.buildGetDDOTx(identity.ontid)
const restClient = getRestClient()
restClient.sendRawTransaction(tx.serialize(), true).then(res => {
if(res.Result) {
let document
const restUrl = getNodeUrl();
try {
document = await OntidContract.getDocumentJson(identity.ontid, restUrl);
} catch (err) {
// tslint:disable-next-line:no-console
console.log(err);
}
let idOnchain;
if (document && document.publicKey) {
idOnchain = document.publicKey.find(item => item.id.split('#')[0] === identity.ontid)
}
if (idOnchain) {
this.saveToDb(identity)
} else {
this.$message.error(this.$t('importIdentity.ontidNotExist'))
this.$store.dispatch('hideLoadingModals')
return;
}
}).catch(err => {
console.log(err)
this.$message.error(this.$t('common.networkError'))
})
} else {
const tx = OntidContract.buildGetDDOTx(identity.ontid)
const restClient = getRestClient()
const res = await restClient.sendRawTransaction(tx.serialize(), true)
if(res.Result.Result) {
this.saveToDb(identity)
} else {
this.$message.error(this.$t('importIdentity.ontidNotExist'))
this.$store.dispatch('hideLoadingModals')
return;
}
}
},
saveToDb(identity) {
const that = this;
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/TopLeftNav.vue
Expand Up @@ -11,11 +11,11 @@
</a-tooltip>
</router-link>

<router-link :to="{name:'Identitys'}" active-class="nav-accounts-active">
<!-- <router-link :to="{name:'Identitys'}" active-class="nav-accounts-active">
<a-tooltip placement="right" :title="$t('setting.ontid')">
<div class="nav-accounts"></div>
</a-tooltip>
</router-link>
</router-link> -->

<router-link :to="{name:'Setting'}" active-class="nav-setting-active">
<a-tooltip placement="right" :title="$t('setting.settings')">
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -6202,10 +6202,10 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"

ontology-ts-sdk@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ontology-ts-sdk/-/ontology-ts-sdk-1.1.0.tgz#7156220ec723c8ad23f3ae2f5c92374b2a9da55c"
integrity sha512-DaJBG2Ugi83TbWfaWY75ijoKuBQ6+7QAveVMfuY0UxrrzxWw9hXqK7UayvGugIfkRWivWr0dyvpHAkL605e6HQ==
ontology-ts-sdk@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/ontology-ts-sdk/-/ontology-ts-sdk-1.1.2.tgz#de95243212f733b0b5d4350fb1849ebb0987163d"
integrity sha512-LkA+qyzNXIiJ4r+32McyXCKilVnCBiZr/vY4tkSJ+iE7ySRdxPPhO8t+y12z6g9EY3b66UebmbwcEH46nbhV/w==
dependencies:
"@ont-community/hdkey-secp256r1" "^1.0.1"
"@ont-community/html5-websocket" "^2.0.2"
Expand Down

0 comments on commit 47dddc9

Please sign in to comment.