api

package
v0.0.0-...-f1492f4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 3 Imported by: 0

README

API

This package adds support for hive api.

State

ID Command Name Version
account_by_key
1 get_key_references RAW
account_history
1 get_account_history DONE
committee_api
1 get_committee_request DONE
2 get_committee_request_votes DONE
3 get_committee_requests_list DONE
database_api
1 get_account_count DONE
2 get_accounts DONE
3 get_block DONE
4 get_block_header DONE
5 get_chain_properties DONE
6 get_config DONE
7 get_database_info DONE
8 get_dynamic_global_properties DONE
9 get_escrow DONE
10 get_expiring_vesting_delegations DONE
11 get_hardfork_version DONE
12 get_next_scheduled_hardfork DONE
13 get_owner_history DONE
14 get_potential_signatures DONE
15 get_proposed_transaction DONE
16 get_recovery_request DONE
17 get_required_signatures DONE
18 get_transaction_hex DONE
19 get_vesting_delegations DONE
20 get_withdraw_routes DONE
21 lookup_account_names DONE
22 lookup_accounts DONE
23 verify_account_authority DONE
24 verify_authority DONE
follow
1 get_blog DONE
2 get_blog_authors DONE
3 get_blog_entries DONE
4 get_feed DONE
5 get_feed_entries DONE
6 get_follow_count DONE
7 get_followers DONE
8 get_following DONE
9 get_reblogged_by DONE
invite_api
1 get_invites_list DONE
2 get_invite_by_id DONE
3 get_invite_by_key DONE
network_broadcast_api
1 broadcast_block NONE
2 broadcast_transaction DONE
3 broadcast_transaction_synchronous DONE
4 broadcast_transaction_with_callback NONE
operation_history
1 get_ops_in_block DONE
2 get_transaction DONE
social_network
1 get_account_votes DONE
2 get_active_votes DONE
3 get_all_content_replies DONE
4 get_content DONE
5 get_content_replies DONE
6 get_replies_by_last_update DONE
tags
1 get_discussions_by_active DONE
2 get_discussions_by_author_before_date DONE
3 get_discussions_by_blog DONE
4 get_discussions_by_cashout DONE
5 get_discussions_by_children DONE
6 get_discussions_by_contents DONE
7 get_discussions_by_created DONE
8 get_discussions_by_feed DONE
9 get_discussions_by_hot DONE
10 get_discussions_by_payout DONE
11 get_discussions_by_trending DONE
12 get_discussions_by_votes DONE
13 get_languages DONE
14 get_tags_used_by_author RAW
15 get_trending_tags DONE
witness_api
1 get_active_witnesses DONE
2 get_miner_queue DONE
3 get_witness_by_account DONE
4 get_witness_count DONE
5 get_witness_schedule DONE
6 get_witnesses DONE
7 get_witnesses_by_vote DONE
8 lookup_witness_accounts DONE

License

MIT, see the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API plug-in structure

func NewAPI

func NewAPI(caller transports.Caller) *API

NewAPI plug-in initialization

func (*API) BroadcastTransaction

func (api *API) BroadcastTransaction(tx *types.Transaction) error

BroadcastTransaction api request broadcast_transaction

func (*API) BroadcastTransactionSynchronous

func (api *API) BroadcastTransactionSynchronous(tx *types.Transaction) (*BroadcastResponse, error)

BroadcastTransactionSynchronous api request broadcast_transaction_synchronous

func (*API) GetBlock

func (api *API) GetBlock(blockNum uint32) (*Block, error)

GetBlock api request get_block

func (*API) GetBlockHeader

func (api *API) GetBlockHeader(blockNum uint32) (*BlockHeader, error)

GetBlockHeader api request get_block_header

func (*API) GetConfig

func (api *API) GetConfig() (*Config, error)

GetConfig api request get_config

func (*API) GetDynamicGlobalProperties

func (api *API) GetDynamicGlobalProperties() (*DynamicGlobalProperties, error)

GetDynamicGlobalProperties api request get_dynamic_global_properties

func (*API) SetBlockAppliedCallback

func (api *API) SetBlockAppliedCallback(notice func(header *BlockHeader, error error)) (err error)

Set callback to invoke as soon as a new block is applied

type Block

type Block struct {
	Number                uint32               `json:"-"`
	Timestamp             *types.Time          `json:"timestamp"`
	Witness               string               `json:"witness"`
	WitnessSignature      string               `json:"witness_signature"`
	TransactionMerkleRoot string               `json:"transaction_merkle_root"`
	Previous              string               `json:"previous"`
	Extensions            [][]interface{}      `json:"extensions"`
	Transactions          []*types.Transaction `json:"transactions"`
}

