diff --git a/src/common/lang/en.js b/src/common/lang/en.js index 3aa2754..e824a02 100644 --- a/src/common/lang/en.js +++ b/src/common/lang/en.js @@ -639,9 +639,16 @@ Within their 50% share each consensus node will receive their share according to loading: 'Loading latest pricing information, please wait..' }, dapps: { - dapps: 'DApps', - sesameSeed: 'Sesame Seed', - 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.' + dapps: 'DApps', + 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.' + }, + sesameseed: { + stakeAmountTip: 'Stake amount for Sesameseed is 1 unit equals 1 ONT', + authorizeTip: 'If a new stake is canceled, it will add to the “canceled” ONT and be directly deposited in the users account within 24 hours. If authorized ONT from a previous consensus round is canceled it will be added to the “canceled” ONT and be directly deposited in the originating users account within 24 hours of the beginning of the next consensus round if Sesameseed is a candidate node (or one round later if Sesameseed is a consensus node). If a user has both authorized ONT from this consensus round and a previous round and cancels an ONT amount exceeding the amount from this round, they will receive authorized ONT from this consensus round first and the remaining authorized ONT in the next round.', + rewardTip: 'Sesameseed rewards Ontology Stake Authorizations in SEED for both foundation rewards created as a candidate or consensus node as an OEP-4 token “SEED”. This token is rewarded directly to Staking participants. In addition to node rewards, 100% of ONG unbound while staking is pooled by all stake authorizations and added to the total “Node Reward”, as a result this node reward is also provided in the form of “SEED” Token. Rewards are distributed daily without the need to redeem. Find out more at https://sesameseed.org.', + pendingWithdrawals: 'Pending canceled stake authorization' } } diff --git a/src/common/lang/zh.js b/src/common/lang/zh.js index 8314353..a65deda 100644 --- a/src/common/lang/zh.js +++ b/src/common/lang/zh.js @@ -634,9 +634,16 @@ export default { loading: 'Loading latest pricing information, please wait..' }, dapps: { - dapps: 'DApps', - sesameSeed: '芝麻籽', - notification: '注意', - userPolicy: '您将跳转至第三方dApp页面,在第三方dApp上的使用行为将适用该第三方dApp的《用户协议》和《隐私政策》,由该第三方dApp直接并单独向您承担责任' + dapps: 'DApps', + sesameSeed: '芝麻籽', + sesameseedDesc: 'Sesameseed voting management', + notification: '注意', + userPolicy: '您将跳转至第三方dApp页面,在第三方dApp上的使用行为将适用该第三方dApp的《用户协议》和《隐私政策》,由该第三方dApp直接并单独向您承担责任' + }, + sesameseed: { + stakeAmountTip: 'Stake amount for Sesameseed is 1 unit equals 1 ONT', + authorizeTip: 'If a new stake is canceled, it will add to the “canceled” ONT and be directly deposited in the users account within 24 hours. If authorized ONT from a previous consensus round is canceled it will be added to the “canceled” ONT and be directly deposited in the originating users account within 24 hours of the beginning of the next consensus round if Sesameseed is a candidate node (or one round later if Sesameseed is a consensus node). If a user has both authorized ONT from this consensus round and a previous round and cancels an ONT amount exceeding the amount from this round, they will receive authorized ONT from this consensus round first and the remaining authorized ONT in the next round.', + rewardTip: 'Sesameseed rewards Ontology Stake Authorizations in SEED for both foundation rewards created as a candidate or consensus node as an OEP-4 token “SEED”. This token is rewarded directly to Staking participants. In addition to node rewards, 100% of ONG unbound while staking is pooled by all stake authorizations and added to the total “Node Reward”, as a result this node reward is also provided in the form of “SEED” Token. Rewards are distributed daily without the need to redeem. Find out more at https://sesameseed.org.', + pendingWithdrawals: 'Pending canceled stake authorization' } } diff --git a/src/renderer/assets/sesameseed.png b/src/renderer/assets/sesameseed.png new file mode 100644 index 0000000..197d937 Binary files /dev/null and b/src/renderer/assets/sesameseed.png differ diff --git a/src/renderer/components/Dapps.vue b/src/renderer/components/Dapps.vue index 8e11d89..712728e 100644 --- a/src/renderer/components/Dapps.vue +++ b/src/renderer/components/Dapps.vue @@ -68,12 +68,15 @@ -
+
- + {{$t('dapps.sesameSeed')}}
-

{{$t('dapps.sesameSeed')}}

+

{{$t('dapps.sesameseedDesc')}}

