services

package
v0.0.0-...-9cf9cea Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CreateAndFundAccountRetryAttempts = 5

CreateAndFundAccountRetryAttempts is the maximum number of attempts to create and fund an account on the Stellar network.

View Source
const DefaultRevokeSponsorshipReserveAmount = "1.5"

DefaultRevokeSponsorshipReserveAmount is the amount of the native asset that the sponsoring account will send to the sponsored account to cover the reserve that is needed to for revoking account sponsorship. The amount will be sent back to the sponsoring account once the sponsored account is deleted onchain.

View Source
const MaxNumberOfChannelAccounts = 1000

MaxNumberOfChannelAccounts is the limit for the number of accounts tx submission service should manage.

View Source
const MaximumCreateAccountOperationsPerStellarTx = 19

MaximumCreateAccountOperationsPerStellarTx is the max number of sponsored accounts we can create in one transaction due to the signature limit.

View Source
const MinNumberOfChannelAccounts = 1

MinNumberOfChannelAccounts is the minimum number of accounts tx submission service should manage.

Variables

View Source
var ErrInvalidNumOfChannelAccountsToCreate = errors.New("invalid number of channel accounts to create")

Functions

func CreateAndFundAccount

func CreateAndFundAccount(ctx context.Context, submitterEngine engine.SubmitterEngine, amountNativeAssetToSend int, sourceAcc, destinationAcc string) error

CreateAndFundAccount creates and funds a new destination account on the Stellar network with the given amount of native asset from the source account.

func CreateChannelAccountsOnChain

func CreateChannelAccountsOnChain(ctx context.Context, submiterEngine engine.SubmitterEngine, numOfChanAccToCreate int) (newAccountAddresses []string, err error)

CreateChannelAccountsOnChain will create up to 19 accounts per Transaction due to the 20 signatures per tx limit This is also a good opportunity to periodically write the generated accounts to persistent storage if generating large amounts of channel accounts.

func DeleteChannelAccountOnChain

func DeleteChannelAccountOnChain(ctx context.Context, submiterEngine engine.SubmitterEngine, chAccAddress string) error

DeleteChannelAccountOnChain creates, signs, and broadcasts a transaction to delete a channel account onchain.

func ViewChannelAccounts

func ViewChannelAccounts(ctx context.Context, dbConnectionPool db.DBConnectionPool) error

ViewChannelAccounts prints all the database channel accounts.

Types

type ChannelAccountsService

type ChannelAccountsService struct {
	engine.SubmitterEngine

	TSSDBConnectionPool db.DBConnectionPool
	// contains filtered or unexported fields
}

func (*ChannelAccountsService) CreateChannelAccounts

func (s *ChannelAccountsService) CreateChannelAccounts(ctx context.Context, amount int) error

CreateChannelAccounts creates the specified number of channel accounts on the network and stores them in the database.

func (*ChannelAccountsService) DeleteChannelAccount

func (s *ChannelAccountsService) DeleteChannelAccount(ctx context.Context, opts DeleteChannelAccountsOptions) error

DeleteChannelAccount removes the specofied channel accounts rom the database and the network.

func (*ChannelAccountsService) EnsureChannelAccountsCount

func (s *ChannelAccountsService) EnsureChannelAccountsCount(ctx context.Context, numAccountsToEnsure int) error

EnsureChannelAccountsCount ensures that the number of channel accounts in the database is equal to the number specified in the parameter.

func (*ChannelAccountsService) GetChannelAccountStore

func (s *ChannelAccountsService) GetChannelAccountStore() store.ChannelAccountStore

func (*ChannelAccountsService) VerifyChannelAccounts

func (s *ChannelAccountsService) VerifyChannelAccounts(ctx context.Context, deleteInvalidAccounts bool) error

VerifyChannelAccounts verifies that all the database channel accounts exist on the network. If the deleteInvalidAccounts flag is set to true, it will delete these invalid accounts from the database.

type DeleteChannelAccountsOptions

type DeleteChannelAccountsOptions struct {
	ChannelAccountID  string
	DeleteAllAccounts bool
}

Jump to

Keyboard shortcuts

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