api

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Overview

Package ethapi implements the general Ethereum API functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllCheckpointInfo

type AllCheckpointInfo struct {
	Registry []CheckpointInfo
	Active   []CheckpointInfo
}

type BLInfo

type BLInfo struct {
	Target  common.Address
	Enforce *ProposalInfo
	Revoke  *ProposalInfo
	Drain   *ProposalInfo
	Blocked bool
}

type Backend

type Backend interface {
	// General Ethereum API
	Downloader() *downloader.Downloader
	ProtocolVersion() int
	SuggestPrice(ctx context.Context) (*big.Int, error)
	ChainDb() ethdb.Database
	EventMux() *event.TypeMux
	AccountManager() *accounts.Manager
	RPCGasCap() *big.Int // global gas cap for eth_call over rpc: DoS protection

	// 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) (*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
	BlockChain() *core.BlockChain

	// 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.Address) (uint64, error)
	Stats() (pending int, queued int)
	TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
	SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription

	ChainConfig() *params.ChainConfig
	CurrentBlock() *types.Block

	AddLocalCheckpoint(num uint64, hash common.Hash) error
	ListCheckpoints() []core.CheckpointInfo
	CheckpointSignatures(cp core.Checkpoint) []core.CheckpointSignature

	IsPublicService() bool
	OnSyncedHeadUpdates(cb func())
}

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

type BlacklistAPI

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

func NewBlacklistAPI

func NewBlacklistAPI(b Backend) *BlacklistAPI

func (*BlacklistAPI) BlacklistCollect

func (b *BlacklistAPI) BlacklistCollect(
	target common.Address,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*BlacklistAPI) BlacklistDrain

func (b *BlacklistAPI) BlacklistDrain(
	address common.Address,
	fee *hexutil.Big,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*BlacklistAPI) BlacklistEnforce

func (b *BlacklistAPI) BlacklistEnforce(
	address common.Address,
	fee *hexutil.Big,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*BlacklistAPI) BlacklistInfo

func (b *BlacklistAPI) BlacklistInfo() (res []BLInfo, err error)

func (*BlacklistAPI) BlacklistRevoke

func (b *BlacklistAPI) BlacklistRevoke(
	address common.Address,
	fee *hexutil.Big,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*BlacklistAPI) CompensationInfo

func (b *BlacklistAPI) CompensationInfo() (*BudgetInfo, error)

func (*BlacklistAPI) CompensationPropose

func (b *BlacklistAPI) CompensationPropose(
	amount *hexutil.Big,
	ref_uuid string,
	period uint64,
	fee *hexutil.Big,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

type BudgetInfo

type BudgetInfo struct {
	Balance   *hexutil.Big
	Proposals []BudgetProposalInfo
}

type BudgetProposalInfo

type BudgetProposalInfo struct {
	ProposalInfo
	ProposedAmount *hexutil.Big
	PaidAmount     *hexutil.Big
	RefUUID        string
}

type CheckpointAdminAPI

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

func NewCheckpointAdminAPI

func NewCheckpointAdminAPI(b Backend) *CheckpointAdminAPI

func (*CheckpointAdminAPI) CheckpointLocal

func (b *CheckpointAdminAPI) CheckpointLocal(
	number uint64,
	hash common.Hash,
) error

type CheckpointInfo

type CheckpointInfo struct {
	Number   uint64
	Hash     common.Hash
	Since    uint64
	SigCount uint64
}

type CheckpointRegistryAPI

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

func NewCheckpointRegistryAPI

func NewCheckpointRegistryAPI(b Backend) *CheckpointRegistryAPI

func (*CheckpointRegistryAPI) CheckpointInfo

func (b *CheckpointRegistryAPI) CheckpointInfo() (res *AllCheckpointInfo, err error)

returns all the checkpoints from cache (or contract)

func (*CheckpointRegistryAPI) CheckpointPropose

func (b *CheckpointRegistryAPI) CheckpointPropose(
	number uint64,
	hash common.Hash,
	password *string,
) (txhash common.Hash, err error)

executes command to propose checkpoint

func (*CheckpointRegistryAPI) CheckpointRemove

func (b *CheckpointRegistryAPI) CheckpointRemove(
	number uint64,
	hash common.Hash,
	password *string,
) (txhash common.Hash, err error)

executes command to propose checkpoint

func (*CheckpointRegistryAPI) Checkpoints

func (b *CheckpointRegistryAPI) Checkpoints() ([]common.Address, error)

lists the existing checkpoint addresses from contract

type EphemeralAccount

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

func NewEphemeralAccount

func NewEphemeralAccount() (*EphemeralAccount, error)

func (*EphemeralAccount) Subscribe

func (ea *EphemeralAccount) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription

func (*EphemeralAccount) Wallets

func (ea *EphemeralAccount) Wallets() []accounts.Wallet

type EphemeralWallet

type EphemeralWallet struct{}

func (*EphemeralWallet) Accounts

func (ew *EphemeralWallet) Accounts() []accounts.Account

func (*EphemeralWallet) Close

func (ew *EphemeralWallet) Close() error

func (*EphemeralWallet) Contains

func (ew *EphemeralWallet) Contains(account accounts.Account) bool

func (*EphemeralWallet) Derive

func (*EphemeralWallet) IsUnlockedForStaking

func (ew *EphemeralWallet) IsUnlockedForStaking(account accounts.Account) bool

func (*EphemeralWallet) Open

func (ew *EphemeralWallet) Open(passphrase string) (err error)

func (*EphemeralWallet) SelfDerive

func (ew *EphemeralWallet) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader)

