Documentation ¶
Index ¶
- Constants
- Variables
- func ChecksumAddress(address string) (string, bool)
- func NewAccountService(config *Config, client client.Client) server.AccountAPIServicer
- func NewBlockService(config *Config, rcpClient client.Client) server.BlockAPIServicer
- func NewCallService(config *Config, client client.Client) server.CallAPIServicer
- func NewConstructionService(config *Config, client client.Client) server.ConstructionAPIServicer
- func NewMempoolService(config *Config, client client.Client) server.MempoolAPIServicer
- func NewNetworkService(config *Config, client client.Client) server.NetworkAPIServicer
- type AccountService
- type BlockService
- type CallService
- type Config
- type ConstructionService
- func (s ConstructionService) ConstructionCombine(ctx context.Context, req *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error)
- func (s ConstructionService) ConstructionDerive(ctx context.Context, req *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error)
- func (s ConstructionService) ConstructionHash(ctx context.Context, req *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error)
- func (s ConstructionService) ConstructionMetadata(ctx context.Context, req *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error)
- func (s ConstructionService) ConstructionParse(ctx context.Context, req *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error)
- func (s ConstructionService) ConstructionPayloads(ctx context.Context, req *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error)
- func (s ConstructionService) ConstructionPreprocess(ctx context.Context, req *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error)
- func (s ConstructionService) ConstructionSubmit(ctx context.Context, req *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error)
- type GetTransactionReceiptInput
- type MempoolService
- type NetworkService
- func (s *NetworkService) NetworkList(ctx context.Context, request *types.MetadataRequest) (*types.NetworkListResponse, *types.Error)
- func (s *NetworkService) NetworkOptions(ctx context.Context, request *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error)
- func (s *NetworkService) NetworkStatus(ctx context.Context, request *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error)
Constants ¶
const ( ModeOffline = "offline" ModeOnline = "online" )
const ( NodeVersion = "1.5.3" MiddlewareVersion = "0.0.11" BlockchainName = "Avalanche" )
Variables ¶
var ( // Errors lists all available error types Errors = []*types.Error{ errNotImplemented, errNotSupported, errNotReady, errUnavailableOffline, errInternalError, errInvalidInput, errClientError, errBlockInvalidInput, errBlockNotFound, errCallInvalidMethod, } )
Functions ¶
func ChecksumAddress ¶ added in v0.0.7
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, rcpClient 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 ¶
func (s AccountService) AccountBalance( ctx context.Context, req *types.AccountBalanceRequest, ) (*types.AccountBalanceResponse, *types.Error)
AccountBalance implements the /account/balance endpoint
func (AccountService) AccountCoins ¶
func (s AccountService) AccountCoins( ctx context.Context, req *types.AccountCoinsRequest, ) (*types.AccountCoinsResponse, *types.Error)
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 ¶
func (s *BlockService) BlockTransaction( ctx context.Context, request *types.BlockTransactionRequest, ) (*types.BlockTransactionResponse, *types.Error)
BlockTransaction implements the /block/transaction endpoint.
type CallService ¶
type CallService struct {
// contains filtered or unexported fields
}
CallService implements /call/* endpoints
func (CallService) Call ¶
func (s CallService) Call( ctx context.Context, req *types.CallRequest, ) (*types.CallResponse, *types.Error)
Call implements the /call endpoint.
type Config ¶
type Config struct { Mode string ChainID *big.Int NetworkID *types.NetworkIdentifier GenesisBlockHash string AvaxAssetID string }
Config holds the service configuration
func (Config) IsOfflineMode ¶
IsOfflineMode returns true if running in offline mode
func (Config) IsOnlineMode ¶
IsOnlineMode returns true if running in online mode
type ConstructionService ¶
type ConstructionService struct {
// contains filtered or unexported fields
}
ConstructionService implements /construction/* endpoints
func (ConstructionService) ConstructionCombine ¶
func (s ConstructionService) ConstructionCombine( ctx context.Context, req *types.ConstructionCombineRequest, ) (*types.ConstructionCombineResponse, *types.Error)
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 ¶
func (s ConstructionService) ConstructionDerive( ctx context.Context, req *types.ConstructionDeriveRequest, ) (*types.ConstructionDeriveResponse, *types.Error)
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 ¶
func (s ConstructionService) ConstructionHash( ctx context.Context, req *types.ConstructionHashRequest, ) (*types.TransactionIdentifierResponse, *types.Error)
ConstructionHash implements /construction/hash endpoint.
TransactionHash returns the network-specific transaction hash for a signed transaction.
func (ConstructionService) ConstructionMetadata ¶
func (s ConstructionService) ConstructionMetadata( ctx context.Context, req *types.ConstructionMetadataRequest, ) (*types.ConstructionMetadataResponse, *types.Error)
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 ¶
func (s ConstructionService) ConstructionParse( ctx context.Context, req *types.ConstructionParseRequest, ) (*types.ConstructionParseResponse, *types.Error)
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 ¶
func (s ConstructionService) ConstructionPayloads( ctx context.Context, req *types.ConstructionPayloadsRequest, ) (*types.ConstructionPayloadsResponse, *types.Error)
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 ¶
func (s ConstructionService) ConstructionPreprocess( ctx context.Context, req *types.ConstructionPreprocessRequest, ) (*types.ConstructionPreprocessResponse, *types.Error)
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 ¶
func (s ConstructionService) ConstructionSubmit( ctx context.Context, req *types.ConstructionSubmitRequest, ) (*types.TransactionIdentifierResponse, *types.Error)
ConstructionSubmit implements /construction/submit endpoint.
Submit a pre-signed transaction to the node.
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 ¶
func (s MempoolService) Mempool( ctx context.Context, req *types.NetworkRequest, ) (*types.MempoolResponse, *types.Error)
Mempool implements the /mempool endpoint
func (MempoolService) MempoolTransaction ¶
func (s MempoolService) MempoolTransaction( ctx context.Context, req *types.MempoolTransactionRequest, ) (*types.MempoolTransactionResponse, *types.Error)
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