Skip to content

Commit

Permalink
Merge pull request #138 from binance-chain/bsc_base
Browse files Browse the repository at this point in the history
add side chain features and staking features
  • Loading branch information
forcodedancing authored Aug 21, 2020
2 parents 6e29c01 + 76b4d4f commit 5316225
Show file tree
Hide file tree
Showing 39 changed files with 6,994 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## 1.2.4
CHAIN UPGRADE
* [\#132](https://github.com/binance-chain/go-sdk/pull/132) [RPC] [API] enable side chain governance transaction
* [\#133](https://github.com/binance-chain/go-sdk/pull/133) [RPC] [API] enable side chain unbind transaction, and modify the structure of claimMsg
* [\#136](https://github.com/binance-chain/go-sdk/pull/136) [TX] [TOOL] add utils to parse Claim payload to human readable interface

## 1.2.3
CHAIN UPGRADE
* [\#110](https://github.com/binance-chain/go-sdk/pull/110) [RPC] [API] Add pending_match flag
Expand Down
4 changes: 3 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# BNC Chain Go SDK


The Binance Chain GO SDK provides a thin wrapper around the BNC Chain API for readonly endpoints, in addition to creating and submitting different transactions.
It includes the following core components:

Expand All @@ -10,6 +9,9 @@ It includes the following core components:
* **keys** - implement `KeyManage` to manage private key and accounts.
* **types** - core type of Binance Chain, such as `coin`, `account`, `tx` and `msg`.

## Disclaimer
**This branch is under active development, all subject to potential future change without notification and not ready for production use. The code and security audit have not been fully completed and not ready for any bug bounty.**

## Install

### Requirement
Expand Down
42 changes: 41 additions & 1 deletion client/rpc/basic_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"time"

"github.com/pkg/errors"

cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
Expand Down Expand Up @@ -50,6 +49,7 @@ type Client interface {
EventsClient
DexClient
OpsClient
StakingClient
}

type EventsClient interface {
Expand Down Expand Up @@ -210,6 +210,21 @@ func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error) {
return c.WSEvents.Validators(height)
}

func (c *HTTP) QueryWithData(path string, data cmn.HexBytes) ([]byte, error) {
result, err := c.ABCIQuery(path, data)

if err != nil {
return nil, err
}

resp := result.Response
if !resp.IsOK() {
return nil, errors.Errorf(resp.Log)
}

return resp.Value, nil
}

func (c *HTTP) QueryStore(key cmn.HexBytes, storeName string) ([]byte, error) {
path := fmt.Sprintf("/store/%s/%s", storeName, "key")
result, err := c.ABCIQuery(path, key)
Expand All @@ -223,6 +238,31 @@ func (c *HTTP) QueryStore(key cmn.HexBytes, storeName string) ([]byte, error) {
return resp.Value, nil
}

func (c *HTTP) QueryStoreSubspace(key cmn.HexBytes, storeName string) (res []cmn.KVPair, err error) {
path := fmt.Sprintf("/store/%s/subspace", storeName)
result, err := c.ABCIQuery(path, key)
if err != nil {
return res, err
}

resp := result.Response
if !resp.IsOK() {
return nil, errors.Errorf(resp.Log)
}

if len(resp.Value) == 0 {
return nil, EmptyResultError
}

err = c.cdc.UnmarshalBinaryLengthPrefixed(resp.Value, &res)

if err != nil {
return nil, err
}

return
}

func (c *HTTP) SetKeyManager(k keys.KeyManager) {
c.key = k
}
Loading

0 comments on commit 5316225

Please sign in to comment.