util

package
v1.21.0-cadence-v1.0.0... Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const EnvPrefix = "FLOW"

Variables

View Source
var TestID = flow.HexToID("24993fc99f81641c45c0afa307e683b4f08d407d90041aa9439f487acb33d633")

Functions

func AddCDCExtension added in v1.20.0

func AddCDCExtension(name string) string

func AddToGitIgnore

func AddToGitIgnore(filename string, loader flowkit.ReaderWriter) error

AddToGitIgnore adds a new line to the .gitignore if one doesn't exist it creates it.

func CheckNetwork

func CheckNetwork(network config.Network) error

func CreateTabWriter

func CreateTabWriter(b *bytes.Buffer) *tabwriter.Writer

func Exit

func Exit(code int, msg string)

func GetAccountByContractName

func GetAccountByContractName(state *flowkit.State, contractName string, network config.Network) (*accounts.Account, error)

func GetAddressByContractName

func GetAddressByContractName(state *flowkit.State, contractName string, network config.Network) (flow.Address, error)

func GetAddressNetwork

func GetAddressNetwork(address flowsdk.Address) (flowsdk.ChainID, error)

GetAddressNetwork returns the chain ID for an address.

func MessageWithEmojiPrefix added in v1.18.0

func MessageWithEmojiPrefix(emoji string, message string) string

func NormalizeLineEndings added in v1.19.0

func NormalizeLineEndings(s string) string

func Pluralize

func Pluralize(word string, count int) string

func PrintEmoji added in v1.18.0

func PrintEmoji(emoji string) string

func StripCDCExtension added in v1.20.0

func StripCDCExtension(name string) string

func TestMocks

func TestMocks(t *testing.T) (*mocks.MockServices, *flowkit.State, flowkit.ReaderWriter)

TestMocks creates mock flowkit services, an empty state and a mock reader writer

func ValidateECDSAP256Pub

func ValidateECDSAP256Pub(key string) error

ValidateECDSAP256Pub attempt to decode the hex string representation of a ECDSA P256 public key

Types

type StandardLibrary

type StandardLibrary struct {
	BaseValueActivation *sema.VariableActivation
}

func NewScriptStandardLibrary

func NewScriptStandardLibrary() (result StandardLibrary)

func NewStandardLibrary

func NewStandardLibrary() (result StandardLibrary)

func (StandardLibrary) AccountKeysCount

func (StandardLibrary) AccountKeysCount(_ common.Address) (uint64, error)

func (StandardLibrary) AddAccountKey

func (StandardLibrary) AddAccountKey(
	_ common.Address,
	_ *stdlib.PublicKey,
	_ sema.HashAlgorithm,
	_ int,
) (
	*stdlib.AccountKey,
	error,
)

func (StandardLibrary) AddEncodedAccountKey

func (StandardLibrary) AddEncodedAccountKey(_ common.Address, _ []byte) error

func (StandardLibrary) BLSAggregatePublicKeys

func (StandardLibrary) BLSAggregatePublicKeys(_ []*stdlib.PublicKey) (*stdlib.PublicKey, error)

func (StandardLibrary) BLSAggregateSignatures

func (StandardLibrary) BLSAggregateSignatures(_ [][]byte) ([]byte, error)

func (StandardLibrary) BLSVerifyPOP

func (StandardLibrary) BLSVerifyPOP(_ *stdlib.PublicKey, _ []byte) (bool, error)

func (StandardLibrary) CommitStorageTemporarily

func (StandardLibrary) CommitStorageTemporarily(_ *interpreter.Interpreter) error

func (StandardLibrary) ContractUpdateRecorded

func (StandardLibrary) ContractUpdateRecorded(_ common.AddressLocation) bool

func (StandardLibrary) CreateAccount

func (StandardLibrary) CreateAccount(_ common.Address) (address common.Address, err error)

func (StandardLibrary) EmitEvent

func (StandardLibrary) EndContractAddition

