ethapi

package
v0.0.0-...-93382e6 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: GPL-3.0 Imports: 59 Imported by: 0

Documentation

Overview

Package ethapi implements the general Ethereum API functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyString   = &decError{"empty input string"}
	ErrSyntax        = &decError{"invalid hex string"}
	ErrMissingPrefix = &decError{"hex string without 0x prefix"}
	ErrOddLength     = &decError{"hex string of odd length"}
	ErrUint64Range   = &decError{"hex number > 64 bits"}
)

Functions

func GetAPIs

func GetAPIs(apiBackend Backend) []rpc.API

func GetBlockReward

func GetBlockReward(block *types.Block) [2]*big.Int

*

[0] block reward
[1] community reward
[2] team reward

func IsContract

func IsContract(b []byte) (bool, error)

func MixAdrressToPkr

func MixAdrressToPkr(addr MixAdrress) c_type.PKr

func PackConstruct

func PackConstruct(abi *abi.ABI, data hexutil.Bytes, args []string) (hexutil.Bytes, error)

func PackMethod

func PackMethod(abi *abi.ABI, contractAddr ContractAddress, methodName string, args []string) (hexutil.Bytes, error)

func PkrToString

func PkrToString(pkr c_type.PKr) string

func RPCMarshalBlock

func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)

RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.

func UnPack

func UnPack(abi *abi.ABI, name string, output hexutil.Bytes) (interface{}, error)

Types

type AddrLocker

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

func (*AddrLocker) LockAddr

func (l *AddrLocker) LockAddr(address common.Address)

LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.

func (*AddrLocker) UnlockAddr

func (l *AddrLocker) UnlockAddr(address common.Address)

UnlockAddr unlocks the mutex of the given account.

type AllBase58Adrress

type AllBase58Adrress []byte

func (AllBase58Adrress) Bytes

func (b AllBase58Adrress) Bytes() []byte

func (AllBase58Adrress) MarshalText

func (b AllBase58Adrress) MarshalText() ([]byte, error)

func (AllBase58Adrress) String

func (b AllBase58Adrress) String() string

func (AllBase58Adrress) ToPkr

func (b AllBase58Adrress) ToPkr(isContract bool) (ret c_type.PKr)

func (*AllBase58Adrress) UnmarshalText

func (b *AllBase58Adrress) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type AllMixedAddress

type AllMixedAddress [96]byte

func (AllMixedAddress) IsContract

func (b AllMixedAddress) IsContract() bool

func (AllMixedAddress) MarshalText

func (b AllMixedAddress) MarshalText() ([]byte, error)

func (AllMixedAddress) ToPKr

func (b AllMixedAddress) ToPKr() (ret c_type.PKr)

func (AllMixedAddress) ToPKrAddress

func (b AllMixedAddress) ToPKrAddress() (ret PKrAddress)

func (*AllMixedAddress) UnmarshalText

func (b *AllMixedAddress) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Backend

type Backend interface {
	// General Ethereum API
	Downloader() *downloader.Downloader
	ProtocolVersion() int
	PeerCount() uint
	SuggestPrice(ctx context.Context) (*big.Int, error)
	ChainDb() decedb.Database
	EventMux() *event.TypeMux
	AccountManager() *accounts.Manager

	// BlockChain API
	SetHead(number uint64)
	HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
	BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
	StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
	GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error)
	GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error)
	GetTd(blockHash common.Hash) *big.Int
	GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)
	SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
	SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription
	SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription

	// TxPool API
	SendTx(ctx context.Context, signedTx *types.Transaction) error
	GetPoolTransactions() (types.Transactions, error)
	GetPoolTransaction(txHash common.Hash) *types.Transaction
	//GetPoolNonce(ctx context.Context, addr common.Data) (uint64, error)
	Stats() (pending int, queued int)
	TxPoolContent() (types.Transactions, types.Transactions)
	SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription

	ChainConfig() *params.ChainConfig
	CurrentBlock() *types.Block
	GetEngin() consensus.Engine
	GetMiner() *miner.Miner

	GetBlocksInfo(start uint64, count uint64) ([]txtool.Block, error)
	GetAnchor(roots []c_type.Uint256) ([]txtool.Witness, error)
	CommitTx(tx *txtool.GTx) error

	GetPkNumber(pk c_type.Uint512) (number uint64, e error)
	GetPkr(pk *c_type.Uint512, index *c_type.Uint256) (c_type.PKr, error)
	GetBalances(pk c_type.Uint512) (balances map[string]*big.Int, tickets map[string][]*common.Hash)
	GenTx(param prepare.PreTxParam) (*txtool.GTxParam, error)
	GetRecordsByPk(pk *c_type.Uint512, begin, end uint64) (records []exchange.Utxo, err error)
	GetRecordsByPkr(pkr c_type.PKr, begin, end uint64) (records []exchange.Utxo, err error)
	GetLockedBalances(pk c_type.Uint512) (balances map[string]*big.Int)
	GetMaxAvailable(pk c_type.Uint512, currency string) (amount *big.Int)
	GetRecordsByTxHash(txHash c_type.Uint256) (records []exchange.Utxo, err error)

	//Light node api
	GetOutByPKr(pkrs []c_type.PKr, start, end uint64) (br light.BlockOutResp, e error)
	CheckNil(Nils []c_type.Uint256) (nilResps []light.NilValue, e error)
}

Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.

var Backend_Instance Backend

type Balance

type Balance struct {
	Tkn map[string]*hexutil.Big   `json:"tkn"`
	Tkt map[string][]*common.Hash `json:"tkt"`
}

func GetBalanceFromExchange

func GetBalanceFromExchange(tkns map[string]*big.Int) (result Balance)

type Big

type Big big.Int

func (Big) MarshalJSON

func (b Big) MarshalJSON() ([]byte, error)

func (*Big) ToInt

func (b *Big) ToInt() *big.Int

func (*Big) UnmarshalJSON

func (b *Big) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Block

type Block struct {
	BlockNumber uint64
	BlockHash   c_type.Uint256
	Ins         []c_type.Uint256
	Outs        []Record
	TxHashes    []common.Hash
	Timestamp   uint64
}

