client

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package client holds data for access to our RPC interface

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyQuery    = errors.New("empty query path")
	ErrEmptyResponse = errors.New("empty response")
)
View Source
var ErrEmptyTransaction = errors.New("empty transaction")

Functions

This section is empty.

Types

type AddAccountReply added in v0.10.8

type AddAccountReply struct {
	Account accounts.Account `json:"account"`
}

type AddAccountRequest added in v0.10.8

type AddAccountRequest = accounts.Account

type ApplyValidatorReply added in v0.10.8

type ApplyValidatorReply struct {
	RawTx []byte `json:"rawTx"`
}

type ApplyValidatorRequest added in v0.10.8

type ApplyValidatorRequest struct {
	Address      keys.Address   `json:"address"`
	Name         string         `json:"name"`
	Amount       balance.Amount `json:"amount"`
	Purge        bool           `json:"purge"`
	TmPubKeyType string         `json:"tmPubKeyType"`
	TmPubKey     []byte         `json:"tmPubKey"`
}

type BTCGetTrackerReply added in v0.13.0

type BTCGetTrackerReply struct {
	TrackerData string `json:"tracker"`
}

type BTCGetTrackerRequest added in v0.13.0

type BTCGetTrackerRequest struct {
	Name string `json:"name"`
}

type BTCLockPrepareRequest added in v0.13.0

type BTCLockPrepareRequest struct {
	Inputs           []InputTransaction `json:"inputs"`
	AmountSatoshi    int64              `json:"amount"`
	FeeRate          int64              `json:"fee_rate"`
	ReturnAddressStr string             `json:"return_address"`
}

type BTCLockPrepareResponse added in v0.13.0

type BTCLockPrepareResponse struct {
	Txn         string `json:"txn"`
	TrackerName string `json:"trackerName"`
}

type BTCLockRequest added in v0.13.0

type BTCLockRequest struct {
	Txn         []byte        `json:"txn"`
	Address     keys.Address  `json:"address"`
	TrackerName string        `json:"trackerName"`
	GasPrice    action.Amount `json:"gasPrice"`
	Gas         int64         `json:"gas"`
}

type BTCRedeemPrepareResponse added in v0.13.0

type BTCRedeemPrepareResponse struct {
	RawTx       []byte `json:"rawTx"`
	TrackerName string `json:"trackerName"`
}

type BTCRedeemRequest added in v0.13.0

type BTCRedeemRequest struct {
	Address    keys.Address  `json:"address"`
	BTCAddress string        `json:"addressBTC"`
	Amount     int64         `json:"amount"`
	FeesBTC    int64         `json:"feesBTC"`
	GasPrice   action.Amount `json:"gasPrice"`
	Gas        int64         `json:"gas"`
}

type BalanceReply added in v0.10.8

type BalanceReply struct {
	// The balance of the account. Returns an empty balance
	// if the account is not found
	Balance string `json:"balance"`
	// The height when this balance was recorded
	Height int64 `json:"height"`
}

type BalanceRequest added in v0.10.8

type BalanceRequest struct {
	Address keys.Address `json:"address"`
}

Blockchain service

type BroadcastMode added in v0.10.8

type BroadcastMode string
const (
	BROADCASTASYNC  BroadcastMode = "async"
	BROADCASTSYNC   BroadcastMode = "sync"
	BROADCASTCOMMIT BroadcastMode = "commit"
)

type BroadcastReply added in v0.10.8

type BroadcastReply struct {
	TxHash bytes.HexBytes `json:"txHash"`
	// OK indicates whether this broadcast was a request.
	// For TxSync, it indicates success of CheckTx. Does not guarantee inclusion of a block
	// For TxAsync, it always returns true
	// For TxCommit, it indicates the success of both CheckTx and DeliverTx. If the broadcast fails is false.
	OK     bool   `json:"ok"`
	Height *int64 `json:"height,omitempty"`
	Log    string `json:"log"`
}

func (*BroadcastReply) FromResultBroadcastTx added in v0.10.8

