account

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCouldNotMarshalJSON   = errors.New("could not marshal data to JSON")
	ErrUnmarshalingEventData = errors.New("error when trying to unmarshal event data")
)

Functions

func NewGetByHeightHttpHandler

func NewGetByHeightHttpHandler(c *client.Client, syncablesDb store.FindMostRecenter) *getByHeightHttpHandler

func NewGetByHeightUseCase

func NewGetByHeightUseCase(c *client.Client, syncablesDb store.FindMostRecenter) *getByHeightUseCase

func NewGetDetailsHttpHandler

func NewGetDetailsHttpHandler(c *client.Client, accountEraSeqDb store.AccountEraSeq, eventSeqDb store.EventSeq, syncablesDb store.Syncables) *getDetailsHttpHandler

func NewGetDetailsUseCase

func NewGetDetailsUseCase(c *client.Client, accountEraSeqDb store.AccountEraSeq, eventSeqDb store.EventSeq, syncablesDb store.Syncables) *getDetailsUseCase

func NewGetRewardsHttpHandler added in v0.7.0

func NewGetRewardsHttpHandler(eventSeqDb store.EventSeq, syncablesDb store.Syncables) *getRewardsHttpHandler

func NewGetRewardsUseCase added in v0.7.0

func NewGetRewardsUseCase(eventSeqDb store.EventSeq, syncablesDb store.Syncables) *getRewardsUseCase

Types

type Account added in v0.5.0

type Account struct {
	// Free balance of account
	Free string `json:"free"`
	// Reserved balance of account
	Reserved string `json:"reserved"`
	// MiscFrozen balance of account
	MiscFrozen string `json:"misc_frozen"`
	// FeeFrozen balance of account
	FeeFrozen string `json:"fee_frozen"`
}

Account is balance information for an account

func ToAccount added in v0.5.0

func ToAccount(rawAccount *accountpb.Account) *Account

type BalanceDeposit

type BalanceDeposit struct {
	// Amount is balance that was deposited into account
	Amount string `json:"amount"`
	// Hash is transaction hash
	Hash string `json:"transaction_hash"`
	// Height is block height transaction occured
	Height int64 `json:"height"`
}

func ToBalanceDeposits

func ToBalanceDeposits(balanceDepositsEvents []model.EventSeqWithTxHash) ([]*BalanceDeposit, error)

type BalanceTransfer

type BalanceTransfer struct {
	// Hash is transaction hash
	Hash string `json:"transaction_hash"`
	// Height is block height transaction occured
	Height int64 `json:"height"`
	// Amount is balance that was transferred
	Amount string `json:"amount"`
	// Kind is transfer kind (either "in" for transfer into account or "out" for transfer out of account)
	// example: in
	Kind string `json:"kind"`
	// Participant is account
	Participant string `json:"participant"`
}

func ToBalanceTransfers

func ToBalanceTransfers(forAddress string, balanceTransferEvents []model.EventSeqWithTxHash) ([]*BalanceTransfer, error)

type Bonded

type Bonded struct {
	// Amount is balance that was bonded
	Amount string `json:"amount"`
	// Receiver is account that bonded
	Receiver string `json:"receiver"`
	// Hash is transaction hash
	Hash string `json:"transaction_hash"`
	// Height is block height transaction occured
	Height int64 `json:"height"`
}

func ToBondedList

func ToBondedList(bondedEvents []model.EventSeqWithTxHash) ([]*Bonded, error)

type DetailsView

type DetailsView struct {
	// Address of account
	Address string `json:"address"`
	// Account is balance information for an account
	Account *Account `json:"account"`
	// Identity is identity details for an account
	*Identity

	// Transfers is a list of all balances.Transfer events for account
	Transfers []*BalanceTransfer `json:"transfers"`
	// Deposits is a list of all balances.Deposit events for account
	Deposits []*BalanceDeposit `json:"deposits"`
	// Bonded is a list of all staking.Bonded events for account
	Bonded []*Bonded `json:"bonded"`
	// Unbonded is a list of all staking.Unbonded events for account
	Unbonded []*Unbonded `json:"unbonded"`
	// Withdrawn is a list of all staking.Withdrawn events for account
	Withdrawn []*Withdrawn `json:"withdrawn"`
	// Delegations is a list of latest delegations for account
	Delegations []*common.Delegation `json:"delegations"`
}

