|
|
@ -56,12 +56,12 @@ func (s *AccountAPI) AccountBalance( |
|
|
|
blockNum := rpc.BlockNumber(block.Header().Header.Number().Int64()) |
|
|
|
blockNum := rpc.BlockNumber(block.Header().Header.Number().Int64()) |
|
|
|
balance := new(big.Int) |
|
|
|
balance := new(big.Int) |
|
|
|
|
|
|
|
|
|
|
|
// delegated balance
|
|
|
|
|
|
|
|
if request.AccountIdentifier.SubAccount != nil { |
|
|
|
if request.AccountIdentifier.SubAccount != nil { |
|
|
|
subAccount := request.AccountIdentifier.SubAccount |
|
|
|
subAccount := request.AccountIdentifier.SubAccount |
|
|
|
ty, exist := subAccount.Metadata["type"] |
|
|
|
ty, exist := subAccount.Metadata["type"] |
|
|
|
|
|
|
|
|
|
|
|
if exist && ty.(string) == "delegation" { |
|
|
|
// delegated balance
|
|
|
|
|
|
|
|
if exist && ty.(string) == Delegation { |
|
|
|
validatorAddr := subAccount.Address |
|
|
|
validatorAddr := subAccount.Address |
|
|
|
validators, delegations := s.hmy.GetDelegationsByDelegatorByBlock(addr, block) |
|
|
|
validators, delegations := s.hmy.GetDelegationsByDelegatorByBlock(addr, block) |
|
|
|
for index, validator := range validators { |
|
|
|
for index, validator := range validators { |
|
|
@ -70,7 +70,7 @@ func (s *AccountAPI) AccountBalance( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// pending undelegated balance
|
|
|
|
// pending undelegated balance
|
|
|
|
} else if exist && ty.(string) == "undelegation" { |
|
|
|
} else if exist && ty.(string) == UnDelegation { |
|
|
|
validatorAddr := subAccount.Address |
|
|
|
validatorAddr := subAccount.Address |
|
|
|
validators, delegations := s.hmy.GetDelegationsByDelegatorByBlock(addr, block) |
|
|
|
validators, delegations := s.hmy.GetDelegationsByDelegatorByBlock(addr, block) |
|
|
|
for index, validator := range validators { |
|
|
|
for index, validator := range validators { |
|
|
|