figmentclient

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationTypeInternalTransfer                 = "InternalTransfer"
	OperationTypeValidatorGroupVoteCast           = "ValidatorGroupVoteCast"
	OperationTypeValidatorGroupVoteActivated      = "ValidatorGroupVoteActivated"
	OperationTypeValidatorGroupPendingVoteRevoked = "ValidatorGroupPendingVoteRevoked"
	OperationTypeValidatorGroupActiveVoteRevoked  = "ValidatorGroupActiveVoteRevoked"
	OperationTypeAccountCreated                   = "AccountCreated"
	OperationTypeAccountSlashed                   = "AccountSlashed"
	OperationTypeVoteSignerAuthorized             = "VoteSignerAuthorized"
	OperationTypeValidatorSignerAuthorized        = "ValidatorSignerAuthorized"
	OperationTypeAttestationSignerAuthorized      = "AttestationSignerAuthorized"
	OperationTypeGoldLocked                       = "GoldLocked"
	OperationTypeGoldRelocked                     = "GoldRelocked"
	OperationTypeGoldUnlocked                     = "GoldUnlocked"
	OperationTypeGoldWithdrawn                    = "GoldWithdrawn"
	OperationTypeValidatorEpochPaymentDistributed = "ValidatorEpochPaymentDistributed"
	OperationTypeProposalVoted                    = "ProposalVoted"
	OperationTypeProposalUpvoted                  = "ProposalUpvoted"
	OperationTypeProposalApproved                 = "ProposalApproved"
	OperationTypeProposalExecuted                 = "ProposalExecuted"
	OperationTypeProposalDequeued                 = "ProposalDequeued"
	OperationTypeProposalQueued                   = "ProposalQueued"
	OperationTypeProposalExpired                  = "ProposalExpired"
)
View Source
const (
	CeloClientFigment = "figment_celo_client"
)

Variables

View Source
var (
	ErrContractNotDeployed = errors.New("contract not deployed")
)

Functions

func New

func New(urls string) (*client, error)

func NewContractsRegistry

func NewContractsRegistry(cc *kliento.CeloClient, rc base.RequestCounter, height *big.Int) (*contractsRegistry, error)

Types

type AccountInfo added in v0.1.0

type AccountInfo struct {
	GoldBalance *big.Int `json:"gold_balance"`

	*Identity
	TotalLockedGold          *big.Int `json:"total_locked_gold"`
	TotalNonvotingLockedGold *big.Int `json:"total_nonvoting_locked_gold"`
	StableTokenBalance       *big.Int `json:"stable_token_balance"`
}

type Block

type Block struct {
	Height          int64      `json:"height"`
	Time            uint64     `json:"time"`
	Hash            string     `json:"hash"`
	ParentHash      string     `json:"parent_hash"`
	Coinbase        string     `json:"coinbase"`
	Root            string     `json:"root"`
	TxHash          string     `json:"tx_hash"`
	RecipientHash   string     `json:"recipient_hash"`
	Size            float64    `json:"size"`
	GasUsed         uint64     `json:"gas_used"`
	TotalDifficulty uint64     `json:"total_difficulty"`
	Extra           BlockExtra `json:"extra"`
	TxCount         int        `json:"tx_count"`
}

type BlockExtra

type BlockExtra struct {
	AddedValidators           []string                        `json:"added_validators"`
	AddedValidatorsPublicKeys []blscrypto.SerializedPublicKey `json:"added_validators_public_keys"`
	RemovedValidators         *big.Int                        `json:"removed_validators"`
	Seal                      []byte                          `json:"seal"`
	AggregatedSeal            IstanbulAggregatedSeal          `json:"aggregated_seal"`
	ParentAggregatedSeal      IstanbulAggregatedSeal          `json:"parent_aggregated_seal"`
}

type ChainParams added in v0.1.0

type ChainParams struct {
	ChainId uint64 `json:"chain_id"`

	EpochSize *int64 `json:"epoch_size"`
}

type ChainStatus

