cadence

package module
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 11 Imported by: 326

README

Cadence

Introduction

Cadence is a resource-oriented programming language that introduces new features to smart contract programming that help developers ensure that their code is safe, secure, clear, and approachable.

Some of these features are:

  • Type safety and a strong static type system
  • Resource-oriented programming, a new paradigm that pairs linear types with object capabilities to create a secure and declarative model for digital ownership by ensuring that resources (and their associated assets) can only exist in one location at a time, cannot be copied, and cannot be accidentally lost or deleted
  • Built-in pre-conditions and post-conditions for functions and transactions
  • The utilization of capability-based security, which enforces access control by requiring that access to objects is restricted to only the owner and those who have a valid reference to the object

Getting Started

To get started writing Cadence, try it out in the Playground.

If you want to develop locally, install the Flow Command Line Client, which provides the Flow emulator and the Visual Studio Code extension. The emulator is a lightweight tool that emulates the behaviour of the real Flow network. The Visual Studio Code extension enables the development, deployment of, and interaction with Cadence contracts.

Documentation

To read more about Cadence, have a look at the language reference on the Flow documentation site.

Contributing

If you would like to contribute to Cadence, have a look at the contributing guide.

Development documentation can be found in the docs directory. For example, it contains the source for the language reference.

Documentation

Index

Constants

View Source
const AddressLength = 8
View Source
const Version = "v0.14.1"

Variables

This section is empty.

Functions

func CastToArray

func CastToArray(value Value) ([]interface{}, error)

func CastToInt

func CastToInt(value Value) (int, error)

func CastToString

func CastToString(value Value) (string, error)

func CastToUInt16

func CastToUInt16(value Value) (uint16, error)

func CastToUInt8

func CastToUInt8(value Value) (uint8, error)

func Fuzz

func Fuzz(data []byte) int

Types

type Address

type Address [AddressLength]byte

func BytesToAddress

func BytesToAddress(b []byte) Address

func NewAddress

func NewAddress(b [AddressLength]byte) Address

func (Address) Bytes

func (v Address) Bytes() []byte

func (Address) Hex

func (v Address) Hex() string

func (Address) String

func (v Address) String() string

func (Address) ToGoValue

func (v Address) ToGoValue() interface{}

func (Address) Type

func (Address) Type() Type

type AddressType

type AddressType struct{}

func (AddressType) ID

func (AddressType) ID() string

type AnyResourceType

type AnyResourceType struct{}

func (AnyResourceType) ID

func (AnyResourceType) ID() string

type AnyStructType

type AnyStructType struct{}

func (AnyStructType) ID

func (AnyStructType) ID() string

type AnyType

type AnyType struct{}

func (AnyType) ID

func (AnyType) ID() string

type Array

type Array struct {
	Values []Value
	// contains filtered or unexported fields
}

func NewArray

func NewArray(values []Value) Array

func (Array) String added in v0.12.0

func (v Array) String() string

func (Array) ToGoValue

func (v Array) ToGoValue() interface{}

func (Array) Type

func (v Array) Type() Type

type ArrayType

type ArrayType interface {
	Element() Type
}

type AuthAccountType added in v0.7.0

type AuthAccountType struct{}

func (AuthAccountType) ID added in v0.7.0

func (AuthAccountType) ID() string

type BlockType added in v0.7.0

type BlockType struct{}

func (BlockType) ID added in v0.7.0

func (BlockType) ID() string

type Bool

type Bool bool

func NewBool

func NewBool(b bool) Bool

func (Bool) String added in v0.12.0

func (v Bool) String() string

func (Bool) ToGoValue

func (v Bool) ToGoValue() interface{}

func (Bool) Type

func (Bool) Type() Type

type BoolType

type BoolType struct{}

func (BoolType) ID

func (BoolType) ID() string

type Bytes

type Bytes []byte

func NewBytes

func NewBytes(b []byte) Bytes

func (Bytes) String added in v0.12.0

func (v Bytes) String() string

func (Bytes) ToGoValue

func (v Bytes) ToGoValue() interface{}

func (Bytes) Type

func (Bytes) Type() Type

type BytesType

type BytesType struct{}

func (BytesType) ID

func (BytesType) ID() string

type Capability added in v0.10.0

type Capability struct {
	Path    Path
	Address Address
	// TODO: a future version might want to export the whole type
	BorrowType string
}

func (Capability) String added in v0.12.0