type BuyShareArgs

type BuyShareArgs struct {
	Value Big
	Vote  PKrAddress
	Pool  *c_type.Uint256
}

type BuyShareTxArg

type BuyShareTxArg struct {
	From     address.MixBase58Adrress  `json:"from"`
	Vote     *address.MixBase58Adrress `json:"vote"`
	Pool     *hexutil.Bytes            `json:"pool"`
	Gas      *hexutil.Uint64           `json:"gas"`
	GasPrice *hexutil.Big              `json:"gasPrice"`
	Value    *hexutil.Big              `json:"value"`
}

type CallArgs

type CallArgs struct {
	From        *address.MixBase58Adrress `json:"from"`
	To          *AllMixedAddress          `json:"to"`
	GasCurrency Smbol                     `json:"gasCy"` // default DECE
	Gas         hexutil.Uint64            `json:"gas"`
	GasPrice    hexutil.Big               `json:"gasPrice"`
	Value       hexutil.Big               `json:"value"`
	Data        hexutil.Bytes             `json:"data"`
	Currency    Smbol                     `json:"cy"`
	Dynamic     bool                      `json:"dy"` // contract address parameters are dynamically generated.
	Category    Smbol                     `json:"catg"`
	Tkt         *common.Hash              `json:"tkt"`
}

CallArgs represents the arguments for a call.

type ClosePkgArgs

type ClosePkgArgs struct {
	From     *address.MixBase58Adrress `json:"from"`
	Gas      *hexutil.Uint64           `json:"gas"`
	GasPrice *hexutil.Big              `json:"gasPrice"`
	PkgId    *c_type.Uint256           `json:"id"`
	Key      *c_type.Uint256           `json:"key"`
}

type ClosePoolArgs

type ClosePoolArgs struct {
}

type CmdsArgs

type CmdsArgs struct {
	//Share
	BuyShare *BuyShareArgs
	//Pool
	RegistPool *RegistPoolArgs
	ClosePool  *ClosePoolArgs
	//Contract
	Contract *ContractArgs
	//Package
	PkgCreate   *PkgCreateArgs
	PkgTransfer *PkgTransferArgs
	PkgClose    *PkgCloseArgs
}

type ContractAddress

type ContractAddress c_type.PKr

func (ContractAddress) MarshalText

func (b ContractAddress) MarshalText() ([]byte, error)

func (*ContractAddress) SetBytes

func (b *ContractAddress) SetBytes(bs []byte)

func (*ContractAddress) UnmarshalText

func (b *ContractAddress) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type ContractArgs

type ContractArgs struct {
	Currency Smbol
	Value    *Big
	To       *ContractAddress
	Data     hexutil.Bytes
}

type ConvertAddress

type ConvertAddress struct {
	Addr      map[string]string                 `json:"addr"`
	ShortAddr map[string]common.ContractAddress `json:"shortAddr"`
	Rand      *c_type.Uint128                   `json:"rand"`
}

type ExecutionResult

type ExecutionResult struct {
	Gas         uint64         `json:"gas"`
	Failed      bool           `json:"failed"`
	ReturnValue string         `json:"returnValue"`
	StructLogs  []StructLogRes `json:"structLogs"`
}

ExecutionResult groups all structured logs emitted by the EVM while replaying a transaction in debug mode as well as transaction execution status, the amount of gas used and the return value

type GOutArgs

type GOutArgs struct {
	PKr   PKrAddress
	Asset assets.Asset
	Memo  c_type.Uint512
}

func (*GOutArgs) ToOut

func (self *GOutArgs) ToOut() (ret txtool.GOut)

type GenTxArgs

type GenTxArgs struct {
	From       address.PKAddress
	RefundTo   *PKrAddress
	Receptions []ReceptionArgs
	Cmds       *CmdsArgs
	Gas        uint64
	GasPrice   *Big
	Roots      []c_type.Uint256
}

type MergeArgs

type MergeArgs struct {
	From     address.PKAddress
	To       *PKrAddress
	Currency Smbol
	Zcount   uint64
	Left     uint64
	Icount   *uint64
}

func (MergeArgs) Check

func (args MergeArgs) Check() error

func (MergeArgs) ToMergParam

func (args MergeArgs) ToMergParam() *exchange.MergeParam

type MixAdrress

type MixAdrress []byte

func (MixAdrress) MarshalText

func (b MixAdrress) MarshalText() ([]byte, error)

func (*MixAdrress) UnmarshalText

func (b *MixAdrress) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type PKrAddress

type PKrAddress [96]byte

func (PKrAddress) Base58

func (b PKrAddress) Base58() string

func (PKrAddress) MarshalText

func (b PKrAddress) MarshalText() ([]byte, error)

func (PKrAddress) String

func (b PKrAddress) String() string

func (PKrAddress) ToPKr

func (b PKrAddress) ToPKr() *c_type.PKr

func (*PKrAddress) UnmarshalText

func (b *PKrAddress) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type PkgCloseArgs

type PkgCloseArgs struct {
	Id  c_type.Uint256
	Key c_type.Uint256
}

type PkgCreateArgs

type PkgCreateArgs struct {
	Id       c_type.Uint256
	PKr      AllMixedAddress
	Currency Smbol
	Value    *Big
	Memo     c_type.Uint512
}

type PkgTransferArgs

type PkgTransferArgs struct {
	Id  c_type.Uint256
	PKr AllMixedAddress
}

type PreTxParamArgs

type PreTxParamArgs struct {
	Gas      uint64
	GasPrice uint64
	From     PKrAddress
	Ins      []c_type.Uint256
	Outs     []GOutArgs
}

func (*PreTxParamArgs) ToParam

func (self *PreTxParamArgs) ToParam() (ret flight.PreTxParam)

type PrivateAccountAPI

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

PrivateAccountAPI provides an API to access accounts managed by this node. It offers methods to create, (un)lock en list accounts. Some methods accept passwords and are therefore considered private by default.

func NewPrivateAccountAPI

func NewPrivateAccountAPI(b Backend, nonceLock *AddrLocker) *PrivateAccountAPI

