sdk

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: GPL-3.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAccountName

func GenerateAccountName(namePrefix string, addStrLen int) string

GenerateAccountName generate account name

func GenerateKey

func GenerateKey() (*ecdsa.PrivateKey, common.PubKey)

GenerateKey generate pubkey and privkey

Types

type API

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

API rpc api

func NewAPI

func NewAPI(rpchost string) *API

NewAPI create api interface

func (*API) AccountCode

func (api *API) AccountCode(name string) ([]byte, error)

AccountCode get account code

func (*API) AccountInfo

func (api *API) AccountInfo(name string) (map[string]interface{}, error)

AccountInfo get account by name

func (*API) AccountIsExist

func (api *API) AccountIsExist(name string) (bool, error)

AccountIsExist account exist

func (*API) AccountNonce

func (api *API) AccountNonce(name string) (uint64, error)

AccountNonce get account nonce

func (*API) AssetInfoByID

func (api *API) AssetInfoByID(id uint64) (*asset.AssetObject, error)

AssetInfoByID get asset info

func (*API) AssetInfoByName

func (api *API) AssetInfoByName(name string) (*asset.AssetObject, error)

AssetInfoByName get asset info

func (*API) BalanceByAssetID

func (api *API) BalanceByAssetID(name string, id uint64, typeID uint64) (*big.Int, error)

BalanceByAssetID get asset balance

func (*API) BlockByHash

func (api *API) BlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error)

BlockByHash block info

func (*API) BlockByNumber

func (api *API) BlockByNumber(number int64, fullTx bool) (map[string]interface{}, error)

BlockByNumber block info

func (*API) ChainConfig added in v0.0.8

func (api *API) ChainConfig() (*params.ChainConfig, error)

ChainConfig chain config

func (*API) CurrentBlock

func (api *API) CurrentBlock(fullTx bool) (map[string]interface{}, error)

CurrentBlock current block info

func (*API) DposAvailableStake added in v0.0.8

func (api *API) DposAvailableStake(name string) (map[string]interface{}, error)

DposAvailableStake state info

func (*API) DposAvailableStakeByHeight added in v0.0.9

func (api *API) DposAvailableStakeByHeight(height uint64, name string) (map[string]interface{}, error)

DposAvailableStakeByHeight state info

func (*API) DposCandidate added in v0.0.8

func (api *API) DposCandidate(name string) (map[string]interface{}, error)

DposCandidate candidate info by name

func (*API) DposCandidates added in v0.0.8

func (api *API) DposCandidates(detail bool) ([]map[string]interface{}, error)

DposCandidates candidate info by name

func (*API) DposInfo

func (api *API) DposInfo() (map[string]interface{}, error)

DposInfo dpos info

func (*API) DposIrreversible

func (api *API) DposIrreversible() (map[string]interface{}, error)

DposIrreversible dpos irreversible info

func (*API) DposNextValidCandidates added in v0.0.9

func (api *API) DposNextValidCandidates() (map[string]interface{}, error)

DposNextValidCandidates dpos candidate info

func (*API) DposNextValidCandidatesByHeight added in v0.0.9

func (api *API) DposNextValidCandidatesByHeight(height uint64) (map[string]interface{}, error)

DposNextValidCandidatesByHeight dpos candidate info

func (*API) DposSnapShotTime added in v0.0.9

func (api *API) DposSnapShotTime() (map[string]interface{}, error)

DposSnapShotTime dpos snapshot time info

func (*API) DposSnapShotTimeByHeight added in v0.0.9

func (api *API) DposSnapShotTimeByHeight(height uint64) (map[string]interface{}, error)

DposSnapShotTimeByHeight dpos snapshot time info

func (*API) DposValidCandidates added in v0.0.8

func (api *API) DposValidCandidates() (map[string]interface{}, error)

DposValidCandidates dpos candidate info

func (*API) DposValidCandidatesByHeight added in v0.0.9

func (api *API) DposValidCandidatesByHeight(height uint64) (map[string]interface{}, error)

DposValidCandidatesByHeight dpos candidate info

func (*API) DposVotersByCandidate added in v0.0.8

func (api *API) DposVotersByCandidate(candidate string, detail bool) (map[string]interface{}, error)

DposVotersByCandidate get voters info of candidate

func (*API) DposVotersByCandidateByHeight added in v0.0.9

func (api *API) DposVotersByCandidateByHeight(height uint64, candidate string, detail bool) (map[string]interface{}, error)

DposVotersByCandidateByHeight get voters info of candidate

func (*API) DposVotersByVoter added in v0.0.8

func (api *API) DposVotersByVoter(voter string, detail bool) (interface{}, error)

DposVotersByVoter get voters info of voter

func (*API) DposVotersByVoterByHeight added in v0.0.9

func (api *API) DposVotersByVoterByHeight(height uint64, voter string, detail bool) (interface{}, error)

DposVotersByVoterByHeight get voters info of voter

func (*API) FeeInfo added in v0.0.8

func (api *API) FeeInfo(name string, objectType uint64) (map[string]interface{}, error)

FeeInfo get object fee by name

func (*API) FeeInfoByID added in v0.0.8

