service

package
v0.0.0-...-778b29f Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeOffline        = "offline"
	ModeOnline         = "online"
	StandardIngestion  = "standard"
	AnalyticsIngestion = "analytics"
)
View Source
const (
	MiddlewareVersion = "0.1.12"
	BlockchainName    = "Candle"
)
View Source
const BalanceOfMethodPrefix = "0x70a08231000000000000000000000000"

Variables

View Source
var (
	// Errors lists all available error types
	Errors = []*types.Error{
		errNotReady,
		errNotImplemented,
		errNotSupported,
		errUnavailableOffline,
		errInternalError,
		errInvalidInput,
		errClientError,
		errBlockInvalidInput,
		errBlockNotFound,
		errCallInvalidMethod,
		errCallInvalidParams,
	}
)
View Source
var NodeVersion = fmt.Sprintf(
	"%d.%d.%d",
	version.Current.Major,
	version.Current.Minor,
	version.Current.Patch,
)

Functions

func ChecksumAddress

func ChecksumAddress(address string) (string, bool)

ChecksumAddress ensures an Ethereum hex address is in Checksum Format. If the address cannot be converted, it returns !ok.

func NewAccountService

func NewAccountService(config *Config, client client.Client) server.AccountAPIServicer

NewAccountService returns a new network servicer

func NewBlockService

func NewBlockService(config *Config, c client.Client) server.BlockAPIServicer

NewBlockService returns a new block servicer

func NewCallService

func NewCallService(config *Config, client client.Client) server.CallAPIServicer

NewCallService returns a new call servicer

func NewConstructionService

func NewConstructionService(config *Config, client client.Client) server.ConstructionAPIServicer

NewConstructionService returns a new construction servicer

func NewMempoolService

func NewMempoolService(config *Config, client client.Client) server.MempoolAPIServicer

NewMempoolService returns a new mempool servicer

func NewNetworkService

func NewNetworkService(config *Config, client client.Client) server.NetworkAPIServicer

NewNetworkService returns a new network servicer

Types

type AccountService

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

AccountService implements the /account/* endpoints

func (AccountService) AccountBalance

AccountBalance implements the /account/balance endpoint

func (AccountService) AccountCoins

AccountCoins implements the /account/coins endpoint

type BlockService

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

BlockService implements the /block/* endpoints

func (*BlockService) Block

func (s *BlockService) Block(
	ctx context.Context,
	request *types.BlockRequest,
) (*types.BlockResponse, *types.Error)

Block implements the /block endpoint

func (*BlockService) BlockTransaction

BlockTransaction implements the /block/transaction endpoint.

type CallService

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

CallService implements /call/* endpoints

func (CallService) Call

Call implements the /call endpoint.

type Config

type Config struct {
	Mode               string
	ChainID            *big.Int
	NetworkID          *types.NetworkIdentifier
	GenesisBlockHash   string
	AvaxAssetID        string
	IngestionMode      string
	TokenWhiteList     []string
	IndexUnknownTokens bool

	// Upgrade Times
	AP5Activation uint64
}

Config holds the service configuration

func (Config) IsAnalyticsMode

func (c Config) IsAnalyticsMode() bool

IsAnalyticsMode returns true if running in analytics ingestion mode

func (Config) IsOfflineMode

func (c Config) IsOfflineMode() bool

IsOfflineMode returns true if running in offline mode

func (Config) IsOnlineMode

func (c Config) IsOnlineMode() bool

IsOnlineMode returns true if running in online mode

func (Config) IsStandardMode

func (c Config) IsStandardMode() bool

IsStandardMode returns true if running in standard ingestion mode

func (Config) IsTokenListEmpty

func (c Config) IsTokenListEmpty() bool

IsTokenListEmpty returns true if the token addresses list is empty

func (Config) Signer

func (c Config) Signer() ethtypes.Signer

Signer returns an eth signer object for a given chain

type ConstructionService

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

ConstructionService implements /construction/* endpoints

func (ConstructionService) ConstructionCombine

ConstructionCombine implements /construction/combine endpoint.

Combine creates a network-specific transaction from an unsigned transaction and an array of provided signatures. The signed transaction returned from this method will be sent to the /construction/submit endpoint by the caller.

func (ConstructionService) ConstructionDerive

ConstructionDerive implements /construction/derive endpoint.

Derive returns the AccountIdentifier associated with a public key. Blockchains that require an on-chain action to create an account should not implement this method.

func (ConstructionService) ConstructionHash

ConstructionHash implements /construction/hash endpoint.

TransactionHash returns the network-specific transaction hash for a signed transaction.

func (ConstructionService) ConstructionMetadata

ConstructionMetadata implements /construction/metadata endpoint.

Get any information required to construct a transaction for a specific network. Metadata returned here could be a recent hash to use, an account sequence number, or even arbitrary chain state. The request used when calling this endpoint is created by calling /construction/preprocess in an offline environment.

func (ConstructionService) ConstructionParse

ConstructionParse implements /construction/parse endpoint

Parse is called on both unsigned and signed transactions to understand the intent of the formulated transaction. This is run as a sanity check before signing (after /construction/payloads) and before broadcast (after /construction/combine).

func (ConstructionService) ConstructionPayloads

ConstructionPayloads implements /construction/payloads endpoint

Payloads is called with an array of operations and the response from /construction/metadata. It returns an unsigned transaction blob and a collection of payloads that must be signed by particular AccountIdentifiers using a certain SignatureType. The array of operations provided in transaction construction often times can not specify all "effects" of a transaction (consider invoked transactions in Ethereum). However, they can deterministically specify the "intent" of the transaction, which is sufficient for construction. For this reason, parsing the corresponding transaction in the Data API (when it lands on chain) will contain a superset of whatever operations were provided during construction.

func (ConstructionService) ConstructionPreprocess

ConstructionPreprocess implements /construction/preprocess endpoint.

Preprocess is called prior to /construction/payloads to construct a request for any metadata that is needed for transaction construction given (i.e. account nonce).

func (ConstructionService) ConstructionSubmit

ConstructionSubmit implements /construction/submit endpoint.

Submit a pre-signed transaction to the node.

func (ConstructionService) CreateOperationDescription

func (s ConstructionService) CreateOperationDescription(
	operations []*types.Operation,
) ([]*parser.OperationDescription, error)

type GetTransactionReceiptInput

type GetTransactionReceiptInput struct {
	TxHash string `json:"tx_hash"`
}

GetTransactionReceiptInput is the input to the call method "eth_getTransactionReceipt".

type MempoolService

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

MempoolService implements the /mempool/* endpoints

func (MempoolService) Mempool

Mempool implements the /mempool endpoint

func (MempoolService) MempoolTransaction

MempoolTransaction implements the /mempool/transaction endpoint

type NetworkService

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

NetworkService implements all /network endpoints

func (*NetworkService) NetworkList

func (s *NetworkService) NetworkList(
	ctx context.Context,
	request *types.MetadataRequest,
) (*types.NetworkListResponse, *types.Error)

NetworkList implements the /network/list endpoint

func (*NetworkService) NetworkOptions

func (s *NetworkService) NetworkOptions(
	ctx context.Context,
	request *types.NetworkRequest,
) (*types.NetworkOptionsResponse, *types.Error)

NetworkOptions implements the /network/options endpoint

func (*NetworkService) NetworkStatus

func (s *NetworkService) NetworkStatus(
	ctx context.Context,
	request *types.NetworkRequest,
) (*types.NetworkStatusResponse, *types.Error)

NetworkStatus implements the /network/status endpoint

Jump to

Keyboard shortcuts

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