common

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 21

Documentation

Overview

uses the provided function `f` to generate a slice with no duplicates. This is equivalent to adding all the values produced by `f` to a map, and then returning `maps.Keys` of that map, except without the nondeterminism. K must be comparable in order to have a consistent meaning of the concept of a "duplicate"

Index

Constants

View Source
const AddressLength = 8
View Source
const AddressLocationPrefix = "A"
View Source
const BigIntWordSize = int(unsafe.Sizeof(big.Word(0)))
View Source
const ComputationKindRangeStart = 1000

[1000,2000) is reserved for Cadence interpreter and runtime

View Source
const IdentifierLocationPrefix = "I"
View Source
const REPLLocationPrefix = "REPL"
View Source
const ScriptIDLength = 32
View Source
const ScriptLocationPrefix = "s"
View Source
const StringLocationPrefix = "S"
View Source
const TransactionIDLength = 32
View Source
const TransactionLocationPrefix = "t"

Variables

View Source
var (
	TypeTokenMemoryUsage  = NewConstantMemoryUsage(MemoryKindTypeToken)
	ErrorTokenMemoryUsage = NewConstantMemoryUsage(MemoryKindErrorToken)
	SpaceTokenMemoryUsage = NewConstantMemoryUsage(MemoryKindSpaceToken)

	ProgramMemoryUsage           = NewConstantMemoryUsage(MemoryKindProgram)
	IdentifierMemoryUsage        = NewConstantMemoryUsage(MemoryKindIdentifier)
	ArgumentMemoryUsage          = NewConstantMemoryUsage(MemoryKindArgument)
	BlockMemoryUsage             = NewConstantMemoryUsage(MemoryKindBlock)
	FunctionBlockMemoryUsage     = NewConstantMemoryUsage(MemoryKindFunctionBlock)
	ParameterMemoryUsage         = NewConstantMemoryUsage(MemoryKindParameter)
	ParameterListMemoryUsage     = NewConstantMemoryUsage(MemoryKindParameterList)
	TypeParameterMemoryUsage     = NewConstantMemoryUsage(MemoryKindTypeParameter)
	TypeParameterListMemoryUsage = NewConstantMemoryUsage(MemoryKindTypeParameterList)
	TransferMemoryUsage          = NewConstantMemoryUsage(MemoryKindTransfer)
	TypeAnnotationMemoryUsage    = NewConstantMemoryUsage(MemoryKindTypeAnnotation)
	DictionaryEntryMemoryUsage   = NewConstantMemoryUsage(MemoryKindDictionaryEntry)

	FunctionDeclarationMemoryUsage           = NewConstantMemoryUsage(MemoryKindFunctionDeclaration)
	CompositeDeclarationMemoryUsage          = NewConstantMemoryUsage(MemoryKindCompositeDeclaration)
	AttachmentDeclarationMemoryUsage         = NewConstantMemoryUsage(MemoryKindAttachmentDeclaration)
	InterfaceDeclarationMemoryUsage          = NewConstantMemoryUsage(MemoryKindInterfaceDeclaration)
	EntitlementDeclarationMemoryUsage        = NewConstantMemoryUsage(MemoryKindEntitlementDeclaration)
	EntitlementMappingElementMemoryUsage     = NewConstantMemoryUsage(MemoryKindEntitlementMappingElement)
	EntitlementMappingDeclarationMemoryUsage = NewConstantMemoryUsage(MemoryKindEntitlementMappingDeclaration)
	ImportDeclarationMemoryUsage             = NewConstantMemoryUsage(MemoryKindImportDeclaration)
	TransactionDeclarationMemoryUsage        = NewConstantMemoryUsage(MemoryKindTransactionDeclaration)
	FieldDeclarationMemoryUsage              = NewConstantMemoryUsage(MemoryKindFieldDeclaration)
	EnumCaseDeclarationMemoryUsage           = NewConstantMemoryUsage(MemoryKindEnumCaseDeclaration)
	VariableDeclarationMemoryUsage           = NewConstantMemoryUsage(MemoryKindVariableDeclaration)
	SpecialFunctionDeclarationMemoryUsage    = NewConstantMemoryUsage(MemoryKindSpecialFunctionDeclaration)
	PragmaDeclarationMemoryUsage             = NewConstantMemoryUsage(MemoryKindPragmaDeclaration)

	AssignmentStatementMemoryUsage = NewConstantMemoryUsage(MemoryKindAssignmentStatement)
	BreakStatementMemoryUsage      = NewConstantMemoryUsage(MemoryKindBreakStatement)
	ContinueStatementMemoryUsage   = NewConstantMemoryUsage(MemoryKindContinueStatement)
	EmitStatementMemoryUsage       = NewConstantMemoryUsage(MemoryKindEmitStatement)
	ExpressionStatementMemoryUsage = NewConstantMemoryUsage(MemoryKindExpressionStatement)
	ForStatementMemoryUsage        = NewConstantMemoryUsage(MemoryKindForStatement)
	IfStatementMemoryUsage         = NewConstantMemoryUsage(MemoryKindIfStatement)
	ReturnStatementMemoryUsage     = NewConstantMemoryUsage(MemoryKindReturnStatement)
	SwapStatementMemoryUsage       = NewConstantMemoryUsage(MemoryKindSwapStatement)
	SwitchStatementMemoryUsage     = NewConstantMemoryUsage(MemoryKindSwitchStatement)
	WhileStatementMemoryUsage      = NewConstantMemoryUsage(MemoryKindWhileStatement)
	RemoveStatementMemoryUsage     = NewConstantMemoryUsage(MemoryKindRemoveStatement)

	BooleanExpressionMemoryUsage     = NewConstantMemoryUsage(MemoryKindBooleanExpression)
	VoidExpressionMemoryUsage        = NewConstantMemoryUsage(MemoryKindVoidExpression)
	NilExpressionMemoryUsage         = NewConstantMemoryUsage(MemoryKindNilExpression)
	StringExpressionMemoryUsage      = NewConstantMemoryUsage(MemoryKindStringExpression)
	IntegerExpressionMemoryUsage     = NewConstantMemoryUsage(MemoryKindIntegerExpression)
	FixedPointExpressionMemoryUsage  = NewConstantMemoryUsage(MemoryKindFixedPointExpression)
	IdentifierExpressionMemoryUsage  = NewConstantMemoryUsage(MemoryKindIdentifierExpression)
	InvocationExpressionMemoryUsage  = NewConstantMemoryUsage(MemoryKindInvocationExpression)
	MemberExpressionMemoryUsage      = NewConstantMemoryUsage(MemoryKindMemberExpression)
	IndexExpressionMemoryUsage       = NewConstantMemoryUsage(MemoryKindIndexExpression)
	ConditionalExpressionMemoryUsage = NewConstantMemoryUsage(MemoryKindConditionalExpression)
	UnaryExpressionMemoryUsage       = NewConstantMemoryUsage(MemoryKindUnaryExpression)
	BinaryExpressionMemoryUsage      = NewConstantMemoryUsage(MemoryKindBinaryExpression)
	FunctionExpressionMemoryUsage    = NewConstantMemoryUsage(MemoryKindFunctionExpression)
	CastingExpressionMemoryUsage     = NewConstantMemoryUsage(MemoryKindCastingExpression)
	CreateExpressionMemoryUsage      = NewConstantMemoryUsage(MemoryKindCreateExpression)
	DestroyExpressionMemoryUsage     = NewConstantMemoryUsage(MemoryKindDestroyExpression)
	ReferenceExpressionMemoryUsage   = NewConstantMemoryUsage(MemoryKindReferenceExpression)
	ForceExpressionMemoryUsage       = NewConstantMemoryUsage(MemoryKindForceExpression)
	PathExpressionMemoryUsage        = NewConstantMemoryUsage(MemoryKindPathExpression)
	AttachExpressionMemoryUsage      = NewConstantMemoryUsage(MemoryKindAttachExpression)

	ConstantSizedTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindConstantSizedType)
	DictionaryTypeMemoryUsage    = NewConstantMemoryUsage(MemoryKindDictionaryType)
	FunctionTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindFunctionType)
	InstantiationTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindInstantiationType)
	NominalTypeMemoryUsage       = NewConstantMemoryUsage(MemoryKindNominalType)
	OptionalTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindOptionalType)
	ReferenceTypeMemoryUsage     = NewConstantMemoryUsage(MemoryKindReferenceType)
	IntersectionTypeMemoryUsage  = NewConstantMemoryUsage(MemoryKindIntersectionType)
	VariableSizedTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindVariableSizedType)

	PositionMemoryUsage = NewConstantMemoryUsage(MemoryKindPosition)
	RangeMemoryUsage    = NewConstantMemoryUsage(MemoryKindRange)

	ElaborationMemoryUsage       = NewConstantMemoryUsage(MemoryKindElaboration)
	ActivationMemoryUsage        = NewConstantMemoryUsage(MemoryKindActivation)
	ActivationEntriesMemoryUsage = NewConstantMemoryUsage(MemoryKindActivationEntries)

	SimpleCompositeValueBaseMemoryUsage         = NewConstantMemoryUsage(MemoryKindSimpleCompositeValueBase)
	AtreeMapElementOverhead                     = NewConstantMemoryUsage(MemoryKindAtreeMapElementOverhead)
	AtreeArrayElementOverhead                   = NewConstantMemoryUsage(MemoryKindAtreeArrayElementOverhead)
	CompositeTypeInfoMemoryUsage                = NewConstantMemoryUsage(MemoryKindCompositeTypeInfo)
	CompositeFieldMemoryUsage                   = NewConstantMemoryUsage(MemoryKindCompositeField)
	DictionaryValueBaseMemoryUsage              = NewConstantMemoryUsage(MemoryKindDictionaryValueBase)
	ArrayValueBaseMemoryUsage                   = NewConstantMemoryUsage(MemoryKindArrayValueBase)
	CompositeValueBaseMemoryUsage               = NewConstantMemoryUsage(MemoryKindCompositeValueBase)
	AddressValueMemoryUsage                     = NewConstantMemoryUsage(MemoryKindAddressValue)
	BoundFunctionValueMemoryUsage               = NewConstantMemoryUsage(MemoryKindBoundFunctionValue)
	HostFunctionValueMemoryUsage                = NewConstantMemoryUsage(MemoryKindHostFunctionValue)
	InterpretedFunctionValueMemoryUsage         = NewConstantMemoryUsage(MemoryKindInterpretedFunctionValue)
	CapabilityValueMemoryUsage                  = NewConstantMemoryUsage(MemoryKindCapabilityValue)
	EphemeralReferenceValueMemoryUsage          = NewConstantMemoryUsage(MemoryKindEphemeralReferenceValue)
	StorageReferenceValueMemoryUsage            = NewConstantMemoryUsage(MemoryKindStorageReferenceValue)
	PathValueMemoryUsage                        = NewConstantMemoryUsage(MemoryKindPathValue)
	OptionalValueMemoryUsage                    = NewConstantMemoryUsage(MemoryKindOptionalValue)
	TypeValueMemoryUsage                        = NewConstantMemoryUsage(MemoryKindTypeValue)
	PublishedValueMemoryUsage                   = NewConstantMemoryUsage(MemoryKindPublishedValue)
	StorageCapabilityControllerValueMemoryUsage = NewConstantMemoryUsage(MemoryKindStorageCapabilityControllerValue)
	AccountCapabilityControllerValueMemoryUsage = NewConstantMemoryUsage(MemoryKindAccountCapabilityControllerValue)

	PrimitiveStaticTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindPrimitiveStaticType)
	CompositeStaticTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindCompositeStaticType)
	InterfaceStaticTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindInterfaceStaticType)
	VariableSizedStaticTypeMemoryUsage  = NewConstantMemoryUsage(MemoryKindVariableSizedStaticType)
	ConstantSizedStaticTypeMemoryUsage  = NewConstantMemoryUsage(MemoryKindConstantSizedStaticType)
	DictionaryStaticTypeMemoryUsage     = NewConstantMemoryUsage(MemoryKindDictionaryStaticType)
	OptionalStaticTypeMemoryUsage       = NewConstantMemoryUsage(MemoryKindOptionalStaticType)
	IntersectionStaticTypeMemoryUsage   = NewConstantMemoryUsage(MemoryKindIntersectionStaticType)
	ReferenceStaticTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindReferenceStaticType)
	CapabilityStaticTypeMemoryUsage     = NewConstantMemoryUsage(MemoryKindCapabilityStaticType)
	FunctionStaticTypeMemoryUsage       = NewConstantMemoryUsage(MemoryKindFunctionStaticType)
	EntitlementMapStaticTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindEntitlementMapStaticAccess)
	InclusiveRangeStaticTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindInclusiveRangeStaticType)

	VariableSizedSemaTypeMemoryUsage       = NewConstantMemoryUsage(MemoryKindVariableSizedSemaType)
	ConstantSizedSemaTypeMemoryUsage       = NewConstantMemoryUsage(MemoryKindConstantSizedSemaType)
	DictionarySemaTypeMemoryUsage          = NewConstantMemoryUsage(MemoryKindDictionarySemaType)
	OptionalSemaTypeMemoryUsage            = NewConstantMemoryUsage(MemoryKindOptionalSemaType)
	IntersectionSemaTypeMemoryUsage        = NewConstantMemoryUsage(MemoryKindIntersectionSemaType)
	ReferenceSemaTypeMemoryUsage           = NewConstantMemoryUsage(MemoryKindReferenceSemaType)
	EntitlementSemaTypeMemoryUsage         = NewConstantMemoryUsage(MemoryKindEntitlementSemaType)
	EntitlementMapSemaTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindEntitlementMapSemaType)
	EntitlementRelationSemaTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindEntitlementRelationSemaType)
	CapabilitySemaTypeMemoryUsage          = NewConstantMemoryUsage(MemoryKindCapabilitySemaType)
	InclusiveRangeSemaTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindInclusiveRangeSemaType)

	OrderedMapMemoryUsage = NewConstantMemoryUsage(MemoryKindOrderedMap)
	InvocationMemoryUsage = NewConstantMemoryUsage(MemoryKindInvocation)
	StorageMapMemoryUsage = NewConstantMemoryUsage(MemoryKindStorageMap)
	StorageKeyMemoryUsage = NewConstantMemoryUsage(MemoryKindStorageKey)

	CadenceDictionaryValueMemoryUsage               = NewConstantMemoryUsage(MemoryKindCadenceDictionaryValue)
	CadenceInclusiveRangeValueMemoryUsage           = NewConstantMemoryUsage(MemoryKindCadenceInclusiveRangeValue)
	CadenceArrayValueBaseMemoryUsage                = NewConstantMemoryUsage(MemoryKindCadenceArrayValueBase)
	CadenceStructValueBaseMemoryUsage               = NewConstantMemoryUsage(MemoryKindCadenceStructValueBase)
	CadenceResourceValueBaseMemoryUsage             = NewConstantMemoryUsage(MemoryKindCadenceResourceValueBase)
	CadenceAttachmentValueBaseMemoryUsage           = NewConstantMemoryUsage(MemoryKindCadenceAttachmentValueBase)
	CadenceEventValueBaseMemoryUsage                = NewConstantMemoryUsage(MemoryKindCadenceEventValueBase)
	CadenceContractValueBaseMemoryUsage             = NewConstantMemoryUsage(MemoryKindCadenceContractValueBase)
	CadenceEnumValueBaseMemoryUsage                 = NewConstantMemoryUsage(MemoryKindCadenceEnumValueBase)
	CadenceAddressValueMemoryUsage                  = NewConstantMemoryUsage(MemoryKindCadenceAddressValue)
	CadenceBoolValueMemoryUsage                     = NewConstantMemoryUsage(MemoryKindCadenceBoolValue)
	CadenceCapabilityValueMemoryUsage               = NewConstantMemoryUsage(MemoryKindCadenceCapabilityValue)
	CadenceDeprecatedPathCapabilityValueMemoryUsage = NewConstantMemoryUsage(MemoryKindCadenceDeprecatedPathCapabilityType) // Deprecated: removed in v1.0.0
	CadenceFunctionValueMemoryUsage                 = NewConstantMemoryUsage(MemoryKindCadenceFunctionValue)
	CadenceKeyValuePairMemoryUsage                  = NewConstantMemoryUsage(MemoryKindCadenceKeyValuePair)
	CadenceOptionalValueMemoryUsage                 = NewConstantMemoryUsage(MemoryKindCadenceOptionalValue)
	CadencePathValueMemoryUsage                     = NewConstantMemoryUsage(MemoryKindCadencePathValue)
	CadenceVoidValueMemoryUsage                     = NewConstantMemoryUsage(MemoryKindCadenceVoidValue)
	CadenceTypeValueMemoryUsage                     = NewConstantMemoryUsage(MemoryKindCadenceTypeValue)

	CadenceCapabilityTypeMemoryUsage           = NewConstantMemoryUsage(MemoryKindCadenceCapabilityType)
	CadenceConstantSizedArrayTypeMemoryUsage   = NewConstantMemoryUsage(MemoryKindCadenceConstantSizedArrayType)
	CadenceVariableSizedArrayTypeMemoryUsage   = NewConstantMemoryUsage(MemoryKindCadenceVariableSizedArrayType)
	CadenceContractInterfaceTypeMemoryUsage    = NewConstantMemoryUsage(MemoryKindCadenceContractInterfaceType)
	CadenceContractTypeMemoryUsage             = NewConstantMemoryUsage(MemoryKindCadenceContractType)
	CadenceDictionaryTypeMemoryUsage           = NewConstantMemoryUsage(MemoryKindCadenceDictionaryType)
	CadenceInclusiveRangeTypeMemoryUsage       = NewConstantMemoryUsage(MemoryKindCadenceInclusiveRangeType)
	CadenceEnumTypeMemoryUsage                 = NewConstantMemoryUsage(MemoryKindCadenceEnumType)
	CadenceEventTypeMemoryUsage                = NewConstantMemoryUsage(MemoryKindCadenceEventType)
	CadenceFunctionTypeMemoryUsage             = NewConstantMemoryUsage(MemoryKindCadenceFunctionType)
	CadenceOptionalTypeMemoryUsage             = NewConstantMemoryUsage(MemoryKindCadenceOptionalType)
	CadenceDeprecatedRestrictedTypeMemoryUsage = NewConstantMemoryUsage(MemoryKindCadenceDeprecatedRestrictedType) // Deprecated: removed in v1.0.0
	CadenceReferenceTypeMemoryUsage            = NewConstantMemoryUsage(MemoryKindCadenceReferenceType)
	CadenceResourceInterfaceTypeMemoryUsage    = NewConstantMemoryUsage(MemoryKindCadenceResourceInterfaceType)
	CadenceResourceTypeMemoryUsage             = NewConstantMemoryUsage(MemoryKindCadenceResourceType)
	CadenceIntersectionTypeMemoryUsage         = NewConstantMemoryUsage(MemoryKindCadenceIntersectionType)
	CadenceStructInterfaceTypeMemoryUsage      = NewConstantMemoryUsage(MemoryKindCadenceStructInterfaceType)
	CadenceStructTypeMemoryUsage               = NewConstantMemoryUsage(MemoryKindCadenceStructType)
	CadenceAttachmentTypeMemoryUsage           = NewConstantMemoryUsage(MemoryKindCadenceAttachmentType)

	VoidStringMemoryUsage                             = NewRawStringMemoryUsage(len("()"))
	TrueStringMemoryUsage                             = NewRawStringMemoryUsage(len("true"))
	FalseStringMemoryUsage                            = NewRawStringMemoryUsage(len("false"))
	TypeValueStringMemoryUsage                        = NewRawStringMemoryUsage(len("Type<>()"))
	NilValueStringMemoryUsage                         = NewRawStringMemoryUsage(len("nil"))
	StorageReferenceValueStringMemoryUsage            = NewRawStringMemoryUsage(len("StorageReference()"))
	SeenReferenceStringMemoryUsage                    = NewRawStringMemoryUsage(3)                   // len(ellipsis)
	AddressValueStringMemoryUsage                     = NewRawStringMemoryUsage(AddressLength*2 + 2) // len(bytes-to-hex + prefix)
	HostFunctionValueStringMemoryUsage                = NewRawStringMemoryUsage(len("Function(...)"))
	AccountValueStringMemoryUsage                     = NewRawStringMemoryUsage(len("Account()"))
	AccountContractsStringMemoryUsage                 = NewRawStringMemoryUsage(len("Account.Contracts()"))
	AccountKeysStringMemoryUsage                      = NewRawStringMemoryUsage(len("Account.Keys()"))
	AccountStorageCapabilitiesStringMemoryUsage       = NewRawStringMemoryUsage(len("Account.StorageCapabilities()"))
	AccountAccountCapabilitiesStringMemoryUsage       = NewRawStringMemoryUsage(len("Account.AccountCapabilities()"))
	AccountCapabilitiesStringMemoryUsage              = NewRawStringMemoryUsage(len("Account.Capabilities()"))
	AccountInboxStringMemoryUsage                     = NewRawStringMemoryUsage(len("Account.Inbox()"))
	AccountStorageStringMemoryUsage                   = NewRawStringMemoryUsage(len("Account.Storage()"))
	IDCapabilityValueStringMemoryUsage                = NewRawStringMemoryUsage(len("Capability<>(address: , id: )"))
	PathCapabilityValueStringMemoryUsage              = NewRawStringMemoryUsage(len("Capability<>(address: , path: )"))
	StorageCapabilityControllerValueStringMemoryUsage = NewRawStringMemoryUsage(len("StorageCapabilityController(borrowType: , capabilityID: , target: )"))
	AccountCapabilityControllerValueStringMemoryUsage = NewRawStringMemoryUsage(len("AccountCapabilityController(borrowType: , capabilityID: )"))
	PublishedValueStringMemoryUsage                   = NewRawStringMemoryUsage(len("PublishedValue<>()"))
	AuthStringMemoryUsage                             = NewRawStringMemoryUsage(len("auth() "))

	VariableSizedStaticTypeStringMemoryUsage         = NewRawStringMemoryUsage(2)  // []
	DictionaryStaticTypeStringMemoryUsage            = NewRawStringMemoryUsage(4)  // {: }
	OptionalStaticTypeStringMemoryUsage              = NewRawStringMemoryUsage(1)  // ?
	CapabilityStaticTypeStringMemoryUsage            = NewRawStringMemoryUsage(12) // Capability<>
	IntersectionStaticTypeStringMemoryUsage          = NewRawStringMemoryUsage(2)  // {}
	IntersectionStaticTypeSeparatorStringMemoryUsage = NewRawStringMemoryUsage(2)  // ,
	InclusiveRangeStaticTypeStringMemoryUsage        = NewRawStringMemoryUsage(16) // InclusiveRange<>
)
View Source
var AddressOverflowError = goErrors.New("address too large")
View Source
var AllPathDomainsByIdentifier = map[string]PathDomain{}
View Source
var AllStorageDomainsByIdentifier = map[string]StorageDomain{}
View Source
var InstantiableCompositeKindsWithFieldsAndFunctions = []CompositeKind{
	CompositeKindStructure,
	CompositeKindResource,
	CompositeKindContract,
}
View Source
var InvalidHexAddressError = goErrors.New("invalid hex string for address")

