Fix signing issue

This commit is contained in:
liangping 2022-08-28 23:06:25 +08:00
parent 9875281a7d
commit d62cbf14fb
3 changed files with 24 additions and 15 deletions

View File

@ -102,18 +102,26 @@ export default class ChainFetch {
} }
async getValidatorDistribution(address) { async getValidatorDistribution(address) {
// return this.get(`/distribution/validators/${address}`).then(data => { return this.get(`/distribution/validators/${address}`).then(data => {
return Promise.all([ const value = commonProcess(data)
this.get(`/cosmos/distribution/v1beta1/validators/${address}/commission`),
this.get(`/cosmos/distribution/v1beta1/validators/${address}/outstanding_rewards`),
]).then(data => {
const ret = ValidatorDistribution.create({ const ret = ValidatorDistribution.create({
operator_address: address, operator_address: address,
self_bond_rewards: data[1].rewards.rewards, self_bond_rewards: value.self_bond_rewards,
val_commission: data[0].commission.commission, val_commission: value.val_commission.commission,
}) })
return ret return ret
}) })
// return Promise.all([
// this.get(`/cosmos/distribution/v1beta1/validators/${address}/commission`),
// this.get(`/cosmos/distribution/v1beta1/validators/${address}/outstanding_rewards`),
// ]).then(data => {
// const ret = ValidatorDistribution.create({
// operator_address: address,
// self_bond_rewards: data[1].rewards.rewards,
// val_commission: data[0].commission.commission,
// })
// return ret
// })
} }
async getStakingDelegatorDelegation(delegatorAddr, validatorAddr) { async getStakingDelegatorDelegation(delegatorAddr, validatorAddr) {
@ -370,7 +378,7 @@ export default class ChainFetch {
async getAuthAccount(address, config = null) { async getAuthAccount(address, config = null) {
return this.get('/cosmos/auth/v1beta1/accounts/'.concat(address), config).then(data => { return this.get('/cosmos/auth/v1beta1/accounts/'.concat(address), config).then(data => {
const result = commonProcess(data) const result = commonProcess(data)
return result.value ? result : { value: result } return result
}) })
} }

View File

@ -156,11 +156,11 @@ export function chartColors() {
} }
export function extractAccountNumberAndSequence(ret) { export function extractAccountNumberAndSequence(ret) {
let account = ret.value let { account } = ret
if (ret.value && ret.value.base_vesting_account) { // vesting account if (account && account.base_vesting_account) { // vesting account
account = ret.value.base_vesting_account?.base_account account = account.base_vesting_account?.base_account
} else if (ret.value && ret.value.base_account) { // evmos based account } else if (account && account.base_account) { // evmos based account
account = ret.value.base_account account = account.base_account
} }
const accountNumber = account.account_number const accountNumber = account.account_number
const sequence = account?.sequence || 0 const sequence = account?.sequence || 0

View File

@ -358,8 +358,8 @@ export default {
this.sequence = account.sequence this.sequence = account.sequence
}) })
this.$http.getBankBalances(this.selectedAddress, this.selectedChain).then(res => { this.$http.getBankBalances(this.selectedAddress, this.selectedChain).then(res => {
if (res && res.length > 0) { if (res.balances && res.balances.length > 0) {
this.balance = res.reverse() this.balance = res.balances.reverse()
const token = this.balance.find(i => !i.denom.startsWith('ibc')) const token = this.balance.find(i => !i.denom.startsWith('ibc'))
this.token = token.denom this.token = token.denom
if (token) this.feeDenom = token.denom if (token) this.feeDenom = token.denom
@ -391,6 +391,7 @@ export default {
}, },
async sendTx() { async sendTx() {
const txMsgs = this.$refs.component.msg const txMsgs = this.$refs.component.msg
if (txMsgs.length === 0) { if (txMsgs.length === 0) {
this.error = 'No delegation found' this.error = 'No delegation found'
return '' return ''