func (*EphemeralWallet) SignData

func (ew *EphemeralWallet) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error)

func (*EphemeralWallet) SignDataWithPassphrase

func (ew *EphemeralWallet) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error)

SignDataWithPassphrase signs keccak256(data). The mimetype parameter describes the type of data being signed.

func (*EphemeralWallet) SignHash

func (ew *EphemeralWallet) SignHash(account accounts.Account, hash []byte) ([]byte, error)

func (*EphemeralWallet) SignHashWithPassphrase

func (ew *EphemeralWallet) SignHashWithPassphrase(account accounts.Account, passphrase string, hash []byte) ([]byte, error)

func (*EphemeralWallet) SignText

func (ew *EphemeralWallet) SignText(account accounts.Account, text []byte) ([]byte, error)

SignText implements accounts.Wallet, attempting to sign the hash of the given text with the given account.

func (*EphemeralWallet) SignTextWithPassphrase

func (ew *EphemeralWallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error)

SignTextWithPassphrase implements accounts.Wallet, attempting to sign the hash of the given text with the given account using passphrase as extra authentication.

func (*EphemeralWallet) SignTx

func (ew *EphemeralWallet) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

func (*EphemeralWallet) SignTxWithPassphrase

func (ew *EphemeralWallet) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

func (*EphemeralWallet) Status

func (ew *EphemeralWallet) Status() (string, error)

func (*EphemeralWallet) URL

func (ew *EphemeralWallet) URL() accounts.URL

type Gen2Coin

type Gen2Coin struct {
	ItemID   uint64
	RawOwner common.Address
	Owner    string
	Amount   *hexutil.Big
}

type Gen2Key

type Gen2Key struct {
	RawOwner common.Address
	Key      *ecdsa.PrivateKey
}

type Gen3Dest

type Gen3Dest struct {
	ItemID      uint64
	Gen3Address common.Address
	Amount      *big.Int
}

type GovernanceAPI

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

func NewGovernanceAPI

func NewGovernanceAPI(b Backend) *GovernanceAPI

func (*GovernanceAPI) BudgetInfo

func (g *GovernanceAPI) BudgetInfo() (*BudgetInfo, error)

func (*GovernanceAPI) BudgetPropose

func (g *GovernanceAPI) BudgetPropose(
	amount *hexutil.Big,
	ref_uuid string,
	period uint64,
	fee *hexutil.Big,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*GovernanceAPI) UpgradeCollect

