Documentation ¶
Index ¶
- type CallFunctionOption
- type CallFunctionResponse
- type Cause
- type Change
- type ChangeData
- type Client
- func (c *Client) Account(accountID string) *account.Account
- func (c *Client) CallFunction(ctx context.Context, accountID string, methodName string, ...) (*CallFunctionResponse, error)
- func (c *Client) DataChanges(ctx context.Context, accountIDs []string, opts ...DataChangesOption) (*DataChangesResponse, error)
- func (c *Client) NodeStatus(ctx context.Context) (*NodeStatusResponse, error)
- func (c *Client) ViewCode(ctx context.Context, accountID string, opts ...ViewCodeOption) (*ViewCodeResponse, error)
- type DataChangesOption
- type DataChangesResponse
- type NodeStatusResponse
- type SyncInfo
- type ViewCodeOption
- type ViewCodeResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallFunctionOption ¶
type CallFunctionOption func(*itypes.QueryRequest) error
CallFunctionOption controls the behavior when calling CallFunction.
func CallFunctionWithArgs ¶
func CallFunctionWithArgs(args interface{}) CallFunctionOption
CallFunctionWithArgs specified the args to call the function with. Should be a JSON encodable object.
func CallFunctionWithBlockHash ¶
func CallFunctionWithBlockHash(blockHash string) CallFunctionOption
CallFunctionWithBlockHash specifies the block hash to call the function for.
func CallFunctionWithBlockHeight ¶
func CallFunctionWithBlockHeight(blockHeight int) CallFunctionOption
CallFunctionWithBlockHeight specifies the block height to call the function for.
func CallFunctionWithFinality ¶
func CallFunctionWithFinality(finalaity string) CallFunctionOption
CallFunctionWithFinality specifies the finality to be used when calling the function.
type CallFunctionResponse ¶
type CallFunctionResponse struct { Result []byte `json:"result"` Logs []string `json:"logs"` BlockHeight int `json:"block_height"` BlockHash string `json:"block_hash"` }
CallFunctionResponse holds information about the result of a function call.
type Change ¶
type Change struct { AccountID string `json:"account_id"` KeyBase64 string `json:"key_base64"` ValueBase64 string `json:"value_base64"` }
Change holds information about a state change of a key-value pair.
type ChangeData ¶
type ChangeData struct { Cause Cause `json:"cause"` Type string `json:"type"` Change Change `json:"change"` }
ChangeData holds information about a state change.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with the NEAR API.
func (*Client) CallFunction ¶
func (c *Client) CallFunction( ctx context.Context, accountID string, methodName string, opts ...CallFunctionOption, ) (*CallFunctionResponse, error)
CallFunction calls a function on a contract.
func (*Client) DataChanges ¶
func (c *Client) DataChanges( ctx context.Context, accountIDs []string, opts ...DataChangesOption, ) (*DataChangesResponse, error)
DataChanges queries changes to contract data changes.
func (*Client) NodeStatus ¶
func (c *Client) NodeStatus(ctx context.Context) (*NodeStatusResponse, error)
NodeStatus returns the node status.
func (*Client) ViewCode ¶
func (c *Client) ViewCode(ctx context.Context, accountID string, opts ...ViewCodeOption) (*ViewCodeResponse, error)
ViewCode returns the smart contract code for the provided account id.
type DataChangesOption ¶
type DataChangesOption func(*itypes.ChangesRequest)
DataChangesOption controls behavior when calling DataChanges.
func DataChangesWithBlockHash ¶
func DataChangesWithBlockHash(blockHash string) DataChangesOption
DataChangesWithBlockHash specifies the block id to query data changes for.
func DataChangesWithBlockHeight ¶
func DataChangesWithBlockHeight(blockHeight int) DataChangesOption
DataChangesWithBlockHeight specifies the block id to query data changes for.
func DataChangesWithFinality ¶
func DataChangesWithFinality(finalaity string) DataChangesOption
DataChangesWithFinality specifies the finality to be used when querying data changes.
func DataChangesWithPrefix ¶
func DataChangesWithPrefix(prefix string) DataChangesOption
DataChangesWithPrefix sets the data key prefix to query for.
type DataChangesResponse ¶
type DataChangesResponse struct { BlockHash string `json:"block_hash"` Changes []ChangeData `json:"changes"` }
DataChangesResponse holds information about all data changes in a block.
type NodeStatusResponse ¶
type NodeStatusResponse struct {
SyncInfo *SyncInfo `json:"sync_info"`
}
NodeStatusResponse holds information about node status.
type SyncInfo ¶
type SyncInfo struct { LatestBlockHash string `json:"latest_block_hash"` LatestBlockHeight int `json:"latest_block_height"` // TODO: make this time.Time and use custom json conversion. LatestBlockTime string `json:"latest_block_time"` }
SyncInfo holds information about the sync status of a node.
type ViewCodeOption ¶
type ViewCodeOption func(*itypes.QueryRequest)
ViewCodeOption controls the behavior when calling ViewCode.
func ViewCodeWithBlockHash ¶
func ViewCodeWithBlockHash(blockHash string) ViewCodeOption
ViewCodeWithBlockHash specifies the block hash to call the function for.
func ViewCodeWithBlockHeight ¶
func ViewCodeWithBlockHeight(blockHeight int) ViewCodeOption
ViewCodeWithBlockHeight specifies the block height to call the function for.
func ViewCodeWithFinality ¶
func ViewCodeWithFinality(finalaity string) ViewCodeOption
ViewCodeWithFinality specifies the finality to be used when calling the function.