func (v Capability) String() string

func (Capability) ToGoValue added in v0.10.0

func (Capability) ToGoValue() interface{}

func (Capability) Type added in v0.10.0

func (Capability) Type() Type

type CapabilityPathType added in v0.11.0

type CapabilityPathType struct{}

func (CapabilityPathType) ID added in v0.11.0

type CapabilityType added in v0.7.0

type CapabilityType struct {
	BorrowType Type
	// contains filtered or unexported fields
}

func (CapabilityType) ID added in v0.7.0

func (t CapabilityType) ID() string

func (CapabilityType) WithID added in v0.7.0

func (t CapabilityType) WithID(id string) CapabilityType

type CharacterType added in v0.7.0

type CharacterType struct{}

func (CharacterType) ID added in v0.7.0

func (CharacterType) ID() string

type CompositeType

type CompositeType interface {
	Type

	CompositeTypeLocation() common.Location
	CompositeTypeQualifiedIdentifier() string
	CompositeFields() []Field
	CompositeInitializers() [][]Parameter
	// contains filtered or unexported methods
}

type ConstantSizedArrayType

type ConstantSizedArrayType struct {
	Size        uint
	ElementType Type
}

func (ConstantSizedArrayType) Element

func (v ConstantSizedArrayType) Element() Type

func (ConstantSizedArrayType) ID

type Contract added in v0.6.0

type Contract struct {
	ContractType *ContractType
	Fields       []Value
}

func NewContract added in v0.6.0

func NewContract(fields []Value) Contract

func (Contract) String added in v0.12.0

func (v Contract) String() string

func (Contract) ToGoValue added in v0.6.0

func (v Contract) ToGoValue() interface{}

func (Contract) Type added in v0.6.0

func (v Contract) Type() Type

func (Contract) WithType added in v0.6.0

func (v Contract) WithType(typ *ContractType) Contract

type ContractInterfaceType added in v0.7.0

type ContractInterfaceType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializers        [][]Parameter
}

func (*ContractInterfaceType) ID added in v0.7.0

func (t *ContractInterfaceType) ID() string

func (*ContractInterfaceType) InterfaceFields added in v0.7.0

func (t *ContractInterfaceType) InterfaceFields() []Field

func (*ContractInterfaceType) InterfaceInitializers added in v0.7.0

func (t *ContractInterfaceType) InterfaceInitializers() [][]Parameter

func (*ContractInterfaceType) InterfaceTypeLocation added in v0.12.0

func (t *ContractInterfaceType) InterfaceTypeLocation() common.Location

func (*ContractInterfaceType) InterfaceTypeQualifiedIdentifier added in v0.12.0

func (t *ContractInterfaceType) InterfaceTypeQualifiedIdentifier() string

type ContractType added in v0.6.0

type ContractType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializers        [][]Parameter
}

func (*ContractType) CompositeFields added in v0.6.0

func (t *ContractType) CompositeFields() []Field

func (*ContractType) CompositeInitializers added in v0.6.0

func (t *ContractType) CompositeInitializers() [][]Parameter

func (*ContractType) CompositeTypeLocation added in v0.12.0

func (t *ContractType) CompositeTypeLocation() common.Location

func (*ContractType) CompositeTypeQualifiedIdentifier added in v0.12.0

func (t *ContractType) CompositeTypeQualifiedIdentifier() string

func (*ContractType) ID added in v0.6.0

func (t *ContractType) ID() string

type Dictionary

type Dictionary struct {
	Pairs []KeyValuePair
	// contains filtered or unexported fields
}

func NewDictionary

func NewDictionary(pairs []KeyValuePair) Dictionary

func (Dictionary) String added in v0.12.0

func (v Dictionary) String() string

func (Dictionary) ToGoValue

func (v Dictionary) ToGoValue() interface{}

func (Dictionary) Type

func (v Dictionary) Type() Type

type DictionaryType

type DictionaryType struct {
	KeyType     Type
	ElementType Type
}

func (DictionaryType) ID

func (t DictionaryType) ID() string

type Enum added in v0.14.0

type Enum struct {
	EnumType *EnumType
	Fields   []Value
}

Enum

func NewEnum added in v0.14.0

func NewEnum(fields []Value) Enum

func (Enum) String added in v0.14.0

func (v Enum) String() string

func (Enum) ToGoValue added in v0.14.0

func (v Enum) ToGoValue() interface{}

