flowkit

package module
v1.0.0-beta03 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 39 Imported by: 1

README

Flowkit Package Design

Flowkit is a core package used by the CLI commands. It features APIs for interacting with the Flow network in the context of flow.json configuration values. Flowkit is defined by the interface here.

Flowkit contains multiple subpackages, the most important ones are:

  • config: parsing and storing of flow.json values, as well as validation,
  • gateway: implementation of Flow AN methods, uses emulator as well as Go SDK to communicate with ANs,
  • project: stateful operations on top of flow.json, which allows resolving imports in contracts used in deployments

It is important we define clear boundaries between flowkit and other CLI packages. If we are in doubt where certain methods should be implemented we must ask ourselves if the method provides value for any other consumers of the pacakge or only provides utility for CLI usage, if it's only providing utility for CLI then it should be added inside the internal package, instead of flowkit. If in doubt better to add things to internal package and then move to flowkit if such need is identified.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LatestBlockQuery = BlockQuery{Latest: true}

LatestBlockQuery specifies the latest block.

View Source
var LatestScriptQuery = ScriptQuery{Latest: true}

LatestScriptQuery specifies the latest block at which query is executed.

Functions

func Exists

func Exists(path string) bool

Exists checks if a project configuration exists.

func ParseArgumentsJSON

func ParseArgumentsJSON(input string) ([]cadence.Value, error)

func ParseArgumentsWithoutType

func ParseArgumentsWithoutType(fileName string, code []byte, args []string) (scriptArgs []cadence.Value, err error)

Types

type Account

type Account struct {
	Name    string
	Address flow.Address
	Key     AccountKey
}

Account is defined by an address and name and contains an AccountKey which can be used for signing.

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
	PrivateKey() (*crypto.PrivateKey, error)
}

AccountKey is a flowkit specific account key implementation allowing us to sign the transactions using different implemented methods.

type AccountPublicKey

type AccountPublicKey struct {
	Public   crypto.PublicKey
	Weight   int
	SigAlgo  crypto.SignatureAlgorithm
	HashAlgo crypto.HashAlgorithm
}

AccountPublicKey holds information about the account key.

type Accounts

type Accounts []Account

Accounts is a collection of account.

func (*Accounts) AddOrUpdate

func (a *Accounts) AddOrUpdate(account *Account)

AddOrUpdate add account if missing or updates if present.

func (Accounts) ByAddress

func (a Accounts) ByAddress(address flow.Address) (*Account, error)

ByAddress get an account by address.

func (Accounts) ByName

func (a Accounts) ByName(name string) (*Account, error)

ByName get an account by name or returns and error if no account found

func (*Accounts) Names

func (a *Accounts) Names() []string

func (*Accounts) Remove

func (a *Accounts) Remove(name string) error

Remove an account.

func (*Accounts) String

func (a *Accounts) String() string

type Bip44AccountKey

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

Bip44AccountKey implements https://github.com/onflow/flow/blob/master/flips/20201125-bip-44-multi-account.md

func (Bip44AccountKey) HashAlgo

func (a Bip44AccountKey) HashAlgo() crypto.HashAlgorithm

func (Bip44AccountKey) Index

func (a Bip44AccountKey) Index() int

func (*Bip44AccountKey) PrivateKey

func (a *Bip44AccountKey) PrivateKey() (*crypto.PrivateKey, error)

func (*Bip44AccountKey) PrivateKeyHex

func (a *Bip44AccountKey) PrivateKeyHex() string

func (Bip44AccountKey) SigAlgo

func (a Bip44AccountKey) SigAlgo() crypto.SignatureAlgorithm

func (*Bip44AccountKey) Signer

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

func (*Bip44AccountKey) ToConfig

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

func (Bip44AccountKey) Type

func (a Bip44AccountKey) Type() config.KeyType

func (*Bip44AccountKey) Validate

func (a *Bip44AccountKey) Validate() error

type BlockQuery

type BlockQuery struct {
	ID     *flow.Identifier
	Height uint64
	Latest bool
}

BlockQuery defines possible queries for block.

func NewBlockQuery

func NewBlockQuery(query string) (BlockQuery, error)

NewBlockQuery creates block query based on the passed query value.

Query string options: - "latest" : return the latest block - height (e.g. 123456789) : return block at this height - ID : return block with this ID if none of the valid values are passed an error is returned.

type CadenceArgument

type CadenceArgument struct {
	Value cadence.Value
}

func (*CadenceArgument) MarshalJSON

func (v *CadenceArgument) MarshalJSON() ([]byte, error)

func (*CadenceArgument) UnmarshalJSON