Functions

func AdditionalAtreeMemoryUsage

func AdditionalAtreeMemoryUsage(originalCount uint64, elementSize uint, array bool) (MemoryUsage, MemoryUsage)

func BigIntByteLength

func BigIntByteLength(v *big.Int) int

func CompositeKindCount

func CompositeKindCount() int

func Concat

func Concat[T any](slices ...[]T) []T

func DeclarationKindCount

func DeclarationKindCount() int

func EnumerateWords

func EnumerateWords(words []string, conjunction string) string

func GenerateSliceWithNoDuplicates

func GenerateSliceWithNoDuplicates[K comparable](generator func() *K) (slice []K)

func LocationsInSameAccount

func LocationsInSameAccount(first, second Location) bool

LocationsInSameAccount returns true if both locations are nil, if both locations are address locations when both locations have the same address, or otherwise if their IDs are the same.

func MappedSliceWithNoDuplicates

func MappedSliceWithNoDuplicates[T any, K comparable](ts []T, f func(T) K) []K

func NewAtreeArrayMemoryUsages

func NewAtreeArrayMemoryUsages(count uint64, elementSize uint) (MemoryUsage, MemoryUsage, MemoryUsage)

func NewAtreeMapMemoryUsages

func NewAtreeMapMemoryUsages(count uint64, elementSize uint) (MemoryUsage, MemoryUsage, MemoryUsage)

