Documentation ¶
Index ¶
- Constants
- type ChainAPI
- func (c *ChainAPI) GetBlock(height uint64) (*api.ResultBlock, error)
- func (c *ChainAPI) GetBlockInfo(height uint64) (*api.ResultBlockInfo, error)
- func (c *ChainAPI) GetHeight() (uint64, error)
- func (c *ChainAPI) GetValidators(height uint64) ([]*api.ResultValidator, error)
- func (c *ChainAPI) IsSyncing() (bool, error)
- type DHTAPI
- func (d *DHTAPI) Announce(key string) error
- func (d *DHTAPI) GetPeers() ([]string, error)
- func (d *DHTAPI) GetProviders(key string) ([]*api.ResultDHTProvider, error)
- func (d *DHTAPI) GetRepoObjectProviders(hash string) ([]*api.ResultDHTProvider, error)
- func (d *DHTAPI) Lookup(key string) (string, error)
- func (d *DHTAPI) Store(key, value string) error
- type PoolAPI
- type PushKeyAPI
- type RPCAPI
- type RPCClient
- func (c *RPCClient) Call(method string, params interface{}) (res util.Map, statusCode int, err error)
- func (c *RPCClient) DHT() types.DHT
- func (c *RPCClient) GetOptions() *types.Options
- func (c *RPCClient) Node() types.Node
- func (c *RPCClient) Pool() types.Pool
- func (c *RPCClient) PushKey() types.PushKey
- func (c *RPCClient) RPC() types.RPC
- func (c *RPCClient) Repo() types.Repo
- func (c *RPCClient) SetCallFunc(f callerFunc)
- func (c *RPCClient) Ticket() types.Ticket
- func (c *RPCClient) Tx() types.Tx
- func (c *RPCClient) User() types.User
- type RepoAPI
- func (c *RepoAPI) AddContributors(body *api.BodyAddRepoContribs) (*api.ResultHash, error)
- func (c *RepoAPI) Create(body *api.BodyCreateRepo) (*api.ResultCreateRepo, error)
- func (c *RepoAPI) Get(name string, opts ...*api.GetRepoOpts) (*api.ResultRepository, error)
- func (c *RepoAPI) VoteProposal(body *api.BodyRepoVote) (*api.ResultHash, error)
- type TicketAPI
- func (t *TicketAPI) Buy(body *api.BodyBuyTicket) (*api.ResultHash, error)
- func (t *TicketAPI) BuyHost(body *api.BodyBuyTicket) (*api.ResultHash, error)
- func (t *TicketAPI) List(body *api.BodyTicketQuery) (res []*api.ResultTicket, err error)
- func (t *TicketAPI) ListHost(body *api.BodyTicketQuery) (res []*api.ResultTicket, err error)
- type TxAPI
- type UserAPI
- func (u *UserAPI) Get(address string, blockHeight ...uint64) (*api.ResultAccount, error)
- func (u *UserAPI) GetBalance(address string, blockHeight ...uint64) (float64, error)
- func (u *UserAPI) GetKeys() ([]string, error)
- func (u *UserAPI) GetNonce(address string, blockHeight ...uint64) (uint64, error)
- func (u *UserAPI) GetPrivateKey(address string, passphrase string) (string, error)
- func (u *UserAPI) GetPublicKey(address string, passphrase string) (string, error)
- func (u *UserAPI) GetStakedBalance(address string, blockHeight ...uint64) (float64, error)
- func (u *UserAPI) GetValidator(includePrivKey bool) (*api.ResultValidatorInfo, error)
- func (u *UserAPI) Send(body *api.BodySendCoin) (*api.ResultHash, error)
- func (u *UserAPI) SetCommission(body *api.BodySetCommission) (*api.ResultHash, error)
Constants ¶
const ( Timeout = 15 * time.Second ErrCodeClient = "client_error" ErrCodeDecodeFailed = "decode_error" ErrCodeUnexpected = "unexpected_error" ErrCodeConnect = "connect_error" ErrCodeBadParam = "bad_param_error" )
Timeout is the max duration for connection and read attempt
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainAPI ¶
type ChainAPI struct {
// contains filtered or unexported fields
}
ChainAPI implements Node to provide access to the chain-related RPC methods
func (*ChainAPI) GetBlock ¶
func (c *ChainAPI) GetBlock(height uint64) (*api.ResultBlock, error)
GetBlock gets a block by height
func (*ChainAPI) GetBlockInfo ¶
func (c *ChainAPI) GetBlockInfo(height uint64) (*api.ResultBlockInfo, error)
GetBlockInfo gets a summarized block data for the given height
func (*ChainAPI) GetValidators ¶
func (c *ChainAPI) GetValidators(height uint64) ([]*api.ResultValidator, error)
GetValidators gets validators at a given block height
type DHTAPI ¶
type DHTAPI struct {
// contains filtered or unexported fields
}
DHTAPI implements DHT to provide access to the DHT network
func (*DHTAPI) GetProviders ¶
func (d *DHTAPI) GetProviders(key string) ([]*api.ResultDHTProvider, error)
GetProviders returns providers of the given key
func (*DHTAPI) GetRepoObjectProviders ¶
func (d *DHTAPI) GetRepoObjectProviders(hash string) ([]*api.ResultDHTProvider, error)
GetRepoObjectProviders returns providers for the given repository object hash
type PoolAPI ¶
type PoolAPI struct {
// contains filtered or unexported fields
}
PoolAPI implements Pool to provide access to the DHT network
func (*PoolAPI) GetPushPoolSize ¶
GetPushPoolSize returns size information of the mempool
type PushKeyAPI ¶
type PushKeyAPI struct {
// contains filtered or unexported fields
}
PushKeyAPI provides access to the pushkey-related RPC methods
func (*PushKeyAPI) GetOwner ¶
func (pk *PushKeyAPI) GetOwner(addr string, blockHeight ...uint64) (*api.ResultAccount, error)
GetOwner gets the account that owns the given push key
func (*PushKeyAPI) Register ¶
func (pk *PushKeyAPI) Register(body *api.BodyRegisterPushKey) (*api.ResultRegisterPushKey, error)
Register registers a public key as a push key
type RPCAPI ¶
type RPCAPI struct {
// contains filtered or unexported fields
}
RPCAPI provides access to the rpc server-related methods
func (*RPCAPI) GetMethods ¶
func (c *RPCAPI) GetMethods() ([]rpc.MethodInfo, error)
GetMethods gets all methods supported by the RPC server
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient provides the ability to interact with a JSON-RPC 2.0 service
func (*RPCClient) Call ¶
func (c *RPCClient) Call(method string, params interface{}) (res util.Map, statusCode int, err error)
Call calls a method on the RPCClient service.
RETURNS:
- res: JSON-RPC 2.0 success response
- statusCode: RPCServer response code
- err: Client error or JSON-RPC 2.0 error response. 0 = Client error
func (*RPCClient) GetOptions ¶
GetOptions returns the client's option
func (*RPCClient) SetCallFunc ¶
func (c *RPCClient) SetCallFunc(f callerFunc)
SetCallFunc sets the RPC call function
type RepoAPI ¶
type RepoAPI struct {
// contains filtered or unexported fields
}
RepoAPI provides access to the repo-related RPC methods
func (*RepoAPI) AddContributors ¶
func (c *RepoAPI) AddContributors(body *api.BodyAddRepoContribs) (*api.ResultHash, error)
AddContributors creates transaction to create a add repo contributors
func (*RepoAPI) Create ¶
func (c *RepoAPI) Create(body *api.BodyCreateRepo) (*api.ResultCreateRepo, error)
Create creates a new repository
func (*RepoAPI) Get ¶
func (c *RepoAPI) Get(name string, opts ...*api.GetRepoOpts) (*api.ResultRepository, error)
Get finds and returns a repository
func (*RepoAPI) VoteProposal ¶
func (c *RepoAPI) VoteProposal(body *api.BodyRepoVote) (*api.ResultHash, error)
VoteProposal creates transaction to vote for/against a repository's proposal
type TicketAPI ¶
type TicketAPI struct {
// contains filtered or unexported fields
}
TicketAPI provides access to ticket-related RPC methods
func (*TicketAPI) Buy ¶
func (t *TicketAPI) Buy(body *api.BodyBuyTicket) (*api.ResultHash, error)
Buy creates a transaction to buy a validator ticket
func (*TicketAPI) BuyHost ¶
func (t *TicketAPI) BuyHost(body *api.BodyBuyTicket) (*api.ResultHash, error)
BuyHost creates a transaction to buy a host ticket
func (*TicketAPI) List ¶
func (t *TicketAPI) List(body *api.BodyTicketQuery) (res []*api.ResultTicket, err error)
List returns active validator tickets associated with a public key
func (*TicketAPI) ListHost ¶
func (t *TicketAPI) ListHost(body *api.BodyTicketQuery) (res []*api.ResultTicket, err error)
ListHost returns active hosts tickets associated with a public key
type TxAPI ¶
type TxAPI struct {
// contains filtered or unexported fields
}
TxAPI provides access to the transaction-related RPC methods
type UserAPI ¶
type UserAPI struct {
// contains filtered or unexported fields
}
UserAPI provides access to user-related RPC methods
func (*UserAPI) GetBalance ¶
GetBalance returns the spendable balance of an account
func (*UserAPI) GetNonce ¶
GetNonce gets the nonce of a user account corresponding to the given address
func (*UserAPI) GetPrivateKey ¶
GetPrivateKey returns the private key of a key on the keystore
func (*UserAPI) GetPublicKey ¶
GetPublicKey returns the public key of a key on the keystore
func (*UserAPI) GetStakedBalance ¶
GetStakedBalance returns the staked coin balance of an account
func (*UserAPI) GetValidator ¶
func (u *UserAPI) GetValidator(includePrivKey bool) (*api.ResultValidatorInfo, error)
GetValidator get the validator information of the node
func (*UserAPI) Send ¶
func (u *UserAPI) Send(body *api.BodySendCoin) (*api.ResultHash, error)
Send sends coins from a user account to another account or repository
func (*UserAPI) SetCommission ¶
func (u *UserAPI) SetCommission(body *api.BodySetCommission) (*api.ResultHash, error)
SetCommission update the validator commission percentage of an account