func (Enum) Type added in v0.14.0

func (v Enum) Type() Type

func (Enum) WithType added in v0.14.0

func (v Enum) WithType(typ *EnumType) Enum

type EnumType added in v0.14.0

type EnumType struct {
	Location            common.Location
	QualifiedIdentifier string
	RawType             Type
	Fields              []Field
	Initializers        [][]Parameter
}

EnumType

func (*EnumType) CompositeFields added in v0.14.0

func (t *EnumType) CompositeFields() []Field

func (*EnumType) CompositeInitializers added in v0.14.0

func (t *EnumType) CompositeInitializers() [][]Parameter

func (*EnumType) CompositeTypeLocation added in v0.14.0

func (t *EnumType) CompositeTypeLocation() common.Location

func (*EnumType) CompositeTypeQualifiedIdentifier added in v0.14.0

func (t *EnumType) CompositeTypeQualifiedIdentifier() string

func (*EnumType) ID added in v0.14.0

func (t *EnumType) ID() string

type Event

type Event struct {
	EventType *EventType
	Fields    []Value
}

func NewEvent

func NewEvent(fields []Value) Event

func (Event) String added in v0.12.0

func (v Event) String() string

func (Event) ToGoValue

func (v Event) ToGoValue() interface{}

func (Event) Type

func (v Event) Type() Type

func (Event) WithType

func (v Event) WithType(typ *EventType) Event

type EventPointer

type EventPointer struct {
	TypeName string
}

func (EventPointer) ID

func (t EventPointer) ID() string

type EventType

type EventType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializer         []Parameter
}

func (*EventType) CompositeFields

func (t *EventType) CompositeFields() []Field

func (*EventType) CompositeInitializers

func (t *EventType) CompositeInitializers() [][]Parameter

func (*EventType) CompositeTypeLocation added in v0.12.0

func (t *EventType) CompositeTypeLocation() common.Location

func (*EventType) CompositeTypeQualifiedIdentifier added in v0.12.0

func (t *EventType) CompositeTypeQualifiedIdentifier() string

func (*EventType) ID

func (t *EventType) ID() string

type Field

type Field struct {
	Identifier string
	Type       Type
}

type Fix64

type Fix64 int64

func NewFix64

func NewFix64(s string) (Fix64, error)

func NewFix64FromParts added in v0.5.0

func NewFix64FromParts(negative bool, integer int, fraction uint) (Fix64, error)

func (Fix64) String added in v0.12.0

func (v Fix64) String() string

func (Fix64) ToBigEndianBytes added in v0.5.0

func (v Fix64) ToBigEndianBytes() []byte

func (Fix64) ToGoValue

func (v Fix64) ToGoValue() interface{}

func (Fix64) Type

func (Fix64) Type() Type

type Fix64Type

type Fix64Type struct{}

func (Fix64Type) ID

func (Fix64Type) ID() string

type FixedPointType added in v0.7.0

type FixedPointType struct{}

func (FixedPointType) ID added in v0.7.0

func (FixedPointType) ID() string

type Function

type Function struct {
	Parameters []Parameter
	ReturnType Type
	// contains filtered or unexported fields
}

func (Function) ID

func (t Function) ID() string

func (Function) WithID

func (t Function) WithID(id string) Function

type Int

type Int struct {
	Value *big.Int
}

func NewInt

func NewInt(i int) Int

func NewIntFromBig

func NewIntFromBig(i *big.Int) Int

func (Int) Big

func (v Int) Big() *big.Int

func (Int) Int

func (v Int) Int() int

func (Int) String added in v0.12.0

func (v Int) String() string

func (Int) ToBigEndianBytes added in v0.5.0

func (v Int) ToBigEndianBytes() []byte

func (Int) ToGoValue

func (v Int) ToGoValue() interface{}

func (Int) Type

func (Int) Type() Type

type Int128

type Int128 struct {
	Value *big.Int
}

func NewInt128

func NewInt128(i int) Int128

func NewInt128FromBig

func NewInt128FromBig(i *big.Int) Int128

func (Int128) Big

func (v Int128) Big() *big.Int

func (Int128) Int

func (v Int128) Int() int

func (Int128) String added in v0.12.0

func (v Int128) String() string

func (Int128) ToBigEndianBytes added in v0.5.0

func (v Int128) ToBigEndianBytes() []byte

func (Int128) ToGoValue

