exported

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	QueryTransactionsByAddress = "transactions_by_address"
	QueryParams                = "params"
	ModuleName                 = types.ModuleName
	StoreKey                   = ModuleName
	RouterKey                  = ModuleName
	QuerierRoute               = ModuleName
	DefaultParamspace          = ModuleName
)

Defines bank module constants

Variables

View Source
var TransactionTypeName = []string{
	TransactionGift:                            "TransactionGift",
	TransactionBacking:                         "TransactionBacking",
	TransactionBackingReturned:                 "TransactionBackingReturned",
	TransactionChallenge:                       "TransactionChallenge",
	TransactionChallengeReturned:               "TransactionChallengeReturned",
	TransactionUpvote:                          "TransactionUpvote",
	TransactionUpvoteReturned:                  "TransactionUpvoteReturned",
	TransactionInterestArgumentCreation:        "TransactionInterestArgumentCreation",
	TransactionInterestUpvoteReceived:          "TransactionInterestUpvoteReceived",
	TransactionInterestUpvoteGiven:             "TransactionInterestUpvoteGiven",
	TransactionRewardPayout:                    "TransactionRewardPayout",
	TransactionInterestArgumentCreationSlashed: "TransactionInterestArgumentCreationSlashed",
	TransactionInterestUpvoteReceivedSlashed:   "TransactionInterestUpvoteReceivedSlashed",
	TransactionInterestUpvoteGivenSlashed:      "TransactionInterestUpvoteGivenSlashed",
	TransactionStakeCreatorSlashed:             "TransactionStakeCreatorSlashed",
	TransactionStakeCuratorSlashed:             "TransactionStakeCuratorSlashed",
}

Functions

This section is empty.

Types

type Filter

type Filter func(*Filters)

func FilterByTransactionType

func FilterByTransactionType(transactionTypes ...TransactionType) Filter

func Limit

func Limit(limit int) Filter

func Offset

func Offset(offset int) Filter

func SortOrder

func SortOrder(sortOrder SortOrderType) Filter

type Filters

type Filters struct {
	TransactionTypes []TransactionType
	SortOrder        SortOrderType
	Limit            int
	Offset           int
}

func GetFilters

func GetFilters(filterSetters ...Filter) Filters

type QueryTransactionsByAddressParams

type QueryTransactionsByAddressParams struct {
	Address   sdk.AccAddress    `json:"address"`
	Types     []TransactionType `json:"types,omitempty"`
	SortOrder SortOrderType     `json:"sort_order,omitempty"`
	Limit     int               `json:"limit,omitempty"`
	Offset    int               `json:"offset,omitempty"`
}

QueryTransactionsByAddress query transactions params for a specific address.

type SortOrderType

type SortOrderType int8
const (
	SortAsc SortOrderType = iota
	SortDesc
)

func (SortOrderType) Valid

func (t SortOrderType) Valid() bool

type Transaction

type Transaction struct {
	ID                uint64          `json:"id"`
	Type              TransactionType `json:"type"`
	AppAccountAddress sdk.AccAddress  `json:"app_account_address"`
	ReferenceID       uint64          `json:"reference_id"`
	CommunityID       string          `json:"community_id"`
	Amount            sdk.Coin        `json:"amount"`
	CreatedTime       time.Time       `json:"created_time"`
	FromModuleAccount string          `json:"sender_module_account"`
	ToModuleAccount   string          `json:"to_module_account"`
}

Transaction stores data related to a transaction

type TransactionSetter

type TransactionSetter func(*Transaction)

func FromModuleAccount

func FromModuleAccount(moduleAccount string) TransactionSetter

func ToModuleAccount

func ToModuleAccount(moduleAccount string) TransactionSetter

func WithCommunityID

func WithCommunityID(communityID string) TransactionSetter

type TransactionType

type TransactionType int8

TransactionType defines the type of transaction.

const (
	TransactionGift TransactionType = iota
	TransactionBacking
	TransactionBackingReturned
	TransactionChallenge
	TransactionChallengeReturned
	TransactionUpvote
	TransactionUpvoteReturned
	TransactionInterestArgumentCreation
	TransactionInterestUpvoteReceived
	TransactionInterestUpvoteGiven
	TransactionRewardPayout
	TransactionInterestArgumentCreationSlashed
	TransactionInterestUpvoteReceivedSlashed
	TransactionInterestUpvoteGivenSlashed
	TransactionStakeCreatorSlashed
	TransactionStakeCuratorSlashed
	TransactionCuratorReward
)

Types of transactions

func (TransactionType) AllowedForAddition

func (t TransactionType) AllowedForAddition() bool

func (TransactionType) AllowedForDeduction

func (t TransactionType) AllowedForDeduction() bool

func (TransactionType) OneOf

func (t TransactionType) OneOf(types []TransactionType) bool

func (TransactionType) String

func (t TransactionType) String() string

Jump to

Keyboard shortcuts

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