rpc: adjust client documentation

This commit is contained in:
Anna Shaleva 2021-09-08 13:02:14 +03:00
parent 913e3878c5
commit df8141ff7d
4 changed files with 25 additions and 9 deletions

View file

@ -110,9 +110,10 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
return cl, nil
}
// Init sets magic of the network client connected to and native NEO and GAS
// contracts scripthashes. This method should be called before any transaction-,
// header- or block-related requests in order to deserialize responses properly.
// Init sets magic of the network client connected to, stateRootInHeader option
// and native NEO, GAS and Policy contracts scripthashes. This method should be
// called before any transaction-, header- or block-related requests in order to
// deserialize responses properly.
func (c *Client) Init() error {
version, err := c.GetVersion()
if err != nil {

View file

@ -12,38 +12,47 @@ return a more pretty printed response from the server instead of
a raw hex string.
TODO:
Add missing methods to client.
Allow client to connect using client cert.
More in-depth examples.
Supported methods
calculatenetworkfee
getapplicationlog
getbestblockhash
getblock
getblockcount
getblockhash
getblockheader
getblocksysfee
getblockheadercount
getcommittee
getconnectioncount
getcontractstate
getnativecontracts
getnep17balances
getnep17transfers
getpeers
getrawmempool
getrawtransaction
getstateheight
getstorage
gettransactionheight
getunclaimedgas
getvalidators
getnextblockvalidators
getversion
invoke
invokefunction
invokescript
invokecontractverify
sendrawtransaction
submitblock
submitoracleresponse
validateaddress
Extensions:
getblocksysfee
submitnotaryrequest
Unsupported methods
claimgas

View file

@ -19,6 +19,12 @@ func Example() {
os.Exit(1)
}
err = c.Init()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
if err := c.Ping(); err != nil {
fmt.Println(err)
os.Exit(1)

View file

@ -38,8 +38,8 @@ type WSClient struct {
}
// Notification represents server-generated notification for client subscriptions.
// Value can be one of block.Block, result.ApplicationLog, result.NotificationEvent
// or transaction.Transaction based on Type.
// Value can be one of block.Block, state.AppExecResult, state.NotificationEvent
// transaction.Transaction or response.NotaryRequestEvent based on Type.
type Notification struct {
Type response.EventID
Value interface{}