Skip to content

Commit 315be98

Browse files
committed
Update jsdoc
1 parent dca847f commit 315be98

File tree

6 files changed

+96
-6
lines changed

6 files changed

+96
-6
lines changed

src/App.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
</template>
66

77
<script>
8+
/**
9+
* Entry point to the application
10+
*/
811
export default {
9-
name: 'vdexnode-gui'
12+
name: 'App'
1013
}
1114
</script>
1215

src/components/GeoWidget.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ import * as d3 from 'd3'
1414
const topojson = require('topojson')
1515
var countries = require('../assets/geoWidgetData/countries.geo.json')
1616
var initialNodeList = require('../assets/geoWidgetData/initial_node_list.json')
17+
/**
18+
* Map widget component
19+
* @vue-prop {Array} geoData
20+
* @vue-data {Object} nodeGeoData - Store the node locations
21+
* @vue-event {} load - Init loading the widget
22+
* @vue-event {} getNodeGeoData - Get the initial node locations and fill the data object
23+
* @vue-event {} mapLoad - Load and display the map with node locations data on it
24+
*
25+
* @example
26+
* import GeoWidget from '../components/GeoWidget.vue'
27+
* <GeoWidget :geoData="geoData"/>
28+
*/
1729
1830
export default {
1931
name: 'GeoWidget',

src/pages/Error404.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
</template>
1717

1818
<script>
19+
/**
20+
* Error handler
21+
*/
1922
export default {
2023
name: 'Error404'
2124
}

src/pages/Index.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,30 @@ import * as utils from '@/util/utils.js'
338338
const { app, dialog } = require('electron').remote
339339
const fs = require('fs')
340340
341+
/**
342+
* Main page. Loads other components
343+
* @vue-data {*} identity - Set of variables for storing user identification information
344+
*
345+
* @vue-event {} refresher
346+
* @vue-event {} identify
347+
* @vue-event {} getUptime
348+
* @vue-event {} getVoted
349+
* @vue-event {} getRank
350+
* @vue-event {} getBalance
351+
* @vue-event {} updatePrivate
352+
* @vue-event {} showPrivate
353+
* @vue-event {} refresh
354+
* @vue-event {} getInstaller
355+
* @vue-event {} forceFileDownload
356+
* @vue-event {} addNode
357+
* @vue-event {} registerNode
358+
* @vue-event {} getAccountName
359+
* @vue-event {} getNodes
360+
* @vue-event {} getListOfNodes
361+
* @vue-event {} addToVote
362+
* @vue-event {} vote
363+
* @vue-event {} retreiveReward
364+
*/
341365
export default {
342366
name: 'index',
343367
components: {

src/util/EosWrapper.js

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig'
33
import ecc from 'eosjs-ecc'
44
const { TextEncoder, TextDecoder } = require('util')
55
const fetch = require('node-fetch')
6-
6+
/**
7+
* Wrapper on eosjs library for interacting with EOS blockchain
8+
*
9+
* @class EosWrapper
10+
*/
711
class EosWrapper {
12+
/**
13+
* Creates an instance of EosWrapper.
14+
* @param {String} keyProvider Private key
15+
* @memberof EosWrapper
16+
*/
817
constructor (keyProvider) {
918
this.rpc = new JsonRpc(process.env.EOS_ENDPOINT, { fetch })
1019
const rpc = this.rpc
@@ -13,22 +22,49 @@ class EosWrapper {
1322
this.api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() })
1423
}
1524
}
16-
25+
/**
26+
* Get public key from private
27+
*
28+
* @param {String} wif Private key
29+
* @returns {String} Public key
30+
* @memberof EosWrapper
31+
*/
1732
privateToPublic (wif) {
1833
let pubKey = ecc.privateToPublic(wif)
1934
return pubKey
2035
}
21-
36+
/**
37+
* Get accounts assigned to a public key
38+
*
39+
* @param {String} wif Public key
40+
* @returns {Array} Array with accounts
41+
* @memberof EosWrapper
42+
*/
2243
async getAccounts (wif) {
2344
let accounts = await this.rpc.history_get_key_accounts(wif)
2445
return accounts
2546
}
26-
47+
/**
48+
* Get balance for an account
49+
*
50+
* @param {String} name Account name
51+
* @returns {Array} Array with balance
52+
* @memberof EosWrapper
53+
*/
2754
async getBalance (name) {
2855
let balance = await this.rpc.get_currency_balance('volentixgsys', name, 'VTX')
2956
return balance
3057
}
31-
58+
/**
59+
* Get contract table
60+
*
61+
* @param {String} code
62+
* @param {String} scope
63+
* @param {String} table Table name
64+
*
65+
* @returns {Array} Array of rows
66+
* @memberof EosWrapper
67+
*/
3268
async getTable (code, scope, table) {
3369
const resp = await this.rpc.get_table_rows({ code: code, scope: scope, table: table, json: true, limit: 999999999999 })
3470
return resp.rows

src/util/utils.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
* Function returns an array with removed duplicates by any field in the object
3+
* @param {Array} arr - Array of objects to work with.
4+
* @param {string} comp - Field to check.
5+
*
6+
* @return {Array} Array of objects with uremoved duplicates
7+
*
8+
* @example
9+
*
10+
* var unique = getUnique([{'key':1}, {'key':2}, {'key':3}, {'key':3}, {'key':3}], 'key')
11+
* unique = [{'key':1}, {'key':2}, {'key':3}]
12+
*/
113
function getUnique (arr, comp) {
214
const unique = arr.map(e => e[comp])
315
// store the keys of the unique objects

0 commit comments

Comments
 (0)