Help us shape the future of Go! Take the 2026 Go Developer Survey

services

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accounts

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

Accounts is a service that handles all account-related interactions.

func NewAccounts

func NewAccounts(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Accounts

NewAccounts returns a new accounts service.

func (*Accounts) AddContract

func (a *Accounts) AddContract(
	accountName string,
	contractName string,
	contractFilename string,
	updateExisting bool,
) (*flow.Account, error)

AddContract adds a new contract to an account and returns the updated account.

func (*Accounts) AddContractForAddress

func (a *Accounts) AddContractForAddress(
	accountAddress string,
	accountPrivateKey string,
	contractName string,
	contractFilename string,
	updateExisting bool,
) (*flow.Account, error)

AddContractForAddress adds a new contract to an address using private key specified

func (*Accounts) AddContractForAddressWithCode

func (a *Accounts) AddContractForAddressWithCode(
	accountAddress string,
	accountPrivateKey string,
	contractName string,
	contractCode []byte,
	updateExisting bool,
) (*flow.Account, error)

AddContractForAddressWithCode adds a new contract to an address using private key and code specified

func (*Accounts) Create

func (a *Accounts) Create(
	signerName string,
	keys []string,
	keyWeights []int,
	signatureAlgorithm string,
	hashingAlgorithm string,
	contracts []string,
) (*flow.Account, error)

Create creates and returns a new account.

The new account is created with the given public keys and contracts.

The account creation transaction is signed by the specified signer.

func (*Accounts) Get

func (a *Accounts) Get(address string) (*flow.Account, error)

Get returns an account by on address.

func (*Accounts) RemoveContract

func (a *Accounts) RemoveContract(
	contractName string,
	accountName string,
) (*flow.Account, error)

RemoveContracts removes a contract from an account and returns the updated account.

func (*Accounts) StakingInfo

func (a *Accounts) StakingInfo(accountAddress string) (*cadence.Value, *cadence.Value, error)

StakingInfo returns the staking information for an account.

type Blocks

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

Blocks is a service that handles all block-related interactions.

func NewBlocks

func NewBlocks(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Blocks

NewBlocks returns a new blocks service.

func (*Blocks) GetBlock

func (e *Blocks) GetBlock(
	query string,
	eventType string,
	verbose bool,
) (*flow.Block, []client.BlockEvents, []*flow.Collection, error)

GetBlock returns a block based on the provided query string.

Query string options: - "latest" : return the latest block - height (e.g. 123456789) : return block at this height - ID : return block with this ID

type Collections

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

Collections is aa service that handles all collection-related interactions.

func NewCollections

func NewCollections(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Collections

NewCollections returns a new collections service.

func (*Collections) Get

func (c *Collections) Get(id string) (*flow.Collection, error)

Get returns a collection by ID.

type Events

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

Events is a service that handles all event-related interactions.

func NewEvents

func NewEvents(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Events

NewEvents returns a new events service.

func (*Events) Get

func (e *Events) Get(name string, start string, end string) ([]client.BlockEvents, error)

Get queries for an event by name and block range.

type Keys

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

Keys is a service that handles all key-related interactions.

func NewKeys

func NewKeys(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Keys

NewKeys returns a new keys service.

func (*Keys) Decode

func (k *Keys) Decode(publicKey string) (*flow.AccountKey, error)

func (*Keys) Generate

func (k *Keys) Generate(inputSeed string, signatureAlgo string) (crypto.PrivateKey, error)

Generate generates a new private key from the given seed and signature algorithm.

type Project

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

Project is a service that handles all interactions for a project.

func NewProject

func NewProject(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Project

NewProject returns a new project service.

func (*Project) Deploy

func (p *Project) Deploy(network string, update bool) ([]*contracts.Contract, error)

func (*Project) Init

func (p *Project) Init(
	reset bool,
	global bool,
	serviceKeySigAlgo string,
	serviceKeyHashAlgo string,
	servicePrivateKey string,
) (*project.Project, error)

type Scripts

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

Scripts is a service that handles all script-related interactions.

func NewScripts

func NewScripts(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Scripts

NewScripts returns a new scripts service.

func (*Scripts) Execute

func (s *Scripts) Execute(scriptPath string, args []string, argsJSON string, network string) (cadence.Value, error)

Execute executes a Cadence script from a file.

func (*Scripts) ExecuteWithCode

func (s *Scripts) ExecuteWithCode(code []byte, args []string, argsJSON string) (cadence.Value, error)

ExecuteWithCode executes a Cadence script from a source code string.

type Services

type Services struct {
	Accounts     *Accounts
	Scripts      *Scripts
	Transactions *Transactions
	Keys         *Keys
	Events       *Events
	Collections  *Collections
	Project      *Project
	Blocks       *Blocks
	Status       *Status
}

Services is a collection of services that provide domain-specific functionality for the different components of a Flow project.

func NewServices

func NewServices(
	gateway gateway.Gateway,
	proj *project.Project,
	logger output.Logger,
) *Services

NewServices returns a new services collection for a project, initialized with a gateway and logger.

type Status added in v0.19.0

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

Status is a service that handles status of access node.

func NewStatus added in v0.19.0

func NewStatus(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Status

NewStatus returns a new status service.

func (*Status) Ping added in v0.19.0

func (s *Status) Ping(network string) (string, error)

Ping sends Ping request to network.

type Transactions

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

Transactions is a service that handles all transaction-related interactions.

func NewTransactions

func NewTransactions(
	gateway gateway.Gateway,
	project *project.Project,
	logger output.Logger,
) *Transactions

NewTransactions returns a new transactions service.

func (*Transactions) Build added in v0.18.0

func (t *Transactions) Build(
	proposer string,
	authorizer []string,
	payer string,
	proposerKeyIndex int,
	codeFilename string,
	gasLimit uint64,
	args []string,
	argsJSON string,
	network string,
) (*project.Transaction, error)

Build builds a transaction with specified payer, proposer and authorizer

func (*Transactions) GetStatus

func (t *Transactions) GetStatus(
	transactionID string,
	waitSeal bool,
) (*flow.Transaction, *flow.TransactionResult, error)

GetStatus of transaction

func (*Transactions) Send

func (t *Transactions) Send(
	codeFilename string,
	signerName string,
	gasLimit uint64,
	args []string,
	argsJSON string,
	network string,
) (*flow.Transaction, *flow.TransactionResult, error)

Send sends a transaction from a file.

func (*Transactions) SendForAddressWithCode

func (t *Transactions) SendForAddressWithCode(
	code []byte,
	signerAddress string,
	signerPrivateKey string,
	args []string,
	argsJSON string,
) (*flow.Transaction, *flow.TransactionResult, error)

SendForAddressWithCode send transaction for address and private key specified with code

func (*Transactions) SendSigned added in v0.18.0

func (t *Transactions) SendSigned(
	signedFilename string,
) (*flow.Transaction, *flow.TransactionResult, error)

SendSigned sends the transaction that is already signed

func (*Transactions) Sign added in v0.18.0

func (t *Transactions) Sign(
	payloadFilename string,
	signerName string,
	approveSigning bool,
) (*project.Transaction, error)

Sign transaction

Jump to

Keyboard shortcuts

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