Documentation ¶
Overview ¶
Package ethapi implements the general Ethereum API functions.
Index ¶
- Variables
- func GetAPIs(apiBackend Backend) []rpc.API
- func GetBlockReward(block *types.Block) [2]*big.Int
- func IsContract(b []byte) (bool, error)
- func MixAdrressToPkr(addr MixAdrress) c_type.PKr
- func PackConstruct(abi *abi.ABI, data hexutil.Bytes, args []string) (hexutil.Bytes, error)
- func PackMethod(abi *abi.ABI, contractAddr ContractAddress, methodName string, args []string) (hexutil.Bytes, error)
- func PkrToString(pkr c_type.PKr) string
- func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)
- func UnPack(abi *abi.ABI, name string, output hexutil.Bytes) (interface{}, error)
- type AddrLocker
- type AllBase58Adrress
- type AllMixedAddress
- type Backend
- type Balance
- type Big
- type Block
- type BuyShareArgs
- type BuyShareTxArg
- type CallArgs
- type ClosePkgArgs
- type ClosePoolArgs
- type CmdsArgs
- type ContractAddress
- type ContractArgs
- type ConvertAddress
- type ExecutionResult
- type GOutArgs
- type GenTxArgs
- type MergeArgs
- type MixAdrress
- type PKrAddress
- type PkgCloseArgs
- type PkgCreateArgs
- type PkgTransferArgs
- type PreTxParamArgs
- type PrivateAccountAPI
- func (s *PrivateAccountAPI) ExportMnemonic(addr address.MixBase58Adrress, password string) (string, error)
- func (s *PrivateAccountAPI) ExportRawKey(addr address.MixBase58Adrress, password string) (hexutil.Bytes, error)
- func (s *PrivateAccountAPI) GenSeed() (hexutil.Bytes, error)
- func (s *PrivateAccountAPI) ImportMnemonic(mnemonic string, password string, a *uint64) (address.PKAddress, error)
- func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string, v *int, a *uint64) (address.PKAddress, error)
- func (s *PrivateAccountAPI) ImportTk(tk address.TKAddress, a *uint64) (address.PKAddress, error)
- func (s *PrivateAccountAPI) ListAccounts() []address.PKAddress
- func (s *PrivateAccountAPI) ListWallets() []rawWallet
- func (s *PrivateAccountAPI) LockAccount(addr address.MixBase58Adrress) bool
- func (s *PrivateAccountAPI) NewAccount(password string) (address.PKAddress, error)
- func (s *PrivateAccountAPI) NewAccountWithMnemonic(password string) (map[string]interface{}, error)
- func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
- func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
- func (s *PrivateAccountAPI) UnlockAccount(addr address.MixBase58Adrress, password string, duration *uint64) (bool, error)
- type PrivateDebugAPI
- type ProofServiceApi
- type PublicAbiAPI
- func (s *PublicAbiAPI) PackConstruct(abi *abi.ABI, data hexutil.Bytes, args []string) (hexutil.Bytes, error)
- func (s *PublicAbiAPI) PackMethod(abi *abi.ABI, contractAddr ContractAddress, methodName string, args []string) (hexutil.Bytes, error)
- func (s *PublicAbiAPI) UnPack(abi *abi.ABI, name string, output hexutil.Bytes) (interface{}, error)
- type PublicAccountAPI
- type PublicBlockChainAPI
- func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
- func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) ConvertAddressParams(ctx context.Context, rand *c_type.Uint128, addresses []AllBase58Adrress, ...) (*ConvertAddress, error)
- func (s *PublicBlockChainAPI) CurrencyToContractAddress(ctx context.Context, cy Smbol) (*ContractAddress, error)
- func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)
- func (s *PublicBlockChainAPI) GenIndexPKr(ctx context.Context, Pk address.PKAddress, index uint64) (PKrAddress, error)
- func (s *PublicBlockChainAPI) GenIndexPKrByTk(ctx context.Context, Tk address.TKAddress, index uint64) (PKrAddress, error)
- func (s *PublicBlockChainAPI) GenOldIndexPKr(ctx context.Context, Pk address.PKAddress, index uint64) (PKrAddress, error)
- func (s *PublicBlockChainAPI) GenPKr(ctx context.Context, Pk address.PKAddress) (PKrAddress, error)
- func (s *PublicBlockChainAPI) GetAnchor(ctx context.Context, roots []c_type.Uint256) ([]txtool.Witness, error)
- func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, addr AllMixedAddress, blockNr rpc.BlockNumber) (Balance, error)
- func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockInfo(ctx context.Context, start hexutil.Uint64, count hexutil.Uint64) ([]txtool.Block, error)
- func (s *PublicBlockChainAPI) GetBlockRewardByNumber(ctx context.Context, blockNr rpc.BlockNumber) [3]hexutil.Big
- func (s *PublicBlockChainAPI) GetBlockTotalRewardByNumber(ctx context.Context, blockNr rpc.BlockNumber) hexutil.Big
- func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address ContractAddress, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetDecimal(ctx context.Context, tokenName string) (*hexutil.Uint, error)
- func (s *PublicBlockChainAPI) GetFullAddress(ctx context.Context, shortAddresses []common.ContractAddress) (map[common.ContractAddress]PKrAddress, error)
- func (s *PublicBlockChainAPI) WatchPkg(ctx context.Context, id c_type.Uint256, key c_type.Uint256) (map[string]interface{}, error)
- type PublicDebugAPI
- type PublicEthereumAPI
- type PublicExchangeAPI
- func (s *PublicExchangeAPI) ClearUsedFlag(ctx context.Context, pk address.PKAddress) (count int, e error)
- func (s *PublicExchangeAPI) ClearUsedFlagForRoot(ctx context.Context, roots []c_type.Uint256) (count int, e error)
- func (s *PublicExchangeAPI) CommitTx(ctx context.Context, args *txtool.GTx) error
- func (s *PublicExchangeAPI) FindRoots(pk address.PKAddress, cy Smbol, amount Big) (map[string]interface{}, error)
- func (s *PublicExchangeAPI) GenMergeTx(ctx context.Context, args MergeArgs) (txParam *txtool.GTxParam, e error)
- func (s *PublicExchangeAPI) GenTx(ctx context.Context, param GenTxArgs) (*txtool.GTxParam, error)
- func (s *PublicExchangeAPI) GenTxWithSign(ctx context.Context, param GenTxArgs) (*txtool.GTx, error)
- func (s *PublicExchangeAPI) GetBalances(ctx context.Context, pk address.PKAddress) map[string]interface{}
- func (s *PublicExchangeAPI) GetBlockByNumber(ctx context.Context, blockNum *int64) (map[string]interface{}, error)
- func (s *PublicExchangeAPI) GetBlocksInfo(ctx context.Context, start, end uint64) (blocks []Block, err error)
- func (s *PublicExchangeAPI) GetLockedBalances(pk address.PKAddress) map[string]*Big
- func (s *PublicExchangeAPI) GetMaxAvailable(pk address.PKAddress, currency Smbol) (amount *Big)
- func (s *PublicExchangeAPI) GetOut(ctx context.Context, root c_type.Uint256) *prepare.Utxo
- func (s *PublicExchangeAPI) GetPkByPkr(ctx context.Context, pkr PKrAddress) (*address.PKAddress, error)
- func (s *PublicExchangeAPI) GetPkSynced(ctx context.Context, pk *address.PKAddress) (map[string]interface{}, error)
- func (s *PublicExchangeAPI) GetPkr(ctx context.Context, pk address.PKAddress, index *c_type.Uint256) (pkrAdd PKrAddress, e error)
- func (s *PublicExchangeAPI) GetRecords(ctx context.Context, begin, end uint64, address *MixAdrress) (records []Record, err error)
- func (s *PublicExchangeAPI) GetTx(ctx context.Context, txHash c_type.Uint256) (map[string]interface{}, error)
- func (s *PublicExchangeAPI) IgnorePkrUtxos(ctx context.Context, pkr PKrAddress, ignore bool) (utxos []exchange.Utxo, e error)
- func (s *PublicExchangeAPI) Merge(ctx context.Context, pk *address.PKAddress, cy Smbol) (map[string]interface{}, error)
- func (s *PublicExchangeAPI) Pk2Pkr(ctx context.Context, pk address.PKAddress, index *c_type.Uint256) (PKrAddress, error)
- func (s *PublicExchangeAPI) Seed2Sk(ctx context.Context, seed hexutil.Bytes, v *int) (c_type.Uint512, error)
- func (s *PublicExchangeAPI) SetBalancePkr(ctx context.Context, pkr PKrAddress) error
- func (s *PublicExchangeAPI) SignTxWithSk(param txtool.GTxParam, SK c_type.Uint512) (txtool.GTx, error)
- func (s *PublicExchangeAPI) Sk2Tk(ctx context.Context, sk c_type.Uint512) (ret address.TKAddress, err error)
- func (s *PublicExchangeAPI) Tk2Pk(ctx context.Context, tk address.TKAddress) (ret address.PKAddress, err error)
- func (s *PublicExchangeAPI) ValidAddress(ctx context.Context, addr address.MixBase58Adrress) (bool, error)
- type PublicFlightAPI
- func (s *PublicFlightAPI) CommitTx(ctx context.Context, args *txtool.GTx) error
- func (s *PublicFlightAPI) GenTxParam(ctx context.Context, param PreTxParamArgs, tk address.TKAddress) (p txtool.GTxParam, e error)
- func (s *PublicFlightAPI) GetBlockByNumber(ctx context.Context, blockNum *int64) (map[string]interface{}, error)
- func (s *PublicFlightAPI) GetBlocksInfo(ctx context.Context, start uint64, count uint64) ([]txtool.Block, error)
- func (s *PublicFlightAPI) GetOut(ctx context.Context, root c_type.Uint256) (out *txtool.Out, e error)
- func (s *PublicFlightAPI) GetTx(ctx context.Context, txhash c_type.Uint256) (gtx txtool.GTx, e error)
- func (s *PublicFlightAPI) GetTxReceipt(ctx context.Context, txhash c_type.Uint256) (ret *TxReceipt, e error)
- func (s *PublicFlightAPI) Trace2Root(ctx context.Context, tk address.TKAddress, trace c_type.Uint256, ...) (root c_type.Uint256, e error)
- type PublicLightNodeApi
- type PublicLocalAPI
- func (s *PublicLocalAPI) ConfirmOutC(ctx context.Context, key c_type.Uint256, outc stx_v1.Out_C) (dout txtool.TDOut, e error)
- func (s *PublicLocalAPI) ConfirmOutZ(ctx context.Context, key c_type.Uint256, outz stx_v0.Out_Z) (dout txtool.TDOut, e error)
- func (s *PublicLocalAPI) CurrencyToId(ctx context.Context, currency string) (ret c_type.Uint256, e error)
- func (s *PublicLocalAPI) DecOut(ctx context.Context, outs []txtool.Out, tk address.TKAddress) (douts []txtool.TDOut, e error)
- func (s *PublicLocalAPI) GenSeed(ctx context.Context) (hexutil.Bytes, error)
- func (s *PublicLocalAPI) IdToCurrency(ctx context.Context, hex c_type.Uint256) (ret string, e error)
- func (s *PublicLocalAPI) IsMyPkr(ctx context.Context, tk address.TKAddress, pkr PKrAddress) (ret bool, e error)
- func (s *PublicLocalAPI) IsPkValid(ctx context.Context, tk address.PKAddress) error
- func (s *PublicLocalAPI) IsPkrValid(ctx context.Context, tk PKrAddress) error
- func (s *PublicLocalAPI) Pk2Pkr(ctx context.Context, pk address.PKAddress, index *c_type.Uint256) (PKrAddress, error)
- func (s *PublicLocalAPI) Seed2Mnemonic(ctx context.Context, seed hexutil.Bytes) (string, error)
- func (s *PublicLocalAPI) Seed2Sk(ctx context.Context, seed hexutil.Bytes, v *int) (c_type.Uint512, error)
- func (s *PublicLocalAPI) SignTxWithSk(param txtool.GTxParam, SK c_type.Uint512) (txtool.GTx, error)
- func (s *PublicLocalAPI) Sk2Tk(ctx context.Context, sk c_type.Uint512) (ret address.TKAddress, err error)
- func (s *PublicLocalAPI) Tk2Pk(ctx context.Context, tk address.TKAddress) (ret address.PKAddress, err error)
- type PublicNetAPI
- type PublicSSIAPI
- func (s *PublicSSIAPI) CommitTx(ctx context.Context, txhash c_type.Uint256) (e error)
- func (s *PublicSSIAPI) CreateKr() (kr txtool.Kr)
- func (s *PublicSSIAPI) Detail(ctx context.Context, roots []c_type.Uint256, skr *c_type.PKr) (douts []txtool.DOut, e error)
- func (s *PublicSSIAPI) GenTx(ctx context.Context, param *ssi.PreTxParam) (hash c_type.Uint256, e error)
- func (s *PublicSSIAPI) GetBlocksInfo(ctx context.Context, start hexutil.Uint64, count hexutil.Uint64) ([]ssi.Block, error)
- func (s *PublicSSIAPI) GetTx(ctx context.Context, txhash c_type.Uint256) (tx *txtool.GTx, e error)
- func (s *PublicSSIAPI) SzkCreateKr() (kr txtool.Kr)
- type PublicStakeApI
- func (s *PublicStakeApI) BuyShare(ctx context.Context, args BuyShareTxArg) (common.Hash, error)
- func (s *PublicStakeApI) CloseStakePool(ctx context.Context, from address.MixBase58Adrress) (common.Hash, error)
- func (s *PublicStakeApI) EstimateShares(ctx context.Context, args BuyShareTxArg) (map[string]interface{}, error)
- func (s *PublicStakeApI) GetShare(ctx context.Context, shareId common.Hash) map[string]interface{}
- func (s *PublicStakeApI) GetShareAtNumber(ctx context.Context, shareId common.Hash, num hexutil.Uint64) (share *stake.Share)
- func (s *PublicStakeApI) GetShareByPkr(ctx context.Context, pkr PKrAddress) []map[string]interface{}
- func (s *PublicStakeApI) GetStakeInfo(ctx context.Context, poolId common.Hash, start, end hexutil.Uint64) (ret map[string][]interface{})
- func (s *PublicStakeApI) ModifyStakePoolFee(ctx context.Context, from address.MixBase58Adrress, fee hexutil.Uint64) (common.Hash, error)
- func (s *PublicStakeApI) ModifyStakePoolVote(ctx context.Context, from address.MixBase58Adrress, ...) (common.Hash, error)
- func (s *PublicStakeApI) MyShare(ctx context.Context, addr address.MixBase58Adrress) []map[string]interface{}
- func (s *PublicStakeApI) PoolState(ctx context.Context, poolId common.Hash) (map[string]interface{}, error)
- func (s *PublicStakeApI) RegistStakePool(ctx context.Context, args RegistStakePoolTxArg) (common.Hash, error)
- func (s *PublicStakeApI) SharePoolSize(ctx context.Context) (hexutil.Uint64, error)
- func (s *PublicStakeApI) SharePrice(ctx context.Context) (*hexutil.Big, error)
- func (s *PublicStakeApI) Shares(ctx context.Context) (shares []*stake.Share)
- func (s *PublicStakeApI) StakePools(ctx context.Context) []map[string]interface{}
- type PublicTransactionPoolAPI
- func (s *PublicTransactionPoolAPI) AddressUnlocked(accountAddr address.MixBase58Adrress) (bool, error)
- func (s *PublicTransactionPoolAPI) CommitTx(ctx context.Context, args *txtool.GTx) error
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
- func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
- func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
- func (s *PublicTransactionPoolAPI) ReSendTransaction(ctx context.Context, txhash common.Hash) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
- type PublicTxPoolAPI
- type RPCStatisticsShare
- type RPCTransaction
- type ReceptionArgs
- type Record
- type RegistPoolArgs
- type RegistStakePoolTxArg
- type SRC20Decimal
- type SRCAbi
- type SendTxArgs
- type Smbol
- type StakePool
- type StructLogRes
- type TransferPkgArgs
- type TxReceipt
Constants ¶
This section is empty.
Variables ¶
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 IsContract ¶
func MixAdrressToPkr ¶
func MixAdrressToPkr(addr MixAdrress) c_type.PKr
func PackConstruct ¶
func PackMethod ¶
func PkrToString ¶
func RPCMarshalBlock ¶
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.
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) 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() serodb.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 Big ¶
func (Big) MarshalJSON ¶
func (*Big) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type BuyShareArgs ¶
type BuyShareArgs struct {}
type BuyShareTxArg ¶
type BuyShareTxArg struct {}
type CallArgs ¶
type CallArgs struct { From *address.MixBase58Adrress `json:"from"` To *AllMixedAddress `json:"to"` GasCurrency Smbol `json:"gasCy"` //default SERO 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"` }
*
func (s *PublicTransactionPoolAPI) CreatePkg(ctx context.Context, args SendTxArgs) (common.Hash, error) { s.nonceLock.mu.Lock() defer s.nonceLock.mu.Unlock() // Look up the wallet containing the requested abi account := accounts.Account{Address: args.From} wallet, err := s.b.AccountManager().Find(account) if err != nil { return common.Hash{}, err } if args.To == nil { return common.Hash{}, errors.New("to can not be nil") } // Set some sanity defaults and terminate on failure if err := args.setDefaults(ctx, s.b); err != nil { return common.Hash{}, err } if args.GasCurrency.IsNotSero() { return common.Hash{}, errors.New("create pkg gasCurrency must be sero") } state, _, err := s.b.StateAndHeaderByNumber(ctx, -1) if err != nil { return common.Hash{}, err } if seroparam.IsExchange() { txParam := args.toCreatePkg(state) pretx, gtx, err := exchange.CurrentExchange().GenTxWithSign(txParam) if err != nil { return common.Hash{}, err } err = s.b.CommitTx(gtx) if err != nil { exchange.CurrentExchange().ClearTxParam(pretx) return common.Hash{}, err } return common.BytesToHash(gtx.Hash[:]), nil } else { // Assemble the transaction and sign with the wallet tx, txt := args.toPkg(state) encrypted, err := wallet.EncryptTx(account, tx, txt, state) if err != nil { return common.Hash{}, err } return submitTransaction(ctx, s.b, encrypted, args.To) }
} *
type ClosePoolArgs ¶
type ClosePoolArgs struct { }
type CmdsArgs ¶
type CmdsArgs struct { BuyShareArgs //Pool RegistPool *RegistPoolArgs ClosePool *ClosePoolArgs //Contract Contract *ContractArgs //Package PkgCreate *PkgCreateArgs PkgTransfer *PkgTransferArgs PkgClose *PkgCloseArgs }BuyShare *
type ContractAddress ¶
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 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 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 }
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 PkgCreateArgs ¶
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) ImportMnemonic ¶
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) 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) FindTxHash ¶
func (nodeApi *ProofServiceApi) FindTxHash(hash common.Hash) common.Hash
func (*ProofServiceApi) SubmitProofWork ¶
type PublicAbiAPI ¶
type PublicAbiAPI struct { }
func (*PublicAbiAPI) PackConstruct ¶
func (*PublicAbiAPI) PackMethod ¶
func (s *PublicAbiAPI) PackMethod(abi *abi.ABI, contractAddr ContractAddress, methodName string, args []string) (hexutil.Bytes, 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 (s *PublicAccountAPI) GetTk(addr address.MixBase58Adrress) address.TKAddress
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 (s *PublicBlockChainAPI) GenPKr(ctx context.Context, Pk address.PKAddress) (PKrAddress, 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 (*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 (*PublicBlockChainAPI) GetFullAddress ¶
func (s *PublicBlockChainAPI) GetFullAddress(ctx context.Context, shortAddresses []common.ContractAddress) (map[common.ContractAddress]PKrAddress, error)
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 ¶
GetBlockRlp retrieves the RLP encoded for of a single block.
func (*PublicDebugAPI) PrintBlock ¶
PrintBlock retrieves a block and returns its pretty printed form.
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) 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 (*PublicExchangeAPI) ClearUsedFlagForRoot ¶
func (*PublicExchangeAPI) GenMergeTx ¶
func (*PublicExchangeAPI) GenTxWithSign ¶
func (*PublicExchangeAPI) GetBalances ¶
func (*PublicExchangeAPI) GetBlockByNumber ¶
func (*PublicExchangeAPI) GetBlocksInfo ¶
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) GetPkByPkr ¶
func (s *PublicExchangeAPI) GetPkByPkr(ctx context.Context, pkr PKrAddress) (*address.PKAddress, error)
func (*PublicExchangeAPI) GetPkSynced ¶
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) IgnorePkrUtxos ¶
func (s *PublicExchangeAPI) IgnorePkrUtxos(ctx context.Context, pkr PKrAddress, ignore bool) (utxos []exchange.Utxo, e error)
func (*PublicExchangeAPI) Pk2Pkr ¶
func (s *PublicExchangeAPI) Pk2Pkr(ctx context.Context, pk address.PKAddress, index *c_type.Uint256) (PKrAddress, error)
func (*PublicExchangeAPI) SetBalancePkr ¶
func (s *PublicExchangeAPI) SetBalancePkr(ctx context.Context, pkr PKrAddress) error
func (*PublicExchangeAPI) SignTxWithSk ¶
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) GenTxParam ¶
func (s *PublicFlightAPI) GenTxParam(ctx context.Context, param PreTxParamArgs, tk address.TKAddress) (p txtool.GTxParam, e error)
func (*PublicFlightAPI) GetBlockByNumber ¶
func (*PublicFlightAPI) GetBlocksInfo ¶
func (*PublicFlightAPI) GetTxReceipt ¶
type PublicLightNodeApi ¶
type PublicLightNodeApi struct {
// contains filtered or unexported fields
}
func (PublicLightNodeApi) GetOutsByPKr ¶
func (plna PublicLightNodeApi) GetOutsByPKr(ctx context.Context, addresses []*MixAdrress, start, end uint64) (outBlockResp light.BlockOutResp, e error)
type PublicLocalAPI ¶
type PublicLocalAPI struct { }
func (*PublicLocalAPI) ConfirmOutC ¶
func (*PublicLocalAPI) ConfirmOutZ ¶
func (*PublicLocalAPI) CurrencyToId ¶
func (*PublicLocalAPI) IdToCurrency ¶
func (*PublicLocalAPI) IsMyPkr ¶
func (s *PublicLocalAPI) IsMyPkr(ctx context.Context, tk address.TKAddress, pkr PKrAddress) (ret bool, e error)
func (*PublicLocalAPI) IsPkrValid ¶
func (s *PublicLocalAPI) IsPkrValid(ctx context.Context, tk PKrAddress) error
func (*PublicLocalAPI) Pk2Pkr ¶
func (s *PublicLocalAPI) Pk2Pkr(ctx context.Context, pk address.PKAddress, index *c_type.Uint256) (PKrAddress, error)
func (*PublicLocalAPI) Seed2Mnemonic ¶
func (*PublicLocalAPI) SignTxWithSk ¶
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) CreateKr ¶
func (s *PublicSSIAPI) CreateKr() (kr txtool.Kr)
func (*PublicSSIAPI) GenTx ¶
func (s *PublicSSIAPI) GenTx(ctx context.Context, param *ssi.PreTxParam) (hash c_type.Uint256, e error)
func (*PublicSSIAPI) GetBlocksInfo ¶
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) GetShareAtNumber ¶
func (*PublicStakeApI) GetShareByPkr ¶
func (s *PublicStakeApI) GetShareByPkr(ctx context.Context, pkr PKrAddress) []map[string]interface{}
func (*PublicStakeApI) GetStakeInfo ¶
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) RegistStakePool ¶
func (s *PublicStakeApI) RegistStakePool(ctx context.Context, args RegistStakePoolTxArg) (common.Hash, error)
func (*PublicStakeApI) SharePoolSize ¶
func (*PublicStakeApI) SharePrice ¶
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) 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 (*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
type RPCStatisticsShare ¶
type RPCStatisticsShare struct {}
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 RegistPoolArgs ¶
type RegistPoolArgs struct { Value utils.U256 Vote PKrAddress FeeRate uint32 }
type RegistStakePoolTxArg ¶
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)
type SendTxArgs ¶
type SendTxArgs struct { From address.MixBase58Adrress `json:"from"` To *AllBase58Adrress `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasCurrency Smbol `json:"gasCy"` //default SERO 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) IsNotEmpty ¶
func (Smbol) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Smbol) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
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"` }