Documentation ¶
Index ¶
- type Client
- func (c *Client) CallView(ctx context.Context, hContract isc.Hname, functionName string, args dict.Dict) (dict.Dict, error)
- func (c *Client) CheckRequestResult(ctx context.Context, reqID isc.RequestID) error
- func (c *Client) DepositFunds(n uint64) (*iotago.Transaction, error)
- func (c *Client) GetChainRecord(ctx context.Context) (*apiclient.ChainInfoResponse, error)
- func (c *Client) Post1Request(contractHname isc.Hname, entryPoint isc.Hname, params ...PostRequestParams) (*iotago.Transaction, error)
- func (c *Client) PostNRequests(contractHname isc.Hname, entryPoint isc.Hname, requestsCount int, ...) ([]*iotago.Transaction, error)
- func (c *Client) PostOffLedgerRequest(context context.Context, contractHname isc.Hname, entrypoint isc.Hname, ...) (isc.OffLedgerRequest, error)
- func (c *Client) RequestIDByEVMTransactionHash(ctx context.Context, txHash common.Hash) (isc.RequestID, error)
- func (c *Client) StateGet(ctx context.Context, key string) ([]byte, error)
- func (c *Client) UploadBlob(ctx context.Context, fields dict.Dict) (hashing.HashValue, isc.OffLedgerRequest, *apiclient.ReceiptResponse, error)
- type PostRequestParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Layer1Client l1connection.Client WaspClient *apiclient.APIClient ChainID isc.ChainID KeyPair *cryptolib.KeyPair // contains filtered or unexported fields }
Client allows to interact with a specific chain in the node, for example to send on-ledger or off-ledger requests
func New ¶
func New( layer1Client l1connection.Client, waspClient *apiclient.APIClient, chainID isc.ChainID, keyPair *cryptolib.KeyPair, ) *Client
New creates a new chainclient.Client
func (*Client) CallView ¶
func (c *Client) CallView(ctx context.Context, hContract isc.Hname, functionName string, args 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) CheckRequestResult ¶
CheckRequestResult fetches the receipt for the given request ID, and returns an error indicating whether the request was processed successfully.
func (*Client) DepositFunds ¶
func (c *Client) DepositFunds(n uint64) (*iotago.Transaction, error)
func (*Client) GetChainRecord ¶
GetChainRecord fetches the chain's Record
func (*Client) Post1Request ¶
func (c *Client) Post1Request( contractHname isc.Hname, entryPoint isc.Hname, params ...PostRequestParams, ) (*iotago.Transaction, error)
Post1Request sends an on-ledger transaction with one request on it to the chain
func (*Client) PostNRequests ¶
func (c *Client) PostNRequests( contractHname isc.Hname, entryPoint isc.Hname, requestsCount int, params ...PostRequestParams, ) ([]*iotago.Transaction, error)
PostNRequest sends n consecutive on-ledger transactions with one request on each, to the chain
func (*Client) PostOffLedgerRequest ¶
func (c *Client) PostOffLedgerRequest(context context.Context, contractHname isc.Hname, entrypoint isc.Hname, params ...PostRequestParams, ) (isc.OffLedgerRequest, error)
PostOffLedgerRequest sends an off-ledger tx via the wasp node web api
func (*Client) RequestIDByEVMTransactionHash ¶
func (*Client) StateGet ¶
StateGet fetches the raw value associated with the given key in the chain state
func (*Client) UploadBlob ¶
func (c *Client) UploadBlob(ctx context.Context, fields dict.Dict) (hashing.HashValue, isc.OffLedgerRequest, *apiclient.ReceiptResponse, error)
UploadBlob sends an off-ledger request to call 'store' in the blob contract.
type PostRequestParams ¶
type PostRequestParams struct { Transfer *isc.Assets Args dict.Dict Nonce uint64 NFT *isc.NFT Allowance *isc.Assets GasBudget *uint64 AutoAdjustStorageDeposit bool }
func NewPostRequestParams ¶
func NewPostRequestParams(p ...interface{}) *PostRequestParams
NewPostRequestParams simplifies encoding of request parameters
func (*PostRequestParams) WithBaseTokens ¶
func (par *PostRequestParams) WithBaseTokens(i uint64) *PostRequestParams
func (*PostRequestParams) WithGasBudget ¶
func (par *PostRequestParams) WithGasBudget(budget uint64) *PostRequestParams
func (*PostRequestParams) WithTransfer ¶
func (par *PostRequestParams) WithTransfer(transfer *isc.Assets) *PostRequestParams