func NewBigInt

func NewBigInt(gauge MemoryGauge) *big.Int

func NewBigIntFromAbsoluteValue

func NewBigIntFromAbsoluteValue(gauge MemoryGauge, value *big.Int) *big.Int

func NewCadenceArrayMemoryUsages

func NewCadenceArrayMemoryUsages(length int) (MemoryUsage, MemoryUsage)

func NewCadenceAttachmentMemoryUsages

func NewCadenceAttachmentMemoryUsages(fields int) (MemoryUsage, MemoryUsage)

func NewCadenceContractMemoryUsages

func NewCadenceContractMemoryUsages(fields int) (MemoryUsage, MemoryUsage)

func NewCadenceEnumMemoryUsages

func NewCadenceEnumMemoryUsages(fields int) (MemoryUsage, MemoryUsage)

func NewCadenceEventMemoryUsages

func NewCadenceEventMemoryUsages(fields int) (MemoryUsage, MemoryUsage)

func NewCadenceResourceMemoryUsages

func NewCadenceResourceMemoryUsages(fields int) (MemoryUsage, MemoryUsage)

func NewCadenceStructMemoryUsages

func NewCadenceStructMemoryUsages(fields int) (MemoryUsage, MemoryUsage)

func NewOrderedMapMemoryUsages

