api

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 4 Imported by: 0

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) (*AsyncBroadcastResponse, 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) GetAccountCount

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

func (*API) GetAccounts

func (api *API) GetAccounts(account string) (*AccountList, error)

func (*API) GetActiveSupernodes

func (api *API) GetActiveSupernodes() (*[]string, error)

func (*API) GetBalance

func (api *API) GetBalance(account, tokenName string, decimals uint8) (*string, error)

Get balance

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

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

func (*API) GetKeyReferences

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

func (*API) GetLatestNFTBlock added in v1.0.2

func (api *API) GetLatestNFTBlock() (*NFTBlock, error)

func (*API) GetNFTBalance added in v1.0.2

func (api *API) GetNFTBalance(account string, symbol string, limit, offset uint32) (*NFTInstanceList, error)

func (*API) GetNFTBalanceOfAccount added in v1.0.2

func (api *API) GetNFTBalanceOfAccount(account string, limit, offset uint32) (map[string]NFTInstanceList, error)

func (*API) GetNFTBlock added in v1.0.2

func (api *API) GetNFTBlock(blockNum uint32) (*NFTBlock, error)

func (*API) GetNFTInstances added in v1.0.2

func (api *API) GetNFTInstances(symbol string, limit, offset uint32) (*NFTInstanceList, error)

func (*API) GetNFTTransaction added in v1.0.2

func (api *API) GetNFTTransaction(trxId string) (*NFTTransaction, error)

func (*API) GetNFTs added in v1.0.2

func (api *API) GetNFTs(symbol string, limit, offset uint32) (*NFTList, error)

func (*API) GetNextScheduledHardfork

func (api *API) GetNextScheduledHardfork() (*ScheduledHardfork, error)

func (*API) GetPendingTransactionCount

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

func (*API) GetSupernodeByAccount

func (api *API) GetSupernodeByAccount(account string) (*SupernodeInfo, error)

func (*API) GetSupernodeByVote

func (api *API) GetSupernodeByVote(lowerBound string, limit uint32) (*SupernodeList, error)

func (*API) GetSupernodeCount

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

func (*API) GetSupernodeSchedule

func (api *API) GetSupernodeSchedule() (*SupernodeSchedule, error)

func (*API) GetSupernodeVoted

func (api *API) GetSupernodeVoted(account string) (*SupernodeVoteList, error)

func (*API) GetSupernodes

func (api *API) GetSupernodes(id types.UInt16) (*SupernodeList, error)

func (*API) GetTokens

func (api *API) GetTokens(name string) (*TokenList, error)

func (*API) GetTransaction

func (api *API) GetTransaction(trxId string) (*TransactionResponse, error)

GetTransaction api request get_transaction

func (*API) GetTransactionHex

func (api *API) GetTransactionHex(tx *types.Transaction) (string, error)

GetTransactionHex api request get_transaction_hex

func (*API) GetTransactionWithStatus

func (api *API) GetTransactionWithStatus(trxId string) (*TransactionResponse, error)

func (*API) GetVersion

func (api *API) GetVersion() (*Version, error)

func (*API) ListAccounts

func (api *API) ListAccounts(lowerBound string, limit uint32) (*[]string, error)

func (*API) ListSupernodes

func (api *API) ListSupernodes(lowerBound string, limit uint32) (*[]string, error)

func (*API) ListTokens

func (api *API) ListTokens() (*TokenList, error)

func (*API) LookupSupernodeAccounts

func (api *API) LookupSupernodeAccounts(lowerBound string, limit uint32) (*[]string, error)

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 AccountInfo

type AccountInfo struct {
	Id                    *types.UInt16          `json:"id"`
	Name                  string                 `json:"name"`
	Owner                 *types.Authority       `json:"owner"`
	JSONMetadata          *types.AccountMetadata `json:"json_metadata"`
	LastOwnerUpdate       *types.Time            `json:"last_owner_update"`
	LastAccountUpdate     *types.Time            `json:"last_account_update"`
	Created               *types.Time            `json:"created"`
	Balance               string                 `json:"balance"`
	WdBalance             string                 `json:"wd_balance"`
	VestingShares         string                 `json:"vesting_shares"`
	VestingWithdrawRate   string                 `json:"vesting_withdraw_rate"`
	NextVestingWithdrawal *types.Time            `json:"next_vesting_withdrawal"`
	Withdrawn             *types.Int64           `json:"withdrawn"`
	ToWithdraw            *types.Int64           `json:"to_withdraw"`
	SupernodesVotedFor    uint16                 `json:"supernodes_voted_for"`
	TokenList             []string               `json:"token_list"`
	VestingBalance        string                 `json:"vesting_balance"`
	SupernodeVotes        []string               `json:"supernode_votes"`
}

type AccountList

type AccountList []AccountInfo

type AsyncBroadcastResponse

type AsyncBroadcastResponse struct {
	ID string `json:"id"`
}

type Block

type Block struct {
	Number                uint32                 `json:"-"`
	Previous              string                 `json:"previous"`
	Timestamp             *types.Time            `json:"timestamp"`
	Supernode             string                 `json:"supernode"`
	TransactionMerkleRoot string                 `json:"transaction_merkle_root"`
	BlockReward           *types.Asset           `json:"block_reward"`
	Extensions            [][]interface{}        `json:"extensions"`
	SupernodeSignature    string                 `json:"supernode_signature"`
	Transactions          []*TransactionResponse `json:"transactions"`
	BlockId               string                 `json:"block_id"`
	PublicKeyType         string                 `json:"signing_key"`
	TransactionIds        []string               `json:"transaction_ids"`
}

Block structure for the GetBlock function

type BlockHeader

type BlockHeader struct {
	Number                uint32        `json:"-"`
	Previous              string        `json:"previous"`
	Timestamp             string        `json:"timestamp"`
	Supernode             string        `json:"supernode"`
	TransactionMerkleRoot string        `json:"transaction_merkle_root"`
	BlockReward           *types.Asset  `json:"block_reward"`
	Extensions            []interface{} `json:"extensions"`
}

BlockHeader structure for the GetBlockHeader and SetBlockAppliedCallback functions

type BlockParams added in v1.0.2

type BlockParams struct {
	BlockNumber uint32 `json:"blockNumber"`
}

type BroadcastResponse

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

BroadcastResponse structure for the BroadcastTransactionSynchronous function

type Config

type Config struct {
	TokenCreationFee int `json:"SMT_TOKEN_CREATION_FEE_HF1"`
	//WDSymbol						 string		   `json:"WD_SYMBOL"`
	Percent100                            *types.Int  `json:"BEOWULF_100_PERCENT"`
	Percent1                              *types.Int  `json:"BEOWULF_1_PERCENT"`
	AddressPrefix                         string      `json:"BEOWULF_ADDRESS_PREFIX"`
	HardforkVersion                       string      `json:"BEOWULF_BLOCKCHAIN_HARDFORK_VERSION"`
	Version                               string      `json:"BEOWULF_BLOCKCHAIN_VERSION"`
	BlockInterval                         uint        `json:"BEOWULF_BLOCK_INTERVAL"`
	BlocksPerDay                          *types.Int  `json:"BEOWULF_BLOCKS_PER_DAY"`
	BlocksPerYear                         *types.Int  `json:"BEOWULF_BLOCKS_PER_YEAR"`
	ChainID                               string      `json:"BEOWULF_CHAIN_ID"`
	GenesisTime                           *types.Time `json:"BEOWULF_GENESIS_TIME"`
	HardforkRequiredSupernodes            *types.Int  `json:"BEOWULF_HARDFORK_REQUIRED_SUPERNODES"`
	InflationNarrowingPeriod              *types.Int  `json:"BEOWULF_INFLATION_NARROWING_PERIOD"`
	InflationRateStartPercent             *types.Int  `json:"BEOWULF_INFLATION_RATE_START_PERCENT_HF1"`
	InflationRateStopPercent              *types.Int  `json:"BEOWULF_INFLATION_RATE_STOP_PERCENT"`
	InitiatorName                         string      `json:"BEOWULF_INIT_MINER_NAME"`
	InitiatorPublicKey                    string      `json:"BEOWULF_INIT_PUBLIC_KEY_STR"`
	InitSupply                            *types.Int  `json:"BEOWULF_INIT_SUPPLY"`
	WDInitSupply                          *types.Int  `json:"WD_INIT_SUPPLY"`
	IrreversibleThreshold                 *types.Int  `json:"BEOWULF_IRREVERSIBLE_THRESHOLD"`
	MaxAccountNameLength                  *types.Int  `json:"BEOWULF_MAX_ACCOUNT_NAME_LENGTH"`
	MaxAccountSupernodeVotes              *types.Int  `json:"BEOWULF_MAX_ACCOUNT_SUPERNODE_VOTES"`
	MaxAuthorityMembership                *types.Int  `json:"BEOWULF_MAX_AUTHORITY_MEMBERSHIP"`
	BlockSize                             *types.Int  `json:"BEOWULF_SOFT_MAX_BLOCK_SIZE"`
	MaxMemoSize                           *types.Int  `json:"BEOWULF_MAX_MEMO_SIZE"`
	MaxSupernodes                         *types.Int  `json:"BEOWULF_MAX_SUPERNODES"`
	MaxPermanentSupernodes                *types.Int  `json:"BEOWULF_MAX_PERMANENT_SUPERNODES_HF0"`
	MaxRunnerSupernodes                   *types.Int  `json:"BEOWULF_MAX_RUNNER_SUPERNODES_HF0"`
	MaxShareSupply                        *types.Int  `json:"BEOWULF_MAX_SHARE_SUPPLY"`
	MaxSigCheckDepth                      *types.Int  `json:"BEOWULF_MAX_SIG_CHECK_DEPTH"`
	MaxSigCheckAccounts                   *types.Int  `json:"BEOWULF_MAX_SIG_CHECK_ACCOUNTS"`
	MaxTimeUntilExpiration                int         `json:"BEOWULF_MAX_TIME_UNTIL_EXPIRATION"`
	MaxTransactionSize                    *types.Int  `json:"BEOWULF_MAX_TRANSACTION_SIZE_HF1"`
	MaxUndoHistory                        *types.Int  `json:"BEOWULF_MAX_UNDO_HISTORY"`
	MaxVotedSupernodes                    *types.Int  `json:"BEOWULF_MAX_VOTED_SUPERNODES_HF0"`
	MinSupernodeFund                      *types.Int  `json:"BEOWULF_MIN_SUPERNODE_FUND"`
	MinTransactionFee                     *types.Int  `json:"BEOWULF_MIN_TRANSACTION_FEE"`
	MinAccountCreationFee                 *types.Int  `json:"BEOWULF_MIN_ACCOUNT_CREATION_FEE_HF1"`
	MinAccountNameLength                  *types.Int  `json:"BEOWULF_MIN_ACCOUNT_NAME_LENGTH"`
	MinBlockSizeLimit                     *types.Int  `json:"BEOWULF_MIN_BLOCK_SIZE"`
	NullAccount                           string      `json:"BEOWULF_NULL_ACCOUNT"`
	NumInitiators                         *types.Int  `json:"BEOWULF_NUM_INIT_MINERS"`
	OwnerAuthHistoryTrackingStartBlockNum *types.Int  `json:"BEOWULF_OWNER_AUTH_HISTORY_TRACKING_START_BLOCK_NUM"`
	OwnerUpdateLimit                      *types.Int  `json:"BEOWULF_OWNER_UPDATE_LIMIT"`
	VestingWithdrawIntervals              *types.Int  `json:"BEOWULF_VESTING_WITHDRAW_INTERVALS"`
	VestingWithdrawIntervalSeconds        *types.Int  `json:"BEOWULF_VESTING_WITHDRAW_INTERVAL_SECONDS"`
	//BEOWULF_SYMBOL
	//VESTS_SYMBOL
	VirtualScheduleLapLength  *types.Int `json:"BEOWULF_VIRTUAL_SCHEDULE_LAP_LENGTH2"`
	Beowulf1Beowulf           *types.Int `json:"BEOWULF_1_BEOWULF"`
	Beowulf1Vests             *types.Int `json:"BEOWULF_1_VESTS"`
	MaxTokenPerAccount        *types.Int `json:"BEOWULF_MAX_TOKEN_PER_ACCOUNT"`
	MinPermanentSupernodeFund *types.Int `json:"BEOWULF_MIN_PERMANENT_SUPERNODE_FUND"`
	MaxTokenNameLength        *types.Int `json:"BEOWULF_MAX_TOKEN_NAME_LENGTH"`
	MinTokenNameLength        *types.Int `json:"BEOWULF_MIN_TOKEN_NAME_LENGTH"`
	SymbolBeowulf             string     `json:"BEOWULF_SYMBOL_BEOWULF"`
	SymbolWD                  string     `json:"BEOWULF_SYMBOL_WD"`
	SymbolVests               string     `json:"BEOWULF_SYMBOL_VESTS"`
	BlockRewardGap            *types.Int `json:"BEOWULF_BLOCK_REWARD_GAP"`
}

Config structure for the GetConfig function.

type DynamicGlobalProperties