Block structure for the GetBlock function

type BlockHeader

type BlockHeader struct {
	Number                uint32        `json:"-"`
	Previous              string        `json:"previous"`
	Timestamp             string        `json:"timestamp"`
	Witness               string        `json:"witness"`
	TransactionMerkleRoot string        `json:"transaction_merkle_root"`
	Extensions            []interface{} `json:"extensions"`
}

BlockHeader structure for the GetBlockHeader and SetBlockAppliedCallback functions

type BroadcastResponse

type BroadcastResponse struct {
	ID       string `json:"id"`
	BlockNum int32  `json:"block_num"`
	TrxNum   int32  `json:"trx_num"`
	Expired  bool   `json:"expired"`
}

BroadcastResponse structure for the BroadcastTransactionSynchronous function

type Config

type Config struct {
	Percent100                       int           `json:"CHAIN_100_PERCENT"`
	Percent1                         *types.Int    `json:"CHAIN_1_PERCENT"`
	AddressPrefix                    string        `json:"CHAIN_ADDRESS_PREFIX"`
	BandwidthAverageWindowSeconds    *types.Int    `json:"CHAIN_BANDWIDTH_AVERAGE_WINDOW_SECONDS"`
	BandwidthPrecision               *types.Int    `json:"CHAIN_BANDWIDTH_PRECISION"`
	ConsensusBandwidthReservePercent *types.Int    `json:"CONSENSUS_BANDWIDTH_RESERVE_PERCENT"`
	ConsensusBandwidthReserveBelow   *types.Int    `json:"CONSENSUS_BANDWIDTH_RESERVE_BELOW"`
	HardforkVersion                  string        `json:"CHAIN_HARDFORK_VERSION"`
	Version                          string        `json:"CHAIN_VERSION"`
	BlockInterval                    uint          `json:"CHAIN_BLOCK_INTERVAL"`
	BlocksPerDay                     *types.Int    `json:"CHAIN_BLOCKS_PER_DAY"`
	BlocksPerYear                    *types.Int    `json:"CHAIN_BLOCKS_PER_YEAR"`
	CashoutWindowSeconds             *types.Int    `json:"CHAIN_CASHOUT_WINDOW_SECONDS"`
	ChainID                          string        `json:"CHAIN_ID"`
	HardforkRequiredWitnesses        *types.Int    `json:"CHAIN_HARDFORK_REQUIRED_WITNESSES"`
	InitiatorName                    string        `json:"CHAIN_INITIATOR_NAME"`
	InitiatorPublicKey               string        `json:"CHAIN_INITIATOR_PUBLIC_KEY_STR"`
	InitSupply                       *types.UInt32 `json:"CHAIN_INIT_SUPPLY"`
	CommitteeAccount                 string        `json:"CHAIN_COMMITTEE_ACCOUNT"`
	CommitteePublicKey               string        `json:"CHAIN_COMMITTEE_PUBLIC_KEY_STR"`
	IrreversibleThreshold            *types.Int    `json:"CHAIN_IRREVERSIBLE_THRESHOLD"`
	MaxAccountNameLength             *types.Int    `json:"CHAIN_MAX_ACCOUNT_NAME_LENGTH"`
	MaxAccountWitnessVotes           *types.Int    `json:"CHAIN_MAX_ACCOUNT_WITNESS_VOTES"`
	BlockSize                        *types.Int    `json:"CHAIN_BLOCK_SIZE"`
	MaxCommentDepth                  *types.Int    `json:"CHAIN_MAX_COMMENT_DEPTH"`
	MaxMemoSize                      *types.Int    `json:"CHAIN_MAX_MEMO_SIZE"`
	MaxWitnesses                     *types.Int    `json:"CHAIN_MAX_WITNESSES"`
	MaxProxyRecursionDepth           *types.Int    `json:"CHAIN_MAX_PROXY_RECURSION_DEPTH"`
	MaxReserveRatio                  *types.Int    `json:"CHAIN_MAX_RESERVE_RATIO"`
	MaxSupportWitnesses              *types.Int    `json:"CHAIN_MAX_SUPPORT_WITNESSES"`
	MaxShareSupply                   string        `json:"CHAIN_MAX_SHARE_SUPPLY"`
	MaxSigCheckDepth                 *types.Int    `json:"CHAIN_MAX_SIG_CHECK_DEPTH"`
	MaxTimeUntilExpiration           *types.Int    `json:"CHAIN_MAX_TIME_UNTIL_EXPIRATION"`
	MaxTransactionSize               *types.Int    `json:"CHAIN_MAX_TRANSACTION_SIZE"`
	MaxUndoHistory                   *types.Int    `json:"CHAIN_MAX_UNDO_HISTORY"`
	MaxVoteChanges                   *types.Int    `json:"CHAIN_MAX_VOTE_CHANGES"`
	MaxTopWitnesses                  *types.Int    `json:"CHAIN_MAX_TOP_WITNESSES"`
	MaxWithdrawRoutes                *types.Int    `json:"CHAIN_MAX_WITHDRAW_ROUTES"`
	MaxWitnessURLLength              *types.Int    `json:"CHAIN_MAX_WITNESS_URL_LENGTH"`
	MinAccountCreationFee            *types.Int    `json:"CHAIN_MIN_ACCOUNT_CREATION_FEE"`
	MinAccountNameLength             *types.Int    `json:"CHAIN_MIN_ACCOUNT_NAME_LENGTH"`
	MinBlockSizeLimit                *types.Int    `json:"CHAIN_MIN_BLOCK_SIZE_LIMIT"`
	MaxBlockSizeLimit                *types.Int    `json:"CHAIN_MAX_BLOCK_SIZE_LIMIT"`
	NullAccount                      string        `json:"CHAIN_NULL_ACCOUNT"`
	NumInitiators                    *types.Int    `json:"CHAIN_NUM_INITIATORS"`
	ProxyToSelfAccount               string        `json:"CHAIN_PROXY_TO_SELF_ACCOUNT"`
	SecondsPerYear                   *types.Int    `json:"CHAIN_SECONDS_PER_YEAR"`
	VestingWithdrawIntervals         *types.Int    `json:"CHAIN_VESTING_WITHDRAW_INTERVALS"`
	VestingWithdrawIntervalSeconds   *types.Int    `json:"CHAIN_VESTING_WITHDRAW_INTERVAL_SECONDS"`
	EnergyRegenerationSeconds        int           `json:"CHAIN_ENERGY_REGENERATION_SECONDS"`
	TokenSymbol                      *types.Int    `json:"TOKEN_SYMBOL"`
	SharesSymbol                     *types.Int    `json:"SHARES_SYMBOL"`
	ChainName                        string        `json:"CHAIN_NAME"`
}

