services

package
v0.0.0-...-43207eb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Sufficient to cover three average ledger close time.
	CreateAccountTxnTimeBounds             = 18
	CreateAccountTxnTimeBoundsSafetyMargin = 12
)

Variables

View Source
var (
	ErrAccountAlreadyExists                = errors.New("account already exists")
	ErrSponsorshipLimitExceeded            = errors.New("sponsorship limit exceeded")
	ErrAccountNotEligibleForBeingSponsored = errors.New("account not eligible for being sponsored")
	ErrFeeExceedsMaximumBaseFee            = errors.New("fee exceeds maximum base fee to sponsor")
	ErrNoSignaturesProvided                = errors.New("should have at least one signature")
)
View Source
var (
	ErrInvalidPrivateKeyProvided   = errors.New("invalid private key provided")
	ErrMismatchDistributionAccount = errors.New("mismatch distribution account")
)
View Source
var PageLimit = 200

Functions

func NewAccountService

func NewAccountService(models *data.Models) (*accountService, error)

func NewAccountSponsorshipService

func NewAccountSponsorshipService(opts AccountSponsorshipServiceOptions) (*accountSponsorshipService, error)

func NewChannelAccountService

func NewChannelAccountService(opts ChannelAccountServiceOptions) (*channelAccountService, error)

func NewIngestService

func NewIngestService(
	models *data.Models,
	ledgerCursorName string,
	appTracker apptracker.AppTracker,
	rpcService RPCService,
	tssRouter tssrouter.Router,
	tssStore tssstore.Store,
) (*ingestService, error)

func NewKMSImportService

func NewKMSImportService(client kmsiface.KMSAPI, kmsKeyARN string, keypairStore store.KeypairStore, distributionAccountPublicKey string) (*kmsImportService, error)

func NewPaymentService

func NewPaymentService(models *data.Models, serverBaseURL string) (*paymentService, error)

func NewRPCService

func NewRPCService(rpcURL string, httpClient utils.HTTPClient) (*rpcService, error)

Types

type AccountService

type AccountService interface {
	// RegisterAccount registers an externally created Stellar account to be sponsored, and tracked by ingestion
	RegisterAccount(ctx context.Context, address string) error
	// DeregisterAccount deregisters a Stellar account, no longer sponsoring its transactions, nor tracking it on ingestion
	DeregisterAccount(ctx context.Context, address string) error
}

type AccountSponsorshipService

type AccountSponsorshipService interface {
	SponsorAccountCreationTransaction(ctx context.Context, address string, signers []entities.Signer, supportedAssets []entities.Asset) (string, string, error)
	WrapTransaction(ctx context.Context, tx *txnbuild.Transaction) (string, string, error)
}

type AccountSponsorshipServiceOptions

type AccountSponsorshipServiceOptions struct {
	DistributionAccountSignatureClient signing.SignatureClient
	ChannelAccountSignatureClient      signing.SignatureClient
	HorizonClient                      horizonclient.ClientInterface
	MaxSponsoredBaseReserves           int
	BaseFee                            int64
	Models                             *data.Models
	BlockedOperationsTypes             []xdr.OperationType
}

func (*AccountSponsorshipServiceOptions) Validate

type ChannelAccountService

type ChannelAccountService interface {
	EnsureChannelAccounts(ctx context.Context, number int64) error
}

type ChannelAccountServiceOptions

type ChannelAccountServiceOptions struct {
	DB                                 db.ConnectionPool
	HorizonClient                      horizonclient.ClientInterface
	BaseFee                            int64
	DistributionAccountSignatureClient signing.SignatureClient
	ChannelAccountStore                store.ChannelAccountStore
	PrivateKeyEncrypter                signingutils.PrivateKeyEncrypter
	EncryptionPassphrase               string
}

func (*ChannelAccountServiceOptions) Validate

func (o *ChannelAccountServiceOptions) Validate() error

type ErrOperationNotAllowed

type ErrOperationNotAllowed struct {
	OperationType xdr.OperationType
}

func (ErrOperationNotAllowed) Error

func (e ErrOperationNotAllowed) Error() string

type IngestService

type IngestService interface {
	Run(ctx context.Context, startLedger uint32, endLedger uint32) error
}

type KMSImportService

type KMSImportService interface {
	ImportDistributionAccountKey(ctx context.Context, distributionAccountSeed string) error
}

type PaymentService

type PaymentService interface {
	GetPaymentsPaginated(ctx context.Context, address string, beforeID, afterID string, sort data.SortOrder, limit int) ([]data.Payment, entities.Pagination, error)
}

type RPCService

type RPCService interface {
	GetTransaction(transactionHash string) (entities.RPCGetTransactionResult, error)
	GetTransactions(startLedger int64, startCursor string, limit int) (entities.RPCGetTransactionsResult, error)
	SendTransaction(transactionXDR string) (entities.RPCSendTransactionResult, error)
	GetHealth() (entities.RPCGetHealthResult, error)
}

type RPCServiceMock

type RPCServiceMock struct {
	mock.Mock
}

func (*RPCServiceMock) GetHealth

func (r *RPCServiceMock) GetHealth() (entities.RPCGetHealthResult, error)

func (*RPCServiceMock) GetTransaction

func (r *RPCServiceMock) GetTransaction(transactionHash string) (entities.RPCGetTransactionResult, error)

func (*RPCServiceMock) GetTransactions

func (r *RPCServiceMock) GetTransactions(startLedger int64, startCursor string, limit int) (entities.RPCGetTransactionsResult, error)

func (*RPCServiceMock) SendTransaction

func (r *RPCServiceMock) SendTransaction(transactionXdr string) (entities.RPCSendTransactionResult, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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