NewPrivateAccountAPI create a new PrivateAccountAPI.

func (*PrivateAccountAPI) ExportMnemonic

func (s *PrivateAccountAPI) ExportMnemonic(addr address.MixBase58Adrress, password string) (string, error)

func (*PrivateAccountAPI) ExportRawKey

func (s *PrivateAccountAPI) ExportRawKey(addr address.MixBase58Adrress, password string) (hexutil.Bytes, error)

func (*PrivateAccountAPI) GenSeed

func (s *PrivateAccountAPI) GenSeed() (hexutil.Bytes, error)

func (*PrivateAccountAPI) ImportMnemonic

func (s *PrivateAccountAPI) ImportMnemonic(mnemonic string, password string, a *uint64) (address.PKAddress, error)

func (*PrivateAccountAPI) ImportRawKey

func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string, v *int, a *uint64) (address.PKAddress, error)

ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.

func (*PrivateAccountAPI) ImportTk

func (*PrivateAccountAPI) ListAccounts

func (s *PrivateAccountAPI) ListAccounts() []address.PKAddress

ListAccounts will return a list of addresses for accounts this node manages.

func (*PrivateAccountAPI) ListWallets

func (s *PrivateAccountAPI) ListWallets() []rawWallet

ListWallets will return a list of wallets this node manages.

func (*PrivateAccountAPI) LockAccount

func (s *PrivateAccountAPI) LockAccount(addr address.MixBase58Adrress) bool

LockAccount will lock the account associated with the given address when it's unlocked.

func (*PrivateAccountAPI) NewAccount

func (s *PrivateAccountAPI) NewAccount(password string) (address.PKAddress, error)

NewAccount will create a new account and returns the address for the new account.

func (*PrivateAccountAPI) NewAccountWithMnemonic

func (s *PrivateAccountAPI) NewAccountWithMnemonic(password string) (map[string]interface{}, error)

NewAccount will create a new account and returns the mnemonic 、address for the new account.

func (*PrivateAccountAPI) SendTransaction

func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)

SendTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails.

func (*PrivateAccountAPI) SignAndSendTransaction

func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)

SignAndSendTransaction was renamed to SendTransaction. This method is deprecated and will be removed in the future. It primary goal is to give clients time to update.

func (*PrivateAccountAPI) UnlockAccount

func (s *PrivateAccountAPI) UnlockAccount(addr address.MixBase58Adrress, password string, duration *uint64) (bool, error)

UnlockAccount will unlock the account associated with the given address with the given password for duration seconds. If duration is nil it will use a default of 300 seconds. It returns an indication if the account was unlocked.

type PrivateDebugAPI

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

PrivateDebugAPI is the collection of Ethereum APIs exposed over the private debugging endpoint.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(b Backend) *PrivateDebugAPI

NewPrivateDebugAPI creates a new API definition for the private debug methods of the Ethereum service.

func (*PrivateDebugAPI) ChaindbCompact

func (api *PrivateDebugAPI) ChaindbCompact() error

func (*PrivateDebugAPI) ChaindbProperty

func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error)

ChaindbProperty returns leveldb properties of the chain database.

func (*PrivateDebugAPI) SetHead

func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64)

SetHead rewinds the head of the blockchain to a previous block.

type ProofServiceApi

type ProofServiceApi struct {
}

func NewProofServiceApi

func NewProofServiceApi() *ProofServiceApi

func (*ProofServiceApi) Fee

func (nodeApi *ProofServiceApi) Fee() map[string]hexutil.Big

func (*ProofServiceApi) FindTxHash

func (nodeApi *ProofServiceApi) FindTxHash(hash common.Hash) common.Hash

func (*ProofServiceApi) SubmitProofWork

func (nodeApi *ProofServiceApi) SubmitProofWork(tx *stx.T, param *txtool.GTxParam) error

type PublicAbiAPI

type PublicAbiAPI struct {
}

func (*PublicAbiAPI) PackConstruct

func (s *PublicAbiAPI) PackConstruct(abi *abi.ABI, data hexutil.Bytes, args []string) (hexutil.Bytes, error)

func (*PublicAbiAPI) PackMethod

func (s *PublicAbiAPI) PackMethod(abi *abi.ABI, contractAddr ContractAddress, methodName string, args []string) (hexutil.Bytes, error)

func (*PublicAbiAPI) UnPack

func (s *PublicAbiAPI) UnPack(abi *abi.ABI, name string, output hexutil.Bytes) (interface{}, error)

type PublicAccountAPI

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

PublicAccountAPI provides an API to access accounts managed by this node. It offers only methods that can retrieve accounts.

func NewPublicAccountAPI

func NewPublicAccountAPI(am *accounts.Manager) *PublicAccountAPI

NewPublicAccountAPI creates a new PublicAccountAPI.

func (*PublicAccountAPI) Accounts

func (s *PublicAccountAPI) Accounts() []address.PKAddress

Accounts returns the collection of accounts this node manages

func (*PublicAccountAPI) GetTk

func (*PublicAccountAPI) IsMinePKr

func (s *PublicAccountAPI) IsMinePKr(Pkr PKrAddress) *address.PKAddress

type PublicBlockChainAPI

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

PublicBlockChainAPI provides an API to access the Ethereum blockchain. It offers only methods that operate on public data that is freely available to anyone.

func NewPublicBlockChainAPI

func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI

NewPublicBlockChainAPI creates a new Ethereum blockchain API.

func (*PublicBlockChainAPI) BlockNumber

func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64

BlockNumber returns the block number of the chain head.

func (*PublicBlockChainAPI) Call

func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

Call executes the given transaction on the state for the given block number. It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.

func (*PublicBlockChainAPI) ConvertAddressParams

func (s *PublicBlockChainAPI) ConvertAddressParams(ctx context.Context, rand *c_type.Uint128, addresses []AllBase58Adrress, dy bool) (*ConvertAddress, error)

func (*PublicBlockChainAPI) CurrencyToContractAddress

func (s *PublicBlockChainAPI) CurrencyToContractAddress(ctx context.Context, cy Smbol) (*ContractAddress, error)

func (*PublicBlockChainAPI) EstimateGas

func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)

EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.

func (*PublicBlockChainAPI) GenIndexPKr

func (s *PublicBlockChainAPI) GenIndexPKr(ctx context.Context, Pk address.PKAddress, index uint64) (PKrAddress, error)

func (*PublicBlockChainAPI) GenIndexPKrByTk

func (s *PublicBlockChainAPI) GenIndexPKrByTk(ctx context.Context, Tk address.TKAddress, index uint64) (PKrAddress, error)

func (*PublicBlockChainAPI) GenOldIndexPKr

func (s *PublicBlockChainAPI) GenOldIndexPKr(ctx context.Context, Pk address.PKAddress, index uint64) (PKrAddress, error)

func (*PublicBlockChainAPI) GenPKr

func (*PublicBlockChainAPI) GetAnchor

func (s *PublicBlockChainAPI) GetAnchor(ctx context.Context, roots []c_type.Uint256) ([]txtool.Witness, error)

func (*PublicBlockChainAPI) GetBalance

func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, addr AllMixedAddress, blockNr rpc.BlockNumber) (Balance, error)

GetBalance returns the amount of wei for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*PublicBlockChainAPI) GetBlockByHash

func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (map[string]interface{}, error)

GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetBlockByNumber

func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

GetBlockByNumber returns the requested block. When blockNr is -1 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetBlockInfo

func (s *PublicBlockChainAPI) GetBlockInfo(ctx context.Context, start hexutil.Uint64, count hexutil.Uint64) ([]txtool.Block, error)

func (*PublicBlockChainAPI) GetBlockRewardByNumber

func (s *PublicBlockChainAPI) GetBlockRewardByNumber(ctx context.Context, blockNr rpc.BlockNumber) [3]hexutil.Big

pow reward

func (*PublicBlockChainAPI) GetBlockTotalRewardByNumber

func (s *PublicBlockChainAPI) GetBlockTotalRewardByNumber(ctx context.Context, blockNr rpc.BlockNumber) hexutil.Big

block reward

func (*PublicBlockChainAPI) GetCode

func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address ContractAddress, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

GetCode returns the code stored at the given address in the state for the given block number.

func (*PublicBlockChainAPI) GetDecimal

func (s *PublicBlockChainAPI) GetDecimal(ctx context.Context, tokenName string) (*hexutil.Uint, error)

func (*PublicBlockChainAPI) GetFullAddress

func (s *PublicBlockChainAPI) GetFullAddress(ctx context.Context, shortAddresses []common.ContractAddress) (map[common.ContractAddress]PKrAddress, error)

func (*PublicBlockChainAPI) GetShortAddress

func (s *PublicBlockChainAPI) GetShortAddress(ctx context.Context, addr AllMixedAddress) hexutil.Bytes

func (*PublicBlockChainAPI) WatchPkg

func (s *PublicBlockChainAPI) WatchPkg(ctx context.Context, id c_type.Uint256, key c_type.Uint256) (map[string]interface{}, error)

* func (s *PublicBlockChainAPI) GetPkg(ctx context.Context, addr common.Address, packed bool, id *c_type.Uint256) (interface{}, error) {

	state, _, err := s.b.StateAndHeaderByNumber(ctx, -1)
	if err != nil {
		return nil, err
	}
	wallets := s.b.AccountManager().Wallets()
	accountAddress := getAccountAddress(addr, s.b)
	if accountAddress == nil {
		return nil, nil
	}

	if state.IsContract(common.BytesToAddress(accountAddress[:])) {
		return nil, errors.New("does not support contract address!")
	}
	// Look up the wallet containing the requested abi
	account := accounts.Account{Address: *accountAddress}
	wallet, err := s.b.AccountManager().Find(account)
	if err != nil {
		return nil, err
	}
	seed := wallet.Accounts()[0].Tk
	pkgs := lstate.CurrentLState().GetPkgs(seed.ToUint512(), packed)
	if len(pkgs) > 0 {
		result := []map[string]interface{}{}
		for _, p := range pkgs {
			pkg := map[string]interface{}{}

			pkg["id"] = p.Pkg.Z.Pack.Id
			pkg["packed"] = packed
			to := getLocalAccountAddressByPkr(wallets, common.BytesToAddress(p.Pkg.Z.Pack.PKr[:]))
			if to != nil {
				pkg["to_addr"] = to
			} else {
				pkg["to"] = common.BytesToAddress(p.Pkg.Z.Pack.PKr[:]).String()
			}
			if (p.Key != c_type.Uint256{}) {
				pkg["key"] = p.Key
				asset := map[string]interface{}{}
				if p.Pkg.O.Asset.Tkn != nil {
					tkn := map[string]interface{}{}
					tkn["currency"] = strings.Trim(string(p.Pkg.O.Asset.Tkn.Currency[:]), zerobyte)
					tkn["value"] = p.Pkg.O.Asset.Tkn.Value
					asset["tkn"] = tkn
				}
				if p.Pkg.O.Asset.Tkt != nil {
					tkt := map[string]interface{}{}
					tkt["category"] = strings.Trim(string(p.Pkg.O.Asset.Tkt.Category[:]), zerobyte)
					tkt["value"] = p.Pkg.O.Asset.Tkt.Value
					asset["tkt"] = tkt
				}

				pkg["asset"] = asset

			}
			if id != nil {
				if p.Pkg.Z.Pack.Id == *id {
					return pkg, nil
				} else {
					continue
				}
			} else {
				result = append(result, pkg)
			}

		}
		return result, nil
	}
	return nil, nil
}

*

type PublicDebugAPI

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

PublicDebugAPI is the collection of Ethereum APIs exposed over the public debugging endpoint.

func NewPublicDebugAPI

func NewPublicDebugAPI(b Backend) *PublicDebugAPI

NewPublicDebugAPI creates a new API definition for the public debug methods of the Ethereum service.

func (*PublicDebugAPI) GetBlockRlp

func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (string, error)

GetBlockRlp retrieves the RLP encoded for of a single block.

func (*PublicDebugAPI) PrintBlock

func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)

