manapi

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 46 Imported by: 0

Documentation

Overview

Package manapi implements the general Matrix API functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCrc8 added in v1.1.1

func CheckCrc8(strData string) bool

func CheckCurrency added in v1.1.1

func CheckCurrency(strData string) bool

func CheckFormat added in v1.1.1

func CheckFormat(strData string) bool

func CheckParams added in v1.1.1

func CheckParams(strData string) error

func GetAPIs

func GetAPIs(apiBackend Backend) []rpc.API

func GetPassword added in v1.1.1

func GetPassword() (string, 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 Backend

type Backend interface {
	// General Matrix API
	Downloader() *downloader.Downloader
	ProtocolVersion() int
	SuggestPrice(ctx context.Context) (*big.Int, error)
	ChainDb() mandb.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.StateDBManage, *types.Header, error)
	GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error)
	GetReceipts(ctx context.Context, blockHash common.Hash) ([]types.CoinReceipts, error)
	GetTd(blockHash common.Hash) *big.Int
	GetEVM(ctx context.Context, msg txinterface.Message, state *state.StateDBManage, 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
	ImportSuperBlock(ctx context.Context, filePath string) (common.Hash, error)
	GetState() (*state.StateDBManage, error)

	// TxPool API
	SendTx(ctx context.Context, signedTx types.SelfTransaction) error
	GetPoolTransactions() (types.SelfTransactions, error)
	GetPoolTransaction(txHash common.Hash) types.SelfTransaction
	GetPoolNonce(cointyp string, ctx context.Context, addr common.Address) (uint64, error)
	Stats() (pending int, queued int)
	TxPoolContent() (map[common.Address]types.SelfTransactions, map[common.Address]types.SelfTransactions)
	SubscribeNewTxsEvent(chan core.NewTxsEvent) event.Subscription //Y

	SignTx(signedTx types.SelfTransaction, chainID *big.Int, blkHash common.Hash, signHeight uint64, usingEntrust bool) (types.SelfTransaction, error) //
	SendBroadTx(ctx context.Context, signedTx types.SelfTransaction, bType bool) error                                                                 //
	FetcherNotify(hash common.Hash, number uint64)                                                                                                     //

	ChainConfig() *params.ChainConfig
	//Config() *man.Config
	NetWorkID() uint64
	SyncMode() downloader.SyncMode
	NetRPCService() *PublicNetAPI
	CurrentBlock() *types.Block
	GetDepositAccount(signAccount common.Address, blockHash common.Hash) (common.Address, error)
	GetFutureRewards(*state.StateDBManage, rpc.BlockNumber) (interface{}, error)
	Genesis() *types.Block
}

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

type CallArgs

type CallArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Currency *string         `json:"currency"    gencodec:"required"`
	Gas      hexutil.Uint64  `json:"gas"`
	GasPrice hexutil.Big     `json:"gasPrice"`
	Value    hexutil.Big     `json:"value"`
	Data     hexutil.Bytes   `json:"data"`
	ExtraTo  []*ExtraTo_Mx   `json:"extra_to"` //
}

CallArgs represents the arguments for a call.

func ManArgsToCallArgs added in v1.1.1

func ManArgsToCallArgs(manargs ManCallArgs) (args CallArgs, err error)

type DepositDetail added in v1.1.2

type DepositDetail struct {
	Address     string
	SignAddress string
	Deposit     *big.Int
	WithdrawH   *big.Int
	OnlineTime  *big.Int
	Role        *big.Int
}

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 ExtraTo_Mx

type ExtraTo_Mx struct {
	To2    *common.Address `json:"to"`
	Value2 *hexutil.Big    `json:"value"`
	Input2 *hexutil.Bytes  `json:"input"`
}

type ExtraTo_Mx1 added in v1.1.1

type ExtraTo_Mx1 struct {
	To2    *string        `json:"to"`
	Value2 *hexutil.Big   `json:"value"`
	Input2 *hexutil.Bytes `json:"input"`
}

type ManCallArgs added in v1.1.1

type ManCallArgs struct {
	From     string         `json:"from"`
	To       *string        `json:"to"`
	Currency *string        `json:"currency"`
	Gas      hexutil.Uint64 `json:"gas"`
	GasPrice hexutil.Big    `json:"gasPrice"`
	Value    hexutil.Big    `json:"value"`
	Data     hexutil.Bytes  `json:"data"`
	ExtraTo  []*ExtraTo_Mx1 `json:"extra_to"` //
}

type NodeInfo added in v1.1.1

type NodeInfo struct {
	Account  string `json:"account"`
	Online   bool   `json:"online"`
	Position uint16 `json:"position"`
}

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

func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error)

DeriveAccount requests a HD wallet to derive a new account, optionally pinning it for later reuse.

func (*PrivateAccountAPI) EcRecover

func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)

EcRecover returns the address for the account that was used to create the signature. Note, this function is compatible with man_sign and personal_sign. As such it recovers the address of: hash = keccak256("\x19Matrix Signed Message:\n"${message length}${message}) addr = ecrecover(hash, signature)

Note, the signature must conform to the secp256k1 curve R, S and V values, where the V value must be be 27 or 28 for legacy reasons.

https://github.com/MatrixAINetwork/go-matrix/wiki/Management-APIs#personal_ecRecover

func (*PrivateAccountAPI) ImportRawKey

func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (string, 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() []common.Address

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(strAddr string) bool

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

func (*PrivateAccountAPI) NewAccount

func (s *PrivateAccountAPI) NewAccount(password string) (string, error)

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

func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) {
	acc, err := fetchKeystore(s.am).NewAccount(password)
	if err == nil {
		return acc.Address, nil
	}
	return common.Address{}, err
}

func (*PrivateAccountAPI) OpenWallet

func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error

OpenWallet initiates a hardware wallet opening procedure, establishing a USB connection and attempting to authenticate via the provided passphrase. Note, the method may return an extra challenge requiring a second open (e.g. the Trezor PIN matrix challenge).

func (*PrivateAccountAPI) SendTransaction

func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args1 SendTxArgs1, 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) SetEntrustSignAccount added in v1.1.1

func (s *PrivateAccountAPI) SetEntrustSignAccount(path string, password string) (string, error)

func (*PrivateAccountAPI) Sign

func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, strAddr string, passwd string) (hexutil.Bytes, error)

Sign calculates an Matrix ECDSA signature for: keccack256("\x19Matrix Signed Message:\n" + len(message) + message))

Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.

The key used to calculate the signature is decrypted with the given password.

https://github.com/MatrixAINetwork/go-matrix/wiki/Management-APIs#personal_sign

func (*PrivateAccountAPI) SignAndSendTransaction

func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs1, 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) SignTransaction

func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs, passwd string) (*SignTransactionResult, error)

SignTransaction 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. The transaction is returned in RLP-form, not broadcast to other nodes

func (*PrivateAccountAPI) UnlockAccount

func (s *PrivateAccountAPI) UnlockAccount(strAddr string, 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 Matrix 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 Matrix 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 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(b Backend) *PublicAccountAPI

NewPublicAccountAPI creates a new PublicAccountAPI.

func (*PublicAccountAPI) Accounts

func (s *PublicAccountAPI) Accounts() [][]string

Accounts returns the collection of accounts this node manages

type PublicBlockChainAPI

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

PublicBlockChainAPI provides an API to access the Matrix 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 Matrix blockchain API.

func (*PublicBlockChainAPI) BlockNumber

func (s *PublicBlockChainAPI) BlockNumber() *big.Int

BlockNumber returns the block number of the chain head.

func (*PublicBlockChainAPI) Call

func (s *PublicBlockChainAPI) Call(ctx context.Context, manargs ManCallArgs, 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) EstimateGas

func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, manargs ManCallArgs) (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) GetAuthFrom added in v1.1.1

func (s *PublicBlockChainAPI) GetAuthFrom(strEntrustFrom string, height uint64) string

func (*PublicBlockChainAPI) GetAuthFromByTime added in v1.1.1

func (s *PublicBlockChainAPI) GetAuthFromByTime(strEntrustFrom string, time uint64) string

func (*PublicBlockChainAPI) GetAuthGasAddress added in v1.1.2