func (v Int128) ToGoValue() interface{}

func (Int128) Type

func (Int128) Type() Type

type Int128Type

type Int128Type struct{}

func (Int128Type) ID

func (Int128Type) ID() string

type Int16

type Int16 int16

func NewInt16

func NewInt16(v int16) Int16

func (Int16) String added in v0.12.0

func (v Int16) String() string

func (Int16) ToBigEndianBytes added in v0.5.0

func (v Int16) ToBigEndianBytes() []byte

func (Int16) ToGoValue

func (v Int16) ToGoValue() interface{}

func (Int16) Type

func (Int16) Type() Type

type Int16Type

type Int16Type struct{}

func (Int16Type) ID

func (Int16Type) ID() string

type Int256

type Int256 struct {
	Value *big.Int
}

func NewInt256

func NewInt256(i int) Int256

func NewInt256FromBig

func NewInt256FromBig(i *big.Int) Int256

func (Int256) Big

func (v Int256) Big() *big.Int

func (Int256) Int

func (v Int256) Int() int

func (Int256) String added in v0.12.0

func (v Int256) String() string

func (Int256) ToBigEndianBytes added in v0.5.0

func (v Int256) ToBigEndianBytes() []byte

func (Int256) ToGoValue

func (v Int256) ToGoValue() interface{}

func (Int256) Type

func (Int256) Type() Type

type Int256Type

type Int256Type struct{}

func (Int256Type) ID

func (Int256Type) ID() string

type Int32

type Int32 int32

func NewInt32

func NewInt32(v int32) Int32

func (Int32) String added in v0.12.0

func (v Int32) String() string

func (Int32) ToBigEndianBytes added in v0.5.0

func (v Int32) ToBigEndianBytes() []byte

func (Int32) ToGoValue

func (v Int32) ToGoValue() interface{}

func (Int32) Type

func (Int32) Type() Type

type Int32Type

type Int32Type struct{}

func (Int32Type) ID

func (Int32Type) ID() string

type Int64

type Int64 int64

func NewInt64

func NewInt64(i int64) Int64

func (Int64) String added in v0.12.0

func (v Int64) String() string

func (Int64) ToBigEndianBytes added in v0.5.0

func (v Int64) ToBigEndianBytes() []byte

func (Int64) ToGoValue

func (v Int64) ToGoValue() interface{}

func (Int64) Type

func (Int64) Type() Type

type Int64Type

type Int64Type struct{}

func (Int64Type) ID

func (Int64Type) ID() string

type Int8

type Int8 int8

func NewInt8

func NewInt8(v int8) Int8

func (Int8) String added in v0.12.0

func (v Int8) String() string

func (Int8) ToBigEndianBytes added in v0.5.0

func (v Int8) ToBigEndianBytes() []byte

func (Int8) ToGoValue

func (v Int8) ToGoValue() interface{}

func (Int8) Type

func (Int8) Type() Type

type Int8Type

type Int8Type struct{}

func (Int8Type) ID

func (Int8Type) ID() string

type IntType

type IntType struct{}

func (IntType) ID

func (IntType) ID() string

type IntegerType added in v0.7.0

type IntegerType struct{}

func (IntegerType) ID added in v0.7.0

func (IntegerType) ID() string

type InterfaceType added in v0.7.0

type InterfaceType interface {
	Type

	InterfaceTypeLocation() common.Location
	InterfaceTypeQualifiedIdentifier() string
	InterfaceFields() []Field
	InterfaceInitializers() [][]Parameter
	// contains filtered or unexported methods
}

type KeyValuePair

type KeyValuePair struct {
	Key   Value
	Value Value
}
type Link struct {
	TargetPath Path
	// TODO: a future version might want to export the whole type
	BorrowType string
}
func NewLink(targetPath Path, borrowType string) Link

func (Link) String added in v0.12.0

func (v Link) String() string

func (Link) ToGoValue added in v0.7.0

func (v Link) ToGoValue() interface{}

func (Link) Type added in v0.7.0

func (v Link) Type() Type

type MetaType added in v0.4.0

type MetaType struct{}

func (MetaType) ID added in v0.4.0

func (MetaType) ID() string

type NeverType added in v0.7.0

type NeverType struct{}

func (NeverType) ID added in v0.7.0

func (NeverType) ID() string

type NumberType added in v0.7.0

type NumberType struct{}

func (NumberType) ID added in v0.7.0