func (v *CadenceArgument) UnmarshalJSON(b []byte) (err error)

type Event

type Event struct {
	Type   string
	Values map[string]cadence.Value
}

func NewEvent

func NewEvent(event flow.Event) Event

func (*Event) GetAddress

func (e *Event) GetAddress() *flow.Address

type EventWorker

type EventWorker struct {
	Count           int
	BlocksPerWorker uint64
}

EventWorker defines how many workers do we want to start, each in its own subroutine, and how many blocks each worker fetches from the network. This is used to process the event requests concurrently.

type Events

type Events []Event

func EventsFromTransaction

func EventsFromTransaction(tx *flow.TransactionResult) Events

func (*Events) GetCreatedAddresses

func (e *Events) GetCreatedAddresses() []*flow.Address

type FileAccountKey

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

func NewFileAccountKey

func NewFileAccountKey(
	location string,
	index int,
	sigAlgo crypto.SignatureAlgorithm,
	hashAlgo crypto.HashAlgorithm,
) *FileAccountKey

NewFileAccountKey creates a new account key that is stored to a separate file in the provided location.

This type of the key is a more secure way of storing accounts. The config only includes the location and not the key.

func (FileAccountKey) HashAlgo

func (a FileAccountKey) HashAlgo() crypto.HashAlgorithm

func (FileAccountKey) Index

func (a FileAccountKey) Index() int

func (*FileAccountKey) PrivateKey

func (f *FileAccountKey) PrivateKey() (*crypto.PrivateKey, error)

func (FileAccountKey) SigAlgo

func (a FileAccountKey) SigAlgo() crypto.SignatureAlgorithm

func (*FileAccountKey) Signer

func (f *FileAccountKey) Signer(ctx context.Context) (crypto.Signer, error)

func (*FileAccountKey) ToConfig

func (f *FileAccountKey) ToConfig() config.AccountKey

func (FileAccountKey) Type

func (a FileAccountKey) Type() config.KeyType

func (FileAccountKey) Validate

func (a FileAccountKey) Validate() error

type Flowkit

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

func NewFlowkit

func NewFlowkit(
	state *State,
	network config.Network,
	gateway gateway.Gateway,
	logger output.Logger,
) *Flowkit

func (*Flowkit) AddContract

func (f *Flowkit) AddContract(
	ctx context.Context,
	account *Account,
	contract Script,
	update UpdateContract,
) (flow.Identifier, bool, error)

func (*Flowkit) BuildTransaction

func (f *Flowkit) BuildTransaction(
	_ context.Context,
	addresses TransactionAddressesRoles,
	proposerKeyIndex int,
	script Script,
	gasLimit uint64,
) (*Transaction, error)

func (*Flowkit) CreateAccount

func (f *Flowkit) CreateAccount(
	_ context.Context,
	signer *Account,
	keys []AccountPublicKey,
) (*flow.Account, flow.Identifier, error)

func (*Flowkit) DeployProject

func (f *Flowkit) DeployProject(ctx context.Context, update UpdateContract) ([]*project.Contract, error)

func (*Flowkit) DerivePrivateKeyFromMnemonic

func (f *Flowkit) DerivePrivateKeyFromMnemonic(
	_ context.Context,
	mnemonic string,
	sigAlgo crypto.SignatureAlgorithm,
	derivationPath string,
) (crypto.PrivateKey, error)

func (*Flowkit) ExecuteScript

func (f *Flowkit) ExecuteScript(_ context.Context, script Script, query ScriptQuery) (cadence.Value, error)

func (*Flowkit) Gateway

func (f *Flowkit) Gateway() gateway.Gateway

func (*Flowkit) GenerateKey

func (f *Flowkit) GenerateKey(
	_ context.Context,
	sigAlgo crypto.SignatureAlgorithm,
	inputSeed string,
) (crypto.PrivateKey, error)

func (*Flowkit) GenerateMnemonicKey

func (f *Flowkit) GenerateMnemonicKey(
	_ context.Context,
	sigAlgo crypto.SignatureAlgorithm,
	derivationPath string,
) (crypto.PrivateKey, string, error)

func (*Flowkit) GetAccount

func (f *Flowkit) GetAccount(_ context.Context, address flow.Address) (*flow.Account, error)

func (*Flowkit) GetBlock

func (f *Flowkit) GetBlock(_ context.Context, query BlockQuery) (*flow.Block, error)

func (*Flowkit) GetCollection

func (f *Flowkit) GetCollection(_ context.Context, ID flow.Identifier) (*flow.Collection, error)

func (*Flowkit) GetEvents

