chainclient

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Level1Client level1.Level1Client
	WaspClient   *client.WaspClient
	ChainID      coretypes.ChainID
	SigScheme    signaturescheme.SignatureScheme
}

Client allows to send webapi requests to a specific chain in the node

func New

func New(
	level1Client level1.Level1Client,
	waspClient *client.WaspClient,
	chainID coretypes.ChainID,
	sigScheme signaturescheme.SignatureScheme,
) *Client

New creates a new chainclient.Client

func (*Client) CallView

func (c *Client) CallView(contractHname coretypes.Hname, fname string, arguments dict.Dict) (dict.Dict, error)

CallView sends a request to call a view function of a given contract, and returns the result of the call

func (*Client) GetChainRecord

func (c *Client) GetChainRecord() (*registry.ChainRecord, error)

GetChainRecord fetches the chain's ChainRecord

func (*Client) PostRequest

func (c *Client) PostRequest(
	contractHname coretypes.Hname,
	entryPoint coretypes.Hname,
	params ...PostRequestParams,
) (*sctransaction.Transaction, error)

PostRequest sends a request transaction to the chain

func (*Client) UploadBlob

func (c *Client) UploadBlob(fields dict.Dict, waspHosts []string, quorum int, optSize ...int) (hashing.HashValue, *sctransaction.Transaction, error)

UploadBlob implements an optimized blob upload protocol to the chain. It allows to avoid placing big data chunks into the request transaction - creates optimized RequestArgs, which contain hash references instead of too big binary parameters - uploads big binary data chunks to blob caches of at least `quorum` of `waspHosts` directly - posts a 'storeBlob' request to the 'blob' contract with optimized parameters - the chain reconstructs original parameters upn settlement of the request

type PostRequestParams

type PostRequestParams struct {
	Transfer coretypes.ColoredBalances
	Args     requestargs.RequestArgs
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL