services

package
v0.0.0-...-fd95350 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Errors contains all errors that could be returned
	// by this Rosetta implementation.
	Errors = []*types.Error{
		ErrUnimplemented,
		ErrUnavailableOffline,
		ErrFury,

		ErrNoOperations,
		ErrInvalidCurrencyAmount,
		ErrUnsupportedCurrency,
		ErrUnclearIntent,
		ErrInvalidAddress,
		ErrInvalidOptions,
		ErrInvalidMetadata,

		ErrUnsupportedCurveType,
		ErrPublicKeyNil,
		ErrMissingPublicKey,
		ErrInvalidPublicKey,
		ErrInvalidTx,
	}

	// ErrUnimplemented is returned when an endpoint
	// is called that is not implemented.
	ErrUnimplemented = &types.Error{
		Code:    0,
		Message: "Endpoint not implemented",
	}

	// ErrUnavailableOffline is returned when an endpoint
	// is called that is not available offline.
	ErrUnavailableOffline = &types.Error{
		Code:    1,
		Message: "Endpoint unavailable offline",
	}

	// ErrFury is returned when fury
	// errors on a request.
	ErrFury = &types.Error{
		Code:    2,
		Message: "Fury error",
	}

	// ErrNoOperations is returned when no operations are provided
	ErrNoOperations = &types.Error{
		Code:    3,
		Message: "No operations provided",
	}

	// ErrInvalidCurrencyAmount is returned when a currency value could not be parsed
	ErrInvalidCurrencyAmount = &types.Error{
		Code:    4,
		Message: "Invalid currency",
	}

	// ErrUnsupportedCurrency is returned when a currency symbol is invalid
	// or the decimals do not match
	ErrUnsupportedCurrency = &types.Error{
		Code:    5,
		Message: "Unsupported concurrency",
	}

	// ErrUnclearIntent is returned when operations
	// provided in /construction/preprocess or /construction/payloads
	// are not valid.
	ErrUnclearIntent = &types.Error{
		Code:    6,
		Message: "Unable to parse intent",
	}

	// ErrInvalidAddress is returned when an account identifier has an invalid address
	ErrInvalidAddress = &types.Error{
		Code:    7,
		Message: "Invalid address",
	}

	// ErrInvalidOptions is returned by the metadata endpoint with invalid options
	ErrInvalidOptions = &types.Error{
		Code:    8,
		Message: "Invalid options",
	}

	// ErrInvalidMetadata is returned by the metadata endpoint with invalid options
	ErrInvalidMetadata = &types.Error{
		Code:    9,
		Message: "Invalid metadata",
	}

	// ErrUnsupportedCurveType is returned when a public key curve type is not supported
	ErrUnsupportedCurveType = &types.Error{
		Code:    10,
		Message: "Unsupported Curve Type",
	}

	// ErrPublicKeyNil is returned when a public key is not provided
	ErrPublicKeyNil = &types.Error{
		Code:    11,
		Message: "Public Key is nil",
	}

	// ErrInvalidPublicKey is returned when a public key is an invalid or could not be parsed
	ErrInvalidPublicKey = &types.Error{
		Code:    12,
		Message: "Invalid Public Key",
	}

	// ErrMissingPublicKey is returned when a public key is missing from a request
	ErrMissingPublicKey = &types.Error{
		Code:    13,
		Message: "Missing Public Key",
	}

	// ErrInvalidTx is returned by invalid transactions.
	ErrInvalidTx = &types.Error{
		Code:    14,
		Message: "Invalid transaction",
	}

	// ErrMissingSignature is returned by invalid transactions.
	ErrMissingSignature = &types.Error{
		Code:    15,
		Message: "Missing Signature",
	}
)

Functions

func NewBlockchainRouter

func NewBlockchainRouter(
	config *configuration.Configuration,
	client Client,
	asserter *asserter.Asserter,
) http.Handler

NewBlockchainRouter creates a Mux http.Handler from a collection of server controllers.

