sdk

package
v0.0.0-...-471f645 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

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

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) (*rpcapi.RPCAccount, error)

AccountInfo get account by name

func (*API) AccountInfoByID

func (api *API) AccountInfoByID(id uint64) (*rpcapi.RPCAccount, error)

AccountInfoByID get account by id

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) DposAvailableStake

func (api *API) DposAvailableStake(epoch uint64, name string) (*big.Int, error)

DposAvailableStake state info

func (*API) DposCandidate

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

DposCandidate candidate info by name

func (*API) DposCandidates

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

DposCandidates candidate info by name

func (*API) DposCandidatesSize

func (api *API) DposCandidatesSize(epoch uint64) (uint64, error)

DposCandidatesSize candidates size

func (*API) DposEpoch

func (api *API) DposEpoch(height uint64) (uint64, error)

DposEpoch dpos epoch info

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) DposNextEpoch

func (api *API) DposNextEpoch(epoch uint64) (uint64, error)

DposNextEpoch dpos epoch info

func (*API) DposNextValidCandidates

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

DposNextValidCandidates dpos candidate info

func (*API) DposPrevEpoch

func (api *API) DposPrevEpoch(epoch uint64) (uint64, error)

DposPrevEpoch dpos epoch info

func (*API) DposSnapShotTime

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

DposSnapShotTime dpos snapshot time info

func (*API) DposValidCandidates

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

DposValidCandidates dpos candidate info

func (*API) DposVotersByCandidate

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

DposVotersByCandidate get voters info of candidate

func (*API) DposVotersByVoter

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

DposVotersByVoter get voters info of voter

func (*API) FeeInfo

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

FeeInfo get object fee by name

func (*API) FeeInfoByID

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

FeeInfoByID get object fee by id

func (*API) GasPrice

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

GasPrice get gas price

func (*API) GetBlockByHash

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

GetBlockByHash get block info

func (*API) GetBlockByNumber

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

GetBlockByNumber get block info

func (*API) GetChainConfig

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

GetChainConfig get chain config

func (*API) GetCurrentBlock

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

GetCurrentBlock get current block info

func (*API) GetTransactionByHash

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

GetTransactionByHash get tx info by hash

func (*API) GetTransactionReceiptByHash

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

GetTransactionReceiptByHash get tx info by hash

func (*API) SendRawTransaction

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

SendRawTransaction send signed tx

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) CallContract

func (acc *Account) CallContract(id uint64, gas uint64, input []byte) (hash common.Hash, err error)

CallContract call contract transaction

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) CreateContract

func (acc *Account) CreateContract(id uint64, gas uint64, input []byte) (hash common.Hash, err error)

CreateContract create and send contract transaction

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

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) RefundCandidate

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

RefundCandidate refund cadiate

func (*Account) RegCandidate

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 *accountmanager.UpdateAssetOwner) (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

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.UpdateAccountAction) (hash common.Hash, err error)

UpdateAccount update accout

func (*Account) UpdateAccountAuthor

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

UpdateAccountAuthor 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

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

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

func (*Account) WithdrawCandidate

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

WithdrawCandidate refund cadiate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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