project

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(path string) bool

Exists checks if a project configuration exists.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func AccountFromAddressAndKey

func AccountFromAddressAndKey(address flow.Address, privateKey crypto.PrivateKey) *Account

func AccountFromConfig

func AccountFromConfig(accountConf config.Account) (*Account, error)

func (*Account) Address

func (a *Account) Address() flow.Address

func (*Account) DefaultKey

func (a *Account) DefaultKey() AccountKey

func (*Account) Keys

func (a *Account) Keys() []AccountKey

func (*Account) Name

func (a *Account) Name() string

func (*Account) SetDefaultKey

func (a *Account) SetDefaultKey(key AccountKey)

type AccountKey

type AccountKey interface {
	Type() config.KeyType
	Index() int
	SigAlgo() crypto.SignatureAlgorithm
	HashAlgo() crypto.HashAlgorithm
	Signer(ctx context.Context) (crypto.Signer, error)
	ToConfig() config.AccountKey
	Validate() error
}

func NewAccountKey

func NewAccountKey(accountKeyConf config.AccountKey) (AccountKey, error)

type Aliases added in v0.18.0

type Aliases map[string]string

type Contract

type Contract struct {
	Name   string
	Source string
	Target flow.Address
	Args   []cadence.Value
}

Contract is a Cadence contract definition for a project.

type HexAccountKey

type HexAccountKey struct {
	// contains filtered or unexported fields
}

func NewHexAccountKeyFromPrivateKey

func NewHexAccountKeyFromPrivateKey(
	index int,
	hashAlgo crypto.HashAlgorithm,
	privateKey crypto.PrivateKey,
) *HexAccountKey

func (HexAccountKey) HashAlgo

func (a HexAccountKey) HashAlgo() crypto.HashAlgorithm

func (HexAccountKey) Index

func (a HexAccountKey) Index() int

func (*HexAccountKey) PrivateKey

func (a *HexAccountKey) PrivateKey() crypto.PrivateKey

func (*HexAccountKey) PrivateKeyHex

func (a *HexAccountKey) PrivateKeyHex() string

func (HexAccountKey) SigAlgo

func (a HexAccountKey) SigAlgo() crypto.SignatureAlgorithm

func (*HexAccountKey) Signer

func (a *HexAccountKey) Signer(ctx context.Context) (crypto.Signer, error)

func (*HexAccountKey) ToConfig

func (a *HexAccountKey) ToConfig() config.AccountKey

func (HexAccountKey) Type

func (a HexAccountKey) Type() config.KeyType

func (HexAccountKey) Validate added in v0.18.0

func (a HexAccountKey) Validate() error

type KmsAccountKey

type KmsAccountKey struct {
	// contains filtered or unexported fields
}

func (KmsAccountKey) HashAlgo

func (a KmsAccountKey) HashAlgo() crypto.HashAlgorithm

func (KmsAccountKey) Index

func (a KmsAccountKey) Index() int

func (KmsAccountKey) SigAlgo

func (a KmsAccountKey) SigAlgo() crypto.SignatureAlgorithm

func (*KmsAccountKey) Signer

func (a *KmsAccountKey) Signer(ctx context.Context) (crypto.Signer, error)

func (*KmsAccountKey) ToConfig

func (a *KmsAccountKey) ToConfig() config.AccountKey

func (KmsAccountKey) Type

func (a KmsAccountKey) Type() config.KeyType

func (*KmsAccountKey) Validate added in v0.18.0

func (a *KmsAccountKey) Validate() error

type Project

type Project struct {
	// contains filtered or unexported fields
}

Project contains the configuration for a Flow project.

func Init

func Init(sigAlgo crypto.SignatureAlgorithm, hashAlgo crypto.HashAlgorithm) (*Project, error)

Init initializes a new Flow project.

func Load

func Load(configFilePaths []string) (*Project, error)

Load loads a project configuration and returns the resulting project.

func (*Project) AccountByAddress

func (p *Project) AccountByAddress(address string) *Account

AccountByAddress returns an account by address.

func (*Project) AccountByName

func (p *Project) AccountByName(name string) *Account

AccountByName returns an account by name.

func (*Project) AccountNamesForNetwork

func (p *Project) AccountNamesForNetwork(network string) []string

AccountNamesForNetwork returns all configured account names for a network.

func (*Project) AddOrUpdateAccount

func (p *Project) AddOrUpdateAccount(account *Account)

AddOrUpdateAccount adds or updates an account.

func (*Project) AliasesForNetwork

func (p *Project) AliasesForNetwork(network string) Aliases

AliasesForNetwork returns all deployment aliases for a network.

func (*Project) Config added in v0.19.0

func (p *Project) Config() *config.Config

Config get project configuration

func (*Project) ContractConflictExists

func (p *Project) ContractConflictExists(network string) bool

