Skip to content

Commit

Permalink
Merge pull request #174 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.8.0
  • Loading branch information
danil-lashin committed Dec 6, 2018
2 parents cdd60c8 + 4f3b939 commit 2f1f12a
Show file tree
Hide file tree
Showing 71 changed files with 4,484 additions and 1,978 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.8.0
*Dec 3rd, 2018*

BREAKING CHANGES

- [api] Switch to RPC protocol
- [api] Separate events from block in API
- [core] Fix issue with incorrect coin conversion
- [core] Limit coins supply to 1,000,000,000,000,000
- [core] Set minimal reserve and min/max coin supply in CreateCoin tx
- [core] Add MinimumValueToBuy and MaximumValueToSell to convert transactions
- [tendermint] Update to [v0.27.0](https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0270)

IMPROVEMENT

- [logs] Add `log_format` option to config
- [events] Add UnbondEvent

## 0.7.6
*Nov 27th, 2018*

Expand Down
82 changes: 53 additions & 29 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
name = "github.com/gobuffalo/packr"
version = "=1.11.1"

[[constraint]]
name = "github.com/gorilla/mux"
version = "=1.6.2"

[[constraint]]
name = "github.com/rs/cors"
version = "^1.6.0"

[[constraint]]
name = "github.com/danil-lashin/iavl"
revision = "ff321d758752b411f0fb01f86370395c314bc13a"
name = "github.com/tendermint/iavl"
version = "0.12.0"

[[constraint]]
name = "github.com/tendermint/tendermint"
version = "=0.26.4"
version = "0.27.0"

[[constraint]]
name = "github.com/MinterTeam/go-amino"
version = "=v0.14.1-m"

[[constraint]]
branch = "v1"
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GOTOOLS = \
github.com/golang/dep/cmd/dep \
gopkg.in/alecthomas/gometalinter.v2 \
github.com/mitchellh/gox \
github.com/golang/dep/cmd/dep \
github.com/alecthomas/gometalinter \
github.com/gogo/protobuf/protoc-gen-gogo \
github.com/gobuffalo/packr/packr
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
BUILD_TAGS?=minter
Expand Down Expand Up @@ -30,8 +32,7 @@ check_tools:

get_tools:
@echo "--> Installing tools"
go get -u -v $(GOTOOLS)
@gometalinter.v2 --install
./scripts/get_tools.sh

update_tools:
@echo "--> Updating tools"
Expand Down
36 changes: 36 additions & 0 deletions api/address.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package api

import (
"github.com/MinterTeam/minter-go-node/core/types"
"github.com/MinterTeam/minter-go-node/rpc/lib/types"
"math/big"
)

type AddressResponse struct {
Balance map[string]*big.Int `json:"balance"`
TransactionCount uint64 `json:"transaction_count"`
}

func Address(address types.Address, height int) (*AddressResponse, error) {
cState, err := GetStateForHeight(height)
if err != nil {
return nil, &rpctypes.RPCError{Code: 404, Message: "State at given height not found", Data: err.Error()}
}

response := AddressResponse{
Balance: make(map[string]*big.Int),
TransactionCount: cState.GetNonce(address),
}

balances := cState.GetBalances(address)

for k, v := range balances.Data {
response.Balance[k.String()] = v
}

if _, exists := response.Balance[types.GetBaseCoin().String()]; !exists {
response.Balance[types.GetBaseCoin().String()] = big.NewInt(0)
}

return &response, nil
}
Loading

0 comments on commit 2f1f12a

Please sign in to comment.