database

package
v0.0.0-...-bbfc9be Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: MIT Imports: 3 Imported by: 7

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
}

func NewAPI

func NewAPI(id caller.APIID, caller caller.Caller) *API

func (*API) CancelAllSubscriptions

func (api *API) CancelAllSubscriptions() error

CancelAllSubscriptions cancel all subscriptions

func (*API) GetAccountBalances

func (api *API) GetAccountBalances(accountID types.ObjectID, assets ...types.ObjectID) ([]*types.AssetAmount, error)

GetAccountBalances Get an account’s balances in various assets.

func (*API) GetBlock

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

GetBlock return a block by the given block number

func (*API) GetBlockHeader

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

GetBlockHeader returns block header by the given block number

func (*API) GetChainID

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

func (*API) GetConfig

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

GetConfig retrieves compile-time constants

func (*API) GetDynamicGlobalProperties

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

GetDynamicGlobalProperties retrieves the current global_property_object

func (*API) GetLimitOrders

func (api *API) GetLimitOrders(base, quote types.ObjectID, limit uint32) ([]*LimitOrder, error)

GetLimitOrders returns limit orders in a given market. There are both sell and buy orders. For the sell orders LimitOrder.SellPrice.Base = the given base For the buy orders LimitOrder.SellPrice.Base = the given quote

func (*API) GetNamedAccountBalances

func (api *API) GetNamedAccountBalances(account string, assets ...types.ObjectID) ([]*types.AssetAmount, error)

Semantically equivalent to get_account_balances, but takes a name instead of an ID.

func (*API) GetObjects

func (api *API) GetObjects(assets ...types.ObjectID) ([]json.RawMessage, error)

GetBlock return a block by the given block number

func (*API) GetRecentTransactionByID

func (api *API) GetRecentTransactionByID(transactionID uint32) (*types.Transaction, error)

GetRecentTransactionByID If the transaction has not expired, this method will return the transaction for the given ID or it will return NULL if it is not known. Just because it is not known does not mean it wasn’t included in the blockchain.

func (*API) GetRequiredFee

func (api *API) GetRequiredFee(ops []types.Operation, assetID string) ([]types.AssetAmount, error)

GetRequiredFee fetchs fee for operations

func (*API) GetTicker

func (api *API) GetTicker(base, quote types.ObjectID) (*MarketTicker, error)

GetTicker returns the ticker for the market assetA:assetB (past 24 hours)

func (*API) GetTransaction

func (api *API) GetTransaction(blockNum uint32, trxInBlock uint32) (*types.Transaction, error)

GetTransaction used to fetch an individual transaction

func (*API) LookupAccounts

func (api *API) LookupAccounts(lowerBoundName string, limit uint16) (AccountsMap, error)

LookupAccounts gets names and IDs for registered accounts lower_bound_name: Lower bound of the first name to return limit: Maximum number of results to return must not exceed 1000

func (*API) LookupAssetSymbols

func (api *API) LookupAssetSymbols(symbols ...string) ([]*Asset, error)

LookupAssetSymbols get assets corresponding to the provided symbols or IDs

func (*API) SetBlockAppliedCallback

func (api *API) SetBlockAppliedCallback(notice func(blockID string, err error)) (err error)

SetBlockAppliedCallback registers a global subscription callback

type AccountsMap

type AccountsMap map[string]types.ObjectID

func (*AccountsMap) UnmarshalJSON

func (o *AccountsMap) UnmarshalJSON(b []byte) error

type Asset

type Asset struct {
	ID                 types.ObjectID `json:"id"`
	Symbol             string         `json:"symbol"`
	Precision          uint8          `json:"precision"`
	Issuer             string         `json:"issuer"`
	DynamicAssetDataID string         `json:"dynamic_asset_data_id"`
}

type Block

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

type BlockHeader

type BlockHeader struct {
	TransactionMerkleRoot string            `json:"transaction_merkle_root"`
	Previous              string            `json:"previous"`
	Timestamp             types.Time        `json:"timestamp"`
	Witness               string            `json:"witness"`
	Extensions            []json.RawMessage `json:"extensions"`
}

type Config

type Config struct {
	GrapheneSymbol               string `json:"GRAPHENE_SYMBOL"`
	GrapheneAddressPrefix        string `json:"GRAPHENE_ADDRESS_PREFIX"`
	GrapheneMinAccountNameLength uint8  `json:"GRAPHENE_MIN_ACCOUNT_NAME_LENGTH"`
	GrapheneMaxAccountNameLength uint8  `json:"GRAPHENE_MAX_ACCOUNT_NAME_LENGTH"`
	GrapheneMinAssetSymbolLength uint8  `json:"GRAPHENE_MIN_ASSET_SYMBOL_LENGTH"`
	GrapheneMaxAssetSymbolLength uint8  `json:"GRAPHENE_MAX_ASSET_SYMBOL_LENGTH"`
	GrapheneMaxShareSupply       string `json:"GRAPHENE_MAX_SHARE_SUPPLY"`
}

type DynamicGlobalProperties

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

type LimitOrder

type LimitOrder struct {
	ID          types.ObjectID `json:"id"`
	Expiration  types.Time     `json:"expiration"`
	Seller      types.ObjectID `json:"seller"`
	ForSale     types.Suint64  `json:"for_sale"`
	DeferredFee uint64         `json:"deferred_fee"`
	SellPrice   types.Price    `json:"sell_price"`
}

type MarketTicker

type MarketTicker struct {
	Time          types.Time     `json:"time"`
	Base          types.ObjectID `json:"base"`
	Quote         types.ObjectID `json:"quote"`
	Latest        string         `json:"latest"`
	LowestAsk     string         `json:"lowest_ask"`
	HighestBid    string         `json:"highest_bid"`
	PercentChange string         `json:"percent_change"`
	BaseVolume    string         `json:"base_volume"`
	QuoteVolume   string         `json:"quote_volume"`
}

Jump to

Keyboard shortcuts

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