conflux

package
v0.0.0-...-817d81e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NodeVersion is the version of conflux full node we are using.
	NodeVersion = "1.1.6"

	// Blockchain is conflux.
	Blockchain string = "Conflux"

	// MainnetNetwork is the value of the network
	// in MainnetNetworkIdentifier.
	MainnetNetwork string = "Mainnet"

	TestnetNetwork string = "Testnet"

	// Symbol is the symbol value
	// used in Currency.
	Symbol = "CFX"

	// Decimals is the decimals value
	// used in Currency.
	Decimals = 18

	// MinerRewardOpType is used to describe
	// a miner block reward.
	MinerRewardOpType = "MINER_REWARD"
	PosRewardOpType   = "POS_REWARD"

	// FeeOpType is used to represent fee operations.
	FeeOpType              = "FEE"
	GasFeeOpType           = "GAS_FEE"
	StorageCollaterlOpType = "STORAGE_COLLATERAL_FEE"
	StorageReleaseOpType   = "STORAGE_RELEASE"

	// SelfDestructOpType is used to represent SELFDESTRUCT trace operations.
	SelfDestructOpType = "SELFDESTRUCT"

	// CallOpType is used to represent CALL trace operations.
	CallOpType = "CALL"

	// CallCodeOpType is used to represent CALLCODE trace operations.
	CallCodeOpType = "CALLCODE"

	// DelegateCallOpType is used to represent DELEGATECALL trace operations.
	DelegateCallOpType = "DELEGATECALL"

	// StaticCallOpType is used to represent STATICCALL trace operations.
	StaticCallOpType = "STATICCALL"

	// CreateOpType is used to represent CREATE trace operations.
	CreateOpType = cfxSdkTypes.CREATE_CREATE

	// Create2OpType is used to represent CREATE2 trace operations.
	Create2OpType = cfxSdkTypes.CREATE_CREATE2

	InternalTransferActionOpType = "INTERNALTRANSFERACTION"

	// DestructOpType is a synthetic operation used to represent the
	// deletion of suicided accounts that still have funds at the end
	// of a transaction.
	DestructOpType = "DESTRUCT"

	// SuccessStatus is the status of any
	// conflux operation considered successful.
	SuccessStatus = "SUCCESS"

	// FailureStatus is the status of any
	// conflux operation considered unsuccessful.
	FailureStatus = "FAILURE"

	// HistoricalBalanceSupported is whether
	// historical balance is supported.
	HistoricalBalanceSupported = true

	// UnclesRewardMultiplier is the uncle reward
	// multiplier.
	UnclesRewardMultiplier = 32

	// MaxUncleDepth is the maximum depth for
	// an uncle to be rewarded.
	MaxUncleDepth = 8

	// GenesisBlockIndex is the index of the
	// genesis block.
	GenesisBlockIndex = int64(0)

	// TransferGasLimit is the gas limit
	// of a transfer.
	TransferGasLimit = int64(21000) //nolint:gomnd

	// TransferGasLimit is the gas limit
	// of a transfer.
	TransferStorageLimit = int64(0) //nolint:gomnd

	// IncludeMempoolCoins does not apply to rosetta-ethereum as it is not UTXO-based.
	IncludeMempoolCoins = false
)

Variables

View Source
var (
	// ErrBlockOrphaned         = errors.New("block orphaned")
	ErrCallParametersInvalid = errors.New("call parameters invalid")
	ErrCallOutputMarshal     = errors.New("call output marshal")
	ErrCallMethodInvalid     = errors.New("call method invalid")
)

Client errors

View Source
var (

	// MainnetGenesisBlockIdentifier is the *types.BlockIdentifier
	// of the mainnet genesis block.
	MainnetGenesisBlockIdentifier = &types.BlockIdentifier{
		Hash:  "0xf6cec5af1ee95f56038fc30589bcfeb4b960075c3c76b8a0eaa6d36e8e623b50",
		Index: GenesisBlockIndex,
	}

	TestnetGenesisBlockIdentifier = &types.BlockIdentifier{
		Hash:  "0x3fb9d350f95424c3c27fcf248d9a6f633a83c2a75c11ef887ea41540c85e7804",
		Index: GenesisBlockIndex,
	}

	// Currency is the *types.Currency for all
	// conflux networks.
	Currency = &types.Currency{
		Symbol:   Symbol,
		Decimals: Decimals,
	}

	// OperationTypes are all suppoorted operation types.
	OperationTypes = []string{
		MinerRewardOpType,
		PosRewardOpType,

		string(CreateOpType),

		InternalTransferActionOpType,

		CallOpType,
		CallCodeOpType,
		DelegateCallOpType,
		StaticCallOpType,
	}

	// OperationStatuses are all supported operation statuses.
	OperationStatuses = []*types.OperationStatus{
		{
			Status:     SuccessStatus,
			Successful: true,
		},
		{
			Status:     FailureStatus,
			Successful: false,
		},
	}

	// CallMethods are all supported call methods.
	CallMethods = []string{}
)
View Source
var (
	StorageUint = new(big.Int).Div(big.NewInt(1e18), big.NewInt(1024))
)

Functions

func CallType

func CallType(t string) bool

CallType returns a boolean indicating if the provided trace type is a call type.

func CreateType

func CreateType(t string) bool

CreateType returns a boolean indicating if the provided trace type is a create type.

func StorageFee

func StorageFee(amount uint64) *big.Int

Types

type Client

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

func NewClient

func NewClient(url string) (*Client, error)

func (*Client) Block

func (ec *Client) Block(ctx context.Context, blockIdentifier *RosettaTypes.PartialBlockIdentifier) (*RosettaTypes.Block, error)

func (*Client) Call

func (*Client) ChainID

func (ec *Client) ChainID() (uint32, error)

func (*Client) Close

func (ec *Client) Close()

Close shuts down the RPC client connection.

func (*Client) EpochNumber

func (ec *Client) EpochNumber(ctx context.Context) (*big.Int, error)

func (*Client) IsPivotBlock

func (ec *Client) IsPivotBlock(block *cfxSdkTypes.Block) (bool, error)

func (*Client) NetworkID

func (ec *Client) NetworkID() (uint32, error)

func (*Client) PendingNonceAt

func (ec *Client) PendingNonceAt(ctx context.Context, account cfxSdkTypes.Address) (*big.Int, error)

func (*Client) SendTransaction

func (ec *Client) SendTransaction(ctx context.Context, tx *cfxSdkTypes.SignedTransaction) error

func (*Client) SuggestGasPrice

func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)

type JSONRPC

type JSONRPC interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
	Close()
}

JSONRPC is the interface for accessing go-ethereum's JSON RPC endpoint.

Jump to

Keyboard shortcuts

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