Skip to content

Commit 5316225

Browse files
Merge pull request #138 from binance-chain/bsc_base
add side chain features and staking features
2 parents 6e29c01 + 76b4d4f commit 5316225

39 files changed

+6994
-44
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# Changelog
2+
## 1.2.4
3+
CHAIN UPGRADE
4+
* [\#132](https://github.com/binance-chain/go-sdk/pull/132) [RPC] [API] enable side chain governance transaction
5+
* [\#133](https://github.com/binance-chain/go-sdk/pull/133) [RPC] [API] enable side chain unbind transaction, and modify the structure of claimMsg
6+
* [\#136](https://github.com/binance-chain/go-sdk/pull/136) [TX] [TOOL] add utils to parse Claim payload to human readable interface
7+
28
## 1.2.3
39
CHAIN UPGRADE
410
* [\#110](https://github.com/binance-chain/go-sdk/pull/110) [RPC] [API] Add pending_match flag

ReadMe.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# BNC Chain Go SDK
22

3-
43
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.
54
It includes the following core components:
65

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

12+
## Disclaimer
13+
**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.**
14+
1315
## Install
1416

1517
### Requirement

client/rpc/basic_client.go

+41-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"time"
66

77
"github.com/pkg/errors"
8-
98
cmn "github.com/tendermint/tendermint/libs/common"
109
"github.com/tendermint/tendermint/rpc/client"
1110
ctypes "github.com/tendermint/tendermint/rpc/core/types"
@@ -50,6 +49,7 @@ type Client interface {
5049
EventsClient
5150
DexClient
5251
OpsClient
52+
StakingClient
5353
}
5454

5555
type EventsClient interface {
@@ -210,6 +210,21 @@ func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error) {
210210
return c.WSEvents.Validators(height)
211211
}
212212

213+
func (c *HTTP) QueryWithData(path string, data cmn.HexBytes) ([]byte, error) {
214+
result, err := c.ABCIQuery(path, data)
215+
216+
if err != nil {
217+
return nil, err
218+
}
219+
220+
resp := result.Response
221+
if !resp.IsOK() {
222+
return nil, errors.Errorf(resp.Log)
223+
}
224+
225+
return resp.Value, nil
226+
}
227+
213228
func (c *HTTP) QueryStore(key cmn.HexBytes, storeName string) ([]byte, error) {
214229
path := fmt.Sprintf("/store/%s/%s", storeName, "key")
215230
result, err := c.ABCIQuery(path, key)
@@ -223,6 +238,31 @@ func (c *HTTP) QueryStore(key cmn.HexBytes, storeName string) ([]byte, error) {
223238
return resp.Value, nil
224239
}
225240

241+
func (c *HTTP) QueryStoreSubspace(key cmn.HexBytes, storeName string) (res []cmn.KVPair, err error) {
242+
path := fmt.Sprintf("/store/%s/subspace", storeName)
243+
result, err := c.ABCIQuery(path, key)
244+
if err != nil {
245+
return res, err
246+
}
247+
248+
resp := result.Response
249+
if !resp.IsOK() {
250+
return nil, errors.Errorf(resp.Log)
251+
}
252+
253+
if len(resp.Value) == 0 {
254+
return nil, EmptyResultError
255+
}
256+
257+
err = c.cdc.UnmarshalBinaryLengthPrefixed(resp.Value, &res)
258+
259+
if err != nil {
260+
return nil, err
261+
}
262+
263+
return
264+
}
265+
226266
func (c *HTTP) SetKeyManager(k keys.KeyManager) {
227267
c.key = k
228268
}

0 commit comments

Comments
 (0)