type ChainStatus struct {
	ChainId         uint64 `json:"chain_id"`
	LastBlockHeight int64  `json:"last_block_height"`
	LastBlockHash   string `json:"last_block_hash"`
}

type Client

type Client interface {
	base.Client

	WithAssignedNode(uint8) Client

	GetRequestCounter() base.RequestCounter

	GetChainStatus(context.Context) (*ChainStatus, error)
	GetChainParams(context.Context) (*ChainParams, error)
	GetMetaByHeight(context.Context, int64) (*HeightMeta, error)
	GetBlockByHeight(context.Context, int64) (*Block, error)
	GetTransactionsByHeight(context.Context, int64) ([]*Transaction, error)
	GetValidatorGroupsByHeight(context.Context, int64) ([]*ValidatorGroup, error)
	GetValidatorsByHeight(context.Context, int64) ([]*Validator, error)
	GetAccountByAddressAndHeight(context.Context, string, int64) (*AccountInfo, error)
	GetIdentityByHeight(context.Context, string, int64) (*Identity, error)
}

type HeightMeta

type HeightMeta struct {
	Height int64  `json:"height"`
	Time   uint64 `json:"time"`

	Epoch       *int64 `json:"epoch"`
	LastInEpoch *bool  `json:"last_in_epoch"`
}

type Identity added in v0.1.0

type Identity struct {
	Name        string `json:"name"`
	MetadataUrl string `json:"metadata_url"`
	Type        string `json:"type"`
	Affiliation string `json:"affiliation"`
}

type IstanbulAggregatedSeal

type IstanbulAggregatedSeal struct {
	Bitmap    *big.Int `json:"bitmap"`
	Signature []byte   `json:"signature"`
	Round     uint64   `json:"round"`
}

type Operation

type Operation struct {
	Name    string      `json:"name"`
	Details interface{} `json:"details"`
}

type Transaction

type Transaction struct {
	Hash                string   `json:"hash"`
	To                  string   `json:"to"`
	Height              int64    `json:"height"`
	Time                uint64   `json:"time"`
	Address             string   `json:"address"`
	Size                string   `json:"size"`
	Nonce               uint64   `json:"nonce"`
	GasPrice            *big.Int `json:"gas_price"`
	Gas                 uint64   `json:"gas"`
	GatewayFee          *big.Int `json:"gateway_fee"`
	GatewayFeeRecipient string   `json:"gateway_fee_recipient"`
	Index               uint     `json:"index"`
	GasUsed             uint64   `json:"gas_used"`
	CumulativeGasUsed   uint64   `json:"cumulative_gas_used"`
	Success             bool     `json:"success"`

	Operations []*Operation `json:"operations"`
}

type Transfer

type Transfer struct {
	Index   uint64   `json:"index"`
	Type    string   `json:"type"`
	From    string   `json:"from"`
	To      string   `json:"to"`
	Value   *big.Int `json:"value"`
	Success bool     `json:"success"`
}

type Validator

type Validator struct {
	Address        string   `json:"address"`
	BlsPublicKey   []byte   `json:"bls_public_key"`
	EcdsaPublicKey []byte   `json:"ecdsa_public_key"`
	Signer         string   `json:"signer"`
	Affiliation    string   `json:"affiliation"`
	Score          *big.Int `json:"score"`
	Signed         *bool    `json:"signed"`
}

type ValidatorGroup

type ValidatorGroup struct {
	Index               uint64   `json:"index"`
	Address             string   `json:"address"`
	Commission          *big.Int `json:"commission"`
	NextCommission      *big.Int `json:"next_commission"`
	NextCommissionBlock int64    `json:"next_commission_block"`
	SlashMultiplier     *big.Int `json:"slash_multiplier "`
	LastSlashed         *big.Int `json:"last_slashed"`
	ActiveVotes         *big.Int `json:"active_votes"`
	PendingVotes        *big.Int `json:"pending_votes"`
	VotingCap           *big.Int `json:"voting_cap"`
	Members             []string `json:"members"`
}

Jump to

Keyboard shortcuts

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