func (StandardLibrary) EndContractAddition(_ common.AddressLocation)

func (StandardLibrary) GenerateAccountID

func (l StandardLibrary) GenerateAccountID(_ common.Address) (uint64, error)

func (StandardLibrary) GetAccountAvailableBalance

func (StandardLibrary) GetAccountAvailableBalance(_ common.Address) (uint64, error)

func (StandardLibrary) GetAccountBalance

func (StandardLibrary) GetAccountBalance(_ common.Address) (uint64, error)

func (StandardLibrary) GetAccountContractCode

func (StandardLibrary) GetAccountContractCode(_ common.AddressLocation) ([]byte, error)

func (StandardLibrary) GetAccountContractNames

func (StandardLibrary) GetAccountContractNames(_ common.Address) ([]string, error)

func (StandardLibrary) GetAccountKey

func (StandardLibrary) GetAccountKey(_ common.Address, _ int) (*stdlib.AccountKey, error)

func (StandardLibrary) GetBlockAtHeight

func (StandardLibrary) GetBlockAtHeight(_ uint64) (stdlib.Block, bool, error)

func (StandardLibrary) GetCurrentBlockHeight

func (StandardLibrary) GetCurrentBlockHeight() (uint64, error)

func (StandardLibrary) GetStorageCapacity

func (StandardLibrary) GetStorageCapacity(_ common.Address) (uint64, error)

func (StandardLibrary) GetStorageUsed

func (StandardLibrary) GetStorageUsed(_ common.Address) (uint64, error)

func (StandardLibrary) Hash

func (StandardLibrary) Hash(_ []byte, _ string, _ sema.HashAlgorithm) ([]byte, error)

func (StandardLibrary) IsContractBeingAdded

func (StandardLibrary) IsContractBeingAdded(_ common.AddressLocation) bool

func (StandardLibrary) ParseAndCheckProgram

func (StandardLibrary) ParseAndCheckProgram(_ []byte, _ common.Location, _ bool) (*interpreter.Program, error)

func (StandardLibrary) ProgramLog

func (StandardLibrary) ReadRandom

func (l StandardLibrary) ReadRandom(_ []byte) error

func (StandardLibrary) RecordContractRemoval

func (StandardLibrary) RecordContractRemoval(_ common.AddressLocation)

func (StandardLibrary) RecordContractUpdate

func (StandardLibrary) RecordContractUpdate(_ common.AddressLocation, _ *interpreter.CompositeValue)

func (StandardLibrary) RemoveAccountContractCode

func (StandardLibrary) RemoveAccountContractCode(_ common.AddressLocation) error

func (StandardLibrary) RevokeAccountKey

func (StandardLibrary) RevokeAccountKey(_ common.Address, _ int) (*stdlib.AccountKey, error)

func (StandardLibrary) RevokeEncodedAccountKey

func (StandardLibrary) RevokeEncodedAccountKey(_ common.Address, _ int) ([]byte, error)

func (StandardLibrary) StartContractAddition

func (StandardLibrary) StartContractAddition(_ common.AddressLocation)

func (StandardLibrary) TemporarilyRecordCode

func (StandardLibrary) TemporarilyRecordCode(_ common.AddressLocation, _ []byte)

func (StandardLibrary) UnsafeRandom

func (StandardLibrary) UnsafeRandom() (uint64, error)

func (StandardLibrary) UpdateAccountContractCode

func (StandardLibrary) UpdateAccountContractCode(_ common.AddressLocation, _ []byte) error

func (StandardLibrary) ValidatePublicKey

func (StandardLibrary) ValidatePublicKey(_ *stdlib.PublicKey) error

func (StandardLibrary) VerifySignature

func (StandardLibrary) VerifySignature(
	_ []byte,
	_ string,
	_ []byte,
	_ []byte,
	_ sema.SignatureAlgorithm,
	_ sema.HashAlgorithm,
) (bool, error)

Jump to

Keyboard shortcuts

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