Skip to content

Commit

Permalink
update doc (#121)
Browse files Browse the repository at this point in the history
Co-authored-by: dayong <[email protected]>
  • Loading branch information
wangdayong228 and dayong authored Oct 25, 2021
1 parent 54d3d8b commit c483144
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 4 deletions.
95 changes: 91 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ BatchGetBlockSummarys requests block summary informations in bulk by blockhashes

```go
func (client *Client) BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error)

```
BatchGetBlockSummarysByNumber requests block summary informations in bulk by blocknumbers
BatchGetBlockSummarysByNumber requests block summary informations in bulk by
blocknumbers

#### func (*Client) BatchGetRawBlockConfirmationRisk

Expand Down Expand Up @@ -401,6 +401,12 @@ func (client *Client) GetBestBlockHash() (hash types.Hash, err error)
```
GetBestBlockHash returns the current best block hash.

#### func (*Client) GetBlockByBlockNumber

```go
func (client *Client) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (block *types.Block, err error)
```

#### func (*Client) GetBlockByEpoch

```go
Expand Down Expand Up @@ -442,6 +448,12 @@ func (client *Client) GetBlockRewardInfo(epoch types.Epoch) (rewardInfo []types.
```
GetBlockRewardInfo returns block reward information in an epoch

#### func (*Client) GetBlockSummaryByBlockNumber

```go
func (client *Client) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (block *types.BlockSummary, err error)
```

#### func (*Client) GetBlockSummaryByEpoch

```go
Expand Down Expand Up @@ -521,6 +533,12 @@ GetEpochNumber returns the highest or specified epoch number.
func (client *Client) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error)
```

#### func (*Client) GetEpochReceiptsByPivotBlockHash

```go
func (client *Client) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error)
```

#### func (*Client) GetGasPrice

```go
Expand Down Expand Up @@ -669,6 +687,12 @@ NewAddress create conflux address by base32 string or hex40 string, if
base32OrHex is base32 and networkID is passed it will create cfx Address use
networkID of current client.

#### func (*Client) Pos

```go
func (client *Client) Pos() *RpcPosClient
```

#### func (*Client) SendRawTransaction

```go
Expand Down Expand Up @@ -711,7 +735,7 @@ expressed by a sequence of epochs. Currently subscriptionEpochType only support
#### func (*Client) SubscribeLogs

```go
func (client *Client) SubscribeLogs(logChannel chan types.Log, chainReorgChannel chan types.ChainReorg, filter types.LogFilter) (*rpc.ClientSubscription, error)
func (client *Client) SubscribeLogs(channel chan types.SubscriptionLog, filter types.LogFilter) (*rpc.ClientSubscription, error)
```
SubscribeLogs subscribes all logs matching a certain filter, in order.

Expand Down Expand Up @@ -858,6 +882,69 @@ type ContractDeployResult struct {
```

ContractDeployResult for state change notification when deploying contract

### type RpcPosClient

```go
type RpcPosClient struct {
}
```


#### func NewRpcPosClient

```go
func NewRpcPosClient(core *Client) RpcPosClient
```

#### func (*RpcPosClient) GetAccount

```go
func (c *RpcPosClient) GetAccount(address postypes.Address, blockNumber ...uint64) (account postypes.Account, err error)
```
GetAccount returns account info at block

#### func (*RpcPosClient) GetBlockByHash

```go
func (c *RpcPosClient) GetBlockByHash(hash types.Hash) (block *postypes.Block, err error)
```
GetBlockByHash returns block info of block hash

#### func (*RpcPosClient) GetBlockByNumber

```go
func (c *RpcPosClient) GetBlockByNumber(blockNumber postypes.BlockNumber) (block *postypes.Block, err error)
```
GetBlockByHash returns block at block number

#### func (*RpcPosClient) GetCommittee

```go
func (c *RpcPosClient) GetCommittee(blockNumber ...uint64) (committee postypes.CommitteeState, err error)
```
GetCommittee returns committee info at block

#### func (*RpcPosClient) GetRewardsByEpoch

```go
func (c *RpcPosClient) GetRewardsByEpoch(epochNumber uint64) (reward postypes.EpochReward, err error)
```
GetRewardsByEpoch returns rewards of epoch

#### func (*RpcPosClient) GetStatus

```go
func (c *RpcPosClient) GetStatus() (status postypes.Status, err error)
```
GetStatus returns pos chain status

#### func (*RpcPosClient) GetTransactionByNumber

```go
func (c *RpcPosClient) GetTransactionByNumber(txNumber uint64) (transaction *postypes.Transaction, err error)
```
GetTransactionByNumber returns transaction info of transaction number
## package utils
```
import "."
Expand Down Expand Up @@ -927,7 +1014,7 @@ Keccak256 hashes hex string by keccak256 and returns it's hash value
#### func PanicIfErr

```go
func PanicIfErr(err error, msg string)
func PanicIfErr(err error)
```
PanicIfErr panic and reports error message

Expand Down
2 changes: 2 additions & 0 deletions changeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Go-conflux-sdk Change Log
## v1.0.14
- Add POS RPC
## v1.0.13
- Add API GetBlockSummaryByBlockNumber
## v1.0.12
Expand Down

0 comments on commit c483144

Please sign in to comment.