services

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 18 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,
		ErrKlaytnClient,
		ErrUnableToDecompressPubkey,
		ErrUnclearIntent,
		ErrUnableToParseIntermediateResult,
		ErrSignatureInvalid,
		ErrBroadcastFailed,
		ErrCallParametersInvalid,
		ErrCallOutputMarshal,
		ErrCallMethodInvalid,
		ErrInvalidAddress,
		ErrKlaytnClientNotReady,
		ErrInvalidInput,
		ErrNotSupportedAPI,
		ErrGetAccountAPI,
		ErrAccountType,
		ErrDeriveAddress,
		ErrDerivedAddrNotMatched,
		ErrXYPoint,
		ErrDiffPubKey,
		ErrExtractAddress,
		ErrAccountKeyFail,
		ErrMultiSigNotIncludePubKey,
		ErrRoleBasedNotIncludePubKey,
		ErrInvalidPubKey,
		ErrInvalidFrom,
	}

	// 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",
	}

	// ErrKlaytnClient is returned when Klaytn Node
	// errors on a request.
	ErrKlaytnClient = &types.Error{
		Code:      2,
		Message:   "klaytn client error",
		Retriable: true,
	}

	// ErrUnableToDecompressPubkey is returned when
	// the *types.PublicKey provided in /construction/derive
	// cannot be decompressed.
	ErrUnableToDecompressPubkey = &types.Error{
		Code:    3,
		Message: "unable to decompress public key",
	}

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

	// ErrUnableToParseIntermediateResult is returned
	// when a data structure passed between Construction
	// API calls is not valid.
	ErrUnableToParseIntermediateResult = &types.Error{
		Code:    5,
		Message: "Unable to parse intermediate result",
	}

	// ErrSignatureInvalid is returned when a signature
	// cannot be parsed.
	ErrSignatureInvalid = &types.Error{
		Code:    6,
		Message: "Signature invalid",
	}

	// ErrBroadcastFailed is returned when transaction
	// broadcast fails.
	ErrBroadcastFailed = &types.Error{
		Code:    7,
		Message: "Unable to broadcast transaction",
	}

	// ErrCallParametersInvalid is returned when
	// the parameters for a particular call method
	// are considered invalid.
	ErrCallParametersInvalid = &types.Error{
		Code:    8,
		Message: "Call parameters invalid",
	}

	// ErrCallOutputMarshal is returned when the output
	// for /call cannot be marshaled.
	ErrCallOutputMarshal = &types.Error{
		Code:    9,
		Message: "Call output marshal failed",
	}

	// ErrCallMethodInvalid is returned when a /call
	// method is invalid.
	ErrCallMethodInvalid = &types.Error{
		Code:    10,
		Message: "Call method invalid",
	}

	// ErrInvalidAddress is returned when an address
	// is not valid.
	ErrInvalidAddress = &types.Error{
		Code:    12,
		Message: "Invalid address",
	}

	// ErrKlaytnClientNotReady is returned when Klaytn client
	// cannot yet serve any queries.
	ErrKlaytnClientNotReady = &types.Error{
		Code:      13,
		Message:   "Klaytn client not ready",
		Retriable: true,
	}

	// ErrInvalidInput is returned when client
	// has provided invalid input
	ErrInvalidInput = &types.Error{
		Code:    14,
		Message: "invalid input",
	}

	// ErrNotSupportedAPI is returned when
	// the API endpoint is not supported by rosetta-klaytn.
	ErrNotSupportedAPI = &types.Error{
		Code:    15,
		Message: "not supported API",
	}

	// ErrGetAccountAPI is returned when
	// the rosetta-klaytn cannot get an account
	// via klay_getAccount API.
	ErrGetAccountAPI = &types.Error{
		Code:    16,
		Message: "Unable to get an account info",
	}

	// ErrAccountType is returned when
	// the account type is neither LegacyAccount nor EOA.
	ErrAccountType = &types.Error{
		Code:    17,
		Message: "not supported account type",
	}

	// ErrDeriveAddress is returned if an error is returned during
	// deriving an address from the public key.
	ErrDeriveAddress = &types.Error{
		Code:    18,
		Message: "cannot derive an address from the public key",
	}

	// ErrDerivedAddrNotMatched is returned if the account associated
	// with the address sent by the user in the metadata field
	// has AccountKeyLegacy as accountKey,
	// and the address derived from the public key
	// does not match the one sent by the user in the metadata field.
	ErrDerivedAddrNotMatched = &types.Error{
		Code:    19,
		Message: "derived address from the public key does not match with the address in the metadata",
	}

	// ErrXYPoint is returned when failed to extract x and y point.
	ErrXYPoint = &types.Error{
		Code:    20,
		Message: "Unable to get x, y point from public key",
	}

	// ErrDiffPubKey is returned when public key parameter is different
	// with a public key in Klaytn account.
	ErrDiffPubKey = &types.Error{
		Code:    21,
		Message: "pubilc key does not match",
	}

	// ErrExtractAddress is returned when fail to get an address from metadata.
	ErrExtractAddress = &types.Error{
		Code:    22,
		Message: "address string could not be extracted from the metadata",
	}

	// ErrAccountKeyFail is returned when an account key of the Klaytn account is AccountKeyFail.
	ErrAccountKeyFail = &types.Error{
		Code:    23,
		Message: "Klaytn account with AccountKeyFail cannot be used",
	}

	// ErrMultiSigNotIncludePubKey is returned when the AccountKeyWeightedMultiSig does not include
	// the public key that user pass as a parameter.
	ErrMultiSigNotIncludePubKey = &types.Error{
		Code:    24,
		Message: "AccountKeyWeightedMultiSig does not include public key passed as a parameter",
	}

	// ErrRoleBasedNotIncludePubKey is returned when the AccountKeyRoleBased does not include
	// the public key that user pass as a parameter in the RoleTransactionKey.
	ErrRoleBasedNotIncludePubKey = &types.Error{
		Code:    25,
		Message: "AccountKeyRoleBased does not include public key passed as a parameter in the RoleTransactionKey",
	}

	// ErrInvalidPubKey is returned when the public key is invalid.
	ErrInvalidPubKey = &types.Error{
		Code:    26,
		Message: "public key is invalid",
	}

	// ErrInvalidFrom is returned when from address is invalid
	ErrInvalidFrom = &types.Error{
		Code:    27,
		Message: "from address is invalid",
	}
)

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(
	config *configuration.Configuration,
	client Client,
) 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 by the services to get block data and to 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,
) *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.

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 {
	// contains filtered or unexported fields
}

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