func NewOrderedMapMemoryUsages(size uint64) (MemoryUsage, MemoryUsage, MemoryUsage)

func OverEstimateBigIntFromString

func OverEstimateBigIntFromString(s string, literalKind IntegerLiteralKind) int

OverEstimateBigIntFromString is an approximate inverse of `interpreter.OverEstimateBigIntStringLength`. Returns the estimated size in bytes.

func RegisterTypeIDDecoder

func RegisterTypeIDDecoder(prefix string, decoder TypeIDDecoder)

func UseMemory

func UseMemory(gauge MemoryGauge, usage MemoryUsage)

Types

type Address

type Address [AddressLength]byte
var ZeroAddress Address = Address{}

Singleton for address 0x0. This should be used in place of an empty initializer `Address{}`

func BytesToAddress

func BytesToAddress(b []byte) (Address, error)

BytesToAddress returns Address with value b.

If the address is too large, then the function returns an error.

func HexToAddress

func HexToAddress(h string) (Address, error)

HexToAddress converts a hex string to an Address.

func HexToAddressAssertPrefix

func HexToAddressAssertPrefix(h string) (Address, error)

HexToAddress converts a hex string to an Address after ensuring that the hex string starts with the prefix 0x.

func MustBytesToAddress

func MustBytesToAddress(b []byte) Address