func (s *PublicBlockChainAPI) GetAuthGasAddress(ctx context.Context, strAddress string, blockNr rpc.BlockNumber) (string, error)

钱包调用,根据块高查询委托gas授权地址

func (*PublicBlockChainAPI) GetBalance

func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, strAddress string, blockNr rpc.BlockNumber) ([]RPCBalanceType, 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) GetBlackList added in v1.1.3

func (s *PublicBlockChainAPI) GetBlackList() []string

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

func (s *PublicBlockChainAPI) GetCode(ctx context.Context, manAddress string, cointype string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) GetDeposit added in v1.1.2

func (s *PublicBlockChainAPI) GetDeposit(ctx context.Context, blockNr rpc.BlockNumber) ([]DepositDetail, error)

func (*PublicBlockChainAPI) GetDestroyBalance added in v1.1.3

func (s *PublicBlockChainAPI) GetDestroyBalance(ctx context.Context, blockNr rpc.BlockNumber) (*big.Int, error)

func (*PublicBlockChainAPI) GetEntrustFrom added in v1.1.1

func (s *PublicBlockChainAPI) GetEntrustFrom(strAuthFrom string, height uint64) []string

func (*PublicBlockChainAPI) GetEntrustFromByTime added in v1.1.1

func (s *PublicBlockChainAPI) GetEntrustFromByTime(strAuthFrom string, time uint64) []string

func (*PublicBlockChainAPI) GetEntrustList added in v1.1.1

func (s *PublicBlockChainAPI) GetEntrustList(strAuthFrom string) []common.EntrustType

钱包调用

func (*PublicBlockChainAPI) GetFutureRewards added in v1.1.1

func (api *PublicBlockChainAPI) GetFutureRewards(ctx context.Context, number rpc.BlockNumber) (interface{}, error)

func (*PublicBlockChainAPI) GetGasPrice added in v1.1.2

func (s *PublicBlockChainAPI) GetGasPrice() *big.Int

func (*PublicBlockChainAPI) GetIPFSblock added in v1.1.1

func (s *PublicBlockChainAPI) GetIPFSblock(strhash string)

func (*PublicBlockChainAPI) GetIPFSfirstcache added in v1.1.1

func (s *PublicBlockChainAPI) GetIPFSfirstcache()

func (*PublicBlockChainAPI) GetIPFSsecondcache added in v1.1.1

func (s *PublicBlockChainAPI) GetIPFSsecondcache(strhash string)

func (*PublicBlockChainAPI) GetIPFSsnap added in v1.1.1

func (s *PublicBlockChainAPI) GetIPFSsnap(str string)

func (*PublicBlockChainAPI) GetInterest added in v1.1.2

func (s *PublicBlockChainAPI) GetInterest(ctx context.Context, strAddress string, blockNr rpc.BlockNumber) (*hexutil.Big, error)

func (*PublicBlockChainAPI) GetMatrixCoin added in v1.1.2

func (s *PublicBlockChainAPI) GetMatrixCoin(ctx context.Context, blockNr rpc.BlockNumber) ([]string, error)

func (*PublicBlockChainAPI) GetMatrixCoinConfig added in v1.1.2

func (s *PublicBlockChainAPI) GetMatrixCoinConfig(ctx context.Context, cointpy string, blockNr rpc.BlockNumber) ([]common.CoinConfig, error)

func (*PublicBlockChainAPI) GetMatrixStateByNum added in v1.1.1

func (s *PublicBlockChainAPI) GetMatrixStateByNum(ctx context.Context, key string, blockNr rpc.BlockNumber) (interface{}, error)

func (*PublicBlockChainAPI) GetSelfLevel

func (s *PublicBlockChainAPI) GetSelfLevel() int

GetSelfLevel get self level from ca, including top node, buckets number and default.

func (*PublicBlockChainAPI) GetSignAccountsByHash

func (s *PublicBlockChainAPI) GetSignAccountsByHash(ctx context.Context, hash common.Hash) ([]common.VerifiedSign1, error)

func (*PublicBlockChainAPI) GetSignAccountsByNumber

func (s *PublicBlockChainAPI) GetSignAccountsByNumber(ctx context.Context, blockNr rpc.BlockNumber) ([]common.VerifiedSign1, error)

func (*PublicBlockChainAPI) GetSlash added in v1.1.2

func (s *PublicBlockChainAPI) GetSlash(ctx context.Context, strAddress string, blockNr rpc.BlockNumber) (*hexutil.Big, error)

func (*PublicBlockChainAPI) GetStorageAt

func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, manAddress string, key string, cointype string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) GetTopologyStatusByNumber added in v1.1.1

func (s *PublicBlockChainAPI) GetTopologyStatusByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*TopologyStatus, error)

func (*PublicBlockChainAPI) GetUncleByBlockHashAndIndex

func (s *PublicBlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)

GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetUncleByBlockNumberAndIndex

func (s *PublicBlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)

GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetUncleCountByBlockHash

func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetUncleCountByBlockHash returns number of uncles in the block for the given block hash

func (*PublicBlockChainAPI) GetUncleCountByBlockNumber

func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetUncleCountByBlockNumber returns number of uncles in the block for the given block number

func (*PublicBlockChainAPI) GetUpTime added in v1.1.1

func (s *PublicBlockChainAPI) GetUpTime(ctx context.Context, strAddress string, blockNr rpc.BlockNumber) (*big.Int, error)

func (*PublicBlockChainAPI) ImportSuperBlock added in v1.1.1

func (s *PublicBlockChainAPI) ImportSuperBlock(ctx context.Context, filePath string) (common.Hash, error)

type PublicDebugAPI

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

PublicDebugAPI is the collection of Matrix 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 Matrix service.

func (*PublicDebugAPI) GetAllChainInfo added in v1.1.1

func (api *PublicDebugAPI) GetAllChainInfo() map[string]interface{}

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 PublicMatrixAPI

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

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

func NewPublicMatrixAPI

func NewPublicMatrixAPI(b Backend) *PublicMatrixAPI

NewPublicMatrixAPI creates a new Matrix protocol API.

func (*PublicMatrixAPI) GasPrice

func (s *PublicMatrixAPI) GasPrice(ctx context.Context) (*big.Int, error)

GasPrice returns a suggestion for a gas price.

func (*PublicMatrixAPI) ProtocolVersion

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

ProtocolVersion returns the current Matrix protocol version this node supports

func (*PublicMatrixAPI) Syncing

func (s *PublicMatrixAPI) 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 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 matrix protocol version.

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) 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, cointy string) 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, cointy string) 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, cointy string) *RPCTransaction1

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, cointy string) *RPCTransaction1

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

func (*PublicTransactionPoolAPI) GetTransactionByHash

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

func (*PublicTransactionPoolAPI) GetTransactionCount

func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, strAddress string, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions the given address has sent for the given block number

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

func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs1 SendTxArgs1, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)

Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the pool and reinsert it with the new gas price and limit.

func (*PublicTransactionPoolAPI) SendRawTransaction

func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, args1 SendTxArgs1) (common.Hash, error)

SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.

func (*PublicTransactionPoolAPI) SendRawTransaction_old added in v1.1.1

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

func (*PublicTransactionPoolAPI) SendTransaction

func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args1 SendTxArgs1) (common.Hash, error)

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

func (*PublicTransactionPoolAPI) Sign

func (s *PublicTransactionPoolAPI) Sign(strAddr string, data hexutil.Bytes) (hexutil.Bytes, error)

Sign calculates an ECDSA signature for: keccack256("\x19Matrix Signed Message:\n" + len(message) + message).

Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.

The account associated with addr must be unlocked.

https://github.com/MatrixAINetwork/wiki/wiki/JSON-RPC#man_sign

func (*PublicTransactionPoolAPI) SignTransaction

SignTransaction will sign the given transaction with the from account. The node needs to have the private key of the account corresponding with the given from address and it needs to be unlocked.

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]map[string]*RPCTransaction

Content returns the transactions contained within the transaction pool.

func (*PublicTxPoolAPI) Inspect

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

Inspect retrieves the content of the transaction pool and flattens it into an easily inspectable list.

func (*PublicTxPoolAPI) Status

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

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

type RPCBalanceType added in v1.1.1