func (NumberType) ID() string

type NumberValue added in v0.5.0

type NumberValue interface {
	Value
	ToBigEndianBytes() []byte
}

type Optional

type Optional struct {
	Value Value
}

func NewOptional

func NewOptional(value Value) Optional

func (Optional) String added in v0.12.0

func (o Optional) String() string

func (Optional) ToGoValue

func (o Optional) ToGoValue() interface{}

func (Optional) Type

func (o Optional) Type() Type

type OptionalType

type OptionalType struct {
	Type Type
}

func (OptionalType) ID

func (t OptionalType) ID() string

type Parameter

type Parameter struct {
	Label      string
	Identifier string
	Type       Type
}

type Path added in v0.10.0

type Path struct {
	Domain     string
	Identifier string
}

func (Path) String added in v0.12.0

func (v Path) String() string

func (Path) ToGoValue added in v0.10.0

func (Path) ToGoValue() interface{}

func (Path) Type added in v0.10.0

func (Path) Type() Type

type PathType added in v0.7.0

type PathType struct{}

func (PathType) ID added in v0.7.0

func (PathType) ID() string

type PrivatePathType added in v0.11.0

type PrivatePathType struct{}

func (PrivatePathType) ID added in v0.11.0

func (PrivatePathType) ID() string

type PublicAccountType added in v0.7.0

type PublicAccountType struct{}

func (PublicAccountType) ID added in v0.7.0

type PublicPathType added in v0.11.0

type PublicPathType struct{}

func (PublicPathType) ID added in v0.11.0

func (PublicPathType) ID() string

type ReferenceType added in v0.7.0

type ReferenceType struct {
	Authorized bool
	Type       Type
	// contains filtered or unexported fields
}

func (ReferenceType) ID added in v0.7.0

func (t ReferenceType) ID() string

func (ReferenceType) WithID added in v0.7.0

func (t ReferenceType) WithID(id string) ReferenceType

type Resource

type Resource struct {
	ResourceType *ResourceType
	Fields       []Value
}

func NewResource

func NewResource(fields []Value) Resource

func (Resource) String added in v0.12.0

func (v Resource) String() string

func (Resource) ToGoValue

func (v Resource) ToGoValue() interface{}

func (Resource) Type

func (v Resource) Type() Type

func (Resource) WithType

func (v Resource) WithType(typ *ResourceType) Resource

type ResourceInterfaceType added in v0.7.0

type ResourceInterfaceType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializers        [][]Parameter
}

func (*ResourceInterfaceType) ID added in v0.7.0

func (t *ResourceInterfaceType) ID() string

func (*ResourceInterfaceType) InterfaceFields added in v0.7.0

func (t *ResourceInterfaceType) InterfaceFields() []Field

func (*ResourceInterfaceType) InterfaceInitializers added in v0.7.0

func (t *ResourceInterfaceType) InterfaceInitializers() [][]Parameter

func (*ResourceInterfaceType) InterfaceTypeLocation added in v0.12.0

func (t *ResourceInterfaceType) InterfaceTypeLocation() common.Location

func (*ResourceInterfaceType) InterfaceTypeQualifiedIdentifier added in v0.12.0

func (t *ResourceInterfaceType) InterfaceTypeQualifiedIdentifier() string

type ResourcePointer

type ResourcePointer struct {
	TypeName string
}

func (ResourcePointer) ID

func (t ResourcePointer) ID() string

type ResourceType

type ResourceType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializers        [][]Parameter
}

func (*ResourceType) CompositeFields

func (t *ResourceType) CompositeFields() []Field

func (*ResourceType) CompositeInitializers

func (t *ResourceType) CompositeInitializers() [][]Parameter

func (*ResourceType) CompositeTypeLocation added in v0.12.0

func (t *ResourceType) CompositeTypeLocation() common.Location

func (*ResourceType) CompositeTypeQualifiedIdentifier added in v0.12.0

func (t *ResourceType) CompositeTypeQualifiedIdentifier() string

func (*ResourceType) ID

func (t *ResourceType) ID() string

type RestrictedType added in v0.7.0

type RestrictedType struct {
	Type         Type
	Restrictions []Type
	// contains filtered or unexported fields
}

func (RestrictedType) ID added in v0.7.0

func (t RestrictedType) ID() string

func (RestrictedType) WithID added in v0.7.0

