cli

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package cli defines constants, configurations, and utilities that are used across the Flow CLI.

Index

Constants

View Source
const (
	EnvPrefix           = "FLOW"
	DefaultSigAlgo      = crypto.ECDSA_P256
	DefaultHashAlgo     = crypto.SHA3_256
	DefaultHost         = "127.0.0.1:3569"
	UFix64DecimalPlaces = 8
)

Variables

View Source
var ConfigPath = "flow.json"

Functions

func ConfigExists

func ConfigExists() bool

func ExecuteScript

func ExecuteScript(host string, script []byte)

func Exit

func Exit(code int, msg string)

func Exitf

func Exitf(code int, msg string, args ...interface{})

func FixedPointToString

func FixedPointToString(amount uint64, decimalPlaces int) string

FixedPointToString converts the given amount to a string with the given number of decimal places.

func FormatUFix64

func FormatUFix64(flow uint64) string

func GcloudApplicationSignin added in v0.12.0

func GcloudApplicationSignin(project string)

GcloudApplicationSignin signs in as an application user using gcloud command line tool currently assumes gcloud is already installed on the machine will by default pop a browser window to sign in

func GetAccount

func GetAccount(host string, address flow.Address) *flow.Account

func GetBlockByHeight

func GetBlockByHeight(host string, height uint64) *flow.Block

func GetBlockByID

func GetBlockByID(host string, blockID flow.Identifier) *flow.Block

func GetBlockEvents

func GetBlockEvents(host string, height uint64, eventType string)

func GetCollectionByID

func GetCollectionByID(host string, collectionID flow.Identifier) *flow.Collection

func GetLatestBlock

func GetLatestBlock(host string) *flow.Block

func GetTransactionResult

func GetTransactionResult(host string, id string, sealed bool, showTransactionCode bool)

func KeyContextFromKMSResourceID added in v0.12.0

func KeyContextFromKMSResourceID(resourceID string) (map[string]string, error)

func MustDecodePrivateKeyHex

func MustDecodePrivateKeyHex(sigAlgo crypto.SignatureAlgorithm, prKeyHex string) crypto.PrivateKey

func MustDecodePublicKeyHex

func MustDecodePublicKeyHex(sigAlgo crypto.SignatureAlgorithm, pubKeyHex string) crypto.PublicKey

func MustSaveConfig

func MustSaveConfig(conf *Config)

func RandomSeed

func RandomSeed(n int) []byte

func SaveConfig

func SaveConfig(conf *Config) error

func SendTransaction

func SendTransaction(host string, signerAccount *Account, tx *flow.Transaction, withResults bool)

Types

type Account

type Account struct {
	KeyType    KeyType
	KeyIndex   int
	KeyContext map[string]string
	Address    flow.Address
	PrivateKey crypto.PrivateKey
	SigAlgo    crypto.SignatureAlgorithm
	HashAlgo   crypto.HashAlgorithm
	Signer     crypto.Signer
}

func (*Account) LoadSigner added in v0.12.0

func (account *Account) LoadSigner() error

func (*Account) MarshalJSON

func (acct *Account) MarshalJSON() ([]byte, error)

func (*Account) UnmarshalJSON

func (acct *Account) UnmarshalJSON(data []byte) (err error)

type Config

type Config struct {
	Host     string              `json:"host"`
	Accounts map[string]*Account `json:"accounts"`
}

func LoadConfig

func LoadConfig() *Config

func NewConfig

func NewConfig() *Config

func (*Config) HostWithOverride

func (c *Config) HostWithOverride(overrideIfNotEmpty string) string

func (*Config) LoadSigners added in v0.12.0

func (c *Config) LoadSigners() error

func (*Config) ServiceAccount

func (c *Config) ServiceAccount() *Account

func (*Config) SetServiceAccountKey

func (c *Config) SetServiceAccountKey(privateKey crypto.PrivateKey, hashAlgo crypto.HashAlgorithm)

type KeyType added in v0.12.0

type KeyType string
const (
	KeyTypeHex   KeyType = "hex"   // Hex private key with in memory signer
	KeyTypeKMS   KeyType = "kms"   // Google KMS signer
	KeyTypeShell KeyType = "shell" // Exec out to a shell script

)

Jump to

Keyboard shortcuts

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