func (api *API) FeeInfoByID(startFeeID uint64, count uint64) (*feemanager.ObjectFeeResult, error)

func (*API) FeeInfoByTime added in v0.0.8

func (api *API) FeeInfoByTime(time uint64, startFeeID uint64, count uint64) (*feemanager.ObjectFeeResult, error)

func (*API) GasPrice

func (api *API) GasPrice() (*big.Int, error)

GasPrice gas price

func (*API) MinerMining

func (api *API) MinerMining() (bool, error)

MinerMining mining

func (*API) MinerSetCoinbase

func (api *API) MinerSetCoinbase(name string, privKeys []string) (bool, error)

MinerSetCoinbase coinbase

func (*API) MinerSetExtra

func (api *API) MinerSetExtra(extra []byte) (bool, error)

MinerSetExtra extra

func (*API) MinerStart

func (api *API) MinerStart() (bool, error)

MinerStart start

func (*API) MinerStop

func (api *API) MinerStop() (bool, error)

MinerStop stop

func (*API) SendRawTransaction

func (api *API) SendRawTransaction(rawTx []byte) (common.Hash, error)

SendRawTransaction send tx

func (*API) TransactionByHash

func (api *API) TransactionByHash(hash common.Hash) (*types.RPCTransaction, error)

TransactionByHash tx info

func (*API) TransactionReceiptByHash

func (api *API) TransactionReceiptByHash(hash common.Hash) (*types.RPCReceipt, error)

TransactionReceiptByHash tx info

type Account

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

Account account object

func NewAccount

func NewAccount(api *API, name common.Name, priv *ecdsa.PrivateKey, feeid uint64, nonce uint64, checked bool, chainID *big.Int) *Account

NewAccount new account object

func (*Account) CreateAccount

func (acc *Account) CreateAccount(to common.Name, value *big.Int, id uint64, gas uint64, newacct *accountmanager.CreateAccountAction) (hash common.Hash, err error)

CreateAccount new account

func (*Account) DestroyAsset

func (acc *Account) DestroyAsset(to common.Name, value *big.Int, id uint64, gas uint64) (hash common.Hash, err error)

DestroyAsset destory asset

func (*Account) ExitTakeOver

func (acc *Account) ExitTakeOver(to common.Name, value *big.Int, id uint64, gas uint64) (hash common.Hash, err error)

ExitTakeOver exit take over

func (*Account) IncreaseAsset

func (acc *Account) IncreaseAsset(to common.Name, value *big.Int, id uint64, gas uint64, asset *accountmanager.IncAsset) (hash common.Hash, err error)

IncreaseAsset update asset

func (*Account) IssueAsset

func (acc *Account) IssueAsset(to common.Name, value *big.Int, id uint64, gas uint64, asset *accountmanager.IssueAsset) (hash common.Hash, err error)

IssueAsset new asset

func (*Account) KickedCandidate added in v0.0.8

func (acc *Account) KickedCandidate(to common.Name, value *big.Int, id uint64, gas uint64, arg *dpos.KickedCandidate) (hash common.Hash, err error)

KickedCandidate kicked candidates

func (*Account) Pubkey

func (acc *Account) Pubkey() common.PubKey

Pubkey account pub key

func (*Account) RegCandidate added in v0.0.8

func (acc *Account) RegCandidate(to common.Name, value *big.Int, id uint64, gas uint64, arg *dpos.RegisterCandidate) (hash common.Hash, err error)

RegCandidate new candidate

func (*Account) SetAssetOwner

func (acc *Account) SetAssetOwner(to common.Name, value *big.Int, id uint64, gas uint64, asset *asset.AssetObject) (hash common.Hash, err error)

SetAssetOwner update asset owner

func (*Account) Transfer

func (acc *Account) Transfer(to common.Name, value *big.Int, id uint64, gas uint64) (hash common.Hash, err error)

Transfer transfer tokens

func (*Account) UnRegCandidate added in v0.0.8

func (acc *Account) UnRegCandidate(to common.Name, value *big.Int, id uint64, gas uint64) (hash common.Hash, err error)

UnRegCandidate remove cadiate

func (*Account) UpdateAccount

func (acc *Account) UpdateAccount(to common.Name, value *big.Int, id uint64, gas uint64, newacct *accountmanager.UpdataAccountAction) (hash common.Hash, err error)

UpdateAccount update accout

func (*Account) UpdateAsset

func (acc *Account) UpdateAsset(to common.Name, value *big.Int, id uint64, gas uint64, asset *accountmanager.UpdateAsset) (hash common.Hash, err error)

UpdateAsset update asset

func (*Account) UpdateCandidate added in v0.0.8

func (acc *Account) UpdateCandidate(to common.Name, value *big.Int, id uint64, gas uint64, arg *dpos.UpdateCandidate) (hash common.Hash, err error)

UpdateCandidate update candidate

func (*Account) VoteCandidate added in v0.0.8

func (acc *Account) VoteCandidate(to common.Name, value *big.Int, id uint64, gas uint64, arg *dpos.VoteCandidate) (hash common.Hash, err error)

VoteCandidate vote cadiate

Jump to

Keyboard shortcuts

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