Documentation ¶
Index ¶
- type Generator
- type Intent
- type Invoker
- type Parser
- type Submitter
- type TransactionParser
- type Transactor
- func (t *Transactor) AttachSignatures(unsigned string, signatures []object.Signature) (string, error)
- func (t *Transactor) CompileTransaction(rosBlockID identifier.Block, intent *Intent, sequence uint64) (string, error)
- func (t *Transactor) DeriveIntent(operations []object.Operation) (*Intent, error)
- func (t *Transactor) HashPayload(rosBlockID identifier.Block, unsigned string, signer identifier.Account) (string, string, error)
- func (t *Transactor) Parse(payload string) (Parser, error)
- func (t *Transactor) SubmitTransaction(signed string) (identifier.Transaction, error)
- func (t *Transactor) TransactionIdentifier(signed string) (identifier.Transaction, error)
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
Generator represents something that can generate Cadence scripts for transferring tokens between two accounts.
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 a set of two Rosetta operations.
type Invoker ¶
type Invoker interface {
Key(height uint64, address flow.Address, index int) (*flow.AccountPublicKey, error)
}
Invoker represents something that can retrieve account public keys at any given height.
type Parser ¶ added in v1.3.4
type Parser interface { BlockID() (identifier.Block, error) Sequence() uint64 Signers() ([]identifier.Account, error) Operations() ([]object.Operation, error) }
Parser represents something that can parse a transaction into individual parts.
type Submitter ¶
type Submitter interface {
Transaction(tx *sdk.Transaction) error
}
Submitter represents something that can submit transactions.
type TransactionParser ¶ added in v1.3.4
type TransactionParser struct {
// contains filtered or unexported fields
}
TransactionParser is a wrapper around a pointer to a sdk.Transaction which exposes methods to individually parse different elements of the transaction.
func (*TransactionParser) BlockID ¶ added in v1.3.4
func (p *TransactionParser) BlockID() (identifier.Block, error)
BlockID parses the transaction's BlockID.
func (*TransactionParser) Operations ¶ added in v1.3.4
func (p *TransactionParser) Operations() ([]object.Operation, error)
Operations parses the transaction's operations.
func (*TransactionParser) Sequence ¶ added in v1.3.4
func (p *TransactionParser) Sequence() uint64
Sequence parses the transaction's sequence number.
func (*TransactionParser) Signers ¶ added in v1.3.4
func (p *TransactionParser) Signers() ([]identifier.Account, error)
Signers parses the transaction's signer accounts.
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 returns the given transaction with the given signatures attached to it.
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)
HashPayload returns the algorithm and hash of a given unsigned transaction when signed by a given account's public key.
func (*Transactor) Parse ¶ added in v1.3.4
func (t *Transactor) Parse(payload string) (Parser, error)
Parse processes the flow transaction, validates its correctness and translates it to a list of operations and a list of signers.
func (*Transactor) SubmitTransaction ¶
func (t *Transactor) SubmitTransaction(signed string) (identifier.Transaction, error)
SubmitTransaction submits the given signed transaction.
func (*Transactor) TransactionIdentifier ¶
func (t *Transactor) TransactionIdentifier(signed string) (identifier.Transaction, error)
TransactionIdentifier returns the transaction identifier of a given signed transaction.
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) }
Validator represents something that can validate account and block identifiers as well as currencies.