PrintBlock retrieves a block and returns its pretty printed form.

func (*PublicDebugAPI) SeedHash

func (api *PublicDebugAPI) SeedHash(ctx context.Context, number uint64) (string, error)

SeedHash retrieves the seed hash of a block.

type PublicEthereumAPI

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

PublicEthereumAPI provides an API to access Ethereum related information. It offers only methods that operate on public data that is freely available to anyone.

func NewPublicEthereumAPI

func NewPublicEthereumAPI(b Backend) *PublicEthereumAPI

NewPublicEthereumAPI creates a new Ethereum protocol API.

func (*PublicEthereumAPI) GasPrice

func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)

GasPrice returns a suggestion for a gas price.

func (*PublicEthereumAPI) ProtocolVersion

func (s *PublicEthereumAPI) ProtocolVersion() hexutil.Uint

ProtocolVersion returns the current Ethereum protocol version this node supports

func (*PublicEthereumAPI) Syncing

func (s *PublicEthereumAPI) Syncing() (interface{}, error)

Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not yet received the latest block headers from its pears. In case it is synchronizing: - startingBlock: block number this node started to synchronise from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled

type PublicExchangeAPI

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

func (*PublicExchangeAPI) ClearUsedFlag

func (s *PublicExchangeAPI) ClearUsedFlag(ctx context.Context, pk address.PKAddress) (count int, e error)

func (*PublicExchangeAPI) ClearUsedFlagForRoot

func (s *PublicExchangeAPI) ClearUsedFlagForRoot(ctx context.Context, roots []c_type.Uint256) (count int, e error)

func (*PublicExchangeAPI) CommitTx

func (s *PublicExchangeAPI) CommitTx(ctx context.Context, args *txtool.GTx) error

func (*PublicExchangeAPI) FindRoots

func (s *PublicExchangeAPI) FindRoots(pk address.PKAddress, cy Smbol, amount Big) (map[string]interface{}, error)

func (*PublicExchangeAPI) GenMergeTx

func (s *PublicExchangeAPI) GenMergeTx(ctx context.Context, args MergeArgs) (txParam *txtool.GTxParam, e error)

func (*PublicExchangeAPI) GenTx

func (s *PublicExchangeAPI) GenTx(ctx context.Context, param GenTxArgs) (*txtool.GTxParam, error)

func (*PublicExchangeAPI) GenTxWithSign

func (s *PublicExchangeAPI) GenTxWithSign(ctx context.Context, param GenTxArgs) (*txtool.GTx, error)

func (*PublicExchangeAPI) GetBalances

func (s *PublicExchangeAPI) GetBalances(ctx context.Context, pk address.PKAddress) map[string]interface{}

func (*PublicExchangeAPI) GetBlockByNumber

func (s *PublicExchangeAPI) GetBlockByNumber(ctx context.Context, blockNum *int64) (map[string]interface{}, error)

func (*PublicExchangeAPI) GetBlocksInfo

func (s *PublicExchangeAPI) GetBlocksInfo(ctx context.Context, start, end uint64) (blocks []Block, err error)

func (*PublicExchangeAPI) GetLockedBalances

func (s *PublicExchangeAPI) GetLockedBalances(pk address.PKAddress) map[string]*Big

func (*PublicExchangeAPI) GetMaxAvailable

func (s *PublicExchangeAPI) GetMaxAvailable(pk address.PKAddress, currency Smbol) (amount *Big)

func (*PublicExchangeAPI) GetOut

func (s *PublicExchangeAPI) GetOut(ctx context.Context, root c_type.Uint256) *prepare.Utxo

func (*PublicExchangeAPI) GetPkByPkr

func (s *PublicExchangeAPI) GetPkByPkr(ctx context.Context, pkr PKrAddress) (*address.PKAddress, error)

func (*PublicExchangeAPI) GetPkSynced

func (s *PublicExchangeAPI) GetPkSynced(ctx context.Context, pk *address.PKAddress) (map[string]interface{}, error)

func (*PublicExchangeAPI) GetPkr

func (s *PublicExchangeAPI) GetPkr(ctx context.Context, pk address.PKAddress, index *c_type.Uint256) (pkrAdd PKrAddress, e error)

func (*PublicExchangeAPI) GetRecords

func (s *PublicExchangeAPI) GetRecords(ctx context.Context, begin, end uint64, address *MixAdrress) (records []Record, err error)

func (*PublicExchangeAPI) GetTx

func (s *PublicExchangeAPI) GetTx(ctx context.Context, txHash c_type.Uint256) (map[string]interface{}, error)

func (*PublicExchangeAPI) IgnorePkrUtxos

func (s *PublicExchangeAPI) IgnorePkrUtxos(ctx context.Context, pkr PKrAddress, ignore bool) (utxos []exchange.Utxo, e error)

func (*PublicExchangeAPI) Merge

func (s *PublicExchangeAPI) Merge(ctx context.Context, pk *address.PKAddress, cy Smbol) (map[string]interface{}, error)

func (*PublicExchangeAPI) Pk2Pkr

func (*PublicExchangeAPI) Seed2Sk

func (s *PublicExchangeAPI) Seed2Sk(ctx context.Context, seed hexutil.Bytes, v *int) (c_type.Uint512, error)

func (*PublicExchangeAPI) SetBalancePkr

func (s *PublicExchangeAPI) SetBalancePkr(ctx context.Context, pkr PKrAddress) error

func (*PublicExchangeAPI) SignTxWithSk

func (s *PublicExchangeAPI) SignTxWithSk(param txtool.GTxParam, SK c_type.Uint512) (txtool.GTx, error)

func (*PublicExchangeAPI) Sk2Tk

func (s *PublicExchangeAPI) Sk2Tk(ctx context.Context, sk c_type.Uint512) (ret address.TKAddress, err error)

func (*PublicExchangeAPI) Tk2Pk

func (*PublicExchangeAPI) ValidAddress

func (s *PublicExchangeAPI) ValidAddress(ctx context.Context, addr address.MixBase58Adrress) (bool, error)

type PublicFlightAPI

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

func (*PublicFlightAPI) CommitTx