MustBytesToAddress returns Address with value b.

If the address is too large, then the function panics.

func (Address) Bytes

func (a Address) Bytes() []byte

Bytes returns address without leading zeros. The fast path is inlined and handles the most common scenario of address having no leading zeros. Otherwise, bytes() is called to trim leading zeros.

func (Address) Compare added in v1.3.0

func (a Address) Compare(other Address) int

func (Address) Hex

func (a Address) Hex() string

Hex returns the hex string representation of the address.

func (Address) HexWithPrefix

func (a Address) HexWithPrefix() string

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

SetBytes sets the address to the value of b.

If b is larger than len(a) it will panic.

func (Address) ShortHexWithPrefix

func (a Address) ShortHexWithPrefix() string

func (Address) String

func (a Address) String() string

type AddressLocation

type AddressLocation struct {
	Name    string
	Address Address
}

AddressLocation is the location of a contract/contract interface at an address

func NewAddressLocation

func NewAddressLocation(gauge MemoryGauge, addr Address, name string) AddressLocation

func (AddressLocation) Description

func (l AddressLocation) Description() string

func (AddressLocation) ID

func (l AddressLocation) ID() string

func (AddressLocation) MarshalJSON

func (l AddressLocation) MarshalJSON() ([]byte, error)

func (AddressLocation) QualifiedIdentifier

func (l AddressLocation) QualifiedIdentifier(typeID TypeID) string

func (AddressLocation) String

func (l AddressLocation) String() string

func (AddressLocation) TypeID

func (l AddressLocation) TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID

type CompositeKind

type CompositeKind uint
const (
	CompositeKindUnknown CompositeKind = iota
	CompositeKindStructure
	CompositeKindResource
	CompositeKindContract
	CompositeKindEvent
	CompositeKindEnum
	CompositeKindAttachment
)

func (CompositeKind) Annotation

func (k CompositeKind) Annotation() string

func (CompositeKind) ConstructionKeyword

func (k CompositeKind) ConstructionKeyword() string

func (CompositeKind) DeclarationKind

func (k CompositeKind) DeclarationKind(isInterface bool) DeclarationKind

func (CompositeKind) DestructionKeyword

func (k CompositeKind) DestructionKeyword() any

func (CompositeKind) Keyword

func (k CompositeKind) Keyword() string

func (CompositeKind) MarshalJSON

func (k CompositeKind) MarshalJSON() ([]byte, error)

func (CompositeKind) MoveOperator

func (k CompositeKind) MoveOperator() string

func (CompositeKind) Name

func (k CompositeKind) Name() string

func (CompositeKind) String

func (i CompositeKind) String() string

func (CompositeKind) SupportsAttachments

func (k CompositeKind) SupportsAttachments() bool

func (CompositeKind) SupportsInterfaces

func (k CompositeKind) SupportsInterfaces() bool

func (CompositeKind) TransferOperator

func (k CompositeKind) TransferOperator() string

type ComputationKind

type ComputationKind uint

ComputationKind captures kind of computation that would be used for metring computation

const (
	ComputationKindUnknown ComputationKind = 0
	// interpreter - base
	ComputationKindStatement ComputationKind = ComputationKindRangeStart + iota
	ComputationKindLoop
	ComputationKindFunctionInvocation

	// interpreter value operations
	ComputationKindCreateCompositeValue
	ComputationKindTransferCompositeValue
	ComputationKindDestroyCompositeValue

	ComputationKindCreateArrayValue
	ComputationKindTransferArrayValue
	ComputationKindDestroyArrayValue

	ComputationKindCreateDictionaryValue
	ComputationKindTransferDictionaryValue
	ComputationKindDestroyDictionaryValue

	ComputationKindEncodeValue

	// stdlibs computation kinds
	//
	ComputationKindSTDLIBPanic
	ComputationKindSTDLIBAssert
	ComputationKindSTDLIBRevertibleRandom

	// RLP
	ComputationKindSTDLIBRLPDecodeString
	ComputationKindSTDLIBRLPDecodeList
)

func (ComputationKind) String

func (i ComputationKind) String() string

type ControlStatement

type ControlStatement uint
const (
	ControlStatementUnknown ControlStatement = iota
	ControlStatementBreak
	ControlStatementContinue
)

func (ControlStatement) String

func (i ControlStatement) String() string

func (ControlStatement) Symbol

func (s ControlStatement) Symbol() string

type DeclarationKind

type DeclarationKind uint
const (
	DeclarationKindUnknown DeclarationKind = iota
	DeclarationKindValue
	DeclarationKindFunction
	DeclarationKindVariable
	DeclarationKindConstant
	DeclarationKindType
	DeclarationKindParameter
	DeclarationKindArgumentLabel
	DeclarationKindStructure
	DeclarationKindResource
	DeclarationKindContract
	DeclarationKindEvent
	DeclarationKindField
	DeclarationKindInitializer
	DeclarationKindDestructorLegacy
	DeclarationKindStructureInterface
	DeclarationKindResourceInterface
	DeclarationKindContractInterface
	DeclarationKindEntitlement
	DeclarationKindEntitlementMapping
	DeclarationKindImport
	DeclarationKindSelf
	DeclarationKindBase
	DeclarationKindTransaction
	DeclarationKindPrepare
	DeclarationKindExecute
	DeclarationKindTypeParameter
	DeclarationKindPragma
	DeclarationKindEnum
	DeclarationKindEnumCase
	DeclarationKindAttachment
)

func (DeclarationKind) IsInterfaceDeclaration

func (k DeclarationKind) IsInterfaceDeclaration() bool

func (DeclarationKind) IsTypeDeclaration

func (k DeclarationKind) IsTypeDeclaration() bool

func (DeclarationKind) Keywords

func (k DeclarationKind) Keywords() string

func (DeclarationKind) MarshalJSON

func (k DeclarationKind) MarshalJSON() ([]byte, error)

func (DeclarationKind) Name

func (k DeclarationKind) Name() string

func (DeclarationKind) String

func (i DeclarationKind) String() string

type DeclarationKindSet

type DeclarationKindSet uint64
const (
	EmptyDeclarationKindSet DeclarationKindSet = 0
	AllDeclarationKindsSet  DeclarationKindSet = math.MaxUint64
)

func NewDeclarationKindSet

func NewDeclarationKindSet(declarationKinds ...DeclarationKind) DeclarationKindSet

func (DeclarationKindSet) Has

func (DeclarationKindSet) With

type HasLocation

type HasLocation interface {
	ImportLocation() Location
}