type DynamicGlobalProperties struct {
	ID               string       `json:"id"`
	HeadBlockNumber  uint32       `json:"head_block_number"`
	HeadBlockID      string       `json:"head_block_id"`
	Time             *types.Time  `json:"time"`
	CurrentSupernode string       `json:"current_supernode"`
	CurrentSupply    *types.Asset `json:"current_supply"`
	CurrentWDSupply  *types.Asset `json:"current_wd_supply"`

	TotalVestingFund   *types.Asset `json:"total_vesting_fund_beowulf"`
	TotalVestingShares *types.Asset `json:"total_vesting_shares"`
	CurrentAslot       uint64       `json:"current_aslot"`
	//RecentSlotsFilled        *types.Int   `json:"recent_slots_filled"`
	//ParticipationCount       uint8        `json:"participation_count"`
	LastIrreversibleBlockNum uint32 `json:"last_irreversible_block_num"`
}

DynamicGlobalProperties structure for the GetDynamicGlobalProperties function.

type Instance added in v1.0.2

type Instance struct {
	Symbol    string `json:"symbol"`
	To        string `json:"to"`
	ToType    string `json:"toType"`
	FeeSymbol string `json:"feeSymbol"`
}

type NFT added in v1.0.2

type NFT struct {
	Id                        *types.UInt16 `json:"_id"`
	Issuer                    string        `json:"issuer"`
	Symbol                    string        `json:"symbol"`
	Name                      string        `json:"name"`
	Metadata                  string        `json:"metadata"`
	MaxSupply                 *types.Int64  `json:"maxSupply"`
	Supply                    *types.Int64  `json:"supply"`
	AuthorizedIssuingAccounts []string      `json:"authorizedIssuingAccounts"`
}

type NFTBlock added in v1.0.2

type NFTBlock struct {
	Id                    uint32            `json:"_id"`
	BlockNumber           uint32            `json:"blockNumber"`
	RefBeowulfBlockNumber uint32            `json:"refBeowulfBlockNumber"`
	RefBeowulfBlockId     string            `json:"refBeowulfBlockId"`
	PrevRefBeowulfBlockId string            `json:"prevRefBeowulfBlockId"`
	PreviousHash          string            `json:"previousHash"`
	PreviousDatabaseHash  string            `json:"previousDatabaseHash"`
	Timestamp             *types.Time       `json:"timestamp"`
	Transactions          []*NFTTransaction `json:"transactions"`
	VirtualTransactions   []*NFTTransaction `json:"virtualTransactions"`
	Hash                  string            `json:"hash"`
	DatabaseHash          string            `json:"databaseHash"`
	MerkleRoot            string            `json:"merkleRoot"`
	Round                 interface{}       `json:"round"`
	RoundHash             string            `json:"roundHash"`
	Supernode             string            `json:"supernode"`
	SigningKey            string            `json:"signingKey"`
	RoundSignature        string            `json:"roundSignature"`
}

type NFTInstance added in v1.0.2

type NFTInstance struct {
	Id         *types.UInt16 `json:"_id"`
	Account    string        `json:"account"`
	Properties interface{}   `json:"properties"`
}

type NFTInstanceList added in v1.0.2

type NFTInstanceList []NFTInstance

type NFTList added in v1.0.2

type NFTList []NFT

type NFTProperty added in v1.0.2

type NFTProperty struct {
	Properties Property `json:"properties"`
	Id         string   `json:"id"`
}

type NFTTransaction added in v1.0.2

type NFTTransaction struct {
	RefBeowulfBlockNumber *types.UInt32 `json:"refBeowulfBlockNumber"`
	TransactionId         string        `json:"transactionId"`
	Sender                string        `json:"sender"`
	Contract              string        `json:"contract"`
	Action                string        `json:"action"`
	Payload               string        `json:"payload"`
	ExecutedCodeHash      string        `json:"executedCodeHash"`
	Hash                  string        `json:"hash"`
	DatabaseHash          string        `json:"databaseHash"`
	Logs                  string        `json:"logs"`
}

type NFTTransferRequest added in v1.0.2

type NFTTransferRequest struct {
	Symbol string   `json:"symbol"`
	Ids    []string `json:"ids"`
}

type Params added in v1.0.2

type Params struct {
	Contract string      `json:"contract"`
	Table    string      `json:"table"`
	Query    interface{} `json:"query"`
	Limit    uint32      `json:"limit"`
	Offset   uint32      `json:"offset"`
}

