mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
rpc: update client documentation
Add missing methods, move example into something that can be compiled (and fix it along the way).
This commit is contained in:
parent
f747b39bc6
commit
685e34d83c
2 changed files with 71 additions and 38 deletions
33
pkg/rpc/client/doc_test.go
Normal file
33
pkg/rpc/client/doc_test.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package client_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpc/client"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
endpoint := "http://seed5.bridgeprotocol.io:10332"
|
||||
opts := client.Options{}
|
||||
|
||||
c, err := client.New(context.TODO(), endpoint, opts)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := c.Ping(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
resp, err := c.GetAccountState("ATySFJAbLW7QHsZGHScLhxq6EyNBxx3eFP")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println(resp.ScriptHash)
|
||||
fmt.Println(resp.Balances)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue