Skip to content

Commit 0a6a028

Browse files
committed
Make EosWrapper global.
1 parent b0a9ef7 commit 0a6a028

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

quasar.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = function (ctx) {
77
boot: [
88
'i18n',
99
'axios',
10-
'utils'
10+
'utils',
11+
'eos'
1112
],
1213

1314
css: [

src/boot/eos.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import EosWrapper from '@/util/EosWrapper'
2+
3+
export default ({ Vue }) => {
4+
Vue.prototype.$EosWrapper = EosWrapper
5+
}

src/pages/Index.vue

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@
376376

377377
<script>
378378
import GeoWidget from '../components/GeoWidget.vue'
379-
import EosWrapper from '@/util/EosWrapper'
380379
const { app, dialog } = require('electron').remote
381380
const fs = require('fs')
382381
@@ -466,7 +465,7 @@ export default {
466465
const accountName = this.identity.account_name
467466
if (accountName.length > 0) {
468467
try {
469-
const eos = new EosWrapper()
468+
const eos = new this.$EosWrapper()
470469
const result = await eos.getTable('vtxdistribut', 'vtxdistribut', 'vdexnodes')
471470
472471
let nodeStats = result.find(row => row.account === accountName)
@@ -489,7 +488,7 @@ export default {
489488
const accountName = this.identity.account_name
490489
if (accountName.length > 0) {
491490
try {
492-
const eos = new EosWrapper()
491+
const eos = new this.$EosWrapper()
493492
const result = await eos.getTable('vdexdposvote', 'vdexdposvote', 'producers')
494493
let nodeStats = result.find(row => row.owner === accountName)
495494
if (nodeStats) {
@@ -511,7 +510,7 @@ export default {
511510
const accountName = this.identity.account_name
512511
if (accountName.length > 0) {
513512
try {
514-
const eos = new EosWrapper()
513+
const eos = new this.$EosWrapper()
515514
const result = await eos.getTable('vtxdistribut', 'vtxdistribut', 'uptimes')
516515
517516
let nodeStats = result.find(row => row.account === accountName)
@@ -532,7 +531,7 @@ export default {
532531
},
533532
async getRegisteredNodes () {
534533
try {
535-
const eos = new EosWrapper()
534+
const eos = new this.$EosWrapper()
536535
const result = await eos.getTable('vdexdposvote', 'vdexdposvote', 'producers')
537536
this.registered_nodes = result.length
538537
this.registered_nodes_names = []
@@ -552,7 +551,7 @@ export default {
552551
}
553552
},
554553
async identify (key) {
555-
const eos = new EosWrapper()
554+
const eos = new this.$EosWrapper()
556555
try {
557556
let accounts = await eos.getAccounts(key)
558557
this.identity.account_name = accounts.account_names[0] ? accounts.account_names[0] : ''
@@ -577,7 +576,7 @@ export default {
577576
const accountName = this.identity.account_name
578577
if (accountName.length > 0) {
579578
try {
580-
const eos = new EosWrapper()
579+
const eos = new this.$EosWrapper()
581580
const result = await eos.getTable('vtxdistribut', 'vtxdistribut', 'uptimes')
582581
583582
let nodeStats = result.find(row => row.account === accountName)
@@ -601,7 +600,7 @@ export default {
601600
const accountName = this.identity.account_name
602601
if (accountName.length > 0) {
603602
try {
604-
const eos = new EosWrapper()
603+
const eos = new this.$EosWrapper()
605604
const result = await eos.getTable('vdexdposvote', 'vdexdposvote', 'voters')
606605
607606
let nodeStats = result.find(row => row.owner === accountName)
@@ -628,7 +627,7 @@ export default {
628627
const accountName = this.identity.account_name
629628
if (accountName.length > 0) {
630629
try {
631-
const eos = new EosWrapper()
630+
const eos = new this.$EosWrapper()
632631
const result = await eos.getTable('vdexdposvote', 'vdexdposvote', 'producers')
633632
634633
let voteStats = result.find(row => row.owner === accountName)
@@ -660,7 +659,7 @@ export default {
660659
const accountName = this.identity.account_name
661660
if (accountName.length > 0) {
662661
try {
663-
const eos = new EosWrapper()
662+
const eos = new this.$EosWrapper()
664663
let balance = await eos.getBalance(accountName)
665664
this.identity.balance = balance[0] ? balance[0] : '0 VTX'
666665
} catch (error) {
@@ -674,7 +673,7 @@ export default {
674673
},
675674
updatePrivate () {
676675
this.privateDialog = false
677-
const eos = new EosWrapper()
676+
const eos = new this.$EosWrapper()
678677
try {
679678
let publicKey = eos.privateToPublic(this.identity.private_key)
680679
this.identity.public_key = publicKey
@@ -735,7 +734,7 @@ export default {
735734
},
736735
async addNode () {
737736
try {
738-
const eos = new EosWrapper(this.identity.private_key)
737+
const eos = new this.$EosWrapper(this.identity.private_key)
739738
const result = await eos.api.transact({
740739
actions: [{
741740
account: 'vtxdistribut',
@@ -762,7 +761,7 @@ export default {
762761
},
763762
async registerNode () {
764763
try {
765-
const eos = new EosWrapper(this.identity.private_key)
764+
const eos = new this.$EosWrapper(this.identity.private_key)
766765
const result = await eos.api.transact({
767766
actions: [{
768767
account: 'vdexdposvote',
@@ -793,7 +792,7 @@ export default {
793792
},
794793
async getListOfNodes () {
795794
await this.getNodes()
796-
const eos = new EosWrapper()
795+
const eos = new this.$EosWrapper()
797796
this.running_nodes = this.nodes.length
798797
this.getRegisteredNodes()
799798
for (var id in this.nodes) {
@@ -855,7 +854,7 @@ export default {
855854
nodesToVote.push(this.voting_list[i].account)
856855
}
857856
try {
858-
const eos = new EosWrapper(this.identity.private_key)
857+
const eos = new this.$EosWrapper(this.identity.private_key)
859858
const result = await eos.api.transact({
860859
actions: [{
861860
account: 'vdexdposvote',
@@ -885,7 +884,7 @@ export default {
885884
},
886885
async retreiveReward () {
887886
try {
888-
const eos = new EosWrapper(this.identity.private_key)
887+
const eos = new this.$EosWrapper(this.identity.private_key)
889888
const result = await eos.api.transact({
890889
actions: [{
891890
account: 'vtxdistribut',

0 commit comments

Comments
 (0)