api

package
v0.0.0-...-7e56884 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 5 Imported by: 0

README

API

This package adds support for golos api.

State

ID Command Name Version
account_by_key
1 get_key_references DONE
account_history
1 get_account_history DONE
database_api
1 get_account_bandwidth DONE
2 get_account_count DONE
3 get_accounts DONE
4 get_block DONE
5 get_block_header DONE
6 get_chain_properties DONE
7 get_config DONE
8 get_conversion_requests DONE
9 get_database_info DONE
10 get_dynamic_global_properties DONE
11 get_escrow DONE
12 get_expiring_vesting_delegations DONE
13 get_hardfork_version DONE
14 get_next_scheduled_hardfork DONE
15 get_owner_history DONE
16 get_potential_signatures DONE
17 get_proposed_transaction DONE
18 get_recovery_request DONE
19 get_required_signatures DONE
20 get_savings_withdraw_from DONE
21 get_savings_withdraw_to DONE
22 get_transaction_hex DONE
23 get_vesting_delegations DONE
24 get_withdraw_routes DONE
25 lookup_account_names DONE
26 lookup_accounts DONE
27 verify_account_authority DONE
28 verify_authority DONE
follow
1 get_account_reputations DONE
2 get_blog DONE
3 get_blog_authors DONE
4 get_blog_entries DONE
5 get_feed DONE
6 get_feed_entries DONE
7 get_follow_count DONE
8 get_followers DONE
9 get_following DONE
10 get_reblogged_by DONE
market_history
1 get_market_history DONE
2 get_market_history_buckets DONE
3 get_open_orders DONE
4 get_order_book DONE
5 get_order_book_extended NONE
6 get_recent_trades DONE
7 get_ticker DONE
8 get_trade_history DONE
9 get_volume 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
operation_history
1 get_inbox DONE
2 get_outbox DONE
3 get_thread DONE
4 get_settings DONE
5 get_contacts_size RAW
6 get_contact_info DONE
7 get_contacts 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_comments 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_promoted DONE
12 get_discussions_by_trending DONE
13 get_discussions_by_votes DONE
14 get_languages DONE
15 get_tags_used_by_author RAW
16 get_trending_tags DONE
witness_api
1 get_active_witnesses DONE
2 get_current_median_history_price DONE
3 get_feed_history DONE
4 get_miner_queue DONE
5 get_witness_by_account DONE
6 get_witness_count DONE
7 get_witness_schedule DONE
8 get_witnesses DONE
9 get_witnesses_by_vote DONE
10 lookup_witness_accounts DONE

License

MIT, see the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyParams = []struct{}{}
)

Functions

This section is empty.

Types

type API

type API struct {
	DatabaseID, HistoryID, NetworkBroadcastID *uint8
	// 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 *operations.Transaction) error

BroadcastTransaction api request broadcast_transaction

func (*API) BroadcastTransactionSynchronous

func (api *API) BroadcastTransactionSynchronous(tx *operations.Transaction, maxBlockAge ...uint32) (*BroadcastResponse, error)

BroadcastTransactionSynchronous api request broadcast_transaction_synchronous

func (*API) DataBaseAPIID

func (api *API) DataBaseAPIID() (*uint8, error)

func (*API) GetAccountCount

func (api *API) GetAccountCount() (*uint64, error)

GetAccountCount returns the number of registered users.

func (*API) GetBlockHeader

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

GetBlockHeader api request get_block_header

func (*API) GetBlockHeaderBatch

func (api *API) GetBlockHeaderBatch(blockNum ...uint32) ([]BlockHeaderBatch, error)

GetBlockHeaderBatch api request get_block_header_batch

func (*API) GetChainID

func (api *API) GetChainID() (*string, error)

GetChainID api request get_chain_id

func (*API) GetChainProperties

func (api *API) GetChainProperties() (*ChainProperty, error)

GetChainProperties api request get_chain_properties

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) GetGlobalProperties

func (api *API) GetGlobalProperties() (*GlobalProperty, error)

GetGlobalProperties api request get_global_properties

func (*API) GetKeyReferences

func (api *API) GetKeyReferences(pubkey ...string) ([]*string, error)

GetKeyReferences returns a list of accounts by a list of public keys

func (*API) HistoryAPIID

func (api *API) HistoryAPIID() (*uint8, error)

func (*API) IsPublicKeyRegistered

func (api *API) IsPublicKeyRegistered(pubkey string) (*bool, error)

IsPublicKeyRegistered api request is_public_key_registered

func (*API) Login

func (api *API) Login(username, password string) (bool, error)

func (*API) NetworkBroadcastAPIID

func (api *API) NetworkBroadcastAPIID() (*uint8, error)

func (*API) SetAPIID

