Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalanceChange ¶
type BalanceChange struct {
Account *types.AccountIdentifier `json:"account_identifier,omitempty"`
Currency *types.Currency `json:"currency,omitempty"`
Block *types.BlockIdentifier `json:"block_identifier,omitempty"`
Difference string `json:"difference,omitempty"`
}
BalanceChange represents a balance change that affected a *types.AccountIdentifier and a *types.Currency.
type ExemptOperation ¶ added in v0.1.10
ExemptOperation is a function that returns a boolean indicating if the operation should be skipped eventhough it passes other checks indiciating it should be considered a balance change.
type OperationGroup ¶
OperationGroup is a group of related operations If all operations in a group have the same operation.Type, the Type is also populated.
func GroupOperations ¶
func GroupOperations(transaction *types.Transaction) []*OperationGroup
GroupOperations parses all of a transaction's opertations and returns a slice of each group of related operations. This should ONLY be called on operations that have already been asserted for correctness. Assertion ensures there are no duplicate operation indexes, operations are sorted, and that operations only reference operations with an index less than theirs.
type Parser ¶
type Parser struct {
Asserter *asserter.Asserter
ExemptFunc ExemptOperation
}
Parser provides support for parsing Rosetta blocks.
func New ¶
func New(asserter *asserter.Asserter, exemptFunc ExemptOperation) *Parser
New creates a new Parser.
func (*Parser) BalanceChanges ¶
func (p *Parser) BalanceChanges( ctx context.Context, block *types.Block, blockRemoved bool, ) ([]*BalanceChange, error)
BalanceChanges returns all balance changes for a particular block. All balance changes for a particular account are summed into a single BalanceChanges struct. If a block is being orphaned, the opposite of each balance change is returned.