diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz new file mode 100644 index 00000000..0b95070f Binary files /dev/null and b/.yarn/install-state.gz differ diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 00000000..3186f3f0 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/src/components/Common/SignSendTx.vue b/src/components/Common/SignSendTx.vue index d1b95e05..1b580092 100644 --- a/src/components/Common/SignSendTx.vue +++ b/src/components/Common/SignSendTx.vue @@ -24,7 +24,7 @@ import {mapState} from 'vuex' import delay from 'delay' import {DEFAULT_SCRYPT} from '../../core/consts' -import { getRestClient } from '../../core/utils' +import { getRestClient, encryptedPrivateKeyFromAccount } from '../../core/utils' import {legacySignWithLedger, checkPublicKeyIsInTheConnectedLedger} from '../../core/ontLedger' import {Crypto, TransactionBuilder, TxSignature, utils, RestClient, WebsocketClient, Transaction, OntAssetTxBuilder} from 'ontology-ts-sdk' // common component to sign tx or messages with wallet or ledger. @@ -93,7 +93,7 @@ export default { } if (this.wallet.key) { this.$store.dispatch("showLoadingModals"); - const enc = new Crypto.PrivateKey(this.wallet.key); + const enc = encryptedPrivateKeyFromAccount(this.wallet); let pri; try { pri = enc.decrypt( diff --git a/src/components/CommonWallet/CommonRedeem.vue b/src/components/CommonWallet/CommonRedeem.vue index 44619609..457aea46 100644 --- a/src/components/CommonWallet/CommonRedeem.vue +++ b/src/components/CommonWallet/CommonRedeem.vue @@ -61,7 +61,7 @@ import { TEST_NET, MAIN_NET, ONT_CONTRACT, ONT_PASS_NODE, DEFAULT_SCRYPT, GAS_PR import {mapState} from 'vuex' import {getDeviceInfo, getPublicKey, checkPublicKeyIsInTheConnectedLedger} from '../../core/ontLedger' import {BigNumber} from 'bignumber.js' -import { getRestClient } from '../../core/utils' +import { getRestClient, encryptedPrivateKeyFromAccount } from '../../core/utils' export default { name: 'CommonRedeem', components: { @@ -183,7 +183,7 @@ export default { const tx = OntAssetTxBuilder.makeWithdrawOngTx(from, to, amount, from, GAS_PRICE, GAS_LIMIT); if(this.type === 'commonWallet') { this.$store.dispatch('showLoadingModals') - const enc = new Crypto.PrivateKey(this.currentWallet.key) + const enc = encryptedPrivateKeyFromAccount(this.currentWallet) let pri; try { pri = enc.decrypt(this.password, from, this.currentWallet.salt, DEFAULT_SCRYPT) diff --git a/src/components/CommonWallet/SendConfirm.vue b/src/components/CommonWallet/SendConfirm.vue index 803bb91b..7fc5f2bd 100644 --- a/src/components/CommonWallet/SendConfirm.vue +++ b/src/components/CommonWallet/SendConfirm.vue @@ -197,7 +197,7 @@ import axios from 'axios'; import {getDeviceInfo, getPublicKey, checkPublicKeyIsInTheConnectedLedger} from '../../core/ontLedger' // import $ from 'jquery' import {BigNumber} from 'bignumber.js' -import { getRestClient } from '../../core/utils' +import { getRestClient, encryptedPrivateKeyFromAccount } from '../../core/utils' export default { name: 'SendConfirm', @@ -335,7 +335,7 @@ export default { if (this.isCommonWallet) { this.$store.dispatch('showLoadingModals') - const enc = new Crypto.PrivateKey(this.currentWallet.key) + const enc = encryptedPrivateKeyFromAccount(this.currentWallet) let pri; try { pri = enc.decrypt(this.password, new Crypto.Address(this.currentWallet.address), this.currentWallet.salt, DEFAULT_SCRYPT) diff --git a/src/components/Identitys/Create/BasicInfo.vue b/src/components/Identitys/Create/BasicInfo.vue index b8431f91..f0a06c82 100644 --- a/src/components/Identitys/Create/BasicInfo.vue +++ b/src/components/Identitys/Create/BasicInfo.vue @@ -61,7 +61,7 @@ import dbService from '../../../core/dbService' import {DEFAULT_SCRYPT, TEST_NET, MAIN_NET} from '../../../core/consts' import {legacySignWithLedger} from '../../../core/ontLedger' -import { getRestClient } from '../../../core/utils' +import { getRestClient, encryptedPrivateKeyFromAccount } from '../../../core/utils' export default { name: 'BasicInfo', @@ -139,7 +139,7 @@ import { getRestClient } from '../../../core/utils' // const tx = Object.assign({}, res); this.$store.dispatch('showLoadingModals') if(this.payerWalletType === 'commonWallet') { - const enc = new Crypto.PrivateKey(this.payerWallet.key) + const enc = encryptedPrivateKeyFromAccount(this.payerWallet) let pri; try { pri = enc.decrypt(this.payerPassword, new Crypto.Address(this.payerWallet.address), this.payerWallet.salt, DEFAULT_SCRYPT) diff --git a/src/components/Identitys/IdentityView.vue b/src/components/Identitys/IdentityView.vue index 29a99d20..a21cf3e2 100644 --- a/src/components/Identitys/IdentityView.vue +++ b/src/components/Identitys/IdentityView.vue @@ -60,7 +60,7 @@