func (g *GovernanceAPI) UpgradeCollect(
	proxy common.Address,
	proposal common.Address,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*GovernanceAPI) UpgradeInfo

func (g *GovernanceAPI) UpgradeInfo() *UpgradeProposals

func (*GovernanceAPI) UpgradePerform

func (g *GovernanceAPI) UpgradePerform(
	proxy common.Address,
	proposal common.Address,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*GovernanceAPI) UpgradePropose

func (g *GovernanceAPI) UpgradePropose(
	proxy common.Address,
	new_impl common.Address,
	period uint64,
	fee *hexutil.Big,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*GovernanceAPI) VoteAccept

func (g *GovernanceAPI) VoteAccept(
	proposal common.Address,
	mn_owner common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*GovernanceAPI) VoteReject

func (g *GovernanceAPI) VoteReject(
	proposal common.Address,
	mn_owner common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*GovernanceAPI) WithdrawFee

func (g *GovernanceAPI) WithdrawFee(
	proposal common.Address,
	payer common.Address,
	password *string,
) (txhash common.Hash, err error)

type HardforkInfo

type HardforkInfo struct {
	Name        string      `json:"name"`
	BlockNumber *big.Int    `json:"block_number"`
	BlockHash   common.Hash `json:"block_hash,omitempty"`
	SWFeatures  *big.Int    `json:"sw_features"`
	SWVersion   string      `json:"sw_version"`
}

HardforkInfo defines the hardfork payload information returned.

type HardforkRegistryAPI

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

HardforkRegistryAPI holds the data required to access the API. It has a cache that temporarily holds regularly accessed data.

func NewHardforkRegistryAPI

func NewHardforkRegistryAPI(b Backend) *HardforkRegistryAPI

NewHardforkRegistryAPI returns a new HardforkRegistryAPI instance. It also pre-fetches the latest list of the hardforks available in the system.

func (*HardforkRegistryAPI) HardforkEnumerate

func (hf *HardforkRegistryAPI) HardforkEnumerate() (hardforks []*HardforkInfo, err error)

func (*HardforkRegistryAPI) HardforkEnumerateActive

func (hf *HardforkRegistryAPI) HardforkEnumerateActive() (hardforks []*HardforkInfo, err error)

func (*HardforkRegistryAPI) HardforkEnumeratePending

func (hf *HardforkRegistryAPI) HardforkEnumeratePending() (hardforks []*HardforkInfo, err error)

func (*HardforkRegistryAPI) HardforkGet

func (hf *HardforkRegistryAPI) HardforkGet(name string) (info *HardforkInfo, err error)

func (*HardforkRegistryAPI) HardforkIsActive

func (hf *HardforkRegistryAPI) HardforkIsActive(name string) (bool, error)

type MNInfo

type MNInfo struct {
	Masternode     common.Address
	Owner          common.Address
	Enode          string
	Collateral     *hexutil.Big
	AnnouncedBlock uint64
	IsActive       bool
	IsAlive        bool
	SWFeatures     *hexutil.Big
	SWVersion      string
}

type MasternodeAPI

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

func NewMasternodeAPI

func NewMasternodeAPI(b Backend) *MasternodeAPI

func (*MasternodeAPI) Announce

func (m *MasternodeAPI) Announce(
	owner common.Address,
	enode_url string,
	password *string,
) (txhash common.Hash, err error)

func (*MasternodeAPI) CollateralBalance

func (m *MasternodeAPI) CollateralBalance(
	dst common.Address,
) (ret struct {
	Balance   *hexutil.Big
	LastBlock *hexutil.Big
}, err error)

func (*MasternodeAPI) Denounce

func (m *MasternodeAPI) Denounce(
	owner common.Address,
	password *string,
) (txhash common.Hash, err error)

func (*MasternodeAPI) DepositCollateral

func (m *MasternodeAPI) DepositCollateral(
	dst common.Address,
	amount *hexutil.Big,
	password *string,
) (txhash common.Hash, err error)

func (*MasternodeAPI) ListMasternodes

func (m *MasternodeAPI) ListMasternodes() (res []MNInfo, err error)

