wasmclient

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0, BSD-2-Clause, Apache-2.0, + 1 more Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_ADDRESS    int32 = 1
	TYPE_AGENT_ID   int32 = 2
	TYPE_BOOL       int32 = 3
	TYPE_BYTES      int32 = 4
	TYPE_CHAIN_ID   int32 = 5
	TYPE_COLOR      int32 = 6
	TYPE_HASH       int32 = 7
	TYPE_HNAME      int32 = 8
	TYPE_INT8       int32 = 9
	TYPE_INT16      int32 = 10
	TYPE_INT32      int32 = 11
	TYPE_INT64      int32 = 12
	TYPE_MAP        int32 = 13
	TYPE_REQUEST_ID int32 = 14
	TYPE_STRING     int32 = 15

	COLOR_IOTA        = "IOTA"
	COLOR_IOTA_BASE58 = "11111111111111111111111111111111"
)

Variables

View Source
var TypeSizes = [...]uint8{0, 33, 37, 1, 0, 33, 32, 32, 4, 1, 2, 4, 8, 0, 34, 0}

Functions

func Base58Decode

func Base58Decode(s string) []byte

func Base58Encode

func Base58Encode(b []byte) string

func ChainIsValid

func ChainIsValid(chainID string) bool

func SeedIsValid

func SeedIsValid(mySeed string) bool

func SeedToKeyPair

func SeedToKeyPair(mySeed string, index uint64) *cryptolib.KeyPair

Types

type Address

type Address string

func SeedToAddress

func SeedToAddress(mySeed string, index uint64) Address

type AgentID

type AgentID string

func SeedToAgentID

func SeedToAgentID(mySeed string, index uint64) AgentID

type ArgMap

type ArgMap dict.Dict

func (ArgMap) Get

func (m ArgMap) Get(key string) []byte

func (ArgMap) Set

func (m ArgMap) Set(key string, value []byte)

type Arguments

type Arguments struct {
	Encoder
	// contains filtered or unexported fields
}

The Arguments struct is used to gather all arguments for a smart contract function call and encode it into a deterministic byte array

func (*Arguments) IndexedKey

func (a *Arguments) IndexedKey(key string, index int) string

func (*Arguments) Mandatory

func (a *Arguments) Mandatory(key string)

func (*Arguments) Set

func (a *Arguments) Set(key string, val []byte)

type ChainID

type ChainID string

type ClientFunc

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

func (*ClientFunc) OnLedgerRequest

func (f *ClientFunc) OnLedgerRequest(onLedger bool)

OnLedgerRequest can override the default off-ledger to on-ledger posting

func (*ClientFunc) Post

func (f *ClientFunc) Post(hFuncName uint32, args *Arguments) Request

Post sends a request to the smart contract service You can wait for the request to complete by using the returned Request as parameter to Service.WaitRequest()

func (*ClientFunc) Sign

func (f *ClientFunc) Sign(keyPair *cryptolib.KeyPair)

Sign optionally overrides the default keypair from the service

func (*ClientFunc) Transfer

func (f *ClientFunc) Transfer(xfer *Transfer)

Transfer optionally indicates which tokens to transfer as part of the request The tokens are presumed to be available in the signing account on the chain

type ClientView

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

func (*ClientView) Call

func (v *ClientView) Call(viewName string, args *Arguments)

func (*ClientView) Error

func (v *ClientView) Error() error

func (*ClientView) Results

func (v *ClientView) Results() Results

type Color

type Color string

type Decoder

type Decoder struct{}

func (Decoder) ToAddress

func (c Decoder) ToAddress(bytes []byte) Address

func (Decoder) ToAgentID

func (c Decoder) ToAgentID(bytes []byte) AgentID

func (Decoder) ToBool

func (c Decoder) ToBool(bytes []byte) bool

func (Decoder) ToBytes

func (c Decoder) ToBytes(bytes []byte) []byte

func (Decoder) ToChainID

func (c Decoder) ToChainID(bytes []byte) ChainID

func (Decoder) ToColor

func (c Decoder) ToColor(bytes []byte) Color

func (Decoder) ToHash

func (c Decoder) ToHash(bytes []byte) Hash

func (Decoder) ToHname

func (c Decoder) ToHname(bytes []byte) Hname

func (Decoder) ToInt16

func (c Decoder) ToInt16(bytes []byte) int16

func (Decoder) ToInt32

func (c Decoder) ToInt32(bytes []byte) int32

func (Decoder) ToInt64

func (c Decoder) ToInt64(bytes []byte) int64

func (Decoder) ToInt8

func (c Decoder) ToInt8(bytes []byte) int8

func (Decoder) ToRequestID

func (c Decoder) ToRequestID(bytes []byte) RequestID

func (Decoder) ToString

func (c Decoder) ToString(bytes []byte) string

func (Decoder) ToUint16

func (c Decoder) ToUint16(bytes []byte) uint16

func (Decoder) ToUint32

func (c Decoder) ToUint32(bytes []byte) uint32

func (Decoder) ToUint64

func (c Decoder) ToUint64(bytes []byte) uint64

func (Decoder) ToUint8

func (c Decoder) ToUint8(bytes []byte) uint8

type Encoder

type Encoder struct{}

func (Encoder) FromAddress