func (s *PublicFlightAPI) CommitTx(ctx context.Context, args *txtool.GTx) error

func (*PublicFlightAPI) GenTxParam

func (s *PublicFlightAPI) GenTxParam(ctx context.Context, param PreTxParamArgs, tk address.TKAddress) (p txtool.GTxParam, e error)

func (*PublicFlightAPI) GetBlockByNumber

func (s *PublicFlightAPI) GetBlockByNumber(ctx context.Context, blockNum *int64) (map[string]interface{}, error)

func (*PublicFlightAPI) GetBlocksInfo

func (s *PublicFlightAPI) GetBlocksInfo(ctx context.Context, start uint64, count uint64) ([]txtool.Block, error)

func (*PublicFlightAPI) GetOut

func (s *PublicFlightAPI) GetOut(ctx context.Context, root c_type.Uint256) (out *txtool.Out, e error)

func (*PublicFlightAPI) GetTx

func (s *PublicFlightAPI) GetTx(ctx context.Context, txhash c_type.Uint256) (gtx txtool.GTx, e error)

func (*PublicFlightAPI) GetTxReceipt

func (s *PublicFlightAPI) GetTxReceipt(ctx context.Context, txhash c_type.Uint256) (ret *TxReceipt, e error)

func (*PublicFlightAPI) Trace2Root

func (s *PublicFlightAPI) Trace2Root(ctx context.Context, tk address.TKAddress, trace c_type.Uint256, base c_type.Uint256) (root c_type.Uint256, e error)

type PublicLightNodeApi

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

func (PublicLightNodeApi) CheckNil

func (plna PublicLightNodeApi) CheckNil(Nils []c_type.Uint256) (nilResps []light.NilValue, e error)

func (PublicLightNodeApi) GetOutsByPKr

func (plna PublicLightNodeApi) GetOutsByPKr(ctx context.Context, addresses []*MixAdrress, start, end uint64) (outBlockResp light.BlockOutResp, e error)

func (PublicLightNodeApi) GetPendingOuts

func (plna PublicLightNodeApi) GetPendingOuts(ctx context.Context, addresses []*PKrAddress) (outBlockResp light.BlockOutResp, e error)

type PublicLocalAPI

type PublicLocalAPI struct {
}

func (*PublicLocalAPI) ConfirmOutC

func (s *PublicLocalAPI) ConfirmOutC(ctx context.Context, key c_type.Uint256, outc tx.Out_C) (dout txtool.TDOut, e error)

func (*PublicLocalAPI) CurrencyToId

func (s *PublicLocalAPI) CurrencyToId(ctx context.Context, currency string) (ret c_type.Uint256, e error)

func (*PublicLocalAPI) DecOut

func (s *PublicLocalAPI) DecOut(ctx context.Context, outs []txtool.Out, tk address.TKAddress) (douts []txtool.TDOut, e error)

func (*PublicLocalAPI) GenSeed

func (s *PublicLocalAPI) GenSeed(ctx context.Context) (hexutil.Bytes, error)

func (*PublicLocalAPI) IdToCurrency

func (s *PublicLocalAPI) IdToCurrency(ctx context.Context, hex c_type.Uint256) (ret string, e error)

func (*PublicLocalAPI) IsMyPkr

func (s *PublicLocalAPI) IsMyPkr(ctx context.Context, tk address.TKAddress, pkr PKrAddress) (ret bool, e error)

func (*PublicLocalAPI) IsPkValid

func (s *PublicLocalAPI) IsPkValid(ctx context.Context, tk address.PKAddress) error

func (*PublicLocalAPI) IsPkrValid

func (s *PublicLocalAPI) IsPkrValid(ctx context.Context, tk PKrAddress) error

func (*PublicLocalAPI) Pk2Pkr

func (*PublicLocalAPI) Seed2Mnemonic

func (s *PublicLocalAPI) Seed2Mnemonic(ctx context.Context, seed hexutil.Bytes) (string, error)

func (*PublicLocalAPI) Seed2Sk

func (s *PublicLocalAPI) Seed2Sk(ctx context.Context, seed hexutil.Bytes, v *int) (c_type.Uint512, error)

func (*PublicLocalAPI) SignTxWithSk

func (s *PublicLocalAPI) SignTxWithSk(param txtool.GTxParam, SK c_type.Uint512) (txtool.GTx, error)

func (*PublicLocalAPI) Sk2Tk

func (s *PublicLocalAPI) Sk2Tk(ctx context.Context, sk c_type.Uint512) (ret address.TKAddress, err error)

func (*PublicLocalAPI) Tk2Pk

func (s *PublicLocalAPI) Tk2Pk(ctx context.Context, tk address.TKAddress) (ret address.PKAddress, err error)

type PublicNetAPI

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

PublicNetAPI offers network related RPC methods

func NewPublicNetAPI

func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI

NewPublicNetAPI creates a new net API instance.

func (*PublicNetAPI) Listening

func (s *PublicNetAPI) Listening() bool

Listening returns an indication if the node is listening for network connections.

func (*PublicNetAPI) PeerCount

func (s *PublicNetAPI) PeerCount() hexutil.Uint

PeerCount returns the number of connected peers

func (*PublicNetAPI) Version

func (s *PublicNetAPI) Version() string

Version returns the current ethereum protocol version.

type PublicSSIAPI

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

func (*PublicSSIAPI) CommitTx

func (s *PublicSSIAPI) CommitTx(ctx context.Context, txhash c_type.Uint256) (e error)

func (*PublicSSIAPI) CreateKr

func (s *PublicSSIAPI) CreateKr() (kr txtool.Kr)

func (*PublicSSIAPI) Detail

func (s *PublicSSIAPI) Detail(ctx context.Context, roots []c_type.Uint256, skr *c_type.PKr) (douts []txtool.DOut, e error)

func (*PublicSSIAPI) GenTx

func (s *PublicSSIAPI) GenTx(ctx context.Context, param *ssi.PreTxParam) (hash c_type.Uint256, e error)

func (*PublicSSIAPI) GetBlocksInfo

