agent

package module
v0.0.0-...-9a6596d Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

Go Agent for the Internet Computer

Documentation

Index

Constants

View Source
const (
	Empty byte = iota
	Fork
	Labeled
	Leaf
	Pruned
)
View Source
const IC_REQUEST_DOMAIN_SEPARATOR = "\x0Aic-request"
View Source
const IC_STATE_ROOT_DOMAIN_SEPARATOR = "\x0Dic-state-root"

Variables

This section is empty.

Functions

func LookUp

func LookUp(paths [][]byte, cert []byte) ([]byte, error)

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

func New

func New(anonymous bool, privKey string) *Agent

func (*Agent) QueryRaw

func (agent *Agent) QueryRaw(canisterID, methodName string, arg []byte) ([]idl.Type, []interface{}, string, error)

func (*Agent) Sender

func (agent *Agent) Sender() principal.Principal

func (*Agent) UpdateRaw

func (agent *Agent) UpdateRaw(canisterID, methodName string, arg []byte) ([]idl.Type, []interface{}, error)

type Certificate

type Certificate struct {
	Tree       Tree   `cbor:"tree"`
	Signature  []byte `cbor:"signature"`
	Delegation []byte `cbor:"delegation"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string) Client

func (*Client) Status

func (c *Client) Status() (Status, error)

type Envelope

type Envelope struct {
	Content      Request `cbor:"content,omitempty"`
	SenderPubkey []byte  `cbor:"sender_pubkey,omitempty"`
	SenderSig    []byte  `cbor:"sender_sig,omitempty"`
}

type Implementation

type Implementation struct {
	// Source is the canonical location of the source code.
	Source string
	// Version is the version number of the implementation.
	Version string
	// Revision is the precise git revision of the implementation.
	Revision string
}

Implementation identifies the implementation of the Internet Computer.

type QueryResponse

type QueryResponse struct {
	Status     string            `cbor:"status"`
	Reply      map[string][]byte `cbor:"reply"`
	RejectCode uint64            `cbor:"reject_code"`
	RejectMsg  string            `cbor:"reject_message"`
}

type Request

type Request struct {
	Type RequestType `cbor:"request_type,omitempty"`
	// The user who issued the request.
	Sender principal.Principal `cbor:"sender,omitempty"`
	// Arbitrary user-provided data, typically randomly generated. This can be
	// used to create distinct requests with otherwise identical fields.
	Nonce []byte `cbor:"nonce,omitempty"`
	// An upper limit on the validity of the request, expressed in nanoseconds
	// since 1970-01-01 (like ic0.time()).
	IngressExpiry uint64 `cbor:"ingress_expiry,omitempty"`
	// The principal of the canister to call.
	CanisterID principal.Principal `cbor:"canister_id"`
	// Name of the canister method to call.
	MethodName string `cbor:"method_name,omitempty"`
	// Argument to pass to the canister method.
	Arguments []byte `cbor:"arg,omitempty"`
	// Paths (sequence of paths): A list of paths, where a path is itself a sequence of blobs.
	Paths [][][]byte `cbor:"paths,omitempty"`
}

DOCS: https://smartcontracts.org/docs/interface-spec/index.html#http-call

type RequestID

type RequestID [32]byte

func EncodeRequestID

func EncodeRequestID(request map[string]interface{}) RequestID

type RequestType

type RequestType = string
const (
	RequestTypeCall      RequestType = "call"
	RequestTypeQuery     RequestType = "query"
	RequestTypeReadState RequestType = "read_state"
)

type Status

type Status struct {
	// Identifies the interface version supported.
	Version string
	// Impl describes the implementation of the Internet Computer.
	Impl *Implementation
	// The public identity (a DER-encoded BLS identity) of the root identity of this Internet Computer instance.
	RootKey []byte
}

Status describes various status fields of the Internet Computer.

func (*Status) UnmarshalCBOR

func (s *Status) UnmarshalCBOR(data []byte) error

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
internal
idl

Jump to

Keyboard shortcuts

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