type IdentifierLocation

type IdentifierLocation string

IdentifierLocation

func NewIdentifierLocation

func NewIdentifierLocation(gauge MemoryGauge, id string) IdentifierLocation

func (IdentifierLocation) Description

func (l IdentifierLocation) Description() string

func (IdentifierLocation) ID

func (l IdentifierLocation) ID() string

func (IdentifierLocation) MarshalJSON

func (l IdentifierLocation) MarshalJSON() ([]byte, error)

func (IdentifierLocation) QualifiedIdentifier

func (l IdentifierLocation) QualifiedIdentifier(typeID TypeID) string

func (IdentifierLocation) String

func (l IdentifierLocation) String() string

func (IdentifierLocation) TypeID

func (l IdentifierLocation) TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID

type Incomparable

type Incomparable [0]func()

Incomparable (the zero-sized type [0]func()) makes the surrounding incomparable. It is crucial to ensure its placed at the beginning or middle of the surrounding struct, and NOT at the end of the struct, as otherwise the compiler will add padding bytes. See https://i.hsfzxjy.site/zst-at-the-rear-of-go-struct/ for more details

type IntegerLiteralKind

type IntegerLiteralKind uint
const (
	IntegerLiteralKindUnknown IntegerLiteralKind = iota
	IntegerLiteralKindBinary
	IntegerLiteralKindOctal
	IntegerLiteralKindDecimal
	IntegerLiteralKindHexadecimal
)

func (IntegerLiteralKind) Base

func (k IntegerLiteralKind) Base() int

func (IntegerLiteralKind) Name

func (k IntegerLiteralKind) Name() string

func (IntegerLiteralKind) String

func (i IntegerLiteralKind) String() string

type Location

type Location interface {
	fmt.Stringer
	// TypeID returns a type ID for the given qualified identifier
	TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID
	// QualifiedIdentifier returns the qualified identifier for the given type ID
	QualifiedIdentifier(typeID TypeID) string
	// Description returns a human-readable description. For example, it can be used in error messages
	Description() string
	// ID returns a string representation of the location, including the location prefix.
	// This is helpful to differentiate a location, e.g in the context of code coverage.
	ID() string
}

Location describes the origin of a Cadence script. This could be a file, a transaction, or a smart contract.

func DecodeTypeID

func DecodeTypeID(gauge MemoryGauge, typeID string) (location Location, qualifiedIdentifier string, err error)

type MemoryGauge

type MemoryGauge interface {
	MeterMemory(usage MemoryUsage) error
}

type MemoryKind

type MemoryKind uint

MemoryKind