func (reply *BroadcastReply) FromResultBroadcastTx(result *ctypes.ResultBroadcastTx)

func (*BroadcastReply) FromResultBroadcastTxCommit added in v0.10.8

func (reply *BroadcastReply) FromResultBroadcastTxCommit(result *ctypes.ResultBroadcastTxCommit)

type BroadcastRequest added in v0.10.8

type BroadcastRequest struct {
	RawTx     []byte         `json:"rawTx"`
	Signature []byte         `json:"signature"`
	PublicKey keys.PublicKey `json:"publicKey"`
}

type CreateTxReply added in v0.14.0

type CreateTxReply struct {
	RawTx []byte `json:"rawTx"`
}

type CurrencyBalanceReply added in v0.13.0

type CurrencyBalanceReply struct {
	Currency string `json:"currency"`
	Balance  string `json:"balance"`
	// The height when this balance was recorded
	Height int64 `json:"height"`
}

type CurrencyBalanceRequest added in v0.13.0

type CurrencyBalanceRequest struct {
	Currency string       `json:"currency"`
	Address  keys.Address `json:"address"`
}

type DeleteAccountReply added in v0.10.8

type DeleteAccountReply struct {
	Deleted bool `json:"deleted"`
}

type DeleteAccountRequest added in v0.10.8

type DeleteAccountRequest struct {
	Address keys.Address `json:"address"`
}

type ETHLockRequest added in v0.13.0

type ETHLockRequest struct {
	Txn     []byte
	Address keys.Address
	Fee     action.Amount `json:"fee"`
	Gas     int64         `json:"gas"`
}

type EmptyRequest added in v0.14.0

type EmptyRequest struct {
}

type ExtServiceContext added in v0.10.8

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

ExtServiceContext holds clients for making requests to external services

func NewExtServiceContext added in v0.10.8

func NewExtServiceContext(rpcAddress, sdkAddress string) (cliCtx ExtServiceContext, err error)

Generators

func (ExtServiceContext) Block added in v0.10.8

func (ctx ExtServiceContext) Block(height int64) (res *ctypes.ResultBlock)

func (ExtServiceContext) BroadcastTxAsync added in v0.10.8

func (ctx ExtServiceContext) BroadcastTxAsync(packet []byte) (res *ctypes.ResultBroadcastTx, err error)

func (ExtServiceContext) BroadcastTxCommit added in v0.10.8

func (ctx ExtServiceContext) BroadcastTxCommit(packet []byte) (res *ctypes.ResultBroadcastTxCommit, err error)

func (ExtServiceContext) BroadcastTxSync added in v0.10.8

func (ctx ExtServiceContext) BroadcastTxSync(packet []byte) (res *ctypes.ResultBroadcastTx, err error)

func (*ExtServiceContext) FullNodeClient added in v0.10.8

func (ctx *ExtServiceContext) FullNodeClient() *ServiceClient

func (ExtServiceContext) Query added in v0.10.8

func (ctx ExtServiceContext) Query(serviceMethod string, args interface{}, response interface{}) error

func (ExtServiceContext) Search added in v0.10.8

func (ctx ExtServiceContext) Search(query string, prove bool, page, perPage int, orderBy string) (res *ctypes.ResultTxSearch)

func (ExtServiceContext) Tx added in v0.10.8

func (ctx ExtServiceContext) Tx(hash []byte, prove bool) (res *ctypes.ResultTx, err error)

type FeeOptionsReply added in v0.14.0

type FeeOptionsReply struct {
	FeeOption fees.FeeOption `json:"feeOption"`
}

type GenerateAccountRequest added in v0.10.8

type GenerateAccountRequest struct {
	Name string `json:"name"`
}

type InputTransaction added in v0.14.0

type InputTransaction struct {
	Hash  string `json:"hash"`
	Index uint32 `json:"index"`
}

type ListAccountAddressesReply added in v0.10.8

type ListAccountAddressesReply struct {
	Addresses []string `json:"addresses"`
}

type ListAccountsReply added in v0.10.8

type ListAccountsReply struct {
	Accounts []accounts.Account `json:"accounts"`
}

