client

package
v0.0.0-...-b762155 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 6 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 {
	// contains filtered or unexported fields
}

Client is implementation of Kadena API.

func New

func New(config Config) *Client

New is constructor for Kadena API client.

func (*Client) TxsResult

func (client *Client) TxsResult(ctx context.Context, commandsResult CommandsResultRequest) (_ map[string]CommandsResultResponse, err error)

TxsResult pulls for one or more command results by request key.

type CommandsResultRequest

type CommandsResultRequest struct {
	RequestKeys []string `json:"requestKeys"`
}

CommandsResultRequest holds unique IDs of a pact transaction consisting of its hash.

type CommandsResultResponse

type CommandsResultResponse struct {
	Gas      int      `json:"gas"`
	ReqKey   string   `json:"reqKey"`
	Result   Result   `json:"result"`
	TxID     int64    `json:"txId"`
	Logs     string   `json:"logs"`
	Metadata Metadata `json:"metaData"`
	Events
	Continuation Continuation `json:"continuation"`
}

CommandsResultResponse holds response for single tx which have been pulled.

type Config

type Config struct {
	NodeAddress string
	ChainName   string `help:"testnet01"`
	ChainID     int
	APIVersion  string `default:"0.0"`
}

Config contains Kadena client configurable parameters.

type Continuation

type Continuation struct {
	PactID          string `json:"pactId"`
	Step            int    `json:"step"`
	StepCount       int    `json:"stepCount"`
	Executed        bool   `json:"executed"`
	StepHasRollback bool   `json:"stepHasRollback"`
}

Continuation describes result of a defpact execution.

type Events

type Events struct {
	Name       string      `json:"name"`
	Module     Module      `json:"module"`
	ModuleHash string      `json:"moduleHash"`
	Params     interface{} `json:"params"`
}

Events holds all event specific characteristic.

type Metadata

type Metadata struct {
	BlockTime     int64  `json:"blockTime" help:"UNIX number"`
	PrevBlockHash string `json:"prevBlockHash"`
	BlockHash     string `json:"blockHash"`
	BlockHeight   int64  `json:"blockHeight"`
}

Metadata contains tx metadata.

type Module

type Module struct {
	Namespace interface{} `json:"namespace"`
	Name      string      `json:"name"`
}

Module defines module name where event occurred.

type Result

type Result struct {
	Status Status      `json:"status"`
	Data   interface{} `json:"data"`
}

Result consists tx status with error message/data if it's required.

type Status

type Status string

Status is list of all possible tx status.

const (
	// StatusSuccess is status for successful tx.
	StatusSuccess Status = "success"
	// StatusFailure is status for failed tx.
	StatusFailure Status = "failure"
)

Jump to

Keyboard shortcuts

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