Documentation ¶
Index ¶
- Variables
- func ConvertAddress(value common.Address, ethNetworkId uint32) types.Address
- func ConvertAddressNullable(value *common.Address, ethNetworkId uint32) *types.Address
- func ConvertAddresses(addresses []common.Address, ethNetworkId uint32) []types.Address
- func ConvertBlock(block *ethTypes.Block, ethNetworkId uint32) *types.Block
- func ConvertBlockHeader(block *ethTypes.Block, ethNetworkId uint32) *types.BlockHeader
- func ConvertBlockSummary(block *ethTypes.Block, ethNetworkId uint32) *types.BlockSummary
- func ConvertHash(value common.Hash) types.Hash
- func ConvertHashNullable(value *common.Hash) *types.Hash
- func ConvertLog(log *ethTypes.Log, ethNetworkId uint32) *types.Log
- func ConvertLogFilter(fq *ethTypes.FilterQuery, ethNetworkId uint32) *types.LogFilter
- func ConvertReceipt(receipt *ethTypes.Receipt, ethNetworkId uint32) *types.TransactionReceipt
- func ConvertTrace(ethTrace *web3goTypes.LocalizedTrace, ethNetworkId uint32) (*types.LocalizedTrace, *types.LocalizedTrace)
- func ConvertTx(tx *ethTypes.TransactionDetail, ethNetworkId uint32) *types.Transaction
- func ConvertTxStatus(value *uint64) hexutil.Uint64
- func ConvertTxStatusNullable(value *uint64) (status *hexutil.Uint64)
- func NormalizeBig(value *big.Int, err error) (*hexutil.Big, error)
- type BlockTraceBuilder
- type CfxAPI
- func (api *CfxAPI) Call(ctx context.Context, request EthCallRequest, bn *EthBlockNumber) (hexutil.Bytes, error)
- func (api *CfxAPI) ClientVersion(ctx context.Context) (string, error)
- func (api *CfxAPI) EpochNumber(ctx context.Context, epoch *types.Epoch) (*hexutil.Big, error)
- func (api *CfxAPI) EstimateGasAndCollateral(ctx context.Context, request EthCallRequest, bn *EthBlockNumber) (types.Estimate, error)
- func (api *CfxAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (api *CfxAPI) GetAccount(ctx context.Context, address EthAddress, bn *EthBlockNumber) (types.AccountInfo, error)
- func (api *CfxAPI) GetAccumulateInterestRate(ctx context.Context, bn *EthBlockNumber) (*hexutil.Big, error)
- func (api *CfxAPI) GetAdmin(ctx context.Context, contract EthAddress, bn *EthBlockNumber) (*string, error)
- func (api *CfxAPI) GetBalance(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
- func (api *CfxAPI) GetBestBlockHash(ctx context.Context) (common.Hash, error)
- func (api *CfxAPI) GetBlockByBlockNumber(ctx context.Context, blockNumer hexutil.Uint64, includeTxs bool) (interface{}, error)
- func (api *CfxAPI) GetBlockByEpochNumber(ctx context.Context, bn EthBlockNumber, includeTxs bool) (interface{}, error)
- func (api *CfxAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, includeTxs bool) (interface{}, error)
- func (api *CfxAPI) GetBlockByHashWithPivotAssumption(ctx context.Context, blockHash, pivotHash common.Hash, bn hexutil.Uint64) (*types.Block, error)
- func (api *CfxAPI) GetBlockRewardInfo(ctx context.Context, epoch types.Epoch) ([]types.RewardInfo, error)
- func (api *CfxAPI) GetBlocksByEpoch(ctx context.Context, bn EthBlockNumber) ([]common.Hash, error)
- func (api *CfxAPI) GetCode(ctx context.Context, contract EthAddress, bn *EthBlockNumber) (hexutil.Bytes, error)
- func (api *CfxAPI) GetCollateralForStorage(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
- func (api *CfxAPI) GetConfirmationRiskByHash(ctx context.Context, blockHash types.Hash) (*hexutil.Big, error)
- func (api *CfxAPI) GetDepositList(ctx context.Context, address EthAddress, bn *EthBlockNumber) ([]types.DepositInfo, error)
- func (api *CfxAPI) GetEpochReceipts(ctx context.Context, bnh EthBlockNumberOrHash) ([][]*types.TransactionReceipt, error)
- func (api *CfxAPI) GetInterestRate(ctx context.Context, bn *EthBlockNumber) (*hexutil.Big, error)
- func (api *CfxAPI) GetLogs(ctx context.Context, filter EthLogFilter) ([]types.Log, error)
- func (api *CfxAPI) GetNextNonce(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
- func (api *CfxAPI) GetSponsorInfo(ctx context.Context, contract EthAddress, bn *EthBlockNumber) (types.SponsorInfo, error)
- func (api *CfxAPI) GetStakingBalance(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
- func (api *CfxAPI) GetStatus(ctx context.Context) (types.Status, error)
- func (api *CfxAPI) GetStorageAt(ctx context.Context, address EthAddress, position *hexutil.Big, ...) (common.Hash, error)
- func (api *CfxAPI) GetStorageRoot(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*types.StorageRoot, error)
- func (api *CfxAPI) GetSupplyInfo(ctx context.Context, epoch *types.Epoch) (types.TokenSupplyInfo, error)
- func (api *CfxAPI) GetTransactionByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, error)
- func (api *CfxAPI) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.TransactionReceipt, error)
- func (api *CfxAPI) GetVoteList(ctx context.Context, address EthAddress, bn *EthBlockNumber) ([]types.VoteStakeInfo, error)
- func (api *CfxAPI) SendRawTransaction(ctx context.Context, signedTx hexutil.Bytes) (common.Hash, error)
- type EthAddress
- type EthBlockNumber
- type EthBlockNumberOrHash
- type EthCallRequest
- type EthLogFilter
- type TraceAPI
- func (api *TraceAPI) Block(ctx context.Context, blockHash types.Hash) (*types.LocalizedBlockTrace, error)
- func (api *TraceAPI) Filter(ctx context.Context, filter types.TraceFilter) ([]types.LocalizedTrace, error)
- func (api *TraceAPI) Transaction(ctx context.Context, txHash types.Hash) ([]types.LocalizedTrace, error)
- type TraceBuilder
- type TransactionTraceBuilder
- type TxpoolAPI
Constants ¶
This section is empty.
Variables ¶
var ( // ETH space only accept latest_state as block number. Other epoch tags, e.g. latest_checkpoint, // latest_confirmed and latest_mined are not supported. ErrEpochUnsupported = errors.New("epoch not supported") // ETH space only have pivot blocks as a list, and do not require to query non-pivot blocks. // To compatible with CFX space RPC, bridge service will check the assumption against pivot block. ErrInvalidBlockAssumption = errors.New("invalid block assumption") )
var (
HexBig0 = types.NewBigInt(0)
)
Functions ¶
func ConvertAddressNullable ¶
func ConvertAddresses ¶
func ConvertBlockHeader ¶
func ConvertBlockHeader(block *ethTypes.Block, ethNetworkId uint32) *types.BlockHeader
func ConvertBlockSummary ¶
func ConvertBlockSummary(block *ethTypes.Block, ethNetworkId uint32) *types.BlockSummary
func ConvertLogFilter ¶
func ConvertLogFilter(fq *ethTypes.FilterQuery, ethNetworkId uint32) *types.LogFilter
func ConvertReceipt ¶
func ConvertReceipt(receipt *ethTypes.Receipt, ethNetworkId uint32) *types.TransactionReceipt
func ConvertTrace ¶
func ConvertTrace(ethTrace *web3goTypes.LocalizedTrace, ethNetworkId uint32) (*types.LocalizedTrace, *types.LocalizedTrace)
func ConvertTx ¶
func ConvertTx(tx *ethTypes.TransactionDetail, ethNetworkId uint32) *types.Transaction
func ConvertTxStatus ¶
func ConvertTxStatusNullable ¶
Types ¶
type BlockTraceBuilder ¶
type BlockTraceBuilder struct {
// contains filtered or unexported fields
}
func (*BlockTraceBuilder) Append ¶
func (btb *BlockTraceBuilder) Append(trace, traceResult *types.LocalizedTrace, subTraces uint) error
func (*BlockTraceBuilder) Build ¶
func (btb *BlockTraceBuilder) Build() ([]types.LocalizedTransactionTrace, error)
type CfxAPI ¶
type CfxAPI struct {
// contains filtered or unexported fields
}
func (*CfxAPI) Call ¶
func (api *CfxAPI) Call(ctx context.Context, request EthCallRequest, bn *EthBlockNumber) (hexutil.Bytes, error)
func (*CfxAPI) ClientVersion ¶
func (*CfxAPI) EpochNumber ¶
func (*CfxAPI) EstimateGasAndCollateral ¶
func (api *CfxAPI) EstimateGasAndCollateral(ctx context.Context, request EthCallRequest, bn *EthBlockNumber) (types.Estimate, error)
func (*CfxAPI) GetAccount ¶
func (api *CfxAPI) GetAccount(ctx context.Context, address EthAddress, bn *EthBlockNumber) (types.AccountInfo, error)
func (*CfxAPI) GetAccumulateInterestRate ¶
func (*CfxAPI) GetAdmin ¶
func (api *CfxAPI) GetAdmin(ctx context.Context, contract EthAddress, bn *EthBlockNumber) (*string, error)
func (*CfxAPI) GetBalance ¶
func (api *CfxAPI) GetBalance(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
func (*CfxAPI) GetBestBlockHash ¶
func (*CfxAPI) GetBlockByBlockNumber ¶
func (*CfxAPI) GetBlockByEpochNumber ¶
func (*CfxAPI) GetBlockByHash ¶
func (*CfxAPI) GetBlockByHashWithPivotAssumption ¶
func (*CfxAPI) GetBlockRewardInfo ¶
func (*CfxAPI) GetBlocksByEpoch ¶
func (*CfxAPI) GetCode ¶
func (api *CfxAPI) GetCode(ctx context.Context, contract EthAddress, bn *EthBlockNumber) (hexutil.Bytes, error)
func (*CfxAPI) GetCollateralForStorage ¶
func (api *CfxAPI) GetCollateralForStorage(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
func (*CfxAPI) GetConfirmationRiskByHash ¶
func (*CfxAPI) GetDepositList ¶
func (api *CfxAPI) GetDepositList(ctx context.Context, address EthAddress, bn *EthBlockNumber) ([]types.DepositInfo, error)
func (*CfxAPI) GetEpochReceipts ¶
func (api *CfxAPI) GetEpochReceipts(ctx context.Context, bnh EthBlockNumberOrHash) ([][]*types.TransactionReceipt, error)
func (*CfxAPI) GetInterestRate ¶
func (*CfxAPI) GetNextNonce ¶
func (api *CfxAPI) GetNextNonce(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
func (*CfxAPI) GetSponsorInfo ¶
func (api *CfxAPI) GetSponsorInfo(ctx context.Context, contract EthAddress, bn *EthBlockNumber) (types.SponsorInfo, error)
func (*CfxAPI) GetStakingBalance ¶
func (api *CfxAPI) GetStakingBalance(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*hexutil.Big, error)
func (*CfxAPI) GetStorageAt ¶
func (api *CfxAPI) GetStorageAt(ctx context.Context, address EthAddress, position *hexutil.Big, bn *EthBlockNumber) (common.Hash, error)
func (*CfxAPI) GetStorageRoot ¶
func (api *CfxAPI) GetStorageRoot(ctx context.Context, address EthAddress, bn *EthBlockNumber) (*types.StorageRoot, error)
func (*CfxAPI) GetSupplyInfo ¶
func (*CfxAPI) GetTransactionByHash ¶
func (*CfxAPI) GetTransactionReceipt ¶
func (*CfxAPI) GetVoteList ¶
func (api *CfxAPI) GetVoteList(ctx context.Context, address EthAddress, bn *EthBlockNumber) ([]types.VoteStakeInfo, error)
type EthAddress ¶
type EthAddress struct {
// contains filtered or unexported fields
}
EthAddress accepts both hex40 and base32 format addresses.
func (*EthAddress) UnmarshalJSON ¶
func (ea *EthAddress) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*EthAddress) ValueOrNil ¶
func (ea *EthAddress) ValueOrNil() *common.Address
type EthBlockNumber ¶
type EthBlockNumber struct {
// contains filtered or unexported fields
}
EthBlockNumber accepts number and epoch tag latest_state, other values are invalid, e.g. latest_confirmed.
func (*EthBlockNumber) ToArg ¶
func (ebn *EthBlockNumber) ToArg() *ethTypes.BlockNumberOrHash
func (*EthBlockNumber) UnmarshalJSON ¶
func (ebn *EthBlockNumber) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*EthBlockNumber) Value ¶
func (ebn *EthBlockNumber) Value() ethTypes.BlockNumber
func (*EthBlockNumber) ValueOrNil ¶
func (ebn *EthBlockNumber) ValueOrNil() *ethTypes.BlockNumber
type EthBlockNumberOrHash ¶
type EthBlockNumberOrHash struct {
// contains filtered or unexported fields
}
EthBlockNumberOrHash accepts hex number, hash and epoch tag latest_state, other values are invalid, e.g. latest_confirmed.
func (*EthBlockNumberOrHash) MarshalText ¶
func (ebnh *EthBlockNumberOrHash) MarshalText() ([]byte, error)
func (*EthBlockNumberOrHash) ToArg ¶
func (ebnh *EthBlockNumberOrHash) ToArg() *ethTypes.BlockNumberOrHash
func (*EthBlockNumberOrHash) UnmarshalJSON ¶
func (ebnh *EthBlockNumberOrHash) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type EthCallRequest ¶
type EthCallRequest struct { From *EthAddress To *EthAddress GasPrice *hexutil.Big Gas *hexutil.Uint64 Value *hexutil.Big Nonce *hexutil.Uint64 Data *string }
EthCallRequest is compatible with CFX CallRequest and accepts hex40 format address. Note, StorageLimit field is simply ignored.
func (*EthCallRequest) ToCallMsg ¶
func (req *EthCallRequest) ToCallMsg() ethTypes.CallRequest
type EthLogFilter ¶
type EthLogFilter struct { FromEpoch *EthBlockNumber ToEpoch *EthBlockNumber BlockHashes *common.Hash // eth space only accept a single block hash as filter Address []EthAddress Topics [][]common.Hash }
EthLogFilter is compatible with CFX LogFilter and accepts hex40 format address. Note, some fields are simply ignored, e.g. from/to block, offset/limit.
func (*EthLogFilter) ToFilterQuery ¶
func (filter *EthLogFilter) ToFilterQuery() ethTypes.FilterQuery
func (*EthLogFilter) UnmarshalJSON ¶
func (l *EthLogFilter) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type TraceAPI ¶
type TraceAPI struct {
// contains filtered or unexported fields
}
func (*TraceAPI) Filter ¶
func (api *TraceAPI) Filter(ctx context.Context, filter types.TraceFilter) ([]types.LocalizedTrace, error)
func (*TraceAPI) Transaction ¶
type TraceBuilder ¶
type TraceBuilder struct {
// contains filtered or unexported fields
}
TraceBuilder builds traces in stack way and thread unsafe.
func (*TraceBuilder) Append ¶
func (tb *TraceBuilder) Append(trace, traceResult *types.LocalizedTrace, subTraces uint) error
func (*TraceBuilder) Build ¶
func (tb *TraceBuilder) Build() ([]types.LocalizedTrace, error)
type TransactionTraceBuilder ¶
type TransactionTraceBuilder struct {
// contains filtered or unexported fields
}
func (*TransactionTraceBuilder) Append ¶
func (ttb *TransactionTraceBuilder) Append(trace, traceResult *types.LocalizedTrace, subTraces uint) (bool, error)
func (*TransactionTraceBuilder) Build ¶
func (ttb *TransactionTraceBuilder) Build() (*types.LocalizedTransactionTrace, bool, error)