Documentation

Overview

    Package http_client is the interface for uses API v2 methods.

    Example
    Output:
    
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func ErrorBody

    func ErrorBody(err error) (int, *models.ErrorBody, error)

      ErrorBody returns error as API model

      func Marshal

      func Marshal(m interface{ MarshalBinary() ([]byte, error) }) (json string, err error)

        Marshal returns model in JSON format

        Types

        type Client

        type Client struct {
        	api_service.ClientService
        	// contains filtered or unexported fields
        }

          Client http concise HTTP client, with wrapper over go-swagger SwagClient methods

          func New

          func New(address string) (*Client, error)

            New returns concise HTTP client, with wrapper over go-swagger methods

            func NewConcise

            func NewConcise(address string) (*Client, error)

              NewConcise returns concise HTTP client, with wrapper over go-swagger methods Deprecated: Use New

              func (*Client) Address

              func (c *Client) Address(address string, optionalHeight ...uint64) (*models.AddressResponse, error)

                Address returns coins list, balance and transaction count of an address.

                func (*Client) AddressExtended

                func (c *Client) AddressExtended(address string, delegated bool, optionalHeight ...uint64) (*models.AddressResponse, error)

                  AddressExtended returns coins list with bipValue, balance, delegated and transaction count of an address.

                  func (*Client) Addresses

                  func (c *Client) Addresses(addresses []string, optionalHeight ...uint64) (*models.AddressesResponse, error)

                    Addresses returns list of addresses.

                    func (*Client) AddressesExtended

                    func (c *Client) AddressesExtended(addresses []string, delegated bool, optionalHeight ...uint64) (*models.AddressesResponse, error)

                      AddressesExtended returns list of addresses with bipValue and delegated.

                      func (*Client) Block

                      func (c *Client) Block(height uint64) (*models.BlockResponse, error)

                        Block returns block data at given height.

                        func (*Client) BlockExtended

                        func (c *Client) BlockExtended(height uint64, failedTxs bool, fieldsBlock ...string) (*models.BlockResponse, error)

                          Block returns block data at given height.

                          func (*Client) Blocks

                          func (c *Client) Blocks(from, to uint64, failedTxs bool, fieldsBlock ...string) (*models.BlocksResponse, error)

                            Blocks ...

                            func (*Client) Candidate

                            func (c *Client) Candidate(publicKey string, optionalHeight ...uint64) (*models.CandidateResponse, error)

                              Candidate returns candidate’s res by provided public_key.

                              func (*Client) CandidateExtended

                              func (c *Client) CandidateExtended(publicKey string, notShowStakes bool, optionalHeight ...uint64) (*models.CandidateResponse, error)

                                CandidateExtended returns candidate’s res by provided public_key.

                                func (*Client) Candidates

                                func (c *Client) Candidates(includeStakes bool, status string, optionalHeight ...uint64) (*models.CandidatesResponse, error)

                                  Candidates returns list of candidates.

                                  func (*Client) CandidatesExtended

                                  func (c *Client) CandidatesExtended(includeStakes, notShowStakes bool, status string, optionalHeight ...uint64) (*models.CandidatesResponse, error)

                                    CandidatesExtended returns list of candidates.

                                    func (*Client) CheckVersion

                                    func (c *Client) CheckVersion(version string, isTestnet bool) error

                                      CheckVersion compares the prefix in the version name and checks the testnet mode

                                      func (*Client) CoinID

                                      func (c *Client) CoinID(symbol string, optionalHeight ...uint64) (uint64, error)

                                        CoinID returns ID of coin symbol.

                                        func (*Client) CoinInfo

                                        func (c *Client) CoinInfo(symbol string, optionalHeight ...uint64) (*models.CoinInfoResponse, error)

                                          CoinInfo returns information about coin symbol.

                                          func (*Client) CoinInfoByID

                                          func (c *Client) CoinInfoByID(id uint64, optionalHeight ...uint64) (*models.CoinInfoResponse, error)

                                            CoinInfoByID returns information about coin ID.

                                            func (*Client) CommissionVotes

                                            func (c *Client) CommissionVotes(target uint64, optionalHeight ...uint64) (*models.CommissionVotesResponse, error)

                                              CommissionVotes returns ...

                                              func (*Client) EstimateCoinIDBuy

                                              func (c *Client) EstimateCoinIDBuy(coinToSell, coinToBuy uint64, valueToBuy string, coinCommission uint64, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error)

                                                EstimateCoinIDBuy return estimate of buy coin transaction.

                                                func (*Client) EstimateCoinIDBuyExtended

                                                func (c *Client) EstimateCoinIDBuyExtended(coinToSell, coinToBuy uint64, valueToBuy string, coinCommission uint64, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error)

                                                  EstimateCoinIDBuyExtended return estimate of buy coin transaction with choice of the exchange source.

                                                  func (*Client) EstimateCoinIDSell

                                                  func (c *Client) EstimateCoinIDSell(coinToBuy, coinToSell uint64, valueToSell string, coinCommission uint64, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error)

                                                    EstimateCoinIDSell return estimate of sell coin transaction.

                                                    func (*Client) EstimateCoinIDSellAll

                                                    func (c *Client) EstimateCoinIDSellAll(coinToBuy, coinToSell, gasPrice uint64, valueToSell string, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error)

                                                      EstimateCoinIDSellAll return estimate of sell all coin transaction.

                                                      func (*Client) EstimateCoinIDSellAllExtended

                                                      func (c *Client) EstimateCoinIDSellAllExtended(coinToBuy, coinToSell, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error)

                                                        EstimateCoinIDSellAllExtended return estimate of sell all coin transaction with choice of the exchange source.

                                                        func (*Client) EstimateCoinIDSellExtended

                                                        func (c *Client) EstimateCoinIDSellExtended(coinToBuy, coinToSell uint64, valueToSell string, coinCommission uint64, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error)

                                                          EstimateCoinIDSellExtended return estimate of sell coin transaction with choice of the exchange source.

                                                          func (*Client) EstimateCoinSymbolBuy

                                                          func (c *Client) EstimateCoinSymbolBuy(coinToSell, coinToBuy, valueToBuy string, coinCommission string, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error)

                                                            EstimateCoinSymbolBuy return estimate of buy coin transaction.

                                                            func (*Client) EstimateCoinSymbolBuyExtended

                                                            func (c *Client) EstimateCoinSymbolBuyExtended(coinToSell, coinToBuy, valueToBuy string, coinCommission string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinBuyResponse, error)

                                                              EstimateCoinSymbolBuyExtended return estimate of buy coin transaction with choice of the exchange source.

                                                              func (*Client) EstimateCoinSymbolSell

                                                              func (c *Client) EstimateCoinSymbolSell(coinToBuy, coinToSell, valueToSell string, coinCommission string, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error)

                                                                EstimateCoinSymbolSell return estimate of sell coin transaction.

                                                                func (*Client) EstimateCoinSymbolSellAll

                                                                func (c *Client) EstimateCoinSymbolSellAll(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error)

                                                                  EstimateCoinSymbolSellAll return estimate of sell all coin transaction.

                                                                  func (*Client) EstimateCoinSymbolSellAllExtended

                                                                  func (c *Client) EstimateCoinSymbolSellAllExtended(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellAllResponse, error)

                                                                    EstimateCoinSymbolSellAllExtended return estimate of sell all coin transaction with choice of the exchange source.

                                                                    func (*Client) EstimateCoinSymbolSellExtended

                                                                    func (c *Client) EstimateCoinSymbolSellExtended(coinToBuy, coinToSell, valueToSell string, coinCommission string, swapFrom string, route []uint64, optionalHeight ...uint64) (*models.EstimateCoinSellResponse, error)

                                                                      EstimateCoinSymbolSellExtended return estimate of sell coin transaction with choice of the exchange source.

                                                                      func (*Client) EstimateTxCommission

                                                                      func (c *Client) EstimateTxCommission(tx string, optionalHeight ...uint64) (*models.EstimateTxCommissionResponse, error)

                                                                        EstimateTxCommission return estimate of encoding transaction.

                                                                        func (*Client) Events

                                                                        func (c *Client) Events(height uint64, search ...string) (*models.EventsResponse, error)

                                                                          Events returns events at given height.

                                                                          func (*Client) Frozen

                                                                          func (c *Client) Frozen(address string, coinID *uint64, optionalHeight ...uint64) (*models.FrozenResponse, error)

                                                                            Frozen returns frozen balance.

                                                                            func (*Client) Genesis

                                                                            func (c *Client) Genesis() (*models.GenesisResponse, error)

                                                                              Genesis returns genesis file.

                                                                              func (*Client) Halts

                                                                              func (c *Client) Halts(height uint64) (*models.HaltsResponse, error)

                                                                                Halts returns the candidate votes for stopping the network at block.

                                                                                func (*Client) MaxGasPrice

                                                                                func (c *Client) MaxGasPrice(optionalHeight ...uint64) (*models.MaxGasPriceResponse, error)

                                                                                  MaxGasPrice returns current max gas.

                                                                                  func (*Client) MinGasPrice

                                                                                  func (c *Client) MinGasPrice() (*models.MinGasPriceResponse, error)

                                                                                    MinGasPrice returns current min gas price.

                                                                                    func (*Client) MissedBlocks

                                                                                    func (c *Client) MissedBlocks(publicKey string, optionalHeight ...uint64) (*models.MissedBlocksResponse, error)

                                                                                      MissedBlocks returns missed blocks by validator public key.

                                                                                      func (*Client) NetInfo

                                                                                      func (c *Client) NetInfo() (*models.NetInfoResponse, error)

                                                                                        NetInfo returns network res

                                                                                        func (*Client) Nonce

                                                                                        func (c *Client) Nonce(address string, optionalHeight ...uint64) (uint64, error)

                                                                                          Nonce returns next transaction number (nonce) of an address.

                                                                                          func (*Client) PriceCommission

                                                                                          func (c *Client) PriceCommission(optionalHeight ...uint64) (*models.PriceCommissionResponse, error)

                                                                                            PriceCommission returns ...

                                                                                            func (*Client) SendTransaction

                                                                                            func (c *Client) SendTransaction(tx string) (*models.SendTransactionResponse, error)

                                                                                              SendTransaction returns the result of sending signed tx. To ensure that transaction was successfully committed to the blockchain, you need to find the transaction by the hash and ensure that the status code equals to 0.

                                                                                              func (*Client) Status

                                                                                              func (c *Client) Status() (*models.StatusResponse, error)

                                                                                                Status returns node status including pubkey, latest block.

                                                                                                func (*Client) Subscribe

                                                                                                func (c *Client) Subscribe(query string) (*SubscriberClient, error)

                                                                                                  Subscribe returns a subscription for events by query.

                                                                                                  func (*Client) SwapPool

                                                                                                  func (c *Client) SwapPool(coin0, coin1 uint64, optionalHeight ...uint64) (*models.SwapPoolResponse, error)

                                                                                                    SwapPool returns total supply and reserves.

                                                                                                    func (*Client) SwapPoolProvider

                                                                                                    func (c *Client) SwapPoolProvider(coin0, coin1 uint64, provider string, optionalHeight ...uint64) (*models.SwapPoolResponse, error)

                                                                                                      SwapPoolProvider returns reserves and liquidity balance of provider.

                                                                                                      func (*Client) Transaction

                                                                                                      func (c *Client) Transaction(hash string) (*models.TransactionResponse, error)

                                                                                                        Transaction returns transaction res.

                                                                                                        func (*Client) Transactions

                                                                                                        func (c *Client) Transactions(query string, page, perPage int32) (*models.TransactionsResponse, error)

                                                                                                          Transactions returns transactions by query.

                                                                                                          func (*Client) UnconfirmedTxs

                                                                                                          func (c *Client) UnconfirmedTxs(limit int32) (*models.UnconfirmedTxsResponse, error)

                                                                                                            UnconfirmedTxs returns unconfirmed transactions.

                                                                                                            func (*Client) UpdateVotes

                                                                                                            func (c *Client) UpdateVotes(target uint64, optionalHeight ...uint64) (*models.UpdateVotesResponse, error)

                                                                                                              CommissionVotes returns ...

                                                                                                              func (*Client) Validators

                                                                                                              func (c *Client) Validators(optionalHeight ...uint64) (*models.ValidatorsResponse, error)

                                                                                                                Validators returns list of active validators.

                                                                                                                func (*Client) VersionNetwork

                                                                                                                func (c *Client) VersionNetwork() (*models.VersionNetworkResponse, error)

                                                                                                                  VersionNetwork returns ...

                                                                                                                  func (*Client) WaitList

                                                                                                                  func (c *Client) WaitList(publicKey, address string, optionalHeight ...uint64) (*models.WaitListResponse, error)

                                                                                                                    WaitList returns the list of address stakes in waitlist.

                                                                                                                    func (*Client) WithContextFunc

                                                                                                                    func (c *Client) WithContextFunc(contextFunc func(context.Context) func() context.Context) *Client

                                                                                                                      WithContextFunc returns new Client client with new context Example:

                                                                                                                      timeout := func(c context.Context) func() context.Context {
                                                                                                                      	return func() context.Context {
                                                                                                                      		ctx, _ := context.WithTimeout(c, 10*time.Second)
                                                                                                                      		return ctx
                                                                                                                      	}
                                                                                                                      }
                                                                                                                      

                                                                                                                      func (*Client) WithDebug

                                                                                                                      func (c *Client) WithDebug(debug bool) *Client

                                                                                                                        WithDebug returns copy of Client with debug.

                                                                                                                        func (*Client) WithHeaders

                                                                                                                        func (c *Client) WithHeaders(headers map[string][]string) *Client

                                                                                                                          WithHeaders returns copy of Client with custom headers.

                                                                                                                          func (*Client) WithLogger

                                                                                                                          func (c *Client) WithLogger(logger logger.Logger) *Client

                                                                                                                            WithLogger returns copy of Client with custom logger.

                                                                                                                            func (*Client) WithTimeout

                                                                                                                            func (c *Client) WithTimeout(timeout time.Duration) *Client

                                                                                                                              WithTimeout returns copy of Client with timeout.

                                                                                                                              type SubscriberClient

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

                                                                                                                                SubscriberClient is subscriber

                                                                                                                                func (*SubscriberClient) CloseSend

                                                                                                                                func (s *SubscriberClient) CloseSend() error

                                                                                                                                  CloseSend closes the send direction of the stream.

                                                                                                                                  func (*SubscriberClient) Recv

                                                                                                                                    Recv returns message SubscribeOKBody.

                                                                                                                                    Directories

                                                                                                                                    Path Synopsis