api

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIsRPCError = errors.New("rpc error")

Error indicating for universal decoding

View Source
var ErrMissingLogic = errors.New("universal JSON decode missing logic")

Functions

This section is empty.

Types

type API

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

API struct accumulates all queries to blockchain node and makes broadcast of prepared transaction

func NewAPI

func NewAPI(opts ConnectionOptions) (*API, error)

func (*API) AccountNumberAndSequence

func (api *API) AccountNumberAndSequence(address string) (uint64, uint64, error)

AccountNumberAndSequence requests account number and current sequence (nonce) of specified address.

func (*API) Address

func (api *API) Address(address string) (*AddressResult, error)

Address requests full information about specified address

func (*API) AddressBalance

func (api *API) AddressBalance(address string) (sdk.Coins, error)

func (*API) BaseCoin

func (api *API) BaseCoin() string

BaseCoin() returns base coin symbol from genesis. Need for correct transaction building

func (*API) BroadcastTxCommit

func (api *API) BroadcastTxCommit(data []byte) (*TxSyncResponse, error)

Send transaction data in commit mode. NOTE: marked by tendermint as deprecated

func (*API) BroadcastTxSync

func (api *API) BroadcastTxSync(data []byte) (*TxSyncResponse, error)

Send transaction data in sync mode. NOTE: marked by tendermint as deprecated

func (*API) ChainID

func (api *API) ChainID() string

ChainID() returns blockchain network chain id

func (*API) Close

func (api *API) Close() error

func (*API) Coins

func (api *API) Coins() ([]Coin, error)

func (*API) GetParameters

func (api *API) GetParameters() error

GetParameters() get blockchain parameters

func (*API) MaxGas

func (api *API) MaxGas() uint64

MaxGas() returns max gas from genesis. Need for correct transaction building

func (*API) MultisigTransactionsByID

func (api *API) MultisigTransactionsByID(txID string) (MultisigTransaction, error)

func (*API) MultisigTransactionsByWallet

func (api *API) MultisigTransactionsByWallet(address string) ([]MultisigTransaction, error)

func (*API) MultisigWalletByAddress

func (api *API) MultisigWalletByAddress(address string) (MultisigWallet, error)

func (*API) MultisigWalletsByOwner

func (api *API) MultisigWalletsByOwner(owner string) ([]MultisigWallet, error)

func (*API) NFT

func (api *API) NFT(denom string, id string) (NFT, error)

func (*API) NFTCollection

func (api *API) NFTCollection(denom string) (NFTCollection, error)

Returns NFT IDs from collection

func (*API) NFTCollections

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

Returns all NFT collections (denoms)

func (*API) NFTSubTokens

func (api *API) NFTSubTokens(denom string, tokenID string, ids []uint64) ([]SubToken, error)

func (*API) Transaction

func (api *API) Transaction(hash string) (*TxResult, error)

func (*API) TransactionsByBlock

func (api *API) TransactionsByBlock(height uint64) ([]string, error)

type AddressResult

type AddressResult struct {
	ID      uint64
	Address string
	Nonce   uint64
}

AddressResult contains API response fields.

type Coin

type Coin = coinTypes.Coin

type ConnectionOptions

type ConnectionOptions struct {
	EndpointHost   string // hostname or IP without any protocol description like "http://"
	TendermintPort int    // tendermint RPC port, default 26657
	GRPCPort       int    // gRPC port, default 9090
	Timeout        uint   // timeout in seconds
	Debug          bool   //turn on debugging via stdlib log
	UseGRPC        bool
}

type Error

type Error struct {
	StatusCode int    `json:"statusCode"`
	Message    string `json:"message"`
	Err        string `json:"error"`
}

Error contains Decimal API error response fields.

func (Error) Error

func (e Error) Error() string

Error returns error info as string.

type Logger

type Logger interface {
	Errorf(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Debugf(format string, v ...interface{})
}

type MultisigTransaction

type MultisigTransaction = multisigTypes.Transaction

type MultisigWallet

type MultisigWallet = multisigTypes.Wallet

type NFT

type NFT struct {
	nftTypes.BaseNFT
	Denom string
}

type NFTCollection

type NFTCollection = nftTypes.Collection

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data"`
}

direct error

func (RPCError) Error

func (e RPCError) Error() string

type ResponseError

type ResponseError struct {
	*resty.Response
}

ResponseError wraps Resty response error and allows to generate error info.

func NewResponseError

func NewResponseError(response *resty.Response) *ResponseError

NewResponseError creates new ResponseError object.

func (ResponseError) Error

func (res ResponseError) Error() string

Error returns error info as JSON string.

type SubToken

type SubToken = nftTypes.SubToken

type TxAttribute

type TxAttribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

TxAttribute contains API response fields.

type TxEvent

type TxEvent struct {
	Type       string        `json:"type"`
	Attributes []TxAttribute `json:"attributes"`
}

TxEvent contains API response fields.

type TxLog

type TxLog struct {
	Events []TxEvent `json:"events"`
}

TxLog contains API response fields.

type TxResult

type TxResult struct {
	Height    uint64
	Code      int
	GasWanted uint64
	GasUsed   uint64
	Codespace string
	RawLog    string
	Log       []TxLog
}

type TxSyncResponse

type TxSyncResponse struct {
	// transaction hash
	Hash string
	// error info. Code = 0 mean no error
	Code      int
	Log       string
	Codespace string
}

Response of broadcast_tx_sync

Jump to

Keyboard shortcuts

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