func (t RestrictedType) WithID(id string) RestrictedType

type SignedFixedPointType added in v0.7.0

type SignedFixedPointType struct{}

func (SignedFixedPointType) ID added in v0.7.0

type SignedIntegerType added in v0.7.0

type SignedIntegerType struct{}

func (SignedIntegerType) ID added in v0.7.0

type SignedNumberType added in v0.7.0

type SignedNumberType struct{}

func (SignedNumberType) ID added in v0.7.0

func (SignedNumberType) ID() string

type StoragePathType added in v0.11.0

type StoragePathType struct{}

func (StoragePathType) ID added in v0.11.0

func (StoragePathType) ID() string

type String

type String string

func NewString

func NewString(s string) String

func (String) String added in v0.12.0

func (v String) String() string

func (String) ToGoValue

func (v String) ToGoValue() interface{}

func (String) Type

func (String) Type() Type

type StringType

type StringType struct{}

func (StringType) ID

func (StringType) ID() string

type Struct

type Struct struct {
	StructType *StructType
	Fields     []Value
}

func NewStruct

func NewStruct(fields []Value) Struct

func (Struct) String added in v0.12.0

func (v Struct) String() string

func (Struct) ToGoValue

func (v Struct) ToGoValue() interface{}

func (Struct) Type

func (v Struct) Type() Type

func (Struct) WithType

func (v Struct) WithType(typ *StructType) Struct

type StructInterfaceType added in v0.7.0

type StructInterfaceType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializers        [][]Parameter
}

func (*StructInterfaceType) ID added in v0.7.0

func (t *StructInterfaceType) ID() string

func (*StructInterfaceType) InterfaceFields added in v0.7.0

func (t *StructInterfaceType) InterfaceFields() []Field

func (*StructInterfaceType) InterfaceInitializers added in v0.7.0

func (t *StructInterfaceType) InterfaceInitializers() [][]Parameter

func (*StructInterfaceType) InterfaceTypeLocation added in v0.12.0

func (t *StructInterfaceType) InterfaceTypeLocation() common.Location

func (*StructInterfaceType) InterfaceTypeQualifiedIdentifier added in v0.12.0

func (t *StructInterfaceType) InterfaceTypeQualifiedIdentifier() string

type StructPointer

type StructPointer struct {
	TypeName string
}

func (StructPointer) ID

func (t StructPointer) ID() string

type StructType

type StructType struct {
	Location            common.Location
	QualifiedIdentifier string
	Fields              []Field
	Initializers        [][]Parameter
}

func (*StructType) CompositeFields

func (t *StructType) CompositeFields() []Field

func (*StructType) CompositeInitializers

func (t *StructType) CompositeInitializers() [][]Parameter

func (*StructType) CompositeTypeLocation added in v0.12.0

func (t *StructType) CompositeTypeLocation() common.Location

func (*StructType) CompositeTypeQualifiedIdentifier added in v0.12.0

func (t *StructType) CompositeTypeQualifiedIdentifier() string

func (*StructType) ID

func (t *StructType) ID() string

type Type

type Type interface {
	ID() string
	// contains filtered or unexported methods
}

type TypeValue added in v0.10.0

type TypeValue struct {
	// TODO: a future version might want to export the whole type
	StaticType string
}

func (TypeValue) String added in v0.12.0

func (v TypeValue) String() string

func (TypeValue) ToGoValue added in v0.10.0

func (TypeValue) ToGoValue() interface{}

func (TypeValue) Type added in v0.10.0

func (TypeValue) Type() Type

type UFix64

type UFix64 uint64

func NewUFix64

func NewUFix64(s string) (UFix64, error)

func NewUFix64FromParts added in v0.5.0

func NewUFix64FromParts(integer int, fraction uint) (UFix64, error)

func (UFix64) String added in v0.12.0

func (v UFix64) String() string

func (UFix64) ToBigEndianBytes added in v0.5.0

func (v UFix64) ToBigEndianBytes() []byte

func (UFix64) ToGoValue

func (v UFix64) ToGoValue() interface{}

func (UFix64) Type

func (UFix64) Type() Type

type UFix64Type

type UFix64Type struct{}

func (UFix64Type) ID

func (UFix64Type) ID() string

type UInt

type UInt struct {
	Value *big.Int
}

func NewUInt

func NewUInt(i uint) UInt

func NewUIntFromBig

func NewUIntFromBig(i *big.Int) UInt