func (f *Flowkit) GetEvents(
	_ context.Context,
	names []string,
	startHeight uint64,
	endHeight uint64,
	worker *EventWorker,
) ([]flow.BlockEvents, error)

func (*Flowkit) GetTransactionByID

func (f *Flowkit) GetTransactionByID(
	_ context.Context,
	ID flow.Identifier,
	waitSeal bool,
) (*flow.Transaction, *flow.TransactionResult, error)

func (*Flowkit) GetTransactionsByBlockID

func (f *Flowkit) GetTransactionsByBlockID(
	_ context.Context,
	blockID flow.Identifier,
) ([]*flow.Transaction, []*flow.TransactionResult, error)

func (*Flowkit) Network

func (f *Flowkit) Network() config.Network

func (*Flowkit) Ping

func (f *Flowkit) Ping() error

func (*Flowkit) RemoveContract

func (f *Flowkit) RemoveContract(
	_ context.Context,
	account *Account,
	contractName string,
) (flow.Identifier, error)

func (*Flowkit) SendSignedTransaction

func (f *Flowkit) SendSignedTransaction(
	_ context.Context,
	tx *Transaction,
) (*flow.Transaction, *flow.TransactionResult, error)

func (*Flowkit) SendTransaction

func (f *Flowkit) SendTransaction(
	ctx context.Context,
	accounts TransactionAccountRoles,
	script Script,
	gasLimit uint64,
) (*flow.Transaction, *flow.TransactionResult, error)

func (*Flowkit) SetLogger

func (f *Flowkit) SetLogger(logger output.Logger)

func (*Flowkit) SignTransactionPayload

func (f *Flowkit) SignTransactionPayload(
	_ context.Context,
	signer *Account,
	payload []byte,
) (*Transaction, error)

func (*Flowkit) State

func (f *Flowkit) State() (*State, error)

type HexAccountKey

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

HexAccountKey implements account key in hex representation.

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, error)

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

func (a *HexAccountKey) Validate() error

type KmsAccountKey

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

KmsAccountKey implements Gcloud KMS system for signing.

func (KmsAccountKey) HashAlgo

func (a KmsAccountKey) HashAlgo() crypto.HashAlgorithm

func (KmsAccountKey) Index

func (a KmsAccountKey) Index() int

func (*KmsAccountKey) PrivateKey

func (a *KmsAccountKey) PrivateKey() (*crypto.PrivateKey, error)

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

ToConfig convert account key to configuration.

func (KmsAccountKey) Type

func (a KmsAccountKey) Type() config.KeyType

func (*KmsAccountKey) Validate

func (a *KmsAccountKey) Validate() error

type ProjectDeploymentError

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

func (*ProjectDeploymentError) Contracts

func (d *ProjectDeploymentError) Contracts() map[string]error

func (*ProjectDeploymentError) Error

func (d *ProjectDeploymentError) Error() string

type ReaderWriter