type RPCBalanceType struct {
	AccountType uint32       `json:"accountType"`
	Balance     *hexutil.Big `json:"balance"`
}

type RPCTransaction

type RPCTransaction struct {
	BlockHash        common.Hash     `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	From             common.Address  `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"`
	V                *hexutil.Big    `json:"v"`
	R                *hexutil.Big    `json:"r"`
	S                *hexutil.Big    `json:"s"`
	TxEnterType      byte            `json:"TxEnterType"`
	IsEntrustTx      bool            `json:"IsEntrustTx"`
	Currency         string          `json:"Currency"`
	CommitTime       hexutil.Uint64  `json:"CommitTime"`
	MatrixType       byte            `json:"matrixType"`
	ExtraTo          []*ExtraTo_Mx   `json:"extra_to"`
}

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

type RPCTransaction1 added in v1.1.1

type RPCTransaction1 struct {
	BlockHash        common.Hash    `json:"blockHash"`
	BlockNumber      *hexutil.Big   `json:"blockNumber"`
	From             string         `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               *string        `json:"to"`
	TransactionIndex hexutil.Uint   `json:"transactionIndex"`
	Value            *hexutil.Big   `json:"value"`
	V                *hexutil.Big   `json:"v"`
	R                *hexutil.Big   `json:"r"`
	S                *hexutil.Big   `json:"s"`
	TxEnterType      byte           `json:"TxEnterType"`
	IsEntrustTx      bool           `json:"IsEntrustTx"`
	Currency         string         `json:"Currency"`
	CommitTime       hexutil.Uint64 `json:"CommitTime"`
	MatrixType       byte           `json:"matrixType"`
	ExtraTo          []*ExtraTo_Mx1 `json:"extra_to"`
}

func RPCTransactionToString added in v1.1.1

func RPCTransactionToString(data *RPCTransaction) *RPCTransaction1

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	Currency string          `json:"currency"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data        *hexutil.Bytes `json:"data"`
	Input       *hexutil.Bytes `json:"input"`
	V           *hexutil.Big   `json:"v"`
	R           *hexutil.Big   `json:"r"`
	S           *hexutil.Big   `json:"s"`
	TxType      byte           `json:"txType"`     //
	LockHeight  uint64         `json:"lockHeight"` //
	IsEntrustTx byte           `json:"isEntrustTx"`
	CommitTime  uint64         `json:"commitTime"`
	ExtraTo     []*ExtraTo_Mx  `json:"extra_to"` //
}

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

func StrArgsToByteArgs added in v1.1.1

func StrArgsToByteArgs(args1 SendTxArgs1) (args SendTxArgs, err error)

type SendTxArgs1 added in v1.1.1

type SendTxArgs1 struct {
	From     string          `json:"from"`
	To       *string         `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data        *hexutil.Bytes `json:"data"`
	Input       *hexutil.Bytes `json:"input"`
	V           *hexutil.Big   `json:"v"`
	R           *hexutil.Big   `json:"r"`
	S           *hexutil.Big   `json:"s"`
	Currency    *string        `json:"currency"`
	TxType      byte           `json:"txType"`     //
	LockHeight  uint64         `json:"lockHeight"` //
	IsEntrustTx byte           `json:"isEntrustTx"`
	CommitTime  uint64         `json:"commitTime"`
	ExtraTo     []*ExtraTo_Mx1 `json:"extra_to"` //
}

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

type SignTransactionResult

type SignTransactionResult struct {
	Raw hexutil.Bytes         `json:"raw"`
	Tx  types.SelfTransaction `json:"tx"`
}

SignTransactionResult represents a RLP encoded signed transaction.

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 TopologyStatus added in v1.1.1

type TopologyStatus struct {
	LeaderReelect         bool       `json:"leader_reelect"`
	Validators            []NodeInfo `json:"validators"`
	BackupValidators      []NodeInfo `json:"backup_validators"`
	Miners                []NodeInfo `json:"miners"`
	ElectValidators       []NodeInfo `json:"elect_validators"`
	ElectBackupValidators []NodeInfo `json:"elect_backup_validators"`
}

Jump to

Keyboard shortcuts

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