transactor

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 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 Generator

type Generator interface {
	TransferTokens(symbol string) ([]byte, error)
}

type Intent

type Intent struct {
	From     flow.Address
	To       flow.Address
	Amount   cadence.UFix64
	Payer    flow.Address
	Proposer flow.Address
}

Intent describes the intent of an array of Rosetta operations.

type Invoker

type Invoker interface {
	Key(height uint64, address flow.Address, index int) (*flow.AccountPublicKey, error)
}

type Submitter

type Submitter interface {
	Transaction(tx *sdk.Transaction) error
}

type Transactor

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

Transactor can determine the transaction intent from an array of Rosetta operations, create a Flow transaction from a transaction intent and translate a Flow transaction back to an array of Rosetta operations.

func New

func New(validate Validator, generate Generator, invoke Invoker, submit Submitter) *Transactor

New creates a new transactor to handle interactions with Flow transactions.

func (*Transactor) AttachSignatures

func (t *Transactor) AttachSignatures(unsigned string, signatures []object.Signature) (string, error)

AttachSignatures adds the given signatures to the transaction.

func (*Transactor) CompileTransaction

func (t *Transactor) CompileTransaction(rosBlockID identifier.Block, intent *Intent, sequence uint64) (string, error)

CompileTransaction creates a complete Flow transaction from the given intent and metadata.

func (*Transactor) DeriveIntent

func (t *Transactor) DeriveIntent(operations []object.Operation) (*Intent, error)

DeriveIntent derives a transaction Intent from two operations given as input. Specified operations should be symmetrical, a deposit and a withdrawal from two different accounts. At the moment, the only fields taken into account are the account IDs, amounts and type of operation.

func (*Transactor) HashPayload

func (t *Transactor) HashPayload(rosBlockID identifier.Block, unsigned string, signer identifier.Account) (string, string, error)

func (*Transactor) ParseTransaction

func (t *Transactor) ParseTransaction(payload string) (identifier.Block, uint64, []object.Operation, []identifier.Account, error)

ParseTransactions processes the flow transaction, validates its correctness and translates it to a list of operations and a list of signers. TODO: Refactor this function, probably into several smaller function with a small amount of return values: => https://github.com/optakt/flow-dps/issues/392

func (*Transactor) SubmitTransaction

func (t *Transactor) SubmitTransaction(signed string) (identifier.Transaction, error)

func (*Transactor) TransactionIdentifier

func (t *Transactor) TransactionIdentifier(signed string) (identifier.Transaction, error)

type Validator

type Validator interface {
	Account(rosAccountID identifier.Account) (address flow.Address, err error)
	Block(rosBlockID identifier.Block) (height uint64, blockID flow.Identifier, err error)
	Currency(currency identifier.Currency) (symbol string, decimals uint, err error)
}

Jump to

Keyboard shortcuts

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