@@ -135,6 +138,9 @@ export default { const cryptonexURL = "https://wallet.cryptonex.org/member/sign-in"; open(cryptonexURL); }, + handleDappSesameseed() { + this.$router.push({name: 'AuthorizeLoginSesameseed'}); + }, formatPrice(value) { if (isNumber(value)) { let val = (value / 1) diff --git a/src/renderer/components/Node/NodeAuthorize/Sesameseed/AuthorizationMgmtSesameseed.vue b/src/renderer/components/Node/NodeAuthorize/Sesameseed/AuthorizationMgmtSesameseed.vue new file mode 100644 index 0000000..3ba7d80 --- /dev/null +++ b/src/renderer/components/Node/NodeAuthorize/Sesameseed/AuthorizationMgmtSesameseed.vue @@ -0,0 +1,341 @@ + + + diff --git a/src/renderer/components/Node/NodeAuthorize/Sesameseed/AuthorizeLoginSesameseed.vue b/src/renderer/components/Node/NodeAuthorize/Sesameseed/AuthorizeLoginSesameseed.vue new file mode 100644 index 0000000..e99d087 --- /dev/null +++ b/src/renderer/components/Node/NodeAuthorize/Sesameseed/AuthorizeLoginSesameseed.vue @@ -0,0 +1,150 @@ + + + diff --git a/src/renderer/components/Node/NodeAuthorize/Sesameseed/NewAuthorizationSesameseed.vue b/src/renderer/components/Node/NodeAuthorize/Sesameseed/NewAuthorizationSesameseed.vue new file mode 100644 index 0000000..f9906e2 --- /dev/null +++ b/src/renderer/components/Node/NodeAuthorize/Sesameseed/NewAuthorizationSesameseed.vue @@ -0,0 +1,193 @@ + + + + diff --git a/src/renderer/components/Node/NodeAuthorize/Sesameseed/SesameseedVars.js b/src/renderer/components/Node/NodeAuthorize/Sesameseed/SesameseedVars.js new file mode 100644 index 0000000..e57b11b --- /dev/null +++ b/src/renderer/components/Node/NodeAuthorize/Sesameseed/SesameseedVars.js @@ -0,0 +1,2 @@ +export const CONTRACT_HASH = 'a63c33d2209854feafbf40685a33d4846ee82556' +export const SESAMESEED_NODE_ADDRESS = 'ANRRE8xKwKzuaCeAjP6eZYDnVi7n2x6byE' diff --git a/src/renderer/router/index.js b/src/renderer/router/index.js index 531d5ff..e3b0405 100644 --- a/src/renderer/router/index.js +++ b/src/renderer/router/index.js @@ -31,7 +31,7 @@ export default new Router({ component: require('@/components/Setting').default }, { - path: '/dapps', + path: '/dapps', name: 'Dapps', component: require('@/components/Dapps').default }, @@ -190,16 +190,31 @@ export default new Router({ name: 'AuthorizeLogin', component: require('@/components/Node/NodeAuthorize/AuthorizeLogin').default }, + { + path: '/node/authorizeLoginSesameseed', + name: 'AuthorizeLoginSesameseed', + component: require('@/components/Node/NodeAuthorize/Sesameseed/AuthorizeLoginSesameseed').default + }, { path: '/node/authorizationMgmt', name: 'AuthorizationMgmt', component: require('@/components/Node/NodeAuthorize/AuthorizationMgmt').default }, + { + path: '/node/authorizationMgmtSesameseed', + name: 'AuthorizationMgmtSesameseed', + component: require('@/components/Node/NodeAuthorize/Sesameseed/AuthorizationMgmtSesameseed').default + }, { path: '/node/newAuthorization', name: 'NewAuthorization', component: require('@/components/Node/NodeAuthorize/NewAuthorization').default }, + { + path: '/node/newAuthorizationSesameseed', + name: 'NewAuthorizationSesameseed', + component: require('@/components/Node/NodeAuthorize/Sesameseed/NewAuthorizationSesameseed').default + }, { path: '/oep4Home', name: 'Oep4Home', diff --git a/src/renderer/store/modules/NodeAuthorizationSesameseed.js b/src/renderer/store/modules/NodeAuthorizationSesameseed.js new file mode 100644 index 0000000..5a5c11f --- /dev/null +++ b/src/renderer/store/modules/NodeAuthorizationSesameseed.js @@ -0,0 +1,61 @@ +import {utils} from 'ontology-ts-sdk' +import axios from 'axios'; + +const state = { + sesameseed: { // for node user + votes: 0, + pendingWithdrawals: 0 + } +} + +const mutations = { + UPDATE_CURRENT_SS_PEER(state, payload) { + state.sesameseed = { + votes: payload.votes, + pendingWithdrawals: payload.pendingWithdrawals + } + } +} + +const actions = { + async fetchSSPerInfo({commit}, address) { + try { + const baseUrl = 'https://dappnode1.ont.io:10334/api/v1/storage/a63c33d2209854feafbf40685a33d4846ee82556/' + + const hexAddress = utils.str2hexstr(address) + const pendingHexAddress = utils.str2hexstr('1' + address) + + const pendingWithdrawalsPromise = axios.get(baseUrl + pendingHexAddress) + const votesPromise = axios.get(baseUrl + hexAddress) + + const [pendingWithdrawalsResponse, votesResponse] = await Promise.all([ pendingWithdrawalsPromise, votesPromise ]) + + let votes = 0 + let pendingWithdrawals = 0 + + if (pendingWithdrawalsResponse.status === 200 && pendingWithdrawalsResponse.data) { + const resultPending = pendingWithdrawalsResponse.data + const pendingWithdrawalsHex = resultPending.Result ? resultPending.Result : 0 + pendingWithdrawals = parseInt(pendingWithdrawalsHex, 16) + } + + if (votesResponse.status === 200 && votesResponse.data) { + const resultVotes = votesResponse.data + const votesHex = resultVotes.Result ? resultVotes.Result : 0 + votes = parseInt(votesHex, 16) + } + + commit('UPDATE_CURRENT_SS_PEER', { votes, pendingWithdrawals }) + return { votes, pendingWithdrawals }; + } catch (err) { + console.log(err) + return 0; + } + } +} + +export default { + state, + mutations, + actions +}