func (api *API) SetAPIID() error

func (*API) SetBlockAppliedCallback

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

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

type BlockHeader

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

BlockHeader structure for the GetBlockHeader function

type BlockHeaderBatch

type BlockHeaderBatch struct {
	BlockNum  uint32
	BlockHead BlockHeader
}

BlockHeader structure for the GetBlockHeaderBatch function

func (*BlockHeaderBatch) UnmarshalJSON

func (n *BlockHeaderBatch) UnmarshalJSON(buf []byte) error

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 CallbackBlockResponse

type CallbackBlockResponse struct {
	BlockNum   int           `json:"block_num"`
	Operations []interface{} `json:"operations"`
}

CallbackBlockResponse structure for the SetBlockAppliedCallback function

type ChainProperty

type ChainProperty struct {
	ChainID                  string                  `json:"chain_id"`
	ImmutableChainParameters ImmutableChainParameter `json:"immutable_chain_parameters"`
}

ChainProperty structure for the GetChainProperties function

type Config

type Config struct {
	Symbol                                  string         `json:"GRAPHENE_SYMBOL"`
	AddressPrefix                           string         `json:"GRAPHENE_ADDRESS_PREFIX"`
	MinAccountNameLength                    uint64         `json:"GRAPHENE_MIN_ACCOUNT_NAME_LENGTH"`
	MaxAccountNameLength                    uint64         `json:"GRAPHENE_MAX_ACCOUNT_NAME_LENGTH"`
	MinAssetSymbolLength                    uint64         `json:"GRAPHENE_MIN_ASSET_SYMBOL_LENGTH"`
	MaxAssetSymbolLength                    uint64         `json:"GRAPHENE_MAX_ASSET_SYMBOL_LENGTH"`
	MaxShareSupply                          string         `json:"GRAPHENE_MAX_SHARE_SUPPLY"`
	MaxSigCheckDepth                        uint8          `json:"GRAPHENE_MAX_SIG_CHECK_DEPTH"`
	MinTransactionSizeLimit                 uint64         `json:"GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT"`
	MinBlockInterval                        uint8          `json:"GRAPHENE_MIN_BLOCK_INTERVAL"`
	MaxBlockInterval                        uint8          `json:"GRAPHENE_MAX_BLOCK_INTERVAL"`
	DefaultBlockInterval                    uint8          `json:"GRAPHENE_DEFAULT_BLOCK_INTERVAL"`
	DefaultMaxTransactionSize               uint32         `json:"GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE"`
	DefaultMaxBlockSize                     uint32         `json:"GRAPHENE_DEFAULT_MAX_BLOCK_SIZE"`
	DefaultMaxTimeUntilExpiration           uint32         `json:"GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION"`
	DefaultMaintenanceInterval              uint32         `json:"GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL"`
	DefaultMaintenanceSkipSlots             uint8          `json:"GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS"`
	MinUndoHistory                          uint64         `json:"GRAPHENE_MIN_UNDO_HISTORY"`
	MaxUndoHistory                          uint64         `json:"GRAPHENE_MAX_UNDO_HISTORY"`
	MinBlockSizeLimit                       uint64         `json:"GRAPHENE_MIN_BLOCK_SIZE_LIMIT"`
	BlockchainPrecision                     uint64         `json:"GRAPHENE_BLOCKCHAIN_PRECISION"`
	BlockchainPrecisionDigits               uint64         `json:"GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS"`
	Percent100                              uint16         `json:"GRAPHENE_100_PERCENT"`
	Percent1                                uint16         `json:"GRAPHENE_1_PERCENT"`
	MaxMarketFeePercent                     uint16         `json:"GRAPHENE_MAX_MARKET_FEE_PERCENT"`
	DefaultForceSettlementDelay             uint64         `json:"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY"`
	DefaultForceSettlementOffset            uint64         `json:"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET"`
	DefaultForceSettlementMaxVolume         uint64         `json:"GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME"`
	DefaultPriceFeedLifetime                uint64         `json:"GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME"`
	DefaultMaxAuthorityMembership           uint16         `json:"GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP"`
	DefaultMaxAssetWhitelistAuthorities     uint8          `json:"GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES"`
	DefaultMaxAssetFeedPublishers           uint8          `json:"GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS"`
	CollateralRatioDenom                    uint64         `json:"GRAPHENE_COLLATERAL_RATIO_DENOM"`
	MinCollateralRatio                      uint64         `json:"GRAPHENE_MIN_COLLATERAL_RATIO"`
	MaxCollateralRatio                      uint64         `json:"GRAPHENE_MAX_COLLATERAL_RATIO"`
	DefaultMaintenanceCollateralRatio       uint64         `json:"GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO"`
	DefaultMaxShortSqueezeRatio             uint64         `json:"GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO"`
	DefaultMaxWitnesses                     uint16         `json:"GRAPHENE_DEFAULT_MAX_WITNESSES"`
	DefaultMaxCommittee                     uint16         `json:"GRAPHENE_DEFAULT_MAX_COMMITTEE"`
	DefaultMaxProposalLifetimeSec           uint32         `json:"GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC"`
	DefaultCommitteeProposalReviewPeriodSec uint32         `json:"GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC"`
	DefaultNetworkPercentOfFee              uint16         `json:"GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE"`
	DefaultLifetimeReferrerPercentOfFee     uint16         `json:"GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE"`
	DefaultCashbackVestingPeriodSec         uint32         `json:"GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC"`
	DefaultCashbackVestingThreshold         int64          `json:"GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD"`
	DefaultBurnPercentOfFee                 uint16         `json:"GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE"`
	DefaultMaxAssertOpcode                  uint16         `json:"GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE"`
	DefaultFeeLiquidationThreshold          int64          `json:"GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD"`
	DefaultAccountsPerFeeScale              uint16         `json:"GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE"`
	DefaultAccountFeeScaleBitshifts         uint8          `json:"GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS"`
	MaxWorkerNameLength                     uint64         `json:"GRAPHENE_MAX_WORKER_NAME_LENGTH"`
	MaxUrlLength                            uint64         `json:"GRAPHENE_MAX_URL_LENGTH"`
	CoreAssetCycleRate                      uint64         `json:"GRAPHENE_CORE_ASSET_CYCLE_RATE"`
	CoreAssetCycleRateBits                  uint64         `json:"GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS"`
	DefaultWitnessPayPerBlock               int64          `json:"GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK"`
	DefaultWitnessPayVestingSeconds         uint32         `json:"GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS"`
	DefaultWorkerBudgetPerDay               string         `json:"GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY"`
	CommitteeAccount                        types.ObjectID `json:"GRAPHENE_COMMITTEE_ACCOUNT"`
	WitnessAccount                          types.ObjectID `json:"GRAPHENE_WITNESS_ACCOUNT"`
	RelaxedCommitteeAccount                 types.ObjectID `json:"GRAPHENE_RELAXED_COMMITTEE_ACCOUNT"`
	NullAccount                             types.ObjectID `json:"GRAPHENE_NULL_ACCOUNT"`
	TempAccount                             types.ObjectID `json:"GRAPHENE_TEMP_ACCOUNT"`
}