func (c Encoder) FromAddress(value Address) []byte

func (Encoder) FromAgentID

func (c Encoder) FromAgentID(value AgentID) []byte

func (Encoder) FromBool

func (c Encoder) FromBool(value bool) []byte

func (Encoder) FromBytes

func (c Encoder) FromBytes(value []byte) []byte

func (Encoder) FromChainID

func (c Encoder) FromChainID(value ChainID) []byte

func (Encoder) FromColor

func (c Encoder) FromColor(value Color) []byte

func (Encoder) FromHash

func (c Encoder) FromHash(value Hash) []byte

func (Encoder) FromHname

func (c Encoder) FromHname(value Hname) []byte

func (Encoder) FromInt16

func (c Encoder) FromInt16(value int16) []byte

func (Encoder) FromInt32

func (c Encoder) FromInt32(value int32) []byte

func (Encoder) FromInt64

func (c Encoder) FromInt64(value int64) []byte

func (Encoder) FromInt8

func (c Encoder) FromInt8(value int8) []byte

func (Encoder) FromRequestID

func (c Encoder) FromRequestID(value RequestID) []byte

func (Encoder) FromString

func (c Encoder) FromString(value string) []byte

func (Encoder) FromUint16

func (c Encoder) FromUint16(value uint16) []byte

func (Encoder) FromUint32

func (c Encoder) FromUint32(value uint32) []byte

func (Encoder) FromUint64

func (c Encoder) FromUint64(value uint64) []byte

func (Encoder) FromUint8

func (c Encoder) FromUint8(value uint8) []byte

type Event

type Event struct {
	Timestamp uint32
	// contains filtered or unexported fields
}

func (*Event) Init

func (e *Event) Init(message []string)

func (*Event) NextAddress

func (e *Event) NextAddress() Address

func (*Event) NextAgentID

func (e *Event) NextAgentID() AgentID

func (*Event) NextBool

func (e *Event) NextBool() bool

func (*Event) NextBytes

func (e *Event) NextBytes() []byte

func (*Event) NextChainID

func (e *Event) NextChainID() ChainID

func (*Event) NextColor

func (e *Event) NextColor() Color

func (*Event) NextHash

func (e *Event) NextHash() Hash

func (*Event) NextHname

func (e *Event) NextHname() Hname

func (*Event) NextInt16

func (e *Event) NextInt16() int16

func (*Event) NextInt32

func (e *Event) NextInt32() int32

func (*Event) NextInt64

func (e *Event) NextInt64() int64

func (*Event) NextInt8

func (e *Event) NextInt8() int8

func (*Event) NextRequestID

func (e *Event) NextRequestID() RequestID

func (*Event) NextString

func (e *Event) NextString() string

func (*Event) NextUint16

func (e *Event) NextUint16() uint16

func (*Event) NextUint32

func (e *Event) NextUint32() uint32

func (*Event) NextUint64

func (e *Event) NextUint64() uint64

func (*Event) NextUint8

func (e *Event) NextUint8() uint8

type Hash

type Hash string

type Hname

type Hname uint32

type IEventHandler

type IEventHandler interface {
	CallHandler(topic string, params []string)
}

type Request

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

func (Request) Error

func (r Request) Error() error

type RequestID

type RequestID string

type ResMap

type ResMap dict.Dict

func (ResMap) Get

func (m ResMap) Get(key string) []byte

type Results

type Results struct {
	Decoder
	// contains filtered or unexported fields
}

The Results struct contains the results from a smart contract function call

func (Results) Exists

func (r Results) Exists(key string) bool

func (Results) ForEach

func (r Results) ForEach(keyValue func(key []byte, val []byte))

func (Results) Get

func (r Results) Get(key string) []byte

type Service

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

func (*Service) AsClientFunc

func (s *Service) AsClientFunc() ClientFunc

func (*Service) AsClientView

func (s *Service) AsClientView() ClientView

func (*Service) CallView

func (s *Service) CallView(viewName string, args ArgMap) (ResMap, error)

func (*Service) Init

func (s *Service) Init(svcClient *ServiceClient, chainID string, scHname uint32) (err error)

func (*Service) PostRequest

func (s *Service) PostRequest(hFuncName uint32, args ArgMap, transfer *Transfer, keyPair *cryptolib.KeyPair, onLedger bool) Request

func (*Service) Register

func (s *Service) Register(handler IEventHandler)

func (*Service) ServiceContractName

func (s *Service) ServiceContractName(contractName string)

overrides default contract name

func (*Service) SignRequests

func (s *Service) SignRequests(keyPair *cryptolib.KeyPair)

func (*Service) Unegister

func (s *Service) Unegister(handler IEventHandler)

func (*Service) WaitRequest

func (s *Service) WaitRequest(req Request) error

type ServiceClient

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

func DefaultServiceClient

func DefaultServiceClient() *ServiceClient

func NewServiceClient

func NewServiceClient(waspAPI, eventPort string) *ServiceClient

type Transfer

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

func NewTransfer

func NewTransfer() *Transfer

func TransferIotas

func TransferIotas(amount uint64) *Transfer

func TransferTokens

func TransferTokens(color string, amount uint64) *Transfer

func (*Transfer) Set

func (t *Transfer) Set(color string, amount uint64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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