type ReaderWriter interface {
	ReadFile(source string) ([]byte, error)
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

ReaderWriter defines read file and write file methods.

type Script

type Script struct {
	Code     []byte
	Args     []cadence.Value
	Location string
}

Script includes Cadence code and optional arguments and filename.

Filename is only required to be passed if the code has imports you want to resolve.

type ScriptQuery

type ScriptQuery struct {
	Latest bool
	ID     flow.Identifier
	Height uint64
}

ScriptQuery defines block ID or height at which we should execute the script.

type Services

type Services interface {
	Network() config.Network
	Ping() error
	Gateway() gateway.Gateway
	SetLogger(output.Logger)

	// GetAccount fetches account on the Flow network.
	GetAccount(context.Context, flow.Address) (*flow.Account, error)

	// CreateAccount on the Flow network with the provided keys and using the signer for creation transaction.
	// Returns the newly created account as well as the ID of the transaction that created the account.
	//
	// Keys is a slice but only one can be passed as well. If the transaction fails or there are other issues an error is returned.
	CreateAccount(context.Context, *Account, []AccountPublicKey) (*flow.Account, flow.Identifier, error)

	// AddContract to the Flow account provided and return the transaction ID.
	//
	// If the contract already exists on the account the operation will fail and error will be returned.
	// Use UpdateExistingContract(bool) to define whether a contract should be updated or not, or you can also
	// define a custom UpdateContract function which returns bool indicating whether a contract should be updated or not.
	AddContract(context.Context, *Account, Script, UpdateContract) (flow.Identifier, bool, error)

	// RemoveContract from the provided account by its name.
	//
	// If removal is successful transaction ID is returned.
	RemoveContract(context.Context, *Account, string) (flow.Identifier, error)

	// GetBlock by the query from Flow blockchain. Query can define a block by ID, block by height or require the latest block.
	GetBlock(context.Context, BlockQuery) (*flow.Block, error)

	// GetCollection by the ID from Flow network.
	GetCollection(context.Context, flow.Identifier) (*flow.Collection, error)

	// GetEvents from Flow network by their event name in the specified height interval defined by start and end inclusive.
	// Optional worker defines parameters for how many concurrent workers do we want to fetch our events,
	// and how many blocks between the provided interval each worker fetches.
	//
	// Providing worker value will produce faster response as the interval will be scanned concurrently. This parameter is optional,
	// if not provided only a single worker will be used.
	GetEvents(context.Context, []string, uint64, uint64, *EventWorker) ([]flow.BlockEvents, error)

	// GenerateKey using the signature algorithm and optional seed. If seed is not provided a random safe seed will be generated.
	GenerateKey(context.Context, crypto.SignatureAlgorithm, string) (crypto.PrivateKey, error)

	// GenerateMnemonicKey will generate a new key with the signature algorithm and optional derivation path.
	//
	// If the derivation path is not provided a default "m/44'/539'/0'/0/0" will be used.
	GenerateMnemonicKey(context.Context, crypto.SignatureAlgorithm, string) (crypto.PrivateKey, string, error)

	DerivePrivateKeyFromMnemonic(context.Context, string, crypto.SignatureAlgorithm, string) (crypto.PrivateKey, error)

	// DeployProject contracts to the Flow network or update if already exists and UpdateContracts returns true.
	//
	// Retrieve all the contracts for specified network, sort them for deployment deploy one by one and replace
	// the imports in the contract source, so it corresponds to the account name the contract was deployed to.
	// If contracts already exist use UpdateExistingContract(bool) to define whether a contract should be updated or not.
	DeployProject(context.Context, UpdateContract) ([]*project.Contract, error)

	// ExecuteScript on the Flow network and return the Cadence value as a result. The script is executed at the
	// block provided as part of the ScriptQuery value.
	ExecuteScript(context.Context, Script, ScriptQuery) (cadence.Value, error)

	// GetTransactionByID from the Flow network including the transaction result. Using the waitSeal we can wait for the transaction to be sealed.
	GetTransactionByID(context.Context, flow.Identifier, bool) (*flow.Transaction, *flow.TransactionResult, error)

	GetTransactionsByBlockID(context.Context, flow.Identifier) ([]*flow.Transaction, []*flow.TransactionResult, error)

	// BuildTransaction builds a new transaction type for later signing and submitting to the network.
	//
	// TransactionAddressesRoles type defines the address for each role (payer, proposer, authorizers) and the script defines the transaction content.
	BuildTransaction(context.Context, TransactionAddressesRoles, int, Script, uint64) (*Transaction, error)

	// SignTransactionPayload will use the signer account provided and the payload raw byte content to sign it.
	//
	// The payload should be RLP encoded transaction payload and is suggested to be used in pair with BuildTransaction function.
	SignTransactionPayload(context.Context, *Account, []byte) (*Transaction, error)

	// SendSignedTransaction will send a prebuilt and signed transaction to the Flow network.
	//
	// You can build the transaction using the BuildTransaction method and then sign it using the SignTranscation method.
	SendSignedTransaction(context.Context, *Transaction) (*flow.Transaction, *flow.TransactionResult, error)

	// SendTransaction will build and send a transaction to the Flow network, using the accounts provided for each role and
	// contain the script. Transaction as well as transaction result will be returned in case the transaction is successfully submitted.
	SendTransaction(context.Context, TransactionAccountRoles, Script, uint64) (*flow.Transaction, *flow.TransactionResult, error)
}

type State

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

State manages the state for a Flow project.

func Init

func Init(
	readerWriter ReaderWriter,
	sigAlgo crypto.SignatureAlgorithm,
	hashAlgo crypto.HashAlgorithm,
) (*State, error)

Init initializes a new Flow project.

func Load

func Load(configFilePaths []string, readerWriter ReaderWriter) (*State, error)

Load loads a project configuration and returns the resulting project.

func (*State) Accounts

func (p *State) Accounts() *Accounts

Accounts get accounts.

func (*State) AccountsForNetwork

func (p *State) AccountsForNetwork(network config.Network) *Accounts

AccountsForNetwork returns all accounts used on a network defined by deployments.

func (*State) AliasesForNetwork

func (p *State) AliasesForNetwork(network config.Network) project.LocationAliases

AliasesForNetwork returns all deployment aliases for a network.

func (*State) Config

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

Config get underlying configuration for advanced usage.

func (*State) Contracts

func (p *State) Contracts() *config.Contracts

Contracts get contracts configuration.

func (*State) DeploymentContractsByNetwork

func (p *State) DeploymentContractsByNetwork(network config.Network) ([]*project.Contract, error)

DeploymentContractsByNetwork returns all contracts for a network.

Build contract slice based on the network provided, check the deployment section for that network and retrieve the account by name, then add the accounts address on the contract as a destination.

func (*State) Deployments

func (p *State) Deployments() *config.Deployments

Deployments get deployments configuration.

func (*State) EmulatorServiceAccount

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

EmulatorServiceAccount returns the service account for the default emulator profile.

func (*State) Networks

func (p *State) Networks() *config.Networks

Networks get network configuration.

func (*State) ReadFile

func (p *State) ReadFile(source string) ([]byte, error)

ReadFile exposes an injected file loader.

func (*State) ReaderWriter

func (p *State) ReaderWriter() ReaderWriter

ReaderWriter retrieve current file reader writer.

func (*State) Save

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

Save saves the project configuration to the given path.

func (*State) SaveDefault

func (p *State) SaveDefault() error

SaveDefault saves to default path.

func (*State) SaveEdited

func (p *State) SaveEdited(paths []string) error

SaveEdited saves configuration to valid path.

func (*State) SetEmulatorKey

func (p *State) SetEmulatorKey(privateKey crypto.PrivateKey)

SetEmulatorKey sets the default emulator service account private key.

type Transaction

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

Transaction builder of flow transactions.

func NewAddAccountContractTransaction

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

NewAddAccountContractTransaction add new contract to the account.

func NewCreateAccountTransaction

func NewCreateAccountTransaction(
	signer *Account,
	keys []*flow.AccountKey,
	contracts []templates.Contract,
) (*Transaction, error)

NewCreateAccountTransaction creates new transaction for account.

func NewRemoveAccountContractTransaction

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

NewRemoveAccountContractTransaction creates new transaction to remove contract.

func NewTransaction

func NewTransaction() *Transaction

NewTransaction create new instance of transaction.

func NewTransactionFromPayload

func NewTransactionFromPayload(payload []byte) (*Transaction, error)

NewTransactionFromPayload build transaction from payload.

func NewUpdateAccountContractTransaction

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

NewUpdateAccountContractTransaction update account contract.

func (*Transaction) AddArgument

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

AddArgument add cadence typed argument.

func (*Transaction) AddArguments

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

AddArguments add array of cadence arguments.

func (*Transaction) AddAuthorizers

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

AddAuthorizers add group of authorizers.

func (*Transaction) FlowTransaction

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

FlowTransaction get flow transaction.

func (*Transaction) Proposer

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

Proposer get proposer.

func (*Transaction) SetBlockReference

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

SetBlockReference sets block reference for transaction.

func (*Transaction) SetGasLimit

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

SetGasLimit sets the gas limit for transaction.

func (*Transaction) SetPayer

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

SetPayer sets the payer for transaction.

func (*Transaction) SetProposer

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

SetProposer sets the proposer for transaction.

func (*Transaction) SetScriptWithArgs

func (t *Transaction) SetScriptWithArgs(script []byte, args []cadence.Value) error

func (*Transaction) SetSigner

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

SetSigner sets the signer for transaction.

func (*Transaction) Sign

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

Sign signs transaction using signer account.

func (*Transaction) Signer

func (t *Transaction) Signer() *Account

Signer get signer.

type TransactionAccountRoles

type TransactionAccountRoles struct {
	Proposer    Account
	Authorizers []Account
	Payer       Account
}

TransactionAccountRoles define all the accounts for different transaction roles.

You can read more about roles here: https://developers.flow.com/learn/concepts/accounts-and-keys

func NewTransactionSingleAccountRole

func NewTransactionSingleAccountRole(account Account) TransactionAccountRoles

NewTransactionSingleAccountRole creates transaction accounts from a single provided account fulfilling all the roles (proposer, payer, authorizer).

type TransactionAddressesRoles

type TransactionAddressesRoles struct {
	Proposer    flow.Address
	Authorizers []flow.Address
	Payer       flow.Address
}

TransactionAddressesRoles defines transaction roles by account addresses.

You can read more about roles here: https://developers.flow.com/learn/concepts/accounts-and-keys

type UpdateContract

type UpdateContract func(existing []byte, new []byte) bool

func UpdateExistingContract

func UpdateExistingContract(updateExisting bool) UpdateContract

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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