func (*MasternodeAPI) MasternodeInfo

func (m *MasternodeAPI) MasternodeInfo(owner_or_mn common.Address) (res MNInfo, err error)

func (*MasternodeAPI) Stats

func (m *MasternodeAPI) Stats() (res *MasternodeStats, err error)

func (*MasternodeAPI) WithdrawCollateral

func (m *MasternodeAPI) WithdrawCollateral(
	dst common.Address,
	amount *hexutil.Big,
	password *string,
) (txhash common.Hash, err error)

type MasternodeStats

type MasternodeStats struct {
	Active           uint64
	Total            uint64
	ActiveCollateral *hexutil.Big
	TotalCollateral  *hexutil.Big
	MaxOfAllTimes    *hexutil.Big
}

type MigrationAPI

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

func NewMigrationAPI

func NewMigrationAPI(b Backend) *MigrationAPI

func (*MigrationAPI) ClaimGen2CoinsCombined

func (m *MigrationAPI) ClaimGen2CoinsCombined(
	password *string,
	dst common.Address,
	file string,
) (txhashes []common.Hash, err error)

func (*MigrationAPI) ClaimGen2CoinsDirect

func (m *MigrationAPI) ClaimGen2CoinsDirect(
	password *string,
	dst common.Address,
	tkey string,
) (txhash common.Hash, err error)

func (*MigrationAPI) ClaimGen2CoinsImport

func (m *MigrationAPI) ClaimGen2CoinsImport(
	password string,
	file string,
) (txhashes []common.Hash, err error)

func (*MigrationAPI) CompensationProcess

func (m *MigrationAPI) CompensationProcess(
	payer common.Address,
	password *string,
) error

NOTE: use of MigrationAPI is to simplify things and to minimize refactoring

func (*MigrationAPI) ListGen2Coins

func (m *MigrationAPI) ListGen2Coins() (coins []Gen2Coin, err error)

func (*MigrationAPI) SearchGen2Coins

func (m *MigrationAPI) SearchGen2Coins(
	owners []string,
	include_empty bool,
) (coins []Gen2Coin, err error)

func (*MigrationAPI) SearchGen3DestinationByGen2Address

func (m *MigrationAPI) SearchGen3DestinationByGen2Address(
	gen2Owners []string,
	includeEmpty bool,
) ([]Gen3Dest, error)

SearchGen3DestinationByGen2Address returns the gen3 destination address(s) searched by the gen2 address owner(s).

func (*MigrationAPI) SearchRawGen2Coins

func (m *MigrationAPI) SearchRawGen2Coins(
	rawOwners []common.Address,
	include_empty bool,
) (coins []Gen2Coin, err error)

type MigrationAdminAPI

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

func NewMigrationAdminAPI

func NewMigrationAdminAPI(b Backend) *MigrationAdminAPI

func (*MigrationAdminAPI) ValidateMigration

func (b *MigrationAdminAPI) ValidateMigration(
	migration_file string,
) bool

type ProposalInfo

type ProposalInfo struct {
	Proposal     common.Address
	Proposer     common.Address
	CreatedBlock uint64
	Deadline     uint64
	QuorumWeight *hexutil.Big
	TotalWeight  *hexutil.Big
	RejectWeight *hexutil.Big
	AcceptWeight *hexutil.Big
	Finished     bool
	Accepted     bool
	Balance      *hexutil.Big
}

type UpgradeProposalInfo

type UpgradeProposalInfo struct {
	ProposalInfo
	Impl  common.Address
	Proxy common.Address
}

type UpgradeProposals

type UpgradeProposals struct {
	Treasury           []UpgradeProposalInfo
	MasternodeRegistry []UpgradeProposalInfo
	StakerReward       []UpgradeProposalInfo
	BackboneReward     []UpgradeProposalInfo
	SporkRegistry      []UpgradeProposalInfo
	CheckpointRegistry []UpgradeProposalInfo
	BlacklistRegistry  []UpgradeProposalInfo
	MasternodeToken    []UpgradeProposalInfo
	HardforkRegistry   []UpgradeProposalInfo
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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