type ListAccountsRequest added in v0.10.8

type ListAccountsRequest struct{}

type ListCurrenciesReply added in v0.10.8

type ListCurrenciesReply struct {
	Currencies balance.Currencies `json:"currencies"`
}

type ListCurrenciesRequest added in v0.10.8

type ListCurrenciesRequest struct{}

type ListTxTypesReply added in v0.14.0

type ListTxTypesReply struct {
	TxTypes []action.TxTypeDescribe `json:"txTypes"`
}

type ListTxTypesRequest added in v0.14.0

type ListTxTypesRequest struct{}

type ListValidatorsReply added in v0.10.8

type ListValidatorsReply struct {
	// The list of active validators
	Validators []identity.Validator `json:"validators"`
	// Height at which this validator set was active
	Height int64 `json:"height"`
}

type ListValidatorsRequest added in v0.10.8

type ListValidatorsRequest struct{}

type MaxTrackerBalanceReply added in v0.14.0

type MaxTrackerBalanceReply struct {
	MaxBalance int64 `json:"max_balance"`
}

type NewAccountReply added in v0.10.8

type NewAccountReply struct {
	Account accounts.Account `json:"account"`
}

type NewAccountRequest added in v0.10.8

type NewAccountRequest struct {
	Name string `json:"name"`
}

type NodeAddressReply added in v0.10.8

type NodeAddressReply struct {
	Address keys.Address `json:"address"`
}

type NodeAddressRequest added in v0.10.8

type NodeAddressRequest struct{}

type NodeIDReply added in v0.10.8

type NodeIDReply struct {
	Id string `json:"id"`
}

type NodeIDRequest added in v0.10.8

type NodeIDRequest struct {
	ShouldShowIP bool `json:"shouldShowIP,omitempty"`
}

type NodeNameReply added in v0.10.8

type NodeNameReply struct {
	Name string `json:"name"`
}

type NodeNameRequest added in v0.10.8

type NodeNameRequest struct{}

type ONSCreateRequest added in v0.10.8

type ONSCreateRequest struct {
	Owner       keys.Address  `json:"owner"`
	Account     keys.Address  `json:"account"`
	Name        string        `json:"name"`
	Uri         string        `json:"uri"`
	BuyingPrice action.Amount `json:"buyingPrice"`
	GasPrice    action.Amount `json:"gasPrice"`
	Gas         int64         `json:"gas"`
}

ONS Request Types

type ONSCreateSubRequest added in v0.14.0

type ONSCreateSubRequest struct {
	Owner       keys.Address  `json:"owner"`
	Account     keys.Address  `json:"account"`
	Name        string        `json:"name"`
	Uri         string        `json:"uri"`
	BuyingPrice action.Amount `json:"buyingPrice"`
	GasPrice    action.Amount `json:"gasPrice"`
	Gas         int64         `json:"gas"`
}

type ONSDeleteSubRequest added in v0.14.0

type ONSDeleteSubRequest struct {
	Name     string        `json:"name"`
	Owner    keys.Address  `json:"owner"`
	GasPrice action.Amount `json:"gasPrice"`
	Gas      int64         `json:"gas"`
}

type ONSGetDomainsOnSaleReply added in v0.10.8

type ONSGetDomainsOnSaleReply struct {
	Domains []ons.Domain `json:"domains"`
	Height  int64        `json:"domains"`
}

type ONSGetDomainsReply added in v0.10.8

type ONSGetDomainsReply struct {
	Domains []ons.Domain `json:"domains"`
	Height  int64        `json:"height"`
}

type ONSGetDomainsRequest added in v0.10.8

type ONSGetDomainsRequest struct {
	Name        string       `json:"name"`
	Owner       keys.Address `json:"owner"`
	OnSale      bool         `json:"onSale"`
	Beneficiary keys.Address `json:"beneficiary"`
}

type ONSGetOptionsReply added in v0.14.0

type ONSGetOptionsReply struct {
	ons.Options `json:"options"`
}

type ONSPurchaseRequest added in v0.10.8