func (UInt) Big

func (v UInt) Big() *big.Int

func (UInt) Int

func (v UInt) Int() int

func (UInt) String added in v0.12.0

func (v UInt) String() string

func (UInt) ToBigEndianBytes added in v0.5.0

func (v UInt) ToBigEndianBytes() []byte

func (UInt) ToGoValue

func (v UInt) ToGoValue() interface{}

func (UInt) Type

func (UInt) Type() Type

type UInt128

type UInt128 struct {
	Value *big.Int
}

func NewUInt128

func NewUInt128(i uint) UInt128

func NewUInt128FromBig

func NewUInt128FromBig(i *big.Int) UInt128

func (UInt128) Big

func (v UInt128) Big() *big.Int

func (UInt128) Int

func (v UInt128) Int() int

func (UInt128) String added in v0.12.0

func (v UInt128) String() string

func (UInt128) ToBigEndianBytes added in v0.5.0

func (v UInt128) ToBigEndianBytes() []byte

func (UInt128) ToGoValue

func (v UInt128) ToGoValue() interface{}

func (UInt128) Type

func (UInt128) Type() Type

type UInt128Type

type UInt128Type struct{}

func (UInt128Type) ID

func (UInt128Type) ID() string

type UInt16

type UInt16 uint16

func NewUInt16

func NewUInt16(v uint16) UInt16

func (UInt16) String added in v0.12.0

func (v UInt16) String() string

func (UInt16) ToBigEndianBytes added in v0.5.0

func (v UInt16) ToBigEndianBytes() []byte

func (UInt16) ToGoValue

func (v UInt16) ToGoValue() interface{}

func (UInt16) Type

func (UInt16) Type() Type

type UInt16Type

type UInt16Type struct{}

func (UInt16Type) ID

func (UInt16Type) ID() string

type UInt256

type UInt256 struct {
	Value *big.Int
}

func NewUInt256

func NewUInt256(i uint) UInt256

func NewUInt256FromBig

func NewUInt256FromBig(i *big.Int) UInt256

func (UInt256) Big

func (v UInt256) Big() *big.Int

func (UInt256) Int

func (v UInt256) Int() int

func (UInt256) String added in v0.12.0

func (v UInt256) String() string

func (UInt256) ToBigEndianBytes added in v0.5.0

func (v UInt256) ToBigEndianBytes() []byte

func (UInt256) ToGoValue

func (v UInt256) ToGoValue() interface{}

func (UInt256) Type

func (UInt256) Type() Type

type UInt256Type

type UInt256Type struct{}

func (UInt256Type) ID

func (UInt256Type) ID() string

type UInt32

type UInt32 uint32

func NewUInt32

func NewUInt32(v uint32) UInt32

func (UInt32) String added in v0.12.0

func (v UInt32) String() string

func (UInt32) ToBigEndianBytes added in v0.5.0

func (v UInt32) ToBigEndianBytes() []byte

func (UInt32) ToGoValue

func (v UInt32) ToGoValue() interface{}

func (UInt32) Type

func (UInt32) Type() Type

type UInt32Type

type UInt32Type struct{}

func (UInt32Type) ID

func (UInt32Type) ID() string

type UInt64

type UInt64 uint64

func NewUInt64

func NewUInt64(v uint64) UInt64

func (UInt64) String added in v0.12.0

func (v UInt64) String() string

func (UInt64) ToBigEndianBytes added in v0.5.0

func (v UInt64) ToBigEndianBytes() []byte

func (UInt64) ToGoValue

func (v UInt64) ToGoValue() interface{}

func (UInt64) Type

func (UInt64) Type() Type

type UInt64Type

type UInt64Type struct{}

func (UInt64Type) ID

func (UInt64Type) ID() string

type UInt8

type UInt8 uint8

UInt8

func NewUInt8

func NewUInt8(v uint8) UInt8

func (UInt8) String added in v0.12.0

func (v UInt8) String() string

func (UInt8) ToBigEndianBytes added in v0.5.0

func (v UInt8) ToBigEndianBytes() []byte

func (UInt8) ToGoValue

func (v UInt8) ToGoValue() interface{}

func (UInt8) Type

func (UInt8) Type() Type

type UInt8Type

type UInt8Type struct{}

func (UInt8Type) ID

func (UInt8Type) ID() string

type UIntType

type UIntType struct{}

func (UIntType) ID

