figmentclient

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 17 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"
)

Variables

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

Functions

func New

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

Types

type AccountInfo added in v0.1.0

type AccountInfo struct {
	GoldBalance *types.BigInt `json:"gold_balance"`

	*Identity
	TotalLockedGold          *types.BigInt `json:"total_locked_gold"`
	TotalNonvotingLockedGold *types.BigInt `json:"total_nonvoting_locked_gold"`
	StableTokenBalance       *types.BigInt `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         *types.BigInt                   `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 {
	GetChainStatus(context.Context) (*ChainStatus, error)
	GetChainParams(context.Context) (*ChainParams, error)
	GetMetaByHeight(context.Context, *ContractRegistry, int64) (*HeightMeta, error)
	GetBlockByHeight(context.Context, int64) (*Block, error)
	GetTransactionsByHeight(context.Context, *ContractRegistry, int64) ([]*Transaction, error)
	GetTransactionHashesByHeight(context.Context, int64) ([]common.Hash, error)
	GetTransactionByHash(context.Context, string) (*Transaction, error)
	GetValidatorGroupsByHeight(context.Context, *ContractRegistry, int64) ([]*ValidatorGroup, error)
	GetValidatorsByHeight(context.Context, *ContractRegistry, int64) ([]*Validator, error)
	GetAccountByAddressAndHeight(context.Context, *ContractRegistry, string, int64) (*AccountInfo, error)
	GetIdentityByHeight(context.Context, *ContractRegistry, string, int64) (*Identity, error)
	Close()
}

type ContractRegistry added in v0.3.0

type ContractRegistry struct {
	// contains filtered or unexported fields
}

func NewContractRegistry added in v0.3.0

func NewContractRegistry(c Client, height int64) (*ContractRegistry, error)

type GenericEvent added in v0.2.5

type GenericEvent struct {
	Account common.Address
	Group   common.Address
	Value   *types.BigInt
}

type GenericGovernanceEvent added in v0.2.5

type GenericGovernanceEvent struct {
	ProposalId *types.BigInt
	Account    common.Address
}

type GovernanceProposalQueued added in v0.2.5

type GovernanceProposalQueued struct {
	ProposalId       *types.BigInt
	Proposer         common.Address
	TransactionCount *types.BigInt
	Deposit          *types.BigInt
	Timestamp        *types.BigInt
}

type GovernanceProposalUpvoted added in v0.2.5

type GovernanceProposalUpvoted struct {
	ProposalId *types.BigInt
	Account    common.Address
	Upvotes    *types.BigInt
}

type GovernanceProposalVoted added in v0.2.5

type GovernanceProposalVoted struct {
	ProposalId *types.BigInt
	Account    common.Address
	Value      *types.BigInt
	Weight     *types.BigInt
}

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    *types.BigInt `json:"bitmap"`
	Signature []byte        `json:"signature"`
	Round     uint64        `json:"round"`
}

type LockedGoldAccountSlashed added in v0.2.5

type LockedGoldAccountSlashed struct {
	Slashed  common.Address
	Penalty  *types.BigInt
	Reporter common.Address
	Reward   *types.BigInt
}

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            *types.BigInt `json:"gas_price"`
	Gas                 uint64        `json:"gas"`
	GatewayFee          *types.BigInt `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   *types.BigInt `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          *types.BigInt `json:"score"`
	Signed         *bool         `json:"signed"`
}

type ValidatorGroup

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

type ValidatorsValidatorEpochPaymentDistributed added in v0.2.5

type ValidatorsValidatorEpochPaymentDistributed struct {
	Validator        common.Address
	ValidatorPayment *types.BigInt
	Group            common.Address
	GroupPayment     *types.BigInt
}

Jump to

Keyboard shortcuts

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