swagger:response AccountDetailsView

func ToDetailsView

func ToDetailsView(address string, rawAccountIdentity *accountpb.AccountIdentity, rawAccount *accountpb.Account, accountEraSeqs []model.AccountEraSeq, balanceTransferModels, balanceDepositModels, bondedModels, unbondedModels, withdrawnModels []model.EventSeqWithTxHash) (DetailsView, error)

type EventData

type EventData struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type GetByHeightRequest added in v0.2.0

type GetByHeightRequest struct {
	// StashAccount
	//
	// required: true
	// in: path
	StashAccount string `json:"stash_account" uri:"stash_account" binding:"required"`
	// Height of block
	//
	// in: query
	Height *int64 `json:"height" form:"height" binding:"-"`
}

swagger:parameters getAccountByHeight

type GetDetailsRequest

type GetDetailsRequest struct {
	// StashAccount
	//
	// required: true
	// in: path
	StashAccount string `json:"stash_account" uri:"stash_account" binding:"required"`
}

swagger:parameters getAccountDetails

type HeightDetailsView

type HeightDetailsView struct {
	Nonce int64 `json:"nonce"`
	// Free balance of account
	Free string `json:"free"`
	// Reserved balance of account
	Reserved string `json:"reserved"`
	// MiscFrozen balance of account
	MiscFrozen string `json:"misc_frozen"`
	// FeeFrozen balance of account
	FeeFrozen string `json:"fee_frozen"`
}

swagger:response AccountHeightDetailsView

func ToHeightDetailsView

func ToHeightDetailsView(rawAccount *accountpb.Account) *HeightDetailsView

type Identity

type Identity struct {
	Deposit     string `json:"deposit"`
	DisplayName string `json:"display_name"`
	LegalName   string `json:"legal_name"`
	WebName     string `json:"web_name"`
	RiotName    string `json:"riot_name"`
	EmailName   string `json:"email_name"`
	TwitterName string `json:"twitter_name"`
	Image       string `json:"image"`
}

func ToIdentity

func ToIdentity(rawAccountIdentity *accountpb.AccountIdentity) *Identity

type Reward added in v0.7.0

type Reward struct {
	// Height of block where reward event occured
	Height int64 `json:"height"`
	// Time of block where reward event occured
	Time time.Time `json:"time"`
	// Amount is reward balance claimed by account
	Amount string `json:"amount"`
}

type RewardsView added in v0.7.0

type RewardsView struct {
	// Account is stash account
	Account string `json:"account"`
	// Start is start time of query period
	Start time.Time `json:"start_time"`
	// End is end time of query period
	End time.Time `json:"end_time"`
	// TotalAmount is summed total of rewards earned
	TotalAmount string `json:"total_amount"`
	// Rewards is list of rewards
	Rewards []Reward `json:"rewards"`
}

swagger:response AccountRewardsView

type Unbonded

type Unbonded struct {
	// Amount is balance that was unbonded
	Amount string `json:"amount"`
	// Hash is transaction hash
	Hash string `json:"transaction_hash"`
	// Height is block height transaction occured
	Height int64 `json:"height"`
}

func ToUnbondedList

func ToUnbondedList(bondedEvents []model.EventSeqWithTxHash) ([]*Unbonded, error)

type Withdrawn

type Withdrawn struct {
	// Amount is balance that was withdrawn
	Amount string `json:"amount"`
	// Hash is transaction hash
	Hash string `json:"transaction_hash"`
	// Height is block height transaction occured
	Height int64 `json:"height"`
}

func ToWithdrawnList

func ToWithdrawnList(withdrawnEvents []model.EventSeqWithTxHash) ([]*Withdrawn, error)

Jump to

Keyboard shortcuts

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