Documentation ¶
Index ¶
- func NewBlock(hash string, txs []Transaction) *block
- func NewFailureResponse(code int, message string, data []byte) *failureResponse
- func NewSuccessResponse(result []byte, txID string) *successResponse
- func NewTransaction(id string, reason string, event []byte, ccID string) *transaction
- func UnmarshalProto(src []byte, dst interface{}) error
- type Block
- type Config
- type Error
- type RequestOptions
- type ShiroClient
- type ShiroResponse
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBlock ¶
func NewBlock(hash string, txs []Transaction) *block
func NewFailureResponse ¶
func NewSuccessResponse ¶
func NewTransaction ¶
func UnmarshalProto ¶
UnmarshalProto attempts to unmarshal protobuf bytes with backwards compatability.
Types ¶
type Block ¶
type Block interface { Hash() string Transactions() []Transaction }
Block is a wrapper for summary information about a block.
type Config ¶
type Config interface {
Fn(*RequestOptions)
}
Config is a type for a function that can mutate a types.RequestOptions object.
func Opt ¶ added in v0.5.2
func Opt(fn func(r *RequestOptions)) Config
Opt creates a standard configuration option.
type Error ¶
type Error interface { error // Code returns a numeric code categorizing the error. Code() int // Message returns a generic error message that corresponds to the // error Code. Message() string // DataJSON returns JSON data returned by the application with the // error, if any was provided. The slice returned by DataJSON will // either be empty or it will contain valid serialized JSON data. DataJSON() []byte }
Error is a generic application error.
type RequestOptions ¶
type RequestOptions struct { HTTPClient *http.Client Log *logrus.Logger LogFields logrus.Fields Headers map[string]string Endpoint string ID string AuthToken string Params interface{} Transient map[string][]byte Target *interface{} TimestampGenerator func(context.Context) string MspFilter []string TargetEndpoints []string MinEndorsers int Creator string DependentTxID string DisableWritePolling bool CcFetchURLDowngrade bool CcFetchURLProxy *url.URL DependentBlock string PhylumVersion string NewPhylumVersion string }
RequestOptions are operated on by the Config functions generated by the With* functions. There is no need for a consumer of this library to directly manipulate objects of this type.
func ApplyConfigs ¶
func ApplyConfigs(log *logrus.Logger, configs ...Config) *RequestOptions
type ShiroClient ¶
type ShiroClient interface { // Seed re-opens the ShiroClient, specifying the phylum version to // target. Seed(ctx context.Context, version string, config ...Config) error // ShiroPhylum returns a non-empty string which should act as an // indentifier indicating the deployed phylum code being executed by // the shiro server. ShiroPhylum(ctx context.Context, config ...Config) (string, error) // Init initializes the chaincode given a string containing // base64-encoded phylum code. The phylum code should be deployed // with the identifier returned by method ShiroPhylum(). Init(ctx context.Context, phylum string, config ...Config) error // Call executes method with the given parameters and commits the // results. The method shuold be executed by the phylum code // matching the identifier returned by method ShiroPhylum(). // // Caller may specify transient data that is accessible to the // chaincode but not comitted on to the blockchain. Call(ctx context.Context, method string, config ...Config) (ShiroResponse, error) // QueryInfo returns the blockchain height. QueryInfo(ctx context.Context, config ...Config) (uint64, error) // QueryBlock returns summary information about the block given by // blockNumber. QueryBlock(ctx context.Context, blockNumber uint64, config ...Config) (Block, error) }
ShiroClient is an abstraction for a connection to a blockchain-based smart contract execution engine. Currently, the "phylum" code must be written in a LISP dialect known as Elps.