Skip to content

Commit

Permalink
Merge pull request #200 from MickWang/master
Browse files Browse the repository at this point in the history
update "my stake" list api
  • Loading branch information
MickWang authored Sep 17, 2019
2 parents 3da4bf5 + db769ca commit 2939134
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "owallet",
"productName": "OWallet",
"homepage": "http://ont.io",
"version": "v0.9.16",
"version": "v0.9.17",
"author": "Ontology Foundation Ltd. <[email protected]>",
"description": "OWallet is a comprehensive Ontology desktop wallet",
"license": "Apache-2.0",
Expand Down
4 changes: 4 additions & 0 deletions src/core/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export const SWAP_ADDRESS = 'AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM'

export const NODE_DETAIL = 'https://explorer.ont.io/nodes/detail/'
export const NODE_NAME_LIST = 'https://ont.io/api/v1/candidate/info/All'
export const OFF_CHAIN_NODES = {
TEST_NET: 'https://polarisexplorer.ont.io/v2/nodes/off-chain-infos',
MAIN_NET: 'https://explorer.ont.io/v2/nodes/off-chain-infos'
}

export const PAX_API = {
Host: 'http://18.138.83.180:20800',
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Node/NodeAuthorize/NodeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</a-tooltip>
{{text}}
</a>
<div slot="action" slot-scope="text, record" class="detail-link" v-if="record.maxAuthorize>0">
<div slot="action" slot-scope="text, record" class="detail-link" v-if="record.maxAuthorize>0 && record.process !== '100.00%'">
<a-icon type="arrow-right" @click="handleAuthorizeLogin(record)" v-if="record.maxAuthorize>0"/>
</div>

Expand Down
13 changes: 7 additions & 6 deletions src/renderer/store/modules/NodeAuthorization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getNodeUrl} from '../../../core/utils'
import {NODE_DETAIL, NODE_NAME_LIST} from '../../../core/consts'
import {NODE_DETAIL, NODE_NAME_LIST, OFF_CHAIN_NODES} from '../../../core/consts'
import numeral from 'numeral'
import { Crypto, RestClient, utils, GovernanceTxBuilder} from 'ontology-ts-sdk'
import {BigNumber} from 'bignumber.js'
Expand Down Expand Up @@ -245,13 +245,14 @@ const actions = {
async searchStakeHistory({commit, dispatch, state}, {address}) {
const url = getNodeUrl();
const list = []
if (state.sortedNodeList.length === 0) {
await dispatch('fetchAllSortedNodeList')
}
const net = localStorage.getItem('net')
const off_chain_nodes_url = OFF_CHAIN_NODES[net];
const userAddr = new Crypto.Address(address);
try {
const infoTemp = await Promise.all(state.sortedNodeList.map(item => {
return GovernanceTxBuilder.getAuthorizeInfo(item.peerPubkey, userAddr, url)
const res = await axios.get(off_chain_nodes_url);
const nodes = res.data.result.filter(node => node.public_key.indexOf('00aaaaaaaaa') < 0); //00aaaaaaaaa开头是无效的公钥
const infoTemp = await Promise.all(nodes.map(item => {
return GovernanceTxBuilder.getAuthorizeInfo(item.public_key, userAddr, url)
}))
console.log(infoTemp)
infoTemp.forEach(item => {
Expand Down

0 comments on commit 2939134

Please sign in to comment.