Documentation
¶
Index ¶
- Constants
- Variables
- func CreateAndFundAccount(ctx context.Context, submitterEngine engine.SubmitterEngine, ...) error
- func CreateChannelAccountsOnChain(ctx context.Context, submiterEngine engine.SubmitterEngine, ...) (newAccountAddresses []string, err error)
- func DeleteChannelAccountOnChain(ctx context.Context, submiterEngine engine.SubmitterEngine, ...) error
- func ViewChannelAccounts(ctx context.Context, dbConnectionPool db.DBConnectionPool) error
- type ChannelAccountsService
- func (s *ChannelAccountsService) CreateChannelAccounts(ctx context.Context, amount int) error
- func (s *ChannelAccountsService) DeleteChannelAccount(ctx context.Context, opts DeleteChannelAccountsOptions) error
- func (s *ChannelAccountsService) EnsureChannelAccountsCount(ctx context.Context, numAccountsToEnsure int) error
- func (s *ChannelAccountsService) GetChannelAccountStore() store.ChannelAccountStore
- func (s *ChannelAccountsService) VerifyChannelAccounts(ctx context.Context, deleteInvalidAccounts bool) error
- type DeleteChannelAccountsOptions
Constants ¶
const CreateAndFundAccountRetryAttempts = 5
CreateAndFundAccountRetryAttempts is the maximum number of attempts to create and fund an account on the Stellar network.
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.
const MaxNumberOfChannelAccounts = 1000
MaxNumberOfChannelAccounts is the limit for the number of accounts tx submission service should manage.
const MaximumCreateAccountOperationsPerStellarTx = 19
MaximumCreateAccountOperationsPerStellarTx is the max number of sponsored accounts we can create in one transaction due to the signature limit.
const MinNumberOfChannelAccounts = 1
MinNumberOfChannelAccounts is the minimum number of accounts tx submission service should manage.
Variables ¶
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.