type ONSPurchaseRequest struct {
	Name     string        `json:"name"`
	Buyer    keys.Address  `json:"buyer"`
	Account  keys.Address  `json:"account"`
	Offering action.Amount `json:"offering"`
	GasPrice action.Amount `json:"gasPrice"`
	Gas      int64         `json:"gas"`
}

type ONSRenewRequest added in v0.14.0

type ONSRenewRequest struct {
	Owner       keys.Address  `json:"owner"`
	Account     keys.Address  `json:"account"`
	Name        string        `json:"name"`
	BuyingPrice action.Amount `json:"buyingPrice"`
	GasPrice    action.Amount `json:"gasPrice"`
	Gas         int64         `json:"gas"`
}

type ONSSaleRequest added in v0.10.8

type ONSSaleRequest struct {
	Name         string        `json:"name"`
	OwnerAddress keys.Address  `json:"owner"`
	Price        action.Amount `json:"price"`
	CancelSale   bool          `json:"cancelSale"`
	GasPrice     action.Amount `json:"gasPrice"`
	Gas          int64         `json:"gas"`
}

type ONSSendRequest added in v0.10.8

type ONSSendRequest struct {
	From     keys.Address  `json:"from"`
	Name     string        `json:"name"`
	Amount   action.Amount `json:"amount"`
	GasPrice action.Amount `json:"gasPrice"`
	Gas      int64         `json:"gas"`
}

type ONSUpdateRequest added in v0.10.8

type ONSUpdateRequest struct {
	Owner    keys.Address  `json:"owner"`
	Account  keys.Address  `json:"account"`
	Name     string        `json:"name"`
	Active   bool          `json:"active"`
	Uri      string        `json:"uri"`
	GasPrice action.Amount `json:"gasPrice"`
	Gas      int64         `json:"gas"`
}

type PurgeValidatorReply added in v0.14.0

type PurgeValidatorReply struct {
	RawTx []byte `json:"rawTx"`
}

type PurgeValidatorRequest added in v0.14.0

type PurgeValidatorRequest struct {
	Admin     keys.Address `json:"admin"`
	Validator keys.Address `json:"validator"`
}

type SendTxRequest added in v0.10.8

type SendTxRequest struct {
	From     keys.Address  `json:"from"`
	To       keys.Address  `json:"to"`
	Amount   action.Amount `json:"amount"`
	GasPrice action.Amount `json:"gasPrice"`
	Gas      int64         `json:"gas"`
}

type ServiceClient added in v0.10.8

type ServiceClient struct {
	*rpc.Client
}

A type-safe client for accessing rpc services. Eventually each service will be broken out onto its own type TODO: The methods defined here should handle context.Context

func NewServiceClient added in v0.10.8

func NewServiceClient(conn string) (*ServiceClient, error)

func (*ServiceClient) AddAccount added in v0.10.8

func (c *ServiceClient) AddAccount(req AddAccountRequest) (out AddAccountReply, err error)

func (*ServiceClient) ApplyValidator added in v0.10.8

func (c *ServiceClient) ApplyValidator(req ApplyValidatorRequest) (out ApplyValidatorReply, err error)

func (*ServiceClient) Balance added in v0.10.8

func (c *ServiceClient) Balance(addr keys.Address) (out BalanceReply, err error)

func (*ServiceClient) CreateRawSend added in v0.10.8

func (c *ServiceClient) CreateRawSend(req SendTxRequest) (out *CreateTxReply, err error)

func (*ServiceClient) CurrBalance added in v0.13.0

func (c *ServiceClient) CurrBalance(addr keys.Address, currency string) (out CurrencyBalanceReply, err error)

func (*ServiceClient) DeleteAccount added in v0.10.8

func (c *ServiceClient) DeleteAccount(req DeleteAccountRequest) (out DeleteAccountReply, err error)

func (*ServiceClient) GetTracker added in v0.13.0

func (c *ServiceClient) GetTracker(name string) (out BTCGetTrackerReply, err error)

func (*ServiceClient) ListAccountAddresses added in v0.10.8

