Skip to content

Commit

Permalink
fix: /chain/transaction/{hash} api
Browse files Browse the repository at this point in the history
  • Loading branch information
romever committed Oct 1, 2024
1 parent f91dae3 commit 41c25a9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions api/internal/logic/chain/chaintransactioninfologic.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ func (l *ChainTransactionInfoLogic) ChainTransactionInfo(req *types.ChainTransac
}

amount := fmt.Sprintf("%.9f", common.ValueToFloatByDecimals(big.NewInt(tx.Amount), common.Decimals))
var validatorAddress staking.Address
err = validatorAddress.UnmarshalText([]byte(tx.ToAddr))
if err != nil {
logc.Errorf(l.ctx, "address error, %v", err)
return nil, errort.NewDefaultError()
}
accountQuery := staking.OwnerQuery{Height: tx.Height - 1, Owner: validatorAddress}
validatorAccount, err := l.svcCtx.Staking.Account(l.ctx, &accountQuery)
if err != nil {
logc.Errorf(l.ctx, "staking account error, %v", err)
return nil, errort.NewDefaultError()
}
if tx.Method == "staking.ReclaimEscrow" {
var validatorAddress staking.Address
err = validatorAddress.UnmarshalText([]byte(tx.ToAddr))
if err != nil {
logc.Errorf(l.ctx, "address error, %v", err)
return nil, errort.NewDefaultError()
}
accountQuery := staking.OwnerQuery{Height: tx.Height - 1, Owner: validatorAddress}
validatorAccount, err := l.svcCtx.Staking.Account(l.ctx, &accountQuery)
if err != nil {
logc.Errorf(l.ctx, "staking account error, %v", err)
return nil, errort.NewDefaultError()
}
sharePool := staking.SharePool{
Balance: validatorAccount.Escrow.Active.Balance,
TotalShares: validatorAccount.Escrow.Active.TotalShares,
Expand Down

0 comments on commit 41c25a9

Please sign in to comment.