api

package
v0.0.3-tmp Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: GPL-3.0 Imports: 24 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupport = errors.New("not support this method")

	ErrBalanceNotEnough = JsonRpc2Error{
		Message: vm.ErrInsufficientBalance.Error(),
		Code:    -35001,
	}

	ErrDecryptKey = JsonRpc2Error{
		Message: walleterrors.ErrDecryptKey.Error(),
		Code:    -34001,
	}

	AddressAlreadyUnLocked = JsonRpc2Error{
		Message: walleterrors.ErrAlreadyLocked.Error(),
		Code:    -34002,
	}
)
View Source
var (
	ErrStrToBigInt = errors.New("convert to big.Int failed")
)

Functions

func TryMakeConcernedError

func TryMakeConcernedError(err error) (newerr error, concerned bool)

Types

type AccountBlock

type AccountBlock struct {
	*ledger.AccountBlock

	Height string
	Quota  string

	Amount string
	Fee    string

	ConfirmedTimes string
	TokenInfo      *RpcTokenInfo
}

func (*AccountBlock) LedgerAccountBlock

func (ab *AccountBlock) LedgerAccountBlock() (*ledger.AccountBlock, error)

type CommonApi

type CommonApi struct {
}

func (CommonApi) LogDir

func (CommonApi) LogDir() string

func (CommonApi) String

func (CommonApi) String() string

type CreateTransferTxParms

type CreateTransferTxParms struct {
	SelfAddr    types.Address
	ToAddr      types.Address
	TokenTypeId types.TokenTypeId
	Passphrase  string
	Amount      string
	Data        []byte
}

type HexSignedTuple

type HexSignedTuple struct {
	Message    string `json:"message"`
	SignedData string `json:"signedData"`
	Pubkey     string `json:"pubkey"`
}

type IsMayValidKeystoreFileResponse

type IsMayValidKeystoreFileResponse struct {
	Maybe      bool
	MayAddress types.Address
}

type JsonRpc2Error

type JsonRpc2Error struct {
	Message string
	Code    int
}

func (JsonRpc2Error) Error

func (e JsonRpc2Error) Error() string

func (JsonRpc2Error) ErrorCode

func (e JsonRpc2Error) ErrorCode() int

type LedgerApi

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

func NewLedgerApi

func NewLedgerApi(vite *vite.Vite) *LedgerApi

func (*LedgerApi) GetAccountByAccAddr

func (l *LedgerApi) GetAccountByAccAddr(addr types.Address) (*RpcAccountInfo, error)

func (*LedgerApi) GetBlocksByAccAddr

func (l *LedgerApi) GetBlocksByAccAddr(addr types.Address, index int, count int, needTokenInfo *bool) ([]*AccountBlock, error)

func (*LedgerApi) GetBlocksByHash

func (l *LedgerApi) GetBlocksByHash(addr types.Address, originBlockHash *types.Hash, count uint64) ([]*AccountBlock, error)

func (*LedgerApi) GetLatestBlock

func (l *LedgerApi) GetLatestBlock(addr types.Address) (*AccountBlock, error)

func (*LedgerApi) GetLatestSnapshotChainHash

func (l *LedgerApi) GetLatestSnapshotChainHash() *types.Hash

func (*LedgerApi) GetSnapshotChainHeight

func (l *LedgerApi) GetSnapshotChainHeight() string

func (*LedgerApi) GetTokenMintage

func (l *LedgerApi) GetTokenMintage(tti types.TokenTypeId) (*RpcTokenInfo, error)

func (LedgerApi) String

func (l LedgerApi) String() string

type P2PApi

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

func NewP2PApi

func NewP2PApi(p2p *p2p.Server) P2PApi

func (P2PApi) NetworkAvailable

func (p P2PApi) NetworkAvailable() bool

func (P2PApi) PeersCount

func (p P2PApi) PeersCount() int

func (P2PApi) String

func (p P2PApi) String() string

type PrivateOnroadApi

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

func NewPrivateOnroadApi

func NewPrivateOnroadApi(manager *onroad.Manager) *PrivateOnroadApi

func (PrivateOnroadApi) GetAccountOnroadInfo

func (o PrivateOnroadApi) GetAccountOnroadInfo(address types.Address) (*RpcAccountInfo, error)

func (PrivateOnroadApi) GetOnroadBlocksByAddress

func (o PrivateOnroadApi) GetOnroadBlocksByAddress(address types.Address, index int, count int) ([]*AccountBlock, error)