type Property added in v1.0.2

type Property struct {
	Name string      `json:"name"`
	Data interface{} `json:"data"`
}

type ScheduledHardfork

type ScheduledHardfork struct {
	HardforkVersion string      `json:"hf_version"`
	LiveTime        *types.Time `json:"live_time"`
}

type SupernodeInfo

type SupernodeInfo struct {
	Id                    *types.UInt16 `json:"id"`
	Owner                 string        `json:"owner"`
	Created               *types.Time   `json:"created"`
	TotalMissed           uint32        `json:"total_missed"`
	LastASlot             uint64        `json:"last_aslot"`
	LastConfirmedBlockNum uint64        `json:"last_confirmed_block_num"`
	SigningKey            string        `json:"signing_key"`
	Votes                 *types.Int64  `json:"votes"`
	//VirtualLastUpdate 		*big.Int			`json:"virtual_last_update"`
	//VirtualPosition			*big.Int			`json:"virtual_position"`
	//VirtualScheduledTime	*big.Int			`json:"virtual_scheduled_time"`
	LastWork            string      `json:"last_work"`
	RunningVersion      string      `json:"running_version"`
	HardforkVersionVote string      `json:"hardfork_version_vote"`
	HardforkTimeVote    *types.Time `json:"hardfork_time_vote"`
}

type SupernodeList

type SupernodeList []SupernodeInfo

type SupernodeSchedule

type SupernodeSchedule struct {
	Id                              *types.UInt16 `json:"id"`
	CurrentVirtualTime              string        `json:"current_virtual_time"`
	NextShuffleBlockNum             uint32        `json:"next_shuffle_block_num"`
	CurrentShuffledSupernodes       []string      `json:"current_shuffled_supernodes"`
	NumScheduledSupernodes          uint8         `json:"num_scheduled_supernodes"`
	ElectedWeight                   uint8         `json:"elected_weight"`
	TimeshareWeight                 uint8         `json:"timeshare_weight"`
	PermanentWeight                 uint8         `json:"permanent_weight"`
	SupernodePayNormalizationFactor uint32        `json:"supernode_pay_normalization_factor"`
	MajorityVersion                 string        `json:"majority_version"`
	MaxVotedSupernodes              uint8         `json:"max_voted_supernodes"`
	MaxPermanentSupernodes          uint8         `json:"max_permanent_supernodes"`
	MaxRunnerSupernodes             uint8         `json:"max_runner_supernodes"`
	HardforkRequiredSupernodes      uint8         `json:"hardfork_required_supernodes"`
}

SupernodeSchedule structure for the GetSupernodeSchedule function

type SupernodeVoteInfo

type SupernodeVoteInfo struct {
	Id        *types.UInt16 `json:"id"`
	Supernode string        `json:"supernode"`
	Account   string        `json:"account"`
	Votes     *types.Int64  `json:"votes"`
}

type SupernodeVoteList

type SupernodeVoteList []SupernodeVoteInfo

type TokenInfo

type TokenInfo struct {
	Id             *types.UInt16      `json:"id"`
	LiquidSymbol   *types.AssetSymbol `json:"liquid_symbol"`
	ControlAccount string             `json:"control_account"`
	Phase          uint8              `json:"phase"`
	CurrentSupply  *types.Int64       `json:"current_supply"`
}

type TokenList

type TokenList []TokenInfo

type TransactionParams added in v1.0.2

type TransactionParams struct {
	Txid string `json:"txid"`
}

type TransactionResponse

type TransactionResponse struct {
	RefBlockNum    *types.UInt16     `json:"ref_block_num"`
	RefBlockPrefix *types.UInt32     `json:"ref_block_prefix"`
	Expiration     *types.Time       `json:"expiration"`
	Operations     *types.Operations `json:"operations"`
	Extensions     []interface{}     `json:"extensions"`
	CreatedTime    *types.UInt64     `json:"created_time"`
	Signatures     []string          `json:"signatures"`
	TransactionId  string            `json:"transaction_id"`
	BlockNum       *types.UInt32     `json:"block_num"`
	TransactionNum *types.UInt32     `json:"transaction_num"`
	Status         string            `json:"status"`
}

type Version

type Version struct {
	BlockchainVersion string `json:"blockchain_version"`
	BeowulfRevision   string `json:"beowulf_revision"`
	FcRevision        string `json:"fc_revision"`
}

Version structure for the GetVersion function.

Jump to

Keyboard shortcuts

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