Config structure for the GetConfig function.

type DynamicGlobalProperties

type DynamicGlobalProperties struct {
	HeadBlockNumber                uint32     `json:"head_block_number"`
	HeadBlockID                    string     `json:"head_block_id"`
	Time                           types.Time `json:"time"`
	CurrentWitness                 string     `json:"current_witness"`
	NextMaintenanceTime            types.Time `json:"next_maintenance_time"`
	LastBudgetTime                 types.Time `json:"last_budget_time"`
	WitnessBudget                  int64      `json:"witness_budget"`
	AccountsRegisteredThisInterval uint32     `json:"accounts_registered_this_interval"`
	RecentlyMissedCount            uint32     `json:"recently_missed_count"`
	CurrentAslot                   uint64     `json:"current_aslot"`
	RecentSlotsFilled              string     `json:"recent_slots_filled"`
	DynamicFlags                   uint32     `json:"dynamic_flags"`
	LastIrreversibleBlockNum       uint32     `json:"last_irreversible_block_num"`
	DynamicFlagBits                uint8      `json:"dynamic_flag_bits"`
}

DynamicGlobalProperties structure for the GetDynamicGlobalProperties function

type GlobalProperty

type GlobalProperty struct {
	Parameters             types.ChainParameters    `json:"parameters"`
	PendingParameters      []*types.ChainParameters `json:"pending_parameters,omitempty"`
	NextAvailableVoteID    uint32                   `json:"next_available_vote_id"`
	ActiveCommitteeMembers []types.ObjectID         `json:"active_committee_members"`
	ActiveWitnesses        []types.ObjectID         `json:"active_witnesses"`
}

GlobalProperty structure for the GetGlobalProperties function

type ImmutableChainParameter

type ImmutableChainParameter struct {
	MinCommitteeMemberCount uint16 `json:"min_committee_member_count"`
	MinWitnessCount         uint16 `json:"min_witness_count"`
	NumSpecialAccounts      uint32 `json:"num_special_accounts"`
	NumSpecialAssets        uint32 `json:"num_special_assets"`
}

ImmutableChainParameter is an additional structure used by ChainProperty structure.

Jump to

Keyboard shortcuts

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