func (UIntType) ID() string

type Value

type Value interface {
	Type() Type
	ToGoValue() interface{}
	fmt.Stringer
	// contains filtered or unexported methods
}

func MustConvertValue

func MustConvertValue(value interface{}) Value

MustConvertValue converts a Go value to an ABI value or panics if the value cannot be converted.

func NewValue

func NewValue(value interface{}) (Value, error)

type Variable

type Variable struct {
	Type Type
}

func (Variable) ID

func (Variable) ID() string

TODO:

type VariableSizedArrayType

type VariableSizedArrayType struct {
	ElementType Type
}

func (VariableSizedArrayType) Element

func (v VariableSizedArrayType) Element() Type

func (VariableSizedArrayType) ID

type Void

type Void struct{}

func NewVoid

func NewVoid() Void

func (Void) String added in v0.12.0

func (Void) String() string

func (Void) ToGoValue

func (Void) ToGoValue() interface{}

func (Void) Type

func (Void) Type() Type

type VoidType

type VoidType struct{}

func (VoidType) ID

func (VoidType) ID() string

type Word16

type Word16 uint16

func NewWord16

func NewWord16(v uint16) Word16

func (Word16) String added in v0.12.0

func (v Word16) String() string

func (Word16) ToBigEndianBytes added in v0.5.0

func (v Word16) ToBigEndianBytes() []byte

func (Word16) ToGoValue

func (v Word16) ToGoValue() interface{}

func (Word16) Type

func (Word16) Type() Type

type Word16Type

type Word16Type struct{}

func (Word16Type) ID

func (Word16Type) ID() string

type Word32

type Word32 uint32

func NewWord32

func NewWord32(v uint32) Word32

func (Word32) String added in v0.12.0

func (v Word32) String() string

func (Word32) ToBigEndianBytes added in v0.5.0

func (v Word32) ToBigEndianBytes() []byte

func (Word32) ToGoValue

func (v Word32) ToGoValue() interface{}

func (Word32) Type

func (Word32) Type() Type

type Word32Type

type Word32Type struct{}

func (Word32Type) ID

func (Word32Type) ID() string

type Word64

type Word64 uint64

func NewWord64

func NewWord64(v uint64) Word64

func (Word64) String added in v0.12.0

func (v Word64) String() string

func (Word64) ToBigEndianBytes added in v0.5.0

func (v Word64) ToBigEndianBytes() []byte

func (Word64) ToGoValue

func (v Word64) ToGoValue() interface{}

func (Word64) Type

func (Word64) Type() Type

type Word64Type

type Word64Type struct{}

func (Word64Type) ID

func (Word64Type) ID() string

type Word8

type Word8 uint8

func NewWord8

func NewWord8(v uint8) Word8

func (Word8) String added in v0.12.0

func (v Word8) String() string

func (Word8) ToBigEndianBytes added in v0.5.0

func (v Word8) ToBigEndianBytes() []byte

func (Word8) ToGoValue

func (v Word8) ToGoValue() interface{}

func (Word8) Type

func (Word8) Type() Type

type Word8Type

type Word8Type struct{}

func (Word8Type) ID

func (Word8Type) ID() string

Directories

Path Synopsis
encoding
json
Package json implements the JSON-Cadence specification: https://github.com/onflow/flow/blob/master/docs/json-cadence-spec.md
Package json implements the JSON-Cadence specification: https://github.com/onflow/flow/blob/master/docs/json-cadence-spec.md
Package fixedpoint provides constants, as well as formatting, conversion, and checking functionality for Cadence fixed-point number types
Package fixedpoint provides constants, as well as formatting, conversion, and checking functionality for Cadence fixed-point number types
ast
Package ast contains all AST nodes for Cadence.
Package ast contains all AST nodes for Cadence.
cmd
cmd/minifier
* Cadence - The resource-oriented smart contract programming language * * Copyright 2019-2020 Dapper Labs, Inc.
* Cadence - The resource-oriented smart contract programming language * * Copyright 2019-2020 Dapper Labs, Inc.
compiler/wasm
WebAssembly (https://webassembly.org/) is an open standard for portable executable programs.
WebAssembly (https://webassembly.org/) is an open standard for portable executable programs.
tools
batch-script Module
docgen Module
get-contracts Module
golangci-lint Module
maprange Module
maprangecheck Module
unkeyed Module
utils

Jump to

Keyboard shortcuts

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