func (s *PublicSSIAPI) GetBlocksInfo(ctx context.Context, start hexutil.Uint64, count hexutil.Uint64) ([]ssi.Block, error)

func (*PublicSSIAPI) GetTx

func (s *PublicSSIAPI) GetTx(ctx context.Context, txhash c_type.Uint256) (tx *txtool.GTx, e error)

func (*PublicSSIAPI) SzkCreateKr

func (s *PublicSSIAPI) SzkCreateKr() (kr txtool.Kr)

type PublicStakeApI

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

func NewPublicStakeApI

func NewPublicStakeApI(b Backend, nonceLock *AddrLocker) *PublicStakeApI

func (*PublicStakeApI) BuyShare

func (s *PublicStakeApI) BuyShare(ctx context.Context, args BuyShareTxArg) (common.Hash, error)

func (*PublicStakeApI) CloseStakePool

func (s *PublicStakeApI) CloseStakePool(ctx context.Context, from address.MixBase58Adrress) (common.Hash, error)

func (*PublicStakeApI) EstimateShares

func (s *PublicStakeApI) EstimateShares(ctx context.Context, args BuyShareTxArg) (map[string]interface{}, error)

func (*PublicStakeApI) GetShare

func (s *PublicStakeApI) GetShare(ctx context.Context, shareId common.Hash) map[string]interface{}

func (*PublicStakeApI) GetShareAtNumber

func (s *PublicStakeApI) GetShareAtNumber(ctx context.Context, shareId common.Hash, num hexutil.Uint64) (share *stake.Share)

func (*PublicStakeApI) GetShareByPkr

func (s *PublicStakeApI) GetShareByPkr(ctx context.Context, pkr PKrAddress) []map[string]interface{}

func (*PublicStakeApI) GetShareByPkrV2

func (s *PublicStakeApI) GetShareByPkrV2(ctx context.Context, pkr PKrAddress) map[string]interface{}

func (*PublicStakeApI) GetStakeInfo

func (s *PublicStakeApI) GetStakeInfo(ctx context.Context, poolId common.Hash, start, end hexutil.Uint64) (ret map[string][]interface{})

func (*PublicStakeApI) ModifyStakePoolFee

func (s *PublicStakeApI) ModifyStakePoolFee(ctx context.Context, from address.MixBase58Adrress, fee hexutil.Uint64) (common.Hash, error)

func (*PublicStakeApI) ModifyStakePoolVote

func (s *PublicStakeApI) ModifyStakePoolVote(ctx context.Context, from address.MixBase58Adrress, vote address.MixBase58Adrress) (common.Hash, error)

func (*PublicStakeApI) MyShare

func (s *PublicStakeApI) MyShare(ctx context.Context, addr address.MixBase58Adrress) []map[string]interface{}

func (*PublicStakeApI) MyShareV2

func (s *PublicStakeApI) MyShareV2(ctx context.Context, addr address.MixBase58Adrress) map[string]interface{}

func (*PublicStakeApI) PoolState

func (s *PublicStakeApI) PoolState(ctx context.Context, poolId common.Hash) (map[string]interface{}, error)

func (*PublicStakeApI) RegistStakePool

func (s *PublicStakeApI) RegistStakePool(ctx context.Context, args RegistStakePoolTxArg) (common.Hash, error)

func (*PublicStakeApI) SharePoolSize

func (s *PublicStakeApI) SharePoolSize(ctx context.Context) (hexutil.Uint64, error)

func (*PublicStakeApI) SharePrice

func (s *PublicStakeApI) SharePrice(ctx context.Context) (*hexutil.Big, error)

func (*PublicStakeApI) Shares

func (s *PublicStakeApI) Shares(ctx context.Context) (shares []*stake.Share)

func (*PublicStakeApI) StakePools

func (s *PublicStakeApI) StakePools(ctx context.Context) []map[string]interface{}

type PublicTransactionPoolAPI

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

PublicTransactionPoolAPI exposes methods for the RPC interface

func NewPublicTransactionPoolAPI

func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransactionPoolAPI

NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.

func (*PublicTransactionPoolAPI) AddressUnlocked

func (s *PublicTransactionPoolAPI) AddressUnlocked(accountAddr address.MixBase58Adrress) (bool, error)

func (*PublicTransactionPoolAPI) CommitContractTx

func (s *PublicTransactionPoolAPI) CommitContractTx(ctx context.Context, args *txtool.GTx) (hash common.Hash, err error)

func (*PublicTransactionPoolAPI) CommitTx

func (s *PublicTransactionPoolAPI) CommitTx(ctx context.Context, args *txtool.GTx) error

func (*PublicTransactionPoolAPI) GenTx

func (*PublicTransactionPoolAPI) GetBlockTransactionCountByHash

func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.

func (*PublicTransactionPoolAPI) GetBlockTransactionCountByNumber

func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.

