Skip to main content

Client

type Client

Client provides an interface for interacting with the blockchain. It is the main struct of the gnoclient package, exposing all APIs used to communicate with a Gno.land chain.

type Client struct {
Signer Signer // Signer for transaction authentication
RPCClient rpcclient.Client // RPC client for blockchain communication
}

func (*Client) AddPackage

func (c *Client) AddPackage(cfg BaseTxCfg, msgs ...MsgAddPackage) (*ctypes.ResultBroadcastTxCommit, error)

AddPackage executes one or more AddPackage calls on the blockchain.

func (*Client) Block

func (c *Client) Block(height int64) (*ctypes.ResultBlock, error)

Block gets the latest block at height, if any. Height must be larger than 0.

func (*Client) BlockResult

func (c *Client) BlockResult(height int64) (*ctypes.ResultBlockResults, error)

BlockResult gets the block results at height, if any. Height must be larger than 0.

func (*Client) LatestBlockHeight

func (c *Client) LatestBlockHeight() (int64, error)

LatestBlockHeight gets the latest block height on the chain.

func (*Client) Call

func (c *Client) Call(cfg BaseTxCfg, msgs ...MsgCall) (*ctypes.ResultBroadcastTxCommit, error)

Call executes a one or more MsgCall calls on the blockchain.

func (*Client) Send

func (c *Client) Send(cfg BaseTxCfg, msgs ...MsgSend) (*ctypes.ResultBroadcastTxCommit, error)

Send executes one or more MsgSend calls on the blockchain.

func (*Client) Run

func (c *Client) Run(cfg BaseTxCfg, msgs ...MsgRun) (*ctypes.ResultBroadcastTxCommit, error)

Run executes a one or more MsgRun calls on the blockchain.

func (*Client) QEval

func (c *Client) QEval(pkgPath string, expression string) (string, *ctypes.ResultABCIQuery, error)

QEval evaluates the given expression with the realm code at pkgPath. The pkgPath should include the prefix like gno.land/. The expression is usually a function call like Render("").

func (*Client) Query

func (c *Client) Query(cfg QueryCfg) (*ctypes.ResultABCIQuery, error)

Query performs a generic query on the blockchain.

func (*Client) QueryAccount

func (c *Client) QueryAccount(addr crypto.Address) (*std.BaseAccount, *ctypes.ResultABCIQuery, error)

QueryAccount retrieves account information for a given address.

func (*Client) QueryAppVersion

func (c *Client) QueryAppVersion() (string, *ctypes.ResultABCIQuery, error)

QueryAppVersion retrieves information about the Gno.land app version.

func (*Client) Render

func (c *Client) Render(pkgPath string, args string) (string, *ctypes.ResultABCIQuery, error)

Render calls the Render function for pkgPath with optional args. The pkgPath should include the prefix like gno.land/. This is similar to using a browser URL <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have the prefix like gno.land/.

type BaseTxCfg

BaseTxCfg defines the base transaction configuration, shared by all message types.

type BaseTxCfg struct {
GasFee string // Gas fee
GasWanted int64 // Gas wanted
AccountNumber uint64 // Account number
SequenceNumber uint64 // Sequence number
Memo string // Memo
}

type MsgAddPackage

MsgAddPackage - syntax sugar for vm.MsgAddPackage.

type MsgAddPackage struct {
Package *std.MemPackage // Package to add
Deposit string // Coin deposit
}

type MsgCall

MsgCall - syntax sugar for vm.MsgCall.

type MsgCall struct {
PkgPath string // Package path
FuncName string // Function name
Args []string // Function arguments
Send string // Send amount
}

type MsgRun

MsgRun - syntax sugar for vm.MsgRun.

type MsgRun struct {
Package *std.MemPackage // Package to run
Send string // Send amount
}

type MsgSend

MsgSend - syntax sugar for bank.MsgSend.

type MsgSend struct {
ToAddress crypto.Address // Send to address
Send string // Send amount
}

type QueryCfg

QueryCfg contains configuration options for performing ABCI queries.

type QueryCfg struct {
Path string // Query path
Data []byte // Query data
rpcclient.ABCIQueryOptions // ABCI query options
}