const (
	MemoryKindUnknown MemoryKind = iota

	MemoryKindAddressValue
	MemoryKindStringValue
	MemoryKindCharacterValue
	MemoryKindNumberValue
	MemoryKindArrayValueBase
	MemoryKindDictionaryValueBase
	MemoryKindCompositeValueBase
	MemoryKindSimpleCompositeValueBase
	MemoryKindOptionalValue
	MemoryKindTypeValue
	MemoryKindPathValue
	MemoryKindCapabilityValue
	MemoryKindStorageReferenceValue
	MemoryKindEphemeralReferenceValue
	MemoryKindInterpretedFunctionValue
	MemoryKindHostFunctionValue
	MemoryKindBoundFunctionValue
	MemoryKindBigInt
	MemoryKindSimpleCompositeValue
	MemoryKindPublishedValue
	MemoryKindStorageCapabilityControllerValue
	MemoryKindAccountCapabilityControllerValue

	// Atree Nodes
	MemoryKindAtreeArrayDataSlab
	MemoryKindAtreeArrayMetaDataSlab
	MemoryKindAtreeArrayElementOverhead
	MemoryKindAtreeMapDataSlab
	MemoryKindAtreeMapMetaDataSlab
	MemoryKindAtreeMapElementOverhead
	MemoryKindAtreeMapPreAllocatedElement
	MemoryKindAtreeEncodedSlab

	// Static Types
	MemoryKindPrimitiveStaticType
	MemoryKindCompositeStaticType
	MemoryKindInterfaceStaticType
	MemoryKindVariableSizedStaticType
	MemoryKindConstantSizedStaticType
	MemoryKindDictionaryStaticType
	MemoryKindInclusiveRangeStaticType
	MemoryKindOptionalStaticType
	MemoryKindIntersectionStaticType
	MemoryKindEntitlementSetStaticAccess
	MemoryKindEntitlementMapStaticAccess
	MemoryKindReferenceStaticType
	MemoryKindCapabilityStaticType
	MemoryKindFunctionStaticType

	// Cadence Values
	MemoryKindCadenceVoidValue
	MemoryKindCadenceOptionalValue
	MemoryKindCadenceBoolValue
	MemoryKindCadenceStringValue
	MemoryKindCadenceCharacterValue
	MemoryKindCadenceAddressValue
	MemoryKindCadenceIntValue
	MemoryKindCadenceNumberValue
	MemoryKindCadenceArrayValueBase
	MemoryKindCadenceArrayValueLength
	MemoryKindCadenceDictionaryValue
	MemoryKindCadenceInclusiveRangeValue
	MemoryKindCadenceKeyValuePair
	MemoryKindCadenceStructValueBase
	MemoryKindCadenceStructValueSize
	MemoryKindCadenceResourceValueBase
	MemoryKindCadenceAttachmentValueBase
	MemoryKindCadenceResourceValueSize
	MemoryKindCadenceAttachmentValueSize
	MemoryKindCadenceEventValueBase
	MemoryKindCadenceEventValueSize
	MemoryKindCadenceContractValueBase
	MemoryKindCadenceContractValueSize
	MemoryKindCadenceEnumValueBase
	MemoryKindCadenceEnumValueSize
	MemoryKindCadencePathValue
	MemoryKindCadenceTypeValue
	MemoryKindCadenceCapabilityValue
	MemoryKindCadenceDeprecatedPathCapabilityType // Deprecated: removed in v1.0.0
	MemoryKindCadenceFunctionValue

	// Cadence Types
	MemoryKindCadenceOptionalType
	MemoryKindCadenceDeprecatedRestrictedType // Deprecated: removed in v1.0.0
	MemoryKindCadenceVariableSizedArrayType
	MemoryKindCadenceConstantSizedArrayType
	MemoryKindCadenceDictionaryType
	MemoryKindCadenceInclusiveRangeType
	MemoryKindCadenceField
	MemoryKindCadenceParameter
	MemoryKindCadenceTypeParameter
	MemoryKindCadenceStructType
	MemoryKindCadenceResourceType
	MemoryKindCadenceAttachmentType
	MemoryKindCadenceEventType
	MemoryKindCadenceContractType
	MemoryKindCadenceStructInterfaceType
	MemoryKindCadenceResourceInterfaceType
	MemoryKindCadenceContractInterfaceType
	MemoryKindCadenceFunctionType
	MemoryKindCadenceEntitlementSetAccess
	MemoryKindCadenceEntitlementMapAccess
	MemoryKindCadenceReferenceType
	MemoryKindCadenceIntersectionType
	MemoryKindCadenceCapabilityType
	MemoryKindCadenceEnumType

	MemoryKindRawString
	MemoryKindAddressLocation
	MemoryKindBytes
	MemoryKindVariable
	MemoryKindCompositeTypeInfo
	MemoryKindCompositeField
	MemoryKindInvocation
	MemoryKindStorageMap
	MemoryKindStorageKey

	MemoryKindTypeToken
	MemoryKindErrorToken
	MemoryKindSpaceToken

	MemoryKindProgram
	MemoryKindIdentifier
	MemoryKindArgument
	MemoryKindBlock
	MemoryKindFunctionBlock
	MemoryKindParameter
	MemoryKindParameterList
	MemoryKindTypeParameter
	MemoryKindTypeParameterList
	MemoryKindTransfer
	MemoryKindMembers
	MemoryKindTypeAnnotation
	MemoryKindDictionaryEntry

	MemoryKindFunctionDeclaration
	MemoryKindCompositeDeclaration
	MemoryKindAttachmentDeclaration
	MemoryKindInterfaceDeclaration
	MemoryKindEntitlementDeclaration
	MemoryKindEntitlementMappingElement
	MemoryKindEntitlementMappingDeclaration
	MemoryKindEnumCaseDeclaration
	MemoryKindFieldDeclaration
	MemoryKindTransactionDeclaration
	MemoryKindImportDeclaration
	MemoryKindVariableDeclaration
	MemoryKindSpecialFunctionDeclaration
	MemoryKindPragmaDeclaration

	MemoryKindAssignmentStatement
	MemoryKindBreakStatement
	MemoryKindContinueStatement
	MemoryKindEmitStatement
	MemoryKindExpressionStatement
	MemoryKindForStatement
	MemoryKindIfStatement
	MemoryKindReturnStatement
	MemoryKindSwapStatement
	MemoryKindSwitchStatement
	MemoryKindWhileStatement
	MemoryKindRemoveStatement

	MemoryKindBooleanExpression
	MemoryKindVoidExpression
	MemoryKindNilExpression
	MemoryKindStringExpression
	MemoryKindIntegerExpression
	MemoryKindFixedPointExpression
	MemoryKindArrayExpression
	MemoryKindStringTemplateExpression
	MemoryKindDictionaryExpression
	MemoryKindIdentifierExpression
	MemoryKindInvocationExpression
	MemoryKindMemberExpression
	MemoryKindIndexExpression
	MemoryKindConditionalExpression
	MemoryKindUnaryExpression
	MemoryKindBinaryExpression
	MemoryKindFunctionExpression
	MemoryKindCastingExpression
	MemoryKindCreateExpression
	MemoryKindDestroyExpression
	MemoryKindReferenceExpression
	MemoryKindForceExpression
	MemoryKindPathExpression
	MemoryKindAttachExpression

	MemoryKindConstantSizedType
	MemoryKindDictionaryType
	MemoryKindFunctionType
	MemoryKindInstantiationType
	MemoryKindNominalType
	MemoryKindOptionalType
	MemoryKindReferenceType
	MemoryKindIntersectionType
	MemoryKindVariableSizedType

	MemoryKindPosition
	MemoryKindRange

	MemoryKindElaboration
	MemoryKindActivation
	MemoryKindActivationEntries

	// sema types
	MemoryKindVariableSizedSemaType
	MemoryKindConstantSizedSemaType
	MemoryKindDictionarySemaType
	MemoryKindOptionalSemaType
	MemoryKindIntersectionSemaType
	MemoryKindReferenceSemaType
	MemoryKindEntitlementSemaType
	MemoryKindEntitlementMapSemaType
	MemoryKindEntitlementRelationSemaType
	MemoryKindCapabilitySemaType
	MemoryKindInclusiveRangeSemaType

	// ordered-map
	MemoryKindOrderedMap
	MemoryKindOrderedMapEntryList
	MemoryKindOrderedMapEntry

	// Placeholder kind to allow consistent indexing
	// this should always be the last kind
	MemoryKindLast
)

func (MemoryKind) String

func (i MemoryKind) String() string

type MemoryUsage

type MemoryUsage struct {
	Kind   MemoryKind
	Amount uint64
}

func NewArrayExpressionMemoryUsage

func NewArrayExpressionMemoryUsage(length int) MemoryUsage

func NewAtreeEncodedSlabMemoryUsage

func NewAtreeEncodedSlabMemoryUsage(slabsCount uint) MemoryUsage

func NewAtreeMapPreAllocatedElementsMemoryUsage

func NewAtreeMapPreAllocatedElementsMemoryUsage(count uint64, elementSize uint) MemoryUsage

func NewBigIntMemoryUsage

func NewBigIntMemoryUsage(bytes int) MemoryUsage

func NewBitwiseAndBigIntMemoryUsage

func NewBitwiseAndBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewBitwiseLeftShiftBigIntMemoryUsage

func NewBitwiseLeftShiftBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewBitwiseOrBigIntMemoryUsage

func NewBitwiseOrBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewBitwiseRightShiftBigIntMemoryUsage

func NewBitwiseRightShiftBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewBitwiseXorBigIntMemoryUsage

func NewBitwiseXorBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewBytesMemoryUsage

func NewBytesMemoryUsage(length int) MemoryUsage

func NewCadenceBigIntMemoryUsage

func NewCadenceBigIntMemoryUsage(bytes int) MemoryUsage

func NewCadenceCharacterMemoryUsage

func NewCadenceCharacterMemoryUsage(length int) MemoryUsage

func NewCadenceIntMemoryUsage

func NewCadenceIntMemoryUsage(bytes int) MemoryUsage

func NewCadenceNumberMemoryUsage

func NewCadenceNumberMemoryUsage(bytes int) MemoryUsage

func NewCadenceStringMemoryUsage

func NewCadenceStringMemoryUsage(length int) MemoryUsage

func NewCharacterMemoryUsage

func NewCharacterMemoryUsage(length int) MemoryUsage

func NewConstantMemoryUsage

func NewConstantMemoryUsage(kind MemoryKind) MemoryUsage

func NewDictionaryExpressionMemoryUsage

func NewDictionaryExpressionMemoryUsage(length int) MemoryUsage

func NewDivBigIntMemoryUsage

func NewDivBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewMembersMemoryUsage

func NewMembersMemoryUsage(length int) MemoryUsage

func NewMinusBigIntMemoryUsage

func NewMinusBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewModBigIntMemoryUsage

func NewModBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewMulBigIntMemoryUsage

func NewMulBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewNegateBigIntMemoryUsage

func NewNegateBigIntMemoryUsage(b *big.Int) MemoryUsage

func NewNumberMemoryUsage

func NewNumberMemoryUsage(bytes int) MemoryUsage

func NewPlusBigIntMemoryUsage

func NewPlusBigIntMemoryUsage(a, b *big.Int) MemoryUsage

func NewRawStringMemoryUsage

func NewRawStringMemoryUsage(length int) MemoryUsage

func NewSimpleCompositeMemoryUsage

func NewSimpleCompositeMemoryUsage(length int) MemoryUsage

func NewStringMemoryUsage

func NewStringMemoryUsage(length int) MemoryUsage

func NewStringTemplateExpressionMemoryUsage added in v1.3.0

func NewStringTemplateExpressionMemoryUsage(length int) MemoryUsage

type OperandSide

type OperandSide uint
const (
	OperandSideUnknown OperandSide = iota
	OperandSideLeft
	OperandSideRight
)

func (OperandSide) Name

func (s OperandSide) Name() string

func (OperandSide) String

func (i OperandSide) String() string

type OperationKind

type OperationKind uint
const (
	OperationKindUnknown OperationKind = iota
	OperationKindUnary
	OperationKindBinary
	OperationKindTernary
)

func (OperationKind) Name

func (k OperationKind) Name() string

func (OperationKind) String

func (i OperationKind) String() string

type PathDomain

type PathDomain uint8
const (
	PathDomainUnknown PathDomain = iota
	PathDomainStorage
	PathDomainPrivate
	PathDomainPublic
)

func PathDomainFromIdentifier

func PathDomainFromIdentifier(domain string) PathDomain

func (PathDomain) Identifier

func (i PathDomain) Identifier() string

func (PathDomain) StorageDomain added in v1.3.0

func (i PathDomain) StorageDomain() StorageDomain

func (PathDomain) String

func (i PathDomain) String() string

type REPLLocation

type REPLLocation struct{}

REPLLocation

func (REPLLocation) Description

func (l REPLLocation) Description() string

func (REPLLocation) ID

func (l REPLLocation) ID() string

func (REPLLocation) MarshalJSON

func (l REPLLocation) MarshalJSON() ([]byte, error)

func (REPLLocation) QualifiedIdentifier

func (l REPLLocation) QualifiedIdentifier(typeID TypeID) string

func (REPLLocation) String

func (l REPLLocation) String() string

func (REPLLocation) TypeID

func (l REPLLocation) TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID

type ScriptLocation

type ScriptLocation [ScriptIDLength]byte

ScriptLocation

func NewScriptLocation

func NewScriptLocation(gauge MemoryGauge, identifier []byte) (location ScriptLocation)

func (ScriptLocation) Description

func (l ScriptLocation) Description() string

func (ScriptLocation) ID

func (l ScriptLocation) ID() string

func (ScriptLocation) MarshalJSON

func (l ScriptLocation) MarshalJSON() ([]byte, error)

func (ScriptLocation) QualifiedIdentifier

func (l ScriptLocation) QualifiedIdentifier(typeID TypeID) string

func (ScriptLocation) String

func (l ScriptLocation) String() string

func (ScriptLocation) TypeID

func (l ScriptLocation) TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID

type StorageDomain added in v1.3.0

type StorageDomain uint8

StorageDomain is used to store domain values on chain.

!!! *WARNING* !!!

Only add new StorageDomain by: - appending to the end.

Only remove StorageDomain by: - replacing existing StorageDomain with a placeholder `_`.

DO *NOT* REPLACE EXISTING STORAGEDOMAIN! DO *NOT* REMOVE EXISTING STORAGEDOMAIN! DO *NOT* INSERT NEW STORAGEDOMAIN IN BETWEEN!

const (
	StorageDomainUnknown StorageDomain = iota

	StorageDomainPathStorage

	StorageDomainPathPrivate

	StorageDomainPathPublic

	StorageDomainContract

	StorageDomainInbox

	// StorageDomainCapabilityController is the storage domain which stores
	// capability controllers by capability ID
	StorageDomainCapabilityController

	// StorageDomainCapabilityControllerTag is the storage domain which stores
	// capability controller tags by capability ID
	StorageDomainCapabilityControllerTag

	// StorageDomainPathCapability is the storage domain which stores
	// capability ID dictionaries (sets) by storage path identifier
	StorageDomainPathCapability

	// StorageDomainAccountCapability is the storage domain which
	// records active account capability controller IDs
	StorageDomainAccountCapability
)

func StorageDomainFromIdentifier added in v1.3.0

func StorageDomainFromIdentifier(domain string) (StorageDomain, bool)

func StorageDomainFromUint64 added in v1.3.0

func StorageDomainFromUint64(i uint64) (StorageDomain, error)

func (StorageDomain) Identifier added in v1.3.0

func (d StorageDomain) Identifier() string

type StringLocation

type StringLocation string

StringLocation

func NewStringLocation

func NewStringLocation(gauge MemoryGauge, id string) StringLocation

func (StringLocation) Description

func (l StringLocation) Description() string

func (StringLocation) ID

func (l StringLocation) ID() string

func (StringLocation) MarshalJSON

func (l StringLocation) MarshalJSON() ([]byte, error)

func (StringLocation) QualifiedIdentifier

func (l StringLocation) QualifiedIdentifier(typeID TypeID) string

func (StringLocation) String

func (l StringLocation) String() string

func (StringLocation) TypeID

func (l StringLocation) TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID

type TransactionLocation

type TransactionLocation [TransactionIDLength]byte

TransactionLocation

func NewTransactionLocation

func NewTransactionLocation(gauge MemoryGauge, identifier []byte) (location TransactionLocation)

func (TransactionLocation) Description

func (l TransactionLocation) Description() string

func (TransactionLocation) ID

func (l TransactionLocation) ID() string

func (TransactionLocation) MarshalJSON

func (l TransactionLocation) MarshalJSON() ([]byte, error)

func (TransactionLocation) QualifiedIdentifier

func (l TransactionLocation) QualifiedIdentifier(typeID TypeID) string

func (TransactionLocation) String

func (l TransactionLocation) String() string

func (TransactionLocation) TypeID

func (l TransactionLocation) TypeID(memoryGauge MemoryGauge, qualifiedIdentifier string) TypeID

type TypeID

type TypeID string

TypeID

func NewTypeIDFromQualifiedName

func NewTypeIDFromQualifiedName(memoryGauge MemoryGauge, location Location, qualifiedIdentifier string) TypeID

type TypeIDDecoder

type TypeIDDecoder func(gauge MemoryGauge, typeID string) (location Location, qualifiedIdentifier string, err error)

Directories

Path Synopsis
Package list implements a doubly linked list.
Package list implements a doubly linked list.

Jump to

Keyboard shortcuts

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