func (*PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex

func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes

GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.

func (*PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex

func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes

GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.

func (*PublicTransactionPoolAPI) GetRawTransactionByHash

func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

GetRawTransactionByHash returns the bytes of the transaction for the given hash.

func (*PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex

func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction

GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.

func (*PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex

func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction

GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.

func (*PublicTransactionPoolAPI) GetTransactionByHash

func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction

GetTransactionByHash returns the transaction for the given hash

func (*PublicTransactionPoolAPI) GetTransactionReceipt

func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the transaction receipt for the given transaction hash.

func (*PublicTransactionPoolAPI) PendingTransactions

func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)

PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.

func (*PublicTransactionPoolAPI) ReSendTransaction

func (s *PublicTransactionPoolAPI) ReSendTransaction(ctx context.Context, txhash common.Hash) (common.Hash, error)

func (*PublicTransactionPoolAPI) SendTransaction

func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)

SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.

type PublicTxPoolAPI

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

PublicTxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential.

func NewPublicTxPoolAPI

func NewPublicTxPoolAPI(b Backend) *PublicTxPoolAPI

NewPublicTxPoolAPI creates a new tx pool service that gives information about the transaction pool.

func (*PublicTxPoolAPI) Content

func (s *PublicTxPoolAPI) Content() map[string]map[string]*RPCTransaction

func (*PublicTxPoolAPI) Inspect

func (s *PublicTxPoolAPI) Inspect() map[string]map[string]string

func (*PublicTxPoolAPI) Status

func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint

Status returns the number of pending and queued transaction in the pool.

type RPCStatisticsShare

type RPCStatisticsShare struct {
	Address     interface{}   `json:"addr"`
	VoteAddress []interface{} `json:"voteAddr"`
	Total       uint32        `json:"total"`
	Remaining   uint32        `json:"remaining"`
	Missed      uint32        `json:"missed"`
	Expired     uint32        `json:"expired"`
	ShareIds    []common.Hash `json:"shareIds"`
	Pools       []common.Hash `json:"pools"`
	Profit      *big.Int      `json:"profit"`
	TotalAmount *big.Int      `json:"totalAmount"`
}

type RPCTransaction

type RPCTransaction struct {
	BlockHash        common.Hash     `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	From             PKrAddress      `json:"from"`
	Gas              hexutil.Uint64  `json:"gas"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	Hash             common.Hash     `json:"hash"`
	Input            hexutil.Bytes   `json:"input"`
	Nonce            hexutil.Uint64  `json:"nonce"`
	To               *common.Address `json:"to"`
	TransactionIndex hexutil.Uint    `json:"transactionIndex"`
	Value            *hexutil.Big    `json:"value"`
	Stx              *stx.T          `json:"stx"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

type ReceptionArgs

type ReceptionArgs struct {
	Addr     MixAdrress
	Currency Smbol
	Value    *Big
}

type Record

type Record struct {
	Pkr      PKrAddress
	Root     c_type.Uint256
	TxHash   c_type.Uint256
	Nil      c_type.Uint256
	Num      uint64
	Currency string
	Value    *Big
}

type RegistPoolArgs

type RegistPoolArgs struct {
	Value   utils.U256
	Vote    PKrAddress
	FeeRate uint32
}

type RegistStakePoolTxArg

type RegistStakePoolTxArg struct {
	From     address.MixBase58Adrress  `json:"from"`
	Vote     *address.MixBase58Adrress `json:"vote"`
	Gas      *hexutil.Uint64           `json:"gas"`
	GasPrice *hexutil.Big              `json:"gasPrice"`
	Value    *hexutil.Big              `json:"value"`
	Fee      *hexutil.Uint             `json:"fee"`
}

type SRC20Decimal

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

func NewSRC20Decimal

func NewSRC20Decimal(tokenName string) []SRC20Decimal

func (SRC20Decimal) Pack

func (d SRC20Decimal) Pack() ([]byte, error)

func (SRC20Decimal) Unpack

func (d SRC20Decimal) Unpack(outData []byte) (*uint8, error)

type SRCAbi

type SRCAbi interface {
	Pack() ([]byte, error)
	Unpack(outData []byte) (*uint8, error)
}

type SendTxArgs

type SendTxArgs struct {
	From        address.MixBase58Adrress `json:"from"`
	To          *AllBase58Adrress        `json:"to"`
	Gas         *hexutil.Uint64          `json:"gas"`
	GasCurrency Smbol                    `json:"gasCy"` // default DECE
	GasPrice    *hexutil.Big             `json:"gasPrice"`
	Value       *hexutil.Big             `json:"value"`
	Data        *hexutil.Bytes           `json:"data"`
	Currency    Smbol                    `json:"cy"`
	Dynamic     bool                     `json:"dy"` // contract address parameters are dynamically generated.
	Category    Smbol                    `json:"catg"`
	Tkt         *common.Hash             `json:"tkt"`
	Memo        string                   `json:"Memo"`
}

SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.

type Smbol

type Smbol string

func (*Smbol) IsEmpty

func (s *Smbol) IsEmpty() bool

func (*Smbol) IsNotEmpty

func (s *Smbol) IsNotEmpty() bool

func (*Smbol) IsNotSero

func (s *Smbol) IsNotSero() bool

func (*Smbol) IsSero

func (s *Smbol) IsSero() bool

func (Smbol) MarshalText

func (s Smbol) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Smbol) String

func (s Smbol) String() string

func (*Smbol) UnmarshalText

func (s *Smbol) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type StakePool

type StakePool struct {
	PKr             c_type.PKr
	VotePKr         c_type.PKr
	TransactionHash common.Hash
	Amount          *big.Int `rlp:"nil"`
	Fee             uint16
	ShareNum        uint32
	ChoicedNum      uint32
	MissedNum       uint32
	WishVotNum      uint32
	Profit          *big.Int `rlp:"nil"`
	LastPayTime     uint64
	Closed          bool
}

type StructLogRes

type StructLogRes struct {
	Pc      uint64             `json:"pc"`
	Op      string             `json:"op"`
	Gas     uint64             `json:"gas"`
	GasCost uint64             `json:"gasCost"`
	Depth   int                `json:"depth"`
	Error   error              `json:"error,omitempty"`
	Stack   *[]string          `json:"stack,omitempty"`
	Memory  *[]string          `json:"memory,omitempty"`
	Storage *map[string]string `json:"storage,omitempty"`
}

StructLogRes stores a structured log emitted by the EVM while replaying a transaction in debug mode

func FormatLogs

func FormatLogs(logs []vm.StructLog) []StructLogRes

formatLogs formats EVM returned structured logs for json output

type TransferPkgArgs

type TransferPkgArgs struct {
	From     *address.MixBase58Adrress `json:"from"`
	Gas      *hexutil.Uint64           `json:"gas"`
	GasPrice *hexutil.Big              `json:"gasPrice"`
	PkgId    *c_type.Uint256           `json:"id"`
	To       *AllBase58Adrress         `json:"To"`
}

type TxReceipt

type TxReceipt struct {
	State   uint64
	TxHash  c_type.Uint256
	BNum    uint64
	BHash   c_type.Uint256
	Outs    []c_type.Uint256
	Nils    []c_type.Uint256
	Pkgs    []c_type.Uint256
	ShareId *c_type.Uint256
	PoolId  *c_type.Uint256
}

Jump to

Keyboard shortcuts

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