Config structure for the GetConfig function.

type DynamicGlobalProperties

type DynamicGlobalProperties struct {
	ID                         *types.Int   `json:"id"`
	HeadBlockNumber            uint32       `json:"head_block_number"`
	HeadBlockID                string       `json:"head_block_id"`
	GenesisTime                *types.Time  `json:"genesis_time"`
	Time                       *types.Time  `json:"time"`
	CurrentWitness             string       `json:"current_witness"`
	CommitteeFund              *types.Asset `json:"committee_fund"`
	CommitteeRequests          uint32       `json:"committee_requests"`
	CurrentSupply              *types.Asset `json:"current_supply"`
	TotalVersingFund           *types.Asset `json:"total_vesting_fund"`
	TotalVestingShares         *types.Asset `json:"total_vesting_shares"`
	TotalRewardFund            *types.Asset `json:"total_reward_fund"`
	TotalRewardShares          *types.Int64 `json:"total_reward_shares"`
	InflationCalcBlockNum      uint32       `json:"inflation_calc_block_num"`
	InflationWitnessPercent    int16        `json:"inflation_witness_percent"`
	InflationRatio             int16        `json:"inflation_ratio"`
	AverageBlockSize           uint32       `json:"average_block_size"`
	MaximumBlockSize           uint32       `json:"maximum_block_size"`
	CurrentAslot               uint64       `json:"current_aslot"`
	RecentSlotsFilled          *types.Int64 `json:"recent_slots_filled"`
	ParticipationCount         uint8        `json:"participation_count"`
	LastIrreversibleBlockNum   uint32       `json:"last_irreversible_block_num"`
	MaxVirtualBandwidth        uint64       `json:"max_virtual_bandwidth"`
	CurrentReserveRatio        uint64       `json:"current_reserve_ratio"`
	VoteRegenerationPerDay     uint32       `json:"vote_regeneration_per_day"`
	BandwidthReserveCandidates uint32       `json:"bandwidth_reserve_candidates"`
}

DynamicGlobalProperties structure for the GetDynamicGlobalProperties function.

Jump to

Keyboard shortcuts

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