CheckContractConflict returns true if the same contract is configured to deploy to more than one account in the same network.

The CLI currently does not allow the same contract to be deployed to multiple accounts in the same network.

func (*Project) DeploymentContractsByNetwork added in v0.19.0

func (p *Project) DeploymentContractsByNetwork(network string) ([]Contract, error)

DeploymentContractsByNetwork returns all contracts for a network.

func (*Project) EmulatorServiceAccount

func (p *Project) EmulatorServiceAccount() (*Account, error)

EmulatorServiceAccount returns the service account for the default emulator profilee.

func (*Project) NetworkByName

func (p *Project) NetworkByName(name string) *config.Network

NetworkByName returns a network by name.

func (*Project) RemoveAccount added in v0.19.0

func (p *Project) RemoveAccount(name string) error

RemoveAccount removes an account from configuration

func (*Project) Save

func (p *Project) Save(path string) error

Save saves the project configuration to the given path.

func (*Project) SaveDefault added in v0.19.0

func (p *Project) SaveDefault() error

SaveDefault saves configuration to default path

func (*Project) SetEmulatorServiceKey

func (p *Project) SetEmulatorServiceKey(privateKey crypto.PrivateKey)

SetEmulatorServiceKey sets the default emulator service account private key.

type Transaction added in v0.18.0

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction builder of flow transactions

func NewAddAccountContractTransaction added in v0.18.0

func NewAddAccountContractTransaction(
	signer *Account,
	name string,
	source string,
	args []cadence.Value,
) (*Transaction, error)

NewAddAccountContractTransaction add new contract to the account

func NewCreateAccountTransaction added in v0.18.0

func NewCreateAccountTransaction(
	signer *Account,
	keys []*flow.AccountKey,
	contractArgs []string,
) (*Transaction, error)

NewCreateAccountTransaction creates new transaction for account

func NewRemoveAccountContractTransaction added in v0.18.0

func NewRemoveAccountContractTransaction(signer *Account, name string) (*Transaction, error)

NewRemoveAccountContractTransaction creates new transaction to remove contract

func NewTransaction added in v0.18.0

func NewTransaction() *Transaction

NewTransaction create new instance of transaction

func NewTransactionFromPayload added in v0.18.0

func NewTransactionFromPayload(filename string) (*Transaction, error)

NewTransactionFromPayload build transaction from payload

func NewUpdateAccountContractTransaction added in v0.18.0

func NewUpdateAccountContractTransaction(signer *Account, name string, source string) (*Transaction, error)

NewUpdateAccountContractTransaction update account contract

func (*Transaction) AddArgument added in v0.18.0

func (t *Transaction) AddArgument(arg cadence.Value) error

AddArgument add cadence typed argument

func (*Transaction) AddArguments added in v0.18.0

func (t *Transaction) AddArguments(args []cadence.Value) error

AddArguments add array of cadence arguments

func (*Transaction) AddAuthorizers added in v0.18.0

func (t *Transaction) AddAuthorizers(authorizers []flow.Address) *Transaction

AddAuthorizers add group of authorizers

func (*Transaction) AddRawArguments added in v0.18.0

func (t *Transaction) AddRawArguments(args []string, argsJSON string) error

AddRawArguments add raw arguments to tx

func (*Transaction) FlowTransaction added in v0.18.0

func (t *Transaction) FlowTransaction() *flow.Transaction

FlowTransaction get flow transaction

func (*Transaction) Proposer added in v0.18.0

func (t *Transaction) Proposer() *flow.Account

Proposer get proposer

func (*Transaction) SetBlockReference added in v0.18.0

func (t *Transaction) SetBlockReference(block *flow.Block) *Transaction

SetBlockReference sets block reference for transaction

func (*Transaction) SetGasLimit added in v0.20.1

func (t *Transaction) SetGasLimit(gasLimit uint64) *Transaction

SetGasLimit sets the gas limit for transaction

func (*Transaction) SetPayer added in v0.18.0

func (t *Transaction) SetPayer(address flow.Address) *Transaction

SetPayer sets the payer for transaction

func (*Transaction) SetProposer added in v0.18.0

func (t *Transaction) SetProposer(proposer *flow.Account, keyIndex int) *Transaction

SetProposer sets the proposer for transaction

func (*Transaction) SetScriptWithArgs added in v0.18.0

func (t *Transaction) SetScriptWithArgs(script []byte, args []string, argsJSON string) error

func (*Transaction) SetSigner added in v0.18.0

func (t *Transaction) SetSigner(account *Account) error

SetSigner sets the signer for transaction

func (*Transaction) Sign added in v0.18.0

func (t *Transaction) Sign() (*Transaction, error)

Sign signs transaction using signer account

func (*Transaction) Signer added in v0.18.0

func (t *Transaction) Signer() *Account

Signer get signer

Jump to

Keyboard shortcuts

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