func (c *ServiceClient) ListAccountAddresses() (out ListAccountAddressesReply, err error)

func (*ServiceClient) ListAccounts added in v0.10.8

func (c *ServiceClient) ListAccounts() (out ListAccountsReply, err error)

func (*ServiceClient) ListCurrencies added in v0.10.8

func (c *ServiceClient) ListCurrencies() (out *ListCurrenciesReply, err error)

func (*ServiceClient) ListValidators added in v0.10.8

func (c *ServiceClient) ListValidators() (out ListValidatorsReply, err error)

func (*ServiceClient) NodeAddress added in v0.10.8

func (c *ServiceClient) NodeAddress() (out NodeAddressReply, err error)

func (*ServiceClient) NodeID added in v0.10.8

func (c *ServiceClient) NodeID(req NodeIDRequest) (out NodeIDReply, err error)

func (*ServiceClient) NodeName added in v0.10.8

func (c *ServiceClient) NodeName() (out NodeNameReply, err error)

func (*ServiceClient) ONS_CreateRawBuy added in v0.10.8

func (c *ServiceClient) ONS_CreateRawBuy(req ONSPurchaseRequest) (out CreateTxReply, err error)

func (*ServiceClient) ONS_CreateRawCreate added in v0.10.8

func (c *ServiceClient) ONS_CreateRawCreate(req ONSCreateRequest) (out CreateTxReply, err error)

ONS

func (*ServiceClient) ONS_CreateRawSale added in v0.10.8

func (c *ServiceClient) ONS_CreateRawSale(req ONSSaleRequest) (out CreateTxReply, err error)

func (*ServiceClient) ONS_CreateRawSend added in v0.10.8

func (c *ServiceClient) ONS_CreateRawSend(req ONSSendRequest) (out CreateTxReply, err error)

func (*ServiceClient) ONS_CreateRawUpdate added in v0.10.8

func (c *ServiceClient) ONS_CreateRawUpdate(req ONSUpdateRequest) (out CreateTxReply, err error)

func (*ServiceClient) PurgeValidator added in v0.14.0

func (c *ServiceClient) PurgeValidator(req PurgeValidatorRequest) (out PurgeValidatorReply, err error)

func (*ServiceClient) SendTx added in v0.10.8

func (c *ServiceClient) SendTx(req SendTxRequest) (out CreateTxReply, err error)

func (*ServiceClient) TxAsync added in v0.10.8

func (c *ServiceClient) TxAsync(req BroadcastRequest) (out BroadcastReply, err error)

Broadcast

func (*ServiceClient) TxCommit added in v0.10.8

func (c *ServiceClient) TxCommit(req BroadcastRequest) (out BroadcastReply, err error)

func (*ServiceClient) TxSync added in v0.10.8

func (c *ServiceClient) TxSync(req BroadcastRequest) (out BroadcastReply, err error)

func (*ServiceClient) WithdrawReward added in v0.12.0

func (c *ServiceClient) WithdrawReward(req WithdrawRewardRequest) (out WithdrawRewardReply, err error)

type SignRawTxRequest added in v0.10.8

type SignRawTxRequest struct {
	RawTx   []byte         `json:"rawTx"`
	Address action.Address `json:"address"`
}

type SignRawTxResponse added in v0.10.8

type SignRawTxResponse struct {
	Signature action.Signature `json:"signature"`
}

type TxRequest added in v0.14.0

type TxRequest struct {
	Hash  string `json:"hash"`
	Prove bool   `json:"prove"`
}

type TxResponse added in v0.14.0

type TxResponse struct {
	Result ctypes.ResultTx `json:"result"`
}

type WithdrawRewardReply added in v0.12.0

type WithdrawRewardReply struct {
	RawTx []byte `json:"rawTx"`
}

type WithdrawRewardRequest added in v0.12.0

type WithdrawRewardRequest struct {
	From     keys.Address  `json:"from"`
	To       keys.Address  `json:"to"`
	GasPrice action.Amount `json:"gasPrice"`
	Gas      int64         `json:"gas"`
}

Jump to

Keyboard shortcuts

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