func NewMempoolAPIService

func NewMempoolAPIService() server.MempoolAPIServicer

NewMempoolAPIService creates a new instance of a MempoolAPIService.

Types

type AccountAPIService

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

AccountAPIService implements the server.AccountAPIServicer interface.

func NewAccountAPIService

func NewAccountAPIService(
	cfg *configuration.Configuration,
	client Client,
) *AccountAPIService

NewAccountAPIService returns a new *AccountAPIService.

func (*AccountAPIService) AccountBalance

AccountBalance implements /account/balance.

func (*AccountAPIService) AccountCoins

AccountCoins implements /account/coins.

type BlockAPIService

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

BlockAPIService implements the server.BlockAPIServicer interface.

func NewBlockAPIService

func NewBlockAPIService(
	cfg *configuration.Configuration,
	client Client,
) *BlockAPIService

NewBlockAPIService creates a new instance of a BlockAPIService.

func (*BlockAPIService) Block

Block implements the /block endpoint.

func (*BlockAPIService) BlockTransaction

BlockTransaction implements the /block/transaction endpoint.

type CallAPIService

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

CallAPIService implements the server.CallAPIServicer interface.

func NewCallAPIService

func NewCallAPIService(cfg *configuration.Configuration, client Client) *CallAPIService

NewCallAPIService creates a new instance of a CallAPIService.

func (*CallAPIService) Call

func (s *CallAPIService) Call(
	ctx context.Context,
	request *types.CallRequest,
) (*types.CallResponse, *types.Error)

Call implements the /call endpoint.

type Client

Client is used services to get blockchain data and submit transactions.

type ConstructionAPIService

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

ConstructionAPIService implements the server.ConstructionAPIServicer interface.

func NewConstructionAPIService

func NewConstructionAPIService(
	cfg *configuration.Configuration,
	client Client,
	encodingConfig params.EncodingConfig,
) *ConstructionAPIService

NewConstructionAPIService creates a new instance of a ConstructionAPIService.

func (*ConstructionAPIService) ConstructionCombine

ConstructionCombine implements the /construction/combine endpoint.

func (*ConstructionAPIService) ConstructionDerive

ConstructionDerive implements the /construction/derive endpoint.

func (*ConstructionAPIService) ConstructionHash

ConstructionHash implements the /construction/hash endpoint.

func (*ConstructionAPIService) ConstructionMetadata

ConstructionMetadata implements the /construction/metadata endpoint.

func (*ConstructionAPIService) ConstructionParse

ConstructionParse implements the /construction/parse endpoint. TODO: improve endpoint validate transactions

func (*ConstructionAPIService) ConstructionPayloads

ConstructionPayloads implements the /construction/payloads endpoint.

func (*ConstructionAPIService) ConstructionPreprocess

ConstructionPreprocess implements the /construction/preprocess endpoint.

func (*ConstructionAPIService) ConstructionSubmit

ConstructionSubmit implements the /construction/submit endpoint.

type MempoolAPIService

type MempoolAPIService struct {
}

MempoolAPIService implements the server.MempoolAPIServicer interface.

func (*MempoolAPIService) Mempool

Mempool implements the /mempool endpoint.

func (*MempoolAPIService) MempoolTransaction

MempoolTransaction implements the /mempool/transaction endpoint.

type NetworkAPIService

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

NetworkAPIService implements the server.NetworkAPIServicer interface.

func NewNetworkAPIService

func NewNetworkAPIService(
	cfg *configuration.Configuration,
	client Client,
) *NetworkAPIService

NewNetworkAPIService creates a new instance of a NetworkAPIService.

func (*NetworkAPIService) NetworkList

NetworkList implements the /network/list endpoint

func (*NetworkAPIService) NetworkOptions

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

NetworkOptions implements the /network/options endpoint.

func (*NetworkAPIService) NetworkStatus

NetworkStatus implements the /network/status endpoint.

Jump to

Keyboard shortcuts

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