func (PrivateOnroadApi) ListWorkingAutoReceiveWorker

func (o PrivateOnroadApi) ListWorkingAutoReceiveWorker() []types.Address

func (PrivateOnroadApi) StartAutoReceive

func (o PrivateOnroadApi) StartAutoReceive(addr types.Address, filter map[types.TokenTypeId]string) error

func (PrivateOnroadApi) StopAutoReceive

func (o PrivateOnroadApi) StopAutoReceive(addr types.Address) error

func (PrivateOnroadApi) String

func (o PrivateOnroadApi) String() string

type PublicOnroadApi

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

func NewPublicOnroadApi

func NewPublicOnroadApi(manager *onroad.Manager) *PublicOnroadApi

func (PublicOnroadApi) GetAccountOnroadInfo

func (o PublicOnroadApi) GetAccountOnroadInfo(address types.Address) (*RpcAccountInfo, error)

func (PublicOnroadApi) GetOnroadBlocksByAddress

func (o PublicOnroadApi) GetOnroadBlocksByAddress(address types.Address, index int, count int) ([]*AccountBlock, error)

func (PublicOnroadApi) String

func (o PublicOnroadApi) String() string

type RpcAccountInfo

type RpcAccountInfo struct {
	AccountAddress      types.Address
	TotalNumber         string                                     // uint64
	TokenBalanceInfoMap map[types.TokenTypeId]*RpcTokenBalanceInfo `json:",omitempty"`
}

type RpcTokenBalanceInfo

type RpcTokenBalanceInfo struct {
	TokenInfo   *RpcTokenInfo `json:",omitempty"`
	TotalAmount string        // big int
	Number      *string       // uint64
}

type RpcTokenInfo

type RpcTokenInfo struct {
	TokenName      string
	TokenSymbol    string
	TotalSupply    *string `json:",omitempty"` // *big.Int
	Decimals       uint8
	Owner          types.Address
	PledgeAmount   *string `json:",omitempty"` // *big.Int
	WithdrawHeight string  // uint64
}

func RawTokenInfoToRpc

func RawTokenInfoToRpc(tinfo *contracts.TokenInfo) *RpcTokenInfo

type TypesApi

type TypesApi struct {
}

func (TypesApi) IsValidHexAddress

func (TypesApi) IsValidHexAddress(addr string) bool

func (TypesApi) IsValidHexTokenTypeId

func (TypesApi) IsValidHexTokenTypeId(tti string) bool

func (TypesApi) String

func (TypesApi) String() string

type WalletApi

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

func NewWalletApi

func NewWalletApi(vite *vite.Vite) *WalletApi

func (*WalletApi) CreateTxWithPassphrase

func (m *WalletApi) CreateTxWithPassphrase(params CreateTransferTxParms) error

func (*WalletApi) ExportPriv

func (m *WalletApi) ExportPriv(address types.Address, password string) (string, error)

func (WalletApi) GetDataDir

func (m WalletApi) GetDataDir() string

func (*WalletApi) ImportPriv

func (m *WalletApi) ImportPriv(privkey string, newpassword string) (types.Address, error)

func (*WalletApi) IsMayValidKeystoreFile

func (m *WalletApi) IsMayValidKeystoreFile(path string) IsMayValidKeystoreFileResponse

func (WalletApi) ListAddress

func (m WalletApi) ListAddress() []types.Address

func (*WalletApi) LockAddress

func (m *WalletApi) LockAddress(addr types.Address) error

func (*WalletApi) NewAddress

func (m *WalletApi) NewAddress(passphrase string) (types.Address, error)

func (*WalletApi) ReloadAndFixAddressFile

func (m *WalletApi) ReloadAndFixAddressFile() error

func (*WalletApi) SignData

func (m *WalletApi) SignData(addr types.Address, hexMsg string) (HexSignedTuple, error)

func (*WalletApi) SignDataWithPassphrase

func (m *WalletApi) SignDataWithPassphrase(addr types.Address, hexMsg string, password string) (HexSignedTuple, error)

func (WalletApi) Status

func (m WalletApi) Status() map[types.Address]string

func (WalletApi) String

func (m WalletApi) String() string

func (*WalletApi) UnlockAddress

func (m *WalletApi) UnlockAddress(addr types.Address, password string, duration *uint64) (bool, error)

Jump to

Keyboard shortcuts

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