types

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessRightRead AccessRight = 1 << iota
	AccessRightWrite
	AccessRightAdd
	AccessRightReadWrite                = AccessRightRead | AccessRightWrite
	AccessRightReadAdd                  = AccessRightRead | AccessRightAdd
	AccessRightAddWrite                 = AccessRightAdd | AccessRightWrite
	AccessRightReadAddWrite             = AccessRightRead | AccessRightAdd | AccessRightWrite
	AccessRightNone         AccessRight = 0

	URefPrefix = "uref-"
)

Variables

This section is empty.

Functions

func UnmarshalCLValue

func UnmarshalCLValue(src []byte, dest *CLValue) (int, error)

Types

type AccessRight

type AccessRight byte

type CLMap

type CLMap struct {
	KeyType   CLType
	ValueType CLType
	// key of the map is encoded CLValue of the KeyType type
	Raw map[string]CLValue
}

func (CLMap) Marshal

func (clmap CLMap) Marshal(w io.Writer) (int, error)

type CLType

type CLType byte
const (
	CLTypeBool CLType = iota
	CLTypeI32
	CLTypeI64
	CLTypeU8
	CLTypeU32
	CLTypeU64
	CLTypeU128
	CLTypeU256
	CLTypeU512
	CLTypeUnit
	CLTypeString
	CLTypeKey
	CLTypeURef
	CLTypeOption
	CLTypeList
	CLTypeByteArray
	CLTypeResult
	CLTypeMap
	CLTypeTuple1
	CLTypeTuple2
	CLTypeTuple3
	CLTypeAny
	CLTypePublicKey
)

func FromString

func FromString(clType string) CLType

func (CLType) ToString

func (t CLType) ToString() string

type CLValue

type CLValue struct {
	Type      CLType
	Bool      *bool
	I32       *int32
	I64       *int64
	U8        *byte
	U32       *uint32
	U64       *uint64
	U128      *big.Int
	U256      *big.Int
	U512      *big.Int
	String    *string
	Key       *Key
	URef      *URef
	Option    *CLValue
	List      *[]CLValue
	ByteArray *FixedByteArray
	Result    *CLValueResult
	Map       *CLMap
	Tuple1    *[1]CLValue
	Tuple2    *[2]CLValue
	Tuple3    *[3]CLValue
	PublicKey *keypair.PublicKey
}

func (CLValue) ArmForSwitch

func (v CLValue) ArmForSwitch(sw byte) (string, bool)

func (CLValue) SwitchFieldName

func (v CLValue) SwitchFieldName() string

type CLValueResult

type CLValueResult struct {
	IsSuccess bool
	Success   *CLValue
	Error     *CLValue
}

CLValueResult representing a result of an operation that might have failed

func (CLValueResult) ErrorFieldName

func (r CLValueResult) ErrorFieldName() string

func (CLValueResult) ResultFieldName

func (r CLValueResult) ResultFieldName() string

func (CLValueResult) SuccessFieldName

func (r CLValueResult) SuccessFieldName() string

type FixedByteArray

type FixedByteArray []byte

func (FixedByteArray) Marshal

func (c FixedByteArray) Marshal(w io.Writer) (int, error)

type Key

type Key struct {
	Type       KeyType
	Account    [32]byte
	Hash       [32]byte
	URef       *URef
	Transfer   [32]byte
	DeployInfo [32]byte
	EraId      *uint64
	Balance    [32]byte
	Bid        [32]byte
	Withdraw   [32]byte
}

Key represents key structure

func (Key) ArmForSwitch

func (u Key) ArmForSwitch(sw byte) (string, bool)

func (Key) Marshal

func (u Key) Marshal(w io.Writer) (int, error)

func (Key) SwitchFieldName

func (u Key) SwitchFieldName() string

func (*Key) Unmarshal

func (u *Key) Unmarshal(data []byte) (int, error)

type KeyType

type KeyType byte
const (
	KeyTypeAccount KeyType = iota
	KeyTypeHash
	KeyTypeURef
	KeyTypeTransfer
	KeyTypeDeployInfo
	KeyTypeEraId
	KeyTypeBalance
	KeyTypeBid
	KeyTypeWithdraw
)

type Signature

type Signature struct {
	Tag           keypair.KeyTag
	SignatureData []byte
}

Signature representing signature

func (Signature) Marshal

func (key Signature) Marshal(w io.Writer) (int, error)

type URef

type URef struct {
	AccessRight AccessRight
	Address     [32]byte
}

func URefFromFormattedString

func URefFromFormattedString(str string) (*URef, error)

func (URef) Marshal

func (uRef URef) Marshal(w io.Writer) (int, error)

func (URef) ToFormattedString

func (uRef URef) ToFormattedString() string

func (*URef) Unmarshal

func (uRef *URef) Unmarshal(data []byte) (int, error)

Jump to

Keyboard shortcuts

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