Documentation ¶
Index ¶
- Constants
- Variables
- func MapConfirmActions(transactions []model.Transaction) (map[string][]model.TransactionsByDelegator, error)
- func ParseAction(trx model.Transaction, account, actionType, validator string) (amt *big.Int, err error)
- type AccessKey
- type Account
- type AccountInfo
- type Action
- type ActionError
- type AddKeyAction
- type Block
- type BlockChange
- type BlockChangesResponse
- type BlockChunk
- type BlockHeader
- type ChunkDetails
- type Client
- type CreateAccountAction
- type DeleteAccountAction
- type DeleteKeyAction
- type DeployContractAction
- type Fisher
- type FunctionCallAction
- type GasPriceDetails
- type GenesisConfig
- type GenesisRecords
- type KickoutReason
- type NetworkInfo
- type NodeStatus
- type Outcome
- type QueryResponse
- type ReasonName
- type ReceiptsOutcome
- type RewardFee
- type StakeAction
- type Status
- type SyncInfo
- type Transaction
- type TransactionDetails
- type TransactionOutcome
- type TransferAction
- type Validator
- type ValidatorKickout
- type ValidatorProposal
- type ValidatorsResponse
- type Version
Constants ¶
View Source
const ( ActionFunctionCallUnstake = "unstake" ActionFunctionCallUnstakeAll = "unstake_all" ActionFunctionCallStake = "stake" ActionFunctionCallStakeAll = "stake_all" ActionFunctionCallWithdraw = "withdraw" ActionFunctionCallWithdrawAll = "withdraw_all" ActionFunctionCallDepositAndStake = "deposit_and_stake" ActionFunctionCallDeposit = "deposit" ActionFunctionCallDepositToStakingPool = "deposit_to_staking_pool" ActionFunctionCallWithdrawFromStakingPool = "withdraw_from_staking_pool" ActionFunctionCallWithdrawAllFromStakingPool = "withdraw_all_from_staking_pool" ActionTypeUnstake = "unstake" ActionTypeStake = "stake" )
View Source
const ( ActionCreateAccount = "CreateAccount" // make a new account (for a person, company, contract, car, refrigerator, etc) ActionDeployContract = "DeployContract" // deploy a new contract (with its own account) ActionFunctionCall = "FunctionCall" // invoke a method on a contract (with budget for compute and storage) ActionTransfer = "Transfer" // transfer tokens from one account to another ActionStake = "Stake" // express interest in becoming a proof-of-stake validator at the next available opportunity ActionAddKey = "AddKey" // add a key to an existing account (either FullAccess or FunctionCall access) ActionDeleteKey = "DeleteKey" // delete an existing key from an account ActionDeleteAccount = "DeleteAccount" // delete an account (and transfer balance to a beneficiary account) )
Variables ¶
View Source
var ( // ErrBlockMissing is returned when block has been GC'ed by the node ErrBlockMissing = errors.New("block is missing") // ErrBlockNotFound is returned when block does not exist at given height ErrBlockNotFound = errors.New("block not found") // ErrEpochUnknown is returned when epoch can't be obtained from the node ErrEpochUnknown = errors.New("unknown epoch") ErrValidatorsUnavailable = errors.New("validator info unavailable") // ErrNotExist is returned when requested data is not available ErrNotExist = errors.New("record does not exist") )
View Source
var (
EmptyTxRoot = "11111111111111111111111111111111"
)
Functions ¶
func MapConfirmActions ¶ added in v0.16.1
func MapConfirmActions(transactions []model.Transaction) (map[string][]model.TransactionsByDelegator, error)
func ParseAction ¶ added in v0.16.1
func ParseAction(trx model.Transaction, account, actionType, validator string) (amt *big.Int, err error)
we only parse needed log message types, there is more than handled in here. ParseAction to get unstaked or staked amount
Types ¶
type AccessKey ¶ added in v0.2.0
type AccessKey struct { Nonce int `json:"nonce"` Permission interface{} `json:"permission"` }
type Account ¶
type Account struct { Amount string `json:"amount"` Locked string `json:"locked"` CodeHash string `json:"code_hash"` StorageUsage int `json:"storage_usage"` StoragePaidAt int `json:"storage_paid_at"` BlockHeight uint64 `json:"block_height"` BlockHash string `json:"block_hash"` // Augumented fields not returned by RPC StakedAmount *string `json:"staked_amount"` StakingPoolsCount *int `json:"staking_pools_count"` }
type AccountInfo ¶ added in v0.4.0
type Action ¶
type Action struct { Type string `json:"type"` Data interface{} `json:"data"` }
func DecodeActions ¶ added in v0.2.0
func DecodeActions(t *Transaction) []Action
DecodeActions decodes all actions in the transactions
type ActionError ¶ added in v0.2.0
type ActionError struct { Index int `json:"index"` Kind interface{} `json:"kind"` }
type AddKeyAction ¶ added in v0.2.0
type Block ¶
type Block struct { Author string `json:"author"` Header BlockHeader `json:"header"` Chunks []BlockChunk `json:"chunks"` }
type BlockChange ¶ added in v0.3.0
type BlockChangesResponse ¶ added in v0.3.0
type BlockChangesResponse struct { BlockHash string `json:"block_hash"` Changes []BlockChange `json:"changes"` }
type BlockChunk ¶
type BlockChunk struct { ChunkHash string `json:"chunk_hash"` PrevBlockHash string `json:"prev_block_hash"` OutcomeRoot string `json:"outcome_root"` PrevStateRoot string `json:"prev_state_root"` EncodedMerkleRoot string `json:"encoded_merkle_root"` EncodedLength int `json:"encoded_length"` HeightCreated uint64 `json:"height_created"` HeightIncluded uint64 `json:"height_included"` ShardID int `json:"shard_id"` GasUsed int `json:"gas_used"` GasLimit int64 `json:"gas_limit"` RentPaid string `json:"rent_paid"` ValidatorReward string `json:"validator_reward"` BalanceBurnt string `json:"balance_burnt"` OutgoingReceiptsRoot string `json:"outgoing_receipts_root"` TxRoot string `json:"tx_root"` ValidatorProposals []ValidatorProposal `json:"validator_proposals"` Signature string `json:"signature"` }
type BlockHeader ¶
type BlockHeader struct { Height uint64 `json:"height"` EpochID string `json:"epoch_id"` NextEpochID string `json:"next_epoch_id"` Hash string `json:"hash"` PrevHash string `json:"prev_hash"` PrevStateRoot string `json:"prev_state_root"` ChunkReceiptsRoot string `json:"chunk_receipts_root"` ChunkHeadersRoot string `json:"chunk_headers_root"` ChunkTxRoot string `json:"chunk_tx_root"` OutcomeRoot string `json:"outcome_root"` ChunksIncluded int `json:"chunks_included"` ChallengesRoot string `json:"challenges_root"` Timestamp int64 `json:"timestamp"` TimestampNanosec string `json:"timestamp_nanosec"` RandomValue string `json:"random_value"` ValidatorProposals []ValidatorProposal `json:"validator_proposals"` ChunkMask []bool `json:"chunk_mask"` GasPrice string `json:"gas_price"` RentPaid string `json:"rent_paid"` ValidatorReward string `json:"validator_reward"` TotalSupply string `json:"total_supply"` ChallengesResult []interface{} `json:"challenges_result"` LastFinalBlock string `json:"last_final_block"` LastDsFinalBlock string `json:"last_ds_final_block"` NextBpHash string `json:"next_bp_hash"` BlockMerkleRoot string `json:"block_merkle_root"` Approvals []interface{} `json:"approvals"` Signature string `json:"signature"` LatestProtocolVersion int `json:"latest_protocol_version"` }
type ChunkDetails ¶
type ChunkDetails struct { Header BlockChunk `json:"header"` Transactions []Transaction `json:"transactions"` }
type Client ¶
type Client interface { SetTimeout(time.Duration) SetDebug(bool) Call(string, interface{}, interface{}) error GenesisConfig() (GenesisConfig, error) GenesisRecords(int, int) (GenesisRecords, error) Status() (NodeStatus, error) NetworkInfo() (NetworkInfo, error) CurrentBlock() (Block, error) BlockByHeight(uint64) (Block, error) BlockByHash(string) (Block, error) Chunk(string) (ChunkDetails, error) Account(id string) (Account, error) AccountAtHeight(string, uint64) (Account, error) AccountInfo(string, string, uint64) (*AccountInfo, error) Transaction(string) (TransactionDetails, error) GasPrice(string) (string, error) CurrentValidators() (*ValidatorsResponse, error) ValidatorsByEpoch(string) (*ValidatorsResponse, error) BlockChanges(interface{}) (BlockChangesResponse, error) RewardFee(string) (*RewardFee, error) Delegations(string, uint64) ([]AccountInfo, error) }
Client interacts with the node RPC API
func DefaultClient ¶ added in v0.3.0
DefaultClient returns a new default RPc client
type CreateAccountAction ¶ added in v0.2.0
type CreateAccountAction struct { }
type DeleteAccountAction ¶ added in v0.2.0
type DeleteAccountAction struct {
BeneficiaryID string `json:"beneficiary_id"`
}
type DeleteKeyAction ¶ added in v0.2.0
type DeleteKeyAction struct {
PublicKey string `json:"public_key"`
}
type DeployContractAction ¶ added in v0.2.0
type DeployContractAction struct { }
type FunctionCallAction ¶ added in v0.2.0
type GasPriceDetails ¶
type GasPriceDetails struct {
GasPrice string `json:"gas_price"`
}
type GenesisConfig ¶
type GenesisConfig struct { ConfigVersion int `json:"config_version"` ProtocolVersion int `json:"protocol_version"` ChainID string `json:"chain_id"` GenesisHeight uint64 `json:"genesis_height"` GenesisTime time.Time `json:"genesis_time"` NumBlockProducerSeats int `json:"num_block_producer_seats"` EpochLength int `json:"epoch_length"` TotalSupply string `json:"total_supply"` Validators []struct { AccountID string `json:"account_id"` PublicKey string `json:"public_key"` Amount string `json:"amount"` } `json:"validators"` }
type GenesisRecords ¶
type GenesisRecords struct { Records []json.RawMessage `json:"records"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
type KickoutReason ¶ added in v0.3.0
type KickoutReason struct { Name ReasonName Data map[string]interface{} }
func (*KickoutReason) UnmarshalJSON ¶ added in v0.3.0
func (r *KickoutReason) UnmarshalJSON(data []byte) error
type NetworkInfo ¶ added in v0.2.1
type NetworkInfo struct { NumActivePeers int `json:"num_active_peers"` MaxPeersCount int `json:"peer_max_count"` KnownProducers []struct { ID string `json:"id"` Address string `json:"addr"` AccountID *string `json:"account_id"` } `json:"known_producers"` ActivePeers []struct { ID string `json:"id"` Address string `json:"addr"` AccountID *string `json:"account_id"` } `json:"active_peers"` }
type NodeStatus ¶
type QueryResponse ¶ added in v0.3.0
type ReasonName ¶ added in v0.3.0
type ReasonName string
const ( // Validator didn't produce enough blocks NotEnoughBlocks ReasonName = "NotEnoughBlocks" // Validator didn't produce enough chunks NotEnoughChunks ReasonName = "NotEnoughChunks" // Validator stake is now below threshold NotEnoughStake ReasonName = "NotEnoughStake" // Validator unstaked themselves Unstaked ReasonName = "Unstaked" // Enough stake but is not chosen because of seat limits. DidNotGetASeat ReasonName = "DidNotGetASeat" // Slashed validators are kicked out. Slashed ReasonName = "Slashed" )
type ReceiptsOutcome ¶
type StakeAction ¶ added in v0.2.0
type Transaction ¶
type TransactionDetails ¶
type TransactionDetails struct { ReceiptsOutcome []ReceiptsOutcome `json:"receipts_outcome"` Status interface{} `json:"status"` Transaction Transaction `json:"transaction"` TransactionOutcome TransactionOutcome `json:"transaction_outcome"` }
type TransactionOutcome ¶
type TransferAction ¶ added in v0.2.0
type TransferAction struct {
Deposit string `json:"deposit"`
}
type ValidatorKickout ¶ added in v0.3.0
type ValidatorKickout struct { Account string `json:"account_id"` Reason KickoutReason `json:"reason"` }
type ValidatorProposal ¶ added in v0.3.0
type ValidatorsResponse ¶ added in v0.3.0
type ValidatorsResponse struct { EpochStartHeight uint64 `json:"epoch_start_height"` CurrentValidators []Validator `json:"current_validators"` CurrentProposales []ValidatorProposal `json:"current_proposals"` NextValidators []Validator `json:"next_validators"` PreviousEpochKickout []ValidatorKickout `json:"prev_epoch_kickout"` }
Click to show internal directories.
Click to hide internal directories.