Documentation
¶
Index ¶
Constants ¶
View Source
const ( InvalidApiID = -1 AssetsListAll = -1 AssetsMaxBatchSize = 100 GetCallOrdersLimit = 100 GetLimitOrdersLimit = 100 GetForceSettlementOrdersLimit = 100 GetTradeHistoryLimit = 100 GetAccountHistoryLimit = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BestNodeClientProvider ¶
type BestNodeClientProvider struct {
api.WebsocketClient
// contains filtered or unexported fields
}
func (*BestNodeClientProvider) CallAPI ¶
func (p *BestNodeClientProvider) CallAPI(apiID int, method string, args ...interface{}) (*json.RawMessage, error)
func (*BestNodeClientProvider) Close ¶
func (p *BestNodeClientProvider) Close() error
type ClientProvider ¶
type ClientProvider interface {
OnError(fn api.ErrorFunc)
Connect() error
Subscribe(apiID int, method string, fn api.SubscribeCallback, args ...interface{}) (*json.RawMessage, error)
CallAPI(apiID int, method string, args ...interface{}) (*json.RawMessage, error)
Close() error
}
func NewBestNodeClientProvider ¶
func NewBestNodeClientProvider(endpointURL string, ws WebsocketAPI) (ClientProvider, error)
func NewSimpleClientProvider ¶
func NewSimpleClientProvider(endpointURL string, ws WebsocketAPI) ClientProvider
type MemoBuilder ¶
type MemoBuilder struct {
// contains filtered or unexported fields
}
MemoBuilder is a memo factory
type SimpleClientProvider ¶
type SimpleClientProvider struct {
api.WebsocketClient
// contains filtered or unexported fields
}
func (*SimpleClientProvider) CallAPI ¶
func (p *SimpleClientProvider) CallAPI(apiID int, method string, args ...interface{}) (*json.RawMessage, error)
type WalletAPI ¶
type WalletAPI interface {
Close() error
Connect() error
GetBlock(number uint64) (*types.Block, error)
GetRelativeAccountHistory(account types.GrapheneObject, stop int64, limit int, start int64) (types.OperationRelativeHistories, error)
GetDynamicGlobalProperties() (*types.DynamicGlobalProperties, error)
BorrowAsset(account types.GrapheneObject, amountToBorrow string, symbolToBorrow types.GrapheneObject, amountOfCollateral string, broadcast bool) (*types.SignedTransaction, error)
Buy(account types.GrapheneObject, base, quote types.GrapheneObject, rate string, amount string, broadcast bool) (*types.SignedTransaction, error)
BuyEx(account types.GrapheneObject, base, quote types.GrapheneObject, rate float64, amount float64, broadcast bool) (*types.SignedTransaction, error)
CancelOrder(orderID types.GrapheneObject, broadcast bool) (*types.SignedTransaction, error)
Info() (*types.Info, error)
IsLocked() (bool, error)
ListAccountBalances(account types.GrapheneObject) (types.AssetAmounts, error)
Lock() error
ReadMemo(memo *types.Memo) (string, error)
Sell(account types.GrapheneObject, base, quote types.GrapheneObject, rate string, amount string, broadcast bool) (*types.SignedTransaction, error)
SellEx(account types.GrapheneObject, base, quote types.GrapheneObject, rate float64, amount float64, broadcast bool) (*types.SignedTransaction, error)
SellAsset(account types.GrapheneObject, amountToSell string, symbolToSell types.GrapheneObject, minToReceive string, symbolToReceive types.GrapheneObject, timeout uint32, fillOrKill bool, broadcast bool) (*types.SignedTransaction, error)
SignTransaction(tx *types.SignedTransaction, broadcast bool) (*types.SignedTransaction, error)
SerializeTransaction(tx *types.SignedTransaction) (string, error)
//Transfer2(from, to types.GrapheneObject, amount string, asset types.GrapheneObject, memo string) (*types.SignedTransactionWithTransactionId, error)
Unlock(password string) error
}
func NewWalletAPI ¶
NewWalletAPI creates a new WalletAPI interface. rpcEndpointURL: Is an RPC endpoint URL to your local `cli_wallet`.
type WebsocketAPI ¶
type WebsocketAPI interface {
//Common functions
CallWsAPI(apiID int, method string, args ...interface{}) (*json.RawMessage, error)
Close() error
Connect() error
DatabaseAPIID() int
HistoryAPIID() int
BroadcastAPIID() int
SetCredentials(username, password string)
OnError(api.ErrorFunc)
Subscribe(apiID int, method string, fn api.SubscribeCallback, args ...interface{}) (*json.RawMessage, error)
BuildSignedTransaction(keyBag *crypto.KeyBag, feeAsset types.GrapheneObject, ops ...types.Operation) (*types.SignedTransaction, error)
SignTransaction(keyBag *crypto.KeyBag, trx *types.SignedTransaction) error
//Websocket API functions
BroadcastTransaction(tx *types.SignedTransaction) error
BroadcastTransactionSynchronous(tx *types.SignedTransaction) (*types.BroadcastResponse, error)
CancelAllSubscriptions() error
GetAccountBalances(account types.GrapheneObject, assets ...types.GrapheneObject) (types.AssetAmounts, error)
GetAccountByName(name string) (*types.Account, error)
GetAccountHistory(account types.GrapheneObject, stop types.GrapheneObject, limit int, start types.GrapheneObject) (types.OperationHistories, error)
GetAccounts(accountIDs ...types.GrapheneObject) (types.Accounts, error)
GetBlock(number uint64) (*types.Block, error)
GetBlockHeader(block uint64) (*types.BlockHeader, error)
GetCallOrders(assetID types.GrapheneObject, limit int) (types.CallOrders, error)
GetChainID() (string, error)
GetDynamicGlobalProperties() (*types.DynamicGlobalProperties, error)
GetForceSettlementOrders(assetID types.GrapheneObject, limit int) (types.ForceSettlementOrders, error)
GetFullAccounts(accountIDs ...types.GrapheneObject) (types.FullAccountInfos, error)
GetLimitOrders(base, quote types.GrapheneObject, limit int) (types.LimitOrders, error)
GetOrderBook(base, quote types.GrapheneObject, depth int) (*types.OrderBook, error)
GetMarginPositions(accountID types.GrapheneObject) (types.CallOrders, error)
GetObjects(objectIDs ...types.GrapheneObject) ([]interface{}, error)
GetPotentialSignatures(tx *types.SignedTransaction) (types.PublicKeys, error)
GetRecentTransactionByID(transactionID uint32) (*types.SignedTransaction, error)
GetRequiredSignatures(tx *types.SignedTransaction, keys types.PublicKeys) (types.PublicKeys, error)
GetRequiredFees(ops types.Operations, feeAsset types.GrapheneObject) (types.AssetAmounts, error)
GetTicker(base, quote types.GrapheneObject) (*types.MarketTicker, error)
GetTradeHistory(base, quote types.GrapheneObject, toTime, fromTime time.Time, limit int) (types.MarketTrades, error)
GetTransaction(blockNum uint64, trxInBlock uint32) (*types.SignedTransaction, error)
LimitOrderCancel(keyBag *crypto.KeyBag, feePayingAccount, orderID, feeAsset types.GrapheneObject) error
ListAssets(lowerBoundSymbol string, limit int) (types.Assets, error)
LookupAssetSymbols(symbols ...string) (types.Assets, error)
SetSubscribeCallback(ID uint64, clearFilter bool) error
SubscribeToBlockApplied(onBlockApplied api.BlockAppliedCallback) error
SubscribeToMarket(base, quote types.GrapheneObject, onMarketData api.SubscribeCallback) error
SubscribeToPendingTransactions(onPendingTransaction api.SubscribeCallback) error
Transfer(keyBag *crypto.KeyBag, from, to, feeAsset types.GrapheneObject, amount types.AssetAmount, memo string) error
UnsubscribeFromMarket(base, quote types.GrapheneObject) error
Get24Volume(base types.GrapheneObject, quote types.GrapheneObject) (*types.Volume24, error)
}
func NewWebsocketAPI ¶
func NewWebsocketAPI(wsEndpointURL string) WebsocketAPI
NewWebsocketAPI creates a new WebsocketAPI interface. wsEndpointURL: a websocket node endpoint URL.
func NewWebsocketAPIWithAutoEndpoint ¶
func NewWebsocketAPIWithAutoEndpoint(startupEndpointURL string) (WebsocketAPI, error)
NewWebsocketAPIWithAutoEndpoint creates a new WebsocketAPI interface with automatic node latency checking. It's best to use this API instance type for a long API lifecycle because the latency tester takes time to unleash its magic. startupEndpointURL: a websocket node endpoint URL to startup the latency tester quickly.
Click to show internal directories.
Click to hide internal directories.